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

Function toJsonLdTriple

lib/views/RdfView.js:132–144  ·  view source on GitHub ↗
(subject, predicate, object)

Source from the content-addressed store, hash-verified

130
131// Converts a triple to the JSON-LD library representation
132function toJsonLdTriple(subject, predicate, object) {
133 return {
134 subject: { value: subject, type: subject[0] !== '_' ? 'IRI' : 'blank node' },
135 predicate: { value: predicate, type: predicate[0] !== '_' ? 'IRI' : 'blank node' },
136 object: !N3.Util.isLiteral(object) ?
137 { value: object, type: object[0] !== '_' ? 'IRI' : 'blank node' } :
138 {
139 value: N3.Util.getLiteralValue(object),
140 datatype: N3.Util.getLiteralType(object),
141 language: N3.Util.getLiteralLanguage(object),
142 },
143 };
144}
145
146module.exports = RdfView;

Callers 1

RdfView.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected