Skip to content

Feature: Save and restore full SPARQL queries via API#860

Draft
dennisvang wants to merge 44 commits intosupport/1.19.xfrom
feature/852-sparql-saved
Draft

Feature: Save and restore full SPARQL queries via API#860
dennisvang wants to merge 44 commits intosupport/1.19.xfrom
feature/852-sparql-saved

Conversation

@dennisvang
Copy link
Copy Markdown
Contributor

@dennisvang dennisvang commented Mar 20, 2026

Adds save/load support for the full SPARQL queries introduced in v1.19.0.

Rationale

The existing FDP implementation (<=v1.19.0) offers support for saving/loading restricted SPARQL queries by storing SearchSavedQuery objects in the relational database:

This contains the restricted query in terms of user input, i.e. the values entered by the user:

public class SearchQueryVariablesDTO {
@NotNull
private String prefixes;
@NotNull
private String graphPattern;
@NotNull
private String ordering;
}

These values are used to render the query template:

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX dct: <http://purl.org/dc/terms/>
{{prefixes}}
SELECT ?entity ?rdfType ?title ?description
WHERE {
?entity rdf:type ?rdfType .
?entity dct:title ?title .
OPTIONAL { ?entity dct:description ?description }
{{graphPattern}}
}
ORDER BY {{ordering}}
LIMIT 50

This PR adds the ability to save/load full SPARQL queries that are not restricted to this template.

TODO:

  • ability to save raw sparql queries (in addition to the restricted sparql queries)
  • ability load/run saved sparql queries

this follows up on #853

@dennisvang dennisvang force-pushed the feature/852-sparql-saved branch 10 times, most recently from 573acad to 66cc0e2 Compare March 26, 2026 14:14
@dennisvang dennisvang force-pushed the feature/852-sparql-saved branch from 2f34c6b to 926e80b Compare March 27, 2026 15:50
@dennisvang dennisvang changed the title Ability to save and restore full SPARQL queries via API Feature: Save and restore full SPARQL queries via API Mar 27, 2026
@dennisvang
Copy link
Copy Markdown
Contributor Author

dennisvang commented Mar 27, 2026

WIP: Now we can save a full sparql query, but not all HTTP methods are supported yet. I'm also not happy with the fact that we need to duplicate a lot of code. Perhaps just step back to a single changeDTO with optional fields for variables and sparqlQuery (like the actualy entity...). This may not be as clear for API users, but there would be a lot less code to maintain.

@dennisvang dennisvang force-pushed the feature/852-sparql-saved branch 4 times, most recently from 578f6f3 to 235f83f Compare April 17, 2026 08:24
…earchQueryVariablesDTO

we're not renaming the entity field "variabes", so data migration is not needed
for consistency with SparqlQueryRestricted
…riablesDTO for consistency

actually this is a 1-1 mapping, so it is redundant, but I'm following the approach of the existing code
(which is to be the hobgoblin from PEP 8...)
because it is a better fit with the existing variables field names and makes more sense semantically
…hSavedQueryDTO

and adapt references and usages
to distinguish from SparqlQueryFullChangeDTO to be added later
…lQueryVariablesChangeDTO

and adapt references
…QueryController

this way the DTO mapping is done at the boundary, where is makes most sense to me
also the SearchSavedQueryService.create method now only knows about domain objects
this is an intentional break in consistency with the existing codebase
…thod instead of SearchSavedQueryMapper

again an intentional break in consistency with the existing code base,
because I think this makes more sense
and adapt existing mapper and controlled methods accordingly
to prevent ambiguity w.r.t. SettingsAutocompleteSource etc.
and move the SparqlQueryFull object into SparqlQueryVariablesChangeDTO
@dennisvang dennisvang force-pushed the feature/852-sparql-saved branch from 235f83f to f079e49 Compare April 17, 2026 08:59
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

Successfully merging this pull request may close these issues.

1 participant