updated mergeFrom function for DLI Unknown

This commit is contained in:
Sandro La Bruzzo 2020-08-10 10:18:35 +02:00
parent ddb1446ceb
commit 0ade33ad15
2 changed files with 72 additions and 68 deletions

View File

@ -2,10 +2,8 @@
package eu.dnetlib.dhp.schema.scholexplorer; package eu.dnetlib.dhp.schema.scholexplorer;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap; import java.util.stream.Collectors;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@ -78,6 +76,25 @@ public class DLIUnknown extends Oaf implements Serializable {
if ("complete".equalsIgnoreCase(p.completionStatus)) if ("complete".equalsIgnoreCase(p.completionStatus))
completionStatus = "complete"; completionStatus = "complete";
dlicollectedfrom = mergeProvenance(dlicollectedfrom, p.getDlicollectedfrom()); 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 <T> List<T> mergeLists(final List<T>... lists) {
return Arrays
.stream(lists)
.filter(Objects::nonNull)
.flatMap(List::stream)
.filter(Objects::nonNull)
.distinct()
.collect(Collectors.toList());
} }
private List<ProvenaceInfo> mergeProvenance( private List<ProvenaceInfo> mergeProvenance(

View File

@ -1,66 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<oai:record xmlns:oai="http://www.openarchives.org/OAI/2.0/" <oai:record xmlns:oai="http://www.openarchives.org/OAI/2.0/"
xmlns:oaf="http://namespace.openaire.eu/oaf" xmlns:oaf="http://namespace.openaire.eu/oaf"
xmlns:dri="http://www.driver-repository.eu/namespace/dri" xmlns:dri="http://www.driver-repository.eu/namespace/dri"
xmlns:dc="http://purl.org/dc/elements/1.1/"> xmlns:dc="http://purl.org/dc/elements/1.1/">
<oai:header> <oai:header>
<dri:repositoryId>aaadf8b3-01a8-4cc2-9964-63cfb19df3b4_UmVwb3NpdG9yeVNlcnZpY2VSZXNvdXJjZXMvUmVwb3NpdG9yeVNlcnZpY2VSZXNvdXJjZVR5cGU=</dri:repositoryId> <dri:repositoryId>aaadf8b3-01a8-4cc2-9964-63cfb19df3b4_UmVwb3NpdG9yeVNlcnZpY2VSZXNvdXJjZXMvUmVwb3NpdG9yeVNlcnZpY2VSZXNvdXJjZVR5cGU=</dri:repositoryId>
<dri:recordIdentifier>oai:pangaea.de:doi:10.1594/PANGAEA.821876</dri:recordIdentifier> <dri:recordIdentifier>oai:pangaea.de:doi:10.1594/PANGAEA.432865</dri:recordIdentifier>
<dri:datasourceprefix>r3d100010134</dri:datasourceprefix> <dri:datasourceprefix>r3d100010134</dri:datasourceprefix>
<dri:objIdentifier>r3d100010134::000083be706192d2d839915694ecfd47</dri:objIdentifier> <dri:objIdentifier>r3d100010134::00002f60593fd1f758fb838fafb46795</dri:objIdentifier>
<dri:resolvedDate>2020-01-08T04:12:12.287</dri:resolvedDate> <dri:dateOfCollection>2020-02-18T03:05:02.534Z</dri:dateOfCollection>
<dri:dateOfCollection>2020-01-08T03:24:10.865Z</dri:dateOfCollection> <oaf:datasourceprefix/>
<oaf:datasourceprefix/> <identifier>oai:pangaea.de:doi:10.1594/PANGAEA.432865</identifier>
<identifier>oai:pangaea.de:doi:10.1594/PANGAEA.821876</identifier> <setSpec>citable topicOceans</setSpec>
<setSpec>citable</setSpec> </oai:header>
</oai:header> <oai:metadata>
<metadata> <resource xmlns="http://datacite.org/schema/kernel-3">
<resource xmlns="http://datacite.org/schema/kernel-3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://datacite.org/schema/kernel-3 http://schema.datacite.org/meta/kernel-3/metadata.xsd"> <identifier identifierType="doi">10.1594/pangaea.432865</identifier>
<identifier identifierType="doi">10.1594/pangaea.821876</identifier> <titles xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<creators> <creator><creatorName>Macke, Andreas</creatorName></creator><creator><creatorName>Kalisch, John</creatorName></creator> </creators> <title>Daily sea level from coastal tide gauge station Woods_Hole in 1978 (Research quality database)</title>
<titles> <title>Total Sky Imager observations during POLARSTERN cruise ANT-XXVI/4 on 2010-05-14 with links to images</title> </titles> </titles>
<publisher xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">PANGAEA - Data Publisher for Earth &amp; Environmental Science</publisher>
<publisher>PANGAEA - Data Publisher for Earth &amp; Environmental Science</publisher> <publicationYear xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">2006</publicationYear>
<dates> <dates xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<date dateType="Collected">2010-05-14T00:13:47/2010-05-14T23:55:47</date> <date dateType="Collected">1978-01-01T12:00:00/1978-12-31T12:00:00</date>
</dates> </dates>
<subjects> <creators xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<creator>
<subject subjectScheme="Parameter">DATE/TIME</subject> <creatorName>WOCE Sea Level, WSL</creatorName>
</creator>
<subject subjectScheme="Parameter">LATITUDE</subject> </creators>
<subjects xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<subject subjectScheme="Parameter">LONGITUDE</subject> <subject subjectScheme="Parameter">DATE/TIME</subject>
<subject subjectScheme="Parameter">Sea level</subject>
<subject subjectScheme="Parameter">Uniform resource locator/link to image</subject> <subject subjectScheme="Method">Tide gauge station</subject>
<subject subjectScheme="Campaign">SeaLevel</subject>
<subject subjectScheme="Method">Total Sky Imager</subject> <subject subjectScheme="Project">World Ocean Circulation Experiment (WOCE)</subject>
</subjects>
<subject subjectScheme="Campaign">ANT-XXVI/4</subject> <resourceType resourceTypeGeneral="Dataset"/>
<relatedIdentifiers>
<subject subjectScheme="Basis">Polarstern</subject> <relatedIdentifier relatedIdentifierType="URL" relationType="isDocumentedBy"
inverseRelationType="documents">http://store.pangaea.de/Projects/WOCE/SeaLevel_rqds/Woods_Hole.txt</relatedIdentifier>
</subjects> </relatedIdentifiers>
<resourceType resourceTypeGeneral="dataset">dataset</resourceType> </resource>
<relatedIdentifiers> </oai:metadata>
<oaf:about>
<relatedIdentifier relatedIdentifierType="dnet" relationType="isPartOf" inverseRelationType="hasPart" entityType="dataset">dli_resolver::cf447a378b0b6603593f8b0e57242695</relatedIdentifier> <oaf:datainfo>
<oaf:collectedFrom completionStatus="complete" id="dli_________::r3d100010134" name="Pangaea"/>
<relatedIdentifier relatedIdentifierType="URL" relationType="references" inverseRelationType="isReferencedBy" entityType="unknown">http://hs.pangaea.de/images/airphoto/ps/ps75/2010-05-14/ant-xxvi_4_2010-05-14_tsi-images-links.zip</relatedIdentifier> <oaf:completionStatus>complete</oaf:completionStatus>
<oaf:provisionMode>collected</oaf:provisionMode>
<relatedIdentifier relatedIdentifierType="dnet" relationType="references" inverseRelationType="isReferencedBy" entityType="publication">dli_resolver::f0f5975d20991cffd222c6002ddd5821</relatedIdentifier> </oaf:datainfo>
</oaf:about>
</relatedIdentifiers> </oai:record>
</resource>
</metadata>
<oaf:about xmlns:oaf="http://namespace.dnet.eu/oaf">
<oaf:datainfo >
<oaf:completionStatus>complete</oaf:completionStatus>
<oaf:collectedFrom id="dli_________::r3d100010134" name="Pangaea" completionStatus="complete"/>
</oaf:datainfo>
</oaf:about>
</oai:record>