Oaf validation #10
27
pom.xml
27
pom.xml
|
@ -315,6 +315,24 @@
|
|||
<version>2.4</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.validation</groupId>
|
||||
<artifactId>validation-api</artifactId>
|
||||
<version>2.0.1.Final</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.victools</groupId>
|
||||
<artifactId>jsonschema-generator</artifactId>
|
||||
<version>${jsonschemagenerator.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.imifou</groupId>
|
||||
<artifactId>jsonschema-module-addon</artifactId>
|
||||
<version>1.2.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
|
@ -389,16 +407,19 @@
|
|||
<groupId>javax.persistence</groupId>
|
||||
<artifactId>javax.persistence-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.validation</groupId>
|
||||
<artifactId>validation-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.victools</groupId>
|
||||
<artifactId>jsonschema-generator</artifactId>
|
||||
<version>${jsonschemagenerator.version}</version>
|
||||
<!-- <scope>test</scope>-->
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.imifou</groupId>
|
||||
<artifactId>jsonschema-module-addon</artifactId>
|
||||
<version>1.2.1</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
|
|
@ -3,11 +3,14 @@ package eu.dnetlib.dhp.schema.oaf;
|
|||
|
||||
import java.util.Optional;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* This class models the access rights of research products.
|
||||
*/
|
||||
public class AccessRight extends Qualifier {
|
||||
|
||||
@NotNull
|
||||
private OpenAccessRoute openAccessRoute;
|
||||
|
||||
public OpenAccessRoute getOpenAccessRoute() {
|
||||
|
|
|
@ -4,8 +4,13 @@ package eu.dnetlib.dhp.schema.oaf;
|
|||
import java.io.Serializable;
|
||||
import java.util.*;
|
||||
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
public class Author implements Serializable {
|
||||
|
||||
@NotBlank
|
||||
private String fullname;
|
||||
|
||||
private String name;
|
||||
|
@ -13,6 +18,8 @@ public class Author implements Serializable {
|
|||
private String surname;
|
||||
|
||||
// START WITH 1
|
||||
@NotNull
|
||||
@Min(1)
|
||||
private Integer rank;
|
||||
|
||||
private List<StructuredProperty> pid;
|
||||
|
|
|
@ -4,9 +4,15 @@ package eu.dnetlib.dhp.schema.oaf;
|
|||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
public class Context implements Serializable {
|
||||
|
||||
@NotBlank
|
||||
private String id;
|
||||
|
||||
@NotNull
|
||||
private List<DataInfo> dataInfo;
|
||||
|
||||
public String getId() {
|
||||
|
|
|
@ -4,13 +4,24 @@ package eu.dnetlib.dhp.schema.oaf;
|
|||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
public class DataInfo implements Serializable {
|
||||
|
||||
@NotNull
|
||||
private Boolean invisible = false;
|
||||
|
||||
@NotNull
|
||||
private Boolean inferred;
|
||||
|
||||
@NotNull
|
||||
private Boolean deletedbyinference = false;
|
||||
private String trust;
|
||||
|
||||
private String inferenceprovenance;
|
||||
|
||||
@NotNull
|
||||
private Qualifier provenanceaction;
|
||||
|
||||
public Boolean getInvisible() {
|
||||
|
|
|
@ -4,8 +4,11 @@ package eu.dnetlib.dhp.schema.oaf;
|
|||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
public class Field<T> implements Serializable {
|
||||
|
||||
@NotBlank
|
||||
private T value;
|
||||
|
||||
private DataInfo dataInfo;
|
||||
|
|
|
@ -4,21 +4,30 @@ package eu.dnetlib.dhp.schema.oaf;
|
|||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
public class Instance implements Serializable {
|
||||
|
||||
private Field<String> license;
|
||||
|
||||
@NotNull
|
||||
private AccessRight accessright;
|
||||
|
||||
@NotNull
|
||||
private Qualifier instancetype;
|
||||
|
||||
@NotNull
|
||||
private KeyValue hostedby;
|
||||
|
||||
@NotEmpty
|
||||
private List<String> url;
|
||||
|
||||
// other research products specifc
|
||||
private String distributionlocation;
|
||||
|
||||
@NotNull
|
||||
private KeyValue collectedfrom;
|
||||
|
||||
private List<StructuredProperty> pid;
|
||||
|
@ -35,6 +44,7 @@ public class Instance implements Serializable {
|
|||
// typed results
|
||||
private Field<String> processingchargecurrency;
|
||||
|
||||
@NotNull
|
||||
private Qualifier refereed; // peer-review status
|
||||
|
||||
private List<Measure> measures;
|
||||
|
|
|
@ -3,14 +3,19 @@ package eu.dnetlib.dhp.schema.oaf;
|
|||
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
|
||||
public class KeyValue implements Serializable {
|
||||
|
||||
@NotBlank
|
||||
private String key;
|
||||
|
||||
@NotBlank
|
||||
private String value;
|
||||
|
||||
private DataInfo dataInfo;
|
||||
|
|
|
@ -9,13 +9,21 @@ import java.util.Optional;
|
|||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
public abstract class Oaf implements Serializable {
|
||||
|
||||
/**
|
||||
* The list of datasource id/name pairs providing this relationship.
|
||||
*/
|
||||
@Valid
|
||||
@NotEmpty
|
||||
protected List<KeyValue> collectedfrom;
|
||||
|
||||
@Valid
|
||||
@NotNull
|
||||
private DataInfo dataInfo;
|
||||
|
||||
private Long lastupdatetimestamp;
|
||||
|
|
|
@ -5,14 +5,18 @@ import java.io.Serializable;
|
|||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
public abstract class OafEntity extends Oaf implements Serializable {
|
||||
|
||||
@NotBlank
|
||||
private String id;
|
||||
|
||||
private List<String> originalId;
|
||||
|
||||
private List<StructuredProperty> pid;
|
||||
|
||||
@NotBlank
|
||||
private String dateofcollection;
|
||||
|
||||
private String dateoftransformation;
|
||||
|
|
|
@ -3,15 +3,24 @@ package eu.dnetlib.dhp.schema.oaf;
|
|||
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
|
||||
public class Qualifier implements Serializable {
|
||||
|
||||
@NotBlank
|
||||
private String classid;
|
||||
|
||||
@NotBlank
|
||||
private String classname;
|
||||
|
||||
@NotBlank
|
||||
private String schemeid;
|
||||
|
||||
@NotBlank
|
||||
private String schemename;
|
||||
|
||||
public String getClassid() {
|
||||
|
|
|
@ -8,6 +8,8 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
import eu.dnetlib.dhp.schema.common.ModelSupport;
|
||||
|
||||
/**
|
||||
|
@ -21,27 +23,32 @@ public class Relation extends Oaf {
|
|||
/**
|
||||
* Main relationship classifier, values include 'resultResult', 'resultProject', 'resultOrganization', etc.
|
||||
*/
|
||||
@NotBlank
|
||||
private String relType;
|
||||
|
||||
/**
|
||||
* Further classifies a relationship, values include 'affiliation', 'similarity', 'supplement', etc.
|
||||
*/
|
||||
@NotBlank
|
||||
private String subRelType;
|
||||
|
||||
/**
|
||||
* Indicates the direction of the relationship, values include 'isSupplementTo', 'isSupplementedBy', 'merges,
|
||||
* 'isMergedIn'.
|
||||
*/
|
||||
@NotBlank
|
||||
private String relClass;
|
||||
|
||||
/**
|
||||
* The source entity id.
|
||||
*/
|
||||
@NotBlank
|
||||
private String source;
|
||||
|
||||
/**
|
||||
* The target entity id.
|
||||
*/
|
||||
@NotBlank
|
||||
private String target;
|
||||
|
||||
/**
|
||||
|
|
|
@ -5,6 +5,10 @@ import java.io.Serializable;
|
|||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
import org.apache.commons.lang3.tuple.ImmutablePair;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
|
@ -28,15 +32,15 @@ public class Result extends OafEntity implements Serializable {
|
|||
private List<Author> author;
|
||||
|
||||
/**
|
||||
* The Resulttype.
|
||||
* The Resulttype, allows subclassing results into publications | datasets | software
|
||||
*/
|
||||
// resulttype allows subclassing results into publications | datasets | software
|
||||
@Valid
|
||||
@NotNull
|
||||
private Qualifier resulttype;
|
||||
|
||||
/**
|
||||
* The Language.
|
||||
*/
|
||||
// common fields
|
||||
private Qualifier language;
|
||||
|
||||
/**
|
||||
|
@ -112,6 +116,8 @@ public class Result extends OafEntity implements Serializable {
|
|||
/**
|
||||
* The Bestaccessright.
|
||||
*/
|
||||
@Valid
|
||||
@NotNull
|
||||
private Qualifier bestaccessright;
|
||||
|
||||
/**
|
||||
|
@ -127,6 +133,8 @@ public class Result extends OafEntity implements Serializable {
|
|||
/**
|
||||
* The Instance.
|
||||
*/
|
||||
@Valid
|
||||
@NotEmpty
|
||||
private List<Instance> instance;
|
||||
|
||||
/**
|
||||
|
|
|
@ -6,12 +6,17 @@ import java.util.Optional;
|
|||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
public class StructuredProperty implements Serializable {
|
||||
|
||||
@NotBlank
|
||||
private String value;
|
||||
|
||||
@NotNull
|
||||
private Qualifier qualifier;
|
||||
|
||||
private DataInfo dataInfo;
|
||||
|
|
Loading…
Reference in New Issue