我正在使用Protege 3.4.8。 假设我有一些数据类型属性colors和对象属性hasMeaning 。 colors的值由字符串表示,例如red blue yellow 。
我想创建一个这样的规则:如果一个人的颜色包含red但没有blue ,那么它的含义就是Happy 。 我目前的规则如下:
colors(?x, ?y) ∧ swrlb:contains(?y, "red") ∧ swrlb:booleanNot(true, swrlb:contains(?y,"blue")) → hasMeaning(?x, Happy)
但是我得到了Error: Expecting ',' or ')', got '('.
我按照这里提供的语法。
知道这里有什么问题吗? 非常感谢你!
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!
最满意答案
SWRL的抽象语法具有原子语法:
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 ::= URIreferencebuiltIn atom的语法将d-objects列表作为参数。 d-object的制作是:
d-object ::= d-variable | dataLiteral原子booleanNot( true, contains( ?string, "red" ))格式错误,因为contains( ?string, "red" )不是d-object ,而是atom。
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 ::= URIreferenceThe syntax for a builtIn atom takes a list of d-objects as arguments. The production for d-object is:
d-object ::= d-variable | dataLiteralThe atom booleanNot( true, contains( ?string, "red" )) is malformed because contains( ?string, "red" ) is not a d-object, but an atom.
更多推荐
发布评论