问题
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