From c1b57f460b1b5490c46fc4af1e3de8822a529cd2 Mon Sep 17 00:00:00 2001 From: Vilnis Termanis Date: Mon, 16 Oct 2023 21:34:55 +0200 Subject: [PATCH] SPARQL: Fix ASK + FROM combination Previously ASK FROM only worked without WHERE --- lib/spargebra/src/parser.rs | 2 +- testsuite/oxigraph-tests/sparql/ask_from.rq | 1 + testsuite/oxigraph-tests/sparql/manifest.ttl | 5 +++++ 3 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 testsuite/oxigraph-tests/sparql/ask_from.rq diff --git a/lib/spargebra/src/parser.rs b/lib/spargebra/src/parser.rs index 7779e31c..ea1f9b7f 100644 --- a/lib/spargebra/src/parser.rs +++ b/lib/spargebra/src/parser.rs @@ -1055,7 +1055,7 @@ parser! { } rule DescribeQuery_item() -> NamedNodePattern = i:VarOrIri() _ { i } - rule AskQuery() -> Query = i("ASK") _ d:DatasetClauses() w:WhereClause() _ g:GroupClause()? _ h:HavingClause()? _ o:OrderClause()? _ l:LimitOffsetClauses()? _ v:ValuesClause() {? + rule AskQuery() -> Query = i("ASK") _ d:DatasetClauses() _ w:WhereClause() _ g:GroupClause()? _ h:HavingClause()? _ o:OrderClause()? _ l:LimitOffsetClauses()? _ v:ValuesClause() {? Ok(Query::Ask { dataset: d, pattern: build_select(Selection::no_op(), w, g, h, o, l, v, state)?, diff --git a/testsuite/oxigraph-tests/sparql/ask_from.rq b/testsuite/oxigraph-tests/sparql/ask_from.rq new file mode 100644 index 00000000..34592a8d --- /dev/null +++ b/testsuite/oxigraph-tests/sparql/ask_from.rq @@ -0,0 +1 @@ +ASK FROM WHERE { } diff --git a/testsuite/oxigraph-tests/sparql/manifest.ttl b/testsuite/oxigraph-tests/sparql/manifest.ttl index 21ef9e76..6594fe12 100644 --- a/testsuite/oxigraph-tests/sparql/manifest.ttl +++ b/testsuite/oxigraph-tests/sparql/manifest.ttl @@ -16,6 +16,7 @@ :long_unicode_escape_with_multibytes_char_update :describe :describe_where + :ask_with_from :group_concat_with_null :single_not_exists :property_list_path @@ -63,6 +64,10 @@ qt:data ] ; mf:result . +:ask_with_from rdf:type mf:PositiveSyntaxTest ; + mf:name "ASK with FROM" ; + mf:action . + :group_concat_with_null rdf:type mf:QueryEvaluationTest ; mf:name "GROUP_CONCAT with NULL" ; rdfs:comment "GROUP_CONCAT should ignore null values" ;