diff --git a/lib/oxigraph/src/sparql/algebra.rs b/lib/oxigraph/src/sparql/algebra.rs index 41689904..8b3f385e 100644 --- a/lib/oxigraph/src/sparql/algebra.rs +++ b/lib/oxigraph/src/sparql/algebra.rs @@ -130,21 +130,7 @@ impl Update { update: &str, base_iri: Option<&str>, ) -> Result { - let update = spargebra::Update::parse(update, base_iri)?; - Ok(Self { - using_datasets: update - .operations - .iter() - .map(|operation| { - if let GraphUpdateOperation::DeleteInsert { using, .. } = operation { - Some(QueryDataset::from_algebra(using)) - } else { - None - } - }) - .collect(), - inner: update, - }) + Ok(spargebra::Update::parse(update, base_iri)?.into()) } /// Returns [the query dataset specification](https://www.w3.org/TR/sparql11-query/#specifyingDataset) in [DELETE/INSERT operations](https://www.w3.org/TR/sparql11-update/#deleteInsert). @@ -188,6 +174,25 @@ impl TryFrom<&String> for Update { } } +impl From for Update { + fn from(update: spargebra::Update) -> Self { + Self { + using_datasets: update + .operations + .iter() + .map(|operation| { + if let GraphUpdateOperation::DeleteInsert { using, .. } = operation { + Some(QueryDataset::from_algebra(using)) + } else { + None + } + }) + .collect(), + inner: update, + } + } +} + /// A SPARQL query [dataset specification](https://www.w3.org/TR/sparql11-query/#specifyingDataset) #[derive(Eq, PartialEq, Debug, Clone, Hash)] pub struct QueryDataset {