How to create constraints about individuals (Protégé - OWL) - owl

I am creating an ontology in Protégé 5.5.0.
I have two classes: 'Person' and 'Company'. They can be related by the following properties:
employs (inverse of isEmployedBy);
manages (inverse of isManagedBy);
sponsors (inverse of isSponsoredBy).
The classes are described as follows:
Person is equivalent to:
(isEmployedBy some Company)
and (isSponsoredBy some Company)
and (manages some Company)
and (isEmployedBy only Company)
and (isSponsoredBy only Company)
and (manages only Company)
Company is equivalent to:
employs some Person
and (isManagedBy some Person)
and (sponsors some Person)
and (employs only Person)
and (isManagedBy only Person)
and (sponsors only Person)
I would like to describe that if there is a Company(c) that employs Person(b), Company(c) can not sponsor Person(b), although it can sponsor Person(c) who is not employed by Company(c).
Since it is a rule related to the individuals and not to the classes I would like to know if it is possible to describe it as an axiom (with an example) or if I would have to use SWRL.

Related

How do I use Manchester Syntax in WebProtege to group only some individuals from from a different class based on individual name

I would like to create a new class PossibleNoduleFinding, grouping some individuals from another class Finding based on the individual name. Finding has a relationship hasFinding with each individual. Example maybe individual name nodule.
I'm trying:
Class: PossibleNodueFinding
Annotations: [in root-ontology]
rdfs:label "PossibleNoduleFinding"#en
SubClassOf: [in root-ontology]
SoftwareMapping
EquivalentTo: (Finding and hasFinding value nodule),
EquivalentTo: (Finding and hasFinding value density)
The Owl editor is not recognizing this syntax.

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.

How to make reasoning of classes with property chain

I have an OWL2 ontology combining technological processes and numerical models. I need to find out, which process might be modeled with which model. I introduced Requirements, that areFulfilled by Process while Models hasRequirements. I am able to do it with individuals, but not classes.
I am using Protege 5.1, Fact++ reasoner.
Classes:
Processes
Proc1 EquivalentTo: Processes and (fulfillRestriction exactly 1 Req1)
Requirements
Req1 Equivalent to Requirements and (hasTemperature exactly 1 (temperature only xsd:double[ "5.0"^^xsd:double , <= "150.0"^^xsd:double])
Models
Model1 EquivalentTo: Models and (hasRestriction exactly 1 Req1)
Now I have an object property:
ObjectProperty: testIsModelOf
SubPropertyChain: hasRestriction o inverse (fulfillRestriction)
I defined individuals:
Individual: mod1
Types: Model1
Facts: hasRestriction requir1
Individual: requir1
Types: Req1
Individual: process1
Types:
Proc1
Facts: fulfillRestriction requir1
Asking for (with DLQuery):
Models that testIsModelOf some Proc1
If I define individuals for those three classes and define object properties between them, the result is as expected (DLQuery says mod1 is an instance of Models that testIsModelOf some Proc1). I expected that I will also get the Model1 class as a Direct Subclass (or equivalent class?) of the query result, but it does not happen. Is this possible to get the class, not only individual - without SWRL?

How to find overlapping classes?

Full ontology:
Prefix: : <http://www.semanticweb.org/l.smolaga/ontologies/2018/0/untitled-ontology-14#>
Prefix: xsd: <http://www.w3.org/2001/XMLSchema#>
Ontology: <http://www.semanticweb.org/l.smolaga/ontologies/2018/0/untitled-ontology-14>
Datatype: xsd:int
DataProperty: hasAge
Characteristics:
Functional
Domain:
Person
Range:
xsd:int
Class: Person
Class: Student
EquivalentTo:
Person
and (hasAge some xsd:int[>= "18"^^xsd:int , <= "26"^^xsd:int])
Class: Teenager
EquivalentTo:
Person
and (hasAge some xsd:int[>= "11"^^xsd:int , <= "19"^^xsd:int])
I'm trying to find a way to check if two classes overlap.
For example let's consider we have an ontology with 3 classes (Person, Teenager and Student).
Teenager is equivalent to Person and hasAge some xsd:int[>= 11, <=19 ]
Student is equivalent to Person and hasAge some xsd:int[>= 18, <=26 ]
I want to check which class overlaps with Student. How I can do this using owlapi/jena ?
The easiest way will be to create an individual, say x, which is of type (Person and Student and Teenager). Invoke the reasoner and if your ontology is consistent, it means it is possible for an individual to belong to all classes. If the ontology is inconsistent, it means an individual cannot belong to all the classes simultaneously.
You should be able to do this in an ontology editor, or programmatically via the owl-api or jena.

NDB Datastore: Data Modeling for a Job website

What is the best way to model data for a job website which has the following elements:
Two types of user accounts: JobSeekers and Employers
Employers can create JobPost entities.
Each JobSeeker can create a Resume entity, and many JobApplication entities.
JobSeekers can create a JobApplication entity which is related to a JobPost entity.
A JobPost entity may receive many JobApplication entities.
A JobSeeker may only create one JobApplication entity per JobPost entity.
A Resume contains one or more instances of Education, Experience, using ndb.StructuredProperty(repeated = True).
Each Education contains the following ndb.StringProperty fields: institution, certification, area_of_study
While each Experience contains: workplace, job_title.
Here is a skeleton model that meets your requirements:
class Employer(ndb.Model):
user = ndb.UserProperty()
class JobPost(ndb.Model):
employer = ndb.KeyProperty(kind=Employer)
class JobSeeker(ndb.Model):
user = ndb.UserProperty()
def apply(self, job_post):
if JobApplication.query(JobApplication.job_seeker == self.key,
JobApplication.job_post == job_post).count(1) == 1:
raise Exception("Already applied for this position")
...
class Resume(ndb.Model):
job_seeker = ndb.KeyProperty(JobSeeker)
education = ndb.JsonProperty()
experience = ndb.JsonProperty()
class JobApplication(ndb.Model):
job_seeker = ndb.KeyProperty(JobSeeker)
job_post = ndb.KeyProperty(JobPost)
Notes:
Employer and JobSeeker have the built-in UserProperty to identify and allow them to login.
Resume uses JsonProperty for education and experience to allow for more fields in the future. You can assign a Python dictionary to this field, for example
resume.education = {'institution': 'name', 'certification': 'certificate', 'area_of_study': 'major', 'year_graduated': 2013, ...}
(I have personally found StructuredProperty to be more pain than gain, and I avoid it now.)
Limiting a JobSeeker to only one JobApplication can be done with the method apply() which checks the JobApplication table for existing applications.

Resources