vendredi 29 octobre 2021

How to insert data using parametrized sparql query?

I have this insert query:

INSERT { $subject <http://www.google.com/go#hasState> ?state} WHERE {?state a <http://www.google.com/go#State>. }

If the state is equal to <http://www.google.com/go#State-USA> I would need to insert all the states of type <http://www.google.com/go#State>. If not, I would need to insert only the specified state, for example: <http://www.google.com/go#State-Michigan> How could I write an if-else statement inside the insert, to check what the value of ?state is, and then to run the needed insert query.

Aucun commentaire:

Enregistrer un commentaire