jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jpz6311...@apache.org
Subject svn commit: r1598941 - in /jena/trunk/jena-arq/src: main/java/org/apache/jena/riot/adapters/RDFReaderRIOT_CSV.java test/java/org/apache/jena/riot/lang/TestLangCSV.java
Date Sun, 01 Jun 2014 02:02:53 GMT
Author: jpz6311whu
Date: Sun Jun  1 02:02:53 2014
New Revision: 1598941

URL: http://svn.apache.org/r1598941
Log:
For JENA-625, add RDFReader implementation for supporting Model.read() csv file.

Added:
    jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/adapters/RDFReaderRIOT_CSV.java
  (with props)
Modified:
    jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/lang/TestLangCSV.java

Added: jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/adapters/RDFReaderRIOT_CSV.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/adapters/RDFReaderRIOT_CSV.java?rev=1598941&view=auto
==============================================================================
--- jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/adapters/RDFReaderRIOT_CSV.java
(added)
+++ jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/adapters/RDFReaderRIOT_CSV.java
Sun Jun  1 02:02:53 2014
@@ -0,0 +1,44 @@
+package org.apache.jena.riot.adapters;
+
+import java.io.InputStream;
+import java.io.Reader;
+
+import com.hp.hpl.jena.rdf.model.Model;
+import com.hp.hpl.jena.rdf.model.RDFErrorHandler;
+import com.hp.hpl.jena.rdf.model.RDFReader;
+
+public class RDFReaderRIOT_CSV implements RDFReader{
+
+	private RDFReader reader ;
+	public RDFReaderRIOT_CSV(){
+		reader = new RDFReaderRIOT("CSV");
+	}
+
+	@Override
+	public void read(Model model, Reader r, String base) {
+		reader.read(model, r, base);
+		
+	}
+
+	@Override
+	public void read(Model model, InputStream r, String base) {
+		reader.read(model, r, base);
+		
+	}
+
+	@Override
+	public void read(Model model, String url) {
+		reader.read(model, url);
+		
+	}
+
+	@Override
+	public Object setProperty(String propName, Object propValue) {
+		return reader.setProperty(propName, propValue);
+	}
+
+	@Override
+	public RDFErrorHandler setErrorHandler(RDFErrorHandler errHandler) {
+		return reader.setErrorHandler(errHandler);
+	}
+}

Propchange: jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/adapters/RDFReaderRIOT_CSV.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/lang/TestLangCSV.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/lang/TestLangCSV.java?rev=1598941&r1=1598940&r2=1598941&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/lang/TestLangCSV.java (original)
+++ jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/lang/TestLangCSV.java Sun Jun 
1 02:02:53 2014
@@ -18,13 +18,14 @@
 
 package org.apache.jena.riot.lang;
 
-import org.apache.jena.atlas.junit.BaseTest ;
-import org.apache.jena.riot.RDFDataMgr ;
-import org.apache.jena.riot.RDFLanguages ;
-import org.junit.Test ;
+import org.apache.jena.atlas.junit.BaseTest;
+import org.apache.jena.riot.RDFDataMgr;
+import org.apache.jena.riot.RDFLanguages;
+import org.junit.Test;
 
-import com.hp.hpl.jena.rdf.model.Model ;
-import com.hp.hpl.jena.util.PrintUtil ;
+import com.hp.hpl.jena.rdf.model.Model;
+import com.hp.hpl.jena.rdf.model.ModelFactory;
+import com.hp.hpl.jena.util.PrintUtil;
 
 public class TestLangCSV extends BaseTest
 {
@@ -32,6 +33,11 @@ public class TestLangCSV extends BaseTes
 		  String file = "src/test/resources/test.csv";
 		  Model m = RDFDataMgr.loadModel(file, RDFLanguages.CSV) ;
 		  assertEquals(6, m.size()) ;
-		  PrintUtil.printOut(m.listStatements());
 	  }
+	  
+	  @Test public void ModelReadTest(){
+	      Model m = ModelFactory.createDefaultModel() ;
+	      m.read("test.csv", "CSV") ;
+	      assertEquals(6, m.size()) ;
+      }
 }



Mime
View raw message