How to use different prefix in SWRL rules?

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

How to use different prefix in SWRL rules?

isukura
Hi,

I'm creating some rules in my ontology via owlready2.
For a very specific reason, one of assumptions in my rule was "owl:Thing(?variable)".
I was able to define this in Protege without any problems, but I didn't succeed in owlready2.

With all other classes (for example, for class Pizza), I can define it ("Pizza(?p)"), but for class "Thing", I can't.

Is there a reason for this? Is my syntax maybe wrong? I tried it with "owl:Thing(?variable)", "owl.Thing(?variable)", "Thing(?variable)", "onto:Thing(?variable)".

Thanks in advancjavascript: void(0)e!
Reply | Threaded
Open this post in threaded view
|

Re: How to use different prefix in SWRL rules?

Jiba
Administrator
Hi,

Owlready has no support for prefixed IRI in SWRL rule, so you need to use the full IRI, e.g. : "http://www.w3.org/2002/07/owl#Thing(?variable)"

However, a bug prevents full IRI to work when they are not from the current world (which is the case for Thing). I fixed that bug in the development version.

Alternatively, you can also pass a list of namespace to set_as_rule():

rule.set_as_rule("""Thing(?x) -> D(?x)""", namespaces = [owl, onto])

These namespaces will be searched in order for entity (NB this works with the current version of Owlready).

Jiba