Hi, I have a framing question, I am framing some documents with @explicit: true
. For properties that have literal value I usually add foo: { @default: "" / null / 0 / false }
when I include them in the frame, but I'm not sure what would be correct for language containers, i.e. for the document
{
"@context": {
"foo": { "@id": "http://example.org/foo", "@container": "@language" }
},
"@id": "http://example.org/1",
"foo": { "en": "foo", "nb": "føø" }
}
the frame
{
"@context": {
"foo": { "@id": "http://example.org/foo", "@container": "@language" }
},
"@explicit": true,
"foo": ""
}
gives me the behavior I want, but it seems a bit random to set the property value to the empty string, when that is never a valid value. What would be the canonical way of handling this?
I have a question about data consistency. So, I really like the fact that I can specify "@container": "@set"
for a property in my context like so:
{ "myProperty": { "@id": "ns:myProperty", "@container": "@set" } }
And this ensures that the value is always an array after compaction.
Does there exist some similar way to say that the value should always be in an object? So, currently, if a value is a string and it has no other properties, then I get
{ "name": "Andy" }
If the string also has, say, a language associated with it, I would instead get
{
"name": {
"@value": "Andy",
"@language": "en"
}
}
Is there a way to specify the aliased property name
in the context such that I get the following for the first example:
{
"name": {
"@value": "Andy"
}
}
I've played around with @container: @language
, but that's not really what I'm looking for.
I hope this makes sense. Thanks in advance.
base
has property a, that has some stuff in it base.a.a
whereas subtype sub1
adds another property to base.a
: sub1.a.b
credentialSubject
field is defined to be of type @id
https://www.w3.org/2018/credentials/v1 , but in the examples given at https://www.w3.org/TR/vc-data-model/#credential-subject it is variously a JSON object and a JSON array
credentialSubject
the fact the the context (not vocabulary) say's it's of type @id
means that string values of credentialSubject
should be interpreted as IRIs, represented in expanded form as an object with a single @id
property.
@id
. Note that the context is not a schema language, just a way to make sure that values are interpreted properly.
Hi everyone, I am looking for a tool that can take a JSON file (not a valid JSON-LD) plus a JSON-LD context as described in https://w3c.github.io/json-ld-syntax/#interpreting-json-as-json-ld and to output Turtle (or expanded JSON-LD or N-Triples, for example, so that it's easy to convert them to Turtle). I tried https://json-ld.org/playground/, http://rdf.greggkellogg.net/distiller, https://github.com/digitalbazaar/jsonld-cli but they all seem to be able to compact a JSON-LD context only when provided with a file that is already in JSON-LD format.
My use-case is to take a JSON output of the tool that only produces JSON and might not wish to change it's output format but may add a JSON-LD context header if I provide them with the context definition. So, a tool that would allow to quickly see what kind of Turtle serialisation my context definition would provide is quite valueable for feedback.
A library suggestion that allows this to be done is also welcome (I looked at https://github.com/ruby-rdf/json-ld but did not see a similar example). Thank you in advance!
@id
are treated as IRIs or blank node identifiers due to the data model requirements. The @id
identifies a node in a graph, and a language value (or really any literal) is not appropriate for this. You might use something that identifies a language, such as http://dbpedia.org/resource/English. but that's probably not what you're looking for.