Add graph information when serializing from JSON-LD to N-Quads

95 Views Asked by At

I have some JSON-LD objects that I want to serialize to N-Quads, but I can't figure out how to add the graph information to the JSON-LD. This is an example of the JSON-LD I have:

{
   'name':u'Meppel',
   'classification':u'Municipality',
   'ori_identifier':   u'https://id.openraadsinformatie.nl/1',
   'had_primary_source':   u'https://argu.co/voc/mapping/meppel/cbs/identifier/gm0119',
   'collection':u'meppel',
   '@context':{
      'name':{
         '@id':'http://www.w3.org/2004/02/skos/core#prefLabel'
      },
      'classification':{
         '@id':'http://www.semanticdesktop.org/ontologies/2007/04/02/ncal#categories'
      },
      'ori_identifier':'@id',
      'had_primary_source':{
         '@id':'http://www.w3.org/ns/prov#hadPrimarySource'
      },
      'collection':{
         '@id':'https://argu.co/ns/meta#collection'
      },
      '@base':'https://id.openraadsinformatie.nl/',
      'Organization':'http://www.w3.org/ns/org#Organization',
      'description':{
         '@id':'http://purl.org/dc/terms/description'
      }
   },
   '@type':'Organization',
   'description':u'Gemeentelijke herindeling per 01-01-1998\r\nBegindatum voor 1830'
}

When serializing this to n-quads I want to add the graph information as the fourth column so that it serializes to this:

<https://id.openraadsinformatie.nl/1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/ns/org#Organization> <http://purl.org/link-lib/supplant> .
<https://id.openraadsinformatie.nl/1> <http://www.w3.org/2004/02/skos/core#prefLabel> "Meppel" <http://purl.org/link-lib/supplant> .
<https://id.openraadsinformatie.nl/1> <http://www.w3.org/ns/prov#hadPrimarySource> "https://argu.co/voc/mapping/meppel/ibabs/identifier/41121" <http://purl.org/link-lib/supplant> .

How can I add the graph name (http://purl.org/link-lib/supplant) to the JSON-LD? I tried simply adding an @graph to the JSON-LD object but with no succes.

0

There are 0 best solutions below