Skip to content
Browse files

trippi 1.5.4 changes to RDF parsing into TripleIterator

  • Loading branch information...
1 parent bebcf14 commit 391bc9af8544bcb1033b01311db7d0f5ade0d05d @barmintor barmintor committed
View
2 fcrepo-client/fcrepo-client-admin/pom.xml
@@ -202,6 +202,8 @@
<dependency>
<groupId>org.fcrepo</groupId>
<artifactId>trippi-core</artifactId>
+ <version>1.5.4</version>
+ <type>pom</type>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
View
39 ...ient/fcrepo-client-admin/src/main/java/org/fcrepo/client/objecteditor/RDFTupleEditor.java
@@ -10,6 +10,8 @@
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
+import java.awt.event.WindowEvent;
+import java.awt.event.WindowListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
@@ -52,6 +54,7 @@
import org.trippi.RDFFormat;
import org.trippi.TripleIterator;
+import org.trippi.io.TripleIteratorFactory;
import org.trippi.TrippiException;
import org.fcrepo.client.Administrator;
@@ -70,7 +73,7 @@
*/
public class RDFTupleEditor
extends ContentEditor
- implements DocumentListener, ActionListener, PropertyChangeListener {
+ implements DocumentListener, ActionListener, PropertyChangeListener, WindowListener {
/** This class handles the RDF MIME type. */
public static String[] s_types = new String[] {"application/rdf+xml"};
@@ -102,6 +105,8 @@
protected String dsid; // not used
protected HashMap<String, String> m_map;
+
+ protected TripleIteratorFactory m_factory;
private static boolean s_registered = false;
@@ -110,6 +115,7 @@ public RDFTupleEditor() {
ContentHandlerFactory.register(this);
s_registered = true;
}
+ m_factory = new TripleIteratorFactory();
}
@Override
@@ -266,7 +272,7 @@ private RDFDataModel() {
public RDFDataModel(InputStream data) {
TripleIterator iter;
try {
- iter = TripleIterator.fromStream(data, RDFFormat.RDF_XML);
+ iter = m_factory.fromStream(data, RDFFormat.RDF_XML);
entries = new ArrayList<RelationshipTuple>();
for (int i = 0; iter.hasNext(); i++) {
Triple triple = iter.next();
@@ -694,4 +700,33 @@ public String getSubject() {
}
+ @Override
+ public void windowActivated(WindowEvent e) {
+ }
+
+ @Override
+ public void windowClosed(WindowEvent e) {
+ }
+
+ @Override
+ public void windowClosing(WindowEvent e) {
+ m_factory.shutdown();
+ }
+
+ @Override
+ public void windowDeactivated(WindowEvent e) {
+ }
+
+ @Override
+ public void windowDeiconified(WindowEvent e) {
+ }
+
+ @Override
+ public void windowIconified(WindowEvent e) {
+ }
+
+ @Override
+ public void windowOpened(WindowEvent e) {
+ }
+
}
View
9 fcrepo-client/pom.xml
@@ -12,6 +12,15 @@
<packaging>pom</packaging>
<name>All Fedora Clients</name>
+ <dependencies>
+ <dependency>
+ <groupId>org.fcrepo</groupId>
+ <artifactId>trippi-core</artifactId>
+ <version>1.5.4</version>
+ <type>pom</type>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
<modules>
<module>fcrepo-client-admin</module>
<module>fcrepo-client-messaging</module>
View
4 fcrepo-installer/src/main/resources/config/spring/triple-generator.xml
@@ -6,6 +6,10 @@
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
+ <bean id="org.trippi.io.TripleIteratorFactory"
+ class="org.trippi.io.TripleIteratorFactory"
+ factory-method="defaultInstance"
+ destroy-method="shutdown"></bean>
<bean id="Object-3.0"
class="org.fcrepo.server.resourceIndex.FedoraObjectTripleGenerator_3_0"
scope="prototype">
View
3 ...rationtest/fcrepo-integrationtest-core/src/main/java/org/fcrepo/test/api/TestRESTAPI.java
@@ -69,6 +69,7 @@
import org.trippi.RDFFormat;
import org.trippi.TripleIterator;
import org.trippi.TrippiException;
+import org.trippi.io.TripleIteratorFactory;
import org.xml.sax.ErrorHandler;
import org.xml.sax.InputSource;
@@ -1778,7 +1779,7 @@ private void checkRelationship(byte[] rdf,
StringBuilder sb = new StringBuilder();
sb.append("RDF: " + new String(rdf, "UTF-8"));
TripleIterator it =
- TripleIterator.fromStream(new ByteArrayInputStream(rdf), null,
+ TripleIteratorFactory.defaultInstance().fromStream(new ByteArrayInputStream(rdf), null,
RDFFormat.RDF_XML);
View
6 fcrepo-server/pom.xml
@@ -666,19 +666,19 @@
<dependency>
<groupId>org.fcrepo</groupId>
<artifactId>trippi-core</artifactId>
- <version>1.5.1</version>
+ <version>1.5.4</version>
</dependency>
<dependency>
<groupId>org.fcrepo</groupId>
<artifactId>trippi-mptstore</artifactId>
- <version>1.5.1</version>
+ <version>1.5.4</version>
</dependency>
<dependency>
<groupId>org.fcrepo</groupId>
<artifactId>trippi-mulgara</artifactId>
- <version>1.5.1</version>
+ <version>1.5.4</version>
</dependency>
<!--Fix of the FCREPO-819 Bug -->
View
3 fcrepo-server/src/main/java/org/fcrepo/server/storage/RDFRelationshipReader.java
@@ -18,6 +18,7 @@
import org.trippi.RDFFormat;
import org.trippi.TripleIterator;
import org.trippi.TrippiException;
+import org.trippi.io.TripleIteratorFactory;
import org.fcrepo.server.errors.GeneralException;
import org.fcrepo.server.errors.ServerException;
@@ -47,7 +48,7 @@
TripleIterator iter = null;
try {
- iter = TripleIterator.fromStream(dsContent, RDFFormat.RDF_XML);
+ iter = TripleIteratorFactory.defaultInstance().fromStream(dsContent, RDFFormat.RDF_XML);
Triple triple;
ObjectNode objectNode;
boolean isLiteral;
View
5 fcrepo-server/src/main/java/org/fcrepo/server/storage/SimpleDOWriter.java
@@ -21,6 +21,7 @@
import org.trippi.RDFFormat;
import org.trippi.TripleIterator;
import org.trippi.TrippiException;
+import org.trippi.io.TripleIteratorFactory;
import org.fcrepo.common.Constants;
import org.fcrepo.common.PID;
@@ -329,7 +330,7 @@ public boolean addRelationship(String dsId,
try {
ByteArrayOutputStream out = new ByteArrayOutputStream();
TripleIterator iter =
- TripleIterator.fromStream(relsDatastream.getContentStream(),
+ TripleIteratorFactory.defaultInstance().fromStream(relsDatastream.getContentStream(),
RDFFormat.RDF_XML);
newIter = new FilteredTripleIterator(iter, toAdd, true);
newIter.toStream(out, RDFFormat.RDF_XML, false);
@@ -416,7 +417,7 @@ public boolean purgeRelationship(String dsId,
TripleIterator iter = null;
FilteredTripleIterator newIter = null;
try {
- iter = TripleIterator.fromStream(relsDatastreamIS, RDFFormat.RDF_XML);
+ iter = TripleIteratorFactory.defaultInstance().fromStream(relsDatastreamIS, RDFFormat.RDF_XML);
newIter = new FilteredTripleIterator(iter, toPurge, false);
ByteArrayOutputStream out = new ByteArrayOutputStream();
View
16 ...po-server/src/test/java/org/fcrepo/server/resourceIndex/ResourceIndexIntegrationTest.java
@@ -25,11 +25,13 @@
import org.jrdf.graph.URIReference;
import org.junit.After;
+import org.junit.Before;
import org.trippi.RDFFormat;
import org.trippi.RDFUtil;
import org.trippi.TripleIterator;
import org.trippi.TriplestoreConnector;
+import org.trippi.io.TripleIteratorFactory;
import org.fcrepo.common.Models;
import org.fcrepo.server.resourceIndex.ModelBasedTripleGenerator;
@@ -82,6 +84,11 @@
* The <code>ResourceIndexImpl</code> instance we'll be using.
*/
private ResourceIndex _ri;
+
+ /**
+ * The <code>org.trippi.io.TripleIteratorFactory</code> used to parse RDF
+ */
+ private TripleIteratorFactory _factory;
/**
* The flusher instance we'll use.
@@ -135,6 +142,12 @@ private static TriplestoreConnector getConnector() throws Exception {
return TriplestoreConnector.init("org.trippi.impl.mpt.MPTConnector",
config);
}
+
+ // Test setup
+ @Before
+ public void setupTest() throws Exception {
+ _factory = new TripleIteratorFactory();
+ }
// Test tearDown
@@ -143,6 +156,7 @@ public void tearDownTest() throws Exception {
if (_ri != null) {
tearDownTriplestore();
}
+ _factory.shutdown();
}
private void tearDownTriplestore() throws Exception {
@@ -163,7 +177,7 @@ private void tearDownTriplestore() throws Exception {
// load all from temp file
triples =
- TripleIterator.fromStream(new FileInputStream(dump),
+ _factory.fromStream(new FileInputStream(dump),
RDFFormat.TURTLE);
_ri.delete(triples, true);
} finally {
View
2 pom.xml
@@ -305,7 +305,7 @@
<dependency>
<groupId>org.fcrepo</groupId>
<artifactId>trippi-core</artifactId>
- <version>1.5.1</version>
+ <version>1.5.4</version>
<exclusions>
<exclusion>
<groupId>log4j</groupId>

0 comments on commit 391bc9a

Please sign in to comment.
Something went wrong with that request. Please try again.