forked from D-Net/dnet-hadoop
instances grouped by URL expose only one refereed
This commit is contained in:
parent
f10066547b
commit
48d32466e4
|
@ -12,6 +12,7 @@ import scala.Serializable;
|
||||||
public class XmlInstance implements Serializable {
|
public class XmlInstance implements Serializable {
|
||||||
|
|
||||||
public static final AccessRight UNKNOWN_ACCESS_RIGHT;
|
public static final AccessRight UNKNOWN_ACCESS_RIGHT;
|
||||||
|
public static final Qualifier UNKNOWN_REVIEW_LEVEL;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
UNKNOWN_ACCESS_RIGHT = new AccessRight();
|
UNKNOWN_ACCESS_RIGHT = new AccessRight();
|
||||||
|
@ -19,6 +20,12 @@ public class XmlInstance implements Serializable {
|
||||||
UNKNOWN_ACCESS_RIGHT.setClassname(ModelConstants.UNKNOWN);
|
UNKNOWN_ACCESS_RIGHT.setClassname(ModelConstants.UNKNOWN);
|
||||||
UNKNOWN_ACCESS_RIGHT.setSchemeid(ModelConstants.DNET_ACCESS_MODES);
|
UNKNOWN_ACCESS_RIGHT.setSchemeid(ModelConstants.DNET_ACCESS_MODES);
|
||||||
UNKNOWN_ACCESS_RIGHT.setSchemename(ModelConstants.DNET_ACCESS_MODES);
|
UNKNOWN_ACCESS_RIGHT.setSchemename(ModelConstants.DNET_ACCESS_MODES);
|
||||||
|
|
||||||
|
UNKNOWN_REVIEW_LEVEL = new Qualifier();
|
||||||
|
UNKNOWN_REVIEW_LEVEL.setClassid("0000");
|
||||||
|
UNKNOWN_REVIEW_LEVEL.setClassname(ModelConstants.UNKNOWN);
|
||||||
|
UNKNOWN_ACCESS_RIGHT.setSchemeid(ModelConstants.DNET_REVIEW_LEVELS);
|
||||||
|
UNKNOWN_REVIEW_LEVEL.setSchemename(ModelConstants.DNET_REVIEW_LEVELS);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String url;
|
private String url;
|
||||||
|
@ -50,7 +57,7 @@ public class XmlInstance implements Serializable {
|
||||||
// typed results
|
// typed results
|
||||||
private String processingchargecurrency;
|
private String processingchargecurrency;
|
||||||
|
|
||||||
private Set<Qualifier> refereed = Sets.newHashSet();; // peer-review status
|
private Qualifier refereed; // peer-review status
|
||||||
|
|
||||||
public String getUrl() {
|
public String getUrl() {
|
||||||
return url;
|
return url;
|
||||||
|
@ -148,11 +155,11 @@ public class XmlInstance implements Serializable {
|
||||||
this.processingchargecurrency = processingchargecurrency;
|
this.processingchargecurrency = processingchargecurrency;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<Qualifier> getRefereed() {
|
public Qualifier getRefereed() {
|
||||||
return refereed;
|
return refereed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRefereed(Set<Qualifier> refereed) {
|
public void setRefereed(Qualifier refereed) {
|
||||||
this.refereed = refereed;
|
this.refereed = refereed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@ import org.dom4j.Node;
|
||||||
import org.dom4j.io.OutputFormat;
|
import org.dom4j.io.OutputFormat;
|
||||||
import org.dom4j.io.SAXReader;
|
import org.dom4j.io.SAXReader;
|
||||||
import org.dom4j.io.XMLWriter;
|
import org.dom4j.io.XMLWriter;
|
||||||
|
import org.json4s.Xml;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.google.common.base.Joiner;
|
import com.google.common.base.Joiner;
|
||||||
|
@ -1208,14 +1209,8 @@ public class XmlRecordFactory implements Serializable {
|
||||||
|
|
||||||
if (instance.getRefereed() != null) {
|
if (instance.getRefereed() != null) {
|
||||||
fields
|
fields
|
||||||
.addAll(
|
.add(
|
||||||
instance
|
XmlSerializationUtils.mapQualifier("refereed", instance.getRefereed()));
|
||||||
.getRefereed()
|
|
||||||
.stream()
|
|
||||||
.filter(Objects::nonNull)
|
|
||||||
.filter(r -> !r.isBlank())
|
|
||||||
.map(r -> XmlSerializationUtils.mapQualifier("refereed", r))
|
|
||||||
.collect(Collectors.toList()));
|
|
||||||
}
|
}
|
||||||
if (instance.getProcessingchargeamount() != null
|
if (instance.getProcessingchargeamount() != null
|
||||||
&& isNotBlank(instance.getProcessingchargeamount())) {
|
&& isNotBlank(instance.getProcessingchargeamount())) {
|
||||||
|
@ -1359,13 +1354,20 @@ public class XmlRecordFactory implements Serializable {
|
||||||
.map(Instance::getAccessright)
|
.map(Instance::getAccessright)
|
||||||
.min(new AccessRightComparator<AccessRight>())
|
.min(new AccessRightComparator<AccessRight>())
|
||||||
.orElse(XmlInstance.UNKNOWN_ACCESS_RIGHT));
|
.orElse(XmlInstance.UNKNOWN_ACCESS_RIGHT));
|
||||||
|
instance
|
||||||
|
.setRefereed(
|
||||||
|
instances
|
||||||
|
.stream()
|
||||||
|
.map(Pair::getValue)
|
||||||
|
.map(i -> Optional.ofNullable(i.getRefereed()).orElse(XmlInstance.UNKNOWN_REVIEW_LEVEL))
|
||||||
|
.min(new RefereedComparator())
|
||||||
|
.orElse(XmlInstance.UNKNOWN_REVIEW_LEVEL));
|
||||||
|
|
||||||
instances.forEach(p -> {
|
instances.forEach(p -> {
|
||||||
final Instance i = p.getRight();
|
final Instance i = p.getRight();
|
||||||
instance.getCollectedfrom().add(i.getCollectedfrom());
|
instance.getCollectedfrom().add(i.getCollectedfrom());
|
||||||
instance.getHostedby().add(i.getHostedby());
|
instance.getHostedby().add(i.getHostedby());
|
||||||
instance.getInstancetype().add(i.getInstancetype());
|
instance.getInstancetype().add(i.getInstancetype());
|
||||||
instance.getRefereed().add(i.getRefereed());
|
|
||||||
instance
|
instance
|
||||||
.setProcessingchargeamount(
|
.setProcessingchargeamount(
|
||||||
Optional.ofNullable(i.getProcessingchargeamount()).map(apc -> apc.getValue()).orElse(null));
|
Optional.ofNullable(i.getProcessingchargeamount()).map(apc -> apc.getValue()).orElse(null));
|
||||||
|
|
|
@ -66,7 +66,7 @@ public class XmlRecordFactoryTest {
|
||||||
assertEquals("doi", doc.valueOf("//instance/alternateidentifier/@classid"));
|
assertEquals("doi", doc.valueOf("//instance/alternateidentifier/@classid"));
|
||||||
assertEquals("10.5689/LIB.2018.2853550", doc.valueOf("//instance/alternateidentifier/text()"));
|
assertEquals("10.5689/LIB.2018.2853550", doc.valueOf("//instance/alternateidentifier/text()"));
|
||||||
|
|
||||||
assertEquals(3, doc.selectNodes("//instance").size());
|
assertEquals(2, doc.selectNodes("//instance").size());
|
||||||
|
|
||||||
assertEquals("1721.47", doc.valueOf("//processingchargeamount/text()"));
|
assertEquals("1721.47", doc.valueOf("//processingchargeamount/text()"));
|
||||||
assertEquals("EUR", doc.valueOf("//processingchargecurrency/text()"));
|
assertEquals("EUR", doc.valueOf("//processingchargecurrency/text()"));
|
||||||
|
|
|
@ -453,6 +453,12 @@
|
||||||
"schemeid": "dnet:dataCite_resource",
|
"schemeid": "dnet:dataCite_resource",
|
||||||
"schemename": "dnet:dataCite_resource"
|
"schemename": "dnet:dataCite_resource"
|
||||||
},
|
},
|
||||||
|
"refereed": {
|
||||||
|
"classid": "0001",
|
||||||
|
"classname": "peerReviewed",
|
||||||
|
"schemeid": "dnet:review_levels",
|
||||||
|
"schemename": "dnet:review_levels"
|
||||||
|
},
|
||||||
"license": {
|
"license": {
|
||||||
"dataInfo": {
|
"dataInfo": {
|
||||||
"deletedbyinference": false,
|
"deletedbyinference": false,
|
||||||
|
@ -585,6 +591,12 @@
|
||||||
"schemeid": "dnet:dataCite_resource",
|
"schemeid": "dnet:dataCite_resource",
|
||||||
"schemename": "dnet:dataCite_resource"
|
"schemename": "dnet:dataCite_resource"
|
||||||
},
|
},
|
||||||
|
"refereed": {
|
||||||
|
"classid": "0000",
|
||||||
|
"classname": "UNKNOWN",
|
||||||
|
"schemeid": "dnet:review_levels",
|
||||||
|
"schemename": "dnet:review_levels"
|
||||||
|
},
|
||||||
"license": {
|
"license": {
|
||||||
"dataInfo": {
|
"dataInfo": {
|
||||||
"deletedbyinference": false,
|
"deletedbyinference": false,
|
||||||
|
@ -717,6 +729,12 @@
|
||||||
"schemeid": "dnet:dataCite_resource",
|
"schemeid": "dnet:dataCite_resource",
|
||||||
"schemename": "dnet:dataCite_resource"
|
"schemename": "dnet:dataCite_resource"
|
||||||
},
|
},
|
||||||
|
"refereed": {
|
||||||
|
"classid": "0002",
|
||||||
|
"classname": "nonPeerReviewed",
|
||||||
|
"schemeid": "dnet:review_levels",
|
||||||
|
"schemename": "dnet:review_levels"
|
||||||
|
},
|
||||||
"license": {
|
"license": {
|
||||||
"dataInfo": {
|
"dataInfo": {
|
||||||
"deletedbyinference": false,
|
"deletedbyinference": false,
|
||||||
|
@ -849,6 +867,12 @@
|
||||||
"schemeid": "dnet:dataCite_resource",
|
"schemeid": "dnet:dataCite_resource",
|
||||||
"schemename": "dnet:dataCite_resource"
|
"schemename": "dnet:dataCite_resource"
|
||||||
},
|
},
|
||||||
|
"refereed": {
|
||||||
|
"classid": "0001",
|
||||||
|
"classname": "peerReviewed",
|
||||||
|
"schemeid": "dnet:review_levels",
|
||||||
|
"schemename": "dnet:review_levels"
|
||||||
|
},
|
||||||
"license": {
|
"license": {
|
||||||
"dataInfo": {
|
"dataInfo": {
|
||||||
"deletedbyinference": false,
|
"deletedbyinference": false,
|
||||||
|
@ -866,7 +890,7 @@
|
||||||
"value": ""
|
"value": ""
|
||||||
},
|
},
|
||||||
"url": [
|
"url": [
|
||||||
"http://dx.doi.org/10.1109/TED.2018.2853552",
|
"http://dx.doi.org/10.1109/TED.2018.2853551",
|
||||||
"http://dx.doi.org/10.1109/TED.2018.2853554"
|
"http://dx.doi.org/10.1109/TED.2018.2853554"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
2
pom.xml
2
pom.xml
|
@ -797,7 +797,7 @@
|
||||||
<mockito-core.version>3.3.3</mockito-core.version>
|
<mockito-core.version>3.3.3</mockito-core.version>
|
||||||
<mongodb.driver.version>3.4.2</mongodb.driver.version>
|
<mongodb.driver.version>3.4.2</mongodb.driver.version>
|
||||||
<vtd.version>[2.12,3.0)</vtd.version>
|
<vtd.version>[2.12,3.0)</vtd.version>
|
||||||
<dhp-schemas.version>[2.10.29]</dhp-schemas.version>
|
<dhp-schemas.version>[2.10.30]</dhp-schemas.version>
|
||||||
<dnet-actionmanager-api.version>[4.0.3]</dnet-actionmanager-api.version>
|
<dnet-actionmanager-api.version>[4.0.3]</dnet-actionmanager-api.version>
|
||||||
<dnet-actionmanager-common.version>[6.0.5]</dnet-actionmanager-common.version>
|
<dnet-actionmanager-common.version>[6.0.5]</dnet-actionmanager-common.version>
|
||||||
<dnet-openaire-broker-common.version>[3.1.6]</dnet-openaire-broker-common.version>
|
<dnet-openaire-broker-common.version>[3.1.6]</dnet-openaire-broker-common.version>
|
||||||
|
|
Loading…
Reference in New Issue