RDFLib / OWL-RL

A simple implementation of the OWL2 RL Profile on top of RDFLib: it expands the graph with all possible triples that OWL RL defines. It can be used together with RDFLib to expand an RDFLib Graph object, or as a stand alone service with its own serialization.
http://www.ivan-herman.net/Misc/2008/owlrl/
Other
144 stars 30 forks source link

owlrl relies on `OWL.Datatype` which does not exist in the OWL namespace in rdflib #53

Open jgeluk opened 2 years ago

jgeluk commented 2 years ago

This line fails with rdflib 6.1.1 because the OWL namespace defined in rdflib does not support the OWL.Datatype property:

https://github.com/RDFLib/OWL-RL/blob/a77e1791b88b54aace609bc6000aac14c7add4ff/owlrl/OWLRLExtras.py#L354

jgeluk commented 2 years ago

See also https://github.com/RDFLib/rdflib/blob/55d6622a0a7657d8d36b909add96169ba9e6553d/rdflib/namespace/_OWL.py#L79

jgeluk commented 2 years ago

Workaround:

OWL._fail = False
jgeluk commented 2 years ago

Renamed OWL.Datatype to OWL.DatatypeProperty in this fork: https://github.com/EKGF/OWL-RL

jjoao commented 2 years ago

This looks a cut and paste like a typo: OWL:Datatype should be RDFS:Datatype

jjoao commented 2 years ago

Renamed OWL.Datatype to OWL.DatatypeProperty in this fork: https://github.com/EKGF/OWL-RL

This is not ideal: you are adding "to be removes triple" like to_be_removed.add((OWL.DataRange, OWL.equivalentClass, RDFS.Datatype)) That will never happens (and fail to remove some noise) => RDFS:Datatype

jgeluk commented 2 years ago

Alright, makes sense.

majidaldo commented 2 years ago

can this be merged asap? seems like a trivial fix.

djherron commented 1 year ago

I had the same issue. I agree with the assessment made by @jjoao . It looks like copy/paste typo errors in two lines in the method 'post_process(self)' of class OWLRL_Extension_Trimming. Consider these 3 lines of code:

    to_be_removed.add((RDFS.Datatype, OWL.equivalentClass, OWL.DataRange))
    to_be_removed.add((OWL.DataRange, RDFS.subClassOf, OWL.Datatype))
    to_be_removed.add((OWL.DataRange, OWL.equivalentClass, OWL.Datatype))

The first of these 3 lines refers to RDFS.Datatype, but the other two lines mistakenly refer to OWL.Datatype, which doesn't exist in the OWL namespace. So a fix involves changing OWL.Datatype to RDFS.Datatype in these two lines.

majidaldo commented 1 year ago

bump