MCPcopy Create free account
hub / github.com/LinkedDataFragments/Server.js / extractTriples

Function extractTriples

lib/datasources/JsonLdDatasource.js:34–45  ·  view source on GitHub ↗
(json, addTriple, done)

Source from the content-addressed store, hash-verified

32
33// Extracts triples from a JSON-LD document
34function 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
48function convertEntity(entity) {

Callers 1

Calls 2

convertEntityFunction · 0.85
doneFunction · 0.85

Tested by

no test coverage detected