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

Base URL is ignored for files specfied as CLI arguments #42

Closed Aklakan closed 1 year ago

Aklakan commented 1 year ago

Dumping data loaded using

rpt integrate file.ttl

where file.ttl has the content

@prefix rr: <http://www.w3.org/ns/r2rml#> .
@base <http://example.com/base/> .

<TriplesMap1>
    a rr:TriplesMap .

Returns <TriplesMap1> without being prefixed by the base IRI. The bug appears to be somewhere inRDFDataMgrRx.createIteratorTriples. Also, by now Jena has the improved AsyncParser so it may be better to switch to it.

Aklakan commented 1 year ago

Seems to be fixed by changing one line in IRIxResolverUtils:

    public static IRIxResolver newIRIxResolverAsGiven(String baseIri) {

        IRIxResolver result = baseIri == null
                ? IRIxResolver.create().noBase().resolve(true /* WAS FALSE */).allowRelative(true).build()
                : ...

When a base IRI is set after initializing the resolver, future IRIs seem to become resolved correctly. As long as the base is not set, IRIs remain relative.