From 55a1b5d2a8d5d15ec267ce2083e04fa119586390 Mon Sep 17 00:00:00 2001 From: "michele.artini" Date: Thu, 23 Nov 2023 11:16:57 +0100 Subject: [PATCH] some vocabularies --- data/import_scripts/loadVocs.sh | 5 +- .../voc_profiles/dnet_countries.xml | 1440 ++++++++++++ .../voc_profiles/dnet_languages.xml | 2047 +++++++++++++++++ .../voc_profiles/iop_typologies.xml | 156 ++ .../voc_profiles/isti_groups.xml | 200 ++ .../controller/ImporterController.java | 10 +- dnet-app/pom.xml | 7 +- 7 files changed, 3857 insertions(+), 8 deletions(-) mode change 100644 => 100755 data/import_scripts/loadVocs.sh create mode 100644 data/import_scripts/voc_profiles/dnet_countries.xml create mode 100644 data/import_scripts/voc_profiles/dnet_languages.xml create mode 100644 data/import_scripts/voc_profiles/iop_typologies.xml create mode 100644 data/import_scripts/voc_profiles/isti_groups.xml diff --git a/data/import_scripts/loadVocs.sh b/data/import_scripts/loadVocs.sh old mode 100644 new mode 100755 index 50b6176..c2c3794 --- a/data/import_scripts/loadVocs.sh +++ b/data/import_scripts/loadVocs.sh @@ -1,6 +1,7 @@ #!/bin/sh -find ./VocabularyDSResourceType/ -name "*.xml" -exec curl -X POST "http://localhost:8280/api/import/vocabulary" -H "accept: */*" -H "Content-Type: text/plain" --data-binary @{} \; +VOC_URL="http://localhost:8888/proxy/byType/vocabulary_manager/api/import/vocabulary" +find ./voc_profiles/ -name "*.xml" -exec curl -X POST "$VOC_URL" -H "accept: */*" -H "Content-Type: text/plain" --data-binary @{} \; -find ./DedupConfigurationDSResources/ -name "*.xml" -exec curl -X POST "http://localhost:8280/api/import/resource" -H "accept: */*" -H "Content-Type: text/plain" --data-binary @{} \; +#find ./DedupConfigurationDSResources/ -name "*.xml" -exec curl -X POST "http://localhost:8280/api/import/resource" -H "accept: */*" -H "Content-Type: text/plain" --data-binary @{} \; diff --git a/data/import_scripts/voc_profiles/dnet_countries.xml b/data/import_scripts/voc_profiles/dnet_countries.xml new file mode 100644 index 0000000..627967e --- /dev/null +++ b/data/import_scripts/voc_profiles/dnet_countries.xml @@ -0,0 +1,1440 @@ + + + +
+ + + + + +
+ + + dnet:countries + dnet:countries + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + String + +
diff --git a/data/import_scripts/voc_profiles/dnet_languages.xml b/data/import_scripts/voc_profiles/dnet_languages.xml new file mode 100644 index 0000000..fc9e5d9 --- /dev/null +++ b/data/import_scripts/voc_profiles/dnet_languages.xml @@ -0,0 +1,2047 @@ + + + +
+ + + + + +
+ + + dnet:languages + dnet:languages + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + String + +
\ No newline at end of file diff --git a/data/import_scripts/voc_profiles/iop_typologies.xml b/data/import_scripts/voc_profiles/iop_typologies.xml new file mode 100644 index 0000000..475ac28 --- /dev/null +++ b/data/import_scripts/voc_profiles/iop_typologies.xml @@ -0,0 +1,156 @@ + + + +
+ + + + + +
+ + + iop:typologies + iop:typologies + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/data/import_scripts/voc_profiles/isti_groups.xml b/data/import_scripts/voc_profiles/isti_groups.xml new file mode 100644 index 0000000..e0dcbae --- /dev/null +++ b/data/import_scripts/voc_profiles/isti_groups.xml @@ -0,0 +1,200 @@ + + + +
+ + + + + +
+ + + isti:groups + Groups/Laboratories + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/dnet-app/apps/dnet-vocabulary-manager/src/main/java/eu/dnetlib/services/vocabularies/controller/ImporterController.java b/dnet-app/apps/dnet-vocabulary-manager/src/main/java/eu/dnetlib/services/vocabularies/controller/ImporterController.java index d45ded6..01ad638 100644 --- a/dnet-app/apps/dnet-vocabulary-manager/src/main/java/eu/dnetlib/services/vocabularies/controller/ImporterController.java +++ b/dnet-app/apps/dnet-vocabulary-manager/src/main/java/eu/dnetlib/services/vocabularies/controller/ImporterController.java @@ -1,6 +1,7 @@ package eu.dnetlib.services.vocabularies.controller; import java.io.IOException; +import java.io.InputStream; import java.nio.charset.StandardCharsets; import org.apache.commons.io.IOUtils; @@ -28,12 +29,11 @@ public class ImporterController extends DnetRestController { @Autowired private VocabularyImporter vocabularyImporter; - @PostMapping(value = "/vocabulary", consumes = { - MediaType.TEXT_PLAIN_VALUE, MediaType.APPLICATION_XML_VALUE, MediaType.APPLICATION_JSON_VALUE - }) + @PostMapping(value = "/vocabulary", consumes = MediaType.ALL_VALUE) public Vocabulary importVocabulary(final HttpServletRequest request) throws Exception, IOException { - final String xml = IOUtils.toString(request.getInputStream(), StandardCharsets.UTF_8); - return vocabularyImporter.importVocabulary(xml); + try (final InputStream in = request.getInputStream()) { + return vocabularyImporter.importVocabulary(IOUtils.toString(in, StandardCharsets.UTF_8)); + } } } diff --git a/dnet-app/pom.xml b/dnet-app/pom.xml index 2df485e..3733c38 100644 --- a/dnet-app/pom.xml +++ b/dnet-app/pom.xml @@ -112,11 +112,16 @@ - + org.dom4j dom4j + + jaxen + jaxen + +