How to use the @rdfjs/data-model.blankNode function in @rdfjs/data-model

To help you get started, we’ve selected a few @rdfjs/data-model examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github comunica / comunica / packages / actor-rdf-parse-jsonld / lib / ActorRdfParseJsonLd.ts View on Github external
public static mapTerm(term: any): RDF.Term {
    switch (term.termType) {
    case 'NamedNode':
      return namedNode(term.value);
    case 'BlankNode':
      return blankNode(term.value.substr(2)); // Remove the '_:' prefix.
    case 'Literal':
      return literal(term.value, term.language || term.datatype);
    /*case 'Variable':
      return variable(term.value);*/ // Variables can not occur in JSON-LD bodies
    case 'DefaultGraph':
      return defaultGraph();
    }
  }
github stephank / castling.club / src / shared / jsonld.js View on Github external
const fromPlainTerm = plainTerm => {
  switch (plainTerm.termType) {
    case "NamedNode":
      return rdf.namedNode(plainTerm.value);
    case "BlankNode":
      return rdf.blankNode(plainTerm.value.substr(2));
    case "Literal":
      return rdf.literal(
        plainTerm.value,
        plainTerm.language || rdf.namedNode(plainTerm.datatype.value)
      );
    case "DefaultGraph":
      return rdf.defaultGraph();
    default:
      throw Error("unknown termType: " + plainTerm.termType);
  }
};
github pietercolpaert / ldfetch / lib / JsonldToRDF.js View on Github external
term (plainTerm) {
    switch (plainTerm.termType) {
      case 'NamedNode':
        return DataFactory.namedNode(plainTerm.value)
      case 'BlankNode':
        return DataFactory.blankNode(plainTerm.value.substr(2))
      case 'Literal':
        return DataFactory.literal(plainTerm.value, plainTerm.language || DataFactory.namedNode(plainTerm.datatype.value))
      case 'DefaultGraph':
        return DataFactory.defaultGraph()
      default:
        throw Error('unknown termType: ' + plainTerm.termType)
    }
  }
github comunica / comunica / packages / actor-query-operation-construct / lib / BindingsToQuadsIterator.ts View on Github external
public static localizeBlankNode(blankNodeCounter: number,
                                  term: RDF.Term): RDF.Term {
    if (term.termType === 'BlankNode') {
      return blankNode(term.value + blankNodeCounter);
    }
    return term;
  }

@rdfjs/data-model

A basic implementation of the RDF/JS Data Model

MIT
Latest version published 11 months ago

Package Health Score

65 / 100
Full package analysis