Skip to content
This repository was archived by the owner on Sep 9, 2025. It is now read-only.

Commit 5e3bb09

Browse files
committed
fix: update tests and format
1 parent 989d3eb commit 5e3bb09

File tree

7 files changed

+364
-343
lines changed

7 files changed

+364
-343
lines changed

src/catplus-common/src/graph/utils.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1+
use crate::graph::namespaces::cat_resource;
12
use base64::{engine::general_purpose, Engine as _};
23
use sha2::{Digest, Sha256};
34
use sophia_api::{
45
prelude::*,
56
term::{bnode_id::BnodeId, SimpleTerm},
67
};
78
use uuid::Uuid;
8-
use crate::graph::namespaces::cat_resource;
99

1010
pub fn generate_bnode_term() -> SimpleTerm<'static> {
1111
let identifier = Uuid::new_v4().to_string();
@@ -26,4 +26,4 @@ pub fn generate_resource_identifier_uri(resource_id: String) -> SimpleTerm<'stat
2626
let mut uri = cat_resource::ns.clone().as_str().to_owned();
2727
uri.push_str(&hash_identifier(&resource_id));
2828
IriRef::new_unchecked(uri).try_into_term().expect("Failed to convert to SimpleTerm")
29-
}
29+
}

src/catplus-common/src/models/agilent.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use crate::{
44
namespaces::{allodc, allores, allorole, cat, obo, purl, qb, qudt},
55
utils::generate_resource_identifier_uri,
66
},
7-
models::{core::PeakList, enums::Unit}
7+
models::{core::PeakList, enums::Unit},
88
};
99

1010
use serde::{Deserialize, Serialize};

src/catplus-common/src/models/synth.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ impl InsertIntoGraph for SynthBatch {
4141
fn get_uri(&self) -> SimpleTerm<'static> {
4242
// build URI based on self.batch_id
4343
generate_resource_identifier_uri(self.batch_id.clone())
44-
}
44+
}
4545

4646
fn insert_into(&self, graph: &mut LightGraph, iri: SimpleTerm) -> anyhow::Result<()> {
4747
for (pred, value) in [

src/converter/tests/agilent_tests.rs

Lines changed: 101 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -43,108 +43,113 @@ fn test_convert_liquid_chromatography() {
4343
PREFIX obo: <http://purl.obolibrary.org/obo/>
4444
4545
<http://example.org/cat/resource/47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU> a allores:AFR_0002567;
46-
allores:AFR_0001119 "DEAC617961";
47-
allores:AFR_0001258 "Agilent";
48-
allores:AFR_0001259 "D.07.38 [0001]";
49-
allores:AFR_0002018 "";
50-
allores:AFR_0002534 "single channel";
51-
allores:AFR_0002568 "Diode array uv detector";
52-
obo:IAO_0000017 "G7115A".
46+
allores:AFR_0001119 "DEAC617961";
47+
allores:AFR_0001258 "Agilent";
48+
allores:AFR_0001259 "D.07.38 [0001]";
49+
allores:AFR_0002018 "";
50+
allores:AFR_0002534 "single channel";
51+
allores:AFR_0002568 "Diode array uv detector";
52+
obo:IAO_0000017 "G7115A".
53+
54+
<http://example.org/cat/resource/EGV7KYAZCZbQwnVVj8yarORbBat6AJfbh09GfG37xAQ> a cat:Product;
55+
purl:identifier "1-4 PYRIDYL PIPERAZINE-2024-04-12 10-23-04+02-00-20.dx".
5356
5457
[] a allores:AFR_0002524;
55-
cat:hasLiquidChromatography [ a allores:AFR_0002525;
56-
allores:AFR_0001116 "Swisscat (swisscat)";
57-
allores:AFR_0002374 [ a allores:AFR_0002375;
58-
allores:AFR_0001121 "DAD1A";
59-
allores:AFR_0002083 [ a cat:SampleDocument;
60-
cat:hasProduct [ a cat:Product;
61-
purl:identifier "1-4 PYRIDYL PIPERAZINE-2024-04-12 10-23-04+02-00-20.dx"];
62-
allores:AFR_0001118 "0659d110-49d0-4e98-8f3a-1aaf9c4ec0d9"];
63-
allores:AFR_0002526 [ a cat:DeviceSystemDocument;
64-
allores:AFR_0002722 <http://example.org/cat/resource/47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU>];
65-
allores:AFR_0002529 [ a cat:InjectionDocument;
66-
allores:AFR_0001267 [ a cat:AutosamplerInjectionVolumeSetting;
67-
qudt:unit unit:MilliM3;
68-
qudt:value "5"^^xsd:double];
69-
allores:AFR_0002535 "2024-04-12 10-23-04+02-00-20.dx";
70-
allores:AFR_0002536 "2024-04-12T08:23:47.113+00:00"^^xsd:dateTime];
71-
allores:AFR_0002534 "single channel";
72-
allores:AFR_0002550 [ a cat:ChromatogramDataCube;
73-
allores:AFR_0000917 "DAD1A";
74-
obo:IAO_0000009 "DAD1A,Sig=215,4 Ref=off";
75-
qb:structure [ a cat:CubeStructure;
76-
cat:dimension [ a cat:Dimension;
77-
allodc:componentDataType "double";
78-
qudt:unit unit:SEC;
79-
<http://www.w3.org/2000/01/rdf-schema#label> "retention time"];
80-
cat:measure [ a allorole:AFRL_0000157;
81-
allodc:componentDataType "double";
82-
qudt:unit qudtext:MilliAbsorbanceUnit;
83-
<http://www.w3.org/2000/01/rdf-schema#label> "absorbance"]]];
84-
allores:AFR_0002659 [ a cat:ProcessedDataDocument;
85-
allores:AFR_0000432 [ a cat:PeakList;
86-
cat:Peak [ a allores:AFR_0000413;
87-
allores:AFR_0000948 [ a cat:Measurement;
88-
qudt:unit qudtext:MilliAbsorbanceUnit;
89-
qudt:value "3058.31"^^xsd:double];
90-
allores:AFR_0000949 [ a cat:Measurement;
91-
qudt:unit unit:PERCENT;
92-
qudt:value "100"^^xsd:double];
93-
allores:AFR_0001073 [ a cat:Measurement;
94-
qudt:unit qudtext:MilliAbsorbanceUnitTimesSecond;
95-
qudt:value "34034.5"^^xsd:double];
96-
allores:AFR_0001089 [ a cat:Measurement;
97-
qudt:unit unit:MIN;
98-
qudt:value "1.19008"^^xsd:double];
99-
allores:AFR_0001164 "f81b4bcb-4d4a-41c7-8b34-5610e940d3ca";
100-
allores:AFR_0001165 [ a cat:Measurement;
101-
qudt:unit unit:PERCENT;
102-
qudt:value "100"^^xsd:double];
103-
allores:AFR_0001178 [ a cat:Measurement;
104-
qudt:unit unit:MIN;
105-
qudt:value "0.984987"^^xsd:double];
106-
allores:AFR_0001179 [ a cat:Measurement;
107-
qudt:unit qudtext:MilliAbsorbanceUnit;
108-
qudt:value "-169.679"^^xsd:double];
109-
allores:AFR_0001180 [ a cat:Measurement;
110-
qudt:unit unit:MIN;
111-
qudt:value "1.68996"^^xsd:double];
112-
allores:AFR_0001181 [ a cat:Measurement;
113-
qudt:unit qudtext:MilliAbsorbanceUnit;
114-
qudt:value "-183.143"^^xsd:double]]]]],
58+
cat:hasLiquidChromatography [ a allores:AFR_0002525;
59+
allores:AFR_0001116 "Swisscat (swisscat)";
60+
allores:AFR_0002374 [ a allores:AFR_0002375;
61+
allores:AFR_0001121 "DAD1B";
62+
allores:AFR_0002083 [ a cat:SampleDocument;
63+
cat:hasProduct <http://example.org/cat/resource/EGV7KYAZCZbQwnVVj8yarORbBat6AJfbh09GfG37xAQ>;
64+
allores:AFR_0001118 "0659d110-49d0-4e98-8f3a-1aaf9c4ec0d9"];
65+
allores:AFR_0002526 [ a cat:DeviceSystemDocument;
66+
allores:AFR_0002722 <http://example.org/cat/resource/47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU>];
67+
allores:AFR_0002529 [ a cat:InjectionDocument;
68+
allores:AFR_0001267 [ a cat:AutosamplerInjectionVolumeSetting;
69+
qudt:unit unit:MilliM3;
70+
qudt:value "5"^^xsd:double];
71+
allores:AFR_0002535 "2024-04-12 10-23-04+02-00-20.dx";
72+
allores:AFR_0002536 "2024-04-12T08:23:47.113+00:00"^^xsd:dateTime];
73+
allores:AFR_0002534 "single channel";
74+
allores:AFR_0002550 [ a cat:ChromatogramDataCube;
75+
allores:AFR_0000917 "DAD1B";
76+
obo:IAO_0000009 "DAD1B,Sig=254,4 Ref=off";
77+
qb:structure [ a cat:CubeStructure;
78+
cat:dimension [ a cat:Dimension;
79+
allodc:componentDataType "double";
80+
qudt:unit unit:SEC;
81+
<http://www.w3.org/2000/01/rdf-schema#label> "retention time"];
82+
cat:measure [ a allorole:AFRL_0000157;
83+
allodc:componentDataType "double";
84+
qudt:unit qudtext:MilliAbsorbanceUnit;
85+
<http://www.w3.org/2000/01/rdf-schema#label> "absorbance"]]];
86+
allores:AFR_0002659 [ a cat:ProcessedDataDocument;
87+
allores:AFR_0000432 [ a cat:PeakList;
88+
cat:hasProduct <http://example.org/cat/resource/EGV7KYAZCZbQwnVVj8yarORbBat6AJfbh09GfG37xAQ>]]],
11589
[ a allores:AFR_0002375;
116-
allores:AFR_0001121 "DAD1B";
117-
allores:AFR_0002083 [ a cat:SampleDocument;
118-
cat:hasProduct [ a cat:Product;
119-
purl:identifier "1-4 PYRIDYL PIPERAZINE-2024-04-12 10-23-04+02-00-20.dx"];
120-
allores:AFR_0001118 "0659d110-49d0-4e98-8f3a-1aaf9c4ec0d9"];
121-
allores:AFR_0002526 [ a cat:DeviceSystemDocument;
122-
allores:AFR_0002722 <http://example.org/cat/resource/47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU>];
123-
allores:AFR_0002529 [ a cat:InjectionDocument;
124-
allores:AFR_0001267 [ a cat:AutosamplerInjectionVolumeSetting;
125-
qudt:unit unit:MilliM3;
126-
qudt:value "5"^^xsd:double];
127-
allores:AFR_0002535 "2024-04-12 10-23-04+02-00-20.dx";
128-
allores:AFR_0002536 "2024-04-12T08:23:47.113+00:00"^^xsd:dateTime];
129-
allores:AFR_0002534 "single channel";
130-
allores:AFR_0002550 [ a cat:ChromatogramDataCube;
131-
allores:AFR_0000917 "DAD1B";
132-
obo:IAO_0000009 "DAD1B,Sig=254,4 Ref=off";
133-
qb:structure [ a cat:CubeStructure;
134-
cat:dimension [ a cat:Dimension;
135-
allodc:componentDataType "double";
136-
qudt:unit unit:SEC;
137-
<http://www.w3.org/2000/01/rdf-schema#label> "retention time"];
138-
cat:measure [ a allorole:AFRL_0000157;
139-
allodc:componentDataType "double";
140-
qudt:unit qudtext:MilliAbsorbanceUnit;
141-
<http://www.w3.org/2000/01/rdf-schema#label> "absorbance"]]];
142-
allores:AFR_0002659 [ a cat:ProcessedDataDocument;
143-
allores:AFR_0000432 [ a cat:PeakList]]]];
144-
schema:contentUrl "http://example.org/test/../../data/tests/agilent_liquid_chromatography_aggregate_document.json".
90+
allores:AFR_0001121 "DAD1A";
91+
allores:AFR_0002083 [ a cat:SampleDocument;
92+
cat:hasProduct <http://example.org/cat/resource/EGV7KYAZCZbQwnVVj8yarORbBat6AJfbh09GfG37xAQ>;
93+
allores:AFR_0001118 "0659d110-49d0-4e98-8f3a-1aaf9c4ec0d9"];
94+
allores:AFR_0002526 [ a cat:DeviceSystemDocument;
95+
allores:AFR_0002722 <http://example.org/cat/resource/47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU>];
96+
allores:AFR_0002529 [ a cat:InjectionDocument;
97+
allores:AFR_0001267 [ a cat:AutosamplerInjectionVolumeSetting;
98+
qudt:unit unit:MilliM3;
99+
qudt:value "5"^^xsd:double];
100+
allores:AFR_0002535 "2024-04-12 10-23-04+02-00-20.dx";
101+
allores:AFR_0002536 "2024-04-12T08:23:47.113+00:00"^^xsd:dateTime];
102+
allores:AFR_0002534 "single channel";
103+
allores:AFR_0002550 [ a cat:ChromatogramDataCube;
104+
allores:AFR_0000917 "DAD1A";
105+
obo:IAO_0000009 "DAD1A,Sig=215,4 Ref=off";
106+
qb:structure [ a cat:CubeStructure;
107+
cat:dimension [ a cat:Dimension;
108+
allodc:componentDataType "double";
109+
qudt:unit unit:SEC;
110+
<http://www.w3.org/2000/01/rdf-schema#label> "retention time"];
111+
cat:measure [ a allorole:AFRL_0000157;
112+
allodc:componentDataType "double";
113+
qudt:unit qudtext:MilliAbsorbanceUnit;
114+
<http://www.w3.org/2000/01/rdf-schema#label> "absorbance"]]];
115+
allores:AFR_0002659 [ a cat:ProcessedDataDocument;
116+
allores:AFR_0000432 [ a cat:PeakList;
117+
cat:hasProduct <http://example.org/cat/resource/EGV7KYAZCZbQwnVVj8yarORbBat6AJfbh09GfG37xAQ>;
118+
cat:peak [ a allores:AFR_0000413;
119+
allores:AFR_0000948 [ a cat:Measurement;
120+
qudt:unit qudtext:MilliAbsorbanceUnit;
121+
qudt:value "3058.31"^^xsd:double];
122+
allores:AFR_0000949 [ a cat:Measurement;
123+
qudt:unit unit:PERCENT;
124+
qudt:value "100"^^xsd:double];
125+
allores:AFR_0001073 [ a cat:Measurement;
126+
qudt:unit qudtext:MilliAbsorbanceUnitTimesSecond;
127+
qudt:value "34034.5"^^xsd:double];
128+
allores:AFR_0001089 [ a cat:Measurement;
129+
qudt:unit unit:MIN;
130+
qudt:value "1.19008"^^xsd:double];
131+
allores:AFR_0001164 "f81b4bcb-4d4a-41c7-8b34-5610e940d3ca";
132+
allores:AFR_0001165 [ a cat:Measurement;
133+
qudt:unit unit:PERCENT;
134+
qudt:value "100"^^xsd:double];
135+
allores:AFR_0001178 [ a cat:Measurement;
136+
qudt:unit unit:MIN;
137+
qudt:value "0.984987"^^xsd:double];
138+
allores:AFR_0001179 [ a cat:Measurement;
139+
qudt:unit qudtext:MilliAbsorbanceUnit;
140+
qudt:value "-169.679"^^xsd:double];
141+
allores:AFR_0001180 [ a cat:Measurement;
142+
qudt:unit unit:MIN;
143+
qudt:value "1.68996"^^xsd:double];
144+
allores:AFR_0001181 [ a cat:Measurement;
145+
qudt:unit qudtext:MilliAbsorbanceUnit;
146+
qudt:value "-183.143"^^xsd:double]]]]]];
147+
schema:contentUrl "http://example.org/test/../../data/tests/agilent_liquid_chromatography_aggregate_document.json".
148+
145149
"#;
146150
let expected_graph = parse_turtle_to_graph(&expected_ttl).unwrap();
147151
let result_ttl = result.as_ref().unwrap().as_str();
152+
println!("Result Turtle:\n{}", result_ttl);
148153
let result_graph = parse_turtle_to_graph(&result_ttl).unwrap();
149154
let graphs_match = isomorphic_graphs(&result_graph, &expected_graph);
150155
assert_eq!(graphs_match.unwrap(), true);

0 commit comments

Comments
 (0)