Trouble with Inferencing

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

Trouble with Inferencing

2bed234
Hi everyone, I am quite new to protege and am having trouble with some
inferencing and also having trouble with finding useful fixes. 

I currently have an ontology which has classes: 
ApplianceUsage 
Household 
     LowConsumptionHousehold 
     HighConsumptionHousehold 

They relate through: Household hasUsage ApplianceUsage 
Also, an instance of ApplianceUsage has data properties of fridge_usage,
heater_usage, ect with each one having a string range. 

I have populated the ontology with various different households including
all of their usages, all as 'household' types. I then created one individual
of type lowConsumption and one of highConsumption and created an
ApplianceUsage for each of them. the lowUsage defines some of the appliances
to have usage of 'never' (but leaves other appliances blank) and the
highUsage defines some appliances as 'daily' (and the rest as blank). 

I am trying to be able to populate the ontology with households, then when I
run the reasoner, be able to infer if a household is a lowConsumption or
highConsumption by trying to relate the household's usage to see if it
matches what I defined to be the low/highUsage. 

for example, household1 hasUsage heater_usage='daily', fridge_usage='daily',
microwave_usage='daily', geyser_usage='weekly', oven_usage='monthly' 

highUsage: heater_usage='daily', fridge_usage='daily', microwave_usage="",
geyser_usage="", oven_usage="" 

in this example, household1 has usage which matches the filled in values of
highUsage so it should be inferred to be a highConsumption household. 

I currently tried to do this by setting the subclass of my
highConsumptionHousehold class to be "Household and (hasUsage value
highUsage)" and similarly lowConsumption. 

I am clearly not looking at this the right way since the inferences aren't
working when I run the reasoner. I think that using "Household and (hasUsage
value highUsage)" means that the usage needs to be set as the exact value of
highUsage, and automatically usage1 =/= highUsage. How can I find a way to
define these high/low usage rules for protege to infer if a household is
high or low consumption? Thanks! 



--
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: Trouble with Inferencing

Michael DeBellis-2
I'm guessing this is a rather small ontology. If that's the case it would be a lot easier for me at least if you would just include the owl file as an attachment to another message and I could take a quick look rather than trying to work through your descriptions above. But from my quick scan of your message there are 2 things I can think of: 

1) Make sure you've done the Pizza tutorial. That shows you how to create defined classes and the basics of creating models in Protege. 

2) Remember that if you want the reasoner to infer that X is an instance of class Foo you have to make Foo a defined class. If you put axioms in the SubClass Of frame those are necessary conditions but not sufficient. It's only when you make Foo a defined class (move the axioms to "Equivalent to" or use "Edit>Convert to defined class") that you have necessary and sufficient axioms to recognize when X is a Foo and that is when the reasoner will start to classify your individuals as you expect.

If that doesn't help feel free to attach the actual ontology in another message.

Michael



On Fri, Aug 23, 2019 at 9:21 AM 2bed234 <[hidden email]> wrote:
Hi everyone, I am quite new to protege and am having trouble with some
inferencing and also having trouble with finding useful fixes. 

I currently have an ontology which has classes: 
ApplianceUsage 
Household 
     LowConsumptionHousehold 
     HighConsumptionHousehold 

They relate through: Household hasUsage ApplianceUsage 
Also, an instance of ApplianceUsage has data properties of fridge_usage,
heater_usage, ect with each one having a string range. 

I have populated the ontology with various different households including
all of their usages, all as 'household' types. I then created one individual
of type lowConsumption and one of highConsumption and created an
ApplianceUsage for each of them. the lowUsage defines some of the appliances
to have usage of 'never' (but leaves other appliances blank) and the
highUsage defines some appliances as 'daily' (and the rest as blank). 

I am trying to be able to populate the ontology with households, then when I
run the reasoner, be able to infer if a household is a lowConsumption or
highConsumption by trying to relate the household's usage to see if it
matches what I defined to be the low/highUsage. 

for example, household1 hasUsage heater_usage='daily', fridge_usage='daily',
microwave_usage='daily', geyser_usage='weekly', oven_usage='monthly' 

highUsage: heater_usage='daily', fridge_usage='daily', microwave_usage="",
geyser_usage="", oven_usage="" 

in this example, household1 has usage which matches the filled in values of
highUsage so it should be inferred to be a highConsumption household. 

I currently tried to do this by setting the subclass of my
highConsumptionHousehold class to be "Household and (hasUsage value
highUsage)" and similarly lowConsumption. 

I am clearly not looking at this the right way since the inferences aren't
working when I run the reasoner. I think that using "Household and (hasUsage
value highUsage)" means that the usage needs to be set as the exact value of
highUsage, and automatically usage1 =/= highUsage. How can I find a way to
define these high/low usage rules for protege to infer if a household is
high or low consumption? Thanks! 



--
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: Trouble with Inferencing

2bed234

Hi Michael,

Thank you for your reply. I have done the pizza tutorial so I think I
understand the basics more or less. I went ahead and followed your advice
and set the low/high consumption to be defined classes through the
"Edit>Convert to defined class" you suggested. This actually worked for
inferring the two entities I had populated that had highUsage and lowUsage
as their ApplianceUsage, but it did not help in inferring any of the other
households.

I have attached the OWL file to this message so you may take a look. I
really appreciate the help, let me know if I can clarify anything!
randoms.owl
<http://protege-project.136.n4.nabble.com/file/t377114/randoms.owl>  



--
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: Trouble with Inferencing

Michael DeBellis-2
Thanks for sending the owl file. I'm not sure what isn't working as you want it to but I think perhaps I may have an idea of the question you were asking (or maybe not). 

When I look at Household1 I don't see anything that the reasoner can currently reason about so it's not a surprise to me that it's not inferred to be an instance of HighConsumption or LowConsumption. But when I look at Usage1 (the hasUsage value for Household1) I see that it has a bunch of data property values such as geyser_use "never" kettle_use "daily", etc. Are these the kinds of values that you want to reason about? E.g., do you want to have rules like:

Houshold(?h) ^ hasUsage(?h,?u) ^ geyser_use(?u,?gs) ^ swrl:equal(?gs, "never") -> NonGeyserHouseHold(?h)  

I know this is a dumb rule, it's just an example but I'm wondering if this is the kind of thing you want to do. This rule is written in the Semantic Web Rule Language (SWRL). The result of this rule would be to classify Houshold1 (and any individuals with geyser_use = "never") as instances of the made up class NonGeyserHouseHold.  What this rule does is first match all instances of Houshold and bind them to ?h. Then get the hasUsage value for each household and bind it to ?u,... and so on. Then for each individual such that all the conditions on the left hand side are satisfied (the "^" is an AND logical operator) the right side of the rule fires and asserts new info. 

If this is the kind of thing you want then SWRL can do this easily. Although you can also just define classes based on the data property values just as you can for object property values. In general when there are lots of properties to reason about I tend to prefer SWRL. However, if you want to use things like cardinality restrictions then defined classes are typically better. 

Another point: unless you are constrained by some pre-existing database to use string values for those properties I would make them individuals that are instances of enumerated classes and then use the names rather than the strings. There are some minor but non-trivial benefits when you do this, for example, Protege can do type ahead for names of individuals but not for string values. So for example I would make an enumerated class called  something like Use that had instances like Never, Daily, Weekly, etc. Then change the data properties to object properties and the SWRL rule above would look like this:

Houshold(?h) ^ hasUsage(?h,?u) ^ geyser_use(?u,?gs) ^ swrl:equal(?gs, Never) -> NonGeyserHouseHold(?h)  

Here is a link to a short SWRL tutorial I wrote: https://symbolicshacker.blogspot.com/2017/06/swrl-process-modeling-tutorial.html  

Let me know if I'm on the right track or if I'm not please explain a bit more an example of the kind of reasoning you want to do based on that ontology.

Michael



On Fri, Aug 23, 2019 at 10:13 AM 2bed234 <[hidden email]> wrote:

Hi Michael,

Thank you for your reply. I have done the pizza tutorial so I think I
understand the basics more or less. I went ahead and followed your advice
and set the low/high consumption to be defined classes through the
"Edit>Convert to defined class" you suggested. This actually worked for
inferring the two entities I had populated that had highUsage and lowUsage
as their ApplianceUsage, but it did not help in inferring any of the other
households.

I have attached the OWL file to this message so you may take a look. I
really appreciate the help, let me know if I can clarify anything!
randoms.owl
<http://protege-project.136.n4.nabble.com/file/t377114/randoms.owl



--
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: Trouble with Inferencing

Michael DeBellis-2
In reply to this post by 2bed234
Just a couple more thoughts:

1) You could have SWRL rules that worked only on the Usage class. I see that you made highUsage and lowUsage individuals. I would make those classes and then I would use the SWRL rules to classify each usage as an instance of the HighUsage or LowUsage class. So for example:

ApplianceUsage(?u) ^ geyser_use(?u, ?gu) ^ swrlb:equal(?gu,"daily") ^ kettle_use(?u, ?ku) ^ swrlb:equal(?ku,"daily") ^ ... -> HighUsage(?u)

Then you could change the definition of the class highConsumption to:

Household and hasUsage some highConsumption

FYI, the standard is that names of classes have the first letter of each word capitalized so the class highConsumption would typically be HighConsumption. The standard for properties is to do it the other way where the first letter is lower case and all the other words (if any) are upper case. So typically rather than geyser_use you would name it geyserUse. Not a big deal, it works fine if you have other naming standards but unless you have a good reason to use some other standard I think sticking to the OWL convention makes your ontology more understandable to others. 

2) One advantage of using named objects rather than strings is that it's easy to put the named objects in an order. You can have object properties like isHigherThan and isLessThan so that you can say things like Daily isHigherThan  Weekly.  You can also make the isLessThan property the inverse of isHigherThan so that the inverse relations are calculated for you.Then in your SWRL rules you could say things like:

ApplianceUsage(?u) ^ geyser_use(?u, ?gu)  ^ isHigherThan(?gu, Weekly) ->  HighUsage(?u)

Michael

On Fri, Aug 23, 2019 at 10:13 AM 2bed234 <[hidden email]> wrote:

Hi Michael,

Thank you for your reply. I have done the pizza tutorial so I think I
understand the basics more or less. I went ahead and followed your advice
and set the low/high consumption to be defined classes through the
"Edit>Convert to defined class" you suggested. This actually worked for
inferring the two entities I had populated that had highUsage and lowUsage
as their ApplianceUsage, but it did not help in inferring any of the other
households.

I have attached the OWL file to this message so you may take a look. I
really appreciate the help, let me know if I can clarify anything!
randoms.owl
<http://protege-project.136.n4.nabble.com/file/t377114/randoms.owl



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