From 82720345f07441c28165fcb430dc4ed123d37849 Mon Sep 17 00:00:00 2001 From: "miriam.baglioni" Date: Thu, 18 Nov 2021 11:23:48 +0100 Subject: [PATCH] [Schema-Dump] changed the model to allow to change the description annotation w.r.t. the specific semantics of the field - pat 3 --- .../schema/dump/oaf/AlternateIdentifier.java | 40 +++++++++++ .../dhp/schema/dump/oaf/AuthorPid.java | 33 --------- .../schema/dump/oaf/AuthorPidSchemeValue.java | 39 +++++++++++ .../dnetlib/dhp/schema/dump/oaf/Instance.java | 69 ------------------- .../dnetlib/dhp/schema/dump/oaf/Measure.java | 44 ++++++++++++ .../dnetlib/dhp/schema/dump/oaf/Subject.java | 34 --------- .../schema/dump/oaf/SubjectSchemeValue.java | 39 +++++++++++ 7 files changed, 162 insertions(+), 136 deletions(-) create mode 100644 src/main/java/eu/dnetlib/dhp/schema/dump/oaf/AlternateIdentifier.java create mode 100644 src/main/java/eu/dnetlib/dhp/schema/dump/oaf/AuthorPidSchemeValue.java create mode 100644 src/main/java/eu/dnetlib/dhp/schema/dump/oaf/Measure.java create mode 100644 src/main/java/eu/dnetlib/dhp/schema/dump/oaf/SubjectSchemeValue.java diff --git a/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/AlternateIdentifier.java b/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/AlternateIdentifier.java new file mode 100644 index 0000000..ca15fe1 --- /dev/null +++ b/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/AlternateIdentifier.java @@ -0,0 +1,40 @@ +package eu.dnetlib.dhp.schema.dump.oaf; + +import com.github.imifou.jsonschema.module.addon.annotation.JsonSchema; + +import java.io.Serializable; + +public class AlternateIdentifier implements Serializable { + @JsonSchema(description="The scheme of the identifier. It can be a persistent identifier (i.e. doi). If it is present in the alternate identifiers " + + "it means it has not been forged by an authority for that pid. For example we collect metadata from an institutional repository that provides " + + "as identifier for the result also the doi") + private String scheme; + + @JsonSchema(description="The value expressed in the scheme") + private String value; + + public String getScheme() { + return scheme; + } + + public void setScheme(String scheme) { + this.scheme = scheme; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + public static AlternateIdentifier newInstance(String scheme, String value) { + AlternateIdentifier cf = new AlternateIdentifier(); + + cf.setScheme(scheme); + cf.setValue(value); + + return cf; + } +} diff --git a/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/AuthorPid.java b/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/AuthorPid.java index 2ad55c0..e77a078 100644 --- a/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/AuthorPid.java +++ b/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/AuthorPid.java @@ -52,36 +52,3 @@ public class AuthorPid implements Serializable { } -class AuthorPidSchemeValue implements Serializable{ - - @JsonSchema(description="The author's pid scheme. OpenAIRE currently supports 'ORCID'") - private String scheme; - - @JsonSchema(description="The author's pid value in that scheme (i.e. 0000-1111-2222-3333") - private String value; - - public String getScheme() { - return scheme; - } - - public void setScheme(String scheme) { - this.scheme = scheme; - } - - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } - - public static AuthorPidSchemeValue newInstance(String scheme, String value) { - AuthorPidSchemeValue cf = new AuthorPidSchemeValue(); - - cf.setScheme(scheme); - cf.setValue(value); - - return cf; - } -} diff --git a/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/AuthorPidSchemeValue.java b/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/AuthorPidSchemeValue.java new file mode 100644 index 0000000..d2db604 --- /dev/null +++ b/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/AuthorPidSchemeValue.java @@ -0,0 +1,39 @@ +package eu.dnetlib.dhp.schema.dump.oaf; + +import com.github.imifou.jsonschema.module.addon.annotation.JsonSchema; + +import java.io.Serializable; + +public class AuthorPidSchemeValue implements Serializable { + + @JsonSchema(description="The author's pid scheme. OpenAIRE currently supports 'ORCID'") + private String scheme; + + @JsonSchema(description="The author's pid value in that scheme (i.e. 0000-1111-2222-3333") + private String value; + + public String getScheme() { + return scheme; + } + + public void setScheme(String scheme) { + this.scheme = scheme; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + public static AuthorPidSchemeValue newInstance(String scheme, String value) { + AuthorPidSchemeValue cf = new AuthorPidSchemeValue(); + + cf.setScheme(scheme); + cf.setValue(value); + + return cf; + } +} diff --git a/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/Instance.java b/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/Instance.java index 0e634e0..b8b2fbc 100644 --- a/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/Instance.java +++ b/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/Instance.java @@ -140,74 +140,5 @@ public class Instance implements Serializable { } } -class Measure implements Serializable{ - @JsonSchema(description = "The measure (i.e. popularity)") - private String key; - @JsonSchema(description = "The value for that measure") - private String value; - public String getKey() { - return key; - } - - public void setKey(String key) { - this.key = key; - } - - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } - - public static Measure newInstance(String key, String value) { - Measure inst = new Measure(); - inst.key = key; - inst.value = value; - return inst; - } - - @JsonIgnore - public boolean isBlank() { - return StringUtils.isBlank(key) && StringUtils.isBlank(value); - } - -} - -class AlternateIdentifier implements Serializable{ - @JsonSchema(description="The scheme of the identifier. It can be a persistent identifier (i.e. doi). If it is present in the alternate identifiers " + - "it means it has not been forged by an authority for that pid. For example we collect metadata from an institutional repository that provides " + - "as identifier for the result also the doi") - private String scheme; - - @JsonSchema(description="The value expressed in the scheme") - private String value; - - public String getScheme() { - return scheme; - } - - public void setScheme(String scheme) { - this.scheme = scheme; - } - - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } - - public static AlternateIdentifier newInstance(String scheme, String value) { - AlternateIdentifier cf = new AlternateIdentifier(); - - cf.setScheme(scheme); - cf.setValue(value); - - return cf; - } -} diff --git a/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/Measure.java b/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/Measure.java new file mode 100644 index 0000000..ebfbf24 --- /dev/null +++ b/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/Measure.java @@ -0,0 +1,44 @@ +package eu.dnetlib.dhp.schema.dump.oaf; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.github.imifou.jsonschema.module.addon.annotation.JsonSchema; +import org.apache.commons.lang3.StringUtils; + +import java.io.Serializable; + +public class Measure implements Serializable { + @JsonSchema(description = "The measure (i.e. popularity)") + private String key; + + @JsonSchema(description = "The value for that measure") + private String value; + + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + public static Measure newInstance(String key, String value) { + Measure inst = new Measure(); + inst.key = key; + inst.value = value; + return inst; + } + + @JsonIgnore + public boolean isBlank() { + return StringUtils.isBlank(key) && StringUtils.isBlank(value); + } + +} \ No newline at end of file diff --git a/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/Subject.java b/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/Subject.java index 67a21fc..2edee2f 100644 --- a/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/Subject.java +++ b/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/Subject.java @@ -38,37 +38,3 @@ public class Subject implements Serializable { } } - -class SubjectSchemeValue implements Serializable{ - @JsonSchema(description="OpenAIRE subject classification scheme (https://api.openaire.eu/vocabularies/dnet:subject_classification_typologies).") - private String scheme; - - @JsonSchema(description="The value for the subject in the selected scheme. When the scheme is 'keyword', it means that the subject is free-text (i.e. not a term from a controlled vocabulary).") - private String value; - - public String getScheme() { - return scheme; - } - - public void setScheme(String scheme) { - this.scheme = scheme; - } - - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } - - public static SubjectSchemeValue newInstance(String scheme, String value) { - SubjectSchemeValue cf = new SubjectSchemeValue(); - - cf.setScheme(scheme); - cf.setValue(value); - - return cf; - } - -} diff --git a/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/SubjectSchemeValue.java b/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/SubjectSchemeValue.java new file mode 100644 index 0000000..58a6224 --- /dev/null +++ b/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/SubjectSchemeValue.java @@ -0,0 +1,39 @@ +package eu.dnetlib.dhp.schema.dump.oaf; + +import com.github.imifou.jsonschema.module.addon.annotation.JsonSchema; + +import java.io.Serializable; + +public class SubjectSchemeValue implements Serializable { + @JsonSchema(description="OpenAIRE subject classification scheme (https://api.openaire.eu/vocabularies/dnet:subject_classification_typologies).") + private String scheme; + + @JsonSchema(description="The value for the subject in the selected scheme. When the scheme is 'keyword', it means that the subject is free-text (i.e. not a term from a controlled vocabulary).") + private String value; + + public String getScheme() { + return scheme; + } + + public void setScheme(String scheme) { + this.scheme = scheme; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + public static SubjectSchemeValue newInstance(String scheme, String value) { + SubjectSchemeValue cf = new SubjectSchemeValue(); + + cf.setScheme(scheme); + cf.setValue(value); + + return cf; + } + +}