Improves nested triples formatting

pull/171/head
Tpt 4 years ago
parent 80676b5149
commit cd36119d88
  1. 4
      lib/src/model/triple.rs
  2. 4
      lib/src/sparql/csv_results.rs

@ -131,7 +131,7 @@ impl fmt::Display for SubjectRef<'_> {
Self::BlankNode(node) => node.fmt(f),
Self::Triple(triple) => write!(
f,
"<< {} {} {} >>",
"<<{} {} {}>>",
triple.subject, triple.predicate, triple.object
),
}
@ -373,7 +373,7 @@ impl fmt::Display for TermRef<'_> {
Self::Triple(triple) => {
write!(
f,
"<< {} {} {} >>",
"<<{} {} {}>>",
triple.subject, triple.predicate, triple.object
)
}

@ -166,13 +166,13 @@ fn write_tsv_term<'a>(term: impl Into<TermRef<'a>>, sink: &mut impl Write) -> io
_ => sink.write_all(literal.to_string().as_bytes()),
},
TermRef::Triple(triple) => {
sink.write_all(b"<< ")?;
sink.write_all(b"<<")?;
write_tsv_term(&triple.subject, sink)?;
sink.write_all(b" ")?;
write_tsv_term(&triple.predicate, sink)?;
sink.write_all(b" ")?;
write_tsv_term(&triple.object, sink)?;
sink.write_all(b" >>")?;
sink.write_all(b">>")?;
Ok(())
}
}

Loading…
Cancel
Save