-
Notifications
You must be signed in to change notification settings - Fork 27
Open
Description
Hi :)
rasqal_query_prepare is returning an error if the query contains a FILTER NOT EXISTS, e.g.
SELECT ?s WHERE { ?s ?p ?o . FILTER NOT EXISTS { ?s ?p2 ?o2 } }
returns
WARNING: Rasqal error: syntax error, unexpected NOT (at line 1, column -1)
This is the code:
static void rasqal_log_handler(void *user_data, raptor_log_message *message)
{
elog(WARNING, "Rasqal error: %s (at line %d, column %d)",
message->text, message->locator->line, message->locator->column);
}
static bool is_valid_sparql_query(const char *sparql_string)
{
bool is_valid = false;
int prepare_result;
rasqal_world *world = rasqal_new_world();
rasqal_query *query = NULL;
if (!world)
return false;
rasqal_world_set_log_handler(world, NULL, rasqal_log_handler);
rasqal_world_set_warning_level(world, 0);
if (rasqal_world_open(world) != 0)
{
elog(WARNING, "Failed to open Rasqal world");
rasqal_free_world(world);
return false;
}
query = rasqal_new_query(world, "sparql", NULL);
if (!query)
{
elog(WARNING, "Failed to create Rasqal query");
rasqal_free_world(world);
return false;
}
prepare_result = rasqal_query_prepare(query, (const unsigned char *)sparql_string, NULL);
if (prepare_result == 0)
is_valid = true;
else
elog(WARNING, "SPARQL query preparation failed. Return code: %d", prepare_result);
rasqal_free_query(query);
rasqal_free_world(world);
return is_valid;
}Am I missing something here?
Thanks in advance!
Best, Jim
Metadata
Metadata
Assignees
Labels
No labels