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

Launching multiple SPARQL queries for same API operation #17

Open
ivanhb opened this issue Jun 7, 2024 · 0 comments
Open

Launching multiple SPARQL queries for same API operation #17

ivanhb opened this issue Jun 7, 2024 · 0 comments

Comments

@ivanhb
Copy link
Member

ivanhb commented Jun 7, 2024

Since some triplestores have limitations on SPARQL query length, a practical solution involves splitting long queries and merging the results.

Here's an example:

Consider the following SPARQL query in the API configuration file:

#sparql PREFIX cito: <http://purl.org/spar/cito/>
SELECT (count(?cited) as ?count)
WHERE {
VALUES ?val { [[id]] } .
?oci cito:hasCitingEntity ?val .
?oci cito:hasCitedEntity ?cited .
}

If [[id]] contains many values, the query might exceed the triplestore's limit. To address this, we can run the same query multiple times, each with a smaller subset of values from [[id]]. Finally, we merge the partial results to obtain the complete answer.

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

1 participant