How to use the @rdfjs/data-model.quad 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 beautifulinteractions / node-quadstore / test / rdfstore.prototype.match.js View on Github external
it('should match quads by object',  async function () {
      const store = this.store;
      const rs = store;
      const quads = [
        factory.quad(
          factory.namedNode('http://ex.com/s'),
          factory.namedNode('http://ex.com/p'),
          factory.literal('o', 'en-gb'),
          factory.namedNode('http://ex.com/g2')
        ),
        factory.quad(
          factory.namedNode('http://ex.com/s'),
          factory.namedNode('http://ex.com/p'),
          factory.literal('o2', 'en-gb'),
          factory.namedNode('http://ex.com/g2')
        )
      ];
      const source = utils.createArrayStream(quads);
      await utils.waitForEvent(store.import(source), 'end', true);
      const object = factory.literal('o2', 'en-gb');
      const matchedQuads = await utils.streamToArray(rs.match(null, null, object));
github beautifulinteractions / node-quadstore / test / rdfstore.prototype.match.js View on Github external
it('should match quads by the default graph (implicit)',  async function () {
      const store = this.store;
      const rs = store;
      const quads = [
        factory.quad(
          factory.namedNode('http://ex.com/s0'),
          factory.namedNode('http://ex.com/p0'),
          factory.literal('o0', 'en-gb')
        ),
        factory.quad(
          factory.namedNode('http://ex.com/s1'),
          factory.namedNode('http://ex.com/p1'),
          factory.literal('o1', 'en-gb'),
          factory.namedNode('http://ex.com/g1')
        )
      ];
      const source = utils.createArrayStream(quads);
      await utils.waitForEvent(store.import(source), 'end', true);
      const readStream = rs.match(null, null, null, factory.defaultGraph());
      const matchedQuads = await utils.streamToArray(readStream);
      stripTermSerializedValue(matchedQuads);
github beautifulinteractions / node-quadstore / test / rdfstore.prototype.match.js View on Github external
it('should match the default graph (explicit)',  async function () {
      const store = this.store;
      const rs = store;
      const quads = [
        factory.quad(
          factory.namedNode('http://ex.com/s0'),
          factory.namedNode('http://ex.com/p0'),
          factory.literal('o0', 'en-gb'),
          factory.defaultGraph()
        ),
        factory.quad(
          factory.namedNode('http://ex.com/s1'),
          factory.namedNode('http://ex.com/p1'),
          factory.literal('o1', 'en-gb'),
          factory.namedNode('http://ex.com/g1')
        )
      ];
      const source = utils.createArrayStream(quads);
      await utils.waitForEvent(store.import(source), 'end', true);
      const matchedQuads = await utils.streamToArray(rs.match(null, null, null, factory.defaultGraph()));
      stripTermSerializedValue(matchedQuads);
github stephank / castling.club / src / shared / jsonld.js View on Github external
const fromPlainQuad = plainQuad =>
  rdf.quad(
    fromPlainTerm(plainQuad.subject),
    fromPlainTerm(plainQuad.predicate),
    fromPlainTerm(plainQuad.object),
    fromPlainTerm(plainQuad.graph)
  );

@rdfjs/data-model

A basic implementation of the RDF/JS Data Model

MIT
Latest version published 9 months ago

Package Health Score

61 / 100
Full package analysis