Created
March 22, 2017 17:03
-
-
Save bshambaugh/7488b14106fdd2ac4a08f49c47979d46 to your computer and use it in GitHub Desktop.
A simple example converting jsonld to nquads
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var jsonld = require('jsonld'); | |
var doc = | |
{ | |
"@context": "http://json-ld.org/contexts/person.jsonld", | |
"@id": "http://dbpedia.org/resource/John_Lennon", | |
"name": "John Lennon", | |
"born": "1940-10-09", | |
"spouse": "http://dbpedia.org/resource/Cynthia_Lennon" | |
}; | |
// serialize a document to N-Quads (RDF) | |
jsonld.toRDF(doc, {format: 'application/nquads'}, function(err, nquads) { | |
console.log(nquads); | |
// nquads is a string of nquads | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment