Applies a substring fragmentation to LDES members
npm install @treecg/ldes-substring-bucketizerThe purpose of the substring bucketizer is to apply a substring fragmentation tot LDES members based on a property path.
> An LDES bucketizer adds triples with the ldes bucket predicate (https://w3id.org/ldes#bucket) to the array of quads representating an LDES member, indicating the bucket in which the member belongs.
The fragmentation strategy is based on previous work and the following method is applied:
!Fragmentation Strategy
We assume the following LDES member on which a substring fragmentation with the property path set to ( will be applied.
``ttl`
dct:isVersionOf
prov:generatedAtTime "2021-09-07T15:44:05.975Z"^^xsd:dateTime ;
rdfs:label "John Doe" .
After passing through the bucketizer, the LDES member will have extra triples:
`ttl`
dct:isVersionOf
prov:generatedAtTime "2021-09-07T15:44:05.975Z"^^xsd:dateTime ;
rdfs:label "John Doe" ;
ldes:bucket "j", "jo", "joh", "john", "d", "do", "doe" .
`bash`
> npm i @treecg/ldes-substring-bucketizer
A bucketizer should always be used in combination with the LDES client. More information on how to setup an LDES client can be found here. It is important to set the option in the LDES client to receive the LDES member as an array of quads: representation: 'quads'.
The bucketizer expects a property path as input and should have the following structure (
`
import { SubstringBucketzer } from '@treecg/ldes-substring-bucketizer'
const run = async (): Promise
const options = {...};
const url = ...;
const bucketizer = await SubstringBucketizer.build('(
const ldes = LDESClient.createReadStream(url, options);
ldes.on('data', (member) => {
bucketizer.bucketize(member.quads, member.id)
// Continue processing the member, but now the array of quads will have an extra triples, the bucket triples
});
}
run().catch(error => console.error(error.stack));
``