mardi 26 novembre 2019

sparql query if statement with retrieval and variable

My main need is to use something like switch cases in other programming languages.

I have a ?x g1:state (true OR false OR UNDEF) The latest is a variable incoming from a REST API and I want to perform different things based on that value

What I want to achieve is if ?x g1:state true bring me all the true triples. If it is false bring me all the false triples that correspond, if the latest is undefined bring me all the triples with whatever values. Something like this.

Bind ( if ('+test+'=true, ?x g1:state true,  Bind ( if ('+test+'=false, ?x g1:state false, ?x g1:state ?y1) as ?y) as ?xf)

Aucun commentaire:

Enregistrer un commentaire