WIP: graph cleaner implementation

This commit is contained in:
Claudio Atzori 2020-06-15 18:32:24 +02:00
parent c15c8c0ad0
commit 2a4f65795f
6 changed files with 1400 additions and 1412 deletions

View File

@ -61,7 +61,7 @@ public class Vocabulary implements Serializable {
}
public VocabularyTerm getTermBySynonym(final String syn) {
return getTerm(synonyms.get(syn));
return getTerm(synonyms.get(syn.toLowerCase()));
}
public Qualifier getTermAsQualifier(final String termId) {

View File

@ -3,7 +3,6 @@ package eu.dnetlib.dhp.oa.graph.raw.common;
import java.io.Serializable;
import java.util.*;
import java.util.function.Supplier;
import java.util.stream.Collectors;
import org.apache.commons.lang3.StringUtils;
@ -46,7 +45,7 @@ public class VocabularyGroup implements Serializable {
}
vocs.addTerm(vocId, termId, termName);
vocs.addSynonyms(vocId, termId, termId);
// vocs.addSynonyms(vocId, termId, termId);
}
}
@ -58,7 +57,7 @@ public class VocabularyGroup implements Serializable {
final String syn = arr[2].trim();
vocs.addSynonyms(vocId, termId, syn);
vocs.addSynonyms(vocId, termId, termId);
// vocs.addSynonyms(vocId, termId, termId);
}
}
@ -135,7 +134,7 @@ public class VocabularyGroup implements Serializable {
Optional
.ofNullable(vocs.get(id))
.orElseThrow(() -> new IllegalArgumentException("missing vocabulary id: " + vocId))
.addSynonym(syn, termId);
.addSynonym(syn.toLowerCase(), termId);
}
}

View File

@ -60,8 +60,8 @@ public class CleaningFunctionTest {
assertNotNull(p_out);
assertEquals("eng", p_out.getLanguage().getClassid());
assertEquals("English", p_out.getLanguage().getClassname());
assertEquals("und", p_out.getLanguage().getClassid());
assertEquals("Undetermined", p_out.getLanguage().getClassname());
assertEquals("0018", p_out.getInstance().get(0).getInstancetype().getClassid());
assertEquals("Annotation", p_out.getInstance().get(0).getInstancetype().getClassname());

View File

@ -281,8 +281,8 @@
"value": "VIRTA"
},
"instancetype": {
"classid": "Comentario",
"classname": "Comentario",
"classid": "Comment/debate",
"classname": "Comment/debate",
"schemeid": "dnet:publication_resource",
"schemename": "dnet:publication_resource"
},
@ -317,8 +317,8 @@
"vol": ""
},
"language": {
"classid": "en",
"classname": "en",
"classid": "UNKNOWN",
"classname": "UNKNOWN",
"schemeid": "dnet:languages",
"schemename": "dnet:languages"
},