Do it like this:
BIND (IF(condition, thenValue, elseValue) AS ?targetVariable)
In SPARQL, IF(…) is a function that returns a value, not a statement like in most programming languages. So you can only use IF(…) in places where a value is allowed. For example, in FILTER (…), in the SELECT clause at the top of the query, and—as we’re doing here—in BIND (…).
Best,
Richard
> --
> You received this message because you are subscribed to the Google Groups "Tarql" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
tarql+un...@googlegroups.com.
> To post to this group, send an email to
ta...@googlegroups.com.
> To view this discussion on the web, visit
https://groups.google.com/d/msgid/tarql/56321042.8040200%40gmail.com.
> For more options, visit
https://groups.google.com/d/optout.