-
Notifications
You must be signed in to change notification settings - Fork 156
Let @vocab take precedence over compact IRIs in compaction #235
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
Comments
I just verified it. The only test that would need to be changed is compact-0023 (context): "Prefixes have precedence over AFAICT it won't have any desired side-effects. If you want to compact something to prefixes, you just have to reset So, I think I'm +0.9 on this. |
Can we try listing the reasons why anyone would have both @vocab and a matching prefix in a context? That might help us decide what the best behavior would be.
For case 2, we probably would prefer to use CURIEs when compacting. If CURIEs are preferred over @vocab, we don't have to make any context changes. If @vocab is preferred over CURIEs, then we'll have to compact with a context that sets @vocab to null. If any term definitions depended on @vocab, those will also have to be changed -- this can be more difficult than just setting @vocab to null, but is perhaps unlikely to happen. For case 3, we probably would prefer to use terms when compacting. If @vocab is preferred over CURIEs, then So far, it sounds like there's an argument that it would be more likely for someone who wanted to compact to terms to also use CURIEs (just in the context) rather than the other way around. If that's true, then we should prefer @vocab over CURIEs because it is the simpler solution in the common case. Are there other reasons for mixing @vocab with a prefix for the same IRI? |
As I understood Niklas the use case is if you include a remote context defined a number of well-known prefixes. It could well be that, e.g., the RDFa initial context is used or that we host something else somewhere at W3C in the future. You would then reference that “generic” remote and augment it with some local definitions, such as @vocab. You would like that this @vocab takes precedence over the prefixes defined in the generic context. Think, most of my data uses schema.org but I also use some FOAF, XSD etc. I would then simply reference the remote context and add a @vocab set to schema.org so that most IRIs are compacted to terms instead of compact IRIs. |
RESOLVED: When compacting IRIs |
I've updated the API spec and the test suite so that |
If a
@vocab
mapping is given, compaction should use that to avoid creating a compact IRI for a term. The purpose of compaction is to make the results as simple and usable as possible, and consumption of JSON with CURIE terms is problematic and undesirable. I propose that@vocab
is considered prior to making a compact IRI.That means moving the content of step 6 before step 3 in 8.3 IRI Compaction of the Processing Algorithms. And to rewrite the initial text of that section to something like:
"If no term was found that could be used to compact the IRI, then an attempt is made to construct one based on the active context's vocabulary mapping, if there is one. If no such term can be constructed, then an attempt is made to find a compact IRI. If there is no appropriate compact IRI, the IRI is transformed to a relative IRI using the document's base IRI. Finally, if the IRI or keyword still could not be compacted, it is returned as is."
That would ensure that this data:
when compacted with this context:
results in:
(Of course, we must ensure that this has no unexpected consequences. It doesn't seem so, but the change should be verified with an implementation against the test suite.)
The text was updated successfully, but these errors were encountered: