Skip to content

Commit

Permalink
Rustfmt
Browse files Browse the repository at this point in the history
  • Loading branch information
magbak committed Dec 19, 2024
1 parent e06ee51 commit 24d879f
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 14 deletions.
5 changes: 4 additions & 1 deletion lib/maplib/src/mapping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,10 @@ impl Mapping {
self.get_triplestore(graph).truncate();
}

pub fn get_predicate_iris(&mut self, graph: &Option<NamedNode>) -> Result<Vec<NamedNode>, SparqlError> {
pub fn get_predicate_iris(
&mut self,
graph: &Option<NamedNode>,
) -> Result<Vec<NamedNode>, SparqlError> {
let triplestore = self.get_triplestore(graph);
Ok(triplestore.get_predicate_iris())
}
Expand Down
4 changes: 2 additions & 2 deletions lib/maplib/src/mapping/expansion/validation.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use crate::mapping::errors::MappingError;
use oxrdf::vocab::{rdfs};
use oxrdf::vocab::rdfs;
use polars::datatypes::DataType;
use polars::frame::DataFrame;
use polars::prelude::{Column};
use polars::prelude::Column;
use representation::polars_to_rdf::polars_type_to_literal_type;
use representation::{BaseRDFNodeType, RDFNodeType};
use std::collections::{HashMap, HashSet};
Expand Down
6 changes: 5 additions & 1 deletion lib/representation/src/multitype.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ use crate::solution_mapping::SolutionMappings;
use crate::{BaseRDFNodeType, RDFNodeType, LANG_STRING_LANG_FIELD, LANG_STRING_VALUE_FIELD};
use oxrdf::vocab::{rdf, xsd};
use polars::datatypes::PlSmallStr;
use polars::prelude::{as_struct, coalesce, col, lit, CategoricalOrdering, DataFrame, DataType, Expr, IntoLazy, JoinArgs, JoinType, LazyFrame, LazyGroupBy, LiteralValue, MaintainOrderJoin, UniqueKeepStrategy};
use polars::prelude::{
as_struct, coalesce, col, lit, CategoricalOrdering, DataFrame, DataType, Expr, IntoLazy,
JoinArgs, JoinType, LazyFrame, LazyGroupBy, LiteralValue, MaintainOrderJoin,
UniqueKeepStrategy,
};

use std::collections::{HashMap, HashSet};

Expand Down
1 change: 0 additions & 1 deletion lib/templates/src/compatible.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

// pub fn validate_compatible_ptypes(argument_ptype:&PType, signature_ptype:&PType) -> bool {
// match argument_ptype {
// PType::None => {
Expand Down
4 changes: 3 additions & 1 deletion lib/triplestore/src/indexing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,9 @@ fn update_at_offset(

fn create_sparse_map(ser: &Series, rdf_node_type: &RDFNodeType) -> BTreeMap<String, usize> {
let iri_ser = get_iri_ser(ser, rdf_node_type);
let iri_cat_ser = iri_ser.as_ref().map(|iri_ser| iri_ser.categorical().unwrap());
let iri_cat_ser = iri_ser
.as_ref()
.map(|iri_ser| iri_ser.categorical().unwrap());
let mut sparse_map = BTreeMap::new();
if let Some(iri_cat_ser) = iri_cat_ser {
let mut current_offset = 0;
Expand Down
5 changes: 2 additions & 3 deletions lib/triplestore/src/sparql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ use representation::rdf_to_polars::{
use representation::solution_mapping::{EagerSolutionMappings, SolutionMappings};
use representation::RDFNodeType;
use representation::{OBJECT_COL_NAME, SUBJECT_COL_NAME, VERB_COL_NAME};
use sparesults::QueryResultsSerializer;
use sparesults::QueryResultsFormat;
use sparesults::QueryResultsSerializer;
use spargebra::term::{NamedNodePattern, TermPattern, TriplePattern};
use spargebra::Query;
use std::collections::HashMap;
Expand All @@ -43,8 +43,7 @@ impl QueryResult {
variables,
solutions,
} = df_as_result(df.clone(), map);
let json_serializer =
QueryResultsSerializer::from_format(QueryResultsFormat::Json);
let json_serializer = QueryResultsSerializer::from_format(QueryResultsFormat::Json);
let mut buffer = vec![];
let mut serializer = json_serializer
.serialize_solutions_to_writer(&mut buffer, variables.clone())
Expand Down
3 changes: 2 additions & 1 deletion lib/triplestore/src/sparql/lazy_graph_patterns/triple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ impl Triplestore {
} else {
predicates = None;
}
let predicates: Option<Vec<_>> = predicates.map(|predicates| predicates.into_iter().collect());
let predicates: Option<Vec<_>> =
predicates.map(|predicates| predicates.into_iter().collect());
self.get_predicates_lf(
predicates,
&subject_rename,
Expand Down
12 changes: 8 additions & 4 deletions py_maplib/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ use representation::solution_mapping::EagerSolutionMappings;

#[cfg(not(target_os = "linux"))]
use mimalloc::MiMalloc;
use templates::MappingColumnType;
use templates::python::{a, py_triple, PyArgument, PyInstance, PyParameter, PyTemplate, PyXSD};
use templates::MappingColumnType;

#[cfg(target_os = "linux")]
#[global_allocator]
Expand Down Expand Up @@ -202,7 +202,7 @@ impl PyMapping {

let types = if let Some(types) = types {
let mut new_types = HashMap::new();
for (k,v) in types {
for (k, v) in types {
new_types.insert(k, MappingColumnType::Flat(v.as_rdf_node_type()));
}
Some(new_types)
Expand Down Expand Up @@ -540,7 +540,10 @@ impl PyMapping {

fn get_predicate_iris(&mut self, graph: Option<String>) -> PyResult<Vec<PyIRI>> {
let graph = parse_optional_graph(graph)?;
let nns = self.inner.get_predicate_iris(&graph).map_err(PyMaplibError::SparqlError)?;
let nns = self
.inner
.get_predicate_iris(&graph)
.map_err(PyMaplibError::SparqlError)?;
Ok(nns.into_iter().map(PyIRI::from).collect())
}

Expand All @@ -559,7 +562,8 @@ impl PyMapping {
for EagerSolutionMappings {
mappings,
rdf_node_types,
} in eager_sms {
} in eager_sms
{
let py_sm = df_to_py_df(mappings, rdf_node_types, None, true, py)?;
out.push(py_sm);
}
Expand Down

0 comments on commit 24d879f

Please sign in to comment.