Closed eugeniashurko closed 2 years ago
My first guess would be: we need to add "in" to the global variable "SPARQL_CLAUSES" in kgforge.core.archetypes.store
line 36
Hi @eugeniashurko ,
If you have a valid SPARQL query (and it looks like you have) then you can set the forge.sparql(...) 'rewrite' argument to False to avoid any change to the provided query.
My first guess would be: we need to add "in" to the global variable "SPARQL_CLAUSES" in kgforge.core.archetypes.store line 36
Sure. The thing is it is difficult to take into account and know about all possible SPARQL clauses. That's why it is recommended to set 'rewrite' to False when having a FULL sparql query or use forge.search(...)
Ok, I will do that for now, but it's a bit annoying to need to specify all the prefixes and not to use the cool feature of 'light sparql' queries in forge. In my case, I cannot use forge search, as I need the full expressivity of sparql.
It would be great, if we could add "IN" to the list of the known statements in the next forge version.
Little UPD: rewrite
seems to be not in the list of arguments of forge.search
(kgforge version 0.7.0
)
Little UPD: rewrite seems to be not in the list of arguments of forge.search
It is part of forge.sparql(...)
Sorry, I meant forge.sparql
(not there for some reason).
I get:
<action> wrapper
<error> TypeError: sparql() got an unexpected keyword argument 'rewrite'
Not yet released I believe but in master.
Doesn't seem to be in the master either, but it's ok, I can wait until we merge from some PR or use from another branch. However, it would be really nice if you could also add "IN" while you are updating the sparql query builder.
I will. See the Querying notebook: https://github.com/BlueBrain/nexus-forge/blob/master/examples/notebooks/getting-started/04%20-%20Querying.ipynb
There is a bug when using
FILTER (?x IN (...))
statement in SPARQL queries executed through forge.Consider the following query:
When running this query with
forge.sparql(query)
, an error "Bad request" is thrown (usually means an invalid query).Indeed, when running
forge.sparql(query, debug=True)
, the query that's sent to the Nexus is transformed into an erroneous one:(last line, ':' is added to IN)