[Graph model] updated definition of ExternalReference: added alternateLabel, removed description (#6503)

This commit is contained in:
Claudio Atzori 2021-04-02 12:32:12 +02:00
parent e686b8de8d
commit 1e7e5180fa
3 changed files with 23 additions and 18 deletions

View File

@ -2,6 +2,7 @@
package eu.dnetlib.dhp.schema.oaf;
import java.io.Serializable;
import java.util.List;
import java.util.Objects;
public class ExternalReference implements Serializable {
@ -11,12 +12,12 @@ public class ExternalReference implements Serializable {
// title
private String label;
// alternative labels
private List<String> alternateLabel;
// text()
private String url;
// ?? not mapped yet ??
private String description;
// type
private Qualifier qualifier;
@ -45,6 +46,14 @@ public class ExternalReference implements Serializable {
this.label = label;
}
public List<String> getAlternateLabel() {
return alternateLabel;
}
public void setAlternateLabel(List<String> alternateLabel) {
this.alternateLabel = alternateLabel;
}
public String getUrl() {
return url;
}
@ -53,14 +62,6 @@ public class ExternalReference implements Serializable {
this.url = url;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Qualifier getQualifier() {
return qualifier;
}
@ -103,7 +104,6 @@ public class ExternalReference implements Serializable {
return Objects.equals(sitename, that.sitename)
&& Objects.equals(label, that.label)
&& Objects.equals(url, that.url)
&& Objects.equals(description, that.description)
&& Objects.equals(qualifier, that.qualifier)
&& Objects.equals(refidentifier, that.refidentifier)
&& Objects.equals(query, that.query)
@ -114,6 +114,7 @@ public class ExternalReference implements Serializable {
public int hashCode() {
return Objects
.hash(
sitename, label, url, description, qualifier, refidentifier, query, dataInfo);
sitename, label, url, qualifier, refidentifier, query, dataInfo);
}
}

View File

@ -132,7 +132,6 @@ public class ProtoConverter implements Serializable {
ex.setQuery(e.getQuery());
ex.setQualifier(mapQualifier(e.getQualifier()));
ex.setLabel(e.getLabel());
ex.setDescription(e.getDescription());
ex.setDataInfo(ex.getDataInfo());
return ex;
}

View File

@ -45,7 +45,6 @@ import eu.dnetlib.dhp.schema.oaf.Result;
public class XmlRecordFactory implements Serializable {
private static final String REL_SUBTYPE_DEDUP = "dedup";
private final Map<String, LongAccumulator> accumulators;
private final Set<String> specialDatasourceTypes;
@ -1202,12 +1201,18 @@ public class XmlRecordFactory implements Serializable {
if (isNotBlank(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())) {
fields.add(XmlSerializationUtils.asXmlElement("url", er.getUrl()));
}
if (isNotBlank(er.getDescription())) {
fields.add(XmlSerializationUtils.asXmlElement("description", er.getDescription()));
}
if (isNotBlank(er.getUrl())) {
fields.add(XmlSerializationUtils.mapQualifier("qualifier", er.getQualifier()));
}