- From: Jindřich Mynarz <mynarzjindrich@gmail.com>
- Date: Sat, 19 Dec 2015 18:56:59 +0100
- To: public-linked-json@w3.org
- Message-ID: <CAE=8Bu_FxYpYCLuNJNamRUXBOEKOX+78EbuOfeaCYDeqH8=MSQ@mail.gmail.com>
Hi,
is it possible to compact rdf:Seq?
For example, let's have this JSON-LD:
{
"@graph": [{
"ex:list": "_:b1"
}, {
"@id": "_:b1",
"rdf:first": "_:b2",
"rdf:rest": "_:b3"
}, {
"@id": "_:b2",
"foaf:name": "Alice"
}, {
"@id": "_:b3",
"rdf:first": "_:b4",
"rdf:rest": "rdf:nil"
}, {
"@id": "_:b4",
"foaf:name": "Bob"
}]
}
We try to compact it with this context:
{
"@context": {
"ex": "http://example.com/",
"foaf": "http://xmlns.com/foaf/0.1/",
"rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
"ex:list": {"@container": "@list",
"@type": "@id"},
"rdf:first": {"@type": "@id"},
"rdf:rest": {"@type": "@id"}
}
}
JSON-LD playground (jsonld.js) returns the following:
{
"@context": {
"ex": "http://example.com/",
"foaf": "http://xmlns.com/foaf/0.1/",
"rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
"ex:list": {
"@container": "@list",
"@type": "@id"
},
"rdf:first": {
"@type": "@id"
},
"rdf:rest": {
"@type": "@id"
}
},
"@graph": [
{
"ex:list": [
"_:b1"
]
},
{
"@id": "_:b1",
"rdf:first": "_:b2",
"rdf:rest": "_:b3"
},
{
"@id": "_:b2",
"foaf:name": "Alice"
},
{
"@id": "_:b3",
"rdf:first": "_:b4",
"rdf:rest": "rdf:nil"
},
{
"@id": "_:b4",
"foaf:name": "Bob"
}
]
}
Is it possible to get to a compact representation of rdf:Seq (
http://www.w3.org/TR/json-ld/#sets-and-lists), like the following?
{
"@context": {
"ex": "http://example.com/",
"foaf": "http://xmlns.com/foaf/0.1/",
"rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
"ex:list": {
"@container": "@list",
"@type": "@id"
},
"rdf:first": {
"@type": "@id"
},
"rdf:rest": {
"@type": "@id"
}
},
"@graph": [
{
"ex:list": [
"_:b2", "_:b4"
]
},
{
"@id": "_:b2",
"foaf:name": "Alice"
},
{
"@id": "_:b4",
"foaf:name": "Bob"
}
]
}
- Jindřich
--
Jindřich Mynarz
http://mynarz.net/#jindrich
Received on Saturday, 19 December 2015 17:57:48 UTC