From 98d98d9b851a26a9caf93d145e36fab7dc485eaf Mon Sep 17 00:00:00 2001 From: Tpt Date: Fri, 30 Apr 2021 17:40:11 +0200 Subject: [PATCH] Adds triple pattern to SPARQL expression --- spargebra/src/parser.rs | 8 +++++++- testsuite/tests/sparql.rs | 4 ---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/spargebra/src/parser.rs b/spargebra/src/parser.rs index a283605f..2a4c5d3b 100644 --- a/spargebra/src/parser.rs +++ b/spargebra/src/parser.rs @@ -1741,7 +1741,8 @@ parser! { l:RDFLiteral() { l.into() } / l:NumericLiteral() { l.into() } / l:BooleanLiteral() { l.into() } / - BuiltInCall() + BuiltInCall() / + TripleExpression() //[120] rule BrackettedExpression() -> Expression = "(" _ e:Expression() _ ")" { e } @@ -2094,6 +2095,11 @@ parser! { t:GraphTerm() { t.into() } / t:EmbTP() { t.into() } + // Extra rule not yet in the spec + rule TripleExpression() -> Expression = "<<" _ s:Expression() _ p:Expression() _ o:Expression() _ ">>" { + Expression::FunctionCall(Function::Triple, vec![s, p, o]) + } + //space rule _() = quiet! { ([' ' | '\t' | '\n' | '\r'] / comment())* } diff --git a/testsuite/tests/sparql.rs b/testsuite/tests/sparql.rs index c7346722..79d439fd 100644 --- a/testsuite/tests/sparql.rs +++ b/testsuite/tests/sparql.rs @@ -151,10 +151,6 @@ fn sparql_star_query_syntax_testsuite() -> Result<()> { "https://w3c.github.io/rdf-star/tests/sparql/syntax#sparql-star-update-6", "https://w3c.github.io/rdf-star/tests/sparql/syntax#sparql-star-update-7", "https://w3c.github.io/rdf-star/tests/sparql/syntax#sparql-star-update-8", - // Not covered by grammar yet - "https://w3c.github.io/rdf-star/tests/sparql/syntax#sparql-star-expr-1", - "https://w3c.github.io/rdf-star/tests/sparql/syntax#sparql-star-expr-2", - "https://w3c.github.io/rdf-star/tests/sparql/syntax#sparql-star-expr-6", ], ) }