Editing data property value with swrl

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

Editing data property value with swrl

lynsie
Hello,
Currently, I am working on creating an ontology for robotics with PROTEGE
and I want to create a rule with swrl to check if a robot can do a given
task: Task(?x),Robot(?r),freeRobot(?r,true)->executes(?r,?x),
freeRobot(?x,false) ,but the problem is that the property freeRobot is not
edited so the robot had 2 values for freeRobot (true and false).
Is there a way to fix this problem please?



--
Sent from: http://protege-project.136.n4.nabble.com/Protege-User-f4659818.html
_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user
Reply | Threaded
Open this post in threaded view
|

Re: Editing data property value with swrl

Michael DeBellis-2
 >the problem is that the property freeRobot is not
>edited so the robot had 2 values for freeRobot (true and false).  

It sounds like what you are probably running into is that SWRL doesn't support non-monotonic reasoning. Here is a link to the SWRL Language FAQ that describes the issue: https://github.com/protegeproject/swrlapi/wiki/SWRLLanguageFAQ#Does_SWRL_support_Nonmonotonic_Inference 

As described on that page, you can't use a SWRL rule to modify an existing value. So if a data property is currently true you can't use a SWRL rule to change it to false. What the rule will end up doing is just adding another value to it, rather than just change the existing value. 

Michael

On Fri, May 24, 2019 at 1:37 PM lynsie <[hidden email]> wrote:
Hello,
Currently, I am working on creating an ontology for robotics with PROTEGE
and I want to create a rule with swrl to check if a robot can do a given
task: Task(?x),Robot(?r),freeRobot(?r,true)->executes(?r,?x),
freeRobot(?x,false) ,but the problem is that the property freeRobot is not
edited so the robot had 2 values for freeRobot (true and false).
Is there a way to fix this problem please?



--
Sent from: http://protege-project.136.n4.nabble.com/Protege-User-f4659818.html
_______________________________________________
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: Editing data property value with swrl

lynsie
Hello
Thank you so much for your quick reply.
Actually, like this always the robots are considered as free meanwhile they
are not.
So, is there an other solution to this issue?



--
Sent from: http://protege-project.136.n4.nabble.com/Protege-User-f4659818.html
_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user
Reply | Threaded
Open this post in threaded view
|

Re: Editing data property value with swrl

Igor Toujilov-2
You can think about any ontology as an instant snapshot of reality. If you model a free robot in your ontology, you cannot tell the robot is not free in the same ontology, obviously because you hit a contradiction. When reality changes, you need another instance of your ontology, which models the reality.
In other words, thinking about OWL properties as variables, supporting the destructive assignment of values (like in imperative programming languages), is wrong.
The solution: change the ontology by another program and reload it in Protégé.

Cheers,
Igor


> Sent: Friday, May 24, 2019 at 10:56 PM
> From: "lynsie" <[hidden email]>
> To: [hidden email]
> Subject: Re: [protege-user] Editing data property value with swrl
>
> Hello
> Thank you so much for your quick reply.
> Actually, like this always the robots are considered as free meanwhile they
> are not.
> So, is there an other solution to this issue?
>
>
>
> --
> Sent from: http://protege-project.136.n4.nabble.com/Protege-User-f4659818.html
> _______________________________________________
> 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: Editing data property value with swrl

lynsie
hello
Okay, I can see things otherwise now ,thank you a lot.



--
Sent from: http://protege-project.136.n4.nabble.com/Protege-User-f4659818.html
_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user
Reply | Threaded
Open this post in threaded view
|

Re: Editing data property value with swrl

Michael DeBellis-2
In reply to this post by lynsie
Sorry we couldn't give an easy answer.  One possible solution might be to try the List pattern. There are many different re-usable ontologies to define lists. You can find some of them here:  https://lov.linkeddata.es/dataset/lov/terms?q=list&page=1  You could have two lists, one of robots that were currently available and one for robots that are currently busy and move the robot from one list to another as appropriate. But even doing it this way, if you stuck with SWRL you might soon end up facing the problem of monotonic reasoning as well as the issue that SWRL and OWL don't support negation as failure and have an Open World Assumption.  For more on the features and limits of SWRL this presentation is an excellent source: https://protege.stanford.edu/conference/2009/slides/SWRL2009ProtegeConference.pdf  

Another option would be to use temporal reasoning and to associate your states with specific times. E.g., create a Value object with both a boolean and a timestamp. In this case you no longer have the issue of needing non-monotonic reasoning because when you update the state of your robot you don't change the value you add a new value that says at time X the robot is now busy/available. SWRL has good support for temporal reasoning: https://github.com/protegeproject/swrlapi/wiki/ModellingTime   

But I think really your best bet is to use something other than SWRL as Igor suggested. There is SPARQL which is roughly to RDF (the language that OWL is built on) what SQL is to relational databases. Here is a link to a tutorial: https://jena.apache.org/tutorials/sparql.html  Note that the SPARQL implementation that is currently in Protege is not as complete as most SPARQL engines and you would probably need to use a different one. 

Another option is to use Apache Jena to create Java objects that instantiate your ontology and then use Java to manipulate the objects. Since Java is a programming language of course the non-monotonic thing is not an issue. Here is a link on Jena: https://jena.apache.org/ (note that SPARQL link was for SPARQL and Jena but it also had an overview of SPARQL and other links to general tutorials on SPARQL). 

If you prefer Python to Java there is also an OWL library for Python that I think does more or less the same as Jena for Java. Here's a link: https://pypi.org/project/Owlready2/    Other things being equal I would recommend using Java and Jena over Python. Java tends to be the language of choice for most applications that use OWL. 

Hope that helps. Good luck,

Michael

On Fri, May 24, 2019 at 2:56 PM lynsie <[hidden email]> wrote:
Hello
Thank you so much for your quick reply.
Actually, like this always the robots are considered as free meanwhile they
are not.
So, is there an other solution to this issue?



--
Sent from: http://protege-project.136.n4.nabble.com/Protege-User-f4659818.html
_______________________________________________
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: Editing data property value with swrl

lynsie
Thank you for this clarification. Is it possible to associate a python module
the ontology created with PROTEGE. If yes, how can I do it?



--
Sent from: http://protege-project.136.n4.nabble.com/Protege-User-f4659818.html
_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user
Reply | Threaded
Open this post in threaded view
|

Re: Editing data property value with swrl

Michael DeBellis-2
I can't answer that, I haven't used the Python OWL library. The documentation on that site should explain what you need.

Michael

On Sat, May 25, 2019 at 1:11 PM lynsie <[hidden email]> wrote:
Thank you for this clarification. Is it possible to associate a python module
the ontology created with PROTEGE. If yes, how can I do it?



--
Sent from: http://protege-project.136.n4.nabble.com/Protege-User-f4659818.html
_______________________________________________
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: Editing data property value with swrl

lynsie
Okay, thank you so much for your replies.



--
Sent from: http://protege-project.136.n4.nabble.com/Protege-User-f4659818.html
_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user