sparql if bound query 1

sparql if bound query

// Don't forget to bind it to a varible
// if you're using it in a select clause

select ?name ?age ( if(bound(?gen), ?gen, 'None') as ?gender )

Here is what the above code is Doing:
1. We’re using the if() function to check if the ?gen variable is bound.
2. If it is bound, we return the value of ?gen.
3. If it is not bound, we return the string ‘None’.
4. We’re using the as keyword to rename the variable ?gen to ?gender.

Similar Posts