From 8de71d4536f92d68219cb0e81df12ac40b8792d7 Mon Sep 17 00:00:00 2001 From: Tpt Date: Sat, 22 Dec 2018 15:07:11 +0100 Subject: [PATCH] The TZ function is not the same as the TIMEZONE function --- lib/src/sparql/algebra.rs | 3 +++ lib/src/sparql/sparql_grammar.rustpeg | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/src/sparql/algebra.rs b/lib/src/sparql/algebra.rs index 6729c5e0..a362bcaa 100644 --- a/lib/src/sparql/algebra.rs +++ b/lib/src/sparql/algebra.rs @@ -458,6 +458,7 @@ pub enum Expression { MinutesFunctionCall(Box), SecondsFunctionCall(Box), TimezoneFunctionCall(Box), + TzFunctionCall(Box), NowFunctionCall(), UUIDFunctionCall(), StrUUIDFunctionCall(), @@ -568,6 +569,7 @@ impl fmt::Display for Expression { Expression::MinutesFunctionCall(e) => write!(f, "MINUTES({})", e), Expression::SecondsFunctionCall(e) => write!(f, "SECONDS({})", e), Expression::TimezoneFunctionCall(e) => write!(f, "TIMEZONE({})", e), + Expression::TzFunctionCall(e) => write!(f, "TZ({})", e), Expression::NowFunctionCall() => write!(f, "NOW()"), Expression::UUIDFunctionCall() => write!(f, "UUID()"), Expression::StrUUIDFunctionCall() => write!(f, "STRUUID()"), @@ -818,6 +820,7 @@ impl<'a> fmt::Display for SparqlExpression<'a> { Expression::MinutesFunctionCall(e) => write!(f, "MINUTES({})", SparqlExpression(&*e)), Expression::SecondsFunctionCall(e) => write!(f, "SECONDS({})", SparqlExpression(&*e)), Expression::TimezoneFunctionCall(e) => write!(f, "TIMEZONE({})", SparqlExpression(&*e)), + Expression::TzFunctionCall(e) => write!(f, "TZ({})", SparqlExpression(&*e)), Expression::NowFunctionCall() => write!(f, "NOW()"), Expression::UUIDFunctionCall() => write!(f, "UUID()"), Expression::StrUUIDFunctionCall() => write!(f, "STRUUID()"), diff --git a/lib/src/sparql/sparql_grammar.rustpeg b/lib/src/sparql/sparql_grammar.rustpeg index a1d16858..d1dbfe12 100644 --- a/lib/src/sparql/sparql_grammar.rustpeg +++ b/lib/src/sparql/sparql_grammar.rustpeg @@ -786,7 +786,8 @@ BuiltInCall -> Expression = "HOURS"i _ '(' _ e:Expression _ ')' { Expression::HoursFunctionCall(Box::new(e)) } / "MINUTES"i _ '(' _ e:Expression _ ')' { Expression::MinutesFunctionCall(Box::new(e)) } / "SECONDS"i _ '(' _ e:Expression _ ')' { Expression::SecondsFunctionCall(Box::new(e)) } / - ("TIMEZONE"i / "TZ"i) _ '(' _ e:Expression _ ')' { Expression::TimezoneFunctionCall(Box::new(e)) } / + "TIMEZONE"i _ '(' _ e:Expression _ ')' { Expression::TimezoneFunctionCall(Box::new(e)) } / + "TZ"i _ '(' _ e:Expression _ ')' { Expression::TzFunctionCall(Box::new(e)) } / "NOW"i _ NIL { Expression::NowFunctionCall() } / "UUID"i _ NIL { Expression::UUIDFunctionCall() }/ "STRUUID"i _ NIL { Expression::StrUUIDFunctionCall() } /