I am using Protege 3.4.8. Say I have some instances with a datatype property colors
and object property hasMeaning
. The value of colors
are represented by a string, e.g. red blue yellow
.
I'd like to create a rule like this: If one's colors contain red
but no blue
, then it has the meaning Happy
. My current rule is written as below:
colors(?x, ?y)
∧ swrlb:contains(?y, "red")
∧ swrlb:booleanNot(true, swrlb:contains(?y,"blue"))
→ hasMeaning(?x, Happy)
But I got Error: Expecting ',' or ')', got '('.
I followed the grammar provided here.
Any idea of what's wrong here? Thank you very much!
The abstract syntax for SWRL has this grammar for atoms:
atom ::= description '(' i-object ')'
| dataRange '(' d-object ')'
| individualvaluedPropertyID '(' i-object i-object ')'
| datavaluedPropertyID '(' i-object d-object ')'
| sameAs '(' i-object i-object ')'
| differentFrom '(' i-object i-object ')'
| builtIn '(' builtinID { d-object } ')'
builtinID ::= URIreference
The syntax for a builtIn
atom takes a list of d-objects
as arguments. The production for d-object
is:
d-object ::= d-variable | dataLiteral
The atom booleanNot( true, contains( ?string, "red" ))
is malformed because contains( ?string, "red" )
is not a d-object
, but an atom.