[Schema-Dump] changed the model to allow to change the description annotation w.r.t. the specific semantics of the field - pat 3

This commit is contained in:
Miriam Baglioni 2021-11-18 11:23:48 +01:00
parent fd0f1d5068
commit 82720345f0
7 changed files with 162 additions and 136 deletions

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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);
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}