0

I am writing a SWRL rule in OWL which can infer if a person is of driving age or not. Person(?p), xsd:int[>= "18"^^xsd:int <= "65"^^xsd:int](?age), hasAge(?p, ?age) -> isDriverAge(?p, "True"xsd:Boolean) It gives me Unexpected Character '[' error

I saw similar syntax for Object Property (found here: https://dior.ics.muni.cz/~makub/owl/ ) but that is also not working when I tweaked my ontology as per this code: Person(?p), int[>= 18 , <= 65](?age), hasAge(?p, ?age) -> hasDriverAge(?p, True)

If you know the answer, could you please also provide me a resource which I can refer to write these rules. I don't want to keep coming back to stack and eat up other dev's time. Thanks

Dave
  • 1
  • 2
  • `xsd:int[>= "18"^^xsd:int <= "65"^^xsd:int]` look like an OWL datatype facet which doesn't make sense here as the property itself would be missing. Those facets or only used in class expressions like `Driver SubClassOf hasAge only xsd:int[>= "18"^^xsd:int <= "65"^^xsd:int]` – UninformedUser Dec 15 '22 at 11:33
  • for SWRL you should simply use SWRL comparison, i.e. `swrlb:greaterThanOrEqual` and `swrlb:lessThanOrEqual` – UninformedUser Dec 15 '22 at 11:34
  • Thanks, I tried ```Person(?p) ^ age(?p, ?a) ^ swrlb:greaterThanOrEqual(?a, 18) -> hasDriverAge(?p, True)``` and it worked. However, when I tried ```Person(?p) ^ age(?p, ?a) ^ swrlb:greaterThanOrEqual(?a, 18) ^ swrlb:smallerThanOrEqual(?a, 65) -> hasDriverAge(?p, True``` it threw error **Invalid SWRL atom predicate 'swrlb:smallerThanOrEqual'** – Dave Dec 15 '22 at 12:08
  • Well, as I said, it is `swrlb:lessThanOrEqual` not `smallerThanOrEqual` - "less" vs "smaller" – UninformedUser Dec 15 '22 at 12:23

0 Answers0