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

graphql: Filtering by a constant(s) #12

Open
Aklakan opened this issue Feb 12, 2024 · 0 comments
Open

graphql: Filtering by a constant(s) #12

Aklakan opened this issue Feb 12, 2024 · 0 comments

Comments

@Aklakan
Copy link
Member

Aklakan commented Feb 12, 2024

While it is possible to use the generic sparql inject mechanism to filter fields, there should also be one that works on simple strings - even if those introduce ambiguity.

{
  myField @sparql(inject: "FILTER(?s = <urn:foo:bar>)")
}

Consider the following example:

{
  myField @filter(value: "http://foobar")
}

It could in a first step be translated generically into

FILTER(?s = <http://foobar> || ?s = "http://foobar")

Afterwards, we can apply value space analysis, which might detect that e.g. ?s appears only in the subject position and thus cannot be a string, leading to the opportunity to eliminate the string comparison.

The same approach could be used for @filter(in: ["urn:some", "http://array", "of values"]).

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