跳到主要内容

Provenance

Import Trevas Provenance module

<dependency>
<groupId>fr.insee.trevas</groupId>
<artifactId>vtl-spark</artifactId>
<version>1.7.0</version>
</dependency>

ProvenanceListener

vtl-prov module expose the ProvenanceListener static class.

This class give access to the run function with the following signature:

run(String script, String programId, String programeName)

Program

run function returns a Program object, containing all provenance information of a script.

Program program = ProvenanceListener.run(script, "program-id", "program-name");

RDF

vtl-prov embeds jena package and expose RDFUtils static class.

Build RDF model

RDFUtils buildModel method enables to build easily a RDF model of Program:

Model model = RDFUtils.buildModel(program);

RDF serialization

RDFUtils buildModel enables to obtain easily a RDF serialization of Model:

String jsonLD = RDFUtils.serialize(model, "JSON-LD");
String ttl = RDFUtils.serialize(model, "TTL");
...

Load in triple store

RDFUrils loadModelWithCredentials enables to push easily RDF model in a triple store:

RDFUtils.loadModelWithCredentials(model, sparqlEndpoint, sparqlEndpointUser, sparlqEndpointPassword);