Open joeltg opened 5 years ago
The ShapeMap spec implies a JSON structure and then uses it in a couple examples. If that were modified to exclude the "<>"s around URLs, we could use JSON-LD pretty directly:
{
"@context": {
"node": { "@id": "http://www.w3.org/ns/shex#node", "@type": "@id" },
"shape": { "@id": "http://www.w3.org/ns/shex#shape", "@type": "@id" },
"status": "http://www.w3.org/ns/shex#status",
"reason": "http://www.w3.org/ns/shex#reason",
"appinfo": "http://www.w3.org/ns/shex#appinfo"
},
"@graph": [
{ "node": "http://data.example/node1",
"shape": "http://schema.example/Shape2",
"status": "conformant" },
{ "node": "http://data.example/node1",
"shape": "http://schema.example/Shape3",
"status": "nonconformant",
"appinfo": {"x": "y"} }
]
}
gives:
PREFIX shex: <http://www.w3.org/ns/shex#>
[] shex:node <http://data.example/node1> ;
shex:shape <http://schema.example/Shape2> ;
shex:status "conformant" .
[] shex:appinfo _:b2 ;
shex:node <http://data.example/node1> ;
shex:shape <http://schema.example/Shape3> ;
shex:status "nonconformant" .
I'm not sure what to do with appinfo, though. That's an arbitrary, application-specific JSON structure. I guess it would have to be just a big string.
One upcoming feature of JSON-LD 1.1 is native JSON literals, using
{
"@type": "@json",
"@value": {
"foo": "bar",
"baz": [1, 2, 3]
}
}
to represent
"{\"baz\":[1,2,3],\"foo\":\"bar\"}"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#JSON>
So you could just add a context property
"appinfo": {
"@id": "http://www.w3.org/ns/shex#appinfo",
"@type": "@json"
}
That would make deployment of the RDF interpretation of ShapeMaps be dependent on deployment of JSON-LD 1.1. I think that's reasonable as there's currently no standard RDF interpretation so we wouldn't breaking anyone's existing tool chain.
One might sometimes want to provide an @context for the appinfo instead of @type: @json. If the @context for ShapeMaps ad the above definition for "appinfo", and you added an "@context" in the appinfo instance, which one wins?
ShapeMaps are defined abstractly in the current spec - are there plans to develop an RDF representation of a
ShapeMap
as anrdfs:Class
?I'm imagining
shape
as a property with rangeshex:ShapeExpression
(this covers both labeled shapes and the start shape?), andnode
as another property whose object is either an IRI (?) or anrdf:Statement
representing a triple pattern.I'm not sure how you'd represent the focus node in a triple pattern - maybe with another
focus
property on theShapeMap
class whose object is a blank node distinguished as the focus selector? Although that seems like an abuse of the semantics of blank nodes.Is this possible? Is it useful? Will blank node labels cause problems?