jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject svn commit: r1564937 - /jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/lang/JsonLDReader.java
Date Wed, 05 Feb 2014 21:26:10 GMT
Author: andy
Date: Wed Feb  5 21:26:09 2014
New Revision: 1564937

URL: http://svn.apache.org/r1564937
Log:
Always produce simple literals from strings, not always xsd:strings.

Modified:
    jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/lang/JsonLDReader.java

Modified: jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/lang/JsonLDReader.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/lang/JsonLDReader.java?rev=1564937&r1=1564936&r2=1564937&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/lang/JsonLDReader.java (original)
+++ jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/lang/JsonLDReader.java Wed Feb
 5 21:26:09 2014
@@ -26,6 +26,7 @@ import java.util.Map ;
 
 import org.apache.jena.atlas.io.IO ;
 import org.apache.jena.atlas.lib.InternalErrorException ;
+import org.apache.jena.atlas.lib.Lib ;
 import org.apache.jena.atlas.web.ContentType ;
 import org.apache.jena.riot.ReaderRIOT ;
 import org.apache.jena.riot.RiotException ;
@@ -38,6 +39,7 @@ import com.github.jsonldjava.core.JSONLD
 import com.github.jsonldjava.core.RDFDataset ;
 import com.github.jsonldjava.utils.JSONUtils ;
 import com.hp.hpl.jena.datatypes.RDFDatatype ;
+import com.hp.hpl.jena.datatypes.xsd.XSDDatatype ;
 import com.hp.hpl.jena.graph.Node ;
 import com.hp.hpl.jena.graph.NodeFactory ;
 import com.hp.hpl.jena.graph.Triple ;
@@ -120,6 +122,8 @@ public class JsonLDReader implements Rea
         return createNode(x) ;
     }
 
+    private static final String xsdString = XSDDatatype.XSDstring.getURI() ;
+    
     private Node createNode(Map<String, Object> map) {
         String type = (String)map.get("type") ;
         String lex = (String)map.get("value") ;
@@ -130,6 +134,10 @@ public class JsonLDReader implements Rea
         else if ( type.equals(LITERAL) ) {
             String lang = (String)map.get("language") ;
             String datatype = (String)map.get("datatype") ;
+            if ( Lib.equal(xsdString, datatype) )
+                // In RDF 1.1, simple literals and xsd:string are the same.
+                // During migration, we prefer simple literals to xsd:strings. 
+                datatype = null ;
             if ( lang == null && datatype == null )
                 return NodeFactory.createLiteral(lex) ;
             if ( lang != null )



Mime
View raw message