|
1 | 1 | use crate::{ |
2 | 2 | graph::{ |
3 | 3 | insert_into::{InsertIntoGraph, Link}, |
4 | | - namespaces::{allodc, allores, allorole, cat, cat_resource, obo, purl, qb, qudt}, |
5 | | - utils::hash_identifier, |
| 4 | + namespaces::{allodc, allores, allorole, cat, obo, purl, qb, qudt}, |
| 5 | + utils::generate_resource_identifier_uri, |
6 | 6 | }, |
7 | | - models::{core::PeakList, enums::Unit}, |
| 7 | + models::{core::PeakList, enums::Unit} |
8 | 8 | }; |
9 | 9 |
|
10 | 10 | use serde::{Deserialize, Serialize}; |
@@ -195,9 +195,7 @@ pub struct DeviceDocument { |
195 | 195 | impl InsertIntoGraph for DeviceDocument { |
196 | 196 | fn get_uri(&self) -> SimpleTerm<'static> { |
197 | 197 | // build URI based on self.device_identifier |
198 | | - let mut uri = cat_resource::ns.clone().as_str().to_owned(); |
199 | | - uri.push_str(&hash_identifier(&self.device_identifier)); |
200 | | - IriRef::new_unchecked(uri).try_into_term().unwrap() |
| 198 | + generate_resource_identifier_uri(self.device_identifier.clone()) |
201 | 199 | } |
202 | 200 |
|
203 | 201 | fn insert_into(&self, graph: &mut LightGraph, iri: SimpleTerm) -> anyhow::Result<()> { |
@@ -279,9 +277,7 @@ impl InsertIntoGraph for AgilentProduct { |
279 | 277 | fn get_uri(&self) -> SimpleTerm<'static> { |
280 | 278 | //same as in synth.rs set_product_uri function |
281 | 279 | //same as in bravo.rs get_uri function for BravoProduct |
282 | | - let mut uri = cat_resource::ns.clone().as_str().to_owned(); |
283 | | - uri.push_str(&hash_identifier(&self.product_identifier)); |
284 | | - IriRef::new_unchecked(uri).try_into_term().unwrap() |
| 280 | + generate_resource_identifier_uri(self.product_identifier.clone()) |
285 | 281 | } |
286 | 282 | fn insert_into(&self, graph: &mut LightGraph, iri: SimpleTerm) -> anyhow::Result<()> { |
287 | 283 | for (pred, value) in [ |
|
0 commit comments