Nikolaos; You may want to try this is a more recent version of TBC, such as 4.4.  I'm finding that both of your queries should get the desired result.

In terms of creating an ordering, there are a couple of choices.  The first is that the constraints will be executed in the order that they appear in Composer form - which is lexicographical order.  So you can add comments, such as "# step 1", "#step 2", etc.

The second alternative is to use rule sets.  You can do this by creating subproperties of spin:constraints.  Then create spin:nextRuleProperty relationships between them.  This sets an order between the spin:constraints subproperties.  Define the constraint rules in the subproperties that you define and the spin:nextRuleProperty will determine the order the rule sets are defined in.

Give those a try to see if it helps any... 

-- Scott

On 3/6/2014, 10:55 AM, Nikolaos Beredimas wrote:
So I've been playing around with TBC trial (v 4.1) to find out more about SPIN.

My problem came about when trying to create a constraint to validate that a given property's object is an xsd:string exactly 11 characters long

So I wrote this constraint:

# aString Length must be 11
ASK WHERE {
    ?this :aStringValue ?val1 .
    BIND (fn:string-length(?val1) AS ?aStringLength) .
    FILTER (?aStringLength != 11) .
}

Strangely, this constraint produces a warning only for strings with a length > 11, and fails to produce a warning for string length < 11.

After a lot of useless trial and error i had the epiphany of changing the constraint to the following (just by removing the variable assignment line):

# aString must be 11
ASK WHERE {
    ?this :aStringValue ?val1 .
    FILTER (fn:string-length(?val1) != 11) .
}

Now, this constraint works and produces warnings as expected (both for >11 and <11 lengths).

But why doesn't the first implementation work correctly?


PS. Any way to define a kind of priority for evaluation of different constraints??? Say for example I have one constraint that checks string length, and one that validates a string's checksum. How should I implement if I only want to attempt to validate the checksum only if the string length is valid?
--
-- You received this message because you are subscribed to the Google
Group "TopBraid Suite Users", the topics of which include Enterprise Vocabulary Network (EVN), TopBraid Composer, TopBraid Live, TopBraid Insight, SPARQLMotion, SPARQL Web Pages 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 Groups "TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

--
-- You received this message because you are subscribed to the Google
Group "TopBraid Suite Users", the topics of which include Enterprise Vocabulary Network (EVN), TopBraid Composer, TopBraid Live, TopBraid Insight, SPARQLMotion, SPARQL Web Pages 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 Groups "TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to