@@ -6,6 +6,70 @@ open ARCtrl.Json
6
6
open TestingUtils
7
7
open TestObjects.Json
8
8
9
+ let deprecated_ROCrate_SourceObject = """ {
10
+ "@id": "#Source_HOR_3369",
11
+ "@type": [
12
+ "Source"
13
+ ],
14
+ "name": "HOR 3369",
15
+ "characteristics": [
16
+ {
17
+ "@id": "#MaterialAttributeValue/Organism=Hordeum vulgare",
18
+ "@type": "PropertyValue",
19
+ "additionalType": "MaterialAttributeValue",
20
+ "category": "Organism",
21
+ "categoryCode": "MIAPPE:0041",
22
+ "value": "Hordeum vulgare",
23
+ "valueCode": "http://purl.obolibrary.org/obo/NCBITaxon_4513",
24
+ "@context": {
25
+ "sdo": "http://schema.org/",
26
+ "additionalType": "sdo:additionalType",
27
+ "alternateName": "sdo:alternateName",
28
+ "measurementMethod": "sdo:measurementMethod",
29
+ "description": "sdo:description",
30
+ "category": "sdo:name",
31
+ "categoryCode": "sdo:propertyID",
32
+ "value": "sdo:value",
33
+ "valueCode": "sdo:valueReference",
34
+ "unit": "sdo:unitText",
35
+ "unitCode": "sdo:unitCode",
36
+ "comments": "sdo:disambiguatingDescription"
37
+ }
38
+ }]}"""
39
+
40
+ let deprecated_ROCrate_SampleObject = """ {
41
+ "@id": "#Sample_HOR_3369",
42
+ "@type": [
43
+ "Sample"
44
+ ],
45
+ "name": "HOR 3369",
46
+ "additionalProperties": [
47
+ {
48
+ "@id": "#MaterialAttributeValue/Organism=Hordeum vulgare",
49
+ "@type": "PropertyValue",
50
+ "additionalType": "MaterialAttributeValue",
51
+ "category": "Organism",
52
+ "categoryCode": "MIAPPE:0041",
53
+ "value": "Hordeum vulgare",
54
+ "valueCode": "http://purl.obolibrary.org/obo/NCBITaxon_4513",
55
+ "@context": {
56
+ "sdo": "http://schema.org/",
57
+ "additionalType": "sdo:additionalType",
58
+ "alternateName": "sdo:alternateName",
59
+ "measurementMethod": "sdo:measurementMethod",
60
+ "description": "sdo:description",
61
+ "category": "sdo:name",
62
+ "categoryCode": "sdo:propertyID",
63
+ "value": "sdo:value",
64
+ "valueCode": "sdo:valueReference",
65
+ "unit": "sdo:unitText",
66
+ "unitCode": "sdo:unitCode",
67
+ "comments": "sdo:disambiguatingDescription"
68
+ }
69
+ }]}"""
70
+
71
+
72
+
9
73
let private tests_source =
10
74
testList " Source" [
11
75
testCase " ReaderSuccess" ( fun () ->
@@ -37,6 +101,19 @@ let private tests_source =
37
101
let inputChara = characteristics.[ 0 ]
38
102
Expect.equal inputChara chara " Sample characteristic did not match"
39
103
)
104
+ testCase " LD_ReadDeprecatedWithCharacteristics" ( fun () ->
105
+ let inputPI = Decode.fromJsonString ProcessInput.ROCrate.decoder deprecated_ ROCrate_ SourceObject
106
+ let inputSourceOpt = ProcessInput.trySource inputPI
107
+ let inputSource = Expect.wantSome inputSourceOpt " Input is not a sample"
108
+ Expect.equal inputSource.Name.Value " HOR 3369" " Sample name did not match"
109
+ let characteristics = Expect.wantSome inputSource.Characteristics " No characteristics found"
110
+ Expect.hasLength characteristics 1 " Sample characteristics length did not match"
111
+ let inputChara = characteristics.[ 0 ]
112
+ Expect.equal inputChara.NameText " Organism" " Sample characteristic name did not match"
113
+ Expect.equal inputChara.ValueText " Hordeum vulgare" " Sample characteristic value did not match"
114
+ )
115
+
116
+
40
117
]
41
118
42
119
let private tests_material =
@@ -106,6 +183,18 @@ let private tests_sample =
106
183
let inputChara = characteristics.[ 0 ]
107
184
Expect.equal inputChara chara " Sample characteristic did not match"
108
185
)
186
+ testCase " LD_ReadDeprecatedWithCharacteristics" ( fun () ->
187
+ let inputPI = Decode.fromJsonString ProcessInput.ROCrate.decoder deprecated_ ROCrate_ SampleObject
188
+ let inputSampleOpt = ProcessInput.trySample inputPI
189
+ let inputSample = Expect.wantSome inputSampleOpt " Input is not a sample"
190
+ Expect.equal inputSample.Name.Value " HOR 3369" " Sample name did not match"
191
+ let characteristics = Expect.wantSome inputSample.Characteristics " No characteristics found"
192
+ Expect.hasLength characteristics 1 " Sample characteristics length did not match"
193
+ let inputChara = characteristics.[ 0 ]
194
+ Expect.equal inputChara.NameText " Organism" " Sample characteristic name did not match"
195
+ Expect.equal inputChara.ValueText " Hordeum vulgare" " Sample characteristic value did not match"
196
+
197
+ )
109
198
]
110
199
111
200
0 commit comments