繁体   English   中英

从SWRL规则创建Jena规则

[英]Creating Jena Rules from SWRL rules

请如何创建耶拿规则。 我有SWRL规则

    1-System(?x) ∧ hasNbAbsence(?x, ?y) ∧ swrlb:greaterThan(?y, 10) →  BadBehaviorOperators(?x)
2-System(?x) ∧ hasNbAbsence(?x, ?y) ∧ swrlb:lessThanOrEqual(?y, 10) →  GoodBehaviorOperators(?x)
3-System(?x) ∧ hasNbStations(?x, ?y) ∧ swrlb:greaterThan(?y, 50) ∧ hasTimeBetweenSuccTravel(?x, ?z) ∧  swrlb:lessThanOrEqual(?z, 15) →  HighAvailableSystem(?x)
4-System(?x) ∧ hasNbAccident(?x, ?y) ∧ swrlb:greaterThan(?y, 30) →  InsecureSystem(?x)
5-System(?x) ∧ hasNbStations(?x, ?y) ∧ swrlb:lessThanOrEqual(?y, 25) ∧ hasTimeBetweenSuccTravel(?x, ?z) ∧  swrlb:greaterThan(?z, 30) →  LowAvailableSystem(?x)
6-System(?x) ∧ hasNbStations(?x, ?y) ∧ swrlb:lessThanOrEqual(?y, 50) ∧ swrlb:greaterThan(?y, 25) ∧  hasTimeBetweenSuccTravel(?x, ?z) ∧ swrlb:greaterThan(?z, 15) ∧ swrlb:lessThanOrEqual(?z, 30) →  MiddleAvailableSystem(?x)
7-System(?x) ∧ hasDelayDuration(?x, ?y) ∧ swrlb:greaterThan(?y, 5) ∧ swrlb:lessThanOrEqual(?y, 10) ∧ hasNbDelays(?x, ?z) ∧  swrlb:greaterThan(?z, 10) ∧ swrlb:lessThanOrEqual(?z, 30) →  MiddleRespectTimeSystem(?x)
8-System(?x) ∧ hasNbAccident(?x, ?y) ∧ swrlb:greaterThanOrEqual(?y, 10) ∧ swrlb:lessThanOrEqual(?y, 30) →  MiddleSecureSystem(?x)
9-System(?x) ∧ hasNbDelays(?x, ?y) ∧ swrlb:lessThanOrEqual(?y, 5) ∧ hasDelayDuration(?x, ?z) ∧  swrlb:lessThanOrEqual(?z, 10) →  RespectTimeSystem(?x)
10-System(?x) ∧ hasNbAccident(?x, ?y) ∧ swrlb:lessThan(?y, 10) →  SecureSystem(?x)
11-System(?x) ∧ hasNbDelays(?x, ?y) ∧ swrlb:greaterThan(?y, 10) ∧ hasDelayDuration(?x, ?z) ∧ swrlb:greaterThan(?z, 30) →  UnrespectTimeSystem(?x)

谢谢大家

我不知道(也不认为有)此任务的API。 但是您可以自己轻松地做到这一点。

您可以在http://jena.apache.org/documentation/inference/中找到语法,只需使用三重模式即可。

第一个示例应转换为(我从未使用过SWRL):

[RuleExample: (?X rdf:type NS:System), (?X NS:hasNbAbsence ?Y), greaterThan(?Y, 10)
-> (?X rdf:type NS:BadBehaviorOperators)]

其中NS是您的本体的Uri。

有关完整的语法和解释,我将查看官方网站(上面的链接)。

没有任何代码可以随时执行这种类型的转换(当然,除非您自己编写),但实际上并不需要。 您可以直接将SWRL规则放入本体中,而不必像Jena规则那样必须指定外部规则文件。 因此,您在这里有几个选择:
1)将规则编码为本体中的SWRL规则。 这可以通过protege来完成,或者如果您有信心使用swrl xml语法自己完成:)
参考: http//www.w3.org/Submission/SWRL/#5

2)在Jena中,即使用Jena规则语法的文本文件中编写等效规则。 由于Jena的规则节点(或原子,如果类似)类似于rdf三元组,因此这有点棘手,以这种格式指定复杂规则可能会有些棘手。
参考: https : //jena.apache.org/documentation/inference/#RULE语法

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM