[topbraid-users] Problem with IF in SPARQL

2015-02-09 Thread Jack Hodges
I was testing a simple conditional in SPARQL and it wasn't working. So I went to the documentation and wrote the test conditional and it worked, but do not understand why mine isn't working. The test conditional compares 2 integers and displays 2 strings. I augmented that test to have another

Re: [topbraid-users] Problem with IF in SPARQL

2015-02-09 Thread Holger Knublauch
Another thing to keep in mind is that IF will return nothing if the condition is returning unbound (fail). For example, IF(strlen(?a) 0, 1, 2) will return nothing if ?a is not a string - it will fail and return unbound - not 2. A safer way of expressing this would be IF(bound(?a)

Re: [topbraid-users] Problem with IF in SPARQL

2015-02-09 Thread Jack Hodges
Holger and Scott, Thank you very much for looking at this. Scott, I tried the scoping (as per your suggestion) and it didn't change anything. I must admit that I had not thought to run the query debugger, but I do not really understand how it works anyway. Holger, I tried using bound(?res2) and

Re: [topbraid-users] Problem with IF in SPARQL

2015-02-09 Thread Scott Henninger
Jack; The problem may be that SPARQL's declarative nature does not impose any ordering on its statements.  One should be able to place the statements in any order and the result will be the same. In your case, you need to make sure the ?res1 and ?res2 binding are