Erwachen; A definitive answer to this question, broadly stated, is
often difficult to do. But as I understand the question, OWL does not
perform the kind of constraint checking I believe you are looking for.
Let me start by explaining how OWL works w.r.t. "constraints". The
way OWL works is to define axioms that define a consistent model. If
a model does not meet the defined consistency criteria, facts
(triples) can be added to make it consistent. An example is that a
functional property can only have one value. In Turtle triples:
:hasBirthFather a owl:Functional Property .
:Mark :hasBirthFather :Edward .
:Mark :hasBirthFather :Ted .
A reasoner will infer ":Ted owl:sameAs :Edward" because only one value
is allowed for :hasBirthFather and the model can be made consistent to
the definition by assuming that :Ted and :Edward are the same thing.
If two facts are present, through inference or assertion, that are
inconsistent with the model's definitions, then an inconsistency is
flagged. So if we also assert:
:Edward owl:differentFrom :Ted
…then there can be no inferred triple that makes the model consistent,
and the only recourse is to flag an inconsistency on the
contradiction:
:Ted :sameAs :Edward
:Edward owl:differentFrom :Ted
So OWL doesn't do "constraint checking", just consistency checking per
its predicate-based FOL model. In this example, if you want to
instead flag a problem when more than one value for a functional
property is found, you simply can't do this in OWL. You can in SPIN
with the spin:constraint:
# A person can have only one birth father
ASK WHERE
{ ?this ?p ?o .
?p a owl:FunctionalProperty .
?this ?p ?o1 .
?this ?p ?o2 .
}
(there are many ways to do this query…)
-------
That as background, to get the kind of constraints I think you are
looking for, you'd have to design your model such that an
inconsistency arises when an instance doesn't have the properties
defined in the class restrictions. That's somewhere between difficult
and impossible to do.
For a more class-based example, let's say that you have a
class :USstate whose membership is defined by a owl:hasValue
restriction ":inCountry owl:hasValue :UnitedStatesOfAmerica". This
means that all members must have the following fact (triple):
?rsc :inCountry :UnitedStatesOfAmerica
If the triple does not exist, it will be inferred. So if you have the
following (which is most likely a data error):
:London a :USstate
…and no other triples, then the following will be inferred:
:London :inCountry :UnitedStatesOfAmerica
Nothing you can do about that in OWL. There isn't a way to flag
":London a :USstate" as a possible data error since OWL will want to
create a consistent model by adding the fact. In some cases it is
desirable, in this case it is not.
Using SPIN, you can define a constraint checking rule by adding a
spin:constraint rule on the class :USstate:
ASK
WHERE
{ NOT EXISTS {?this :inCountry :UnitedStatesOfAmerica}
}
In this case a constraint violation is flagged for ":London
a :USstate" because it lacks the :inCountry property. One can then
take corrective action on this (take a look at the spin:fix construct
for a way to automate fixing constraint violations). This kind of
example is very useful for data cleanup and sanitation. I recently
used similar rules to clean up the Geography model we now use to
demonstrate TopBraid EVN capabilities, which was pieced together from
various SPARQL endpoints, leaving us with some messy data that needed
validating.
SPIN can be used for general-purpose constraint checking, and OWL is
really not designed for consistency checking. So it's really an
apples vs. oranges comparison. On the other hand, SPIN can be used to
implement OWL, as can be seen in our OWL 2 RL profile included in the
TopBraid/SPIN/owlrl-all.rdf implementation.
That may be longer-winded or/and less informative and/or different
than you expected. It's a complex topic, and we'd be happy to
continue a dialog that further explains the issues involved, provide
other examples, etc.
BTW, this just looks at the issue of constraints, there are similar
issues for inference using SPIN vs. OWL. Others may want to chime in
with their favorite examples.
On Nov 30, 6:39 pm, erwachen hzz <[email protected]> wrote:
> Hello,
>
> Can someone give me examples of general cases where some constraints can be
> expressed using SPIN SPARQL and not with OWL/RDFS ?
>
> Best regards!
--
You received this message because you are subscribed to the Google
Group "TopBraid Suite Users", the topics of which include TopBraid Composer,
TopBraid Live, TopBraid Ensemble, SPARQLMotion and SPIN.
To post to this group, send email to
[email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/topbraid-users?hl=en