Repository navigation
Closed
Labels
Description
When a context utilizes a urn as the @base IRI for expanding relative IRI's, the resulting expanded absolute IRI does not retain the urn format.
Example
{
"@context": [
"http://schema.org/",
{
"@base": "urn:example-org:entities/persons/",
"knows": { "@id": "http://schema.org/knows", "@type": "@id" }
}
],
"@graph": [
{
"@id": "jdoe",
"@type": "Person",
"givenName": "John Doe",
"knows": "janed"
},
{
"@id": "urn:example-org/entities/persons/janed",
"@type": "Person",
"givenName": "Jane Doe"
}
]
}After expansion the relative IRI's resolve to:
[
{
"@id": "urn:/example-org:entities/persons/jdoe",
"@type": [
"http://schema.org/Person"
],
"http://schema.org/givenName": [
{
"@value": "John Doe"
}
],
"http://schema.org/knows": [
{
"@id": "urn:/example-org:entities/persons/janed"
}
]
},
{
"@id": "urn:example-org/entities/persons/janed",
"@type": [
"http://schema.org/Person"
],
"http://schema.org/givenName": [
{
"@value": "Jane Doe"
}
]
}
]The relative IRI for jdoe gets expanded to absolute IRI urn:/example.org:entities/person/jdoe. This mangles the urn format and both the nss and nid segments gets mangled. I would have expected the absolute IRI to be urn:example-org:entities/persons/jdoe.
Activity
davidlehn commentedon Mar 23, 2019
Yeah, this is a bug. I think there is also a typo in your example; one of base or janed id have a flipped
:or/. Either way, the base is getting parsed in a nonsensical way and the output is wrong. The fix might be related to fixes required for the other failing relative iri tests.I made a slightly simplified example. Variations of
@baseall are broken.AtesComp commentedon May 29, 2019
Additional examples derived from the JSON-LD 1.1 documentation that fail. See example.
Example 1: @id changed to relative id, @type remains relative, "name" property remains relative.
Failure:
This contradicts the documentation.
Example 2: Removed @vocab and modified @base end character.
Failure:
Example 3: Added @vocab with absolute IRI.
Failure:
Otherwise, @type and "name" use @vocab as intended.
Shouldn't @id and @type values expand in the same way using the same code?
Example 4: No @context.
Failure:
Otherwise, @id and @type use the document default for the base.
AtesComp commentedon May 29, 2019
Additionally, when the @base contains the gen-delim / sub-delim characters anywhere else in the IRI, similar errors and truncation occur.
gkellogg commentedon Mar 29, 2020
I think PR #384 may fix this.
dlongley commentedon May 26, 2020
Closing as stale/potentially fixed by #384.