You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2011/10/16 19:08:28 UTC
svn commit: r1184870 - in
/incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/dev: Run.java
ScopeVisitor.java
Author: andy
Date: Sun Oct 16 17:08:27 2011
New Revision: 1184870
URL: http://svn.apache.org/viewvc?rev=1184870&view=rev
Log: (empty)
Removed:
incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/dev/ScopeVisitor.java
Modified:
incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/dev/Run.java
Modified: incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/dev/Run.java
URL: http://svn.apache.org/viewvc/incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/dev/Run.java?rev=1184870&r1=1184869&r2=1184870&view=diff
==============================================================================
--- incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/dev/Run.java (original)
+++ incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/dev/Run.java Sun Oct 16 17:08:27 2011
@@ -18,12 +18,23 @@
package dev;
+import java.io.FileInputStream ;
+import java.io.InputStream ;
+
+import org.junit.Test ;
import org.openjena.atlas.lib.FileOps ;
import org.openjena.atlas.logging.Log ;
+import com.hp.hpl.jena.query.Query ;
+import com.hp.hpl.jena.query.QueryException ;
+import com.hp.hpl.jena.query.QueryFactory ;
+import com.hp.hpl.jena.sparql.lang.SyntaxVarScope ;
import com.hp.hpl.jena.tdb.TDB ;
+import com.hp.hpl.jena.tdb.TDBFactory ;
+import com.hp.hpl.jena.tdb.TDBLoader ;
import com.hp.hpl.jena.tdb.base.file.FileFactory ;
import com.hp.hpl.jena.tdb.base.objectfile.StringFile ;
+import com.hp.hpl.jena.tdb.store.DatasetGraphTDB ;
public class Run
{
@@ -31,8 +42,24 @@ public class Run
public static void main(String[] argv) throws Exception
{
+ // JENA-102
+ {
+ String DIR = "tmp/DB" ;
+ FileOps.ensureDir("tmp") ;
+ FileOps.ensureDir(DIR) ;
+// FileOps.clearDirectory(DIR) ;
+ DatasetGraphTDB dsg = TDBFactory.createDatasetGraph(DIR) ;
+ InputStream in = new FileInputStream("D.nt") ;
+ // Check code path when there is existing data.
+ TDBLoader.load(dsg, in, false) ;
+ System.exit(0) ;
+ }
+
+
{
+ //JENA-142
String x = "SELECT * WHERE { { ?s ?p ?o} UNION { BIND('default' AS ?s) } }" ;
+ //String x = "SELECT * WHERE { { ?s ?p ?o} { BIND('default' AS ?s) } }" ;
arq.qparse.main(x) ;
System.out.println("DONE") ;
System.exit(0) ;
@@ -46,5 +73,29 @@ public class Run
StringFile x = FileFactory.createStringFileDisk(DIR+"/nodes.dat") ;
x.dump() ;
}
+
+ @Test public void scope_22() { scope("SELECT * { ?s ?p ?o OPTIONAL{?s ?p2 ?o2} BIND(?o2+5 AS ?z) }") ; }
+
+ @Test(expected=QueryException.class)
+ public void scope_23() { scope("SELECT * { ?s ?p ?o OPTIONAL{?s ?p2 ?o2} BIND(5 AS ?o2) }") ; }
+
+ @Test(expected=QueryException.class)
+ public void scope_24() { scope("SELECT * { ?s ?p ?o OPTIONAL{?s ?p2 ?o2} BIND(?o+5 AS ?o2) }") ; }
+
+ @Test(expected=QueryException.class)
+ public void scope_25() { scope("SELECT * { ?s ?p ?o OPTIONAL{?s ?p2 ?o2} BIND(5 AS ?o) }") ; }
+
+ // new tests
+ @Test public void scope_26() { scope("SELECT * WHERE { { ?s ?p ?o} UNION { BIND('default' AS ?s) } }") ; }
+
+ @Test public void scope_27() { scope("SELECT * WHERE { { ?s ?p ?o} BIND('default' AS ?s) }") ; }
+
+ @Test public void scope_28() { scope("SELECT * WHERE { ?s ?p ?o { BIND('default' AS ?s) } }") ; }
+
+ private static void scope(String queryStr)
+ {
+ Query query = QueryFactory.create(queryStr) ;
+ SyntaxVarScope.check(query) ;
+ }
}