You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@any23.apache.org by an...@apache.org on 2013/06/26 02:19:48 UTC

[01/24] git commit: add changes since beta2

Updated Branches:
  refs/heads/master 0f067f1f9 -> 78754675a


add changes since beta2


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

Branch: refs/heads/master
Commit: 8f825099c738899b65b2e700f2e3b8135a460db2
Parents: 79ac93f
Author: Peter Ansell <p_...@yahoo.com>
Authored: Fri Apr 19 13:31:50 2013 +1000
Committer: Peter Ansell <p_...@yahoo.com>
Committed: Wed Jun 26 10:06:32 2013 +1000

----------------------------------------------------------------------
 .../any23/rdf/Any23ValueFactoryWrapper.java     |  5 -----
 .../apache/any23/io/nquads/NQuadsParser.java    |  7 ++++---
 .../apache/any23/io/nquads/NQuadsWriter.java    | 20 +++++++++++++++++++-
 pom.xml                                         |  4 ++--
 4 files changed, 25 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/any23/blob/8f825099/core/src/main/java/org/apache/any23/rdf/Any23ValueFactoryWrapper.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/any23/rdf/Any23ValueFactoryWrapper.java b/core/src/main/java/org/apache/any23/rdf/Any23ValueFactoryWrapper.java
index 4db8629..d601d68 100644
--- a/core/src/main/java/org/apache/any23/rdf/Any23ValueFactoryWrapper.java
+++ b/core/src/main/java/org/apache/any23/rdf/Any23ValueFactoryWrapper.java
@@ -149,11 +149,6 @@ public class Any23ValueFactoryWrapper implements ValueFactory {
         return wrappedFactory.createLiteral(date);
     }
 
-    @Override
-    public Literal createLiteral(Object object) {
-        return wrappedFactory.createLiteral(object);
-    }
-
     public Statement createStatement(Resource sub, URI pre, Value obj) {
         if (sub == null || pre == null || obj == null) {
             return null;

http://git-wip-us.apache.org/repos/asf/any23/blob/8f825099/nquads/src/main/java/org/apache/any23/io/nquads/NQuadsParser.java
----------------------------------------------------------------------
diff --git a/nquads/src/main/java/org/apache/any23/io/nquads/NQuadsParser.java b/nquads/src/main/java/org/apache/any23/io/nquads/NQuadsParser.java
index ba484ba..485d5cb 100644
--- a/nquads/src/main/java/org/apache/any23/io/nquads/NQuadsParser.java
+++ b/nquads/src/main/java/org/apache/any23/io/nquads/NQuadsParser.java
@@ -29,6 +29,7 @@ import org.openrdf.rio.RDFFormat;
 import org.openrdf.rio.RDFHandler;
 import org.openrdf.rio.RDFHandlerException;
 import org.openrdf.rio.RDFParseException;
+import org.openrdf.rio.helpers.NTriplesParserSettings;
 import org.openrdf.rio.helpers.RDFParserBase;
 import org.openrdf.rio.ntriples.NTriplesUtil;
 
@@ -170,7 +171,7 @@ public class NQuadsParser extends RDFParserBase {
         try {
             return (char) Integer.parseInt(unicodeCharStr, 16);
         } catch (NumberFormatException nfe) {
-            reportError("Error while converting unicode char '\\u" + unicodeCharStr + "'", row, col);
+            reportError("Error while converting unicode char '\\u" + unicodeCharStr + "'", row, col, NTriplesParserSettings.IGNORE_NTRIPLES_INVALID_LINES);
             throw new IllegalStateException();
         }
     }
@@ -280,7 +281,7 @@ public class NQuadsParser extends RDFParserBase {
                     throw new RDFParseException(e, row, col);
             } else { // Remove rest of broken line and report error.
                 consumeBrokenLine(br);
-                reportError(e.getMessage(), row, col);
+                reportError(e.getMessage(), row, col, NTriplesParserSettings.IGNORE_NTRIPLES_INVALID_LINES);
                 return true;
             }
         }
@@ -636,7 +637,7 @@ public class NQuadsParser extends RDFParserBase {
             try {
                 literalType = new URIImpl(lt.value);
             } catch (Exception e) {
-                reportError( String.format("Error while parsing literal type '%s'", lt.value), row, col );
+                reportError( String.format("Error while parsing literal type '%s'", lt.value), row, col , NTriplesParserSettings.IGNORE_NTRIPLES_INVALID_LINES);
             }
             return createLiteral(
                     validateAndNormalizeLiteral(value, literalType),

http://git-wip-us.apache.org/repos/asf/any23/blob/8f825099/nquads/src/main/java/org/apache/any23/io/nquads/NQuadsWriter.java
----------------------------------------------------------------------
diff --git a/nquads/src/main/java/org/apache/any23/io/nquads/NQuadsWriter.java b/nquads/src/main/java/org/apache/any23/io/nquads/NQuadsWriter.java
index 6f7abaf..6da59d4 100644
--- a/nquads/src/main/java/org/apache/any23/io/nquads/NQuadsWriter.java
+++ b/nquads/src/main/java/org/apache/any23/io/nquads/NQuadsWriter.java
@@ -26,14 +26,21 @@ import org.openrdf.model.Value;
 import org.openrdf.rio.RDFFormat;
 import org.openrdf.rio.RDFHandlerException;
 import org.openrdf.rio.RDFWriter;
+import org.openrdf.rio.RioSetting;
+import org.openrdf.rio.WriterConfig;
+import org.openrdf.rio.helpers.NTriplesParserSettings;
+import org.openrdf.rio.helpers.RDFWriterBase;
 import org.openrdf.rio.ntriples.NTriplesUtil;
 
 import java.io.IOException;
 import java.io.OutputStream;
 import java.io.OutputStreamWriter;
 import java.io.Writer;
+import java.util.Collection;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Map;
+import java.util.Set;
 
 /**
  * <i>N-Quads</i> implementation of an {@link org.openrdf.rio.RDFWriter}.
@@ -41,7 +48,7 @@ import java.util.Map;
  *
  * @author Michele Mostarda (mostarda@fbk.eu)
  */
-public class NQuadsWriter implements RDFWriter {
+public class NQuadsWriter extends RDFWriterBase implements RDFWriter {
 
     /**
      * The table maintaining namespaces.
@@ -58,6 +65,8 @@ public class NQuadsWriter implements RDFWriter {
      */
     private boolean started = false;
 
+    private WriterConfig writerConfig;
+
     public NQuadsWriter(OutputStream os) {
         this( new OutputStreamWriter(os) );
     }
@@ -270,4 +279,13 @@ public class NQuadsWriter implements RDFWriter {
         }
     }
 
+    @Override
+    public Collection<RioSetting<?>> getSupportedSettings() {
+        Set<RioSetting<?>> results = new HashSet<RioSetting<?>>(super.getSupportedSettings());
+        
+        results.add(NTriplesParserSettings.IGNORE_NTRIPLES_INVALID_LINES);
+        
+        return results;
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/any23/blob/8f825099/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 12ea7d2..70dc27e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -226,8 +226,8 @@
     <maven.build.timestamp.format>yyyy-MM-dd HH:mm:ssZ</maven.build.timestamp.format>
     <implementation.build>${scmBranch}@r${buildNumber}</implementation.build>
     <implementation.build.tstamp>${implementation.build}; ${maven.build.timestamp}</implementation.build.tstamp>
-    <slf4j.logger.version>1.7.2</slf4j.logger.version>
-    <sesame.version>2.7.0-beta2-SNAPSHOT</sesame.version>
+    <slf4j.logger.version>1.7.5</slf4j.logger.version>
+    <sesame.version>2.7.0</sesame.version>
     <latest.stable.released>0.7.0-incubating</latest.stable.released>
 
     <!-- Maven Plugin Versions -->


[03/24] git commit: modify N3 mimetype to match current W3C team submission

Posted by an...@apache.org.
modify N3 mimetype to match current W3C team submission


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

Branch: refs/heads/master
Commit: 79ac93f85a2a1f43e1a348c133fda77c27237894
Parents: 0619427
Author: Peter Ansell <p_...@yahoo.com>
Authored: Mon Jan 21 09:54:16 2013 +1000
Committer: Peter Ansell <p_...@yahoo.com>
Committed: Wed Jun 26 10:06:32 2013 +1000

----------------------------------------------------------------------
 mime/src/main/resources/org/apache/any23/mime/mimetypes.xml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/any23/blob/79ac93f8/mime/src/main/resources/org/apache/any23/mime/mimetypes.xml
----------------------------------------------------------------------
diff --git a/mime/src/main/resources/org/apache/any23/mime/mimetypes.xml b/mime/src/main/resources/org/apache/any23/mime/mimetypes.xml
index 0ef6e0c..f2e8457 100644
--- a/mime/src/main/resources/org/apache/any23/mime/mimetypes.xml
+++ b/mime/src/main/resources/org/apache/any23/mime/mimetypes.xml
@@ -25,8 +25,8 @@
 	<!-- BEGIN: Any23 Semantic Web document mime types. -->
 
 	<!-- N3 -->
-	<mime-type type="text/rdf+n3">
-		<alias type="text/n3" />
+	<mime-type type="text/n3">
+		<alias type="text/rdf+n3" />
 		<alias type="application/n3" />
 		<glob pattern="*.n3" />
 		<magic priority="50">


[10/24] git commit: add log4j properties file to nquads module

Posted by an...@apache.org.
add log4j properties file to nquads module


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

Branch: refs/heads/master
Commit: 5d69c946a46777484e750f27d8a56ae4549857dd
Parents: 2ad859a
Author: Peter Ansell <p_...@yahoo.com>
Authored: Wed Oct 24 13:52:22 2012 +1000
Committer: Peter Ansell <p_...@yahoo.com>
Committed: Wed Jun 26 10:08:05 2013 +1000

----------------------------------------------------------------------
 nquads/src/test/resources/log4j.properties | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/any23/blob/5d69c946/nquads/src/test/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/nquads/src/test/resources/log4j.properties b/nquads/src/test/resources/log4j.properties
index 4aa0d92..84062ba 100644
--- a/nquads/src/test/resources/log4j.properties
+++ b/nquads/src/test/resources/log4j.properties
@@ -1,3 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
 log4j.rootCategory=INFO, O  
       
 # Stdout  


[23/24] git commit: update some versions

Posted by an...@apache.org.
update some versions


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

Branch: refs/heads/master
Commit: 79338c058857ee187015f6bb2d1ff04e4514c543
Parents: 8efbee7
Author: Peter Ansell <p_...@yahoo.com>
Authored: Wed Jun 26 10:14:16 2013 +1000
Committer: Peter Ansell <p_...@yahoo.com>
Committed: Wed Jun 26 10:14:16 2013 +1000

----------------------------------------------------------------------
 pom.xml | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/any23/blob/79338c05/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index d2fbd1b..e69dbd7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -227,8 +227,8 @@
     <implementation.build>${scmBranch}@r${buildNumber}</implementation.build>
     <implementation.build.tstamp>${implementation.build}; ${maven.build.timestamp}</implementation.build.tstamp>
     <slf4j.logger.version>1.7.5</slf4j.logger.version>
-    <sesame.version>2.7.1-SNAPSHOT</sesame.version>
-    <latest.stable.released>0.7.0-incubating</latest.stable.released>
+    <sesame.version>2.7.2</sesame.version>
+    <latest.stable.released>0.8.0</latest.stable.released>
 
     <!-- Maven Plugin Versions -->
     <maven-javadoc-plugin.version>2.8</maven-javadoc-plugin.version>
@@ -242,7 +242,7 @@
     <buildnumber-maven-plugin.version>1.0</buildnumber-maven-plugin.version>
     <maven-compiler-plugin.version>2.5.1</maven-compiler-plugin.version>
     <maven-jar-plugin.version>2.3.1</maven-jar-plugin.version>
-    <maven-surefire-plugin.version>2.9</maven-surefire-plugin.version>
+    <maven-surefire-plugin.version>2.14.1</maven-surefire-plugin.version>
     <cobertura-maven-plugin.version>2.5.1</cobertura-maven-plugin.version>
     <maven-site-plugin.version>3.0</maven-site-plugin.version>
     <maven-changes-plugin.version>2.6</maven-changes-plugin.version>


[04/24] git commit: bump to sesame-2.7.0-beta2-SNAPSHOT

Posted by an...@apache.org.
bump to sesame-2.7.0-beta2-SNAPSHOT


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

Branch: refs/heads/master
Commit: 237af799d9f7516c6acfb8555170cf1ef678646c
Parents: bcad0f2
Author: Peter Ansell <p_...@yahoo.com>
Authored: Thu Jan 17 12:17:13 2013 +1000
Committer: Peter Ansell <p_...@yahoo.com>
Committed: Wed Jun 26 10:06:32 2013 +1000

----------------------------------------------------------------------
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/any23/blob/237af799/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index ce8dcdd..12ea7d2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -227,7 +227,7 @@
     <implementation.build>${scmBranch}@r${buildNumber}</implementation.build>
     <implementation.build.tstamp>${implementation.build}; ${maven.build.timestamp}</implementation.build.tstamp>
     <slf4j.logger.version>1.7.2</slf4j.logger.version>
-    <sesame.version>2.7-SNAPSHOT</sesame.version>
+    <sesame.version>2.7.0-beta2-SNAPSHOT</sesame.version>
     <latest.stable.released>0.7.0-incubating</latest.stable.released>
 
     <!-- Maven Plugin Versions -->


[07/24] git commit: remove aduna-commons packages that are not used independent of sesame

Posted by an...@apache.org.
remove aduna-commons packages that are not used independent of sesame


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

Branch: refs/heads/master
Commit: bcad0f2f55d2dc3c2d8a50631131a8126af884af
Parents: f8948d9
Author: Peter Ansell <p_...@yahoo.com>
Authored: Fri Dec 7 09:57:56 2012 +1000
Committer: Peter Ansell <p_...@yahoo.com>
Committed: Wed Jun 26 10:06:32 2013 +1000

----------------------------------------------------------------------
 core/pom.xml | 28 ----------------------------
 pom.xml      | 35 -----------------------------------
 2 files changed, 63 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/any23/blob/bcad0f2f/core/pom.xml
----------------------------------------------------------------------
diff --git a/core/pom.xml b/core/pom.xml
index 4389684..d5a60b0 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -134,34 +134,6 @@
       <groupId>org.openrdf.sesame</groupId>
       <artifactId>sesame-repository-api</artifactId>
     </dependency>
-    <dependency>
-      <groupId>info.aduna.commons</groupId>
-      <artifactId>aduna-commons-xml</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>info.aduna.commons</groupId>
-      <artifactId>aduna-commons-text</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>info.aduna.commons</groupId>
-      <artifactId>aduna-commons-net</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>info.aduna.commons</groupId>
-      <artifactId>aduna-commons-lang</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>info.aduna.commons</groupId>
-      <artifactId>aduna-commons-iteration</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>info.aduna.commons</groupId>
-      <artifactId>aduna-commons-io</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>info.aduna.commons</groupId>
-      <artifactId>aduna-commons-concurrent</artifactId>
-    </dependency>
     <!-- END: Sesame -->
 
     <!-- BEGIN:  Apache Commons, this version is hosted in the 

http://git-wip-us.apache.org/repos/asf/any23/blob/bcad0f2f/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index ae44a9a..ce8dcdd 100644
--- a/pom.xml
+++ b/pom.xml
@@ -380,41 +380,6 @@
         <artifactId>sesame-repository-api</artifactId>
         <version>${sesame.version}</version>
       </dependency>
-      <dependency>
-        <groupId>info.aduna.commons</groupId>
-        <artifactId>aduna-commons-xml</artifactId>
-        <version>2.7.0</version>
-      </dependency>
-      <dependency>
-        <groupId>info.aduna.commons</groupId>
-        <artifactId>aduna-commons-text</artifactId>
-        <version>2.7.0</version>
-      </dependency>
-      <dependency>
-        <groupId>info.aduna.commons</groupId>
-        <artifactId>aduna-commons-net</artifactId>
-        <version>2.7.0</version>
-      </dependency>
-      <dependency>
-        <groupId>info.aduna.commons</groupId>
-        <artifactId>aduna-commons-lang</artifactId>
-        <version>2.9.0</version>
-      </dependency>
-      <dependency>
-        <groupId>info.aduna.commons</groupId>
-        <artifactId>aduna-commons-iteration</artifactId>
-        <version>2.10.0</version>
-      </dependency>
-      <dependency>
-        <groupId>info.aduna.commons</groupId>
-        <artifactId>aduna-commons-io</artifactId>
-        <version>2.10.0</version>
-      </dependency>
-      <dependency>
-        <groupId>info.aduna.commons</groupId>
-        <artifactId>aduna-commons-concurrent</artifactId>
-        <version>2.7.0</version>
-      </dependency>
       <!-- END: Sesame -->
 
       <!-- BEGIN:  Apache Commons -->


[02/24] git commit: bump sesame and slf4j versions

Posted by an...@apache.org.
bump sesame and slf4j versions


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

Branch: refs/heads/master
Commit: fa0ca270727df8333d54de21ea2b6f47008b7cd0
Parents: 0f067f1
Author: Peter Ansell <p_...@yahoo.com>
Authored: Fri Dec 7 09:41:15 2012 +1000
Committer: Peter Ansell <p_...@yahoo.com>
Committed: Wed Jun 26 10:06:32 2013 +1000

----------------------------------------------------------------------
 pom.xml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/any23/blob/fa0ca270/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 5d40a96..98a9a8f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -226,8 +226,8 @@
     <maven.build.timestamp.format>yyyy-MM-dd HH:mm:ssZ</maven.build.timestamp.format>
     <implementation.build>${scmBranch}@r${buildNumber}</implementation.build>
     <implementation.build.tstamp>${implementation.build}; ${maven.build.timestamp}</implementation.build.tstamp>
-    <slf4j.logger.version>1.6.6</slf4j.logger.version>
-    <sesame.version>2.6.9</sesame.version>
+    <slf4j.logger.version>1.7.2</slf4j.logger.version>
+    <sesame.version>2.7-SNAPSHOT</sesame.version>
     <latest.stable.released>0.7.0-incubating</latest.stable.released>
 
     <!-- Maven Plugin Versions -->


[13/24] git commit: replace NQuadsWriter as a thin wrapper over sesame-rio-nquads writer

Posted by an...@apache.org.
replace NQuadsWriter as a thin wrapper over sesame-rio-nquads writer


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

Branch: refs/heads/master
Commit: 493c573f4fbfbd6d84eefe75d74915e20d1dc922
Parents: 5d69c94
Author: Peter Ansell <p_...@yahoo.com>
Authored: Wed Oct 24 13:53:14 2012 +1000
Committer: Peter Ansell <p_...@yahoo.com>
Committed: Wed Jun 26 10:08:07 2013 +1000

----------------------------------------------------------------------
 .../apache/any23/io/nquads/NQuadsWriter.java    | 263 +------------------
 1 file changed, 6 insertions(+), 257 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/any23/blob/493c573f/nquads/src/main/java/org/apache/any23/io/nquads/NQuadsWriter.java
----------------------------------------------------------------------
diff --git a/nquads/src/main/java/org/apache/any23/io/nquads/NQuadsWriter.java b/nquads/src/main/java/org/apache/any23/io/nquads/NQuadsWriter.java
index 6da59d4..6adb3a4 100644
--- a/nquads/src/main/java/org/apache/any23/io/nquads/NQuadsWriter.java
+++ b/nquads/src/main/java/org/apache/any23/io/nquads/NQuadsWriter.java
@@ -17,275 +17,24 @@
 
 package org.apache.any23.io.nquads;
 
-import org.openrdf.model.BNode;
-import org.openrdf.model.Literal;
-import org.openrdf.model.Resource;
-import org.openrdf.model.Statement;
-import org.openrdf.model.URI;
-import org.openrdf.model.Value;
-import org.openrdf.rio.RDFFormat;
-import org.openrdf.rio.RDFHandlerException;
-import org.openrdf.rio.RDFWriter;
-import org.openrdf.rio.RioSetting;
-import org.openrdf.rio.WriterConfig;
-import org.openrdf.rio.helpers.NTriplesParserSettings;
-import org.openrdf.rio.helpers.RDFWriterBase;
-import org.openrdf.rio.ntriples.NTriplesUtil;
-
-import java.io.IOException;
 import java.io.OutputStream;
 import java.io.OutputStreamWriter;
 import java.io.Writer;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
+import java.nio.charset.Charset;
 
 /**
- * <i>N-Quads</i> implementation of an {@link org.openrdf.rio.RDFWriter}.
+ * A UTF-8 aware <i>N-Quads</i> implementation of an {@link org.openrdf.rio.RDFWriter}.
  * See the format specification <a href="http://sw.deri.org/2008/07/n-quads/">here</a>.
  *
  * @author Michele Mostarda (mostarda@fbk.eu)
  */
-public class NQuadsWriter extends RDFWriterBase implements RDFWriter {
-
-    /**
-     * The table maintaining namespaces.
-     */
-    private Map<String,String> namespaceTable;
-
-    /**
-     * The output writer.
-     */
-    private Writer writer;
-
-    /**
-     * Maintain the started status.
-     */
-    private boolean started = false;
-
-    private WriterConfig writerConfig;
+public class NQuadsWriter extends org.openrdf.rio.nquads.NQuadsWriter {
 
     public NQuadsWriter(OutputStream os) {
-        this( new OutputStreamWriter(os) );
-    }
-
-    public NQuadsWriter(Writer w) {
-        if(w == null) {
-            throw new NullPointerException("the writer cannot be null.");
-        }
-        writer = w;
-    }
-
-    public RDFFormat getRDFFormat() {
-        return RDFFormat.NQUADS;
-    }
-
-    public void startRDF() throws RDFHandlerException {
-        if(started) {
-            throw new IllegalStateException("Parsing already started.");
-        }
-        started = true;
-    }
-
-    public void endRDF() throws RDFHandlerException {
-        if(!started) {
-            throw new IllegalStateException("Parsing never started.");
-        }
-
-        try {
-            writer.flush();
-        } catch (IOException ioe) {
-            throw new RDFHandlerException("Error while flushing writer.", ioe);
-        } finally {
-            started = false;
-            if(namespaceTable != null) {
-                namespaceTable.clear();
-            }
-        }
-    }
-
-    public void handleNamespace(String ns, String uri) throws RDFHandlerException {
-        if(!started) {
-            throw new IllegalStateException("Parsing never started.");
-        }
-
-        if(namespaceTable == null) {
-            namespaceTable = new HashMap<String, String>();
-        }
-        namespaceTable.put(ns, NTriplesUtil.escapeString(uri) );
-    }
-
-    public void handleStatement(Statement statement) throws RDFHandlerException {
-        if(!started) {
-            throw new IllegalStateException("Cannot handle statement without start parsing first.");
-        }
-
-        try {
-            printSubject(statement);
-            printSpace();
-            printPredicate(statement);
-            printSpace();
-            printObject(statement);
-            printSpace();
-            printGraph(statement);
-            printCloseStatement();
-        } catch (IOException ioe) {
-            throw new RDFHandlerException("An error occurred while printing statement.", ioe);
-        }
-    }
-
-    public void handleComment(String comment) throws RDFHandlerException {
-        try {
-            writer.write("# ");
-            writer.write(comment);
-            writer.append('\n');
-        } catch (IOException ioe) {
-            throw new RDFHandlerException("An error occurred while printing comment.", ioe);
-        }
+        super( new OutputStreamWriter(os, Charset.forName("UTF-8")) );
     }
 
-    /**
-     * Prints out a space.
-     *
-     * @throws IOException
-     */
-    private void printSpace() throws IOException {
-        writer.append(' ');
+    public NQuadsWriter(Writer writer) {
+        super( writer );
     }
-
-    /**
-     * Prints out the close statement.
-     * 
-     * @throws IOException
-     */
-    private void printCloseStatement() throws IOException {
-        writer.append(" .\n");
-    }
-
-    /**
-     * Prints out a URI string, replacing the existing prefix if found.
-     * 
-     * @param uri the URI to print.
-     * @throws IOException
-     */
-    private void printURI(URI uri) throws IOException {
-        final String uriString = uri.stringValue();
-        int splitIdx = 0;
-        String namespace = null;
-        if(namespaceTable != null) {
-            splitIdx = uriString.indexOf(':');
-            if (splitIdx > 0) {
-                String prefix = uriString.substring(0, splitIdx);
-                namespace = namespaceTable.get(prefix);
-            }
-        }
-
-        if (namespace != null) {
-            writer.append('<');
-            writer.append(namespace);
-            writer.append( NTriplesUtil.escapeString(uriString.substring(splitIdx)) );
-            writer.append('>');
-        } else {
-            writer.append('<');
-            writer.append( NTriplesUtil.escapeString(uriString) );
-            writer.append('>');
-        }
-    }
-
-    /**
-     * Prints out the bnode.
-     *
-     * @param b bnode value.
-     * @throws IOException
-     */
-    private void printBNode(BNode b) throws IOException {
-        writer.append( NTriplesUtil.toNTriplesString(b) );
-    }
-
-    /**
-     * Prints out the resource.
-     *
-     * @param r resource value.
-     * @throws java.io.IOException
-     */
-    private void printResource(Resource r) throws IOException {
-        if(r instanceof BNode) {
-            printBNode((BNode) r);
-        } else if(r instanceof URI) {
-            printURI((URI) r);
-        } else {
-            throw new IllegalStateException();
-        }
-    }
-
-    /**
-     * Prints out a literal value.
-     *
-     * @param l literal value.
-     * @throws java.io.IOException
-     */
-    private void printLiteral(Literal l) throws IOException {
-        writer.append( NTriplesUtil.toNTriplesString(l) );
-    }
-
-    /**
-     * Prints out the subject.
-     * 
-     * @param s
-     * @throws IOException
-     */
-    private void printSubject(Statement s) throws IOException {
-        printResource( s.getSubject() );
-    }
-
-    /**
-     * Prints out the predicate.
-     *
-     * @param s
-     * @throws IOException
-     */
-    private void printPredicate(Statement s) throws IOException {
-        printURI( s.getPredicate() );
-    }
-
-    /**
-     * Prints out the object, handling all the logic to manage
-     * the literal data type / language attribute.
-     *
-     * @param s
-     * @throws IOException
-     */
-    private void printObject(Statement s) throws IOException {
-        Value v = s.getObject();
-        if(v instanceof Resource) {
-            printResource((Resource) v);
-            return;
-        }
-        printLiteral( (Literal) v );
-    }
-
-    /**
-     * Prints out the graph.
-     *
-     * @param s
-     * @throws IOException
-     */
-    private void printGraph(Statement s) throws IOException {
-        Resource graph = s.getContext();
-        if(graph != null) {
-            printResource( s.getContext() );
-        }
-    }
-
-    @Override
-    public Collection<RioSetting<?>> getSupportedSettings() {
-        Set<RioSetting<?>> results = new HashSet<RioSetting<?>>(super.getSupportedSettings());
-        
-        results.add(NTriplesParserSettings.IGNORE_NTRIPLES_INVALID_LINES);
-        
-        return results;
-    }
-
 }


[17/24] git commit: convert NQuadsParser to override sesame-rio-nquads parser with UTF-8 support for InputStreamReader constructor

Posted by an...@apache.org.
convert NQuadsParser to override sesame-rio-nquads parser with UTF-8 support for InputStreamReader constructor


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

Branch: refs/heads/master
Commit: c9a867b4055a3d01596cd105af754f0bba75c228
Parents: da720fe
Author: Peter Ansell <p_...@yahoo.com>
Authored: Wed Oct 24 14:16:34 2012 +1000
Committer: Peter Ansell <p_...@yahoo.com>
Committed: Wed Jun 26 10:08:07 2013 +1000

----------------------------------------------------------------------
 .../apache/any23/io/nquads/NQuadsParser.java    | 694 +------------------
 1 file changed, 1 insertion(+), 693 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/any23/blob/c9a867b4/nquads/src/main/java/org/apache/any23/io/nquads/NQuadsParser.java
----------------------------------------------------------------------
diff --git a/nquads/src/main/java/org/apache/any23/io/nquads/NQuadsParser.java b/nquads/src/main/java/org/apache/any23/io/nquads/NQuadsParser.java
index 7ca4fe9..3f5b5d2 100644
--- a/nquads/src/main/java/org/apache/any23/io/nquads/NQuadsParser.java
+++ b/nquads/src/main/java/org/apache/any23/io/nquads/NQuadsParser.java
@@ -17,27 +17,12 @@
 
 package org.apache.any23.io.nquads;
 
-import org.openrdf.model.BNode;
-import org.openrdf.model.Resource;
-import org.openrdf.model.Statement;
-import org.openrdf.model.URI;
-import org.openrdf.model.Value;
-import org.openrdf.model.datatypes.XMLDatatypeUtil;
-import org.openrdf.model.impl.URIImpl;
-import org.openrdf.rio.ParseLocationListener;
-import org.openrdf.rio.RDFFormat;
-import org.openrdf.rio.RDFHandler;
 import org.openrdf.rio.RDFHandlerException;
 import org.openrdf.rio.RDFParseException;
-import org.openrdf.rio.helpers.NTriplesParserSettings;
-import org.openrdf.rio.helpers.RDFParserBase;
-import org.openrdf.rio.ntriples.NTriplesUtil;
 
-import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
-import java.io.Reader;
 import java.nio.charset.Charset;
 
 /**
@@ -48,61 +33,7 @@ import java.nio.charset.Charset;
  * @author Michele Mostarda (mostarda@fbk.eu)
  * @see org.openrdf.rio.RDFParser
  */
-public class NQuadsParser extends RDFParserBase {
-
-    /**
-     * Location listener acquired when parsing started.
-     */
-    private ParseLocationListener locationListener;
-
-    /**
-     * RDF handler acquired when parsing started.
-     */
-    private RDFHandler rdfHandler;
-
-    /**
-     * Current row, col and marker trackers.
-     */
-    private int row, col, mark;
-
-    public NQuadsParser() {}
-
-    public RDFFormat getRDFFormat() {
-        return RDFFormat.NQUADS;
-    }
-
-    public void parse(Reader reader, String baseURI)
-    throws IOException, RDFParseException, RDFHandlerException {
-        if(reader == null) {
-            throw new NullPointerException("reader cannot be null.");
-        }
-        if(baseURI == null) {
-            throw new NullPointerException("baseURI cannot be null.");
-        }
-        
-        try {
-            row = col = 1;
-
-            locationListener = getParseLocationListener();
-            rdfHandler = getRDFHandler();
-
-            setBaseURI(baseURI);
-
-            final BufferedReader br = new BufferedReader( reader );
-            if( rdfHandler != null ) {
-                rdfHandler.startRDF();
-            }
-            while( parseLine(br) ) {
-                nextRow();
-            }
-        } finally {
-            if(rdfHandler != null) {
-                rdfHandler.endRDF();
-            }
-            clear();
-            clearBNodeIDMap();
-        }
-    }
+public class NQuadsParser extends org.openrdf.rio.nquads.NQuadsParser {
 
     public synchronized void parse(InputStream is, String baseURI)
     throws IOException, RDFParseException, RDFHandlerException {
@@ -117,627 +48,4 @@ public class NQuadsParser extends RDFParserBase {
         this.parse(new InputStreamReader(is, Charset.forName("UTF-8")), baseURI);
     }
 
-    /**
-     * Moves to the next row, resets the column.
-     */
-    private void nextRow() {
-        col = 1;
-        row++;
-        if(locationListener != null) {
-            locationListener.parseLocationUpdate(row, col);
-        }
-    }
-
-    /**
-     * Moves to the next column.
-     */
-    private void nextCol() {
-        col++;
-        if(locationListener != null) {
-            locationListener.parseLocationUpdate(row, col);
-        }
-    }
-
-    /**
-     * Reads the next char.
-     *
-     * @param br
-     * @return the next read char.
-     * @throws IOException
-     */
-    private char readChar(BufferedReader br) throws IOException {
-        final int c = br.read();
-        if(c == -1) {
-            throw new EOS();
-        }
-        nextCol();
-        return (char) c;
-    }
-
-    /**
-     * Reads an unicode char with pattern <code>\\uABCD</code>.
-     *
-     * @param br input reader.
-     * @return read char.
-     * @throws IOException
-     * @throws RDFParseException
-     */
-    private char readUnicode(BufferedReader br) throws IOException, RDFParseException {
-        final char[] unicodeSequence = new char[4];
-        for(int i = 0; i < unicodeSequence.length; i++) {
-            unicodeSequence[i] = readChar(br);
-        }
-        final String unicodeCharStr = new String(unicodeSequence);
-        try {
-            return (char) Integer.parseInt(unicodeCharStr, 16);
-        } catch (NumberFormatException nfe) {
-            reportError("Error while converting unicode char '\\u" + unicodeCharStr + "'", row, col, NTriplesParserSettings.IGNORE_NTRIPLES_INVALID_LINES);
-            throw new IllegalStateException();
-        }
-    }
-
-    /**
-     * Marks the buffered input stream with the current location.
-     *
-     * @param br
-     */
-    private void mark(BufferedReader br) throws IOException {
-        mark = col;
-        br.mark(5);
-    }
-
-    /**
-     * Resets the buffered input stream and update the new location.
-     *
-     * @param br
-     * @throws IOException
-     */
-    private void reset(BufferedReader br) throws IOException {
-        col = mark;
-        br.reset();
-        if(locationListener != null) {
-            locationListener.parseLocationUpdate(row, col);
-        }
-    }
-
-    /**
-     * Asserts to read a specific char.
-     *
-     * @param br
-     * @param c
-     * @throws IOException
-     */
-    private void assertChar(BufferedReader br, char c) throws IOException, RDFParseException {
-        final char read = readChar(br);
-        if(read != c) {
-            throw new RDFParseException(
-                    String.format("Unexpected char '%s', expected '%s'", read, c),
-                    row, col
-            );
-        }
-    }
-
-    /**
-     * Consumes the reader until the next carriage return.
-     *
-     * @param br
-     * @throws IOException
-     */
-    private void consumeBrokenLine(BufferedReader br) throws IOException {
-        char c;
-        while (true) {
-            mark(br);
-            c = readChar(br);
-            if (c == '\n') {
-                return;
-            }
-        }
-    }
-
-    /**
-     * Parsers an <i>NQuads</i> line.
-     *
-     * @param br input stream reader containing NQuads.
-     * @return <code>false</code> if the parsing completed, <code>true</code> otherwise.
-     * @throws IOException
-     * @throws RDFParseException
-     * @throws RDFHandlerException
-     */
-    private boolean parseLine(BufferedReader br)
-    throws IOException, RDFParseException, RDFHandlerException {
-
-        if(!consumeSpacesAndNotEOS(br)) {
-            return false;
-        }
-
-        // Consumes empty line or line comment.
-        try {
-            if(consumeEmptyLine(br)) return true;
-            if( consumeComment(br) ) return true;
-        } catch (EOS eos) {
-            return false;
-        }
-
-        final Resource sub;
-        final URI      pred;
-        final Value    obj;
-        final URI      context;
-        try {
-            sub = parseSubject(br);
-            consumeSpaces(br);
-            pred = parsePredicate(br);
-            consumeSpaces(br);
-            obj = parseObject(br);
-            consumeSpaces(br);
-            context = parseContextAndOrDot(br);
-        } catch (EOS eos) {
-            reportFatalError("Unexpected end of stream.", row, col);
-            throw new IllegalStateException();
-        } catch (Exception e) { // FIXME: We should not be catching IOException here as that is used to indicate a failure of the stream/writer
-            if(super.stopAtFirstError()) {
-                if(e instanceof RDFParseException)
-                    throw (RDFParseException) e;
-                else
-                    throw new RDFParseException(e, row, col);
-            } else { // Remove rest of broken line and report error.
-                consumeBrokenLine(br);
-                reportError(e.getMessage(), row, col, NTriplesParserSettings.IGNORE_NTRIPLES_INVALID_LINES);
-                return true;
-            }
-        }
-
-        assert sub  != null : "Subject cannot be null.";
-        assert pred != null : "Predicate cannot be null.";
-        assert obj  != null : "Object cannot be null.";
-        notifyStatement(sub, pred, obj, context);
-
-        if(!consumeSpacesAndNotEOS(br)) {
-            return false;
-        }
-        return readChar(br) == '\n';
-    }
-
-    /**
-     * Consumes the line if empty (contains just a carriage return).
-     *
-     * @param br input NQuads stream.
-     * @return <code>true</code> if the line is empty.
-     * @throws IOException if an error occurs while consuming stream.
-     */
-    private boolean consumeEmptyLine(BufferedReader br) throws IOException {
-        char c;
-        mark(br);
-        c = readChar(br);
-        if (c == '\n') {
-            return true;
-        } else {
-            reset(br);
-            return false;
-        }
-    }
-
-    /**
-     * Consumes all subsequent spaces and returns true, if End Of Stream is reached instead returns false.
-     * @param br input NQuads stream reader.
-     * @return <code>true</code> if there are other chars to be consumed.
-     * @throws IOException if an error occurs while consuming stream.
-     */
-    private boolean consumeSpacesAndNotEOS(BufferedReader br) throws IOException {
-        try {
-            consumeSpaces(br);
-            return true;
-        } catch (EOS eos) {
-            return false;
-        }
-    }
-
-    /**
-     * Consumes a comment if any.
-     *
-     * @param br input NQuads stream reader.
-     * @return <code>true</code> if comment has been consumed, false otherwise.
-     * @throws IOException
-     */
-    private boolean consumeComment(BufferedReader br) throws IOException {
-        char c;
-        mark(br);
-        c = readChar(br);
-        if (c == '#') {
-            mark(br);
-            while (readChar(br) != '\n');
-            mark(br);
-            return true;
-        } else {
-            reset(br);
-            return false;
-        }
-    }
-
-    /**
-     * Notifies the parsed statement to the {@link RDFHandler}.
-     *
-     * @param sub
-     * @param pred
-     * @param obj
-     * @param context
-     * @throws RDFParseException
-     * @throws RDFHandlerException
-     */
-    private void notifyStatement(Resource sub, URI pred, Value obj, URI context)
-    throws RDFParseException, RDFHandlerException {
-        Statement statement = super.createStatement(sub, pred, obj, context);
-        if (rdfHandler != null) {
-            try {
-                rdfHandler.handleStatement(statement);
-            } catch (RDFHandlerException rdfhe) {
-                reportFatalError(rdfhe);
-                throw rdfhe;
-            }
-        }
-    }
-
-    /**
-     * Consumes spaces until a non space char is detected.
-     *
-     * @param br input stream reader from which consume spaces.
-     * @throws IOException
-     */
-    private void consumeSpaces(BufferedReader br) throws IOException {
-        char c;
-        while(true) {
-            mark(br);
-            c = readChar(br);
-            if(c == ' ' || c == '\r' || c == '\f' || c == '\t') {
-                mark(br);
-            } else {
-                break;
-            }
-        }
-        reset(br);
-    }
-
-    /**
-     * Consumes the dot at the end of NQuads line.
-     *
-     * @param br
-     * @throws IOException
-     */
-    private void parseDot(BufferedReader br) throws IOException, RDFParseException {
-        assertChar(br, '.');
-    }
-
-    /**
-     * Parses a URI enclosed within &lt; and &gt; brackets.
-     * @param br
-     * @return the parsed URI.
-     * @throws IOException
-     * @throws RDFParseException
-     */
-    private URI parseURI(BufferedReader br) throws IOException, RDFParseException {
-        assertChar(br, '<');
-
-        StringBuilder sb = new StringBuilder();
-        char c;
-        while(true) {
-            c = readChar(br);
-            if(c != '>') {
-                sb.append(c);
-            } else {
-                break;
-            }
-        }
-        mark(br);
-
-        try {
-            // TODO - LOW: used to unescape \\uXXXX unicode chars. Unify with #printEscaped().
-            String uriStr = NTriplesUtil.unescapeString( sb.toString() );
-            URI uri;
-            if(uriStr.charAt(0) == '#') {
-                uri = super.resolveURI(uriStr);
-            } else {
-                uri = super.createURI(uriStr);
-            }
-            return uri;
-        } catch (RDFParseException rdfpe) {
-            reportFatalError(rdfpe, row, col);
-            throw rdfpe;
-        }
-    }
-
-    /**
-     * Parses a BNode.
-     *
-     * @param br the buffered input stream.
-     * @return the generated bnode.
-     * @throws IOException
-     * @throws RDFParseException
-     */
-    private BNode parseBNode(BufferedReader br) throws IOException, RDFParseException {
-        assertChar(br, '_');
-        assertChar(br, ':');
-
-        char c;
-        StringBuilder sb = new StringBuilder();
-        while(true) {
-            c = readChar(br);
-            if(c != ' ' && c != '<') {
-                sb.append(c);
-                mark(br);
-            } else {
-                break;
-            }
-        }
-        reset(br);
-
-        try {
-            return createBNode( sb.toString() );
-        } catch (RDFParseException rdfpe) {
-            reportFatalError(rdfpe, row, col);
-            throw rdfpe;
-        }
-    }
-
-    /**
-     * Parses a literal attribute that can be either the language or the data type.
-     *
-     * @param br
-     * @return the literal attribute.
-     * @throws IOException
-     */
-    private LiteralAttribute parseLiteralAttribute(BufferedReader br) throws IOException, RDFParseException {
-        char c = readChar(br);
-        if(c != '^' && c != '@') {
-            reset(br);
-            return null;
-        }
-
-        boolean isLang = true;
-        if(c == '^') {
-            isLang = false;
-            assertChar(br, '^');
-        }
-
-        final String attribute;
-        if (isLang) { // Read until space or context begin.
-            final StringBuilder sb = new StringBuilder();
-            while (true) {
-                c = readChar(br);
-                if (c != ' ' && c != '<') {
-                    mark(br);
-                    sb.append(c);
-                } else {
-                    reset(br);
-                    break;
-                }
-            }
-            attribute = sb.toString();
-        }  else {
-            attribute = parseURI(br).stringValue();
-        }
-
-        return new LiteralAttribute(isLang, attribute);
-    }
-
-    /**
-     * Validates and normalize the value of a literal on the basis of the datat ype handling policy and
-     * the associated data type.
-     *
-     * @param value
-     * @param datatype
-     * @return the normalized data type. It depends on the data type handling policy and the specified data type.
-     * @throws RDFParseException
-     */
-    private String validateAndNormalizeLiteral(String value, URI datatype) throws RDFParseException {
-        DatatypeHandling dh = datatypeHandling();
-        if(dh.equals( DatatypeHandling.IGNORE )) {
-            return value;
-        }
-
-        if ( dh.equals(DatatypeHandling.VERIFY) ) {
-            if( ! XMLDatatypeUtil.isBuiltInDatatype(datatype)){
-                return value;
-            }
-            if( ! XMLDatatypeUtil.isValidValue(value, datatype) ) {
-                throw new RDFParseException(
-                        String.format("Illegal literal value '%s' with datatype %s", value, datatype.stringValue() ),
-                        row, col
-                );
-            }
-            return value;
-        } else if( dh.equals(DatatypeHandling.NORMALIZE) ) {
-            return XMLDatatypeUtil.normalize(value, datatype);
-        } else {
-            throw new IllegalArgumentException( String.format("Unsupported datatype handling: %s", dh) );
-        }
-    }
-
-    /**
-     * Prints the escaped version of the given char c.
-     *
-     * @param c escaped char.
-     * @param sb output string builder.
-     */
-    private void printEscaped(char c, StringBuilder sb) {
-        if(c == 'b') {
-            sb.append('\b');
-            return;
-        }
-        if(c == 'f') {
-            sb.append('\f');
-            return;
-        }
-        if(c == 'n') {
-            sb.append('\n');
-            return;
-        }
-        if(c == 'r') {
-            sb.append('\r');
-            return;
-        }
-        if(c == 't') {
-            sb.append('\t');
-            return;
-        }
-    }
-
-    /**
-     * Parses a literal.
-     *
-     * @param br
-     * @return the parsed literal.
-     * @throws IOException
-     * @throws RDFParseException
-     */
-    private Value parseLiteral(BufferedReader br) throws IOException, RDFParseException {
-        assertChar(br, '"');
-
-        char c;
-        boolean escaped = false;
-        StringBuilder sb = new StringBuilder();
-        while(true) {
-            c = readChar(br);
-            if( c == '\\' ) {
-                if(escaped) {
-                    escaped = false;
-                    sb.append(c);
-                } else {
-                    escaped = true;
-                }
-                continue;
-            } else if(c == '"' && !escaped) {
-                break;
-            }
-            if(escaped) {
-                if(c == 'u') {
-                    char unicodeChar = readUnicode(br);
-                    sb.append(unicodeChar);
-                } else {
-                    printEscaped(c, sb);
-                }
-                escaped = false;
-            } else {
-                sb.append(c);
-            }
-        }
-        mark(br);
-
-        LiteralAttribute lt = parseLiteralAttribute(br);
-
-        final String value = sb.toString();
-        if(lt == null) {
-            return createLiteral(value, null, null);
-        }else if(lt.isLang) {
-            return createLiteral(
-                    value,
-                    lt.value,
-                    null
-            );
-        } else {
-            URI literalType = null;
-            try {
-                literalType = new URIImpl(lt.value);
-            } catch (Exception e) {
-                reportError( String.format("Error while parsing literal type '%s'", lt.value), row, col , NTriplesParserSettings.IGNORE_NTRIPLES_INVALID_LINES);
-            }
-            return createLiteral(
-                    validateAndNormalizeLiteral(value, literalType),
-                    null,
-                    literalType
-            );
-        }
-    }
-
-    /**
-     * Parses the subject sequence.
-     *
-     * @param br
-     * @return the corresponding URI object.
-     * @throws IOException
-     * @throws RDFParseException
-     */
-    private Resource parseSubject(BufferedReader br) throws IOException, RDFParseException {
-        mark(br);
-        char c = readChar(br);
-        reset(br);
-        if( c == '<' ) {
-            return parseURI(br);
-        } else {
-            return parseBNode(br);
-        }
-    }
-
-    /**
-     * Parses the predicate URI.
-     *
-     * @param br
-     * @return the corresponding URI object.
-     * @throws IOException
-     * @throws RDFParseException
-     */
-    private URI parsePredicate(BufferedReader br) throws IOException, RDFParseException {
-        return parseURI(br);
-    }
-
-    /**
-     * Parses the the object sequence.
-     *
-     * @param br
-     * @return the corresponding URI object.
-     * @throws IOException
-     * @throws RDFParseException
-     */
-    private Value parseObject(BufferedReader br) throws IOException, RDFParseException {
-        mark(br);
-        char c = readChar(br);
-        reset(br);
-        if( c == '<' ) {
-            return parseURI(br);
-        } else if( c == '_') {
-            return parseBNode(br);
-        } else {
-            return parseLiteral(br);
-        }
-    }
-
-    /**
-     * Represents a literal with its attribute value that can be either a language or a data type.
-     */
-    class LiteralAttribute {
-        final boolean isLang;
-        final String value;
-
-        LiteralAttribute(boolean lang, String value) {
-            isLang = lang;
-            this.value = value;
-        }
-    }
-
-    /**
-     * Parses the context if any.
-     *
-     * @param br
-     * @return the context URI or null if not found.
-     * @throws IOException
-     * @throws RDFParseException
-     */
-    private URI parseContextAndOrDot(BufferedReader br) throws IOException, RDFParseException {
-        mark(br);
-        final char c = readChar(br);
-        reset(br);
-        if(c == '<') {
-            final URI context = parseURI(br);
-            consumeSpaces(br);
-            parseDot(br);
-            return context;
-        } else {
-            parseDot(br);
-            return null;
-        }
-    }
-
-    /**
-     * Defines the End Of Stream exception.
-     */
-    class EOS extends IOException {}
-
 }


[15/24] git commit: add FIXME note about N-Quads parser catching all Exceptions

Posted by an...@apache.org.
add FIXME note about N-Quads parser catching all Exceptions


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

Branch: refs/heads/master
Commit: 5f8fb13a6d70a90e0369e66cc1652faa7d7bc446
Parents: 94f6d30
Author: Peter Ansell <p_...@yahoo.com>
Authored: Wed Oct 24 13:57:50 2012 +1000
Committer: Peter Ansell <p_...@yahoo.com>
Committed: Wed Jun 26 10:08:07 2013 +1000

----------------------------------------------------------------------
 nquads/src/main/java/org/apache/any23/io/nquads/NQuadsParser.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/any23/blob/5f8fb13a/nquads/src/main/java/org/apache/any23/io/nquads/NQuadsParser.java
----------------------------------------------------------------------
diff --git a/nquads/src/main/java/org/apache/any23/io/nquads/NQuadsParser.java b/nquads/src/main/java/org/apache/any23/io/nquads/NQuadsParser.java
index 485d5cb..7ca4fe9 100644
--- a/nquads/src/main/java/org/apache/any23/io/nquads/NQuadsParser.java
+++ b/nquads/src/main/java/org/apache/any23/io/nquads/NQuadsParser.java
@@ -273,7 +273,7 @@ public class NQuadsParser extends RDFParserBase {
         } catch (EOS eos) {
             reportFatalError("Unexpected end of stream.", row, col);
             throw new IllegalStateException();
-        } catch (Exception e) {
+        } catch (Exception e) { // FIXME: We should not be catching IOException here as that is used to indicate a failure of the stream/writer
             if(super.stopAtFirstError()) {
                 if(e instanceof RDFParseException)
                     throw (RDFParseException) e;


[18/24] git commit: fix test that attempted to parse an nquads file with no newlines in it, against the specification

Posted by an...@apache.org.
fix test that attempted to parse an nquads file with no newlines in it, against the specification


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

Branch: refs/heads/master
Commit: 3a155feaf7f23859c11ee9959ecb2de3f09a3f5e
Parents: 9643063
Author: Peter Ansell <p_...@yahoo.com>
Authored: Wed Oct 24 14:47:19 2012 +1000
Committer: Peter Ansell <p_...@yahoo.com>
Committed: Wed Jun 26 10:08:07 2013 +1000

----------------------------------------------------------------------
 .../src/test/java/org/apache/any23/cli/CrawlerTest.java             | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/any23/blob/3a155fea/plugins/basic-crawler/src/test/java/org/apache/any23/cli/CrawlerTest.java
----------------------------------------------------------------------
diff --git a/plugins/basic-crawler/src/test/java/org/apache/any23/cli/CrawlerTest.java b/plugins/basic-crawler/src/test/java/org/apache/any23/cli/CrawlerTest.java
index bf66295..2439336 100644
--- a/plugins/basic-crawler/src/test/java/org/apache/any23/cli/CrawlerTest.java
+++ b/plugins/basic-crawler/src/test/java/org/apache/any23/cli/CrawlerTest.java
@@ -89,6 +89,7 @@ public class CrawlerTest extends Any23OnlineTestBase {
         final StringBuilder allLinesExceptLast = new StringBuilder();
         for (int i = 0; i < lines.length - 1; i++) {
             allLinesExceptLast.append(lines[i]);
+            allLinesExceptLast.append("\n");
         }
 
         final Statement[] statements = RDFUtils.parseRDF(RDFFormat.NQUADS, allLinesExceptLast.toString());


[19/24] git commit: Fix NQuads test that broke due to addition of DBPedia datatype handler

Posted by an...@apache.org.
Fix NQuads test that broke due to addition of DBPedia datatype handler

The dbpedia datatypes are verified in a very rudimentary way, by
checking that the prefix matches the dbpedia datatype prefix

Also fix test that relied on setStopAtFirstError(false), by turning off
the relevant error setting


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

Branch: refs/heads/master
Commit: f2ded151c114f4fbe411704b099c26177d4c9f2d
Parents: a849b7b
Author: Peter Ansell <p_...@yahoo.com>
Authored: Fri Apr 19 14:58:13 2013 +1000
Committer: Peter Ansell <p_...@yahoo.com>
Committed: Wed Jun 26 10:08:07 2013 +1000

----------------------------------------------------------------------
 .../test/java/org/apache/any23/io/nquads/NQuadsParserTest.java | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/any23/blob/f2ded151/nquads/src/test/java/org/apache/any23/io/nquads/NQuadsParserTest.java
----------------------------------------------------------------------
diff --git a/nquads/src/test/java/org/apache/any23/io/nquads/NQuadsParserTest.java b/nquads/src/test/java/org/apache/any23/io/nquads/NQuadsParserTest.java
index 8d25e02..8f976cf 100644
--- a/nquads/src/test/java/org/apache/any23/io/nquads/NQuadsParserTest.java
+++ b/nquads/src/test/java/org/apache/any23/io/nquads/NQuadsParserTest.java
@@ -35,6 +35,7 @@ import org.openrdf.rio.RDFParseException;
 import org.openrdf.rio.RDFParser;
 import org.openrdf.rio.RioSetting;
 import org.openrdf.rio.helpers.BasicParserSettings;
+import org.openrdf.rio.helpers.NTriplesParserSettings;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -481,7 +482,8 @@ public class NQuadsParserTest {
                     "<http://s1> <http://p1> <http://o1> <http://g1> .\n"
                 ).getBytes()
         );
-        parser.setStopAtFirstError(false);
+        //parser.setStopAtFirstError(false);
+        parser.getParserConfig().addNonFatalError(NTriplesParserSettings.FAIL_ON_NTRIPLES_INVALID_LINES);
         parser.parse(bais, "http://base-uri");
         rdfHandler.assertHandler(2);
         final List<Statement> statements = rdfHandler.getStatements();
@@ -555,7 +557,7 @@ public class NQuadsParserTest {
                 (
                         "<http://dbpedia.org/resource/Camillo_Benso,_conte_di_Cavour> " +
                         "<http://dbpedia.org/property/mandatofine> " +
-                        "\"1380.0\"^^<http://dbpedia.org/datatype/second> " +
+                        "\"1380.0\"^^<http://dbpedia.org/invalid/datatype/second> " +
                         "<http://it.wikipedia.org/wiki/Camillo_Benso,_conte_di_Cavour#absolute-line=20> ."
                 ).getBytes()
         );


[05/24] git commit: add sonatype snapshot repository to fetch sesame-2.7-SNAPSHOT artifacts

Posted by an...@apache.org.
add sonatype snapshot repository to fetch sesame-2.7-SNAPSHOT artifacts


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

Branch: refs/heads/master
Commit: f8948d9a8e473e42d850e4920bba6fca99ae1e49
Parents: 560dffe
Author: Peter Ansell <p_...@yahoo.com>
Authored: Fri Dec 7 09:55:05 2012 +1000
Committer: Peter Ansell <p_...@yahoo.com>
Committed: Wed Jun 26 10:06:32 2013 +1000

----------------------------------------------------------------------
 pom.xml | 6 ++++++
 1 file changed, 6 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/any23/blob/f8948d9a/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 1474bab..ae44a9a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -511,6 +511,12 @@
       <id>any23-repository-external</id>
       <url>http://svn.apache.org/repos/asf/any23/repo-ext/</url>
     </repository>
+    <repository>
+      <id>sonatype-snapshots</id>
+      <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
+      <releases><enabled>false</enabled></releases>
+      <snapshots><enabled>true</enabled></snapshots>
+    </repository>
   </repositories>
 
   <build>


[16/24] git commit: fix test that relies on the NQuadsWriter expanding namespaces, when this is never necessary with the Sesame API, as namespaces are always expanded automatically inside of the org.openrdf.model.URI interface, and in addition, N-Quads h

Posted by an...@apache.org.
fix test that relies on the NQuadsWriter expanding namespaces, when this is never necessary with the Sesame API, as namespaces are always expanded automatically inside of the org.openrdf.model.URI interface, and in addition, N-Quads has never, and will never have, any support for namespaces. If that happens it will be as an extension to Turtle, which will be separate from N-Quads as N-Quads is by design a very thin wrapper over N-Triples, which will also never have namespace/prefixes


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

Branch: refs/heads/master
Commit: 94f6d302061bbe51decbfe947938b6d808c5f8fa
Parents: 493c573
Author: Peter Ansell <p_...@yahoo.com>
Authored: Wed Oct 24 13:55:18 2012 +1000
Committer: Peter Ansell <p_...@yahoo.com>
Committed: Wed Jun 26 10:08:07 2013 +1000

----------------------------------------------------------------------
 .../any23/io/nquads/NQuadsWriterTest.java       | 23 ++++++++++----------
 1 file changed, 12 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/any23/blob/94f6d302/nquads/src/test/java/org/apache/any23/io/nquads/NQuadsWriterTest.java
----------------------------------------------------------------------
diff --git a/nquads/src/test/java/org/apache/any23/io/nquads/NQuadsWriterTest.java b/nquads/src/test/java/org/apache/any23/io/nquads/NQuadsWriterTest.java
index 368e876..1fe92c6 100644
--- a/nquads/src/test/java/org/apache/any23/io/nquads/NQuadsWriterTest.java
+++ b/nquads/src/test/java/org/apache/any23/io/nquads/NQuadsWriterTest.java
@@ -97,12 +97,12 @@ public class NQuadsWriterTest {
                 literal("12345", uri("http://www.w3.org/2001/XMLSchema#integer")),
                 uri("http://gra2")
         );
-        Statement s6 = quad(
-                uri("p1:sub"),
-                uri("p1:pre"),
-                uri("p1:obj"),
-                uri("p1:gra2")
-        );
+//        Statement s6 = quad(
+//                uri("p1:sub"),
+//                uri("p1:pre"),
+//                uri("p1:obj"),
+//                uri("p1:gra2")
+//        );
         Statement s7 = quad(
                 uri("http://sub"),
                 uri("http://pre"),
@@ -112,29 +112,30 @@ public class NQuadsWriterTest {
 
         // Sending events.
         writer.startRDF();
-        writer.handleNamespace("p1", "http://test.com/");
+        //writer.handleNamespace("p1", "http://test.com/");
         writer.handleStatement(s1);
         writer.handleStatement(s2);
         writer.handleStatement(s3);
         writer.handleStatement(s4);
         writer.handleStatement(s5);
-        writer.handleStatement(s6);
+        //writer.handleStatement(s6);
         writer.handleStatement(s7);
         writer.endRDF();
 
         // Checking content.
         String content = baos.toString();
+        logger.info("output={}", content);
         String[] lines = content.split("\n");
-        Assert.assertEquals("Unexpected number of lines.", 7, lines.length);
+        Assert.assertEquals("Unexpected number of lines.", 6, lines.length);
         Assert.assertTrue( lines[0].matches("<.*> <.*> <.*> <.*> \\.") );
         Assert.assertTrue( lines[1].matches("_:.* <.*> _:.* <.*> \\.") );
         Assert.assertTrue( lines[2].matches("_:.* <.*> \".*\" <.*> \\.") );
         Assert.assertTrue( lines[3].matches("_:.* <.*> \".*\"@en <.*> \\.") );
         Assert.assertTrue( lines[4].matches("_:.* <.*> \".*\"\\^\\^<.*> <.*> \\.") );
-        Assert.assertTrue( lines[5].matches("<http://.*> <http://.*> <http://.*> <http://.*> \\.") );
+        //Assert.assertTrue( lines[5].matches("<http://.*> <http://.*> <http://.*> <http://.*> \\.") );
         Assert.assertEquals(
                 "<http://sub> <http://pre> \"This is line 1.\\nThis is line 2.\\n\" <http://gra3> .",
-                lines[6]
+                lines[5]
         );
     }
 


[20/24] git commit: fix use of relative URLs in test1.nq that is designed to only test cases from the NQuads grammar

Posted by an...@apache.org.
fix use of relative URLs in test1.nq that is designed to only test cases from the NQuads grammar


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

Branch: refs/heads/master
Commit: da720fe6c398378cd331616b0c8fd389ae20adf6
Parents: 5f8fb13
Author: Peter Ansell <p_...@yahoo.com>
Authored: Wed Oct 24 14:15:52 2012 +1000
Committer: Peter Ansell <p_...@yahoo.com>
Committed: Wed Jun 26 10:08:07 2013 +1000

----------------------------------------------------------------------
 test-resources/src/test/resources/application/nquads/test1.nq | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/any23/blob/da720fe6/test-resources/src/test/resources/application/nquads/test1.nq
----------------------------------------------------------------------
diff --git a/test-resources/src/test/resources/application/nquads/test1.nq b/test-resources/src/test/resources/application/nquads/test1.nq
index bcc6108..df6263a 100644
--- a/test-resources/src/test/resources/application/nquads/test1.nq
+++ b/test-resources/src/test/resources/application/nquads/test1.nq
@@ -4,5 +4,5 @@ _:bnode2 <http://xmlns.com/foaf/0.1/Friend> _:bnode3 <http://example.org/alice/f
 
 
 _:bnode3 <http://xmlns.com/foaf/0.1/Friend> "This literal is \"really\" useful"@it <http://example.org/alice/foaf4.rdf> .
-_:bnode1 <#like> "12345"^^<http://www.w3.org/2001/XMLSchema#integer> <http://example.org/alice/foaf5.rdf> .
-_:bnode4 <#type> "triple"^^<http://www.w3.org/2001/XMLSchema#String> .
\ No newline at end of file
+_:bnode1 <http://example.org/#like> "12345"^^<http://www.w3.org/2001/XMLSchema#integer> <http://example.org/alice/foaf5.rdf> .
+_:bnode4 <http://example.org/#type> "triple"^^<http://www.w3.org/2001/XMLSchema#String> .
\ No newline at end of file


[09/24] git commit: import sesame-rio-nquads package into nquads module

Posted by an...@apache.org.
import sesame-rio-nquads package into nquads module


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

Branch: refs/heads/master
Commit: 2ad859a1cb12871df371f8917a93d32f24dc817e
Parents: 8f82509
Author: Peter Ansell <p_...@yahoo.com>
Authored: Wed Oct 24 13:51:57 2012 +1000
Committer: Peter Ansell <p_...@yahoo.com>
Committed: Wed Jun 26 10:07:07 2013 +1000

----------------------------------------------------------------------
 nquads/pom.xml | 4 ++++
 pom.xml        | 5 +++++
 2 files changed, 9 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/any23/blob/2ad859a1/nquads/pom.xml
----------------------------------------------------------------------
diff --git a/nquads/pom.xml b/nquads/pom.xml
index 7889368..dd5c7b8 100644
--- a/nquads/pom.xml
+++ b/nquads/pom.xml
@@ -52,6 +52,10 @@
       <artifactId>sesame-rio-ntriples</artifactId>
     </dependency>
     <dependency>
+      <groupId>org.openrdf.sesame</groupId>
+      <artifactId>sesame-rio-nquads</artifactId>
+    </dependency>
+    <dependency>
       <groupId>org.kohsuke.metainf-services</groupId>
       <artifactId>metainf-services</artifactId>
       <scope>compile</scope>

http://git-wip-us.apache.org/repos/asf/any23/blob/2ad859a1/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 70dc27e..28ee640 100644
--- a/pom.xml
+++ b/pom.xml
@@ -357,6 +357,11 @@
       </dependency>
       <dependency>
         <groupId>org.openrdf.sesame</groupId>
+        <artifactId>sesame-rio-nquads</artifactId>
+        <version>${sesame.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.openrdf.sesame</groupId>
         <artifactId>sesame-rio-n3</artifactId>
         <version>${sesame.version}</version>
       </dependency>


[08/24] git commit: add new ValueFactory methods to Any23ValueFactoryWrapper

Posted by an...@apache.org.
add new ValueFactory methods to Any23ValueFactoryWrapper


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

Branch: refs/heads/master
Commit: 0619427e2d1b42aec53ff4e399f82112ca3a8a07
Parents: 237af79
Author: Peter Ansell <p_...@yahoo.com>
Authored: Thu Jan 17 12:19:18 2013 +1000
Committer: Peter Ansell <p_...@yahoo.com>
Committed: Wed Jun 26 10:06:32 2013 +1000

----------------------------------------------------------------------
 .../org/apache/any23/rdf/Any23ValueFactoryWrapper.java | 13 +++++++++++++
 1 file changed, 13 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/any23/blob/0619427e/core/src/main/java/org/apache/any23/rdf/Any23ValueFactoryWrapper.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/any23/rdf/Any23ValueFactoryWrapper.java b/core/src/main/java/org/apache/any23/rdf/Any23ValueFactoryWrapper.java
index bbde7b0..4db8629 100644
--- a/core/src/main/java/org/apache/any23/rdf/Any23ValueFactoryWrapper.java
+++ b/core/src/main/java/org/apache/any23/rdf/Any23ValueFactoryWrapper.java
@@ -17,6 +17,8 @@
 
 package org.apache.any23.rdf;
 
+import java.util.Date;
+
 import org.apache.any23.extractor.IssueReport;
 import org.openrdf.model.BNode;
 import org.openrdf.model.Literal;
@@ -25,6 +27,7 @@ import org.openrdf.model.Statement;
 import org.openrdf.model.URI;
 import org.openrdf.model.Value;
 import org.openrdf.model.ValueFactory;
+import org.openrdf.model.impl.ValueFactoryBase;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -141,6 +144,16 @@ public class Any23ValueFactoryWrapper implements ValueFactory {
         return wrappedFactory.createLiteral(pref, value);
     }
 
+    @Override
+    public Literal createLiteral(Date date) {
+        return wrappedFactory.createLiteral(date);
+    }
+
+    @Override
+    public Literal createLiteral(Object object) {
+        return wrappedFactory.createLiteral(object);
+    }
+
     public Statement createStatement(Resource sub, URI pre, Value obj) {
         if (sub == null || pre == null || obj == null) {
             return null;


[11/24] git commit: Switch off verification for now as otherwise DBPedia will be inaccessible

Posted by an...@apache.org.
Switch off verification for now as otherwise DBPedia will be
inaccessible


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

Branch: refs/heads/master
Commit: acf3afe962e7d72ded6c91434562e870a386d9a7
Parents: f8cfa0e
Author: Peter Ansell <p_...@yahoo.com>
Authored: Fri Apr 19 14:07:25 2013 +1000
Committer: Peter Ansell <p_...@yahoo.com>
Committed: Wed Jun 26 10:08:07 2013 +1000

----------------------------------------------------------------------
 .../apache/any23/extractor/rdf/BaseRDFExtractor.java   | 13 +++++++++++++
 1 file changed, 13 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/any23/blob/acf3afe9/core/src/main/java/org/apache/any23/extractor/rdf/BaseRDFExtractor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/any23/extractor/rdf/BaseRDFExtractor.java b/core/src/main/java/org/apache/any23/extractor/rdf/BaseRDFExtractor.java
index d0797dd..c079841 100644
--- a/core/src/main/java/org/apache/any23/extractor/rdf/BaseRDFExtractor.java
+++ b/core/src/main/java/org/apache/any23/extractor/rdf/BaseRDFExtractor.java
@@ -26,10 +26,13 @@ import org.apache.any23.extractor.ExtractorDescription;
 import org.openrdf.rio.RDFHandlerException;
 import org.openrdf.rio.RDFParseException;
 import org.openrdf.rio.RDFParser;
+import org.openrdf.rio.RioSetting;
+import org.openrdf.rio.helpers.BasicParserSettings;
 import org.openrdf.rio.helpers.RDFParserBase;
 
 import java.io.IOException;
 import java.io.InputStream;
+import java.util.HashSet;
 
 /**
  * Base class for a generic <i>RDF</i>
@@ -90,6 +93,16 @@ public abstract class BaseRDFExtractor implements Extractor.ContentExtractor {
     ) throws IOException, ExtractionException {
         try {
             final RDFParser parser = getParser(extractionContext, extractionResult);
+            parser.getParserConfig().setNonFatalErrors(new HashSet<RioSetting<?>>());
+
+            // Disable verification to ensure that DBPedia is accessible, given it uses so many custom datatypes
+            parser.getParserConfig().set(BasicParserSettings.FAIL_ON_UNKNOWN_DATATYPES, false);                
+            parser.getParserConfig().addNonFatalError(BasicParserSettings.FAIL_ON_UNKNOWN_DATATYPES);
+            parser.getParserConfig().set(BasicParserSettings.VERIFY_DATATYPE_VALUES, false);                
+            parser.getParserConfig().addNonFatalError(BasicParserSettings.VERIFY_DATATYPE_VALUES);
+            parser.getParserConfig().set(BasicParserSettings.NORMALIZE_DATATYPE_VALUES, false);                
+            parser.getParserConfig().addNonFatalError(BasicParserSettings.NORMALIZE_DATATYPE_VALUES);
+            
             parser.parse(in, extractionContext.getDocumentURI().stringValue());
         } catch (RDFHandlerException ex) {
             throw new IllegalStateException("Unexpected exception.", ex);


[22/24] git commit: make NQuadsParserTest pass, including always having an rdfHandler, ignoring column numbers as they are not supported, removing test for relative URL as it is not in the NQuads specification, and fixing blank node identifiers that star

Posted by an...@apache.org.
make NQuadsParserTest pass, including always having an rdfHandler, ignoring column numbers as they are not supported, removing test for relative URL as it is not in the NQuads specification, and fixing blank node identifiers that start with a number, when the specification says they must start with a letter


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

Branch: refs/heads/master
Commit: 9643063aa76726827a0ec0f3fe2bd7c047436128
Parents: c9a867b
Author: Peter Ansell <p_...@yahoo.com>
Authored: Wed Oct 24 14:17:39 2012 +1000
Committer: Peter Ansell <p_...@yahoo.com>
Committed: Wed Jun 26 10:08:07 2013 +1000

----------------------------------------------------------------------
 .../any23/io/nquads/NQuadsParserTest.java       | 60 ++++++--------------
 1 file changed, 18 insertions(+), 42 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/any23/blob/9643063a/nquads/src/test/java/org/apache/any23/io/nquads/NQuadsParserTest.java
----------------------------------------------------------------------
diff --git a/nquads/src/test/java/org/apache/any23/io/nquads/NQuadsParserTest.java b/nquads/src/test/java/org/apache/any23/io/nquads/NQuadsParserTest.java
index 5a71544..1e7d545 100644
--- a/nquads/src/test/java/org/apache/any23/io/nquads/NQuadsParserTest.java
+++ b/nquads/src/test/java/org/apache/any23/io/nquads/NQuadsParserTest.java
@@ -56,9 +56,13 @@ public class NQuadsParserTest {
 
     private NQuadsParser parser;
 
+    private TestRDFHandler rdfHandler;
+
     @Before
     public void setUp() {
         parser = new NQuadsParser();
+        rdfHandler = new TestRDFHandler();
+        parser.setRDFHandler(rdfHandler);
         parser.setVerifyData(true);
         parser.setDatatypeHandling(RDFParser.DatatypeHandling.VERIFY);
         parser.setStopAtFirstError(true);
@@ -95,8 +99,6 @@ public class NQuadsParserTest {
             "  \n\n\n# This is a comment\n\n#this is another comment."
             .getBytes()
         );
-        final TestRDFHandler rdfHandler = new TestRDFHandler();
-        parser.setRDFHandler(rdfHandler);
         parser.parse(bais, "http://test.base.uri");
         Assert.assertEquals(rdfHandler.getStatements().size(), 0);
     }
@@ -111,11 +113,9 @@ public class NQuadsParserTest {
     @Test
     public void testParseBasic() throws RDFHandlerException, IOException, RDFParseException {
         final ByteArrayInputStream bais = new ByteArrayInputStream(
-            "<http://www.v/dat/4b><http://www.w3.org/20/ica#dtend><http://sin/value/2><http://sin.siteserv.org/def/>."
+            "<http://www.v/dat/4b> <http://www.w3.org/20/ica#dtend> <http://sin/value/2> <http://sin.siteserv.org/def/>."
             .getBytes()
         );
-        final TestRDFHandler rdfHandler = new TestRDFHandler();
-        parser.setRDFHandler(rdfHandler);
         parser.parse(bais, "http://test.base.uri");
         Assert.assertThat(rdfHandler.getStatements().size(), is(1));
         final Statement statement = rdfHandler.getStatements().get(0);
@@ -136,11 +136,9 @@ public class NQuadsParserTest {
     @Test
     public void testParseBasicBNode() throws RDFHandlerException, IOException, RDFParseException {
         final ByteArrayInputStream bais = new ByteArrayInputStream(
-            "_:123456768<http://www.w3.org/20/ica#dtend><http://sin/value/2><http://sin.siteserv.org/def/>."
+            "_:a123456768 <http://www.w3.org/20/ica#dtend> <http://sin/value/2> <http://sin.siteserv.org/def/>."
             .getBytes()
         );
-        final TestRDFHandler rdfHandler = new TestRDFHandler();
-        parser.setRDFHandler(rdfHandler);
         parser.parse(bais, "http://test.base.uri");
         Assert.assertThat(rdfHandler.getStatements().size(), is(1));
         final Statement statement = rdfHandler.getStatements().get(0);
@@ -161,11 +159,9 @@ public class NQuadsParserTest {
     @Test
     public void testParseBasicLiteral() throws RDFHandlerException, IOException, RDFParseException {
         final ByteArrayInputStream bais = new ByteArrayInputStream(
-            "_:123456768<http://www.w3.org/20/ica#dtend>\"2010-05-02\"<http://sin.siteserv.org/def/>."
+            "_:a123456768 <http://www.w3.org/20/ica#dtend> \"2010-05-02\" <http://sin.siteserv.org/def/>."
             .getBytes()
         );
-        final TestRDFHandler rdfHandler = new TestRDFHandler();
-        parser.setRDFHandler(rdfHandler);
         parser.parse(bais, "http://test.base.uri");
         Assert.assertThat(rdfHandler.getStatements().size(), is(1));
         final Statement statement = rdfHandler.getStatements().get(0);
@@ -186,11 +182,9 @@ public class NQuadsParserTest {
     @Test
     public void testParseBasicLiteralLang() throws RDFHandlerException, IOException, RDFParseException {
         final ByteArrayInputStream bais = new ByteArrayInputStream(
-            "<http://www.v/dat/4b2-21><http://www.w3.org/20/ica#dtend>\"2010-05-02\"@en<http://sin.siteserv.org/def/>."
+            "<http://www.v/dat/4b2-21> <http://www.w3.org/20/ica#dtend> \"2010-05-02\"@en <http://sin.siteserv.org/def/>."
             .getBytes()
         );
-        final TestRDFHandler rdfHandler = new TestRDFHandler();
-        parser.setRDFHandler(rdfHandler);
         parser.parse(bais, "http://test.base.uri");
         final Statement statement = rdfHandler.getStatements().get(0);
         Assert.assertEquals("http://www.v/dat/4b2-21", statement.getSubject().stringValue());
@@ -213,14 +207,12 @@ public class NQuadsParserTest {
     @Test
     public void testParseBasicLiteraDatatype() throws RDFHandlerException, IOException, RDFParseException {
         final ByteArrayInputStream bais = new ByteArrayInputStream(
-            ("<http://www.v/dat/4b2-21>" +
-             "<http://www.w3.org/20/ica#dtend>" +
-             "\"2010\"^^<http://www.w3.org/2001/XMLSchema#integer>" +
+            ("<http://www.v/dat/4b2-21> " +
+             "<http://www.w3.org/20/ica#dtend> " +
+             "\"2010\"^^<http://www.w3.org/2001/XMLSchema#integer> " +
              "<http://sin.siteserv.org/def/>."
             ).getBytes()
         );
-        final TestRDFHandler rdfHandler = new TestRDFHandler();
-        parser.setRDFHandler(rdfHandler);
         parser.parse(bais, "http://test.base.uri");
         final Statement statement = rdfHandler.getStatements().get(0);
         Assert.assertEquals("http://www.v/dat/4b2-21", statement.getSubject().stringValue());
@@ -244,9 +236,7 @@ public class NQuadsParserTest {
     public void testLiteralEscapeManagement1()
     throws RDFHandlerException, IOException, RDFParseException {
         TestParseLocationListener parseLocationListener = new TestParseLocationListener();
-        TestRDFHandler rdfHandler = new TestRDFHandler();
         parser.setParseLocationListener(parseLocationListener);
-        parser.setRDFHandler(rdfHandler);
 
         final ByteArrayInputStream bais = new ByteArrayInputStream(
             "<http://a> <http://b> \"\\\\\" <http://c> .".getBytes()
@@ -254,7 +244,8 @@ public class NQuadsParserTest {
         parser.parse(bais, "http://base-uri");
 
         rdfHandler.assertHandler(1);
-        parseLocationListener.assertListener(1, 40);
+        //parseLocationListener.assertListener(1, 40);
+        parseLocationListener.assertListener(1, 1);
     }
 
     /**
@@ -268,9 +259,7 @@ public class NQuadsParserTest {
     public void testLiteralEscapeManagement2()
     throws RDFHandlerException, IOException, RDFParseException {
         TestParseLocationListener parseLocationListener = new TestParseLocationListener();
-        TestRDFHandler rdfHandler = new TestRDFHandler();
         parser.setParseLocationListener(parseLocationListener);
-        parser.setRDFHandler(rdfHandler);
 
         final ByteArrayInputStream bais = new ByteArrayInputStream(
             "<http://a> <http://b> \"Line text 1\\nLine text 2\" <http://c> .".getBytes()
@@ -294,9 +283,7 @@ public class NQuadsParserTest {
     @Test
     public void testURIDecodingManagement() throws RDFHandlerException, IOException, RDFParseException {
         TestParseLocationListener parseLocationListener = new TestParseLocationListener();
-        TestRDFHandler rdfHandler = new TestRDFHandler();
         parser.setParseLocationListener(parseLocationListener);
-        parser.setRDFHandler(rdfHandler);
 
         final ByteArrayInputStream bais = new ByteArrayInputStream(
             "<http://s/\\u306F\\u3080> <http://p/\\u306F\\u3080> <http://o/\\u306F\\u3080> <http://g/\\u306F\\u3080> ."
@@ -330,8 +317,6 @@ public class NQuadsParserTest {
 
     @Test
     public void testUnicodeLiteralManagement() throws RDFHandlerException, IOException, RDFParseException {
-        TestRDFHandler rdfHandler = new TestRDFHandler();
-        parser.setRDFHandler(rdfHandler);
         final String INPUT_LITERAL = "[は、イギリスおよびイングランドの首都である] [是大不列顛及北愛爾蘭聯合王國和英格蘭的首都]";
         final String INPUT_STRING = String.format(
                 "<http://a> <http://b> \"%s\" <http://c> .",
@@ -349,8 +334,6 @@ public class NQuadsParserTest {
 
     @Test
     public void testUnicodeLiteralDecoding() throws RDFHandlerException, IOException, RDFParseException {
-        TestRDFHandler rdfHandler = new TestRDFHandler();
-        parser.setRDFHandler(rdfHandler);
         final String INPUT_LITERAL_PLAIN   = "[は]";
         final String INPUT_LITERAL_ENCODED = "[\\u306F]";
         final String INPUT_STRING = String.format(
@@ -431,9 +414,7 @@ public class NQuadsParserTest {
     public void testParseRealData()
     throws IOException, RDFParseException, RDFHandlerException {
         TestParseLocationListener parseLocationListener = new TestParseLocationListener();
-        TestRDFHandler rdfHandler = new TestRDFHandler();
         parser.setParseLocationListener(parseLocationListener);
-        parser.setRDFHandler(rdfHandler);
 
         parser.parse(
             this.getClass().getClassLoader().getResourceAsStream("application/nquads/test2.nq"),
@@ -490,8 +471,6 @@ public class NQuadsParserTest {
                     "<http://s1> <http://p1> <http://o1> <http://g1> .\n"
                 ).getBytes()
         );
-        final TestRDFHandler rdfHandler = new TestRDFHandler();
-        parser.setRDFHandler(rdfHandler);
         parser.setStopAtFirstError(false);
         parser.parse(bais, "http://base-uri");
         rdfHandler.assertHandler(2);
@@ -514,9 +493,9 @@ public class NQuadsParserTest {
             parser.parse(bais, "http://base-uri");
             Assert.fail("Expected failure here.");
         } catch (RDFParseException e) {
-            Assert.assertTrue(e.getMessage().contains("expected '<'"));
+            Assert.assertTrue(e.getMessage().contains("Expected '<'"));
             Assert.assertEquals(1 , e.getLineNumber());
-            Assert.assertEquals(35, e.getColumnNumber());
+            //Assert.assertEquals(35, e.getColumnNumber());
         }
     }
 
@@ -528,8 +507,6 @@ public class NQuadsParserTest {
              "\"2010\"^^<http://www.w3.org/2001/XMLSchema#integer> ."
             ).getBytes()
         );
-        final TestRDFHandler rdfHandler = new TestRDFHandler();
-        parser.setRDFHandler(rdfHandler);
         parser.parse(bais, "http://test.base.uri");
         final Statement statement = rdfHandler.getStatements().get(0);
         Assert.assertEquals("http://www.v/dat/4b2-21", statement.getSubject().stringValue());
@@ -558,8 +535,6 @@ public class NQuadsParserTest {
 
     private void verifyStatementWithInvalidDatatype(RDFParser.DatatypeHandling datatypeHandling)
     throws RDFHandlerException, IOException, RDFParseException {
-        TestRDFHandler rdfHandler = new TestRDFHandler();
-        parser.setRDFHandler(rdfHandler);
         parser.setDatatypeHandling(datatypeHandling);
         final ByteArrayInputStream bais = new ByteArrayInputStream(
                 (
@@ -584,7 +559,8 @@ public class NQuadsParserTest {
 
         private void assertListener(int row, int col) {
             Assert.assertEquals("Unexpected last row", row , lastRow);
-            Assert.assertEquals("Unexpected last col", col , lastCol);
+            // Column numbers are not supported by the Rio NQuadsParser currently
+            //Assert.assertEquals("Unexpected last col", col , lastCol);
         }
 
     }
@@ -639,7 +615,7 @@ public class NQuadsParserTest {
             }
 
             if( statementIndex == 4) {
-                Assert.assertEquals(new URIImpl("http://test.base.uri#like"), statement.getPredicate() );
+                Assert.assertEquals(new URIImpl("http://example.org/#like"), statement.getPredicate() );
             }
 
             if(statementIndex == 5) {


[12/24] git commit: migrate NQuadsParserTest to make it use strict datatype handling

Posted by an...@apache.org.
migrate NQuadsParserTest to make it use strict datatype handling

apparently previously a test with a non-XSD datatype that should have
been failing was not failing

if non-XSD datatypes need to be supported now, when datatype
validation/verification is enabled, they need to have custom
org.openrdf.rio.DatatypeHandler implementations


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

Branch: refs/heads/master
Commit: f8cfa0e72999742764d51e9b225e5a405fb34157
Parents: 3a155fe
Author: Peter Ansell <p_...@yahoo.com>
Authored: Fri Apr 19 13:46:04 2013 +1000
Committer: Peter Ansell <p_...@yahoo.com>
Committed: Wed Jun 26 10:08:07 2013 +1000

----------------------------------------------------------------------
 .../any23/io/nquads/NQuadsParserTest.java       | 30 ++++++++++++++++----
 1 file changed, 25 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/any23/blob/f8cfa0e7/nquads/src/test/java/org/apache/any23/io/nquads/NQuadsParserTest.java
----------------------------------------------------------------------
diff --git a/nquads/src/test/java/org/apache/any23/io/nquads/NQuadsParserTest.java b/nquads/src/test/java/org/apache/any23/io/nquads/NQuadsParserTest.java
index 1e7d545..8d25e02 100644
--- a/nquads/src/test/java/org/apache/any23/io/nquads/NQuadsParserTest.java
+++ b/nquads/src/test/java/org/apache/any23/io/nquads/NQuadsParserTest.java
@@ -33,6 +33,8 @@ import org.openrdf.rio.RDFHandler;
 import org.openrdf.rio.RDFHandlerException;
 import org.openrdf.rio.RDFParseException;
 import org.openrdf.rio.RDFParser;
+import org.openrdf.rio.RioSetting;
+import org.openrdf.rio.helpers.BasicParserSettings;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -41,7 +43,9 @@ import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.io.InputStreamReader;
 import java.util.ArrayList;
+import java.util.HashSet;
 import java.util.List;
+import java.util.Set;
 
 import static org.hamcrest.core.Is.is;
 
@@ -63,9 +67,15 @@ public class NQuadsParserTest {
         parser = new NQuadsParser();
         rdfHandler = new TestRDFHandler();
         parser.setRDFHandler(rdfHandler);
-        parser.setVerifyData(true);
-        parser.setDatatypeHandling(RDFParser.DatatypeHandling.VERIFY);
-        parser.setStopAtFirstError(true);
+        Set<RioSetting<?>> nonFatalErrors = new HashSet<RioSetting<?>>();
+        parser.getParserConfig().setNonFatalErrors(nonFatalErrors);
+        parser.getParserConfig().set(BasicParserSettings.FAIL_ON_UNKNOWN_DATATYPES, false);
+        parser.getParserConfig().addNonFatalError(BasicParserSettings.FAIL_ON_UNKNOWN_DATATYPES);
+        parser.getParserConfig().set(BasicParserSettings.VERIFY_DATATYPE_VALUES, false);
+        parser.getParserConfig().addNonFatalError(BasicParserSettings.VERIFY_DATATYPE_VALUES);
+        parser.getParserConfig().set(BasicParserSettings.NORMALIZE_DATATYPE_VALUES, false);
+        parser.getParserConfig().addNonFatalError(BasicParserSettings.NORMALIZE_DATATYPE_VALUES);
+        
     }
 
     @After
@@ -443,7 +453,7 @@ public class NQuadsParserTest {
         verifyStatementWithInvalidDatatype(RDFParser.DatatypeHandling.IGNORE);
     }
 
-    @Test
+    @Test(expected = RDFParseException.class)
     public void testStatementWithInvalidDatatypeAndVerifyValidation()
     throws RDFHandlerException, IOException, RDFParseException {
         verifyStatementWithInvalidDatatype(RDFParser.DatatypeHandling.VERIFY);
@@ -529,7 +539,12 @@ public class NQuadsParserTest {
                 "<http://it.wikipedia.org/wiki/Camillo_Benso,_conte_di_Cavour#absolute-line=20> ."
                 ).getBytes()
         );
-        parser.setDatatypeHandling(datatypeHandling);
+        if(datatypeHandling == RDFParser.DatatypeHandling.VERIFY) {
+            parser.getParserConfig().setNonFatalErrors(new HashSet<RioSetting<?>>());
+            parser.getParserConfig().set(BasicParserSettings.FAIL_ON_UNKNOWN_DATATYPES, true);
+            parser.getParserConfig().set(BasicParserSettings.VERIFY_DATATYPE_VALUES, true);
+        }
+        //parser.setDatatypeHandling(datatypeHandling);
         parser.parse(bais, "http://base-uri");
     }
 
@@ -544,6 +559,11 @@ public class NQuadsParserTest {
                         "<http://it.wikipedia.org/wiki/Camillo_Benso,_conte_di_Cavour#absolute-line=20> ."
                 ).getBytes()
         );
+        if(datatypeHandling == RDFParser.DatatypeHandling.VERIFY) {
+            parser.getParserConfig().setNonFatalErrors(new HashSet<RioSetting<?>>());
+            parser.getParserConfig().set(BasicParserSettings.FAIL_ON_UNKNOWN_DATATYPES, true);
+            parser.getParserConfig().set(BasicParserSettings.VERIFY_DATATYPE_VALUES, true);
+        }
         parser.parse(bais, "http://base-uri");
         rdfHandler.assertHandler(1);
     }


[06/24] git commit: remove aduna repository, as sesame-2.7 is going to be deployed to sonatype and maven central

Posted by an...@apache.org.
remove aduna repository, as sesame-2.7 is going to be deployed to sonatype and maven central


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

Branch: refs/heads/master
Commit: 560dffe8215bae2eef5b0f83739bdccbb3c381e2
Parents: fa0ca27
Author: Peter Ansell <p_...@yahoo.com>
Authored: Fri Dec 7 09:50:14 2012 +1000
Committer: Peter Ansell <p_...@yahoo.com>
Committed: Wed Jun 26 10:06:32 2013 +1000

----------------------------------------------------------------------
 pom.xml | 7 -------
 1 file changed, 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/any23/blob/560dffe8/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 98a9a8f..1474bab 100644
--- a/pom.xml
+++ b/pom.xml
@@ -511,13 +511,6 @@
       <id>any23-repository-external</id>
       <url>http://svn.apache.org/repos/asf/any23/repo-ext/</url>
     </repository>
-    <!-- Specific repository for Aduna / Sesame related dependencies. -->
-    <repository>
-      <id>aduna-software-release-repo</id>
-      <name>Aduna SW Release Repository</name>
-      <url>http://repo.aduna-software.org/maven2/releases</url>
-      <layout>default</layout>
-    </repository>
   </repositories>
 
   <build>


[14/24] git commit: add verification back in but do not fail with a parse exception if it fails

Posted by an...@apache.org.
add verification back in but do not fail with a parse exception if it
fails

this will result in log messages for the as yet unsupported datatypes,
including http://www.openlinksw.com/schemas/virtrdf#Geometry


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

Branch: refs/heads/master
Commit: 8efbee79ce8771168ba898c733106f1d3cd299a8
Parents: f2ded15
Author: Peter Ansell <p_...@yahoo.com>
Authored: Fri Apr 19 15:18:52 2013 +1000
Committer: Peter Ansell <p_...@yahoo.com>
Committed: Wed Jun 26 10:08:07 2013 +1000

----------------------------------------------------------------------
 .../java/org/apache/any23/extractor/rdf/BaseRDFExtractor.java    | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/any23/blob/8efbee79/core/src/main/java/org/apache/any23/extractor/rdf/BaseRDFExtractor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/any23/extractor/rdf/BaseRDFExtractor.java b/core/src/main/java/org/apache/any23/extractor/rdf/BaseRDFExtractor.java
index c079841..6dda7a9 100644
--- a/core/src/main/java/org/apache/any23/extractor/rdf/BaseRDFExtractor.java
+++ b/core/src/main/java/org/apache/any23/extractor/rdf/BaseRDFExtractor.java
@@ -96,9 +96,9 @@ public abstract class BaseRDFExtractor implements Extractor.ContentExtractor {
             parser.getParserConfig().setNonFatalErrors(new HashSet<RioSetting<?>>());
 
             // Disable verification to ensure that DBPedia is accessible, given it uses so many custom datatypes
-            parser.getParserConfig().set(BasicParserSettings.FAIL_ON_UNKNOWN_DATATYPES, false);                
+            parser.getParserConfig().set(BasicParserSettings.FAIL_ON_UNKNOWN_DATATYPES, true);                
             parser.getParserConfig().addNonFatalError(BasicParserSettings.FAIL_ON_UNKNOWN_DATATYPES);
-            parser.getParserConfig().set(BasicParserSettings.VERIFY_DATATYPE_VALUES, false);                
+            parser.getParserConfig().set(BasicParserSettings.VERIFY_DATATYPE_VALUES, true);                
             parser.getParserConfig().addNonFatalError(BasicParserSettings.VERIFY_DATATYPE_VALUES);
             parser.getParserConfig().set(BasicParserSettings.NORMALIZE_DATATYPE_VALUES, false);                
             parser.getParserConfig().addNonFatalError(BasicParserSettings.NORMALIZE_DATATYPE_VALUES);


[24/24] git commit: Cleanup NQuads code and tests

Posted by an...@apache.org.
Cleanup NQuads code and tests

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

Branch: refs/heads/master
Commit: 78754675aa1d5201e9d04b879755ccb226988aca
Parents: 79338c0
Author: Peter Ansell <p_...@yahoo.com>
Authored: Wed Jun 26 10:19:13 2013 +1000
Committer: Peter Ansell <p_...@yahoo.com>
Committed: Wed Jun 26 10:19:13 2013 +1000

----------------------------------------------------------------------
 nquads/src/main/java/org/apache/any23/io/nquads/NQuadsParser.java  | 1 +
 .../src/test/java/org/apache/any23/io/nquads/NQuadsParserTest.java | 2 --
 2 files changed, 1 insertion(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/any23/blob/78754675/nquads/src/main/java/org/apache/any23/io/nquads/NQuadsParser.java
----------------------------------------------------------------------
diff --git a/nquads/src/main/java/org/apache/any23/io/nquads/NQuadsParser.java b/nquads/src/main/java/org/apache/any23/io/nquads/NQuadsParser.java
index 3f5b5d2..d5abfd3 100644
--- a/nquads/src/main/java/org/apache/any23/io/nquads/NQuadsParser.java
+++ b/nquads/src/main/java/org/apache/any23/io/nquads/NQuadsParser.java
@@ -35,6 +35,7 @@ import java.nio.charset.Charset;
  */
 public class NQuadsParser extends org.openrdf.rio.nquads.NQuadsParser {
 
+    @Override
     public synchronized void parse(InputStream is, String baseURI)
     throws IOException, RDFParseException, RDFHandlerException {
         if(is == null) {

http://git-wip-us.apache.org/repos/asf/any23/blob/78754675/nquads/src/test/java/org/apache/any23/io/nquads/NQuadsParserTest.java
----------------------------------------------------------------------
diff --git a/nquads/src/test/java/org/apache/any23/io/nquads/NQuadsParserTest.java b/nquads/src/test/java/org/apache/any23/io/nquads/NQuadsParserTest.java
index 8f976cf..ba54b01 100644
--- a/nquads/src/test/java/org/apache/any23/io/nquads/NQuadsParserTest.java
+++ b/nquads/src/test/java/org/apache/any23/io/nquads/NQuadsParserTest.java
@@ -607,7 +607,6 @@ public class NQuadsParserTest {
         }
 
         public void handleNamespace(String s, String s1) throws RDFHandlerException {
-            throw new UnsupportedOperationException();
         }
 
         public void handleStatement(Statement statement) throws RDFHandlerException {
@@ -616,7 +615,6 @@ public class NQuadsParserTest {
         }
 
         public void handleComment(String s) throws RDFHandlerException {
-            throw new UnsupportedOperationException();
         }
 
         public void assertHandler(int expected) {


[21/24] git commit: bump to sesame-2.7.1-SNAPSHOT to test out DBPedia datatype handler

Posted by an...@apache.org.
bump to sesame-2.7.1-SNAPSHOT to test out DBPedia datatype handler


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

Branch: refs/heads/master
Commit: a849b7b0b230027e5f82b42c37713d5f8c6d2d21
Parents: acf3afe
Author: Peter Ansell <p_...@yahoo.com>
Authored: Fri Apr 19 14:54:35 2013 +1000
Committer: Peter Ansell <p_...@yahoo.com>
Committed: Wed Jun 26 10:08:07 2013 +1000

----------------------------------------------------------------------
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/any23/blob/a849b7b0/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 28ee640..d2fbd1b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -227,7 +227,7 @@
     <implementation.build>${scmBranch}@r${buildNumber}</implementation.build>
     <implementation.build.tstamp>${implementation.build}; ${maven.build.timestamp}</implementation.build.tstamp>
     <slf4j.logger.version>1.7.5</slf4j.logger.version>
-    <sesame.version>2.7.0</sesame.version>
+    <sesame.version>2.7.1-SNAPSHOT</sesame.version>
     <latest.stable.released>0.7.0-incubating</latest.stable.released>
 
     <!-- Maven Plugin Versions -->