pull/745/head
Yuri Astrakhan 11 months ago
parent 882984dd41
commit abbae9be5b
  1. 2
      lib/oxsdatatypes/src/date_time.rs
  2. 6
      lib/spargebra/src/parser.rs

@ -2308,7 +2308,7 @@ fn timezone_frag(input: &str) -> Result<(TimezoneOffset, &str), ParseDateTimeErr
Ok(( Ok((
TimezoneOffset::new(sign * (hours * 60 + i16::from(minutes))) TimezoneOffset::new(sign * (hours * 60 + i16::from(minutes)))
.map_err(|e| ParseDateTimeError::InvalidTimezone(e))?, .map_err(ParseDateTimeError::InvalidTimezone)?,
input, input,
)) ))
} }

@ -17,13 +17,13 @@ use std::str::FromStr;
/// Parses a SPARQL query with an optional base IRI to resolve relative IRIs in the query. /// Parses a SPARQL query with an optional base IRI to resolve relative IRIs in the query.
pub fn parse_query(query: &str, base_iri: Option<&str>) -> Result<Query, ParseError> { pub fn parse_query(query: &str, base_iri: Option<&str>) -> Result<Query, ParseError> {
let mut state = ParserState::from_base_iri(base_iri)?; let mut state = ParserState::from_base_iri(base_iri)?;
parser::QueryUnit(query, &mut state).map_err(|e| ParseError::Parser(e)) parser::QueryUnit(query, &mut state).map_err(ParseError::Parser)
} }
/// Parses a SPARQL update with an optional base IRI to resolve relative IRIs in the query. /// Parses a SPARQL update with an optional base IRI to resolve relative IRIs in the query.
pub fn parse_update(update: &str, base_iri: Option<&str>) -> Result<Update, ParseError> { pub fn parse_update(update: &str, base_iri: Option<&str>) -> Result<Update, ParseError> {
let mut state = ParserState::from_base_iri(base_iri)?; let mut state = ParserState::from_base_iri(base_iri)?;
let operations = parser::UpdateInit(update, &mut state).map_err(|e| ParseError::Parser(e))?; let operations = parser::UpdateInit(update, &mut state).map_err(ParseError::Parser)?;
Ok(Update { Ok(Update {
operations, operations,
base_iri: state.base_iri, base_iri: state.base_iri,
@ -667,7 +667,7 @@ impl ParserState {
pub(crate) fn from_base_iri(base_iri: Option<&str>) -> Result<Self, ParseError> { pub(crate) fn from_base_iri(base_iri: Option<&str>) -> Result<Self, ParseError> {
Ok(Self { Ok(Self {
base_iri: if let Some(base_iri) = base_iri { base_iri: if let Some(base_iri) = base_iri {
Some(Iri::parse(base_iri.to_owned()).map_err(|e| ParseError::InvalidBaseIri(e))?) Some(Iri::parse(base_iri.to_owned()).map_err(ParseError::InvalidBaseIri)?)
} else { } else {
None None
}, },

Loading…
Cancel
Save