Skip to content

Commit 320628d

Browse files
committed
ssh vocabs
1 parent b9e879f commit 320628d

15 files changed

+1644
-6
lines changed

src/test/java/edu/harvard/iq/dataverse/DatasetFieldServiceBeanFilterResponseTest.java

Lines changed: 110 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ public class DatasetFieldServiceBeanFilterResponseTest {
2424
void setUp() {
2525
this.datasetFieldServiceBean = new DatasetFieldServiceBean();
2626

27+
// for debugging purposes
28+
//
2729
// Logger rootLogger = Logger.getLogger(DatasetFieldServiceBean.class.getCanonicalName());
2830
// rootLogger.setLevel(Level.FINE);
2931
//
@@ -49,7 +51,7 @@ void audience() throws Exception {
4951
String termURI = "https://www.narcis.nl/classification/D13700";
5052
JsonObject cvocEntry = readObject("src/test/resources/json/cvoc-dans-config/audience.json");
5153
JsonObject readObject = readObject("src/test/resources/json/cvoc-dans-value/audience.json");
52-
// https://vocabs.datastations.nl/rest/v1/NARCIS/data&format=application/json&uri=https://www.narcis.nl/classification/D13700
54+
// https://vocabs.datastations.nl/NARCIS/en/page/D13700
5355

5456
JsonObject result = callFilterResponse(cvocEntry, readObject, termURI);
5557

@@ -64,6 +66,7 @@ void collection() throws Exception {
6466
String termURI = "https://vocabularies.dans.knaw.nl/collections/archaeology/ArcheoDepot";
6567
JsonObject cvocEntry = readObject("src/test/resources/json/cvoc-dans-config/collection.json");
6668
JsonObject readObject = readObject("src/test/resources/json/cvoc-dans-value/collection.json");
69+
// https://vocabs.datastations.nl/rest/v1/DansCollections/data?uri=https://vocabularies.dans.knaw.nl/collections/archaeology/ArcheoDepot&format=application/json
6770

6871
JsonObject result = callFilterResponse(cvocEntry, readObject, termURI);
6972

@@ -78,6 +81,7 @@ void aatClassification() throws Exception {
7881
String termURI = "http://vocab.getty.edu/aat/300187008";
7982
JsonObject cvocEntry = readObject("src/test/resources/json/cvoc-dans-config/AATClassification.json");
8083
JsonObject readObject = readObject("src/test/resources/json/cvoc-dans-value/AATClassification.json");
84+
// https://vocabs.datastations.nl/AATC/en/page/300187008
8185

8286
JsonObject result = callFilterResponse(cvocEntry, readObject, termURI);
8387

@@ -92,6 +96,7 @@ void abrPeriod() throws Exception {
9296
String termURI = "https://data.cultureelerfgoed.nl/term/id/abr/533f6881-7c2d-49fc-bce6-71a839558c0f";
9397
JsonObject cvocEntry = readObject("src/test/resources/json/cvoc-dans-config/abrPeriod.json");
9498
JsonObject readObject = readObject("src/test/resources/json/cvoc-dans-value/abrPeriod.json");
99+
// https://vocabs.datastations.nl/ABR/en/page/?uri=https://data.cultureelerfgoed.nl/term/id/abr/533f6881-7c2d-49fc-bce6-71a839558c0f&clang=nl
95100

96101
JsonObject result = callFilterResponse(cvocEntry, readObject, termURI);
97102

@@ -106,6 +111,7 @@ void abrArtifact() throws Exception {
106111
String termURI = "https://data.cultureelerfgoed.nl/term/id/abr/db8feb21-8ddc-432f-8062-a3a15f7f7cf4";
107112
JsonObject cvocEntry = readObject("src/test/resources/json/cvoc-dans-config/abrArtifact.json");
108113
JsonObject readObject = readObject("src/test/resources/json/cvoc-dans-value/abrArtifact.json");
114+
// https://vocabs.datastations.nl/ABR/en/page/?uri=https://data.cultureelerfgoed.nl/term/id/abr/db8feb21-8ddc-432f-8062-a3a15f7f7cf4&clang=nl
109115

110116
JsonObject result = callFilterResponse(cvocEntry, readObject, termURI);
111117

@@ -120,6 +126,7 @@ void abrVerwervingswijze() throws Exception {
120126
String termURI = "https://data.cultureelerfgoed.nl/term/id/abr/b7f4fe13-d7b4-4fb9-a7a8-c25ef74b612d";
121127
JsonObject cvocEntry = readObject("src/test/resources/json/cvoc-dans-config/abrVerwervingswijze.json");
122128
JsonObject readObject = readObject("src/test/resources/json/cvoc-dans-value/abrVerwervingswijze.json");
129+
// https://vocabs.datastations.nl/ABR/en/page/?uri=https://data.cultureelerfgoed.nl/term/id/abr/e06a84fa-62e8-42ff-8f38-0ddfe9485a15&clang=nl
123130

124131
JsonObject result = callFilterResponse(cvocEntry, readObject, termURI);
125132

@@ -134,7 +141,7 @@ void abrRapportType() throws Exception {
134141
String termURI = "https://data.cultureelerfgoed.nl/term/id/abr/5701cb3d-0ffd-4663-98e0-fab808448109";
135142
JsonObject cvocEntry = readObject("src/test/resources/json/cvoc-dans-config/abrRapportType.json");
136143
JsonObject readObject = readObject("src/test/resources/json/cvoc-dans-value/abrRapportType.json");
137-
// https://vocabs.datastations.nl/rest/v1/ABR/data&format=application/json&uri=https://data.cultureelerfgoed.nl/term/id/abr/5701cb3d-0ffd-4663-98e0-fab808448109
144+
// https://vocabs.datastations.nl/ABR/en/page/?uri=https://data.cultureelerfgoed.nl/term/id/abr/5701cb3d-0ffd-4663-98e0-fab808448109
138145

139146
JsonObject result = callFilterResponse(cvocEntry, readObject, termURI);
140147

@@ -149,13 +156,113 @@ void abrComplex() throws Exception {
149156
String termURI = "https://data.cultureelerfgoed.nl/term/id/abr/1b5b4dd1-f4f8-4e4c-9108-a6fb2c606cde";
150157
JsonObject cvocEntry = readObject("src/test/resources/json/cvoc-dans-config/abrComplex.json");
151158
JsonObject readObject = readObject("src/test/resources/json/cvoc-dans-value/abrComplex.json");
159+
// https://vocabs.datastations.nl/ABR/en/page/?uri=https://data.cultureelerfgoed.nl/term/id/abr/1b5b4dd1-f4f8-4e4c-9108-a6fb2c606cde
152160

153161
JsonObject result = callFilterResponse(cvocEntry, readObject, termURI);
154162
assertThat(result.getString("@id")).isEqualTo(termURI);
155163
assertThat(result.getString("vocabularyName")).isEqualTo("ABR complextypen");
156164
assertThat(getValue("nl", result.get("termName"))).isEqualTo("(ring)walburg");
157165
assertThat(result.keySet()).containsExactlyInAnyOrder("@id", "termName", "vocabularyUri", "vocabularyName");
158166
}
167+
168+
@Test
169+
void cessda() throws Exception {
170+
String termURI = "https://vocabularies.cessda.eu/vocabulary/TopicClassification?v=4.2#TradeIndustryAndMarkets.AgricultureAndRuralIndustry";
171+
JsonObject cvocEntry = readObject("src/test/resources/json/cvoc-dans-config/cessdaClassification.json");
172+
JsonObject readObject = readObject("src/test/resources/json/cvoc-dans-value/cessdaClassification.json");
173+
// https://vocabs.datastations.nl/TopicClassification_4_2/en/page/?uri=https://vocabularies.cessda.eu/vocabulary/TopicClassification?v=4.2#TradeIndustryAndRuralIndustry
174+
175+
JsonObject result = callFilterResponse(cvocEntry, readObject, termURI);
176+
assertThat(result.getString("@id")).isEqualTo(termURI);
177+
assertThat(result.getString("vocabularyName")).isEqualTo("CESSDA Topis classification 4.2");
178+
assertThat(getValue("en", result.get("termName"))).isEqualTo("Agriculture and rural industry");
179+
assertThat(result.keySet()).containsExactlyInAnyOrder("@id", "termName", "vocabularyUri", "vocabularyName");
180+
}
181+
182+
@Test
183+
void collectionMode() throws Exception {
184+
String termURI = "http://rdf-vocabulary.ddialliance.org/cv/ModeOfCollection/4.0/#AutomatedDataExtraction.WebScraping";
185+
JsonObject cvocEntry = readObject("src/test/resources/json/cvoc-dans-config/collectionMode.json");
186+
JsonObject readObject = readObject("src/test/resources/json/cvoc-dans-value/collectionMode.json");
187+
// https://vocabs.datastations.nl/ModeOfCollection_4_0/en/page/?uri=http://rdf-vocabulary.ddialliance.org/cv/ModeOfCollection/4.0/#AutomatedDataExtraction.WebScraping
188+
189+
JsonObject result = callFilterResponse(cvocEntry, readObject, termURI);
190+
assertThat(result.getString("@id")).isEqualTo(termURI);
191+
assertThat(result.getString("vocabularyName")).isEqualTo("DDI Alliance Controlled Vocabulary for Analysis Unit 2.1");
192+
assertThat(getValue("en", result.get("termName"))).isEqualTo("Automated data extraction: Web scraping");
193+
assertThat(result.keySet()).containsExactlyInAnyOrder("@id", "termName", "vocabularyUri", "vocabularyName");
194+
}
195+
196+
@Test
197+
void elsstClassification() throws Exception {
198+
String termURI = "https://elsst.cessda.eu/id/4/bf0d664a-e89a-4ec3-80d2-04f664b359ab";
199+
JsonObject cvocEntry = readObject("src/test/resources/json/cvoc-dans-config/elsstClassification.json");
200+
JsonObject readObject = readObject("src/test/resources/json/cvoc-dans-value/elsstClassification.json");
201+
// https://vocabs.datastations.nl/ELSST_R4/en/page/bf0d664a-e89a-4ec3-80d2-04f664b359ab
202+
203+
JsonObject result = callFilterResponse(cvocEntry, readObject, termURI);
204+
assertThat(result.getString("@id")).isEqualTo(termURI);
205+
assertThat(result.getString("vocabularyName")).isEqualTo("ELSST Thesaurus Version 4");
206+
assertThat(getValue("nl", result.get("termName"))).isEqualTo("ACADEMISCHE VAARDIGHEDEN");
207+
assertThat(result.keySet()).containsExactlyInAnyOrder("@id", "termName", "vocabularyUri", "vocabularyName");
208+
}
209+
210+
@Test
211+
void researchInstrument() throws Exception {
212+
String termURI = "http://rdf-vocabulary.ddialliance.org/cv/TypeOfInstrument/1.1/#Questionnaire.Semistructured";
213+
JsonObject cvocEntry = readObject("src/test/resources/json/cvoc-dans-config/researchInstrument.json");
214+
JsonObject readObject = readObject("src/test/resources/json/cvoc-dans-value/researchInstrument.json");
215+
// https://vocabs.datastations.nl/TypeOfInstrument_1_1/en/page/?uri=http://rdf-vocabulary.ddialliance.org/cv/TypeOfInstrument/1.1/#Questionnaire.Semistructured
216+
217+
JsonObject result = callFilterResponse(cvocEntry, readObject, termURI);
218+
assertThat(result.getString("@id")).isEqualTo(termURI);
219+
assertThat(result.getString("vocabularyName")).isEqualTo("DDI Alliance Controlled Vocabulary for Type of Instrument 1.1");
220+
assertThat(getValue("en", result.get("termName"))).isEqualTo("Semi-structured questionnaire");
221+
assertThat(result.keySet()).containsExactlyInAnyOrder("@id", "termName", "vocabularyUri", "vocabularyName");
222+
}
223+
224+
@Test
225+
void samplingProcedureCV() throws Exception {
226+
String termURI = "http://rdf-vocabulary.ddialliance.org/cv/SamplingProcedure/1.1/#MixedProbabilityNonprobability";
227+
JsonObject cvocEntry = readObject("src/test/resources/json/cvoc-dans-config/samplingProcedureCV.json");
228+
JsonObject readObject = readObject("src/test/resources/json/cvoc-dans-value/samplingProcedureCV.json");
229+
// https://vocabs.datastations.nl/SamplingProcedure_1_1/en/page/?uri=http://rdf-vocabulary.ddialliance.org/cv/SamplingProcedure/1.1/#MixedProbabilityNonprobability
230+
231+
JsonObject result = callFilterResponse(cvocEntry, readObject, termURI);
232+
assertThat(result.getString("@id")).isEqualTo(termURI);
233+
assertThat(result.getString("vocabularyName")).isEqualTo("DDI Alliance Controlled Vocabulary for Sampling Procedure 1.1");
234+
assertThat(getValue("en", result.get("termName"))).isEqualTo("Mixed probability and non-probability");
235+
assertThat(result.keySet()).containsExactlyInAnyOrder("@id", "termName", "vocabularyUri", "vocabularyName");
236+
}
237+
238+
@Test
239+
void timeMethod() throws Exception {
240+
String termURI = "http://rdf-vocabulary.ddialliance.org/cv/TimeMethod/1.2/#TimeSeries.Discrete";
241+
JsonObject cvocEntry = readObject("src/test/resources/json/cvoc-dans-config/timeMethod.json");
242+
JsonObject readObject = readObject("src/test/resources/json/cvoc-dans-value/timeMethod.json");
243+
// https://vocabs.datastations.nl/TimeMethod_1_2/en/page/?uri=http://rdf-vocabulary.ddialliance.org/cv/TimeMethod/1.2/#TimeSeries.Discrete
244+
245+
JsonObject result = callFilterResponse(cvocEntry, readObject, termURI);
246+
assertThat(result.getString("@id")).isEqualTo(termURI);
247+
assertThat(result.getString("vocabularyName")).isEqualTo("DDI Alliance Controlled Vocabulary for Time Method 1.2");
248+
assertThat(getValue("en", result.get("termName"))).isEqualTo("Time series: Discrete");
249+
assertThat(result.keySet()).containsExactlyInAnyOrder("@id", "termName", "vocabularyUri", "vocabularyName");
250+
}
251+
252+
@Test
253+
void unitOfAnalysis() throws Exception {
254+
String termURI = "http://rdf-vocabulary.ddialliance.org/cv/AnalysisUnit/2.1/#EventOrProcessOrActivity";
255+
JsonObject cvocEntry = readObject("src/test/resources/json/cvoc-dans-config/unitOfAnalysys.json");
256+
JsonObject readObject = readObject("src/test/resources/json/cvoc-dans-value/unitOfAnalysis.json");
257+
// https://vocabs.datastations.nl/AnalysisUnit_2_1/en/page/?uri=http://rdf-vocabulary.ddialliance.org/cv/AnalysisUnit/2.1/#EventOrProcessOrActivity
258+
259+
JsonObject result = callFilterResponse(cvocEntry, readObject, termURI);
260+
assertThat(result.getString("@id")).isEqualTo(termURI);
261+
assertThat(result.getString("vocabularyName")).isEqualTo("DDI Alliance Controlled Vocabulary for Analysis Unit 2.1");
262+
assertThat(getValue("en", result.get("termName"))).isEqualTo("Event/Process/Activity");
263+
assertThat(result.keySet()).containsExactlyInAnyOrder("@id", "termName", "vocabularyUri", "vocabularyName");
264+
}
265+
159266
private String getValue(String nl, JsonValue values) {
160267
if (values instanceof JsonArray) {
161268
for (var item : (JsonArray) values) {
@@ -164,17 +271,14 @@ private String getValue(String nl, JsonValue values) {
164271
return obj.getString("value");
165272
}
166273
}
167-
} else if (values instanceof JsonObject) {
168-
JsonObject obj = (JsonObject) values;
274+
} else if (values instanceof JsonObject obj) {
169275
if (nl.equals(obj.getString("lang", ""))) {
170276
return obj.getString("value");
171277
}
172278
}
173279
return null; // Return null if no match is found
174280
}
175281

176-
// TODO add more tests for other CVOC entries
177-
178282
private JsonObject readObject(String pathname) throws FileNotFoundException {
179283
var reader = new FileReader(pathname);
180284
return Json.createReader(reader).readObject();
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"allow-free-text": false,
3+
"cvoc-url": "https://dev.vocabs.datastations.nl/",
4+
"field-name": "dansCessdaClassification",
5+
"js-url": "/custom/skosmos.js",
6+
"languages": "en",
7+
"managed-fields": {},
8+
"protocol": "skosmos",
9+
"retrieval-filtering": {
10+
"@context": {
11+
"lang": "@language",
12+
"termName": "https://schema.org/name",
13+
"value": "@value",
14+
"vocabularyName": "https://dataverse.org/schema/vocabularyName",
15+
"vocabularyUri": "https://dataverse.org/schema/vocabularyUri"
16+
},
17+
"@id": {
18+
"params": [
19+
"@id"
20+
],
21+
"pattern": "{0}"
22+
},
23+
"termName": {
24+
"params": [
25+
"/graph/uri=@id/prefLabel"
26+
],
27+
"pattern": "{0}"
28+
},
29+
"vocabularyName": {
30+
"params": [],
31+
"pattern": "CESSDA Topis classification 4.2"
32+
},
33+
"vocabularyUri": {
34+
"params": [],
35+
"pattern": "https://vocabularies.cessda.eu/vocabulary/TopicClassification?v=4.2"
36+
}
37+
},
38+
"retrieval-uri": "https://dev.vocabs.datastations.nl/rest/v1/data?uri={0}",
39+
"term-parent-uri": "",
40+
"term-uri-field": "dansCessdaClassification",
41+
"vocabs": {
42+
"TopicClassification_4_2": {
43+
"uriSpace": "https://vocabularies.cessda.eu/vocabulary/TopicClassification?v=4.2",
44+
"vocabularyUri": "https://vocabularies.cessda.eu/vocabulary/TopicClassification?v=4.2"
45+
}
46+
}
47+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
"allow-free-text": false,
3+
"cvoc-url": "https://dev.vocabs.datastations.nl/",
4+
"field-name": "dansCollectionMode",
5+
"js-url": "/custom/skosmos.js",
6+
"languages": "en",
7+
"managed-fields": {},
8+
"protocol": "skosmos",
9+
"retrieval-filtering": {
10+
"@context": {
11+
"lang": "@language",
12+
"termName": "https://schema.org/name",
13+
"value": "@value",
14+
"vocabularyName": "https://dataverse.org/schema/vocabularyName",
15+
"vocabularyUri": "https://dataverse.org/schema/vocabularyUri"
16+
},
17+
"@id": {
18+
"params": [
19+
"@id"
20+
],
21+
"pattern": "{0}"
22+
},
23+
"termName": {
24+
"params": [
25+
"/graph/uri=@id/prefLabel"
26+
],
27+
"pattern": "{0}"
28+
},
29+
"vocabularyName": {
30+
"pattern": "DDI Alliance Controlled Vocabulary for Analysis Unit 2.1",
31+
"params": []
32+
},
33+
"vocabularyUri": {
34+
"params": [
35+
"/graph/type=skos:ConceptScheme/uri"
36+
],
37+
"pattern": "{0}"
38+
}
39+
},
40+
"retrieval-uri": "https://dev.vocabs.datastations.nl/rest/v1/data?uri={0}",
41+
"term-parent-uri": "",
42+
"term-uri-field": "dansCollectionMode",
43+
"vocabs": {
44+
"ModeOfCollection_4_0": {
45+
"uriSpace": "http://rdf-vocabulary.ddialliance.org/cv/ModeOfCollection/4.0/",
46+
"vocabularyUri": "http://rdf-vocabulary.ddialliance.org/cv/ModeOfCollection/4.0/"
47+
}
48+
}
49+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
"allow-free-text": false,
3+
"cvoc-url": "https://dev.vocabs.datastations.nl/",
4+
"field-name": "dansElsstClassification",
5+
"js-url": "/custom/skosmos.js",
6+
"languages": "en",
7+
"managed-fields": {
8+
},
9+
"protocol": "skosmos",
10+
"retrieval-filtering": {
11+
"@context": {
12+
"lang": "@language",
13+
"termName": "https://schema.org/name",
14+
"value": "@value",
15+
"vocabularyName": "https://dataverse.org/schema/vocabularyName",
16+
"vocabularyUri": "https://dataverse.org/schema/vocabularyUri"
17+
},
18+
"@id": {
19+
"params": [
20+
"@id"
21+
],
22+
"pattern": "{0}"
23+
},
24+
"termName": {
25+
"params": [
26+
"/graph/uri=@id/prefLabel"
27+
],
28+
"pattern": "{0}"
29+
},
30+
"vocabularyName": {
31+
"pattern": "ELSST Thesaurus Version 4",
32+
"params": []
33+
},
34+
"vocabularyUri": {
35+
"pattern": "https://elsst.cessda.eu/id/",
36+
"params": []
37+
}
38+
},
39+
"retrieval-uri": "https://dev.vocabs.datastations.nl/rest/v1/data?uri={0}",
40+
"term-parent-uri": "",
41+
"term-uri-field": "dansElsstClassification",
42+
"vocabs": {
43+
"ELSST_R4": {
44+
"uriSpace": "https://elsst.cessda.eu/id/",
45+
"vocabularyUri": "https://elsst.cessda.eu/id/"
46+
}
47+
}
48+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"allow-free-text": false,
3+
"cvoc-url": "https://dev.vocabs.datastations.nl/",
4+
"field-name": "dansResearchInstrument",
5+
"js-url": "/custom/skosmos.js",
6+
"languages": "en",
7+
"managed-fields": {},
8+
"protocol": "skosmos",
9+
"retrieval-filtering": {
10+
"@context": {
11+
"lang": "@language",
12+
"termName": "https://schema.org/name",
13+
"value": "@value",
14+
"vocabularyName": "https://dataverse.org/schema/vocabularyName",
15+
"vocabularyUri": "https://dataverse.org/schema/vocabularyUri"
16+
},
17+
"@id": {
18+
"params": [
19+
"@id"
20+
],
21+
"pattern": "{0}"
22+
},
23+
"termName": {
24+
"params": [
25+
"/graph/uri=@id/prefLabel"
26+
],
27+
"pattern": "{0}"
28+
},
29+
"vocabularyName": {
30+
"pattern": "DDI Alliance Controlled Vocabulary for Type of Instrument 1.1",
31+
"params": []
32+
},
33+
"vocabularyUri": {
34+
"pattern": "http://rdf-vocabulary.ddialliance.org/cv/TypeOfInstrument/1.1/",
35+
"params": []
36+
}
37+
},
38+
"retrieval-uri": "https://dev.vocabs.datastations.nl/rest/v1/data?uri={0}",
39+
"term-parent-uri": "",
40+
"term-uri-field": "dansResearchInstrument",
41+
"vocabs": {
42+
"TypeOfInstrument_1_1": {
43+
"uriSpace": "http://rdf-vocabulary.ddialliance.org/cv/TypeOfInstrument/1.1/",
44+
"vocabularyUri": "http://rdf-vocabulary.ddialliance.org/cv/TypeOfInstrument/1.1/"
45+
}
46+
}
47+
}

0 commit comments

Comments
 (0)