diff --git a/python/src/sparql.rs b/python/src/sparql.rs index c331a810..a3bea873 100644 --- a/python/src/sparql.rs +++ b/python/src/sparql.rs @@ -3,7 +3,11 @@ use crate::map_storage_error; use crate::model::*; use oxigraph::model::Term; use oxigraph::sparql::*; -use pyo3::exceptions::{PyRuntimeError, PySyntaxError, PyTypeError, PyValueError}; +use pyo3::basic::CompareOp; +use pyo3::exceptions::{ + PyNotImplementedError, PyRuntimeError, PySyntaxError, PyTypeError, PyValueError, +}; + use pyo3::prelude::*; use std::vec::IntoIter; @@ -104,6 +108,16 @@ impl PyQuerySolution { buffer } + fn __richcmp__(&self, other: &Self, op: CompareOp) -> PyResult { + match op { + CompareOp::Eq => Ok(self.inner == other.inner), + CompareOp::Ne => Ok(self.inner != other.inner), + _ => Err(PyNotImplementedError::new_err( + "Ordering is not implemented", + )), + } + } + fn __len__(&self) -> usize { self.inner.len() }