Protege使用swrl:equal比较数据类型属性的值 [英] Protege Using swrl:equal to compare the values of datatype property

查看:446
本文介绍了Protege使用swrl:equal比较数据类型属性的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在建立一个3类的本体:

I am building an ontology of 3 classes :

  1. 消息
  2. 火腿
  3. 垃圾邮件

2个dataproperties,domain:消息和范围xsd:string:

2 dataproperties , domain : Messages and range xsd:string :

  1. 有兴趣
  2. hasCategory

2个SWRL规则: Message(?x),hasInterest(?x,?a),hasCategory(?x,?b),swrl:equal(?a,?b)-> Ham(?x)

2 SWRL Rules: Message(?x),hasInterest(?x,?a),hasCategory(?x,?b), swrl:equal(?a,?b) ->Ham(?x)

Message(?x),hasInterest(?x,?a),hasCategory(?x,?b),swrl:notEqual(?a?b)->垃圾邮件(?x)

Message(?x),hasInterest(?x,?a),hasCategory(?x,?b), swrl:notEqual(?a?b) ->Spam(?x)

我想将Message类的实例分类为Spam或Ham类;如果hasCategory值(邮件类别)等于hasInterest值(用户兴趣),则邮件为垃圾邮件

I want to classify instances of class Message to class Spam or Ham ; if the hasCategory value ( message category) is equal to the hasInterest value ( user interests) then the message is ham else spam

如果我有1个消息类别和1个兴趣,这可以正常工作 前任: m1具有兴趣运动 m1具有类别体育

This worked correctly If I have 1 message category and 1 interest ex: m1 hasInterests sports m1 hasCategory sports

那么,如果我有一个清单或类别的清单,例如: 每则讯息都有1个以上的兴趣爱好{体育,电影} 每封邮件都有1个以上的类别{电影,政治}

So what If I have a list of iterests or categories ex: Each message has more than 1 interests {sports, movies} Each message has more than 1 category {movies , politics}

我想说如果两个列表都相交,则消息是火腿,因此swrl:equal无效,我如何定义它以比较所有个体

I want to say if both lists intersect then the message is ham so the swrl:equal did not work how can i define it to compare all the individuals

我所做的是根据个人意思重复hasInterests和hasCategory,我的意思是手动定义列表并起作用,是否有另一种自动方式使用字符串列表以及如何在swrl中进行比较?

What I did is repeating the hasInterests and hasCategory depending on the individual values I mean defining manually the list and it worked , is there another automatic way using a list of strings and how to compare them in swrl ?

推荐答案

SWRL字符串内置程序(

SWRL Built-Ins for Strings (http://www.daml.org/rules/proposal/builtins.html) only support simple string functions. In your model you can model a message individual m1 with many interests and many categories like this:

m1 hasInterests "sports", m1 hasInterests "movies" 
m1 hasCategory "sports", m1 m1 hasCategory "movies" 

并按照您的规则

Message(?x),hasInterest(?x,?a),hasCategory(?x,?b), swrl:equal(?a,?b) ->Ham(?x)

每条具有至少一个等于类别的兴趣的消息将变为Ham.

every message with at least one interest equal to a category becomes Ham.

使用SQWRL查询可能有用的提示来找到感兴趣的数量

Perhaps useful hint to find number of interests but with the SQWRL Query:

Message(?x) ^ hasInterest(?x,?a) → sqwrl:select(?x) ^ sqwrl:count(?a)

这篇关于Protege使用swrl:equal比较数据类型属性的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆