CLARIAH / grlc

grlc builds Web APIs using shared SPARQL queries
http://grlc.io
MIT License
137 stars 32 forks source link

Allowing values to be inserted from the body into a query #406

Closed aschimmenti closed 9 months ago

aschimmenti commented 1 year ago

Hello everyone, I don't know if it's already possible (if so, pardon my ignorance), but would it be possible to make post requests with grlc to modify/ bind the query variables? e.g. by using variables inside the query, that are filled with values from the body e.g. from this

SELECT ?person ?personLabel
        WHERE {
 BIND(${value} AS ?person)
          ?person wdt:P31 wd:Q5;
                  rdfs:label ?personLabel .
          }

to this:

SELECT ?person ?personLabel
        WHERE {
 BIND(wd:Q42 AS ?person)
          ?person wdt:P31 wd:Q5;
                  rdfs:label ?personLabel .
          }

Thank you

c-martinez commented 1 year ago

Hi @aschimmenti !

Thanks for getting in touch. I think this is similar to issue #230, so the proposed workaround from issue #322 might work for you as well.

Do you think the same workaround would work for you?

For the longer term, supporting this type of variable replacement would be a good improvement. What do you think @albertmeronyo ?

c-martinez commented 9 months ago

Hi @aschimmenti -- this should be possible with release v1.3.9.

aschimmenti commented 9 months ago

That's amazing! Thank you for your work.