Jena Riot infers invalid RDF (with literals as subjects)

30 Views Asked by At

I'm feeding RDF inferred by the Jena riot CLI tool into the shacl cli tool.

My schema definition contains something like this:

lob:account_number
    rdfs:domain lob:Account;
    rdfs:range xsd:string .

and the data contains this:

:cbaEverydayOffset a :BankAccount;
  rdfs:label "Everyday Offset Account";
  :bsb "063-791"^^xsd:string;
  :account_number "1234567".

I then run it through riot like this:

riot --rdfs=tbox.ttl --strict --formatted=ttl abox.ttl > inferred.ttl

I then try to validate using shacl, but it is crashing because my file inferred.ttl contains assertions like this:

"1234567" rdf:type xsd:string .

which I thought was invalid RDF. Is this an incompatibility somehow related to RDF*? What do I do about it?

1

There are 1 best solutions below

2
AndyS On

Yes - the RDF is invalid. It is not RDF-star related.

The rule-expansion is given by rule rdfs3 in https://www.w3.org/TR/rdf11-mt/#patterns-of-rdfs-entailment-informative

riot application of --rdfs= is direct application of the RDFS entailment rules.

Classes are sets of the resources in the domain being modelled. The class of literal values is rdfs:Literal - the values, not the representation as pairs of lexical form and datatype.

The outcome of rdfs3 with literals can't be written in RDF only because of the no-literals-as-subjects rule (a historical feature).

Something close is:

_:a rdf:type xsd:string .
_:a rdf:value "1234567" .