jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [27/50] [abbrv] jena git commit: create run-construct-quad-tests with test files
Date Mon, 17 Aug 2015 15:10:06 GMT
create run-construct-quad-tests with test files

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

Branch: refs/heads/JENA-491-construct-quads
Commit: 84f6f989f0e40695ba675e81e9785e3a558d03df
Parents: 69f5ee2
Author: confidencesun <confidence.sun@gmail.com>
Authored: Wed Aug 5 11:07:49 2015 +0800
Committer: confidencesun <confidence.sun@gmail.com>
Committed: Wed Aug 5 11:07:49 2015 +0800

----------------------------------------------------------------------
 .../constructquads/ExampleConstructQuads.java   | 40 +++++++++++++++-----
 .../Syntax-ARQ/syntax-quad-construct-01.arq     |  3 ++
 .../Syntax-ARQ/syntax-quad-construct-02.arq     |  3 ++
 .../Syntax-ARQ/syntax-quad-construct-03.arq     |  3 ++
 .../Syntax-ARQ/syntax-quad-construct-04.arq     |  9 +++++
 .../Syntax-ARQ/syntax-quad-construct-05.arq     |  9 +++++
 .../Syntax-ARQ/syntax-quad-construct-06.arq     | 14 +++++++
 .../Syntax-ARQ/syntax-quad-construct-07.arq     |  7 ++++
 .../Syntax-ARQ/syntax-quad-construct-08.arq     |  9 +++++
 9 files changed, 87 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/84f6f989/jena-arq/src-examples/arq/examples/constructquads/ExampleConstructQuads.java
----------------------------------------------------------------------
diff --git a/jena-arq/src-examples/arq/examples/constructquads/ExampleConstructQuads.java
b/jena-arq/src-examples/arq/examples/constructquads/ExampleConstructQuads.java
index dcc587b..5b4efd6 100644
--- a/jena-arq/src-examples/arq/examples/constructquads/ExampleConstructQuads.java
+++ b/jena-arq/src-examples/arq/examples/constructquads/ExampleConstructQuads.java
@@ -18,6 +18,12 @@
 
 package arq.examples.constructquads;
 
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.FilenameFilter;
+import java.io.IOException;
 import java.util.Iterator;
 
 import org.apache.jena.graph.Triple;
@@ -38,7 +44,7 @@ import org.apache.jena.sparql.core.Quad;
 import org.apache.jena.util.PrintUtil;
 
 public class ExampleConstructQuads {
-	public static void main(String[] args) {
+	public static void main(String[] args) throws FileNotFoundException, IOException {
 
 		// create testing data :
 		// 1) default graph data
@@ -64,7 +70,6 @@ public class ExampleConstructQuads {
 				.create(query, dataset)) {
 			Iterator<Quad> quads = qexec.execConstructQuads();
 			PrintUtil.printOut(quads);
-			qexec.close();
 		}
 		arq.qparse.main("--in", "arq", queryString);
 
@@ -75,7 +80,6 @@ public class ExampleConstructQuads {
 				.create(query, dataset)) {
 			Iterator<Quad> quads = qexec.execConstructQuads();
 			PrintUtil.printOut(quads);
-			qexec.close();
 		}
 		arq.qparse.main("--in", "arq", queryString);
 
@@ -87,7 +91,6 @@ public class ExampleConstructQuads {
 				.create(query, dataset)) {
 			Iterator<Quad> quads = qexec.execConstructQuads();
 			PrintUtil.printOut(quads);
-			qexec.close();
 		}
 		arq.qparse.main("--in", "arq", queryString);
 
@@ -99,7 +102,6 @@ public class ExampleConstructQuads {
 				.create(query, dataset)) {
 			Iterator<Triple> triples = qexec.execConstructTriples();
 			PrintUtil.printOut(triples);
-			qexec.close();
 		}
 		arq.qparse.main("--in", "arq", queryString);
 
@@ -111,7 +113,6 @@ public class ExampleConstructQuads {
 				.create(query, dataset)) {
 			Dataset d = qexec.execConstructDataset();
 			RDFDataMgr.write(System.out, d, Lang.TRIG);
-			qexec.close();
 		}
 		arq.qparse.main("--in", "arq", queryString);
 
@@ -123,7 +124,6 @@ public class ExampleConstructQuads {
 				.create(query, dataset)) {
 			Iterator<Quad> quads = qexec.execConstructQuads();
 			PrintUtil.printOut(quads);
-			qexec.close();
 		}
 		arq.qparse.main("--in", "arq", queryString);
 
@@ -135,7 +135,6 @@ public class ExampleConstructQuads {
 				.create(query, dataset)) {
 			Iterator<Quad> quads = qexec.execConstructQuads();
 			PrintUtil.printOut(quads);
-			qexec.close();
 		}
 		arq.qparse.main("--in", "arq", queryString);
 
@@ -147,7 +146,6 @@ public class ExampleConstructQuads {
 				.create(query, dataset)) {
 			Iterator<Triple> triples = qexec.execConstructTriples();
 			PrintUtil.printOut(triples);
-			qexec.close();
 		}
 		arq.qparse.main("--in", "arq", queryString);
 
@@ -159,9 +157,31 @@ public class ExampleConstructQuads {
 				.create(query, dataset)) {
 			Iterator<Quad> quads = qexec.execConstructQuads();
 			PrintUtil.printOut(quads);
-			qexec.close();
 		}
 		arq.qparse.main("--in", "arq", queryString);
 
+		// run-construct-quad-test
+		System.out.println("run-construct-quad-test:");
+		File[] tests = new File("testing/ARQ/Syntax/Syntax-ARQ")
+				.listFiles(new FilenameFilter() {
+					public boolean accept(File dir, String fname) {
+						System.out.println(fname);
+						if (fname.startsWith("syntax-quad-construct-")) {
+							return true;
+						}
+						return false;
+					}
+				});
+		for (File test : tests) {
+			System.out.println("======== File: "+test.getName());
+			try (BufferedReader br = new BufferedReader(new FileReader(test))) {
+				String line = null;
+				while( (line = br.readLine()) != null){
+					System.out.println(line);
+				}
+			}
+			System.out.println("==== Output of qparse --file "+ test.getName());
+			arq.qparse.main("--in", "arq", "--file", test.getAbsolutePath());
+		}
 	}
 }

http://git-wip-us.apache.org/repos/asf/jena/blob/84f6f989/jena-arq/testing/ARQ/Syntax/Syntax-ARQ/syntax-quad-construct-01.arq
----------------------------------------------------------------------
diff --git a/jena-arq/testing/ARQ/Syntax/Syntax-ARQ/syntax-quad-construct-01.arq b/jena-arq/testing/ARQ/Syntax/Syntax-ARQ/syntax-quad-construct-01.arq
new file mode 100644
index 0000000..3e43045
--- /dev/null
+++ b/jena-arq/testing/ARQ/Syntax/Syntax-ARQ/syntax-quad-construct-01.arq
@@ -0,0 +1,3 @@
+PREFIX : <http://example/>
+
+CONSTRUCT { GRAPH :g { :s :p :o } } WHERE {}

http://git-wip-us.apache.org/repos/asf/jena/blob/84f6f989/jena-arq/testing/ARQ/Syntax/Syntax-ARQ/syntax-quad-construct-02.arq
----------------------------------------------------------------------
diff --git a/jena-arq/testing/ARQ/Syntax/Syntax-ARQ/syntax-quad-construct-02.arq b/jena-arq/testing/ARQ/Syntax/Syntax-ARQ/syntax-quad-construct-02.arq
new file mode 100644
index 0000000..f1bd671
--- /dev/null
+++ b/jena-arq/testing/ARQ/Syntax/Syntax-ARQ/syntax-quad-construct-02.arq
@@ -0,0 +1,3 @@
+PREFIX : <http://example/>
+
+CONSTRUCT { GRAPH ?g { ?s ?p ?o } } WHERE { ?s ?p ?o }

http://git-wip-us.apache.org/repos/asf/jena/blob/84f6f989/jena-arq/testing/ARQ/Syntax/Syntax-ARQ/syntax-quad-construct-03.arq
----------------------------------------------------------------------
diff --git a/jena-arq/testing/ARQ/Syntax/Syntax-ARQ/syntax-quad-construct-03.arq b/jena-arq/testing/ARQ/Syntax/Syntax-ARQ/syntax-quad-construct-03.arq
new file mode 100644
index 0000000..2e7c0a8
--- /dev/null
+++ b/jena-arq/testing/ARQ/Syntax/Syntax-ARQ/syntax-quad-construct-03.arq
@@ -0,0 +1,3 @@
+PREFIX : <http://example/>
+
+CONSTRUCT { :s :p :o } WHERE {}

http://git-wip-us.apache.org/repos/asf/jena/blob/84f6f989/jena-arq/testing/ARQ/Syntax/Syntax-ARQ/syntax-quad-construct-04.arq
----------------------------------------------------------------------
diff --git a/jena-arq/testing/ARQ/Syntax/Syntax-ARQ/syntax-quad-construct-04.arq b/jena-arq/testing/ARQ/Syntax/Syntax-ARQ/syntax-quad-construct-04.arq
new file mode 100644
index 0000000..7638a43
--- /dev/null
+++ b/jena-arq/testing/ARQ/Syntax/Syntax-ARQ/syntax-quad-construct-04.arq
@@ -0,0 +1,9 @@
+PREFIX : <http://example/>
+
+CONSTRUCT {
+   GRAPH ?g { :s :p :o }
+   ?s ?p ?o
+   }
+WHERE
+   { GRAPH ?g { ?s ?p ?o } }
+

http://git-wip-us.apache.org/repos/asf/jena/blob/84f6f989/jena-arq/testing/ARQ/Syntax/Syntax-ARQ/syntax-quad-construct-05.arq
----------------------------------------------------------------------
diff --git a/jena-arq/testing/ARQ/Syntax/Syntax-ARQ/syntax-quad-construct-05.arq b/jena-arq/testing/ARQ/Syntax/Syntax-ARQ/syntax-quad-construct-05.arq
new file mode 100644
index 0000000..d9b1bda
--- /dev/null
+++ b/jena-arq/testing/ARQ/Syntax/Syntax-ARQ/syntax-quad-construct-05.arq
@@ -0,0 +1,9 @@
+PREFIX : <http://example/>
+
+CONSTRUCT {
+   ?s ?p ?o
+   GRAPH ?g { :s :p :o }
+   }
+WHERE
+   { GRAPH ?g { ?s ?p ?o } }
+

http://git-wip-us.apache.org/repos/asf/jena/blob/84f6f989/jena-arq/testing/ARQ/Syntax/Syntax-ARQ/syntax-quad-construct-06.arq
----------------------------------------------------------------------
diff --git a/jena-arq/testing/ARQ/Syntax/Syntax-ARQ/syntax-quad-construct-06.arq b/jena-arq/testing/ARQ/Syntax/Syntax-ARQ/syntax-quad-construct-06.arq
new file mode 100644
index 0000000..d6b11bb
--- /dev/null
+++ b/jena-arq/testing/ARQ/Syntax/Syntax-ARQ/syntax-quad-construct-06.arq
@@ -0,0 +1,14 @@
+PREFIX : <http://example/>
+
+CONSTRUCT {
+   GRAPH ?g { :s :p :o }
+   ?s ?p ?o .
+   ?s ?p ?o .
+   GRAPH ?g { ?s ?p ?o }
+   ?s ?p ?o .
+   ?s ?p ?o
+   GRAPH ?g { ?s ?p ?o }
+   }
+WHERE
+   { GRAPH ?g { ?s ?p ?o } }
+

http://git-wip-us.apache.org/repos/asf/jena/blob/84f6f989/jena-arq/testing/ARQ/Syntax/Syntax-ARQ/syntax-quad-construct-07.arq
----------------------------------------------------------------------
diff --git a/jena-arq/testing/ARQ/Syntax/Syntax-ARQ/syntax-quad-construct-07.arq b/jena-arq/testing/ARQ/Syntax/Syntax-ARQ/syntax-quad-construct-07.arq
new file mode 100644
index 0000000..19fe948
--- /dev/null
+++ b/jena-arq/testing/ARQ/Syntax/Syntax-ARQ/syntax-quad-construct-07.arq
@@ -0,0 +1,7 @@
+PREFIX : <http://example/>
+
+CONSTRUCT {
+   GRAPH <urn:x-arq:DefaultGraphNode> {:s :p :o .}
+   }
+WHERE {}
+

http://git-wip-us.apache.org/repos/asf/jena/blob/84f6f989/jena-arq/testing/ARQ/Syntax/Syntax-ARQ/syntax-quad-construct-08.arq
----------------------------------------------------------------------
diff --git a/jena-arq/testing/ARQ/Syntax/Syntax-ARQ/syntax-quad-construct-08.arq b/jena-arq/testing/ARQ/Syntax/Syntax-ARQ/syntax-quad-construct-08.arq
new file mode 100644
index 0000000..602e81c
--- /dev/null
+++ b/jena-arq/testing/ARQ/Syntax/Syntax-ARQ/syntax-quad-construct-08.arq
@@ -0,0 +1,9 @@
+PREFIX : <http://example/>
+
+CONSTRUCT {
+   GRAPH ?g { :s :p :o }
+   GRAPH ?g1 { :s :p :o }
+   }
+WHERE
+   { }
+


Mime
View raw message