I am trying to infer the existence of individuals in Protege, and can use some help.
Consider the following ontology as the example scenario: Persons may be siblings. If they are siblings then they have at least one mutual/common parent.
I defined a class called "Person" with a subclass of "CommonParent". I define the "sibling" object property from one "Person" (Domain) to another "Person" (Ranges), and marked it as "Symmetric".
I created three individuals (Mike, Jerry, Suzie) and added two assertions about one being sibling to another. The reasoner (HermiT) correctly classified the individuals as persons and added missing sibling relations.
Now, what I want to do is to have the reasoner infer the existence of another (unnamed) entity being the "CommonParent" of each sibling pair (without me specifically asserting that there is such individual). Is this possible? How do I approach this?
Protege screenshot
Related
I want to define an OWL ontology, whose main goal is to explicitly describe the spatial elevation of things. Here is an example, I divide things into three classes, namely above_ground, surface and underground. The concepts of some things may belong to these classes simultaneously. Such as the concept Parking lot should belong to these three classes. However, when instantiating Parking lot, say Pk_xxx, it comes a problem, I can't distinguish which class the instance Pk_xxx belong to.
Is there an easy way to retrieve just the root classes from an OWL ontology in OWLAPI? Here I mean named classes with no asserted parent class. Added complexity, trying not to use reasoner because ontologies are huge and reasoner is not completing in fast enough time (typically). Thanks as always!
Actually using a reasoner would make the task trivial because the only named class without a parent would be owl:Thing.
Jokes aside, you'd need to take all the classes in the ontology signature and, for each one, ensure it does not appear in a subclass axiom as subclass (or, if it does, that the class on the other side is owl:Thing.
The code would look like this:
OWLDataFactory df=OWLManager.getOWLDataFactory();
OWLClass thing=df.getOWLThing();
OWLOntology o = ...
o.classesInSignature()
// all asserted superclasses
.filter(c->o.subClassAxiomsForSubClass(c)
// skip owl:Thing
.filter(s->!thing.equals(s.getSuperClass()))
// only keep the ones with no superclass
.count()==0)
.forEach(System.out::println);
This example prints out the IRIs for those classes.
I am getting a confusion with Protege. May be it is a setting that I should configure somewhere that I am not doing.
Suppose I have an object property hasFriend. The domain and range of this object property is both Person. Now Person has two subclasses: Man and Woman.
The problem is when I launches the reasoner, HermiT (default reasoner in Protege), I was expecting to see that it adds Man and Woman as domain and ranges for hasFriend since they are subclasses of Person.
Is there a particular why I am not seeing these inferences ?
I need to map classes from a preexisting ontology to individuals in mine. I'm looking for an elegant way to do so. For instance, let's say the preexisting ontology has:
Class Drug1 with subclasses Brand1, Brand2, Brand3
In my ontology, I want to have Brand1, Brand2, and Brand3 as individuals of Class Drug1.
I cannot use owl:sameAs because it is for individual-individual mapping. Similarly, I probably cannot use equivalentClass becuase it is for class-class mapping.
What is a good approach to take in such a scenario?
It's done by punning. In Protege, just have identical names for the class and the individual you'd like to pun.
I'm working with a OWL API 3 / Pellet / SPARQL-DL stack and want to read the asserted TBox axioms of a certain class from an ontology.
I can easily access the axioms with OWL API. However, the OWLClassAxiom just provides function to access the signature without the connections. I.e. I want to know to which Class a ObjectProperty is assigned to. All I can retrieve is a set of all elements in the signature, without their connection.
It seems that OWL API does not really support working with given axioms on a class level well (Reading, not adding.) Or am I missing something? Any other ideas how to achieve that? (With whatever tools.)
Concrete Example: Pizza hasBase some PizzaTopping. I want to retrieve the value "PizzaTopping" by specifying Pizza and hasBase.
If Pizza is a class, then
Pizza hasBase some PizzaTopping
isn't a legal axiom. What you probably actually have is
Pizza subClassof hasBase some PizzaTopping
That means that every instance of Pizza is related to some instance of PizzaTopping by the hasBase property. The axiom is a subclass axiom, so you'd want to retrieve an instance of OWLSubClassOfAxiom, (which is a subclass of OWLClassAxiom).
In this case, if you have a reference to the OWLClass for Pizza, then you could use OWLClass#getSuperclasses() to get a list of superclass expressions. One of them would be an OWLObjectSomeValuesFrom expression for (hasBase some PizzaTopping). You'd have to look for the ones of that type, and then examine the property that it is a restriction on.
That said, your stated goal
to know to which Class a ObjectProperty is assigned to
doesn't quite match up with the OWL model. Object properties (and data properties) don't "belong" to classes in OWL. You can use subclass axioms and property restrictions, like above, to say that members of a class must have a value for a particular property,