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>
<artifactId>dhp-schemas</artifactId>
<packaging>jar</packaging>
<version>2.10.30-SNAPSHOT</version>
<version>2.10.30-SCHOLEXPLORER-SNAPSHOT</version>
<licenses>

View File

@ -1,11 +1,13 @@
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 javax.validation.constraints.NotBlank;
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 {
@NotBlank
@ -94,4 +96,4 @@ public class LinkPublisher {
}
return o.toString().replace("\n", "\n ");
}
}
}

View File

@ -1,12 +1,13 @@
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.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 {
@JsonProperty("name")

View File

@ -1,10 +1,11 @@
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 com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
public class ScholixIdentifier {
@JsonProperty("identifier")

View File

@ -1,14 +1,15 @@
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.List;
import java.util.Objects;
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 {
@JsonProperty("identifiers")

View File

@ -1,15 +1,17 @@
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.List;
import java.util.Objects;
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 static ScholixProvider fromScholixEntityId(final ScholixEntityId provider) {

View File

@ -1,12 +1,14 @@
package eu.dnetlib.dhp.schema.sx.api.model.v1;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import static eu.dnetlib.dhp.schema.sx.api.model.v2.RelationshipType.relationMapping;
import javax.validation.constraints.NotBlank;
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 {

View File

@ -1,16 +1,18 @@
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.util.ArrayList;
import java.util.List;
import java.util.Objects;
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 {
@JsonProperty("linkProvider")

View File

@ -1,11 +1,13 @@
package eu.dnetlib.dhp.schema.sx.api.model.v2;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.Objects;
import javax.validation.constraints.NotBlank;
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.
@ -120,4 +122,4 @@ public class LinkProviderType {
}
return o.toString().replace("\n", "\n ");
}
}
}

View File

@ -1,14 +1,16 @@
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.util.ArrayList;
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
* /l2/links

View File

@ -1,14 +1,16 @@
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.stream.Collectors;
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.
*/

View File

@ -1,14 +1,16 @@
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.List;
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.
*/

View File

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

View File

@ -1,12 +1,13 @@
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.List;
import java.util.stream.Collectors;
import com.fasterxml.jackson.annotation.JsonProperty;
import eu.dnetlib.dhp.schema.sx.scholix.ScholixResource;
/**
* The type Scholix item type.
*/

View File

@ -1,14 +1,16 @@
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.List;
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.
*/
@ -83,4 +85,4 @@ public class ScholixLinkProviderType {
}
}
}

View File

@ -1,14 +1,16 @@
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.util.List;
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.
*/

View File

@ -1,15 +1,16 @@
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.List;
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.
*/
@ -184,7 +185,9 @@ public class ScholixItemType {
if (input == null)
return null;
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());
if (input.getIdentifier()!= null)

View File

@ -1,16 +1,18 @@
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 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.scholix.Scholix;
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.
*/

View File

@ -1,14 +1,14 @@
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.util.List;
import java.util.Objects;
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> {

View File

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

View File

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

View File

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

View File

@ -1,11 +1,12 @@
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.util.Objects;
import static eu.dnetlib.dhp.schema.sx.scholix.ScholixComparator.normalizeIdnetifier;
import org.apache.commons.lang3.StringUtils;
/**
* The type Scholix identifier.

View File

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

View File

@ -1,14 +1,14 @@
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.util.List;
import java.util.Objects;
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> {

View File

@ -1,12 +1,14 @@
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.List;
import java.util.stream.Collectors;
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 {