Protege: Object property restrictions 2 - owl

I'm using Protege 4.3 to create my first ontology, so I encountered a few problems
let's say we have the classes Person and Department and the properties employs and hasPart
So the problem is: I defined some classes like BigShopas Equivalent To employs min 6 Person and hasPart some Department but when I activate the reasoner I don't get the results I'm waiting for, I also tried SubClass Of with the same two restrictions but nothing happened
Any idea why?

Related

protege reflexive property usage

In protege a reflexive property is assigned to all individuals relgardless of domain and range and the class to which individuals belongs.
so what is the use of this restriction?
P.S: lets say there is three individuals:
NamedIndividual( :John )
NamedIndividual( :alex )
NamedIndividual( :BMW )
and an object proeprty:
ObjectProperty( :hasFriend )
ReflexiveObjectProperty(:hasFriend)
running pellet deduce that :
BMW hasFriend BMW
This inference is conceptually meaningless
Papers like The even more irresistible SROIQ and Foundations of Description Logics point out that reflexive and irreflexive properties are closely related to the exists r.Self concept. I.e. Narcissist can be defined as Narcissist \sqsubseteq loves.Self.
The SROIQ paper actually mentions that the main use cases for reflexive and irreflexive properties are limited and only make sense when used along with cardinality restrictions. I.e. if you define PopularPerson as someone with at least 2 friends, and hasFriend is reflexive, then by asserting an individual has 1 known friend will result in that individual being classified as a PopularPerson because the individual is already assumed to be its own friend.
Interestingly, the paper also mentions that reflexive(r) is equivalent to adding the GCI top \sqsubseteq exists r.Self to the TBox. Personally for me this is more intuitive and provides the control I think you seem to want to achieve. In particular this allows you to replace \top with whatever class of your choice. A similar equivalent exists for irreflexive properties.

OWL/Protege: Model inferred class of persons, who are not members of a group

I try to create an ontology in OWL, using Protégé 5.5.0. No I have a little trouble with inferred classes.
I have three classes: Agents and as subclasses Groups and Persons. Persons can be members of Groups. Now I want to create two inferred classes: a) "Members of groups" and b) "Not members of groups" (both as subclasses of Person)
I was successful with a), using the axiom equivalent class: Person and member_of some Group.
I created one individual, which is a person and member of a group and it was inferred to be member of the class "Members of groups".
Now I'm stuck with b). I tried several options for the equivalent class, for example:
Person and member_of max 0 Group
Or: Person and member_of exactly 0 Group
Or: Person and not member_of some Group
I created an individual which is a person but no groupmember. But the reasoner does not agree with me about the fact, that this individual should belong to the inferred class "Not members of groups".
What did I do wrong?
One way to achieve this in OWL, using your Person and not member_of some Group,
is to define a MemberOfGroup class that is defined as you suggested. Then define a NotMemberOfGroup class, that is disjoint with the MemberOfGroup class. If you now define your individual to be of type Person, as well as of type not member_of some Group, then your individual will be classified as belonging to the NotMemberOfGroup class.
The reason why you have to do this, is that OWL uses the open world assumption and hence it can only make inferences about things it knows for sure. I.e. saying that the individual is a Person, while making no statement regarding member_of provides the reasoner with zero explicit info to determine that the individual either belongs or does not to a group.
The other option is to use SHACL/SHEX/SPIN.

Protege exactly 1 cardinality OWL restriction not raising an inconsistency

I think I am going crazy! I have followed the various tutorials for Owl and Protege and still cannot figure out the answer. Use case is simple. I have defined a class called ‘Person’. I have defined a data property called hasFirstName. I have added a ‘subclass of’ restriction to Person like this : ‘hasFirstName exactly 1 string’. I have also added an individual called Alex of type Person, and have not added the hasFirstName property. I expect the reasoner to complain as I have specified the cardinality of 1, and asserted that Alex is a Person, but have not added the property value to Alex individual, yet the reasoner does not complain. If however I add two statements e.g. hasFirstName ‘Alex’ and hasFirstName ‘John’ then I get a complain. What I am doing wrong? Any help will be most appreciated, thanks.
There's no inconsistency in the first case. OWL makes the open world assumption, which means that something being unknown is different from it being known to be true or known to be false. Your username, at the time I'm writing this answer is user3552593. I'm relatively confident that you have a name, and that's not inconsistent with the fact that I don't know what it is yet.
By saying that
Person ⊑ =1 hasFirstName.String
and that
Alex : Person
you can infer that
Alex : =1 hasFirstName.String
There's nothing inconsistent with that; Alex, by virtue of Alex's personhood, has exactly one first name—we just don't know what it is yet.

In OWL, is it possible to query a class that does not have a property?

In OWL, is it possible to query a class that does not have a property?
Suppose I have an object property R and I want to retrieve all classes that do not have the property R. Also, suppose that I have already closed all classes with closures.
I was trying this:
suppose the propety in question is hasProperty, my query was this
hasProperty only Nothing
But it doesn't work
What do you mean by "class that does not have a property"?
Semantically, a class is a set of individuals and a property is a set of pairs of individuals. Given these two sets, what do you mean by "class has / has not a property"?
Regarding your example query
hasProperty only Nothing
lets rewrite it a bit so that we can think about it in natural language. This gives better intuition about the meaning of this query.
First lets rename hasProperty to follows (or whatever English verb), then we have:
follows only Nothing
This is semantically equivalent to
follows only (not Thing)
which is semantically equivalent to
not (follows some Thing)
Now we have gotten rid of the only which is a confusing part of OWL and is better avoided. So now we can verbalize the query in English as:
those who do not follow anything
or
who does not follow anything?
or more formally
which individuals of the ontology are known
not to have a follow relationship to any other individual
E.g. if your ontology states that
John does not follow Mary.
John does not follow himself.
Every individual in the ontology is either John or is Mary.
then John will be the answer to the above query.
You can also get a named class as the query answer if the asked restriction holds for a (named) group of individuals. In any case, the following must hold: if you asserted that the answer (or a member of it) does have a follow-relation to some individual then it would render the ontology inconsistent.
OWL does not have any means for querying the data. SPARQL is used for that. So the SPARQL query to find all class definitions that do not have the property :R would be:
SELECT ?cls
WHERE {
?cls a owl:Class .
FILTER NOT EXISTS {?cls :R ?o}
}

get_by_id() will not return model instance

I have a Model called Version that looks like this:
from google.appengine.ext import db
import piece
class Version(db.Model):
"A particular version of a piece of writing."
parent_piece = db.ReferenceProperty(piece.Piece, collection_name='versions')
"The Piece to which this version belongs."
note = db.TextProperty()
"A note from the Author about this version."
content = db.TextProperty()
"The actual content of this version of the Piece."
published_on = db.DateProperty(auto_now_add=True)
"The date on which the version was published."
I would like to access instances of Version via their IDs, using Version.get_by_id(), but this call always returns None. I can see in the Datastore Viewer that they have ID values, and in the debugger, I can query for them but not use them:
>>> for each_ver in version.Version.all():
... print each_ver.key().id()
...
34
35
36
31
32
>>> a = version.Version.get_by_id(34)
>>> type(a)
<type 'NoneType'>
I see that there are plenty of questions here where people are able to use get_by_id() effectively just as I wish, and they do not see the results that I am seeing.
Could the problem be that each Version instance is a child in an Entity Group rather than a root of an Entity Group? Each Version lives in an Entity Group that looks like Member->Piece->Version. If that is the problem, is there a way that I can refer to Version entity without using its entire key? If that is not the problem, can anyone tell me what I can do to make get_by_id() work as expected?
Could the problem be that each Version
instance is a child in an Entity Group
rather than a root of an Entity Group?
Yes. An entity's key includes the keys of any parent entities.
If that is the problem, is there a
way that I can refer to Version entity
without using its entire key?
No. An entity is uniquely identified only by its entire key, which includes the keys of all the parent entities. If you know the kinds of its parent entities, though, you can use db.Key.from_path to construct the key from the chain of IDs or key names.
I had your same problem but in ndb.Model and I found that I need to convert the ID to an int. So maybe using version.Version.get_by_id(int(34)) can solve your problem.

Resources