-
Notifications
You must be signed in to change notification settings - Fork 35
"Create term definition" algorithm expands schema part of an absolute IRI as if it is a compact IRI #96
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
@lo48576 thanks for the detailed analysis. The meta-issue you're noting is that in JSON-LD, there is an ambiguity between compact IRIs and absolute IRIs. The definition of compact IRI simply says "a compact IRI has the form of In IRI Expansion we do distinguish values containing a colon where the suffix begins with "//", but this is not carried out uniformly. Given the definitions, JSON-LD does allow http to be used as a prefix. One thing we've considered is a way to define terms that cannot be used as prefixes ( I don't see that your suggested wording change would have an effect, unless the compact IRI definition were updated similarly to what is done in IRI expansion to prohibit a string containing "://" from being considered as a compact IRI. There could potentially be some backwards compatibility issues with doing this, but it may be the best way to go. |
In JSON-LD 1.0 §6.3 Compact IRIs, suffix seems to be already prohibited starting with two slashes:
According to this description, I've thought Is my understanding correct? |
This should be fixed by #110. |
Fixed in #110, closing. |
Summary
playground: https://json-ld.org/playground/#startTab=tab-expanded&json-ld=%7B%22%40context%22%3A%7B%22http%22%3A%22schema%3A%2F%2Fhello%22%2C%22http%3A%2F%2Fexample.com%22%3A%7B%22%40type%22%3A%22http%3A%2F%2Ftype%22%7D%7D%2C%22http%3A%2F%2Fexample.com%22%3A%222000%22%7D
"Create term definition" algorithm has a step that replaces schema part of an absolute IRI to another IRI (the IRI mapping for the term that equals to the schema string).
This causes
"http://example.com"
to be replaced to"schema://hello//example.com"
(in example above), but this is unexpected for me.I'm not sure if this is a bug, but I want to know this is intended behavior or not.
If this is not intended, step 14.2 in JSON-LD-API 1.0 and step 17.2 in JSON-LD-API 1.1 (TR) should be like this:
"If term is a compact IRI and term's prefix has a term definition in active context, set the IRI mapping of ...".
Details
Create term definition has the steps below:
For exact definitions, see step 14 in JSON-LD-API 1.0 §6.2 Create Term Definition, and JSON-LD-API 1.1 §4.2 Create Term Definition step 17.
json-ld-api/index.html
Lines 1405 to 1422 in 4725397
The problem is the second substep, "If term's prefix has a term definition in active context, ...".
This step replaces prefix of a compact IRI (for example
xsd:dateTime
tohttp://www.w3.org/2001/XMLSchema#dateTime
), which is expected behavior.However, this condition does not require term to be a compact IRI (which is required in the previous substep), and this causes an absolute IRI to be replaced if the schema (such as
http
) has a corresponding term definition.For example,
http://example.com
is replaced toschema://hello//example.com
in such cases.I think the second substep should be like this: "If term is a compact IRI and term's prefix has a term definition in active context, set the IRI mapping of ...".
Example
playground: https://json-ld.org/playground/#startTab=tab-expanded&json-ld=%7B%22%40context%22%3A%7B%22http%22%3A%22schema%3A%2F%2Fhello%22%2C%22http%3A%2F%2Fexample.com%22%3A%7B%22%40type%22%3A%22http%3A%2F%2Ftype%22%7D%7D%2C%22http%3A%2F%2Fexample.com%22%3A%222000%22%7D
input
Attempt to associate
"2000"
value to the absolute IRIhttp://example.com
.actual output
Absolute IRI
http://example.com
in input document is replaced toschema://hello//example.com
, as if it was a compact IRI.expected
http://example.com
is preserved even when a termhttp
is expandable to another IRI, becausehttp://example.com
is not a compact IRI.The text was updated successfully, but these errors were encountered: