(json, addTriple, done)
| 32 | |
| 33 | // Extracts triples from a JSON-LD document |
| 34 | function extractTriples(json, addTriple, done) { |
| 35 | jsonld.toRDF(json, function (error, triples) { |
| 36 | for (var graphName in triples) { |
| 37 | triples[graphName].forEach(function (triple) { |
| 38 | addTriple(triple.subject.value, |
| 39 | triple.predicate.value, |
| 40 | convertEntity(triple.object)); |
| 41 | }); |
| 42 | } |
| 43 | done(error); |
| 44 | }); |
| 45 | } |
| 46 | |
| 47 | // Converts a jsonld.js entity to the N3.js in-memory representation |
| 48 | function convertEntity(entity) { |
no test coverage detected