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 2018/02/27 23:10:38 UTC

[18/24] jena git commit: Allow raw SPARQL string to be used in HTTP requests. Add Fuseki-specific tests.

Allow raw SPARQL string to be used in HTTP requests. Add Fuseki-specific tests.


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

Branch: refs/heads/master
Commit: d7c1e97087f71b98d88cba9dec388cedf20d8fdc
Parents: 6b2dcba
Author: Andy Seaborne <an...@apache.org>
Authored: Sat Feb 24 10:57:10 2018 +0000
Committer: Andy Seaborne <an...@apache.org>
Committed: Sat Feb 24 10:57:10 2018 +0000

----------------------------------------------------------------------
 .../sparql/engine/http/QueryEngineHTTP.java     |   6 +
 .../jena/sparql/modify/UpdateProcessRemote.java |   2 +-
 .../sparql/modify/UpdateProcessRemoteBase.java  |   8 +-
 .../test/rdfconnection/TS_RDFConnection2.java   |  37 ------
 .../TS_RDFConnectionIntegration.java            |  39 ++++++
 .../test/rdfconnection/TestBlankNodeBinary.java |  89 -------------
 .../rdfconnection/TestRDFConnectionFuseki.java  |  30 +++++
 .../TestRDFConnectionFusekiBinary.java          | 123 ++++++++++++++++++
 .../rdfconnection/TestRDFConnectionRemote.java  |   6 +-
 .../rdfconnection/RDFConnectionFactory.java     |  30 ++---
 .../jena/rdfconnection/RDFConnectionFuseki.java | 119 +++++------------
 .../jena/rdfconnection/RDFConnectionRemote.java |  76 +++++++++--
 .../RDFConnectionRemoteBuilder.java             |  21 ++-
 .../jena/rdfconnection/TS_RDFConnection.java    |   4 +-
 .../jena/rdfconnection/TestLibRDFConn.java      | 127 +++++++++++++++++++
 .../apache/jena/rdfconnection/TestRDFConn.java  | 127 -------------------
 16 files changed, 470 insertions(+), 374 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/d7c1e970/jena-arq/src/main/java/org/apache/jena/sparql/engine/http/QueryEngineHTTP.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/http/QueryEngineHTTP.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/http/QueryEngineHTTP.java
index 543e3a6..165108d 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/http/QueryEngineHTTP.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/http/QueryEngineHTTP.java
@@ -895,6 +895,11 @@ public class QueryEngineHTTP implements QueryExecution {
             sBuff.append(";q=").append(v) ;
     }
 
+    /** Get the HTTP Accept header for the request. */ 
+    public String getAcceptHeader() {
+        return this.acceptHeader;
+    }
+    
     /** Set the HTTP Accept header for the request.
      * Unlike the {@code set??ContentType} operations, this is not checked 
      * for validity.
@@ -902,4 +907,5 @@ public class QueryEngineHTTP implements QueryExecution {
     public void setAcceptHeader(String acceptHeader) {
         this.acceptHeader = acceptHeader;
     }
+
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/jena/blob/d7c1e970/jena-arq/src/main/java/org/apache/jena/sparql/modify/UpdateProcessRemote.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/modify/UpdateProcessRemote.java b/jena-arq/src/main/java/org/apache/jena/sparql/modify/UpdateProcessRemote.java
index 1d8ef65..f1dd978 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/modify/UpdateProcessRemote.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/modify/UpdateProcessRemote.java
@@ -71,7 +71,7 @@ public class UpdateProcessRemote extends UpdateProcessRemoteBase
         
         // Build endpoint URL
         String endpoint = this.getEndpoint();
-        String querystring = this.getQueryString();
+        String querystring = this.getUpdateString();
         if (querystring != null && !querystring.equals("")) {
             endpoint = endpoint.contains("?") ? endpoint + "&" + querystring : endpoint + "?" + querystring;
         }

http://git-wip-us.apache.org/repos/asf/jena/blob/d7c1e970/jena-arq/src/main/java/org/apache/jena/sparql/modify/UpdateProcessRemoteBase.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/modify/UpdateProcessRemoteBase.java b/jena-arq/src/main/java/org/apache/jena/sparql/modify/UpdateProcessRemoteBase.java
index e03b087..fdf402d 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/modify/UpdateProcessRemoteBase.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/modify/UpdateProcessRemoteBase.java
@@ -130,6 +130,12 @@ public abstract class UpdateProcessRemoteBase implements UpdateProcessor {
         return this.endpoint;
     }
 
+    /** @deprecated Use {@link #getUpdateString()} */
+    @Deprecated
+    public String getQueryString() {
+        return getUpdateString();
+    }
+
     /**
      * Gets the generated HTTP query string portion of the endpoint URL if applicable
      * <p>
@@ -140,7 +146,7 @@ public abstract class UpdateProcessRemoteBase implements UpdateProcessor {
      * 
      * @return Generated query string
      */
-    public String getQueryString() {
+    public String getUpdateString() {
         return this.getParams().httpString();
     }
 

http://git-wip-us.apache.org/repos/asf/jena/blob/d7c1e970/jena-integration-tests/src/test/java/org/apache/jena/test/rdfconnection/TS_RDFConnection2.java
----------------------------------------------------------------------
diff --git a/jena-integration-tests/src/test/java/org/apache/jena/test/rdfconnection/TS_RDFConnection2.java b/jena-integration-tests/src/test/java/org/apache/jena/test/rdfconnection/TS_RDFConnection2.java
deleted file mode 100644
index ea37a51..0000000
--- a/jena-integration-tests/src/test/java/org/apache/jena/test/rdfconnection/TS_RDFConnection2.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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.test.rdfconnection;
-
-import org.junit.runner.RunWith ;
-import org.junit.runners.Suite ;
-
-@RunWith(Suite.class)
-@Suite.SuiteClasses( {
-    // Done in the module
-//    TestRDFConnectionLocalTxnMem.class ,
-//    TestRDFConnectionLocalMRSW.class ,
-    
-    // Addition tests added here.
-    TestRDFConnectionLocalTDB.class ,
-    TestRDFConnectionRemote.class,
-    TestBlankNodeBinary.class
-})
-
-public class TS_RDFConnection2 {}
-

http://git-wip-us.apache.org/repos/asf/jena/blob/d7c1e970/jena-integration-tests/src/test/java/org/apache/jena/test/rdfconnection/TS_RDFConnectionIntegration.java
----------------------------------------------------------------------
diff --git a/jena-integration-tests/src/test/java/org/apache/jena/test/rdfconnection/TS_RDFConnectionIntegration.java b/jena-integration-tests/src/test/java/org/apache/jena/test/rdfconnection/TS_RDFConnectionIntegration.java
new file mode 100644
index 0000000..ab092a3
--- /dev/null
+++ b/jena-integration-tests/src/test/java/org/apache/jena/test/rdfconnection/TS_RDFConnectionIntegration.java
@@ -0,0 +1,39 @@
+/*
+ * 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.test.rdfconnection;
+
+import org.junit.runner.RunWith ;
+import org.junit.runners.Suite ;
+
+@RunWith(Suite.class)
+@Suite.SuiteClasses( {
+    // Done in the module
+    //    TestRDFConnectionLocalTxnMem
+    //    TestRDFConnectionLocalMRSW
+
+    TestBlankNodeBinary.class,
+
+    // Addition tests added here.
+    TestRDFConnectionLocalTDB.class,
+    TestRDFConnectionRemote.class,
+    TestRDFConnectionFuseki.class,
+    TestRDFConnectionFusekiBinary.class
+})
+
+public class TS_RDFConnectionIntegration {}

http://git-wip-us.apache.org/repos/asf/jena/blob/d7c1e970/jena-integration-tests/src/test/java/org/apache/jena/test/rdfconnection/TestBlankNodeBinary.java
----------------------------------------------------------------------
diff --git a/jena-integration-tests/src/test/java/org/apache/jena/test/rdfconnection/TestBlankNodeBinary.java b/jena-integration-tests/src/test/java/org/apache/jena/test/rdfconnection/TestBlankNodeBinary.java
index a3eee4d..6d7d3a5 100644
--- a/jena-integration-tests/src/test/java/org/apache/jena/test/rdfconnection/TestBlankNodeBinary.java
+++ b/jena-integration-tests/src/test/java/org/apache/jena/test/rdfconnection/TestBlankNodeBinary.java
@@ -24,24 +24,15 @@ import static org.junit.Assert.assertTrue;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 
-import org.apache.jena.fuseki.FusekiLib;
-import org.apache.jena.fuseki.embedded.FusekiServer;
 import org.apache.jena.graph.*;
 import org.apache.jena.query.Query;
-import org.apache.jena.query.QueryExecution;
 import org.apache.jena.query.QueryFactory;
-import org.apache.jena.rdf.model.Model;
-import org.apache.jena.rdf.model.ModelFactory;
-import org.apache.jena.rdfconnection.RDFConnectionFuseki;
-import org.apache.jena.rdfconnection.RDFConnectionRemoteBuilder;
 import org.apache.jena.riot.Lang;
 import org.apache.jena.riot.RDFDataMgr;
 import org.apache.jena.sparql.algebra.Algebra;
 import org.apache.jena.sparql.algebra.Op;
 import org.apache.jena.sparql.algebra.op.OpBGP;
 import org.apache.jena.sparql.core.BasicPattern;
-import org.apache.jena.sparql.core.DatasetGraph;
-import org.apache.jena.sparql.core.DatasetGraphFactory;
 import org.apache.jena.sparql.core.TriplePath;
 import org.apache.jena.sparql.modify.request.UpdateDataInsert;
 import org.apache.jena.sparql.sse.SSE;
@@ -109,84 +100,4 @@ public class TestBlankNodeBinary {
         Node obj = ins.getQuads().get(0).getObject();
         assertEquals("789", obj.getBlankNodeLabel());
     }
-    
-    // RDFConnection level testing. 
-
-    @Test public void rdfconnection_binary_1() {
-        // Tests on one connection.
-        Triple triple = SSE.parseTriple("(:s :p <_:b3456>)");
-        // Goes in as URI! (pre this PR)
-        Model model = ModelFactory.createDefaultModel();
-        model.getGraph().add(triple);
-        
-        int PORT = FusekiLib.choosePort();
-        FusekiServer server = createFusekiServer(PORT).build().start();
-        try {
-            String dsURL = "http://localhost:"+PORT+"/ds" ;
-            assertTrue(FusekiLib.isFuseki(dsURL)); 
-
-            RDFConnectionRemoteBuilder builder = RDFConnectionFuseki.create().destination(dsURL);
-
-            try (RDFConnectionFuseki conn = (RDFConnectionFuseki)builder.build()) {
-                assertTrue(FusekiLib.isFuseki(conn));
-                // GSP
-                conn.put(model);
-                checkModel(conn, "b3456");
-
-                // Query forms.
-                conn.querySelect("SELECT * {?s ?p ?o}", x-> {
-                    Node obj = x.get("o").asNode();
-                    assertTrue(obj.isBlank());
-                    assertEquals("b3456", obj.getBlankNodeLabel());
-                });
-
-                try(QueryExecution qExec = conn.query("ASK {?s ?p <_:b3456>}")){
-                    boolean bool = qExec.execAsk();
-                    assertTrue(bool);
-                }
-
-                try (QueryExecution qExec = conn.query("CONSTRUCT { ?s ?p ?o } WHERE { ?s ?p ?o . FILTER (sameTerm(?o, <_:b3456>)) }")){
-                    Model model2 = qExec.execConstruct() ;
-                    checkModel(model2, "b3456");
-                }
-
-                try(QueryExecution qExec = conn.query("DESCRIBE ?s WHERE { ?s ?p <_:b3456>}")){
-                    Model model2 = qExec.execConstruct() ;
-                    checkModel(model2, "b3456");
-                }
-
-                // Update
-                conn.update("CLEAR DEFAULT" );
-                conn.update("INSERT DATA { <x:s> <x:p> <_:b789> }" );
-                checkModel(conn, "b789");
-                conn.update("CLEAR DEFAULT" );
-                conn.update("INSERT DATA { <x:s> <x:p> <_:6789> }" );
-                checkModel(conn, "6789");
-            }
-        } finally { server.stop(); } 
-    }
-
-    private void checkModel(RDFConnectionFuseki conn, String label) {
-        Model model2 = conn.fetch();
-        checkModel(model2, label);
-    }
-
-    private void checkModel(Model model2, String label) {
-        assertEquals(1, model2.size());
-        Node n = model2.listStatements().next().getObject().asNode();
-        assertTrue(n.isBlank());
-        assertEquals(label, n.getBlankNodeLabel());
-    }
-
-    
-    private static FusekiServer.Builder createFusekiServer(int PORT) {
-        DatasetGraph dsg = DatasetGraphFactory.createTxnMem();
-        return  
-            FusekiServer.create()
-                .setPort(PORT)
-                //.setStaticFileBase("/home/afs/ASF/jena-fuseki-cmds/sparqler")
-                .add("/ds", dsg)
-                //.setVerbose(true)
-                ;
-    }               
 }

http://git-wip-us.apache.org/repos/asf/jena/blob/d7c1e970/jena-integration-tests/src/test/java/org/apache/jena/test/rdfconnection/TestRDFConnectionFuseki.java
----------------------------------------------------------------------
diff --git a/jena-integration-tests/src/test/java/org/apache/jena/test/rdfconnection/TestRDFConnectionFuseki.java b/jena-integration-tests/src/test/java/org/apache/jena/test/rdfconnection/TestRDFConnectionFuseki.java
new file mode 100644
index 0000000..d54a72c
--- /dev/null
+++ b/jena-integration-tests/src/test/java/org/apache/jena/test/rdfconnection/TestRDFConnectionFuseki.java
@@ -0,0 +1,30 @@
+/*
+ * 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.test.rdfconnection;
+
+import org.apache.jena.rdfconnection.RDFConnection;
+import org.apache.jena.rdfconnection.RDFConnectionFactory;
+
+public class TestRDFConnectionFuseki extends TestRDFConnectionRemote {
+    @Override
+    protected RDFConnection connection() {
+        return RDFConnectionFactory.connectFuseki("http://localhost:"+PORT+"/ds");
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/jena/blob/d7c1e970/jena-integration-tests/src/test/java/org/apache/jena/test/rdfconnection/TestRDFConnectionFusekiBinary.java
----------------------------------------------------------------------
diff --git a/jena-integration-tests/src/test/java/org/apache/jena/test/rdfconnection/TestRDFConnectionFusekiBinary.java b/jena-integration-tests/src/test/java/org/apache/jena/test/rdfconnection/TestRDFConnectionFusekiBinary.java
new file mode 100644
index 0000000..9619798
--- /dev/null
+++ b/jena-integration-tests/src/test/java/org/apache/jena/test/rdfconnection/TestRDFConnectionFusekiBinary.java
@@ -0,0 +1,123 @@
+/*
+ * 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.test.rdfconnection;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.jena.fuseki.FusekiLib;
+import org.apache.jena.fuseki.embedded.FusekiServer;
+import org.apache.jena.graph.Node;
+import org.apache.jena.graph.Triple;
+import org.apache.jena.query.QueryExecution;
+import org.apache.jena.rdf.model.Model;
+import org.apache.jena.rdf.model.ModelFactory;
+import org.apache.jena.rdfconnection.RDFConnectionFuseki;
+import org.apache.jena.rdfconnection.RDFConnectionRemoteBuilder;
+import org.apache.jena.sparql.core.DatasetGraph;
+import org.apache.jena.sparql.core.DatasetGraphFactory;
+import org.apache.jena.sparql.sse.SSE;
+import org.junit.Test;
+
+/* Tests that blanknodes work over RDFConnectionFuseki
+ * This consists of testing each of the necessary components,
+ * and then a test of a connection itself.  
+ */
+
+public class TestRDFConnectionFusekiBinary {
+    private static Node n(String str) { return SSE.parseNode(str) ; }
+
+    @Test public void rdfconnection_fuseki_1() {
+        // Tests all run, in order, on one connection.
+        Triple triple = SSE.parseTriple("(:s :p <_:b3456>)");
+        // Goes in as URI! (pre this PR)
+        Model model = ModelFactory.createDefaultModel();
+        model.getGraph().add(triple);
+        
+        int PORT = FusekiLib.choosePort();
+        FusekiServer server = createFusekiServer(PORT).build().start();
+        try {
+            String dsURL = "http://localhost:"+PORT+"/ds" ;
+            assertTrue(FusekiLib.isFuseki(dsURL)); 
+
+            RDFConnectionRemoteBuilder builder = RDFConnectionFuseki.create().destination(dsURL);
+
+            try (RDFConnectionFuseki conn = (RDFConnectionFuseki)builder.build()) {
+                assertTrue(FusekiLib.isFuseki(conn));
+                // GSP
+                conn.put(model);
+                checkModel(conn, "b3456");
+
+                // Query forms.
+                conn.querySelect("SELECT * {?s ?p ?o}", x-> {
+                    Node obj = x.get("o").asNode();
+                    assertTrue(obj.isBlank());
+                    assertEquals("b3456", obj.getBlankNodeLabel());
+                });
+
+                try(QueryExecution qExec = conn.query("ASK {?s ?p <_:b3456>}")){
+                    boolean bool = qExec.execAsk();
+                    assertTrue(bool);
+                }
+
+                try (QueryExecution qExec = conn.query("CONSTRUCT { ?s ?p ?o } WHERE { ?s ?p ?o . FILTER (sameTerm(?o, <_:b3456>)) }")){
+                    Model model2 = qExec.execConstruct() ;
+                    checkModel(model2, "b3456");
+                }
+
+                try(QueryExecution qExec = conn.query("DESCRIBE ?s WHERE { ?s ?p <_:b3456>}")){
+                    Model model2 = qExec.execConstruct() ;
+                    checkModel(model2, "b3456");
+                }
+
+                // Update
+                conn.update("CLEAR DEFAULT" );
+                conn.update("INSERT DATA { <x:s> <x:p> <_:b789> }" );
+                checkModel(conn, "b789");
+                conn.update("CLEAR DEFAULT" );
+                conn.update("INSERT DATA { <x:s> <x:p> <_:6789> }" );
+                checkModel(conn, "6789");
+            }
+        } finally { server.stop(); } 
+    }
+
+    private void checkModel(RDFConnectionFuseki conn, String label) {
+        Model model2 = conn.fetch();
+        checkModel(model2, label);
+    }
+
+    private void checkModel(Model model2, String label) {
+        assertEquals(1, model2.size());
+        Node n = model2.listStatements().next().getObject().asNode();
+        assertTrue(n.isBlank());
+        assertEquals(label, n.getBlankNodeLabel());
+    }
+
+    
+    private static FusekiServer.Builder createFusekiServer(int PORT) {
+        DatasetGraph dsg = DatasetGraphFactory.createTxnMem();
+        return  
+            FusekiServer.create()
+                .setPort(PORT)
+                //.setStaticFileBase("/home/afs/ASF/jena-fuseki-cmds/sparqler")
+                .add("/ds", dsg)
+                //.setVerbose(true)
+                ;
+    }               
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/d7c1e970/jena-integration-tests/src/test/java/org/apache/jena/test/rdfconnection/TestRDFConnectionRemote.java
----------------------------------------------------------------------
diff --git a/jena-integration-tests/src/test/java/org/apache/jena/test/rdfconnection/TestRDFConnectionRemote.java b/jena-integration-tests/src/test/java/org/apache/jena/test/rdfconnection/TestRDFConnectionRemote.java
index 4b2615f..ef86755 100644
--- a/jena-integration-tests/src/test/java/org/apache/jena/test/rdfconnection/TestRDFConnectionRemote.java
+++ b/jena-integration-tests/src/test/java/org/apache/jena/test/rdfconnection/TestRDFConnectionRemote.java
@@ -20,6 +20,7 @@ package org.apache.jena.test.rdfconnection;
 
 import org.apache.jena.atlas.logging.LogCtl ;
 import org.apache.jena.fuseki.Fuseki ;
+import org.apache.jena.fuseki.FusekiLib;
 import org.apache.jena.fuseki.embedded.FusekiServer ;
 import org.apache.jena.rdfconnection.AbstractTestRDFConnection;
 import org.apache.jena.rdfconnection.RDFConnection;
@@ -34,11 +35,12 @@ import org.junit.BeforeClass ;
 public class TestRDFConnectionRemote extends AbstractTestRDFConnection {
     private static FusekiServer server ;
     private static DatasetGraph serverdsg = DatasetGraphFactory.createTxnMem() ;
+    protected static int PORT  = FusekiLib.choosePort(); 
     
     @BeforeClass
     public static void beforeClass() {
         server = FusekiServer.create()
-            .setPort(2244)
+            .setPort(PORT)
             .add("/ds", serverdsg)
             .build() ;
         LogCtl.setLevel(Fuseki.serverLogName,  "WARN");
@@ -69,7 +71,7 @@ public class TestRDFConnectionRemote extends AbstractTestRDFConnection {
 
     @Override
     protected RDFConnection connection() {
-        return RDFConnectionFactory.connect("http://localhost:2244/ds");
+        return RDFConnectionFactory.connect("http://localhost:"+PORT+"/ds");
     }
 }
 

http://git-wip-us.apache.org/repos/asf/jena/blob/d7c1e970/jena-rdfconnection/src/main/java/org/apache/jena/rdfconnection/RDFConnectionFactory.java
----------------------------------------------------------------------
diff --git a/jena-rdfconnection/src/main/java/org/apache/jena/rdfconnection/RDFConnectionFactory.java b/jena-rdfconnection/src/main/java/org/apache/jena/rdfconnection/RDFConnectionFactory.java
index 3049812..83b1442 100644
--- a/jena-rdfconnection/src/main/java/org/apache/jena/rdfconnection/RDFConnectionFactory.java
+++ b/jena-rdfconnection/src/main/java/org/apache/jena/rdfconnection/RDFConnectionFactory.java
@@ -144,21 +144,21 @@ public class RDFConnectionFactory {
     }
 
     /** Create a connection to a remote Fuseki server by URL.
-         * This is the URL for the dataset.
-         * 
-         * Each service is then specified by a URL which is relative to the {@code datasetURL}.
-         * 
-         * @param datasetURL
-         * @param queryServiceEndpoint
-         * @param updateServiceEndpoint
-         * @param graphStoreProtocolEndpoint
-         * @return RDFConnectionFuseki
-    s     */
-        public static RDFConnectionFuseki connectFuseki(String datasetURL, 
-                                                        String queryServiceEndpoint, 
-                                                        String updateServiceEndpoint,
-                                                        String graphStoreProtocolEndpoint) {
-            return (RDFConnectionFuseki)RDFConnectionFuseki.create()
+     * This is the URL for the dataset.
+     * 
+     * Each service is then specified by a URL which is relative to the {@code datasetURL}.
+     * 
+     * @param datasetURL
+     * @param queryServiceEndpoint
+     * @param updateServiceEndpoint
+     * @param graphStoreProtocolEndpoint
+     * @return RDFConnectionFuseki
+     */
+    public static RDFConnectionFuseki connectFuseki(String datasetURL, 
+                                                    String queryServiceEndpoint, 
+                                                    String updateServiceEndpoint,
+                                                    String graphStoreProtocolEndpoint) {
+        return (RDFConnectionFuseki)RDFConnectionFuseki.create()
                 .destination(datasetURL)
                 .queryEndpoint(queryServiceEndpoint)
                 .updateEndpoint(updateServiceEndpoint)

http://git-wip-us.apache.org/repos/asf/jena/blob/d7c1e970/jena-rdfconnection/src/main/java/org/apache/jena/rdfconnection/RDFConnectionFuseki.java
----------------------------------------------------------------------
diff --git a/jena-rdfconnection/src/main/java/org/apache/jena/rdfconnection/RDFConnectionFuseki.java b/jena-rdfconnection/src/main/java/org/apache/jena/rdfconnection/RDFConnectionFuseki.java
index ece1987..81fab04 100644
--- a/jena-rdfconnection/src/main/java/org/apache/jena/rdfconnection/RDFConnectionFuseki.java
+++ b/jena-rdfconnection/src/main/java/org/apache/jena/rdfconnection/RDFConnectionFuseki.java
@@ -18,27 +18,12 @@
 
 package org.apache.jena.rdfconnection;
 
-import java.util.stream.Stream;
-
 import org.apache.http.client.HttpClient;
 import org.apache.http.protocol.HttpContext;
-import org.apache.jena.graph.Graph;
-import org.apache.jena.graph.Node;
-import org.apache.jena.graph.Triple;
-import org.apache.jena.query.Dataset;
-import org.apache.jena.query.QueryExecution;
-import org.apache.jena.rdf.model.Model;
 import org.apache.jena.riot.Lang;
 import org.apache.jena.riot.RDFFormat;
-import org.apache.jena.riot.WebContent;
 import org.apache.jena.riot.resultset.ResultSetLang;
-import org.apache.jena.riot.web.HttpOp;
-import org.apache.jena.sparql.core.DatasetGraph;
-import org.apache.jena.sparql.core.Quad;
 import org.apache.jena.sparql.core.Transactional;
-import org.apache.jena.sparql.engine.http.QueryEngineHTTP;
-import org.apache.jena.update.UpdateFactory;
-import org.apache.jena.update.UpdateRequest;
 
 /** 
  * Implementation of the {@link RDFConnection} interface for connecting to an Apache Jena Fuseki.
@@ -83,6 +68,7 @@ public class RDFConnectionFuseki extends RDFConnectionRemote {
                 .acceptHeaderSelectQuery(ResultSetLang.SPARQLResultSetThrift.getHeaderString())
                 .acceptHeaderAskQuery(ResultSetLang.SPARQLResultSetJSON.getHeaderString())
                 .acceptHeaderQuery(acceptHeaderSPARQL)
+                .parseCheckSPARQL(false)
                 // Create object of this class.
                 .creator((b)->fusekiMaker(b));
     }
@@ -100,89 +86,52 @@ public class RDFConnectionFuseki extends RDFConnectionRemote {
             base.destination, base.queryURL, base.updateURL, base.gspURL,
             base.outputQuads, base.outputTriples,
             base.acceptDataset, base.acceptGraph,
-            base.acceptSparqlResults, base.acceptSelectResult, base.acceptAskResult);
+            base.acceptSparqlResults, base.acceptSelectResult, base.acceptAskResult,
+            base.parseCheckQueries, base.parseCheckUpdates);
     }
     
     protected RDFConnectionFuseki(Transactional txnLifecycle, HttpClient httpClient, HttpContext httpContext, String destination,
                                   String queryURL, String updateURL, String gspURL, RDFFormat outputQuads, RDFFormat outputTriples,
                                   String acceptDataset, String acceptGraph, 
-                                  String acceptSparqlResults, String acceptSelectResult, String acceptAskResult) {
+                                  String acceptSparqlResults, String acceptSelectResult, String acceptAskResult,
+                                  boolean parseCheckQueries, boolean parseCheckUpdates) {
         super(txnLifecycle, httpClient, httpContext, 
               destination, queryURL, updateURL, gspURL,
               outputQuads, outputTriples, 
               acceptDataset, acceptGraph,
-              acceptSparqlResults, acceptSelectResult, acceptAskResult);
+              acceptSparqlResults, acceptSelectResult, acceptAskResult, parseCheckQueries, parseCheckUpdates);
     }
     
     // Fuseki specific operations.
     
-    @Override
-    public void update(String updateString) {
-        checkUpdate();
-        if ( true ) {
-            // XXX Parse local, use original string.
-            UpdateRequest req = UpdateFactory.create(updateString);
-        }
-        exec(()->HttpOp.execHttpPost(svcUpdate, WebContent.contentTypeSPARQLUpdate, updateString, this.httpClient, this.httpContext));
-//        update(UpdateFactory.create(updateString));
-    }
-    
-//    @Override
-//    public void querySelect(String query, Consumer<QuerySolution> rowAction) {
-//        try ( QueryExecution qExec = query(query) ) {
-//            qExec.execSelect().forEachRemaining(rowAction);
-//        }
-//    }
-    
-    // Make sure all query goes through query(String) or query(Query) 
-    
-    @Override
-    public QueryExecution query(String queryString) {
-        checkQuery();
-        return exec(()-> {
-            QueryExecution qExec = new QueryEngineHTTP(svcQuery, queryString, httpClient, httpContext);
-            QueryEngineHTTP qEngine = (QueryEngineHTTP)qExec;
-            // We do not know the kind of query unless we parse it locally.
-            if ( acceptSparqlResults != null )
-                qEngine.setAcceptHeader(super.acceptSparqlResults);
-            else {
-                qEngine.setSelectContentType(acceptSelectResult);
-                qEngine.setAskContentType(acceptAskResult);
-                qEngine.setModelContentType(acceptGraph);
-                qEngine.setDatasetContentType(acceptDataset);
-            }
-            return qEngine ;
-        });
-    }
-
-    /**
-     * Return a {@link Model} that is proxy for a remote model in a Fuseki server. This
-     * support the model operations of accessing statements and changing the model.
-     * <p>
-     * This provide low level access to the remote data. The application will be working
-     * with and manipulating the remote model directly which may involve a significant
-     * overhead for every {@code Model} API operation.
-     * <p>
-     * <b><em>Warning</em>:</b> This is <b>not</b> performant for bulk changes. 
-     * <p>
-     * Getting the model, using {@link #fetch()}, which copies the whole model into a local
-     * {@code Model} object, maniupulating it and putting it back with {@link #put(Model)}
-     * provides another way to work with remote data.
-     * 
-     * @return Model
-     */
-    public Model getModelProxy() { return null; }
-    public Model getModelProxy(String graphName) { return null; }
-    
-    public Graph getGraphProxy() { return null; }
-    public Graph getGraphProxy(String graphName) { return null; }
-
-    public Dataset getDatasetProxy() { return null; }
-    public DatasetGraph getDatasetGraphProxy() { return null; }
-
-    // Or remote RDFStorage?
-    public Stream<Triple> findStream(Node s, Node p , Node o) { return null; }
-    public Stream<Quad> findStream(Node g, Node s, Node p , Node o) { return null; }
+//    /**
+//     * Return a {@link Model} that is proxy for a remote model in a Fuseki server. This
+//     * support the model operations of accessing statements and changing the model.
+//     * <p>
+//     * This provide low level access to the remote data. The application will be working
+//     * with and manipulating the remote model directly which may involve a significant
+//     * overhead for every {@code Model} API operation.
+//     * <p>
+//     * <b><em>Warning</em>:</b> This is <b>not</b> performant for bulk changes. 
+//     * <p>
+//     * Getting the model, using {@link #fetch()}, which copies the whole model into a local
+//     * {@code Model} object, maniupulating it and putting it back with {@link #put(Model)}
+//     * provides another way to work with remote data.
+//     * 
+//     * @return Model
+//     */
+//    public Model getModelProxy() { return null; }
+//    public Model getModelProxy(String graphName) { return null; }
+//    
+//    public Graph getGraphProxy() { return null; }
+//    public Graph getGraphProxy(String graphName) { return null; }
+//
+//    public Dataset getDatasetProxy() { return null; }
+//    public DatasetGraph getDatasetGraphProxy() { return null; }
+//
+//    // Or remote RDFStorage?
+//    public Stream<Triple> findStream(Node s, Node p , Node o) { return null; }
+//    public Stream<Quad> findStream(Node g, Node s, Node p , Node o) { return null; }
 
     // Send Patch 
 }

http://git-wip-us.apache.org/repos/asf/jena/blob/d7c1e970/jena-rdfconnection/src/main/java/org/apache/jena/rdfconnection/RDFConnectionRemote.java
----------------------------------------------------------------------
diff --git a/jena-rdfconnection/src/main/java/org/apache/jena/rdfconnection/RDFConnectionRemote.java b/jena-rdfconnection/src/main/java/org/apache/jena/rdfconnection/RDFConnectionRemote.java
index d0a797a..7af0ca7 100644
--- a/jena-rdfconnection/src/main/java/org/apache/jena/rdfconnection/RDFConnectionRemote.java
+++ b/jena-rdfconnection/src/main/java/org/apache/jena/rdfconnection/RDFConnectionRemote.java
@@ -22,6 +22,7 @@ import static java.util.Objects.requireNonNull;
 
 import java.io.File;
 import java.io.InputStream;
+import java.util.Objects;
 import java.util.function.Supplier;
 
 import org.apache.http.HttpEntity;
@@ -29,14 +30,13 @@ import org.apache.http.client.HttpClient;
 import org.apache.http.entity.EntityTemplate;
 import org.apache.http.protocol.HttpContext;
 import org.apache.jena.atlas.io.IO;
+import org.apache.jena.atlas.lib.InternalErrorException;
 import org.apache.jena.atlas.web.HttpException;
 import org.apache.jena.atlas.web.TypedInputStream;
 import org.apache.jena.graph.Graph;
 import org.apache.jena.query.*;
 import org.apache.jena.rdf.model.Model;
 import org.apache.jena.rdf.model.ModelFactory;
-import org.apache.jena.rdfconnection.RDFConnection;
-import org.apache.jena.rdfconnection.RDFConnectionFactory;
 import org.apache.jena.riot.*;
 import org.apache.jena.riot.web.HttpCaptureResponse;
 import org.apache.jena.riot.web.HttpOp;
@@ -47,8 +47,7 @@ import org.apache.jena.sparql.core.Transactional;
 import org.apache.jena.sparql.core.TransactionalLock;
 import org.apache.jena.sparql.engine.http.QueryEngineHTTP;
 import org.apache.jena.system.Txn;
-import org.apache.jena.update.UpdateExecutionFactory;
-import org.apache.jena.update.UpdateProcessor;
+import org.apache.jena.update.UpdateFactory;
 import org.apache.jena.update.UpdateRequest;
 import org.apache.jena.web.HttpSC;
 
@@ -81,6 +80,11 @@ public class RDFConnectionRemote implements RDFConnection {
     protected final String acceptSelectResult;
     protected final String acceptAskResult;
     
+    // Whether to check SPARQL queries given as strings by parsing them.
+    protected final boolean parseCheckQueries;
+    // Whether to check SPARQL updates given as strings by parsing them.
+    protected final boolean parseCheckUpdates;
+
     /** Create a {@link RDFConnectionRemoteBuilder}. */
     public static RDFConnectionRemoteBuilder create() {
         return new RDFConnectionRemoteBuilder();
@@ -160,7 +164,8 @@ public class RDFConnectionRemote implements RDFConnection {
             RDFFormat.NQUADS, RDFFormat.NTRIPLES,
             WebContent.defaultGraphAcceptHeader, WebContent.defaultDatasetAcceptHeader,
             null,
-            QueryEngineHTTP.defaultSelectHeader(), QueryEngineHTTP.defaultAskHeader());
+            QueryEngineHTTP.defaultSelectHeader(), QueryEngineHTTP.defaultAskHeader(),
+            true, true);
     }
 
     // Used by the builder.
@@ -168,7 +173,8 @@ public class RDFConnectionRemote implements RDFConnection {
                                    String queryURL, String updateURL, String gspURL, RDFFormat outputQuads, RDFFormat outputTriples,
                                    String acceptDataset, String acceptGraph,
                                    String acceptSparqlResults,
-                                   String acceptSelectResult, String acceptAskResult) {
+                                   String acceptSelectResult, String acceptAskResult,
+                                   boolean parseCheckQueries, boolean parseCheckUpdates) {
         this.httpClient = httpClient;
         this.httpContext = httpContext;
         this.destination = destination;
@@ -185,6 +191,8 @@ public class RDFConnectionRemote implements RDFConnection {
         this.acceptSparqlResults = acceptSparqlResults;
         this.acceptSelectResult = acceptSelectResult;
         this.acceptAskResult = acceptAskResult;
+        this.parseCheckQueries = parseCheckQueries;
+        this.parseCheckUpdates = parseCheckUpdates;
     }
 
     /** Return the {@link HttpClient} in-use. */ 
@@ -203,14 +211,34 @@ public class RDFConnectionRemote implements RDFConnection {
     }
 
     @Override
+    public QueryExecution query(String queryString) {
+        Objects.requireNonNull(queryString);
+        return queryExec(null, queryString);
+    }
+    
+    @Override
     public QueryExecution query(Query query) {
+        Objects.requireNonNull(query);
+        return queryExec(query, null);
+    }
+    
+    private QueryExecution queryExec(Query query, String queryString) {
         checkQuery();
+        if ( query == null && queryString == null )
+            throw new InternalErrorException("Both query and query string are null"); 
+        if ( query == null ) {
+            if ( parseCheckQueries )
+                QueryFactory.create(queryString);
+        }
+        
+        // Use the query string as provided if possible, otherwise serialize the query.
+        String queryStringToSend = ( queryString != null ) ?  queryString : query.toString();
+        
         return exec(()-> {
-            QueryExecution qExec = QueryExecutionFactory.sparqlService(svcQuery, query, this.httpClient, this.httpContext);
+            QueryExecution qExec = new QueryEngineHTTP(svcQuery, queryStringToSend, httpClient, httpContext);
             QueryEngineHTTP qEngine = (QueryEngineHTTP)qExec;
-            if ( acceptSparqlResults != null )
-                qEngine.setAcceptHeader(acceptSparqlResults);
-            else {
+            // Set the accept header - use the most specific method. 
+            if ( query != null ) {
                 if ( query.isSelectType() && acceptSelectResult != null )
                     qEngine.setAcceptHeader(acceptSelectResult);
                 if ( query.isAskType() && acceptAskResult != null )
@@ -220,15 +248,39 @@ public class RDFConnectionRemote implements RDFConnection {
                 if ( query.isConstructQuad() )
                     qEngine.setDatasetContentType(acceptDataset);
             }
+            // Use the general one.
+            if ( qEngine.getAcceptHeader() == null && acceptSparqlResults != null )
+                qEngine.setAcceptHeader(acceptSparqlResults);
+            // Makre sure it was set somehow.
+            if ( qEngine.getAcceptHeader() == null )
+                throw new JenaConnectionException("No Accept header");   
             return qExec ;
         });
     }
 
     @Override
+    public void update(String updateString) {
+        Objects.requireNonNull(updateString);
+        updateExec(null, updateString);
+    }
+    
+    @Override
     public void update(UpdateRequest update) {
+        Objects.requireNonNull(update);
+        updateExec(update, null);
+    }
+    
+    private void updateExec(UpdateRequest update, String updateString ) {
         checkUpdate();
-        UpdateProcessor proc = UpdateExecutionFactory.createRemote(update, svcUpdate, this.httpClient, this.httpContext);
-        exec(()->proc.execute());
+        if ( update == null && updateString == null )
+            throw new InternalErrorException("Both update request and update string are null"); 
+        if ( update == null ) {
+            if ( parseCheckUpdates )
+                UpdateFactory.create(updateString);
+        }
+        // Use the query string as provided if possible, otherwise serialize the query.
+        String updateStringToSend = ( updateString != null ) ? updateString  : update.toString();
+        exec(()->HttpOp.execHttpPost(svcUpdate, WebContent.contentTypeSPARQLUpdate, updateString, this.httpClient, this.httpContext));
     }
     
     @Override

http://git-wip-us.apache.org/repos/asf/jena/blob/d7c1e970/jena-rdfconnection/src/main/java/org/apache/jena/rdfconnection/RDFConnectionRemoteBuilder.java
----------------------------------------------------------------------
diff --git a/jena-rdfconnection/src/main/java/org/apache/jena/rdfconnection/RDFConnectionRemoteBuilder.java b/jena-rdfconnection/src/main/java/org/apache/jena/rdfconnection/RDFConnectionRemoteBuilder.java
index 3b5de7f..617290b 100644
--- a/jena-rdfconnection/src/main/java/org/apache/jena/rdfconnection/RDFConnectionRemoteBuilder.java
+++ b/jena-rdfconnection/src/main/java/org/apache/jena/rdfconnection/RDFConnectionRemoteBuilder.java
@@ -56,7 +56,10 @@ public class RDFConnectionRemoteBuilder {
     protected String        acceptSelectResult = QueryEngineHTTP.defaultSelectHeader();
     protected String        acceptAskResult    = QueryEngineHTTP.defaultAskHeader();
     // All-purpose head that works for any query type (but is quite long!)
-    protected String        acceptSparqlResults = null;
+    protected String        acceptSparqlResults = acceptSelectResult+","+acceptGraph;
+    // Whether to parse SPARQL Queries and Updates for checkign purposes.
+    protected boolean       parseCheckQueries   = true;
+    protected boolean       parseCheckUpdates   = true;
 
     RDFConnectionRemoteBuilder() { 
         // Default settings are the meber declarations.
@@ -81,6 +84,8 @@ public class RDFConnectionRemoteBuilder {
         
         acceptSelectResult  = base.acceptSelectResult;
         acceptAskResult     = base.acceptAskResult;
+        parseCheckQueries   = base.parseCheckQueries;
+        parseCheckUpdates   = base.parseCheckUpdates;
     }
     
     /** URL of the remote SPARQL endpoint.
@@ -260,7 +265,16 @@ public class RDFConnectionRemoteBuilder {
         this.acceptSparqlResults = acceptHeader;
         return this;
     }
-
+    
+    /**
+     * Set the flag for whether to check SPARQL queries and SPARQL updates provided as a string.   
+     */
+    public RDFConnectionRemoteBuilder parseCheckSPARQL(boolean parseCheck) {
+        this.parseCheckQueries = parseCheck;
+        this.parseCheckUpdates = parseCheck;
+        return this;
+    }
+    
     private Function<RDFConnectionRemoteBuilder, RDFConnection> creator = null;
     /** Provide an alternative function to make the {@link RDFConnection} object.
      * <p>
@@ -304,6 +318,7 @@ public class RDFConnectionRemoteBuilder {
                                         destination, queryURL, updateURL, gspURL,
                                         outputQuads, outputTriples,
                                         acceptDataset, acceptGraph,
-                                        acceptSparqlResults, acceptSelectResult, acceptAskResult);
+                                        acceptSparqlResults, acceptSelectResult, acceptAskResult,
+                                        parseCheckQueries, parseCheckUpdates);
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/jena/blob/d7c1e970/jena-rdfconnection/src/test/java/org/apache/jena/rdfconnection/TS_RDFConnection.java
----------------------------------------------------------------------
diff --git a/jena-rdfconnection/src/test/java/org/apache/jena/rdfconnection/TS_RDFConnection.java b/jena-rdfconnection/src/test/java/org/apache/jena/rdfconnection/TS_RDFConnection.java
index 82af6a9..e4697af 100644
--- a/jena-rdfconnection/src/test/java/org/apache/jena/rdfconnection/TS_RDFConnection.java
+++ b/jena-rdfconnection/src/test/java/org/apache/jena/rdfconnection/TS_RDFConnection.java
@@ -23,11 +23,11 @@ import org.junit.runners.Suite;
 
 @RunWith(Suite.class)
 @Suite.SuiteClasses( {
-    // Other tests, especifically for RDFCommectionRemote are in jena-integration-tests
+    // Other tests, for RDFConnectionRemote and RDFConnectionFuseki, are in jena-integration-tests
     TestRDFConnectionLocalTxnMem.class
     , TestRDFConnectionLocalMRSW.class
     , TestLocalIsolation.class
-    , TestRDFConn.class
+    , TestLibRDFConn.class
 })
 
 public class TS_RDFConnection {}

http://git-wip-us.apache.org/repos/asf/jena/blob/d7c1e970/jena-rdfconnection/src/test/java/org/apache/jena/rdfconnection/TestLibRDFConn.java
----------------------------------------------------------------------
diff --git a/jena-rdfconnection/src/test/java/org/apache/jena/rdfconnection/TestLibRDFConn.java b/jena-rdfconnection/src/test/java/org/apache/jena/rdfconnection/TestLibRDFConn.java
new file mode 100644
index 0000000..37c4280
--- /dev/null
+++ b/jena-rdfconnection/src/test/java/org/apache/jena/rdfconnection/TestLibRDFConn.java
@@ -0,0 +1,127 @@
+/*
+ * 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;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+public class TestLibRDFConn {
+    
+    @Test public void service_url_01() {
+        testServiceName(null, "XYZ", "XYZ"); 
+    }
+    
+    @Test public void service_url_02() {
+        testServiceName("http://example/", "XYZ", "http://example/XYZ"); 
+    }
+
+    @Test public void service_url_03() {
+        testServiceName("http://example/abc", "XYZ", "http://example/abc/XYZ"); 
+    }
+
+    @Test public void service_url_04() {
+        testServiceName("http://example/abc/", "XYZ", "http://example/abc/XYZ"); 
+    }
+    
+    @Test public void service_url_05() {
+        testServiceName("http://example/abc?param=value", "XYZ", "http://example/abc/XYZ?param=value"); 
+    }
+
+    @Test public void service_url_06() {
+        testServiceName("http://example/dataset", "http://other/abc/", "http://other/abc/"); 
+    }
+
+    @Test public void service_url_07() {
+        testServiceName("http://example/dataset", "http://example/abc/XYZ?param=value", "http://example/abc/XYZ?param=value"); 
+    }
+    
+    private static void testServiceName(String destination, String service, String expected) {
+        String x = LibRDFConn.formServiceURL(destination, service);
+        assertEquals(expected, x);
+    }
+    
+    // Assumes service name constructed correctly (see above). 
+    
+    @Test public void gsp_url_01() {
+        testGSP("http://example/", null, "http://example/?default");  
+    }
+
+    @Test public void gsp_url_02() {
+        testGSP("http://example/", "default", "http://example/?default");  
+    }
+
+    @Test public void gsp_url_03() {
+        testGSP("http://example/dataset", null, "http://example/dataset?default");  
+    }
+
+    @Test public void gsp_url_04() {
+        testGSP("http://example/dataset", "default", "http://example/dataset?default");  
+    }
+    
+    @Test public void gsp_url_05() {
+        testGSP("http://example/dataset?param=value", "default", "http://example/dataset?param=value&default");  
+    }
+    
+    @Test public void gsp_url_06() {
+        testGSP("http://example/?param=value", "default", "http://example/?param=value&default");  
+    }
+
+    @Test public void gsp_url_07() {
+        testGSP("http://example/dataset?param=value", "default", "http://example/dataset?param=value&default");  
+    }
+    
+    @Test public void gsp_url_08() {
+        testGSP("http://example/dataset/?param=value", "default", "http://example/dataset/?param=value&default");  
+    }
+
+    @Test public void gsp_url_11() {
+        testGSP("http://example/dataset", "name", "http://example/dataset?graph=name");  
+    }
+
+    @Test public void gsp_url_12() {
+        testGSP("http://example/", "name", "http://example/?graph=name");  
+    }
+    
+    @Test public void gsp_url_13() {
+        testGSP("http://example/dataset/", "name", "http://example/dataset/?graph=name");  
+    }
+
+    @Test public void gsp_url_20() {
+        testGSP("http://example/dataset?param=value", null, "http://example/dataset?param=value&default");  
+    }
+
+    @Test public void gsp_url_21() {
+        testGSP("http://example/?param=value", null, "http://example/?param=value&default");  
+    }
+
+    @Test public void gsp_url_16() {
+        testGSP("http://example/dataset?param=value", "name", "http://example/dataset?param=value&graph=name");  
+    }
+
+    @Test public void gsp_url_17() {
+        testGSP("http://example/?param=value", "name", "http://example/?param=value&graph=name");  
+    }
+
+    private void testGSP(String gsp, String graphName, String expected) {
+        String x = LibRDFConn.urlForGraph(gsp, graphName);
+        assertEquals(expected, x);
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/d7c1e970/jena-rdfconnection/src/test/java/org/apache/jena/rdfconnection/TestRDFConn.java
----------------------------------------------------------------------
diff --git a/jena-rdfconnection/src/test/java/org/apache/jena/rdfconnection/TestRDFConn.java b/jena-rdfconnection/src/test/java/org/apache/jena/rdfconnection/TestRDFConn.java
deleted file mode 100644
index 46e2159..0000000
--- a/jena-rdfconnection/src/test/java/org/apache/jena/rdfconnection/TestRDFConn.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * 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;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-
-public class TestRDFConn {
-    
-    @Test public void service_url_01() {
-        testServiceName(null, "XYZ", "XYZ"); 
-    }
-    
-    @Test public void service_url_02() {
-        testServiceName("http://example/", "XYZ", "http://example/XYZ"); 
-    }
-
-    @Test public void service_url_03() {
-        testServiceName("http://example/abc", "XYZ", "http://example/abc/XYZ"); 
-    }
-
-    @Test public void service_url_04() {
-        testServiceName("http://example/abc/", "XYZ", "http://example/abc/XYZ"); 
-    }
-    
-    @Test public void service_url_05() {
-        testServiceName("http://example/abc?param=value", "XYZ", "http://example/abc/XYZ?param=value"); 
-    }
-
-    @Test public void service_url_06() {
-        testServiceName("http://example/dataset", "http://other/abc/", "http://other/abc/"); 
-    }
-
-    @Test public void service_url_07() {
-        testServiceName("http://example/dataset", "http://example/abc/XYZ?param=value", "http://example/abc/XYZ?param=value"); 
-    }
-    
-    private static void testServiceName(String destination, String service, String expected) {
-        String x = LibRDFConn.formServiceURL(destination, service);
-        assertEquals(expected, x);
-    }
-    
-    // Assumes service name constructed correctly (see above). 
-    
-    @Test public void gsp_url_01() {
-        testGSP("http://example/", null, "http://example/?default");  
-    }
-
-    @Test public void gsp_url_02() {
-        testGSP("http://example/", "default", "http://example/?default");  
-    }
-
-    @Test public void gsp_url_03() {
-        testGSP("http://example/dataset", null, "http://example/dataset?default");  
-    }
-
-    @Test public void gsp_url_04() {
-        testGSP("http://example/dataset", "default", "http://example/dataset?default");  
-    }
-    
-    @Test public void gsp_url_05() {
-        testGSP("http://example/dataset?param=value", "default", "http://example/dataset?param=value&default");  
-    }
-    
-    @Test public void gsp_url_06() {
-        testGSP("http://example/?param=value", "default", "http://example/?param=value&default");  
-    }
-
-    @Test public void gsp_url_07() {
-        testGSP("http://example/dataset?param=value", "default", "http://example/dataset?param=value&default");  
-    }
-    
-    @Test public void gsp_url_08() {
-        testGSP("http://example/dataset/?param=value", "default", "http://example/dataset/?param=value&default");  
-    }
-
-    @Test public void gsp_url_11() {
-        testGSP("http://example/dataset", "name", "http://example/dataset?graph=name");  
-    }
-
-    @Test public void gsp_url_12() {
-        testGSP("http://example/", "name", "http://example/?graph=name");  
-    }
-    
-    @Test public void gsp_url_13() {
-        testGSP("http://example/dataset/", "name", "http://example/dataset/?graph=name");  
-    }
-
-    @Test public void gsp_url_20() {
-        testGSP("http://example/dataset?param=value", null, "http://example/dataset?param=value&default");  
-    }
-
-    @Test public void gsp_url_21() {
-        testGSP("http://example/?param=value", null, "http://example/?param=value&default");  
-    }
-
-    @Test public void gsp_url_16() {
-        testGSP("http://example/dataset?param=value", "name", "http://example/dataset?param=value&graph=name");  
-    }
-
-    @Test public void gsp_url_17() {
-        testGSP("http://example/?param=value", "name", "http://example/?param=value&graph=name");  
-    }
-
-    private void testGSP(String gsp, String graphName, String expected) {
-        String x = LibRDFConn.urlForGraph(gsp, graphName);
-        assertEquals(expected, x);
-    }
-    
-}