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 2012/11/11 23:07:41 UTC
svn commit: r1408132 -
/jena/Scratch/AFS/Dev/trunk/src-dev/dev/Jena346_TestCase.java
Author: andy
Date: Sun Nov 11 22:07:41 2012
New Revision: 1408132
URL: http://svn.apache.org/viewvc?rev=1408132&view=rev
Log: (empty)
Added:
jena/Scratch/AFS/Dev/trunk/src-dev/dev/Jena346_TestCase.java
Added: jena/Scratch/AFS/Dev/trunk/src-dev/dev/Jena346_TestCase.java
URL: http://svn.apache.org/viewvc/jena/Scratch/AFS/Dev/trunk/src-dev/dev/Jena346_TestCase.java?rev=1408132&view=auto
==============================================================================
--- jena/Scratch/AFS/Dev/trunk/src-dev/dev/Jena346_TestCase.java (added)
+++ jena/Scratch/AFS/Dev/trunk/src-dev/dev/Jena346_TestCase.java Sun Nov 11 22:07:41 2012
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package dev;
+
+import org.openjena.atlas.lib.StrUtils ;
+
+import com.hp.hpl.jena.query.* ;
+import com.hp.hpl.jena.sparql.util.QueryExecUtils ;
+import com.hp.hpl.jena.tdb.TDB ;
+import com.hp.hpl.jena.tdb.TDBFactory ;
+import com.hp.hpl.jena.update.UpdateAction ;
+import com.hp.hpl.jena.update.UpdateFactory ;
+import com.hp.hpl.jena.update.UpdateRequest ;
+
+public class Jena346_TestCase
+{
+ public static void main(String[] args)
+ {
+ ARQ.getContext().setTrue(TDB.symUnionDefaultGraph) ;
+
+ Dataset ds = TDBFactory.createDataset() ;
+ String x = StrUtils.strjoinNL("BASE <http://example/>",
+ "CLEAR ALL ; ",
+ "INSERT DATA { GRAPH <g> { <s> <p> 1}} ; ",
+ "INSERT { GRAPH <g99> { ?s ?p 99} } WHERE { ?s ?p 1 }") ;
+ ds.begin(ReadWrite.WRITE) ;
+ UpdateRequest req = UpdateFactory.create(x) ;
+ UpdateAction.execute(req, ds) ;
+ ds.commit() ;
+ ds.end() ;
+
+ ds.begin(ReadWrite.READ) ;
+ Query q = QueryFactory.create("SELECT * { { ?s ?p ?o } UNION { GRAPH ?g { ?s ?p ?o }}}") ;
+ QueryExecution qExec = QueryExecutionFactory.create(q, ds) ;
+ QueryExecUtils.executeQuery(q, qExec) ;
+ ds.end() ;
+
+ // and again.
+ //ds.getContext().setTrue(TDB.symUnionDefaultGraph) ; //*** Exception.
+ ds.begin(ReadWrite.WRITE) ;
+ //ds.asDatasetGraph().getContext().setTrue(TDB.symUnionDefaultGraph) ;
+ UpdateAction.execute(req, ds) ;
+
+ // If skipped, no default union graph, no correct update.
+ if ( true )
+ {
+ ds.commit() ;
+ ds.end() ;
+
+ ds.begin(ReadWrite.READ) ;
+ }
+ QueryExecution qExec2 = QueryExecutionFactory.create(q, ds) ;
+ QueryExecUtils.executeQuery(q, qExec2) ;
+ ds.commit() ;
+ ds.end() ;
+
+
+ System.exit(0) ;
+ }
+}
+