You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@marmotta.apache.org by ss...@apache.org on 2013/11/26 10:07:20 UTC

[1/3] git commit: move drop/create indexes and initialise connection to separate initialise() and shutdown methods to avoid dropping indexes for every file

Updated Branches:
  refs/heads/develop 8841aea52 -> 2b6337d5e


move drop/create indexes and initialise connection to separate initialise() and shutdown methods to avoid dropping indexes for every file


Project: http://git-wip-us.apache.org/repos/asf/marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/marmotta/commit/e4a9abdc
Tree: http://git-wip-us.apache.org/repos/asf/marmotta/tree/e4a9abdc
Diff: http://git-wip-us.apache.org/repos/asf/marmotta/diff/e4a9abdc

Branch: refs/heads/develop
Commit: e4a9abdc0245ebbd52a6c728b648dfd41b46a604
Parents: 70b4146
Author: Sebastian Schaffert <ss...@apache.org>
Authored: Tue Nov 26 10:03:26 2013 +0100
Committer: Sebastian Schaffert <ss...@apache.org>
Committed: Tue Nov 26 10:03:26 2013 +0100

----------------------------------------------------------------------
 .../apache/marmotta/kiwi/loader/KiWiLoader.java | 45 ++++++++------
 .../kiwi/loader/generic/KiWiBatchHandler.java   | 53 ++++++++++------
 .../kiwi/loader/generic/KiWiHandler.java        | 31 ++++++++--
 .../kiwi/loader/mysql/MySQLLoadUtil.java        | 63 +++++++++++++-------
 .../marmotta/kiwi/loader/pgsql/PGCopyUtil.java  | 63 +++++++++++++-------
 .../marmotta/kiwi/loader/KiWiLoaderTest.java    |  7 ++-
 6 files changed, 171 insertions(+), 91 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/marmotta/blob/e4a9abdc/libraries/kiwi/kiwi-loader/src/main/java/org/apache/marmotta/kiwi/loader/KiWiLoader.java
----------------------------------------------------------------------
diff --git a/libraries/kiwi/kiwi-loader/src/main/java/org/apache/marmotta/kiwi/loader/KiWiLoader.java b/libraries/kiwi/kiwi-loader/src/main/java/org/apache/marmotta/kiwi/loader/KiWiLoader.java
index 2bdbddb..9543806 100644
--- a/libraries/kiwi/kiwi-loader/src/main/java/org/apache/marmotta/kiwi/loader/KiWiLoader.java
+++ b/libraries/kiwi/kiwi-loader/src/main/java/org/apache/marmotta/kiwi/loader/KiWiLoader.java
@@ -128,6 +128,7 @@ public class KiWiLoader {
 
     protected KiWiStore store;
     protected SailRepository repository;
+    protected KiWiHandler handler;
 
     public KiWiLoader(KiWiConfiguration kiwi, String baseUri, String context) {
         this.kiwi = kiwi;
@@ -327,6 +328,9 @@ public class KiWiLoader {
         } catch (RepositoryException e) {
             log.error("Sesame-Exception: {}", e.getMessage(), e);
             System.exit(2);
+        } catch (RDFHandlerException e) {
+            log.error("RDFHandler-Exception: {}", e.getMessage(), e);
+            System.exit(3);
         }
     }
 
@@ -344,23 +348,6 @@ public class KiWiLoader {
      */
     public void load(InputStream inStream, RDFFormat forFileName) throws RDFParseException, IOException {
         try {
-            KiWiLoaderConfiguration config = new KiWiLoaderConfiguration();
-            if (context != null) {
-                config.setContext(context);
-            }
-            config.setStatistics(isStatisticsEnabled);
-            config.setStatisticsGraph(statisticsGraph);
-
-            KiWiHandler handler;
-            if(kiwi.getDialect() instanceof PostgreSQLDialect) {
-                config.setCommitBatchSize(100000);
-                handler = new KiWiPostgresHandler(store,config);
-            } else if(kiwi.getDialect() instanceof MySQLDialect) {
-                config.setCommitBatchSize(100000);
-                handler = new KiWiMySQLHandler(store,config);
-            } else {
-                handler = new KiWiHandler(store,config);
-            }
 
             RDFParser parser = Rio.createParser(forFileName);
             parser.setRDFHandler(handler);
@@ -394,10 +381,11 @@ public class KiWiLoader {
      * Shutdown the Repository, close all database connections.
      * @throws RepositoryException
      */
-    public synchronized void shutdown() throws RepositoryException {
+    public synchronized void shutdown() throws RepositoryException, RDFHandlerException {
         if (repository == null || !repository.isInitialized()) {
             throw new IllegalStateException("repository was not initialized!");
         }
+        handler.shutdown();
         repository.shutDown();
         repository = null;
     }
@@ -424,7 +412,7 @@ public class KiWiLoader {
      * Initialize the KiWiStore, connect to the database.
      * @throws RepositoryException
      */
-    public synchronized void initialize() throws RepositoryException {
+    public synchronized void initialize() throws RepositoryException, RDFHandlerException {
         if (repository != null && repository.isInitialized()) {
             throw new IllegalStateException("repository already initialized");
         }
@@ -433,6 +421,25 @@ public class KiWiLoader {
 
         repository = new SailRepository(store);
         repository.initialize();
+
+
+        KiWiLoaderConfiguration config = new KiWiLoaderConfiguration();
+        if (context != null) {
+            config.setContext(context);
+        }
+        config.setStatistics(isStatisticsEnabled);
+        config.setStatisticsGraph(statisticsGraph);
+
+        if(kiwi.getDialect() instanceof PostgreSQLDialect) {
+            config.setCommitBatchSize(100000);
+            handler = new KiWiPostgresHandler(store,config);
+        } else if(kiwi.getDialect() instanceof MySQLDialect) {
+            config.setCommitBatchSize(100000);
+            handler = new KiWiMySQLHandler(store,config);
+        } else {
+            handler = new KiWiHandler(store,config);
+        }
+        handler.initialise();
     }
 
     private static String getPassword(CommandLine cmd, String jdbc, String user, String password) throws ParseException {

http://git-wip-us.apache.org/repos/asf/marmotta/blob/e4a9abdc/libraries/kiwi/kiwi-loader/src/main/java/org/apache/marmotta/kiwi/loader/generic/KiWiBatchHandler.java
----------------------------------------------------------------------
diff --git a/libraries/kiwi/kiwi-loader/src/main/java/org/apache/marmotta/kiwi/loader/generic/KiWiBatchHandler.java b/libraries/kiwi/kiwi-loader/src/main/java/org/apache/marmotta/kiwi/loader/generic/KiWiBatchHandler.java
index 8e12416..3448d77 100644
--- a/libraries/kiwi/kiwi-loader/src/main/java/org/apache/marmotta/kiwi/loader/generic/KiWiBatchHandler.java
+++ b/libraries/kiwi/kiwi-loader/src/main/java/org/apache/marmotta/kiwi/loader/generic/KiWiBatchHandler.java
@@ -71,9 +71,42 @@ public abstract class KiWiBatchHandler extends KiWiHandler implements RDFHandler
         this.backend = backend;
     }
 
+
     /**
+     * Perform initialisation, e.g. dropping indexes or other preparations.
+     */
+    @Override
+    public void initialise() throws RDFHandlerException {
+        super.initialise();
+
+        if(config.isDropIndexes()) {
+            try {
+                log.info("{}: dropping indexes before import", backend);
+                dropIndexes();
+                connection.commit();
+            } catch (SQLException e) {
+                throw new RDFHandlerException("error while dropping indexes", e);
+            }
+        }
+    }
 
-     /**
+    /**
+     * Peform cleanup on shutdown, e.g. re-creating indexes after import completed
+     */
+    @Override
+    public void shutdown() throws RDFHandlerException {
+        if(config.isDropIndexes()) {
+            try {
+                log.info("{}: re-creating indexes after import", backend);
+                createIndexes();
+                connection.commit();
+            } catch (SQLException e) {
+                throw new RDFHandlerException("error while dropping indexes", e);
+            }
+        }
+    }
+
+    /**
      * Signals the start of the RDF data. This method is called before any data
      * is reported.
      *
@@ -92,15 +125,6 @@ public abstract class KiWiBatchHandler extends KiWiHandler implements RDFHandler
 
         super.startRDF();
 
-        if(config.isDropIndexes()) {
-            try {
-                log.info("{}: dropping indexes before import", backend);
-                dropIndexes();
-                connection.commit();
-            } catch (SQLException e) {
-                throw new RDFHandlerException("error while dropping indexes", e);
-            }
-        }
     }
 
 
@@ -119,15 +143,6 @@ public abstract class KiWiBatchHandler extends KiWiHandler implements RDFHandler
             throw new RDFHandlerException(e);
         }
 
-        if(config.isDropIndexes()) {
-            try {
-                log.info("{}: re-creating indexes after import", backend);
-                createIndexes();
-                connection.commit();
-            } catch (SQLException e) {
-                throw new RDFHandlerException("error while dropping indexes", e);
-            }
-        }
 
         super.endRDF();
 

http://git-wip-us.apache.org/repos/asf/marmotta/blob/e4a9abdc/libraries/kiwi/kiwi-loader/src/main/java/org/apache/marmotta/kiwi/loader/generic/KiWiHandler.java
----------------------------------------------------------------------
diff --git a/libraries/kiwi/kiwi-loader/src/main/java/org/apache/marmotta/kiwi/loader/generic/KiWiHandler.java b/libraries/kiwi/kiwi-loader/src/main/java/org/apache/marmotta/kiwi/loader/generic/KiWiHandler.java
index 03704e2..8eaa151 100644
--- a/libraries/kiwi/kiwi-loader/src/main/java/org/apache/marmotta/kiwi/loader/generic/KiWiHandler.java
+++ b/libraries/kiwi/kiwi-loader/src/main/java/org/apache/marmotta/kiwi/loader/generic/KiWiHandler.java
@@ -113,6 +113,31 @@ public class KiWiHandler implements RDFHandler {
 
     }
 
+
+    /**
+     * Perform initialisation, e.g. dropping indexes or other preparations.
+     */
+    public void initialise() throws RDFHandlerException {
+        try {
+            this.connection = store.getPersistence().getConnection();
+        } catch (SQLException e) {
+            throw new RDFHandlerException(e);
+        }
+    }
+
+
+    /**
+     * Peform cleanup on shutdown, e.g. re-creating indexes after import completed
+     */
+    public void shutdown() throws RDFHandlerException {
+        try {
+            connection.close();
+        } catch (SQLException e) {
+            throw new RDFHandlerException(e);
+        }
+
+    }
+
     /**
      * Signals the end of the RDF data. This method is called when all data has
      * been reported.
@@ -129,7 +154,6 @@ public class KiWiHandler implements RDFHandler {
 
         try {
             connection.commit();
-            connection.close();
         } catch (SQLException e) {
             throw new RDFHandlerException(e);
         }
@@ -147,11 +171,6 @@ public class KiWiHandler implements RDFHandler {
     @Override
     public void startRDF() throws RDFHandlerException {
         log.info("KiWiLoader: starting RDF bulk import");
-        try {
-            this.connection = store.getPersistence().getConnection();
-        } catch (SQLException e) {
-            throw new RDFHandlerException(e);
-        }
 
         this.start = System.currentTimeMillis();
         this.previous = System.currentTimeMillis();

http://git-wip-us.apache.org/repos/asf/marmotta/blob/e4a9abdc/libraries/kiwi/kiwi-loader/src/main/java/org/apache/marmotta/kiwi/loader/mysql/MySQLLoadUtil.java
----------------------------------------------------------------------
diff --git a/libraries/kiwi/kiwi-loader/src/main/java/org/apache/marmotta/kiwi/loader/mysql/MySQLLoadUtil.java b/libraries/kiwi/kiwi-loader/src/main/java/org/apache/marmotta/kiwi/loader/mysql/MySQLLoadUtil.java
index 43cb3c0..26a47b8 100644
--- a/libraries/kiwi/kiwi-loader/src/main/java/org/apache/marmotta/kiwi/loader/mysql/MySQLLoadUtil.java
+++ b/libraries/kiwi/kiwi-loader/src/main/java/org/apache/marmotta/kiwi/loader/mysql/MySQLLoadUtil.java
@@ -108,14 +108,24 @@ public class MySQLLoadUtil {
     public static InputStream flushTriples(Iterable<KiWiTriple> tripleBacklog) throws IOException {
         StringWriter out = new StringWriter();
         CsvListWriter writer = new CsvListWriter(out, CsvPreference.STANDARD_PREFERENCE);
-        for(KiWiTriple t : tripleBacklog) {
-            List<Object> row = Arrays.<Object>asList(
-                    t.getId(), t.getSubject(), t.getPredicate(), t.getObject(), t.getContext(), t.getCreator(), t.isInferred(), t.isDeleted(), t.getCreated(), t.getDeletedAt()
-            );
 
-            if(row != null) {
-                writer.write(row, tripleProcessors);
-            }
+        // reuse the same array to avoid unnecessary object allocation
+        Object[] rowArray = new Object[10];
+        List<Object> row = Arrays.asList(rowArray);
+
+        for(KiWiTriple t : tripleBacklog) {
+            rowArray[0] = t.getId();
+            rowArray[1] = t.getSubject();
+            rowArray[2] = t.getPredicate();
+            rowArray[3] = t.getObject();
+            rowArray[4] = t.getContext();
+            rowArray[5] = t.getCreator();
+            rowArray[6] = t.isInferred();
+            rowArray[7] = t.isDeleted();
+            rowArray[8] = t.getCreated();
+            rowArray[9] = t.getDeletedAt();
+
+            writer.write(row, tripleProcessors);
         }
         writer.close();
 
@@ -127,46 +137,55 @@ public class MySQLLoadUtil {
     public static InputStream flushNodes(Iterable<KiWiNode> nodeBacklog) throws IOException {
         StringWriter out = new StringWriter();
         CsvListWriter writer = new CsvListWriter(out, nodesPreference);
+
+        // reuse the same array to avoid unnecessary object allocation
+        Object[] rowArray = new Object[10];
+        List<Object> row = Arrays.asList(rowArray);
+
         for(KiWiNode n : nodeBacklog) {
-            List<Object> row = null;
             if(n instanceof KiWiUriResource) {
                 KiWiUriResource u = (KiWiUriResource)n;
-                row = createNodeList(u.getId(), u.getClass(), u.stringValue(), null, null, null, null, null, null, u.getCreated());
+                createNodeList(rowArray, u.getId(), u.getClass(), u.stringValue(), null, null, null, null, null, null, u.getCreated());
             } else if(n instanceof KiWiAnonResource) {
                 KiWiAnonResource a = (KiWiAnonResource)n;
-                row = createNodeList(a.getId(), a.getClass(), a.stringValue(), null, null, null, null, null, null, a.getCreated());
+                createNodeList(rowArray, a.getId(), a.getClass(), a.stringValue(), null, null, null, null, null, null, a.getCreated());
             } else if(n instanceof KiWiIntLiteral) {
                 KiWiIntLiteral l = (KiWiIntLiteral)n;
-                row = createNodeList(l.getId(), l.getClass(), l.getContent(), l.getDoubleContent(), l.getIntContent(), null, null, l.getDatatype(), l.getLocale(), l.getCreated());
+                createNodeList(rowArray, l.getId(), l.getClass(), l.getContent(), l.getDoubleContent(), l.getIntContent(), null, null, l.getDatatype(), l.getLocale(), l.getCreated());
             } else if(n instanceof KiWiDoubleLiteral) {
                 KiWiDoubleLiteral l = (KiWiDoubleLiteral)n;
-                row = createNodeList(l.getId(), l.getClass(), l.getContent(), l.getDoubleContent(), null, null, null, l.getDatatype(), l.getLocale(), l.getCreated());
+                createNodeList(rowArray, l.getId(), l.getClass(), l.getContent(), l.getDoubleContent(), null, null, null, l.getDatatype(), l.getLocale(), l.getCreated());
             } else if(n instanceof KiWiBooleanLiteral) {
                 KiWiBooleanLiteral l = (KiWiBooleanLiteral)n;
-                row = createNodeList(l.getId(), l.getClass(), l.getContent(), null, null, null, l.booleanValue(), l.getDatatype(), l.getLocale(), l.getCreated());
+                createNodeList(rowArray, l.getId(), l.getClass(), l.getContent(), null, null, null, l.booleanValue(), l.getDatatype(), l.getLocale(), l.getCreated());
             } else if(n instanceof KiWiDateLiteral) {
                 KiWiDateLiteral l = (KiWiDateLiteral)n;
-                row = createNodeList(l.getId(), l.getClass(), l.getContent(), null, null, l.getDateContent(), null, l.getDatatype(), l.getLocale(), l.getCreated());
+                createNodeList(rowArray, l.getId(), l.getClass(), l.getContent(), null, null, l.getDateContent(), null, l.getDatatype(), l.getLocale(), l.getCreated());
             } else if(n instanceof KiWiStringLiteral) {
                 KiWiStringLiteral l = (KiWiStringLiteral)n;
-                row = createNodeList(l.getId(), l.getClass(), l.getContent(), null, null, null, null, l.getDatatype(), l.getLocale(), l.getCreated());
+                createNodeList(rowArray, l.getId(), l.getClass(), l.getContent(), null, null, null, null, l.getDatatype(), l.getLocale(), l.getCreated());
             } else {
                 log.warn("unknown node type, cannot flush to import stream: {}", n.getClass());
             }
 
-            if(row != null) {
-                writer.write(row, nodeProcessors);
-            }
+            writer.write(row, nodeProcessors);
         }
         writer.close();
 
         return IOUtils.toInputStream(out.toString());
     }
 
-    private static List<Object> createNodeList(Long id, Class type, String content, Double dbl, Long lng, Date date, Boolean bool, URI dtype, Locale lang, Date created) {
-        return Arrays.asList(new Object[]{
-                id, type, content, dbl, lng, date, bool, dtype, lang, created
-        });
+    private static void createNodeList(Object[] a, Long id, Class type, String content, Double dbl, Long lng, Date date, Boolean bool, URI dtype, Locale lang, Date created) {
+        a[0] = id;
+        a[1] = type;
+        a[2] = content;
+        a[3] = dbl;
+        a[4] = lng;
+        a[5] = date;
+        a[6] = bool;
+        a[7] = dtype;
+        a[8] = lang;
+        a[9] = created;
     }
 
 }

http://git-wip-us.apache.org/repos/asf/marmotta/blob/e4a9abdc/libraries/kiwi/kiwi-loader/src/main/java/org/apache/marmotta/kiwi/loader/pgsql/PGCopyUtil.java
----------------------------------------------------------------------
diff --git a/libraries/kiwi/kiwi-loader/src/main/java/org/apache/marmotta/kiwi/loader/pgsql/PGCopyUtil.java b/libraries/kiwi/kiwi-loader/src/main/java/org/apache/marmotta/kiwi/loader/pgsql/PGCopyUtil.java
index 2631258..3cf6448 100644
--- a/libraries/kiwi/kiwi-loader/src/main/java/org/apache/marmotta/kiwi/loader/pgsql/PGCopyUtil.java
+++ b/libraries/kiwi/kiwi-loader/src/main/java/org/apache/marmotta/kiwi/loader/pgsql/PGCopyUtil.java
@@ -106,14 +106,24 @@ public class PGCopyUtil {
 
     public static void flushTriples(Iterable<KiWiTriple> tripleBacklog, OutputStream out) throws IOException {
         CsvListWriter writer = new CsvListWriter(new OutputStreamWriter(out), CsvPreference.STANDARD_PREFERENCE);
-        for(KiWiTriple t : tripleBacklog) {
-            List<Object> row = Arrays.<Object>asList(
-                    t.getId(), t.getSubject(), t.getPredicate(), t.getObject(), t.getContext(), t.getCreator(), t.isInferred(), t.isDeleted(), t.getCreated(), t.getDeletedAt()
-            );
 
-            if(row != null) {
-                writer.write(row, tripleProcessors);
-            }
+        // reuse the same array to avoid unnecessary object allocation
+        Object[] rowArray = new Object[10];
+        List<Object> row = Arrays.asList(rowArray);
+
+        for(KiWiTriple t : tripleBacklog) {
+            rowArray[0] = t.getId();
+            rowArray[1] = t.getSubject();
+            rowArray[2] = t.getPredicate();
+            rowArray[3] = t.getObject();
+            rowArray[4] = t.getContext();
+            rowArray[5] = t.getCreator();
+            rowArray[6] = t.isInferred();
+            rowArray[7] = t.isDeleted();
+            rowArray[8] = t.getCreated();
+            rowArray[9] = t.getDeletedAt();
+
+            writer.write(row, tripleProcessors);
         }
         writer.close();
     }
@@ -122,43 +132,52 @@ public class PGCopyUtil {
 
     public static void flushNodes(Iterable<KiWiNode> nodeBacklog, OutputStream out) throws IOException {
         CsvListWriter writer = new CsvListWriter(new OutputStreamWriter(out), nodesPreference);
+
+        // reuse the same array to avoid unnecessary object allocation
+        Object[] rowArray = new Object[10];
+        List<Object> row = Arrays.asList(rowArray);
+
         for(KiWiNode n : nodeBacklog) {
-            List<Object> row = null;
             if(n instanceof KiWiUriResource) {
                 KiWiUriResource u = (KiWiUriResource)n;
-                row = createNodeList(u.getId(), u.getClass(), u.stringValue(), null, null, null, null, null, null, u.getCreated());
+                createNodeList(rowArray, u.getId(), u.getClass(), u.stringValue(), null, null, null, null, null, null, u.getCreated());
             } else if(n instanceof KiWiAnonResource) {
                 KiWiAnonResource a = (KiWiAnonResource)n;
-                row = createNodeList(a.getId(), a.getClass(), a.stringValue(), null, null, null, null, null, null, a.getCreated());
+                createNodeList(rowArray, a.getId(), a.getClass(), a.stringValue(), null, null, null, null, null, null, a.getCreated());
             } else if(n instanceof KiWiIntLiteral) {
                 KiWiIntLiteral l = (KiWiIntLiteral)n;
-                row = createNodeList(l.getId(), l.getClass(), l.getContent(), l.getDoubleContent(), l.getIntContent(), null, null, l.getDatatype(), l.getLocale(), l.getCreated());
+                createNodeList(rowArray, l.getId(), l.getClass(), l.getContent(), l.getDoubleContent(), l.getIntContent(), null, null, l.getDatatype(), l.getLocale(), l.getCreated());
             } else if(n instanceof KiWiDoubleLiteral) {
                 KiWiDoubleLiteral l = (KiWiDoubleLiteral)n;
-                row = createNodeList(l.getId(), l.getClass(), l.getContent(), l.getDoubleContent(), null, null, null, l.getDatatype(), l.getLocale(), l.getCreated());
+                createNodeList(rowArray, l.getId(), l.getClass(), l.getContent(), l.getDoubleContent(), null, null, null, l.getDatatype(), l.getLocale(), l.getCreated());
             } else if(n instanceof KiWiBooleanLiteral) {
                 KiWiBooleanLiteral l = (KiWiBooleanLiteral)n;
-                row = createNodeList(l.getId(), l.getClass(), l.getContent(), null, null, null, l.booleanValue(), l.getDatatype(), l.getLocale(), l.getCreated());
+                createNodeList(rowArray, l.getId(), l.getClass(), l.getContent(), null, null, null, l.booleanValue(), l.getDatatype(), l.getLocale(), l.getCreated());
             } else if(n instanceof KiWiDateLiteral) {
                 KiWiDateLiteral l = (KiWiDateLiteral)n;
-                row = createNodeList(l.getId(), l.getClass(), l.getContent(), null, null, l.getDateContent(), null, l.getDatatype(), l.getLocale(), l.getCreated());
+                createNodeList(rowArray, l.getId(), l.getClass(), l.getContent(), null, null, l.getDateContent(), null, l.getDatatype(), l.getLocale(), l.getCreated());
             } else if(n instanceof KiWiStringLiteral) {
                 KiWiStringLiteral l = (KiWiStringLiteral)n;
-                row = createNodeList(l.getId(), l.getClass(), l.getContent(), null, null, null, null, l.getDatatype(), l.getLocale(), l.getCreated());
+                createNodeList(rowArray, l.getId(), l.getClass(), l.getContent(), null, null, null, null, l.getDatatype(), l.getLocale(), l.getCreated());
             } else {
                 log.warn("unknown node type, cannot flush to import stream: {}", n.getClass());
             }
 
-            if(row != null) {
-                writer.write(row, nodeProcessors);
-            }
+            writer.write(row, nodeProcessors);
         }
         writer.close();
     }
 
-    private static List<Object> createNodeList(Long id, Class type, String content, Double dbl, Long lng, Date date, Boolean bool, URI dtype, Locale lang, Date created) {
-        return Arrays.asList(new Object[]{
-                id, type, content, dbl, lng, date, bool, dtype, lang, created
-        });
+    private static void createNodeList(Object[] a, Long id, Class type, String content, Double dbl, Long lng, Date date, Boolean bool, URI dtype, Locale lang, Date created) {
+        a[0] = id;
+        a[1] = type;
+        a[2] = content;
+        a[3] = dbl;
+        a[4] = lng;
+        a[5] = date;
+        a[6] = bool;
+        a[7] = dtype;
+        a[8] = lang;
+        a[9] = created;
     }
 }

http://git-wip-us.apache.org/repos/asf/marmotta/blob/e4a9abdc/libraries/kiwi/kiwi-loader/src/test/java/org/apache/marmotta/kiwi/loader/KiWiLoaderTest.java
----------------------------------------------------------------------
diff --git a/libraries/kiwi/kiwi-loader/src/test/java/org/apache/marmotta/kiwi/loader/KiWiLoaderTest.java b/libraries/kiwi/kiwi-loader/src/test/java/org/apache/marmotta/kiwi/loader/KiWiLoaderTest.java
index 86c31f1..8896e58 100644
--- a/libraries/kiwi/kiwi-loader/src/test/java/org/apache/marmotta/kiwi/loader/KiWiLoaderTest.java
+++ b/libraries/kiwi/kiwi-loader/src/test/java/org/apache/marmotta/kiwi/loader/KiWiLoaderTest.java
@@ -17,6 +17,7 @@ import org.openrdf.repository.Repository;
 import org.openrdf.repository.RepositoryConnection;
 import org.openrdf.repository.RepositoryException;
 import org.openrdf.rio.RDFFormat;
+import org.openrdf.rio.RDFHandlerException;
 import org.openrdf.rio.RDFParseException;
 
 import java.io.File;
@@ -105,7 +106,7 @@ public class KiWiLoaderTest {
 
     @Test
     public void testLoadFile() throws RepositoryException, RDFParseException,
-            IOException {
+            IOException, RDFHandlerException {
         KiWiTestLoader loader = new KiWiTestLoader(getKiWiConfig(),
                 "http://example.com/test/", null);
         loader.initialize();
@@ -128,7 +129,7 @@ public class KiWiLoaderTest {
 
     @Test
     public void testLoadFile_GZ() throws RepositoryException, RDFParseException,
-            IOException {
+            IOException, RDFHandlerException {
         File gz = temp.newFile(dataFile.getName() + ".gz");
         OutputStream os = new GZIPOutputStream(new FileOutputStream(gz));
         FileInputStream is = new FileInputStream(dataFile);
@@ -175,7 +176,7 @@ public class KiWiLoaderTest {
     }
 
     @Test
-    public void testLoadInputStream() throws RepositoryException, RDFParseException, IOException {
+    public void testLoadInputStream() throws RepositoryException, RDFParseException, IOException, RDFHandlerException {
         KiWiTestLoader loader = new KiWiTestLoader(getKiWiConfig(),
                 "http://example.com/test/", null);
         loader.initialize();


[2/3] git commit: merge conflicts

Posted by ss...@apache.org.
merge conflicts


Project: http://git-wip-us.apache.org/repos/asf/marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/marmotta/commit/5fd62839
Tree: http://git-wip-us.apache.org/repos/asf/marmotta/tree/5fd62839
Diff: http://git-wip-us.apache.org/repos/asf/marmotta/diff/5fd62839

Branch: refs/heads/develop
Commit: 5fd6283905ad3da6009fa7a58825b98da1c26fe7
Parents: e4a9abd 8841aea
Author: Sebastian Schaffert <ss...@apache.org>
Authored: Tue Nov 26 10:06:35 2013 +0100
Committer: Sebastian Schaffert <ss...@apache.org>
Committed: Tue Nov 26 10:06:35 2013 +0100

----------------------------------------------------------------------
 .../apache/marmotta/kiwi/loader/KiWiLoader.java | 162 ++++++++++---------
 .../marmotta/kiwi/loader/KiWiLoaderTest.java    |  33 +++-
 2 files changed, 118 insertions(+), 77 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/marmotta/blob/5fd62839/libraries/kiwi/kiwi-loader/src/main/java/org/apache/marmotta/kiwi/loader/KiWiLoader.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/marmotta/blob/5fd62839/libraries/kiwi/kiwi-loader/src/test/java/org/apache/marmotta/kiwi/loader/KiWiLoaderTest.java
----------------------------------------------------------------------
diff --cc libraries/kiwi/kiwi-loader/src/test/java/org/apache/marmotta/kiwi/loader/KiWiLoaderTest.java
index 8896e58,80279e4..d9a02a6
--- a/libraries/kiwi/kiwi-loader/src/test/java/org/apache/marmotta/kiwi/loader/KiWiLoaderTest.java
+++ b/libraries/kiwi/kiwi-loader/src/test/java/org/apache/marmotta/kiwi/loader/KiWiLoaderTest.java
@@@ -105,14 -104,10 +105,12 @@@ public class KiWiLoaderTest 
      }
  
      @Test
 -    public void testLoadFile() throws RepositoryException, RDFParseException, IOException {
 -        KiWiTestLoader loader = new KiWiTestLoader(getKiWiConfig(), "http://example.com/test/", null);
 +    public void testLoadFile() throws RepositoryException, RDFParseException,
 +            IOException, RDFHandlerException {
 +        KiWiTestLoader loader = new KiWiTestLoader(getKiWiConfig(),
 +                "http://example.com/test/", null);
          loader.initialize();
- 
          loader.load(dataFile.getAbsolutePath(), RDFFormat.RDFXML, false);
- 
          final RepositoryConnection con = loader.getRepository().getConnection();
          try {
              con.begin();


[3/3] git commit: merge conflicts

Posted by ss...@apache.org.
merge conflicts


Project: http://git-wip-us.apache.org/repos/asf/marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/marmotta/commit/2b6337d5
Tree: http://git-wip-us.apache.org/repos/asf/marmotta/tree/2b6337d5
Diff: http://git-wip-us.apache.org/repos/asf/marmotta/diff/2b6337d5

Branch: refs/heads/develop
Commit: 2b6337d5e79ce8d9f5aaa57954c369af377d211e
Parents: 5fd6283
Author: Sebastian Schaffert <ss...@apache.org>
Authored: Tue Nov 26 10:07:01 2013 +0100
Committer: Sebastian Schaffert <ss...@apache.org>
Committed: Tue Nov 26 10:07:01 2013 +0100

----------------------------------------------------------------------
 .../apache/marmotta/kiwi/loader/KiWiLoader.java | 24 +++++++++++++++++---
 .../marmotta/kiwi/loader/KiWiLoaderTest.java    |  3 +--
 2 files changed, 22 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/marmotta/blob/2b6337d5/libraries/kiwi/kiwi-loader/src/main/java/org/apache/marmotta/kiwi/loader/KiWiLoader.java
----------------------------------------------------------------------
diff --git a/libraries/kiwi/kiwi-loader/src/main/java/org/apache/marmotta/kiwi/loader/KiWiLoader.java b/libraries/kiwi/kiwi-loader/src/main/java/org/apache/marmotta/kiwi/loader/KiWiLoader.java
index ece8b90..f317079 100644
--- a/libraries/kiwi/kiwi-loader/src/main/java/org/apache/marmotta/kiwi/loader/KiWiLoader.java
+++ b/libraries/kiwi/kiwi-loader/src/main/java/org/apache/marmotta/kiwi/loader/KiWiLoader.java
@@ -17,7 +17,13 @@
  */
 package org.apache.marmotta.kiwi.loader;
 
-import org.apache.commons.cli.*;
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.CommandLineParser;
+import org.apache.commons.cli.HelpFormatter;
+import org.apache.commons.cli.Option;
+import org.apache.commons.cli.Options;
+import org.apache.commons.cli.ParseException;
+import org.apache.commons.cli.PosixParser;
 import org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream;
 import org.apache.commons.compress.compressors.gzip.GzipCompressorInputStream;
 import org.apache.commons.configuration.Configuration;
@@ -34,12 +40,24 @@ import org.apache.marmotta.kiwi.persistence.pgsql.PostgreSQLDialect;
 import org.apache.marmotta.kiwi.sail.KiWiStore;
 import org.openrdf.repository.RepositoryException;
 import org.openrdf.repository.sail.SailRepository;
-import org.openrdf.rio.*;
+import org.openrdf.rio.RDFFormat;
+import org.openrdf.rio.RDFHandlerException;
+import org.openrdf.rio.RDFParseException;
+import org.openrdf.rio.RDFParser;
+import org.openrdf.rio.Rio;
+import org.openrdf.rio.UnsupportedRDFormatException;
 import org.openrdf.rio.helpers.BasicParserSettings;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.io.*;
+import java.io.BufferedInputStream;
+import java.io.Console;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.io.InputStream;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.regex.Pattern;

http://git-wip-us.apache.org/repos/asf/marmotta/blob/2b6337d5/libraries/kiwi/kiwi-loader/src/test/java/org/apache/marmotta/kiwi/loader/KiWiLoaderTest.java
----------------------------------------------------------------------
diff --git a/libraries/kiwi/kiwi-loader/src/test/java/org/apache/marmotta/kiwi/loader/KiWiLoaderTest.java b/libraries/kiwi/kiwi-loader/src/test/java/org/apache/marmotta/kiwi/loader/KiWiLoaderTest.java
index d9a02a6..86a913e 100644
--- a/libraries/kiwi/kiwi-loader/src/test/java/org/apache/marmotta/kiwi/loader/KiWiLoaderTest.java
+++ b/libraries/kiwi/kiwi-loader/src/test/java/org/apache/marmotta/kiwi/loader/KiWiLoaderTest.java
@@ -29,7 +29,6 @@ import java.util.Properties;
 import java.util.zip.GZIPOutputStream;
 
 import static org.hamcrest.CoreMatchers.containsString;
-import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertThat;
 import static org.junit.Assert.assertTrue;
 
@@ -204,7 +203,7 @@ public class KiWiLoaderTest {
     }
 
     @Test
-    public void testLoadFileFromDirectory() throws RepositoryException, RDFParseException, IOException {
+    public void testLoadFileFromDirectory() throws RepositoryException, RDFParseException, IOException, RDFHandlerException {
         KiWiTestLoader loader = new KiWiTestLoader(getKiWiConfig(), "http://example.com/test/", null);
         loader.initialize();
         loader.load(dataFile.getParent(), RDFFormat.RDFXML, false);