-
Notifications
You must be signed in to change notification settings - Fork 579
Closed
Description
Prior to RDFLib 6, when rdflib_jsonld was a separate package and had to be imported separately, rdflib.util.guess_format would detect 'jsonld' as the suffix for JSON-LD format.
RDFLib 6 incorporates rdflib_jsonld but rdflib.util.guess_format no longer detects 'jsonld' as the suffix for JSON-LD files.
$ python3
Python 3.8.5 (v3.8.5:580fbb018f, Jul 20 2020, 12:11:27)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import rdflib
RDFLib Version: 6.0.0
>>> rdflib.util.SUFFIX_FORMAT_MAP
{'xml': 'xml', 'rdf': 'xml', 'owl': 'xml', 'n3': 'n3', 'ttl': 'turtle', 'nt': 'nt', 'trix': 'trix', 'xhtml': 'rdfa', 'html': 'rdfa', 'svg': 'rdfa', 'nq': 'nquads', 'trig': 'trig'}
>>> 'jsonld' in rdflib.util.SUFFIX_FORMAT_MAP
False
It is now necessary to import the json-ld parser separately, just as it was in the old days.
>>> import rdflib.plugins.parsers.jsonld
>>> rdflib.util.SUFFIX_FORMAT_MAP
{'xml': 'xml', 'rdf': 'xml', 'owl': 'xml', 'n3': 'n3', 'ttl': 'turtle', 'nt': 'nt', 'trix': 'trix', 'xhtml': 'rdfa', 'html': 'rdfa', 'svg': 'rdfa', 'nq': 'nquads', 'trig': 'trig', 'jsonld': 'application/ld+json'}
>>> 'jsonld' in rdflib.util.SUFFIX_FORMAT_MAP
True
This feels wrong. Why does the JSON-LD parser have to be imported separately to make rdflib.util.guess_format detect the JSON-LD format?
Can JSON-LD be an automatically detected format out of the box now that the JSON-LD parser is included in RDFLib?
Metadata
Metadata
Assignees
Labels
No labels