merging from master branch
This commit is contained in:
parent
3916f838a7
commit
8e32f2bb32
|
@ -4,6 +4,7 @@ package eu.dnetlib.dhp.schema.action;
|
|||
import java.io.IOException;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
import com.fasterxml.jackson.databind.JsonDeserializer;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
|
@ -11,10 +12,10 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
|||
|
||||
import eu.dnetlib.dhp.schema.oaf.Oaf;
|
||||
|
||||
public class AtomicActionDeserializer extends JsonDeserializer<AtomicAction> {
|
||||
public class AtomicActionDeserializer extends JsonDeserializer {
|
||||
|
||||
@Override
|
||||
public AtomicAction deserialize(JsonParser jp, DeserializationContext ctxt)
|
||||
public Object deserialize(JsonParser jp, DeserializationContext ctxt)
|
||||
throws IOException {
|
||||
JsonNode node = jp.getCodec().readTree(jp);
|
||||
String classTag = node.get("clazz").asText();
|
||||
|
|
|
@ -0,0 +1,69 @@
|
|||
|
||||
package eu.dnetlib.dhp.schema.common;
|
||||
|
||||
import java.util.Comparator;
|
||||
|
||||
import eu.dnetlib.dhp.schema.oaf.Qualifier;
|
||||
|
||||
public class LicenseComparator implements Comparator<Qualifier> {
|
||||
|
||||
@Override
|
||||
public int compare(Qualifier left, Qualifier right) {
|
||||
|
||||
if (left == null && right == null)
|
||||
return 0;
|
||||
if (left == null)
|
||||
return 1;
|
||||
if (right == null)
|
||||
return -1;
|
||||
|
||||
String lClass = left.getClassid();
|
||||
String rClass = right.getClassid();
|
||||
|
||||
if (lClass.equals(rClass))
|
||||
return 0;
|
||||
|
||||
if (lClass.equals("OPEN SOURCE"))
|
||||
return -1;
|
||||
if (rClass.equals("OPEN SOURCE"))
|
||||
return 1;
|
||||
|
||||
if (lClass.equals("OPEN"))
|
||||
return -1;
|
||||
if (rClass.equals("OPEN"))
|
||||
return 1;
|
||||
|
||||
if (lClass.equals("6MONTHS"))
|
||||
return -1;
|
||||
if (rClass.equals("6MONTHS"))
|
||||
return 1;
|
||||
|
||||
if (lClass.equals("12MONTHS"))
|
||||
return -1;
|
||||
if (rClass.equals("12MONTHS"))
|
||||
return 1;
|
||||
|
||||
if (lClass.equals("EMBARGO"))
|
||||
return -1;
|
||||
if (rClass.equals("EMBARGO"))
|
||||
return 1;
|
||||
|
||||
if (lClass.equals("RESTRICTED"))
|
||||
return -1;
|
||||
if (rClass.equals("RESTRICTED"))
|
||||
return 1;
|
||||
|
||||
if (lClass.equals("CLOSED"))
|
||||
return -1;
|
||||
if (rClass.equals("CLOSED"))
|
||||
return 1;
|
||||
|
||||
if (lClass.equals("UNKNOWN"))
|
||||
return -1;
|
||||
if (rClass.equals("UNKNOWN"))
|
||||
return 1;
|
||||
|
||||
// Else (but unlikely), lexicographical ordering will do.
|
||||
return lClass.compareTo(rClass);
|
||||
}
|
||||
}
|
|
@ -1,7 +1,9 @@
|
|||
|
||||
package eu.dnetlib.dhp.schema.common;
|
||||
|
||||
import eu.dnetlib.dhp.schema.oaf.*;
|
||||
import eu.dnetlib.dhp.schema.oaf.DataInfo;
|
||||
import eu.dnetlib.dhp.schema.oaf.KeyValue;
|
||||
import eu.dnetlib.dhp.schema.oaf.Qualifier;
|
||||
|
||||
public class ModelConstants {
|
||||
|
||||
|
@ -9,45 +11,21 @@ public class ModelConstants {
|
|||
public static final String ORCID_PENDING = "orcid_pending";
|
||||
public static final String ORCID_CLASSNAME = "Open Researcher and Contributor ID";
|
||||
|
||||
public static final String CROSSREF_ID = "10|openaire____::081b82f96300b6a6e3d282bad31cb6e2";
|
||||
public static final String DATACITE_ID = "10|openaire____::9e3be59865b2c1c335d32dae2fe7b254";
|
||||
|
||||
public static final String EUROPE_PUBMED_CENTRAL_ID = "10|opendoar____::8b6dd7db9af49e67306feb59a8bdc52c";
|
||||
public static final String PUBMED_CENTRAL_ID = "10|opendoar____::eda80a3d5b344bc40f3bc04f65b7a357";
|
||||
public static final String ARXIV_ID = "10|opendoar____::6f4922f45568161a8cdf4ad2299f6d23";
|
||||
|
||||
public static final String OPENORGS_NAME = "OpenOrgs Database";
|
||||
|
||||
// VOCABULARY VALUE
|
||||
public static final String ACCESS_RIGHT_OPEN = "OPEN";
|
||||
|
||||
public static final String DNET_SUBJECT_TYPOLOGIES = "dnet:subject_classification_typologies";
|
||||
public static final String DNET_RESULT_TYPOLOGIES = "dnet:result_typologies";
|
||||
public static final String DNET_PUBLICATION_RESOURCE = "dnet:publication_resource";
|
||||
public static final String DNET_ACCESS_MODES = "dnet:access_modes";
|
||||
public static final String DNET_LANGUAGES = "dnet:languages";
|
||||
public static final String DNET_PID_TYPES = "dnet:pid_types";
|
||||
public static final String DNET_DATACITE_DATE = "dnet:dataCite_date";
|
||||
public static final String DNET_DATACITE_TITLE = "dnet:dataCite_title";
|
||||
public static final String DNET_DATA_CITE_DATE = "dnet:dataCite_date";
|
||||
public static final String DNET_DATA_CITE_RESOURCE = "dnet:dataCite_resource";
|
||||
public static final String DNET_PROVENANCE_ACTIONS = "dnet:provenanceActions";
|
||||
public static final String DNET_COUNTRY_TYPE = "dnet:countries";
|
||||
public static final String DNET_REVIEW_LEVELS = "dnet:review_levels";
|
||||
public static final String DNET_PROGRAMMING_LANGUAGES = "dnet:programming_languages";
|
||||
public static final String DNET_EXTERNAL_REF_TYPES = "dnet:externalReference_typologies";
|
||||
|
||||
public static final String SYSIMPORT_CROSSWALK_REPOSITORY = "sysimport:crosswalk:repository";
|
||||
public static final String SYSIMPORT_CROSSWALK_ENTITYREGISTRY = "sysimport:crosswalk:entityregistry";
|
||||
public static final String SYSIMPORT_ACTIONSET = "sysimport:actionset";
|
||||
public static final String SYSIMPORT_ORCID_NO_DOI = "sysimport:actionset:orcidworks-no-doi";
|
||||
|
||||
public static final String USER_CLAIM = "user:claim";
|
||||
public static final String HARVESTED = "Harvested";
|
||||
|
||||
public static final String PROVENANCE_DEDUP = "sysimport:dedup";
|
||||
|
||||
public static final Qualifier PROVENANCE_ACTION_SET_QUALIFIER = qualifier(
|
||||
SYSIMPORT_ACTIONSET, SYSIMPORT_ACTIONSET, DNET_PROVENANCE_ACTIONS, DNET_PROVENANCE_ACTIONS);
|
||||
|
||||
public static final String DATASET_RESULTTYPE_CLASSID = "dataset";
|
||||
public static final String PUBLICATION_RESULTTYPE_CLASSID = "publication";
|
||||
|
@ -66,12 +44,12 @@ public class ModelConstants {
|
|||
public static final String IS_SUPPLEMENTED_BY = "isSupplementedBy";
|
||||
public static final String PART = "part";
|
||||
public static final String IS_PART_OF = "isPartOf";
|
||||
public static final String HAS_PART = "hasPart";
|
||||
public static final String HAS_PARTS = "hasParts";
|
||||
public static final String RELATIONSHIP = "relationship";
|
||||
public static final String CITATION = "citation";
|
||||
public static final String CITES = "cites";
|
||||
public static final String IS_CITED_BY = "isCitedBy";
|
||||
public static final String REVIEW = "review"; // subreltype
|
||||
public static final String REVIEW = "review";
|
||||
public static final String REVIEWS = "reviews";
|
||||
public static final String IS_REVIEWED_BY = "isReviewedBy";
|
||||
|
||||
|
@ -95,16 +73,7 @@ public class ModelConstants {
|
|||
public static final String IS_AUTHOR_INSTITUTION_OF = "isAuthorInstitutionOf";
|
||||
public static final String HAS_AUTHOR_INSTITUTION = "hasAuthorInstitution";
|
||||
|
||||
public static final String ORG_ORG_RELTYPE = "organizationOrganization";
|
||||
|
||||
public static final String DEDUP = "dedup";
|
||||
public static final String MERGES = "merges";
|
||||
public static final String IS_MERGED_IN = "isMergedIn";
|
||||
|
||||
public static final String SIMILARITY = "similarity";
|
||||
public static final String IS_SIMILAR_TO = "isSimilarTo";
|
||||
|
||||
public static final String IS_DIFFERENT_FROM = "isDifferentFrom";
|
||||
|
||||
public static final String UNKNOWN = "UNKNOWN";
|
||||
public static final String NOT_AVAILABLE = "not available";
|
||||
|
@ -133,25 +102,11 @@ public class ModelConstants {
|
|||
SYSIMPORT_CROSSWALK_ENTITYREGISTRY, SYSIMPORT_CROSSWALK_ENTITYREGISTRY,
|
||||
DNET_PROVENANCE_ACTIONS, DNET_PROVENANCE_ACTIONS);
|
||||
|
||||
public static final String UNKNOWN_REPOSITORY_ORIGINALID = "openaire____::1256f046-bf1f-4afc-8b47-d0b147148b18";
|
||||
public static final KeyValue UNKNOWN_REPOSITORY = keyValue(
|
||||
"10|openaire____::55045bd2a65019fd8e6741a755395c8c", "Unknown Repository");
|
||||
|
||||
public static final Qualifier UNKNOWN_COUNTRY = qualifier(UNKNOWN, "Unknown", DNET_COUNTRY_TYPE, DNET_COUNTRY_TYPE);
|
||||
|
||||
public static final Qualifier MAIN_TITLE_QUALIFIER = qualifier(
|
||||
"main title", "main title", DNET_DATACITE_TITLE, DNET_DATACITE_TITLE);
|
||||
|
||||
public static final AccessRight OPEN_ACCESS_RIGHT() {
|
||||
|
||||
final AccessRight result = new AccessRight();
|
||||
result.setClassid(ACCESS_RIGHT_OPEN);
|
||||
result.setClassid(ACCESS_RIGHT_OPEN);
|
||||
result.setSchemeid(ModelConstants.DNET_ACCESS_MODES);
|
||||
result.setSchemename(ModelConstants.DNET_ACCESS_MODES);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static Qualifier qualifier(
|
||||
final String classid,
|
||||
final String classname,
|
||||
|
|
|
@ -3,19 +3,17 @@ package eu.dnetlib.dhp.schema.common;
|
|||
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.Instant;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.temporal.TemporalAccessor;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.apache.commons.codec.binary.Hex;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
|
@ -41,7 +39,7 @@ public class ModelSupport {
|
|||
/**
|
||||
* Defines the mapping between the actual entity types and the relative classes implementing them
|
||||
*/
|
||||
public static final Map<EntityType, Class<? extends OafEntity>> entityTypes = Maps.newHashMap();
|
||||
public static final Map<EntityType, Class> entityTypes = Maps.newHashMap();
|
||||
|
||||
static {
|
||||
entityTypes.put(EntityType.datasource, Datasource.class);
|
||||
|
@ -116,67 +114,67 @@ public class ModelSupport {
|
|||
relationInverseMap
|
||||
.put(
|
||||
"projectOrganization_participation_isParticipant", new RelationInverse()
|
||||
.setRelation(ModelConstants.IS_PARTICIPANT)
|
||||
.setInverse(ModelConstants.HAS_PARTICIPANT)
|
||||
.setRelType(ModelConstants.PROJECT_ORGANIZATION)
|
||||
.setSubReltype(ModelConstants.PARTICIPATION));
|
||||
.setRelation("isParticipant")
|
||||
.setInverse("hasParticipant")
|
||||
.setRelType("projectOrganization")
|
||||
.setSubReltype("participation"));
|
||||
relationInverseMap
|
||||
.put(
|
||||
"projectOrganization_participation_hasParticipant", new RelationInverse()
|
||||
.setInverse(ModelConstants.IS_PARTICIPANT)
|
||||
.setRelation(ModelConstants.HAS_PARTICIPANT)
|
||||
.setRelType(ModelConstants.PROJECT_ORGANIZATION)
|
||||
.setSubReltype(ModelConstants.PARTICIPATION));
|
||||
.setInverse("isParticipant")
|
||||
.setRelation("hasParticipant")
|
||||
.setRelType("projectOrganization")
|
||||
.setSubReltype("participation"));
|
||||
relationInverseMap
|
||||
.put(
|
||||
"resultOrganization_affiliation_hasAuthorInstitution", new RelationInverse()
|
||||
.setRelation(ModelConstants.HAS_AUTHOR_INSTITUTION)
|
||||
.setInverse(ModelConstants.IS_AUTHOR_INSTITUTION_OF)
|
||||
.setRelType(ModelConstants.RESULT_ORGANIZATION)
|
||||
.setSubReltype(ModelConstants.AFFILIATION));
|
||||
.setRelation("hasAuthorInstitution")
|
||||
.setInverse("isAuthorInstitutionOf")
|
||||
.setRelType("resultOrganization")
|
||||
.setSubReltype("affiliation"));
|
||||
relationInverseMap
|
||||
.put(
|
||||
"resultOrganization_affiliation_isAuthorInstitutionOf", new RelationInverse()
|
||||
.setInverse(ModelConstants.HAS_AUTHOR_INSTITUTION)
|
||||
.setRelation(ModelConstants.IS_AUTHOR_INSTITUTION_OF)
|
||||
.setRelType(ModelConstants.RESULT_ORGANIZATION)
|
||||
.setSubReltype(ModelConstants.AFFILIATION));
|
||||
.setInverse("hasAuthorInstitution")
|
||||
.setRelation("isAuthorInstitutionOf")
|
||||
.setRelType("resultOrganization")
|
||||
.setSubReltype("affiliation"));
|
||||
relationInverseMap
|
||||
.put(
|
||||
"organizationOrganization_dedup_merges", new RelationInverse()
|
||||
.setRelation(ModelConstants.MERGES)
|
||||
.setInverse(ModelConstants.IS_MERGED_IN)
|
||||
.setRelType(ModelConstants.ORG_ORG_RELTYPE)
|
||||
.setSubReltype(ModelConstants.DEDUP));
|
||||
.setRelation("merges")
|
||||
.setInverse("isMergedIn")
|
||||
.setRelType("organizationOrganization")
|
||||
.setSubReltype("dedup"));
|
||||
relationInverseMap
|
||||
.put(
|
||||
"organizationOrganization_dedup_isMergedIn", new RelationInverse()
|
||||
.setInverse(ModelConstants.MERGES)
|
||||
.setRelation(ModelConstants.IS_MERGED_IN)
|
||||
.setRelType(ModelConstants.ORG_ORG_RELTYPE)
|
||||
.setSubReltype(ModelConstants.DEDUP));
|
||||
.setInverse("merges")
|
||||
.setRelation("isMergedIn")
|
||||
.setRelType("organizationOrganization")
|
||||
.setSubReltype("dedup"));
|
||||
relationInverseMap
|
||||
.put(
|
||||
"organizationOrganization_dedupSimilarity_isSimilarTo", new RelationInverse()
|
||||
.setInverse(ModelConstants.IS_SIMILAR_TO)
|
||||
.setRelation(ModelConstants.IS_SIMILAR_TO)
|
||||
.setRelType(ModelConstants.ORG_ORG_RELTYPE)
|
||||
.setSubReltype(ModelConstants.DEDUP));
|
||||
.setInverse("isSimilarTo")
|
||||
.setRelation("isSimilarTo")
|
||||
.setRelType("organizationOrganization")
|
||||
.setSubReltype("dedupSimilarity"));
|
||||
|
||||
relationInverseMap
|
||||
.put(
|
||||
"resultProject_outcome_isProducedBy", new RelationInverse()
|
||||
.setRelation(ModelConstants.IS_PRODUCED_BY)
|
||||
.setInverse(ModelConstants.PRODUCES)
|
||||
.setRelType(ModelConstants.RESULT_PROJECT)
|
||||
.setSubReltype(ModelConstants.OUTCOME));
|
||||
.setRelation("isProducedBy")
|
||||
.setInverse("produces")
|
||||
.setRelType("resultProject")
|
||||
.setSubReltype("outcome"));
|
||||
relationInverseMap
|
||||
.put(
|
||||
"resultProject_outcome_produces", new RelationInverse()
|
||||
.setInverse(ModelConstants.IS_PRODUCED_BY)
|
||||
.setRelation(ModelConstants.PRODUCES)
|
||||
.setRelType(ModelConstants.RESULT_PROJECT)
|
||||
.setSubReltype(ModelConstants.OUTCOME));
|
||||
.setInverse("isProducedBy")
|
||||
.setRelation("produces")
|
||||
.setRelType("resultProject")
|
||||
.setSubReltype("outcome"));
|
||||
relationInverseMap
|
||||
.put(
|
||||
"projectPerson_contactPerson_isContact", new RelationInverse()
|
||||
|
@ -201,108 +199,115 @@ public class ModelSupport {
|
|||
relationInverseMap
|
||||
.put(
|
||||
"personPerson_dedup_merges", new RelationInverse()
|
||||
.setInverse(ModelConstants.IS_MERGED_IN)
|
||||
.setRelation(ModelConstants.MERGES)
|
||||
.setInverse("isMergedIn")
|
||||
.setRelation("merges")
|
||||
.setRelType("personPerson")
|
||||
.setSubReltype(ModelConstants.DEDUP));
|
||||
.setSubReltype("dedup"));
|
||||
relationInverseMap
|
||||
.put(
|
||||
"personPerson_dedup_isMergedIn", new RelationInverse()
|
||||
.setInverse(ModelConstants.MERGES)
|
||||
.setRelation(ModelConstants.IS_MERGED_IN)
|
||||
.setInverse("merges")
|
||||
.setRelation("isMergedIn")
|
||||
.setRelType("personPerson")
|
||||
.setSubReltype(ModelConstants.DEDUP));
|
||||
.setSubReltype("dedup"));
|
||||
relationInverseMap
|
||||
.put(
|
||||
"personPerson_dedupSimilarity_isSimilarTo", new RelationInverse()
|
||||
.setInverse(ModelConstants.IS_SIMILAR_TO)
|
||||
.setRelation(ModelConstants.IS_SIMILAR_TO)
|
||||
.setInverse("isSimilarTo")
|
||||
.setRelation("isSimilarTo")
|
||||
.setRelType("personPerson")
|
||||
.setSubReltype(ModelConstants.DEDUP));
|
||||
.setSubReltype("dedupSimilarity"));
|
||||
relationInverseMap
|
||||
.put(
|
||||
"datasourceOrganization_provision_isProvidedBy", new RelationInverse()
|
||||
.setInverse(ModelConstants.PROVIDES)
|
||||
.setRelation(ModelConstants.IS_PROVIDED_BY)
|
||||
.setRelType(ModelConstants.DATASOURCE_ORGANIZATION)
|
||||
.setSubReltype(ModelConstants.PROVISION));
|
||||
.setInverse("provides")
|
||||
.setRelation("isProvidedBy")
|
||||
.setRelType("datasourceOrganization")
|
||||
.setSubReltype("provision"));
|
||||
relationInverseMap
|
||||
.put(
|
||||
"datasourceOrganization_provision_provides", new RelationInverse()
|
||||
.setInverse(ModelConstants.IS_PROVIDED_BY)
|
||||
.setRelation(ModelConstants.PROVIDES)
|
||||
.setRelType(ModelConstants.DATASOURCE_ORGANIZATION)
|
||||
.setSubReltype(ModelConstants.PROVISION));
|
||||
.setInverse("isProvidedBy")
|
||||
.setRelation("provides")
|
||||
.setRelType("datasourceOrganization")
|
||||
.setSubReltype("provision"));
|
||||
relationInverseMap
|
||||
.put(
|
||||
"resultResult_similarity_hasAmongTopNSimilarDocuments", new RelationInverse()
|
||||
.setInverse("isAmongTopNSimilarDocuments")
|
||||
.setRelation("hasAmongTopNSimilarDocuments")
|
||||
.setRelType(ModelConstants.RESULT_RESULT)
|
||||
.setSubReltype(ModelConstants.SIMILARITY));
|
||||
.setRelType("resultResult")
|
||||
.setSubReltype("similarity"));
|
||||
relationInverseMap
|
||||
.put(
|
||||
"resultResult_similarity_isAmongTopNSimilarDocuments", new RelationInverse()
|
||||
.setInverse("hasAmongTopNSimilarDocuments")
|
||||
.setRelation("isAmongTopNSimilarDocuments")
|
||||
.setRelType(ModelConstants.RESULT_RESULT)
|
||||
.setSubReltype(ModelConstants.SIMILARITY));
|
||||
.setRelType("resultResult")
|
||||
.setSubReltype("similarity"));
|
||||
relationInverseMap
|
||||
.put(
|
||||
"resultResult_relationship_isRelatedTo", new RelationInverse()
|
||||
.setInverse(ModelConstants.IS_RELATED_TO)
|
||||
.setRelation(ModelConstants.IS_RELATED_TO)
|
||||
.setRelType(ModelConstants.RESULT_RESULT)
|
||||
.setSubReltype(ModelConstants.RELATIONSHIP));
|
||||
.setInverse("isRelatedTo")
|
||||
.setRelation("isRelatedTo")
|
||||
.setRelType("resultResult")
|
||||
.setSubReltype("relationship"));
|
||||
relationInverseMap
|
||||
.put(
|
||||
"resultResult_similarity_isAmongTopNSimilarDocuments", new RelationInverse()
|
||||
.setInverse("hasAmongTopNSimilarDocuments")
|
||||
.setRelation("isAmongTopNSimilarDocuments")
|
||||
.setRelType("resultResult")
|
||||
.setSubReltype("similarity"));
|
||||
relationInverseMap
|
||||
.put(
|
||||
"resultResult_supplement_isSupplementTo", new RelationInverse()
|
||||
.setInverse(ModelConstants.IS_SUPPLEMENTED_BY)
|
||||
.setRelation(ModelConstants.IS_SUPPLEMENT_TO)
|
||||
.setRelType(ModelConstants.RESULT_RESULT)
|
||||
.setSubReltype(ModelConstants.SUPPLEMENT));
|
||||
.setInverse("isSupplementedBy")
|
||||
.setRelation("isSupplementTo")
|
||||
.setRelType("resultResult")
|
||||
.setSubReltype("supplement"));
|
||||
relationInverseMap
|
||||
.put(
|
||||
"resultResult_supplement_isSupplementedBy", new RelationInverse()
|
||||
.setInverse(ModelConstants.IS_SUPPLEMENT_TO)
|
||||
.setRelation(ModelConstants.IS_SUPPLEMENTED_BY)
|
||||
.setRelType(ModelConstants.RESULT_RESULT)
|
||||
.setSubReltype(ModelConstants.SUPPLEMENT));
|
||||
.setInverse("isSupplementTo")
|
||||
.setRelation("isSupplementedBy")
|
||||
.setRelType("resultResult")
|
||||
.setSubReltype("supplement"));
|
||||
relationInverseMap
|
||||
.put(
|
||||
"resultResult_part_isPartOf", new RelationInverse()
|
||||
.setInverse(ModelConstants.HAS_PART)
|
||||
.setRelation(ModelConstants.IS_PART_OF)
|
||||
.setRelType(ModelConstants.RESULT_RESULT)
|
||||
.setSubReltype(ModelConstants.PART));
|
||||
.setInverse("hasPart")
|
||||
.setRelation("isPartOf")
|
||||
.setRelType("resultResult")
|
||||
.setSubReltype("part"));
|
||||
relationInverseMap
|
||||
.put(
|
||||
"resultResult_part_hasPart", new RelationInverse()
|
||||
.setInverse(ModelConstants.IS_PART_OF)
|
||||
.setRelation(ModelConstants.HAS_PART)
|
||||
.setRelType(ModelConstants.RESULT_RESULT)
|
||||
.setSubReltype(ModelConstants.PART));
|
||||
.setInverse("isPartOf")
|
||||
.setRelation("hasPart")
|
||||
.setRelType("resultResult")
|
||||
.setSubReltype("part"));
|
||||
relationInverseMap
|
||||
.put(
|
||||
"resultResult_dedup_merges", new RelationInverse()
|
||||
.setInverse(ModelConstants.IS_MERGED_IN)
|
||||
.setRelation(ModelConstants.MERGES)
|
||||
.setRelType(ModelConstants.RESULT_RESULT)
|
||||
.setSubReltype(ModelConstants.DEDUP));
|
||||
.setInverse("isMergedIn")
|
||||
.setRelation("merges")
|
||||
.setRelType("resultResult")
|
||||
.setSubReltype("dedup"));
|
||||
relationInverseMap
|
||||
.put(
|
||||
"resultResult_dedup_isMergedIn", new RelationInverse()
|
||||
.setInverse(ModelConstants.MERGES)
|
||||
.setRelation(ModelConstants.IS_MERGED_IN)
|
||||
.setRelType(ModelConstants.RESULT_RESULT)
|
||||
.setSubReltype(ModelConstants.DEDUP));
|
||||
.setInverse("merges")
|
||||
.setRelation("isMergedIn")
|
||||
.setRelType("resultResult")
|
||||
.setSubReltype("dedup"));
|
||||
relationInverseMap
|
||||
.put(
|
||||
"resultResult_dedupSimilarity_isSimilarTo", new RelationInverse()
|
||||
.setInverse(ModelConstants.IS_SIMILAR_TO)
|
||||
.setRelation(ModelConstants.IS_SIMILAR_TO)
|
||||
.setRelType(ModelConstants.RESULT_RESULT)
|
||||
.setSubReltype(ModelConstants.DEDUP));
|
||||
.setInverse("isSimilarTo")
|
||||
.setRelation("isSimilarTo")
|
||||
.setRelType("resultResult")
|
||||
.setSubReltype("dedupSimilarity"));
|
||||
|
||||
}
|
||||
|
||||
|
@ -376,8 +381,6 @@ public class ModelSupport {
|
|||
Field.class,
|
||||
GeoLocation.class,
|
||||
Instance.class,
|
||||
AccessRight.class,
|
||||
OpenAccessRoute.class,
|
||||
Journal.class,
|
||||
KeyValue.class,
|
||||
Oaf.class,
|
||||
|
@ -477,20 +480,6 @@ public class ModelSupport {
|
|||
return ((OafEntity) t).getId();
|
||||
}
|
||||
|
||||
public static String md5(final String s) {
|
||||
try {
|
||||
final MessageDigest md = MessageDigest.getInstance("MD5");
|
||||
md.update(s.getBytes(StandardCharsets.UTF_8));
|
||||
return new String(Hex.encodeHex(md.digest()));
|
||||
} catch (final NoSuchAlgorithmException e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static String generateIdentifier(final String originalId, final String nsPrefix) {
|
||||
return String.format("%s::%s", nsPrefix, md5(originalId));
|
||||
}
|
||||
|
||||
public static String oldest(String dateA, String dateB) throws ParseException {
|
||||
|
||||
if (StringUtils.isBlank(dateA)) {
|
||||
|
|
|
@ -12,7 +12,6 @@ public class Author implements Serializable {
|
|||
|
||||
private String surname;
|
||||
|
||||
// START WITH 1
|
||||
private Integer rank;
|
||||
|
||||
private List<StructuredProperty> pid;
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
package eu.dnetlib.dhp.schema.oaf;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public class ExternalReference implements Serializable {
|
||||
|
@ -12,12 +11,12 @@ public class ExternalReference implements Serializable {
|
|||
// title
|
||||
private String label;
|
||||
|
||||
// alternative labels
|
||||
private List<String> alternateLabel;
|
||||
|
||||
// text()
|
||||
private String url;
|
||||
|
||||
// ?? not mapped yet ??
|
||||
private String description;
|
||||
|
||||
// type
|
||||
private Qualifier qualifier;
|
||||
|
||||
|
@ -46,14 +45,6 @@ public class ExternalReference implements Serializable {
|
|||
this.label = label;
|
||||
}
|
||||
|
||||
public List<String> getAlternateLabel() {
|
||||
return alternateLabel;
|
||||
}
|
||||
|
||||
public void setAlternateLabel(List<String> alternateLabel) {
|
||||
this.alternateLabel = alternateLabel;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
@ -62,6 +53,14 @@ public class ExternalReference implements Serializable {
|
|||
this.url = url;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public Qualifier getQualifier() {
|
||||
return qualifier;
|
||||
}
|
||||
|
@ -104,6 +103,7 @@ public class ExternalReference implements Serializable {
|
|||
return Objects.equals(sitename, that.sitename)
|
||||
&& Objects.equals(label, that.label)
|
||||
&& Objects.equals(url, that.url)
|
||||
&& Objects.equals(description, that.description)
|
||||
&& Objects.equals(qualifier, that.qualifier)
|
||||
&& Objects.equals(refidentifier, that.refidentifier)
|
||||
&& Objects.equals(query, that.query)
|
||||
|
@ -114,7 +114,6 @@ public class ExternalReference implements Serializable {
|
|||
public int hashCode() {
|
||||
return Objects
|
||||
.hash(
|
||||
sitename, label, url, qualifier, refidentifier, query, dataInfo);
|
||||
sitename, label, url, description, qualifier, refidentifier, query, dataInfo);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ public class Instance implements Serializable {
|
|||
|
||||
private Field<String> license;
|
||||
|
||||
private AccessRight accessright;
|
||||
private Qualifier accessright;
|
||||
|
||||
private Qualifier instancetype;
|
||||
|
||||
|
@ -21,10 +21,6 @@ public class Instance implements Serializable {
|
|||
|
||||
private KeyValue collectedfrom;
|
||||
|
||||
private List<StructuredProperty> pid;
|
||||
|
||||
private List<StructuredProperty> alternateIdentifier;
|
||||
|
||||
private Field<String> dateofacceptance;
|
||||
|
||||
// ( article | book ) processing charges. Defined here to cope with possible wrongly typed
|
||||
|
@ -45,11 +41,11 @@ public class Instance implements Serializable {
|
|||
this.license = license;
|
||||
}
|
||||
|
||||
public AccessRight getAccessright() {
|
||||
public Qualifier getAccessright() {
|
||||
return accessright;
|
||||
}
|
||||
|
||||
public void setAccessright(AccessRight accessright) {
|
||||
public void setAccessright(Qualifier accessright) {
|
||||
this.accessright = accessright;
|
||||
}
|
||||
|
||||
|
@ -93,14 +89,6 @@ public class Instance implements Serializable {
|
|||
this.collectedfrom = collectedfrom;
|
||||
}
|
||||
|
||||
public List<StructuredProperty> getPid() {
|
||||
return pid;
|
||||
}
|
||||
|
||||
public void setPid(List<StructuredProperty> pid) {
|
||||
this.pid = pid;
|
||||
}
|
||||
|
||||
public Field<String> getDateofacceptance() {
|
||||
return dateofacceptance;
|
||||
}
|
||||
|
@ -109,14 +97,6 @@ public class Instance implements Serializable {
|
|||
this.dateofacceptance = dateofacceptance;
|
||||
}
|
||||
|
||||
public List<StructuredProperty> getAlternateIdentifier() {
|
||||
return alternateIdentifier;
|
||||
}
|
||||
|
||||
public void setAlternateIdentifier(List<StructuredProperty> alternateIdentifier) {
|
||||
this.alternateIdentifier = alternateIdentifier;
|
||||
}
|
||||
|
||||
public Field<String> getProcessingchargeamount() {
|
||||
return processingchargeamount;
|
||||
}
|
||||
|
@ -169,5 +149,4 @@ public class Instance implements Serializable {
|
|||
|
||||
return toComparableString().equals(other.toComparableString());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
|
||||
package eu.dnetlib.dhp.schema.oaf;
|
||||
|
||||
import eu.dnetlib.dhp.schema.common.ModelSupport;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
|
||||
import java.text.ParseException;
|
||||
|
@ -8,8 +10,6 @@ import java.util.*;
|
|||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import eu.dnetlib.dhp.schema.common.ModelSupport;
|
||||
|
||||
/**
|
||||
* Relation models any edge between two nodes in the OpenAIRE graph. It has a source id and a target id pointing to
|
||||
* graph node identifiers and it is further characterised by the semantic of the link through the fields relType,
|
||||
|
@ -137,10 +137,7 @@ public class Relation extends Oaf {
|
|||
try {
|
||||
setValidationDate(ModelSupport.oldest(getValidationDate(), r.getValidationDate()));
|
||||
} catch (ParseException e) {
|
||||
throw new IllegalArgumentException(String
|
||||
.format(
|
||||
"invalid validation date format in relation [s:%s, t:%s]: %s", getSource(), getTarget(),
|
||||
getValidationDate()));
|
||||
throw new IllegalArgumentException(String.format("invalid validation date format in relation [s:%s, t:%s]: %s", getSource(), getTarget(), getValidationDate()));
|
||||
}
|
||||
|
||||
super.mergeFrom(r);
|
||||
|
|
|
@ -2,11 +2,12 @@
|
|||
package eu.dnetlib.dhp.schema.oaf;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import eu.dnetlib.dhp.schema.common.AccessRightComparator;
|
||||
import eu.dnetlib.dhp.schema.common.LicenseComparator;
|
||||
|
||||
public class Result extends OafEntity implements Serializable {
|
||||
|
||||
|
@ -247,7 +248,7 @@ public class Result extends OafEntity implements Serializable {
|
|||
instance = mergeLists(instance, r.getInstance());
|
||||
|
||||
if (r.getBestaccessright() != null
|
||||
&& new AccessRightComparator().compare(r.getBestaccessright(), bestaccessright) < 0)
|
||||
&& new LicenseComparator().compare(r.getBestaccessright(), bestaccessright) < 0)
|
||||
bestaccessright = r.getBestaccessright();
|
||||
|
||||
if (r.getResulttype() != null && compareTrust(this, r) < 0)
|
||||
|
|
|
@ -2,13 +2,6 @@
|
|||
package eu.dnetlib.dhp.schema.oaf;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import com.google.common.base.Joiner;
|
||||
|
||||
public class StructuredProperty implements Serializable {
|
||||
|
||||
|
@ -43,12 +36,7 @@ public class StructuredProperty implements Serializable {
|
|||
}
|
||||
|
||||
public String toComparableString() {
|
||||
return Stream
|
||||
.of(
|
||||
getQualifier().toComparableString(),
|
||||
Optional.ofNullable(getValue()).map(String::toLowerCase).orElse(""))
|
||||
.filter(StringUtils::isNotBlank)
|
||||
.collect(Collectors.joining("||"));
|
||||
return value != null ? value.toLowerCase() : "";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package eu.dnetlib.dhp.schema.scholexplorer
|
||||
|
||||
import eu.dnetlib.dhp.schema.common.ModelConstants
|
||||
import eu.dnetlib.dhp.schema.oaf.{AccessRight, DataInfo, Field, KeyValue, Qualifier, StructuredProperty}
|
||||
import eu.dnetlib.dhp.schema.oaf.{DataInfo, Field, KeyValue, Qualifier, StructuredProperty}
|
||||
|
||||
object OafUtils {
|
||||
|
||||
|
@ -16,13 +15,13 @@ object OafUtils {
|
|||
}
|
||||
|
||||
|
||||
def generateDataInfo(trust: String = "0.9", invisible: Boolean = false): DataInfo = {
|
||||
def generateDataInfo(trust: String = "0.9", invisibile: Boolean = false): DataInfo = {
|
||||
val di = new DataInfo
|
||||
di.setDeletedbyinference(false)
|
||||
di.setInferred(false)
|
||||
di.setInvisible(invisible)
|
||||
di.setInvisible(false)
|
||||
di.setTrust(trust)
|
||||
di.setProvenanceaction(createQualifier(ModelConstants.SYSIMPORT_ACTIONSET, ModelConstants.DNET_PROVENANCE_ACTIONS))
|
||||
di.setProvenanceaction(createQualifier("sysimport:actionset", "dnet:provenanceActions"))
|
||||
di
|
||||
}
|
||||
|
||||
|
@ -40,15 +39,6 @@ object OafUtils {
|
|||
q
|
||||
}
|
||||
|
||||
def createAccessRight(classId: String, className: String, schemeId: String, schemeName: String): AccessRight = {
|
||||
val accessRight: AccessRight = new AccessRight
|
||||
accessRight.setClassid(classId)
|
||||
accessRight.setClassname(className)
|
||||
accessRight.setSchemeid(schemeId)
|
||||
accessRight.setSchemename(schemeName)
|
||||
accessRight
|
||||
}
|
||||
|
||||
|
||||
def asField[T](value: T): Field[T] = {
|
||||
val tmp = new Field[T]
|
||||
|
|
|
@ -10,7 +10,6 @@ import org.junit.jupiter.api.Test;
|
|||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import eu.dnetlib.dhp.schema.common.ModelConstants;
|
||||
import eu.dnetlib.dhp.schema.oaf.Relation;
|
||||
|
||||
/** @author claudio.atzori */
|
||||
|
@ -22,9 +21,9 @@ public class AtomicActionTest {
|
|||
Relation rel = new Relation();
|
||||
rel.setSource("1");
|
||||
rel.setTarget("2");
|
||||
rel.setRelType(ModelConstants.RESULT_RESULT);
|
||||
rel.setSubRelType(ModelConstants.DEDUP);
|
||||
rel.setRelClass(ModelConstants.MERGES);
|
||||
rel.setRelType("resultResult");
|
||||
rel.setSubRelType("dedup");
|
||||
rel.setRelClass("merges");
|
||||
|
||||
AtomicAction aa1 = new AtomicAction(Relation.class, rel);
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ package eu.dnetlib.dhp.schema.oaf;
|
|||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
import java.time.format.DateTimeParseException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -95,7 +94,7 @@ public class MergeTest {
|
|||
|
||||
@Test
|
||||
public void mergeRelationTestParseException() {
|
||||
assertThrows(DateTimeParseException.class, () -> {
|
||||
assertThrows(IllegalArgumentException.class, () -> {
|
||||
Relation a = createRel(true, "2016-04-05");
|
||||
Relation b = createRel(true, "2016-04-05");
|
||||
a.mergeFrom(b);
|
||||
|
|
|
@ -12,7 +12,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature;
|
|||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||
|
||||
import eu.dnetlib.dhp.schema.common.ModelConstants;
|
||||
import eu.dnetlib.dhp.schema.oaf.Qualifier;
|
||||
import eu.dnetlib.dhp.schema.oaf.StructuredProperty;
|
||||
|
||||
|
@ -21,7 +20,7 @@ public class DLItest {
|
|||
@Test
|
||||
public void testMergePublication() throws JsonProcessingException {
|
||||
DLIPublication a1 = new DLIPublication();
|
||||
a1.setPid(Arrays.asList(createSP("123456", "pdb", ModelConstants.DNET_PID_TYPES)));
|
||||
a1.setPid(Arrays.asList(createSP("123456", "pdb", "dnet:pid_types")));
|
||||
a1.setTitle(Collections.singletonList(createSP("Un Titolo", "title", "dnetTitle")));
|
||||
a1.setDlicollectedfrom(Arrays.asList(createCollectedFrom("znd", "Zenodo", "complete")));
|
||||
a1.setCompletionStatus("complete");
|
||||
|
@ -31,8 +30,8 @@ public class DLItest {
|
|||
.setPid(
|
||||
Arrays
|
||||
.asList(
|
||||
createSP("10.11", "doi", ModelConstants.DNET_PID_TYPES),
|
||||
createSP("123456", "pdb", ModelConstants.DNET_PID_TYPES)));
|
||||
createSP("10.11", "doi", "dnet:pid_types"),
|
||||
createSP("123456", "pdb", "dnet:pid_types")));
|
||||
a.setTitle(Collections.singletonList(createSP("A Title", "title", "dnetTitle")));
|
||||
a
|
||||
.setDlicollectedfrom(
|
||||
|
|
Loading…
Reference in New Issue