Page MenuHomeDevCentral

Transform sparql module from fantoir-datasource in standalone crate

Authored By
dereckson
Jan 14 2023, 19:02
Size
813 B
Referenced Files
None
Subscribers
None

Transform sparql module from fantoir-datasource in standalone crate

impl SparqlResults {
pub fn into_bool (self) -> Option<bool> {
match self {
SparqlResults::Solutions(_) => None,
SparqlResults::Boolean(bool) => Some(bool),
}
}
}
/* -------------------------------------------------------------
Tests
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#[cfg(test)]
mod tests {
use super::*;
#[test]
pub fn test_parse_boolean_results () {
let boolean_results = r#"
<?xml version="1.0"?>
<sparql xmlns="http://www.w3.org/2005/sparql-results#">
<head />
<boolean>true</boolean>
</sparql>
"#;
let results = parse_sparql_results(boolean_results);
let actual = results.into_bool();
assert!(actual.is_some());
assert!(actual.unwrap());
}
}

File Metadata

Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1324677
Default Alt Text
Transform sparql module from fantoir-datasource in standalone crate (813 B)

Event Timeline