0

I am trying to reproduce the example code from https://github.com/RDFLib/rdflib-jsonld as below:

from rdflib import Graph, plugin
from rdflib.serializer import Serializer
testrdf = '''
@prefix dc: <http://purl.org/dc/terms/> .
<http://example.org/about>
dc:title "Someone's Homepage"@en .
'''
g = Graph().parse(data=testrdf, format='n3')
print(g.serialize(format='json-ld', indent=4))

However, it seems my python output was not printed as same as the expected result.

The result should be:

{
    "@id": "http://example.org/about",
    "http://purl.org/dc/terms/title": [
        {
             "@language": "en",
             "@value": "Someone's Homepage"
        }
    ]
}

but I got these output

b'[\n    {\n        "@id": "http://example.org/about",\n        "http://purl.org/dc/terms/title": [\n            {\n                "@language": "en",\n                "@value": "Someone\'s Homepage"\n            }\n        ]\n    }\n]'

Is there any extra setup that I have to do in order to get the proper output?

suesalito
  • 3
  • 1

0 Answers0