I'm a protégé newbie and did the pizza tutorial and read the 101 documentation. I'm trying to model a ontology like the following picture:
I have a person who has a style. The style can be a style_active or style_passive.
This style is determined by a index of two data properties:
ind_passive and ind_active, the bigger value should infer the style.
I had to create two individuals: style_active and style_passive, because they must be individuals to be assigned to the object property has_style.
How to infer the value of has_style object property based on ind_passive and ind_active data properties? Using a reasoner?
Is something wrong with this model?
I suceed in calculate the value of style object property based on two swrl rules. It does not work with a reasoner like HermiT (default in Protégé 5.5), but works in SWRLTab, that uses Drools.
The rules I used:
Name: Passive
Rule: Person(?p) ^ ind_passive(?p, ?ip) ^ ind_active(?p, ?ia) ^ swrlb:greaterThan(?ip, ?ia) -> has_style(?p, style_passive)
Name: Active
Rule: Person(?p) ^ ind_passive(?p, ?ip) ^ ind_active(?p, ?ia) ^ swrlb:greaterThan(?ia, ?ip) -> has_style(?p, style_active)
The reasoner Hermit could not be enabled after using this rules, because it does not supports "built-in atoms", like swrlb:greaterThan.
Related
Suppose an OWL ontology contains the following SWRL rule:
has_part(?x, ?y) ^ participates(?x, ?z) -> participates(?y, ?z)
and following object property assertions:
o1 has_part o2
o1 participates p1
When I run the Hermit reasoner in Protege, I obtain the following inferred object property assertion:
o2 participates p1
However, when I load the same ontology with owlready2 and run its Hermit reasoner, I do not get any inferred object property assertion. For example:
from owlready2 import *
onto = get_ontology("test.owl").load()
sync_reasoner()
onto.o2.get_properties()
does not return any properties.
I did save the ontology in the RDFXML format and I can retrieve the SWRL rule with owlready2.
Does owlready2 reasoner not support this kind of inference?
Solution: sync_reasoner(infer_property_values = True)
Could OWL reasoner inherit ranges of data properties from parent properties?
For example, there is the data property "hasEventYear".
It has the domain "Person" and the range "xsd:integer".
When the subproperty "hasBirthYear" is added
the reasoner tells that this subproperty has the domain "Person".
About the range it tells nothing.
Is it normal?
The code below has been tested on Protege 5 and Hermit:
Declaration(Class(:Person))
Declaration(DataProperty(:hasBirthYear))
Declaration(DataProperty(:hasEventYear))
SubDataPropertyOf(:hasBirthYear :hasEventYear)
SubDataPropertyOf(:hasEventYear owl:topDataProperty)
DataPropertyDomain(:hasEventYear :Person)
DataPropertyRange(:hasEventYear xsd:integer)
UPD: You can hack Protege )) by adding:
Declaration(DataProperty(:hasDeathYear))
SubDataPropertyOf(:hasDeathYear :hasEventYear)
DataPropertyRange(:hasDeathYear xsd:string)
I've got the hasDeathYear domain is "Nothing"
and the explanation:
hasEventYear Range: xsd:integer
hasDeathYear SubPropertyOf: hasEventYear
hasDeathYear Range: xsd:string
I have been studying Protege and I have a question. I added an individual with name aaa in ontology "people.owl" which I downloaded from the internet.
I set type assertion as:
sheep and hasCC value 200,
where hasCC is data property.
Then, in class animal I created two classes: hhh and lll.
I set hhh as equivalent and there wrote:
animal and (hasCC some decimal[>= 150])
For lll I set:
animal and (hasCC some decimal[< 250])
When I run HermiT reasoner I see that the individual aaa is classified in both lll and hhh classes.
But when I set lll and hhh classes to be disjoint and run the reasoner the classes are not classified in the class "Nothing" as, for example, the class "mad_cow". I get a message:
"Your ontology is inconsistent which means that the OWL reasoner will no longer be able to provide any useful information about the ontology." After clicking the button "Explain" I get:
Could you say, why lll and hhh classes cannot be classified as Nothing?
What should I correct to let lll and hhh classes to be classified as Nothing?
Thank you!
"Your ontology is inconsistent which means that the OWL reasoner will no longer be able to provide any useful information about the ontology."
Isn't this saying it all already? You complain that the reasoner is not doing something but the reasoner explicitly tells you that it is not able to provide any useful information! Make your ontology consistent, then you can expect something from the reasoner.
In any case, you cannot expect a class that contains an instance (here the classes hhh and lll both must contain instance aaa) to be equivalent to Nothing. Nothing precisely means "the class that does not have any instance".
I am using Protege 3.4 and I built my ontology and extended it with SWRL rules using SWRL and sqwrl built ins . The rules classifies instances of a class of the ontology ; the RHS is class assertion of an instance .It works successfully but when I change the values of the causes in the LHS no reclassification is done the instance is asserted to the same class
Why does this happen ? How to reclassify instances ?
ex:
SWRL rules:
1. Message(?m) hasInterest(?m,?i) hasCategory(?m,?c) sqwrl:makeset(?s1,?i) sqwrl:makeset(?s2,?c) sqwrl:intersection(?s3,?s1,?s2) sqwrl:size(?n,?s3) swrlb:greaterThan(?n,0) -> Ham(?m)
Message(?m) hasInterest(?m,?i) hasCategory(?m,?c) sqwrl:makeset(?s1,?i) sqwrl:makeset(?s2,?c) sqwrl:difference(?s3,?s1,?s2) sqwrl:size(?n,?s3) swrlb:greaterThan(?n,0) -> Spam(?m)
So once the message instance is classified as ham for example , whenever I change the values of i or c it will always be ham .
Im regenerating an ontology to OWL2 using the OWL-API and testing with Protégé.
There are some concepts that are subclass of many superclasses, and some DataProperties that should take multiple values, for example:
Artifactual Location & Artifactual Area
And I want to specify that:
• For Artifactual Location the DataProperty hasConcreteEntityType should take the values LOCATION and ARTIFACT
• For Artifactual Area the DataProperty hasConcreteEntityType should take the values ARTIFACTUAL_LOCATION and AREA
Class Tree & Class Descriptions
But after activating the reasoner, I get Artifactual Location misclassified to Nothing(but not both)
Inference Explanations
And I don't understand what's wrong with the inference explanation,but seems that there should be a third explanation like the second but related to the value AREA, so seems that doesn't support bi-valued properties like this, or, maybe there is another way to define and constraint the values of a multi-valued DataProperty or even the reasoner doesn't work fine with this,
im using Hermit 1.3.8.3
Quoting the comment on my previous answer (I've deleted the answer because it is incorrect)
[The ontology] should be here drive.google.com/file/d/0B2FYMQD3DD8DNWtteUlLcDgyTGM/ Look at the linguisticUnitType property for Morphosyntactic Unit, as I defined it (to have 2 values, MORPHOLOGICAL and SYNTACTIC) it is classified fine by the reasoner, but it doesn't behave the same with the properties hasConcreteEntityType and hasLocationType regarding the classes at Nothing Artifactual Area and Artifactual Location. I don't understand why for one case is fine but not for the other, because the properties and restrictions are defined in the same manner.
The problem is that Artifactual Area is defined as subclass of Location, which already restricts the values of hasConcreteType to only one value (LOCATION). In order to allow Artifactual Area to have exactly two values, the restriction on the superclass must be removed or amended.
For future reference, the fragment in Functional syntax is here:
Ontology(<http://localhost/pruebaLUO.owl>
DataPropertyDomain(:hasConcreteEntityType :ConcreteEntity)
DataPropertyRange(:hasConcreteEntityType DataOneOf("ARTIFACT"^^xsd:string "FOOD"^^xsd:string "LIVING_ENTITY"^^xsd:string "LOCATION"^^xsd:string "MATERIAL"^^xsd:string "ORGANIC_OBJECT"^^xsd:string "PHYSICAL_OBJECT"^^xsd:string "SUBSTANCE"^^xsd:string))
DataPropertyDomain(:hasLocationType :Location)
DataPropertyRange(:hasLocationType DataOneOf("3D"^^xsd:string "AREA"^^xsd:string "ARTIFACTUAL_LOCATION"^^xsd:string "GEOPOLITICAL"^^xsd:string "OPENING"^^xsd:string "OTHER"^^xsd:string))
DataPropertyDomain(:linguisticUnitType :LinguisticUnit)
DataPropertyRange(:linguisticUnitType DataOneOf("MORPHOLOGICAL"^^xsd:string "SEMANTIC"^^xsd:string "SYNTACTIC"^^xsd:string))
AnnotationAssertion(rdfs:label :Area "Area"#en)
SubClassOf(:Area :Location)
SubClassOf(:Area DataHasValue(:hasLocationType "AREA"^^xsd:string))
AnnotationAssertion(rdfs:label :Artifact "Artifact"#en)
SubClassOf(:Artifact :ConcreteEntity)
SubClassOf(:Artifact DataHasValue(:hasConcreteEntityType "ARTIFACT"^^xsd:string))
SubClassOf(:ArtifactualArea :Area)
SubClassOf(:ArtifactualArea :ArtifactualLocation)
SubClassOf(:ArtifactualArea DataExactCardinality(2 :hasLocationType DataOneOf("AREA"^^xsd:string "ARTIFACTUAL_ LOCATION"^^xsd:string)))
SubClassOf(:ArtifactualLocation :Artifact)
SubClassOf(:ArtifactualLocation :Location)
SubClassOf(:ArtifactualLocation DataHasValue(:hasLocationType "ARTIFACTUAL_ LOCATION"^^xsd:string))
SubClassOf(:ArtifactualLocation DataExactCardinality(2 :hasConcreteEntityType DataOneOf("ARTIFACT"^^xsd:string "LOCATION"^^xsd:string)))
SubClassOf(:Building :ArtifactualLocation)
SubClassOf(:ConcreteEntity :GenericEntity)
SubClassOf(:Entity :PropositionalComponent)
SubClassOf(:GenericEntity :Entity)
SubClassOf(:Location :ConcreteEntity)
SubClassOf(:Location DataHasValue(:hasConcreteEntityType "LOCATION"^^xsd:string))
SubClassOf(:MorphologicalUnit :LinguisticUnit)
SubClassOf(:MorphologicalUnit DataHasValue(:linguisticUnitType "MORPHOLOGICAL"^^xsd:string))
SubClassOf(:MorphosyntacticUnit :MorphologicalUnit)
SubClassOf(:MorphosyntacticUnit :Token)
SubClassOf(:MorphosyntacticUnit DataExactCardinality(2 :linguisticUnitType DataOneOf("MORPHOLOGICAL"^^xsd:string "SYNTACTIC"^^xsd:string)))
SubClassOf(:PropositionalComponent :SemanticUnit)
SubClassOf(:SemanticUnit :LinguisticUnit)
SubClassOf(:SemanticUnit DataHasValue(:linguisticUnitType "SEMANTIC"^^xsd:string))
SubClassOf(:SyntacticUnit :LinguisticUnit)
SubClassOf(:SyntacticUnit DataHasValue(:linguisticUnitType "SYNTACTIC"^^xsd:string))
SubClassOf(:Token :SyntacticUnit)
)