You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
RFC 3986 section 5.1 specifies that relative URIs should be expanded against the document's base URI. In absence of an explicit base, there are prescribed steps to determine the base IRI for a given document:
5.1.1. Base URI Embedded in Content . . . . . . . . . . 29 5.1.2. Base URI from the Encapsulating Entity . . . . . 29 5.1.3. Base URI from the Retrieval URI . . . . . . . . 30 5.1.4. Default Base URI . . . . . . . . . . . . . . . . 30
The current implementation in pyLD ignores the last two requirements. For 5.1.3 this is understandable, as the library only operates on a data payload. However, 5.1.4 is the catch-all that would ensure that @id values are always expanded to absolute IRIs.
In absence of this, non-IRI @id values in documents that do not explicitly specify a base in a context are not expanded to an absolute IRI. This means that the to_rdf function ignores them when producing N-Quads output. This is a showstopper for RDFLib/rdflib#2308.
The JSON-LD spec does allow for a means to prevent expansion against a base by setting @base to null (see https://www.w3.org/TR/json-ld/#base-iri) but does not specify that null is the default.
Because the manifest files specify a baseIRI value, the test will always run with a base specified. This means that the situation reported in this issue is not recognised.
Rewriting the test is not an option as with an unspecified base IRI, the output will be application specific.
RFC 3986 section 5.1 specifies that relative URIs should be expanded against the document's base URI. In absence of an explicit base, there are prescribed steps to determine the base IRI for a given document:
5.1.1. Base URI Embedded in Content . . . . . . . . . . 29
5.1.2. Base URI from the Encapsulating Entity . . . . . 29
5.1.3. Base URI from the Retrieval URI . . . . . . . . 30
5.1.4. Default Base URI . . . . . . . . . . . . . . . . 30
The current implementation in pyLD ignores the last two requirements. For 5.1.3 this is understandable, as the library only operates on a data payload. However, 5.1.4 is the catch-all that would ensure that
@id
values are always expanded to absolute IRIs.In absence of this, non-IRI
@id
values in documents that do not explicitly specify a base in a context are not expanded to an absolute IRI. This means that theto_rdf
function ignores them when producing N-Quads output. This is a showstopper for RDFLib/rdflib#2308.The JSON-LD spec does allow for a means to prevent expansion against a base by setting
@base
tonull
(see https://www.w3.org/TR/json-ld/#base-iri) but does not specify thatnull
is the default.This violates test t0060 in and t0060.
The output should be something similar to (with a different application-specific base):
But the output of pyld is:
The resulting N-Quads only returns a single triple:
This is not a duplicate of #143 as that issue is about a case where the
@base
is specified.The problem appears to reside here:
pyld/lib/pyld/jsonld.py
Lines 3186 to 3202 in 316fbc2
Where in absence of a
@base
(or an explicitnull
base, see https://www.w3.org/TR/json-ld/#base-iri) a default base needs to be set.The text was updated successfully, but these errors were encountered: