@lde/change-detection
v0.0.3
Published
Tell whether an RDF document changed since its last write, so writers can skip the unchanged ones
Readme
@lde/change-detection
Tell whether an RDF document changed since its last write, so a writer can skip the unchanged ones. The hash is stored with the document, as two triples on its IRI, in the same update.
Installation
npm install @lde/change-detectionimport {
detectChange,
SparqlContentHashReader,
withContentHash,
} from '@lde/change-detection';
const hashes = new SparqlContentHashReader({ endpoint });
const previous = (await hashes.read([iri])).get(iri.value);
const { status, hash } = await detectChange(document, previous, 'conversion-1');
if (status !== 'unchanged') {
await store.write(withContentHash(document, iri, hash));
}Documentation
See the full documentation.
