SWRL:如何使用内置swrlb:booleanNot?(SWRL: How to use the built

编程入门 行业动态 更新时间:2024-10-25 16:21:41
SWRL:如何使用内置swrlb:booleanNot?(SWRL: How to use the built-in swrlb:booleanNot?)

我正在使用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 ::= URIreference

builtIn 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 ::= 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.

更多推荐

本文发布于:2023-08-04 17:01:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1417721.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何使用   SWRL   swrlb   built   booleanNot

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!