Skip to content

Commit ca541ec

Browse files
committed
fixing location handling
1 parent 7f41ea9 commit ca541ec

File tree

4 files changed

+17
-14
lines changed

4 files changed

+17
-14
lines changed

Cargo.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ members = [
77
resolver = "2"
88

99
[workspace.package]
10-
version = "0.3.0"
10+
version = "0.3.1-a1"
1111
authors = ["Gabe Fierro <[email protected]>"]
1212
license = "BSD-3-Clause"
1313
edition = "2021"
@@ -35,7 +35,7 @@ clap = { version = "4.4.18", features = ["derive"] }
3535
derive_builder = "0.20"
3636
oxigraph = "0.4.11"
3737

38-
ontoenv = { version = "0.3.0", path = "lib" }
38+
ontoenv = { version = "0.3.1-a1", path = "lib" }
3939

4040
[profile.profiling]
4141
inherits = "release"

lib/src/io.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,8 @@ fn add_ontology_to_store(
5858
location.as_str(),
5959
now.elapsed()
6060
);
61-
let temp_graph_id = GraphIdentifier::new(temp_graph_name.as_ref());
62-
let ontology = Ontology::from_store(store, &temp_graph_id, strict)?;
63-
64-
// The location is incorrectly parsed from the temp graph id, so we set it from the original
65-
// location here by round-tripping through JSON.
66-
let mut ont_json = serde_json::to_value(&ontology)?;
67-
ont_json["location"] = serde_json::to_value(&location)?;
68-
let mut ontology: Ontology = serde_json::from_value(ont_json)?;
61+
let temp_graph_id = GraphIdentifier::new_with_location(temp_graph_name.as_ref(), location);
62+
let mut ontology = Ontology::from_store(store, &temp_graph_id, strict)?;
6963

7064
debug!("Adding ontology: {}", ontology.id());
7165
ontology.with_last_updated(Utc::now());

lib/src/ontology.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,15 @@ impl GraphIdentifier {
8080
name: name.into(),
8181
}
8282
}
83+
pub fn new_with_location(
84+
name: NamedNodeRef,
85+
location: OntologyLocation,
86+
) -> Self {
87+
GraphIdentifier {
88+
location,
89+
name: name.into(),
90+
}
91+
}
8392
pub fn location(&self) -> &OntologyLocation {
8493
&self.location
8594
}
@@ -456,7 +465,7 @@ impl Ontology {
456465
}
457466

458467
info!(
459-
"1Fetched graph {ontology_subject} from location: {location:?}"
468+
"Fetched graph {ontology_subject} from location: {location:?}"
460469
);
461470

462471
let ontology_name: NamedNode = match ontology_subject {

0 commit comments

Comments
 (0)