Rodolfo; My suggestion was only to use TBC as a tool to check the
validity of your queries before going through the edit-compile-test
cycle.

In terms of adding constraints "dynamically" (not exactly sure what
dynamically means here), a constraint is a triple:
 <class> spin:constraint [query]

...where <class> is the class the constraint is defined on (meaning
the rule/constraint is applied to all members of that class), and
[query] is the bnode that contains the RDF representation of your
query.

Given that you can add a triple at any time, a constraint can be added
at any time.  Then re-run SPINConstraints.check() to get the results.

-- Scott

On Oct 7, 10:52 am, Rodolfo Rieckhof <rodo2...@googlemail.com> wrote:
> Hello,
> thanks for your answer Scott,   but is there any way to use SPIN without the
> TBD, and add the constraints with the api dynamically ?
>
> 2010/10/7 Scott Henninger <shennin...@topquadrant.com>
>
> >  Rodolfo; There may be a couple of SPIN principles that may be helpful to
> > you.  The first is that constraints, constructors and rules are defined for
> > a class and applied to its members.  The second is that ?this should be used
> > to state that the query is applied to individual members.  I.e. in the
> > following query:
> >  1) is defined as a spin:constraint property for bad:Device
> >  2) the triple pattern <?dev rdf:type bad:Device> is not necessary because
> > ?this is pre-bound to each member of bad:Device
>
> > CONSTRUCT {
> >     _:b0 a spin:ConstraintViolation .
> >     _:b0 spin:violationRoot ?this .
> >     _:b0 spin:violationPath bad:deviceIngressProtection .
> >     _:b0 rdfs:label "the value should be between 20 and 30" .
> > }
> > WHERE {
> >     ?this bad:deviceIngressProtection ?value .
> >     FILTER ((?value < 20) || (?value > 30)) .
> > }
>
> > In this case, I'm using Composer's constraint violation infrastructure to
> > show this, so I'm creating a ConstraintViolation instance and hanging it on
> > the bad:deviceIngressProtection property.
>
> > I'm attaching a model that demonstrates this.  You can try it out in TBC
> > Free/SE/ME.
>
> > -- Scott

-- 
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
topbraid-users@googlegroups.com
To unsubscribe from this group, send email to
topbraid-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/topbraid-users?hl=en

Reply via email to