SUM of data properties of a class and it's subclass

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

SUM of data properties of a class and it's subclass

joshuabezaleel
Hi everyone,

I am pretty new to ontology and semantic web things so I am really sorry if
my question is a really basic one.

Let's say that I have a class (e.g. Family) and it has a subclass (e.g.
FamilyMember) which both of them have the same property (e.g. hasMoney)
which is an integer denoting how much money each family member has.
For example, a Family instance named JohnFamily has 3 instances of
FamilyMember which are Father, Mother and Son, all of it with their own
hasMoney property.
Is it possible to inference automatically that the hasMoney property of
Family is the SUM of all it's FamilyMember (Father,Mother and Son) (If
Father has $200, Mother has $100, Son has $50, then the reasoner can infer
that the hasMoney property of JohnFamily is $350)? Or do I need some kind of
Rule(SWRL & SQWRL) and how do I make this?

Thank you very much for the help. Any kind of help, how little it is, is
really much appreciated from me.




--
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: SUM of data properties of a class and it's subclass

samsontu

On May 4, 2018, at 9:20 AM, joshuabezaleel <[hidden email]> wrote:

Hi everyone,

I am pretty new to ontology and semantic web things so I am really sorry if
my question is a really basic one.

Let's say that I have a class (e.g. Family) and it has a subclass (e.g.
FamilyMember) which both of them have the same property (e.g. hasMoney)
which is an integer denoting how much money each family member has. 
For example, a Family instance named JohnFamily has 3 instances of
FamilyMember which are Father, Mother and Son, all of it with their own
hasMoney property. 
Is it possible to inference automatically that the hasMoney property of
Family is the SUM of all it's FamilyMember (Father,Mother and Son) (If
Father has $200, Mother has $100, Son has $50, then the reasoner can infer
that the hasMoney property of JohnFamily is $350)? Or do I need some kind of
Rule(SWRL & SQWRL) and how do I make this?

Thank you very much for the help. Any kind of help, how little it is, is
really much appreciated from me.

A couple comments:

1. A requirement of OWL class hierarchy is that an instance of the subclass must also an instance of a superclass. So if you have FamilyMember as a subclass of Family, then a family member (say, John) must be an instance of Family as well. A better alternative is to use a ‘hasFamilyMember’ property to link a family (e.g., JohnFamily) with members such as John (an instance of Person).

2. The question of taking sums comes periodically on this mailing list. An old thread is appended below. The SWRLTab mentioned in the message has been ported to Protege 5.2. The current reference for SQWRL is available at [1].

With best regards,
Samson 





From: Igor Toujilov <[hidden email]>
Subject: Re: [protege-user] Question on data properties and SWRL
Date: July 3, 2014 at 1:53:53 PM PDT
Reply-To: User support for WebProtege and Protege Desktop <[hidden email]>

Hi All,
The open world assumption does not prohibit us from possession of full knowledge about a logical condition. For example, we can perfectly know what are all the Factories that are attached to a Distributor at least for a fixed period of time.
So, there is a way to do this in pure OWL DL + SWRL. For example, we can use a linked list of objects, and derive aggregation values on data properties of the linked objects with a help of simple SWRL rules. Once I had posted a tiny ontology, implementing this (to this or related Email-list for OWL API developers; I do not remember exactly where I had posted it, but you can find, or I can resend if needed). This way we can use native aggregation capabilities of OWL DL + SWRL in Protégé 4 or 5 (or perhaps Web Protégé).
 
Cheers,
Igor
 
 
 
Sent: Wednesday, July 02, 2014 at 8:37 PM
From: "Csongor Nyulas" <[hidden email]>
Subject: Re: [protege-user] Question on data properties and SWRL
Hi Gedaliah,

Because SWRL adopts the open world assumption [1] there is no way to do this in "pure" SWRL. In an open world you can never know what are "all" the Factories that are attached to a Distributor.

This being said, you can use the aggregation capabilities [2] of the SQWRL query language [3] to retrieve the sum of the property values. SQWRL is currently available only in Protege 3.x throulgh the SWRLTab plugin. Martin O'Connor is working on porting this plugin to Protege 5.0.

Csongor

 
On 07/02/2014 11:37 AM, Knizhnik, Gedaliah wrote:
Is there a way of writing SWRL rules to add together values from all of a range of data properties? I have an ontology that contains a Factory class, as well as a Distributor class. Each Factory has a data property hasProduction which is a double type measurement of its output. A Distributor has an object property hasFactory, which links it to a single instance of the Factory class, but a single Distributor can have any number of Factories. I want to use SWRL to make a data property hasDistribution for the Distributor, which will be the sum of all the production values from the Factories attached to that Distributor. Is there a way to do that?
 
Thanks.
  



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

Re: SUM of data properties of a class and it's subclass

Igor Toujilov-2

Hi All,

Please see the topic at https://mailman.stanford.edu/pipermail/p4-feedback/2013-April/005704.html

 

Cheers,

Igor

 

 
 
Sent: Friday, May 04, 2018 at 6:23 PM
From: "Samson Tu" <[hidden email]>
To: "User support for WebProtege and Protege Desktop" <[hidden email]>
Subject: Re: [protege-user] SUM of data properties of a class and it's subclass
 
On May 4, 2018, at 9:20 AM, joshuabezaleel <[hidden email]> wrote:
 
Hi everyone,
 
I am pretty new to ontology and semantic web things so I am really sorry if
my question is a really basic one.
 
Let's say that I have a class (e.g. Family) and it has a subclass (e.g.
FamilyMember) which both of them have the same property (e.g. hasMoney)
which is an integer denoting how much money each family member has. 
For example, a Family instance named JohnFamily has 3 instances of
FamilyMember which are Father, Mother and Son, all of it with their own
hasMoney property. 
Is it possible to inference automatically that the hasMoney property of
Family is the SUM of all it's FamilyMember (Father,Mother and Son) (If
Father has $200, Mother has $100, Son has $50, then the reasoner can infer
that the hasMoney property of JohnFamily is $350)? Or do I need some kind of
Rule(SWRL & SQWRL) and how do I make this?
 
Thank you very much for the help. Any kind of help, how little it is, is
really much appreciated from me.
 
A couple comments:
 
1. A requirement of OWL class hierarchy is that an instance of the subclass must also an instance of a superclass. So if you have FamilyMember as a subclass of Family, then a family member (say, John) must be an instance of Family as well. A better alternative is to use a ‘hasFamilyMember’ property to link a family (e.g., JohnFamily) with members such as John (an instance of Person).
 
2. The question of taking sums comes periodically on this mailing list. An old thread is appended below. The SWRLTab mentioned in the message has been ported to Protege 5.2. The current reference for SQWRL is available at [1].
 
With best regards,
Samson 
 
 
 
 
 
From: Igor Toujilov <[hidden email]>
Subject: Re: [protege-user] Question on data properties and SWRL
Date: July 3, 2014 at 1:53:53 PM PDT
Reply-To: User support for WebProtege and Protege Desktop <[hidden email]>
 
Hi All,
The open world assumption does not prohibit us from possession of full knowledge about a logical condition. For example, we can perfectly know what are all the Factories that are attached to a Distributor at least for a fixed period of time.
So, there is a way to do this in pure OWL DL + SWRL. For example, we can use a linked list of objects, and derive aggregation values on data properties of the linked objects with a help of simple SWRL rules. Once I had posted a tiny ontology, implementing this (to this or related Email-list for OWL API developers; I do not remember exactly where I had posted it, but you can find, or I can resend if needed). This way we can use native aggregation capabilities of OWL DL + SWRL in Protégé 4 or 5 (or perhaps Web Protégé).
 
Cheers,
Igor
 
 
 
Sent: Wednesday, July 02, 2014 at 8:37 PM
From: "Csongor Nyulas" <[hidden email]>
Subject: Re: [protege-user] Question on data properties and SWRL
Hi Gedaliah,
 
Because SWRL adopts the open world assumption [1] there is no way to do this in "pure" SWRL. In an open world you can never know what are "all" the Factories that are attached to a Distributor.
 
This being said, you can use the aggregation capabilities [2] of the SQWRL query language [3] to retrieve the sum of the property values. SQWRL is currently available only in Protege 3.x throulgh the SWRLTab plugin. Martin O'Connor is working on porting this plugin to Protege 5.0.
 
Csongor
 
 
On 07/02/2014 11:37 AM, Knizhnik, Gedaliah wrote:
Is there a way of writing SWRL rules to add together values from all of a range of data properties? I have an ontology that contains a Factory class, as well as a Distributor class. Each Factory has a data property hasProduction which is a double type measurement of its output. A Distributor has an object property hasFactory, which links it to a single instance of the Factory class, but a single Distributor can have any number of Factories. I want to use SWRL to make a data property hasDistribution for the Distributor, which will be the sum of all the production values from the Factories attached to that Distributor. Is there a way to do that?
 
Thanks.
  
 
 
_______________________________________________ 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: SUM of data properties of a class and it's subclass

joshuabezaleel
This post was updated on .
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: SUM of data properties of a class and it's subclass

Igor Toujilov-2
Hi Joshua,
It is available from my MELO project: https://sourceforge.net/p/meloproject/code/ci/master/tree/OWL/examples/list_sum.owl

Enjoy!

Cheers,
Igor


> Sent: Tuesday, May 08, 2018 at 7:53 AM
> From: joshuabezaleel <[hidden email]>
> To: [hidden email]
> Subject: Re: [protege-user] SUM of data properties of a class and it's subclass
>
> Hi Mr. Toujilov,
>
> Thank you very much for the reference and for your reply.
>
> You said in the previous thread that you have made a tiny ontology
> implementing the case and you can resend if needed. Can you please send it
> to me? This is a study case for my final project.
> You can reach me at [hidden email].
> Seriously, thank you, your help is really much appreciated.
>
>
>
>
> --
> 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: SUM of data properties of a class and it's subclass

joshuabezaleel
Hi Igor,

There are several problems when arose when I tried to run the list_sum.owl
from your MELO project.
1. I tried to run the DL query "has_price_sum some decimal [< 500]" that you
recommended  here
<http://protege-project.136.n4.nabble.com/Protege-SWRL-Help-needed-td4657759.html>  
but the error said that the keyword "decimal" is not the one expected at the
query but rather "Datatype name", "not" or "{". Picture attached named
"error_decimal".

2. I tried to run SQWRL query found in the SQWRLtab but both of the SQWRL
query output the error of "invalid query name". Picture attached named
"error_invalidqueryname".

Do you have any recommendations or solutions on how to solve these problems?

Thank you very much. Any kind of help is much appreciated.

<http://protege-project.136.n4.nabble.com/file/t376301/error_decimal.png>
<http://protege-project.136.n4.nabble.com/file/t376301/error_invalidqueryname.png>





--
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: SUM of data properties of a class and it's subclass

Lorenz Buehmann


On 08.06.2018 03:53, joshuabezaleel wrote:

> Hi Igor,
>
> There are several problems when arose when I tried to run the list_sum.owl
> from your MELO project.
> 1. I tried to run the DL query "has_price_sum some decimal [< 500]" that you
> recommended  here
> <http://protege-project.136.n4.nabble.com/Protege-SWRL-Help-needed-td4657759.html>  
> but the error said that the keyword "decimal" is not the one expected at the
> query but rather "Datatype name", "not" or "{". Picture attached named
> "error_decimal".
it must be xsd:decimal, i.e.

has_price_sum some xsd:decimal [< 500]



>
> 2. I tried to run SQWRL query found in the SQWRLtab but both of the SQWRL
> query output the error of "invalid query name". Picture attached named
> "error_invalidqueryname".
>
> Do you have any recommendations or solutions on how to solve these problems?
>
> Thank you very much. Any kind of help is much appreciated.
>
> <http://protege-project.136.n4.nabble.com/file/t376301/error_decimal.png>
> <http://protege-project.136.n4.nabble.com/file/t376301/error_invalidqueryname.png>
>
>
>
>
>
> --
> 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: SUM of data properties of a class and it's subclass

Igor Toujilov-2
Hi All,

Lorenz, that is right; thank you.

Joshuabezaleel,
My recommended query was for old Protégé five years ago. Now Protégé 5.2.0 requires xsd:decimal instead of just decimal in DL queries. Also note: the DL Query uses a proper OWL 2 DL reasoner, Pellet in this case.

Regarding your second question, I am not a fun of the SQWRLtab because, as it says, "The SWRLAPI supports an OWL profile called OWL 2 RL and uses an OWL 2 RL-based reasoner to perform querying." The  OWL 2 RL profile is a subset of the OWL 2 DL profile.
So, when I select and run S1 query, it says:

Exception when running SQWRL query S1: error running SQWRL queries: error running Drools rule engine:
built-in exception thrown by built-in swrlb:add in rule S2: exception thrown by built-in swrlb:add in rule S2: cannot convert value of type xsd:decimal to xsd:double

So, I think the SQWRLtab cannot cope with xsd:decimal data types.

Cheers,
Igor


> Sent: Friday, June 08, 2018 at 6:40 AM
> From: "Lorenz Buehmann" <[hidden email]>
> To: [hidden email]
> Subject: Re: [protege-user] SUM of data properties of a class and it's subclass
>
>
>
> On 08.06.2018 03:53, joshuabezaleel wrote:
> > Hi Igor,
> >
> > There are several problems when arose when I tried to run the list_sum.owl
> > from your MELO project.
> > 1. I tried to run the DL query "has_price_sum some decimal [< 500]" that you
> > recommended  here
> > <http://protege-project.136.n4.nabble.com/Protege-SWRL-Help-needed-td4657759.html>  
> > but the error said that the keyword "decimal" is not the one expected at the
> > query but rather "Datatype name", "not" or "{". Picture attached named
> > "error_decimal".
> it must be xsd:decimal, i.e.
>
> has_price_sum some xsd:decimal [< 500]
>
>
>
> >
> > 2. I tried to run SQWRL query found in the SQWRLtab but both of the SQWRL
> > query output the error of "invalid query name". Picture attached named
> > "error_invalidqueryname".
> >
> > Do you have any recommendations or solutions on how to solve these problems?
> >
> > Thank you very much. Any kind of help is much appreciated.
> >
> > <http://protege-project.136.n4.nabble.com/file/t376301/error_decimal.png>
> > <http://protege-project.136.n4.nabble.com/file/t376301/error_invalidqueryname.png>
> >
> >
> >
> >
> >
> > --
> > 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
>
_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user
Reply | Threaded
Open this post in threaded view
|

Re: SUM of data properties of a class and it's subclass

Martin O'Connor-2
Regarding your second question, I am not a fun of the SQWRLtab because, as it says, "The SWRLAPI supports an OWL profile called OWL 2 RL and uses an OWL 2 RL-based reasoner to perform querying." The  OWL 2 RL profile is a subset of the OWL 2 DL profile.
So, when I select and run S1 query, it says:

Exception when running SQWRL query S1: error running SQWRL queries: error running Drools rule engine:
built-in exception thrown by built-in swrlb:add in rule S2: exception thrown by built-in swrlb:add in rule S2: cannot convert value of type xsd:decimal to xsd:double

So, I think the SQWRLtab cannot cope with xsd:decimal data types.

What version of the SWRLTab are you using? As of release 2.0.0 [1] the SWRLAPI supports xsd:decimal types.

Martin

[1] https://github.com/protegeproject/swrltab-plugin/releases/tag/release-2.0.0



Cheers,
Igor


Sent: Friday, June 08, 2018 at 6:40 AM
From: "Lorenz Buehmann" <[hidden email]>
To: [hidden email]
Subject: Re: [protege-user] SUM of data properties of a class and it's subclass



On 08.06.2018 03:53, joshuabezaleel wrote:
Hi Igor,

There are several problems when arose when I tried to run the list_sum.owl
from your MELO project.
1. I tried to run the DL query "has_price_sum some decimal [< 500]" that you
recommended  here
<http://protege-project.136.n4.nabble.com/Protege-SWRL-Help-needed-td4657759.html>  
but the error said that the keyword "decimal" is not the one expected at the
query but rather "Datatype name", "not" or "{". Picture attached named
"error_decimal".
it must be xsd:decimal, i.e.

has_price_sum some xsd:decimal [< 500]




2. I tried to run SQWRL query found in the SQWRLtab but both of the SQWRL
query output the error of "invalid query name". Picture attached named
"error_invalidqueryname".

Do you have any recommendations or solutions on how to solve these problems?

Thank you very much. Any kind of help is much appreciated.

<http://protege-project.136.n4.nabble.com/file/t376301/error_decimal.png>
<http://protege-project.136.n4.nabble.com/file/t376301/error_invalidqueryname.png>





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

_______________________________________________
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: SUM of data properties of a class and it's subclass

Igor Toujilov-2

I was using SWRLTab version 1.0.3. After upgrading to 2.0.5 it worked fine.

 
 
Sent: Wednesday, June 27, 2018 at 11:07 PM
From: "Martin O'Connor" <[hidden email]>
To: "User support for WebProtege and Protege Desktop" <[hidden email]>
Subject: Re: [protege-user] SUM of data properties of a class and it's subclass
Regarding your second question, I am not a fun of the SQWRLtab because, as it says, "The SWRLAPI supports an OWL profile called OWL 2 RL and uses an OWL 2 RL-based reasoner to perform querying." The  OWL 2 RL profile is a subset of the OWL 2 DL profile.
So, when I select and run S1 query, it says:

Exception when running SQWRL query S1: error running SQWRL queries: error running Drools rule engine:
built-in exception thrown by built-in swrlb:add in rule S2: exception thrown by built-in swrlb:add in rule S2: cannot convert value of type xsd:decimal to xsd:double

So, I think the SQWRLtab cannot cope with xsd:decimal data types.
 
What version of the SWRLTab are you using? As of release 2.0.0 [1] the SWRLAPI supports xsd:decimal types.
 
Martin
 
[1] https://github.com/protegeproject/swrltab-plugin/releases/tag/release-2.0.0
 
 

Cheers,
Igor

 
Sent: Friday, June 08, 2018 at 6:40 AM
From: "Lorenz Buehmann" <[hidden email]>
To: [hidden email]
Subject: Re: [protege-user] SUM of data properties of a class and it's subclass



On 08.06.2018 03:53, joshuabezaleel wrote:
Hi Igor,

There are several problems when arose when I tried to run the list_sum.owl
from your MELO project.
1. I tried to run the DL query "has_price_sum some decimal [< 500]" that you
recommended  here
<http://protege-project.136.n4.nabble.com/Protege-SWRL-Help-needed-td4657759.html>  
but the error said that the keyword "decimal" is not the one expected at the
query but rather "Datatype name", "not" or "{". Picture attached named
"error_decimal".
it must be xsd:decimal, i.e.

has_price_sum some xsd:decimal [< 500]


 

2. I tried to run SQWRL query found in the SQWRLtab but both of the SQWRL
query output the error of "invalid query name". Picture attached named
"error_invalidqueryname".

Do you have any recommendations or solutions on how to solve these problems?

Thank you very much. Any kind of help is much appreciated.

<http://protege-project.136.n4.nabble.com/file/t376301/error_decimal.png>
<http://protege-project.136.n4.nabble.com/file/t376301/error_invalidqueryname.png>





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