Is there a way to convert JSON-LD to N-Quads format?

白昼怎懂夜的黑 提交于 2019-12-11 18:08:36

问题


We have a requirement where we will be storing data in JSON-LD format for maintaining catalog and data from catalog will be pulled in batches to graph DB which supports RDF data format. We have been looking at Cayley and DBgraph for this purpose but these DB support N-Quads as their data format.

If there is a graph db which has JSON-LD data format or if there is way to convert JSON-LD format to N-Quads/Turtle format?


回答1:


Converting JSON-LD to N-Quads (and back) are core algorithms described in the JSON-LD API specification. Any conforming JSON-LD processor supports this




回答2:


Pyld provides an option to normalise jsonld to other RDF formats.

# normalize a document using the RDF Dataset Normalization Algorithm
# (URDNA2015), see: http://json-ld.github.io/normalization/spec/
normalized = jsonld.normalize(
    doc, {'algorithm': 'URDNA2015', 'format': 'application/nquads'})
# normalized is a string that is a canonical representation of the document
# that can be used for hashing, comparison, etc.

Below is the link:

https://github.com/digitalbazaar/pyld



来源:https://stackoverflow.com/questions/48275500/is-there-a-way-to-convert-json-ld-to-n-quads-format

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!