added api data model

This commit is contained in:
Sandro La Bruzzo 2022-06-13 10:15:30 +02:00
parent d899bacebb
commit d6b950dacd
26 changed files with 129 additions and 93 deletions

View File

@ -5,7 +5,7 @@
<groupId>eu.dnetlib.dhp</groupId> <groupId>eu.dnetlib.dhp</groupId>
<artifactId>dhp-schemas</artifactId> <artifactId>dhp-schemas</artifactId>
<packaging>jar</packaging> <packaging>jar</packaging>
<version>2.10.30-SNAPSHOT</version> <version>2.10.30-SCHOLEXPLORER-SNAPSHOT</version>
<licenses> <licenses>

View File

@ -1,11 +1,13 @@
package eu.dnetlib.dhp.schema.sx.api.model.v1; package eu.dnetlib.dhp.schema.sx.api.model.v1;
import com.fasterxml.jackson.annotation.JsonProperty; import java.util.Objects;
import io.swagger.v3.oas.annotations.media.Schema;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size; import javax.validation.constraints.Size;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
public class LinkPublisher { public class LinkPublisher {
@NotBlank @NotBlank

View File

@ -1,12 +1,13 @@
package eu.dnetlib.dhp.schema.sx.api.model.v1; package eu.dnetlib.dhp.schema.sx.api.model.v1;
import com.fasterxml.jackson.annotation.JsonProperty;
import eu.dnetlib.dhp.schema.sx.scholix.ScholixEntityId;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.fasterxml.jackson.annotation.JsonProperty;
import eu.dnetlib.dhp.schema.sx.scholix.ScholixEntityId;
import io.swagger.v3.oas.annotations.media.Schema;
public class ScholixCreator { public class ScholixCreator {
@JsonProperty("name") @JsonProperty("name")

View File

@ -1,10 +1,11 @@
package eu.dnetlib.dhp.schema.sx.api.model.v1; package eu.dnetlib.dhp.schema.sx.api.model.v1;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.Objects; import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
public class ScholixIdentifier { public class ScholixIdentifier {
@JsonProperty("identifier") @JsonProperty("identifier")

View File

@ -1,14 +1,15 @@
package eu.dnetlib.dhp.schema.sx.api.model.v1; package eu.dnetlib.dhp.schema.sx.api.model.v1;
import com.fasterxml.jackson.annotation.JsonProperty;
import eu.dnetlib.dhp.schema.sx.scholix.ScholixResource;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.fasterxml.jackson.annotation.JsonProperty;
import eu.dnetlib.dhp.schema.sx.scholix.ScholixResource;
import io.swagger.v3.oas.annotations.media.Schema;
public class ScholixItem { public class ScholixItem {
@JsonProperty("identifiers") @JsonProperty("identifiers")

View File

@ -1,15 +1,17 @@
package eu.dnetlib.dhp.schema.sx.api.model.v1; package eu.dnetlib.dhp.schema.sx.api.model.v1;
import com.fasterxml.jackson.annotation.JsonProperty;
import eu.dnetlib.dhp.schema.sx.scholix.ScholixEntityId;
import io.swagger.v3.oas.annotations.media.Schema;
import javax.validation.Valid;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import javax.validation.Valid;
import com.fasterxml.jackson.annotation.JsonProperty;
import eu.dnetlib.dhp.schema.sx.scholix.ScholixEntityId;
import io.swagger.v3.oas.annotations.media.Schema;
public class ScholixProvider { public class ScholixProvider {
public static ScholixProvider fromScholixEntityId(final ScholixEntityId provider) { public static ScholixProvider fromScholixEntityId(final ScholixEntityId provider) {

View File

@ -1,12 +1,14 @@
package eu.dnetlib.dhp.schema.sx.api.model.v1; package eu.dnetlib.dhp.schema.sx.api.model.v1;
import com.fasterxml.jackson.annotation.JsonProperty; import static eu.dnetlib.dhp.schema.sx.api.model.v2.RelationshipType.relationMapping;
import io.swagger.v3.oas.annotations.media.Schema;
import javax.validation.constraints.NotBlank;
import java.util.Objects; import java.util.Objects;
import static eu.dnetlib.dhp.schema.sx.api.model.v2.RelationshipType.relationMapping; import javax.validation.constraints.NotBlank;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
public class ScholixRelationship { public class ScholixRelationship {

View File

@ -1,16 +1,18 @@
package eu.dnetlib.dhp.schema.sx.api.model.v1; package eu.dnetlib.dhp.schema.sx.api.model.v1;
import com.fasterxml.jackson.annotation.JsonProperty;
import eu.dnetlib.dhp.schema.sx.scholix.Scholix;
import io.swagger.v3.oas.annotations.media.Schema;
import javax.validation.constraints.NotBlank;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import javax.validation.constraints.NotBlank;
import com.fasterxml.jackson.annotation.JsonProperty;
import eu.dnetlib.dhp.schema.sx.scholix.Scholix;
import io.swagger.v3.oas.annotations.media.Schema;
public class ScholixV1 implements Serializable { public class ScholixV1 implements Serializable {
@JsonProperty("linkProvider") @JsonProperty("linkProvider")

View File

@ -1,11 +1,13 @@
package eu.dnetlib.dhp.schema.sx.api.model.v2; package eu.dnetlib.dhp.schema.sx.api.model.v2;
import com.fasterxml.jackson.annotation.JsonProperty; import java.util.Objects;
import io.swagger.v3.oas.annotations.media.Schema;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size; import javax.validation.constraints.Size;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
/** /**
* The type Link provider type. * The type Link provider type.

View File

@ -1,14 +1,16 @@
package eu.dnetlib.dhp.schema.sx.api.model.v2; package eu.dnetlib.dhp.schema.sx.api.model.v2;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import javax.validation.constraints.NotBlank;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import javax.validation.constraints.NotBlank;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
/** /**
* The main class that show the page result from the method * The main class that show the page result from the method
* /l2/links * /l2/links

View File

@ -1,14 +1,16 @@
package eu.dnetlib.dhp.schema.sx.api.model.v2; package eu.dnetlib.dhp.schema.sx.api.model.v2;
import com.fasterxml.jackson.annotation.JsonProperty;
import eu.dnetlib.dhp.schema.sx.scholix.ScholixRelationship;
import io.swagger.v3.oas.annotations.media.Schema;
import javax.validation.constraints.NotNull;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
import javax.validation.constraints.NotNull;
import com.fasterxml.jackson.annotation.JsonProperty;
import eu.dnetlib.dhp.schema.sx.scholix.ScholixRelationship;
import io.swagger.v3.oas.annotations.media.Schema;
/** /**
* The type Relationship type. * The type Relationship type.
*/ */

View File

@ -1,14 +1,16 @@
package eu.dnetlib.dhp.schema.sx.api.model.v2; package eu.dnetlib.dhp.schema.sx.api.model.v2;
import com.fasterxml.jackson.annotation.JsonProperty;
import eu.dnetlib.dhp.schema.sx.scholix.ScholixEntityId;
import io.swagger.v3.oas.annotations.media.Schema;
import javax.validation.constraints.NotBlank;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import javax.validation.constraints.NotBlank;
import com.fasterxml.jackson.annotation.JsonProperty;
import eu.dnetlib.dhp.schema.sx.scholix.ScholixEntityId;
import io.swagger.v3.oas.annotations.media.Schema;
/** /**
* The type Scholix creator type. * The type Scholix creator type.
*/ */

View File

@ -1,11 +1,12 @@
package eu.dnetlib.dhp.schema.sx.api.model.v2; package eu.dnetlib.dhp.schema.sx.api.model.v2;
import javax.validation.constraints.NotBlank;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import eu.dnetlib.dhp.schema.sx.scholix.ScholixIdentifier; import eu.dnetlib.dhp.schema.sx.scholix.ScholixIdentifier;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import javax.validation.constraints.NotBlank;
/** /**
* The type Scholix identifier type. * The type Scholix identifier type.
*/ */

View File

@ -1,12 +1,13 @@
package eu.dnetlib.dhp.schema.sx.api.model.v2; package eu.dnetlib.dhp.schema.sx.api.model.v2;
import com.fasterxml.jackson.annotation.JsonProperty;
import eu.dnetlib.dhp.schema.sx.scholix.ScholixResource;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.fasterxml.jackson.annotation.JsonProperty;
import eu.dnetlib.dhp.schema.sx.scholix.ScholixResource;
/** /**
* The type Scholix item type. * The type Scholix item type.
*/ */

View File

@ -1,14 +1,16 @@
package eu.dnetlib.dhp.schema.sx.api.model.v2; package eu.dnetlib.dhp.schema.sx.api.model.v2;
import com.fasterxml.jackson.annotation.JsonProperty;
import eu.dnetlib.dhp.schema.sx.scholix.ScholixEntityId;
import io.swagger.v3.oas.annotations.media.Schema;
import javax.validation.constraints.NotBlank;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import javax.validation.constraints.NotBlank;
import com.fasterxml.jackson.annotation.JsonProperty;
import eu.dnetlib.dhp.schema.sx.scholix.ScholixEntityId;
import io.swagger.v3.oas.annotations.media.Schema;
/** /**
* The type Scholix link provider type. * The type Scholix link provider type.
*/ */

View File

@ -1,14 +1,16 @@
package eu.dnetlib.dhp.schema.sx.api.model.v2; package eu.dnetlib.dhp.schema.sx.api.model.v2;
import com.fasterxml.jackson.annotation.JsonProperty;
import eu.dnetlib.dhp.schema.sx.scholix.Scholix;
import io.swagger.v3.oas.annotations.media.Schema;
import javax.validation.constraints.NotBlank;
import java.io.Serializable; import java.io.Serializable;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import javax.validation.constraints.NotBlank;
import com.fasterxml.jackson.annotation.JsonProperty;
import eu.dnetlib.dhp.schema.sx.scholix.Scholix;
import io.swagger.v3.oas.annotations.media.Schema;
/** /**
* The type Scholix type. * The type Scholix type.
*/ */

View File

@ -1,15 +1,16 @@
package eu.dnetlib.dhp.schema.sx.api.model.v3; package eu.dnetlib.dhp.schema.sx.api.model.v3;
import com.fasterxml.jackson.annotation.JsonProperty;
import eu.dnetlib.dhp.schema.sx.api.model.v2.ScholixCreatorType;
import eu.dnetlib.dhp.schema.sx.api.model.v2.ScholixIdentifierType;
import eu.dnetlib.dhp.schema.sx.api.model.v2.ScholixLinkProviderType;
import eu.dnetlib.dhp.schema.sx.scholix.ScholixResource;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.fasterxml.jackson.annotation.JsonProperty;
import eu.dnetlib.dhp.schema.sx.api.model.v2.ScholixCreatorType;
import eu.dnetlib.dhp.schema.sx.api.model.v2.ScholixIdentifierType;
import eu.dnetlib.dhp.schema.sx.api.model.v2.ScholixLinkProviderType;
import eu.dnetlib.dhp.schema.sx.scholix.ScholixResource;
/** /**
* The type Scholix item type. * The type Scholix item type.
*/ */
@ -184,7 +185,9 @@ public class ScholixItemType {
if (input == null) if (input == null)
return null; return null;
final ScholixItemType instance = new ScholixItemType(); final ScholixItemType instance = new ScholixItemType();
instance.setType("publication".equalsIgnoreCase(input.getObjectType())?"literature": "dataset"); instance.setType(input.getObjectType());
instance.setSubType(input.getObjectSubType());
// instance.setType("publication".equalsIgnoreCase(input.getObjectType())?"literature": "dataset");
instance.setTitle(input.getTitle()); instance.setTitle(input.getTitle());
if (input.getIdentifier()!= null) if (input.getIdentifier()!= null)

View File

@ -1,16 +1,18 @@
package eu.dnetlib.dhp.schema.sx.api.model.v3; package eu.dnetlib.dhp.schema.sx.api.model.v3;
import java.io.Serializable;
import java.util.List;
import java.util.stream.Collectors;
import javax.validation.constraints.NotBlank;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import eu.dnetlib.dhp.schema.sx.api.model.v2.RelationshipType; import eu.dnetlib.dhp.schema.sx.api.model.v2.RelationshipType;
import eu.dnetlib.dhp.schema.sx.api.model.v2.ScholixLinkProviderType; import eu.dnetlib.dhp.schema.sx.api.model.v2.ScholixLinkProviderType;
import eu.dnetlib.dhp.schema.sx.scholix.Scholix; import eu.dnetlib.dhp.schema.sx.scholix.Scholix;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.List;
import java.util.stream.Collectors;
/** /**
* The type Scholix type. * The type Scholix type.
*/ */

View File

@ -1,14 +1,14 @@
package eu.dnetlib.dhp.schema.sx.scholix; package eu.dnetlib.dhp.schema.sx.scholix;
import org.apache.commons.lang3.StringUtils; import static eu.dnetlib.dhp.schema.sx.scholix.ScholixComparator.*;
import java.io.Serializable; import java.io.Serializable;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static eu.dnetlib.dhp.schema.sx.scholix.ScholixComparator.*; import org.apache.commons.lang3.StringUtils;
public class Scholix implements Serializable, Comparable<Scholix> { public class Scholix implements Serializable, Comparable<Scholix> {

View File

@ -1,12 +1,12 @@
package eu.dnetlib.dhp.schema.sx.scholix; package eu.dnetlib.dhp.schema.sx.scholix;
import org.apache.commons.lang3.StringUtils; import static eu.dnetlib.dhp.schema.sx.scholix.ScholixComparator.*;
import java.io.Serializable; import java.io.Serializable;
import java.util.Objects; import java.util.Objects;
import static eu.dnetlib.dhp.schema.sx.scholix.ScholixComparator.*; import org.apache.commons.lang3.StringUtils;
public class ScholixCollectedFrom implements Serializable, Comparable<ScholixCollectedFrom> { public class ScholixCollectedFrom implements Serializable, Comparable<ScholixCollectedFrom> {

View File

@ -5,6 +5,7 @@ import java.util.List;
import java.util.stream.Stream; import java.util.stream.Stream;
import com.google.common.collect.Iterators; import com.google.common.collect.Iterators;
import me.xuender.unidecode.Unidecode; import me.xuender.unidecode.Unidecode;
public class ScholixComparator { public class ScholixComparator {

View File

@ -1,8 +1,7 @@
package eu.dnetlib.dhp.schema.sx.scholix; package eu.dnetlib.dhp.schema.sx.scholix;
import com.google.common.collect.Iterators; import static eu.dnetlib.dhp.schema.sx.scholix.ScholixComparator.normalizeString;
import org.apache.commons.lang3.StringUtils;
import java.io.Serializable; import java.io.Serializable;
import java.util.List; import java.util.List;
@ -10,7 +9,9 @@ import java.util.Objects;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
import static eu.dnetlib.dhp.schema.sx.scholix.ScholixComparator.normalizeString; import org.apache.commons.lang3.StringUtils;
import com.google.common.collect.Iterators;
public class ScholixEntityId implements Serializable, Comparable<ScholixEntityId> { public class ScholixEntityId implements Serializable, Comparable<ScholixEntityId> {
private String name; private String name;

View File

@ -1,11 +1,12 @@
package eu.dnetlib.dhp.schema.sx.scholix; package eu.dnetlib.dhp.schema.sx.scholix;
import org.apache.commons.lang3.StringUtils; import static eu.dnetlib.dhp.schema.sx.scholix.ScholixComparator.normalizeIdnetifier;
import java.io.Serializable; import java.io.Serializable;
import java.util.Objects; import java.util.Objects;
import static eu.dnetlib.dhp.schema.sx.scholix.ScholixComparator.normalizeIdnetifier; import org.apache.commons.lang3.StringUtils;
/** /**
* The type Scholix identifier. * The type Scholix identifier.

View File

@ -1,11 +1,12 @@
package eu.dnetlib.dhp.schema.sx.scholix; package eu.dnetlib.dhp.schema.sx.scholix;
import org.apache.commons.lang3.StringUtils; import static eu.dnetlib.dhp.schema.sx.scholix.ScholixComparator.*;
import java.io.Serializable; import java.io.Serializable;
import java.util.Objects; import java.util.Objects;
import static eu.dnetlib.dhp.schema.sx.scholix.ScholixComparator.*;
import org.apache.commons.lang3.StringUtils;
public class ScholixRelationship implements Serializable, Comparable<ScholixRelationship> { public class ScholixRelationship implements Serializable, Comparable<ScholixRelationship> {
private String name; private String name;

View File

@ -1,14 +1,14 @@
package eu.dnetlib.dhp.schema.sx.scholix; package eu.dnetlib.dhp.schema.sx.scholix;
import org.apache.commons.lang3.StringUtils; import static eu.dnetlib.dhp.schema.sx.scholix.ScholixComparator.*;
import java.io.Serializable; import java.io.Serializable;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static eu.dnetlib.dhp.schema.sx.scholix.ScholixComparator.*; import org.apache.commons.lang3.StringUtils;
public class ScholixResource implements Serializable, Comparable<ScholixResource> { public class ScholixResource implements Serializable, Comparable<ScholixResource> {

View File

@ -1,12 +1,14 @@
package eu.dnetlib.dhp.schema.sx.scholix; package eu.dnetlib.dhp.schema.sx.scholix;
import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.IntStream; import java.util.stream.IntStream;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotEquals; import org.junit.jupiter.api.Test;
public class ScholixCompareTest { public class ScholixCompareTest {