From 20928b82fab4f0cff42204d49b195bcd86df1f01 Mon Sep 17 00:00:00 2001 From: Tpt Date: Thu, 12 Jan 2023 21:40:31 +0100 Subject: [PATCH] SPARQL smith: adds more functions --- lib/sparql-smith/src/lib.rs | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/lib/sparql-smith/src/lib.rs b/lib/sparql-smith/src/lib.rs index d367fa8d..4a288a50 100644 --- a/lib/sparql-smith/src/lib.rs +++ b/lib/sparql-smith/src/lib.rs @@ -1479,15 +1479,43 @@ enum BuiltInCall { // | RegexExpression // | ExistsFunc // | NotExistsFunc - Bound(Var), //TODO: Other functions + Str(Box), + Lang(Box), + Datatype(Box), + Bound(Var), + Iri(Box), + Bnode(Box), + Coalesce(ExpressionList), + If(Box, Box, Box), + StrLang(Box, Box), + StrDt(Box, Box), + SameTerm(Box, Box), + IsIri(Box), + IsBlank(Box), + IsLiteral(Box), + IsNumeric(Box), Exists(ExistsFunc), - NotExists(ExistsFunc), + NotExists(NotExistsFunc), //TODO: Other functions } impl fmt::Display for BuiltInCall { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { + Self::Str(v) => write!(f, "STR({v})"), + Self::Lang(v) => write!(f, "LANG({v})"), + Self::Datatype(v) => write!(f, "DATATYPE({v})"), Self::Bound(v) => write!(f, "BOUND({v})"), + Self::Iri(v) => write!(f, "IRI({v})"), + Self::Bnode(v) => write!(f, "BNODE({v})"), + Self::Coalesce(vs) => write!(f, "COALESCE{vs}"), + Self::If(a, b, c) => write!(f, "IF({a}, {b}, {c})"), + Self::StrLang(a, b) => write!(f, "STRLANG({a}, {b})"), + Self::StrDt(a, b) => write!(f, "STRDT({a}, {b})"), + Self::SameTerm(a, b) => write!(f, "sameTerm({a}, {b})"), + Self::IsIri(e) => write!(f, "isIRI({e})"), + Self::IsBlank(e) => write!(f, "isBlank({e})"), + Self::IsLiteral(e) => write!(f, "isLiteral({e})"), + Self::IsNumeric(e) => write!(f, "isNumeric({e})"), Self::Exists(e) => write!(f, "{e}"), Self::NotExists(e) => write!(f, "{e}"), }