Adds some documentation about S-expressions serialization

pull/171/head
Tpt 3 years ago
parent 5f79c408bc
commit 0ed7319fd7
  1. 4
      spargebra/src/query.rs
  2. 4
      spargebra/src/update.rs

@ -8,12 +8,16 @@ use std::str::FromStr;
/// A parsed [SPARQL query](https://www.w3.org/TR/sparql11-query/)
///
/// The `Display` trait prints a serialization of the query using SPARQL syntax and
/// `Debug` prints the [SPARQL S-Expression syntax](https://jena.apache.org/documentation/notes/sse.html).
///
/// ```
/// use spargebra::Query;
///
/// let query_str = "SELECT ?s ?p ?o WHERE { ?s ?p ?o . }";
/// let query = Query::parse(query_str, None)?;
/// assert_eq!(query.to_string(), query_str);
/// assert_eq!(format!("{:?}", query), "(project (?s ?p ?o) (bgp (triple ?s ?p ?o)))");
/// # Result::Ok::<_, spargebra::ParseError>(())
/// ```
#[derive(Eq, PartialEq, Clone, Hash)]

@ -8,12 +8,16 @@ use std::str::FromStr;
/// A parsed [SPARQL update](https://www.w3.org/TR/sparql11-update/)
///
/// The `Display` trait prints a serialization of the update using SPARQL syntax and
/// `Debug` prints the [SPARQL S-Expression syntax](https://jena.apache.org/documentation/notes/sse.html).
///
/// ```
/// use spargebra::Update;
///
/// let update_str = "CLEAR ALL ;";
/// let update = Update::parse(update_str, None)?;
/// assert_eq!(update.to_string().trim(), update_str);
/// assert_eq!(format!("{:?}", update), "(update (clear all))");
/// # Result::Ok::<_, spargebra::ParseError>(())
/// ```
#[derive(Eq, PartialEq, Clone, Hash)]

Loading…
Cancel
Save