Skip to content

Treat invalid IRIs as errors in conversion to RDF #138

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions lib/pyld/jsonld.py
Original file line number Diff line number Diff line change
Expand Up @@ -3545,10 +3545,16 @@ def _graph_to_rdf(self, graph, issuer, options):
continue

for item in items:
# skip relative IRI subjects and predicates
# All IDs should be absolute at this point in time
if not (_is_absolute_iri(id_) and
_is_absolute_iri(property)):
continue
raise JsonLdError(
'JSON-LD graph conversion error; '
'invalid IRI for property or ID, '
'IRIs must be absolute',
'jsonld.RdfError',
{'@id': id_, 'property': property},
code='invalid IRI')

# RDF subject
subject = {}
Expand Down