简体   繁体   中英

Creating Jena Rules from SWRL rules

please how creating Jena Rules. There is my SWRL Rules

    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)

thanks to all

I dont know (and dont think there is) an API for this task. But u can easily do it by your own.

U can simply use tripple patterns with the syntax u can find at http://jena.apache.org/documentation/inference/ .

The first example should translate into (I never worked with SWRL):

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

Where NS is the Uri of your ontology.

For the full syntax and explanation i would check out the official site (link above).

There is no code that can perform this type of conversion readily available(unless you write it yourself of course) however, its really not required. You can directly place SWRL rules in your ontology without having to specify an external rule file as you must with Jena rules. So you have a couple options here:
1) Encode your rules as SWRL rules in your ontology. This can be done through protege or if you are feeling confident do it yourself using the swrl xml syntax :)
Reference: http://www.w3.org/Submission/SWRL/#5

2) Write the equivalent rules in Jena ie, in a text file with the Jena rule syntax. This is a little trickier since Jena rules nodes(or atoms if you will) resemble rdf triples and it can be a little tricky to specify complex rules in this format.
Reference: https://jena.apache.org/documentation/inference/#RULEsyntax

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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