owlgraphdbreasoning

How does OWL2-RL handle date comparisons?


Is it possible to do "greater than date" that gets inferred by OWL2-RL in GraphDB? For ex: "Alice on date after 2024-02-10".

So for example:

:AliceTravelAfterToday a rdfs:Class ;
    rdfs:subClassOf :Person ;
    owl:equivalentClass [
        a owl:Class ;
        owl:intersectionOf (
            [ a owl:Class ;
              owl:oneOf ( :Alice ) ]
            [ a owl:Restriction ;
              owl:onProperty :canTravel ;
              owl:someValuesFrom [
                  owl:onDatatype xsd:date ;
                  owl:withRestrictions ( [ xsd:minExclusive "2024-02-10"^^xsd:date ] )
              ]
            ]
        )
    ] .

I have had no success with xsd:minExlusive or minInclusive with OWL2-RL on GraphDB.

Clarification: I'm fine with not using "today" as the date - that was more of a placeholder in my previous example (now edited to a date). I'm more interested in learning if

  1. OWL2-RL can infer minInclusive/maxInclusive (has anyone had success with implementing it)
  2. It can handle dates (like before or after)
  3. It can compare dates using minInclusive (ex: any date after "X" date)

Solution

  • OWL2-RL reasoner does not support inferring class membership based on date comparisons using restrictions like xsd:minExclusive or xsd:minInclusive, even if you use xsd:dateTime. This means that you cannot have a class definition such as “Alice on date after 2024-02-10” inferred automatically by the reasoner. Instead, you could perform the date comparison in your SPARQL query. For instance, load your data with the following Turtle file:

    @prefix : <http://example.org/> .
    @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
    @prefix owl: <http://www.w3.org/2002/07/owl#> .
    @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
    
    :Person a owl:Class .
    :canTravel a owl:DatatypeProperty .
    
    :Alice a :Person ;
           :canTravel "2024-02-11T00:00:00"^^xsd:dateTime .
    

    Then use the following SPARQL query with a FILTER to get individuals whose travel date is after 2024-02-10T00:00:00:

    PREFIX : <http://example.org/>
    PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
    
    SELECT ?person
    WHERE {
      ?person a :Person ;
              :canTravel ?date .
      FILTER(xsd:dateTime(?date) > "2024-02-10T00:00:00"^^xsd:dateTime)
    }