jena icon indicating copy to clipboard operation
jena copied to clipboard

"Safe" flag for riot RDFS inference

Open rybesh opened this issue 3 years ago • 4 comments

Version

4.7.0

Feature

Currently, riot RDFS inference outputs “generalized” RDF which may not be parsable by other tools (including various Jena CLI tools). For example:

data.ttl

PREFIX ex: <http://example.org/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

ex:louie ex:birthdate "2022-08-11”^^xsd:date .

vocab.ttl

PREFIX ex: <http://example.org/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> 

ex:birthdate rdfs:range xsd:date .

Output of riot --rdfs=vocab.ttl data.ttl

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> 

"2022-08-11”^^xsd:date rdf:type xsd:date .

… which is generalized RDF due to the literal in the subject position.

It would be nice if there were a flag to filter out such triples (using SafeGraph), so as to avoid errors when subsequently processing the output with tools that don't accept generalized RDF.

I’m interested in contributing a solution, but would need some pointers as to where in the codebase this should go.

Are you interested in contributing a solution yourself?

Perhaps?

rybesh avatar Jan 17 '23 19:01 rybesh

Is it only excluding generalised triples that have literals as subjects?

The RDF expansion is done by RDFSFactory.streamRDFS so adding a legality testing StreamRDF around that would work.

afs avatar Jan 18 '23 17:01 afs

It seems that riot --rdfs is follwing RDFS 1.1 instead of OWL (which redefines rdfs:range).

justin2004 avatar Apr 04 '24 15:04 justin2004