OWL axiom: Given an individual of a particular class, enforce an existence of an Object Property relation with another individual - owl

In OWL, is there a way to state that an individual of a particular class must be related to another individual via a specific object property?
For example, I would like to state that:
forall(x) Object(x) -> exists(y) Shape(y) ^ hasShape(x, y)
i.e., "For all objects, there exists a shape that is the shape of the object."
so that if there is an individual of the type Object that has no shape associated with it, a reasoner would find it to be inconsistent.
I tried an axiom:
Object SubClassOf hasShape min 1 Shape
but it's not working.
It seems like the issue is because Object Property in OWL has no identity, but is there a workaround for this issue?
(I'm using Protege 5.2.0)

You are correct that the meaning of Object SubClassOf hasShape min 1 Shape is that every individual of Object is associated with an individual of Shape via the hasShape property.
So if you create an individual x of type Object without x being associated with an individual of Shape, why does the reasoner not determine that your ontology is inconsistent? The reason for this is due to the open world assumption. Informally it means that the only inferences that the reasoner can make from an ontology is based on explicit information stated in the ontology or what can derived from explicit stated information.
When you state x is an Object, there is no explicit information in the ontology that states that x is not associated with an individual of Shape via the hasShape property. To make explicit that x is not is such a relation, you have to define x as follows:
Individual: x
Types:
Object,
hasShape max 0 owl:Thing
Btw, this problem has nothing to do with identity as you stated.

One solution I found was to make the ontology "closed world", by making owl:Thing equivalent to the set of all individuals defined so far.

Related

Using Same Object Property between Multiple Classes

I tried to use the same object property between multiple classes, but I got a warning that the same object property has been set multiple times as follows, can you please let me know what is wrong with that and how to solve it? Does this restrict reasoning later on (i.e. confuse the reasoner since the same object property is set multiple times)?
Thanks
Contrary to the comments it actually is very problematic to use the same object property between multiple classes.
What you don't see in your visualization is that in RDF/OWL, the starting point of your relation arrows is modelled as rdfs:domain and the target point of the arrows is modelled as rdfs:range.
The semantic of an OWL class is that it is a set of individuals and rdfs:domain and rdfs:range specify the domain, respectively range of a relation. That is, they specify the sets of allowed values in subject, respectively object position of a triple with that relation in the predicate position.
If you express your example in RDF Turtle it would look like this:
:hasPart rdfs:domain :ClassA, :ClassB;
rdfs:range :ClassB, :ClassC, :ClassD.
This causes multiple problems:
Intersection
The semantic of multiple domains, respectively ranges, is the intersection of those classes, not the union!
Even if we disregard the relation between :ClassB and :ClassD, this means :hasPart is only allowed by individuals that are instances of class C and class D at the same time!
For example, lets say class A is "car", class B is "tire" and class C is "motor". Now you want to say that a car can have tires and motors but what you actually specify is that a car can only have things that are a motor and a tire at the same time!
Unwanted but allowed usage
If you fix the first problem but specifying the union instead of the intersection, it will be very messy in serialized RDF because you need a large amount of triples to represent OWL restrictions such as unions. But even if you do that, you could now connect an instance of class A with an instance of class D, which is not allowed in the image.
Solution
The solution is simple, just separate those relations, for example into :hasB, :hasC and :hasD, although in a real scenario you can probably find a more suitable naming scheme, where the "has" prefix is often not used. For example, in DBpedia, the property for the country of a city is expressed using dbo:country, not dbo:hasCountry.

Why does FunctionalObjectProperty take an Object Property Expression, not a named property only?

The functional object property axiom - here in functional syntax - has the form
FunctionalObjectProperty(P)
P is an Object Property Expression, which is one of:
a named object property (PN). Example: FunctionalObjectProperty(:hasBase)
the owl:topObjectProperty
the owl:bottomObjectProperty
an inverse property. Example: FunctionalObjectProperty(ObjectInverseOf(:isBaseOf))
The first is expected. What's the use of the three other variants? These seem to only increase the complexity of parsers, reasoners and APIs. (Yes, marginally.)
The last looks redundant since OWL has an "InverseFunctionalObjectProperty". And who declares top- or bottomObjectProperty as functional ?
I searched through ontologies like geneontology.org. So far, they use nothing else than a named property (PN) as parameter.
Anyway, OWL allows P here, and I may miss the forest for the trees. What is it good for ?
Remark:The same can be asked for other unary property axioms like SymmetricObjectProperty.
See: https://www.w3.org/2007/OWL/refcard
This definition is used in OWL to define what the language syntax considers correct. However there can be some language constructs that are broadly used and other that are syntactically correct but have limited usage.
The definition of the FunctionalObjectProperty axiom allows one to state that an object property expression is functional — that is, that each individual can have at most one outgoing connection of the specified object property expression. 1
The syntax definition of FunctionalObjectProperty is:
Functional Object Properties:
FunctionalObjectProperty := 'FunctionalObjectProperty' '('
axiomAnnotations ObjectPropertyExpression ')'
This definition refers to the ObjectPropertyExpression which is defined as follows.
Object Property Expression definition
ObjectProperty := IRI
ObjectPropertyExpression := ObjectProperty | InverseObjectProperty
InverseObjectProperty := 'ObjectInverseOf' '(' ObjectProperty ')'
This basically mean that there are 2 ways to define an object property.
The first way is to directly define an IRI as an object property.
The second way is to indirectly define an object property as the inverse of an already defined object property.
The difference can be demonstrated in these examples:
Example A: FunctionalObjectProperty(:isGoodFor)
Example B: FunctionalObjectProperty(ObjectInverseOf(:isBaseOf))
The Example A uses an existing Object Property :isGoodFor while the Example B uses the inverse of the defined Object Property :isBaseOf without defining an IRI for it.
The syntax definition for ObjectPropertyExpression includes any Object Property IRI, since it does not exclude it. Therefore the TopObjectProperty and BottomObjectProperty are syntactically valid choices.
So the following are syntactically valid:
FunctionalObjectProperty(owl:topObjectProperty)
FunctionalObjectProperty(owl:bottomObjectProperty)
However owl:topObjectProperty and owl:bottomObjectProperty have predefined semantics in OWL2. So while the above statements are syntactically correct, it would not be a good practice to use them.
Definitions of TopObjectProperty and BottomObjectProperty
Owl defines 2 built-in object properties with the IRIs owl:topObjectProperty and owl:bottomObjectProperty. And have predefined semantics.
The object property with IRI owl:topObjectProperty connects all possible pairs of individuals.
The object property with IRI owl:bottomObjectProperty does not connect any pair of individuals.

similar syntax to represent xs:unique in OWL

Is it possible to express the meaning of xs:unique in OWL?
Say, I define a property hasID whose range is integer. 2 different individuals A and B could not have the same ID. So you don't have A hasID 1 and B hasID 1 at the same time.
That's an inverse functional property. In OWL, there are inverse functional object properties, such that if p is an inverse functional object property then p(A,C) and p(B,C) imply A = B.
From the specification:
9.2.8 Inverse-Functional Object Properties
An object property inverse functionality axiom
InverseFunctionalObjectProperty( OPE ) states that the object property
expression OPE is inverse-functional — that is, for each individual x,
there can be at most one individual y such that y is connected by OPE
with x. Each such axiom can be seen as a syntactic shortcut for the
following axiom:
SubClassOf( owl:Thing ObjectMaxCardinality( 1 ObjectInverseOf( OPE ) ) )
However, OWL doesn't have inverse functional datatype properties. This is the subject of What's the problem with inverse-functional datatype properties? on answers.semanticweb.com. (I'm providing a link to the WaybackMachine's archived version of that page, since the actual site seems to be down.)

In OWL 1; are min 1 Thing and some Thing equivalent?

In OWL 1; What is the difference between:
Parent subclassOf hasChildren min 1 Thing
and
Parent subclassOf hasChildren some Thing
Are they equivalent as both of them assert that each Parent instance must has at least one value from any class through hasChildren? as we don't specify a particular range for the someValuesFrom restriction?
In OWL 1; What is the difference between:
Parent subclassOf hasChildren min 1 Thing
and
Parent subclassOf hasChildren some Thing
OWL1 doesn't have qualified cardinality restrictions. You can't say
property min n Class
in OWL1. You can use unqualified cardinality restrictions (1), and qualified existential restrictions, like:
property min n
property some Class
In OWL 2, where you do have qualified cardinality restrictions, you have the ability to write
property min n Class
and you're absolutely right that the following are equivalent:
property min 1 Class
property some Class
and as a special case, the following are equivalent:
property min 1 owl:Thing
property some owl:Thing
The someValuesFromin OWL is equivalent to the existential quantifier in predicate logic:
In predicate logic, an existential quantification is a type of quantifier, a logical constant which is interpreted as "there exists," "there is at least one," or "for some." It expresses that a propositional function can be satisfied by at least one member of a domain of discourse. In other terms, it is the predication of a property or relation to at least one member of the domain. It asserts that a predicate within the scope of an existential quantifier is true of at least one value of a predicate variable.
Keeping this in mind, please refer to the definition of Restirction:
OWL Lite allows restrictions to be placed on how properties can be used by instances of a class.
And the definition of Cardinality:
OWL (and OWL Lite) cardinality restrictions are referred to as local restrictions, since they are stated on properties with respect to a particular class. That is, the restrictions constrain the cardinality of that property on instances of that class.
In OWL, someValuesFrom has been defined as:
The restriction someValuesFrom is stated on a property with respect to a class. A particular class may have a restriction on a property that at least one value for that property is of a certain type.
And minCardinality has been defined as:
If a minCardinality of 1 is stated on a property with respect to a class, then any instance of that class will be related to at least one individual by that property.
So, although logically they are the same, they represent different ideas.

Assigning a value to a property based on a SWRL rule (Protege 4.3 with Pellet as reasoner)

My question is related to SWRL rules and actually was already asked by another user (see Ontology property definition in Protégé-OWL / SWRL). Still, after following the instructions on how to get it to work, I was not successful.
In my ontology I have to work with some complex temporal facts (related to time intervals etc.), therefore I import the Time Ontology. Before tackling the real problem, I'm consider a simple example, testing how to assign a value to a data property based on a SWRL rule. The simple example deals with a class Person. There also is a class BirthYear (subclass of the Instant class from the Time Ontology). The object property bornInYear, with domain Person and range BirthYear relates a Person with the year of his/her birth. I would like to calculate the age of the person in the current year, therefore I formulate this SWRL rule:
Person(?p) ∧ bornInYear(?p, ?birthYear) ∧ subtract(?age, 2014, ?birthYear)
→ age(?p, ?age)
After creating an individual of class Person and asserting that his/her BirthYear has the value "1977", I would expect Pellet to calculate that this person's age is 37. This does not happen. Any idea why? Is the SWRL rule correct? (In order to know if the value 37 is asserted to the data property age, I look at the "Property assertions" view of the individual p. I also make sure, that in the reasoner preferences the check box 'Object Property Assertions" is checked.) My example ontology reads as follows:
Prefix(SWRLexample:=<http://www.semanticweb.org/ontologies/2014/1/SWRLexample#>)
Prefix(xsd:=<http://www.w3.org/2001/XMLSchema#>)
Prefix(swrlb:=<http://www.w3.org/2003/11/swrlb#>)
Prefix(owl:=<http://www.w3.org/2002/07/owl#>)
Prefix(:=<http://www.semanticweb.org/ontologies/2014/1/untitled-ontology-101#>)
Prefix(time:=<http://www.w3.org/2006/time#>)
Prefix(xml:=<http://www.w3.org/XML/1998/namespace>)
Prefix(rdf:=<http://www.w3.org/1999/02/22-rdf-syntax-ns#>)
Prefix(swrl:=<http://www.w3.org/2003/11/swrl#>)
Prefix(rdfs:=<http://www.w3.org/2000/01/rdf-schema#>)
Ontology(<http://www.semanticweb.org/ontologies/2014/1/SWRLexample>
Import(<http://www.w3.org/2006/time>)
Declaration(Class(SWRLexample:BirthYear))
SubClassOf(SWRLexample:BirthYear time:Instant)
Declaration(Class(SWRLexample:Person))
Declaration(ObjectProperty(SWRLexample:bornInYear))
ObjectPropertyDomain(SWRLexample:bornInYear SWRLexample:Person)
ObjectPropertyRange(SWRLexample:bornInYear SWRLexample:BirthYear)
Declaration(DataProperty(SWRLexample:age))
AnnotationAssertion(rdfs:comment SWRLexample:age "Age of a person in years")
DataPropertyDomain(SWRLexample:age SWRLexample:Person)
DataPropertyRange(SWRLexample:age xsd:int)
Declaration(NamedIndividual(SWRLexample:birthYear1))
ClassAssertion(SWRLexample:BirthYear SWRLexample:birthYear1)
DataPropertyAssertion(time:year SWRLexample:birthYear1 "1977"^^xsd:gYear)
Declaration(NamedIndividual(SWRLexample:p1))
ClassAssertion(SWRLexample:Person SWRLexample:p1)
ObjectPropertyAssertion(SWRLexample:bornInYear SWRLexample:p1 SWRLexample:birthYear1)
DLSafeRule(Body(ClassAtom(SWRLexample:Person Variable(<urn:swrl#p>)) ObjectPropertyAtom(SWRLexample:bornInYear Variable(<urn:swrl#p>) Variable(<urn:swrl#birthYear>)) BuiltInAtom(swrlb:subtract Variable(<urn:swrl#age>) "2014"^^xsd:integer Variable(<urn:swrl#birthYear>)))Head(DataPropertyAtom(SWRLexample:age Variable(<urn:swrl#p>) Variable(<urn:swrl#age>))))
)
There are a few problems (but I'm glad that that other answer was a useful starting point):
age is a data property, so you not only need to make sure that "the check box 'Object Property Assertions' is checked," but also 'Data Property Assertions', since it's a datatype assertion that you're looking for.
BornInYear is an object property, so ?birthYear in bornInYear(?p, ?birthYear) must be an individual. However, swrlb:subtract's arguments must be numeric literals. To use swrlb:subtract, you'll need to get the integer value of the year in the rule and perform the arithmetic on that. You should be able to do that without too much trouble, although I'm not sure if you'll still be able to use the value "1977"^^xsd:gYear. SWRL does define some functions working with dates and times, though (see 8.5. Built-Ins for Date, Time and Duration). Not all the reasoners support that, though (e.g., I don't think Pellet does). However, the value of the year property does need to be an xsd:gYear.
Here are the successive steps :
Go to metadata tab
Import temporal ontology, prefix it as temporal.
Go to SWRL tab
Write rule as follows :
Person(?x) ^ hasDOB(?x, ?dob) ^ temporal:duration(?age, "now", ?dob, temporal:Years) -> hasAge(?x, ?age)
where Person is a class
hasDOB,hasAge are object properties

Resources