Skip to content

Commit

Permalink
build(deps): bump sophia from 0.7.2 to 0.8.0 (#118)
Browse files Browse the repository at this point in the history
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Christian Kleinbölting <[email protected]>
Co-authored-by: Balduin Landolt <[email protected]>
  • Loading branch information
3 people authored Aug 13, 2024
1 parent e272c98 commit 63a3d1b
Show file tree
Hide file tree
Showing 6 changed files with 114 additions and 133 deletions.
127 changes: 60 additions & 67 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dsp-meta/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ serde_yaml.workspace = true
nonempty.workspace = true
valico.workspace = true
regex.workspace = true
sophia = "0.7.2"
sophia = "0.8.0"
tokio.workspace = true
tower.workspace = true
tower-http.workspace = true
Expand Down
10 changes: 2 additions & 8 deletions dsp-meta/src/api/convert/rdf/error.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
use crate::error::DspMetaError;

impl From<sophia::iri::error::InvalidIri> for DspMetaError {
fn from(error: sophia::iri::error::InvalidIri) -> Self {
impl From<sophia::iri::InvalidIri> for DspMetaError {
fn from(error: sophia::iri::InvalidIri) -> Self {
DspMetaError::SerializeToRdf(error.0)
}
}

impl From<sophia::term::TermError> for DspMetaError {
fn from(error: sophia::term::TermError) -> Self {
DspMetaError::SerializeToRdf(error.to_string())
}
}
24 changes: 14 additions & 10 deletions dsp-meta/src/api/convert/rdf/project.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// placeholder for project

use dsp_domain::metadata::entity::project::Project;
use sophia::graph::inmem::LightGraph;
use sophia::graph::{Graph, MutableGraph};
use sophia::ns::{rdf, Namespace};
use sophia::term::SimpleIri;
use sophia::api::graph::{Graph, MutableGraph};
use sophia::api::ns::{rdf, Namespace};
use sophia::inmem::graph::LightGraph;
use sophia::iri::Iri;

use crate::api::convert::rdf::constance::DSP_NAMESPACE_STRING;
use crate::api::convert::rdf::value::shortcode::ShortcodeGraphDto;
Expand All @@ -15,17 +15,21 @@ impl ProjectGraphDto {
let mut graph = LightGraph::new();

// http://ns.dasch.swiss/repository#dsp-081C-project a http://ns.dasch.swiss/repository#Project
let dsp = Namespace::new_unchecked(DSP_NAMESPACE_STRING);
let project_iri_suffix = format!("dsp-{}-project", self.0.shortcode.0);
let project_iri = SimpleIri::new_unchecked(dsp.as_ref(), Some(project_iri_suffix.as_str()));
let project_class = SimpleIri::new_unchecked(dsp.as_ref(), Some("Project"));
let ns = Namespace::new_unchecked(DSP_NAMESPACE_STRING);

let shortcode_graph = ShortcodeGraphDto(&self.0.shortcode).to_graph(&project_iri);
let project_iri = ns
.get(format!("{}dsp-{}-project", ns.as_str(), self.0.shortcode.0).as_str())
.expect("project_iri creation failed.")
.to_string();
let project_iri = Iri::new(project_iri).expect("project_iri creation failed.");

let project_class = ns.get("Project").expect("project_class creation failed.");

graph
.insert(&project_iri, &rdf::type_, &project_class)
.insert(&project_iri, rdf::type_, project_class)
.expect("insert of project triples into graph failed.");

let shortcode_graph = ShortcodeGraphDto(&self.0.shortcode).to_graph(&project_iri);
graph
.insert_all(shortcode_graph.triples())
.expect("insert of project triples into graph failed.");
Expand Down
Loading

0 comments on commit 63a3d1b

Please sign in to comment.