title: Binding a variable to one of two values with IF?
body: <p>In the following SPARQL query, I'm not sure how to use <code>if</code> to bind one of two strings to the variable <code>?result</code>. I heard that there are concepts of “in scope” and “out of scope,” but I don't really see the difference.  I've also tried putting the <code>if</code> clause in the <code>select</code> line, but it didn't work either.  How can I fix this query to bind <code>?result</code> to one of the two strings based on the condition?</p>
  
  <pre><code>SELECT ?result
  WHERE{
      ?chain rdf:type rdfs:Property .
      ?chain rdfs:domain &lt;http://www.vs.cs.hs-rm.de/ontostor/SVC#MDiskGroup&gt; .
      ?chain rdfs:range &lt;http://www.vs.cs.hs-rm.de/ontostor/SVC#IOgroup&gt; .
      ?this ?chain ?arg .
      ?arg io:id ?var .
      IF(?var = "0"^^xsd:integer,
         BIND("    *"^^xsd:string AS ?result),
         BIND(""^^xsd:string AS ?result)) .
  }
  </code></pre>