Alison,
The main reason of why the BINDs in your query return an empty result
set is that they are all trying to assign values to the same variable
?x. In a SPARQL query, you can assign a value to a variable only once.
So, instead of four BINDs, you might need one BIND with nested IFs or
four BINDs that assign values to different variables, and then another
BIND that would choose what to assign to ?x depending on those vales.
Here is how a BIND with nested IFs would look like in your case:
BIND (IF((?agent_type = <http://bio2rdf.org/chebi:36080>), 1,
IF((?agent_type = <http://bio2rdf.org/so:0000236>), -1, IF((?agent_type
= <http://bio2rdf.org/chebi:33697>), 1,
IF((:subClassAskQuery(?agent_type, <http://bio2rdf.org/chebi:24431>) =
true), 1, 0)))) AS ?x) .
Gokhan
On 6/1/2011 9:40 AM, Alison Callahan wrote:
Hello all,
I am using TopBraid Composer version 3.5.0 in Ubuntu 11.04. I am
trying to execute the following SPARQL query, but I have found that
when all four BIND operations are included, the query returns an empty
result set.
SELECT ?x
WHERE {
?arg1 ns:has_agent ?agent .
{
?agent rdfs:subClassOf ?agent_type .
}
UNION
{
?agent rdf:type ?agent_type .
} .
BIND (IF((?agent_type = <http://bio2rdf.org/chebi:36080>), 1, 0) AS
?x) . #bind number 1
BIND (IF((?agent_type = <http://bio2rdf.org/so:0000236>), -1, 0) AS
?x) . #bind number 2
BIND (IF((?agent_type = <http://bio2rdf.org/chebi:33697>), 1, 0) AS
?x) . #bind number 3
BIND (IF((:subClassAskQuery(?agent_type,
<http://bio2rdf.org/chebi:24431>) = true), 1, 0) AS ?x) . #bind number 4
}
:subClassAskQuery is the following:
ASK WHERE {
?arg1 (rdfs:subClassOf)* ?arg2 .
}
Strangely, when only bind operations #1 and #4 or bind operations #1-3
are included, the query returns results. The problem seems to be when
I combine bind operations #(2, 3 and 4) or (2 and 4) or (3 and 4) --
the result set is empty.
In other queries, I have used multiple bind operations with no problems.
Has anyone else experienced this? Any help is much appreciated!
Thanks,
Alison
--
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
[email protected]
For more options, visit this group at
http://groups.google.com/group/topbraid-users?hl=en