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
39 stars 3 forks source link

integrate shows strange behavior when JSON-LD is used #29

Closed TBoonX closed 1 year ago

TBoonX commented 1 year ago

Command:

java -jar $PATH_RPT integrate -o=local_licenses.jsonld --out-format=jsonld datasources.n3 get_licenses.rq

Version: 1.9.1

datasources.n3:

<http://dalicc.net/dependencygraph/dg_default/>
        <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>  <https://vocab.eccenca.com/di/Dataset> .

<https://coypu.org/datasource/COY%20Ontology%20%2F%20CoyPu%20Schema> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/ns/dcat#Dataset>.
<https://coypu.org/datasource/COY%20Ontology%20%2F%20CoyPu%20Schema> <http://purl.org/dc/terms/title> "COY Ontology / CoyPu Schema".
<https://coypu.org/datasource/COY%20Ontology%20%2F%20CoyPu%20Schema> <http://purl.org/dc/terms/language> "http://id.loc.gov/vocabulary/iso639-1/en".
<https://coypu.org/datasource/COY%20Ontology%20%2F%20CoyPu%20Schema> <http://purl.org/dc/terms/license> <http://dalicc.net/licenselibrary/CC-BY_v4>.

get_licenses.rq:

PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX odrl: <http://www.w3.org/ns/odrl/2/>
construct { ?license a odrl:Set . }
 WHERE {
   SELECT distinct ?license WHERE {
     ?ds a <http://www.w3.org/ns/dcat#Dataset> ;
     dcterms:license ?license .
   }

}

It shows an RDF result in the terminal, but writes [] into the jsonld file. With other formats it works.

Aklakan commented 1 year ago

One part of the issue seems to be that there is no streaming json ld writer in jena. The code is adapted that the request for formats for which no streaming writer exists now fall back to non-streaming serialization.

A useful improvement now would be writing out a log message whether streaming or non-streaming is used - not yet sure about how to handle this; e.g. the sink could either expose a flag or a more general set of capabilities.

Aklakan commented 1 year ago

A release candidate with the jsonld fix (and the latest jenax plugins) has been created at https://github.com/SmartDataAnalytics/RdfProcessingToolkit/releases/tag/v1.9.2-rc1

TBoonX commented 1 year ago

Works with RC1.

Aklakan commented 1 year ago

A couple of minor issues: