-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clarification: prefix definition in @context using relative IRI? #363
Comments
The paragraph you quote means that properties (among other things) are "resolved" against Sort of, because in JSON-LD, "resolved using the vocabulary mapping" (i.e. using Then let me try to convince you that this is no really a problem 😉
In Linked Data, IRIs are identifiers (1st principle) before being addresses (2nd principle). Being a shared vocabulary, an ontology (and all its terms) must have the same IRI everywhere they are used, even on a test server. So my advice is to decide on an absolute IRI where your ontolgy will be published, and use that absolute IRI in your context, even while testing your API on Think about it this way: the client consuming your JSON-LD will look for a property it knows. If it consumes the JSON directly (trusting the context), it will look for the |
Thanks a lot for the great explanation and examples. I'll close the issue. The following are some details about my specific situation/a response to the second piece. I totally recognize that for people building ontologies for others to consume that appropriate identifiers are key and should be the same across environments, even in testing. In fact, for my example ontology, since it relies on schema.org, which recently dropped builtin support for content negotiation, I'm overriding DNS using However, my ontologies are primarily for testing software I'm working on for frontend developers working with linked data. Additionally, the software itself is pretty generic, and will try to dereference and fetch some vary basic things like rdfs:label, etc, so it doesn't depend on the details of the ontologies. Therefore it doesn't really make a difference whether it is using It's also just partly convenience: being able to say serve on localhost:4000 instead of localhost:9090, for example, with out having to replace the ID in multiple places. For example, I've been using json-server to serve the data: here, and it's more convenient to use relative IRIs because like I mentioned I can change which port I'm serving on. I guess for my situation there are a few options:
Maybe there'd even be another option in another version of JSON-LD, something like Maybe that's not even something for JSON-LD to deal with, rather to do using RDF libraries. I think type of feature is slightly related to some discussions I've seen in the schema.org repositories about providing backup URLs for remote context documents schemaorg/schemaorg#2578 (comment). I think I've seen some related things here: #108 (comment), #9. I think there is a need to deal with the reliability of remote contexts, but I'm not sure if anything above would work. |
schema.org replaced content-negotiation with using the rel=alternate link header to point to the context. This is provided for in the spec, and conforming implementations will retrieve the document from that location. You might see if the processor your using conforms to JSON-LD 1.1.
For testing purposes, some tests will set |
@gkellogg Yeah the processors are compliant and they do get sent to the appropriate context location. However the context only defines terms in the vocabulary, it doesn't include any actual triples about classes or properties (e.g. labels and descriptions, which I'm interested in). There was a feature a added to schema.org a while back that supported content negotiation to actually send different representations in various RDF serializations of each class and property. E.g. for https://schema.org/Person, it would return all the triples of the form I've built a simple version of that here, which doesn't support the |
Okay, not familiar with that aspect of schema.org, but you might try checking on their forum. I do know that the publish the vocabulary (RDFS equivalent) in a number of different formats, but their naming has changed in version 1.0. You can try https://schema.org/version/latest/schemaorg-all-http.jsonld for example. |
I have a document that looks like this at
/home
:That fetches the following at
/context
I then got an error from the
jsonld
library:Invalid JSON-LD syntax; a @context @id value must be an absolute IRI, a blank node identifier, or a keyword.
.@context
itself can be a remote resource as illustrated in the first example.I did see this note:
Thus it makes sense that there might be an error if trying to use the
ppl
prefix in a property, likeppl:knows
.I looked through the spec though and couldn't find any explicit answer to whether relative prefixes are allowed in the context, so I'm hoping one of you here could answer that.
It likely would be a helpful option for those serving ontologies from test/local servers.
The text was updated successfully, but these errors were encountered: