How I can use class expressions in SWRL rules on SWRLTab of protege?

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

How I can use class expressions in SWRL rules on SWRLTab of protege?

simon_wangcheng
Hello everyone!

I'm a newer to SWRL. When I use SWRLTab to write SWRL rules on protege, I'm confused. Because class expression just doesn't work!

"Unexpected charactor '>'" is shown.

However, the manual tell me that it shoud work!

Protege 5.0 and swrltab-plugin-1.1.4 are used.

Thanks a lot.
Reply | Threaded
Open this post in threaded view
|

Re: How I can use class expressions in SWRL rules on SWRLTab of protege?

Csongor Nyulas
Administrator
It is impossible to say what is wrong if we don't see your rule (and
better even, your ontology, or a sample ontology that exhibits this
behaviour).

Csongor


On 03/14/2017 07:16 PM, simon_wangcheng wrote:

> Hello everyone!
>
> I'm a newer to SWRL. When I use SWRLTab to write SWRL rules on protege, I'm
> confused. Because class expression just doesn't work!
>
> "Unexpected charactor '>'" is shown.
>
> However, the  manual
> <https://github.com/protegeproject/swrlapi/wiki/SWRLLanguageFAQ>   tell me
> that it shoud work!
>
> Protege 5.0 and swrltab-plugin-1.1.4 are used.
>
> Thanks a lot.
>
>
>
> --
> View this message in context: http://protege-project.136.n4.nabble.com/How-I-can-use-class-expressions-in-SWRL-rules-on-SWRLTab-of-protege-tp4667823.html
> Sent from the Protege User mailing list archive at Nabble.com.
> _______________________________________________
> protege-user mailing list
> [hidden email]
> https://mailman.stanford.edu/mailman/listinfo/protege-user


_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user
Reply | Threaded
Open this post in threaded view
|

Re: How I can use class expressions in SWRL rules on SWRLTab of protege?

simon_wangcheng
Thanks for short reply.
I' very sorry. This is a example.

There is an simple ontology including two classes Person and Parent, of course Parent is a subclass of Person. Person has two instances father_1 and child_1, a object property hasChild is built from father_1 to child_1. So I want to use SWRL rules to classify father_1 as a instance of Parent. However, there is something wrong hanppend in SWRLTab, just like the picture below.




2017-03-15 12:13 GMT+08:00 Csongor Nyulas [via Protege Project] <[hidden email]>:
It is impossible to say what is wrong if we don't see your rule (and
better even, your ontology, or a sample ontology that exhibits this
behaviour).

Csongor


On 03/14/2017 07:16 PM, simon_wangcheng wrote:

> Hello everyone!
>
> I'm a newer to SWRL. When I use SWRLTab to write SWRL rules on protege, I'm
> confused. Because class expression just doesn't work!
>
> "Unexpected charactor '>'" is shown.
>
> However, the  manual
> <https://github.com/protegeproject/swrlapi/wiki/SWRLLanguageFAQ>   tell me
> that it shoud work!
>
> Protege 5.0 and swrltab-plugin-1.1.4 are used.
>
> Thanks a lot.
>
>
>
> --
> View this message in context: http://protege-project.136.n4.nabble.com/How-I-can-use-class-expressions-in-SWRL-rules-on-SWRLTab-of-protege-tp4667823.html
> Sent from the Protege User mailing list archive at Nabble.com.
> _______________________________________________
> protege-user mailing list
> [hidden email]
> https://mailman.stanford.edu/mailman/listinfo/protege-user

_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user



To unsubscribe from How I can use class expressions in SWRL rules on SWRLTab of protege?, click here.
NAML


swrl_error.owl (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: How I can use class expressions in SWRL rules on SWRLTab of protege?

Csongor Nyulas
Administrator
First of all you don't need SWRL to express this. You can make the class Parent subclass of:

    Person and (hasChild min 1)

This would be pure OWL.

Second, if you really want to use SWRL, you could simply write:

    Person(?x) ^ hasChild(?x, ?c) -> Parent(?x)

This rule would fire only for instances that have at least one known child.

This being said, I also get some exceptions when I try to write the rule:

    Person(?x) ^ (hasChild >= 1)(?x) -> Parent(?x)

For me actually it complains already at the "(", before "hasChild". For some reason SWRLTab does not seem to like class expressions anymore. Maybe Martin can shed some light on this.

However, you can use the Rule editor (Window -> Views -> Ontology views -> Rules) to write the rule that you want (with a little bit of syntax difference):

    Person(?x), (hasChild min 1)(?x) -> Parent(?x)

and after running a reasoner that can interpret SWRL rules (such as Pellet or or Hermit) you will get the inference that you expect

Csongor



On 03/14/2017 09:45 PM, simon_wangcheng wrote:
Thanks for short reply.
I' very sorry. This is a example.

There is an simple ontology including two classes Person and Parent, of course Parent is a subclass of Person. Person has two instances father_1 and child_1, a object property hasChild is built from father_1 to child_1. So I want to use SWRL rules to classify father_1 as a instance of Parent. However, there is something wrong hanppend in SWRLTab, just like the picture below.




2017-03-15 12:13 GMT+08:00 Csongor Nyulas [via Protege Project] <[hidden email]>:
It is impossible to say what is wrong if we don't see your rule (and
better even, your ontology, or a sample ontology that exhibits this
behaviour).

Csongor


On 03/14/2017 07:16 PM, simon_wangcheng wrote:

> Hello everyone!
>
> I'm a newer to SWRL. When I use SWRLTab to write SWRL rules on protege, I'm
> confused. Because class expression just doesn't work!
>
> "Unexpected charactor '>'" is shown.
>
> However, the  manual
> <https://github.com/protegeproject/swrlapi/wiki/SWRLLanguageFAQ>   tell me
> that it shoud work!
>
> Protege 5.0 and swrltab-plugin-1.1.4 are used.
>
> Thanks a lot.
>
>
>
> --
> View this message in context: http://protege-project.136.n4.nabble.com/How-I-can-use-class-expressions-in-SWRL-rules-on-SWRLTab-of-protege-tp4667823.html
> Sent from the Protege User mailing list archive at Nabble.com.
> _______________________________________________
> protege-user mailing list
> [hidden email]
> https://mailman.stanford.edu/mailman/listinfo/protege-user

_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user



To unsubscribe from How I can use class expressions in SWRL rules on SWRLTab of protege?, click here.
NAML


swrl_error.owl (2K) Download Attachment


View this message in context: Re: How I can use class expressions in SWRL rules on SWRLTab of protege?
Sent from the Protege User mailing list archive at Nabble.com.


_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user


_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user
Reply | Threaded
Open this post in threaded view
|

Re: How I can use class expressions in SWRL rules on SWRLTab of protege?

simon_wangcheng
Thank you very much! It works.

2017-03-15 13:27 GMT+08:00 Csongor Nyulas [via Protege Project] <[hidden email]>:
First of all you don't need SWRL to express this. You can make the class Parent subclass of:

    Person and (hasChild min 1)

This would be pure OWL.

Second, if you really want to use SWRL, you could simply write:

    Person(?x) ^ hasChild(?x, ?c) -> Parent(?x)

This rule would fire only for instances that have at least one known child.

This being said, I also get some exceptions when I try to write the rule:

    Person(?x) ^ (hasChild >= 1)(?x) -> Parent(?x)

For me actually it complains already at the "(", before "hasChild". For some reason SWRLTab does not seem to like class expressions anymore. Maybe Martin can shed some light on this.

However, you can use the Rule editor (Window -> Views -> Ontology views -> Rules) to write the rule that you want (with a little bit of syntax difference):

    Person(?x), (hasChild min 1)(?x) -> Parent(?x)

and after running a reasoner that can interpret SWRL rules (such as Pellet or or Hermit) you will get the inference that you expect

Csongor



On 03/14/2017 09:45 PM, simon_wangcheng wrote:
Thanks for short reply.
I' very sorry. This is a example.

There is an simple ontology including two classes Person and Parent, of course Parent is a subclass of Person. Person has two instances father_1 and child_1, a object property hasChild is built from father_1 to child_1. So I want to use SWRL rules to classify father_1 as a instance of Parent. However, there is something wrong hanppend in SWRLTab, just like the picture below.




2017-03-15 12:13 GMT+08:00 Csongor Nyulas [via Protege Project] <[hidden email]>:
It is impossible to say what is wrong if we don't see your rule (and
better even, your ontology, or a sample ontology that exhibits this
behaviour).

Csongor


On 03/14/2017 07:16 PM, simon_wangcheng wrote:

> Hello everyone!
>
> I'm a newer to SWRL. When I use SWRLTab to write SWRL rules on protege, I'm
> confused. Because class expression just doesn't work!
>
> "Unexpected charactor '>'" is shown.
>
> However, the  manual
> <https://github.com/protegeproject/swrlapi/wiki/SWRLLanguageFAQ>   tell me
> that it shoud work!
>
> Protege 5.0 and swrltab-plugin-1.1.4 are used.
>
> Thanks a lot.
>
>
>
> --
> View this message in context: http://protege-project.136.n4.nabble.com/How-I-can-use-class-expressions-in-SWRL-rules-on-SWRLTab-of-protege-tp4667823.html
> Sent from the Protege User mailing list archive at Nabble.com.
> _______________________________________________
> protege-user mailing list
> [hidden email]
> https://mailman.stanford.edu/mailman/listinfo/protege-user

_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user



To unsubscribe from How I can use class expressions in SWRL rules on SWRLTab of protege?, click here.
NAML


swrl_error.owl (2K) Download Attachment


View this message in context: Re: How I can use class expressions in SWRL rules on SWRLTab of protege?
Sent from the Protege User mailing list archive at Nabble.com.


_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user


_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user



To unsubscribe from How I can use class expressions in SWRL rules on SWRLTab of protege?, click here.
NAML

Reply | Threaded
Open this post in threaded view
|

Re: How I can use class expressions in SWRL rules on SWRLTab of protege?

samsontu
In reply to this post by Csongor Nyulas
Hi,

Protege’s SWRLTab does not support class expressions in the rules.

Use the Rules view (menu item: Windows/Views/OntologyViews/Rules) to write the rules and the Pellet reasoner for reasoning.

With best regards,
Samson



On Mar 14, 2017, at 9:51 PM, simon_wangcheng <[hidden email]> wrote:

Thanks for short reply.
I' very sorry. This is a example.

There is an simple ontology including two classes Person and Parent, of
course Parent is a subclass of Person. Person has two instances father_1 and
child_1, a object property hasChild is built from father_1 to child_1. So I
want to use SWRL rules to classify father_1 as a instance of Parent.
However, there is something wrong hanppend in SWRLTab, just like the picture
below.
<http://protege-project.136.n4.nabble.com/file/n4667828/swrl_error.png>



   <owl:ObjectProperty rdf:about="#hasChild"/>

   <owl:Class rdf:about="#Parent">
       <rdfs:subClassOf rdf:resource="#Person"/>
   </owl:Class>

   <owl:Class rdf:about="#Person"/>

   <owl:NamedIndividual rdf:about="#child_1">
       <rdf:type rdf:resource="#Person"/>
   </owl:NamedIndividual>

   <owl:NamedIndividual rdf:about="#father_1">
       <rdf:type rdf:resource="#Person"/>
       <p:hasChild rdf:resource="#child_1"/>
   </owl:NamedIndividual>



--
View this message in context: http://protege-project.136.n4.nabble.com/How-I-can-use-class-expressions-in-SWRL-rules-on-SWRLTab-of-protege-tp4667823p4667828.html
Sent from the Protege User mailing list archive at Nabble.com.
_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user


_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user