UNPKG

rdf-stores

Version:

A TypeScript/JavaScript implementation of the RDF/JS store interface with support for quoted triples.

42 lines 1.25 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.DatasetCoreWrapper = void 0; const RdfStore_1 = require("../RdfStore"); /** * A DatasetCoreWrapper exposes an RdfStore inside an RDF.DatasetCore. */ class DatasetCoreWrapper { constructor(store) { this.store = store; } get size() { return this.store.size; } add(quad) { this.store.addQuad(quad); return this; } delete(quad) { this.store.removeQuad(quad); return this; } has(quad) { // eslint-disable-next-line no-unreachable-loop for (const result of this.store.readQuads(quad.subject, quad.predicate, quad.object, quad.graph)) { return true; } return false; } match(subject, predicate, object, graph) { const newStore = new RdfStore_1.RdfStore(this.store.options); for (const quad of this.store.readQuads(subject, predicate, object, graph)) { newStore.addQuad(quad); } return new DatasetCoreWrapper(newStore); } [Symbol.iterator]() { return this.store.readQuads(); } } exports.DatasetCoreWrapper = DatasetCoreWrapper; //# sourceMappingURL=DatasetCoreWrapper.js.map