From 39fa75ae3fe938e6334fc0f2165ac06917b716e1 Mon Sep 17 00:00:00 2001 From: Claudio Atzori Date: Wed, 19 Jun 2024 15:32:52 +0200 Subject: [PATCH] WIP: align Solr JSON records to the explore portal requirements --- .../java/eu/dnetlib/dhp/schema/solr/Pid.java | 35 ++++++++++++------- .../dhp/schema/solr/RelatedRecord.java | 9 +++++ .../dhp/schema/solr/RelatedRecordHeader.java | 13 ++++++- .../dhp/schema/solr/SolrRecordHeader.java | 17 +++++++++ .../eu/dnetlib/dhp/schema/solr/Subject.java | 25 +++++++++---- 5 files changed, 79 insertions(+), 20 deletions(-) diff --git a/src/main/java/eu/dnetlib/dhp/schema/solr/Pid.java b/src/main/java/eu/dnetlib/dhp/schema/solr/Pid.java index 7c42c29..27dcff5 100644 --- a/src/main/java/eu/dnetlib/dhp/schema/solr/Pid.java +++ b/src/main/java/eu/dnetlib/dhp/schema/solr/Pid.java @@ -6,25 +6,20 @@ public class Pid implements Serializable { private static final long serialVersionUID = -943684282582228545L; - private String type; - private String value; - public static Pid newInstance(String type, String value) { + private String typeCode; + + private String typeLabel; + + public static Pid newInstance(String value, String typeCode, String typeLabel) { Pid p = new Pid(); - p.setType(type); p.setValue(value); + p.setTypeCode(typeCode); + p.setTypeLabel(typeLabel); return p; } - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - public String getValue() { return value; } @@ -32,4 +27,20 @@ public class Pid implements Serializable { public void setValue(String value) { this.value = value; } + + public String getTypeCode() { + return typeCode; + } + + public void setTypeCode(String typeCode) { + this.typeCode = typeCode; + } + + public String getTypeLabel() { + return typeLabel; + } + + public void setTypeLabel(String typeLabel) { + this.typeLabel = typeLabel; + } } diff --git a/src/main/java/eu/dnetlib/dhp/schema/solr/RelatedRecord.java b/src/main/java/eu/dnetlib/dhp/schema/solr/RelatedRecord.java index 1b20777..d91d5ef 100644 --- a/src/main/java/eu/dnetlib/dhp/schema/solr/RelatedRecord.java +++ b/src/main/java/eu/dnetlib/dhp/schema/solr/RelatedRecord.java @@ -39,6 +39,7 @@ public class RelatedRecord implements Serializable { private String acronym; private CodeLabel contracttype; private Funding funding; + private String validationDate; public RelatedRecordHeader getHeader() { return header; @@ -215,4 +216,12 @@ public class RelatedRecord implements Serializable { public void setFunding(Funding funding) { this.funding = funding; } + + public String getValidationDate() { + return validationDate; + } + + public void setValidationDate(String validationDate) { + this.validationDate = validationDate; + } } diff --git a/src/main/java/eu/dnetlib/dhp/schema/solr/RelatedRecordHeader.java b/src/main/java/eu/dnetlib/dhp/schema/solr/RelatedRecordHeader.java index db89b6c..7d7d479 100644 --- a/src/main/java/eu/dnetlib/dhp/schema/solr/RelatedRecordHeader.java +++ b/src/main/java/eu/dnetlib/dhp/schema/solr/RelatedRecordHeader.java @@ -14,12 +14,15 @@ public class RelatedRecordHeader implements Serializable { private RecordType relatedRecordType; - public static RelatedRecordHeader newInstance(String relationType, String relationClass, String relatedIdentifier, RecordType relatedRecordType) { + private String relationProvenance; + + public static RelatedRecordHeader newInstance(String relationType, String relationClass, String relatedIdentifier, RecordType relatedRecordType, String relationProvenance) { RelatedRecordHeader header = new RelatedRecordHeader(); header.setRelationType(relationType); header.setRelationClass(relationClass); header.setRelatedIdentifier(relatedIdentifier); header.setRelatedRecordType(relatedRecordType); + header.setRelationProvenance(relationProvenance); return header; } @@ -54,4 +57,12 @@ public class RelatedRecordHeader implements Serializable { public void setRelatedRecordType(RecordType relatedRecordType) { this.relatedRecordType = relatedRecordType; } + + public String getRelationProvenance() { + return relationProvenance; + } + + public void setRelationProvenance(String relationProvenance) { + this.relationProvenance = relationProvenance; + } } diff --git a/src/main/java/eu/dnetlib/dhp/schema/solr/SolrRecordHeader.java b/src/main/java/eu/dnetlib/dhp/schema/solr/SolrRecordHeader.java index 04bde53..f15530b 100644 --- a/src/main/java/eu/dnetlib/dhp/schema/solr/SolrRecordHeader.java +++ b/src/main/java/eu/dnetlib/dhp/schema/solr/SolrRecordHeader.java @@ -7,6 +7,8 @@ public class SolrRecordHeader implements Serializable { private static final long serialVersionUID = -6052397109220149426L; + public enum Status { UNDER_CURATION } + /** * The OpenAIRE identifiers for this record */ @@ -19,13 +21,20 @@ public class SolrRecordHeader implements Serializable { private RecordType recordType; + private Status status = null; + private Boolean deletedbyinference; public static SolrRecordHeader newInstance(String id, List originalId, RecordType recordType, Boolean deletedbyinference) { + return newInstance(id, originalId, recordType, null, deletedbyinference); + } + + public static SolrRecordHeader newInstance(String id, List originalId, RecordType recordType, Status status, Boolean deletedbyinference) { SolrRecordHeader header = new SolrRecordHeader(); header.setId(id); header.setOriginalId(originalId); header.setRecordType(recordType); + header.setStatus(status); header.setDeletedbyinference(deletedbyinference); return header; } @@ -58,6 +67,14 @@ public class SolrRecordHeader implements Serializable { return deletedbyinference; } + public Status getStatus() { + return status; + } + + public void setStatus(Status status) { + this.status = status; + } + public void setDeletedbyinference(Boolean deletedbyinference) { this.deletedbyinference = deletedbyinference; } diff --git a/src/main/java/eu/dnetlib/dhp/schema/solr/Subject.java b/src/main/java/eu/dnetlib/dhp/schema/solr/Subject.java index 9f13c41..f7cbe06 100644 --- a/src/main/java/eu/dnetlib/dhp/schema/solr/Subject.java +++ b/src/main/java/eu/dnetlib/dhp/schema/solr/Subject.java @@ -8,12 +8,15 @@ public class Subject implements Serializable { private String value; - private String type; + private String typeCode; - public static Subject newInstance(String value, String type) { + private String typeLabel; + + public static Subject newInstance(String value, String typeCode, String typeLabel) { Subject s = new Subject(); s.setValue(value); - s.setType(type); + s.setTypeCode(typeCode); + s.setTypeLabel(typeLabel); return s; } @@ -25,11 +28,19 @@ public class Subject implements Serializable { this.value = value; } - public String getType() { - return type; + public String getTypeCode() { + return typeCode; } - public void setType(String type) { - this.type = type; + public void setTypeCode(String typeCode) { + this.typeCode = typeCode; + } + + public String getTypeLabel() { + return typeLabel; + } + + public void setTypeLabel(String typeLabel) { + this.typeLabel = typeLabel; } }