help in using SWRL

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

help in using SWRL

SamSam2019

Hi,

Sorry, I do not know if this is the right place to submit my question. But, I really need some help.

In my ontology, I have two classes,

First Class is named: Task

Second Class is named: sub_Task

I have:

an object Property “Task_Has_subTask”   Domain: Task, Range: sub_Task

Data Property     isAchieved   Domain: Task, sub_Task, Range: Boolean

 

For example:

I have the Task individual (Task1) that has the Sub_Task Individuals (sTask1, sTask2, sTask3, sTask4)

The isAchieved property for the sub-Tasks 1 & 2 is True

The isAchieved property for the sub-Tasks 3 & 4 is False.

 

I would like to write a generic SWRL statement to set the isAchieved for the Task individual as True if All of its related sub-Tasks are True.

Task (?T)    sub_Task (?sT)   Task_Has_subTask (?T, ?sT)    isAchieved(?sT, true)    isAchieved(?T, true)

The result of this statement is true, however NOT all of the related sub-Tasks are achieved.

 

As I have mentioned, I need it to be generic, so it can fit with all the Task’s instances that may include 1,2,3 or more sub-Tasks.

Please let me know if you have any suggestions.

Thanks for your help in advance.



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

Re: help in using SWRL

samsontu
Hi,

You can’t do what you want in SWRL.

On Mar 16, 2019, at 4:53 PM, Sam Samhan <[hidden email]> wrote:

Hi,

Sorry, I do not know if this is the right place to submit my question. But, I really need some help.

In my ontology, I have two classes,

First Class is named: Task

Second Class is named: sub_Task

I have:

an object Property “Task_Has_subTask”   Domain: Task, Range: sub_Task



It’s better to have a single class Task, and relate individuals of class Task by the ‘has_subTask’ object property (whose domain and range are Task).

Data Property     isAchieved   Domain: Task, sub_Task, Range: Boolean

 

For example:

I have the Task individual (Task1) that has the Sub_Task Individuals (sTask1, sTask2, sTask3, sTask4)

The isAchieved property for the sub-Tasks 1 & 2 is True

The isAchieved property for the sub-Tasks 3 & 4 is False.

 

I would like to write a generic SWRL statement to set the isAchieved for the Task individual as True if All of its related sub-Tasks are True.

Task (?T)    sub_Task (?sT)   Task_Has_subTask (?T, ?sT)    isAchieved(?sT, true)    isAchieved(?T, true)

The result of this statement is true, however NOT all of the related sub-Tasks are achieved.

 
In first-order logic, what you want is something like:

forall ?x, Task(?x) and if (forall ?y, if has_subTask(?x, ?y) then isAchieved(?y)), then isAchieved(?x)

You can’t write such complex rule in SWRL.

Moreover, you will up against the “open world assumption” of OWL and SWRL, which assumes, in the absence of contrary evidence, that you may have unasserted subtasks. So the reasoner cannot conclude that all subtasks of a task are achieved even if all known subtasks are achieved.

You may be able to write a SPARQL query for tasks such that there does not exist any subtask that is not achieved. You need a SPARQL engine that supports the NOT EXISTS filter.

With best regards,
Samson









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

smime.p7s (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: help in using SWRL

Igor Toujilov-2

Hi Sam,

You can do what you want by at least two alternatives:

- Use nominals (OWL classes, which are explicitly specified by enumerating individuals) without a single line of SWRL; An example is here in my project: https://sourceforge.net/p/meloproject/code/ci/master/tree/OWL/examples/closing_world_with_nominals.owl ;

- If you prefer SWRL, you would need constructing a conjunctive aggregation on is_achieved property over a list: this is similar to the sum example at https://sourceforge.net/p/meloproject/code/ci/master/tree/OWL/examples/list_sum.owl .

 

Cheers,

Igor

 

 
 
Sent: Monday, March 18, 2019 at 5:51 AM
From: "Samson Tu" <[hidden email]>
To: "User support for WebProtege and Protege Desktop" <[hidden email]>
Subject: Re: [protege-user] help in using SWRL
Hi,
 
You can’t do what you want in SWRL.
 
On Mar 16, 2019, at 4:53 PM, Sam Samhan <[hidden email]> wrote:
 

Hi,

Sorry, I do not know if this is the right place to submit my question. But, I really need some help.

In my ontology, I have two classes,

First Class is named: Task

Second Class is named: sub_Task

I have:

an object Property “Task_Has_subTask”   Domain: Task, Range: sub_Task

 
 
It’s better to have a single class Task, and relate individuals of class Task by the ‘has_subTask’ object property (whose domain and range are Task).
 

Data Property     isAchieved   Domain: Task, sub_Task, Range: Boolean

 

For example:

I have the Task individual (Task1) that has the Sub_Task Individuals (sTask1, sTask2, sTask3, sTask4)

The isAchieved property for the sub-Tasks 1 & 2 is True

The isAchieved property for the sub-Tasks 3 & 4 is False.

 

I would like to write a generic SWRL statement to set the isAchieved for the Task individual as True if All of its related sub-Tasks are True.

Task (?T)    sub_Task (?sT)   Task_Has_subTask (?T, ?sT)    isAchieved(?sT, true)    isAchieved(?T, true)

The result of this statement is true, however NOT all of the related sub-Tasks are achieved.

 
In first-order logic, what you want is something like:
 
forall ?x, Task(?x) and if (forall ?y, if has_subTask(?x, ?y) then isAchieved(?y)), then isAchieved(?x)
 
You can’t write such complex rule in SWRL.
 
Moreover, you will up against the “open world assumption” of OWL and SWRL, which assumes, in the absence of contrary evidence, that you may have unasserted subtasks. So the reasoner cannot conclude that all subtasks of a task are achieved even if all known subtasks are achieved.
 
You may be able to write a SPARQL query for tasks such that there does not exist any subtask that is not achieved. You need a SPARQL engine that supports the NOT EXISTS filter.
 
With best regards,
Samson
 
 
 
 
 
 
 

_______________________________________________ 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: help in using SWRL

SamSam2019
In reply to this post by samsontu
Many thanks Samson for your response and taking time to clarify the issue. 

As a beginner in this domain, may I ask:

Can the SPARQL capabilities support the (forall) query?, 

what options available suitable with OWL 2.0 to apply such a query that may contain updating an individual's property based on checking a  multi-value property?


Best Regards
Sam
 

On Monday, 18 March 2019, 05:51:37 GMT, Samson Tu <[hidden email]> wrote:


Hi,

You can’t do what you want in SWRL.

On Mar 16, 2019, at 4:53 PM, Sam Samhan <[hidden email]> wrote:

Hi,

Sorry, I do not know if this is the right place to submit my question. But, I really need some help.

In my ontology, I have two classes,

First Class is named: Task

Second Class is named: sub_Task

I have:

an object Property “Task_Has_subTask”   Domain: Task, Range: sub_Task



It’s better to have a single class Task, and relate individuals of class Task by the ‘has_subTask’ object property (whose domain and range are Task).

Data Property     isAchieved   Domain: Task, sub_Task, Range: Boolean

 

For example:

I have the Task individual (Task1) that has the Sub_Task Individuals (sTask1, sTask2, sTask3, sTask4)

The isAchieved property for the sub-Tasks 1 & 2 is True

The isAchieved property for the sub-Tasks 3 & 4 is False.

 

I would like to write a generic SWRL statement to set the isAchieved for the Task individual as True if All of its related sub-Tasks are True.

Task (?T)    sub_Task (?sT)   Task_Has_subTask (?T, ?sT)    isAchieved(?sT, true)    isAchieved(?T, true)

The result of this statement is true, however NOT all of the related sub-Tasks are achieved.

 
In first-order logic, what you want is something like:

forall ?x, Task(?x) and if (forall ?y, if has_subTask(?x, ?y) then isAchieved(?y)), then isAchieved(?x)

You can’t write such complex rule in SWRL.

Moreover, you will up against the “open world assumption” of OWL and SWRL, which assumes, in the absence of contrary evidence, that you may have unasserted subtasks. So the reasoner cannot conclude that all subtasks of a task are achieved even if all known subtasks are achieved.

You may be able to write a SPARQL query for tasks such that there does not exist any subtask that is not achieved. You need a SPARQL engine that supports the NOT EXISTS filter.

With best regards,
Samson








_______________________________________________
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: help in using SWRL

samsontu
In reply to this post by Igor Toujilov-2
I stand corrected by Igor. The use of nominals is a nice solution to the problem.

With best regards,
Samson


On Mar 18, 2019, at 4:24 PM, Igor Toujilov <[hidden email]> wrote:

Hi Sam,

You can do what you want by at least two alternatives:

- Use nominals (OWL classes, which are explicitly specified by enumerating individuals) without a single line of SWRL; An example is here in my project: https://sourceforge.net/p/meloproject/code/ci/master/tree/OWL/examples/closing_world_with_nominals.owl ;

- If you prefer SWRL, you would need constructing a conjunctive aggregation on is_achieved property over a list: this is similar to the sum example at https://sourceforge.net/p/meloproject/code/ci/master/tree/OWL/examples/list_sum.owl .

 

Cheers,

Igor

 
 
 
Sent: Monday, March 18, 2019 at 5:51 AM
From: "Samson Tu" <[hidden email]>
To: "User support for WebProtege and Protege Desktop" <[hidden email]>
Subject: Re: [protege-user] help in using SWRL
Hi,
 
You can’t do what you want in SWRL.
 
On Mar 16, 2019, at 4:53 PM, Sam Samhan <[hidden email]> wrote:
 

Hi,

Sorry, I do not know if this is the right place to submit my question. But, I really need some help.

In my ontology, I have two classes,

First Class is named: Task

Second Class is named: sub_Task

I have:

an object Property “Task_Has_subTask”   Domain: Task, Range: sub_Task

 
 
It’s better to have a single class Task, and relate individuals of class Task by the ‘has_subTask’ object property (whose domain and range are Task).
 

Data Property     isAchieved   Domain: Task, sub_Task, Range: Boolean

 

For example:

I have the Task individual (Task1) that has the Sub_Task Individuals (sTask1, sTask2, sTask3, sTask4)

The isAchieved property for the sub-Tasks 1 & 2 is True

The isAchieved property for the sub-Tasks 3 & 4 is False.

 

I would like to write a generic SWRL statement to set the isAchieved for the Task individual as True if All of its related sub-Tasks are True.

Task (?T)    sub_Task (?sT)   Task_Has_subTask (?T, ?sT)    isAchieved(?sT, true)    isAchieved(?T, true)

The result of this statement is true, however NOT all of the related sub-Tasks are achieved.

 
In first-order logic, what you want is something like:
 
forall ?x, Task(?x) and if (forall ?y, if has_subTask(?x, ?y) then isAchieved(?y)), then isAchieved(?x)
 
You can’t write such complex rule in SWRL.
 
Moreover, you will up against the “open world assumption” of OWL and SWRL, which assumes, in the absence of contrary evidence, that you may have unasserted subtasks. So the reasoner cannot conclude that all subtasks of a task are achieved even if all known subtasks are achieved.
 
You may be able to write a SPARQL query for tasks such that there does not exist any subtask that is not achieved. You need a SPARQL engine that supports the NOT EXISTS filter.
 
With best regards,
Samson
 
 
 
 
 
 
 

_______________________________________________ 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

smime.p7s (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: help in using SWRL

SamSam2019
In reply to this post by Igor Toujilov-2
Hi Igor, 


Sorry, I've just seen your response as it was misplaced in my email's folders. 

I will check the proposed alternatives. 

Many thanks.
Sam
On Monday, 18 March 2019, 23:24:31 GMT, Igor Toujilov <[hidden email]> wrote:


Hi Sam,

You can do what you want by at least two alternatives:

- Use nominals (OWL classes, which are explicitly specified by enumerating individuals) without a single line of SWRL; An example is here in my project: https://sourceforge.net/p/meloproject/code/ci/master/tree/OWL/examples/closing_world_with_nominals.owl ;

- If you prefer SWRL, you would need constructing a conjunctive aggregation on is_achieved property over a list: this is similar to the sum example at https://sourceforge.net/p/meloproject/code/ci/master/tree/OWL/examples/list_sum.owl .

 

Cheers,

Igor

 

 
 
Sent: Monday, March 18, 2019 at 5:51 AM
From: "Samson Tu" <[hidden email]>
To: "User support for WebProtege and Protege Desktop" <[hidden email]>
Subject: Re: [protege-user] help in using SWRL
Hi,
 
You can’t do what you want in SWRL.
 
On Mar 16, 2019, at 4:53 PM, Sam Samhan <[hidden email]> wrote:
 

Hi,

Sorry, I do not know if this is the right place to submit my question. But, I really need some help.

In my ontology, I have two classes,

First Class is named: Task

Second Class is named: sub_Task

I have:

an object Property “Task_Has_subTask”   Domain: Task, Range: sub_Task

 
 
It’s better to have a single class Task, and relate individuals of class Task by the ‘has_subTask’ object property (whose domain and range are Task).
 

Data Property     isAchieved   Domain: Task, sub_Task, Range: Boolean

 

For example:

I have the Task individual (Task1) that has the Sub_Task Individuals (sTask1, sTask2, sTask3, sTask4)

The isAchieved property for the sub-Tasks 1 & 2 is True

The isAchieved property for the sub-Tasks 3 & 4 is False.

 

I would like to write a generic SWRL statement to set the isAchieved for the Task individual as True if All of its related sub-Tasks are True.

Task (?T)    sub_Task (?sT)   Task_Has_subTask (?T, ?sT)    isAchieved(?sT, true)    isAchieved(?T, true)

The result of this statement is true, however NOT all of the related sub-Tasks are achieved.

 
In first-order logic, what you want is something like:
 
forall ?x, Task(?x) and if (forall ?y, if has_subTask(?x, ?y) then isAchieved(?y)), then isAchieved(?x)
 
You can’t write such complex rule in SWRL.
 
Moreover, you will up against the “open world assumption” of OWL and SWRL, which assumes, in the absence of contrary evidence, that you may have unasserted subtasks. So the reasoner cannot conclude that all subtasks of a task are achieved even if all known subtasks are achieved.
 
You may be able to write a SPARQL query for tasks such that there does not exist any subtask that is not achieved. You need a SPARQL engine that supports the NOT EXISTS filter.
 
With best regards,
Samson
 
 
 
 
 
 
 

_______________________________________________ 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
|

Re: help in using SWRL

SamSam2019
In reply to this post by samsontu
Many Thanks Igor,

I have applied the first solution and it helped in solving the issue under
consideration.

Just a quick question please:

What Does the Identified 'General Class Axiom' Do in this example, what is
the exact meaning of it?

Task_HasRelated_SubTask  only (isAchieved value true) SubClassOf isAchieved
value true.

Thanks ahead.

Sam



--
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: help in using SWRL

Igor Toujilov-2
Hi Sam,
The axiom

has_subtask only (is_achieved value true) SubClassOf is_achieved value true

works as a rule. It tells: "If a task has only subtasks, which are achieved, then this task is also achieved".
Enjoy!

Cheers,
Igor


> Sent: Friday, May 03, 2019 at 8:11 PM
> From: "SamSam2019" <[hidden email]>
> To: [hidden email]
> Subject: Re: [protege-user] help in using SWRL
>
> Many Thanks Igor,
>
> I have applied the first solution and it helped in solving the issue under
> consideration.
>
> Just a quick question please:
>
> What Does the Identified 'General Class Axiom' Do in this example, what is
> the exact meaning of it?
>
> Task_HasRelated_SubTask  only (isAchieved value true) SubClassOf isAchieved
> value true.
>
> Thanks ahead.
>
> Sam
>
>
>
> --
> 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: help in using SWRL

SamSam2019
Thanks Igor,

Appreciated.

Best Regards
Sam



--
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