Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to represent a list consisting of multiple variables in the query converted into JSON? #380

Open
Montanaz0r opened this issue Nov 3, 2022 · 1 comment

Comments

@Montanaz0r
Copy link

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!

@c-martinez
Copy link
Collaborator

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants