Is it possible to represent Sufficient Condition relation in OWL? - semantic-web

Related questions Necessary and sufficient conditions for inferring a property, Representing if-then sentence using OW
Base on my understanding of owl:equivelantClass and rdfs:subClassOf we can represent Necessary Condition and Necessary and Sufficient Condition using subClassOf relation (one directional subClassOf or bi-direction subClassOf which is equivalentClass).
If we want to represent condition N is Necessary Condition of S (IF S THEN N), we can model this in following:
S rdf:type owl:Class;
rdfs:subClassOf [
rdf:type rdf:Restriction;
owl:onProperty :N;
owl:hasValue :D
].
or just say:
S rdfs:subClassOf N.
If we want to represent condition N is Necessary and Sufficient Condition of S (N IIF S), we can model this in following:
N rdf:type owl:Class;
owl:equivalentClass [
rdf:type rdf:Restriction;
owl:onProperty :S;
owl:hasValue :D
].
or just say:
N owl:equivalentClass S.
My question is can we represent sufficient condition using OWL? I'm thinking maybe I can represent the Sufficient Condition by reverse the order of Restriction Class and A.
Edit
According to the definition of Necessary and Sufficient condition, the assertion of N is Necessary for S is equivalent to S is Sufficient to N, we can understand this as N is super-set of S or S is subset of N.
Base on the accepted answer, we can model this relationship as S rdfs:subClassOf N or define a superClassOf property:
:superClassOf owl:inverseOf rdfs:subClassOf
and assert N :superClassOf S.
Conclusion
So the answer is yes, we can represent Sufficient condition by reverse the order (define a inverse property of rdfs:subClassOf) of Necessary condition.

Conditions, of course, refers to "conditions on an individual for class membership", and are expressed in terms of defining ever-smaller (more restricted) subclasses of the overall "class of all things".
In that context, a sufficient condition is simply the inverse of a necessary condition. So in effect, every time you specify a necessary condition, you also specify a sufficient condition.
Let's spell that out.
A necessary condition on a class X is the following: "IF the individual i is an instance of the class X, THEN the condition must be true". subClassOf(X, Y) means that IF an i is of class X, THEN it must also be of class Y, so in other words if we want to say that i is in X, it's necessary that it is also in Y. But it's not sufficient for i to be in Y to conclude that it is in X.
A necessary and sufficient condition on class X is a condition where in addition it also holds that "IF the condition is true, THEN the individual must be an instance of the class". In other words "if i is in class Y, this is sufficient evidence that it is also in X". This is the equivalence relation, which specifies that the sets of individuals of two classes are exactly the same (so if i is in Y, it must be also in X, vice versa).
A condition on X that is only sufficient, but not necessary, would mean that you have some relation R(X,Y) for which it holds that IF an indivual is in Y, it is also in X, but not necessarily that IF it is in X, THEN it is also in Y. This is the superclass relation, in other words the inverse of the subclass relation.
So when you say subClassOf(X, Y) you have not only defined a necessary condition for X, but effectively also a sufficient condition for Y. After all, if we know an individual i is an instance of X, then that is sufficient to conclude it's also an instance of Y. But it's not necessary for i to be an instance of X to also be an instance of Y: there can be instances of Y that are not in X.
In OWL there is no explicit separate owl:superClassOf relation. However if you really wanted to express it in those terms, you could conceivably introduce a superClass relation yourself, simply be defining it as the owl:inverseOf the subClassOf relation.

Related

How to remove unsafety in a conditional Clingo rule?

I would like to define the set of nodes in a directed graph reachable from all nodes in a given set of start nodes in Clingo. To my understanding, this can be done via conditions in a rule body: in a rule
p(X) :- q(X) : r(X).
a conjunction of rules q(a) is dynamically generated in the body of p/1 for grounded facts a, for which the rule r(a) also holds. Now for some reason, the following set of rules results in an "unsafe" variable X being discovered on the last line:
% Test case
arc(1,4). arc(2,4). arc(3,5). arc(4,1). arc(4,2). arc(4,3).
start(1). start(4). start(5).
% Define a path inductively, with the base case being path of length 1:
path(A, B) :- arc(A, B).
path(A, B) :- arc(A, X), arc(X, B).
path(A, B) :- arc(A, X), path(X, Y), arc(Y, B).
% A node X is simply reachable/1, if there is a possibly empty path to it
% from a start node or reachable/2 from A, if there is a path to it from A:
reachable(X) :- start(X).
reachable(X) :- start(A), path(A, X).
reachable(X, A) :- path(A, X).
% Predicate all_reach defined by the reachable relation:
all_reach(X) :- reachable(X, A) : start(A).
I wanted to ask, what is meant by an "unsafe" variable, and how might I amend this situation? One source claims that an unsafe variable is a variable, which appears in the head of a rule but not in the body, which makes sense as the symbols :- denote a reverse implication. However, this does not seem to be the case here, so I'm confused.
Could it be that there might not be a grounded fact a for which start(a) holds, and hence the body of the implication or rule becomes empty, causing the unsafety. Is that it? Is there a standard way of avoiding this?
The issue was that there wasn't a positive rule in the body of all_reach/1 that was satisfied for at least some grounded instance of X. Adding the lines
% Project nodes from arcs
node(X) :- arc(X,Y).
node(Y) :- arc(X,Y).
and reformulating the all_reach/1 rule as
all_reach(X) :- reachable(X, A) : start(A); node(X).
solved the issue. The desired conjunction
∧[i=1 → ∞] reachable(d, s[i])
for all start nodes s[i] and destination nodes d is then generated as the
body of allreach/1.
In other words, when using conditionals in the body b/m of a rule r/n,
there must still be a predicate p in b that is unconditionally grounded
for any variables present in the head of the rule. Otherwise we might end up
with an ambiguity or an ever-expanding rule during grounding, which is unsafe.

How to make a indirect relation between two or more instances in Protégé

First of all, my English is poor, so sorry if my writing is confusing.
I'm trying to create the following relationship between instances: if A propertyX B, and C propertyY A, then C propertyX B. In my case, I want to specify that if a ManagerA "manages" an employee, and ManagerB has the same job as ManagerA, then he also manages the same employee.
I tried to use chain properties to do that, but the reasoner (FaCT ++ 1.6.5) doesn't work when I activate it (the log says a non-simple property is being used as one). I think the problem is in the fact that the property "manages" is asymmetric and irreflexive and the property "sameJob" is transitive and symmetric, but I'm not sure if that's the case. I applied the chain property in the "manages" property, stating: sameJob o manages SubPropertyOf: manages.
I'm just starting with Protégé and will appreciate any help a lot.
The reason for the error is due to manages not being a simple role, i.e. if you have r1 o ... o rn subPropertyOf r where n>1 then r is a non-simple role. Non-simple roles cannot be used in IrreflexiveObjectProperty and AsymmetricObjectProperty. See section 11 of OWL 2 syntax. The reason for the constraint on roles is to maintain decidability.
However, you can achieve the desired result by adding a SWRL rule:
manages(?x, ?y) ^ sameJob(?x, ?z) -> manages(?z, ?y).

Adding qualifier to objectProperty in OWL

I want to express the following in an OWL ontology in Protege: IndividualA is composed of IndividualB1 at X %, IndividualB2 at Y % and so on, up until 100%.
Does a pattern exists to model this?
I want to express the following in an OWL ontology in Protege:
IndividualA is composed of IndividualB1 at X %, IndividualB2 at Y %
and so on, up until 100%.
Does a pattern exists to model this?
I don't think you'll be able to get the guarantee/restriction on sums that you're looking for in OWL. But part of the structure that you're talking about is just an n-ary relationship. Instead of a two place relationship
isComposedOf(IndividualA, IndividualB1)
you have a three place relationship:
isComposedOfByPercent(IndividualA, IndividualB1, 0.34)
There are lots of ways to represent n-ary relationships using semantic technologies, so many so that the W3C published a working note, Defining N-ary Relations on the Semantic Web. In OWL, one of the most common approaches might be:
x a Composition ;
hasComposite IndividualA ;
hasComponent IndividualB1 ;
hasPercentage 0.34 .
Another might be:
IndividualA hasCompositePart y .
y a CompositePart ;
hasComponent IndividualB1 ;
hasPercentage 0.34 .

Is property with exact cardinality one functional?

In an OWL-DL ontology, consider a property p with domain D and range R where D has a restriction over p to have cardinality of exactly one:
D SubClassOf p exactly 1 Thing
(D ⊑ =1 p.Thing)
Can we then infer that p is a functional property, since each d of type D will have exactly one value for p? If this is correct, can a reasoner infer this knowledge?
In OWL, a property is function when each individual has at most one value for the property. That "at most" is important; it is permitted for something to have no value for the property. (That means that a functional property in OWL is actually more like a possibly partial function in mathematics.) That said, if every individual has a exactly one value for a property, then it clearly has at most one value for the property, so the property would, as you suspect, be functional. We can walk though a specific case, though, to be sure that this is general, and because we need to make sure that the property p here actually has at most one value for every individual.
Proof: Suppose the property p has domain D, and D is a subclass of =1 p.Thing, so that every D has exactly one p
value. Is it the case that every individual x has at most one value
for p? There are two cases to consider:
x is a D. Then by the subclass axiom with the restriction, x must have exactly one value for p, and one is less than or equal to
one.
x is not a D. Then x has no values for p. If it did, then it would be in the domain of p, which is D, and that is a
contradiction. Then x has zero values for p, and zero is less
than or equal to one.
Then any individual x at most one value for the property p, which
is the definition of p being functional. Thus, p is functional.
QED
An OWL DL reasoner should be able to confirm this, and it shouldn't be hard to check.

Check if variable is empty or filled

I have the following problem:
prolog prog:
man(thomas, 2010).
man(leon, 2011).
man(thomas, 2012).
man(Man) :- once(man(Man, _).
problem:
?- man(thomas).
true ; %i want only on true even if there are more "thomas" *working because of once()*
?- man(X).
X = thomas ; %i want all man to be listed *isn't working*
goal:
?- man(thomas).
true ;
?- man(X).
X = thomas ;
X = leon ;
X = thomas ;
I do unterstand why this happens, but still want to get the names of all man.
So my solution woud be to look if "Man" is initialized, if yes than "once.." else then... something like that:
man(Man) :- (->check<-,once(man(Man, _)); man(Man, _).
On "check" shoud be the code sniped that checks if the variable "Man" is filled.
Is this possible?
One way to achieve this is as follows:
man(X) :-
(nonvar(X), man(X, _)), !
;
man(X, _).
Or, more preferred, would be:
man(X) :-
( var(X)
-> man(X, _)
; once(man(X, _))
).
The cut will ensure only one solution (at most) to an instantiated X, whereas the non-instantiated case will run its course. Note that, with the cut, you don't need once/1. The reason once/1 doesn't work as expected without the cut is that backtracking will still come back and take the "or" condition and succeed there as well.
man(X) :-
setof(t,Y^man(X,Y),_).
Additionally to what you are asking this removes redundant answers/solutions.
The built-in setof/3 describes in its last argument the sorted list of solutions found in the first argument. And that for each different instantiation of the free variables of the goal.
Free variables are those which neither occur in the first argument nor as an existential variable – the term on the left of (^)/2.
In our case this means that the last argument will always be [t] which is uninteresting. Therefore the _.
Two variables occurring in the goal are X and Y. Or, to be more precise the variables contained in X and Y. Y is an existential variable.
The only free variable is X. So all solutions for X are enumerated without redundancies. Note that you cannot depend on the precise order which happens to be sorted in this concrete case in many implementations.