Handling JSON Query Results with Python

Is there a 'simple' way to extract SPARQL query results, returned as JSON, using Python? I'm not a Python expert and it doesn't seem JSON friendly.

Are you saying that Python doesn't seem JSON friendly? If you're building a client application, perhaps you can consider using pystardog.

Jess

Jess,

Yes, I’m building a client application: Executing SPARQL queries and extract the bits.

The application needs to avoid non-generic libraries. And I did look at pystardog, but I didn’t see anything in the documentation that suggested it provided a
‘simple’ way to extract ‘bits’ from a JSON result. Did I miss it?

Thank you.

Todd

image001.jpg

What is the significance of JSON here? It's just one way to represent a SPARQL query result.

You could always return your results as csv if that's easier for you.

Jess,

There’s no significance of JSON, just going from previous experience using JAVA with SPARQL queries via HTTP calls

Todd.

image001.jpg

Zachary,

I didn’t see CSV as an option for ‘Accept’ (in an HTTP GET call) in the Stardog documentation.

Todd

image001.jpg

text/csv should be in there https://stardog.docs.apiary.io/reference/core-api/executing-a-query

Zachary,

I didn’t see the ‘extended’ list of ‘Accept’ types in
https://stardog.docs.apiary.io/reference/core-api/executing-a-query when I looked earlier.

The ‘text/csv’ should do the job nicely.

Thank you.

Todd

image001.jpg

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.