jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rve...@apache.org
Subject [22/48] jena git commit: JENA-816 : Ouput RDF 1.1 form when in RDF 1.1. mode.
Date Tue, 25 Nov 2014 16:26:44 GMT
JENA-816 : Ouput RDF 1.1 form when in RDF 1.1. mode.

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

Branch: refs/heads/hadoop-rdf
Commit: 0e83e7be295e1f466b29af553e146d8275cc92d7
Parents: be22707
Author: Andy Seaborne <andy@apache.org>
Authored: Fri Nov 21 16:48:11 2014 +0000
Committer: Andy Seaborne <andy@apache.org>
Committed: Fri Nov 21 16:48:11 2014 +0000

----------------------------------------------------------------------
 .../java/org/apache/jena/riot/out/NodeFormatterBase.java    | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/0e83e7be/jena-arq/src/main/java/org/apache/jena/riot/out/NodeFormatterBase.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/riot/out/NodeFormatterBase.java b/jena-arq/src/main/java/org/apache/jena/riot/out/NodeFormatterBase.java
index a921e97..6ea8dd7 100644
--- a/jena-arq/src/main/java/org/apache/jena/riot/out/NodeFormatterBase.java
+++ b/jena-arq/src/main/java/org/apache/jena/riot/out/NodeFormatterBase.java
@@ -20,6 +20,8 @@ package org.apache.jena.riot.out;
 
 import org.apache.jena.atlas.io.AWriter ;
 
+import com.hp.hpl.jena.JenaRuntime ;
+import com.hp.hpl.jena.datatypes.xsd.XSDDatatype ;
 import com.hp.hpl.jena.graph.Node ;
 import com.hp.hpl.jena.sparql.ARQInternalErrorException ;
 
@@ -58,7 +60,12 @@ public abstract class NodeFormatterBase implements NodeFormatter
         String lang = n.getLiteralLanguage() ;
         String lex = n.getLiteralLexicalForm() ;
         
-        if ( dt == null )
+        // In RDF 1.1, print xsd:string and language strings without datatype explicitly.
+        // dt should not be null for RDF 1.1 but let's play carefully. 
+        boolean shortString = JenaRuntime.isRDF11 ? (dt == null || dt.equals(XSDDatatype.XSDstring.getURI()))

+                                                  : (dt == null) ;
+        
+        if ( shortString )
         {
             if ( lang == null || lang.equals("") )
                 formatLitString(w, lex) ;


Mime
View raw message