A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/RDFLib/rdflib/issues/2138 below:

[json-ld serialisation] Context.to_dict() is not implemented (anymore?) · Issue #2138 · RDFLib/rdflib · GitHub

The to_dict() method is missing on Context:

Though this seems to have been implemented and merged before: RDFLib/rdflib-jsonld#51 , it is no longer present in the current codebase. However, it is still referenced: https://github.com/RDFLib/rdflib/blob/main/rdflib/plugins/serializers/jsonld.py#L126 , so this leads to an error if you pass an explicit Context instance:

>>> g.serialize(format='json-ld', auto_compact=True,context=c3)
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/home/proycon/work/codemetapy/env/lib/python3.10/site-packages/rdflib/graph.py", line 1186, in serialize
    serializer.serialize(stream, base=base, encoding="utf-8", **args)
  File "/home/proycon/work/codemetapy/env/lib/python3.10/site-packages/rdflib/plugins/serializers/jsonld.py", line 84, in serialize
    obj = from_rdf(
  File "/home/proycon/work/codemetapy/env/lib/python3.10/site-packages/rdflib/plugins/serializers/jsonld.py", line 126, in from_rdf
    context_data = context.to_dict()
AttributeError: 'Context' object has no attribute 'to_dict'

Perhaps the solution is to re-apply the old pull request?


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4