lundi 19 juillet 2021

SPARQL if-then-else statement

I am trying to create an RDF graph, in which: if ?n1 exists then a triple of the form: <?x ex:n "1"> will be created. Otherwise, a triple of the form <?x ex:n "0"> will be created. My code is the following:

CONSTRUCT {?x ex:n ?result .}

WHERE { 
  ?x ex:n ?n1 .
  BIND (IF(?n1 ="    *"^^xsd:string, "0", "1") AS ?result)
}

However, only the triples where the value of ?n1 exists are created (<?x ex:n "1">). I miss the triples of the form: <?x ex:n "0">. Why does it happen?

Aucun commentaire:

Enregistrer un commentaire