Skip to content

Commit

Permalink
Release 0.1.49
Browse files Browse the repository at this point in the history
  • Loading branch information
labra committed Oct 30, 2024
1 parent 4c45590 commit c59c1b1
Show file tree
Hide file tree
Showing 14 changed files with 77 additions and 17 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

## Current changes without release yet

## [v0.1.49] - 2025-10-30

- Implemented Display for ShapeMap, ShEx-schema and SHACL-schema
- Added `__repr__` to ShapeMap, ShExSchema and SHACLSchema
- Added `update_config` to rudof and pyrudof

## [v0.1.48] - 2025-10-29

- Minor release to force re-publication
Expand Down
2 changes: 1 addition & 1 deletion python/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pyrudof"
version = "0.1.48"
version = "0.1.49"
documentation = "https://rudof-project.github.io/rudof/"
readme = "README.md"
license.workspace = true
Expand Down
34 changes: 25 additions & 9 deletions python/src/pyrudof_lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ impl PyRudof {
})
}

pub fn update_config(&mut self, config: &PyRudofConfig) {
self.inner.update_config(&config.inner)
}

/// Obtain the version of the Rudof library
#[pyo3(signature = ())]
pub fn version(&self) -> PyResult<String> {
Expand Down Expand Up @@ -92,14 +96,14 @@ impl PyRudof {
#[pyo3(signature = ())]
pub fn get_dctap(&self) -> Option<PyDCTAP> {
let dctap = self.inner.get_dctap();
dctap.map(|s| PyDCTAP { _inner: s.clone() })
dctap.map(|s| PyDCTAP { inner: s.clone() })
}

/// Obtains the current ShEx Schema
#[pyo3(signature = ())]
pub fn get_shex(&self) -> Option<PyShExSchema> {
let shex_schema = self.inner.get_shex();
shex_schema.map(|s| PyShExSchema { _inner: s.clone() })
shex_schema.map(|s| PyShExSchema { inner: s.clone() })
}

/// Obtains the current Shapemap
Expand Down Expand Up @@ -487,6 +491,7 @@ impl PyShExFormatter {
}
}

/// Defines how to format a ShapeMap
#[pyclass(frozen, name = "ShapeMapFormatter")]
pub struct PyShapeMapFormatter {
inner: ShapeMapFormatter,
Expand Down Expand Up @@ -541,17 +546,25 @@ impl PyUmlGenerationMode {

#[pyclass(name = "ShExSchema")]
pub struct PyShExSchema {
_inner: ShExSchema,
inner: ShExSchema,
}

impl PyShExSchema {}
impl PyShExSchema {
pub fn __repr__(&self) -> String {
format!("{}", self.inner)
}
}

#[pyclass(name = "DCTAP")]
pub struct PyDCTAP {
_inner: DCTAP,
inner: DCTAP,
}

impl PyDCTAP {}
impl PyDCTAP {
pub fn __repr__(&self) -> String {
format!("{}", self.inner)
}
}

#[pyclass(name = "QueryShapeMap")]
pub struct PyQueryShapeMap {
Expand All @@ -563,6 +576,10 @@ impl PyQueryShapeMap {
let result = &self.inner;
format!("{result:?}")
}

fn __repr__(&self) -> String {
format!("{}", self.inner)
}
}

#[pyclass(name = "ShaclSchema")]
Expand All @@ -571,9 +588,8 @@ pub struct PyShaclSchema {
}

impl PyShaclSchema {
pub fn serialize(&self, _format: &ShaclFormat) -> String {
let result = &self.inner;
format!("{result:?}")
pub fn __repr__(&self) -> String {
format!("{}", self.inner)
}
}

Expand Down
2 changes: 1 addition & 1 deletion rudof_lib/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rudof_lib"
version = "0.1.48"
version = "0.1.49"
authors.workspace = true
description.workspace = true
documentation = "https://docs.rs/rudof_lib"
Expand Down
4 changes: 4 additions & 0 deletions rudof_lib/src/rudof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ impl Rudof {
}
}

pub fn update_config(&mut self, config: &RudofConfig) {
self.config = config.clone();
}

/// Resets the current RDF Data
pub fn reset_data(&mut self) {
self.rdf_data = RdfData::new()
Expand Down
2 changes: 1 addition & 1 deletion shacl_ast/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "shacl_ast"
version = "0.1.35"
version = "0.1.49"
authors.workspace = true
description.workspace = true
documentation = "https://docs.rs/shacl_ast"
Expand Down
10 changes: 10 additions & 0 deletions shacl_ast/src/ast/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@ impl Schema {
}
}

/*impl Display for Schema {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(
f,
"{}",
serde_json::to_string_pretty(&self).map_err(|_| std::fmt::Error)?
)
}
}*/

impl Display for Schema {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
for (id, shape) in self.shapes.iter() {
Expand Down
2 changes: 1 addition & 1 deletion shacl_validation/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "shacl_validation"
version = "0.1.38"
version = "0.1.49"
readme = "README.md"
license.workspace = true
authors.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion shapemap/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "shapemap"
version = "0.1.39"
version = "0.1.49"
authors.workspace = true
description.workspace = true
documentation = "https://docs.rs/shapemap"
Expand Down
12 changes: 12 additions & 0 deletions shapemap/src/query_shape_map.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use std::fmt::Display;

use crate::{Association, NodeSelector, ShapeSelector};
use prefixmap::PrefixMap;
use serde_derive::Serialize;
Expand Down Expand Up @@ -53,3 +55,13 @@ impl QueryShapeMap {
self.iter().flat_map(|assoc| assoc.iter_node_shape(rdf))
}
}

impl Display for QueryShapeMap {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(
f,
"{}",
serde_json::to_string_pretty(&self).map_err(|_| std::fmt::Error)?
)
}
}
2 changes: 1 addition & 1 deletion shex_ast/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "shex_ast"
version = "0.1.39"
version = "0.1.49"
authors.workspace = true
description.workspace = true
documentation = "https://docs.rs/shex_ast"
Expand Down
12 changes: 12 additions & 0 deletions shex_ast/src/ast/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use crate::ShapeExprLabel;
use iri_s::IriS;
use prefixmap::{IriRef, PrefixMap, PrefixMapError};
use serde_derive::{Deserialize, Serialize};
use std::fmt::Display;
use std::path::{Path, PathBuf};
use std::{fs, io};
use tracing::debug;
Expand Down Expand Up @@ -277,6 +278,17 @@ impl Default for Schema {
}
}

impl Display for Schema {
// TODO: Improve
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(
f,
"{}",
serde_json::to_string_pretty(&self).map_err(|_| std::fmt::Error)?
)
}
}

#[cfg(test)]
mod tests {

Expand Down
2 changes: 1 addition & 1 deletion sparql_service/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "sparql_service"
version = "0.1.38"
version = "0.1.49"
authors.workspace = true
description.workspace = true
edition.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion srdf/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "srdf"
version = "0.1.45"
version = "0.1.49"
authors.workspace = true
description.workspace = true
documentation = "https://docs.rs/srdf"
Expand Down

0 comments on commit c59c1b1

Please sign in to comment.