-
Notifications
You must be signed in to change notification settings - Fork 18
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
Gravsearch AND expression failing #846
Comments
I think we can do it like this: My understanding is that |
The way the filter statements are generated at the moment for
This will generate additional statements to check for both conditions, and both sides of the expression will be removed. But all those statements must then match to get a search result, so in effect the OR becomes an AND, which is wrong. Similarly imagine this:
This is valid SPARQL, but in Gravsearch it could never return any results. The solution is not to remove the expression from the FILTER, but instead to replace it with a comparison that checks the value of a variable, which is set by an additional statement. In short: if you remove an expression from a FILTER, it has to be the top-level expression, and then you have to remove the whole FILTER, otherwise the logic will be invalid. |
Ok, I understand! But how would that work for fulltext search? We allow users to use the match function, but internally we are creating a statement using the Lucene index. |
I'll add a check to make sure that |
By the way, thank you for refactoring |
Great!
Also great! I think your idea with the design doc for gravsearch is good, we should try to describe what is implemented in a more formalized way. And I think we will find a lot of inconsistencies. |
Example:
In query below FILTER(?text = "Bonjour" && lang(?text) = "fr") is failing
"""
|PREFIX knora-api: http://api.knora.org/ontology/knora-api/simple/v2#
|PREFIX anything: http://0.0.0.0:3333/ontology/0001/anything/simple/v2#
|
|CONSTRUCT {
| ?thing knora-api:isMainResource true .
|
| ?thing a anything:Thing .
|
| ?thing anything:hasText ?text .
|} WHERE {
| ?thing a knora-api:Resource .
|
| ?thing a anything:Thing .
|
| ?thing anything:hasText ?text .
|
| anything:hasText knora-api:objectType xsd:string .
|
| ?text a xsd:string .
|
| FILTER(?text = "Bonjour" && lang(?text) = "fr")
|}
""".
The text was updated successfully, but these errors were encountered: