Fixes SPARQL query formatting

pull/271/head
Tpt 2 years ago committed by Thomas Tanon
parent b84df8a3d9
commit 00ab9ab83c
  1. 12
      lib/spargebra/src/algebra.rs

@ -71,17 +71,17 @@ impl fmt::Display for PropertyPathExpression {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::NamedNode(p) => p.fmt(f),
Self::Reverse(p) => write!(f, "^{}", p),
Self::Reverse(p) => write!(f, "^({})", p),
Self::Sequence(a, b) => write!(f, "({} / {})", a, b),
Self::Alternative(a, b) => write!(f, "({} | {})", a, b),
Self::ZeroOrMore(p) => write!(f, "{}*", p),
Self::OneOrMore(p) => write!(f, "{}+", p),
Self::ZeroOrOne(p) => write!(f, "{}?", p),
Self::ZeroOrMore(p) => write!(f, "({})*", p),
Self::OneOrMore(p) => write!(f, "({})+", p),
Self::ZeroOrOne(p) => write!(f, "({})?", p),
Self::NegatedPropertySet(p) => {
write!(f, "!(")?;
for (i, c) in p.iter().enumerate() {
if i > 0 {
write!(f, " ")?;
write!(f, " | ")?;
}
write!(f, "{}", c)?;
}
@ -466,7 +466,7 @@ impl fmt::Display for Function {
Self::LCase => write!(f, "LCASE"),
Self::EncodeForUri => write!(f, "ENCODE_FOR_URI"),
Self::Contains => write!(f, "CONTAINS"),
Self::StrStarts => write!(f, "STRSTATS"),
Self::StrStarts => write!(f, "STRSTARTS"),
Self::StrEnds => write!(f, "STRENDS"),
Self::StrBefore => write!(f, "STRBEFORE"),
Self::StrAfter => write!(f, "STRAFTER"),

Loading…
Cancel
Save