Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dspace harvester first version #4

Merged
merged 6 commits into from May 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -27,7 +27,7 @@
/**
* Collection
*/
@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaJerseyServerCodegen", date = "2022-04-07T06:06:42.412-04:00[America/New_York]")public class Collection {
@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaJerseyServerCodegen", date = "2022-04-11T22:50:22.156-05:00[America/Guayaquil]")public class Collection {
@JsonProperty("dspaceType")
private String dspaceType = "collection";

Expand Down
Expand Up @@ -28,7 +28,7 @@
/**
* Community
*/
@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaJerseyServerCodegen", date = "2022-04-07T06:06:42.412-04:00[America/New_York]")public class Community {
@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaJerseyServerCodegen", date = "2022-04-11T22:50:22.156-05:00[America/Guayaquil]")public class Community {
@JsonProperty("dspaceType")
private String dspaceType = "community";

Expand Down
Expand Up @@ -22,7 +22,7 @@
/**
* Error
*/
@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaJerseyServerCodegen", date = "2022-04-07T06:06:42.412-04:00[America/New_York]")public class Error {
@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaJerseyServerCodegen", date = "2022-04-11T22:50:22.156-05:00[America/Guayaquil]")public class Error {
@JsonProperty("code")
private Integer code = null;

Expand Down
Expand Up @@ -26,7 +26,7 @@
/**
* Item
*/
@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaJerseyServerCodegen", date = "2022-04-07T06:06:42.412-04:00[America/New_York]")public class Item {
@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaJerseyServerCodegen", date = "2022-04-11T22:50:22.156-05:00[America/Guayaquil]")public class Item {
@JsonProperty("dspaceType")
private String dspaceType = "item";

Expand Down
Expand Up @@ -27,7 +27,7 @@
/**
* Repository
*/
@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaJerseyServerCodegen", date = "2022-04-07T06:06:42.412-04:00[America/New_York]")public class Repository {
@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaJerseyServerCodegen", date = "2022-04-11T22:50:22.156-05:00[America/Guayaquil]")public class Repository {
@JsonProperty("dspaceType")
private String dspaceType = "repository";

Expand Down
Expand Up @@ -22,7 +22,7 @@
/**
* Statement
*/
@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaJerseyServerCodegen", date = "2022-04-07T06:06:42.412-04:00[America/New_York]")public class Statement {
@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaJerseyServerCodegen", date = "2022-04-11T22:50:22.156-05:00[America/Guayaquil]")public class Statement {
@JsonProperty("dspaceType")
private String dspaceType = "statement";

Expand Down
Expand Up @@ -22,7 +22,7 @@
/**
* StatementLiteral
*/
@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaJerseyServerCodegen", date = "2022-04-07T06:06:42.412-04:00[America/New_York]")public class StatementLiteral {
@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaJerseyServerCodegen", date = "2022-04-11T22:50:22.156-05:00[America/Guayaquil]")public class StatementLiteral {
@JsonProperty("dspaceType")
private String dspaceType = "statementLiteral";

Expand Down
185 changes: 110 additions & 75 deletions bundles/org.vivoweb.dspacevivo.transformation/pom.xml
@@ -1,77 +1,112 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>org.vivoweb.dspacevivo.transformation</artifactId>
<licenses>
<license>
<name>BSD 3-Clause License</name>
<url>https://raw.githubusercontent.com/vivo-project/VIVO/develop/LICENSE</url>
<distribution>repo</distribution>
</license>
</licenses>
<developers>
<developer>
<name>Michel Héon</name>
<organization>Université du Québec à Montréal</organization>
<organizationUrl>http://uqam.ca/</organizationUrl>
<url>https://ca.linkedin.com/in/michelheon</url>
</developer>
</developers>
<properties>
</properties>
<build>
</build>
<parent>
<groupId>org.vivoweb.dspacevivo</groupId>
<artifactId>org.vivoweb.dspacevivo.installer</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../../releng/org.vivoweb.dspacevivo.installer</relativePath>
</parent>
<dependencies>
<dependency>
<groupId>org.apache.jena</groupId>
<artifactId>jena-core</artifactId>
</dependency>
<dependency>
<groupId>org.apache.jena</groupId>
<artifactId>apache-jena-libs</artifactId>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.apache.jena</groupId>
<artifactId>jena-arq</artifactId>
</dependency>
<dependency>
<groupId>org.apache.jena</groupId>
<artifactId>jena-cmds</artifactId>
</dependency>
<dependency>
<groupId>org.apache.jena</groupId>
<artifactId>apache-jena</artifactId>
<type>pom</type>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
</dependency>
<dependency>
<groupId>org.vivoweb.dspacevivo</groupId>
<artifactId>org.vivoweb.dspacevivo.model.ontologie</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.vivoweb.dspacevivo</groupId>
<artifactId>org.vivoweb.dspacevivo.model.openapi</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>org.vivoweb.dspacevivo.transformation</artifactId>
<licenses>
<license>
<name>BSD 3-Clause License</name>
<url>https://raw.githubusercontent.com/vivo-project/VIVO/develop/LICENSE</url>
<distribution>repo</distribution>
</license>
</licenses>
<developers>
<developer>
<name>Michel Héon</name>
<organization>Université du Québec à Montréal</organization>
<organizationUrl>http://uqam.ca/</organizationUrl>
<url>https://ca.linkedin.com/in/michelheon</url>
</developer>
</developers>
<properties>
</properties>
<build>
</build>
<parent>
<groupId>org.vivoweb.dspacevivo</groupId>
<artifactId>org.vivoweb.dspacevivo.installer</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../../releng/org.vivoweb.dspacevivo.installer</relativePath>
</parent>
<dependencies>
<dependency>
<groupId>com.konghq</groupId>
<artifactId>unirest-java</artifactId>
<version>3.13.6</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.17.0</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.17.0</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>2.17.0</version>
</dependency>
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.13.1</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.11.0</version>
</dependency>
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.el</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.jena</groupId>
<artifactId>jena-core</artifactId>
</dependency>
<dependency>
<groupId>org.apache.jena</groupId>
<artifactId>apache-jena-libs</artifactId>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.apache.jena</groupId>
<artifactId>jena-arq</artifactId>
</dependency>
<dependency>
<groupId>org.apache.jena</groupId>
<artifactId>jena-cmds</artifactId>
</dependency>
<dependency>
<groupId>org.apache.jena</groupId>
<artifactId>apache-jena</artifactId>
<type>pom</type>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
</dependency>
<dependency>
<groupId>org.vivoweb.dspacevivo</groupId>
<artifactId>org.vivoweb.dspacevivo.model.ontologie</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.vivoweb.dspacevivo</groupId>
<artifactId>org.vivoweb.dspacevivo.model.openapi</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
</project>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add new line at the end of file

@@ -0,0 +1,28 @@
package org.vivoweb.dspacevivo.transformation;

import java.io.IOException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.vivoweb.dspacevivo.transformation.harvester.HarvesterRunner;

public class ConsoleApplication {

private static Logger logger = LoggerFactory.getLogger(ConsoleApplication.class);

public static void main(String[] args) throws IOException {

logger.info("Testing Dspace Harvester...");
HarvesterRunner runner = new HarvesterRunner();
logger.info("Init Dspace Harvester...");
runner.init();
logger.info("Harvesting Items...");
runner.harvestItems();
logger.info("Harvesting Communities...");
//runner.harvestCommunities();
logger.info("Harvesting Collections...");
//runner.harvestCollections();
logger.info("Harvesting Repositories...");
//runner.harvestRepositories();
}

}
Expand Up @@ -49,7 +49,7 @@ public static void main(String[] args) throws JsonProcessingException {
Repository repo = new Repository();
repo.setId("123456789_0");
repo.setUri("http://localhost:8080/server/rdf/resource/123456789/0");
repo.addHasCommunityIdItem("123456789_1");
//repo.addHasCommunityIdItem("123456789_1");
Statement stmt = new Statement();
stmt.setSubjectUri("dspace:123456789_0");
stmt.setPredicateUri("dcterms:hasPart");
Expand Down
@@ -0,0 +1,31 @@
package org.vivoweb.dspacevivo.transformation.harvester;

import java.util.Iterator;
import java.util.Properties;
import org.vivoweb.dspacevivo.model.Collection;
import org.vivoweb.dspacevivo.model.Community;
import org.vivoweb.dspacevivo.model.Item;
import org.vivoweb.dspacevivo.model.Repository;

public abstract class DspaceHarvester {

protected Properties conf = null;

public DspaceHarvester(Properties conf) {
this.conf = conf;
}

public Properties getConf() {
return conf;
}

public abstract void connect();

public abstract Iterator<Item> harvestItems();

public abstract Iterator<Community> harvestCommunity();

public abstract Iterator<Collection> harvestCollection();

public abstract Iterator<Repository> harvestRepository();
}