I checked the consistency of the toy ontology copied below using this CLI call:
stardog reasoning consistency http://*** -u *** -p ***
The call returns:
The database is NOT consistent.
This seemed wrong to me so I asked for the explanation and got this:
stardog reasoning explain -i http://*** -u *** -p ***
VIOLATED <http://www.semanticweb.org/datatype_test_202108041832#p1> rdfs:range <http://www.semanticweb.org/datatype_test_202108041832#mesh>
ASSERTED <http://www.semanticweb.org/datatype_test_202108041832#p1> rdfs:range <http://www.semanticweb.org/datatype_test_202108041832#mesh>
ASSERTED <http://www.semanticweb.org/datatype_test_202108041832#i1> <http://www.semanticweb.org/datatype_test_202108041832#p1> "2021-08-04"
But this is not a reason for inconsistency. "2021-08-04" is and is declared in the ontology as xsd:string, whose lexical space is contained in :mesh, so the violation reported above is false because "2021-08-04" belongs to the lexical space of :mesh.
Am I missing something?
(I tried also using DataUnionOf and tried to declare "2021-08-04" as "2021-08-04"^^:mesh - with the same result.)
Ontology (without the standard prefixes)
@prefix : <http://www.semanticweb.org/datatype_test_202108041832#> .
...
@base <http://www.semanticweb.org/datatype_test_202108041832> .
<http://www.semanticweb.org/datatype_test_202108041832> rdf:type owl:Ontology .
:mesh rdf:type rdfs:Datatype ;
owl:equivalentClass [ rdf:type rdfs:Datatype ;
owl:unionOf ( xsd:dateTime
xsd:dateTimeStamp
xsd:string
)
] .
:p1 rdf:type owl:DatatypeProperty ;
rdfs:range :mesh .
:i1 rdf:type owl:NamedIndividual ;
:p1 "2021-08-04"^^xsd:string .