From 9b0fc0ec2ec5aef8b2b38e635d6444e94e833092 Mon Sep 17 00:00:00 2001 From: Sandro La Bruzzo Date: Thu, 1 Jul 2021 14:29:47 +0200 Subject: [PATCH 01/18] [Scholexplorer]: Imported Scholix Schema and Scholix Summary data model on dhp-schemas --- .../dhp/schema/scholexplorer/DLIDataset.java | 89 ---------- .../schema/scholexplorer/DLIPublication.java | 87 ---------- .../dhp/schema/scholexplorer/DLIUnknown.java | 132 --------------- .../schema/scholexplorer/ProvenaceInfo.java | 47 ------ .../{scholexplorer => sx}/OafUtils.scala | 2 +- .../dhp/schema/sx/scholix/Scholix.java | 77 +++++++++ .../sx/scholix/ScholixCollectedFrom.java | 45 ++++++ .../schema/sx/scholix/ScholixEntityId.java | 34 ++++ .../schema/sx/scholix/ScholixIdentifier.java | 33 ++++ .../sx/scholix/ScholixRelationship.java | 43 +++++ .../schema/sx/scholix/ScholixResource.java | 153 ++++++++++++++++++ .../schema/sx/summary/CollectedFromType.java | 44 +++++ .../dhp/schema/sx/summary/SchemeValue.java | 33 ++++ .../dhp/schema/sx/summary/ScholixSummary.java | 128 +++++++++++++++ .../schema/sx/summary/TypedIdentifier.java | 33 ++++ .../dhp/schema/sx/summary/Typology.java | 8 + .../dhp/schema/scholexplorer/DLItest.java | 84 ---------- 17 files changed, 632 insertions(+), 440 deletions(-) delete mode 100644 src/main/java/eu/dnetlib/dhp/schema/scholexplorer/DLIDataset.java delete mode 100644 src/main/java/eu/dnetlib/dhp/schema/scholexplorer/DLIPublication.java delete mode 100644 src/main/java/eu/dnetlib/dhp/schema/scholexplorer/DLIUnknown.java delete mode 100644 src/main/java/eu/dnetlib/dhp/schema/scholexplorer/ProvenaceInfo.java rename src/main/java/eu/dnetlib/dhp/schema/{scholexplorer => sx}/OafUtils.scala (98%) create mode 100644 src/main/java/eu/dnetlib/dhp/schema/sx/scholix/Scholix.java create mode 100644 src/main/java/eu/dnetlib/dhp/schema/sx/scholix/ScholixCollectedFrom.java create mode 100644 src/main/java/eu/dnetlib/dhp/schema/sx/scholix/ScholixEntityId.java create mode 100644 src/main/java/eu/dnetlib/dhp/schema/sx/scholix/ScholixIdentifier.java create mode 100644 src/main/java/eu/dnetlib/dhp/schema/sx/scholix/ScholixRelationship.java create mode 100644 src/main/java/eu/dnetlib/dhp/schema/sx/scholix/ScholixResource.java create mode 100644 src/main/java/eu/dnetlib/dhp/schema/sx/summary/CollectedFromType.java create mode 100644 src/main/java/eu/dnetlib/dhp/schema/sx/summary/SchemeValue.java create mode 100644 src/main/java/eu/dnetlib/dhp/schema/sx/summary/ScholixSummary.java create mode 100644 src/main/java/eu/dnetlib/dhp/schema/sx/summary/TypedIdentifier.java create mode 100644 src/main/java/eu/dnetlib/dhp/schema/sx/summary/Typology.java delete mode 100644 src/test/java/eu/dnetlib/dhp/schema/scholexplorer/DLItest.java diff --git a/src/main/java/eu/dnetlib/dhp/schema/scholexplorer/DLIDataset.java b/src/main/java/eu/dnetlib/dhp/schema/scholexplorer/DLIDataset.java deleted file mode 100644 index 421b4ec..0000000 --- a/src/main/java/eu/dnetlib/dhp/schema/scholexplorer/DLIDataset.java +++ /dev/null @@ -1,89 +0,0 @@ - -package eu.dnetlib.dhp.schema.scholexplorer; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.apache.commons.lang3.StringUtils; - -import eu.dnetlib.dhp.schema.oaf.Dataset; -import eu.dnetlib.dhp.schema.oaf.OafEntity; - -public class DLIDataset extends Dataset { - - private String originalObjIdentifier; - - private List dlicollectedfrom; - - private String completionStatus; - - public String getCompletionStatus() { - return completionStatus; - } - - public void setCompletionStatus(String completionStatus) { - this.completionStatus = completionStatus; - } - - public List getDlicollectedfrom() { - return dlicollectedfrom; - } - - public void setDlicollectedfrom(List dlicollectedfrom) { - this.dlicollectedfrom = dlicollectedfrom; - } - - public String getOriginalObjIdentifier() { - return originalObjIdentifier; - } - - public void setOriginalObjIdentifier(String originalObjIdentifier) { - this.originalObjIdentifier = originalObjIdentifier; - } - - @Override - public void mergeFrom(OafEntity e) { - super.mergeFrom(e); - DLIDataset p = (DLIDataset) e; - if (StringUtils.isBlank(completionStatus) && StringUtils.isNotBlank(p.completionStatus)) - completionStatus = p.completionStatus; - if ("complete".equalsIgnoreCase(p.completionStatus)) - completionStatus = "complete"; - dlicollectedfrom = mergeProvenance(dlicollectedfrom, p.getDlicollectedfrom()); - } - - private List mergeProvenance( - final List a, final List b) { - Map result = new HashMap<>(); - if (a != null) - a - .forEach( - p -> { - if (p != null && StringUtils.isNotBlank(p.getId()) && result.containsKey(p.getId())) { - if ("incomplete".equalsIgnoreCase(result.get(p.getId()).getCompletionStatus()) - && StringUtils.isNotBlank(p.getCompletionStatus())) { - result.put(p.getId(), p); - } - - } else if (p != null && p.getId() != null && !result.containsKey(p.getId())) - result.put(p.getId(), p); - }); - if (b != null) - b - .forEach( - p -> { - if (p != null && StringUtils.isNotBlank(p.getId()) && result.containsKey(p.getId())) { - if ("incomplete".equalsIgnoreCase(result.get(p.getId()).getCompletionStatus()) - && StringUtils.isNotBlank(p.getCompletionStatus())) { - result.put(p.getId(), p); - } - - } else if (p != null && p.getId() != null && !result.containsKey(p.getId())) - result.put(p.getId(), p); - }); - - return new ArrayList<>(result.values()); - } -} diff --git a/src/main/java/eu/dnetlib/dhp/schema/scholexplorer/DLIPublication.java b/src/main/java/eu/dnetlib/dhp/schema/scholexplorer/DLIPublication.java deleted file mode 100644 index c899a89..0000000 --- a/src/main/java/eu/dnetlib/dhp/schema/scholexplorer/DLIPublication.java +++ /dev/null @@ -1,87 +0,0 @@ - -package eu.dnetlib.dhp.schema.scholexplorer; - -import java.io.Serializable; -import java.util.*; - -import org.apache.commons.lang3.StringUtils; - -import eu.dnetlib.dhp.schema.oaf.OafEntity; -import eu.dnetlib.dhp.schema.oaf.Publication; - -public class DLIPublication extends Publication implements Serializable { - - private String originalObjIdentifier; - - private List dlicollectedfrom; - - private String completionStatus; - - public String getCompletionStatus() { - return completionStatus; - } - - public void setCompletionStatus(String completionStatus) { - this.completionStatus = completionStatus; - } - - public List getDlicollectedfrom() { - return dlicollectedfrom; - } - - public void setDlicollectedfrom(List dlicollectedfrom) { - this.dlicollectedfrom = dlicollectedfrom; - } - - public String getOriginalObjIdentifier() { - return originalObjIdentifier; - } - - public void setOriginalObjIdentifier(String originalObjIdentifier) { - this.originalObjIdentifier = originalObjIdentifier; - } - - @Override - public void mergeFrom(OafEntity e) { - super.mergeFrom(e); - DLIPublication p = (DLIPublication) e; - if (StringUtils.isBlank(completionStatus) && StringUtils.isNotBlank(p.completionStatus)) - completionStatus = p.completionStatus; - if ("complete".equalsIgnoreCase(p.completionStatus)) - completionStatus = "complete"; - dlicollectedfrom = mergeProvenance(dlicollectedfrom, p.getDlicollectedfrom()); - } - - private List mergeProvenance( - final List a, final List b) { - Map result = new HashMap<>(); - if (a != null) - a - .forEach( - p -> { - if (p != null && StringUtils.isNotBlank(p.getId()) && result.containsKey(p.getId())) { - if ("incomplete".equalsIgnoreCase(result.get(p.getId()).getCompletionStatus()) - && StringUtils.isNotBlank(p.getCompletionStatus())) { - result.put(p.getId(), p); - } - - } else if (p != null && p.getId() != null && !result.containsKey(p.getId())) - result.put(p.getId(), p); - }); - if (b != null) - b - .forEach( - p -> { - if (p != null && StringUtils.isNotBlank(p.getId()) && result.containsKey(p.getId())) { - if ("incomplete".equalsIgnoreCase(result.get(p.getId()).getCompletionStatus()) - && StringUtils.isNotBlank(p.getCompletionStatus())) { - result.put(p.getId(), p); - } - - } else if (p != null && p.getId() != null && !result.containsKey(p.getId())) - result.put(p.getId(), p); - }); - - return new ArrayList<>(result.values()); - } -} diff --git a/src/main/java/eu/dnetlib/dhp/schema/scholexplorer/DLIUnknown.java b/src/main/java/eu/dnetlib/dhp/schema/scholexplorer/DLIUnknown.java deleted file mode 100644 index 5da5994..0000000 --- a/src/main/java/eu/dnetlib/dhp/schema/scholexplorer/DLIUnknown.java +++ /dev/null @@ -1,132 +0,0 @@ - -package eu.dnetlib.dhp.schema.scholexplorer; - -import java.io.Serializable; -import java.util.*; -import java.util.stream.Collectors; - -import org.apache.commons.lang3.StringUtils; - -import eu.dnetlib.dhp.schema.oaf.Oaf; -import eu.dnetlib.dhp.schema.oaf.StructuredProperty; - -public class DLIUnknown extends Oaf implements Serializable { - - private String id; - - private List pid; - - private String dateofcollection; - - private String dateoftransformation; - - private List dlicollectedfrom; - - private String completionStatus = "incomplete"; - - public String getCompletionStatus() { - return completionStatus; - } - - public void setCompletionStatus(String completionStatus) { - this.completionStatus = completionStatus; - } - - public List getDlicollectedfrom() { - return dlicollectedfrom; - } - - public void setDlicollectedfrom(List dlicollectedfrom) { - this.dlicollectedfrom = dlicollectedfrom; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public List getPid() { - return pid; - } - - public void setPid(List pid) { - this.pid = pid; - } - - public String getDateofcollection() { - return dateofcollection; - } - - public void setDateofcollection(String dateofcollection) { - this.dateofcollection = dateofcollection; - } - - public String getDateoftransformation() { - return dateoftransformation; - } - - public void setDateoftransformation(String dateoftransformation) { - this.dateoftransformation = dateoftransformation; - } - - public void mergeFrom(DLIUnknown p) { - if ("complete".equalsIgnoreCase(p.completionStatus)) - completionStatus = "complete"; - dlicollectedfrom = mergeProvenance(dlicollectedfrom, p.getDlicollectedfrom()); - if (StringUtils.isEmpty(id) && StringUtils.isNoneEmpty(p.getId())) - id = p.getId(); - if (StringUtils.isEmpty(dateofcollection) && StringUtils.isNoneEmpty(p.getDateofcollection())) - dateofcollection = p.getDateofcollection(); - - if (StringUtils.isEmpty(dateoftransformation) && StringUtils.isNoneEmpty(p.getDateoftransformation())) - dateofcollection = p.getDateoftransformation(); - pid = mergeLists(pid, p.getPid()); - } - - protected List mergeLists(final List... lists) { - - return Arrays - .stream(lists) - .filter(Objects::nonNull) - .flatMap(List::stream) - .filter(Objects::nonNull) - .distinct() - .collect(Collectors.toList()); - } - - private List mergeProvenance( - final List a, final List b) { - Map result = new HashMap<>(); - if (a != null) - a - .forEach( - p -> { - if (p != null && StringUtils.isNotBlank(p.getId()) && result.containsKey(p.getId())) { - if ("incomplete".equalsIgnoreCase(result.get(p.getId()).getCompletionStatus()) - && StringUtils.isNotBlank(p.getCompletionStatus())) { - result.put(p.getId(), p); - } - - } else if (p != null && p.getId() != null && !result.containsKey(p.getId())) - result.put(p.getId(), p); - }); - if (b != null) - b - .forEach( - p -> { - if (p != null && StringUtils.isNotBlank(p.getId()) && result.containsKey(p.getId())) { - if ("incomplete".equalsIgnoreCase(result.get(p.getId()).getCompletionStatus()) - && StringUtils.isNotBlank(p.getCompletionStatus())) { - result.put(p.getId(), p); - } - - } else if (p != null && p.getId() != null && !result.containsKey(p.getId())) - result.put(p.getId(), p); - }); - - return new ArrayList<>(result.values()); - } -} diff --git a/src/main/java/eu/dnetlib/dhp/schema/scholexplorer/ProvenaceInfo.java b/src/main/java/eu/dnetlib/dhp/schema/scholexplorer/ProvenaceInfo.java deleted file mode 100644 index b1188f0..0000000 --- a/src/main/java/eu/dnetlib/dhp/schema/scholexplorer/ProvenaceInfo.java +++ /dev/null @@ -1,47 +0,0 @@ - -package eu.dnetlib.dhp.schema.scholexplorer; - -import java.io.Serializable; - -public class ProvenaceInfo implements Serializable { - - private String id; - - private String name; - - private String completionStatus; - - private String collectionMode = "collected"; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getCompletionStatus() { - return completionStatus; - } - - public void setCompletionStatus(String completionStatus) { - this.completionStatus = completionStatus; - } - - public String getCollectionMode() { - return collectionMode; - } - - public void setCollectionMode(String collectionMode) { - this.collectionMode = collectionMode; - } -} diff --git a/src/main/java/eu/dnetlib/dhp/schema/scholexplorer/OafUtils.scala b/src/main/java/eu/dnetlib/dhp/schema/sx/OafUtils.scala similarity index 98% rename from src/main/java/eu/dnetlib/dhp/schema/scholexplorer/OafUtils.scala rename to src/main/java/eu/dnetlib/dhp/schema/sx/OafUtils.scala index b0cd344..b34a951 100644 --- a/src/main/java/eu/dnetlib/dhp/schema/scholexplorer/OafUtils.scala +++ b/src/main/java/eu/dnetlib/dhp/schema/sx/OafUtils.scala @@ -1,4 +1,4 @@ -package eu.dnetlib.dhp.schema.scholexplorer +package eu.dnetlib.dhp.schema.sx import eu.dnetlib.dhp.schema.common.ModelConstants import eu.dnetlib.dhp.schema.oaf.{AccessRight, DataInfo, Field, KeyValue, Qualifier, StructuredProperty} diff --git a/src/main/java/eu/dnetlib/dhp/schema/sx/scholix/Scholix.java b/src/main/java/eu/dnetlib/dhp/schema/sx/scholix/Scholix.java new file mode 100644 index 0000000..ca01cb5 --- /dev/null +++ b/src/main/java/eu/dnetlib/dhp/schema/sx/scholix/Scholix.java @@ -0,0 +1,77 @@ + +package eu.dnetlib.dhp.schema.sx.scholix; + +import java.io.Serializable; +import java.util.List; + +public class Scholix implements Serializable { + private String publicationDate; + + private List publisher; + + private List linkprovider; + + private ScholixRelationship relationship; + + private ScholixResource source; + + private ScholixResource target; + + private String identifier; + + public String getPublicationDate() { + return publicationDate; + } + + public void setPublicationDate(String publicationDate) { + this.publicationDate = publicationDate; + } + + public List getPublisher() { + return publisher; + } + + public void setPublisher(List publisher) { + this.publisher = publisher; + } + + public List getLinkprovider() { + return linkprovider; + } + + public void setLinkprovider(List linkprovider) { + this.linkprovider = linkprovider; + } + + public ScholixRelationship getRelationship() { + return relationship; + } + + public void setRelationship(ScholixRelationship relationship) { + this.relationship = relationship; + } + + public ScholixResource getSource() { + return source; + } + + public void setSource(ScholixResource source) { + this.source = source; + } + + public ScholixResource getTarget() { + return target; + } + + public void setTarget(ScholixResource target) { + this.target = target; + } + + public String getIdentifier() { + return identifier; + } + + public void setIdentifier(String identifier) { + this.identifier = identifier; + } +} diff --git a/src/main/java/eu/dnetlib/dhp/schema/sx/scholix/ScholixCollectedFrom.java b/src/main/java/eu/dnetlib/dhp/schema/sx/scholix/ScholixCollectedFrom.java new file mode 100644 index 0000000..e8e4551 --- /dev/null +++ b/src/main/java/eu/dnetlib/dhp/schema/sx/scholix/ScholixCollectedFrom.java @@ -0,0 +1,45 @@ + +package eu.dnetlib.dhp.schema.sx.scholix; + +import java.io.Serializable; + +public class ScholixCollectedFrom implements Serializable { + + private ScholixEntityId provider; + private String provisionMode; + private String completionStatus; + + public ScholixCollectedFrom() { + } + + public ScholixCollectedFrom( + ScholixEntityId provider, String provisionMode, String completionStatus) { + this.provider = provider; + this.provisionMode = provisionMode; + this.completionStatus = completionStatus; + } + + public ScholixEntityId getProvider() { + return provider; + } + + public void setProvider(ScholixEntityId provider) { + this.provider = provider; + } + + public String getProvisionMode() { + return provisionMode; + } + + public void setProvisionMode(String provisionMode) { + this.provisionMode = provisionMode; + } + + public String getCompletionStatus() { + return completionStatus; + } + + public void setCompletionStatus(String completionStatus) { + this.completionStatus = completionStatus; + } +} diff --git a/src/main/java/eu/dnetlib/dhp/schema/sx/scholix/ScholixEntityId.java b/src/main/java/eu/dnetlib/dhp/schema/sx/scholix/ScholixEntityId.java new file mode 100644 index 0000000..e4bcee3 --- /dev/null +++ b/src/main/java/eu/dnetlib/dhp/schema/sx/scholix/ScholixEntityId.java @@ -0,0 +1,34 @@ + +package eu.dnetlib.dhp.schema.sx.scholix; + +import java.io.Serializable; +import java.util.List; + +public class ScholixEntityId implements Serializable { + private String name; + private List identifiers; + + public ScholixEntityId() { + } + + public ScholixEntityId(String name, List identifiers) { + this.name = name; + this.identifiers = identifiers; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public List getIdentifiers() { + return identifiers; + } + + public void setIdentifiers(List identifiers) { + this.identifiers = identifiers; + } +} diff --git a/src/main/java/eu/dnetlib/dhp/schema/sx/scholix/ScholixIdentifier.java b/src/main/java/eu/dnetlib/dhp/schema/sx/scholix/ScholixIdentifier.java new file mode 100644 index 0000000..2301d40 --- /dev/null +++ b/src/main/java/eu/dnetlib/dhp/schema/sx/scholix/ScholixIdentifier.java @@ -0,0 +1,33 @@ + +package eu.dnetlib.dhp.schema.sx.scholix; + +import java.io.Serializable; + +public class ScholixIdentifier implements Serializable { + private String identifier; + private String schema; + + public ScholixIdentifier() { + } + + public ScholixIdentifier(String identifier, String schema) { + this.identifier = identifier; + this.schema = schema; + } + + public String getIdentifier() { + return identifier; + } + + public void setIdentifier(String identifier) { + this.identifier = identifier; + } + + public String getSchema() { + return schema; + } + + public void setSchema(String schema) { + this.schema = schema; + } +} diff --git a/src/main/java/eu/dnetlib/dhp/schema/sx/scholix/ScholixRelationship.java b/src/main/java/eu/dnetlib/dhp/schema/sx/scholix/ScholixRelationship.java new file mode 100644 index 0000000..b2e0e3f --- /dev/null +++ b/src/main/java/eu/dnetlib/dhp/schema/sx/scholix/ScholixRelationship.java @@ -0,0 +1,43 @@ + +package eu.dnetlib.dhp.schema.sx.scholix; + +import java.io.Serializable; + +public class ScholixRelationship implements Serializable { + private String name; + private String schema; + private String inverse; + + public ScholixRelationship() { + } + + public ScholixRelationship(String name, String schema, String inverse) { + this.name = name; + this.schema = schema; + this.inverse = inverse; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getSchema() { + return schema; + } + + public void setSchema(String schema) { + this.schema = schema; + } + + public String getInverse() { + return inverse; + } + + public void setInverse(String inverse) { + this.inverse = inverse; + } +} diff --git a/src/main/java/eu/dnetlib/dhp/schema/sx/scholix/ScholixResource.java b/src/main/java/eu/dnetlib/dhp/schema/sx/scholix/ScholixResource.java new file mode 100644 index 0000000..8665cb8 --- /dev/null +++ b/src/main/java/eu/dnetlib/dhp/schema/sx/scholix/ScholixResource.java @@ -0,0 +1,153 @@ + +package eu.dnetlib.dhp.schema.sx.scholix; + + + +import eu.dnetlib.dhp.schema.sx.summary.ScholixSummary; + +import java.io.Serializable; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public class ScholixResource implements Serializable { + + private List identifier; + private String dnetIdentifier; + private String objectType; + private String objectSubType; + private String title; + private List creator; + private String publicationDate; + private List publisher; + private List collectedFrom; + + public static ScholixResource fromSummary(ScholixSummary summary) { + + final ScholixResource resource = new ScholixResource(); + + resource.setDnetIdentifier(summary.getId()); + + resource + .setIdentifier( + summary + .getLocalIdentifier() + .stream() + .map(i -> new ScholixIdentifier(i.getId(), i.getType())) + .collect(Collectors.toList())); + + resource.setObjectType(summary.getTypology().toString()); + + if (summary.getTitle() != null && summary.getTitle().size() > 0) + resource.setTitle(summary.getTitle().get(0)); + + if (summary.getAuthor() != null) + resource + .setCreator( + summary + .getAuthor() + .stream() + .map(c -> new ScholixEntityId(c, null)) + .collect(Collectors.toList())); + + if (summary.getDate() != null && summary.getDate().size() > 0) + resource.setPublicationDate(summary.getDate().get(0)); + if (summary.getPublisher() != null) + resource + .setPublisher( + summary + .getPublisher() + .stream() + .map(p -> new ScholixEntityId(p, null)) + .collect(Collectors.toList())); + if (summary.getDatasources() != null) + resource + .setCollectedFrom( + summary + .getDatasources() + .stream() + .map( + d -> new ScholixCollectedFrom( + new ScholixEntityId( + d.getDatasourceName(), + Collections + .singletonList( + new ScholixIdentifier(d.getDatasourceId(), "dnet_identifier"))), + "collected", + d.getCompletionStatus())) + .collect(Collectors.toList())); + return resource; + } + + public List getIdentifier() { + return identifier; + } + + public void setIdentifier(List identifier) { + this.identifier = identifier; + } + + public String getDnetIdentifier() { + return dnetIdentifier; + } + + public void setDnetIdentifier(String dnetIdentifier) { + this.dnetIdentifier = dnetIdentifier; + } + + public String getObjectType() { + return objectType; + } + + public void setObjectType(String objectType) { + this.objectType = objectType; + } + + public String getObjectSubType() { + return objectSubType; + } + + public void setObjectSubType(String objectSubType) { + this.objectSubType = objectSubType; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public List getCreator() { + return creator; + } + + public void setCreator(List creator) { + this.creator = creator; + } + + public String getPublicationDate() { + return publicationDate; + } + + public void setPublicationDate(String publicationDate) { + this.publicationDate = publicationDate; + } + + public List getPublisher() { + return publisher; + } + + public void setPublisher(List publisher) { + this.publisher = publisher; + } + + public List getCollectedFrom() { + return collectedFrom; + } + + public void setCollectedFrom(List collectedFrom) { + this.collectedFrom = collectedFrom; + } +} diff --git a/src/main/java/eu/dnetlib/dhp/schema/sx/summary/CollectedFromType.java b/src/main/java/eu/dnetlib/dhp/schema/sx/summary/CollectedFromType.java new file mode 100644 index 0000000..0dae748 --- /dev/null +++ b/src/main/java/eu/dnetlib/dhp/schema/sx/summary/CollectedFromType.java @@ -0,0 +1,44 @@ + +package eu.dnetlib.dhp.schema.sx.summary; + +import java.io.Serializable; + +public class CollectedFromType implements Serializable { + + private String datasourceName; + private String datasourceId; + private String completionStatus; + + public CollectedFromType() { + } + + public CollectedFromType(String datasourceName, String datasourceId, String completionStatus) { + this.datasourceName = datasourceName; + this.datasourceId = datasourceId; + this.completionStatus = completionStatus; + } + + public String getDatasourceName() { + return datasourceName; + } + + public void setDatasourceName(String datasourceName) { + this.datasourceName = datasourceName; + } + + public String getDatasourceId() { + return datasourceId; + } + + public void setDatasourceId(String datasourceId) { + this.datasourceId = datasourceId; + } + + public String getCompletionStatus() { + return completionStatus; + } + + public void setCompletionStatus(String completionStatus) { + this.completionStatus = completionStatus; + } +} diff --git a/src/main/java/eu/dnetlib/dhp/schema/sx/summary/SchemeValue.java b/src/main/java/eu/dnetlib/dhp/schema/sx/summary/SchemeValue.java new file mode 100644 index 0000000..a58bc26 --- /dev/null +++ b/src/main/java/eu/dnetlib/dhp/schema/sx/summary/SchemeValue.java @@ -0,0 +1,33 @@ + +package eu.dnetlib.dhp.schema.sx.summary; + +import java.io.Serializable; + +public class SchemeValue implements Serializable { + private String scheme; + private String value; + + public SchemeValue() { + } + + public SchemeValue(String scheme, String value) { + this.scheme = scheme; + this.value = value; + } + + public String getScheme() { + return scheme; + } + + public void setScheme(String scheme) { + this.scheme = scheme; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } +} diff --git a/src/main/java/eu/dnetlib/dhp/schema/sx/summary/ScholixSummary.java b/src/main/java/eu/dnetlib/dhp/schema/sx/summary/ScholixSummary.java new file mode 100644 index 0000000..fc146b2 --- /dev/null +++ b/src/main/java/eu/dnetlib/dhp/schema/sx/summary/ScholixSummary.java @@ -0,0 +1,128 @@ + +package eu.dnetlib.dhp.schema.sx.summary; + +import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.Serializable; +import java.util.List; + +public class ScholixSummary implements Serializable { + private String id; + private List localIdentifier; + private Typology typology; + private List title; + private List author; + private List date; + private String description; + private List subject; + private List publisher; + private long relatedPublications; + private long relatedDatasets; + private long relatedUnknown; + private List datasources; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public List getLocalIdentifier() { + return localIdentifier; + } + + public void setLocalIdentifier(List localIdentifier) { + this.localIdentifier = localIdentifier; + } + + public Typology getTypology() { + return typology; + } + + public void setTypology(Typology typology) { + this.typology = typology; + } + + public List getTitle() { + return title; + } + + public void setTitle(List title) { + this.title = title; + } + + public List getAuthor() { + return author; + } + + public void setAuthor(List author) { + this.author = author; + } + + public List getDate() { + return date; + } + + public void setDate(List date) { + this.date = date; + } + + @JsonProperty("abstract") + public String getDescription() { + return description; + } + + @JsonProperty("abstract") + public void setDescription(String description) { + this.description = description; + } + + public List getSubject() { + return subject; + } + + public void setSubject(List subject) { + this.subject = subject; + } + + public List getPublisher() { + return publisher; + } + + public void setPublisher(List publisher) { + this.publisher = publisher; + } + + public long getRelatedPublications() { + return relatedPublications; + } + + public void setRelatedPublications(long relatedPublications) { + this.relatedPublications = relatedPublications; + } + + public long getRelatedDatasets() { + return relatedDatasets; + } + + public void setRelatedDatasets(long relatedDatasets) { + this.relatedDatasets = relatedDatasets; + } + + public long getRelatedUnknown() { + return relatedUnknown; + } + + public void setRelatedUnknown(long relatedUnknown) { + this.relatedUnknown = relatedUnknown; + } + + public List getDatasources() { + return datasources; + } + + public void setDatasources(List datasources) { + this.datasources = datasources; + } +} diff --git a/src/main/java/eu/dnetlib/dhp/schema/sx/summary/TypedIdentifier.java b/src/main/java/eu/dnetlib/dhp/schema/sx/summary/TypedIdentifier.java new file mode 100644 index 0000000..60465aa --- /dev/null +++ b/src/main/java/eu/dnetlib/dhp/schema/sx/summary/TypedIdentifier.java @@ -0,0 +1,33 @@ + +package eu.dnetlib.dhp.schema.sx.summary; + +import java.io.Serializable; + +public class TypedIdentifier implements Serializable { + private String id; + private String type; + + public TypedIdentifier() { + } + + public TypedIdentifier(String id, String type) { + this.id = id; + this.type = type; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } +} diff --git a/src/main/java/eu/dnetlib/dhp/schema/sx/summary/Typology.java b/src/main/java/eu/dnetlib/dhp/schema/sx/summary/Typology.java new file mode 100644 index 0000000..e39f312 --- /dev/null +++ b/src/main/java/eu/dnetlib/dhp/schema/sx/summary/Typology.java @@ -0,0 +1,8 @@ + +package eu.dnetlib.dhp.schema.sx.summary; + +import java.io.Serializable; + +public enum Typology implements Serializable { + dataset, publication, unknown +} diff --git a/src/test/java/eu/dnetlib/dhp/schema/scholexplorer/DLItest.java b/src/test/java/eu/dnetlib/dhp/schema/scholexplorer/DLItest.java deleted file mode 100644 index 16ce152..0000000 --- a/src/test/java/eu/dnetlib/dhp/schema/scholexplorer/DLItest.java +++ /dev/null @@ -1,84 +0,0 @@ - -package eu.dnetlib.dhp.schema.scholexplorer; - -import java.io.IOException; -import java.util.Arrays; -import java.util.Collections; - -import org.junit.jupiter.api.Test; - -import com.fasterxml.jackson.core.JsonProcessingException; -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; - -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.setTitle(Collections.singletonList(createSP("Un Titolo", "title", "dnetTitle"))); - a1.setDlicollectedfrom(Arrays.asList(createCollectedFrom("znd", "Zenodo", "complete"))); - a1.setCompletionStatus("complete"); - - DLIPublication a = new DLIPublication(); - a - .setPid( - Arrays - .asList( - createSP("10.11", "doi", ModelConstants.DNET_PID_TYPES), - createSP("123456", "pdb", ModelConstants.DNET_PID_TYPES))); - a.setTitle(Collections.singletonList(createSP("A Title", "title", "dnetTitle"))); - a - .setDlicollectedfrom( - Arrays - .asList( - createCollectedFrom("dct", "datacite", "complete"), - createCollectedFrom("dct", "datacite", "incomplete"))); - a.setCompletionStatus("incomplete"); - - a.mergeFrom(a1); - - ObjectMapper mapper = new ObjectMapper(); - System.out.println(mapper.writeValueAsString(a)); - } - - @Test - public void testDeserialization() throws IOException { - - final String json = "{\"dataInfo\":{\"invisible\":false,\"inferred\":null,\"deletedbyinference\":false,\"trust\":\"0.9\",\"inferenceprovenance\":null,\"provenanceaction\":null},\"lastupdatetimestamp\":null,\"id\":\"60|bd9352547098929a394655ad1a44a479\",\"originalId\":[\"bd9352547098929a394655ad1a44a479\"],\"collectedfrom\":[{\"key\":\"dli_________::datacite\",\"value\":\"Datasets in Datacite\",\"dataInfo\":null,\"blank\":false}],\"pid\":[{\"value\":\"10.7925/DRS1.DUCHAS_5078760\",\"qualifier\":{\"classid\":\"doi\",\"classname\":\"doi\",\"schemeid\":\"dnet:pid_types\",\"schemename\":\"dnet:pid_types\",\"blank\":false},\"dataInfo\":null}],\"dateofcollection\":\"2020-01-09T08:29:31.885Z\",\"dateoftransformation\":null,\"extraInfo\":null,\"oaiprovenance\":null,\"author\":[{\"fullname\":\"Cathail, S. Ó\",\"name\":null,\"surname\":null,\"rank\":null,\"pid\":null,\"affiliation\":null},{\"fullname\":\"Donnell, Breda Mc\",\"name\":null,\"surname\":null,\"rank\":null,\"pid\":null,\"affiliation\":null},{\"fullname\":\"Ireland. Department of Arts, Culture, and the Gaeltacht\",\"name\":null,\"surname\":null,\"rank\":null,\"pid\":null,\"affiliation\":null},{\"fullname\":\"University College Dublin\",\"name\":null,\"surname\":null,\"rank\":null,\"pid\":null,\"affiliation\":null},{\"fullname\":\"National Folklore Foundation\",\"name\":null,\"surname\":null,\"rank\":null,\"pid\":null,\"affiliation\":null},{\"fullname\":\"Cathail, S. Ó\",\"name\":null,\"surname\":null,\"rank\":null,\"pid\":null,\"affiliation\":null},{\"fullname\":\"Donnell, Breda Mc\",\"name\":null,\"surname\":null,\"rank\":null,\"pid\":null,\"affiliation\":null}],\"resulttype\":null,\"language\":null,\"country\":null,\"subject\":[{\"value\":\"Recreation\",\"qualifier\":{\"classid\":\"dnet:subject\",\"classname\":\"dnet:subject\",\"schemeid\":\"unknown\",\"schemename\":\"unknown\",\"blank\":false},\"dataInfo\":null},{\"value\":\"Entertainments and recreational activities\",\"qualifier\":{\"classid\":\"dnet:subject\",\"classname\":\"dnet:subject\",\"schemeid\":\"unknown\",\"schemename\":\"unknown\",\"blank\":false},\"dataInfo\":null},{\"value\":\"Siamsaíocht agus caitheamh aimsire\",\"qualifier\":{\"classid\":\"dnet:subject\",\"classname\":\"dnet:subject\",\"schemeid\":\"unknown\",\"schemename\":\"unknown\",\"blank\":false},\"dataInfo\":null}],\"title\":[{\"value\":\"Games We Play\",\"qualifier\":null,\"dataInfo\":null}],\"relevantdate\":[{\"value\":\"1938-09-28\",\"qualifier\":{\"classid\":\"date\",\"classname\":\"date\",\"schemeid\":\"dnet::date\",\"schemename\":\"dnet::date\",\"blank\":false},\"dataInfo\":null}],\"description\":[{\"value\":\"Story collected by Breda Mc Donnell, a student at Tenure school (Tinure, Co. Louth) (no informant identified).\",\"dataInfo\":null}],\"dateofacceptance\":null,\"publisher\":{\"value\":\"University College Dublin\",\"dataInfo\":null},\"embargoenddate\":null,\"source\":null,\"fulltext\":null,\"format\":null,\"contributor\":null,\"resourcetype\":null,\"coverage\":null,\"refereed\":null,\"context\":null,\"processingchargeamount\":null,\"processingchargecurrency\":null,\"externalReference\":null,\"instance\":[],\"storagedate\":null,\"device\":null,\"size\":null,\"version\":null,\"lastmetadataupdate\":null,\"metadataversionnumber\":null,\"geolocation\":null,\"dlicollectedfrom\":[{\"id\":\"dli_________::datacite\",\"name\":\"Datasets in Datacite\",\"completionStatus\":\"complete\",\"collectionMode\":\"resolved\"}],\"completionStatus\":\"complete\"}"; - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - DLIDataset dliDataset = mapper.readValue(json, DLIDataset.class); - mapper.enable(SerializationFeature.INDENT_OUTPUT); - System.out.println(mapper.writeValueAsString(dliDataset)); - } - - private ProvenaceInfo createCollectedFrom( - final String id, final String name, final String completionStatus) { - ProvenaceInfo p = new ProvenaceInfo(); - p.setId(id); - p.setName(name); - p.setCompletionStatus(completionStatus); - return p; - } - - private StructuredProperty createSP( - final String value, final String className, final String schemeName) { - StructuredProperty p = new StructuredProperty(); - p.setValue(value); - Qualifier schema = new Qualifier(); - schema.setClassname(className); - schema.setClassid(className); - schema.setSchemename(schemeName); - schema.setSchemeid(schemeName); - p.setQualifier(schema); - return p; - } -} From 905d425064bd1a6cb8d762309b217c1e1ab81a0f Mon Sep 17 00:00:00 2001 From: Sandro La Bruzzo Date: Mon, 5 Jul 2021 14:36:45 +0200 Subject: [PATCH 02/18] [Scholexplorer]: Updated scholix model: added subtype in scholix Summary and URL in Identifier field --- .../dhp/schema/sx/scholix/ScholixResource.java | 6 ++---- .../dhp/schema/sx/summary/ScholixSummary.java | 12 +++++++++++- .../dhp/schema/sx/summary/TypedIdentifier.java | 12 +++++++++++- 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/src/main/java/eu/dnetlib/dhp/schema/sx/scholix/ScholixResource.java b/src/main/java/eu/dnetlib/dhp/schema/sx/scholix/ScholixResource.java index 8665cb8..e173e2a 100644 --- a/src/main/java/eu/dnetlib/dhp/schema/sx/scholix/ScholixResource.java +++ b/src/main/java/eu/dnetlib/dhp/schema/sx/scholix/ScholixResource.java @@ -1,15 +1,13 @@ package eu.dnetlib.dhp.schema.sx.scholix; - - -import eu.dnetlib.dhp.schema.sx.summary.ScholixSummary; - import java.io.Serializable; import java.util.Collections; import java.util.List; import java.util.stream.Collectors; +import eu.dnetlib.dhp.schema.sx.summary.ScholixSummary; + public class ScholixResource implements Serializable { private List identifier; diff --git a/src/main/java/eu/dnetlib/dhp/schema/sx/summary/ScholixSummary.java b/src/main/java/eu/dnetlib/dhp/schema/sx/summary/ScholixSummary.java index fc146b2..5894c05 100644 --- a/src/main/java/eu/dnetlib/dhp/schema/sx/summary/ScholixSummary.java +++ b/src/main/java/eu/dnetlib/dhp/schema/sx/summary/ScholixSummary.java @@ -1,14 +1,16 @@ package eu.dnetlib.dhp.schema.sx.summary; -import com.fasterxml.jackson.annotation.JsonProperty; import java.io.Serializable; import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + public class ScholixSummary implements Serializable { private String id; private List localIdentifier; private Typology typology; + private String subType; private List title; private List author; private List date; @@ -125,4 +127,12 @@ public class ScholixSummary implements Serializable { public void setDatasources(List datasources) { this.datasources = datasources; } + + public String getSubType() { + return subType; + } + + public void setSubType(String subType) { + this.subType = subType; + } } diff --git a/src/main/java/eu/dnetlib/dhp/schema/sx/summary/TypedIdentifier.java b/src/main/java/eu/dnetlib/dhp/schema/sx/summary/TypedIdentifier.java index 60465aa..b66cb08 100644 --- a/src/main/java/eu/dnetlib/dhp/schema/sx/summary/TypedIdentifier.java +++ b/src/main/java/eu/dnetlib/dhp/schema/sx/summary/TypedIdentifier.java @@ -6,13 +6,23 @@ import java.io.Serializable; public class TypedIdentifier implements Serializable { private String id; private String type; + private String url; public TypedIdentifier() { } - public TypedIdentifier(String id, String type) { + public TypedIdentifier(String id, String type, String url) { this.id = id; this.type = type; + this.url = url; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; } public String getId() { From bc664061710b5718bd800cab28329544cd6a6d0f Mon Sep 17 00:00:00 2001 From: Sandro La Bruzzo Date: Tue, 6 Jul 2021 09:54:26 +0200 Subject: [PATCH 03/18] [Scholexplorer]: Removed TypedIdentifier class on summary and resue ScholixIdentifier --- .../schema/sx/scholix/ScholixIdentifier.java | 28 ++++++++- .../schema/sx/scholix/ScholixResource.java | 61 ------------------- .../schema/sx/summary/CollectedFromType.java | 14 +++++ .../dhp/schema/sx/summary/ScholixSummary.java | 8 ++- .../schema/sx/summary/TypedIdentifier.java | 43 ------------- 5 files changed, 46 insertions(+), 108 deletions(-) delete mode 100644 src/main/java/eu/dnetlib/dhp/schema/sx/summary/TypedIdentifier.java diff --git a/src/main/java/eu/dnetlib/dhp/schema/sx/scholix/ScholixIdentifier.java b/src/main/java/eu/dnetlib/dhp/schema/sx/scholix/ScholixIdentifier.java index 2301d40..8fc8b08 100644 --- a/src/main/java/eu/dnetlib/dhp/schema/sx/scholix/ScholixIdentifier.java +++ b/src/main/java/eu/dnetlib/dhp/schema/sx/scholix/ScholixIdentifier.java @@ -2,17 +2,43 @@ package eu.dnetlib.dhp.schema.sx.scholix; import java.io.Serializable; +import java.util.Objects; public class ScholixIdentifier implements Serializable { private String identifier; private String schema; + private String url; public ScholixIdentifier() { } - public ScholixIdentifier(String identifier, String schema) { + public ScholixIdentifier(String identifier, String schema, String url) { this.identifier = identifier; this.schema = schema; + this.url = url; + } + + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + ScholixIdentifier that = (ScholixIdentifier) o; + return identifier.equals(that.identifier) && schema.equals(that.schema); + } + + @Override + public int hashCode() { + return Objects.hash(identifier, schema); } public String getIdentifier() { diff --git a/src/main/java/eu/dnetlib/dhp/schema/sx/scholix/ScholixResource.java b/src/main/java/eu/dnetlib/dhp/schema/sx/scholix/ScholixResource.java index e173e2a..569b1f3 100644 --- a/src/main/java/eu/dnetlib/dhp/schema/sx/scholix/ScholixResource.java +++ b/src/main/java/eu/dnetlib/dhp/schema/sx/scholix/ScholixResource.java @@ -2,11 +2,7 @@ package eu.dnetlib.dhp.schema.sx.scholix; import java.io.Serializable; -import java.util.Collections; import java.util.List; -import java.util.stream.Collectors; - -import eu.dnetlib.dhp.schema.sx.summary.ScholixSummary; public class ScholixResource implements Serializable { @@ -20,63 +16,6 @@ public class ScholixResource implements Serializable { private List publisher; private List collectedFrom; - public static ScholixResource fromSummary(ScholixSummary summary) { - - final ScholixResource resource = new ScholixResource(); - - resource.setDnetIdentifier(summary.getId()); - - resource - .setIdentifier( - summary - .getLocalIdentifier() - .stream() - .map(i -> new ScholixIdentifier(i.getId(), i.getType())) - .collect(Collectors.toList())); - - resource.setObjectType(summary.getTypology().toString()); - - if (summary.getTitle() != null && summary.getTitle().size() > 0) - resource.setTitle(summary.getTitle().get(0)); - - if (summary.getAuthor() != null) - resource - .setCreator( - summary - .getAuthor() - .stream() - .map(c -> new ScholixEntityId(c, null)) - .collect(Collectors.toList())); - - if (summary.getDate() != null && summary.getDate().size() > 0) - resource.setPublicationDate(summary.getDate().get(0)); - if (summary.getPublisher() != null) - resource - .setPublisher( - summary - .getPublisher() - .stream() - .map(p -> new ScholixEntityId(p, null)) - .collect(Collectors.toList())); - if (summary.getDatasources() != null) - resource - .setCollectedFrom( - summary - .getDatasources() - .stream() - .map( - d -> new ScholixCollectedFrom( - new ScholixEntityId( - d.getDatasourceName(), - Collections - .singletonList( - new ScholixIdentifier(d.getDatasourceId(), "dnet_identifier"))), - "collected", - d.getCompletionStatus())) - .collect(Collectors.toList())); - return resource; - } - public List getIdentifier() { return identifier; } diff --git a/src/main/java/eu/dnetlib/dhp/schema/sx/summary/CollectedFromType.java b/src/main/java/eu/dnetlib/dhp/schema/sx/summary/CollectedFromType.java index 0dae748..61df72f 100644 --- a/src/main/java/eu/dnetlib/dhp/schema/sx/summary/CollectedFromType.java +++ b/src/main/java/eu/dnetlib/dhp/schema/sx/summary/CollectedFromType.java @@ -2,6 +2,7 @@ package eu.dnetlib.dhp.schema.sx.summary; import java.io.Serializable; +import java.util.Objects; public class CollectedFromType implements Serializable { @@ -18,6 +19,19 @@ public class CollectedFromType implements Serializable { this.completionStatus = completionStatus; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + CollectedFromType that = (CollectedFromType) o; + return Objects.equals(datasourceName, that.datasourceName) && Objects.equals(datasourceId, that.datasourceId); + } + + @Override + public int hashCode() { + return Objects.hash(datasourceName, datasourceId); + } + public String getDatasourceName() { return datasourceName; } diff --git a/src/main/java/eu/dnetlib/dhp/schema/sx/summary/ScholixSummary.java b/src/main/java/eu/dnetlib/dhp/schema/sx/summary/ScholixSummary.java index 5894c05..8da25dc 100644 --- a/src/main/java/eu/dnetlib/dhp/schema/sx/summary/ScholixSummary.java +++ b/src/main/java/eu/dnetlib/dhp/schema/sx/summary/ScholixSummary.java @@ -6,9 +6,11 @@ import java.util.List; import com.fasterxml.jackson.annotation.JsonProperty; +import eu.dnetlib.dhp.schema.sx.scholix.ScholixIdentifier; + public class ScholixSummary implements Serializable { private String id; - private List localIdentifier; + private List localIdentifier; private Typology typology; private String subType; private List title; @@ -30,11 +32,11 @@ public class ScholixSummary implements Serializable { this.id = id; } - public List getLocalIdentifier() { + public List getLocalIdentifier() { return localIdentifier; } - public void setLocalIdentifier(List localIdentifier) { + public void setLocalIdentifier(List localIdentifier) { this.localIdentifier = localIdentifier; } diff --git a/src/main/java/eu/dnetlib/dhp/schema/sx/summary/TypedIdentifier.java b/src/main/java/eu/dnetlib/dhp/schema/sx/summary/TypedIdentifier.java deleted file mode 100644 index b66cb08..0000000 --- a/src/main/java/eu/dnetlib/dhp/schema/sx/summary/TypedIdentifier.java +++ /dev/null @@ -1,43 +0,0 @@ - -package eu.dnetlib.dhp.schema.sx.summary; - -import java.io.Serializable; - -public class TypedIdentifier implements Serializable { - private String id; - private String type; - private String url; - - public TypedIdentifier() { - } - - public TypedIdentifier(String id, String type, String url) { - this.id = id; - this.type = type; - this.url = url; - } - - public String getUrl() { - return url; - } - - public void setUrl(String url) { - this.url = url; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } -} From 8fd1b508adcc5d12d9ec74e497b34dbe9f99b35b Mon Sep 17 00:00:00 2001 From: Claudio Atzori Date: Tue, 13 Jul 2021 10:11:00 +0200 Subject: [PATCH 04/18] introducing version 2.6.14 to include the Scholexplorer model classes --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 1c4cfc6..0eea07f 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ eu.dnetlib.dhp dhp-schemas jar - 2.6.13 + 2.6.14-SNAPSHOT From 461dafb96ea9cb364aba45719a55adc3a9545bb1 Mon Sep 17 00:00:00 2001 From: Claudio Atzori Date: Tue, 13 Jul 2021 10:12:56 +0200 Subject: [PATCH 05/18] [maven-release-plugin] prepare release dhp-schemas-2.6.14 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 0eea07f..e522711 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ eu.dnetlib.dhp dhp-schemas jar - 2.6.14-SNAPSHOT + 2.6.14 @@ -32,7 +32,7 @@ scm:git:gitea@code-repo.d4science.org:D-Net/dhp-schemas.git scm:git:gitea@code-repo.d4science.org:D-Net/dhp-schemas.git https://code-repo.d4science.org/D-Net/dhp-schemas/ - dhp-schemas-2.6.13 + dhp-schemas-2.6.14 This module contains common schema classes meant to be used across the dnet-hadoop submodules From acab6500ab3c04c2b52f5b4131f0ca591da8daa5 Mon Sep 17 00:00:00 2001 From: Claudio Atzori Date: Tue, 13 Jul 2021 10:13:00 +0200 Subject: [PATCH 06/18] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index e522711..a29864b 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ eu.dnetlib.dhp dhp-schemas jar - 2.6.14 + 2.6.15-SNAPSHOT @@ -32,7 +32,7 @@ scm:git:gitea@code-repo.d4science.org:D-Net/dhp-schemas.git scm:git:gitea@code-repo.d4science.org:D-Net/dhp-schemas.git https://code-repo.d4science.org/D-Net/dhp-schemas/ - dhp-schemas-2.6.14 + dhp-schemas-2.6.13 This module contains common schema classes meant to be used across the dnet-hadoop submodules From b034b165947183d6575ee48b6b2f753722cd88da Mon Sep 17 00:00:00 2001 From: Claudio Atzori Date: Tue, 13 Jul 2021 10:16:18 +0200 Subject: [PATCH 07/18] [maven-release-plugin] rollback the release of dhp-schemas-2.6.14 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index a29864b..0eea07f 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ eu.dnetlib.dhp dhp-schemas jar - 2.6.15-SNAPSHOT + 2.6.14-SNAPSHOT From 93a10a50b5d1d9b34bc07e13bc692651f8ce6c34 Mon Sep 17 00:00:00 2001 From: Claudio Atzori Date: Tue, 13 Jul 2021 10:17:27 +0200 Subject: [PATCH 08/18] removed tag --- pom.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/pom.xml b/pom.xml index 0eea07f..63afaab 100644 --- a/pom.xml +++ b/pom.xml @@ -32,7 +32,6 @@ scm:git:gitea@code-repo.d4science.org:D-Net/dhp-schemas.git scm:git:gitea@code-repo.d4science.org:D-Net/dhp-schemas.git https://code-repo.d4science.org/D-Net/dhp-schemas/ - dhp-schemas-2.6.13 This module contains common schema classes meant to be used across the dnet-hadoop submodules From 2f6c91f767cde85261a994ac689a3170ebba2edb Mon Sep 17 00:00:00 2001 From: Claudio Atzori Date: Tue, 13 Jul 2021 10:21:20 +0200 Subject: [PATCH 09/18] [maven-release-plugin] prepare release dhp-schemas-2.6.14 --- pom.xml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 63afaab..052003f 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ eu.dnetlib.dhp dhp-schemas jar - 2.6.14-SNAPSHOT + 2.6.14 @@ -32,7 +32,8 @@ scm:git:gitea@code-repo.d4science.org:D-Net/dhp-schemas.git scm:git:gitea@code-repo.d4science.org:D-Net/dhp-schemas.git https://code-repo.d4science.org/D-Net/dhp-schemas/ - + dhp-schemas-2.6.14 + This module contains common schema classes meant to be used across the dnet-hadoop submodules From 468c7f24db8531ef935b4ec74e937694df1da001 Mon Sep 17 00:00:00 2001 From: Claudio Atzori Date: Tue, 13 Jul 2021 10:21:24 +0200 Subject: [PATCH 10/18] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 052003f..2701856 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ eu.dnetlib.dhp dhp-schemas jar - 2.6.14 + 2.6.15-SNAPSHOT @@ -32,7 +32,7 @@ scm:git:gitea@code-repo.d4science.org:D-Net/dhp-schemas.git scm:git:gitea@code-repo.d4science.org:D-Net/dhp-schemas.git https://code-repo.d4science.org/D-Net/dhp-schemas/ - dhp-schemas-2.6.14 + HEAD This module contains common schema classes meant to be used across the dnet-hadoop submodules From 0f7d4b10d05ccaa591bd8d4bcb2bcb52a0442313 Mon Sep 17 00:00:00 2001 From: Claudio Atzori Date: Tue, 13 Jul 2021 10:22:27 +0200 Subject: [PATCH 11/18] [maven-release-plugin] rollback the release of dhp-schemas-2.6.14 --- pom.xml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 2701856..63afaab 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ eu.dnetlib.dhp dhp-schemas jar - 2.6.15-SNAPSHOT + 2.6.14-SNAPSHOT @@ -32,8 +32,7 @@ scm:git:gitea@code-repo.d4science.org:D-Net/dhp-schemas.git scm:git:gitea@code-repo.d4science.org:D-Net/dhp-schemas.git https://code-repo.d4science.org/D-Net/dhp-schemas/ - HEAD - + This module contains common schema classes meant to be used across the dnet-hadoop submodules From f76a11d27d4b2fd3805a569bcb0ba4c957ca7f82 Mon Sep 17 00:00:00 2001 From: Claudio Atzori Date: Tue, 13 Jul 2021 10:23:03 +0200 Subject: [PATCH 12/18] this is a release --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 63afaab..800ade6 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ eu.dnetlib.dhp dhp-schemas jar - 2.6.14-SNAPSHOT + 2.6.14 From cba43126e1a1f7bcdfdc82f6a2f97bdc22887bdc Mon Sep 17 00:00:00 2001 From: "miriam.baglioni" Date: Tue, 13 Jul 2021 15:01:00 +0200 Subject: [PATCH 13/18] Added APC to the schema of the dump --- src/main/java/eu/dnetlib/dhp/schema/dump/oaf/APC.java | 2 +- .../java/eu/dnetlib/dhp/schema/dump/oaf/Instance.java | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/APC.java b/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/APC.java index 7f5dcb3..0d5ad63 100644 --- a/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/APC.java +++ b/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/APC.java @@ -4,7 +4,7 @@ package eu.dnetlib.dhp.schema.dump.oaf; import java.io.Serializable; /** - * Used to refer to the Article Processing Charge information. Not dumped in this release. It contains two parameters: - + * Used to refer to the Article Processing Charge information. It contains two parameters: - * currency of type String to store the currency of the APC - amount of type String to stores the charged amount */ public class APC implements Serializable { diff --git a/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/Instance.java b/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/Instance.java index edc6f28..c4ec7b1 100644 --- a/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/Instance.java +++ b/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/Instance.java @@ -15,6 +15,7 @@ import java.util.List; * publicationdate of type String to store the publication date of the instance ;// dateofacceptance; - refereed of type * String to store information abour tthe review status of the instance. Possible values are 'Unknown', * 'nonPeerReviewed', 'peerReviewed'. It corresponds to refereed.classname of the instance to be dumped + * - articleprocessingcharge of type APC to store the article processing charges possibly associated to the instance */ public class Instance implements Serializable { @@ -26,6 +27,8 @@ public class Instance implements Serializable { private List url; + private APC articleprocessingcharge; + private String publicationdate;// dateofacceptance; private String refereed; // peer-review status @@ -78,4 +81,11 @@ public class Instance implements Serializable { this.refereed = refereed; } + public APC getArticleprocessingcharge() { + return articleprocessingcharge; + } + + public void setArticleprocessingcharge(APC articleprocessingcharge) { + this.articleprocessingcharge = articleprocessingcharge; + } } From 4336646df9a3b0ccab9a2812d55a5b54956f9cd0 Mon Sep 17 00:00:00 2001 From: "miriam.baglioni" Date: Tue, 13 Jul 2021 16:20:05 +0200 Subject: [PATCH 14/18] changed the name of originalId in acronym --- .../dhp/schema/dump/oaf/graph/ResearchInitiative.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/graph/ResearchInitiative.java b/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/graph/ResearchInitiative.java index ad4ad88..f79cd2a 100644 --- a/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/graph/ResearchInitiative.java +++ b/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/graph/ResearchInitiative.java @@ -19,7 +19,7 @@ import java.io.Serializable; */ public class ResearchInitiative implements Serializable { private String id; // openaireId - private String originalId; // context id + private String acronym; // context id private String name; // context name private String type; // context type: research initiative or research community private String description; @@ -57,12 +57,12 @@ public class ResearchInitiative implements Serializable { this.name = label; } - public String getOriginalId() { - return originalId; + public String getAcronym() { + return acronym; } - public void setOriginalId(String originalId) { - this.originalId = originalId; + public void setAcronym(String acronym) { + this.acronym = acronym; } public String getDescription() { From 28ef0d2fa366ba1ac15c5eb5636ce86b196e1709 Mon Sep 17 00:00:00 2001 From: "miriam.baglioni" Date: Thu, 5 Aug 2021 12:04:10 +0200 Subject: [PATCH 15/18] extended the schema of the dump to mirror the changes in the model. Added openaccessroute at the level of the instance inside the AccessRight element. Added the information of the pid and the alternate indentifiers at the level of the instance, and added the bipFinder measures at the level of the dumper result. Also correct a typo in the Measure class in the oaf model --- .../dhp/schema/dump/oaf/AccessRight.java | 10 ++++++++ .../dnetlib/dhp/schema/dump/oaf/Instance.java | 23 +++++++++++++++++++ .../dhp/schema/dump/oaf/OpenAccessRoute.java | 13 +++++++++++ .../dnetlib/dhp/schema/dump/oaf/Result.java | 11 +++++++++ .../eu/dnetlib/dhp/schema/oaf/Measure.java | 2 +- 5 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 src/main/java/eu/dnetlib/dhp/schema/dump/oaf/OpenAccessRoute.java diff --git a/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/AccessRight.java b/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/AccessRight.java index f28c544..b973f5b 100644 --- a/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/AccessRight.java +++ b/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/AccessRight.java @@ -13,6 +13,8 @@ public class AccessRight extends Qualifier { private String scheme; + private OpenAccessRoute openAccessRoute ; + public String getScheme() { return scheme; } @@ -28,4 +30,12 @@ public class AccessRight extends Qualifier { ar.setScheme(scheme); return ar; } + + public OpenAccessRoute getOpenAccessRoute() { + return openAccessRoute; + } + + public void setOpenAccessRoute(OpenAccessRoute openAccessRoute) { + this.openAccessRoute = openAccessRoute; + } } diff --git a/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/Instance.java b/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/Instance.java index c4ec7b1..826e65c 100644 --- a/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/Instance.java +++ b/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/Instance.java @@ -16,9 +16,16 @@ import java.util.List; * String to store information abour tthe review status of the instance. Possible values are 'Unknown', * 'nonPeerReviewed', 'peerReviewed'. It corresponds to refereed.classname of the instance to be dumped * - articleprocessingcharge of type APC to store the article processing charges possibly associated to the instance + * -pid of type List that is the list of pids associated to the result coming from authoritative sources for that pid + * -alternateIdentifier of type List that is the list of pids associated to the result coming from NON authoritative + * sources for that pid */ public class Instance implements Serializable { + private List pid; + + private List alternateIdentifier; + private String license; private AccessRight accessright; @@ -88,4 +95,20 @@ public class Instance implements Serializable { public void setArticleprocessingcharge(APC articleprocessingcharge) { this.articleprocessingcharge = articleprocessingcharge; } + + public List getPid() { + return pid; + } + + public void setPid(List pid) { + this.pid = pid; + } + + public List getAlternateIdentifier() { + return alternateIdentifier; + } + + public void setAlternateIdentifier(List alternateIdentifier) { + this.alternateIdentifier = alternateIdentifier; + } } diff --git a/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/OpenAccessRoute.java b/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/OpenAccessRoute.java new file mode 100644 index 0000000..fbef655 --- /dev/null +++ b/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/OpenAccessRoute.java @@ -0,0 +1,13 @@ + +package eu.dnetlib.dhp.schema.dump.oaf; + +/** + * This Enum models the OpenAccess status, currently including only the values from Unpaywall + * + * https://support.unpaywall.org/support/solutions/articles/44001777288-what-do-the-types-of-oa-status-green-gold-hybrid-and-bronze-mean- + */ +public enum OpenAccessRoute { + + gold, green, hybrid, bronze + +} diff --git a/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/Result.java b/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/Result.java index 88ab2c3..1981776 100644 --- a/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/Result.java +++ b/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/Result.java @@ -62,9 +62,12 @@ import eu.dnetlib.dhp.schema.dump.oaf.community.Project; * to store information about the time OpenAIRE collected the record. It corresponds to dateofcollection of the result * represented in the internal model - lasteupdatetimestamp of type String to store the timestamp of the last update of * the record. It corresponds to lastupdatetimestamp of the resord represented in the internal model + * -measure list to represent the measure of beepFinder. It corresponds to measures in the model */ public class Result implements Serializable { + private List measures; + private List author; // resulttype allows subclassing results into publications | datasets | software @@ -376,4 +379,12 @@ public class Result implements Serializable { public void setGeolocation(List geolocation) { this.geolocation = geolocation; } + + public List getMeasures() { + return measures; + } + + public void setMeasures(List measures) { + this.measures = measures; + } } diff --git a/src/main/java/eu/dnetlib/dhp/schema/oaf/Measure.java b/src/main/java/eu/dnetlib/dhp/schema/oaf/Measure.java index c0c14d1..e88ff73 100644 --- a/src/main/java/eu/dnetlib/dhp/schema/oaf/Measure.java +++ b/src/main/java/eu/dnetlib/dhp/schema/oaf/Measure.java @@ -16,7 +16,7 @@ public class Measure { private String id; /** - * List of units associated with this measure. KeyValue provides a pair to store the laber (key) and the value, plus + * List of units associated with this measure. KeyValue provides a pair to store the label (key) and the value, plus * common provenance information. */ private List unit; From b8082384223d096a5ec6c40753bbbcda1a6255df Mon Sep 17 00:00:00 2001 From: Claudio Atzori Date: Thu, 5 Aug 2021 14:07:41 +0200 Subject: [PATCH 16/18] updated changelog --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index a00ebae..88df206 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -4,6 +4,7 @@ | **Version** | **Changes** | **Readiness** | |---|---|---| +| 2.7.17 | [Dump model]
aligned the graph dump schema to mirror the changes in the model
1. Added openaccessroute at the level of the instance inside the AccessRight element;
2. Added pid and the alternate identifiers at the level of the instance;
3. Added the bipFinder measures | beta | | 2.7.16 | [Graph model]
Updated the casing of the following terms (`relation.relClass`):
1. `isRelatedTo -> IsRelatedTo`
Added the following `relClass` terms:
1. `IsAmongTopNSimilarDocuments`
2. `HasAmongTopNSimilarDocuments` | beta | | 2.7.15 | 1. added support for delegated authorities
2. fixed regex for DOI cleaning | beta | | 2.7.14 | [Graph model]
Relation types are now inspired by the Datacite definitions https://schema.datacite.org/meta/kernel-4.4/doc/DataCite-MetadataKernel_v4.4.pdf
The changes involve the values stored in `relation.subRelType` and `relation.relClass`:
Updated the casing of the following terms (`relation.relClass`):
1. `isSupplementTo -> IsSupplementTo` / `isSupplementedBy -> IsSupplementedBy`
2. `isPartOf -> IsPartOf` / `hasPart -> HasPart`
3. `cites -> Cites` / `isCitedBy -> IsCitedBy`
4. `reviews -> Reviews` / `isReviewedBy -> IsReviewedBy`
Added the following terms [`subRelType: relClass / relClass (inverse)`]:
1. `relationship: References / IsReferencedBy`
2. `relationship: IsIdenticalTo`
3. `relationship: IsContinuedBy / Continues`
4. `relationship: IsDocumentedBy / Documents`
5. `relationship: Documents / IsDocumentedBy`
6. `relationship: IsCompiledBy / Compiles`
7. `version: IsPreviousVersionOf / IsNewVersionOf`
8. `version: IsSourceOf / IsDerivedFrom`
9. `version: IsVariantFormOf / IsOriginalFormOf`
10. `version: IsObsoletedBy / Obsoletes`
11. `version: IsVersionOf / HasVersion` | beta | From 3ab98d8b37aa567a83bc93d8c4654b10b1697c54 Mon Sep 17 00:00:00 2001 From: Claudio Atzori Date: Tue, 10 Aug 2021 09:36:37 +0200 Subject: [PATCH 17/18] suggestions from SonarLint --- .../action/AtomicActionDeserializer.java | 11 ++++--- .../schema/common/AccessRightComparator.java | 1 - .../dhp/schema/common/ModelConstants.java | 2 ++ .../dhp/schema/common/ModelSupport.java | 7 ++-- .../dnetlib/dhp/schema/dump/oaf/Author.java | 1 - .../dhp/schema/dump/oaf/Container.java | 1 - .../dhp/schema/dump/oaf/Qualifier.java | 4 --- .../dnetlib/dhp/schema/dump/oaf/Result.java | 2 -- .../schema/dump/oaf/community/Context.java | 12 +++++-- .../dhp/schema/dump/oaf/community/Funder.java | 2 -- .../schema/dump/oaf/community/Project.java | 2 -- .../dhp/schema/dump/oaf/graph/Datasource.java | 1 - .../dhp/schema/dump/oaf/graph/Funder.java | 2 -- .../dhp/schema/dump/oaf/graph/Granted.java | 1 - .../schema/dump/oaf/graph/Organization.java | 3 -- .../dnetlib/dhp/schema/oaf/AccessRight.java | 1 + .../eu/dnetlib/dhp/schema/oaf/OafEntity.java | 3 +- .../eu/dnetlib/dhp/schema/oaf/Project.java | 4 --- .../eu/dnetlib/dhp/schema/oaf/Relation.java | 6 ++-- .../eu/dnetlib/dhp/schema/oaf/Result.java | 8 ++--- .../dhp/schema/oaf/StructuredProperty.java | 2 -- .../schema/oaf/utils/CleaningFunctions.java | 2 ++ .../schema/oaf/utils/IdentifierFactory.java | 6 ++-- .../dhp/schema/oaf/utils/ModelHardLimits.java | 2 ++ .../oaf/utils/PidBlacklistProvider.java | 2 ++ .../oaf/utils/ResultTypeComparator.java | 3 +- .../dnetlib/dhp/schema/orcid/Contributor.java | 3 -- .../dnetlib/dhp/schema/orcid/WorkDetail.java | 5 --- .../dhp/schema/action/AtomicActionTest.java | 5 +-- .../dhp/schema/common/ModelSupportTest.java | 4 +-- .../dnetlib/dhp/schema/oaf/MeasureTest.java | 4 +-- .../eu/dnetlib/dhp/schema/oaf/MergeTest.java | 33 ++++++++++--------- .../oaf/utils/BlackListProviderTest.java | 4 +-- .../oaf/utils/IdentifierFactoryTest.java | 6 ++-- 34 files changed, 70 insertions(+), 85 deletions(-) diff --git a/src/main/java/eu/dnetlib/dhp/schema/action/AtomicActionDeserializer.java b/src/main/java/eu/dnetlib/dhp/schema/action/AtomicActionDeserializer.java index 7b88e9c..628d8fe 100644 --- a/src/main/java/eu/dnetlib/dhp/schema/action/AtomicActionDeserializer.java +++ b/src/main/java/eu/dnetlib/dhp/schema/action/AtomicActionDeserializer.java @@ -4,7 +4,6 @@ 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; @@ -12,10 +11,11 @@ import com.fasterxml.jackson.databind.ObjectMapper; import eu.dnetlib.dhp.schema.oaf.Oaf; -public class AtomicActionDeserializer extends JsonDeserializer { +public class AtomicActionDeserializer extends JsonDeserializer> { @Override - public Object deserialize(JsonParser jp, DeserializationContext ctxt) + @SuppressWarnings("unchecked") + public AtomicAction deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { JsonNode node = jp.getCodec().readTree(jp); String classTag = node.get("clazz").asText(); @@ -23,8 +23,9 @@ public class AtomicActionDeserializer extends JsonDeserializer { ObjectMapper mapper = new ObjectMapper(); try { - final Class clazz = Class.forName(classTag); - return new AtomicAction(clazz, (Oaf) mapper.readValue(payload.toString(), clazz)); + final Class clazz = (Class) Class.forName(classTag); + final T oaf = mapper.readValue(payload.toString(), clazz); + return new AtomicAction(clazz, oaf); } catch (ClassNotFoundException e) { throw new IOException(e); } diff --git a/src/main/java/eu/dnetlib/dhp/schema/common/AccessRightComparator.java b/src/main/java/eu/dnetlib/dhp/schema/common/AccessRightComparator.java index 6116bc4..f77e2af 100644 --- a/src/main/java/eu/dnetlib/dhp/schema/common/AccessRightComparator.java +++ b/src/main/java/eu/dnetlib/dhp/schema/common/AccessRightComparator.java @@ -3,7 +3,6 @@ package eu.dnetlib.dhp.schema.common; import java.util.Comparator; -import eu.dnetlib.dhp.schema.oaf.AccessRight; import eu.dnetlib.dhp.schema.oaf.Qualifier; public class AccessRightComparator implements Comparator { diff --git a/src/main/java/eu/dnetlib/dhp/schema/common/ModelConstants.java b/src/main/java/eu/dnetlib/dhp/schema/common/ModelConstants.java index 4537c1d..5c08765 100644 --- a/src/main/java/eu/dnetlib/dhp/schema/common/ModelConstants.java +++ b/src/main/java/eu/dnetlib/dhp/schema/common/ModelConstants.java @@ -8,6 +8,8 @@ import eu.dnetlib.dhp.schema.oaf.Qualifier; public class ModelConstants { + private ModelConstants() {} + public static final String ORCID = "orcid"; public static final String ORCID_PENDING = "orcid_pending"; public static final String ORCID_CLASSNAME = "Open Researcher and Contributor ID"; diff --git a/src/main/java/eu/dnetlib/dhp/schema/common/ModelSupport.java b/src/main/java/eu/dnetlib/dhp/schema/common/ModelSupport.java index a6d164c..89eddd0 100644 --- a/src/main/java/eu/dnetlib/dhp/schema/common/ModelSupport.java +++ b/src/main/java/eu/dnetlib/dhp/schema/common/ModelSupport.java @@ -7,13 +7,14 @@ import java.nio.charset.StandardCharsets; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.text.ParseException; -import java.time.format.DateTimeParseException; -import java.util.*; +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 org.apache.commons.lang3.time.DateUtils; import com.github.sisyphsu.dateparser.DateParserUtils; import com.google.common.collect.Maps; diff --git a/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/Author.java b/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/Author.java index 34920bc..ef035a1 100644 --- a/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/Author.java +++ b/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/Author.java @@ -2,7 +2,6 @@ package eu.dnetlib.dhp.schema.dump.oaf; import java.io.Serializable; -import java.util.List; /** * Used to represent the generic author of the result. It has six parameters: - name of type String to store the given diff --git a/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/Container.java b/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/Container.java index 8699528..ad9ea48 100644 --- a/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/Container.java +++ b/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/Container.java @@ -2,7 +2,6 @@ package eu.dnetlib.dhp.schema.dump.oaf; import java.io.Serializable; -import java.util.Objects; /** * To store information about the conference or journal where the result has been presented or published. It contains diff --git a/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/Qualifier.java b/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/Qualifier.java index 348c22b..fd21424 100644 --- a/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/Qualifier.java +++ b/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/Qualifier.java @@ -3,10 +3,6 @@ package eu.dnetlib.dhp.schema.dump.oaf; import java.io.Serializable; -import org.apache.commons.lang3.StringUtils; - -import com.fasterxml.jackson.annotation.JsonIgnore; - /** * To represent the information described by a code and a value It has two parameters: - code to store the code * (generally the classid of the eu.dnetlib.dhp.schema.oaf.Qualifier element) - label to store the label (generally the diff --git a/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/Result.java b/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/Result.java index 1981776..932df9e 100644 --- a/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/Result.java +++ b/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/Result.java @@ -4,8 +4,6 @@ package eu.dnetlib.dhp.schema.dump.oaf; import java.io.Serializable; import java.util.List; -import eu.dnetlib.dhp.schema.dump.oaf.community.Project; - /** * To represent the dumped result. It will be extended in the dump for Research Communities - Research * Initiative/Infrastructures. It has the following parameters: - author of type diff --git a/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/community/Context.java b/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/community/Context.java index 16d5a6e..d4c1d40 100644 --- a/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/community/Context.java +++ b/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/community/Context.java @@ -3,6 +3,8 @@ package eu.dnetlib.dhp.schema.dump.oaf.community; import java.util.List; import java.util.Objects; +import java.util.Optional; +import java.util.stream.Collectors; import eu.dnetlib.dhp.schema.dump.oaf.Provenance; import eu.dnetlib.dhp.schema.dump.oaf.Qualifier; @@ -32,9 +34,13 @@ public class Context extends Qualifier { @Override public int hashCode() { - String provenance = ""; - this.provenance.forEach(p -> provenance.concat(p.toString())); - return Objects.hash(getCode(), getLabel(), provenance); + final String p = Optional.ofNullable(getProvenance()) + .map(prov -> prov.stream() + .map(Provenance::toString) + .collect(Collectors.joining())) + .orElse(""); + + return Objects.hash(getCode(), getLabel(), p); } } diff --git a/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/community/Funder.java b/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/community/Funder.java index adb4163..5ea0d12 100644 --- a/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/community/Funder.java +++ b/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/community/Funder.java @@ -1,8 +1,6 @@ package eu.dnetlib.dhp.schema.dump.oaf.community; -import java.io.Serializable; - /** * To store information about the funder funding the project related to the result. It has the following parameters: - * shortName of type String to store the funder short name (e.c. AKA). - name of type String to store the funder name diff --git a/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/community/Project.java b/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/community/Project.java index 030b565..aadb790 100644 --- a/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/community/Project.java +++ b/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/community/Project.java @@ -1,8 +1,6 @@ package eu.dnetlib.dhp.schema.dump.oaf.community; -import java.io.Serializable; - import eu.dnetlib.dhp.schema.dump.oaf.Provenance; /** diff --git a/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/graph/Datasource.java b/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/graph/Datasource.java index 6b2b7b1..62a32a0 100644 --- a/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/graph/Datasource.java +++ b/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/graph/Datasource.java @@ -6,7 +6,6 @@ import java.util.List; import eu.dnetlib.dhp.schema.dump.oaf.Container; import eu.dnetlib.dhp.schema.dump.oaf.ControlledField; -import eu.dnetlib.dhp.schema.dump.oaf.KeyValue; /** * To store information about the datasource OpenAIRE collects information from. It contains the following parameters: - diff --git a/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/graph/Funder.java b/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/graph/Funder.java index 3b298c8..19e068f 100644 --- a/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/graph/Funder.java +++ b/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/graph/Funder.java @@ -1,8 +1,6 @@ package eu.dnetlib.dhp.schema.dump.oaf.graph; -import java.io.Serializable; - /** * To store information about the funder funding the project related to the result. It extends * eu.dnetlib.dhp.schema.dump.oaf.Funder with the following parameter: - - private diff --git a/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/graph/Granted.java b/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/graph/Granted.java index 94ace55..3dec2df 100644 --- a/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/graph/Granted.java +++ b/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/graph/Granted.java @@ -2,7 +2,6 @@ package eu.dnetlib.dhp.schema.dump.oaf.graph; import java.io.Serializable; -import java.util.Optional; /** * To describe the funded amount. It has the following parameters: - private String currency to store the currency of diff --git a/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/graph/Organization.java b/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/graph/Organization.java index 2407c9c..c1fd0e9 100644 --- a/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/graph/Organization.java +++ b/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/graph/Organization.java @@ -5,10 +5,7 @@ import java.io.Serializable; import java.util.List; import eu.dnetlib.dhp.schema.dump.oaf.ControlledField; -import eu.dnetlib.dhp.schema.dump.oaf.Country; -import eu.dnetlib.dhp.schema.dump.oaf.KeyValue; import eu.dnetlib.dhp.schema.dump.oaf.Qualifier; -import eu.dnetlib.dhp.schema.dump.oaf.community.Project; /** * To represent the generic organizaiton. It has the following parameters: - private String legalshortname to store the diff --git a/src/main/java/eu/dnetlib/dhp/schema/oaf/AccessRight.java b/src/main/java/eu/dnetlib/dhp/schema/oaf/AccessRight.java index 14fe748..c680555 100644 --- a/src/main/java/eu/dnetlib/dhp/schema/oaf/AccessRight.java +++ b/src/main/java/eu/dnetlib/dhp/schema/oaf/AccessRight.java @@ -18,6 +18,7 @@ public class AccessRight extends Qualifier { this.openAccessRoute = openAccessRoute; } + @Override public String toComparableString() { String s = super.toComparableString(); return Optional diff --git a/src/main/java/eu/dnetlib/dhp/schema/oaf/OafEntity.java b/src/main/java/eu/dnetlib/dhp/schema/oaf/OafEntity.java index 17c3e6b..0411821 100644 --- a/src/main/java/eu/dnetlib/dhp/schema/oaf/OafEntity.java +++ b/src/main/java/eu/dnetlib/dhp/schema/oaf/OafEntity.java @@ -96,7 +96,8 @@ public abstract class OafEntity extends Oaf implements Serializable { oaiprovenance = e.getOaiprovenance(); } - protected List mergeLists(final List... lists) { + @SafeVarargs + protected final List mergeLists(final List... lists) { return Arrays .stream(lists) diff --git a/src/main/java/eu/dnetlib/dhp/schema/oaf/Project.java b/src/main/java/eu/dnetlib/dhp/schema/oaf/Project.java index 6e3ac1a..0798212 100644 --- a/src/main/java/eu/dnetlib/dhp/schema/oaf/Project.java +++ b/src/main/java/eu/dnetlib/dhp/schema/oaf/Project.java @@ -348,10 +348,6 @@ public class Project extends OafEntity implements Serializable { : contactemail; summary = p.getSummary() != null && compareTrust(this, e) < 0 ? p.getSummary() : summary; currency = p.getCurrency() != null && compareTrust(this, e) < 0 ? p.getCurrency() : currency; -// totalcost = p.getTotalcost() != null && compareTrust(this, e) < 0 ? p.getTotalcost() : totalcost; -// fundedamount = p.getFundedamount() != null && compareTrust(this, e) < 0 -// ? p.getFundedamount() -// : fundedamount; if (p.getH2020topiccode() != null && StringUtils.isEmpty(h2020topiccode)){ h2020topiccode = p.getH2020topiccode(); diff --git a/src/main/java/eu/dnetlib/dhp/schema/oaf/Relation.java b/src/main/java/eu/dnetlib/dhp/schema/oaf/Relation.java index adfc6af..fc6c5e0 100644 --- a/src/main/java/eu/dnetlib/dhp/schema/oaf/Relation.java +++ b/src/main/java/eu/dnetlib/dhp/schema/oaf/Relation.java @@ -4,9 +4,9 @@ package eu.dnetlib.dhp.schema.oaf; import static com.google.common.base.Preconditions.checkArgument; import java.text.ParseException; -import java.util.*; -import java.util.stream.Collectors; -import java.util.stream.Stream; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; import eu.dnetlib.dhp.schema.common.ModelSupport; diff --git a/src/main/java/eu/dnetlib/dhp/schema/oaf/Result.java b/src/main/java/eu/dnetlib/dhp/schema/oaf/Result.java index 701f9ef..68e715d 100644 --- a/src/main/java/eu/dnetlib/dhp/schema/oaf/Result.java +++ b/src/main/java/eu/dnetlib/dhp/schema/oaf/Result.java @@ -349,10 +349,10 @@ public class Result extends OafEntity implements Serializable { private StructuredProperty getMainTitle(List titles) { // need to check if the list of titles contains more than 1 main title? (in that case, we should chose which // main title select in the list) - for (StructuredProperty title : titles) { - if (title.getQualifier() != null && title.getQualifier().getClassid() != null) - if (title.getQualifier().getClassid().equals("main title")) - return title; + for (StructuredProperty t : titles) { + if (t.getQualifier() != null && t.getQualifier().getClassid() != null) + if (t.getQualifier().getClassid().equals("main title")) + return t; } return null; } diff --git a/src/main/java/eu/dnetlib/dhp/schema/oaf/StructuredProperty.java b/src/main/java/eu/dnetlib/dhp/schema/oaf/StructuredProperty.java index 024b915..8750950 100644 --- a/src/main/java/eu/dnetlib/dhp/schema/oaf/StructuredProperty.java +++ b/src/main/java/eu/dnetlib/dhp/schema/oaf/StructuredProperty.java @@ -8,8 +8,6 @@ import java.util.stream.Stream; import org.apache.commons.lang3.StringUtils; -import com.google.common.base.Joiner; - public class StructuredProperty implements Serializable { private String value; diff --git a/src/main/java/eu/dnetlib/dhp/schema/oaf/utils/CleaningFunctions.java b/src/main/java/eu/dnetlib/dhp/schema/oaf/utils/CleaningFunctions.java index c56eed4..d759114 100644 --- a/src/main/java/eu/dnetlib/dhp/schema/oaf/utils/CleaningFunctions.java +++ b/src/main/java/eu/dnetlib/dhp/schema/oaf/utils/CleaningFunctions.java @@ -22,6 +22,8 @@ public class CleaningFunctions { PID_BLACKLIST.add("na"); } + private CleaningFunctions() {} + /** * Utility method that filter PID values on a per-type basis. * @param s the PID whose value will be checked. diff --git a/src/main/java/eu/dnetlib/dhp/schema/oaf/utils/IdentifierFactory.java b/src/main/java/eu/dnetlib/dhp/schema/oaf/utils/IdentifierFactory.java index 2b7a5f3..35d1536 100644 --- a/src/main/java/eu/dnetlib/dhp/schema/oaf/utils/IdentifierFactory.java +++ b/src/main/java/eu/dnetlib/dhp/schema/oaf/utils/IdentifierFactory.java @@ -120,7 +120,7 @@ public class IdentifierFactory implements Serializable { return pids .values() .stream() - .flatMap(s -> s.stream()) + .flatMap(Set::stream) .min(new PidComparator<>(entity)) .map( min -> Optional @@ -140,8 +140,7 @@ public class IdentifierFactory implements Serializable { if (entity instanceof Result) { return Optional .ofNullable(((Result) entity).getInstance()) - .map( - instance -> mapPids(instance)) + .map(IdentifierFactory::mapPids) .orElse(new HashMap<>()); } else { return entity @@ -247,7 +246,6 @@ public class IdentifierFactory implements Serializable { md.update(s.getBytes(StandardCharsets.UTF_8)); return new String(Hex.encodeHex(md.digest())); } catch (final Exception e) { - System.err.println("Error creating id"); return null; } } diff --git a/src/main/java/eu/dnetlib/dhp/schema/oaf/utils/ModelHardLimits.java b/src/main/java/eu/dnetlib/dhp/schema/oaf/utils/ModelHardLimits.java index b8f81ea..ea40509 100644 --- a/src/main/java/eu/dnetlib/dhp/schema/oaf/utils/ModelHardLimits.java +++ b/src/main/java/eu/dnetlib/dhp/schema/oaf/utils/ModelHardLimits.java @@ -3,6 +3,8 @@ package eu.dnetlib.dhp.schema.oaf.utils; public class ModelHardLimits { + private ModelHardLimits() {} + public static final String LAYOUT = "index"; public static final String INTERPRETATION = "openaire"; public static final String SEPARATOR = "-"; diff --git a/src/main/java/eu/dnetlib/dhp/schema/oaf/utils/PidBlacklistProvider.java b/src/main/java/eu/dnetlib/dhp/schema/oaf/utils/PidBlacklistProvider.java index 1c1c21f..3bcd0ab 100644 --- a/src/main/java/eu/dnetlib/dhp/schema/oaf/utils/PidBlacklistProvider.java +++ b/src/main/java/eu/dnetlib/dhp/schema/oaf/utils/PidBlacklistProvider.java @@ -34,4 +34,6 @@ public class PidBlacklistProvider { .orElse(new HashSet<>()); } + private PidBlacklistProvider() {} + } diff --git a/src/main/java/eu/dnetlib/dhp/schema/oaf/utils/ResultTypeComparator.java b/src/main/java/eu/dnetlib/dhp/schema/oaf/utils/ResultTypeComparator.java index 80a7ce0..04d855d 100644 --- a/src/main/java/eu/dnetlib/dhp/schema/oaf/utils/ResultTypeComparator.java +++ b/src/main/java/eu/dnetlib/dhp/schema/oaf/utils/ResultTypeComparator.java @@ -9,6 +9,7 @@ import java.util.Optional; import java.util.stream.Collectors; import eu.dnetlib.dhp.schema.common.ModelConstants; +import eu.dnetlib.dhp.schema.oaf.KeyValue; import eu.dnetlib.dhp.schema.oaf.Result; public class ResultTypeComparator implements Comparator { @@ -69,7 +70,7 @@ public class ResultTypeComparator implements Comparator { .map( cf -> cf .stream() - .map(c -> c.getKey()) + .map(KeyValue::getKey) .collect(Collectors.toCollection(HashSet::new))) .orElse(new HashSet<>()); } diff --git a/src/main/java/eu/dnetlib/dhp/schema/orcid/Contributor.java b/src/main/java/eu/dnetlib/dhp/schema/orcid/Contributor.java index 3b543db..23161d7 100644 --- a/src/main/java/eu/dnetlib/dhp/schema/orcid/Contributor.java +++ b/src/main/java/eu/dnetlib/dhp/schema/orcid/Contributor.java @@ -3,12 +3,9 @@ package eu.dnetlib.dhp.schema.orcid; import java.io.Serializable; -import eu.dnetlib.dhp.schema.orcid.AuthorData; - /** * This class models the data related to a contributor, that are retrieved from an orcid publication */ - public class Contributor extends AuthorData implements Serializable { private String sequence; private String role; diff --git a/src/main/java/eu/dnetlib/dhp/schema/orcid/WorkDetail.java b/src/main/java/eu/dnetlib/dhp/schema/orcid/WorkDetail.java index 614d415..f0e2ceb 100644 --- a/src/main/java/eu/dnetlib/dhp/schema/orcid/WorkDetail.java +++ b/src/main/java/eu/dnetlib/dhp/schema/orcid/WorkDetail.java @@ -4,11 +4,6 @@ package eu.dnetlib.dhp.schema.orcid; import java.io.Serializable; import java.util.List; -import eu.dnetlib.dhp.schema.orcid.Contributor; -import eu.dnetlib.dhp.schema.orcid.ExternalId; -import eu.dnetlib.dhp.schema.orcid.OrcidData; -import eu.dnetlib.dhp.schema.orcid.PublicationDate; - /** * This class models the data that are retrieved from orcid publication */ diff --git a/src/test/java/eu/dnetlib/dhp/schema/action/AtomicActionTest.java b/src/test/java/eu/dnetlib/dhp/schema/action/AtomicActionTest.java index 9818d03..22cd48c 100644 --- a/src/test/java/eu/dnetlib/dhp/schema/action/AtomicActionTest.java +++ b/src/test/java/eu/dnetlib/dhp/schema/action/AtomicActionTest.java @@ -14,10 +14,11 @@ import eu.dnetlib.dhp.schema.common.ModelConstants; import eu.dnetlib.dhp.schema.oaf.Relation; /** @author claudio.atzori */ -public class AtomicActionTest { +class AtomicActionTest { @Test - public void serializationTest() throws IOException { + @SuppressWarnings("unchecked") + void serializationTest() throws IOException { Relation rel = new Relation(); rel.setSource("1"); diff --git a/src/test/java/eu/dnetlib/dhp/schema/common/ModelSupportTest.java b/src/test/java/eu/dnetlib/dhp/schema/common/ModelSupportTest.java index 73e8c47..b40e119 100644 --- a/src/test/java/eu/dnetlib/dhp/schema/common/ModelSupportTest.java +++ b/src/test/java/eu/dnetlib/dhp/schema/common/ModelSupportTest.java @@ -17,7 +17,7 @@ public class ModelSupportTest { class IsSubClass { @Test - public void shouldReturnFalseWhenSubClassDoesNotExtendSuperClass() { + void shouldReturnFalseWhenSubClassDoesNotExtendSuperClass() { // when Boolean result = ModelSupport.isSubClass(Relation.class, OafEntity.class); @@ -26,7 +26,7 @@ public class ModelSupportTest { } @Test - public void shouldReturnTrueWhenSubClassExtendsSuperClass() { + void shouldReturnTrueWhenSubClassExtendsSuperClass() { // when Boolean result = ModelSupport.isSubClass(Result.class, OafEntity.class); diff --git a/src/test/java/eu/dnetlib/dhp/schema/oaf/MeasureTest.java b/src/test/java/eu/dnetlib/dhp/schema/oaf/MeasureTest.java index 26b4407..c6f8aa8 100644 --- a/src/test/java/eu/dnetlib/dhp/schema/oaf/MeasureTest.java +++ b/src/test/java/eu/dnetlib/dhp/schema/oaf/MeasureTest.java @@ -12,13 +12,13 @@ import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; import com.google.common.collect.Lists; -public class MeasureTest { +class MeasureTest { public static final ObjectMapper OBJECT_MAPPER = new ObjectMapper() .setSerializationInclusion(JsonInclude.Include.NON_NULL); @Test - public void testMeasureSerialization() throws IOException { + void testMeasureSerialization() throws IOException { Measure popularity = new Measure(); popularity.setId("popularity"); diff --git a/src/test/java/eu/dnetlib/dhp/schema/oaf/MergeTest.java b/src/test/java/eu/dnetlib/dhp/schema/oaf/MergeTest.java index f9e70c7..e271e47 100644 --- a/src/test/java/eu/dnetlib/dhp/schema/oaf/MergeTest.java +++ b/src/test/java/eu/dnetlib/dhp/schema/oaf/MergeTest.java @@ -10,7 +10,7 @@ import java.util.List; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -public class MergeTest { +class MergeTest { OafEntity oaf; @@ -20,7 +20,8 @@ public class MergeTest { } @Test - public void mergeListsTest() { + @SuppressWarnings("unchecked") + void mergeListsTest() { // string list merge test List a = Arrays.asList("a", "b", "c", "e"); @@ -35,7 +36,7 @@ public class MergeTest { } @Test - public void mergePublicationCollectedFromTest() { + void mergePublicationCollectedFromTest() { Publication a = publication(); Publication b = publication(); @@ -50,7 +51,7 @@ public class MergeTest { } @Test - public void mergePublicationDateOfAcceptanceTest_bothPresent() { + void mergePublicationDateOfAcceptanceTest_bothPresent() { Publication a = publication(); Publication b = publication(); @@ -65,7 +66,7 @@ public class MergeTest { } @Test - public void mergePublicationDateOfAcceptanceTest_bothPresent_1() { + void mergePublicationDateOfAcceptanceTest_bothPresent_1() { Publication a = publication("0.8"); Publication b = publication("0.9"); @@ -80,7 +81,7 @@ public class MergeTest { } @Test - public void mergePublicationDateOfAcceptanceTest_bothPresent_2() { + void mergePublicationDateOfAcceptanceTest_bothPresent_2() { Publication a = publication("0.9"); Publication b = publication("0.8"); @@ -95,7 +96,7 @@ public class MergeTest { } @Test - public void mergePublicationDateOfAcceptanceTest_leftMissing() { + void mergePublicationDateOfAcceptanceTest_leftMissing() { Publication a = publication(); Publication b = publication(); @@ -109,7 +110,7 @@ public class MergeTest { } @Test - public void mergePublicationDateOfAcceptanceTest_leftMissing_1() { + void mergePublicationDateOfAcceptanceTest_leftMissing_1() { Publication a = publication("0.9"); Publication b = publication("0.8"); @@ -123,7 +124,7 @@ public class MergeTest { } @Test - public void mergePublicationDateOfAcceptanceTest_leftMissing_2() { + void mergePublicationDateOfAcceptanceTest_leftMissing_2() { Publication a = publication("0.8"); Publication b = publication("0.9"); @@ -137,7 +138,7 @@ public class MergeTest { } @Test - public void mergePublicationDateOfAcceptanceTest_rightMissing() { + void mergePublicationDateOfAcceptanceTest_rightMissing() { Publication a = publication(); Publication b = publication(); @@ -151,7 +152,7 @@ public class MergeTest { } @Test - public void mergePublicationDateOfAcceptanceTest_rightMissing_1() { + void mergePublicationDateOfAcceptanceTest_rightMissing_1() { Publication a = publication("0.8"); Publication b = publication("0.9"); @@ -165,7 +166,7 @@ public class MergeTest { } @Test - public void mergePublicationDateOfAcceptanceTest_rightMissing_2() { + void mergePublicationDateOfAcceptanceTest_rightMissing_2() { Publication a = publication("0.9"); Publication b = publication("0.8"); @@ -179,7 +180,7 @@ public class MergeTest { } @Test - public void mergePublicationSubjectTest() { + void mergePublicationSubjectTest() { Publication a = publication(); Publication b = publication(); @@ -194,7 +195,7 @@ public class MergeTest { } @Test - public void mergeRelationTest() { + void mergeRelationTest() { Relation a = createRel(null, null); Relation b = createRel(null, null); @@ -235,7 +236,7 @@ public class MergeTest { } @Test - public void mergeRelationTestParseException() { + void mergeRelationTestParseException() { assertThrows(DateTimeParseException.class, () -> { Relation a = createRel(true, "Once upon a time ..."); Relation b = createRel(true, "... in a far away land"); @@ -279,7 +280,7 @@ public class MergeTest { } private Field field(T value) { - Field f = new Field(); + Field f = new Field(); f.setValue(value); return f; } diff --git a/src/test/java/eu/dnetlib/dhp/schema/oaf/utils/BlackListProviderTest.java b/src/test/java/eu/dnetlib/dhp/schema/oaf/utils/BlackListProviderTest.java index 203cda0..61d06a6 100644 --- a/src/test/java/eu/dnetlib/dhp/schema/oaf/utils/BlackListProviderTest.java +++ b/src/test/java/eu/dnetlib/dhp/schema/oaf/utils/BlackListProviderTest.java @@ -6,10 +6,10 @@ import java.util.Set; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -public class BlackListProviderTest { +class BlackListProviderTest { @Test - public void blackListTest() { + void blackListTest() { Assertions.assertNotNull(PidBlacklistProvider.getBlacklist()); Assertions.assertNotNull(PidBlacklistProvider.getBlacklist().get("doi")); diff --git a/src/test/java/eu/dnetlib/dhp/schema/oaf/utils/IdentifierFactoryTest.java b/src/test/java/eu/dnetlib/dhp/schema/oaf/utils/IdentifierFactoryTest.java index aec0878..0a434a1 100644 --- a/src/test/java/eu/dnetlib/dhp/schema/oaf/utils/IdentifierFactoryTest.java +++ b/src/test/java/eu/dnetlib/dhp/schema/oaf/utils/IdentifierFactoryTest.java @@ -14,13 +14,13 @@ import com.fasterxml.jackson.databind.ObjectMapper; import eu.dnetlib.dhp.schema.oaf.Publication; -public class IdentifierFactoryTest { +class IdentifierFactoryTest { private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper() .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); @Test - public void testCreateIdentifierForPublication() throws IOException { + void testCreateIdentifierForPublication() throws IOException { verifyIdentifier( "publication_doi1.json", "50|doi_________::79dbc7a2a56dc1532659f9038843256e", true); @@ -51,7 +51,7 @@ public class IdentifierFactoryTest { } @Test - public void testCreateIdentifierForPublicationNoHash() throws IOException { + void testCreateIdentifierForPublicationNoHash() throws IOException { verifyIdentifier("publication_doi1.json", "50|doi_________::10.1016/j.cmet.2010.03.013", false); verifyIdentifier("publication_doi2.json", "50|doi_________::10.1016/j.cmet.2010.03.013", false); From 1a34a9f7b38555227deb42f3cb509e9df5e03fe0 Mon Sep 17 00:00:00 2001 From: Claudio Atzori Date: Wed, 11 Aug 2021 15:42:00 +0200 Subject: [PATCH 18/18] added public constructor to allow subclassing --- .../java/eu/dnetlib/dhp/schema/oaf/utils/CleaningFunctions.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/eu/dnetlib/dhp/schema/oaf/utils/CleaningFunctions.java b/src/main/java/eu/dnetlib/dhp/schema/oaf/utils/CleaningFunctions.java index d759114..1d12478 100644 --- a/src/main/java/eu/dnetlib/dhp/schema/oaf/utils/CleaningFunctions.java +++ b/src/main/java/eu/dnetlib/dhp/schema/oaf/utils/CleaningFunctions.java @@ -22,7 +22,7 @@ public class CleaningFunctions { PID_BLACKLIST.add("na"); } - private CleaningFunctions() {} + public CleaningFunctions() {} /** * Utility method that filter PID values on a per-type basis.