forked from D-Net/dnet-hadoop
[Graph model] updated definition of ExternalReference: added alternateLabel, removed description (#6503)
This commit is contained in:
parent
e686b8de8d
commit
1e7e5180fa
|
@ -2,6 +2,7 @@
|
||||||
package eu.dnetlib.dhp.schema.oaf;
|
package eu.dnetlib.dhp.schema.oaf;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
public class ExternalReference implements Serializable {
|
public class ExternalReference implements Serializable {
|
||||||
|
@ -11,12 +12,12 @@ public class ExternalReference implements Serializable {
|
||||||
// title
|
// title
|
||||||
private String label;
|
private String label;
|
||||||
|
|
||||||
|
// alternative labels
|
||||||
|
private List<String> alternateLabel;
|
||||||
|
|
||||||
// text()
|
// text()
|
||||||
private String url;
|
private String url;
|
||||||
|
|
||||||
// ?? not mapped yet ??
|
|
||||||
private String description;
|
|
||||||
|
|
||||||
// type
|
// type
|
||||||
private Qualifier qualifier;
|
private Qualifier qualifier;
|
||||||
|
|
||||||
|
@ -45,6 +46,14 @@ public class ExternalReference implements Serializable {
|
||||||
this.label = label;
|
this.label = label;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<String> getAlternateLabel() {
|
||||||
|
return alternateLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAlternateLabel(List<String> alternateLabel) {
|
||||||
|
this.alternateLabel = alternateLabel;
|
||||||
|
}
|
||||||
|
|
||||||
public String getUrl() {
|
public String getUrl() {
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
@ -53,14 +62,6 @@ public class ExternalReference implements Serializable {
|
||||||
this.url = url;
|
this.url = url;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDescription() {
|
|
||||||
return description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDescription(String description) {
|
|
||||||
this.description = description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Qualifier getQualifier() {
|
public Qualifier getQualifier() {
|
||||||
return qualifier;
|
return qualifier;
|
||||||
}
|
}
|
||||||
|
@ -103,7 +104,6 @@ public class ExternalReference implements Serializable {
|
||||||
return Objects.equals(sitename, that.sitename)
|
return Objects.equals(sitename, that.sitename)
|
||||||
&& Objects.equals(label, that.label)
|
&& Objects.equals(label, that.label)
|
||||||
&& Objects.equals(url, that.url)
|
&& Objects.equals(url, that.url)
|
||||||
&& Objects.equals(description, that.description)
|
|
||||||
&& Objects.equals(qualifier, that.qualifier)
|
&& Objects.equals(qualifier, that.qualifier)
|
||||||
&& Objects.equals(refidentifier, that.refidentifier)
|
&& Objects.equals(refidentifier, that.refidentifier)
|
||||||
&& Objects.equals(query, that.query)
|
&& Objects.equals(query, that.query)
|
||||||
|
@ -114,6 +114,7 @@ public class ExternalReference implements Serializable {
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects
|
return Objects
|
||||||
.hash(
|
.hash(
|
||||||
sitename, label, url, description, qualifier, refidentifier, query, dataInfo);
|
sitename, label, url, qualifier, refidentifier, query, dataInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -132,7 +132,6 @@ public class ProtoConverter implements Serializable {
|
||||||
ex.setQuery(e.getQuery());
|
ex.setQuery(e.getQuery());
|
||||||
ex.setQualifier(mapQualifier(e.getQualifier()));
|
ex.setQualifier(mapQualifier(e.getQualifier()));
|
||||||
ex.setLabel(e.getLabel());
|
ex.setLabel(e.getLabel());
|
||||||
ex.setDescription(e.getDescription());
|
|
||||||
ex.setDataInfo(ex.getDataInfo());
|
ex.setDataInfo(ex.getDataInfo());
|
||||||
return ex;
|
return ex;
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,6 @@ import eu.dnetlib.dhp.schema.oaf.Result;
|
||||||
|
|
||||||
public class XmlRecordFactory implements Serializable {
|
public class XmlRecordFactory implements Serializable {
|
||||||
|
|
||||||
private static final String REL_SUBTYPE_DEDUP = "dedup";
|
|
||||||
private final Map<String, LongAccumulator> accumulators;
|
private final Map<String, LongAccumulator> accumulators;
|
||||||
|
|
||||||
private final Set<String> specialDatasourceTypes;
|
private final Set<String> specialDatasourceTypes;
|
||||||
|
@ -1202,12 +1201,18 @@ public class XmlRecordFactory implements Serializable {
|
||||||
if (isNotBlank(er.getLabel())) {
|
if (isNotBlank(er.getLabel())) {
|
||||||
fields.add(XmlSerializationUtils.asXmlElement("label", er.getLabel()));
|
fields.add(XmlSerializationUtils.asXmlElement("label", er.getLabel()));
|
||||||
}
|
}
|
||||||
|
Optional
|
||||||
|
.ofNullable(er.getAlternateLabel())
|
||||||
|
.map(
|
||||||
|
altLabel -> altLabel
|
||||||
|
.stream()
|
||||||
|
.filter(StringUtils::isNotBlank)
|
||||||
|
.collect(Collectors.toList()))
|
||||||
|
.orElse(Lists.newArrayList())
|
||||||
|
.forEach(alt -> fields.add(XmlSerializationUtils.asXmlElement("alternatelabel", alt)));
|
||||||
if (isNotBlank(er.getUrl())) {
|
if (isNotBlank(er.getUrl())) {
|
||||||
fields.add(XmlSerializationUtils.asXmlElement("url", er.getUrl()));
|
fields.add(XmlSerializationUtils.asXmlElement("url", er.getUrl()));
|
||||||
}
|
}
|
||||||
if (isNotBlank(er.getDescription())) {
|
|
||||||
fields.add(XmlSerializationUtils.asXmlElement("description", er.getDescription()));
|
|
||||||
}
|
|
||||||
if (isNotBlank(er.getUrl())) {
|
if (isNotBlank(er.getUrl())) {
|
||||||
fields.add(XmlSerializationUtils.mapQualifier("qualifier", er.getQualifier()));
|
fields.add(XmlSerializationUtils.mapQualifier("qualifier", er.getQualifier()));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue