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 2016/12/22 17:55:10 UTC

[10/11] jena git commit: Clean up jena-rdfconenction

Clean up jena-rdfconenction


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

Branch: refs/heads/master
Commit: 5a70fb6f85f722be1e6d1154304ba322797e8a1b
Parents: f1ef499
Author: Andy Seaborne <an...@apache.org>
Authored: Thu Dec 22 17:20:46 2016 +0000
Committer: Andy Seaborne <an...@apache.org>
Committed: Thu Dec 22 17:20:46 2016 +0000

----------------------------------------------------------------------
 jena-parent/pom.xml                             |   1 +
 jena-rdfconnection/Documentation.md             | 222 -------------------
 jena-rdfconnection/README.md                    |   6 -
 jena-rdfconnection/pom.xml                      |  13 +-
 .../apache/jena/rdfconnection/Isolation.java    |  20 +-
 pom.xml                                         |   7 +-
 6 files changed, 25 insertions(+), 244 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/5a70fb6f/jena-parent/pom.xml
----------------------------------------------------------------------
diff --git a/jena-parent/pom.xml b/jena-parent/pom.xml
index 7cb9edf..c2627c1 100644
--- a/jena-parent/pom.xml
+++ b/jena-parent/pom.xml
@@ -433,6 +433,7 @@
             <exclude>**/.project</exclude>
             <exclude>**/.settings/**</exclude>
             <exclude>**/.classpath</exclude>
+            <exclude>**/README.*</exclude>
             <exclude>**/META-INF/services/*</exclude>
             <!--
                 jena-core exclusions

http://git-wip-us.apache.org/repos/asf/jena/blob/5a70fb6f/jena-rdfconnection/Documentation.md
----------------------------------------------------------------------
diff --git a/jena-rdfconnection/Documentation.md b/jena-rdfconnection/Documentation.md
deleted file mode 100644
index e64eb67..0000000
--- a/jena-rdfconnection/Documentation.md
+++ /dev/null
@@ -1,222 +0,0 @@
-# RDF Connection : SPARQL operations API
-
-`RDFConnection` provides a unified set of operations for working on RDF
-with SPARQL operations. It provides <a
-href="http://www.w3.org/TR/sparql11-query/">SPARQL Query</a>, <a
-href="http://www.w3.org/TR/sparql11-update/">SPARQL Update</a> and the <a
-href="http://www.w3.org/TR/sparql11-http-rdf-update/">SPARQL Graph
-Store</a> operations.  The interface is uniform - the same interface
-applies to local data and to remote data using HTTP and the SPARQL
-protocols ( <a href="http://www.w3.org/TR/sparql11-protocol/">SPARQL
-protocol</a> and <a
-href="http://www.w3.org/TR/sparql11-http-rdf-update/">SPARQL Graph Store
-Protocol</a>).
-
-## Outline
-
-`RDFConnection` provides a number of different styles for working with RDF
-data in Java.  It provides support for try-resource and functional code
-passing styles, as well the more basic sequence of methods calls.
-
-For example: using `try-resources` to manage the connection, and perform two operations, one to load
-some data, and one to make a query can be written as:
-
-```
-try ( RDFConnection conn = RDFConnectionFactory.connect(...) ) {
-    conn.load("data.ttl") ;
-    conn.querySelect("SELECT DISTINCT ?s { ?s ?p ?o }", (qs)->
-       Resource subject = qs.getResource("s") ;
-       System.out.println("Subject: "+subject) ;
-    }) ;
-}
-```
-This could have been written as (approximately -- the error handling is better
-in the example above):
-
-```
-RDFConnection conn = RDFConnectionFactory.connect(...)
-conn.load("data.ttl") ;
-QueryExecution qExec = conn.query("SELECT DISTINCT ?s { ?s ?p ?o }") ;
-ResultSet rs = qExec.execSelect() ;
-while(rs.hasNext()) {
-    QuerySolution qs = rs.next() ;
-    Resource subject = qs.getResource("s") ;
-    System.out.println("Subject: "+subject) ;
-}
-qExec.close() ;
-conn.close() ;
-```
-
-Jena also provides a separate
-[SPARQL over JDBC driver](http://jena.staging.apache.org/documentation/jdbc/index.html)
-library.
-
-## Transactions
-
-Transactions are the preferred way to work with RDF data.
-Operations on an `RDFConnection` outside of an application-controlled
-transaction will cause the system to add one for the duration of the
-operation. This "autocommit" feature may lead to inefficient operations due
-to excessive overhead.
-
-The `Txn` class provides a Java8-style transaction API.  Transactions are
-code passed in the `Txn` library that handles the transaction lifecycle.
-
-```
-try ( RDFConnection conn = RDFConnectionFactory.connect(...) ) {
-    Txn.execWrite(conn, ()-> {
-        conn.load("data1.ttl") ;
-        conn.load("data2.ttl") ;
-        conn.querySelect("SELECT DISTINCT ?s { ?s ?p ?o }", (qs)->
-           Resource subject = qs.getResource("s") ;
-           System.out.println("Subject: "+subject) ;
-        }) ;
-    }) ;
-}
-```
-
-The traditional style of explicit `begin`, `commit`, `abort` is also available.
-
-```
-try ( RDFConnection conn = RDFConnectionFactory.connect(...) ) {
-    conn.begin(ReadWrite.WRITE) ;
-    try {
-        conn.load("data1.ttl") ;
-        conn.load("data2.ttl") ;
-        conn.querySelect("SELECT DISTINCT ?s { ?s ?p ?o }", (qs)->
-           Resource subject = qs.getResource("s") ;
-           System.out.println("Subject: "+subject) ;
-        }) ;
-        conn.commit() ;
-    } finally { conn.end() ; }
-}
-```
-
-The use of `try-finally` ensures that transactions are properly finished.
-The `conn.end()` provides an abort in case an exception occurs in the
-transaction and a commit has not been issued.  The use of `try-finally`
-ensures that transactions are properly finished.
-
-`Txn` is wrapping these steps up and calling the application supplied code
-for the transaction body.
-
-### Remote Transactions
-
-SPARQL does not define a remote transaction standard protocol. Each remote
-operation shuld be atomic (all happens or nothing happens) - this is the
-responsibility of the remote server.
-
-An `RDFConnection` will at least provide the client-side locking features.
-This means that overlapping operations that change data are naturally
-handled by the transaction pattern within a single JVM.
-
-## Graph Store Protocol
-
-The <a href="http://www.w3.org/TR/sparql11-http-rdf-update/">SPARQL Graph
-Store Protocol</a> (GSP) is a set of operations to work on whole graphs in a
-dataset.  It provides a standardised way to manage the data in a dataset.
-
-The operations are to fetch a graph, set the RDF data in a graph,
-add more RDF data into a graph, and delete a graph from a dataset.
-
-For example: load two files:
-```
-  try ( RDFConnection conn = RDFConnectionFactory.connect(...) ) {
-    conn.load("data1.ttl") ;
-    conn.load("data2.nt") ;
-  } 
-```
-The file extension is used to determine the syntax.
-
-There is also a set of scripts to help do these operations from the command
-line with <a href="http://jena.apache.org/documentation/fuseki2/soh.html"
->SOH</a>. It is possible to write curl scripts as well.  The SPARQL Graph
-Store Protocol provides a standardised way to manage the data in a dataset.
-
-In addition, `RDFConnection` provides an extension to give the same style
-of operation to work on a whole dataset (deleting the dataset is not
-provided).
-
-```
-    conn.loadDataset("data-complete.trig") ;
-```
-
-### Local vs Remote
-
-GSP operations work on while models and datasets. When used on a remote connection, 
-the result of a GSP operation is a separate copy of the remote RDF data.  When working
-with local connections, 3 isolations modes are available:
-
-* Copy &ndash; the models and datasets returned are independent copies.
-Updates are made to the return copy only. This is most like
-a remote connectionand is useful for testing.
-* Read-only &ndash; the models and datasets are made read-only but any changes
-to the underlying RDF data by changes by another route will be visible.
-This provides a form of checking for large datasets when "copy" is impractical.
-* None &ndash; the models and datasets are passed back with no additional wrappers
-and they can be updated with the changes being made the underlying dataset.
-
-The default for a local `RDFConnection` is "none".  
-
-## Query Usage
-
-`RDFConnection` provides methods for each of the SPARQL query forms (`SELECT`,
-`CONSTRUCT`, `DESCRIBE`, `ASK`) as well as a way to get the lower level
-`QueryExecution` for specialized configuration.
-
-When creating an `QueryExecution` explicitly, care shoud be taken to close
-it. If the application wishes to capture the result set from a SELECT query and
-retain it across the lifetime of the transaction or `QueryExecution`, then
-the application should create a copy which is not attached to any external system
-with `ResultSetFactory.copyResults`.
-
-```
-  try ( RDFConnection conn = RDFConnectionFactory.connect("foo") ) {
-      ResultSet safeCopy =
-          Txn.execReadReturn(conn, ()-> {
-              // Process results by row:
-              conn.querySelect("SELECT DISTINCT ?s { ?s ?p ?o }", (qs)->{
-                  Resource subject = qs.getResource("s") ;
-                  System.out.println("Subject: "+subject) ;
-              }) ;
-              ResultSet rs = conn.query("SELECT * { ?s ?p ?o }").execSelect() ;
-              return ResultSetFactory.copyResults(rs) ;
-          }) ;
-  }
-```
-
-## Update Usage
-
-SPARQL Update opertions can be performed and mixed with other operations.
-
-```
-  try ( RDFConnection conn = RDFConnectionFactory.connect(...) ) {
-      Txn.execWrite(conn, ()-> {
-         conn.update("DELETE DATA { ... }" ) ;
-         conn.load("data.ttl") ;
-         }) ;
-```
-
-## Dataset operations
-
-In addition to the SPARQL Graph Store Protocol, operations on whole
-datasets are provided for fetching (HTTP GET), adding data (HTTP POST) and
-setting the data (HTTP PUT) on a dataset URL.  This assumes the remote
-server supported these REST-style operations.  Apache Jena Fuseki does
-provide these.
-
-## Subinterfaces
-
-To help structure code, the `RDFConnection` consists of a number of
-different interfaces.  An `RDFConnection` can be passed to application code
-as one of these interfaces so that only certain subsets of the full
-operations are visible to the called code.
-
-* query via `SparqlQueryConnection`
-* update via `SparqlUpdateConnection`
-* graph store protocol `RDFDatasetAccessConnection` (read operations),
-   and `RDFDatasetConnection` (read and write operations).
-
-## Examples
-
-https://github.com/apache/jena/jena-rdfconnection/tree/master/src/main/java/rdfconnection/examples

http://git-wip-us.apache.org/repos/asf/jena/blob/5a70fb6f/jena-rdfconnection/README.md
----------------------------------------------------------------------
diff --git a/jena-rdfconnection/README.md b/jena-rdfconnection/README.md
deleted file mode 100644
index 1fee5e2..0000000
--- a/jena-rdfconnection/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-RDF Connection
-==============
-
-An API for SPARQL client functionality.
-
-Works for local and remote data.

http://git-wip-us.apache.org/repos/asf/jena/blob/5a70fb6f/jena-rdfconnection/pom.xml
----------------------------------------------------------------------
diff --git a/jena-rdfconnection/pom.xml b/jena-rdfconnection/pom.xml
index d2173c3..ba7d9d1 100644
--- a/jena-rdfconnection/pom.xml
+++ b/jena-rdfconnection/pom.xml
@@ -48,9 +48,8 @@
   <dependencies>
     <dependency>
       <groupId>org.apache.jena</groupId>
-      <artifactId>apache-jena-libs</artifactId>
+      <artifactId>jena-arq</artifactId>
       <version>3.2.0-SNAPSHOT</version>
-      <type>pom</type>
     </dependency>
 
     <dependency>
@@ -147,16 +146,6 @@
         <artifactId>maven-resources-plugin</artifactId>
       </plugin>
 
-      <plugin>
-        <groupId>org.apache.rat</groupId>
-        <artifactId>apache-rat-plugin</artifactId>
-        <configuration>
-          <excludes>
-            <exclude>Documentation.md</exclude>
-            <exclude>README.*</exclude>
-          </excludes>
-        </configuration>
-      </plugin>
     </plugins>
 
   </build>

http://git-wip-us.apache.org/repos/asf/jena/blob/5a70fb6f/jena-rdfconnection/src/main/java/org/apache/jena/rdfconnection/Isolation.java
----------------------------------------------------------------------
diff --git a/jena-rdfconnection/src/main/java/org/apache/jena/rdfconnection/Isolation.java b/jena-rdfconnection/src/main/java/org/apache/jena/rdfconnection/Isolation.java
index 79c496f..1260801 100644
--- a/jena-rdfconnection/src/main/java/org/apache/jena/rdfconnection/Isolation.java
+++ b/jena-rdfconnection/src/main/java/org/apache/jena/rdfconnection/Isolation.java
@@ -1,5 +1,23 @@
+/*
+ * 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 org.apache.jena.rdfconnection;
+
 public enum Isolation { COPY, READONLY, NONE }
 
-// XXX Expose copy-mode?
 

http://git-wip-us.apache.org/repos/asf/jena/blob/5a70fb6f/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 9b005e3..82c9fd4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -72,8 +72,8 @@
         
         <module>jena-core</module>
         <module>jena-arq</module>
-        <module>jena-tdb</module>
         <module>jena-rdfconnection</module>
+        <module>jena-tdb</module>
         <module>apache-jena-libs</module>
         <module>jena-cmds</module>
         
@@ -144,8 +144,8 @@
 
         <module>jena-core</module>
         <module>jena-arq</module>
-        <module>jena-tdb</module>
         <module>jena-rdfconnection</module>
+        <module>jena-tdb</module>
         <module>apache-jena-libs</module>
         <module>jena-cmds</module>
 
@@ -157,7 +157,6 @@
 
         <module>jena-fuseki1</module>
         <module>jena-fuseki2</module>
-        <module>jena-permissions</module>
 
         <!--
             Tests of artifacts that require additional 
@@ -167,6 +166,8 @@
         -->
         <module>jena-integration-tests</module>
 
+        <module>jena-permissions</module>
+
         <module>jena-jdbc</module>
         <!-- Removed because this breaks the build after the 
              upgrade of Apache parent PM to v18 - see JENA-1184