|
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 | 7 | models::{core::PeakList, enums::Unit}, |
8 | 8 | }; |
@@ -100,9 +100,6 @@ impl InsertIntoGraph for MeasurementAggregateDocument { |
100 | 100 | pub struct MeasurementDocument { |
101 | 101 | #[serde(rename = "measurement identifier")] |
102 | 102 | pub measurement_identifier: String, |
103 | | - // TO-DO: needs further definition to be integrated |
104 | | - // #[serde(rename = "chromatography column document")] |
105 | | - // pub chromatography_column_document: ChromatographyColumnDocument, |
106 | 103 | #[serde(rename = "device control aggregate document")] |
107 | 104 | pub device_control_aggregate_document: DeviceSystemDocument, |
108 | 105 | #[serde(rename = "sample document")] |
@@ -148,23 +145,6 @@ impl InsertIntoGraph for MeasurementDocument { |
148 | 145 | } |
149 | 146 | } |
150 | 147 |
|
151 | | -#[derive(Clone, Debug, Serialize, Deserialize)] |
152 | | -pub struct ChromatographyColumnDocument {} |
153 | | - |
154 | | -impl InsertIntoGraph for ChromatographyColumnDocument { |
155 | | - fn insert_into(&self, graph: &mut LightGraph, iri: SimpleTerm) -> anyhow::Result<()> { |
156 | | - for (pred, value) in |
157 | | - [(rdf::type_, &cat::ChromatographyColumnDocument.as_simple() as &dyn InsertIntoGraph)] |
158 | | - { |
159 | | - value.attach_into( |
160 | | - graph, |
161 | | - Link { source_iri: iri.clone(), pred: pred.as_simple(), target_iri: None }, |
162 | | - )?; |
163 | | - } |
164 | | - Ok(()) |
165 | | - } |
166 | | -} |
167 | | - |
168 | 148 | #[derive(Clone, Debug, Serialize, Deserialize)] |
169 | 149 | pub struct DeviceSystemDocument { |
170 | 150 | #[serde(alias = "device document", alias = "device control document")] |
@@ -215,9 +195,7 @@ pub struct DeviceDocument { |
215 | 195 | impl InsertIntoGraph for DeviceDocument { |
216 | 196 | fn get_uri(&self) -> SimpleTerm<'static> { |
217 | 197 | // build URI based on self.device_identifier |
218 | | - let mut uri = cat_resource::ns.clone().as_str().to_owned(); |
219 | | - uri.push_str(&hash_identifier(&self.device_identifier)); |
220 | | - IriRef::new_unchecked(uri).try_into_term().unwrap() |
| 198 | + generate_resource_identifier_uri(self.device_identifier.clone()) |
221 | 199 | } |
222 | 200 |
|
223 | 201 | fn insert_into(&self, graph: &mut LightGraph, iri: SimpleTerm) -> anyhow::Result<()> { |
@@ -296,6 +274,11 @@ pub struct AgilentProduct { |
296 | 274 | } |
297 | 275 |
|
298 | 276 | impl InsertIntoGraph for AgilentProduct { |
| 277 | + fn get_uri(&self) -> SimpleTerm<'static> { |
| 278 | + //same as in synth.rs set_product_uri function |
| 279 | + //same as in bravo.rs get_uri function for BravoProduct |
| 280 | + generate_resource_identifier_uri(self.product_identifier.clone()) |
| 281 | + } |
299 | 282 | fn insert_into(&self, graph: &mut LightGraph, iri: SimpleTerm) -> anyhow::Result<()> { |
300 | 283 | for (pred, value) in [ |
301 | 284 | (rdf::type_, &cat::Product.as_simple() as &dyn InsertIntoGraph), |
|
0 commit comments