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

Endpoint to easily search/resolve singular entities by via basic Queries #2933

Merged
merged 7 commits into from
Feb 14, 2023

Conversation

awildturtok
Copy link
Collaborator

No description provided.

@awildturtok awildturtok requested a review from thoniTUB February 13, 2023 09:57

// Build query, assuming FilterValues are all of the same concept and connector.
final CQConcept cqConcept = new CQConcept();
cqConcept.setElements(List.of(filters.get(0).getFilter().getConnector().getConcept()));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

du könntest den connector oben schon rausholen beim distinct

Comment on lines 70 to 75
public static record ResolveEntitiesContainer(List<FilterValue<?>> filters){
@ValidationMethod(message = "Only one Connector is supported.")
public boolean isFiltersForSameConnector() {
return filters().stream().map(fv -> fv.getFilter().getConnector()).distinct().count() == 1;
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bitte in eine extra klasse packen

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hatte vergessen die Klasse zu löschen


@POST
@Path("/resolve-entities")
public Stream<Map<String, String>> resolveEntities(@Auth Subject subject, @Valid @NotEmpty List<FilterValue<?>> container, @Context HttpServletRequest request) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public Stream<Map<String, String>> resolveEntities(@Auth Subject subject, @Valid @NotEmpty List<FilterValue<?>> container, @Context HttpServletRequest request) {
public Stream<Map<String, String>> resolveEntities(@Auth Subject subject, @Valid @NotEmpty List<FilterValue<?>> container) {

/**
* Execute a basic query on a single concept and return only the included entities Id's.
*/
public Stream<Map<String, String>> resolveEntities(Subject subject, List<FilterValue<?>> filters, Dataset dataset) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wir sollten echt überlegen ob wir nicht einen synchronen/long-poll execution modus anbieten.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ja, wobei hier ja das format ja auch ein bestimmtes ist. Long-poll könnte man ja recht einfach über einen query-param in den query-submission Endpunkten machen, und dann mit der gleichen Logik wie hier.

@awildturtok awildturtok merged commit c8240a6 into develop Feb 14, 2023
@delete-merged-branch delete-merged-branch bot deleted the feature/search-entities branch February 14, 2023 08:58
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.

2 participants