Catrina; The second query, using smf:buildURI() to create a resource,
should work.  A NPE will occur when executing tops:definesStatements
if the resource defined for ?baseURI does not exist in the model the
query is applied to.

Also, I note that your query is returning all triples for the graph,
but you are only interested in whether or not a triple is defined for
the graph.  In that case, it will be more efficient to use a triple
pattern.  For example, in most cases the owl:Ontology is defined for a
graph.  So you could use:

ASK
WHERE
{  LET (?baseURI := smf:buildURI("http://someGraphUri";)) .
   ?baseURI a owl:Ontology .
}

…and only one triple will need to be found to for ASK to be true.

-- Scott

On Oct 12, 8:23 am, Catrina <[email protected]>
wrote:
> Is it possible to use <urn:var:GRAPH_VAR> in an ASK query?  For
> example, I want to dynamically determine if a graph exists with
> something like the following where I previously set GRAPH_VAR.
> ASK WHERE {
>     GRAPH <urn:var:GRAPH_VAR> {
>     } .
>
> }
>
> I tried something like the following, but I get a NullPointerException
> if the graph does not exists.
> ASK WHERE {
>         LET (?baseURI := smf:buildURI("http://someGraphUri";)) .
>     ?baseURI tops:definesStatements (?subject ?predicate ?object) .
>
> }
>
> Thanks,
> Catrina

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