diff --git a/spargebra/src/parser.rs b/spargebra/src/parser.rs index ab86f201..22f4d4bf 100644 --- a/spargebra/src/parser.rs +++ b/spargebra/src/parser.rs @@ -303,12 +303,7 @@ impl From for AnnotatedTermPath { annotations: term .annotations .into_iter() - .map(|(p, o)| { - ( - p.into(), - o.into_iter().map(Self::from).collect(), - ) - }) + .map(|(p, o)| (p.into(), o.into_iter().map(Self::from).collect())) .collect(), } } @@ -1283,8 +1278,13 @@ parser! { //[53] rule GroupGraphPattern() -> GraphPattern = - "{" _ p:GroupGraphPatternSub() _ "}" { p } / - "{" _ p:SubSelect() _ "}" { p } + "{" _ GroupGraphPattern_clear() p:GroupGraphPatternSub() GroupGraphPattern_clear() _ "}" { p } / + "{" _ GroupGraphPattern_clear() p:SubSelect() GroupGraphPattern_clear() _ "}" { p } + rule GroupGraphPattern_clear() = { + // We deal with blank nodes aliases rule + state.used_bnodes.extend(state.currently_used_bnodes.iter().cloned()); + state.currently_used_bnodes.clear(); + } //[54] rule GroupGraphPatternSub() -> GraphPattern = a:TriplesBlock()? _ b:GroupGraphPatternSub_item()* { @@ -1314,10 +1314,6 @@ parser! { } } - // We deal with blank nodes aliases rule (TODO: partial for now) - state.used_bnodes.extend(state.currently_used_bnodes.iter().cloned()); - state.currently_used_bnodes.clear(); - if let Some(expr) = filter { GraphPattern::Filter { expr, inner: Box::new(g) } } else { diff --git a/testsuite/tests/sparql.rs b/testsuite/tests/sparql.rs index f27fe513..e62135a9 100644 --- a/testsuite/tests/sparql.rs +++ b/testsuite/tests/sparql.rs @@ -27,8 +27,6 @@ fn sparql10_w3c_query_syntax_testsuite() -> Result<()> { run_testsuite( "http://www.w3.org/2001/sw/DataAccess/tests/data-r2/manifest-syntax.ttl", vec![ - "http://www.w3.org/2001/sw/DataAccess/tests/data-r2/syntax-sparql4/manifest#syn-bad-38", // bnode scope - "http://www.w3.org/2001/sw/DataAccess/tests/data-r2/syntax-sparql4/manifest#syn-bad-34", // bnode scope "http://www.w3.org/2001/sw/DataAccess/tests/data-r2/syntax-sparql3/manifest#syn-bad-26", // tokenizer ], )