rda json dmp import/export
This commit is contained in:
parent
9a8fc5e92e
commit
0c57bba0b4
|
@ -1136,7 +1136,7 @@ public class DatasetManager {
|
||||||
List<Tag> tags = apiContext.getOperationsContext().getElasticRepository().getDatasetRepository().query(criteria).stream().map(eu.eudat.elastic.entities.Dataset::getTags).flatMap(Collection::stream).filter(StreamDistinctBy.distinctByKey(Tag::getId)).collect(Collectors.toList());
|
List<Tag> tags = apiContext.getOperationsContext().getElasticRepository().getDatasetRepository().query(criteria).stream().map(eu.eudat.elastic.entities.Dataset::getTags).flatMap(Collection::stream).filter(StreamDistinctBy.distinctByKey(Tag::getId)).collect(Collectors.toList());
|
||||||
Set<JsonNode> tagNodes = new HashSet<>();
|
Set<JsonNode> tagNodes = new HashSet<>();
|
||||||
tagNodes.addAll(JsonSearcher.findNodes(propertiesJson, "renderStyle", "tags", true));
|
tagNodes.addAll(JsonSearcher.findNodes(propertiesJson, "renderStyle", "tags", true));
|
||||||
tagNodes.addAll(JsonSearcher.findNodes(propertiesJson, "rdaProperty", "dataset.keyword"));
|
tagNodes.addAll(JsonSearcher.findNodes(propertiesJson, "schematics", "rda.dataset.keyword"));
|
||||||
if(wizardModel.getTags() == null){
|
if(wizardModel.getTags() == null){
|
||||||
wizardModel.setTags(new ArrayList<>());
|
wizardModel.setTags(new ArrayList<>());
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,18 @@ public class JsonSearcher {
|
||||||
}
|
}
|
||||||
found++;
|
found++;
|
||||||
}
|
}
|
||||||
|
else if(node.get(fieldName).isArray()){
|
||||||
|
for(JsonNode item: node.get(fieldName)){
|
||||||
|
if(item.asText().equals(value) || item.asText().startsWith(value)){
|
||||||
|
if (parent) {
|
||||||
|
nodes.add(root);
|
||||||
|
} else {
|
||||||
|
nodes.add(node);
|
||||||
|
}
|
||||||
|
found++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,19 @@ public class CostRDAMapper {
|
||||||
public static List<Cost> toRDAList(List<JsonNode> nodes) throws JsonProcessingException {
|
public static List<Cost> toRDAList(List<JsonNode> nodes) throws JsonProcessingException {
|
||||||
Map<String, Cost> rdaMap = new HashMap<>();
|
Map<String, Cost> rdaMap = new HashMap<>();
|
||||||
for(JsonNode node: nodes){
|
for(JsonNode node: nodes){
|
||||||
String rdaProperty = node.get("rdaProperty").asText();
|
String rdaProperty = "";
|
||||||
|
JsonNode schematics = node.get("schematics");
|
||||||
|
if(schematics.isArray()){
|
||||||
|
for(JsonNode schematic: schematics){
|
||||||
|
if(schematic.asText().startsWith("rda.dmp.cost")){
|
||||||
|
rdaProperty = schematic.asText();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
String rdaValue = node.get("value").asText();
|
String rdaValue = node.get("value").asText();
|
||||||
if(rdaValue == null || (rdaValue.isEmpty() && !node.get("value").isArray())){
|
if(rdaValue == null || (rdaValue.isEmpty() && !node.get("value").isArray())){
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -27,7 +27,19 @@ public class DatasetIdRDAMapper {
|
||||||
public static DatasetId toRDA(List<JsonNode> nodes) {
|
public static DatasetId toRDA(List<JsonNode> nodes) {
|
||||||
DatasetId data = new DatasetId();
|
DatasetId data = new DatasetId();
|
||||||
for (JsonNode node: nodes) {
|
for (JsonNode node: nodes) {
|
||||||
String rdaProperty = node.get("rdaProperty").asText();
|
String rdaProperty = "";
|
||||||
|
JsonNode schematics = node.get("schematics");
|
||||||
|
if(schematics.isArray()){
|
||||||
|
for(JsonNode schematic: schematics){
|
||||||
|
if(schematic.asText().startsWith("rda.dataset.dataset_id")){
|
||||||
|
rdaProperty = schematic.asText();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
String rdaValue = node.get("value").asText();
|
String rdaValue = node.get("value").asText();
|
||||||
if(rdaValue == null || rdaValue.isEmpty()){
|
if(rdaValue == null || rdaValue.isEmpty()){
|
||||||
continue;
|
continue;
|
||||||
|
@ -77,20 +89,25 @@ public class DatasetIdRDAMapper {
|
||||||
public static Map<String, String> toProperties(DatasetId rda, JsonNode node) {
|
public static Map<String, String> toProperties(DatasetId rda, JsonNode node) {
|
||||||
Map<String, String> properties = new HashMap<>();
|
Map<String, String> properties = new HashMap<>();
|
||||||
|
|
||||||
List<JsonNode> idNodes = JsonSearcher.findNodes(node, "rdaProperty", "dataset.dataset_id");
|
List<JsonNode> idNodes = JsonSearcher.findNodes(node, "schematics", "rda.dataset.dataset_id");
|
||||||
|
|
||||||
for (JsonNode idNode: idNodes) {
|
for (JsonNode idNode: idNodes) {
|
||||||
for (DatasetIdProperties datasetIdProperties : DatasetIdProperties.values()) {
|
for (DatasetIdProperties datasetIdProperties : DatasetIdProperties.values()) {
|
||||||
if (idNode.get("rdaProperty").asText().endsWith(datasetIdProperties.getName())) {
|
JsonNode schematics = idNode.get("schematics");
|
||||||
switch (datasetIdProperties) {
|
if(schematics.isArray()){
|
||||||
case IDENTIFIER:
|
for(JsonNode schematic: schematics){
|
||||||
properties.put(idNode.get("id").asText(), rda.getIdentifier());
|
if(schematic.asText().endsWith(datasetIdProperties.getName())){
|
||||||
break;
|
switch (datasetIdProperties) {
|
||||||
case TYPE:
|
case IDENTIFIER:
|
||||||
properties.put(idNode.get("id").asText(), rda.getType().value());
|
properties.put(idNode.get("id").asText(), rda.getIdentifier());
|
||||||
|
break;
|
||||||
|
case TYPE:
|
||||||
|
properties.put(idNode.get("id").asText(), rda.getType().value());
|
||||||
|
break;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,32 +59,32 @@ public class DatasetRDAMapper {
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
String datasetDescriptionJson = mapper.writeValueAsString(datasetWizardModel.getDatasetProfileDefinition());
|
String datasetDescriptionJson = mapper.writeValueAsString(datasetWizardModel.getDatasetProfileDefinition());
|
||||||
JsonNode datasetDescriptionObj = mapper.readTree(datasetDescriptionJson);
|
JsonNode datasetDescriptionObj = mapper.readTree(datasetDescriptionJson);
|
||||||
List<JsonNode> idNodes = JsonSearcher.findNodes(datasetDescriptionObj, "rdaProperty", "dataset.dataset_id");
|
List<JsonNode> idNodes = JsonSearcher.findNodes(datasetDescriptionObj, "schematics", "rda.dataset.dataset_id");
|
||||||
if (!idNodes.isEmpty()) {
|
if (!idNodes.isEmpty()) {
|
||||||
rda.setDatasetId(DatasetIdRDAMapper.toRDA(idNodes));
|
rda.setDatasetId(DatasetIdRDAMapper.toRDA(idNodes));
|
||||||
}
|
}
|
||||||
if (rda.getDatasetId() == null) {
|
if (rda.getDatasetId() == null) {
|
||||||
rda.setDatasetId(new DatasetId(dataset.getId().toString(), DatasetId.Type.OTHER));
|
rda.setDatasetId(new DatasetId(dataset.getId().toString(), DatasetId.Type.OTHER));
|
||||||
}
|
}
|
||||||
List<JsonNode> typeNodes = JsonSearcher.findNodes(datasetDescriptionObj, "rdaProperty", "dataset.type");
|
List<JsonNode> typeNodes = JsonSearcher.findNodes(datasetDescriptionObj, "schematics", "rda.dataset.type");
|
||||||
if (!typeNodes.isEmpty() && !typeNodes.get(0).get("value").asText().isEmpty()) {
|
if (!typeNodes.isEmpty() && !typeNodes.get(0).get("value").asText().isEmpty()) {
|
||||||
rda.setType(typeNodes.get(0).get("value").asText());
|
rda.setType(typeNodes.get(0).get("value").asText());
|
||||||
} else {
|
} else {
|
||||||
rda.setType("DMP Dataset");
|
rda.setType("DMP Dataset");
|
||||||
}
|
}
|
||||||
List<JsonNode> languageNodes = JsonSearcher.findNodes(datasetDescriptionObj, "rdaProperty", "dataset.language");
|
List<JsonNode> languageNodes = JsonSearcher.findNodes(datasetDescriptionObj, "schematics", "rda.dataset.language");
|
||||||
if (!languageNodes.isEmpty() && !languageNodes.get(0).get("value").asText().isEmpty()) {
|
if (!languageNodes.isEmpty() && !languageNodes.get(0).get("value").asText().isEmpty()) {
|
||||||
rda.setLanguage(Language.fromValue(languageNodes.get(0).get("value").asText()));
|
rda.setLanguage(Language.fromValue(languageNodes.get(0).get("value").asText()));
|
||||||
} else {
|
} else {
|
||||||
rda.setLanguage(LanguageRDAMapper.mapLanguageIsoToRDAIso(dataset.getProfile().getLanguage()));
|
rda.setLanguage(LanguageRDAMapper.mapLanguageIsoToRDAIso(dataset.getProfile().getLanguage()));
|
||||||
}
|
}
|
||||||
List<JsonNode> metadataNodes = JsonSearcher.findNodes(datasetDescriptionObj, "rdaProperty", "dataset.metadata");
|
List<JsonNode> metadataNodes = JsonSearcher.findNodes(datasetDescriptionObj, "schematics", "rda.dataset.metadata");
|
||||||
if (!metadataNodes.isEmpty()) {
|
if (!metadataNodes.isEmpty()) {
|
||||||
rda.setMetadata(MetadataRDAMapper.toRDAList(metadataNodes));
|
rda.setMetadata(MetadataRDAMapper.toRDAList(metadataNodes));
|
||||||
}else{
|
}else{
|
||||||
rda.setMetadata(new ArrayList<>());
|
rda.setMetadata(new ArrayList<>());
|
||||||
}
|
}
|
||||||
List<JsonNode> qaNodes = JsonSearcher.findNodes(datasetDescriptionObj, "rdaProperty", "dataset.data_quality_assurance");
|
List<JsonNode> qaNodes = JsonSearcher.findNodes(datasetDescriptionObj, "schematics", "rda.dataset.data_quality_assurance");
|
||||||
if (!qaNodes.isEmpty()) {
|
if (!qaNodes.isEmpty()) {
|
||||||
/*rda.setDataQualityAssurance(qaNodes.stream().map(qaNode -> qaNode.get("value").asText()).collect(Collectors.toList()));
|
/*rda.setDataQualityAssurance(qaNodes.stream().map(qaNode -> qaNode.get("value").asText()).collect(Collectors.toList()));
|
||||||
for (int i = 0; i < qaNodes.size(); i++) {
|
for (int i = 0; i < qaNodes.size(); i++) {
|
||||||
|
@ -115,17 +115,17 @@ public class DatasetRDAMapper {
|
||||||
}else{
|
}else{
|
||||||
rda.setDataQualityAssurance(new ArrayList<>());
|
rda.setDataQualityAssurance(new ArrayList<>());
|
||||||
}
|
}
|
||||||
List<JsonNode> preservationNodes = JsonSearcher.findNodes(datasetDescriptionObj, "rdaProperty", "dataset.preservation_statement");
|
List<JsonNode> preservationNodes = JsonSearcher.findNodes(datasetDescriptionObj, "schematics", "rda.dataset.preservation_statement");
|
||||||
if (!preservationNodes.isEmpty() && !preservationNodes.get(0).get("value").asText().isEmpty()) {
|
if (!preservationNodes.isEmpty() && !preservationNodes.get(0).get("value").asText().isEmpty()) {
|
||||||
rda.setPreservationStatement(preservationNodes.get(0).get("value").asText());
|
rda.setPreservationStatement(preservationNodes.get(0).get("value").asText());
|
||||||
}
|
}
|
||||||
List<JsonNode> distributionNodes = JsonSearcher.findNodes(datasetDescriptionObj, "rdaProperty", "dataset.distribution");
|
List<JsonNode> distributionNodes = JsonSearcher.findNodes(datasetDescriptionObj, "schematics", "rda.dataset.distribution");
|
||||||
if (!distributionNodes.isEmpty()) {
|
if (!distributionNodes.isEmpty()) {
|
||||||
rda.setDistribution(DistributionRDAMapper.toRDAList(distributionNodes));
|
rda.setDistribution(DistributionRDAMapper.toRDAList(distributionNodes));
|
||||||
}else{
|
}else{
|
||||||
rda.setDistribution(new ArrayList<>());
|
rda.setDistribution(new ArrayList<>());
|
||||||
}
|
}
|
||||||
List<JsonNode> keywordNodes = JsonSearcher.findNodes(datasetDescriptionObj, "rdaProperty", "dataset.keyword");
|
List<JsonNode> keywordNodes = JsonSearcher.findNodes(datasetDescriptionObj, "schematics", "rda.dataset.keyword");
|
||||||
if (!keywordNodes.isEmpty()) {
|
if (!keywordNodes.isEmpty()) {
|
||||||
rda.setKeyword(keywordNodes.stream().map(keywordNode -> {
|
rda.setKeyword(keywordNodes.stream().map(keywordNode -> {
|
||||||
JsonNode value = keywordNode.get("value");
|
JsonNode value = keywordNode.get("value");
|
||||||
|
@ -142,7 +142,7 @@ public class DatasetRDAMapper {
|
||||||
List<String> tags = apiContext.getOperationsContext().getElasticRepository().getDatasetRepository().findDocument(dataset.getId().toString()).getTags().stream().map(Tag::getName).collect(Collectors.toList());
|
List<String> tags = apiContext.getOperationsContext().getElasticRepository().getDatasetRepository().findDocument(dataset.getId().toString()).getTags().stream().map(Tag::getName).collect(Collectors.toList());
|
||||||
rda.setKeyword(tags);
|
rda.setKeyword(tags);
|
||||||
}
|
}
|
||||||
List<JsonNode> personalDataNodes = JsonSearcher.findNodes(datasetDescriptionObj, "rdaProperty", "dataset.personal_data");
|
List<JsonNode> personalDataNodes = JsonSearcher.findNodes(datasetDescriptionObj, "schematics", "rda.dataset.personal_data");
|
||||||
if (!personalDataNodes.isEmpty()) {
|
if (!personalDataNodes.isEmpty()) {
|
||||||
try{
|
try{
|
||||||
rda.setPersonalData(personalDataNodes.stream().map(personalDataNode -> Dataset.PersonalData.fromValue(personalDataNode.get("value").asText())).findFirst().get());
|
rda.setPersonalData(personalDataNodes.stream().map(personalDataNode -> Dataset.PersonalData.fromValue(personalDataNode.get("value").asText())).findFirst().get());
|
||||||
|
@ -152,13 +152,13 @@ public class DatasetRDAMapper {
|
||||||
} else {
|
} else {
|
||||||
rda.setPersonalData(Dataset.PersonalData.UNKNOWN);
|
rda.setPersonalData(Dataset.PersonalData.UNKNOWN);
|
||||||
}
|
}
|
||||||
List<JsonNode> securityAndPrivacyNodes = JsonSearcher.findNodes(datasetDescriptionObj, "rdaProperty", "dataset.security_and_privacy");
|
List<JsonNode> securityAndPrivacyNodes = JsonSearcher.findNodes(datasetDescriptionObj, "schematics", "rda.dataset.security_and_privacy");
|
||||||
if (!securityAndPrivacyNodes.isEmpty()) {
|
if (!securityAndPrivacyNodes.isEmpty()) {
|
||||||
rda.setSecurityAndPrivacy(SecurityAndPrivacyRDAMapper.toRDAList(securityAndPrivacyNodes));
|
rda.setSecurityAndPrivacy(SecurityAndPrivacyRDAMapper.toRDAList(securityAndPrivacyNodes));
|
||||||
}else{
|
}else{
|
||||||
rda.setSecurityAndPrivacy(new ArrayList<>());
|
rda.setSecurityAndPrivacy(new ArrayList<>());
|
||||||
}
|
}
|
||||||
List<JsonNode> sensitiveDataNodes = JsonSearcher.findNodes(datasetDescriptionObj, "rdaProperty", "dataset.sensitive_data");
|
List<JsonNode> sensitiveDataNodes = JsonSearcher.findNodes(datasetDescriptionObj, "schematics", "rda.dataset.sensitive_data");
|
||||||
if (!sensitiveDataNodes.isEmpty()) {
|
if (!sensitiveDataNodes.isEmpty()) {
|
||||||
try{
|
try{
|
||||||
rda.setSensitiveData(sensitiveDataNodes.stream().map(sensitiveDataNode -> Dataset.SensitiveData.fromValue(sensitiveDataNode.get("value").asText())).findFirst().get());
|
rda.setSensitiveData(sensitiveDataNodes.stream().map(sensitiveDataNode -> Dataset.SensitiveData.fromValue(sensitiveDataNode.get("value").asText())).findFirst().get());
|
||||||
|
@ -168,35 +168,47 @@ public class DatasetRDAMapper {
|
||||||
} else {
|
} else {
|
||||||
rda.setSensitiveData(Dataset.SensitiveData.UNKNOWN);
|
rda.setSensitiveData(Dataset.SensitiveData.UNKNOWN);
|
||||||
}
|
}
|
||||||
List<JsonNode> technicalResourceNodes = JsonSearcher.findNodes(datasetDescriptionObj, "rdaProperty", "dataset.technical_resource");
|
List<JsonNode> technicalResourceNodes = JsonSearcher.findNodes(datasetDescriptionObj, "schematics", "rda.dataset.technical_resource");
|
||||||
if (!technicalResourceNodes.isEmpty()) {
|
if (!technicalResourceNodes.isEmpty()) {
|
||||||
rda.setTechnicalResource(TechnicalResourceRDAMapper.toRDAList(technicalResourceNodes));
|
rda.setTechnicalResource(TechnicalResourceRDAMapper.toRDAList(technicalResourceNodes));
|
||||||
}else{
|
}else{
|
||||||
rda.setTechnicalResource(new ArrayList<>());
|
rda.setTechnicalResource(new ArrayList<>());
|
||||||
}
|
}
|
||||||
List<JsonNode> issuedNodes = JsonSearcher.findNodes(datasetDescriptionObj, "rdaProperty", "dataset.issued");
|
List<JsonNode> issuedNodes = JsonSearcher.findNodes(datasetDescriptionObj, "schematics", "rda.dataset.issued");
|
||||||
if (!issuedNodes.isEmpty() && !issuedNodes.get(0).get("value").asText().isEmpty()) {
|
if (!issuedNodes.isEmpty() && !issuedNodes.get(0).get("value").asText().isEmpty()) {
|
||||||
rda.setIssued(issuedNodes.get(0).get("value").asText());
|
rda.setIssued(issuedNodes.get(0).get("value").asText());
|
||||||
}
|
}
|
||||||
List<JsonNode> contributorNodes = JsonSearcher.findNodes(datasetDescriptionObj, "rdaProperty", "dmp.contributor");
|
List<JsonNode> contributorNodes = JsonSearcher.findNodes(datasetDescriptionObj, "schematics", "rda.dmp.contributor");
|
||||||
if (!contributorNodes.isEmpty()) {
|
if (!contributorNodes.isEmpty()) {
|
||||||
dmp.getContributor().addAll(contributorNodes.stream().map(contributorNode -> {
|
dmp.getContributor().addAll(contributorNodes.stream().map(contributorNode -> {
|
||||||
JsonNode value = contributorNode.get("value");
|
JsonNode value = contributorNode.get("value");
|
||||||
if (value.isArray()) {
|
if (value.isArray()) {
|
||||||
return StreamSupport.stream(value.spliterator(), false).map(node -> ContributorRDAMapper.toRDA(node.asText())).collect(Collectors.toList());
|
return StreamSupport.stream(value.spliterator(), false).map(node -> ContributorRDAMapper.toRDA(node.asText())).collect(Collectors.toList());
|
||||||
} else {
|
} else {
|
||||||
return Collections.singletonList(new Contributor()); // return null kalutera
|
return Collections.singletonList(new Contributor());
|
||||||
}
|
}
|
||||||
}).flatMap(Collection::stream).collect(Collectors.toList()));
|
}).flatMap(Collection::stream).collect(Collectors.toList()));
|
||||||
}
|
}
|
||||||
List<JsonNode> costNodes = JsonSearcher.findNodes(datasetDescriptionObj, "rdaProperty", "dmp.cost");
|
List<JsonNode> costNodes = JsonSearcher.findNodes(datasetDescriptionObj, "schematics", "rda.dmp.cost");
|
||||||
if (!costNodes.isEmpty()) {
|
if (!costNodes.isEmpty()) {
|
||||||
dmp.getCost().addAll(CostRDAMapper.toRDAList(costNodes));
|
dmp.getCost().addAll(CostRDAMapper.toRDAList(costNodes));
|
||||||
}
|
}
|
||||||
List<JsonNode> ethicsNodes = JsonSearcher.findNodes(datasetDescriptionObj, "rdaProperty", "dmp.ethical_issues");
|
List<JsonNode> ethicsNodes = JsonSearcher.findNodes(datasetDescriptionObj, "schematics", "rda.dmp.ethical_issues");
|
||||||
if (!ethicsNodes.isEmpty()) {
|
if (!ethicsNodes.isEmpty()) {
|
||||||
for(JsonNode node: ethicsNodes){
|
for(JsonNode node: ethicsNodes){
|
||||||
String rdaProperty = node.get("rdaProperty").asText();
|
String rdaProperty = "";
|
||||||
|
JsonNode schematics = node.get("schematics");
|
||||||
|
if(schematics.isArray()){
|
||||||
|
for(JsonNode schematic: schematics){
|
||||||
|
if(schematic.asText().startsWith("rda.dmp.ethical_issues")){
|
||||||
|
rdaProperty = schematic.asText();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
String rdaValue = node.get("value").asText();
|
String rdaValue = node.get("value").asText();
|
||||||
if(rdaValue == null || rdaValue.isEmpty()){
|
if(rdaValue == null || rdaValue.isEmpty()){
|
||||||
continue;
|
continue;
|
||||||
|
@ -276,12 +288,12 @@ public class DatasetRDAMapper {
|
||||||
String datasetDescriptionJson = mapper.writeValueAsString(datasetWizardModel.getDatasetProfileDefinition());
|
String datasetDescriptionJson = mapper.writeValueAsString(datasetWizardModel.getDatasetProfileDefinition());
|
||||||
JsonNode datasetDescriptionObj = mapper.readTree(datasetDescriptionJson);
|
JsonNode datasetDescriptionObj = mapper.readTree(datasetDescriptionJson);
|
||||||
|
|
||||||
List<JsonNode> typeNodes = JsonSearcher.findNodes(datasetDescriptionObj, "rdaProperty", "dataset.type");
|
List<JsonNode> typeNodes = JsonSearcher.findNodes(datasetDescriptionObj, "schematics", "rda.dataset.type");
|
||||||
if (!typeNodes.isEmpty()) {
|
if (!typeNodes.isEmpty()) {
|
||||||
properties.put(typeNodes.get(0).get("id").asText(), rda.getType());
|
properties.put(typeNodes.get(0).get("id").asText(), rda.getType());
|
||||||
}
|
}
|
||||||
|
|
||||||
List<JsonNode> languageNodes = JsonSearcher.findNodes(datasetDescriptionObj, "rdaProperty", "dataset.language");
|
List<JsonNode> languageNodes = JsonSearcher.findNodes(datasetDescriptionObj, "schematics", "rda.dataset.language");
|
||||||
if (!languageNodes.isEmpty() && rda.getLanguage() != null) {
|
if (!languageNodes.isEmpty() && rda.getLanguage() != null) {
|
||||||
properties.put(languageNodes.get(0).get("id").asText(), rda.getLanguage().value());
|
properties.put(languageNodes.get(0).get("id").asText(), rda.getLanguage().value());
|
||||||
}
|
}
|
||||||
|
@ -298,7 +310,7 @@ public class DatasetRDAMapper {
|
||||||
for (int i = 0; i < qaIds.size(); i++) {
|
for (int i = 0; i < qaIds.size(); i++) {
|
||||||
properties.put(qaIds.get(i), rda.getDataQualityAssurance().get(i));
|
properties.put(qaIds.get(i), rda.getDataQualityAssurance().get(i));
|
||||||
}*/
|
}*/
|
||||||
List<JsonNode> qaNodes = JsonSearcher.findNodes(datasetDescriptionObj, "rdaProperty", "dataset.data_quality_assurance");
|
List<JsonNode> qaNodes = JsonSearcher.findNodes(datasetDescriptionObj, "schematics", "rda.dataset.data_quality_assurance");
|
||||||
if (!qaNodes.isEmpty() && rda.getDataQualityAssurance() != null && !rda.getDataQualityAssurance().isEmpty()) {
|
if (!qaNodes.isEmpty() && rda.getDataQualityAssurance() != null && !rda.getDataQualityAssurance().isEmpty()) {
|
||||||
ObjectMapper m = new ObjectMapper();
|
ObjectMapper m = new ObjectMapper();
|
||||||
List<String> qas = new ArrayList<>(rda.getDataQualityAssurance());
|
List<String> qas = new ArrayList<>(rda.getDataQualityAssurance());
|
||||||
|
@ -310,12 +322,12 @@ public class DatasetRDAMapper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List<JsonNode> preservationNodes = JsonSearcher.findNodes(datasetDescriptionObj, "rdaProperty", "dataset.preservation_statement");
|
List<JsonNode> preservationNodes = JsonSearcher.findNodes(datasetDescriptionObj, "schematics", "rda.dataset.preservation_statement");
|
||||||
if (!preservationNodes.isEmpty()) {
|
if (!preservationNodes.isEmpty()) {
|
||||||
properties.put(preservationNodes.get(0).get("id").asText(), rda.getPreservationStatement());
|
properties.put(preservationNodes.get(0).get("id").asText(), rda.getPreservationStatement());
|
||||||
}
|
}
|
||||||
|
|
||||||
List<JsonNode> issuedNodes = JsonSearcher.findNodes(datasetDescriptionObj, "rdaProperty", "dataset.issued");
|
List<JsonNode> issuedNodes = JsonSearcher.findNodes(datasetDescriptionObj, "schematics", "rda.dataset.issued");
|
||||||
if (!issuedNodes.isEmpty()) {
|
if (!issuedNodes.isEmpty()) {
|
||||||
properties.put(issuedNodes.get(0).get("id").asText(), rda.getIssued());
|
properties.put(issuedNodes.get(0).get("id").asText(), rda.getIssued());
|
||||||
}
|
}
|
||||||
|
@ -351,7 +363,7 @@ public class DatasetRDAMapper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List<JsonNode> personalDataNodes = JsonSearcher.findNodes(datasetDescriptionObj, "rdaProperty", "dataset.personal_data");
|
List<JsonNode> personalDataNodes = JsonSearcher.findNodes(datasetDescriptionObj, "schematics", "rda.dataset.personal_data");
|
||||||
if (!personalDataNodes.isEmpty()) {
|
if (!personalDataNodes.isEmpty()) {
|
||||||
properties.put(personalDataNodes.get(0).get("id").asText(), rda.getPersonalData().value());
|
properties.put(personalDataNodes.get(0).get("id").asText(), rda.getPersonalData().value());
|
||||||
}
|
}
|
||||||
|
@ -360,7 +372,7 @@ public class DatasetRDAMapper {
|
||||||
properties.putAll(SecurityAndPrivacyRDAMapper.toProperties(rda.getSecurityAndPrivacy()));
|
properties.putAll(SecurityAndPrivacyRDAMapper.toProperties(rda.getSecurityAndPrivacy()));
|
||||||
}
|
}
|
||||||
|
|
||||||
List<JsonNode> sensitiveDataNodes = JsonSearcher.findNodes(datasetDescriptionObj, "rdaProperty", "dataset.sensitive_data");
|
List<JsonNode> sensitiveDataNodes = JsonSearcher.findNodes(datasetDescriptionObj, "schematics", "rda.dataset.sensitive_data");
|
||||||
if (!sensitiveDataNodes.isEmpty()) {
|
if (!sensitiveDataNodes.isEmpty()) {
|
||||||
properties.put(sensitiveDataNodes.get(0).get("id").asText(), rda.getSensitiveData().value());
|
properties.put(sensitiveDataNodes.get(0).get("id").asText(), rda.getSensitiveData().value());
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,10 @@ public class DistributionRDAMapper {
|
||||||
Map<String, Distribution> rdaMap = new HashMap<>();
|
Map<String, Distribution> rdaMap = new HashMap<>();
|
||||||
|
|
||||||
for (JsonNode node: nodes) {
|
for (JsonNode node: nodes) {
|
||||||
String rdaProperty = node.get("rdaProperty").asText();
|
String rdaProperty = getRdaDistributionProperty(node);
|
||||||
|
if(rdaProperty.isEmpty()){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
String rdaValue = node.get("value").asText();
|
String rdaValue = node.get("value").asText();
|
||||||
//if(rdaValue == null || rdaValue.isEmpty()){
|
//if(rdaValue == null || rdaValue.isEmpty()){
|
||||||
if(rdaValue == null || (rdaValue.isEmpty() && !node.get("value").isArray())){
|
if(rdaValue == null || (rdaValue.isEmpty() && !node.get("value").isArray())){
|
||||||
|
@ -79,7 +82,16 @@ public class DistributionRDAMapper {
|
||||||
rda.setAdditionalProperty(ImportPropertyName.BYTE_SIZE.getName(), node.get("id").asText());
|
rda.setAdditionalProperty(ImportPropertyName.BYTE_SIZE.getName(), node.get("id").asText());
|
||||||
break;
|
break;
|
||||||
case LICENSE:
|
case LICENSE:
|
||||||
List<JsonNode> licenseNodes = nodes.stream().filter(lnode -> lnode.get("rdaProperty").asText().toLowerCase().contains("license")).collect(Collectors.toList());
|
List<JsonNode> licenseNodes = nodes.stream().filter(lnode -> {
|
||||||
|
if(lnode.get("schematics").isArray()){
|
||||||
|
for(JsonNode schematic: lnode.get("schematics")){
|
||||||
|
if(schematic.asText().startsWith("rda.dataset.distribution.license")){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
License license = LicenseRDAMapper.toRDA(licenseNodes);
|
License license = LicenseRDAMapper.toRDA(licenseNodes);
|
||||||
rda.setLicense(license != null? Collections.singletonList(license): new ArrayList<>());
|
rda.setLicense(license != null? Collections.singletonList(license): new ArrayList<>());
|
||||||
break;
|
break;
|
||||||
|
@ -182,71 +194,77 @@ public class DistributionRDAMapper {
|
||||||
public static Map<String, String> toProperties(Distribution rda, JsonNode root) {
|
public static Map<String, String> toProperties(Distribution rda, JsonNode root) {
|
||||||
Map<String, String> properties = new HashMap<>();
|
Map<String, String> properties = new HashMap<>();
|
||||||
|
|
||||||
List<JsonNode> distributionNodes = JsonSearcher.findNodes(root, "rdaProperty", "dataset.distribution");
|
List<JsonNode> distributionNodes = JsonSearcher.findNodes(root, "schematics", "rda.dataset.distribution");
|
||||||
|
|
||||||
for (JsonNode distributionNode: distributionNodes) {
|
for (JsonNode distributionNode: distributionNodes) {
|
||||||
for (ExportPropertyName exportPropertyName: ExportPropertyName.values()) {
|
for (ExportPropertyName exportPropertyName: ExportPropertyName.values()) {
|
||||||
if (distributionNode.get("rdaProperty").asText().contains(exportPropertyName.getName())) {
|
JsonNode schematics = distributionNode.get("schematics");
|
||||||
switch (exportPropertyName) {
|
if(schematics.isArray()){
|
||||||
case ACCESS_URL:
|
for(JsonNode schematic: schematics){
|
||||||
properties.put(distributionNode.get("id").asText(), rda.getAccessUrl());
|
if(schematic.asText().contains(exportPropertyName.getName())){
|
||||||
break;
|
switch (exportPropertyName) {
|
||||||
case DESCRIPTION:
|
case ACCESS_URL:
|
||||||
properties.put(distributionNode.get("id").asText(), rda.getDescription());
|
properties.put(distributionNode.get("id").asText(), rda.getAccessUrl());
|
||||||
break;
|
break;
|
||||||
case TITLE:
|
case DESCRIPTION:
|
||||||
properties.put(distributionNode.get("id").asText(), rda.getTitle());
|
properties.put(distributionNode.get("id").asText(), rda.getDescription());
|
||||||
break;
|
break;
|
||||||
case AVAILABLE_UNTIL:
|
case TITLE:
|
||||||
properties.put(distributionNode.get("id").asText(), rda.getAvailableUntil());
|
properties.put(distributionNode.get("id").asText(), rda.getTitle());
|
||||||
break;
|
break;
|
||||||
case DOWNLOAD_URL:
|
case AVAILABLE_UNTIL:
|
||||||
if (rda.getDownloadUrl() != null) {
|
properties.put(distributionNode.get("id").asText(), rda.getAvailableUntil());
|
||||||
properties.put(distributionNode.get("id").asText(), rda.getDownloadUrl().toString());
|
break;
|
||||||
}
|
case DOWNLOAD_URL:
|
||||||
break;
|
if (rda.getDownloadUrl() != null) {
|
||||||
case DATA_ACCESS:
|
properties.put(distributionNode.get("id").asText(), rda.getDownloadUrl().toString());
|
||||||
properties.put(distributionNode.get("id").asText(), rda.getDataAccess().value());
|
|
||||||
break;
|
|
||||||
case BYTE_SIZE:
|
|
||||||
if (rda.getByteSize() != null) {
|
|
||||||
properties.put(distributionNode.get("id").asText(), rda.getByteSize().toString());
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case FORMAT:
|
|
||||||
if (rda.getFormat() != null && !rda.getFormat().isEmpty()) {
|
|
||||||
String style = distributionNode.get("viewStyle").get("renderStyle").asText();
|
|
||||||
if(style.equals("combobox")) {
|
|
||||||
if (distributionNode.get("data").get("type").asText().equals("autocomplete")) {
|
|
||||||
Map<String, Object> additionalProperties = rda.getAdditionalProperties();
|
|
||||||
List<Object> standardFormats = new ArrayList<>();
|
|
||||||
rda.getAdditionalProperties().forEach((key, value) -> {
|
|
||||||
try {
|
|
||||||
if (key.matches("format\\d+")) {
|
|
||||||
standardFormats.add(additionalProperties.get(key));
|
|
||||||
properties.put(distributionNode.get("id").asText(), mapper.writeValueAsString(standardFormats));
|
|
||||||
}
|
|
||||||
} catch (JsonProcessingException e) {
|
|
||||||
logger.error(e.getMessage(), e);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
else if(style.equals("freetext")){
|
case DATA_ACCESS:
|
||||||
properties.put(distributionNode.get("id").asText(), String.join(", ", rda.getFormat()));
|
properties.put(distributionNode.get("id").asText(), rda.getDataAccess().value());
|
||||||
}
|
break;
|
||||||
}
|
case BYTE_SIZE:
|
||||||
break;
|
if (rda.getByteSize() != null) {
|
||||||
case LICENSE:
|
properties.put(distributionNode.get("id").asText(), rda.getByteSize().toString());
|
||||||
if (rda.getLicense() != null && !rda.getLicense().isEmpty()) {
|
}
|
||||||
properties.putAll(LicenseRDAMapper.toProperties(rda.getLicense().get(0), root));
|
break;
|
||||||
}
|
case FORMAT:
|
||||||
break;
|
if (rda.getFormat() != null && !rda.getFormat().isEmpty()) {
|
||||||
case HOST:
|
String style = distributionNode.get("viewStyle").get("renderStyle").asText();
|
||||||
if (rda.getHost() != null) {
|
if(style.equals("combobox")) {
|
||||||
properties.putAll(HostRDAMapper.toProperties(rda.getHost()));
|
if (distributionNode.get("data").get("type").asText().equals("autocomplete")) {
|
||||||
|
Map<String, Object> additionalProperties = rda.getAdditionalProperties();
|
||||||
|
List<Object> standardFormats = new ArrayList<>();
|
||||||
|
rda.getAdditionalProperties().forEach((key, value) -> {
|
||||||
|
try {
|
||||||
|
if (key.matches("format\\d+")) {
|
||||||
|
standardFormats.add(additionalProperties.get(key));
|
||||||
|
properties.put(distributionNode.get("id").asText(), mapper.writeValueAsString(standardFormats));
|
||||||
|
}
|
||||||
|
} catch (JsonProcessingException e) {
|
||||||
|
logger.error(e.getMessage(), e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(style.equals("freetext")){
|
||||||
|
properties.put(distributionNode.get("id").asText(), String.join(", ", rda.getFormat()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case LICENSE:
|
||||||
|
if (rda.getLicense() != null && !rda.getLicense().isEmpty()) {
|
||||||
|
properties.putAll(LicenseRDAMapper.toProperties(rda.getLicense().get(0), root));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case HOST:
|
||||||
|
if (rda.getHost() != null) {
|
||||||
|
properties.putAll(HostRDAMapper.toProperties(rda.getHost()));
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -258,7 +276,10 @@ public class DistributionRDAMapper {
|
||||||
public static Distribution toRDA(List<JsonNode> nodes) {
|
public static Distribution toRDA(List<JsonNode> nodes) {
|
||||||
Distribution rda = new Distribution();
|
Distribution rda = new Distribution();
|
||||||
for (JsonNode node: nodes) {
|
for (JsonNode node: nodes) {
|
||||||
String rdaProperty = node.get("rdaProperty").asText();
|
String rdaProperty = getRdaDistributionProperty(node);
|
||||||
|
if(rdaProperty.isEmpty()){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
String rdaValue = node.get("value").asText();
|
String rdaValue = node.get("value").asText();
|
||||||
for (ExportPropertyName exportPropertyName: ExportPropertyName.values()) {
|
for (ExportPropertyName exportPropertyName: ExportPropertyName.values()) {
|
||||||
if (rdaProperty.contains(exportPropertyName.getName())) {
|
if (rdaProperty.contains(exportPropertyName.getName())) {
|
||||||
|
@ -288,11 +309,29 @@ public class DistributionRDAMapper {
|
||||||
rda.setFormat(Collections.singletonList(rdaValue));
|
rda.setFormat(Collections.singletonList(rdaValue));
|
||||||
break;
|
break;
|
||||||
case LICENSE:
|
case LICENSE:
|
||||||
List<JsonNode> licenseNodes = nodes.stream().filter(lnode -> lnode.get("rdaProperty").asText().toLowerCase().contains("license")).collect(Collectors.toList());
|
List<JsonNode> licenseNodes = nodes.stream().filter(lnode -> {
|
||||||
|
if(lnode.get("schematics").isArray()){
|
||||||
|
for(JsonNode schematic: lnode.get("schematics")){
|
||||||
|
if(schematic.asText().startsWith("rda.dataset.distribution.license")){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
rda.setLicense(Collections.singletonList(LicenseRDAMapper.toRDA(licenseNodes)));
|
rda.setLicense(Collections.singletonList(LicenseRDAMapper.toRDA(licenseNodes)));
|
||||||
break;
|
break;
|
||||||
case HOST:
|
case HOST:
|
||||||
List<JsonNode> hostNodes = nodes.stream().filter(lnode -> lnode.get("rdaProperty").asText().toLowerCase().contains("host")).collect(Collectors.toList());
|
List<JsonNode> hostNodes = nodes.stream().filter(lnode -> {
|
||||||
|
if(lnode.get("schematics").isArray()){
|
||||||
|
for(JsonNode schematic: lnode.get("schematics")){
|
||||||
|
if(schematic.asText().startsWith("rda.dataset.distribution.host")){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
rda.setHost(HostRDAMapper.toRDA(hostNodes, "0"));
|
rda.setHost(HostRDAMapper.toRDA(hostNodes, "0"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -333,6 +372,20 @@ public class DistributionRDAMapper {
|
||||||
return rda;
|
return rda;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String getRdaDistributionProperty(JsonNode node) {
|
||||||
|
String rdaProperty = "";
|
||||||
|
JsonNode schematics = node.get("schematics");
|
||||||
|
if(schematics.isArray()){
|
||||||
|
for(JsonNode schematic: schematics){
|
||||||
|
if(schematic.asText().startsWith("rda.dataset.distribution")){
|
||||||
|
rdaProperty = schematic.asText();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return rdaProperty;
|
||||||
|
}
|
||||||
|
|
||||||
private static Distribution getRelative( Map<String, Distribution> rdaMap, String numbering) {
|
private static Distribution getRelative( Map<String, Distribution> rdaMap, String numbering) {
|
||||||
return rdaMap.entrySet().stream().filter(entry -> MyStringUtils.getFirstDifference(entry.getKey(), numbering) > 0)
|
return rdaMap.entrySet().stream().filter(entry -> MyStringUtils.getFirstDifference(entry.getKey(), numbering) > 0)
|
||||||
.max(Comparator.comparingInt(entry -> MyStringUtils.getFirstDifference(entry.getKey(), numbering))).map(Map.Entry::getValue).orElse(new Distribution());
|
.max(Comparator.comparingInt(entry -> MyStringUtils.getFirstDifference(entry.getKey(), numbering))).map(Map.Entry::getValue).orElse(new Distribution());
|
||||||
|
|
|
@ -19,7 +19,19 @@ public class HostRDAMapper {
|
||||||
public static Host toRDA(List<JsonNode> nodes, String numbering) {
|
public static Host toRDA(List<JsonNode> nodes, String numbering) {
|
||||||
Host rda = new Host();
|
Host rda = new Host();
|
||||||
for (JsonNode node: nodes) {
|
for (JsonNode node: nodes) {
|
||||||
String rdaProperty = node.get("rdaProperty").asText();
|
String rdaProperty = "";
|
||||||
|
JsonNode schematics = node.get("schematics");
|
||||||
|
if(schematics.isArray()){
|
||||||
|
for(JsonNode schematic: schematics){
|
||||||
|
if(schematic.asText().startsWith("rda.dataset.distribution.host")){
|
||||||
|
rdaProperty = schematic.asText();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (rdaProperty.contains("host")) {
|
if (rdaProperty.contains("host")) {
|
||||||
int firstDiff = MyStringUtils.getFirstDifference(numbering, node.get("numbering").asText());
|
int firstDiff = MyStringUtils.getFirstDifference(numbering, node.get("numbering").asText());
|
||||||
if (firstDiff == -1 || firstDiff >= 2) {
|
if (firstDiff == -1 || firstDiff >= 2) {
|
||||||
|
|
|
@ -17,7 +17,19 @@ public class LicenseRDAMapper {
|
||||||
public static License toRDA(List<JsonNode> nodes) {
|
public static License toRDA(List<JsonNode> nodes) {
|
||||||
License rda = new License();
|
License rda = new License();
|
||||||
for (JsonNode node: nodes) {
|
for (JsonNode node: nodes) {
|
||||||
String rdaProperty = node.get("rdaProperty").asText();
|
String rdaProperty = "";
|
||||||
|
JsonNode schematics = node.get("schematics");
|
||||||
|
if(schematics.isArray()){
|
||||||
|
for(JsonNode schematic: schematics){
|
||||||
|
if(schematic.asText().startsWith("rda.dataset.distribution.license")){
|
||||||
|
rdaProperty = schematic.asText();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
String value = node.get("value").asText();
|
String value = node.get("value").asText();
|
||||||
if(value == null || value.isEmpty()){
|
if(value == null || value.isEmpty()){
|
||||||
continue;
|
continue;
|
||||||
|
@ -78,20 +90,26 @@ public class LicenseRDAMapper {
|
||||||
public static Map<String, String> toProperties(License rda, JsonNode root) {
|
public static Map<String, String> toProperties(License rda, JsonNode root) {
|
||||||
Map<String, String> properties = new HashMap<>();
|
Map<String, String> properties = new HashMap<>();
|
||||||
|
|
||||||
List<JsonNode> licenseNodes = JsonSearcher.findNodes(root, "rdaProperty", "dataset.distribution.license");
|
List<JsonNode> licenseNodes = JsonSearcher.findNodes(root, "schematics", "rda.dataset.distribution.license");
|
||||||
|
|
||||||
for (JsonNode licenseNode: licenseNodes) {
|
for (JsonNode licenseNode: licenseNodes) {
|
||||||
for (LicenceProperties licenceProperty: LicenceProperties.values()) {
|
for (LicenceProperties licenceProperty: LicenceProperties.values()) {
|
||||||
if (licenseNode.get("rdaProperty").asText().endsWith(licenceProperty.getName())) {
|
JsonNode schematics = licenseNode.get("schematics");
|
||||||
switch (licenceProperty) {
|
if(schematics.isArray()) {
|
||||||
case LICENSE_REF:
|
for (JsonNode schematic : schematics) {
|
||||||
if (rda.getLicenseRef() != null) {
|
if (schematic.asText().endsWith(licenceProperty.getName())) {
|
||||||
properties.put(licenseNode.get("id").asText(), rda.getLicenseRef().toString());
|
switch (licenceProperty) {
|
||||||
|
case LICENSE_REF:
|
||||||
|
if (rda.getLicenseRef() != null) {
|
||||||
|
properties.put(licenseNode.get("id").asText(), rda.getLicenseRef().toString());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case START_DATE:
|
||||||
|
properties.put(licenseNode.get("id").asText(), rda.getStartDate());
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
}
|
||||||
case START_DATE:
|
break;
|
||||||
properties.put(licenseNode.get("id").asText(), rda.getStartDate());
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,19 @@ public class MetadataRDAMapper {
|
||||||
Map<String, String> rdaMap = new HashMap<>();
|
Map<String, String> rdaMap = new HashMap<>();
|
||||||
List<Metadatum> rdas = new ArrayList<>();
|
List<Metadatum> rdas = new ArrayList<>();
|
||||||
for (JsonNode node: nodes) {
|
for (JsonNode node: nodes) {
|
||||||
String rdaProperty = node.get("rdaProperty").asText();
|
String rdaProperty = "";
|
||||||
|
JsonNode schematics = node.get("schematics");
|
||||||
|
if(schematics.isArray()){
|
||||||
|
for(JsonNode schematic: schematics){
|
||||||
|
if(schematic.asText().startsWith("rda.dataset.metadata")){
|
||||||
|
rdaProperty = schematic.asText();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
JsonNode rdaValue = node.get("value");
|
JsonNode rdaValue = node.get("value");
|
||||||
|
|
||||||
for (PropertyName propertyName: PropertyName.values()) {
|
for (PropertyName propertyName: PropertyName.values()) {
|
||||||
|
@ -119,7 +131,16 @@ public class MetadataRDAMapper {
|
||||||
|
|
||||||
public static Metadatum toRDA(JsonNode node) {
|
public static Metadatum toRDA(JsonNode node) {
|
||||||
Metadatum rda = new Metadatum();
|
Metadatum rda = new Metadatum();
|
||||||
String rdaProperty = node.get("rdaProperty").asText();
|
String rdaProperty = "";
|
||||||
|
JsonNode schematics = node.get("schematics");
|
||||||
|
if(schematics.isArray()){
|
||||||
|
for(JsonNode schematic: schematics){
|
||||||
|
if(schematic.asText().startsWith("rda.dataset.metadata")){
|
||||||
|
rdaProperty = schematic.asText();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
JsonNode rdaValue = node.get("value");
|
JsonNode rdaValue = node.get("value");
|
||||||
if (rdaProperty.contains("metadata_standard_id")) {
|
if (rdaProperty.contains("metadata_standard_id")) {
|
||||||
if (rdaValue instanceof ArrayNode) {
|
if (rdaValue instanceof ArrayNode) {
|
||||||
|
|
|
@ -16,7 +16,19 @@ public class SecurityAndPrivacyRDAMapper {
|
||||||
Map<String, SecurityAndPrivacy> rdaMap = new HashMap<>();
|
Map<String, SecurityAndPrivacy> rdaMap = new HashMap<>();
|
||||||
|
|
||||||
for (JsonNode node: nodes) {
|
for (JsonNode node: nodes) {
|
||||||
String rdaProperty = node.get("rdaProperty").asText();
|
String rdaProperty = "";
|
||||||
|
JsonNode schematics = node.get("schematics");
|
||||||
|
if(schematics.isArray()){
|
||||||
|
for(JsonNode schematic: schematics){
|
||||||
|
if(schematic.asText().startsWith("rda.dataset.security_and_privacy")){
|
||||||
|
rdaProperty = schematic.asText();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
String rdaValue = node.get("value").asText();
|
String rdaValue = node.get("value").asText();
|
||||||
if(rdaValue == null || rdaValue.isEmpty()){
|
if(rdaValue == null || rdaValue.isEmpty()){
|
||||||
continue;
|
continue;
|
||||||
|
@ -69,8 +81,17 @@ public class SecurityAndPrivacyRDAMapper {
|
||||||
|
|
||||||
public static SecurityAndPrivacy toRDA(JsonNode node) {
|
public static SecurityAndPrivacy toRDA(JsonNode node) {
|
||||||
SecurityAndPrivacy rda = new SecurityAndPrivacy();
|
SecurityAndPrivacy rda = new SecurityAndPrivacy();
|
||||||
String rdaProperty = node.get("rdaProperty").asText();
|
String rdaProperty = "";
|
||||||
String value =node.get("value").asText();
|
JsonNode schematics = node.get("schematics");
|
||||||
|
if(schematics.isArray()){
|
||||||
|
for(JsonNode schematic: schematics){
|
||||||
|
if(schematic.asText().startsWith("rda.dataset.security_and_privacy")){
|
||||||
|
rdaProperty = schematic.asText();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
String value = node.get("value").asText();
|
||||||
|
|
||||||
if (rdaProperty.contains("description")) {
|
if (rdaProperty.contains("description")) {
|
||||||
rda.setDescription(value);
|
rda.setDescription(value);
|
||||||
|
|
|
@ -16,7 +16,19 @@ public class TechnicalResourceRDAMapper {
|
||||||
Map<String, TechnicalResource> rdaMap = new HashMap<>();
|
Map<String, TechnicalResource> rdaMap = new HashMap<>();
|
||||||
|
|
||||||
for (JsonNode node: nodes) {
|
for (JsonNode node: nodes) {
|
||||||
String rdaProperty = node.get("rdaProperty").asText();
|
String rdaProperty = "";
|
||||||
|
JsonNode schematics = node.get("schematics");
|
||||||
|
if(schematics.isArray()){
|
||||||
|
for(JsonNode schematic: schematics){
|
||||||
|
if(schematic.asText().startsWith("rda.dataset.technical_resource")){
|
||||||
|
rdaProperty = schematic.asText();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
String rdaValue = node.get("value").asText();
|
String rdaValue = node.get("value").asText();
|
||||||
if(rdaValue == null || rdaValue.isEmpty()){
|
if(rdaValue == null || rdaValue.isEmpty()){
|
||||||
continue;
|
continue;
|
||||||
|
@ -70,7 +82,16 @@ public class TechnicalResourceRDAMapper {
|
||||||
|
|
||||||
public static TechnicalResource toRDA(JsonNode node) {
|
public static TechnicalResource toRDA(JsonNode node) {
|
||||||
TechnicalResource rda = new TechnicalResource();
|
TechnicalResource rda = new TechnicalResource();
|
||||||
String rdaProperty = node.get("rdaProperty").asText();
|
String rdaProperty = "";
|
||||||
|
JsonNode schematics = node.get("schematics");
|
||||||
|
if(schematics.isArray()){
|
||||||
|
for(JsonNode schematic: schematics){
|
||||||
|
if(schematic.asText().startsWith("rda.dataset.technical_resource")){
|
||||||
|
rdaProperty = schematic.asText();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
String value = node.get("value").asText();
|
String value = node.get("value").asText();
|
||||||
|
|
||||||
if (rdaProperty.contains("description")) {
|
if (rdaProperty.contains("description")) {
|
||||||
|
|
Loading…
Reference in New Issue