Skip to content

Commit

Permalink
Shapify (#65)
Browse files Browse the repository at this point in the history
* feat: implement shapify

* feat: implement ldesify_sds with tests

* 1.0.0-alpha.0

* 1.0.0-alpha.1

* chore: update dependencies

* feat: update README

* add hashtag in ID

* chore: make test more readable
  • Loading branch information
ajuvercr authored Oct 15, 2024
1 parent 933a8cb commit 1f47904
Show file tree
Hide file tree
Showing 14 changed files with 1,268 additions and 1,833 deletions.
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,33 @@ When a member arrives, all buckets that hold members with a timestamp older than

This processor takes a stream of raw entities (e.g., out from a RML transformation process) and creates versioned entities appending the current timestamp to the entity IRI to make it unique. It is capable of keeping a state so that unmodified entities are filtered.


### [`js:LdesifySDS`](https://github.com/rdf-connect/sds-processors/blob/master/configs/ldesify.ttl#L82)

Transform SDS-records in SDS-members, creating versioned objects.
The resulting objects are encapsulated in a graph (overriding other graphs).

Specify:
- `js:input` input channel
- `js:output` output channel
- `js:statePath` path for state file
- optional `js:sourceStream`
- `js:targetStream` newly created sds stream id
- optional `js:timestampPath`, defaults to `http://purl.org/dc/terms/modified`
- optional `js:versionOfPath`, defaults to `http://purl.org/dc/terms/isVersionOf`


### [`js:Shapify`](https://github.com/rdf-connect/sds-processors/blob/master/configs/shapify.ttl#L14)

Execute [Extract CBD Shape algorithm](https://github.com/TREEcg/extract-cbd-shape) on all sds records.
**Note:** this processor does not create a new sds stream.

Specify:
- `js:input` input channel
- `js:output` output channel
- `js:shape` used `sh:NodeShape`


### [`js:StreamJoin`](https://github.com/rdf-connect/sds-processors/blob/master/configs/stream_join.ttl#L10)

This processor can be used to join multiple input streams or Reader Channels (`js:input`) and pipe their data flow into a single output stream or Writer Channel (`js:output`). The processor will guarantee that all data elements are delivered downstream and will close the output if all inputs are closed.
Expand Down
82 changes: 82 additions & 0 deletions configs/ldesify.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,85 @@ js:Ldesify a js:JsProcess;
sh:maxCount 1;
].


js:LdesifySDS a js:JsProcess;
dc:title "Ldesify processor (for sds streams)";
dc:description "";
js:file <../lib/ldesify.js>;
js:function "ldesify_sds";
js:location <../>;
js:mapping [
a fno:Mapping;
fno:parameterMapping [
a fnom:PositionParameterMapping;
fnom:functionParameter "Data input channel";
fnom:implementationParameterPosition "0"^^xsd:int;
], [
a fnom:PositionParameterMapping;
fnom:functionParameter "Data output channel";
fnom:implementationParameterPosition "1"^^xsd:int;
], [
a fnom:PositionParameterMapping;
fnom:functionParameter "State file path";
fnom:implementationParameterPosition "2"^^xsd:int;
], [
a fnom:PositionParameterMapping;
fnom:functionParameter "Source Stream";
fnom:implementationParameterPosition "3"^^xsd:int;
], [
a fnom:PositionParameterMapping;
fnom:functionParameter "Target Stream";
fnom:implementationParameterPosition "4"^^xsd:int;
], [
a fnom:PositionParameterMapping;
fnom:functionParameter "Timestamp Path";
fnom:implementationParameterPosition "5"^^xsd:int;
], [
a fnom:PositionParameterMapping;
fnom:functionParameter "Version Of Path";
fnom:implementationParameterPosition "6"^^xsd:int;
];
].


[ ] a sh:NodeShape;
sh:targetClass js:LdesifySDS;
sh:property [
sh:class :ReaderChannel;
sh:path js:input;
sh:name "Data input channel";
sh:maxCount 1;
sh:minCount 1;
], [
sh:class :WriterChannel;
sh:path js:output;
sh:name "Data output channel";
sh:maxCount 1;
sh:minCount 1;
], [
sh:datatype xsd:string;
sh:path js:statePath;
sh:name "State file path";
sh:maxCount 1;
], [
sh:datatype xsd:iri;
sh:path js:sourceStream;
sh:name "Source Stream";
sh:maxCount 1;
], [
sh:datatype xsd:iri;
sh:path js:targetStream;
sh:name "Target Stream";
sh:minCount 1;
sh:maxCount 1;
], [
sh:datatype xsd:iri;
sh:path js:timestampPath;
sh:name "Timestamp Path";
sh:maxCount 1;
], [
sh:datatype xsd:iri;
sh:path js:versionOfPath;
sh:name "Version Of Path";
sh:maxCount 1;
].
74 changes: 74 additions & 0 deletions configs/shapify.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
@prefix dcterms: <http://purl.org/dc/terms/>.
@prefix sosa: <http://www.w3.org/ns/sosa/>.
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix js: <https://w3id.org/conn/js#>.
@prefix fno: <https://w3id.org/function/ontology#>.
@prefix fnom: <https://w3id.org/function/vocabulary/mapping#>.
@prefix xsd: <http://www.w3.org/2001/XMLSchema#>.
@prefix : <https://w3id.org/conn#>.
@prefix sh: <http://www.w3.org/ns/shacl#>.
@prefix owl: <http://www.w3.org/2002/07/owl#>.
@prefix dc: <http://purl.org/dc/terms/>.
@prefix rdfl: <https://w3id.org/rdf-lens/ontology#>.

js:Shapify a js:JsProcess;
dc:title "Shapify processor";
dc:description "";
js:file <../lib/shapify.js>;
js:function "shapify";
js:location <../>;
js:mapping [
a fno:Mapping;
fno:parameterMapping [
a fnom:PositionParameterMapping;
fnom:functionParameter "Data input channel";
fnom:implementationParameterPosition "0"^^xsd:int;
], [
a fnom:PositionParameterMapping;
fnom:functionParameter "Data output channel";
fnom:implementationParameterPosition "1"^^xsd:int;
], [
a fnom:PositionParameterMapping;
fnom:functionParameter "Shape";
fnom:implementationParameterPosition "2"^^xsd:int;
];
].

[ ] a sh:NodeShape;
sh:targetClass js:Shape;
sh:property [
sh:datatype xsd:any;
sh:path ( );
sh:name "id";
sh:minCount 1;
sh:maxCount 1;
], [
sh:class rdfl:Context;
sh:path ( );
sh:name "quads";
sh:minCount 1;
sh:maxCount 1;
].

[ ] a sh:NodeShape;
sh:targetClass js:Shapify;
sh:property [
sh:class :ReaderChannel;
sh:path js:input;
sh:name "Data input channel";
sh:maxCount 1;
sh:minCount 1;
], [
sh:class :WriterChannel;
sh:path js:output;
sh:name "Data output channel";
sh:maxCount 1;
sh:minCount 1;
], [
sh:class js:Shape;
sh:path js:shape;
sh:name "Shape";
sh:minCount 1;
sh:maxCount 1;
].

Loading

0 comments on commit 1f47904

Please sign in to comment.