Rule editor and SPARQL query

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Rule editor and SPARQL query

Dipali


From: "Dipali "<[hidden email]>
Sent: Mon, 20 Mar 2017 18:06:03
To: <[hidden email]>,"[hidden email]"<[hidden email]>
Subject: Rule editor and SPARQL query


Hello,

In my ontology, I have class  “Item” and “BarCode”.(Developed in Protege5.1)

 Snapshot below shows class instances.

 

  http://protege-project.136.n4.nabble.com/attachment/4667854/0/image002.jpg                http://protege-project.136.n4.nabble.com/attachment/4667854/1/image006.jpg

 

Object property is “hasBarcode”   .It says Item hasBarcode.

I want to create rule as as Bar code  6879.2 is  equivalent to (1000.9 and XYZ1234) means if any item has barcode 6879.2 - it should get replace by the item numbers having barcode 1000.9and XYZ1234 when I run reasoner and run my query.

I created rule using Rule editor (Rule editor (Window -> Views -> Ontology views -> Rules) )

I used Pellet as reasoner (version 2.2.0) and wrote the SPARQL query to get Item and Barcode data… but  cannot see the above rules inference  in ontology.

Below is snap shot of my query:



I cannot see Item 4 getting replace by Item 5 and Item1.

Is it something I am missing or rule very specific to instance will not work with SWRL and SPARQL together?
 

 Thanks,
Dipali

 



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

image008.jpg (28K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Rule editor and SPARQL query

Csongor Nyulas
Administrator
Hi Dipali,

I can't fully answer your question because it is not completely clear what you are trying to achieve, and there is also some more information we would need. Please send us the ontology, and if possible copy the rules and SPARQL queries in the email as text, (not only as screen shots), so that we can try them out.

Here are just a few observations:
- You can't "replace" information in your ontology with SWRL rules, because of its monotonicity [1]. The rules can only add new information, but cannot delete existing axioms.
- Your rule does not have variables, so it would never fire.
- It is not clear where do you want to have replaced item 4 with item 5 and item 1. Do these items belong somewhere?

You could say that if an item has a bar code X it should also have bar code Y and bar code Z, in case this is what you want:

    Item(?it), hasBarCode(?it, temp:6879.2) -> hasBarCode(?it, temp:1000.9), hasBarCode(?it, temp:XYZ1234)


Csongor

[1] https://github.com/protegeproject/swrlapi/wiki/SWRLLanguageFAQ#Does_SWRL_support_Nonmonotonic_Inference



On 03/20/2017 05:43 AM, Dipali wrote:


From: "Dipali "[hidden email]
Sent: Mon, 20 Mar 2017 18:06:03
To: [hidden email],[hidden email][hidden email]
Subject: Rule editor and SPARQL query


Hello,

In my ontology, I have class  “Item” and “BarCode”.(Developed in Protege5.1)

 Snapshot below shows class instances.

 

  http://protege-project.136.n4.nabble.com/attachment/4667854/0/image002.jpg                http://protege-project.136.n4.nabble.com/attachment/4667854/1/image006.jpg

 

Object property is “hasBarcode”   .It says Item hasBarcode.

I want to create rule as as Bar code  6879.2 is  equivalent to (1000.9 and XYZ1234) means if any item has barcode 6879.2 - it should get replace by the item numbers having barcode 1000.9and XYZ1234 when I run reasoner and run my query.

I created rule using Rule editor (Rule editor (Window -> Views -> Ontology views -> Rules) )

I used Pellet as reasoner (version 2.2.0) and wrote the SPARQL query to get Item and Barcode data… but  cannot see the above rules inference  in ontology.

Below is snap shot of my query:



I cannot see Item 4 getting replace by Item 5 and Item1.

Is it something I am missing or rule very specific to instance will not work with SWRL and SPARQL together?
 

 Thanks,
Dipali

 




_______________________________________________
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
|  
Report Content as Inappropriate

Re: Rule editor and SPARQL query

Lorenz B.
In reply to this post by Dipali
Your rule just uses the class Barcode, which means you do not generate any relationship between items. The rule itself doesn't make any sense in it's current form.

It just states that

"IF 6879.2 is a barcode THEN 1000.9 is a barcode and XYZ1234 is a barcode."

You see, nothing said about items that have a barcode.




From: "Dipali "[hidden email]
Sent: Mon, 20 Mar 2017 18:06:03
To: [hidden email],[hidden email][hidden email]
Subject: Rule editor and SPARQL query


Hello,

In my ontology, I have class  “Item” and “BarCode”.(Developed in Protege5.1)

 Snapshot below shows class instances.

 

  http://protege-project.136.n4.nabble.com/attachment/4667854/0/image002.jpg                http://protege-project.136.n4.nabble.com/attachment/4667854/1/image006.jpg

 

Object property is “hasBarcode”   .It says Item hasBarcode.

I want to create rule as as Bar code  6879.2 is  equivalent to (1000.9 and XYZ1234) means if any item has barcode 6879.2 - it should get replace by the item numbers having barcode 1000.9and XYZ1234 when I run reasoner and run my query.

I created rule using Rule editor (Rule editor (Window -> Views -> Ontology views -> Rules) )

I used Pellet as reasoner (version 2.2.0) and wrote the SPARQL query to get Item and Barcode data… but  cannot see the above rules inference  in ontology.

Below is snap shot of my query:



I cannot see Item 4 getting replace by Item 5 and Item1.

Is it something I am missing or rule very specific to instance will not work with SWRL and SPARQL together?
 

 Thanks,
Dipali

 




_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user
-- 
Lorenz Bühmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center

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

Re: Rule editor and SPARQL query

Dipali
In reply to this post by Csongor Nyulas
Hello Csongor,

Sorry for not putting the my question in clear format.

Yes. what I want to do in ontology was  " if an item has a bar code X it should also have bar code Y and bar code Z"
I updated the rule in my ontology as per your suggestion..

    Item(?it), hasBarCode(?it, 6879.2) -> hasBarCode(?it, 1000.9), hasBarCode(?it, XYZ1234)

And I was able to achieve the result as required.

Thanks for your support.

Thanks,
Dipali

From: Csongor Nyulas <[hidden email]>
Sent: Tue, 21 Mar 2017 13:15:41
To: User support for WebProtege and Protege Desktop <[hidden email]>
Subject: Re: [protege-user] Rule editor and SPARQL query

Hi Dipali,

I can't fully answer your question because it is not completely clear what you are trying to achieve, and there is also some more information we would need. Please send us the ontology, and if possible copy the rules and SPARQL queries in the email as text, (not only as screen shots), so that we can try them out.

Here are just a few observations:
- You can't "replace" information in your ontology with SWRL rules, because of its monotonicity [1]. The rules can only add new information, but cannot delete existing axioms.
- Your rule does not have variables, so it would never fire.
- It is not clear where do you want to have replaced item 4 with item 5 and item 1. Do these items belong somewhere?

You could say that if an item has a bar code X it should also have bar code Y and bar code Z, in case this is what you want:

    Item(?it), hasBarCode(?it, temp:6879.2) -> hasBarCode(?it, temp:1000.9), hasBarCode(?it, temp:XYZ1234)


Csongor

[1] <a class="moz-txt-link-freetext" href="https://github.com/protegeproject/swrlapi/wiki/SWRLLanguageFAQ#Does_SWRL_support_Nonmonotonic_Inference VDBWZ1xhBCMLMFVqAGE=" rel="external" target="_blank">https://github.com/protegeproject/swrlapi/wiki/SWRLLanguageFAQ#Does_SWRL_support_Nonmonotonic_Inference


 
On 03/20/2017 05:43 AM, Dipali wrote:
[hidden email]" type="cite">

From: "Dipali "<[hidden email]>
Sent: Mon, 20 Mar 2017 18:06:03
To: <[hidden email]>,"[hidden email]"<[hidden email]>
Subject: Rule editor and SPARQL query


Hello,

In my ontology, I have class  “Item” and “BarCode”.(Developed in Protege5.1)

 Snapshot below shows class instances.

 

  http://protege-project.136.n4.nabble.com/attachment/4667854/0/image002.jpg                http://protege-project.136.n4.nabble.com/attachment/4667854/1/image006.jpg

 

Object property is “hasBarcode”   .It says Item hasBarcode.

I want to create rule as as Bar code  6879.2 is  equivalent to (1000.9 and XYZ1234) means if any item has barcode 6879.2 - it should get replace by the item numbers having barcode 1000.9and XYZ1234 when I run reasoner and run my query.

I created rule using Rule editor (Rule editor (Window -> Views -> Ontology views -> Rules) )

I used Pellet as reasoner (version 2.2.0) and wrote the SPARQL query to get Item and Barcode data… but  cannot see the above rules inference  in ontology.

Below is snap shot of my query:



I cannot see Item 4 getting replace by Item 5 and Item1.

Is it something I am missing or rule very specific to instance will not work with SWRL and SPARQL together?
 

 Thanks,
Dipali

 

 
 
 
_______________________________________________
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

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

Re: Rule editor and SPARQL query

Dipali
In reply to this post by Lorenz B.
Hello Lorenz,
Thanks for clarification.

I updated the rule as suggested by Csongor and it worked well .

Thanks,
Dipali

From: "Lorenz B." <[hidden email]>
Sent: Tue, 21 Mar 2017 13:49:06
To: [hidden email]
Subject: Re: [protege-user] Rule editor and SPARQL query
 
Your rule just uses the class Barcode, which means you do not generate any relationship between items. The rule itself doesn't make any sense in it's current form.

It just states that

"IF 6879.2 is a barcode THEN 1000.9 is a barcode and XYZ1234 is a barcode."

You see, nothing said about items that have a barcode.

 
 
[hidden email]" type="cite">

From: "Dipali "<[hidden email]>
Sent: Mon, 20 Mar 2017 18:06:03
To: <[hidden email]>,"[hidden email]"<[hidden email]>
Subject: Rule editor and SPARQL query


Hello,

In my ontology, I have class  “Item” and “BarCode”.(Developed in Protege5.1)

 Snapshot below shows class instances.

 

  http://protege-project.136.n4.nabble.com/attachment/4667854/0/image002.jpg                http://protege-project.136.n4.nabble.com/attachment/4667854/1/image006.jpg

 

Object property is “hasBarcode”   .It says Item hasBarcode.

I want to create rule as as Bar code  6879.2 is  equivalent to (1000.9 and XYZ1234) means if any item has barcode 6879.2 - it should get replace by the item numbers having barcode 1000.9and XYZ1234 when I run reasoner and run my query.

I created rule using Rule editor (Rule editor (Window -> Views -> Ontology views -> Rules) )

I used Pellet as reasoner (version 2.2.0) and wrote the SPARQL query to get Item and Barcode data… but  cannot see the above rules inference  in ontology.

Below is snap shot of my query:



I cannot see Item 4 getting replace by Item 5 and Item1.

Is it something I am missing or rule very specific to instance will not work with SWRL and SPARQL together?
 

 Thanks,
Dipali

 

 
 
 
_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user
-- 
Lorenz Bühmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center
_______________________________________________
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
Loading...