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

Request for API to return application/ld+json format #1909

Closed
adeel-ansari opened this issue Dec 18, 2020 · 5 comments · Fixed by #2307
Closed

Request for API to return application/ld+json format #1909

adeel-ansari opened this issue Dec 18, 2020 · 5 comments · Fixed by #2307

Comments

@adeel-ansari
Copy link

Some visualization tools can visualize data returned in the following format (GET https://bnb.data.bl.uk/sparql?query=DESCRIBE http://bnb.data.bl.uk/id/resource/018212405):

{
"@graph": [
{
"@id": "http://bnb.data.bl.uk/id/resource/GBB721847",
"http://www.w3.org/2002/07/owl#sameAs": [
{
"@id": "http://bnb.data.bl.uk/id/resource/018212405"
}
]
},
{
"@id": "http://bnb.data.bl.uk/id/person/ZweigStefan1881-1942",
"http://www.bl.uk/schemas/bibliographic/blterms#hasCreated": [
{
"@id": "http://bnb.data.bl.uk/id/resource/018212405"
}
]
},
{
"@id": "http://bnb.data.bl.uk/id/resource/018212405",
"@type": [
"http://schema.org/Book",
"http://purl.org/dc/terms/BibliographicResource",
… [truncated]

Currently Nexus api's return application/sparql-results+json format:

{
"head": {
"vars": [
"subject",
"predicate",
"object",
"context"
]
},
"results": {
"bindings": [
{
"object": {
"type": "uri",
"value": "https://bluebrain.github.io/nexus/schemas/unconstrained.json"
},
"predicate": {
"type": "uri",
"value": "https://bluebrain.github.io/nexus/vocabulary/constrainedBy"
},
"subject": {
"type": "uri",
"value": "https://reservoir.global/v1/resources/Public/CONP/_/3206cae4-764a-4a84-88a5-ecc1a317830f"
}
},
…[truncated]

Can we add a feature to return the json-ld format?

@bogdanromanx bogdanromanx added this to the v1.5.0 milestone Dec 19, 2020
@umbreak umbreak modified the milestones: v1.5.0, v1.6.0 Jan 29, 2021
@umbreak
Copy link
Contributor

umbreak commented Apr 20, 2021

As far as Blazegraph goes, the supported response types are listed here. I don't see anything that looks like what you are describing.

@adeel-ansari can you please give us further feedback? What is the exact query (SELECT, CONSTRUCT, ...) and what is the exact HTTP Accept header those visualization tools are sending to the /sparql endpoint?

@adeel-ansari
Copy link
Author

@umbreak , unfortunately I don't have the original query I was using at the time. If I get a chance in the coming weeks, I'll try to re-create.

I was following neo4j instructions to visualize the nexus data in neo4j: https://neo4j.com/labs/neosemantics/how-to-guide/#_previewing_the_data. Because of the format that Nexus was returning, the data wasn't being displayed.

The serialization formats allowed are: Turtle, N-Triples, JSON-LD, RDF/XML, TriG and N-Quads (For named graphs)

If it's something you want to try, note you have to install neo4j and the neosemantics component: https://neo4j.com/labs/neosemantics/installation/

Full documentation here: https://neo4j.com/labs/neosemantics/4.2/

@umbreak
Copy link
Contributor

umbreak commented Apr 20, 2021

I see.
I can confirm that this works in Blazegraph as well, using the HTTP Accept header application/ld+json when the SPARQL query is a construct query:

$ curl -s -H 'Accept: application/ld+json' '{endpoint}/sparql' 
   -d 'query=CONSTRUCT%20%7B%3Fs%20%3Fp%20%3Fo%7D%20WHERE%20%7B%3Fs%20%3Fp%20%3Fo%7D%20limit%2010'

We will probably want to support the following:

  • text/plain: N-triples response
  • application/ld+json: a collection of expanded JSON-LD

@bogdanromanx
Copy link
Contributor

@wwajerowicz is this currently supported in the blazegraph plugin?

@umbreak
Copy link
Contributor

umbreak commented Apr 23, 2021

No. I'm working on supporting it. It could be done by the following days.

This will make part of the composite views a bit easier. We can query the common blazegraph namespace using the text/plain Accept header and get back n-triples instead of what we are currently doing (getting the json-sparql-results and converting them into ntriples).

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

Successfully merging a pull request may close this issue.

3 participants