SmartDataAnalytics / RdfProcessingToolkit

Command line interface based RDF processing toolkit to run sequences of SPARQL statements ad-hoc on RDF datasets, streams of bindings and streams of named graphs with support for processing JSON, CSV and XML using function extensions
https://smartdataanalytics.github.io/RdfProcessingToolkit/
Other
40 stars 3 forks source link

Environment substitution not working with the new SparqlScriptProcessor. #20

Closed Aklakan closed 1 year ago

Aklakan commented 3 years ago

Environment sustitution for IRIs such as in

$> FOO=bar sparql-integrate file.sparql

file.sparql:
SELECT * { BIND(<env:FOO> AS ?bar) }

stopped working after consolidating lots of logic into the SparqlScriptProcessor.

Although the SparqlScriptProcessor is configured with a parser that is wrapped with a post processor to perform environment substitution, the SparqlScriptProcessor invokes SparqlStmtUtils.processFile(...) which internally creates a new parser instance.

Hence,processFileneeds to be changed to accept a parser as an argument.

Aklakan commented 1 year ago

Should be long fixed - just tested this and it works as expected:

FOO=bar rpt integrate '(<env:FOO> AS ?x) {}' --out-format csv
# x
# bar