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
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
d034b1b
first version
195150d
Dspace harvester first version
0b0fda3
harvest other entities + dspace docker compose
0a1d506
Fix issues in the harvest alg
556de89
Merge branch 'main' of https://github.com/joseph6x/DSpace-VIVO into d…
0b4677a
Add logging, fix OAI issue en Col/Com/Rep , port RESTv7 harvester
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,77 +1,92 @@ | ||
<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>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> | ||
18 changes: 18 additions & 0 deletions
18
...ransformation/src/main/java/org/vivoweb/dspacevivo/transformation/ConsoleApplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package org.vivoweb.dspacevivo.transformation; | ||
|
||
import java.io.IOException; | ||
import org.vivoweb.dspacevivo.transformation.harvester.HarvesterRunner; | ||
|
||
public class ConsoleApplication { | ||
|
||
public static void main(String[] args) throws IOException { | ||
|
||
HarvesterRunner runner = new HarvesterRunner(); | ||
runner.init(); | ||
//runner.harvest(); | ||
//runner.harvestCommunity(); | ||
//runner.harvestCollection(); | ||
runner.harvestRepository(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
...mation/src/main/java/org/vivoweb/dspacevivo/transformation/harvester/DspaceHarvester.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
} |
99 changes: 99 additions & 0 deletions
99
...mation/src/main/java/org/vivoweb/dspacevivo/transformation/harvester/HarvesterRunner.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
package org.vivoweb.dspacevivo.transformation.harvester; | ||
|
||
import com.fasterxml.jackson.core.JsonProcessingException; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import com.fasterxml.jackson.databind.SerializationFeature; | ||
import java.io.IOException; | ||
import java.util.Iterator; | ||
import java.util.Properties; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.vivoweb.dspacevivo.model.Collection; | ||
import org.vivoweb.dspacevivo.model.Community; | ||
import org.vivoweb.dspacevivo.model.Item; | ||
import org.vivoweb.dspacevivo.model.Repository; | ||
import org.vivoweb.dspacevivo.transformation.harvester.config.HarvesterConfiguration; | ||
import org.vivoweb.dspacevivo.transformation.harvester.oai.DspaceOAI; | ||
|
||
public class HarvesterRunner { | ||
|
||
private static Logger log = LoggerFactory.getLogger(HarvesterRunner.class); | ||
private DspaceHarvester dh = null; | ||
|
||
public void init() throws IOException { | ||
Properties conf = HarvesterConfiguration.getConf(); | ||
switch (conf.getProperty("type")) { | ||
case "RESTv7": | ||
//dh = new Dspace7REST(conf); | ||
break; | ||
case "SPARQL": | ||
//dh = new SPARQLHarvester(conf); | ||
break; | ||
case "OAI": | ||
dh = new DspaceOAI(conf); | ||
break; | ||
} | ||
dh.connect(); | ||
} | ||
|
||
public void harvest() throws JsonProcessingException { | ||
ObjectMapper mp = new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT); | ||
Iterator<Item> harvestItemsItr = dh.harvestItems(); | ||
int count = 0; | ||
if (harvestItemsItr != null) { | ||
while (harvestItemsItr.hasNext()) { | ||
count++; | ||
Item next = harvestItemsItr.next(); | ||
System.out.println("new Item harvested..."); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we use loggers instead of printing to console? |
||
System.out.println(" " + count); | ||
System.out.println(mp.writeValueAsString(next)); | ||
} | ||
} | ||
} | ||
|
||
public void harvestCollection() throws JsonProcessingException { | ||
ObjectMapper mp = new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT); | ||
Iterator<Collection> harvestCollection = dh.harvestCollection(); | ||
int count = 0; | ||
if (harvestCollection != null) { | ||
while (harvestCollection.hasNext()) { | ||
count++; | ||
Collection next = harvestCollection.next(); | ||
System.out.println("new Collection harvested..."); | ||
System.out.println(" " + count); | ||
System.out.println(mp.writeValueAsString(next)); | ||
} | ||
} | ||
} | ||
|
||
public void harvestCommunity() throws JsonProcessingException { | ||
ObjectMapper mp = new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT); | ||
Iterator<Community> harvestCommunity = dh.harvestCommunity(); | ||
int count = 0; | ||
if (harvestCommunity != null) { | ||
while (harvestCommunity.hasNext()) { | ||
count++; | ||
Community next = harvestCommunity.next(); | ||
System.out.println("new Community harvested..."); | ||
System.out.println(" " + count); | ||
System.out.println(mp.writeValueAsString(next)); | ||
} | ||
} | ||
} | ||
|
||
public void harvestRepository() throws JsonProcessingException { | ||
ObjectMapper mp = new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT); | ||
Iterator<Repository> harvestRepository = dh.harvestRepository(); | ||
int count = 0; | ||
if (harvestRepository != null) { | ||
while (harvestRepository.hasNext()) { | ||
count++; | ||
Repository next = harvestRepository.next(); | ||
System.out.println("new Repository harvested..."); | ||
System.out.println(" " + count); | ||
System.out.println(mp.writeValueAsString(next)); | ||
} | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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