diff --git a/src/sparql/algebra.rs b/src/sparql/algebra.rs index bb46e6c8..e6c8d1d5 100644 --- a/src/sparql/algebra.rs +++ b/src/sparql/algebra.rs @@ -280,7 +280,8 @@ impl fmt::Display for Expression { Expression::DatatypeFunctionCall(e) => write!(f, "DATATYPE({})", e), Expression::BoundFunctionCall(v) => write!(f, "BOUND({})", v), Expression::IRIFunctionCall(e) => write!(f, "IRI({})", e), - Expression::BNodeFunctionCall(v) => v.as_ref() + Expression::BNodeFunctionCall(v) => v + .as_ref() .map(|id| write!(f, "BOUND({})", id)) .unwrap_or_else(|| write!(f, "BOUND()")), Expression::RandFunctionCall() => write!(f, "RAND()"), @@ -296,11 +297,13 @@ impl fmt::Display for Expression { .collect::>() .join(", ") ), - Expression::SubStrFunctionCall(a, b, c) => c.as_ref() + Expression::SubStrFunctionCall(a, b, c) => c + .as_ref() .map(|cv| write!(f, "SUBSTR({}, {}, {})", a, b, cv)) .unwrap_or_else(|| write!(f, "SUBSTR({}, {})", a, b)), Expression::StrLenFunctionCall(e) => write!(f, "STRLEN({})", e), - Expression::ReplaceFunctionCall(a, b, c, d) => d.as_ref() + Expression::ReplaceFunctionCall(a, b, c, d) => d + .as_ref() .map(|dv| write!(f, "REPLACE({}, {}, {}, {})", a, b, c, dv)) .unwrap_or_else(|| write!(f, "REPLACE({}, {}, {})", a, b, c)), Expression::UCaseFunctionCall(e) => write!(f, "UCASE({})", e), @@ -342,7 +345,8 @@ impl fmt::Display for Expression { Expression::IsBlankFunctionCall(e) => write!(f, "isBLANK({})", e), Expression::IsLiteralFunctionCall(e) => write!(f, "isLITERAL({})", e), Expression::IsNumericFunctionCall(e) => write!(f, "isNUMERIC({})", e), - Expression::RegexFunctionCall(a, b, c) => c.as_ref() + Expression::RegexFunctionCall(a, b, c) => c + .as_ref() .map(|cv| write!(f, "REGEX({}, {}, {})", a, b, cv)) .unwrap_or_else(|| write!(f, "REGEX({}, {})", a, b)), Expression::CustomFunctionCall(iri, args) => write!( @@ -471,7 +475,8 @@ impl<'a> fmt::Display for SparqlExpression<'a> { Expression::DatatypeFunctionCall(e) => write!(f, "DATATYPE({})", SparqlExpression(&*e)), Expression::BoundFunctionCall(v) => write!(f, "BOUND({})", v), Expression::IRIFunctionCall(e) => write!(f, "IRI({})", SparqlExpression(&*e)), - Expression::BNodeFunctionCall(v) => v.as_ref() + Expression::BNodeFunctionCall(v) => v + .as_ref() .map(|id| write!(f, "BOUND({})", SparqlExpression(&*id))) .unwrap_or_else(|| write!(f, "BOUND()")), Expression::RandFunctionCall() => write!(f, "RAND()"), @@ -487,7 +492,8 @@ impl<'a> fmt::Display for SparqlExpression<'a> { .collect::>() .join(", ") ), - Expression::SubStrFunctionCall(a, b, c) => c.as_ref() + Expression::SubStrFunctionCall(a, b, c) => c + .as_ref() .map(|cv| { write!( f, @@ -506,7 +512,8 @@ impl<'a> fmt::Display for SparqlExpression<'a> { ) }), Expression::StrLenFunctionCall(e) => write!(f, "STRLEN({})", SparqlExpression(&*e)), - Expression::ReplaceFunctionCall(a, b, c, d) => d.as_ref() + Expression::ReplaceFunctionCall(a, b, c, d) => d + .as_ref() .map(|dv| { write!( f, @@ -617,7 +624,8 @@ impl<'a> fmt::Display for SparqlExpression<'a> { Expression::IsNumericFunctionCall(e) => { write!(f, "isNUMERIC({})", SparqlExpression(&*e)) } - Expression::RegexFunctionCall(a, b, c) => c.as_ref() + Expression::RegexFunctionCall(a, b, c) => c + .as_ref() .map(|cv| { write!( f, diff --git a/src/store/memory.rs b/src/store/memory.rs index a6f8a206..880bbb4e 100644 --- a/src/store/memory.rs +++ b/src/store/memory.rs @@ -166,10 +166,12 @@ impl<'a> Iterator for ListIterator<'a> { fn next(&mut self) -> Option { match self.current_node.clone() { Some(current) => { - let result = self.graph + let result = self + .graph .object_for_subject_predicate(¤t, &rdf::FIRST)? .clone(); - self.current_node = match self.graph + self.current_node = match self + .graph .object_for_subject_predicate(¤t, &rdf::REST) { Some(Term::NamedNode(n)) if *n == *rdf::NIL => None, diff --git a/src/store/rocksdb/mod.rs b/src/store/rocksdb/mod.rs index 997ed34f..8112e142 100644 --- a/src/store/rocksdb/mod.rs +++ b/src/store/rocksdb/mod.rs @@ -40,12 +40,13 @@ impl RocksDbDataset { }) } - fn quads_for_subject( + pub fn quads_for_subject( &self, subject: &NamedOrBlankNode, ) -> Result>> { Ok(QuadsIterator { - iter: self.store + iter: self + .store .quads_for_subject(self.store.encoder().encode_named_or_blank_node(subject)?)?, encoder: self.store.encoder(), }) diff --git a/src/store/rocksdb/storage.rs b/src/store/rocksdb/storage.rs index 461b0e6d..67b89ba9 100644 --- a/src/store/rocksdb/storage.rs +++ b/src/store/rocksdb/storage.rs @@ -180,11 +180,13 @@ impl<'a> BytesStore for RocksDbBytesStore<'a> { match self.0.db.get_cf(self.0.str2id_cf, value)? { Some(id) => id_buffer.copy_from_slice(&id), None => { - let id = to_bytes(self.0 - .str_id_counter - .lock() - .unwrap() - .get_and_increment(&self.0.db)?); + let id = to_bytes( + self.0 + .str_id_counter + .lock() + .unwrap() + .get_and_increment(&self.0.db)?, + ); let mut batch = WriteBatch::default(); batch.put_cf(self.0.id2str_cf, &id, value)?; batch.put_cf(self.0.str2id_cf, value, &id)?; @@ -210,7 +212,8 @@ impl RocksDBCounter { } fn get_and_increment(&self, db: &DB) -> Result { - let value = db.get(self.name.as_bytes())? + let value = db + .get(self.name.as_bytes())? .map(|b| { let mut buf = [0 as u8; size_of::()]; buf.copy_from_slice(&b); diff --git a/tests/rdf_test_cases.rs b/tests/rdf_test_cases.rs index 6d6dfcef..4ed7f0ce 100644 --- a/tests/rdf_test_cases.rs +++ b/tests/rdf_test_cases.rs @@ -88,7 +88,8 @@ fn turtle_w3c_testsuite() { } } else if test.kind == "TestTurtleNegativeEval" { let action_graph = client.load_turtle(test.action.clone()); - let result_graph = test.result + let result_graph = test + .result .clone() .map(|r| client.load_turtle(r)) .unwrap_or_else(|| Ok(MemoryGraph::default())); @@ -272,7 +273,8 @@ impl<'a> Iterator for TestManifest<'a> { match self.tests_to_do.pop() { Some(Term::NamedNode(test_node)) => { let test_subject = NamedOrBlankNode::from(test_node.clone()); - let kind = match self.graph + let kind = match self + .graph .object_for_subject_predicate(&test_subject, &rdf::TYPE) { Some(Term::NamedNode(c)) => match c.value().split("#").last() { @@ -281,26 +283,30 @@ impl<'a> Iterator for TestManifest<'a> { }, _ => return Some(Err("no type".into())), }; - let name = match self.graph + let name = match self + .graph .object_for_subject_predicate(&test_subject, &mf::NAME) { Some(Term::Literal(c)) => Some(c.value().to_string()), _ => None, }; - let comment = match self.graph + let comment = match self + .graph .object_for_subject_predicate(&test_subject, &rdfs::COMMENT) { Some(Term::Literal(c)) => Some(c.value().to_string()), _ => None, }; - let action = match self.graph + let action = match self + .graph .object_for_subject_predicate(&test_subject, &*mf::ACTION) { Some(Term::NamedNode(n)) => n.url().clone(), Some(_) => return Some(Err("invalid action".into())), None => return Some(Err("action not found".into())), }; - let result = match self.graph + let result = match self + .graph .object_for_subject_predicate(&test_subject, &*mf::RESULT) { Some(Term::NamedNode(n)) => Some(n.url().clone()), @@ -327,7 +333,8 @@ impl<'a> Iterator for TestManifest<'a> { } // New manifests - match self.graph + match self + .graph .object_for_subject_predicate(&manifest, &*mf::INCLUDE) { Some(Term::BlankNode(list)) => { @@ -345,7 +352,8 @@ impl<'a> Iterator for TestManifest<'a> { } // New tests - match self.graph + match self + .graph .object_for_subject_predicate(&manifest, &*mf::ENTRIES) { Some(Term::BlankNode(list)) => {