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

Return no quads for malformed QPF selectors #1171

Closed
wants to merge 2 commits into from

Conversation

langsamu
Copy link

@langsamu langsamu commented Mar 12, 2023

Resolves #1163 by shortcircuiting the QPF source to an empty stream of quads when matching a malformed selector:

public match(subject: RDF.Term, predicate: RDF.Term, object: RDF.Term, graph: RDF.Term): AsyncIterator<RDF.Quad> {
if (_isMalformedSelector(subject, predicate, object, graph)) {
return _noQuads();

@CLAassistant
Copy link

CLAassistant commented Mar 12, 2023

CLA assistant check
All committers have signed the CLA.

@coveralls
Copy link

coveralls commented Mar 12, 2023

Pull Request Test Coverage Report for Build 4399142398

  • 8 of 8 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 100.0%

Totals Coverage Status
Change from base Build 4384977037: 0.0%
Covered Lines: 5876
Relevant Lines: 5876

💛 - Coveralls

@langsamu langsamu force-pushed the qpf_malformed_selectors branch 6 times, most recently from 0c38d06 to 344f749 Compare March 12, 2023 19:11
@langsamu langsamu force-pushed the qpf_malformed_selectors branch 2 times, most recently from 898a651 to cc7984d Compare March 12, 2023 19:42
@langsamu
Copy link
Author

@jeswr, @rubensworks can I have some feedback.

I think the adjustment is basically fine:

public match(subject: RDF.Term, predicate: RDF.Term, object: RDF.Term, graph: RDF.Term): AsyncIterator<RDF.Quad> {
if (_isMalformedSelector(subject, predicate, object, graph)) {
return _noQuads();

However I wanted my tests to fail before the adjustment (in addition to covering the new code).
But they pass.

In the test, I'm trying to set up a source with 'weird' quads (e.g. with a literal subject) that would not be empty when queried with a malformed QPF selector. This is so I can prove they are empty when malformed selectors are ignored.

@rubensworks
Copy link
Member

Thanks for the PR @langsamu!

As mentioned in #1163 (comment), I would prefer a more general approach, as the same problem could also occur for other source types.
So basically, the same logic could be applied in https://github.com/comunica/comunica/blob/master/packages/actor-query-operation-quadpattern/lib/ActorQueryOperationQuadpattern.ts

To still allow the old mode for people relying on the current behaviour, we'll also have to introduce a generalizedRdf context option (can default to false).

@rubensworks
Copy link
Member

Closing this PR due to staleness.
Feel free to re-open if there are any updates! 🙂

@rubensworks rubensworks closed this May 5, 2023
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.

Malformed QPF with literal subject
4 participants