Create swrl rule

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Create swrl rule

kloud
This post was updated on .
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Create swrl rule

IWilliams
Could you provide a better example? From what you have, this is what I suggest:
onto = get_ontology('file://path to owl file').load()
with onto:
      ruleName=Imp()
      ruleName.set_as_rule("add your swrl atoms")
onto.save(file="path to owl file")

Also, why not just create the relationship when you are populating the Abox of the ontology. What is relation(link)?
Reply | Threaded
Open this post in threaded view
|

Re: Create swrl rule

kloud
This post was updated on .
Thank you Iwilliams for your response. My question was : I would like that someone helps me to write the rule that enables me to link two individuals named world and worldCases by an object property named cases !
I want to obtain this relation : word cases worldCases

This is my attempt :

Country(?x)^CountryCases(?y)^swrlb:endswith(?y, "Cases")->cases(?x,?y)

But I got this error : [Line: 1, Column: 1]: built-in exception thrown by built-in swrlb:endsWith in rule S1: exception thrown by built-in swrlb:endsWith in rule S1: expecting literal, got individual

Some help please
Reply | Threaded
Open this post in threaded view
|

Re: Create swrl rule

IWilliams
I dont know the Tbox of  your ontology. However, if you have CountryCases that has a data property like hasName then you could have this rule.

Country(?x)^CountryCases(?y)^ hasName(?y, ?name) ^ swrlb:endswith(?name, "Cases")->cases(?x,?y)

So, JapanCases (CountryCases) with hasName value being "JapanCases" the rule should work.