On 7/15/11 3:30 PM, Leonard Jacuzzo wrote:
> Scott,
> Thanks this is great. What I meant was, I want to apply my understanding of 
> OWL Semantics using SPIN...Not the model that is machine interpretable...I 
> basically want OWL inferencing but faster and in a more choice driven manner 
> so I want to capture OWL semantics with SPIN rules.
>

Yes, the OWL 2 RL is designed specifically for scalable reasoning.  In
addition, the SPARQL implementation of OWL2RL in Composer/TopBraid
Suite has the flexibility you desire, as rules can chosen as desired.
All rules are defined as templates as defined in TopBraid/SPIN/
owlrl.spin.rdf.  There are two ways to customize these rules:

1. Start with an empty SPIN model (New > RDF/OWL SPIN File).  Open
OWL:Thing (if you want to apply inferences to all classes in the
model) and choose "Create from SPIN Template" from the spin:rule
context menu.  This template wizard will display a list of templates
that include all of the owlrl rules.  Choose the rules you want to
apply to the model.  You need to do this for each rule, so if you want
most of the rules, use method 2.

2. Copy TopBraid/SPIN/owlrl-all.rdf to some project in your
workspace.  Open it, modify its base URI, and save ( a very important
step).  Open owl:Thing.  A list of all rules will appear in the
rules.  By default only the 50 properties are shown on the form (the
spin:rule property will say "(incomplete)"), but you can change this
through the preferences (Preferences > TopBraid Composer, change the
value of 'Max number of values on forms').

I'd start by removing some of the computationally useless rules, such
as eq-ref (no pragmatic rule system can start with a guarantee that
the number of triples are tripled - this rule is simply senseless) and
scm-cls (although you may want to introduce a rule that ensures that
an owl:Class definition is a subClassOf owl:Thing).

In either case, when finished import the rule file to your model and
set the inference engine to TopSPIN.  If you had previously set the
Profile to OWL2RL, undo that so you just run your rule sub-set.

Not sure why TopSPIN would hang on a OWL2RL rule.  If it's the case,
we'd like to hear more about this, including what actions you took,
what behavior you observed, and any errors and warnings in the log
that may be clues.  Of course the version number and OS is always key
to help us help you.


On Jul 15, 3:46 pm, Leonard Jacuzzo <[email protected]> wrote:
> Hi Scott,
> cls-svf1 is not what I am after.
>
> Compare
>
> # cls-svf1
> CONSTRUCT {
>     ?u a ?x .}
>
> WHERE {
>     ?x owl:someValuesFrom ?y .
>     ?x owl:onProperty ?p .
>     ?u ?p ?v .
>     ?v a ?y .
>
> }
> To what I wrote:
> > CONSTRUCT {?this rdfs:subClassOf ?restriction .
> >     ?restriction rdf:type owl:Restriction .
> >     ?restriction owl:onProperty :isPartOf .
> >     ?restriction owl:someValuesFrom ?Var . }
>
> > WHERE {
>
> >     ?var rdfs:subClassOf ?restriction1 .
> >     ?restriction1 rdf:type owl:Restriction .
> >     ?restriction1 owl:onProperty :hasPart .
> >     ?restriction1 owl:someValuesFrom ?this .
> > }
>
> What I want to do is to create a restriction on one property from a
> restriction on another. In this case I started with 'haspart' being
> restricted to WHEEL and end up with isPart being restricted to auto. Where
> Wheel is a subclass of the latter restriction and Auto is a subclass of the
> former restriction.
>
> Maybe I can explain it better with some thought.
>
> Thanks again, I am having fun.
> LFJ
> On Fri, Jul 15, 2011 at 4:23 PM, Scott Henninger <[email protected]
>
> > wrote:
> >  See comments inline:
>
> > > Hi Scott,
> > > Thanks for this. It did not work for me. How is your inferencing
> > configured?
>
> > I have TopSPIN configured for inferencing.  What didn't work?  The
> > queries do use some SPARQL 1.1 features that may not be in earlier
> > versions of TBC.  Upgrading to 3.5.x will work, as will replacing IF
> > with smf:if and COALESCE with smf:firstBound.
>
> > > Also, your rule seems to be constructing a restriction. How does the
> > inferencing work such that an individual is classified as a teenager? Does
> > the reasoner construct the restriction and then determine that Since the
> > individual is a person, and a member of the restriction class, and teenager
> > is the intersection of Person and The Restriction, the individul is
> > therefore a teenager?
>
> > A restriction creates an unnamed node (bnode) that represents a
> > class.  In the case of an equivalentClass restriction on a class, the
> > restriction is an equivalentClass meaning that all members of the
> > restriction are also members of the class.  E.g. suppose we have:
> >  :Teenager a owl:Class .
> >  <restr> owl:equivalentClass :Teenager
>
> > The restriction, such as "Person and (hasAge only xsd:integer[>= 13 ,
> > <= 19])" is applied to the class defined by the restriction.  Since it
> > is an equivalent class with :Teenager, then all members of the
> > restriction are members of :Teenager, and vice-versa.
>
> > > I am trying to get a handle on how SPIN works to perform inferences based
> > on OWL semantics. Maybe a more general rule would be better.
>
> > On its own, it doesn't.  SPIN is a different way to accomplish
> > inferences.  It is based on SPARQL, and as such has no inherent
> > interactions with OWL (it is rdf-based).  However, one of the OWL 2
> > profiles, OWL 2 RL, is defined such that a triple-based rule engine
> > can implement it directly.  SPARQL, using CONSTRUCT, is one such
> > engine.  When you choose OWL2 RL in the Ontology Home Profile, a set
> > of rules implementing OWL 2RL profile are applied when you run
> > inferences.
>
> > In effect, this imports TopBraid/SPIN/owlrl-all.rdf.  For a listing of
> > these rules, seehttp://topbraid.org/spin/owlrl-all.html.  Compare
> > these to the standard,
> >http://www.w3.org/TR/owl2-profiles/#Reasoning_in_OWL_2_RL_and_RDF_Gra...
> > ,
> > and you'll see this is a direct implementation the profile.
>
> > So, as a simpler example, see the cas-sco rule:
>
> > CONSTRUCT { ?x a ?c2 .}
> > WHERE {
> >    ?c1 rdfs:subClassOf ?c2 .
> >    ?x a ?c1 .
> > }
>
> > This is the classic subclassOf inference.  If ?x is a member of ?c1
> > and ?c1 is a subClassOf ?c2, then ?x is a member of ?c2.
>
> > > So instead of classifying an individual, I tried to do some class level
> > reasoning. For example, If I have a class such as Automobile and it is
> > defined as a subclass of the restriction on 'Haspart' to some value wheel,
> > how would a rule that resulted in "wheel isPartOF some Automobile.
>
> > > So I want to go from
>
> > >  Auto :subClassOf {hasPart some Wheel}
>
> > > To
>
> > > Wheel :subClassOf {isPartOf some Automobile}
>
> > someValuesOf restrictions on someValesOf are already included in OWL 2
> > RL, so you don't need to re-implement them.  See cls-svf1 and cls-
> > svf2.
>
> > -- Scott
>
> > > My attempt was the following, but I could not get it to work when
> > attached to thing, or even the class that I created to test it. Does one use
> > '?this' to refer to a class?  Maybe if I understand this easy one, It will
> > help with the more difficult rules.
>
> > > CONSTRUCT {?this rdfs:subClassOf ?restriction .
> > >     ?restriction rdf:type owl:Restriction .
> > >     ?restriction owl:onProperty :isPartOf .
> > >     ?restriction owl:someValuesFrom ?Var . }
>
> > > WHERE {
>
> > >     ?var rdfs:subClassOf ?restriction1 .
> > >     ?restriction1 rdf:type owl:Restriction .
> > >     ?restriction1 owl:onProperty :hasPart .
> > >     ?restriction1 owl:someValuesFrom ?this .
> > > }
>
> > > On Thu, Jul 14, 2011 at 2:03 PM, Scott Henninger <
> > [email protected]> wrote:
>
> > >     Leonard; Attached is an example SPIN rule that is generalized to
> > address all datarange restrictions - one or two data range values and all
> > four datarange restrictions.  There are some test cases included so you can
> > run inferences and experiment with this.  This is just a draft, so see how
> > it works for you.
>
> > >     The main part of the example is the rule on the :Person class:
>
> > >     CONSTRUCT {
> > >         ?this a ?restriction .
> > >     }
> > >     WHERE {
> > >         ?datatype owl:onDatatype xsd:integer .
> > >         ?datatype owl:withRestrictions ?restrList .
> > >         ?datatype a rdfs:Datatype .
> > >         ?restriction ?restrType ?datatype .
>
> > >         ?restriction a owl:Restriction .
> > >         ?restriction owl:onProperty ?datatypeproperty .
> > >         ?this ?datatypeproperty ?val .
> > >         ?restrList rdf:rest ?restrListRest .
> > >         BIND (IF((?restrListRest = rdf:nil), :singleDataRange(?val,
> > ?restrList), :doubleDataRange(?val, ?restrList)) AS ?boolResult) .
> > >         FILTER (?boolResult) .
> > >     }
>
> > >     The {?restrList rdf:rest ?restrListRest .} gets the restriction list.
> >  If ?restrListRest = rdf:nil, then there is only one data range to consider.
> >  Otherwise there are two.  The BIND statement uses this fact to call
> > functions that compute whether the range restriction is met. You can find
> > the definitions for these functions by doing a ctl-click in the spin:rule
> > for :Person.
>
> > >     The datarange definitions for three classes are included to test this
> > out.  The instances of :Person will be classified by rules (the two values
> > for :Scott are both lies ;-) but it classifies correctly)
>
> > >     :Child owl:equivalentClass "Person and (hasAge only xsd:integer[<=
> > 12])"
> > >     :Teenager owl:equivalentClass "Person and (hasAge only xsd:integer[>=
> > 13 , <= 19])"
> > >     :Adult owl:equivalentClass "Person and (hasAge only xsd:integer[>
> > 19])"
>
> > >     -- Scott
>
> > >     On 7/13/11 9:09 AM, Leonard Jacuzzo wrote:
> > >>     Hello Topquadrant folks.
>
> > >>     I have been pulling my hair out in an attempt to construct a SPIN
> > rule that is general enough to classify an instance for any datarange
> > restriction using maxInclusive and MinInclusive.
>
> > >>     Going back to the running example. I have defined teenager as being
> > equivalent to the intersection of (Person, and hasAge only mininclusive 13,
> > and hasAge only maxinclusive 19).
>
> > >>     I would like to have a person classified as being a teenager...But I
> > would like to have a general rule to do any classification of this nature
> > and attach it to Thing. Below is what I have come up with so far.
> > >>     TBC rejects it based on syntax. Can anyone spot the problem(s)? I
> > feel like I am chasing my tail.
>
> > >>     Here is what I have so far.
>
> > >>     CONSTRUCT {?this a ?P}
>
> > >>     WHERE {?this a ?B.
>
> > >>      ?P rdfs:subclassOf ?B.
>
> > >>      ?P owl:equivalentClass ?A.
> > >>      ?A owl:intersectionOf ?B, ?restriction, ?restriction2
> > >>      ?datatype owl:onDatatype xsd:float .
> > >>      ?datatype owl:withRestrictions ?var .
> > >>      ?datatype a rdfs:Datatype .
> > >>      ?restriction owl:allValuesFrom ?datatype .
> > >>      ?restriction a owl:Restriction .
> > >>      ?restriction owl:onProperty ?datatypeproperty .
> > >>      ?var rdf:first ?var1 .
> > >>      ?var1 xsd:minInclusive ?mval .
> > >>      ?x2 ?datatypeproperty ?val .
> > >>      ?datatype2 owl:onDatatype xsd:float .
> > >>      ?datatype2 owl:withRestrictions ?var .
> > >>      ?datatype2 a rdfs:Datatype .
> > >>      ?restriction2 owl:allValuesFrom ?datatype .
> > >>      ?restriction2 a owl:Restriction .
> > >>      ?restriction2 owl:onProperty ?datatypeproperty .
> > >>      ?var2 rdf:rest ?var3 .
> > >>      ?var3 xsd:maxInclusive ?maval .
> > >>      ?x2 ?datatypeproperty ?val2 .
> > >>     FILTER (?val >= ?mval) .
> > >>     FILTER (?val2 <= ?maval). }
> > >>     --
> > >>     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
> > >     --
> > >     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
>
> ...
>
> read more »

-- 
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

Reply via email to