Description
As specified, framing uses a single context to perform compaction, however, there are cases where specific sub-frames may want to use their own context. For example, consider the following frame:
{
"@context": {
"foaf": "http://xmlns.com/foaf/0.1/",
"doap": "http://usefulinc.com/ns/doap#",
"doap_developer": {"@id": "doap:developer", "@type": "@id"},
"doap_id": "@id",
"doap_name": "doap:name",
"foaf_name": "foaf:name"
},
"doap:name": null,
"doap_developer": {
"@context": {
"foaf_id": "@id",
"foaf_name": "foaf:name"
}
}
}
This defines aliases for @id and foaf:name exclusive to the values of doap:developer. The desired output would use the embedded context definition for compacting the portions of that frame; example output from doing this might be the following:
{
"@context": {
"foaf": "http://xmlns.com/foaf/0.1/",
"doap": "http://usefulinc.com/ns/doap#",
"doap_developer": {"@id": "doap:developer", "@type": "@id"},
"doap_id": "@id",
"doap_name": "doap:name"
"foaf_id": "@id",
"foaf_name": "foaf:name"
},
"@graph": [{
"doap_id": "http://rubygems.org/gems/json-ld",
"doap_developer": {
"doap_id": "http://greggkellogg.net/foaf#me",
"foaf_name": "Gregg Kellogg"
},
"doap_name": "JSON::LD"
}, {
"doap_id": "http://rubygems.org/gems/rdf",
"doap_developer": [
{"foaf_id": "http://ar.to/#self", "foaf_name": "Arto Bendiken"},
{"foaf_id": "http://bhuga.net/#ben", "foaf_name": "Ben Lavender"},
{"foaf_id": "http://greggkellogg.net/foaf#me", "foaf_name": "Gregg Kellogg"}
],
"doap_name": "RDF.rb"
}, {
"doap_id": "http://rubygems.org/gems/rdf-aggregate-repo",
"doap_developer": {"foaf_id": "http://greggkellogg.net/foaf#me", "foaf_name": "Gregg Kellogg"},
"doap_name": "RDF::AggregateRepo"
}, {
"doap_id": "http://rubygems.org/gems/rdf-json",
"doap_developer": {"foaf_id": "http://ar.to/#self", "foaf_name": "Arto Bendiken"},
"doap_name": "RDF::JSON"
}, {
"doap_id": "http://rubygems.org/gems/rdf-microdata",
"doap_developer": {"foaf_id": "http://greggkellogg.net/foaf#me", "foaf_name": "Gregg Kellogg"},
"doap_name": "RDF::Microdata"
}, {
"doap_id": "http://rubygems.org/gems/rdf-n3",
"doap_developer": {"foaf_id": "http://greggkellogg.net/foaf#me", "foaf_name": "Gregg Kellogg"},
"doap_name": "RDF::N3"
}, {
"doap_id": "http://rubygems.org/gems/rdf-rdfa",
"doap_developer": {"foaf_id": "http://greggkellogg.net/foaf#me", "foaf_name": "Gregg Kellogg"},
"doap_name": "RDF::RDFa"
}, {
"doap_id": "http://rubygems.org/gems/rdf-rdfxml",
"doap_developer": {"foaf_id": "http://greggkellogg.net/foaf#me", "foaf_name": "Gregg Kellogg"},
"doap_name": "RDF::RDFXML"
}]
}
The use case for this is to allow an easy way to map JSON-LD with embedding to a CSV format. The CSV transformation would just take the property definitions and flatten into a single table, such as the following:
doap_id | doap_name | foaf_id | foaf_name |
---|---|---|---|
<http://rubygems.org/gems/json-ld> | JSON::LD | <http://greggkellogg.net/foaf#me> | Gregg Kellogg |
<http://rubygems.org/gems/rdf> | RDF.rb | <http://ar.to/#self> | Arto Bendiken |
<http://rubygems.org/gems/rdf> | RDF.rb | <http://bhuga.net/#ben> | Ben Lavender |
<http://rubygems.org/gems/rdf> | RDF.rb | <http://greggkellogg.net/foaf#me> | Gregg Kellogg |
<http://rubygems.org/gems/rdf-aggregate-repo> | RDF::AggregateRepo | <http://greggkellogg.net/foaf#me> | Gregg Kellogg |
<http://rubygems.org/gems/rdf-json> | RDF::JSON | <http://ar.to/#self> | Arto Bendiken |
<http://rubygems.org/gems/rdf-microdata> | RDF::Microdata | <http://greggkellogg.net/foaf#me> | Gregg Kellogg |
<http://rubygems.org/gems/rdf-n3> | RDF::N3 | <http://greggkellogg.net/foaf#me> | Gregg Kellogg |
<http://rubygems.org/gems/rdf-rdfa> | RDF::RDFa | <http://greggkellogg.net/foaf#me> | Gregg Kellogg |
<http://rubygems.org/gems/rdf-rdfxml> | RDF::RDFXML | <http://greggkellogg.net/foaf#me> | Gregg Kellogg |
This is also consistent with how an HTML representation of SPARQL results might look from the following query:
PREFIX doap: <http://usefulinc.com/ns/doap#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT *
WHERE {
?doap_id a doap:Project; doap:name ?doap_name; doap:developer ?foaf_id .
?foaf_id foaf:name ?foaf_name .
}