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

Allow more elaborate patterns (like specifying suffix/prefix) for bindings inside HAVING clauses #122

Open
rogerlucena opened this issue Jul 29, 2020 · 1 comment

Comments

@rogerlucena
Copy link
Contributor

It would be useful to be able to apply more ellaborate patterns for bindings inside the HAVING clauses, like being able to specify the suffix/prefix of a TYPE binding for example:

SELECT ?o, ?o_type
FROM ?test
WHERE {
  ?s ?p ?o TYPE ?o_type
}
HAVING ?o_type LIKE "/country/corp%"^^type:text;

With something like a LIKE keyword and a protected symbol such as % to represent that anything can appear at that position, as in the example above on which we specify a prefix for ?o_type.

Given a graph containing hierarchical node TYPEs, such as /country/corp and /country/corp/employee for example, this feature would be especially handy.

To achieve that, it may be helpful to have a look at functions such as strings.HasPrefix as used for covariants in BadWolf here:

if !strings.HasPrefix(t.String(), ot.String()) {
.

@rogerlucena rogerlucena changed the title Allow more ellaborate patterns (like specifying suffix/prefix) for bindings inside HAVING clauses Allow more elaborate patterns (like specifying suffix/prefix) for bindings inside HAVING clauses Jul 29, 2020
@rogerlucena
Copy link
Contributor Author

This can be done by the addition to a new FILTER function to BQL, something like the match FILTER function for regex (commented in #129).

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