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/01/11 16:41:46 UTC

svn commit: r1230098 - in /incubator/jena/Jena2/TDB/trunk: ./ src-examples/tdb/examples/

Author: andy
Date: Wed Jan 11 15:41:45 2012
New Revision: 1230098

URL: http://svn.apache.org/viewvc?rev=1230098&view=rev
Log:
Transaction examples.

Added:
    incubator/jena/Jena2/TDB/trunk/src-examples/tdb/examples/ExTDB_Txn1.java
    incubator/jena/Jena2/TDB/trunk/src-examples/tdb/examples/ExTDB_Txn2.java
Modified:
    incubator/jena/Jena2/TDB/trunk/.classpath
    incubator/jena/Jena2/TDB/trunk/src-examples/tdb/examples/ExQuadFilter.java
    incubator/jena/Jena2/TDB/trunk/src-examples/tdb/examples/ExTDB1.java
    incubator/jena/Jena2/TDB/trunk/src-examples/tdb/examples/ExTDB2.java
    incubator/jena/Jena2/TDB/trunk/src-examples/tdb/examples/ExTDB3.java
    incubator/jena/Jena2/TDB/trunk/src-examples/tdb/examples/ExTDB4.java
    incubator/jena/Jena2/TDB/trunk/src-examples/tdb/examples/ExTDB5.java

Modified: incubator/jena/Jena2/TDB/trunk/.classpath
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/TDB/trunk/.classpath?rev=1230098&r1=1230097&r2=1230098&view=diff
==============================================================================
--- incubator/jena/Jena2/TDB/trunk/.classpath (original)
+++ incubator/jena/Jena2/TDB/trunk/.classpath Wed Jan 11 15:41:45 2012
@@ -1,31 +1,23 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
-  <classpathentry excluding="**/.svn/" kind="src" path="src/main/java"/>
-  <classpathentry excluding="**/.svn/" kind="src" path="src/test/java"/>
-  <classpathentry excluding="**/.svn/" kind="src" path="src-dev"/>
-  <classpathentry excluding="**/.svn/" kind="src" path="src-examples"/>
-  <classpathentry excluding="**/*.java" kind="src" path="resources"/>
-  <classpathentry excluding="**/*.java" kind="src" path="resources2"/>
-
-  <classpathentry kind="var" path="M2_REPO/org/apache/jena/jena-arq/2.9.0-incubating/jena-arq-2.9.0-incubating.jar" sourcepath="M2_REPO/org/apache/jena/jena-arq/2.8.9-incubating/jena-arq-2.8.9-incubating-sources.jar"/>
-
-  <classpathentry kind="var" path="M2_REPO/org/apache/jena/jena-arq/2.9.0-incubating/jena-arq-2.9.0-incubating-tests.jar" sourcepath="M2_REPO/org/apache/jena/jena-arq/2.9.0-incubating/jena-arq-2.9.0-incubating-test-sources.jar"/>
-
-  <classpathentry kind="var" path="M2_REPO/org/apache/jena/jena-iri/0.9.0-incubating/jena-iri-0.9.0-incubating.jar" sourcepath="M2_REPO/org/apache/jena/jena-iri/0.9.0-incubating/jena-iri-0.9.0-incubating-sources.jar"/>
-
-  <classpathentry kind="var" path="M2_REPO/org/apache/jena/jena-core/2.7.0-incubating/jena-core-2.7.0-incubating-tests.jar" sourcepath="M2_REPO/org/apache/jena/jena-core/2.7.0-incubating/jena-core-2.7.0-incubating-test-sources.jar"/>
-
-  <classpathentry kind="var" path="M2_REPO/org/apache/jena/jena-core/2.7.0-incubating/jena-core-2.7.0-incubating.jar" sourcepath="M2_REPO/org/apache/jena/jena-core/2.7.0-incubating/jena-core-2.7.0-incubating-sources.jar"/>
-
-  <classpathentry kind="var" path="M2_REPO/com/ibm/icu/icu4j/3.4.4/icu4j-3.4.4.jar" sourcepath="M2_REPO/com/ibm/icu/icu4j/3.4.4/icu4j-3.4.4-sources.jar"/>
-  <classpathentry kind="var" path="M2_REPO/junit/junit/4.9/junit-4.9.jar" sourcepath="M2_REPO/junit/junit/4.9/junit-4.9-sources.jar"/>
-  <classpathentry kind="var" path="M2_REPO/log4j/log4j/1.2.16/log4j-1.2.16.jar" sourcepath="M2_REPO/log4j/log4j/1.2.16/log4j-1.2.16-sources.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/slf4j/slf4j-api/1.6.4/slf4j-api-1.6.4.jar" sourcepath="M2_REPO/org/slf4j/slf4j-api/1.6.4/slf4j-api-1.6.4-sources.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/slf4j/slf4j-log4j12/1.6.4/slf4j-log4j12-1.6.4.jar" sourcepath="M2_REPO/org/slf4j/slf4j-log4j12/1.6.4/slf4j-log4j12-1.6.4-sources.jar"/>
-
-  <classpathentry kind="var" path="M2_REPO/xerces/xercesImpl/2.10.0/xercesImpl-2.10.0.jar"/>
-  <classpathentry kind="var" path="M2_REPO/xml-apis/xml-apis/1.4.01/xml-apis-1.4.01.jar"/>
- 
-  <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
-  <classpathentry kind="output" path="classes"/>
+	<classpathentry excluding="**/.svn/" kind="src" path="src/main/java"/>
+	<classpathentry excluding="**/.svn/" kind="src" path="src/test/java"/>
+	<classpathentry excluding="**/.svn/" kind="src" path="src-dev"/>
+	<classpathentry excluding="**/.svn/" kind="src" path="src-examples"/>
+	<classpathentry excluding="**/*.java" kind="src" path="resources"/>
+	<classpathentry excluding="**/*.java" kind="src" path="resources2"/>
+	<classpathentry kind="var" path="M2_REPO/org/apache/jena/jena-arq/2.9.0-incubating/jena-arq-2.9.0-incubating.jar" sourcepath="/M2_REPO/org/apache/jena/jena-arq/2.9.0-incubating/jena-arq-2.9.0-incubating-sources.jar"/>
+	<classpathentry kind="var" path="M2_REPO/org/apache/jena/jena-arq/2.9.0-incubating/jena-arq-2.9.0-incubating-tests.jar" sourcepath="M2_REPO/org/apache/jena/jena-arq/2.9.0-incubating/jena-arq-2.9.0-incubating-test-sources.jar"/>
+	<classpathentry kind="var" path="M2_REPO/org/apache/jena/jena-iri/0.9.0-incubating/jena-iri-0.9.0-incubating.jar" sourcepath="M2_REPO/org/apache/jena/jena-iri/0.9.0-incubating/jena-iri-0.9.0-incubating-sources.jar"/>
+	<classpathentry kind="var" path="M2_REPO/org/apache/jena/jena-core/2.7.0-incubating/jena-core-2.7.0-incubating-tests.jar" sourcepath="M2_REPO/org/apache/jena/jena-core/2.7.0-incubating/jena-core-2.7.0-incubating-test-sources.jar"/>
+	<classpathentry kind="var" path="M2_REPO/org/apache/jena/jena-core/2.7.0-incubating/jena-core-2.7.0-incubating.jar" sourcepath="M2_REPO/org/apache/jena/jena-core/2.7.0-incubating/jena-core-2.7.0-incubating-sources.jar"/>
+	<classpathentry kind="var" path="M2_REPO/com/ibm/icu/icu4j/3.4.4/icu4j-3.4.4.jar" sourcepath="M2_REPO/com/ibm/icu/icu4j/3.4.4/icu4j-3.4.4-sources.jar"/>
+	<classpathentry kind="var" path="M2_REPO/junit/junit/4.9/junit-4.9.jar" sourcepath="M2_REPO/junit/junit/4.9/junit-4.9-sources.jar"/>
+	<classpathentry kind="var" path="M2_REPO/log4j/log4j/1.2.16/log4j-1.2.16.jar" sourcepath="M2_REPO/log4j/log4j/1.2.16/log4j-1.2.16-sources.jar"/>
+	<classpathentry kind="var" path="M2_REPO/org/slf4j/slf4j-api/1.6.4/slf4j-api-1.6.4.jar" sourcepath="M2_REPO/org/slf4j/slf4j-api/1.6.4/slf4j-api-1.6.4-sources.jar"/>
+	<classpathentry kind="var" path="M2_REPO/org/slf4j/slf4j-log4j12/1.6.4/slf4j-log4j12-1.6.4.jar" sourcepath="M2_REPO/org/slf4j/slf4j-log4j12/1.6.4/slf4j-log4j12-1.6.4-sources.jar"/>
+	<classpathentry kind="var" path="M2_REPO/xerces/xercesImpl/2.10.0/xercesImpl-2.10.0.jar"/>
+	<classpathentry kind="var" path="M2_REPO/xml-apis/xml-apis/1.4.01/xml-apis-1.4.01.jar"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="output" path="classes"/>
 </classpath>

Modified: incubator/jena/Jena2/TDB/trunk/src-examples/tdb/examples/ExQuadFilter.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/TDB/trunk/src-examples/tdb/examples/ExQuadFilter.java?rev=1230098&r1=1230097&r2=1230098&view=diff
==============================================================================
--- incubator/jena/Jena2/TDB/trunk/src-examples/tdb/examples/ExQuadFilter.java (original)
+++ incubator/jena/Jena2/TDB/trunk/src-examples/tdb/examples/ExQuadFilter.java Wed Jan 11 15:41:45 2012
@@ -1,7 +1,19 @@
 /*
- * (c) Copyright 2010 Epimorphics Ltd.
- * All rights reserved.
- * [See end of file]
+ * 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 tdb.examples;
@@ -29,7 +41,7 @@ import com.hp.hpl.jena.tdb.sys.SystemTDB
  * Can be used to exclude daat from specific graphs.   
  * This mechanism is not limited to graphs - it works for properties or anything
  * where the visibility of otherwise is determined by the elements of the quad. 
- * See <a href="http://openjena.org/wiki/TDB/QuadFilter">TDB/QuadFilter</a>
+ * See <a href="http://incubator.apache.org/jena/documentation/tdb/quadfilter.html">QuadFiltering</a>
  * for further details.
  */
 
@@ -128,30 +140,3 @@ public class ExQuadFilter
     }
         
 }
-
-/*
- * (c) Copyright 2010 Epimorphics Ltd.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
\ No newline at end of file

Modified: incubator/jena/Jena2/TDB/trunk/src-examples/tdb/examples/ExTDB1.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/TDB/trunk/src-examples/tdb/examples/ExTDB1.java?rev=1230098&r1=1230097&r2=1230098&view=diff
==============================================================================
--- incubator/jena/Jena2/TDB/trunk/src-examples/tdb/examples/ExTDB1.java (original)
+++ incubator/jena/Jena2/TDB/trunk/src-examples/tdb/examples/ExTDB1.java Wed Jan 11 15:41:45 2012
@@ -1,8 +1,19 @@
 /*
- * (c) Copyright 2008, 2009 Hewlett-Packard Development Company, LP
- * (c) Copyright 2010 Epimorphics Ltd.
- * All rights reserved.
- * [See end of file]
+ * 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 tdb.examples;
@@ -38,31 +49,3 @@ public class ExTDB1
         
     }
 }
-
-/*
- * (c) Copyright 2008, 2009 Hewlett-Packard Development Company, LP
- * (c) Copyright 2010 Epimorphics Ltd.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
\ No newline at end of file

Modified: incubator/jena/Jena2/TDB/trunk/src-examples/tdb/examples/ExTDB2.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/TDB/trunk/src-examples/tdb/examples/ExTDB2.java?rev=1230098&r1=1230097&r2=1230098&view=diff
==============================================================================
--- incubator/jena/Jena2/TDB/trunk/src-examples/tdb/examples/ExTDB2.java (original)
+++ incubator/jena/Jena2/TDB/trunk/src-examples/tdb/examples/ExTDB2.java Wed Jan 11 15:41:45 2012
@@ -1,8 +1,19 @@
 /*
- * (c) Copyright 2008, 2009 Hewlett-Packard Development Company, LP
- * (c) Copyright 2010 Epimorphics Ltd.
- * All rights reserved.
- * [See end of file]
+ * 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 tdb.examples;
@@ -30,31 +41,3 @@ public class ExTDB2
         ds.close() ;
     }
 }
-
-/*
- * (c) Copyright 2008, 2009 Hewlett-Packard Development Company, LP
- * (c) Copyright 2010 Epimorphics Ltd.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
\ No newline at end of file

Modified: incubator/jena/Jena2/TDB/trunk/src-examples/tdb/examples/ExTDB3.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/TDB/trunk/src-examples/tdb/examples/ExTDB3.java?rev=1230098&r1=1230097&r2=1230098&view=diff
==============================================================================
--- incubator/jena/Jena2/TDB/trunk/src-examples/tdb/examples/ExTDB3.java (original)
+++ incubator/jena/Jena2/TDB/trunk/src-examples/tdb/examples/ExTDB3.java Wed Jan 11 15:41:45 2012
@@ -1,8 +1,19 @@
 /*
- * (c) Copyright 2008, 2009 Hewlett-Packard Development Company, LP
- * (c) Copyright 2010 Epimorphics Ltd.
- * All rights reserved.
- * [See end of file]
+ * 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 tdb.examples;
@@ -56,31 +67,3 @@ public class ExTDB3
         Dataset ds = (Dataset)Assembler.general.open(root) ;
     }
 }
-
-/*
- * (c) Copyright 2008, 2009 Hewlett-Packard Development Company, LP
- * (c) Copyright 2010 Epimorphics Ltd.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
\ No newline at end of file

Modified: incubator/jena/Jena2/TDB/trunk/src-examples/tdb/examples/ExTDB4.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/TDB/trunk/src-examples/tdb/examples/ExTDB4.java?rev=1230098&r1=1230097&r2=1230098&view=diff
==============================================================================
--- incubator/jena/Jena2/TDB/trunk/src-examples/tdb/examples/ExTDB4.java (original)
+++ incubator/jena/Jena2/TDB/trunk/src-examples/tdb/examples/ExTDB4.java Wed Jan 11 15:41:45 2012
@@ -1,8 +1,19 @@
 /*
- * (c) Copyright 2008, 2009 Hewlett-Packard Development Company, LP
- * (c) Copyright 2010 Epimorphics Ltd.
- * All rights reserved.
- * [See end of file]
+ * 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 tdb.examples;
@@ -36,7 +47,7 @@ public class ExTDB4
         
         // Potentially expensive query.
         String sparqlQueryString = "SELECT (count(*) AS ?count) { ?s ?p ?o }" ;
-        // See http://www.openjena.org/ARQ/app_api.html
+        // See http://incubator.apache.org/jena/documentation/query/app_api.html
         
         Query query = QueryFactory.create(sparqlQueryString) ;
         QueryExecution qexec = QueryExecutionFactory.create(query, dataset) ;
@@ -47,31 +58,3 @@ public class ExTDB4
         dataset.close();
     }
 }
-
-/*
- * (c) Copyright 2008, 2009 Hewlett-Packard Development Company, LP
- * (c) Copyright 2010 Epimorphics Ltd.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
\ No newline at end of file

Modified: incubator/jena/Jena2/TDB/trunk/src-examples/tdb/examples/ExTDB5.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/TDB/trunk/src-examples/tdb/examples/ExTDB5.java?rev=1230098&r1=1230097&r2=1230098&view=diff
==============================================================================
--- incubator/jena/Jena2/TDB/trunk/src-examples/tdb/examples/ExTDB5.java (original)
+++ incubator/jena/Jena2/TDB/trunk/src-examples/tdb/examples/ExTDB5.java Wed Jan 11 15:41:45 2012
@@ -1,8 +1,19 @@
 /*
- * (c) Copyright 2008, 2009 Hewlett-Packard Development Company, LP
- * (c) Copyright 2010 Epimorphics Ltd.
- * All rights reserved.
- * [See end of file]
+ * 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 tdb.examples;
@@ -36,7 +47,7 @@ public class ExTDB5
         
         // Potentially expensive query.
         String sparqlQueryString = "SELECT (count(*) AS ?count) { ?s ?p ?o }" ;
-        // See http://www.openjena.org/ARQ/app_api.html
+        // See http://incubator.apache.org/jena/documentation/query/app_api.html
         
         Query query = QueryFactory.create(sparqlQueryString) ;
         QueryExecution qexec = QueryExecutionFactory.create(query, dataset) ;
@@ -55,31 +66,3 @@ public class ExTDB5
         
     }
 }
-
-/*
- * (c) Copyright 2008, 2009 Hewlett-Packard Development Company, LP
- * (c) Copyright 2010 Epimorphics Ltd.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
\ No newline at end of file

Added: incubator/jena/Jena2/TDB/trunk/src-examples/tdb/examples/ExTDB_Txn1.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/TDB/trunk/src-examples/tdb/examples/ExTDB_Txn1.java?rev=1230098&view=auto
==============================================================================
--- incubator/jena/Jena2/TDB/trunk/src-examples/tdb/examples/ExTDB_Txn1.java (added)
+++ incubator/jena/Jena2/TDB/trunk/src-examples/tdb/examples/ExTDB_Txn1.java Wed Jan 11 15:41:45 2012
@@ -0,0 +1,79 @@
+/**
+ * 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 tdb.examples;
+
+import com.hp.hpl.jena.query.Dataset ;
+import com.hp.hpl.jena.query.Query ;
+import com.hp.hpl.jena.query.QueryExecution ;
+import com.hp.hpl.jena.query.QueryExecutionFactory ;
+import com.hp.hpl.jena.query.QueryFactory ;
+import com.hp.hpl.jena.query.QuerySolution ;
+import com.hp.hpl.jena.query.ReadWrite ;
+import com.hp.hpl.jena.query.ResultSet ;
+import com.hp.hpl.jena.tdb.TDBFactory ;
+
+/** Example of a READ transaction. */
+public class ExTDB_Txn1
+{
+    public static void main(String... argv)
+    {
+        String directory = "MyDatabases/DB1" ;
+        Dataset dataset = TDBFactory.createDataset(directory) ;
+
+        // Start READ transaction. 
+        //   No updates or changes to the dataset are possible while this
+        //   dataset is used for a read transaction.
+        //   An application can have other Datasets, in the same JVM, 
+        //   tied to the same TDB database performing read or write
+        //   transactions concurrently.
+        
+        dataset.begin(ReadWrite.READ) ;
+        try
+        {
+            // Do some queries
+            String sparqlQueryString = "SELECT (count(*) AS ?count) { ?s ?p ?o }" ;
+            execQuery(sparqlQueryString, dataset) ;
+            
+            // Can also call dataset.abort() or dataset.commit() here 
+        } finally
+        {
+            // Notify the end of the READ transaction.
+            // Any use of dataset.abort() or dataset.commit() or dataset.end()
+            // .end() can be called multiple times for the same .begin(READ)
+            dataset.end() ;
+        }
+    }
+    
+    public static void execQuery(String sparqlQueryString, Dataset dataset)
+    {
+        Query query = QueryFactory.create(sparqlQueryString) ;
+        QueryExecution qexec = QueryExecutionFactory.create(query, dataset) ;
+        try {
+            ResultSet results = qexec.execSelect() ;
+            for ( ; results.hasNext() ; )
+            {
+                QuerySolution soln = results.nextSolution() ;
+                int count = soln.getLiteral("count").getInt() ;
+                System.out.println("count = "+count) ;
+            }
+          } finally { qexec.close() ; }
+    }
+    
+}
+

Added: incubator/jena/Jena2/TDB/trunk/src-examples/tdb/examples/ExTDB_Txn2.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/TDB/trunk/src-examples/tdb/examples/ExTDB_Txn2.java?rev=1230098&view=auto
==============================================================================
--- incubator/jena/Jena2/TDB/trunk/src-examples/tdb/examples/ExTDB_Txn2.java (added)
+++ incubator/jena/Jena2/TDB/trunk/src-examples/tdb/examples/ExTDB_Txn2.java Wed Jan 11 15:41:45 2012
@@ -0,0 +1,83 @@
+/**
+ * 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 tdb.examples;
+
+import org.openjena.atlas.lib.StrUtils ;
+
+import com.hp.hpl.jena.query.Dataset ;
+import com.hp.hpl.jena.query.ReadWrite ;
+import com.hp.hpl.jena.tdb.TDBFactory ;
+import com.hp.hpl.jena.update.GraphStore ;
+import com.hp.hpl.jena.update.GraphStoreFactory ;
+import com.hp.hpl.jena.update.UpdateExecutionFactory ;
+import com.hp.hpl.jena.update.UpdateFactory ;
+import com.hp.hpl.jena.update.UpdateProcessor ;
+import com.hp.hpl.jena.update.UpdateRequest ;
+
+/** Example of a WRITE transaction. */
+public class ExTDB_Txn2
+{
+    public static void main(String... argv)
+    {
+        String directory = "MyDatabases/DB1" ;
+        Dataset dataset = TDBFactory.createDataset(directory) ;
+
+        // Start WRITE transaction. 
+        //   It's possible to read from the datet inside the write transaction.
+
+        //   An application can have other Datasets, in the same JVM, 
+        //   tied to the same TDB database performing read
+        //   transactions concurrently. If another write transaction
+        //   starts, the call of dataset.begin(WRITE) blocks until
+        //   existing writer finishes.
+        
+        dataset.begin(ReadWrite.WRITE) ;
+        try
+        {
+            GraphStore graphStore = GraphStoreFactory.create(dataset) ;
+            // Do a SPARQL Update.
+            String sparqlUpdateString = StrUtils.strjoinNL(
+                 "PREFIX . <http://example/>",
+                 "INSERT { :s :p ?now } WHERE { BIND(now() AS ?now) }"
+                 ) ;
+
+            execUpdate(sparqlUpdateString, graphStore) ;
+            dataset.commit() ;
+            // Or call .abort()
+            
+        } finally
+        {
+            // Notify the end of the transaction.
+            // The transaction was finished at the point .commit or .abort was called.
+            // .end will force an abort() if no previous call to .commit() or .abort()
+            // has occurred, so .end() help manage track the state of the transaction.
+            // .end() can be called multiple times for the same .begin(WRITE)
+            dataset.end() ;
+        }
+    }
+    
+    public static void execUpdate(String sparqlUpdateString, GraphStore graphStore)
+    {
+        UpdateRequest request = UpdateFactory.create(sparqlUpdateString) ;
+        UpdateProcessor proc = UpdateExecutionFactory.create(request, graphStore) ;
+        proc.execute() ;
+    }
+    
+}
+