Fixes some formatting

pull/10/head
Tpt 6 years ago
parent a77d08cf03
commit 81cae09eb5
  1. 2
      lib/src/rio/xml.rs
  2. 36
      lib/src/sparql/eval.rs
  3. 8
      lib/src/sparql/xml_results.rs
  4. 3
      lib/src/store/numeric_encoder.rs
  5. 2
      lib/tests/rdf_test_cases.rs
  6. 2
      lib/tests/sparql_test_cases.rs

@ -292,7 +292,7 @@ impl<R: BufRead> RdfXmlIterator<R> {
None => {
return Err(format_err!(
"No state in the stack: the XML is not balanced"
))
));
}
};

@ -487,37 +487,37 @@ impl<S: EncodedQuadsStore> SimpleEvaluator<S> {
EncodedTerm::NaiveDate(date) => Some(date.year().into()),
EncodedTerm::DateTime(date_time) => Some(date_time.year().into()),
EncodedTerm::NaiveDateTime(date_time) => Some(date_time.year().into()),
_ => None
_ => None,
},
PlanExpression::Month(e) => match self.eval_expression(e, tuple)? {
EncodedTerm::NaiveDate(date) => Some(date.month().into()),
EncodedTerm::DateTime(date_time) => Some(date_time.month().into()),
EncodedTerm::NaiveDateTime(date_time) => Some(date_time.month().into()),
_ => None
_ => None,
},
PlanExpression::Day(e) => match self.eval_expression(e, tuple)? {
EncodedTerm::NaiveDate(date) => Some(date.day().into()),
EncodedTerm::DateTime(date_time) => Some(date_time.day().into()),
EncodedTerm::NaiveDateTime(date_time) => Some(date_time.day().into()),
_ => None
_ => None,
},
PlanExpression::Hours(e) => match self.eval_expression(e, tuple)? {
EncodedTerm::NaiveTime(time) => Some(time.hour().into()),
EncodedTerm::DateTime(date_time) => Some(date_time.hour().into()),
EncodedTerm::NaiveDateTime(date_time) => Some(date_time.hour().into()),
_ => None
_ => None,
},
PlanExpression::Minutes(e) => match self.eval_expression(e, tuple)? {
EncodedTerm::NaiveTime(time) => Some(time.minute().into()),
EncodedTerm::DateTime(date_time) => Some(date_time.minute().into()),
EncodedTerm::NaiveDateTime(date_time) => Some(date_time.minute().into()),
_ => None
_ => None,
},
PlanExpression::Seconds(e) => match self.eval_expression(e, tuple)? {
EncodedTerm::NaiveTime(time) => Some(time.second().into()),
EncodedTerm::DateTime(date_time) => Some(date_time.second().into()),
EncodedTerm::NaiveDateTime(date_time) => Some(date_time.second().into()),
_ => None
_ => None,
},
PlanExpression::UUID() => Some(EncodedTerm::NamedNode {
iri_id: self
@ -963,26 +963,34 @@ impl<S: EncodedQuadsStore> SimpleEvaluator<S> {
EncodedTerm::DecimalLiteral(b) => a.partial_cmp(&b),
_ => None,
},
EncodedTerm::NaiveDate(a) => if let EncodedTerm::NaiveDate(ref b) = b {
EncodedTerm::NaiveDate(a) => {
if let EncodedTerm::NaiveDate(ref b) = b {
a.partial_cmp(b)
} else {
None
},
EncodedTerm::NaiveTime(a) => if let EncodedTerm::NaiveTime(ref b) = b {
}
}
EncodedTerm::NaiveTime(a) => {
if let EncodedTerm::NaiveTime(ref b) = b {
a.partial_cmp(b)
} else {
None
},
EncodedTerm::DateTime(a) => if let EncodedTerm::DateTime(ref b) = b {
}
}
EncodedTerm::DateTime(a) => {
if let EncodedTerm::DateTime(ref b) = b {
a.partial_cmp(b)
} else {
None
},
EncodedTerm::NaiveDateTime(a) => if let EncodedTerm::NaiveDateTime(ref b) = b {
}
}
EncodedTerm::NaiveDateTime(a) => {
if let EncodedTerm::NaiveDateTime(ref b) = b {
a.partial_cmp(b)
} else {
None
},
}
}
_ => None,
}
}

@ -104,7 +104,7 @@ pub fn write_xml_results<W: Write>(results: QueryResult<'_>, sink: W) -> Result<
QueryResult::Graph(_) => {
return Err(format_err!(
"Graphs could not be formatted to SPARQL query results XML format"
))
));
}
}
Ok(writer.into_inner())
@ -310,7 +310,7 @@ impl<R: BufRead> Iterator for ResultsIterator<R> {
None => {
return Some(Err(format_err!(
"No name attribute found for the <binding> tag"
)))
)));
}
}
state = State::Binding;
@ -386,7 +386,7 @@ impl<R: BufRead> Iterator for ResultsIterator<R> {
return Some(Err(format_err!(
"Unexpected textual value found: {}",
self.reader.decode(&data)
)))
)));
}
},
Err(error) => return Some(Err(error.into())),
@ -403,7 +403,7 @@ impl<R: BufRead> Iterator for ResultsIterator<R> {
return Some(Err(format_err!(
"No variable found for variable {}",
self.reader.decode(&var)
)))
)));
}
_ => return Some(Err(format_err!("No name found for <binding> tag"))),
}

@ -427,7 +427,8 @@ impl<R: Read> TermReader for R {
NaiveTime::from_num_seconds_from_midnight_opt(
self.read_u32::<LittleEndian>()?,
self.read_u32::<LittleEndian>()?,
).ok_or_else(|| format_err!("Invalid time serialization"))?,
)
.ok_or_else(|| format_err!("Invalid time serialization"))?,
)),
TYPE_DATE_TIME_LITERAL => Ok(EncodedTerm::DateTime(DateTime::from_utc(
NaiveDateTime::from_timestamp_opt(

@ -388,7 +388,7 @@ impl<'a> Iterator for TestManifest<'a> {
return Some(Err(format_err!(
"Invalid tests list. Got term {}",
term
)))
)));
}
None => (),
}

@ -591,7 +591,7 @@ impl<'a> Iterator for TestManifest<'a> {
return Some(Err(format_err!(
"action not found for test {}",
test_subject
)))
)));
}
};
let result = match self

Loading…
Cancel
Save