https://github.com/incf-nidash/nidm-specs
Raw File
Tip revision: b568043b81e75110d63b994c00aa17275a5f4614 authored by Karl Helmer on 22 March 2023, 15:46:01 UTC
Merge pull request #506 from dnkennedy/patch-1
Tip revision: b568043
test_jsonldification.py
import rdflib as rl
import pyld as ld
import json

g = rl.ConjunctiveGraph()
g.parse(('https://raw.githubusercontent.com/incf-nidash/nidm-specs/master/nidm/nidm-results'
        '/spm/example001/example001_spm_results.ttl'), 
        format='turtle')
g2 = g.serialize(format='json-ld')

context = { "@context": "https://raw.githubusercontent.com/satra/nidm-jsonld/master/nidm-results.jsonld" }
foo = ld.jsonld.compact(json.loads(g2), context)
print(json.dumps(foo, indent=2))
back to top