0

I need to write rules that compares dates. I modificated builtin_rdfsPlus-optimized.pie file by adding some prefices :

Prefices
{
    time : http://www.w3.org/2006/time#
    swrlb : http://www.w3.org/2003/11/swrlb#
}

And this rule :

Rules
{

    Id: rule_after

      insta <time:inXSDDate> datea
      instb <time:inXSDDate> dateb
      datea <swrlb:lessThanOrEqual> dateb
    ------------------------------------
      datea <time:after> dateb

}

I don't know how to express comparison between two variables. Here I used the property "lessThanOrEqual" from swrl. No "after" porperty is inferred after loading the custom ruleset file and graph with dates in GraphDB. Do I have to modifificate another given ruleset file ? I looked over the other files, and I didn't see any property that could express comparison.

Could you please help me ?

Thanks in advance.

Alice

alicer
  • 1

1 Answers1

0

The PIE files support only equality comparison (= or !=) because, at runtime, the inference reference has access only to the internal value ID but not the actual RDF value.

The only way to implement such logic is with a sequence of SPARQL queries, where you would lose the (1) automatic inference generation and (2) the smart retraction of statements. This is the only way to go if your data is not very dynamic. As an alternative, you can also go with highly complex queries (i.e., backward chaining approach), but you should be prepared for the complexity/performance becomes unpredictable.

Konstantin Petrov
  • 1,058
  • 6
  • 11