I want to use OWL (in Protege) to encode the ternary relation ancestorOf(x, y, p); saying that y is the ancestor of x with probability p. Because object properties only support binary relations, my relation has to be represented as a Relation class and a relation individual, with relations to x, y and p (like in this design pattern).
I really do not know how to write an SWRL rule to infer a transitive relation. I.e. that
ancestorOf(x, y, p1) ^ ancestorOf(y, z, p2) -> ancestorOf(x, z, p1 * p2)
I would be thankful is somebody could point me in the correct direction.
Thanks in advance!
The first thing to do is to ensure your ontology is correctly designed for the task. As you rightly pointed out you will need reification to achieve this. This means you will need to introduce a class for representing your n-ary relation, i.e.:
The related ontology with rules and some individuals to test with will look as follows:
ObjectProperty: ancestor
Domain: AncestorProbability
Range: Person
ObjectProperty: descendant
Domain: AncestorProbability
Range: Person
DataProperty: probability
Domain: AncestorProbability
Range: xsd:decimal
Class: AncestorProbability
Class: Person
Individual: _a1
Types:
AncestorProbability
Facts:
ancestor _y,
descendant _x,
probability 0.2
Individual: _a2
Types:
AncestorProbability
Facts:
ancestor _z,
descendant _y,
probability 0.31
Individual: _a3
Types:
AncestorProbability
Facts:
descendant _x
Individual: _x
Types: Person
Individual: _y
Types: Person
Individual: _z
Types: Person
DifferentIndividuals:
_a1,_a2,_a3
DifferentIndividuals:
_x,_y,_z
Rule:
ancestor(?a1, ?y), descendant(?a1, ?x), probability(?a1, ?p1),
ancestor(?a2, ?z), descendant(?a2, ?y), probability(?a2, ?p2),
descendant(?a3, ?x), swrlm:eval(?p3, "p1 * p2", ?p1, ?p2)
-> ancestor(?a3, ?z), probability(?a3, ?p3)
One important thing to note is that since there is no ancestorOf(x, y, p) property and you have to use reification, you have to specify your rule component-wise, where ancestor, descendant and probability are properties representing components of your AncestorProbability n-ary relation.
Another important thing to note is that descendant(?a3, ?x) must be added to indicate on which AncestorProbability individual the rule must be applied for which descendant.
One possible problem is that the reasoner you use may not support swrlm:eval(?p3, "p1 * p2", ?p1, ?p2), which is the problem I found when testing this with Protege and the HermiT reasoner. It is possible that some commercial reasoner does support this.
Related
Suppose we have a class named A, and a DataProperty called hasRestriction. What is the difference between these statements:
A SubClassOf (hasRestriction value 2)
A SubClassOf (hasRestriction exactly 2)
A SubClassOf (hasRestriction only 2)
TL;DR: read AKSW's comments, they are good and concise.
Long version:
Your question is asking how to interpret class expressions in Protégé. Protégé uses the OWL 2 Manchester syntax to describe classes, and Protégé assumes that ontologies are interpreted according to the OWL 2 Direct Semantics. If the property hasRestriction is a DataProperty in Protégé, then it means that hasRestriction denotes a set of pairs (x,y) where x is an individual (an element of the universe of discourse) and y is a data value (like a number, a string, a date). In Protégé, class expressions are used to denote sets of individuals.
In the statements you provide there are three class expressions:
hasRestriction value 2
hasRestriction exactly 2
hasRestriction only 2
The first one, hasRestriction value 2, identifies the set of things that have the property hasRestriction with the value 2. So if x belongs to this class, then (x, 2) belongs to what hasRestriction denotes. If A is a subClass of this class, then a triple x rdf:type A entails the triple x hasRestriction 2.
The second one, hasRestriction exactly 2, identifies the set of things that have exactly 2 values for the property hasRestriction. So if x belongs to this class, then there are two distinct values v and w such that (x, v) and (x,w) belong to what hasRestriction denotes. If A is a subClass of this class, then a triple x rdf:type A entails the triples x hasRestriction _:v and x hasRestriction _:w and _:v owl:differentFrom _:w (I use a quasi-Turtle syntax here).
The third one, hasRestriction only 2 is a syntax error because if hasRestriction is a datatype property, then you must use a datatype expression after the keyword only. For instance, hasRestriction only xsd:integer.
In the second case, a given individual x in class A may have known values for the property hasRestriction. For instance, there could be the triples x rdf:type A, x hasRestriction 1, x hasRestriction 2, in which case, we know that x exactly has 1 and 2 as values for hasRestriction. If, additionally, we know that x hasRestriction 3, then there is a contradiction, because 1, 2 and 3 are three distinct values, while the expression tells us that there must be exactly two.
I know that there is a way to decompose a ternary relation into binary relations [1]. However, is there a way to either:
decompose any n-ary relation into m-ary relations for m < n,
Or
check whether a n-ary relation is in principle decomposable in terms of relations of smaller arity?
I suppose that the answer here is negative. But even if so, how can I justify it ? Can you point me towards some examples ?
Refrences :
[1] Song, I. Y., & Jones, T. H. (1995, March). Ternary relationship decomposition strategies based on binary imposition rules. In Proceedings of the Eleventh International Conference on Data Engineering (pp. 485-492). IEEE.
I have to determine the functional dependencies for the below ER:
As shown It's a one-to-many relationship. Depending on the functional dependency definition:
"X->Y means, each possible value of X can correspond to exactly one
value of Y"
, I can write:
A -> B
P -> Q,R
But I'm not sure how should the FD should be written for Ent1 and Ent1 with the relation. If I write A -> X,Pis it correct?. Can someone explain?
Thank you.
In any relationship, the combination of entity sets in many-roles determine the other entity sets and attributes in the relationship.
In your example, Ent2 (represented by P) determines Ent1 (represented by A) as well as X.
So, you would write P -> A,X.
Can Any one explain the difference between using "d" and "o" notations in Generalization & Specialization of ER diagrams. Whether the both notation gives the same meaning or different meanings.
An o is for overlapping, meaning an entity type can belong to more than one subtype. In your example, an Assignment can involve a Grade and/or a Lab_Session.
A d is for disjoint, meaning an entity type can't belong to more than one subtype. In your example, a Lecture can be only one of Enhancement, SpecialDegree or GeneralDegree lectures.
I have:
U-> PT….. 1
Q-> SU……2
etc...
in using the reflexivity axiom can I then say
Q-> S , Q-> U
Q-> PT
I trying to ask how this axiom works using the example above.
To derive
Q->S
Q->U
from
Q->SU
I'd use the decomposition rule, not the reflexivity axiom. Then I'd apply the transitivity axiom to Q->U, U->PT to derive Q->PT.
If you're asking what the reflexivity axiom means, it means
If Y is a subset of X, then X->Y.
In your example, it looks like you might be trying to say that
SU is a subset of Q, therefore Q->S and Q->U.
But it's not given that SU is a subset of Q. To make sure you get this point, Q->SU doesn't mean SU is a subset of Q.
For example, if you're in the military, your last name and blood type (among other things) are functionally dependent on your service number. Let's let the service number attribute be represented by "S", last name by "L", and blood type by "B". Then
S->LB
But neither "last name" nor "blood type" are subsets of "service number".
On the other hand, let's imagine that you're given this to start with.
U->PT
Q->SU
Q = {SUV} (New information!)
Since Q={SUV}, {S} is a subset of {SUV}, and {U} is a subset of {SUV}, then you can apply the reflexivity axiom to derive
Q->S (or SUV->S)
Q->U (or SUV->U)
But that axiom only applies in this example because you're given Q={SUV}.