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

App freezes on SPARQL SERVICE request #2

Open
webhart opened this issue Oct 23, 2024 · 3 comments
Open

App freezes on SPARQL SERVICE request #2

webhart opened this issue Oct 23, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@webhart
Copy link
Collaborator

webhart commented Oct 23, 2024

Steps to reproduce:
Run the following SPARQL query:

select * where { 
    SERVICE <https://query.wikidata.org/bigdata/namespace/wdq/sparql>{
		?s ?p ?o .
    }
} limit 10
@webhart webhart added the bug Something isn't working label Oct 23, 2024
@JannisGrundmann
Copy link
Collaborator

Trying to access https://query.wikidata.org/bigdata/namespace/wdq/sparql throws

com.google.gson.stream.MalformedJsonException: Unterminated string at line 30356959 column 1 path $.results.bindings[2309719].o.value 

It seems to work with

select * where { 
    SERVICE <https://dbpedia.org/sparql> {
		?s ?p ?o .
    }
} limit 10

@webhart
Copy link
Collaborator Author

webhart commented Oct 23, 2024

According to https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service:
The result is returned as XML by default, or as JSON if either the query parameter format=json or the header Accept: application/sparql-results+json are provided
Do we need to configure Jena accordingly?

@Lexachoc
Copy link
Collaborator

Lexachoc commented Oct 23, 2024

I download the RDF data from the endpoint and upload to FUSEKI, then the query works.

image

I started to doubt that the query on the server side is too large, which is causing the problem. I verify this by changing this line:

return await client.get(self.server, params={"query": query}, headers=FusekiConnection._header)

into

return await client.post("https://query.wikidata.org/bigdata/namespace/wdq/sparql", params={'query': query, 'format': 'json'})

and type:

SELECT * WHERE {
  ?sub ?pred ?obj .
} LIMIT 10

to the YASGUI editor

Directly query to the endpoint works.

It turns out that the data is way too large to process and your LIMIT 10 is not passed to the wikidata server.

Using below query will fix the issue:

select * where { 
    SERVICE <https://query.wikidata.org/bigdata/namespace/wdq/sparql> {
    {
      SELECT * WHERE {
        ?s ?p ?o .
      } LIMIT 10
    }
    }
}

The result:

image

So we don't need to configure Fuseki. Fuseki/ontodocker can parse the results.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants