Hi Scott,

That's what I was missing - I thought it was an evaluation order issue but
could not find a reference for that.

My real use case is more complicated in that I was trying to use the
OPTIONAL to control the execution of the BIND where the BIND is creating a
URI.  In this case the BIND requires a variable outside of the OPTIONAL.

I came up with a work around in that I can move the BIND outside the
OPTIONAL and add smf:if (BOUND(...)...  inside the BIND to see if the
OPTIONAL matched or not.

It's just not as clean as I was hoping...

Thanks for the help,

Tim



On Fri, Nov 30, 2012 at 4:14 PM, Scott Henninger <[email protected]
> wrote:

> Tim; Unfortunately, your query is not like the example you cite because
> BIND is interpreted outside of the basic graph pattern.
>
> Fortunately, in your case you can simply remove the OPTIONAL clause. BIND
> semantics are somewhat similar in that the assigned variable will be
> unbound if the expression fails.
>
> -- Scott
>
> On Nov 30, 2012, at 2:37 PM, Tim Smith <[email protected]> wrote:
>
> Hi,
>
> In the following query, why is ?lab not bound inside the OPTIONAL?
>
> SELECT *
> WHERE {
>       owl:Thing rdfs:label ?lab .
>     OPTIONAL{
>     BIND (smf:trim(?lab) as ?lab2).
>     BIND(smf:if(BOUND(?lab), true, false) as ?bound) . } .
> }
>
> The results of the query using TBC 3.6.1 are:
>
> ?lab = Thing
> ?lab2 = is unbound
> ?bound = false
>
> My query is similar to this example from the SPARQL reference page so I'm
> curious as to why it doesn't work:
>
> http://www.w3.org/TR/sparql11-query/#optionals
>
> PREFIX foaf: <http://xmlns.com/foaf/0.1/>
> SELECT ?name ?mbox
> WHERE  { ?x foaf:name  ?name .
>          OPTIONAL { ?x  foaf:mbox  ?mbox }
>        }
>
>
>
>
>  --
> -- 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 Ensemble, 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
> Group "TopBraid Suite Users", the topics of which include Enterprise
> Vocabulary Network (EVN), TopBraid Composer, TopBraid Live,
> TopBraid Ensemble, 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
Group "TopBraid Suite Users", the topics of which include Enterprise Vocabulary 
Network (EVN), TopBraid Composer, TopBraid Live,
TopBraid Ensemble, 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


Reply via email to