commonsrdf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject [04/50] [abbrv] incubator-commonsrdf git commit: NodeFmtLib
Date Sat, 02 Jul 2016 16:14:21 GMT
NodeFmtLib


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

Branch: refs/heads/jena
Commit: f5d15e4296402a3d1dbd0eab1642c61b8b7584d8
Parents: ae1b260
Author: Andy Seaborne <andy@seaborne.org>
Authored: Thu Aug 27 16:12:41 2015 +0100
Committer: Andy Seaborne <andy@seaborne.org>
Committed: Thu Aug 27 16:12:41 2015 +0100

----------------------------------------------------------------------
 .../examples/Ex_ParseIntoCommonsRDFGraph.java         | 14 ++++++++++++--
 .../org/apache/jena/commonsrdf/impl/JCR_Term.java     |  5 +----
 2 files changed, 13 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/f5d15e42/src/main/java/org/apache/jena/commonsrdf/examples/Ex_ParseIntoCommonsRDFGraph.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/jena/commonsrdf/examples/Ex_ParseIntoCommonsRDFGraph.java
b/src/main/java/org/apache/jena/commonsrdf/examples/Ex_ParseIntoCommonsRDFGraph.java
index b3dd218..cb77289 100644
--- a/src/main/java/org/apache/jena/commonsrdf/examples/Ex_ParseIntoCommonsRDFGraph.java
+++ b/src/main/java/org/apache/jena/commonsrdf/examples/Ex_ParseIntoCommonsRDFGraph.java
@@ -20,6 +20,7 @@ package org.apache.jena.commonsrdf.examples;
 
 import org.apache.commons.rdf.api.Graph ;
 import org.apache.commons.rdf.api.RDFTermFactory ;
+import org.apache.commons.rdf.simple.SimpleRDFTermFactory ;
 import org.apache.jena.atlas.logging.LogCtl ;
 import org.apache.jena.commonsrdf.JenaCommonsRDF ;
 import org.apache.jena.commonsrdf.RDFTermFactoryJena ;
@@ -31,12 +32,21 @@ public class Ex_ParseIntoCommonsRDFGraph {
     static { LogCtl.setCmdLogging(); }
     
     public static void main(String ...a) {
-        RDFTermFactory rft = new RDFTermFactoryJena() ; // This can be a non-Jena backed
factory 
+        System.out.println("== RDFTermFactoryJena") ;
+        RDFTermFactory rft1 = new RDFTermFactoryJena() ; // This can be a non-Jena backed
factory
+        parse(rft1) ;
+        System.out.println() ;
+        System.out.println("== SimpleRDFTermFactory") ;
+        RDFTermFactory rft2 = new SimpleRDFTermFactory() ;
+        parse(rft2) ;
+    }
+    
+    public static void parse(RDFTermFactory rft) {
         Graph graph = rft.createGraph() ;
         StreamRDF dest = JenaCommonsRDF.streamJenaToCommonsRDF(rft, graph) ;
         RDFDataMgr.parse(dest, "D.ttl") ;
-        System.out.println("==== Write CommonsRDF graph\n") ;
         graph.getTriples().forEach(System.out::println) ;
     }
+    
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/f5d15e42/src/main/java/org/apache/jena/commonsrdf/impl/JCR_Term.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/jena/commonsrdf/impl/JCR_Term.java b/src/main/java/org/apache/jena/commonsrdf/impl/JCR_Term.java
index 9b897dd..f2f27ec 100644
--- a/src/main/java/org/apache/jena/commonsrdf/impl/JCR_Term.java
+++ b/src/main/java/org/apache/jena/commonsrdf/impl/JCR_Term.java
@@ -22,7 +22,6 @@ import org.apache.jena.graph.Node ;
 import org.apache.jena.riot.out.NodeFmtLib ;
 import org.apache.jena.shared.PrefixMapping ;
 import org.apache.jena.shared.impl.PrefixMappingImpl ;
-import org.apache.jena.sparql.util.FmtUtils ;
 
 class JCR_Term implements JenaNode {
     private Node node;
@@ -38,9 +37,7 @@ class JCR_Term implements JenaNode {
     }
 
     public String ntriplesString() {
-        if ( node.isBlank() )
-            return "_:C"+NodeFmtLib.encodeBNodeLabel(node.getBlankNodeLabel()) ;
-        return FmtUtils.stringForNode(node, empty) ;
+        return NodeFmtLib.str(node) ;
     }
     
     @Override


Mime
View raw message