I want to create a collection of people in json-ld format, but I need to save some keys instead of using arrays, so I tried this first:
{
"@context" : {
"@base" : "http://www.example.com/data/",
"@vocab" : "http://www.example.com/vocab#",
"name" : "schema:name",
"people" : {
"@container" : "@index",
"@id" : "people"
},
"schema" : "http://schema.org/"
},
"@id" : "http://www.example.com",
"people" : {
"person1" : {
"@id" : "people/person1",
"name" : "Person 1"
},
"person2" : {
"@id" : "people/person2",
"name" : "Person 2"
},
"person3" : {
"@id" : "people/person3",
"name" : "Person 3"
},
"person4" : {
"@id" : "people/person4",
"name" : "Person 4"
}
}
}
Testing it on a JSON-LD playground looks great, and the N-Quads result shows something like this:
<http://www.example.com/data/people/person1> <http://schema.org/name> "Person 1" .
<http://www.example.com/data/people/person2> <http://schema.org/name> "Person 2" .
<http://www.example.com/data/people/person3> <http://schema.org/name> "Person 3" .
<http://www.example.com/data/people/person4> <http://schema.org/name> "Person 4" .
<http://www.example.com> <http://www.example.com/vocab
<http://www.example.com> <http://www.example.com/vocab
<http://www.example.com> <http://www.example.com/vocab
<http://www.example.com> <http://www.example.com/vocab
Then I wanted to add a scheme: it knows a property that also stores keys and does not use such arrays:
{
"@context" : {
"@base" : "http://www.example.com/data/",
"@vocab" : "http://www.example.com/vocab#",
"knows" : {
"@container" : "@index",
"@id" : "schema:knows",
"@type" : "@id"
},
"name" : "schema:name",
"people" : {
"@container" : "@index",
"@id" : "people"
},
"schema" : "http://schema.org/"
},
"@id" : "http://www.example.com",
"people" : {
"person1" : {
"@id" : "people/person1",
"knows" : {
"person2" : "people/person2",
"person3" : "people/person3"
},
"name" : "Person 1"
},
"person2" : {
"@id" : "people/person2",
"name" : "Person 2"
},
"person3" : {
"@id" : "people/person3",
"name" : "Person 3"
},
"person4" : {
"@id" : "people/person4",
"name" : "Person 4"
}
}
}
This time, when I tested on the playground, it returns the following error:
{ "name": "jsonld.SyntaxError", "message": " JSON-LD; @index.", "details": { "code": " ", "": { "@id": " http://www.example.com/data/people/person2", "@index": "person2" }} }
, ?