Skip to content

Commit

Permalink
Formatted more files
Browse files Browse the repository at this point in the history
  • Loading branch information
labra committed Jun 7, 2024
1 parent 75a63d5 commit 140656a
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 42 deletions.
2 changes: 1 addition & 1 deletion dctap/src/dctap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::path::PathBuf;
use tracing::debug;

#[derive(Debug, Serialize, Deserialize)]
struct TapShapeId(String);
struct TapShapeId(String);

#[derive(Debug, Serialize)]
pub struct DCTap {
Expand Down
13 changes: 6 additions & 7 deletions dctap/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,15 @@
//! DCTAP (Dublin Core Tabular Application Profiles) is a simple model that can be used to specify data models
//!
pub mod dctap;
pub mod tap_config;
pub mod tap_error;
pub mod tap_statement;
pub mod tap_shape;
pub mod tap_config;
pub mod tap_statement;

pub use crate::tap_config::*;
pub use crate::tap_error::*;
pub use dctap::*;
pub use dctap::*;
pub use crate::tap_error::*;
pub use crate::tap_statement::*;
pub use crate::tap_shape::*;
pub use crate::tap_config::*;

pub use crate::tap_statement::*;
pub use dctap::*;
pub use dctap::*;
9 changes: 3 additions & 6 deletions dctap/src/tap_config.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
use serde_derive::{Deserialize, Serialize};

#[derive(Deserialize, Serialize, Debug, PartialEq, Clone)]
pub struct TapConfig {

}
pub struct TapConfig {}

impl Default for TapConfig {

fn default() -> Self {
Self { }
Self {}
}
}
}
3 changes: 1 addition & 2 deletions dctap/src/tap_error.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use thiserror::Error;

#[derive(Error, Debug)]
pub enum TapError { }

pub enum TapError {}
10 changes: 3 additions & 7 deletions dctap/src/tap_shape.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,8 @@ use crate::tap_statement::TapStatement;

#[derive(Deserialize, Serialize, Debug, PartialEq, Clone)]
pub struct TapShape {

#[serde(rename = "shapeID")]
shape_id: String,

statements: Vec<TapStatement>

shape_id: String,


}
statements: Vec<TapStatement>,
}
24 changes: 14 additions & 10 deletions shex_ast/src/ast/shape_expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ impl ShapeExpr {

pub fn or(ses: Vec<ShapeExpr>) -> ShapeExpr {
/*let shape_exprs = ses
.into_iter()
.map(|shape_expression| Box::new(shape_expression.into()))
.collect(); */
.into_iter()
.map(|shape_expression| Box::new(shape_expression.into()))
.collect(); */
let mut shape_exprs = Vec::new();
for se in ses {
shape_exprs.push(se.into())
Expand All @@ -113,9 +113,9 @@ impl ShapeExpr {

pub fn and(ses: Vec<ShapeExpr>) -> ShapeExpr {
/* let shape_exprs = ses
.into_iter()
.map(|shape_expression| Box::new(shape_expression.into()))
.collect(); */
.into_iter()
.map(|shape_expression| Box::new(shape_expression.into()))
.collect(); */
let mut shape_exprs = Vec::new();
for se in ses {
shape_exprs.push(se.into())
Expand Down Expand Up @@ -160,12 +160,16 @@ impl Deref for ShapeExpr {
ShapeExpr::External => Ok(ShapeExpr::External),
ShapeExpr::ShapeAnd { shape_exprs } => {
let shape_exprs = <ShapeExpr as Deref>::deref_vec(shape_exprs, base, prefixmap)?;
Ok(ShapeExpr::ShapeAnd { shape_exprs: shape_exprs.clone() })
},
Ok(ShapeExpr::ShapeAnd {
shape_exprs: shape_exprs.clone(),
})
}
ShapeExpr::ShapeOr { shape_exprs } => {
let shape_exprs = <ShapeExpr as Deref>::deref_vec(shape_exprs, base, prefixmap)?;
Ok(ShapeExpr::ShapeOr { shape_exprs: shape_exprs.clone() })
},
Ok(ShapeExpr::ShapeOr {
shape_exprs: shape_exprs.clone(),
})
}
ShapeExpr::ShapeNot { shape_expr } => {
let shape_expr = Box::new(shape_expr.deref(base, prefixmap)?);
Ok(ShapeExpr::ShapeNot { shape_expr })
Expand Down
9 changes: 3 additions & 6 deletions shex_ast/src/ast/value_set_value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -728,8 +728,7 @@ impl<'de> Deserialize<'de> for ValueSetValue {
}
None => Err(de::Error::missing_field("value")),
},
Some(ValueSetValueType::Integer) => {
match value {
Some(ValueSetValueType::Integer) => match value {
Some(s) => {
let n = isize::from_str(&s).map_err(|e| {
de::Error::custom(format!(
Expand All @@ -740,7 +739,7 @@ impl<'de> Deserialize<'de> for ValueSetValue {
Ok(v)
}
None => Err(de::Error::missing_field("value")),
}},
},
Some(ValueSetValueType::Other(iri)) => match value {
Some(v) => match language_tag {
Some(lang) => Ok(ValueSetValue::ObjectValue(ObjectValue::Literal(
Expand All @@ -749,9 +748,7 @@ impl<'de> Deserialize<'de> for ValueSetValue {
lang: Some(Lang::new(&lang)),
},
))),
None => {
Ok(ValueSetValue::datatype_literal(&v, &iri))
},
None => Ok(ValueSetValue::datatype_literal(&v, &iri)),
},
None => Err(de::Error::missing_field("value")),
},
Expand Down
7 changes: 4 additions & 3 deletions shex_testsuite/src/manifest_schemas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,13 @@ impl SchemasEntry {
}
})?;

let schema_serialized_after = serde_json::to_string_pretty(&schema_parsed_after_serialization).map_err(|e| {
let schema_serialized_after =
serde_json::to_string_pretty(&schema_parsed_after_serialization).map_err(|e| {
ManifestError::SchemaSerializationError2nd {
schema_parsed: schema_parsed_after_serialization.clone(),
error: e,
}
})?;
})?;

if schema_parsed == schema_parsed_after_serialization {
// If the 2 schemas are equal, parse the corresponding schema using ShExC and check that it is also equal
Expand Down Expand Up @@ -216,7 +217,7 @@ impl SchemasEntry {
schema_parsed,
schema_serialized: schema_serialized.clone(),
schema_parsed_after_serialization,
schema_serialized_after
schema_serialized_after,
})
}
}
Expand Down

0 comments on commit 140656a

Please sign in to comment.