Skip to content

The SWRL temporal built-in "temporal:equals" doesn't work as expected #90

Description

@Ines-Akaichi

I am using the SWRL temporal built-ins provided in [1] to compare dateTime values. I am mainly interested in the following operators: equals, before, after.

"before" and "after" work for me given the example below. However, my issue is when using "equals".

For example, I have the following RDF:


@prefix : <http://example.org/test#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix ex: <http://example.org#> .

:elapse1    :hasTime   "2026-01-11T17:30:00"^^xsd:dateTime .

:elapse2    :hasTime   "2026-01-11T17:30:00"^^xsd:dateTime .

:elapse3    :hasTime   "2026-01-11T11:30:00"^^xsd:dateTime .

:BeforeEvent rdf:type owl:Class .
:AfterEvent rdf:type owl:Class .
:Equals rdf:type owl:Class . 

:hasTime a owl:DatatypeProperty ;
        rdfs:range xsd:dateTime .

I also have the following SWRL rules:

  :hasTime (?e1,?t1) ^ :hasTime (?e2,?t2) ^ temporal:before(?t1,?t2) -> :BeforeEvent(?e1)

   :hasTime (?e1,?t1) ^ :hasTime (?e2,?t2) ^ temporal:after(?t1,?t2) -> :AfterEvent(?e1)

   :hasTime (?e1,?t1) ^ :hasTime (?e2,?t2) ^ temporal:equals(?t2,?t1) -> :Equals(?e2)

I run these rules using the SWRLTab in Protege 5.6.7

The result shows me the following:

:elapse1 a :AfterEvent, :Equals .
:elapse2 a :AfterEvent, :Equals .
:elapse3 a :BeforeEvent, :Equals .               

I understand that :elapse1 and :elapse2 are of type :AfterEvent. I also understand that :elapse3 is of type :BeforeEvent. What I don't understand is why :elapse1, :elapse2, and :elapse3 are of type Equals. Specifically :elapse3 is different from :elapse1 and :elapse2. I expected that only both :elapse1 and :elapse2 are of type :Equals.

Anyone has an explanation for this behavior?

Thanks a lot!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions