clerezza-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject clerezza git commit: CLEREZZA-1009: Setting right datatype for literals with language
Date Fri, 08 Apr 2016 13:38:35 GMT
Repository: clerezza
Updated Branches:
  refs/heads/master 6e36c2ee0 -> 9f22c10e1


CLEREZZA-1009: Setting right datatype for literals with language

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

Branch: refs/heads/master
Commit: 9f22c10e17796957dbe4b2692976bf888bd5cee6
Parents: 6e36c2e
Author: Reto Gmür <reto@apache.org>
Authored: Fri Apr 8 13:34:25 2016 +0000
Committer: Reto Gmür <reto@apache.org>
Committed: Fri Apr 8 13:34:25 2016 +0000

----------------------------------------------------------------------
 rdf/jena/commons/pom.xml                                |  2 +-
 .../apache/clerezza/rdf/jena/commons/Jena2TriaUtil.java | 12 +++++++-----
 rdf/jena/facade/pom.xml                                 |  4 ++--
 rdf/jena/parser/pom.xml                                 |  4 ++--
 .../rdf/jena/parser/JenaParserProviderTest.java         | 12 ++++++++++++
 .../org/apache/clerezza/rdf/jena/parser/test-06.nt      |  1 +
 6 files changed, 25 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/clerezza/blob/9f22c10e/rdf/jena/commons/pom.xml
----------------------------------------------------------------------
diff --git a/rdf/jena/commons/pom.xml b/rdf/jena/commons/pom.xml
index d29f722..a8a33ed 100644
--- a/rdf/jena/commons/pom.xml
+++ b/rdf/jena/commons/pom.xml
@@ -30,7 +30,7 @@
     <groupId>org.apache.clerezza</groupId>
     <artifactId>rdf.jena.commons</artifactId>
     <packaging>bundle</packaging>
-    <version>1.1.0</version>
+    <version>1.1.1-SNAPSHOT</version>
     <name>Clerezza - RDF - Jena - Commons</name>
     <description>Common classes needed by Jena adaptors</description>
     <dependencyManagement>

http://git-wip-us.apache.org/repos/asf/clerezza/blob/9f22c10e/rdf/jena/commons/src/main/java/org/apache/clerezza/rdf/jena/commons/Jena2TriaUtil.java
----------------------------------------------------------------------
diff --git a/rdf/jena/commons/src/main/java/org/apache/clerezza/rdf/jena/commons/Jena2TriaUtil.java
b/rdf/jena/commons/src/main/java/org/apache/clerezza/rdf/jena/commons/Jena2TriaUtil.java
index 809d8ac..3df18dd 100644
--- a/rdf/jena/commons/src/main/java/org/apache/clerezza/rdf/jena/commons/Jena2TriaUtil.java
+++ b/rdf/jena/commons/src/main/java/org/apache/clerezza/rdf/jena/commons/Jena2TriaUtil.java
@@ -61,14 +61,16 @@ public class Jena2TriaUtil {
         final String datatypeString = node.getLiteralDatatypeURI();
         final String languageTag = node.getLiteralLanguage();
         Language language = null;
+        IRI dataType = null;
         if ((languageTag != null) && !languageTag.equals("")) {
              language = new Language(languageTag);
-        }
-        IRI dataType = null;
-        if (datatypeString != null) {
-            dataType = new IRI(datatypeString);
+             dataType = new IRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString");
         } else {
-            dataType = new IRI("http://www.w3.org/2001/XMLSchema#string");
+            if (datatypeString != null) {
+                dataType = new IRI(datatypeString);
+            } else {
+                dataType = new IRI("http://www.w3.org/2001/XMLSchema#string");
+            }
         }
         return new LiteralImpl(lexicalForm, dataType, language);
     }

http://git-wip-us.apache.org/repos/asf/clerezza/blob/9f22c10e/rdf/jena/facade/pom.xml
----------------------------------------------------------------------
diff --git a/rdf/jena/facade/pom.xml b/rdf/jena/facade/pom.xml
index 1bc4452..0e93ffd 100644
--- a/rdf/jena/facade/pom.xml
+++ b/rdf/jena/facade/pom.xml
@@ -30,7 +30,7 @@
     <groupId>org.apache.clerezza</groupId>
     <artifactId>rdf.jena.facade</artifactId>
     <packaging>bundle</packaging>
-    <version>1.1.0</version>
+    <version>1.1.1-SNAPSHOT</version>
     <name>Clerezza - RDF - Jena - Facade: Jena API on Clerezza RDF Commons</name>
     <description>An implementation of the Jena API on top of Clerezza RDF Commons,
allows to
         run code written against the Jena API on a source exposing the Clerezza Commons API
.</description>
@@ -59,7 +59,7 @@
         <dependency>
             <groupId>org.apache.clerezza</groupId>
             <artifactId>rdf.jena.commons</artifactId>
-            <version>1.0.0</version>
+            <version>1.1.1-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.wymiwyg</groupId>

http://git-wip-us.apache.org/repos/asf/clerezza/blob/9f22c10e/rdf/jena/parser/pom.xml
----------------------------------------------------------------------
diff --git a/rdf/jena/parser/pom.xml b/rdf/jena/parser/pom.xml
index fb0111c..098e54d 100644
--- a/rdf/jena/parser/pom.xml
+++ b/rdf/jena/parser/pom.xml
@@ -30,7 +30,7 @@
     <groupId>org.apache.clerezza</groupId>
     <artifactId>rdf.jena.parser</artifactId>
     <packaging>bundle</packaging>
-    <version>1.1.0</version>
+    <version>1.1.1-SNAPSHOT</version>
     <name>Clerezza - RDF - Jena - Parser</name>
     <description>A ParserProvider based on jena</description>
     <dependencyManagement>
@@ -53,7 +53,7 @@
         <dependency>
             <groupId>org.apache.clerezza</groupId>
             <artifactId>rdf.jena.facade</artifactId>
-            <version>1.0.0</version>
+            <version>1.1.1-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.apache.felix</groupId>

http://git-wip-us.apache.org/repos/asf/clerezza/blob/9f22c10e/rdf/jena/parser/src/test/java/org/apache/clerezza/rdf/jena/parser/JenaParserProviderTest.java
----------------------------------------------------------------------
diff --git a/rdf/jena/parser/src/test/java/org/apache/clerezza/rdf/jena/parser/JenaParserProviderTest.java
b/rdf/jena/parser/src/test/java/org/apache/clerezza/rdf/jena/parser/JenaParserProviderTest.java
index ff777de..05a7bbb 100644
--- a/rdf/jena/parser/src/test/java/org/apache/clerezza/rdf/jena/parser/JenaParserProviderTest.java
+++ b/rdf/jena/parser/src/test/java/org/apache/clerezza/rdf/jena/parser/JenaParserProviderTest.java
@@ -27,6 +27,7 @@ import org.apache.clerezza.rdf.core.serializedform.ParsingProvider;
 import org.apache.clerezza.commons.rdf.Graph;
 import org.apache.clerezza.commons.rdf.ImmutableGraph;
 import org.apache.clerezza.commons.rdf.IRI;
+import org.apache.clerezza.commons.rdf.Language;
 import org.apache.clerezza.commons.rdf.Literal;
 import org.apache.clerezza.commons.rdf.Triple;
 import org.apache.clerezza.commons.rdf.impl.utils.simple.SimpleGraph;
@@ -61,6 +62,17 @@ public class JenaParserProviderTest {
         Triple t1 = graphFromNTriples.filter(null, new IRI("http://discobits.org/ontology#infoBit"),
null).next();
         Assert.assertEquals(new IRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral"),
((Literal)t1.getObject()).getDataType());
     }
+    
+    @Test
+    public void testNTriplesLanguage() {
+        ParsingProvider provider = new JenaParserProvider();
+        InputStream nTriplesIn = getClass().getResourceAsStream("test-06.nt");
+        ImmutableGraph graphFromNTriples = parse(provider, nTriplesIn, "application/n-triples",
null);
+        Assert.assertEquals(1, graphFromNTriples.size());
+        Triple t1 = graphFromNTriples.iterator().next();
+        Assert.assertEquals(new IRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"),
((Literal)t1.getObject()).getDataType());
+        Assert.assertEquals(new Language("it"), ((Literal)t1.getObject()).getLanguage());
+    }
 
     /*
      * comparing result from nt and rdf/xml parsing,

http://git-wip-us.apache.org/repos/asf/clerezza/blob/9f22c10e/rdf/jena/parser/src/test/resources/org/apache/clerezza/rdf/jena/parser/test-06.nt
----------------------------------------------------------------------
diff --git a/rdf/jena/parser/src/test/resources/org/apache/clerezza/rdf/jena/parser/test-06.nt
b/rdf/jena/parser/src/test/resources/org/apache/clerezza/rdf/jena/parser/test-06.nt
new file mode 100644
index 0000000..e5feebd
--- /dev/null
+++ b/rdf/jena/parser/src/test/resources/org/apache/clerezza/rdf/jena/parser/test-06.nt
@@ -0,0 +1 @@
+<http://example.org/base#c> <http://example.org/base#d> "Ciao"@it .
\ No newline at end of file


Mime
View raw message