RDFLib / pySHACL

A Python validator for SHACL
Apache License 2.0
241 stars 63 forks source link

[Discussion] Unexpected behaviour of OWL-RL reasoner #194

Closed arrascue closed 11 months ago

arrascue commented 11 months ago

We were trying pyshacl's owlrl reasoner (v=0.23.0) and found that some of the inferred facts would cause the graph to be unparseable in some triplestores.

We have reduced our graph to a minimal example to explain the problem:

@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

<https:example.org/A> dcterms:issued "2018-06-21T12:00:00"^^xsd:dateTime .

The function we used to generate the graph was:

def _get_augmented_graph(my_graph: Graph) -> Graph:
    validator = Validator(
        data_graph=my_graph,
        options={
            "inference": "owlrl",
            "advanced": True,
        },
        ont_graph=Graph(),
    )
    validator.run()
    augmented_graph = validator.target_graph
    return augmented_graph

The augmented graph contains the following (problematic) triple:

"2018-06-21T12:00:00"^^xsd:dateTime a xsd:dateTime ;
    owl:sameAs "2018-06-21T12:00:00"^^xsd:dateTime .

The problem here is that a literal appears in the position of subject, which is not compliant with RDF.

If we tried to upload the serialized augmented graph to GraphDB, we would get a parsing error.

Another interesting fact is that with other OWL-RL reasoners, these statements with literals as the first component of a triple are not present. We concretely refer here to OWL-RL repository in GraphDB.

So, we were wondering what is the role of these types of triples with literals as subjects.

Thank you in advance.

ashleysommer commented 11 months ago

Hi @arrascue Looks like you opened this issue in the wrong repo. The OWL-RL inferencer is here: https://github.com/RDFLib/OWL-RL

arrascue commented 11 months ago

Thank you for pointing to the right repository :-)