- From: Gregg Kellogg <gregg@greggkellogg.net>
- Date: Tue, 29 Jul 2014 08:39:54 -0700
- To: "john.walker" <john.walker@semaku.com>
- Cc: Robert Sanderson <azaroth42@gmail.com>, Sandro Hawke <sandro@hawke.org>, JSON-LD CG <public-linked-json@w3.org>, Sandro Hawke <sandro@w3.org>
Note, I have an example schema.org context, which uses the principles I suggest: https://github.com/ruby-rdf/json-ld/blob/develop/etc/schema.org.jsonld This is generated automatically using the Ruby JSON-LD gem from the schema.org vocabulary definition in RDFa. It could be used for pretty much any vocabulary. (This particular one creates a subclass hierarchy, but that's not necessary; DanBri wanted it to do a D3.js visualization). I used the tool to generate the following JSON-LD version of the LDP vocabulary from <http://www.w3.org/ns/ldp>: { "@context": { "contains": { "@id": "http://www.w3.org/ns/ldp#contains", "@type": "@id" }, "hasMemberRelation": { "@id": "http://www.w3.org/ns/ldp#hasMemberRelation", "@type": "@id" }, "insertedContentRelation": { "@id": "http://www.w3.org/ns/ldp#insertedContentRelation", "@type": "@id" }, "isMemberOfRelation": { "@id": "http://www.w3.org/ns/ldp#isMemberOfRelation", "@type": "@id" }, "ldp": "http://www.w3.org/ns/ldp#", "member": { "@id": "http://www.w3.org/ns/ldp#member", "@type": "@id" }, "membershipResource": { "@id": "http://www.w3.org/ns/ldp#membershipResource", "@type": "@id" }, "owl": "http://www.w3.org/2002/07/owl#", "owl:equivalentClass": { "@type": "@vocab" }, "owl:equivalentProperty": { "@type": "@vocab" }, "owl:imports": { "@type": "@id" }, "owl:inverseOf": { "@type": "@vocab" }, "owl:oneOf": { "@type": "@vocab", "@container": "@list" }, "owl:versionInfo": { "@type": "xsd:string", "@language": null }, "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#", "rdfs": "http://www.w3.org/2000/01/rdf-schema#", "rdfs:domain": { "@type": "@id" }, "rdfs:range": { "@type": "@id" }, "rdfs:subClassOf": { "@type": "@id" }, "rdfs:subPropertyOf": { "@type": "@id" } }, "@graph": [ { "@id": "http://www.w3.org/ns/ldp#", "@type": "owl:Ontology", "http://purl.org/dc/terms/description": "All vocabulary URIs defined in the Linked Data Platform (LDP) namespace.", "http://purl.org/dc/terms/title": "The W3C Linked Data Platform (LDP) Vocabulary", "rdfs:comment": "This ontology provides an informal representation of the concepts and terms as defined in the LDP specification. Consult the LDP specification for normative reference.", "rdfs:label": "W3C Linked Data Platform (LDP)", "rdfs:seeAlso": [ { "@id": "http://www.w3.org/2012/ldp" }, { "@id": "http://www.w3.org/TR/ldp-ucr/" }, { "@id": "http://www.w3.org/TR/ldp/" }, { "@id": "http://www.w3.org/2011/09/LinkedData/" } ] }, { "@id": "http://www.w3.org/ns/ldp#BasicContainer", "@type": "rdfs:Class", "http://www.w3.org/2003/06/sw-vocab-status/ns#term_status": "unstable", "rdfs:comment": "An LDPC that uses a predefined predicate to simply link to its contained resources.", "rdfs:isDefinedBy": { "@id": "http://www.w3.org/ns/ldp#" }, "rdfs:label": "BasicContainer", "rdfs:subClassOf": "http://www.w3.org/ns/ldp#Container" }, { "@id": "http://www.w3.org/ns/ldp#Container", "@type": "rdfs:Class", "http://www.w3.org/2003/06/sw-vocab-status/ns#term_status": "unstable", "rdfs:comment": "A Linked Data Platform RDF Source (LDP-RS) that also conforms to additional patterns and conventions for managing membership. Readers should refer to the specification defining this ontology for the list of behaviors associated with it.", "rdfs:isDefinedBy": { "@id": "http://www.w3.org/ns/ldp#" }, "rdfs:label": "Container", "rdfs:subClassOf": "http://www.w3.org/ns/ldp#RDFSource" }, { "@id": "http://www.w3.org/ns/ldp#DirectContainer", "@type": "rdfs:Class", "http://www.w3.org/2003/06/sw-vocab-status/ns#term_status": "unstable", "rdfs:comment": "An LDPC that is similar to a LDP-DC but it allows an indirection with the ability to list as member a resource, such as a URI representing a real-world object, that is different from the resource that is created", "rdfs:isDefinedBy": { "@id": "http://www.w3.org/ns/ldp#" }, "rdfs:label": "DirectContainer", "rdfs:subClassOf": "http://www.w3.org/ns/ldp#Container" }, { "@id": "http://www.w3.org/ns/ldp#IndirectContainer", "@type": "rdfs:Class", "http://www.w3.org/2003/06/sw-vocab-status/ns#term_status": "unstable", "rdfs:comment": "An LDPC that has the flexibility of choosing what form the membership triples take.", "rdfs:isDefinedBy": { "@id": "http://www.w3.org/ns/ldp#" }, "rdfs:label": "IndirectContainer", "rdfs:subClassOf": "http://www.w3.org/ns/ldp#Container" }, { "@id": "http://www.w3.org/ns/ldp#MemberSubject", "@type": "rdf:Description", "http://www.w3.org/2003/06/sw-vocab-status/ns#term_status": "unstable", "rdfs:comment": "Used to indicate default and typical behavior for ldp:insertedContentRelation, where the member-URI value in the membership triple added when a creation request is successful is the URI assigned to the newly created resource.", "rdfs:isDefinedBy": { "@id": "http://www.w3.org/ns/ldp#" }, "rdfs:label": "MemberSubject" }, { "@id": "http://www.w3.org/ns/ldp#NonRDFSource", "@type": "rdfs:Class", "http://www.w3.org/2003/06/sw-vocab-status/ns#term_status": "unstable", "rdfs:comment": "A Linked Data Platform Resource (LDPR) whose state is NOT represented as RDF.", "rdfs:isDefinedBy": { "@id": "http://www.w3.org/ns/ldp#" }, "rdfs:label": "NonRDFSource", "rdfs:subClassOf": "http://www.w3.org/ns/ldp#Resource" }, { "@id": "http://www.w3.org/ns/ldp#PreferContainment", "@type": "rdf:Description", "http://www.w3.org/2003/06/sw-vocab-status/ns#term_status": "unstable", "rdfs:comment": "URI identifying a LDPC's containment triples, for example to allow clients to express interest in receiving them.", "rdfs:isDefinedBy": { "@id": "http://www.w3.org/ns/ldp#" }, "rdfs:label": "PreferContainment" }, { "@id": "http://www.w3.org/ns/ldp#PreferEmptyContainer", "@type": "rdf:Description", "http://www.w3.org/2003/06/sw-vocab-status/ns#term_status": "unstable", "rdfs:comment": "URI identifying the subset of a LDPC's triples present in an empty LDPC, for example to allow clients to express interest in receiving them. Currently this excludes containment and membership triples, but in the future other exclusions might be added. This definition is written to automatically exclude those new classes of triples.", "rdfs:isDefinedBy": { "@id": "http://www.w3.org/ns/ldp#" }, "rdfs:label": "PreferEmptyContainer" }, { "@id": "http://www.w3.org/ns/ldp#PreferMembership", "@type": "rdf:Description", "http://www.w3.org/2003/06/sw-vocab-status/ns#term_status": "unstable", "rdfs:comment": "URI identifying a LDPC's membership triples, for example to allow clients to express interest in receiving them.", "rdfs:isDefinedBy": { "@id": "http://www.w3.org/ns/ldp#" }, "rdfs:label": "PreferMembership" }, { "@id": "http://www.w3.org/ns/ldp#RDFSource", "@type": "rdfs:Class", "http://www.w3.org/2003/06/sw-vocab-status/ns#term_status": "unstable", "rdfs:comment": "A Linked Data Platform Resource (LDPR) whose state is represented as RDF.", "rdfs:isDefinedBy": { "@id": "http://www.w3.org/ns/ldp#" }, "rdfs:label": "RDFSource", "rdfs:subClassOf": "http://www.w3.org/ns/ldp#Resource" }, { "@id": "http://www.w3.org/ns/ldp#Resource", "@type": "rdfs:Class", "http://www.w3.org/2003/06/sw-vocab-status/ns#term_status": "unstable", "rdfs:comment": "A HTTP-addressable resource whose lifecycle is managed by a LDP server.", "rdfs:isDefinedBy": { "@id": "http://www.w3.org/ns/ldp#" }, "rdfs:label": "Resource" }, { "@id": "http://www.w3.org/ns/ldp#contains", "@type": "rdf:Property", "http://www.w3.org/2003/06/sw-vocab-status/ns#term_status": "unstable", "rdfs:comment": "Links a container with resources created through the container.", "rdfs:domain": "http://www.w3.org/ns/ldp#Container", "rdfs:isDefinedBy": { "@id": "http://www.w3.org/ns/ldp#" }, "rdfs:label": "contains", "rdfs:range": "rdfs:Resource" }, { "@id": "http://www.w3.org/ns/ldp#hasMemberRelation", "@type": "rdf:Property", "http://www.w3.org/2003/06/sw-vocab-status/ns#term_status": "unstable", "rdfs:comment": "Indicates which predicate is used in membership triples, and that the membership triple pattern is < membership-constant-URI , object-of-hasMemberRelation, member-URI >.", "rdfs:domain": "http://www.w3.org/ns/ldp#Container", "rdfs:isDefinedBy": { "@id": "http://www.w3.org/ns/ldp#" }, "rdfs:label": "hasMemberRelation", "rdfs:range": "rdf:Property" }, { "@id": "http://www.w3.org/ns/ldp#insertedContentRelation", "@type": "rdf:Property", "http://www.w3.org/2003/06/sw-vocab-status/ns#term_status": "unstable", "rdfs:comment": "Indicates which triple in a creation request should be used as the member-URI value in the membership triple added when the creation request is successful.", "rdfs:domain": "http://www.w3.org/ns/ldp#Container", "rdfs:isDefinedBy": { "@id": "http://www.w3.org/ns/ldp#" }, "rdfs:label": "insertedContentRelation", "rdfs:range": "rdf:Property" }, { "@id": "http://www.w3.org/ns/ldp#isMemberOfRelation", "@type": "rdf:Property", "http://www.w3.org/2003/06/sw-vocab-status/ns#term_status": "unstable", "rdfs:comment": "Indicates which predicate is used in membership triples, and that the membership triple pattern is < member-URI , object-of-isMemberOfRelation, membership-constant-URI >.", "rdfs:domain": "http://www.w3.org/ns/ldp#Container", "rdfs:isDefinedBy": { "@id": "http://www.w3.org/ns/ldp#" }, "rdfs:label": "isMemmberOfRelation", "rdfs:range": "rdf:Property" }, { "@id": "http://www.w3.org/ns/ldp#member", "@type": "rdf:Property", "http://www.w3.org/2003/06/sw-vocab-status/ns#term_status": "unstable", "rdfs:comment": "LDP servers should use this predicate as the membership predicate if there is no obvious predicate from an application vocabulary to use.", "rdfs:domain": "http://www.w3.org/ns/ldp#Resource", "rdfs:isDefinedBy": { "@id": "http://www.w3.org/ns/ldp#" }, "rdfs:label": "member", "rdfs:range": "rdfs:Resource" }, { "@id": "http://www.w3.org/ns/ldp#membershipResource", "@type": "rdf:Property", "http://www.w3.org/2003/06/sw-vocab-status/ns#term_status": "unstable", "rdfs:comment": "Indicates the membership-constant-URI in a membership triple. Depending upon the membership triple pattern a container uses, as indicated by the presence of ldp:hasMemberRelation or ldp:isMemberOfRelation, the membership-constant-URI might occupy either the subject or object position in membership triples.", "rdfs:domain": "http://www.w3.org/ns/ldp#Container", "rdfs:isDefinedBy": { "@id": "http://www.w3.org/ns/ldp#" }, "rdfs:label": "membershipResource", "rdfs:range": "rdf:Property" } ] } For reference: * clone the gem from http://github.com/ruby-rdf/json-ld * bundle install * run `script/gen_context --body http://www.w3.org/ns/ldp` Gregg Kellogg Sent from my iPad On Jul 29, 2014, at 1:21 AM, "john.walker" <john.walker@semaku.com> wrote: > Hi Gregg >> On July 29, 2014 at 2:08 AM Gregg Kellogg <gregg@greggkellogg.net> wrote: >> >> We could consider a boilerplate context, which would gather such common definitions together, then you could do something like the following: >> >> { >> "@context": [ >> " http://www.w3.org/ns/rdfs", >> { >> "@vocab": " http://www.w3.org/ns/ldp#", >> "ldp": " http://www.w3.org/ns/ldp#", >> ... >> } >> } >> } >> >> And put all of the RDFS-related definitions in a single location. > I understood duplicate context terms are overridden using a most-recently-defined-wins mechanism. > > So if I was using the above LDP example as an external context and the referenced RDFS context was defined in a similar way. > > Imagine there were some terms with 'the same' name, say rdfs:comment and ldp:comment. If I used the term "comment" in my JSON-LD document, I assume this would be expanded to "http://www.w3.org/ns/ldp#comment" as this is the most recently defined. > > Also if I wanted to use any RDFS term in my document, then i would HAVE to prefix them with rdfs: otherwise they would be expanded again the @vocab from LDP context. > > Do I understand that correctly? > > Reminds me of XML namespaces... > > Cheers > > John
Received on Tuesday, 29 July 2014 15:40:25 UTC