You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by rv...@apache.org on 2013/04/09 01:53:21 UTC
svn commit: r1465832 - in /jena/Experimental/jena-jdbc: ./
jena-jdbc-core/src/main/java/org/apache/jena/jdbc/
jena-jdbc-driver-remote/src/main/java/org/apache/jena/jdbc/remote/
jena-jdbc-driver-remote/src/main/java/org/apache/jena/jdbc/remote/statements/
Author: rvesse
Date: Mon Apr 8 23:53:21 2013
New Revision: 1465832
URL: http://svn.apache.org/r1465832
Log:
Update JavaDoc and README with newly supported connection URL parameters
Modified:
jena/Experimental/jena-jdbc/README
jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/JenaDriver.java
jena/Experimental/jena-jdbc/jena-jdbc-driver-remote/src/main/java/org/apache/jena/jdbc/remote/RemoteEndpointDriver.java
jena/Experimental/jena-jdbc/jena-jdbc-driver-remote/src/main/java/org/apache/jena/jdbc/remote/statements/RemoteEndpointStatement.java
Modified: jena/Experimental/jena-jdbc/README
URL: http://svn.apache.org/viewvc/jena/Experimental/jena-jdbc/README?rev=1465832&r1=1465831&r2=1465832&view=diff
==============================================================================
--- jena/Experimental/jena-jdbc/README (original)
+++ jena/Experimental/jena-jdbc/README Mon Apr 8 23:53:21 2013
@@ -36,6 +36,16 @@ jdbc:jena:foo:param=value&arg=1234
Arguments may be separated by ampersand (&), semicolon (;) or pipe (|)
+There are some common driver parameters supported by all Jena drivers:
+
+jdbc-compatibility=5
+
+Sets the JDBC compatibility level (range 1-9 with 1 being lowest) which affects some aspects of driver behaviour.
+
+pre-processor=my.package.class
+
+May be specified as many times as desired to register CommandPreProcessor implementations for connections.
+
In-Memory
---------
@@ -88,6 +98,30 @@ update=http://example.org/update
Sets the SPARQL Update endpoint to use, one/both of this and the query parameter must be set. Set only this for a write-only connection
+default-graph-uri=http://graph
+
+Sets a default graph for SPARQL queries, may be specified multiple times
+
+named-graph-uri=http://graph
+
+Sets a named graph for SPARQL queries, may be specified multiple times
+
+using-graph-uri=http://graph
+
+Sets a default graph for SPARQL updates, may be specified multiple times
+
+using-named-graph-uri=http://graph
+
+Sets a named graph for SPARQL updates, may be specified multiple times
+
+user=username
+
+Sets a user name to authenticate against the remote server with
+
+password=password
+
+Sets a password to authenticate against the remote server with
+
Notes:
- Remote connections do not support transactions
@@ -97,17 +131,12 @@ To Do List
This is early experimental prototyping and there is much to be done, this represents a current list of things that need implementing:
-- JDBC Compatibility
- - Provide a compatibility level parameter for all drivers that configures some aspects of behaviour depending on how JDBC like the
- user needs a connection to be
- e.g. currently we report column types as strings so that data is usable with generic JDBC apps, it may be better to allow this to
- be configured so applications that talk SPARQL can have columns typed as Node
- Connections
- Flesh out proper support for database metadata, needs lots of reporting of various metadata that we don't yet provide
- Drivers
- Support auto-commit parameter for TDB driver URLs
- - Support default-graph-uri (and so forth) parameters for Remote Endpoint driver URLs
- - Support authentication parameters for Remote Endpoint driver URLs
+ - Remote Endpoint Driver
+ - Support configurable query results types
- Provide a convenience Fuseki Driver which is merely a layer over a Remote Endpoint driver
- Statement and Result Handling
- Implement a ResultSetBuffered to support setFetchSize()
Modified: jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/JenaDriver.java
URL: http://svn.apache.org/viewvc/jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/JenaDriver.java?rev=1465832&r1=1465831&r2=1465832&view=diff
==============================================================================
--- jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/JenaDriver.java (original)
+++ jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/JenaDriver.java Mon Apr 8 23:53:21 2013
@@ -35,7 +35,7 @@ import org.apache.jena.jdbc.preprocessin
* <p>
* Abstract implementation of a Jena JDBC driver
* </p>
- * <h3>Connection URLs</h3>
+ * <h2>Connection URLs</h2>
* <p>
* All Jena JDBC drivers are expected to have connection URLs which start with
* the following:
@@ -51,7 +51,7 @@ import org.apache.jena.jdbc.preprocessin
* it appropriately identifies at a glance the type of the underlying RDF
* database.
* </p>
- * <h4>Connection URL Parameters</h4>
+ * <h3>Connection URL Parameters</h3>
* <p>
* After the prefix a Jena JDBC connection URL consists of a sequence of key
* value pairs, the characters ampersand ({@code &}), semicolon ({@code ;}) and
@@ -66,18 +66,42 @@ import org.apache.jena.jdbc.preprocessin
* pass these to the {@link #connect(String, Properties)} method directly in the
* {@link Properties} object.
* </p>
- * <h5>Common Parameters</h5>
+ * <h4>Common Parameters</h4>
* <p>
- * There is currently a single common parameter understood by all Jena JDBC
- * drivers and this is the {@code jdbc-compatibility} parameter. To avoid typos
- * when creating URLs programmatically a constant (
+ * There are some common parameter understood by all Jena JDBC drivers and which
+ * apply regardless of driver implementation.
+ * </p>
+ * <h5>JDBC Compatibility Level</h5>
+ * <p>
+ * The first of these is the {@code jdbc-compatibility} parameter. To avoid
+ * typos when creating URLs programmatically a constant (
* {@link #PARAM_JDBC_COMPATIBILITY}) is provided which contains the parameter
* name exactly as the code expects it. This parameter provides an integer value
* in the range 1-9 which denotes how compatible the driver should attempt to
* be, see {@link JdbcCompatibility} for discussion on the meaning of
- * compatibility levels. When not set the {@link JdbcCompatibility#DEFAULT}
- * compatibility level is used, note that {@link JenaConnection} objects do
- * support changing this after the connection has been established.
+ * compatibility levels.
+ * </p>
+ * <p>
+ * When not set the {@link JdbcCompatibility#DEFAULT} compatibility level is
+ * used, note that {@link JenaConnection} objects support changing this after
+ * the connection has been established.
+ * </p>
+ * <h5>Pre-Processors</h5>
+ * <p>
+ * The second of these is the {@code pre-processor} parameter which is used to
+ * specify one/more {@link CommandPreProcessor} implementations to use. The
+ * parameter should be specified once for each pre-processor you wish to you and
+ * you should supply a fully qualified class name to ensure the pre-processor
+ * can be loaded and registered on your connections. The driver will report an
+ * error if you specify a class that cannot be appropriately loaded and
+ * registered.
+ * </p>
+ * <p>
+ * Pre-processors are registered in the order that they are specified so if you
+ * use multiple pre-processors and they have ordering dependencies please ensure
+ * that you specify them in the desired order. Note that {@link JenaConnection}
+ * objects support changing registered pre-processors after the connection has
+ * been established.
* </p>
*/
public abstract class JenaDriver implements Driver {
Modified: jena/Experimental/jena-jdbc/jena-jdbc-driver-remote/src/main/java/org/apache/jena/jdbc/remote/RemoteEndpointDriver.java
URL: http://svn.apache.org/viewvc/jena/Experimental/jena-jdbc/jena-jdbc-driver-remote/src/main/java/org/apache/jena/jdbc/remote/RemoteEndpointDriver.java?rev=1465832&r1=1465831&r2=1465832&view=diff
==============================================================================
--- jena/Experimental/jena-jdbc/jena-jdbc-driver-remote/src/main/java/org/apache/jena/jdbc/remote/RemoteEndpointDriver.java (original)
+++ jena/Experimental/jena-jdbc/jena-jdbc-driver-remote/src/main/java/org/apache/jena/jdbc/remote/RemoteEndpointDriver.java Mon Apr 8 23:53:21 2013
@@ -53,6 +53,29 @@ import org.apache.jena.jdbc.remote.conne
* the relevant parameters directly on the {@link Properties} object you pass to
* the {@link #connect(String, Properties)} method.
* </p>
+ * <h3>Other Supported Parameters</h3>
+ * <p>
+ * This driver supports a variety of properties that can be used to configure
+ * aspects of its behavior, firstly there are a set of properties used to
+ * specify the dataset for queries and updates:
+ * </p>
+ * <ul>
+ * <li>{@code default-graph-uri} - Sets a default graph for queries, may be
+ * specified multiple times to specify multiple graphs to form the default graph
+ * </li>
+ * <li>{@code named-graph-uri} - Sets a named graph for queries, may be
+ * specified multiple times to specify multiple named graphs for the dataset</li>
+ * <li>{@code using-graph-uri} - Sets a default graph for updates, may be
+ * specified multiple times to specify multiple graphs to form the default graph
+ * for updates</li>
+ * <li>{@code using-named-graph-uri} - Sets a named graph for updates, may be
+ * specified multiple times to specify multiple named graphs for the dataset</li>
+ * </ul>
+ * <p>
+ * The driver also supports the standard JDBC {@code user} and {@code password}
+ * parameters which are used to set user credentials for authenticating to the
+ * remote HTTP server.
+ * </p>
*/
public class RemoteEndpointDriver extends JenaDriver {
/**
@@ -134,7 +157,7 @@ public class RemoteEndpointDriver extend
List<String> namedGraphs = this.getValues(props, PARAM_NAMED_GRAPH_URI);
List<String> usingGraphs = this.getValues(props, PARAM_USING_GRAPH_URI);
List<String> usingNamedGraphs = this.getValues(props, PARAM_USING_NAMED_GRAPH_URI);
-
+
// Authentication settings
String user = props.getProperty(PARAM_USERNAME);
String password = props.getProperty(PARAM_PASSWORD);
Modified: jena/Experimental/jena-jdbc/jena-jdbc-driver-remote/src/main/java/org/apache/jena/jdbc/remote/statements/RemoteEndpointStatement.java
URL: http://svn.apache.org/viewvc/jena/Experimental/jena-jdbc/jena-jdbc-driver-remote/src/main/java/org/apache/jena/jdbc/remote/statements/RemoteEndpointStatement.java?rev=1465832&r1=1465831&r2=1465832&view=diff
==============================================================================
--- jena/Experimental/jena-jdbc/jena-jdbc-driver-remote/src/main/java/org/apache/jena/jdbc/remote/statements/RemoteEndpointStatement.java (original)
+++ jena/Experimental/jena-jdbc/jena-jdbc-driver-remote/src/main/java/org/apache/jena/jdbc/remote/statements/RemoteEndpointStatement.java Mon Apr 8 23:53:21 2013
@@ -118,6 +118,14 @@ public class RemoteEndpointStatement ext
proc.setAuthentication(this.username, this.password);
}
+ // Apply default and named graphs if appropriate
+ if (this.remoteConn.getUsingGraphURIs() != null) {
+ proc.setDefaultGraphs(this.remoteConn.getUsingGraphURIs());
+ }
+ if (this.remoteConn.getNamedGraphURIs() != null) {
+ proc.setNamedGraphs(this.remoteConn.getUsingNamedGraphURIs());
+ }
+
return proc;
}