Is it possible to represent a list consisting of multiple variables in the query converted into JSON?
Montanaz0r opened this issue · comments
Hi @c-martinez @albertmeronyo! First of all, Thank you for your excellent work.
I do play with the tool you created for some time, and I was wondering if there is a way to represent a python-like list in the transformed JSON. The caveat is that the list should contain multiple variables that query extracts. Let me show you an example of what I am trying to achieve:
#+ "coordinates": [1.234, 3.555],
I can place a hardcoded list with two decimal values in the decorated transform clause. This will indeed allow me to represent a python-like list with multiple values separated by a comma, but I would like to replace those values with variables that are coming from the query. Just like this:
#+ "coordinates": [?a_variable, ?b_variable],
Unfortunately, this doesn't work and the JSON output doesn't produce what I was expecting. You can see the output below.
"coordinates": [ { "a_variable": null }, { "b_variable": null } ],
I have also tried capturing the whole list between "" and the same for variables inside the list, but it didn't help.
Is there any way I could achieve this? My specific goal is to capture latitude and longitude using the SPARQL query. Cast them both as decimals and represent the inside of a single list. For now, I ended up concatenating a string from both coordinates and closed brackets. However, this doesn't feel good.
Thank you in advance for your help!
Hi @Montanaz0r ! Nice to hear you find grlc useful!
Very good question! I'm not sure this is possible. But I would guess @pasqLisena might know -- he is the real expert in transform syntax.
@pasqLisena, any ideas?