SPARQL XML results: do not panic on unknown variable

pull/171/head
Tpt 3 years ago
parent 0ba0e4e399
commit f23350dac8
  1. 8
      lib/src/sparql/xml_results.rs

@ -542,7 +542,13 @@ impl<R: BufRead> ResultsIterator<R> {
State::Result => return Ok(Some(new_bindings)), State::Result => return Ok(Some(new_bindings)),
State::Binding => { State::Binding => {
if let Some(var) = &current_var { if let Some(var) = &current_var {
new_bindings[self.mapping[var]] = term.take() if let Some(var) = self.mapping.get(var) {
new_bindings[*var] = term.take()
} else {
return Err(
invalid_data_error(format!("The variable '{}' is used in a binding but not declared in the variables list", self.reader.decode(&var).map_err(map_xml_error)?)).into()
);
}
} else { } else {
return Err( return Err(
invalid_data_error("No name found for <binding> tag").into() invalid_data_error("No name found for <binding> tag").into()

Loading…
Cancel
Save