diff --git a/apps/pom.xml b/apps/pom.xml index 3b388dd8..5b589921 100644 --- a/apps/pom.xml +++ b/apps/pom.xml @@ -16,6 +16,7 @@ dhp-broker-public-application dhp-mdstore-manager dnet-orgs-database-application + scholexplorer-api diff --git a/apps/scholexplorer-api/pom.xml b/apps/scholexplorer-api/pom.xml new file mode 100644 index 00000000..93fc45b7 --- /dev/null +++ b/apps/scholexplorer-api/pom.xml @@ -0,0 +1,45 @@ + + + + eu.dnetlib.dhp + apps + 3.2.3-SNAPSHOT + ../pom.xml + + + 4.0.0 + jar + scholexplorer-api + + + + io.springfox + springfox-bean-validators + + + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + + + + org.apache.maven.plugins + maven-help-plugin + + + org.springframework.boot + spring-boot-maven-plugin + + + + + \ No newline at end of file diff --git a/apps/scholexplorer-api/src/main/java/eu/dnetlib/scholix/api/MainApplication.java b/apps/scholexplorer-api/src/main/java/eu/dnetlib/scholix/api/MainApplication.java new file mode 100644 index 00000000..b7761633 --- /dev/null +++ b/apps/scholexplorer-api/src/main/java/eu/dnetlib/scholix/api/MainApplication.java @@ -0,0 +1,89 @@ +package eu.dnetlib.scholix.api; + +import eu.dnetlib.common.app.AbstractDnetApp; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.domain.EntityScan; +import org.springframework.cache.annotation.EnableCaching; +import org.springframework.context.annotation.Bean; +import org.springframework.scheduling.annotation.EnableScheduling; +import springfox.documentation.builders.ApiInfoBuilder; +import springfox.documentation.builders.RequestHandlerSelectors; +import springfox.documentation.service.ApiInfo; +import springfox.documentation.spi.DocumentationType; +import springfox.documentation.spring.web.plugins.Docket; +import springfox.documentation.swagger2.annotations.EnableSwagger2; + +@SpringBootApplication +@EnableSwagger2 +@EnableCaching +@EnableScheduling +//@EntityScan("eu.dnetlib.scholix.api.controller") +public class MainApplication extends AbstractDnetApp { + + @Value("${dhp.swagger.api.host}") + private String swaggetHost; + + @Value("${dhp.swagger.api.basePath}") + private String swaggerPath; + + final String descriptionAPI = "

\"ScholeXplorer\"

" + + "The Scholix Swagger API allows clients to run REST queries over the Scholexplorer index in order to fetch links matching given criteria. In the current version, clients can search for:" + + ""; + + public static void main(final String[] args) { + SpringApplication.run(MainApplication.class, args); + } + + @Override + protected void configSwagger(final Docket docket) { + docket + .host(swaggetHost) + .pathMapping(swaggerPath) + .groupName("Scholexplorer V1") + .select() + .apis(RequestHandlerSelectors.any()) + .paths(p -> p.startsWith("/v1")) + .build() + .apiInfo(new ApiInfoBuilder() + .title("Scholexplorer API V1.0") + .description(descriptionAPI) + .version("1.0") + .contact(ApiInfo.DEFAULT_CONTACT) + .license("Apache 2.0") + .licenseUrl("http://www.apache.org/licenses/LICENSE-2.0") + .build()); + } + + + + @Bean (name = "SpringDOcketv2") + public Docket v2Docket() { + + + final Docket docket = new Docket(DocumentationType.SWAGGER_2); + + docket + .host(swaggetHost) + .pathMapping(swaggerPath) + .groupName("Scholexplorer V2") + .select() + .apis(RequestHandlerSelectors.any()) + .paths(p -> p.startsWith("/v2")) + .build() + .apiInfo(new ApiInfoBuilder() + .title("Scholexplorer API V2.0") + .description(descriptionAPI) + .version("2.0") + .contact(ApiInfo.DEFAULT_CONTACT) + .license("Apache 2.0") + .licenseUrl("http://www.apache.org/licenses/LICENSE-2.0") + .build()); + + return docket; + } + +} diff --git a/apps/scholexplorer-api/src/main/java/eu/dnetlib/scholix/api/controller/DatasourceV1.java b/apps/scholexplorer-api/src/main/java/eu/dnetlib/scholix/api/controller/DatasourceV1.java new file mode 100644 index 00000000..007a6caf --- /dev/null +++ b/apps/scholexplorer-api/src/main/java/eu/dnetlib/scholix/api/controller/DatasourceV1.java @@ -0,0 +1,33 @@ +package eu.dnetlib.scholix.api.controller; + +import eu.dnetlib.common.controller.AbstractDnetController; +import eu.dnetlib.scholix.api.model.v1.LinkPublisher; +import io.swagger.annotations.Api; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.Arrays; +import java.util.List; + + +@RestController +@RequestMapping("/v1") +@Api(tags = { + "Datasources" +}) +public class DatasourceV1 extends AbstractDnetController { + + @Operation( + summary = "Get all Datasources", + description = "returns a list of all datasources") + @GetMapping("/v1/listDatasources") + public List getDatasources() { + return Arrays.asList( + new LinkPublisher().name("pippo").totalRelationships(30), + new LinkPublisher().name("pluto").totalRelationships(30), + new LinkPublisher().name("peppa").totalRelationships(30) + ); + } +} diff --git a/apps/scholexplorer-api/src/main/java/eu/dnetlib/scholix/api/controller/LinkProviderV2.java b/apps/scholexplorer-api/src/main/java/eu/dnetlib/scholix/api/controller/LinkProviderV2.java new file mode 100644 index 00000000..3aa1514f --- /dev/null +++ b/apps/scholexplorer-api/src/main/java/eu/dnetlib/scholix/api/controller/LinkProviderV2.java @@ -0,0 +1,35 @@ +package eu.dnetlib.scholix.api.controller; +import eu.dnetlib.scholix.api.model.v2.LinkProviderType; +import io.swagger.annotations.Api; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.enums.ParameterIn; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.util.Arrays; +import java.util.List; + +@RestController +@RequestMapping("/v2") +@Api(tags = { + "LinkProvider : Operation related to the Link Provider" +}) +public class LinkProviderV2 { + + @Operation( + summary = "Get all Link Providers", + description = "Return a list of link provider and relative number of relations") + @GetMapping("/LinkProvider") + public List getLinkProviders( + @Parameter(in = ParameterIn.QUERY, description = "Filter the link provider name") @RequestParam(required = false) String name + ) { + return Arrays.asList( + new LinkProviderType().name("pippo").totalRelationships(30), + new LinkProviderType().name("pluto").totalRelationships(30), + new LinkProviderType().name("peppa").totalRelationships(30) + ); + } +} diff --git a/apps/scholexplorer-api/src/main/java/eu/dnetlib/scholix/api/controller/LinkPublisherV2.java b/apps/scholexplorer-api/src/main/java/eu/dnetlib/scholix/api/controller/LinkPublisherV2.java new file mode 100644 index 00000000..41883343 --- /dev/null +++ b/apps/scholexplorer-api/src/main/java/eu/dnetlib/scholix/api/controller/LinkPublisherV2.java @@ -0,0 +1,51 @@ +package eu.dnetlib.scholix.api.controller; +import eu.dnetlib.scholix.api.model.v2.LinkProviderType; +import io.swagger.annotations.Api; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.enums.ParameterIn; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.util.Arrays; +import java.util.List; + +@RestController +@RequestMapping("/v2/LinkPublisher") +@Api(tags = { + "LinkPublisher : Operation related to the Link Publisher" +}) +public class LinkPublisherV2 { + + @Operation( + summary = "Get All Publishers that provide source object", + description = "Return a List of all Publishers that provide source objects in Scholix " + + "links and the total number of links where the source object comes from this publisher") + @GetMapping("/inSource") + public List getInSource( + @Parameter(in = ParameterIn.QUERY, description = "Filter the link publisher name") @RequestParam(required = false) String name + ) { + return Arrays.asList( + new LinkProviderType().name("pippo").totalRelationships(30), + new LinkProviderType().name("pluto").totalRelationships(30), + new LinkProviderType().name("peppa").totalRelationships(30) + ); + } + + @Operation( + summary = "Get All Publishers that provide target object", + description = "Return a List of all Publishers that provide source objects in Scholix " + + "links and the total number of links where the target object comes from this publisher") + @GetMapping("/inTarget") + public List getInTarget( + @Parameter(in = ParameterIn.QUERY, description = "Filter the link publisher name") @RequestParam(required = false) String name + ) { + return Arrays.asList( + new LinkProviderType().name("pippo").totalRelationships(30), + new LinkProviderType().name("pluto").totalRelationships(30), + new LinkProviderType().name("peppa").totalRelationships(30) + ); + } +} diff --git a/apps/scholexplorer-api/src/main/java/eu/dnetlib/scholix/api/controller/ScholixControllerV1.java b/apps/scholexplorer-api/src/main/java/eu/dnetlib/scholix/api/controller/ScholixControllerV1.java new file mode 100644 index 00000000..b63d7c2f --- /dev/null +++ b/apps/scholexplorer-api/src/main/java/eu/dnetlib/scholix/api/controller/ScholixControllerV1.java @@ -0,0 +1,84 @@ +package eu.dnetlib.scholix.api.controller; + + +import eu.dnetlib.common.controller.AbstractDnetController; +import eu.dnetlib.scholix.api.model.v1.ScholixV1; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.enums.ParameterIn; +import io.swagger.v3.oas.annotations.media.Schema; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +import java.util.ArrayList; +import java.util.List; + + +@RestController +@RequestMapping("/v1") +@Api(tags = { + "Scholix" +}) +public class ScholixControllerV1 extends AbstractDnetController { + + @Operation( + summary = "Get all Scholix relation collected from a publisher", + description = "return a list of scholix object published from a specific publisher" + ) + @GetMapping("/linksFromPublisher") + public List linksFromPublisher( + @Parameter( + in = ParameterIn.QUERY, + description = "Filter Scholix relationships collected from a publisher", + schema = @Schema(), required = true) String publisher, + @Parameter(in = ParameterIn.QUERY, + description = "The page number") @RequestParam(required = false) Integer page + ) { + + return new ArrayList<>(); + } + + @Operation( + summary = "Get all Scholix relation collected from a datasource", + description = "return a list of scholix object collected from a specific datasource" + ) + @GetMapping("/linksFromDatasource") + public List linksFromDatasource( + @Parameter( + in = ParameterIn.QUERY, + description = "Filter Scholix relationships collected from a LinkProvider", + schema = @Schema()) @NotNull String datasource, + @Parameter(in = ParameterIn.QUERY, + description = "The page number") @RequestParam(required = false) Integer page + ) { + + return new ArrayList<>(); + } + + + @Operation( + summary = "Retrieve all scholix links from a persistent identifier", + description = "The linksFromPid endpoint returns a list of scholix object related from a specific persistent identifier" + ) + @GetMapping("/linksFromPid") + public List linksFromPid( + @Parameter(in = ParameterIn.QUERY, description = "persistent Identifier") @NotNull String pid, + @Parameter(in = ParameterIn.QUERY, description = "Persistent Identifier Type") @RequestParam(required = false) String pidType, + @Parameter(in = ParameterIn.QUERY, description = "typology target filter should be publication, dataset or unknown") @RequestParam(required = false) String typologyTarget, + @Parameter(in = ParameterIn.QUERY, description = "a datasource provenance filter of the target relation") @RequestParam(required = false) String datasourceTarget, + @Parameter(in = ParameterIn.QUERY, + description = "The page number") @RequestParam(required = false) Integer page + ) { + + return new ArrayList<>(); + } + + + +} diff --git a/apps/scholexplorer-api/src/main/java/eu/dnetlib/scholix/api/controller/ScholixControllerV2.java b/apps/scholexplorer-api/src/main/java/eu/dnetlib/scholix/api/controller/ScholixControllerV2.java new file mode 100644 index 00000000..ee5fef8a --- /dev/null +++ b/apps/scholexplorer-api/src/main/java/eu/dnetlib/scholix/api/controller/ScholixControllerV2.java @@ -0,0 +1,56 @@ +package eu.dnetlib.scholix.api.controller; + + +import eu.dnetlib.common.controller.AbstractDnetController; +import eu.dnetlib.scholix.api.model.v2.PageResultType; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.enums.ParameterIn; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import javax.validation.constraints.NotNull; +import java.util.Arrays; + +@RestController +@RequestMapping("/v2") +@Api(tags = { + "Links : Operation related to the Scholix Links" +}) +public class ScholixControllerV2 extends AbstractDnetController { + + @ApiOperation("Get Scholix Links") + @GetMapping("/Links") + public PageResultType links( + @Parameter(in = ParameterIn.QUERY, + description = "Filter Scholix relationships collected from a LinkProvider") String linkProvider, + @Parameter(in = ParameterIn.QUERY, + description = "Filter Scholix relationships having a target pid") String targetPid, + @Parameter(in = ParameterIn.QUERY, + description = "Filter Scholix relationships having a target pid type") String targetPidType, + @Parameter(in = ParameterIn.QUERY, + description = "Filter Scholix relationships having a target published in a Publisher named targetPublisher") String targetPublisher, + @Parameter(in = ParameterIn.QUERY, + description = "Filter Scholix relationships having a target type (literature, dataset, unknown)") String targetType, + @Parameter(in = ParameterIn.QUERY, + description = "Filter Scholix relationships having a source pid") String sourcePid, + @Parameter(in = ParameterIn.QUERY, + description = "Filter Scholix relationships having a source pid type") String sourcePidType, + @Parameter(in = ParameterIn.QUERY, + description = "Filter Scholix relationships having a source published in a Publisher named sourcePublisher") String sourcePublisher, + @Parameter(in = ParameterIn.QUERY, + description = "Filter Scholix relationships having a source type (literature, dataset, unknown)") String sourceType, + @Parameter(in = ParameterIn.QUERY, + description = "Filter scholix Links having collected after this date") String harvestedAfter, + @Parameter(in = ParameterIn.QUERY, + description = "select page of result") Integer page) { + + return new PageResultType(); + } + + + +} diff --git a/apps/scholexplorer-api/src/main/java/eu/dnetlib/scholix/api/model/v1/LinkPublisher.java b/apps/scholexplorer-api/src/main/java/eu/dnetlib/scholix/api/model/v1/LinkPublisher.java new file mode 100644 index 00000000..ae1a1b63 --- /dev/null +++ b/apps/scholexplorer-api/src/main/java/eu/dnetlib/scholix/api/model/v1/LinkPublisher.java @@ -0,0 +1,97 @@ +package eu.dnetlib.scholix.api.model.v1; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.media.Schema; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Size; +import java.util.Objects; + +public class LinkPublisher { + @NotBlank + @JsonProperty("name") + private String name = null; + + @NotBlank + @JsonProperty("totalRelationships") + private Integer totalRelationships = null; + + public LinkPublisher name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @Schema(description = "The Publisher Name") + + @Size(max=300) public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public LinkPublisher totalRelationships(Integer totalRelationships) { + this.totalRelationships = totalRelationships; + return this; + } + + /** + * Get totalRelationships + * @return totalRelationships + **/ + @Schema(description = "Total number of relationships that the publisher provides") + + public Integer getTotalRelationships() { + return totalRelationships; + } + + public void setTotalRelationships(Integer totalRelationships) { + this.totalRelationships = totalRelationships; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + LinkPublisher linkPublisher = (LinkPublisher) o; + return Objects.equals(this.name, linkPublisher.name) && + Objects.equals(this.totalRelationships, linkPublisher.totalRelationships); + } + + @Override + public int hashCode() { + return Objects.hash(name, totalRelationships); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class LinkPublisher {\n"); + + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" totalRelationships: ").append(toIndentedString(totalRelationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} \ No newline at end of file diff --git a/apps/scholexplorer-api/src/main/java/eu/dnetlib/scholix/api/model/v1/ScholixCreator.java b/apps/scholexplorer-api/src/main/java/eu/dnetlib/scholix/api/model/v1/ScholixCreator.java new file mode 100644 index 00000000..97f571b1 --- /dev/null +++ b/apps/scholexplorer-api/src/main/java/eu/dnetlib/scholix/api/model/v1/ScholixCreator.java @@ -0,0 +1,102 @@ +package eu.dnetlib.scholix.api.model.v1; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.media.Schema; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +public class ScholixCreator { + + @JsonProperty("name") + private String name = null; + + @JsonProperty("identifier") + private List identifier = null; + + public ScholixCreator name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @Schema(required = true, description = "The name of the Object Creator") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public ScholixCreator identifier(List identifier) { + this.identifier = identifier; + return this; + } + + public ScholixCreator addIdentifierItem(ScholixIdentifier identifierItem) { + if (this.identifier == null) { + this.identifier = new ArrayList(); + } + this.identifier.add(identifierItem); + return this; + } + + /** + * Get identifier + * @return identifier + **/ + @Schema(description = "A unique string that identifies the Object Creator") + public List getIdentifier() { + return identifier; + } + + public void setIdentifier(List identifier) { + this.identifier = identifier; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ScholixCreator ScholixCreator = (ScholixCreator) o; + return Objects.equals(this.name, ScholixCreator.name) && + Objects.equals(this.identifier, ScholixCreator.identifier); + } + + @Override + public int hashCode() { + return Objects.hash(name, identifier); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ScholixCreator {\n"); + + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" identifier: ").append(toIndentedString(identifier)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/apps/scholexplorer-api/src/main/java/eu/dnetlib/scholix/api/model/v1/ScholixIdentifier.java b/apps/scholexplorer-api/src/main/java/eu/dnetlib/scholix/api/model/v1/ScholixIdentifier.java new file mode 100644 index 00000000..49fb0be6 --- /dev/null +++ b/apps/scholexplorer-api/src/main/java/eu/dnetlib/scholix/api/model/v1/ScholixIdentifier.java @@ -0,0 +1,98 @@ +package eu.dnetlib.scholix.api.model.v1; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.media.Schema; + +import java.util.Objects; + +public class ScholixIdentifier { + + @JsonProperty("identifier") + private String identifier = null; + + @JsonProperty("schema") + private String schema = null; + + + + public ScholixIdentifier Identifier(String ID) { + this.identifier = ID; + return this; + } + + /** + * Get ID + * @return ID + **/ + @Schema(description = "The value of the Identifier") + public String getIdentifier() { + return identifier; + } + + public void setIdentifier(String identifier) { + this.identifier = identifier; + } + + public ScholixIdentifier Schema(String idScheme) { + this.schema = idScheme; + return this; + } + + /** + * Get the Schema + * @return Schema + **/ + @Schema(description = "The Schema URL of the identifier type") + + public String getSchema() { + return schema; + } + + public void setSchema(String schema) { + this.schema = schema; + } + + + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ScholixIdentifier identifierType = (ScholixIdentifier) o; + return Objects.equals(this.identifier, identifierType.identifier) && + Objects.equals(this.schema, identifierType.schema); + } + + @Override + public int hashCode() { + return Objects.hash(identifier, schema); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IdentifierType {\n"); + + sb.append(" identifier: ").append(toIndentedString(identifier)).append("\n"); + sb.append(" schema: ").append(toIndentedString(schema)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/apps/scholexplorer-api/src/main/java/eu/dnetlib/scholix/api/model/v1/ScholixItem.java b/apps/scholexplorer-api/src/main/java/eu/dnetlib/scholix/api/model/v1/ScholixItem.java new file mode 100644 index 00000000..c81b3bd1 --- /dev/null +++ b/apps/scholexplorer-api/src/main/java/eu/dnetlib/scholix/api/model/v1/ScholixItem.java @@ -0,0 +1,178 @@ +package eu.dnetlib.scholix.api.model.v1; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.media.Schema; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +public class ScholixItem { + + @JsonProperty("identifier") + private ScholixIdentifier identifier; + + @JsonProperty("objectType") + private String objectType; + + @JsonProperty("objectSubType") + private String objectSubType; + + @JsonProperty("title") + private String title; + + @JsonProperty("creator") + private List creator; + + @JsonProperty("publicationDate") + private String publicationDate; + + @JsonProperty("publisher") + private ScholixProvider publisher; + + public ScholixItem identifier(ScholixIdentifier identifier) { + this.identifier = identifier; + return this; + } + + @Schema(description = "The identifier string") + public ScholixIdentifier getIdentifier() { + return identifier; + } + + public void setIdentifier(ScholixIdentifier identifier) { + this.identifier = identifier; + } + + public ScholixItem objectType(String objectType) { + this.objectType = objectType; + return this; + } + + @Schema(description = "Describes the nature of the object (its intended usage)") + public String getObjectType() { + return objectType; + } + + public void setObjectType(String objectType) { + this.objectType = objectType; + } + + public ScholixItem objectSubType(String objectSubType) { + this.objectSubType = objectSubType; + return this; + } + + @Schema(description = "The sub-type of Object") + public String getObjectSubType() { + return objectSubType; + } + + public void setObjectSubType(String objectSubType) { + this.objectSubType = objectSubType; + } + + public ScholixItem title(String title) { + this.title = title; + return this; + } + + @Schema(description = "The name of the object") + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public ScholixItem creator(List creator) { + this.creator = creator; + return this; + } + + public ScholixItem addCreatorInstance(ScholixCreator creatorInstance) { + if(this.creator == null) + this.creator = new ArrayList<>(); + this.creator.add(creatorInstance); + return this; + } + + @Schema(description = "Party responsible for the creation of the object") + public List getCreator() { + return creator; + } + + public void setCreator(List creator) { + this.creator = creator; + } + + @Schema(description = "The date the object was formally issued, published or distributed") + public String getPublicationDate() { + return publicationDate; + } + + public void setPublicationDate(String publicationDate) { + this.publicationDate = publicationDate; + } + + @Schema(description = "The name of the publisher of the object") + public ScholixProvider getPublisher() { + return publisher; + } + + public void setPublisher(ScholixProvider publisher) { + this.publisher = publisher; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ScholixItem scholixItemType = (ScholixItem) o; + return Objects.equals(this.objectType, scholixItemType.objectType) && + Objects.equals(this.objectSubType, scholixItemType.objectSubType) && + Objects.equals(this.identifier, scholixItemType.identifier) && + Objects.equals(this.title, scholixItemType.title) && + Objects.equals(this.creator, scholixItemType.creator) && + Objects.equals(this.publicationDate, scholixItemType.publicationDate) && + Objects.equals(this.publisher, scholixItemType.publisher); + } + + @Override + public int hashCode() { + return Objects.hash(objectType, objectSubType, identifier, title, creator, publicationDate, publisher); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ScholixItemType {\n"); + + sb.append(" objectType: ").append(toIndentedString(objectType)).append("\n"); + sb.append(" objectSubType: ").append(toIndentedString(objectSubType)).append("\n"); + sb.append(" identifier: ").append(toIndentedString(identifier)).append("\n"); + sb.append(" title: ").append(toIndentedString(title)).append("\n"); + sb.append(" creator: ").append(toIndentedString(creator)).append("\n"); + sb.append(" publicationDate: ").append(toIndentedString(publicationDate)).append("\n"); + sb.append(" publisher: ").append(toIndentedString(publisher)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/apps/scholexplorer-api/src/main/java/eu/dnetlib/scholix/api/model/v1/ScholixProvider.java b/apps/scholexplorer-api/src/main/java/eu/dnetlib/scholix/api/model/v1/ScholixProvider.java new file mode 100644 index 00000000..1436c36d --- /dev/null +++ b/apps/scholexplorer-api/src/main/java/eu/dnetlib/scholix/api/model/v1/ScholixProvider.java @@ -0,0 +1,106 @@ +package eu.dnetlib.scholix.api.model.v1; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.media.Schema; + +import javax.validation.Valid; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +public class ScholixProvider { + + @JsonProperty("name") + private String name = null; + + @JsonProperty("identifier") + @Valid + private List identifier = null; + + public ScholixProvider name(String name) { + this.name = name; + return this; + } + + /** + * Get the provider name + * @return name + **/ + @Schema(description = "The provider name") + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public ScholixProvider identifier(List identifier) { + this.identifier = identifier; + return this; + } + + public ScholixProvider addIdentifierItem(ScholixIdentifier identifierItem) { + if (this.identifier == null) { + this.identifier = new ArrayList<>(); + } + this.identifier.add(identifierItem); + return this; + } + + /** + * Get identifier + * @return identifier + **/ + @Schema(description = "the identifiers of the provider") + @Valid + public List getIdentifier() { + return identifier; + } + + public void setIdentifier(List identifier) { + this.identifier = identifier; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ScholixProvider scholixProviderType = (ScholixProvider) o; + return Objects.equals(this.name, scholixProviderType.name) && + Objects.equals(this.identifier, scholixProviderType.identifier); + } + + @Override + public int hashCode() { + return Objects.hash(name, identifier); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ScholixProviderType {\n"); + + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" identifiers: ").append(toIndentedString(identifier)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/apps/scholexplorer-api/src/main/java/eu/dnetlib/scholix/api/model/v1/ScholixRelationship.java b/apps/scholexplorer-api/src/main/java/eu/dnetlib/scholix/api/model/v1/ScholixRelationship.java new file mode 100644 index 00000000..82242d39 --- /dev/null +++ b/apps/scholexplorer-api/src/main/java/eu/dnetlib/scholix/api/model/v1/ScholixRelationship.java @@ -0,0 +1,119 @@ +package eu.dnetlib.scholix.api.model.v1; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.media.Schema; + +import javax.validation.constraints.NotBlank; +import java.util.Objects; + +public class ScholixRelationship { + + @JsonProperty("name") + private String name = null; + + @JsonProperty("schema") + private String schema = null; + + @NotBlank + @JsonProperty("inverseRelationship") + private String inverseRelationship = null; + + public ScholixRelationship name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @Schema(required = true, description = "The relationship type chosen from a Scholix controlled vocabulary") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public ScholixRelationship schema(String schema) { + this.schema = schema; + return this; + } + + /** + * Get The name of the schema or controlled list from which Relationship Sub-type is sourced + * @return subType + **/ + @Schema(description = "The name of the schema or controlled list from which Relationship Sub-type is sourced") + public String getSchema() { + return schema; + } + + public void setSchema(String schema) { + this.schema = schema; + } + + public ScholixRelationship inverseRelationship(String inverseRelationship) { + this.inverseRelationship = inverseRelationship; + return this; + } + + /** + * Get inverseRelationship + * @return inverseRelationship + **/ + @Schema(description = "The value of the inverse relation") + + public String getInverseRelationship() { + return inverseRelationship; + } + + public void setInverseRelationship(String inverseRelationship) { + this.inverseRelationship = inverseRelationship; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ScholixRelationship relationshipType = (ScholixRelationship) o; + return Objects.equals(this.name, relationshipType.name) && + Objects.equals(this.schema, relationshipType.schema) && + Objects.equals(this.inverseRelationship, relationshipType.inverseRelationship); + } + + @Override + public int hashCode() { + return Objects.hash(name, schema, inverseRelationship); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RelationshipType {\n"); + + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" subType: ").append(toIndentedString(schema)).append("\n"); + sb.append(" subTypeSchema: ").append(toIndentedString(inverseRelationship)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/apps/scholexplorer-api/src/main/java/eu/dnetlib/scholix/api/model/v1/ScholixV1.java b/apps/scholexplorer-api/src/main/java/eu/dnetlib/scholix/api/model/v1/ScholixV1.java new file mode 100644 index 00000000..b12e453c --- /dev/null +++ b/apps/scholexplorer-api/src/main/java/eu/dnetlib/scholix/api/model/v1/ScholixV1.java @@ -0,0 +1,159 @@ +package eu.dnetlib.scholix.api.model.v1; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.media.Schema; + +import javax.validation.constraints.NotBlank; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +public class ScholixV1 { + + @JsonProperty("linkProvider") + private List linkProvider; + + @JsonProperty("publicationDate") + private String publicationDate; + + @NotBlank + @JsonProperty("relationship") + private ScholixRelationship relationship; + + @NotBlank + @JsonProperty("source") + private ScholixItem source; + + @NotBlank + @JsonProperty("target") + private ScholixItem target; + + + + public ScholixV1 linkProvider (final List linkProvider ) { + this.linkProvider = linkProvider; + return this; + } + + @Schema(description = "An entity responsible for making this record available online") + public List getLinkProvider() { + return linkProvider; + } + + public ScholixV1 addLinkProviderItem(ScholixProvider linkProviderItem) { + if (this.linkProvider == null) { + this.linkProvider = new ArrayList<>(); + } + this.linkProvider.add(linkProviderItem); + return this; + } + + public void setLinkProvider(List linkProvider) { + this.linkProvider = linkProvider; + } + + @Schema(description = "date of formal issuance (e.g., publication) of the resource; generally different from source object and target object publication dates") + public String getPublicationDate() { + return publicationDate; + } + + public ScholixV1 publicationDate(String publicationDate) { + this.publicationDate = publicationDate; + return this; + } + + public void setPublicationDate(String publicationDate) { + this.publicationDate = publicationDate; + } + + @Schema(description = "Semantics of the relationship from source to target") + public ScholixRelationship getRelationship() { + return relationship; + } + + public ScholixV1 relationship(ScholixRelationship relationship) { + this.relationship = relationship; + return this; + } + + public void setRelationship(ScholixRelationship relationship) { + this.relationship = relationship; + } + + @Schema(description = "Root element relative to all properties describing the link’s source object.") + public ScholixItem getSource() { + return source; + } + + + public ScholixV1 source(ScholixItem source) { + this.source = source; + return this; + } + public void setSource(ScholixItem source) { + this.source = source; + } + + @Schema(description = "Root element relative to all properties describing the link’s target object.") + public ScholixItem getTarget() { + return target; + } + + public ScholixV1 target(ScholixItem target) { + this.target = target; + return this; + } + + public void setTarget(ScholixItem target) { + this.target = target; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ScholixV1 scholixV1 = (ScholixV1) o; + return Objects.equals(this.linkProvider, scholixV1.getLinkProvider()) && + Objects.equals(this.publicationDate, scholixV1.getPublicationDate()) && + Objects.equals(this.relationship, scholixV1.getRelationship()) && + Objects.equals(this.source, scholixV1.getSource()) && + Objects.equals(this.target, scholixV1.getTarget()); + } + + @Override + public int hashCode() { + return Objects.hash(linkProvider, publicationDate, relationship, source, target); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ScholixV1 {\n"); + + sb.append(" linkProvider: ").append(toIndentedString(linkProvider)).append("\n"); + sb.append(" publicationDate: ").append(toIndentedString(publicationDate)).append("\n"); + sb.append(" relationship: ").append(toIndentedString(relationship)).append("\n"); + sb.append(" source: ").append(toIndentedString(source)).append("\n"); + sb.append(" target: ").append(toIndentedString(target)).append("\n"); + + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/apps/scholexplorer-api/src/main/java/eu/dnetlib/scholix/api/model/v2/LinkProviderType.java b/apps/scholexplorer-api/src/main/java/eu/dnetlib/scholix/api/model/v2/LinkProviderType.java new file mode 100644 index 00000000..4957b4f7 --- /dev/null +++ b/apps/scholexplorer-api/src/main/java/eu/dnetlib/scholix/api/model/v2/LinkProviderType.java @@ -0,0 +1,123 @@ +package eu.dnetlib.scholix.api.model.v2; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.media.Schema; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Size; +import java.util.Objects; + +/** + * The type Link provider type. + */ +public class LinkProviderType { + @NotBlank + @JsonProperty("name") + private String name = null; + + @NotBlank + @JsonProperty("totalRelationships") + private Integer totalRelationships = null; + + /** + * Name link provider type. + * + * @param name the name + * @return the link provider type + */ + public LinkProviderType name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * + * @return name name + */ + @Schema(description = "The Publisher Name") + @Size(max=300) + public String getName() { + return name; + } + + /** + * Sets name. + * + * @param name the name + */ + public void setName(String name) { + this.name = name; + } + + /** + * Total relationships link provider type. + * + * @param totalRelationships the total relationships + * @return the link provider type + */ + public LinkProviderType totalRelationships(Integer totalRelationships) { + this.totalRelationships = totalRelationships; + return this; + } + + /** + * Get totalRelationships + * + * @return totalRelationships total relationships + */ + @Schema(description = "Total number of relationships that the publisher provides") + public Integer getTotalRelationships() { + return totalRelationships; + } + + /** + * Sets total relationships. + * + * @param totalRelationships the total relationships + */ + public void setTotalRelationships(Integer totalRelationships) { + this.totalRelationships = totalRelationships; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + LinkProviderType linkPublisher = (LinkProviderType) o; + return Objects.equals(this.name, linkPublisher.name) && + Objects.equals(this.totalRelationships, linkPublisher.totalRelationships); + } + + @Override + public int hashCode() { + return Objects.hash(name, totalRelationships); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class LinkPublisher {\n"); + + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" totalRelationships: ").append(toIndentedString(totalRelationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} \ No newline at end of file diff --git a/apps/scholexplorer-api/src/main/java/eu/dnetlib/scholix/api/model/v2/PageResultType.java b/apps/scholexplorer-api/src/main/java/eu/dnetlib/scholix/api/model/v2/PageResultType.java new file mode 100644 index 00000000..cb7c262e --- /dev/null +++ b/apps/scholexplorer-api/src/main/java/eu/dnetlib/scholix/api/model/v2/PageResultType.java @@ -0,0 +1,114 @@ +package eu.dnetlib.scholix.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; + +/** + * The main class that show the page result from the method + * /l2/links + */ +public class PageResultType implements Serializable { + + @NotBlank + @JsonProperty("currentPage") + @ApiModelProperty(position = 0) + private Integer currentPage = 0; + + @NotBlank + @JsonProperty("totalLinks") + @ApiModelProperty(position = 1) + private Integer totalLinks= 0; + + @NotBlank + @JsonProperty("totalPages") + @ApiModelProperty(position = 2) + private Integer totalPages = 0; + + @NotBlank + @JsonProperty("result") + @ApiModelProperty(position = 3) + private List result = new ArrayList<>(); + + + /** + * Gets current page. + * + * @return the current page + */ + @Schema(description = "The Current page of the results") + public Integer getCurrentPage() { + return currentPage; + } + + /** + * Sets current page. + * + * @param currentPage the current page + */ + public void setCurrentPage(Integer currentPage) { + this.currentPage = currentPage; + } + + /** + * Gets total links. + * + * @return the total links + */ + @Schema(description = "The total number of Links found by the query") + public Integer getTotalLinks() { + return totalLinks; + } + + /** + * Sets total links. + * + * @param totalLinks the total links + */ + public void setTotalLinks(Integer totalLinks) { + this.totalLinks = totalLinks; + } + + /** + * Gets total pages. + * + * @return the total pages + */ + @Schema(description = "The Total number of pages") + public Integer getTotalPages() { + return totalPages; + } + + /** + * Sets total pages. + * + * @param totalPages the total pages + */ + public void setTotalPages(Integer totalPages) { + this.totalPages = totalPages; + } + + /** + * Gets result. + * + * @return the result + */ + @Schema(description = "The First page of Scholix results") + public List getResult() { + return result; + } + + /** + * Sets result. + * + * @param result the result + */ + public void setResult(List result) { + this.result = result; + } +} diff --git a/apps/scholexplorer-api/src/main/java/eu/dnetlib/scholix/api/model/v2/RelationshipType.java b/apps/scholexplorer-api/src/main/java/eu/dnetlib/scholix/api/model/v2/RelationshipType.java new file mode 100644 index 00000000..87166b25 --- /dev/null +++ b/apps/scholexplorer-api/src/main/java/eu/dnetlib/scholix/api/model/v2/RelationshipType.java @@ -0,0 +1,86 @@ +package eu.dnetlib.scholix.api.model.v2; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.media.Schema; + +import javax.validation.constraints.NotNull; + +/** + * The type Relationship type. + */ +public class RelationshipType { + + @NotNull + @JsonProperty("Name") + private String name; + + @JsonProperty("SubType") + private String subType; + + @JsonProperty("SubTypeSchema") + private String subTypeSchema; + + + /** + * Gets The relationship type chosen from a Scholix controlled vocabulary + * + * @return the name + */ + @Schema(description = "The relationship type chosen from a Scholix controlled vocabulary") + public String getName() { + return name; + } + + /** + * Sets The relationship type chosen from a Scholix controlled vocabulary + * + * @param name the name + * @return the RelationshipType instance + */ + public RelationshipType setName(String name) { + this.name = name; + return this; + } + + /** + * Gets The sub-type of RelationshipType.Name + * + * @return the sub type + */ + @Schema(description = "The sub-type of RelationshipType.Name") + public String getSubType() { + return subType; + } + + /** + * Sets The sub-type of RelationshipType.Name + * + * @param subType the sub type + * @return the RelationshipType instance + */ + public RelationshipType setSubType(String subType) { + this.subType = subType; + return this; + } + + /** + * Gets The name of the schema or controlled list from which RelationshipSub-type is sourced. + * + * @return the sub type schema + */ + @Schema(description = "The name of the schema or controlled list from which RelationshipSub-type is sourced") + public String getSubTypeSchema() { + return subTypeSchema; + } + + /** + * Sets The name of the schema or controlled list from which RelationshipSub-type is sourced. + * + * @param subTypeSchema the sub type schema + * @return the RelationshipType instance + */ + public RelationshipType setSubTypeSchema(String subTypeSchema) { + this.subTypeSchema = subTypeSchema; + return this; + } +} diff --git a/apps/scholexplorer-api/src/main/java/eu/dnetlib/scholix/api/model/v2/ScholixCreatorType.java b/apps/scholexplorer-api/src/main/java/eu/dnetlib/scholix/api/model/v2/ScholixCreatorType.java new file mode 100644 index 00000000..61902ade --- /dev/null +++ b/apps/scholexplorer-api/src/main/java/eu/dnetlib/scholix/api/model/v2/ScholixCreatorType.java @@ -0,0 +1,66 @@ +package eu.dnetlib.scholix.api.model.v2; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.media.Schema; + +import javax.validation.constraints.NotBlank; +import java.util.ArrayList; +import java.util.List; + +/** + * The type Scholix creator type. + */ +public class ScholixCreatorType { + + @NotBlank + @JsonProperty("name") + private String name = null; + + + @NotBlank + @JsonProperty("identifier") + private List identifier = new ArrayList<>(); + + /** + * Gets A List of unique string that identifies the creator + * + * @return the identifier + */ + @Schema(description = "A List of unique string that identifies the creator") + public List getIdentifier() { + return identifier; + } + + /** + * Sets A List of unique string that identifies the creator + * + * @param identifier the identifier + * @return the identifier + */ + public ScholixCreatorType setIdentifier(List identifier) { + this.identifier = identifier; + return this; + } + + + /** + * Gets The name of the Object Creator + * + * @return the name + */ + @Schema(description = "The name of the Object Creator") + public String getName() { + return name; + } + + /** + * Sets The name of the Object Creator + * + * @param name the name + * @return the name + */ + public ScholixCreatorType setName(String name) { + this.name = name; + return this; + } +} diff --git a/apps/scholexplorer-api/src/main/java/eu/dnetlib/scholix/api/model/v2/ScholixIdentifierType.java b/apps/scholexplorer-api/src/main/java/eu/dnetlib/scholix/api/model/v2/ScholixIdentifierType.java new file mode 100644 index 00000000..b023c772 --- /dev/null +++ b/apps/scholexplorer-api/src/main/java/eu/dnetlib/scholix/api/model/v2/ScholixIdentifierType.java @@ -0,0 +1,92 @@ +package eu.dnetlib.scholix.api.model.v2; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.media.Schema; + +import javax.validation.constraints.NotBlank; +import java.util.Objects; + +/** + * The type Scholix identifier type. + */ +public class ScholixIdentifierType { + + @NotBlank + @JsonProperty("ID") + private String id = null; + + @NotBlank + @JsonProperty("IDScheme") + private String idScheme = null; + + @NotBlank + @JsonProperty("IDURL") + private String idURL = null; + + + /** + * Gets The identifier + * + * @return the id + */ + @Schema(description = "The identifier") + public String getId() { + return id; + } + + /** + * Sets The identifier + * + * @param id the id + * @return the id + */ + public ScholixIdentifierType setId(String id) { + this.id = id; + return this; + } + + /** + * Gets The scheme or namespace of the identifier string + * + * @return the id scheme + */ + @Schema(description = "The scheme or namespace of the identifier string") + public String getIdScheme() { + return idScheme; + } + + /** + * Sets The scheme or namespace of the identifier string + * + * @param idScheme the id scheme + * @return the id scheme + */ + public ScholixIdentifierType setIdScheme(String idScheme) { + this.idScheme = idScheme; + return this; + } + + /** + * Gets An internet resolvable form of the identifier + * + * @return the id url + */ + @Schema(description = "An internet resolvable form of the identifier") + public String getIdURL() { + return idURL; + } + + /** + * Sets An internet resolvable form of the identifier + * + * @param idURL the id url + * @return the id url + */ + public ScholixIdentifierType setIdURL(String idURL) { + this.idURL = idURL; + return this; + } + + + +} diff --git a/apps/scholexplorer-api/src/main/java/eu/dnetlib/scholix/api/model/v2/ScholixItemType.java b/apps/scholexplorer-api/src/main/java/eu/dnetlib/scholix/api/model/v2/ScholixItemType.java new file mode 100644 index 00000000..b137a9ac --- /dev/null +++ b/apps/scholexplorer-api/src/main/java/eu/dnetlib/scholix/api/model/v2/ScholixItemType.java @@ -0,0 +1,151 @@ +package eu.dnetlib.scholix.api.model.v2; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.ArrayList; +import java.util.List; + +/** + * The type Scholix item type. + */ +public class ScholixItemType { + + @JsonProperty("Identifier") + private List identifier = new ArrayList(); + + @JsonProperty("Title") + private String title; + + @JsonProperty("Type") + private String type; + + @JsonProperty("Creator") + private List creator = new ArrayList<>(); + + @JsonProperty("PublicationDate") + private String publicationDate; + + @JsonProperty("Publisher") + private List publisher = new ArrayList<>(); + + + /** + * Gets identifier. + * + * @return the identifier + */ + public List getIdentifier() { + return identifier; + } + + /** + * Sets identifier. + * + * @param identifier the identifier + * @return the identifier + */ + public ScholixItemType setIdentifier(List identifier) { + this.identifier = identifier; + return this; + } + + /** + * Gets title. + * + * @return the title + */ + public String getTitle() { + return title; + } + + /** + * Sets title. + * + * @param title the title + * @return the title + */ + public ScholixItemType setTitle(String title) { + this.title = title; + return this; + } + + /** + * Gets type. + * + * @return the type + */ + public String getType() { + return type; + } + + /** + * Sets type. + * + * @param type the type + * @return the type + */ + public ScholixItemType setType(String type) { + this.type = type; + return this; + } + + /** + * Gets creator. + * + * @return the creator + */ + public List getCreator() { + return creator; + } + + /** + * Sets creator. + * + * @param creator the creator + * @return the creator + */ + public ScholixItemType setCreator(List creator) { + this.creator = creator; + return this; + } + + /** + * Gets publication date. + * + * @return the publication date + */ + public String getPublicationDate() { + return publicationDate; + } + + /** + * Sets publication date. + * + * @param publicationDate the publication date + * @return the publication date + */ + public ScholixItemType setPublicationDate(String publicationDate) { + this.publicationDate = publicationDate; + return this; + } + + /** + * Gets publisher. + * + * @return the publisher + */ + public List getPublisher() { + return publisher; + } + + /** + * Sets publisher. + * + * @param publisher the publisher + * @return the publisher + */ + public ScholixItemType setPublisher(List publisher) { + this.publisher = publisher; + return this; + } +} diff --git a/apps/scholexplorer-api/src/main/java/eu/dnetlib/scholix/api/model/v2/ScholixLinkProviderType.java b/apps/scholexplorer-api/src/main/java/eu/dnetlib/scholix/api/model/v2/ScholixLinkProviderType.java new file mode 100644 index 00000000..c14093d3 --- /dev/null +++ b/apps/scholexplorer-api/src/main/java/eu/dnetlib/scholix/api/model/v2/ScholixLinkProviderType.java @@ -0,0 +1,67 @@ +package eu.dnetlib.scholix.api.model.v2; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.media.Schema; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Size; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** + * The type Scholix link provider type. + */ +public class ScholixLinkProviderType { + @NotBlank + @JsonProperty("name") + private String name = null; + + + @NotBlank + @JsonProperty("identifier") + private List identifier = new ArrayList<>(); + + /** + * Gets A List of unique string that identifies the object + * + * @return the identifier + */ + @Schema(description = "A List of unique string that identifies the object") + public List getIdentifier() { + return identifier; + } + + /** + * Sets A List of unique string that identifies the object + * + * @param identifier the identifier + * @return the identifier + */ + public ScholixLinkProviderType setIdentifier(List identifier) { + this.identifier = identifier; + return this; + } + + + /** + * Gets The name of the Provider + * + * @return the name + */ + @Schema(description = "The name of the Provider") + public String getName() { + return name; + } + + /** + * Sets The name of the Provider + * + * @param name the name + * @return the name + */ + public ScholixLinkProviderType setName(String name) { + this.name = name; + return this; + } +} \ No newline at end of file diff --git a/apps/scholexplorer-api/src/main/java/eu/dnetlib/scholix/api/model/v2/ScholixType.java b/apps/scholexplorer-api/src/main/java/eu/dnetlib/scholix/api/model/v2/ScholixType.java new file mode 100644 index 00000000..3c994c96 --- /dev/null +++ b/apps/scholexplorer-api/src/main/java/eu/dnetlib/scholix/api/model/v2/ScholixType.java @@ -0,0 +1,170 @@ +package eu.dnetlib.scholix.api.model.v2; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.media.Schema; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; +import java.util.List; + +/** + * The type Scholix type. + */ +public class ScholixType implements Serializable { + + + @NotBlank + @JsonProperty("RelationshipType") + private RelationshipType relationshipType ; + + @NotBlank + @JsonProperty("source") + private ScholixItemType source ; + + @NotBlank + @JsonProperty("target") + private ScholixItemType target ; + + @JsonProperty("HarvestDate") + private String harvestDate ; + + + @JsonProperty("LicenseURL") + private String licenseURL ; + + @JsonProperty("LinkProvider") + private List linkProvider ; + + @JsonProperty("LinkPublicationDate") + private String linkPublicationDate ; + + + /** + * Gets the nature of the relationship between the source object and target object in this Link Information Package + * + * @return the relationship type + */ + @Schema(description = "The nature of the relationship between the source object and target object in this Link Information Package") + public RelationshipType getRelationshipType() { + return relationshipType; + } + + public void setRelationshipType(RelationshipType relationshipType) { + this.relationshipType = relationshipType; + } + + /** + * Gets Root element relative to all properties describing the link’s source object + * + * @return the source + */ + @Schema(description = "Root element relative to all properties describing the link’s source object") + public ScholixItemType getSource() { + return source; + } + + /** + * Sets source. + * + * @param source the source + */ + public void setSource(ScholixItemType source) { + this.source = source; + } + + /** + * Gets Root element relative to all properties describing the link’s target object + * + * @return the target + */ + @Schema(description = "Gets Root element relative to all properties describing the link’s target object") + public ScholixItemType getTarget() { + return target; + } + + /** + * Sets target. + * + * @param target the target + */ + public void setTarget(ScholixItemType target) { + this.target = target; + } + + /** + * Gets harvest date. + * + * @return the harvest date + */ + public String getHarvestDate() { + return harvestDate; + } + + /** + * Sets harvest date. + * + * @param harvestDate the harvest date + */ + public void setHarvestDate(String harvestDate) { + this.harvestDate = harvestDate; + } + + /** + * Gets The URL of the license for the Scholix Link Information Package + * + * @return the license url + */ + + @Schema(description = "The URL of the license for the Scholix Link Information Package") + public String getLicenseURL() { + return licenseURL; + } + + /** + * Sets license url. + * + * @param licenseURL the license url + */ + public void setLicenseURL(String licenseURL) { + this.licenseURL = licenseURL; + } + + /** + * Gets The source(s) of this Link Information Package. + * + * @return the link provider + */ + @Schema(description = "The source(s) of this Link Information Package") + public List getLinkProvider() { + return linkProvider; + } + + /** + * Sets link provider. + * + * @param linkProvider the link provider + */ + public void setLinkProvider(List linkProvider) { + this.linkProvider = linkProvider; + } + + /** + * Gets Date when this Link Information Package was first formally issued from this current Provider + * + * @return the link publication date + */ + @Schema(description = "Date when this Link Information Package was first formally issued from this current Provider") + + public String getLinkPublicationDate() { + return linkPublicationDate; + } + + /** + * Sets link publication date. + * + * @param linkPublicationDate the link publication date + */ + public void setLinkPublicationDate(String linkPublicationDate) { + this.linkPublicationDate = linkPublicationDate; + } +} diff --git a/apps/scholexplorer-api/src/main/resources/application.properties b/apps/scholexplorer-api/src/main/resources/application.properties new file mode 100644 index 00000000..38401105 --- /dev/null +++ b/apps/scholexplorer-api/src/main/resources/application.properties @@ -0,0 +1,48 @@ +spring.main.banner-mode = console + +logging.level.root = INFO +dhp.swagger.api.host = localhost:8080 +#dhp.swagger.api.host = api.scholexplorer.openaire.eu +dhp.swagger.api.basePath = / + +maven.pom.path = /META-INF/maven/eu.dnetlib.dhp/scholexplorer-api/effective-pom.xml +# +#spring.thymeleaf.cache=false +# +#management.endpoints.web.exposure.include = prometheus,health +#management.endpoints.web.base-path = / +#management.endpoints.web.path-mapping.prometheus = metrics +#management.endpoints.web.path-mapping.health = health +# +#spring.datasource.url=jdbc:postgresql://localhost:5432/mdstoremanager +#spring.datasource.username= +#spring.datasource.password= +# +#spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect +# +## Hibernate ddl auto (create, create-drop, validate, update) +#spring.jpa.hibernate.ddl-auto = validate +#spring.jpa.properties.hibernate.hbm2dll.extra_physical_table_types = MATERIALIZED VIEW +#spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true +#spring.jpa.open-in-view=true +# +## logs +#logging.level.io.swagger.models.parameters.AbstractSerializableParameter = error +# +## Hadoop +#dhp.mdstore-manager.hadoop.cluster = GARR +#dhp.mdstore-manager.hdfs.base-path = /data/dnet.dev/mdstore +#dhp.mdstore-manager.hadoop.user = dnet.dev +# +##dhp.mdstore-manager.hadoop.zeppelin.base-url = https://iis-cdh5-test-gw.ocean.icm.edu.pl/zeppelin +##dhp.mdstore-manager.hadoop.zeppelin.login = +##dhp.mdstore-manager.hadoop.zeppelin.password = +#dhp.mdstore-manager.hadoop.zeppelin.base-url = https://hadoop-zeppelin.garr-pa1.d4science.org +#dhp.mdstore-manager.hadoop.zeppelin.login = +#dhp.mdstore-manager.hadoop.zeppelin.password = +# +#dhp.mdstore-manager.hadoop.zeppelin.name-prefix = mdstoreManager +# +#dhp.mdstore-manager.inspector.records.max = 1000 + + diff --git a/apps/scholexplorer-api/src/main/resources/static/logo.png b/apps/scholexplorer-api/src/main/resources/static/logo.png new file mode 100644 index 00000000..4614e2d5 Binary files /dev/null and b/apps/scholexplorer-api/src/main/resources/static/logo.png differ diff --git a/apps/scholexplorer-api/src/main/resources/static/new_swagger.html b/apps/scholexplorer-api/src/main/resources/static/new_swagger.html new file mode 100644 index 00000000..a22ffb29 --- /dev/null +++ b/apps/scholexplorer-api/src/main/resources/static/new_swagger.html @@ -0,0 +1,135 @@ + + + + + + Custom Swagger UI + + + + + + + +
+ + X name + +
+
+ + + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index d48f11f4..5c9b7070 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,8 @@ libs apps cmd-line-apps - + scholexplorer-api + Redmine