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 2015/03/05 16:36:40 UTC

[01/23] jena git commit: Rename folder jena-fuseki to jena-fuseki1

Repository: jena
Updated Branches:
  refs/heads/master 368d051f3 -> 4692c7397


http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/main/resources/META-INF/LICENSE
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/resources/META-INF/LICENSE b/jena-fuseki1/src/main/resources/META-INF/LICENSE
new file mode 100644
index 0000000..d645695
--- /dev/null
+++ b/jena-fuseki1/src/main/resources/META-INF/LICENSE
@@ -0,0 +1,202 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed 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.

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/main/resources/META-INF/NOTICE
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/resources/META-INF/NOTICE b/jena-fuseki1/src/main/resources/META-INF/NOTICE
new file mode 100644
index 0000000..1bf7fa8
--- /dev/null
+++ b/jena-fuseki1/src/main/resources/META-INF/NOTICE
@@ -0,0 +1,16 @@
+Apache Jena - module Fuseki
+Copyright 2011, 2012, 2013, 2014, 2015 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+
+Portions of this software were originally based on the following:
+  - Copyright 2005, 2006, 2007, 2008, 2009 Hewlett-Packard Development Company, LP
+  - Copyright 2010, 2011 Epimorphics Ltd.
+  - Copyright 2010, 2011 Talis Systems Ltd.
+These have been licensed to the Apache Software Foundation under a software grant.
+
+- - - - - - - - - - - - - - - - - - - - - - - 
+
+Portions of this software include software from  Mort Bay Consulting Pty. Ltd.
+ - Copyright (c) 2004-2009 Mort Bay Consulting Pty. Ltd.

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/main/resources/org/apache/jena/fuseki/fuseki-properties.xml
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/resources/org/apache/jena/fuseki/fuseki-properties.xml b/jena-fuseki1/src/main/resources/org/apache/jena/fuseki/fuseki-properties.xml
new file mode 100644
index 0000000..34082eb
--- /dev/null
+++ b/jena-fuseki1/src/main/resources/org/apache/jena/fuseki/fuseki-properties.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
+<!-- Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0" -->
+<properties version="1.0">
+  <comment>Fuseki System Properties</comment>
+  <entry key="org.apache.jena.fuseki.version">${project.version}</entry>
+  <entry key="org.apache.jena.fuseki.build.datetime">${build.time.xsd}</entry>
+</properties>

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/test/java/org/apache/jena/fuseki/ServerTest.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/test/java/org/apache/jena/fuseki/ServerTest.java b/jena-fuseki1/src/test/java/org/apache/jena/fuseki/ServerTest.java
new file mode 100644
index 0000000..18150b1
--- /dev/null
+++ b/jena-fuseki1/src/test/java/org/apache/jena/fuseki/ServerTest.java
@@ -0,0 +1,111 @@
+/*
+ * 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.fuseki;
+
+import com.hp.hpl.jena.graph.Graph ;
+import com.hp.hpl.jena.graph.Node ;
+import com.hp.hpl.jena.graph.NodeFactory ;
+import com.hp.hpl.jena.rdf.model.Model ;
+import com.hp.hpl.jena.rdf.model.ModelFactory ;
+import com.hp.hpl.jena.sparql.core.DatasetGraph ;
+import com.hp.hpl.jena.sparql.core.DatasetGraphFactory ;
+import com.hp.hpl.jena.sparql.modify.request.Target ;
+import com.hp.hpl.jena.sparql.modify.request.UpdateDrop ;
+import com.hp.hpl.jena.sparql.sse.SSE ;
+import com.hp.hpl.jena.update.Update ;
+import com.hp.hpl.jena.update.UpdateExecutionFactory ;
+import com.hp.hpl.jena.update.UpdateProcessor ;
+
+/** Manage a server for testing.
+ * Example for one server per test suite: 
+ * <pre>
+    \@BeforeClass public static void beforeClass() { ServerTest.allocServer() ; }
+    \@AfterClass  public static void afterClass()  { ServerTest.freeServer() ; }
+    \@Before      public void beforeTest()         { ServerTest.resetServer() ; }
+    </pre>
+ */
+public class ServerTest
+{
+    // Abstraction that runs a SPARQL server for tests.
+    
+    public static final int port             = 3635 ;   // Different to the Fuseki2 test port.
+    public static final String urlRoot       = "http://localhost:"+port+"/" ;
+    public static final String datasetPath   = "/dataset" ;
+    public static final String serviceUpdate = "http://localhost:"+port+datasetPath+"/update" ; 
+    public static final String serviceQuery  = "http://localhost:"+port+datasetPath+"/query" ; 
+    public static final String serviceREST   = "http://localhost:"+port+datasetPath+"/data" ; // ??????
+    
+    public static final String gn1       = "http://graph/1" ;
+    public static final String gn2       = "http://graph/2" ;
+    public static final String gn99      = "http://graph/99" ;
+    
+    public static final Node n1          = NodeFactory.createURI("http://graph/1") ;
+    public static final Node n2          = NodeFactory.createURI("http://graph/2") ;
+    public static final Node n99         = NodeFactory.createURI("http://graph/99") ;
+    
+    public static final Graph graph1     = SSE.parseGraph("(base <http://example/> (graph (<x> <p> 1)))") ;
+    public static final Graph graph2     = SSE.parseGraph("(base <http://example/> (graph (<x> <p> 2)))") ;
+    
+    public static final Model model1     = ModelFactory.createModelForGraph(graph1) ;
+    public static final Model model2     = ModelFactory.createModelForGraph(graph2) ;
+    
+    private static EmbeddedFusekiServer server = null ;
+    
+    // reference count of start/stop server
+    private static int countServer = 0 ; 
+    
+    // This will cause there to be one server over all tests.
+    // Must be after initialization of counters 
+    //static { allocServer() ; }
+
+    static public void allocServer()
+    {
+        if ( countServer == 0 )
+            setupServer() ;
+        countServer++ ;
+    }
+    
+    static public void freeServer() 
+    {
+        if ( countServer >= 0 ) {
+            countServer -- ;
+            if ( countServer == 0 )
+                teardownServer() ;
+        }
+    }
+    
+    protected static void setupServer()
+    {
+        DatasetGraph dsg = DatasetGraphFactory.createMem() ;
+        server = EmbeddedFusekiServer.create(port, dsg, datasetPath) ;
+        server.start() ;
+    }
+    
+    protected static void teardownServer() {
+        if ( server != null )
+            server.stop() ;
+        server = null ;
+    }
+    public static void resetServer()
+    {
+        Update clearRequest = new UpdateDrop(Target.ALL) ;
+        UpdateProcessor proc = UpdateExecutionFactory.createRemote(clearRequest, ServerTest.serviceUpdate) ;
+        proc.execute() ;
+    }
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/test/java/org/apache/jena/fuseki/TS_Fuseki.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/test/java/org/apache/jena/fuseki/TS_Fuseki.java b/jena-fuseki1/src/test/java/org/apache/jena/fuseki/TS_Fuseki.java
new file mode 100644
index 0000000..693217f
--- /dev/null
+++ b/jena-fuseki1/src/test/java/org/apache/jena/fuseki/TS_Fuseki.java
@@ -0,0 +1,61 @@
+/*
+ * 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.fuseki;
+
+import org.apache.http.client.HttpClient ;
+import org.apache.jena.atlas.logging.LogCtl ;
+import org.apache.jena.fuseki.http.TestDatasetAccessorHTTP ;
+import org.apache.jena.fuseki.http.TestDatasetGraphAccessorHTTP ;
+import org.apache.jena.fuseki.http.TestHttpOp ;
+import org.apache.jena.riot.web.HttpOp ;
+import org.junit.AfterClass ;
+import org.junit.BeforeClass ;
+import org.junit.runner.RunWith ;
+import org.junit.runners.Suite ;
+
+@RunWith(Suite.class)
+@Suite.SuiteClasses( {
+    TestHttpOp.class
+    , TestSPARQLProtocol.class
+    , TestDatasetGraphAccessorHTTP.class
+    , TestDatasetAccessorHTTP.class
+    , TestQuery.class
+    , TestAuth.class
+})
+public class TS_Fuseki extends ServerTest
+{
+    // Use HttpOp caching of connections during testing to stop
+    // swamping  kernel socket management (seems to be most
+    // acute on Java 1.6)
+    
+    static HttpClient defaultHttpClient = HttpOp.getDefaultHttpClient() ;
+    // Used for all tests except auth tests.
+    static HttpClient globalCachingClient = HttpOp.createCachingHttpClient() ;
+    
+    @BeforeClass public static void beforeClassAbstract1() {
+        HttpOp.setDefaultHttpClient(globalCachingClient) ;
+    }
+    
+    @AfterClass public static void afterClassAbstract1() {
+        HttpOp.setDefaultHttpClient(defaultHttpClient) ;
+    }
+    
+    @BeforeClass static public void beforeClass() { LogCtl.disable(Fuseki.requestLogName) ; }
+    @AfterClass static public void afterClass()   { LogCtl.setInfo(Fuseki.requestLogName) ;}
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/test/java/org/apache/jena/fuseki/TestAuth.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/test/java/org/apache/jena/fuseki/TestAuth.java b/jena-fuseki1/src/test/java/org/apache/jena/fuseki/TestAuth.java
new file mode 100644
index 0000000..4cff28d
--- /dev/null
+++ b/jena-fuseki1/src/test/java/org/apache/jena/fuseki/TestAuth.java
@@ -0,0 +1,429 @@
+/*
+ * 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.fuseki;
+
+import java.io.File ;
+import java.io.FileWriter ;
+import java.io.IOException ;
+import java.net.URI ;
+import java.net.URISyntaxException ;
+import java.util.HashMap ;
+import java.util.Map ;
+
+import org.apache.jena.atlas.logging.LogCtl ;
+import org.apache.jena.atlas.web.HttpException ;
+import org.apache.jena.atlas.web.auth.PreemptiveBasicAuthenticator ;
+import org.apache.jena.atlas.web.auth.ScopedAuthenticator ;
+import org.apache.jena.atlas.web.auth.ServiceAuthenticator ;
+import org.apache.jena.atlas.web.auth.SimpleAuthenticator ;
+import org.apache.jena.fuseki.server.FusekiConfig ;
+import org.apache.jena.fuseki.server.SPARQLServer ;
+import org.apache.jena.fuseki.server.ServerConfig ;
+import org.junit.AfterClass ;
+import org.junit.Assert ;
+import org.junit.BeforeClass ;
+import org.junit.Test ;
+
+import com.hp.hpl.jena.query.ARQ ;
+import com.hp.hpl.jena.query.DatasetAccessor ;
+import com.hp.hpl.jena.query.DatasetAccessorFactory ;
+import com.hp.hpl.jena.query.QueryExecutionFactory ;
+import com.hp.hpl.jena.rdf.model.Model ;
+import com.hp.hpl.jena.sparql.core.DatasetGraph ;
+import com.hp.hpl.jena.sparql.core.DatasetGraphFactory ;
+import com.hp.hpl.jena.sparql.engine.http.QueryEngineHTTP ;
+import com.hp.hpl.jena.sparql.engine.http.QueryExceptionHTTP ;
+import com.hp.hpl.jena.sparql.engine.http.Service ;
+import com.hp.hpl.jena.sparql.modify.UpdateProcessRemoteBase ;
+import com.hp.hpl.jena.sparql.util.Context ;
+import com.hp.hpl.jena.update.UpdateExecutionFactory ;
+import com.hp.hpl.jena.update.UpdateFactory ;
+import com.hp.hpl.jena.update.UpdateRequest ;
+
+/**
+ * Tests Fuseki operation with authentication enabled
+ */
+public class TestAuth {
+    // Use different port etc because sometimes the previous testing servers
+    // don't release ports fast enough (OS issue / Linux)
+    public static final int authPort             = ServerTest.port+10 ;
+    public static final String authUrlRoot       = "http://localhost:"+authPort+"/" ;
+    public static final String authDatasetPath   = "/dataset" ;
+    public static final String authServiceUpdate = "http://localhost:"+authPort+authDatasetPath+"/update" ; 
+    public static final String authServiceQuery  = "http://localhost:"+authPort+authDatasetPath+"/query" ; 
+    public static final String authServiceREST   = "http://localhost:"+authPort+authDatasetPath+"/data" ;
+
+    
+    private static File realmFile;
+    private static SPARQLServer server;
+
+    /**
+     * Sets up the authentication for tests
+     * @throws IOException
+     */
+    @BeforeClass
+    public static void setup() throws IOException {
+        realmFile = File.createTempFile("realm", ".properties");
+
+        try(FileWriter writer = new FileWriter(realmFile)) {
+            writer.write("allowed: password, fuseki\n");
+            writer.write("forbidden: password, other");
+        }
+
+        LogCtl.logLevel(Fuseki.serverLog.getName(), org.apache.log4j.Level.WARN, java.util.logging.Level.WARNING);
+        LogCtl.logLevel(Fuseki.requestLog.getName(), org.apache.log4j.Level.WARN, java.util.logging.Level.WARNING);
+        LogCtl.logLevel("org.eclipse.jetty", org.apache.log4j.Level.WARN, java.util.logging.Level.WARNING);
+
+        DatasetGraph dsg = DatasetGraphFactory.createMem();
+        // This must agree with ServerTest
+        ServerConfig conf = FusekiConfig.defaultConfiguration(authDatasetPath, dsg, true, true);
+        conf.port = authPort ;
+        conf.pagesPort = authPort ;
+        conf.authConfigFile = realmFile.getAbsolutePath();
+
+        server = new SPARQLServer(conf);
+        server.start();
+    }
+
+    /**
+     * Tears down authentication test setup
+     */
+    @AfterClass
+    public static void teardown() {
+        server.stop();
+
+        realmFile.delete();
+    }
+
+    @Test(expected = QueryExceptionHTTP.class)
+    public void query_with_auth_01() {
+        QueryEngineHTTP qe = (QueryEngineHTTP) QueryExecutionFactory.sparqlService(authServiceQuery, "ASK { }");
+        // No auth credentials should result in an error
+        qe.execAsk();
+    }
+
+    @Test(expected = QueryExceptionHTTP.class)
+    public void query_with_auth_02() {
+        QueryEngineHTTP qe = (QueryEngineHTTP) QueryExecutionFactory.sparqlService(authServiceQuery, "ASK { }");
+        // Auth credentials for valid user with bad password
+        qe.setBasicAuthentication("allowed", "incorrect".toCharArray());
+        qe.execAsk();
+    }
+
+    @Test
+    public void query_with_auth_03() {
+        QueryEngineHTTP qe = (QueryEngineHTTP) QueryExecutionFactory.sparqlService(authServiceQuery, "ASK { }");
+        // Auth credentials for valid user with correct password
+        qe.setBasicAuthentication("allowed", "password".toCharArray());
+        Assert.assertTrue(qe.execAsk());
+    }
+
+    @Test(expected = QueryExceptionHTTP.class)
+    public void query_with_auth_04() {
+        QueryEngineHTTP qe = (QueryEngineHTTP) QueryExecutionFactory.sparqlService(authServiceQuery, "ASK { }");
+        // Auth credentials for valid user with correct password BUT not in
+        // correct role
+        qe.setBasicAuthentication("forbidden", "password".toCharArray());
+        qe.execAsk();
+    }
+
+    @Test
+    public void query_with_auth_05() {
+        // Uses auth and enables compression
+        QueryEngineHTTP qe = (QueryEngineHTTP) QueryExecutionFactory.sparqlService(authServiceQuery, "ASK { }");
+        qe.setAllowDeflate(true);
+        qe.setAllowGZip(true);
+
+        // Auth credentials for valid user with correct password
+        qe.setBasicAuthentication("allowed", "password".toCharArray());
+        Assert.assertTrue(qe.execAsk());
+    }
+
+    @Test(expected = QueryExceptionHTTP.class)
+    public void query_with_auth_06() {
+        // Uses auth and enables compression
+        QueryEngineHTTP qe = (QueryEngineHTTP) QueryExecutionFactory.sparqlService(authServiceQuery, "ASK { }");
+        qe.setAllowDeflate(true);
+        qe.setAllowGZip(true);
+
+        // Auth credentials for valid user with bad password
+        qe.setBasicAuthentication("allowed", "incorrect".toCharArray());
+        qe.execAsk();
+    }
+
+    @Test(expected = QueryExceptionHTTP.class)
+    public void query_with_auth_07() throws URISyntaxException {
+        QueryEngineHTTP qe = (QueryEngineHTTP) QueryExecutionFactory.sparqlService(authServiceQuery, "ASK { }");
+
+        // Auth credentials for valid user with correct password but scoped to
+        // wrong URI
+        ScopedAuthenticator authenticator = new ScopedAuthenticator(new URI("http://example"), "allowed",
+                "password".toCharArray());
+        qe.setAuthenticator(authenticator);
+        qe.execAsk();
+    }
+
+    @Test
+    public void query_with_auth_08() throws URISyntaxException {
+        QueryEngineHTTP qe = (QueryEngineHTTP) QueryExecutionFactory.sparqlService(authServiceQuery, "ASK { }");
+
+        // Auth credentials for valid user with correct password and scoped to
+        // correct URI
+        ScopedAuthenticator authenticator = new ScopedAuthenticator(new URI(authServiceQuery), "allowed", "password".toCharArray());
+        qe.setAuthenticator(authenticator);
+        Assert.assertTrue(qe.execAsk());
+    }
+
+    @Test
+    public void query_with_auth_09() throws URISyntaxException {
+        QueryEngineHTTP qe = (QueryEngineHTTP) QueryExecutionFactory.sparqlService(authServiceQuery, "ASK { }");
+
+        // Auth credentials for valid user with correct password using
+        // pre-emptive auth
+        ScopedAuthenticator authenticator = new ScopedAuthenticator(new URI(authServiceQuery), "allowed", "password".toCharArray());
+        qe.setAuthenticator(new PreemptiveBasicAuthenticator(authenticator));
+        Assert.assertTrue(qe.execAsk());
+    }
+
+    @Test
+    public void query_with_auth_10() {
+        Context ctx = ARQ.getContext();
+        try {
+            QueryEngineHTTP qe = (QueryEngineHTTP) QueryExecutionFactory.sparqlService(authServiceQuery, "ASK { }");
+
+            // Auth credentials for valid user with correct password and scoped
+            // to correct URI
+            // Provided via Service Context and its associated authenticator
+            Map<String, Context> serviceContext = new HashMap<String, Context>();
+            Context authContext = new Context();
+            authContext.put(Service.queryAuthUser, "allowed");
+            authContext.put(Service.queryAuthPwd, "password");
+            serviceContext.put(authServiceQuery, authContext);
+            ctx.put(Service.serviceContext, serviceContext);
+
+            qe.setAuthenticator(new ServiceAuthenticator());
+            Assert.assertTrue(qe.execAsk());
+        } finally {
+            ctx.remove(Service.serviceContext);
+        }
+    }
+    
+    @Test
+    public void query_with_auth_11() {
+        Context ctx = ARQ.getContext();
+        try {
+            QueryEngineHTTP qe = (QueryEngineHTTP) QueryExecutionFactory.sparqlService(authServiceQuery, "ASK { }");
+
+            // Auth credentials for valid user with correct password and scoped
+            // to base URI of the actual service URL
+            // Provided via Service Context and its associated authenticator
+            Map<String, Context> serviceContext = new HashMap<String, Context>();
+            Context authContext = new Context();
+            authContext.put(Service.queryAuthUser, "allowed");
+            authContext.put(Service.queryAuthPwd, "password");
+            serviceContext.put(authUrlRoot, authContext);
+            ctx.put(Service.serviceContext, serviceContext);
+
+            qe.setAuthenticator(new ServiceAuthenticator());
+            Assert.assertTrue(qe.execAsk());
+        } finally {
+            ctx.remove(Service.serviceContext);
+        }
+    }
+    
+    @Test
+    public void query_with_auth_12() {
+        ARQ.getContext().remove(Service.serviceContext);
+
+        QueryEngineHTTP qe = (QueryEngineHTTP) QueryExecutionFactory.sparqlService(authServiceQuery, "ASK { }");
+
+        // Auth credentials for valid user with correct password
+        // Use service authenticator with fallback credentials.
+        qe.setAuthenticator(new ServiceAuthenticator("allowed", "password".toCharArray()));
+        Assert.assertTrue(qe.execAsk());
+     }
+    
+    @Test
+    public void query_with_auth_13() throws URISyntaxException {
+        QueryEngineHTTP qe = (QueryEngineHTTP) QueryExecutionFactory.sparqlService(authServiceQuery, "ASK { }");
+
+        // Auth credentials for valid user with correct password and scoped to
+        // base URI of the actual service URL
+        ScopedAuthenticator authenticator = new ScopedAuthenticator(new URI(authUrlRoot), "allowed", "password".toCharArray());
+        qe.setAuthenticator(authenticator);
+        Assert.assertTrue(qe.execAsk());
+    }
+    
+    @Test
+    public void query_with_auth_14() throws URISyntaxException {
+        QueryEngineHTTP qe = (QueryEngineHTTP) QueryExecutionFactory.sparqlService(authServiceQuery, "ASK { }");
+
+        // Auth credentials for valid user with correct password and scoped to
+        // base URI of the actual service URL
+        ScopedAuthenticator authenticator = new ScopedAuthenticator(new URI("http://localhost:" + authPort), "allowed", "password".toCharArray());
+        qe.setAuthenticator(authenticator);
+        Assert.assertTrue(qe.execAsk());
+    }
+
+    @Test(expected = HttpException.class)
+    public void update_with_auth_01() {
+        UpdateRequest updates = UpdateFactory.create("CREATE SILENT GRAPH <http://graph>");
+        UpdateProcessRemoteBase ue = (UpdateProcessRemoteBase) UpdateExecutionFactory.createRemote(updates, authServiceUpdate);
+        // No auth credentials should result in an error
+        ue.execute();
+    }
+
+    @Test(expected = HttpException.class)
+    public void update_with_auth_02() {
+        UpdateRequest updates = UpdateFactory.create("CREATE SILENT GRAPH <http://graph>");
+        UpdateProcessRemoteBase ue = (UpdateProcessRemoteBase) UpdateExecutionFactory.createRemote(updates, authServiceUpdate);
+        // Auth credentials for valid user with bad password
+        ue.setAuthentication("allowed", "incorrect".toCharArray());
+        ue.execute();
+    }
+
+    @Test
+    public void update_with_auth_03() {
+        UpdateRequest updates = UpdateFactory.create("CREATE SILENT GRAPH <http://graph>");
+        UpdateProcessRemoteBase ue = (UpdateProcessRemoteBase) UpdateExecutionFactory.createRemote(updates, authServiceUpdate);
+        // Auth credentials for valid user with correct password
+        ue.setAuthentication("allowed", "password".toCharArray());
+        ue.execute();
+    }
+
+    @Test(expected = HttpException.class)
+    public void update_with_auth_04() {
+        UpdateRequest updates = UpdateFactory.create("CREATE SILENT GRAPH <http://graph>");
+        UpdateProcessRemoteBase ue = (UpdateProcessRemoteBase) UpdateExecutionFactory.createRemote(updates, authServiceUpdate);
+        // Auth credentials for valid user with correct password BUT not in
+        // correct role
+        ue.setAuthentication("forbidden", "password".toCharArray());
+        ue.execute();
+    }
+
+    @Test(expected = HttpException.class)
+    public void update_with_auth_05() {
+        UpdateRequest updates = UpdateFactory.create("CREATE SILENT GRAPH <http://graph>");
+        UpdateProcessRemoteBase ue = (UpdateProcessRemoteBase) UpdateExecutionFactory.createRemoteForm(updates, authServiceUpdate);
+        // No auth credentials should result in an error
+        ue.execute();
+    }
+
+    @Test(expected = HttpException.class)
+    public void update_with_auth_06() {
+        UpdateRequest updates = UpdateFactory.create("CREATE SILENT GRAPH <http://graph>");
+        UpdateProcessRemoteBase ue = (UpdateProcessRemoteBase) UpdateExecutionFactory.createRemoteForm(updates, authServiceUpdate);
+        // Auth credentials for valid user with bad password
+        ue.setAuthentication("allowed", "incorrect".toCharArray());
+        ue.execute();
+    }
+
+    @Test
+    public void update_with_auth_07() {
+        UpdateRequest updates = UpdateFactory.create("CREATE SILENT GRAPH <http://graph>");
+        UpdateProcessRemoteBase ue = (UpdateProcessRemoteBase) UpdateExecutionFactory.createRemoteForm(updates, authServiceUpdate);
+        // Auth credentials for valid user with correct password
+        ue.setAuthentication("allowed", "password".toCharArray());
+        ue.execute();
+    }
+
+    @Test(expected = HttpException.class)
+    public void update_with_auth_08() {
+        UpdateRequest updates = UpdateFactory.create("CREATE SILENT GRAPH <http://graph>");
+        UpdateProcessRemoteBase ue = (UpdateProcessRemoteBase) UpdateExecutionFactory.createRemoteForm(updates, authServiceUpdate);
+        // Auth credentials for valid user with correct password BUT not in
+        // correct role
+        ue.setAuthentication("forbidden", "password".toCharArray());
+        ue.execute();
+    }
+
+    @Test(expected = HttpException.class)
+    public void update_with_auth_09() throws URISyntaxException {
+        UpdateRequest updates = UpdateFactory.create("CREATE SILENT GRAPH <http://graph>");
+        UpdateProcessRemoteBase ue = (UpdateProcessRemoteBase) UpdateExecutionFactory.createRemote(updates, authServiceUpdate);
+
+        // Auth credentials for valid user with correct password but scoped to
+        // wrong URI
+        ScopedAuthenticator authenticator = new ScopedAuthenticator(new URI("http://example"), "allowed",
+                "password".toCharArray());
+        ue.setAuthenticator(authenticator);
+        ue.execute();
+    }
+
+    @Test
+    public void update_with_auth_10() throws URISyntaxException {
+        UpdateRequest updates = UpdateFactory.create("CREATE SILENT GRAPH <http://graph>");
+        UpdateProcessRemoteBase ue = (UpdateProcessRemoteBase) UpdateExecutionFactory.createRemote(updates, authServiceUpdate);
+
+        // Auth credentials for valid user with correct password scoped to
+        // correct URI
+        ScopedAuthenticator authenticator = new ScopedAuthenticator(new URI(authServiceUpdate), "allowed", "password".toCharArray());
+        ue.setAuthenticator(authenticator);
+        ue.execute();
+    }
+
+    @Test
+    public void update_with_auth_11() throws URISyntaxException {
+        UpdateRequest updates = UpdateFactory.create("CREATE SILENT GRAPH <http://graph>");
+        UpdateProcessRemoteBase ue = (UpdateProcessRemoteBase) UpdateExecutionFactory.createRemote(updates, authServiceUpdate);
+
+        // Auth credentials for valid user with correct password scoped to
+        // correct URI
+        // Also using pre-emptive auth
+        ScopedAuthenticator authenticator = new ScopedAuthenticator(new URI(authServiceUpdate), "allowed", "password".toCharArray());
+        ue.setAuthenticator(new PreemptiveBasicAuthenticator(authenticator));
+        ue.execute();
+    }
+    
+    @Test(expected = HttpException.class)
+    public void graphstore_with_auth_01() {       
+        // No auth credentials
+        DatasetAccessor accessor = DatasetAccessorFactory.createHTTP(authServiceREST);
+        accessor.getModel();
+    }
+    
+    @Test(expected = HttpException.class)
+    public void graphstore_with_auth_02() {
+        // Incorrect auth credentials
+        DatasetAccessor accessor = DatasetAccessorFactory.createHTTP(authServiceREST, new SimpleAuthenticator("allowed", "incorrect".toCharArray()));
+        accessor.getModel();
+    }
+    
+    @Test
+    public void graphstore_with_auth_03() {
+        // Correct auth credentials
+        DatasetAccessor accessor = DatasetAccessorFactory.createHTTP(authServiceREST, new SimpleAuthenticator("allowed", "password".toCharArray()));
+        Model m = accessor.getModel();
+        Assert.assertTrue(m.isEmpty());
+    }
+    
+    @Test(expected = HttpException.class)
+    public void graphstore_with_auth_04() throws URISyntaxException {
+        // Correct auth credentials scoped to wrong URI
+        DatasetAccessor accessor = DatasetAccessorFactory.createHTTP(authServiceREST, new ScopedAuthenticator(new URI("http://example.org/"), "allowed", "password".toCharArray()));
+        accessor.getModel();
+    }
+    
+    @Test
+    public void graphstore_with_auth_05() throws URISyntaxException {
+        // Correct auth credentials scoped to correct URI
+        DatasetAccessor accessor = DatasetAccessorFactory.createHTTP(authServiceREST, new ScopedAuthenticator(new URI(authServiceREST), "allowed", "password".toCharArray()));
+        accessor.getModel();
+    }
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/test/java/org/apache/jena/fuseki/TestQuery.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/test/java/org/apache/jena/fuseki/TestQuery.java b/jena-fuseki1/src/test/java/org/apache/jena/fuseki/TestQuery.java
new file mode 100644
index 0000000..5748dc4
--- /dev/null
+++ b/jena-fuseki1/src/test/java/org/apache/jena/fuseki/TestQuery.java
@@ -0,0 +1,117 @@
+/*
+ * 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.fuseki;
+
+import java.io.IOException ;
+import java.net.HttpURLConnection ;
+import java.net.URL ;
+
+import static org.apache.jena.fuseki.ServerTest.* ;
+
+import org.junit.AfterClass ;
+import org.junit.Assert ;
+import org.junit.BeforeClass ;
+import org.junit.Test ;
+import org.apache.jena.atlas.junit.BaseTest ;
+import com.hp.hpl.jena.query.* ;
+import com.hp.hpl.jena.sparql.core.Var ;
+import com.hp.hpl.jena.sparql.engine.binding.Binding ;
+import com.hp.hpl.jena.sparql.resultset.ResultSetCompare ;
+import com.hp.hpl.jena.sparql.sse.Item ;
+import com.hp.hpl.jena.sparql.sse.SSE ;
+import com.hp.hpl.jena.sparql.sse.builders.BuilderResultSet ;
+import com.hp.hpl.jena.sparql.util.Convert ;
+
+public class TestQuery extends BaseTest 
+{
+    protected static ResultSet rs1 = null ; 
+    static {
+        Item item = SSE.parseItem("(resultset (?s ?p ?o) (row (?s <x>)(?p <p>)(?o 1)))") ;
+        rs1 = BuilderResultSet.build(item) ;
+    }
+    
+    // DRY - test protocol?
+    @BeforeClass public static void beforeClass()
+    {
+        ServerTest.allocServer() ;
+        ServerTest.resetServer() ;
+        DatasetAccessor du = DatasetAccessorFactory.createHTTP(serviceREST) ;
+        du.putModel(model1) ;
+        du.putModel(gn1, model2) ;
+    }
+    
+    @AfterClass public static void afterClass()
+    {
+        DatasetAccessor du = DatasetAccessorFactory.createHTTP(serviceREST) ;
+        du.deleteDefault() ;
+        ServerTest.freeServer() ;
+    }
+    
+    @Test public void query_01()
+    {
+        execQuery("SELECT * {?s ?p ?o}", 1) ;
+    }
+    
+    @Test public void query_recursive_01()
+    {
+        String query = "SELECT * WHERE { SERVICE <" + serviceQuery + "> { ?s ?p ?o . BIND(?o AS ?x) } }";
+        try(QueryExecution qExec = QueryExecutionFactory.sparqlService(serviceQuery, query)) {
+            ResultSet rs = qExec.execSelect();
+            
+            Var x = Var.alloc("x");
+            while (rs.hasNext()) {
+                Binding b = rs.nextBinding();
+                Assert.assertNotNull(b.get(x));
+            }
+        }
+    }
+    
+    @Test public void query_with_params_01()
+    {
+        String query = "ASK { }";
+        try(QueryExecution qExec = QueryExecutionFactory.sparqlService(serviceQuery + "?output=json", query)) {
+            boolean result = qExec.execAsk();
+            Assert.assertTrue(result);
+        }
+    }
+    
+    @Test public void request_id_header_01() throws IOException
+    {
+        String qs = Convert.encWWWForm("ASK{}") ;
+        URL u = new URL(serviceQuery+"?query="+qs);
+        HttpURLConnection conn = (HttpURLConnection) u.openConnection();
+        Assert.assertTrue(conn.getHeaderField("Fuseki-Request-ID") != null);
+    }
+
+    private void execQuery(String queryString, int exceptedRowCount)
+    {
+        QueryExecution qExec = QueryExecutionFactory.sparqlService(serviceQuery, queryString) ;
+        ResultSet rs = qExec.execSelect() ;
+        int x = ResultSetFormatter.consume(rs) ;
+        assertEquals(exceptedRowCount, x) ;
+    }
+    
+    private void execQuery(String queryString, ResultSet expectedResultSet)
+    {
+        QueryExecution qExec = QueryExecutionFactory.sparqlService(serviceQuery, queryString) ;
+        ResultSet rs = qExec.execSelect() ;
+        boolean b = ResultSetCompare.equalsByTerm(rs, expectedResultSet) ;
+        assertTrue("Result sets different", b) ;
+    }
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/test/java/org/apache/jena/fuseki/TestSPARQLProtocol.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/test/java/org/apache/jena/fuseki/TestSPARQLProtocol.java b/jena-fuseki1/src/test/java/org/apache/jena/fuseki/TestSPARQLProtocol.java
new file mode 100644
index 0000000..3b86e17
--- /dev/null
+++ b/jena-fuseki1/src/test/java/org/apache/jena/fuseki/TestSPARQLProtocol.java
@@ -0,0 +1,95 @@
+/*
+ * 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.fuseki;
+
+import static org.apache.jena.fuseki.ServerTest.* ;
+import org.apache.jena.atlas.junit.BaseTest ;
+import org.apache.jena.riot.WebContent ;
+import org.junit.AfterClass ;
+import org.junit.BeforeClass ;
+import org.junit.Test ;
+
+import com.hp.hpl.jena.query.* ;
+import com.hp.hpl.jena.sparql.engine.http.QueryEngineHTTP ;
+import com.hp.hpl.jena.sparql.util.Convert ;
+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 ;
+// Generally poke the server using Jena APIs
+// SPARQL Query
+// SPARQL Update
+//   GSP is done in TestDatasetAccessorHTTP
+
+public class TestSPARQLProtocol extends BaseTest
+{
+    @BeforeClass public static void beforeClass()
+    {
+        ServerTest.allocServer() ;
+        ServerTest.resetServer() ;
+        // Load some data.
+        DatasetAccessor du = DatasetAccessorFactory.createHTTP(serviceREST) ;
+        du.putModel(model1) ;
+        du.putModel(gn1, model2) ;
+    }
+    
+    @AfterClass public static void afterClass()
+    {
+        ServerTest.resetServer() ;
+        ServerTest.freeServer() ;
+    }
+    
+    static String query(String base, String queryString)
+    {
+        return base+"?query="+Convert.encWWWForm(queryString) ;
+    }
+    
+    @Test public void query_01()
+    {
+        Query query = QueryFactory.create("SELECT * { ?s ?p ?o }") ;
+        QueryExecution qexec = QueryExecutionFactory.sparqlService(serviceQuery, query) ;
+        ResultSet rs = qexec.execSelect() ;
+        int x = ResultSetFormatter.consume(rs) ;
+        assertTrue( x != 0 ) ;
+    }
+
+    @Test public void query_02()
+    {
+        Query query = QueryFactory.create("SELECT * { ?s ?p ?o }") ;
+        QueryEngineHTTP engine = QueryExecutionFactory.createServiceRequest(serviceQuery, query) ;
+        engine.setSelectContentType(WebContent.contentTypeResultsJSON) ;
+        ResultSet rs = engine.execSelect() ;
+        int x = ResultSetFormatter.consume(rs) ;
+        assertTrue( x != 0 ) ;
+    }
+
+    @Test public void update_01()
+    {
+        UpdateRequest update = UpdateFactory.create("INSERT DATA {}") ;
+        UpdateProcessor proc = UpdateExecutionFactory.createRemote(update, serviceUpdate) ;
+        proc.execute() ;
+    }
+    
+    @Test public void update_02()
+    {
+        UpdateRequest update = UpdateFactory.create("INSERT DATA {}") ;
+        UpdateProcessor proc = UpdateExecutionFactory.createRemoteForm(update, serviceUpdate) ;
+        proc.execute() ;
+    }
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/test/java/org/apache/jena/fuseki/http/TestDatasetAccessorHTTP.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/test/java/org/apache/jena/fuseki/http/TestDatasetAccessorHTTP.java b/jena-fuseki1/src/test/java/org/apache/jena/fuseki/http/TestDatasetAccessorHTTP.java
new file mode 100644
index 0000000..f8cf8fd
--- /dev/null
+++ b/jena-fuseki1/src/test/java/org/apache/jena/fuseki/http/TestDatasetAccessorHTTP.java
@@ -0,0 +1,261 @@
+/*
+ * 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.fuseki.http;
+
+import static org.apache.jena.fuseki.ServerTest.* ;
+import org.apache.jena.atlas.junit.BaseTest ;
+import org.apache.jena.atlas.web.HttpException ;
+import org.apache.jena.fuseki.ServerTest ;
+import org.apache.jena.riot.web.HttpOp ;
+import org.apache.jena.web.HttpSC ;
+import org.junit.AfterClass ;
+import org.junit.Before ;
+import org.junit.BeforeClass ;
+import org.junit.Test ;
+
+import com.hp.hpl.jena.query.DatasetAccessor ;
+import com.hp.hpl.jena.query.DatasetAccessorFactory ;
+import com.hp.hpl.jena.rdf.model.Model ;
+import com.hp.hpl.jena.rdf.model.ModelFactory ;
+
+
+public class TestDatasetAccessorHTTP extends BaseTest 
+{
+    //Model level testing.
+    
+    static final String datasetURI_not_1    = "http://localhost:"+port+"/junk" ;
+    static final String datasetURI_not_2    = serviceREST+"/not" ;
+    static final String datasetURI_not_3    = "http://localhost:"+port+datasetPath+"/not/data" ;
+    
+    @BeforeClass public static void beforeClass()   { ServerTest.allocServer() ; }
+    @AfterClass public static void afterClass()     { ServerTest.freeServer() ; }
+    @Before public void before()                    { ServerTest.resetServer() ; }
+    
+    @Test(expected=HttpException.class)
+    public void test_ds_1()
+    {
+        // Can't GET the dataset service.
+        try {
+            HttpOp.execHttpGet(serviceREST) ;
+        } catch (HttpException ex) {
+            assertTrue(HttpSC.isClientError(ex.getResponseCode())) ;
+            throw ex ;
+        }
+    }
+    
+    @Test(expected=HttpException.class)
+    public void test_ds_2()
+    {
+        try {
+            HttpOp.execHttpGet(datasetURI_not_1) ;
+        } catch (HttpException ex) {
+            assertEquals(HttpSC.NOT_FOUND_404, ex.getResponseCode()) ;
+            throw ex ;
+        }
+    }
+
+    @Test(expected=HttpException.class)
+    public void test_ds_3()
+    {
+        try {
+            HttpOp.execHttpGet(datasetURI_not_2) ;
+        } catch (HttpException ex) {
+            assertEquals(HttpSC.NOT_FOUND_404, ex.getResponseCode()) ;
+            throw ex ;
+        }
+    }
+
+    @Test
+    public void test_404_1()
+    {
+        // Not the right service.
+        DatasetAccessor du = DatasetAccessorFactory.createHTTP(datasetURI_not_1) ;
+        Model graph = du.getModel(gn99) ;
+        assertNull(graph) ; 
+    }
+
+    @Test
+    public void test_404_2()
+    {
+        DatasetAccessor du = DatasetAccessorFactory.createHTTP(datasetURI_not_2) ;
+        Model graph = du.getModel(gn99) ;
+        assertNull(graph) ;
+    }
+
+    @Test
+    public void test_404_3()
+    {
+        // Right service, wrong graph
+        DatasetAccessor du = DatasetAccessorFactory.createHTTP(serviceREST) ;
+        Model graph = du.getModel(gn99) ;
+        assertNull(graph) ;
+    }
+
+    @Test public void head_01()
+    {
+        DatasetAccessor du = create() ;
+        boolean b = du.containsModel(gn1) ;
+        assertFalse("Blank remote dataset as a named graph", b) ;
+    }
+
+    @Test public void head_02()
+    {
+        DatasetAccessor du = create() ;
+        du.putModel(gn1, model1) ;
+        boolean exists = du.containsModel(gn1) ;
+        assertTrue(exists) ;
+        exists = du.containsModel(gn2) ;
+        assertFalse("Expected gn2 not to exist (1)", exists) ;
+
+        exists = du.containsModel(gn2) ;
+        assertFalse("Expected gn2 not to exist (2)", exists) ;
+        // Clearup
+        du.deleteModel(gn1) ;
+    }
+
+    @Test public void get_01()
+    {
+        DatasetAccessor du = create() ;
+        Model graph = du.getModel() ;
+        assertTrue(graph.isEmpty()) ;
+    }
+    
+    @Test public void get_02()
+    {
+        DatasetAccessor du = create() ;
+        Model graph = du.getModel(gn1) ;
+        assertNull(graph) ;
+    }
+
+    @Test public void delete_01()
+    {
+        DatasetAccessor du = create() ;
+        du.deleteDefault() ;
+    }
+
+    @Test public void delete_02()
+    {
+        DatasetAccessor du = create() ;
+        du.deleteModel(gn1) ;
+        boolean exists = du.containsModel(gn1) ;
+        assertFalse("Expected gn1 not to exist", exists) ;
+    }
+
+    @Test public void put_01()
+    {
+        DatasetAccessor du = create() ;
+        du.putModel(model1) ;
+        Model graph = du.getModel() ;
+        assertTrue(graph.isIsomorphicWith(model1)) ;
+        // Empty it.
+        du.deleteDefault() ;
+        graph = du.getModel() ;
+        assertTrue(graph.isEmpty()) ;
+    }
+    
+    @Test public void put_02()
+    {
+        DatasetAccessor du = create() ;
+        du.putModel(gn1, model1) ;
+        boolean exists = du.containsModel(gn1) ;
+        assertTrue(exists) ;
+        exists = du.containsModel(gn2) ;
+        assertFalse("Expected gn2 not to exist", exists) ;
+        
+        Model graph = du.getModel() ;
+        assertTrue(graph.isEmpty()) ;
+        graph = du.getModel(gn1) ;
+        assertTrue(graph.isIsomorphicWith(model1)) ;
+        
+        du.deleteModel(gn1) ;
+        exists = du.containsModel(gn1) ;
+        assertFalse("Expected gn1 not to exist", exists) ;
+        
+        graph = du.getModel(gn1) ;
+        assertNull(graph) ;
+    }
+
+    @Test public void put_03()
+    {
+        DatasetAccessor du = create() ;
+        du.putModel(model1) ;
+        du.putModel(model2) ;  // PUT overwrites
+        Model graph = du.getModel() ;
+        assertFalse(graph.isIsomorphicWith(model1)) ;
+        assertTrue(graph.isIsomorphicWith(model2)) ;
+        // Empty it.
+        du.deleteDefault() ;
+        graph = du.getModel() ;
+        assertTrue(graph.isEmpty()) ;
+    }
+
+    @Test public void post_01()
+    {
+        DatasetAccessor du = create() ;
+        du.putModel(model1) ;
+        du.add(model2) ;  // POST appends
+        Model graph = du.getModel() ;
+        
+        Model graph3 = ModelFactory.createDefaultModel() ;
+        graph3.add(model1) ;
+        graph3.add(model2) ;
+        
+        assertFalse(graph.isIsomorphicWith(model1)) ;
+        assertFalse(graph.isIsomorphicWith(model2)) ;
+        assertTrue(graph.isIsomorphicWith(graph3)) ;
+        // Empty it.
+        du.deleteDefault() ;
+        graph = du.getModel() ;
+        assertTrue(graph.isEmpty()) ;
+    }
+
+    @Test public void post_02()
+    {
+        DatasetAccessor du = create() ;
+        du.add(model1) ;
+        du.add(model2) ;
+        Model graph = du.getModel() ;
+        
+        Model graph3 = ModelFactory.createDefaultModel() ;
+        graph3.add(model1) ;
+        graph3.add(model2) ;
+        
+        assertFalse(graph.isIsomorphicWith(model1)) ;
+        assertFalse(graph.isIsomorphicWith(model2)) ;
+        assertTrue(graph.isIsomorphicWith(graph3)) ;
+        // Empty it.
+        du.deleteDefault() ;
+        graph = du.getModel() ;
+        assertTrue(graph.isEmpty()) ;
+    }
+    
+    @Test public void clearup_1()
+    {
+        DatasetAccessor du = create() ;
+        du.deleteDefault() ;
+        du.deleteModel(gn1) ;
+        du.deleteModel(gn2) ;
+        du.deleteModel(gn99) ;
+    }
+
+    static DatasetAccessor create()
+    {
+        return DatasetAccessorFactory.createHTTP(ServerTest.serviceREST) ;
+    }
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/test/java/org/apache/jena/fuseki/http/TestDatasetGraphAccessorHTTP.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/test/java/org/apache/jena/fuseki/http/TestDatasetGraphAccessorHTTP.java b/jena-fuseki1/src/test/java/org/apache/jena/fuseki/http/TestDatasetGraphAccessorHTTP.java
new file mode 100644
index 0000000..7687b2c
--- /dev/null
+++ b/jena-fuseki1/src/test/java/org/apache/jena/fuseki/http/TestDatasetGraphAccessorHTTP.java
@@ -0,0 +1,43 @@
+/*
+ * 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.fuseki.http;
+
+import org.apache.jena.fuseki.ServerTest ;
+import org.apache.jena.web.AbstractTestDatasetGraphAccessor ;
+import org.apache.jena.web.DatasetGraphAccessor ;
+import org.apache.jena.web.DatasetGraphAccessorHTTP ;
+import org.junit.AfterClass ;
+import org.junit.Before ;
+import org.junit.BeforeClass ;
+
+public class TestDatasetGraphAccessorHTTP extends AbstractTestDatasetGraphAccessor
+{
+    @BeforeClass public static void beforeClass() { ServerTest.allocServer() ; }
+    @AfterClass public static void afterClass() { ServerTest.freeServer() ; }
+    @Before public void before() { 
+        ServerTest.resetServer() ; 
+    }
+
+    
+    @Override
+    protected DatasetGraphAccessor getDatasetUpdater()
+    {
+        return new DatasetGraphAccessorHTTP(ServerTest.serviceREST) ;
+    }
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/test/java/org/apache/jena/fuseki/http/TestHttpOp.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/test/java/org/apache/jena/fuseki/http/TestHttpOp.java b/jena-fuseki1/src/test/java/org/apache/jena/fuseki/http/TestHttpOp.java
new file mode 100644
index 0000000..1c5ccd5
--- /dev/null
+++ b/jena-fuseki1/src/test/java/org/apache/jena/fuseki/http/TestHttpOp.java
@@ -0,0 +1,214 @@
+/**
+ * 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.fuseki.http;
+
+import java.io.IOException ;
+
+import org.apache.jena.atlas.io.IO ;
+import org.apache.jena.atlas.junit.BaseTest ;
+import org.apache.jena.atlas.web.HttpException ;
+import org.apache.jena.atlas.web.TypedInputStream ;
+import org.apache.jena.fuseki.ServerTest ;
+import org.apache.jena.riot.WebContent ;
+import org.apache.jena.riot.system.IRILib ;
+import org.apache.jena.riot.web.HttpOp ;
+import org.apache.jena.web.HttpSC ;
+import org.junit.AfterClass ;
+import org.junit.BeforeClass ;
+import org.junit.Test ;
+
+import com.hp.hpl.jena.sparql.engine.http.Params ;
+import com.hp.hpl.jena.util.FileUtils ;
+
+// This a mixture of testing HttpOp and testing basic operation of the SPARQL server
+// especially error cases abnd unusual usage that the higher level APIs don't use.
+public class TestHttpOp extends BaseTest {
+    
+    static String pingURL = ServerTest.urlRoot+"ping.txt" ;
+    @BeforeClass public static void beforeClass() { ServerTest.allocServer() ; }
+    @AfterClass  public static void afterClass()  { ServerTest.freeServer() ; }
+    
+    static String graphURL = ServerTest.serviceREST+"?default" ;
+    static String queryURL = ServerTest.serviceQuery ;
+    static String updateURL = ServerTest.serviceUpdate ;
+    
+    static String simpleQuery = queryURL+"?query="+IRILib.encodeUriComponent("ASK{}") ;
+    
+    // Basic operations
+    
+    @Test public void httpGet_01() {
+        TypedInputStream in = HttpOp.execHttpGet(pingURL) ;
+        IO.close(in) ;
+    }
+    
+    @Test(expected=HttpException.class) 
+    public void httpGet_02() {
+        try {
+            TypedInputStream in = HttpOp.execHttpGet(ServerTest.urlRoot+"does-not-exist") ;
+            IO.close(in) ;
+        } catch(HttpException ex) {
+            assertEquals(HttpSC.NOT_FOUND_404, ex.getResponseCode()) ;
+            throw ex ;
+        }
+    }
+
+    @Test public void httpGet_03() throws IOException {
+        String x = HttpOp.execHttpGetString(pingURL) ;
+        String y = FileUtils.readWholeFileAsUTF8("pages/ping.txt") ;
+        assertEquals(y,x) ;
+    }   
+    
+    @Test public void httpGet_04() {
+        String x = HttpOp.execHttpGetString(ServerTest.urlRoot+"does-not-exist") ;
+        assertNull(x) ;
+    }
+    
+    @Test public void httpGet_05() {
+        TypedInputStream in = HttpOp.execHttpGet(simpleQuery) ;
+        IO.close(in) ;
+    }
+    
+    // SPARQL Query
+    
+    @Test public void queryGet_01() {
+        TypedInputStream in = HttpOp.execHttpGet(simpleQuery) ;
+        IO.close(in) ;
+    }
+
+    @Test(expected=HttpException.class)
+    public void queryGet_02() {
+        try {
+            // No query.
+            TypedInputStream in = HttpOp.execHttpGet(queryURL+"?query=") ;
+            IO.close(in) ;
+        } catch (HttpException ex) {
+            assertEquals(ex.getResponseCode(), HttpSC.BAD_REQUEST_400) ;
+            throw ex ; 
+        }
+    }
+
+//    @Test(expected=HttpException.class)
+//    public void queryGet_03() {
+//        try {
+//            // Service description.
+//            TypedInputStream in = HttpOp.execHttpGet(queryURL) ;
+//            IO.close(in) ;
+//        } catch (HttpException ex) {
+//            assertEquals(ex.getResponseCode(), HttpSC.NOT_FOUND_404) ;
+//            throw ex ; 
+//        }
+//    }
+
+    @Test(expected=HttpException.class)
+    public void httpPost_01() {
+        try {
+            HttpOp.execHttpPost(queryURL, "ASK{}", "text/plain") ;
+        } catch (HttpException ex) {
+            assertEquals(ex.getResponseCode(), HttpSC.UNSUPPORTED_MEDIA_TYPE_415) ;
+            throw ex ;
+        }
+    }
+    
+    @Test(expected=HttpException.class)
+    public void httpPost_02() {
+        try {
+            HttpOp.execHttpPost(queryURL, "ASK{}", WebContent.contentTypeSPARQLQuery) ;
+        } catch (HttpException ex) {
+            assertEquals(ex.getResponseCode(), HttpSC.UNSUPPORTED_MEDIA_TYPE_415) ;
+            throw ex ;
+        }
+    }
+    
+    @Test(expected=HttpException.class)
+    public void httpPost_03() {
+        try {
+            HttpOp.execHttpPost(queryURL, "ASK{}", WebContent.contentTypeOctets) ;
+        } catch (HttpException ex) {
+            assertEquals(ex.getResponseCode(), HttpSC.UNSUPPORTED_MEDIA_TYPE_415) ;
+            throw ex ;
+        }
+    }
+        
+    @Test public void httpPost_04() {
+        Params params = new Params() ;
+        params.addParam("query", "ASK{}") ;
+        TypedInputStream in = HttpOp.execHttpPostFormStream(queryURL, params, WebContent.contentTypeResultsJSON) ;
+        IO.close(in) ;
+    }
+    
+    @Test(expected=HttpException.class)
+    public void httpPost_05() {
+        Params params = new Params() ;
+        params.addParam("query", "ASK{}") ;
+        TypedInputStream in = null ;
+        try {
+            // Query to Update 
+            in = HttpOp.execHttpPostFormStream(updateURL, params, WebContent.contentTypeResultsJSON) ;
+        } catch (HttpException ex) {
+            assertEquals(ex.getResponseCode(), HttpSC.BAD_REQUEST_400) ;
+            throw ex ;
+        }
+        finally { IO.close(in) ; }
+    }
+    
+    @Test public void httpPost_06() {
+        Params params = new Params() ;
+        params.addParam("request", "CLEAR ALL") ;
+        HttpOp.execHttpPostForm(updateURL, params) ;
+    }
+    
+    // GSP
+    @Test public void gsp_01() {
+        String x = HttpOp.execHttpGetString(graphURL, "application/rdf+xml") ;
+        assertTrue(x.contains("</")) ;
+        assertTrue(x.contains(":RDF")) ;
+    }
+
+    @Test public void gsp_02() {
+        String x = HttpOp.execHttpGetString(graphURL, "application/n-triples") ;
+        assertTrue(x.isEmpty()) ;
+    }
+    
+    static String graphString = "@prefix : <http://example/> . :s :p :o ." ;
+    
+    @Test public void gsp_03() {
+        HttpOp.execHttpPut(graphURL, WebContent.contentTypeTurtle, graphString) ;
+    }
+    
+    @Test public void gsp_04() {
+        HttpOp.execHttpPut(graphURL, WebContent.contentTypeTurtle, graphString) ;
+        String s1 = HttpOp.execHttpGetString(graphURL, WebContent.contentTypeNTriples) ;
+        assertFalse(s1.isEmpty()) ;
+        HttpOp.execHttpDelete(graphURL) ;
+        String s2 = HttpOp.execHttpGetString(graphURL, WebContent.contentTypeNTriples) ;
+        assertTrue(s2.isEmpty()) ;
+    }
+    
+    @Test public void gsp_05() {
+        HttpOp.execHttpDelete(graphURL) ;
+        
+        HttpOp.execHttpPost(graphURL, WebContent.contentTypeTurtle, graphString) ;
+        String s1 = HttpOp.execHttpGetString(graphURL, WebContent.contentTypeNTriples) ;
+        assertFalse(s1.isEmpty()) ;
+        HttpOp.execHttpDelete(graphURL) ;
+        String s2 = HttpOp.execHttpGetString(graphURL, WebContent.contentTypeNTriples) ;
+        assertTrue(s2.isEmpty()) ;
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/test/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/test/resources/log4j.properties b/jena-fuseki1/src/test/resources/log4j.properties
new file mode 100644
index 0000000..da8f386
--- /dev/null
+++ b/jena-fuseki1/src/test/resources/log4j.properties
@@ -0,0 +1,20 @@
+log4j.rootLogger=INFO,stdlog
+
+log4j.appender.stdlog=org.apache.log4j.ConsoleAppender
+log4j.appender.stdlog.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdlog.layout.ConversionPattern=%d{HH:mm:ss} %-5p %-25c{1} :: %m%n
+
+# Jena Dependency log levels
+log4j.logger.com.hp.hpl.jena.arq.info=INFO
+log4j.logger.com.hp.hpl.jena.arq.exec=INFO
+log4j.logger.com.hp.hpl.jena=WARN
+log4j.logger.org.apache.jena=WARN
+log4j.logger.org.apache.jena.riot=INFO
+
+# Jetty - Fuseki catches Jetty errors and reports them.
+log4j.logger.org.eclipse.jetty=FATAL
+
+# Fuseki
+log4j.logger.org.apache.jena.fuseki.Server=WARN
+log4j.logger.org.apache.jena.fuseki.Fuseki=WARN
+log4j.logger.org.apache.jena.fuseki=WARN
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/tdb.ttl
----------------------------------------------------------------------
diff --git a/jena-fuseki1/tdb.ttl b/jena-fuseki1/tdb.ttl
new file mode 100644
index 0000000..6cc1130
--- /dev/null
+++ b/jena-fuseki1/tdb.ttl
@@ -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.
+
+@prefix tdb:     <http://jena.hpl.hp.com/2008/tdb#> .
+@prefix rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+@prefix rdfs:    <http://www.w3.org/2000/01/rdf-schema#> .
+@prefix ja:      <http://jena.hpl.hp.com/2005/11/Assembler#> .
+@prefix tdb:     <http://jena.hpl.hp.com/2008/tdb#> .
+
+[] ja:loadClass "com.hp.hpl.jena.tdb.TDB" .
+tdb:DatasetTDB  rdfs:subClassOf  ja:RDFDataset .
+tdb:GraphTDB    rdfs:subClassOf  ja:Model .
+
+ <#dataset> rdf:type      tdb:DatasetTDB ;
+     tdb:location "DB" ;
+##      tdb:unionDefaultGraph true ;
+     .

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 568340d..4f20cc2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -68,7 +68,7 @@
         <module>jena-core</module>
         <module>jena-arq</module>
         <module>jena-tdb</module>
-        <!--<module>jena-fuseki</module>-->
+        <!--<module>jena-fuseki1</module>-->
 	<module>jena-fuseki2</module>
 
 	<!-- <module>jena-security</module> Lots of output and warnings -->
@@ -110,7 +110,7 @@
 
         <module>jena-sdb</module>
 
-        <module>jena-fuseki</module>
+        <module>jena-fuseki1</module>
         <module>jena-fuseki2</module>
 	<module>jena-security</module>
 


[17/23] jena git commit: Rename folder jena-fuseki to jena-fuseki1

Posted by an...@apache.org.
http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/s-update-form
----------------------------------------------------------------------
diff --git a/jena-fuseki/s-update-form b/jena-fuseki/s-update-form
deleted file mode 100755
index 4f6590d..0000000
--- a/jena-fuseki/s-update-form
+++ /dev/null
@@ -1,713 +0,0 @@
-#!/usr/bin/env ruby
-# -*- coding: utf-8 -*-
-
-# 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.
-
-# SPARQL HTTP Update, client.
-
-require 'optparse'
-require 'net/http'
-require 'uri'
-require 'cgi'
-require 'pp'
-require 'ostruct'
-
-# ToDo
-#  Allow a choice of media type for GET
-#   --accept "content-type" (and abbreviations)
-#   --header "Add:this"
-#   --user, --password
-#  Basic authentication: request.basic_auth("username", "password")
-#  Follow redirects => 301:  puts response["location"] # All headers are lowercase?
-
-SOH_NAME="SOH"
-SOH_VERSION="0.0.0"
-
-$proxy = ENV['http_proxy'] ? URI.parse(ENV['http_proxy']) : OpenStruct.new  
-
-# What about direct naming?
-
-# Names
-$mtTurtle           = 'text/turtle;charset=utf-8'
-$mtRDF              = 'application/rdf+xml'
-$mtText             = 'text/plain'
-$mtNTriples         = 'application/n-triples'
-$mtNQuads           = 'application/n-quads'
-$mtJSONLD           = 'application/ld+json'
-$mtTriG             = 'application/trig'
-$mtSparqlResultsX   = 'application/sparql-results+xml'
-$mtSparqlResultsJ   = 'application/sparql-results+json'
-$mtAppJSON          = 'application/json'
-$mtAppXML           = 'application/xml'
-$mtSparqlResultsTSV = 'application/sparql-results+tsv'
-$mtSparqlResultsCSV = 'application/sparql-results+csv'
-$mtSparqlUpdate     = 'application/sparql-update'
-$mtWWWForm          = 'application/x-www-form-urlencoded'
-$mtSparqlQuery      = "application/sparql-query" ;
-
-# Global media type table.
-$fileMediaTypes = {}
-$fileMediaTypes['ttl']   = $mtTurtle
-$fileMediaTypes['n3']    = 'text/n3; charset=utf-8'
-$fileMediaTypes['nt']    = $mtText
-$fileMediaTypes['rdf']   = $mtRDF
-$fileMediaTypes['owl']   = $mtRDF
-$fileMediaTypes['nq']    = $mtNQuads
-$fileMediaTypes['trig']  = $mtTriG
-$fileMediaTypes['json-ld']  = $mtJSONLD
-$fileMediaTypes['jsonld']  = $mtJSONLD
-
-# Global charset : no entry means "don't set"
-$charsetUTF8      = 'utf-8'
-$charset = {}
-$charset[$mtTurtle]   = 'utf-8'
-$charset[$mtText]     = 'ascii'
-$charset[$mtTriG]     = 'utf-8'
-$charset[$mtNQuads]   = 'utf-8'
-
-# Headers
-
-$hContentType         = 'Content-Type'
-# $hContentEncoding     = 'Content-Encoding'
-$hContentLength       = 'Content-Length'
-# $hContentLocation     = 'Content-Location'
-# $hContentRange        = 'Content-Range'
-
-$hAccept              = 'Accept'
-$hAcceptCharset       = 'Accept-Charset'
-$hAcceptEncoding      = 'Accept-Encoding'
-$hAcceptRanges        = 'Accept-Ranges' 
-
-$headers = { "User-Agent" => "#{SOH_NAME}/Fuseki #{SOH_VERSION}"}
-$print_http = false
-
-# Default for GET
-# At least allow anything (and hope!)
-$accept_rdf="#{$mtTurtle} , #{$mtNTriples};q=0.9 , #{$mtRDF};q=0.8 , #{$mtJSONLD};q=0.5"
-# Datasets
-$accept_ds="#{$mtTrig} , #{$mtNQuads};q=0.9 , #{$mtJSONLD};q=0.5"
-# For SPARQL query
-$accept_results="#{$mtSparqlResultsJ} , #{$mtSparqlResultsX};q=0.9 , #{$accept_rdf}"
-
-# Accept any in case of trouble.
-$accept_rdf="#{$accept_rdf} , */*;q=0.1"
-$accept_results="#{$accept_results} , */*;q=0.1" 
-
-# The media type usually forces the charset.
-$accept_charset=nil
-
-## Who we are.
-## Two styles:
-##    s-query .....
-##    soh query .....
-
-$cmd = File.basename($0)
-if $cmd == 'soh'
-then
-  $cmd = (ARGV.size == 0) ? 'soh' : ARGV.shift
-end
-
-if ! $cmd.start_with?('s-') && $cmd != 'soh'
-  $cmd = 's-'+$cmd
-end
-
-## -------- 
-
-def GET(dataset, graph)
-  print "GET #{dataset} #{graph}\n" if $verbose
-  requestURI = target(dataset, graph)
-  headers = {}
-  headers.merge!($headers)
-  headers[$hAccept] = $accept_rdf
-  headers[$hAcceptCharset] = $accept_charset unless $accept_charset.nil?
-  get_worker(requestURI, headers)
-end
-
-def get_worker(requestURI, headers)
-  uri = URI.parse(requestURI)
-  request = Net::HTTP::Get.new(uri.request_uri)
-  request.initialize_http_header(headers)
-  print_http_request(uri, request)
-  response_print_body(uri, request)
-end
-
-def HEAD(dataset, graph)
-  print "HEAD #{dataset} #{graph}\n" if $verbose
-  requestURI = target(dataset, graph)
-  headers = {}
-  headers.merge!($headers)
-  headers[$hAccept] = $accept_rdf
-  headers[$hAcceptCharset] = $accept_charset unless $accept_charset.nil?
-  uri = URI.parse(requestURI)
-  request = Net::HTTP::Head.new(uri.request_uri)
-  request.initialize_http_header(headers)
-  print_http_request(uri, request)
-  response_no_body(uri, request)
-end
-
-def PUT(dataset, graph, file)
-  print "PUT #{dataset} #{graph} #{file}\n" if $verbose
-  send_body(dataset, graph, file, Net::HTTP::Put)
-end
-
-def POST(dataset, graph, file)
-  print "POST #{dataset} #{graph} #{file}\n" if $verbose
-  send_body(dataset, graph, file, Net::HTTP::Post)
-end
-
-def DELETE(dataset, graph)
-  print "DELETE #{dataset} #{graph}\n" if $verbose
-  requestURI = target(dataset, graph)
-  uri = URI.parse(requestURI)
-  request = Net::HTTP::Delete.new(uri.request_uri)
-  headers = {}
-  headers.merge!($headers)
-  request.initialize_http_header(headers)
-  print_http_request(uri, request)
-  response_no_body(uri, request)
-end
-
-def uri_escape(string)
-  CGI.escape(string)
-end
-
-def target(dataset, graph)
-  return dataset+"?default" if graph == "default"
-  return dataset+"?graph="+uri_escape(graph)
-end
-
-def send_body(dataset, graph, file, method)
-  mt = content_type(file)
-  headers = {}
-  headers.merge!($headers)
-  headers[$hContentType] = mt
-  headers[$hContentLength] = File.size(file).to_s
-  ## p headers
-
-  requestURI = target(dataset, graph)
-  uri = URI.parse(requestURI)
-  
-  request = method.new(uri.request_uri)
-  request.initialize_http_header(headers)
-  print_http_request(uri, request)
-  request.body_stream = File.open(file)
-  response_no_body(uri, request)
-end
-
-def response_no_body(uri, request)
-  http = Net::HTTP::Proxy($proxy.host,$proxy.port).new(uri.host, uri.port)
-  http.read_timeout = nil
-  # check we can connect.
-  begin http.start
-  rescue Exception => e  
-    # puts e.message  
-    #puts e.backtrace.inspect  
-    warn_exit "Failed to connect: #{uri.host}:#{uri.port}: #{e.message}", 3
-  end
-  response = http.request(request)
-  print_http_response(response)
-  case response
-  when Net::HTTPSuccess, Net::HTTPRedirection
-    # OK
-  when Net::HTTPNotFound
-    warn_exit "404 Not found: #{uri}", 9
-    #print response.body
-  else
-    warn_exit "#{response.code} #{response.message} #{uri}", 9
-    # Unreachable
-      response.error!
-  end
-  # NO BODY IN RESPONSE
-end
-
-def response_print_body(uri, request)
-  http = Net::HTTP::Proxy($proxy.host,$proxy.port).new(uri.host, uri.port)
-  http.read_timeout = nil
-  # check we can connect.
-  begin http.start
-  rescue => e  
-    #puts e.backtrace.inspect  
-    #print e.class
-    warn_exit "Failed to connect: #{uri.host}:#{uri.port}: #{e.message}", 3
-  end
-
-  # Add a blank line if headers were output.
-  print "\n" if $http_print ;
-
-  begin
-    response = http.request(request) { |res| 
-      print_http_response(res)
-      #puts res.code
-      res.read_body do |segment|
-        print segment
-      end
-    }
-    case response
-    when Net::HTTPSuccess, Net::HTTPRedirection
-      # OK
-    when Net::HTTPNotFound
-      warn_exit "404 Not found: #{uri}", 9
-      #print response.body
-    else
-      warn_exit "#{response.code}: #{uri}", 9
-      # Unreachable
-      response.error!
-    end
-  rescue EOFError => e
-    warn_exit "IO Error: "+e.message, 3
-  end
-end
-
-def print_http_request(uri, request)
-  return unless $print_http
-  #print "Request\n"
-  print request.method," ",uri, "\n"
-  print_headers("  ",request)
-end
-
-def print_http_response(response)
-  return unless $print_http
-  #print "Response\n"
-  print response.code, " ", response.message, "\n"
-  print_headers("  ",response)
-end
-
-def print_headers(marker, headers)
-  headers.each do |k,v| 
-    k = k.split('-').map{|w| w.capitalize}.join('-')+':'
-    printf "%s%-20s %s\n",marker,k,v
-  end
-end
-
-def content_type(file)
-  file =~ /\.([^.]*)$/
-  ext = $1
-  mt = $fileMediaTypes[ext]
-  cs = $charset[mt]
-  mt = mt+';charset='+cs if ! cs.nil?
-  return mt
-end
-
-def charset(content_type)
-  return $charset[content_type]
-end
-
-def warn_exit(msg, rc)
-    warn msg
-    exit rc ;
-end
-
-def parseURI(uri_string)
-  begin
-    return URI.parse(uri_string).to_s
-  rescue URI::InvalidURIError => err
-    warn_exit "Bad URI: <#{uri_string}>", 2
-  end
-end
-
-## ---- Command
-
-def cmd_soh(command=nil)
-  ## Command line
-  options = {}
-  optparse = OptionParser.new do |opts|
-    # Set a banner, displayed at the top
-    # of the help screen.
-    case $cmd
-    when "s-http", "sparql-http", "soh"
-      banner="$cmd [get|post|put|delete] datasetURI graph [file]"
-    when "s-get", "s-head", "s-delete"
-      banner="$cmd  datasetURI graph"
-    end
-
-    opts.banner = $banner
-    # Define the options, and what they do
-    
-    options[:verbose] = false
-    opts.on( '-v', '--verbose', 'Verbose' ) do
-      options[:verbose] = true
-    end
-    
-    options[:version] = false
-    opts.on( '--version', 'Print version and exit' ) do
-      print "#{SOH_NAME} #{SOH_VERSION}\n"
-      exit
-    end
-    
-    # This displays the help screen, all programs are
-    # assumed to have this option.
-    opts.on( '-h', '--help', 'Display this screen and exit' ) do
-      puts opts
-      exit
-    end
-  end
-
-  begin optparse.parse!    
-  rescue OptionParser::InvalidArgument => e
-    warn e
-    exit
-  end
-
-  $verbose = options[:verbose]
-  $print_http = $verbose
-
-  if command.nil?
-    if ARGV.size == 0
-      warn "No command given: expected one of 'get', 'put', 'post', 'delete', 'query' or 'update'"
-      exit 1
-    end
-    cmdPrint=ARGV.shift
-    command=cmdPrint.upcase
-  else
-    cmdPrint=command
-  end
-
-  case command
-  when "HEAD", "GET", "DELETE"
-    requiredFile=false
-  when "PUT", "POST"
-    requiredFile=true
-  when "QUERY"
-    cmd_sparql_query
-  when "UPDATE"
-    cmd_sparql_update
-  else
-    warn_exit "Unknown command: #{command}", 2
-  end
-
-  if requiredFile 
-  then
-    if ARGV.size != 3
-      warn_exit "Required: dataset URI, graph URI (or 'default') and file", 1 
-    end
-  else
-    if ARGV.size != 2
-      warn_exit "Required: dataset URI and graph URI (or 'default')", 1 
-    end
-  end
-
-  dataset=parseURI(ARGV.shift)
-  # Relative URI?
-  graph=parseURI(ARGV.shift)
-  file=""
-  if requiredFile
-  then
-    file = ARGV.shift if requiredFile
-    if ! File.exist?(file)
-      warn_exit "No such file: "+file, 3
-    end
-    if File.directory?(file)
-      warn_exit "File is a directory: "+file, 3
-    end
-  end
-
-  case command
-  when "GET"
-    GET(dataset, graph)
-  when "HEAD"
-    HEAD(dataset, graph)
-  when "PUT"
-    PUT(dataset, graph, file)
-  when "DELETE"
-    DELETE(dataset, graph)
-  when "POST"
-    POST(dataset, graph, file)
-  else
-    warn_exit "Internal error: Unknown command: #{cmd}", 2
-  end
-  exit 0
-end
-
-## --------
-def string_or_file(arg)
-  return arg if ! arg.match(/^@/)
-  a=(arg[1..-1])
-  open(a, 'rb'){|f| f.read}
-end
-
-## -------- SPARQL Query
-
-## Choose method
-def SPARQL_query(service, query, query_file, forcePOST=false, args2={})
-   if ! query_file.nil?
-    query = open(query_file, 'rb'){|f| f.read}
-  end
-  if forcePOST || query.length >= 2*1024 
-    SPARQL_query_POST(service, query, args2)
-  else
-    SPARQL_query_GET(service, query, args2)
-  end
-end
-
-## By GET
-
-def SPARQL_query_GET(service, query, args2)
-  args = { "query" => query }
-  args.merge!(args2)
-  qs=args.collect { |k,v| "#{k}=#{uri_escape(v)}" }.join('&')
-  action="#{service}?#{qs}"
-  headers={}
-  headers.merge!($headers)
-  headers[$hAccept]=$accept_results
-  get_worker(action, headers)
-end
-
-## By POST
-
-def SPARQL_query_POST(service, query, args2)
-  # DRY - body/no body for each of request and response.
-  post_params={ "query" => query }
-  post_params.merge!(args2)
-  uri = URI.parse(service)
-  headers={}
-  headers.merge!($headers)
-  headers[$hAccept]=$accept_results
-  execute_post_form_body(uri, headers, post_params)
-end
-
-def execute_post_form_body(uri, headers, post_params)
-  request = Net::HTTP::Post.new(uri.request_uri)
-  qs=post_params.collect { |k,v| "#{k}=#{uri_escape(v)}" }.join('&')
-  headers[$hContentType] = $mtWWWForm
-  headers[$hContentLength] = qs.length.to_s
-  request.initialize_http_header(headers)
-  request.body = qs
-  print_http_request(uri, request)
-  response_print_body(uri, request)
-end
-
-# Usage: -v --help --file= --query=
-def cmd_sparql_query
-  options={}
-  optparse = OptionParser.new do |opts|
-    opts.banner = "Usage: #{$cmd} [--query QUERY] [--service URI] [--post] 'query' | @file"
-    opts.on('--service=URI', '--server=URI', 'SPARQL endpoint') do |uri|
-      options[:service]=uri
-    end
-    opts.on('--query=FILE','--file=FILE', 'Take query from a file') do |file|
-      options[:file]=file
-    end
-    opts.on('--output=TYPE', [:json,:xml,:text,:csv,:tsv],
-            'Set the output argument') do |type|
-      options[:output]=type
-    end
-    opts.on('--accept=TYPE', [:json,:xml,:text,:csv,:tsv], 
-            'Set the accept header type') do |type|
-      options[:accept]=type
-    end
-    options[:verbose] = false
-    opts.on( '--post', 'Force use of POST' ) do
-      options[:post] = true
-    end
-    opts.on( '-v', '--verbose', 'Verbose' ) do
-      options[:verbose] = true
-    end
-    opts.on( '--version', 'Print version and exit' ) do
-      print "#{SOH_NAME} #{SOH_VERSION}\n"
-      exit
-    end 
-    opts.on( '-h', '--help', 'Display this screen and exit' ) do
-      puts opts
-      exit
-    end
-  end
-
-  begin optparse.parse!    
-  rescue OptionParser::InvalidArgument, OptionParser::InvalidOption => e
-    warn e
-    exit 1
-  end
-
-  $verbose = options[:verbose]
-  $print_http = $verbose
-  usePOST = options[:post]
-
-  service = options[:service]
-  warn_exit 'No service specified.  Required --service=URI',1 if service.nil?
-
-  # Query
-  query=nil
-  query_file=options[:file]
-  if query_file.nil? && ARGV.size == 0
-  then
-    warn_exit 'No query specified.',1
-    end
-  if query_file.nil?
-    query = ARGV.shift
-    if query.match(/^@/)
-      query_file = query[1..-1]
-      query = nil
-    end
-  end
-
-  # --output ==> output= (non-standard)
-  args={}
-  case options[:output]
-  when nil
-  when  "json","xml","text","csv","tsv"
-    args['output'] = options[:output]
-  when :json,:xml,:text,:csv,:tsv
-    args['output'] = options[:output].to_s
-  else
-    warn_exit "Unrecognized output type: "+options[:output],2
-  end
-
-  # --accept
-  # options[:accept]
-
-  print "SPARQL #{service}\n" if $verbose
-  #args={"output"=>"text"}
-  SPARQL_query(service, query, query_file, usePOST, args)
-  exit(0)
-end
-
-## -------- SPARQL Update
-
-# Update sent as a WWW form.
-def SPARQL_update_by_form(service, update, args2={})
-  args = {}
-  args.merge!(args2)
-  headers={}
-  headers.merge!($headers)
-  # args? encode?
-  body="update="+uri_escape(update)
-  headers[$hContentType] = $mtWWWForm
-  headers[$hContentLength] = body.length.to_s
-  uri = URI.parse(service)
-  execute_post_form(uri, headers, body)
-end
-
-# DRY - query form.
-def execute_post_form(uri, headers, body)
-  request = Net::HTTP::Post.new(uri.request_uri)
-  request.initialize_http_header(headers)
-  request.body = body
-  print_http_request(uri, request)
-  response_no_body(uri, request)
-end
-
-def SPARQL_update(service, update, args2={})
-  args = {}
-  args.merge!(args2)
-  headers={}
-  headers.merge!($headers)
-  headers[$hContentType] = $mtSparqlUpdate
-  uri = URI.parse(service)
-  request = Net::HTTP::Post.new(uri.request_uri)
-  request.initialize_http_header(headers)
-  request.body = update
-  print_http_request(uri, request)
-  response_no_body(uri, request)
-end
-
-def cmd_sparql_update(by_raw_post=true)
-  # Share with cmd_sparql_query
-  options={}
-  optparse = OptionParser.new do |opts|
-    opts.banner = "Usage: #{$cmd} [--file REQUEST] [--service URI] 'request' | @file"
-    opts.on('--service=URI', '--server=URI', 'SPARQL endpoint') do |uri|
-      options[:service]=uri
-    end
-    opts.on('--update=FILE', '--file=FILE', 'Take update from a file') do |file|
-      options[:file]=file
-    end
-    options[:verbose] = false
-    opts.on( '-v', '--verbose', 'Verbose' ) do
-      options[:verbose] = true
-    end
-    opts.on( '--version', 'Print version and exit' ) do
-      print "#{SOH_NAME} #{SOH_VERSION}\n"
-      exit
-    end 
-    opts.on( '-h', '--help', 'Display this screen and exit' ) do
-      puts opts
-      exit
-    end
-  end
-
-  begin optparse.parse!    
-  rescue OptionParser::InvalidArgument => e
-    warn e
-    exit
-  end
-
-  $verbose = options[:verbose]
-  $print_http = $verbose
-
-  service = options[:service]
-  warn_exit 'No service specified. Required --service=URI',1   if service.nil?
-  
-  update=nil
-  update_file=options[:file]
-
-  if update_file.nil? && ARGV.size == 0
-  then
-    warn_exit 'No update specified.',1
-    end
-  if update_file.nil?
-    update = ARGV.shift
-    if update.match(/^@/)
-      update_file = update[1..-1]
-      update = nil
-    end
-  end
-  
-  print "SPARQL-Update #{service}\n" if $verbose
-  args={}
-
-  # Reads in the file :-(
-  if update.nil?
-  then
-    update = open(update_file, 'rb'){|f| f.read}
-  else
-    update = string_or_file(update)
-  end
-
-  if by_raw_post
-    SPARQL_update(service, update, args)
-  else
-    SPARQL_update_by_form(service, update, args)
-  end
-  exit(0)
-end
-
-## -------
-
-case $cmd
-when "s-http", "sparql-http", "soh"
-  $banner="#{$cmd} [get|post|put|delete] datasetURI graph [file]"
-  cmd_soh
-when "s-get", "s-head", "s-put", "s-delete", "s-post"
-
-  case $cmd
-  when "s-get", "s-head", "s-delete"
-    $banner="#{$cmd} datasetURI graph"
-  when "s-put", "s-post"
-    $banner="#{$cmd} datasetURI graph file"
-  end
-  cmd2 = $cmd.sub(/^s-/, '').upcase
-  cmd_soh cmd2
-
-when "s-query", "sparql-query"
-  cmd_sparql_query
-when "s-update", "sparql-update"
-  cmd_sparql_update true
-when "s-update-form", "sparql-update-form"
-  cmd_sparql_update false
-else 
-  warn_exit "Unknown: "+$cmd, 1
-end

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/soh
----------------------------------------------------------------------
diff --git a/jena-fuseki/soh b/jena-fuseki/soh
deleted file mode 100755
index 4f6590d..0000000
--- a/jena-fuseki/soh
+++ /dev/null
@@ -1,713 +0,0 @@
-#!/usr/bin/env ruby
-# -*- coding: utf-8 -*-
-
-# 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.
-
-# SPARQL HTTP Update, client.
-
-require 'optparse'
-require 'net/http'
-require 'uri'
-require 'cgi'
-require 'pp'
-require 'ostruct'
-
-# ToDo
-#  Allow a choice of media type for GET
-#   --accept "content-type" (and abbreviations)
-#   --header "Add:this"
-#   --user, --password
-#  Basic authentication: request.basic_auth("username", "password")
-#  Follow redirects => 301:  puts response["location"] # All headers are lowercase?
-
-SOH_NAME="SOH"
-SOH_VERSION="0.0.0"
-
-$proxy = ENV['http_proxy'] ? URI.parse(ENV['http_proxy']) : OpenStruct.new  
-
-# What about direct naming?
-
-# Names
-$mtTurtle           = 'text/turtle;charset=utf-8'
-$mtRDF              = 'application/rdf+xml'
-$mtText             = 'text/plain'
-$mtNTriples         = 'application/n-triples'
-$mtNQuads           = 'application/n-quads'
-$mtJSONLD           = 'application/ld+json'
-$mtTriG             = 'application/trig'
-$mtSparqlResultsX   = 'application/sparql-results+xml'
-$mtSparqlResultsJ   = 'application/sparql-results+json'
-$mtAppJSON          = 'application/json'
-$mtAppXML           = 'application/xml'
-$mtSparqlResultsTSV = 'application/sparql-results+tsv'
-$mtSparqlResultsCSV = 'application/sparql-results+csv'
-$mtSparqlUpdate     = 'application/sparql-update'
-$mtWWWForm          = 'application/x-www-form-urlencoded'
-$mtSparqlQuery      = "application/sparql-query" ;
-
-# Global media type table.
-$fileMediaTypes = {}
-$fileMediaTypes['ttl']   = $mtTurtle
-$fileMediaTypes['n3']    = 'text/n3; charset=utf-8'
-$fileMediaTypes['nt']    = $mtText
-$fileMediaTypes['rdf']   = $mtRDF
-$fileMediaTypes['owl']   = $mtRDF
-$fileMediaTypes['nq']    = $mtNQuads
-$fileMediaTypes['trig']  = $mtTriG
-$fileMediaTypes['json-ld']  = $mtJSONLD
-$fileMediaTypes['jsonld']  = $mtJSONLD
-
-# Global charset : no entry means "don't set"
-$charsetUTF8      = 'utf-8'
-$charset = {}
-$charset[$mtTurtle]   = 'utf-8'
-$charset[$mtText]     = 'ascii'
-$charset[$mtTriG]     = 'utf-8'
-$charset[$mtNQuads]   = 'utf-8'
-
-# Headers
-
-$hContentType         = 'Content-Type'
-# $hContentEncoding     = 'Content-Encoding'
-$hContentLength       = 'Content-Length'
-# $hContentLocation     = 'Content-Location'
-# $hContentRange        = 'Content-Range'
-
-$hAccept              = 'Accept'
-$hAcceptCharset       = 'Accept-Charset'
-$hAcceptEncoding      = 'Accept-Encoding'
-$hAcceptRanges        = 'Accept-Ranges' 
-
-$headers = { "User-Agent" => "#{SOH_NAME}/Fuseki #{SOH_VERSION}"}
-$print_http = false
-
-# Default for GET
-# At least allow anything (and hope!)
-$accept_rdf="#{$mtTurtle} , #{$mtNTriples};q=0.9 , #{$mtRDF};q=0.8 , #{$mtJSONLD};q=0.5"
-# Datasets
-$accept_ds="#{$mtTrig} , #{$mtNQuads};q=0.9 , #{$mtJSONLD};q=0.5"
-# For SPARQL query
-$accept_results="#{$mtSparqlResultsJ} , #{$mtSparqlResultsX};q=0.9 , #{$accept_rdf}"
-
-# Accept any in case of trouble.
-$accept_rdf="#{$accept_rdf} , */*;q=0.1"
-$accept_results="#{$accept_results} , */*;q=0.1" 
-
-# The media type usually forces the charset.
-$accept_charset=nil
-
-## Who we are.
-## Two styles:
-##    s-query .....
-##    soh query .....
-
-$cmd = File.basename($0)
-if $cmd == 'soh'
-then
-  $cmd = (ARGV.size == 0) ? 'soh' : ARGV.shift
-end
-
-if ! $cmd.start_with?('s-') && $cmd != 'soh'
-  $cmd = 's-'+$cmd
-end
-
-## -------- 
-
-def GET(dataset, graph)
-  print "GET #{dataset} #{graph}\n" if $verbose
-  requestURI = target(dataset, graph)
-  headers = {}
-  headers.merge!($headers)
-  headers[$hAccept] = $accept_rdf
-  headers[$hAcceptCharset] = $accept_charset unless $accept_charset.nil?
-  get_worker(requestURI, headers)
-end
-
-def get_worker(requestURI, headers)
-  uri = URI.parse(requestURI)
-  request = Net::HTTP::Get.new(uri.request_uri)
-  request.initialize_http_header(headers)
-  print_http_request(uri, request)
-  response_print_body(uri, request)
-end
-
-def HEAD(dataset, graph)
-  print "HEAD #{dataset} #{graph}\n" if $verbose
-  requestURI = target(dataset, graph)
-  headers = {}
-  headers.merge!($headers)
-  headers[$hAccept] = $accept_rdf
-  headers[$hAcceptCharset] = $accept_charset unless $accept_charset.nil?
-  uri = URI.parse(requestURI)
-  request = Net::HTTP::Head.new(uri.request_uri)
-  request.initialize_http_header(headers)
-  print_http_request(uri, request)
-  response_no_body(uri, request)
-end
-
-def PUT(dataset, graph, file)
-  print "PUT #{dataset} #{graph} #{file}\n" if $verbose
-  send_body(dataset, graph, file, Net::HTTP::Put)
-end
-
-def POST(dataset, graph, file)
-  print "POST #{dataset} #{graph} #{file}\n" if $verbose
-  send_body(dataset, graph, file, Net::HTTP::Post)
-end
-
-def DELETE(dataset, graph)
-  print "DELETE #{dataset} #{graph}\n" if $verbose
-  requestURI = target(dataset, graph)
-  uri = URI.parse(requestURI)
-  request = Net::HTTP::Delete.new(uri.request_uri)
-  headers = {}
-  headers.merge!($headers)
-  request.initialize_http_header(headers)
-  print_http_request(uri, request)
-  response_no_body(uri, request)
-end
-
-def uri_escape(string)
-  CGI.escape(string)
-end
-
-def target(dataset, graph)
-  return dataset+"?default" if graph == "default"
-  return dataset+"?graph="+uri_escape(graph)
-end
-
-def send_body(dataset, graph, file, method)
-  mt = content_type(file)
-  headers = {}
-  headers.merge!($headers)
-  headers[$hContentType] = mt
-  headers[$hContentLength] = File.size(file).to_s
-  ## p headers
-
-  requestURI = target(dataset, graph)
-  uri = URI.parse(requestURI)
-  
-  request = method.new(uri.request_uri)
-  request.initialize_http_header(headers)
-  print_http_request(uri, request)
-  request.body_stream = File.open(file)
-  response_no_body(uri, request)
-end
-
-def response_no_body(uri, request)
-  http = Net::HTTP::Proxy($proxy.host,$proxy.port).new(uri.host, uri.port)
-  http.read_timeout = nil
-  # check we can connect.
-  begin http.start
-  rescue Exception => e  
-    # puts e.message  
-    #puts e.backtrace.inspect  
-    warn_exit "Failed to connect: #{uri.host}:#{uri.port}: #{e.message}", 3
-  end
-  response = http.request(request)
-  print_http_response(response)
-  case response
-  when Net::HTTPSuccess, Net::HTTPRedirection
-    # OK
-  when Net::HTTPNotFound
-    warn_exit "404 Not found: #{uri}", 9
-    #print response.body
-  else
-    warn_exit "#{response.code} #{response.message} #{uri}", 9
-    # Unreachable
-      response.error!
-  end
-  # NO BODY IN RESPONSE
-end
-
-def response_print_body(uri, request)
-  http = Net::HTTP::Proxy($proxy.host,$proxy.port).new(uri.host, uri.port)
-  http.read_timeout = nil
-  # check we can connect.
-  begin http.start
-  rescue => e  
-    #puts e.backtrace.inspect  
-    #print e.class
-    warn_exit "Failed to connect: #{uri.host}:#{uri.port}: #{e.message}", 3
-  end
-
-  # Add a blank line if headers were output.
-  print "\n" if $http_print ;
-
-  begin
-    response = http.request(request) { |res| 
-      print_http_response(res)
-      #puts res.code
-      res.read_body do |segment|
-        print segment
-      end
-    }
-    case response
-    when Net::HTTPSuccess, Net::HTTPRedirection
-      # OK
-    when Net::HTTPNotFound
-      warn_exit "404 Not found: #{uri}", 9
-      #print response.body
-    else
-      warn_exit "#{response.code}: #{uri}", 9
-      # Unreachable
-      response.error!
-    end
-  rescue EOFError => e
-    warn_exit "IO Error: "+e.message, 3
-  end
-end
-
-def print_http_request(uri, request)
-  return unless $print_http
-  #print "Request\n"
-  print request.method," ",uri, "\n"
-  print_headers("  ",request)
-end
-
-def print_http_response(response)
-  return unless $print_http
-  #print "Response\n"
-  print response.code, " ", response.message, "\n"
-  print_headers("  ",response)
-end
-
-def print_headers(marker, headers)
-  headers.each do |k,v| 
-    k = k.split('-').map{|w| w.capitalize}.join('-')+':'
-    printf "%s%-20s %s\n",marker,k,v
-  end
-end
-
-def content_type(file)
-  file =~ /\.([^.]*)$/
-  ext = $1
-  mt = $fileMediaTypes[ext]
-  cs = $charset[mt]
-  mt = mt+';charset='+cs if ! cs.nil?
-  return mt
-end
-
-def charset(content_type)
-  return $charset[content_type]
-end
-
-def warn_exit(msg, rc)
-    warn msg
-    exit rc ;
-end
-
-def parseURI(uri_string)
-  begin
-    return URI.parse(uri_string).to_s
-  rescue URI::InvalidURIError => err
-    warn_exit "Bad URI: <#{uri_string}>", 2
-  end
-end
-
-## ---- Command
-
-def cmd_soh(command=nil)
-  ## Command line
-  options = {}
-  optparse = OptionParser.new do |opts|
-    # Set a banner, displayed at the top
-    # of the help screen.
-    case $cmd
-    when "s-http", "sparql-http", "soh"
-      banner="$cmd [get|post|put|delete] datasetURI graph [file]"
-    when "s-get", "s-head", "s-delete"
-      banner="$cmd  datasetURI graph"
-    end
-
-    opts.banner = $banner
-    # Define the options, and what they do
-    
-    options[:verbose] = false
-    opts.on( '-v', '--verbose', 'Verbose' ) do
-      options[:verbose] = true
-    end
-    
-    options[:version] = false
-    opts.on( '--version', 'Print version and exit' ) do
-      print "#{SOH_NAME} #{SOH_VERSION}\n"
-      exit
-    end
-    
-    # This displays the help screen, all programs are
-    # assumed to have this option.
-    opts.on( '-h', '--help', 'Display this screen and exit' ) do
-      puts opts
-      exit
-    end
-  end
-
-  begin optparse.parse!    
-  rescue OptionParser::InvalidArgument => e
-    warn e
-    exit
-  end
-
-  $verbose = options[:verbose]
-  $print_http = $verbose
-
-  if command.nil?
-    if ARGV.size == 0
-      warn "No command given: expected one of 'get', 'put', 'post', 'delete', 'query' or 'update'"
-      exit 1
-    end
-    cmdPrint=ARGV.shift
-    command=cmdPrint.upcase
-  else
-    cmdPrint=command
-  end
-
-  case command
-  when "HEAD", "GET", "DELETE"
-    requiredFile=false
-  when "PUT", "POST"
-    requiredFile=true
-  when "QUERY"
-    cmd_sparql_query
-  when "UPDATE"
-    cmd_sparql_update
-  else
-    warn_exit "Unknown command: #{command}", 2
-  end
-
-  if requiredFile 
-  then
-    if ARGV.size != 3
-      warn_exit "Required: dataset URI, graph URI (or 'default') and file", 1 
-    end
-  else
-    if ARGV.size != 2
-      warn_exit "Required: dataset URI and graph URI (or 'default')", 1 
-    end
-  end
-
-  dataset=parseURI(ARGV.shift)
-  # Relative URI?
-  graph=parseURI(ARGV.shift)
-  file=""
-  if requiredFile
-  then
-    file = ARGV.shift if requiredFile
-    if ! File.exist?(file)
-      warn_exit "No such file: "+file, 3
-    end
-    if File.directory?(file)
-      warn_exit "File is a directory: "+file, 3
-    end
-  end
-
-  case command
-  when "GET"
-    GET(dataset, graph)
-  when "HEAD"
-    HEAD(dataset, graph)
-  when "PUT"
-    PUT(dataset, graph, file)
-  when "DELETE"
-    DELETE(dataset, graph)
-  when "POST"
-    POST(dataset, graph, file)
-  else
-    warn_exit "Internal error: Unknown command: #{cmd}", 2
-  end
-  exit 0
-end
-
-## --------
-def string_or_file(arg)
-  return arg if ! arg.match(/^@/)
-  a=(arg[1..-1])
-  open(a, 'rb'){|f| f.read}
-end
-
-## -------- SPARQL Query
-
-## Choose method
-def SPARQL_query(service, query, query_file, forcePOST=false, args2={})
-   if ! query_file.nil?
-    query = open(query_file, 'rb'){|f| f.read}
-  end
-  if forcePOST || query.length >= 2*1024 
-    SPARQL_query_POST(service, query, args2)
-  else
-    SPARQL_query_GET(service, query, args2)
-  end
-end
-
-## By GET
-
-def SPARQL_query_GET(service, query, args2)
-  args = { "query" => query }
-  args.merge!(args2)
-  qs=args.collect { |k,v| "#{k}=#{uri_escape(v)}" }.join('&')
-  action="#{service}?#{qs}"
-  headers={}
-  headers.merge!($headers)
-  headers[$hAccept]=$accept_results
-  get_worker(action, headers)
-end
-
-## By POST
-
-def SPARQL_query_POST(service, query, args2)
-  # DRY - body/no body for each of request and response.
-  post_params={ "query" => query }
-  post_params.merge!(args2)
-  uri = URI.parse(service)
-  headers={}
-  headers.merge!($headers)
-  headers[$hAccept]=$accept_results
-  execute_post_form_body(uri, headers, post_params)
-end
-
-def execute_post_form_body(uri, headers, post_params)
-  request = Net::HTTP::Post.new(uri.request_uri)
-  qs=post_params.collect { |k,v| "#{k}=#{uri_escape(v)}" }.join('&')
-  headers[$hContentType] = $mtWWWForm
-  headers[$hContentLength] = qs.length.to_s
-  request.initialize_http_header(headers)
-  request.body = qs
-  print_http_request(uri, request)
-  response_print_body(uri, request)
-end
-
-# Usage: -v --help --file= --query=
-def cmd_sparql_query
-  options={}
-  optparse = OptionParser.new do |opts|
-    opts.banner = "Usage: #{$cmd} [--query QUERY] [--service URI] [--post] 'query' | @file"
-    opts.on('--service=URI', '--server=URI', 'SPARQL endpoint') do |uri|
-      options[:service]=uri
-    end
-    opts.on('--query=FILE','--file=FILE', 'Take query from a file') do |file|
-      options[:file]=file
-    end
-    opts.on('--output=TYPE', [:json,:xml,:text,:csv,:tsv],
-            'Set the output argument') do |type|
-      options[:output]=type
-    end
-    opts.on('--accept=TYPE', [:json,:xml,:text,:csv,:tsv], 
-            'Set the accept header type') do |type|
-      options[:accept]=type
-    end
-    options[:verbose] = false
-    opts.on( '--post', 'Force use of POST' ) do
-      options[:post] = true
-    end
-    opts.on( '-v', '--verbose', 'Verbose' ) do
-      options[:verbose] = true
-    end
-    opts.on( '--version', 'Print version and exit' ) do
-      print "#{SOH_NAME} #{SOH_VERSION}\n"
-      exit
-    end 
-    opts.on( '-h', '--help', 'Display this screen and exit' ) do
-      puts opts
-      exit
-    end
-  end
-
-  begin optparse.parse!    
-  rescue OptionParser::InvalidArgument, OptionParser::InvalidOption => e
-    warn e
-    exit 1
-  end
-
-  $verbose = options[:verbose]
-  $print_http = $verbose
-  usePOST = options[:post]
-
-  service = options[:service]
-  warn_exit 'No service specified.  Required --service=URI',1 if service.nil?
-
-  # Query
-  query=nil
-  query_file=options[:file]
-  if query_file.nil? && ARGV.size == 0
-  then
-    warn_exit 'No query specified.',1
-    end
-  if query_file.nil?
-    query = ARGV.shift
-    if query.match(/^@/)
-      query_file = query[1..-1]
-      query = nil
-    end
-  end
-
-  # --output ==> output= (non-standard)
-  args={}
-  case options[:output]
-  when nil
-  when  "json","xml","text","csv","tsv"
-    args['output'] = options[:output]
-  when :json,:xml,:text,:csv,:tsv
-    args['output'] = options[:output].to_s
-  else
-    warn_exit "Unrecognized output type: "+options[:output],2
-  end
-
-  # --accept
-  # options[:accept]
-
-  print "SPARQL #{service}\n" if $verbose
-  #args={"output"=>"text"}
-  SPARQL_query(service, query, query_file, usePOST, args)
-  exit(0)
-end
-
-## -------- SPARQL Update
-
-# Update sent as a WWW form.
-def SPARQL_update_by_form(service, update, args2={})
-  args = {}
-  args.merge!(args2)
-  headers={}
-  headers.merge!($headers)
-  # args? encode?
-  body="update="+uri_escape(update)
-  headers[$hContentType] = $mtWWWForm
-  headers[$hContentLength] = body.length.to_s
-  uri = URI.parse(service)
-  execute_post_form(uri, headers, body)
-end
-
-# DRY - query form.
-def execute_post_form(uri, headers, body)
-  request = Net::HTTP::Post.new(uri.request_uri)
-  request.initialize_http_header(headers)
-  request.body = body
-  print_http_request(uri, request)
-  response_no_body(uri, request)
-end
-
-def SPARQL_update(service, update, args2={})
-  args = {}
-  args.merge!(args2)
-  headers={}
-  headers.merge!($headers)
-  headers[$hContentType] = $mtSparqlUpdate
-  uri = URI.parse(service)
-  request = Net::HTTP::Post.new(uri.request_uri)
-  request.initialize_http_header(headers)
-  request.body = update
-  print_http_request(uri, request)
-  response_no_body(uri, request)
-end
-
-def cmd_sparql_update(by_raw_post=true)
-  # Share with cmd_sparql_query
-  options={}
-  optparse = OptionParser.new do |opts|
-    opts.banner = "Usage: #{$cmd} [--file REQUEST] [--service URI] 'request' | @file"
-    opts.on('--service=URI', '--server=URI', 'SPARQL endpoint') do |uri|
-      options[:service]=uri
-    end
-    opts.on('--update=FILE', '--file=FILE', 'Take update from a file') do |file|
-      options[:file]=file
-    end
-    options[:verbose] = false
-    opts.on( '-v', '--verbose', 'Verbose' ) do
-      options[:verbose] = true
-    end
-    opts.on( '--version', 'Print version and exit' ) do
-      print "#{SOH_NAME} #{SOH_VERSION}\n"
-      exit
-    end 
-    opts.on( '-h', '--help', 'Display this screen and exit' ) do
-      puts opts
-      exit
-    end
-  end
-
-  begin optparse.parse!    
-  rescue OptionParser::InvalidArgument => e
-    warn e
-    exit
-  end
-
-  $verbose = options[:verbose]
-  $print_http = $verbose
-
-  service = options[:service]
-  warn_exit 'No service specified. Required --service=URI',1   if service.nil?
-  
-  update=nil
-  update_file=options[:file]
-
-  if update_file.nil? && ARGV.size == 0
-  then
-    warn_exit 'No update specified.',1
-    end
-  if update_file.nil?
-    update = ARGV.shift
-    if update.match(/^@/)
-      update_file = update[1..-1]
-      update = nil
-    end
-  end
-  
-  print "SPARQL-Update #{service}\n" if $verbose
-  args={}
-
-  # Reads in the file :-(
-  if update.nil?
-  then
-    update = open(update_file, 'rb'){|f| f.read}
-  else
-    update = string_or_file(update)
-  end
-
-  if by_raw_post
-    SPARQL_update(service, update, args)
-  else
-    SPARQL_update_by_form(service, update, args)
-  end
-  exit(0)
-end
-
-## -------
-
-case $cmd
-when "s-http", "sparql-http", "soh"
-  $banner="#{$cmd} [get|post|put|delete] datasetURI graph [file]"
-  cmd_soh
-when "s-get", "s-head", "s-put", "s-delete", "s-post"
-
-  case $cmd
-  when "s-get", "s-head", "s-delete"
-    $banner="#{$cmd} datasetURI graph"
-  when "s-put", "s-post"
-    $banner="#{$cmd} datasetURI graph file"
-  end
-  cmd2 = $cmd.sub(/^s-/, '').upcase
-  cmd_soh cmd2
-
-when "s-query", "sparql-query"
-  cmd_sparql_query
-when "s-update", "sparql-update"
-  cmd_sparql_update true
-when "s-update-form", "sparql-update-form"
-  cmd_sparql_update false
-else 
-  warn_exit "Unknown: "+$cmd, 1
-end

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src-dev/dev/RunFuseki.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src-dev/dev/RunFuseki.java b/jena-fuseki/src-dev/dev/RunFuseki.java
deleted file mode 100644
index 74f678c..0000000
--- a/jena-fuseki/src-dev/dev/RunFuseki.java
+++ /dev/null
@@ -1,90 +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 dev;
-
-import org.apache.jena.fuseki.FusekiCmd ;
-
-public class RunFuseki
-{
-    public static void main(String[] args)
-    {
-        //demo() ;
-        //FusekiCmd.main("--config=config.ttl") ; System.exit(0) ;
-        main1() ;
-    }
-    
-    public static void demo()
-    {
-        String DIR="DemoServer" ;
-        FusekiCmd.main("--config="+name(DIR,"config.ttl"), "--pages="+name(DIR, "demo-pages")) ;
-        System.exit(0) ;
-    }
-    
-    public static String name(String DIR, String filename)
-    {
-        StringBuilder sb = new StringBuilder() ;
-        if ( ! filename.startsWith("/") )
-        {
-            sb.append(DIR) ;
-            if ( ! DIR.endsWith("/") )
-                sb.append("/") ;
-        }
-        sb.append(filename) ;
-        return sb.toString() ;
-    }
-    
-    private static void main1()
-    {
-        String tmpdir = System.getenv("TMPDIR") ;
-        if ( tmpdir == null )
-            tmpdir = System.getenv("TMP") ;
-        if ( tmpdir == null )
-            tmpdir = System.getenv("HOME")+"/tmp" ;
-        if ( ! tmpdir.endsWith("/") )
-            tmpdir = tmpdir+"/" ;
-        
-        FusekiCmd.main(
-                     //  "-v",
-                     "--mem", "--update", "/ds"
-                     //"--update", "--loc="+tmpdir+"DB", "--set=tdb:unionDefaultGraph=true", "/ds"
-                     //"--update", "--mem", "/ds"
-
-                     //"--update", "--memtdb", "--set=tdb:unionDefaultGraph=true", "/ds"
-                     
-                    //"--debug",
-                    //"--update",
-                    //"--timeout=1000,5000",
-                    //"--set=arq:queryTimeout=1000",
-                    //"--port=3030",
-                    //"--mgtPort=3031",
-                    //"--mem",
-                    //"--home=/home/afs/Projects/Fuseki",
-                    //"--loc=DB",
-                    //"--file=D.nt",
-                    //"--gzip=no",
-                    //"--desc=desc.ttl",
-                    //--pages=
-                    //"--jetty-config=jetty-fuseki.xml",
-                    //"--config=config-tdb.ttl"
-                    // "/ds"
-                    ) ;
-        System.exit(0) ;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/main/java/org/apache/jena/fuseki/DEF.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/main/java/org/apache/jena/fuseki/DEF.java b/jena-fuseki/src/main/java/org/apache/jena/fuseki/DEF.java
deleted file mode 100644
index c24f7e3..0000000
--- a/jena-fuseki/src/main/java/org/apache/jena/fuseki/DEF.java
+++ /dev/null
@@ -1,66 +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.fuseki;
-
-import static org.apache.jena.riot.WebContent.* ;
-import org.apache.jena.atlas.web.AcceptList ;
-import org.apache.jena.atlas.web.MediaType ;
-
-public class DEF
-{
-    public static final MediaType acceptRDFXML        = MediaType.create(contentTypeRDFXML) ;
-    public static final MediaType acceptNQuads        = MediaType.create(contentTypeNQuads) ;
-    public static final MediaType acceptRSXML         = MediaType.create(contentTypeResultsXML) ;
-
-    public static final AcceptList rdfOffer           = AcceptList.create(contentTypeTurtle, 
-                                                                          contentTypeTurtleAlt1,
-                                                                          contentTypeTurtleAlt2,
-                                                                          contentTypeNTriples,
-                                                                          contentTypeNTriplesAlt,
-                                                                          contentTypeRDFXML,
-                                                                          contentTypeJSONLD,
-                                                                          contentTypeRDFJSON,
-                                                                          contentTypeRDFThrift
-                                                                          ) ;
-    
-    public static final AcceptList quadsOffer         = AcceptList.create(contentTypeTriG,
-                                                                          contentTypeTriGAlt1,
-                                                                          contentTypeTriGAlt2,
-                                                                          contentTypeJSONLD,
-                                                                          contentTypeNQuads,
-                                                                          contentTypeNQuadsAlt1,
-                                                                          contentTypeNQuadsAlt2 
-                                                                          ) ;
-    
-    public static final AcceptList rsOfferTable            = AcceptList.create(contentTypeResultsJSON,
-                                                                          contentTypeTextCSV,
-                                                                          contentTypeTextTSV,
-                                                                          contentTypeResultsXML,
-                                                                          contentTypeResultsThrift,
-                                                                          contentTypeTextPlain
-                                                                          ) ;
-    
-    public static final AcceptList rsOfferBoolean            = AcceptList.create(contentTypeResultsJSON,
-                                                                          contentTypeTextCSV,
-                                                                          contentTypeTextTSV,
-                                                                          contentTypeResultsXML,
-                                                                          contentTypeTextPlain
-                                                                          ) ;
-
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/main/java/org/apache/jena/fuseki/EmbeddedFusekiServer.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/main/java/org/apache/jena/fuseki/EmbeddedFusekiServer.java b/jena-fuseki/src/main/java/org/apache/jena/fuseki/EmbeddedFusekiServer.java
deleted file mode 100644
index 0261b67..0000000
--- a/jena-fuseki/src/main/java/org/apache/jena/fuseki/EmbeddedFusekiServer.java
+++ /dev/null
@@ -1,86 +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.fuseki;
-
-import org.apache.jena.atlas.lib.FileOps ;
-import org.apache.jena.fuseki.server.FusekiConfig ;
-import org.apache.jena.fuseki.server.SPARQLServer ;
-import org.apache.jena.fuseki.server.ServerConfig ;
-
-import com.hp.hpl.jena.sparql.core.DatasetGraph ;
-import com.hp.hpl.jena.sparql.core.DatasetGraphFactory ;
-import com.hp.hpl.jena.tdb.TDBFactory ;
-
-/** Embedded (same JVM) server.
- * <p>Example for one server per test suite: 
- * <pre>
-    private static EmbeddedFusekiServer server = null ;
-    \@BeforeClass public static void beforeClass() { 
-        server = EmbeddedFusekiServer.createMemByPath(3030, "/test") ;
-        server.start() ;
-    \@AfterClass  public static void afterClass()  { 
-        server.stop() ;
-    }
-    </pre>
- */
-public class EmbeddedFusekiServer
-{
-    
-    public static EmbeddedFusekiServer mem(int port, String datasetPath) {
-        DatasetGraph dsg = DatasetGraphFactory.createMem() ;
-        return EmbeddedFusekiServer.create(port, dsg, datasetPath) ;
-    }
-    
-    public static EmbeddedFusekiServer memTDB(int port, String datasetPath) {
-        DatasetGraph dsg = TDBFactory.createDatasetGraph() ;
-        return EmbeddedFusekiServer.create(port, dsg, datasetPath) ;
-    }
-
-    public static EmbeddedFusekiServer create(int port, DatasetGraph dsg, String datasetPath) {
-        ServerConfig conf = FusekiConfig.defaultConfiguration(datasetPath, dsg, true, true) ;
-        conf.port = port ;
-        conf.pagesPort = port ;
-        if ( ! FileOps.exists(conf.pages) )
-            conf.pages = null ;
-        return new EmbeddedFusekiServer(conf) ;
-    }
-        
-    public static EmbeddedFusekiServer configure(int port, String fileConfig) {
-        ServerConfig conf = FusekiConfig.configure(fileConfig) ;
-        conf.port = port ;
-        conf.pagesPort = port ;
-        if ( ! FileOps.exists(conf.pages) )
-            conf.pages = null ;
-        return new EmbeddedFusekiServer(conf) ;
-    }
-    
-    private SPARQLServer server = null ;
-    
-    public EmbeddedFusekiServer(ServerConfig conf) {
-        server = new SPARQLServer(conf) ;
-    }
-    
-    public void start() {
-        server.start() ;
-    }
-    
-    public void stop() {
-        server.stop() ;
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/main/java/org/apache/jena/fuseki/Fuseki.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/main/java/org/apache/jena/fuseki/Fuseki.java b/jena-fuseki/src/main/java/org/apache/jena/fuseki/Fuseki.java
deleted file mode 100644
index c62ba1f..0000000
--- a/jena-fuseki/src/main/java/org/apache/jena/fuseki/Fuseki.java
+++ /dev/null
@@ -1,174 +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.fuseki;
-
-import org.apache.jena.fuseki.server.SPARQLServer ;
-import org.apache.jena.riot.RIOT ;
-import org.apache.jena.riot.system.stream.LocatorFTP ;
-import org.apache.jena.riot.system.stream.LocatorHTTP ;
-import org.apache.jena.riot.system.stream.StreamManager ;
-import org.slf4j.Logger ;
-import org.slf4j.LoggerFactory ;
-
-import com.hp.hpl.jena.query.ARQ ;
-import com.hp.hpl.jena.sparql.SystemARQ ;
-import com.hp.hpl.jena.sparql.lib.Metadata ;
-import com.hp.hpl.jena.sparql.mgt.SystemInfo ;
-import com.hp.hpl.jena.sparql.util.Context ;
-import com.hp.hpl.jena.sparql.util.MappingRegistry ;
-import com.hp.hpl.jena.tdb.TDB ;
-import com.hp.hpl.jena.tdb.transaction.TransactionManager ;
-
-/**
- * <p>The main class enabling us to:</p> 
- * <ol>
- * <li>create instances of a Fuseki server e.g.
- * the ARQ, RIOT and TDB server stack</li>
- * <li>get server global {@link com.hp.hpl.jena.sparql.util.Context} e.g. 
- * named values used to pass implementation-specific parameters across 
- * general interfaces.</li>
- * <li>get the {@link org.apache.jena.fuseki.server.SPARQLServer} instance.</li>
- * <li>set the {@link org.apache.jena.fuseki.server.SPARQLServer} instance.</li>
- *
- */
-public class Fuseki
-{
-    /** Path to ???*/
-    static public String PATH = "org.apache.jena.fuseki" ;
-    
-    /** a unique IRI for the Fuseki namespace*/
-    static public String FusekiIRI = "http://jena.apache.org/Fuseki" ;
-    
-    /** Fuseki home environment, usually set to $FUSEKI_HOME */
-    static public String FusekiHomeEnv = "FUSEKI_HOME" ;
-    
-    /** a unique IRI including the symbol notation for which properties should be appended */
-    static public String FusekiSymbolIRI = "http://jena.apache.org/fuseki#" ;
-    
-    /** ??? */
-    static public String PagesStatic = "pages" ;
-    
-    /** 
-     * TEMPORARY - this enables POST of triples to the dataset URI causing a graph to be created.
-     * POSTing to /dataset?graph=uri is preferred 
-     */
-    static public boolean graphStoreProtocolPostCreate = false ;
-    
-    /** an relative path to the location of <code>fuseki-properties.xml</code> file */
-    static private String metadataLocation = "org/apache/jena/fuseki/fuseki-properties.xml" ;
-    
-    /** Object which holds metadata specified within {@link Fuseki#metadataLocation} */
-    static private Metadata metadata = initMetadata() ;
-    
-    private static Metadata initMetadata()
-    {
-        Metadata m = new Metadata() ;
-        //m.addMetadata(metadataDevLocation) ;
-        m.addMetadata(metadataLocation) ;
-        return m ;
-    }
-    
-    /** The name of the Fuseki server. Set to the string <code>Fuseki</code> by default.*/
-    static public final String NAME             = "Fuseki" ;
-    
-    /** Version of this Fuseki instance */
-    static public final String VERSION          = metadata.get(PATH+".version", "development");
-    
-    /** Date when Fuseki was built */
-    static public final String BUILD_DATE       = metadata.get(PATH+".build.datetime", "unknown") ; // call Date if unavailable.
-    
-    /** An identifier for the HTTP Fuseki server instance*/
-    static public final String serverHttpName   = NAME+" ("+VERSION+")" ;    
-    
-    /** Actual log file for operations */
-    public static final String requestLogName   = PATH+".Fuseki" ;
-    
-    /** Instance of log for operations */
-    public static final Logger requestLog       = LoggerFactory.getLogger(requestLogName) ;
-    
-    /** Actual log file for general server messages.*/
-    public static final String serverLogName    = PATH+".Server" ;
-    
-    /** Instance of log for general server messages */
-    public static final Logger serverLog        = LoggerFactory.getLogger(serverLogName) ;
-    
-    /** Actual log file for config server messages. */
-    public static final String configLogName    = PATH+".Config" ;
-    
-    /** Instance of log for config server message s*/
-    public static final Logger configLog        = LoggerFactory.getLogger(configLogName) ;
-    
-    /** Instance of log for config server message s*/
-    public static boolean verboseLogging        = false ;
-    
-    /** An instance of management for stream opening, including redirecting through a 
-     * location mapper whereby a name (e.g. URL) is redirected to another name (e.g. local file).
-     * */
-    public static final StreamManager webStreamManager ;
-    static {
-        webStreamManager = new StreamManager() ;
-        // Only know how to handle http and ftp URLs - nothing local.
-        webStreamManager.addLocator(new LocatorHTTP()) ;
-        webStreamManager.addLocator(new LocatorFTP()) ;
-    }
-    
-    private static boolean initialized = false ;
-    
-    /**
-     * Initialize an instance of the Fuseki server stack.
-     */
-    public synchronized static void init()
-    {
-        if ( initialized )
-            return ;
-        initialized = true ;
-        ARQ.init() ;
-        SystemInfo sysInfo = new SystemInfo(FusekiIRI, PATH, VERSION, BUILD_DATE) ;
-        SystemARQ.registerSubSystem(sysInfo) ;
-        RIOT.init() ;
-        TDB.init() ;
-        MappingRegistry.addPrefixMapping("fuseki", FusekiSymbolIRI) ;
-        
-        TDB.setOptimizerWarningFlag(false) ;
-        // Don't set TDB batch commits.
-        // This can be slower, but it less memory hungry and more predictable. 
-        TransactionManager.QueueBatchSize = 0 ;
-    }
-  
-    /**
-     * Get server global {@link com.hp.hpl.jena.sparql.util.Context}.
-     * @return {@link com.hp.hpl.jena.query.ARQ#getContext()}
-     */
-    public static Context getContext()
-    {
-        return ARQ.getContext() ;
-    }
-    
-    // Temporary ...
-    private static SPARQLServer server ;
-    
-    /** set/specify the {@link org.apache.jena.fuseki.server.SPARQLServer} instance.*/
-    public static void setServer(SPARQLServer _server)      { server = _server ; }
-    
-    /** get the {@link org.apache.jena.fuseki.server.SPARQLServer} instance. */
-    public static SPARQLServer getServer()                  { return server ; }
-
-    // Force a call to init.
-    static { init() ; }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/main/java/org/apache/jena/fuseki/FusekiCmd.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/main/java/org/apache/jena/fuseki/FusekiCmd.java b/jena-fuseki/src/main/java/org/apache/jena/fuseki/FusekiCmd.java
deleted file mode 100644
index 77bafe8..0000000
--- a/jena-fuseki/src/main/java/org/apache/jena/fuseki/FusekiCmd.java
+++ /dev/null
@@ -1,508 +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.fuseki;
-
-import static org.apache.jena.fuseki.Fuseki.serverLog ;
-
-import java.io.File ;
-import java.io.InputStream ;
-import java.util.List ;
-
-import org.apache.jena.atlas.io.IO ;
-import org.apache.jena.atlas.lib.FileOps ;
-import org.apache.jena.atlas.lib.Lib ;
-import org.apache.jena.atlas.lib.StrUtils ;
-import org.apache.jena.atlas.logging.LogCtl ;
-import org.apache.jena.fuseki.mgt.ManagementServer ;
-import org.apache.jena.fuseki.server.FusekiConfig ;
-import org.apache.jena.fuseki.server.SPARQLServer ;
-import org.apache.jena.fuseki.server.ServerConfig ;
-import org.apache.jena.riot.Lang ;
-import org.apache.jena.riot.RDFDataMgr ;
-import org.apache.jena.riot.RDFLanguages ;
-import org.apache.jena.riot.SysRIOT ;
-import org.eclipse.jetty.server.Server ;
-import org.slf4j.Logger ;
-import arq.cmd.CmdException ;
-import arq.cmdline.ArgDecl ;
-import arq.cmdline.CmdARQ ;
-import arq.cmdline.ModDatasetAssembler ;
-
-import com.hp.hpl.jena.query.ARQ ;
-import com.hp.hpl.jena.query.Dataset ;
-import com.hp.hpl.jena.sparql.core.DatasetGraph ;
-import com.hp.hpl.jena.sparql.core.DatasetGraphFactory ;
-import com.hp.hpl.jena.tdb.TDB ;
-import com.hp.hpl.jena.tdb.TDBFactory ;
-import com.hp.hpl.jena.tdb.sys.Names ;
-import com.hp.hpl.jena.tdb.transaction.TransactionManager ;
-
-public class FusekiCmd extends CmdARQ
-{
-    private static String log4Jsetup = StrUtils.strjoinNL(
-          "## Plain output to stdout"
-          , "log4j.appender.jena.plain=org.apache.log4j.ConsoleAppender"
-          , "log4j.appender.jena.plain.target=System.out"
-          , "log4j.appender.jena.plain.layout=org.apache.log4j.PatternLayout"
-          , "log4j.appender.jena.plain.layout.ConversionPattern=%d{HH:mm:ss} %-5p %m%n"
-          
-          , "## Plain output with level, to stderr"
-          , "log4j.appender.jena.plainlevel=org.apache.log4j.ConsoleAppender"
-          , "log4j.appender.jena.plainlevel.target=System.err"
-          , "log4j.appender.jena.plainlevel.layout=org.apache.log4j.PatternLayout"
-          , "log4j.appender.jena.plainlevel.layout.ConversionPattern=%d{HH:mm:ss} %-5p %m%n"
-          
-          , "## Everything"
-          , "log4j.rootLogger=INFO, jena.plain"
-          , "log4j.logger.com.hp.hpl.jena=WARN"
-          , "log4j.logger.org.openjena=WARN"
-          , "log4j.logger.org.apache.jena=WARN"
-          
-          , "# Server log."
-          , "log4j.logger.org.apache.jena.fuseki.Server=INFO"
-          , "# Request log."
-          , "log4j.logger.org.apache.jena.fuseki.Fuseki=INFO"
-          , "log4j.logger.org.apache.jena.tdb.loader=INFO"
-          , "log4j.logger.org.eclipse.jetty=ERROR"
-          
-          , "## Parser output"
-          , "log4j.additivity."+SysRIOT.riotLoggerName+"=false"
-          , "log4j.logger."+SysRIOT.riotLoggerName+"=INFO, jena.plainlevel "
-        ) ;
-
-    
-    // Set logging.
-    // 1/ Use log4j.configuration is defined.
-    // 2/ Use file:log4j.properties 
-    // 3/ Use Built in.
-    
-    static void setLogging() {
-        // No loggers have been created but configuration may have been set up. 
-        String x = System.getProperty("log4j.configuration", null) ;
-        
-        if ( x != null && ! x.equals("set") ) {
-            // "set" indicates that CmdMain set logging.
-            // Use standard log4j initialization.
-            return ;
-        }
-        
-        String fn = "log4j.properties" ;
-        File f = new File(fn) ;
-        if ( f.exists() ) {
-            // Use file log4j.properties
-            System.setProperty("log4j.configuration", "file:"+fn) ;
-            return ;
-        }
-        // Use built-in for Fuseki.
-        LogCtl.resetLogging(log4Jsetup) ;     
-    }
-    
-    static { setLogging() ; }
-
-    // Arguments:
-    // --update
-    
-    // Specific switches:
-    
-    // --admin=on/off
-    
-    // --http-update
-    // --http-get
-    
-    // --sparql-query
-    // --sparql-update
-    
-    // pages/validators/
-    // pages/control/
-    // pages/query/ or /pages/sparql/
-    
-    private static ArgDecl argMgtPort       = new ArgDecl(ArgDecl.HasValue, "mgtPort", "mgtport") ;
-    private static ArgDecl argMem           = new ArgDecl(ArgDecl.NoValue,  "mem") ;
-    private static ArgDecl argAllowUpdate   = new ArgDecl(ArgDecl.NoValue,  "update", "allowUpdate") ;
-    private static ArgDecl argFile          = new ArgDecl(ArgDecl.HasValue, "file") ;
-    private static ArgDecl argMemTDB        = new ArgDecl(ArgDecl.NoValue,  "memtdb", "memTDB") ;
-    private static ArgDecl argTDB           = new ArgDecl(ArgDecl.HasValue, "loc", "location") ;
-    private static ArgDecl argPort          = new ArgDecl(ArgDecl.HasValue, "port") ;
-    private static ArgDecl argLocalhost     = new ArgDecl(ArgDecl.NoValue, "localhost", "local") ;
-    private static ArgDecl argTimeout       = new ArgDecl(ArgDecl.HasValue, "timeout") ;
-    private static ArgDecl argFusekiConfig  = new ArgDecl(ArgDecl.HasValue, "config", "conf") ;
-    private static ArgDecl argJettyConfig   = new ArgDecl(ArgDecl.HasValue, "jetty-config") ;
-    private static ArgDecl argGZip          = new ArgDecl(ArgDecl.HasValue, "gzip") ;
-    private static ArgDecl argUber          = new ArgDecl(ArgDecl.NoValue,  "uber", "über") ;   // Use the überservlet (experimental)
-    private static ArgDecl argBasicAuth     = new ArgDecl(ArgDecl.HasValue, "basic-auth") ;
-    
-    private static ArgDecl argGSP           = new ArgDecl(ArgDecl.NoValue,  "gsp") ;    // GSP compliance mode
-    
-    private static ArgDecl argHome          = new ArgDecl(ArgDecl.HasValue, "home") ;
-    private static ArgDecl argPages         = new ArgDecl(ArgDecl.HasValue, "pages") ;
-    
-    //private static ModLocation          modLocation =  new ModLocation() ;
-    private static ModDatasetAssembler  modDataset = new ModDatasetAssembler() ;
-    
-    // fuseki [--mem|--desc assembler.ttl] [--port PORT] **** /datasetURI
-
-    static public void main(String...argv)
-    {
-        // Just to make sure ...
-        ARQ.init() ;
-        TDB.init() ;
-        Fuseki.init() ;
-        new FusekiCmd(argv).mainRun() ;
-    }
-    
-    private int port                    = 3030 ;
-    private int mgtPort                 = -1 ;
-    private boolean listenLocal         = false ;
-
-    private DatasetGraph dsg            = null ; 
-    private String datasetPath          = null ;
-    private boolean allowUpdate         = false ;
-    
-    private String fusekiConfigFile     = null ;
-    private boolean enableCompression   = true ;
-    private String jettyConfigFile      = null ;
-    private String authConfigFile       = null ;
-    private String homeDir              = null ;
-    private String pagesDir             = null ;
-    
-    public FusekiCmd(String...argv)
-    {
-        super(argv) ;
-        
-        if ( false )
-            // Consider ...
-            TransactionManager.QueueBatchSize =  TransactionManager.QueueBatchSize / 2 ;
-        
-        getUsage().startCategory("Fuseki") ;
-        addModule(modDataset) ;
-        add(argMem,     "--mem",                "Create an in-memory, non-persistent dataset for the server") ;
-        add(argFile,    "--file=FILE",          "Create an in-memory, non-persistent dataset for the server, initialised with the contents of the file") ;
-        add(argTDB,     "--loc=DIR",            "Use an existing TDB database (or create if does not exist)") ;
-        add(argMemTDB,  "--memTDB",             "Create an in-memory, non-persistent dataset using TDB (testing only)") ;
-        add(argPort,    "--port",               "Listen on this port number") ;
-        add(argPages,   "--pages=DIR",          "Set of pages to serve as static content") ; 
-        // Set via jetty config file.
-        add(argLocalhost,   "--localhost",      "Listen only on the localhost interface") ;
-        add(argTimeout, "--timeout=",           "Global timeout applied to queries (value in ms) -- format is X[,Y] ") ;
-        add(argAllowUpdate, "--update",         "Allow updates (via SPARQL Update and SPARQL HTTP Update)") ;
-        add(argFusekiConfig, "--config=",       "Use a configuration file to determine the services") ;
-        add(argJettyConfig, "--jetty-config=FILE",  "Set up the server (not services) with a Jetty XML file") ;
-        add(argBasicAuth, "--basic-auth=FILE",  "Configure basic auth using provided Jetty realm file, ignored if --jetty-config is used") ;
-        add(argMgtPort, "--mgtPort=port",       "Enable the management commands on the given port") ; 
-        add(argHome, "--home=DIR",              "Root of Fuseki installation (overrides environment variable FUSEKI_HOME)") ; 
-        add(argGZip, "--gzip=on|off",           "Enable GZip compression (HTTP Accept-Encoding) if request header set") ;
-        
-        add(argUber) ;
-        //add(argGSP) ;
-        
-        super.modVersion.addClass(TDB.class) ;
-        super.modVersion.addClass(Fuseki.class) ;
-    }
-
-    static String argUsage = "[--config=FILE] [--mem|--desc=AssemblerFile|--file=FILE] [--port PORT] /DatasetPathName" ; 
-    
-    @Override
-    protected String getSummary()
-    {
-        return getCommandName()+" "+argUsage ;
-    }
-
-    @Override
-    protected void processModulesAndArgs()
-    {
-        int x = 0 ;
-        
-        Logger log = Fuseki.serverLog ;
-        
-        if ( contains(argFusekiConfig) )
-            fusekiConfigFile = getValue(argFusekiConfig) ;
-        
-        ArgDecl assemblerDescDecl = new ArgDecl(ArgDecl.HasValue, "desc", "dataset") ;
-        if ( contains(argMem) ) x++ ; 
-        if ( contains(argFile) ) x++ ;
-        if ( contains(assemblerDescDecl) ) x++ ;
-        if ( contains(argTDB) ) x++ ;
-        if ( contains(argMemTDB) ) x++ ;
-
-        if ( fusekiConfigFile != null )
-        {
-            if ( x >= 1 )
-                throw new CmdException("Dataset specified on the command line but a configuration file also given.") ;
-        }
-        else
-        {
-            if ( x != 1 )
-                throw new CmdException("Required: either --config=FILE or one of --mem, --file, --loc or --desc") ;
-        }
-        
-        // One of:
-        // argMem, argFile, argMemTDB, argTDB, 
-        
-        
-        if ( contains(argMem) )
-        {
-            log.info("Dataset: in-memory") ;
-            dsg = DatasetGraphFactory.createMem() ;
-        }
-        if ( contains(argFile) )
-        {
-            dsg = DatasetGraphFactory.createMem() ;
-            // replace by RiotLoader after ARQ refresh.
-            String filename = getValue(argFile) ;
-            log.info("Dataset: in-memory: load file: "+filename) ;
-            if ( ! FileOps.exists(filename) )
-                throw new CmdException("File not found: "+filename) ;
-
-            Lang language = RDFLanguages.filenameToLang(filename) ;
-            if ( language == null )
-                throw new CmdException("Can't guess language for file: "+filename) ;
-            InputStream input = IO.openFile(filename) ; 
-            
-            if ( RDFLanguages.isQuads(language) )
-                RDFDataMgr.read(dsg, filename) ;
-            else
-                RDFDataMgr.read(dsg.getDefaultGraph(), filename) ;
-        }
-        
-        if ( contains(argMemTDB) )
-        {
-            log.info("TDB dataset: in-memory") ;
-            dsg = TDBFactory.createDatasetGraph() ;
-        }
-        
-        if ( contains(argTDB) )
-        {
-            String dir = getValue(argTDB) ;
-            
-            if ( Lib.equal(dir, Names.memName) ) {
-                log.info("TDB dataset: in-memory") ;
-            } else {
-                if ( ! FileOps.exists(dir) )
-                    throw new CmdException("Directory not found: "+dir) ;
-                log.info("TDB dataset: directory="+dir) ;
-            }
-            dsg = TDBFactory.createDatasetGraph(dir) ;
-        }
-        
-        // Otherwise
-        if ( contains(assemblerDescDecl) )
-        {
-            log.info("Dataset from assembler") ;
-            Dataset ds = modDataset.createDataset() ;
-            if ( ds != null )
-                dsg = ds.asDatasetGraph() ;
-        }
-        
-        if ( contains(argFusekiConfig) )
-        {
-            if ( dsg != null )
-                throw new CmdException("(internal error) Dataset specificed on the command line but a a configuration file also given.") ;
-            fusekiConfigFile = getValue(argFusekiConfig) ;
-        }
-        
-        if ( contains(argPort) )
-        {
-            String portStr = getValue(argPort) ;
-            try {
-                port = Integer.parseInt(portStr) ;
-            } catch (NumberFormatException ex)
-            {
-                throw new CmdException(argPort.getKeyName()+" : bad port number: "+portStr) ;
-            }
-        }
-        
-        if ( contains(argMgtPort) )
-        {
-            String mgtPortStr = getValue(argMgtPort) ;
-            try {
-                mgtPort = Integer.parseInt(mgtPortStr) ;
-            } catch (NumberFormatException ex)
-            {
-                throw new CmdException(argMgtPort.getKeyName()+" : bad port number: "+mgtPortStr) ;
-            }
-        }
-
-        if ( contains(argLocalhost) )
-            listenLocal = true ;
-            
-        if ( fusekiConfigFile == null && dsg == null )
-            throw new CmdException("No dataset defined and no configuration file: "+argUsage) ;
-        
-        if ( dsg != null )
-        {
-            if ( getPositional().size() == 0 )
-                throw new CmdException("No dataset path name given") ;
-            if ( getPositional().size() > 1  )
-                throw new CmdException("Multiple dataset path names given") ;
-            datasetPath = getPositionalArg(0) ;
-            if ( datasetPath.length() > 0 && ! datasetPath.startsWith("/") )
-                throw new CmdException("Dataset path name must begin with a /: "+datasetPath) ;
-            
-            allowUpdate = contains(argAllowUpdate) ;
-        }
-        
-        if ( contains(argTimeout) )
-        {
-            String str = getValue(argTimeout) ;
-            ARQ.getContext().set(ARQ.queryTimeout, str) ;
-        }
-        
-        if ( contains(argJettyConfig) )
-        {
-            jettyConfigFile = getValue(argJettyConfig) ;
-            if ( !FileOps.exists(jettyConfigFile) )
-                throw new CmdException("No such file: "+jettyConfigFile) ;
-        }
-        
-        if ( contains(argBasicAuth) )
-        {
-            authConfigFile = getValue(argBasicAuth) ;
-            if ( !FileOps.exists(authConfigFile) )
-                throw new CmdException("No such file: " + authConfigFile) ;
-        }
-        
-        if ( contains(argHome) )
-        {
-           List<String> args = super.getValues(argHome) ;
-           homeDir = args.get(args.size()-1) ;
-        }
-        
-        if ( contains(argPages) )
-        {
-           List<String> args = super.getValues(argPages) ;
-           pagesDir = args.get(args.size()-1) ;
-        }
-
-        if ( contains(argGZip) )
-        {
-            if ( ! hasValueOfTrue(argGZip) && ! hasValueOfFalse(argGZip) )
-                throw new CmdException(argGZip.getNames().get(0)+": Not understood: "+getValue(argGZip)) ;
-            enableCompression = super.hasValueOfTrue(argGZip) ;
-        }
-        
-        if ( contains(argUber) )
-            SPARQLServer.überServlet = true ;
-        
-        if ( contains(argGSP) )
-        {
-            SPARQLServer.überServlet = true ;
-            Fuseki.graphStoreProtocolPostCreate = true ;
-        }
-
-    }
-
-    private static String sort_out_dir(String path)
-    {
-        path.replace('\\', '/') ;
-        if ( ! path.endsWith("/"))
-            path = path +"/" ;
-        return path ;
-    }
-    
-    @Override
-    protected void exec()
-    {
-        if ( homeDir == null )
-        {
-            if ( System.getenv(Fuseki.FusekiHomeEnv) != null )
-                 homeDir = System.getenv(Fuseki.FusekiHomeEnv) ;
-            else
-                 homeDir = "." ;
-        }
-        
-        homeDir = sort_out_dir(homeDir) ;
-        Fuseki.configLog.info("Home Directory: " + FileOps.fullDirectoryPath(homeDir));
-        if ( ! FileOps.exists(homeDir) )
-            Fuseki.configLog.warn("No such directory for Fuseki home: "+homeDir) ;
-        
-        String staticContentDir = pagesDir ;
-        if ( staticContentDir == null )
-            staticContentDir = homeDir+Fuseki.PagesStatic ;
-        
-        Fuseki.configLog.debug("Static Content Directory: "+ FileOps.fullDirectoryPath(staticContentDir)) ;
-
-        if ( ! FileOps.exists(staticContentDir) ) {
-            Fuseki.configLog.warn("No such directory for static content: " + FileOps.fullDirectoryPath(staticContentDir)) ;
-            Fuseki.configLog.warn("You may need to set the --pages or --home option to configure static content correctly");
-        }
-        
-        if ( jettyConfigFile != null )
-            Fuseki.configLog.info("Jetty configuration: "+jettyConfigFile) ;
-        
-        ServerConfig serverConfig ;
-        
-        if ( fusekiConfigFile != null )
-        {
-            Fuseki.configLog.info("Configuration file: "+fusekiConfigFile) ;
-            serverConfig = FusekiConfig.configure(fusekiConfigFile) ;
-        }
-        else 
-        {
-            serverConfig = FusekiConfig.defaultConfiguration(datasetPath, dsg, allowUpdate, listenLocal) ;
-            if ( ! allowUpdate )
-                Fuseki.serverLog.info("Running in read-only mode.");
-        }
-        
-        // TODO Get from parsing config file.
-        serverConfig.port = port ;
-        serverConfig.pages = staticContentDir ;
-        serverConfig.mgtPort = mgtPort ;
-        serverConfig.pagesPort = port ;
-        serverConfig.loopback = listenLocal ;
-        serverConfig.enableCompression = enableCompression ;
-        serverConfig.jettyConfigFile = jettyConfigFile ;
-        serverConfig.authConfigFile = authConfigFile ;
-        serverConfig.verboseLogging = ( super.isVerbose() || super.isDebug() ) ;
-        
-        SPARQLServer server = new SPARQLServer(serverConfig) ;
-        
-        // Temporary
-        Fuseki.setServer(server) ;
-        
-        Server mgtServer = null ;
-        
-        if ( mgtPort > 0 )
-        {
-            Fuseki.configLog.info("Management services on port "+mgtPort) ;
-            mgtServer = ManagementServer.createManagementServer(mgtPort) ;
-            try { mgtServer.start() ; }
-            catch (java.net.BindException ex)
-            { serverLog.error("SPARQLServer: Failed to start management server: " + ex.getMessage()) ; System.exit(1) ; }
-            catch (Exception ex)
-            { serverLog.error("SPARQLServer: Failed to start management server: " + ex.getMessage(), ex) ; System.exit(1) ; }
-        }
-
-        server.start() ;
-        try { server.getServer().join() ; } catch (Exception ex) {}
-
-        if ( mgtServer != null )
-        {
-            try { mgtServer.stop() ; } 
-            catch (Exception e) { serverLog.warn("Failed to cleanly stop the management server", e) ; }
-        }
-        System.exit(0) ;
-    }
-    
-
-    @Override
-    protected String getCommandName()
-    {
-        return "fuseki" ;
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/main/java/org/apache/jena/fuseki/FusekiConfigException.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/main/java/org/apache/jena/fuseki/FusekiConfigException.java b/jena-fuseki/src/main/java/org/apache/jena/fuseki/FusekiConfigException.java
deleted file mode 100644
index 5e1b018..0000000
--- a/jena-fuseki/src/main/java/org/apache/jena/fuseki/FusekiConfigException.java
+++ /dev/null
@@ -1,28 +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.fuseki;
-
-
-public class FusekiConfigException extends FusekiException
-{
-    public FusekiConfigException(String msg, Throwable cause)    { super(msg, cause) ; }
-    public FusekiConfigException(String msg)                     { super(msg) ; }
-    public FusekiConfigException(Throwable cause)                { super(cause) ; }
-    public FusekiConfigException()                               { super() ; }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/main/java/org/apache/jena/fuseki/FusekiException.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/main/java/org/apache/jena/fuseki/FusekiException.java b/jena-fuseki/src/main/java/org/apache/jena/fuseki/FusekiException.java
deleted file mode 100644
index 04953ce..0000000
--- a/jena-fuseki/src/main/java/org/apache/jena/fuseki/FusekiException.java
+++ /dev/null
@@ -1,29 +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.fuseki;
-
-import com.hp.hpl.jena.sparql.ARQException ;
-
-public class FusekiException extends ARQException
-{
-    public FusekiException(String msg, Throwable cause)    { super(msg, cause) ; }
-    public FusekiException(String msg)                     { super(msg) ; }
-    public FusekiException(Throwable cause)                { super(cause) ; }
-    public FusekiException()                               { super() ; }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/main/java/org/apache/jena/fuseki/FusekiLib.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/main/java/org/apache/jena/fuseki/FusekiLib.java b/jena-fuseki/src/main/java/org/apache/jena/fuseki/FusekiLib.java
deleted file mode 100644
index 5324793..0000000
--- a/jena-fuseki/src/main/java/org/apache/jena/fuseki/FusekiLib.java
+++ /dev/null
@@ -1,148 +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.fuseki;
-
-import java.util.Iterator ;
-
-import javax.servlet.http.HttpServletRequest ;
-
-import org.apache.commons.lang.StringUtils ;
-import org.apache.jena.atlas.lib.MultiMap ;
-import org.apache.jena.atlas.lib.MultiMapToList ;
-import org.apache.jena.atlas.web.ContentType ;
-import org.apache.jena.fuseki.servlets.HttpAction ;
-import org.apache.jena.riot.Lang ;
-import org.apache.jena.riot.RDFLanguages ;
-
-import com.hp.hpl.jena.graph.Graph ;
-import com.hp.hpl.jena.graph.Node ;
-import com.hp.hpl.jena.graph.Triple ;
-import com.hp.hpl.jena.shared.PrefixMapping ;
-import com.hp.hpl.jena.sparql.core.DatasetGraph ;
-import com.hp.hpl.jena.sparql.core.Quad ;
-import com.hp.hpl.jena.sparql.util.Convert ;
-
-public class FusekiLib {
-    /** Get the content type of an action or return the default.
-     * @param  action
-     * @return ContentType
-     */
-    public static ContentType getContentType(HttpAction action) {
-        return getContentType(action.request) ;
-    }
-    
-    /** Get the content type of an action or return the default.
-     * @param  request
-     * @return ContentType
-     */
-    public static ContentType getContentType(HttpServletRequest request) {
-        String contentTypeHeader = request.getContentType() ;
-        if ( contentTypeHeader == null ) 
-            return null ;
-        return ContentType.create(contentTypeHeader) ;
-    }
-    
-    /** Get the incoming Lang based on Content-Type of an action.
-     * @param  action
-     * @param  dft Default if no "Content-Type:" found. 
-     * @return ContentType
-     */
-    public static Lang getLangFromAction(HttpAction action, Lang dft) {
-        String contentTypeHeader = action.request.getContentType() ;
-        if ( contentTypeHeader == null )
-            return dft ;
-        return RDFLanguages.contentTypeToLang(contentTypeHeader) ;
-    }
-
-    static String fmtRequest(HttpServletRequest request) {
-        StringBuilder sbuff = new StringBuilder() ;
-        sbuff.append(request.getMethod()) ;
-        sbuff.append(" ") ;
-        sbuff.append(Convert.decWWWForm(request.getRequestURL())) ;
-
-        String qs = request.getQueryString() ;
-        if ( qs != null ) {
-            String tmp = request.getQueryString() ;
-            tmp = Convert.decWWWForm(tmp) ;
-            tmp = tmp.replace('\n', ' ') ;
-            tmp = tmp.replace('\r', ' ') ;
-            sbuff.append("?").append(tmp) ;
-        }
-        return sbuff.toString() ;
-    }
-
-    /** Parse the query string - do not process the body even for a form */
-    public static MultiMap<String, String> parseQueryString(HttpServletRequest req) {
-        MultiMap<String, String> map = MultiMapToList.create() ;
-
-        // Don't use ServletRequest.getParameter or getParamterNames
-        // as that reads form data. This code parses just the query string.
-        if ( req.getQueryString() != null ) {
-            String[] params = req.getQueryString().split("&") ;
-            for ( String p : params )
-            {
-                String[] x = p.split( "=", 2 );
-                String name = null;
-                String value = null;
-
-                if ( x.length == 0 )
-                { // No "="
-                    name = p;
-                    value = "";
-                }
-                else if ( x.length == 1 )
-                { // param=
-                    name = x[0];
-                    value = "";
-                }
-                else
-                { // param=value
-                    name = x[0];
-                    value = x[1];
-                }
-                map.put( name, value );
-            }
-        }
-        return map ;
-    }
-    
-    public static String safeParameter(HttpServletRequest request, String pName) {
-        String value = request.getParameter(pName) ;
-        value = StringUtils.replaceChars(value, "\r", "") ;
-        value = StringUtils.replaceChars(value, "\n", "") ;
-        return value ;
-    }
-
-    // Do the addition directly on the dataset
-    public static void addDataInto(Graph data, DatasetGraph dsg, Node graphName) {
-        // Prefixes?
-        if ( graphName == null )
-            graphName = Quad.defaultGraphNodeGenerated ;
-
-        Iterator<Triple> iter = data.find(Node.ANY, Node.ANY, Node.ANY) ;
-        for (; iter.hasNext();) {
-            Triple t = iter.next() ;
-            dsg.add(graphName, t.getSubject(), t.getPredicate(), t.getObject()) ;
-        }
-
-        PrefixMapping pmapSrc = data.getPrefixMapping() ;
-        PrefixMapping pmapDest = dsg.getDefaultGraph().getPrefixMapping() ;
-        pmapDest.setNsPrefixes(pmapSrc) ;
-    }
-}


[18/23] jena git commit: Rename folder jena-fuseki to jena-fuseki1

Posted by an...@apache.org.
http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/s-post
----------------------------------------------------------------------
diff --git a/jena-fuseki/s-post b/jena-fuseki/s-post
deleted file mode 100755
index 4f6590d..0000000
--- a/jena-fuseki/s-post
+++ /dev/null
@@ -1,713 +0,0 @@
-#!/usr/bin/env ruby
-# -*- coding: utf-8 -*-
-
-# 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.
-
-# SPARQL HTTP Update, client.
-
-require 'optparse'
-require 'net/http'
-require 'uri'
-require 'cgi'
-require 'pp'
-require 'ostruct'
-
-# ToDo
-#  Allow a choice of media type for GET
-#   --accept "content-type" (and abbreviations)
-#   --header "Add:this"
-#   --user, --password
-#  Basic authentication: request.basic_auth("username", "password")
-#  Follow redirects => 301:  puts response["location"] # All headers are lowercase?
-
-SOH_NAME="SOH"
-SOH_VERSION="0.0.0"
-
-$proxy = ENV['http_proxy'] ? URI.parse(ENV['http_proxy']) : OpenStruct.new  
-
-# What about direct naming?
-
-# Names
-$mtTurtle           = 'text/turtle;charset=utf-8'
-$mtRDF              = 'application/rdf+xml'
-$mtText             = 'text/plain'
-$mtNTriples         = 'application/n-triples'
-$mtNQuads           = 'application/n-quads'
-$mtJSONLD           = 'application/ld+json'
-$mtTriG             = 'application/trig'
-$mtSparqlResultsX   = 'application/sparql-results+xml'
-$mtSparqlResultsJ   = 'application/sparql-results+json'
-$mtAppJSON          = 'application/json'
-$mtAppXML           = 'application/xml'
-$mtSparqlResultsTSV = 'application/sparql-results+tsv'
-$mtSparqlResultsCSV = 'application/sparql-results+csv'
-$mtSparqlUpdate     = 'application/sparql-update'
-$mtWWWForm          = 'application/x-www-form-urlencoded'
-$mtSparqlQuery      = "application/sparql-query" ;
-
-# Global media type table.
-$fileMediaTypes = {}
-$fileMediaTypes['ttl']   = $mtTurtle
-$fileMediaTypes['n3']    = 'text/n3; charset=utf-8'
-$fileMediaTypes['nt']    = $mtText
-$fileMediaTypes['rdf']   = $mtRDF
-$fileMediaTypes['owl']   = $mtRDF
-$fileMediaTypes['nq']    = $mtNQuads
-$fileMediaTypes['trig']  = $mtTriG
-$fileMediaTypes['json-ld']  = $mtJSONLD
-$fileMediaTypes['jsonld']  = $mtJSONLD
-
-# Global charset : no entry means "don't set"
-$charsetUTF8      = 'utf-8'
-$charset = {}
-$charset[$mtTurtle]   = 'utf-8'
-$charset[$mtText]     = 'ascii'
-$charset[$mtTriG]     = 'utf-8'
-$charset[$mtNQuads]   = 'utf-8'
-
-# Headers
-
-$hContentType         = 'Content-Type'
-# $hContentEncoding     = 'Content-Encoding'
-$hContentLength       = 'Content-Length'
-# $hContentLocation     = 'Content-Location'
-# $hContentRange        = 'Content-Range'
-
-$hAccept              = 'Accept'
-$hAcceptCharset       = 'Accept-Charset'
-$hAcceptEncoding      = 'Accept-Encoding'
-$hAcceptRanges        = 'Accept-Ranges' 
-
-$headers = { "User-Agent" => "#{SOH_NAME}/Fuseki #{SOH_VERSION}"}
-$print_http = false
-
-# Default for GET
-# At least allow anything (and hope!)
-$accept_rdf="#{$mtTurtle} , #{$mtNTriples};q=0.9 , #{$mtRDF};q=0.8 , #{$mtJSONLD};q=0.5"
-# Datasets
-$accept_ds="#{$mtTrig} , #{$mtNQuads};q=0.9 , #{$mtJSONLD};q=0.5"
-# For SPARQL query
-$accept_results="#{$mtSparqlResultsJ} , #{$mtSparqlResultsX};q=0.9 , #{$accept_rdf}"
-
-# Accept any in case of trouble.
-$accept_rdf="#{$accept_rdf} , */*;q=0.1"
-$accept_results="#{$accept_results} , */*;q=0.1" 
-
-# The media type usually forces the charset.
-$accept_charset=nil
-
-## Who we are.
-## Two styles:
-##    s-query .....
-##    soh query .....
-
-$cmd = File.basename($0)
-if $cmd == 'soh'
-then
-  $cmd = (ARGV.size == 0) ? 'soh' : ARGV.shift
-end
-
-if ! $cmd.start_with?('s-') && $cmd != 'soh'
-  $cmd = 's-'+$cmd
-end
-
-## -------- 
-
-def GET(dataset, graph)
-  print "GET #{dataset} #{graph}\n" if $verbose
-  requestURI = target(dataset, graph)
-  headers = {}
-  headers.merge!($headers)
-  headers[$hAccept] = $accept_rdf
-  headers[$hAcceptCharset] = $accept_charset unless $accept_charset.nil?
-  get_worker(requestURI, headers)
-end
-
-def get_worker(requestURI, headers)
-  uri = URI.parse(requestURI)
-  request = Net::HTTP::Get.new(uri.request_uri)
-  request.initialize_http_header(headers)
-  print_http_request(uri, request)
-  response_print_body(uri, request)
-end
-
-def HEAD(dataset, graph)
-  print "HEAD #{dataset} #{graph}\n" if $verbose
-  requestURI = target(dataset, graph)
-  headers = {}
-  headers.merge!($headers)
-  headers[$hAccept] = $accept_rdf
-  headers[$hAcceptCharset] = $accept_charset unless $accept_charset.nil?
-  uri = URI.parse(requestURI)
-  request = Net::HTTP::Head.new(uri.request_uri)
-  request.initialize_http_header(headers)
-  print_http_request(uri, request)
-  response_no_body(uri, request)
-end
-
-def PUT(dataset, graph, file)
-  print "PUT #{dataset} #{graph} #{file}\n" if $verbose
-  send_body(dataset, graph, file, Net::HTTP::Put)
-end
-
-def POST(dataset, graph, file)
-  print "POST #{dataset} #{graph} #{file}\n" if $verbose
-  send_body(dataset, graph, file, Net::HTTP::Post)
-end
-
-def DELETE(dataset, graph)
-  print "DELETE #{dataset} #{graph}\n" if $verbose
-  requestURI = target(dataset, graph)
-  uri = URI.parse(requestURI)
-  request = Net::HTTP::Delete.new(uri.request_uri)
-  headers = {}
-  headers.merge!($headers)
-  request.initialize_http_header(headers)
-  print_http_request(uri, request)
-  response_no_body(uri, request)
-end
-
-def uri_escape(string)
-  CGI.escape(string)
-end
-
-def target(dataset, graph)
-  return dataset+"?default" if graph == "default"
-  return dataset+"?graph="+uri_escape(graph)
-end
-
-def send_body(dataset, graph, file, method)
-  mt = content_type(file)
-  headers = {}
-  headers.merge!($headers)
-  headers[$hContentType] = mt
-  headers[$hContentLength] = File.size(file).to_s
-  ## p headers
-
-  requestURI = target(dataset, graph)
-  uri = URI.parse(requestURI)
-  
-  request = method.new(uri.request_uri)
-  request.initialize_http_header(headers)
-  print_http_request(uri, request)
-  request.body_stream = File.open(file)
-  response_no_body(uri, request)
-end
-
-def response_no_body(uri, request)
-  http = Net::HTTP::Proxy($proxy.host,$proxy.port).new(uri.host, uri.port)
-  http.read_timeout = nil
-  # check we can connect.
-  begin http.start
-  rescue Exception => e  
-    # puts e.message  
-    #puts e.backtrace.inspect  
-    warn_exit "Failed to connect: #{uri.host}:#{uri.port}: #{e.message}", 3
-  end
-  response = http.request(request)
-  print_http_response(response)
-  case response
-  when Net::HTTPSuccess, Net::HTTPRedirection
-    # OK
-  when Net::HTTPNotFound
-    warn_exit "404 Not found: #{uri}", 9
-    #print response.body
-  else
-    warn_exit "#{response.code} #{response.message} #{uri}", 9
-    # Unreachable
-      response.error!
-  end
-  # NO BODY IN RESPONSE
-end
-
-def response_print_body(uri, request)
-  http = Net::HTTP::Proxy($proxy.host,$proxy.port).new(uri.host, uri.port)
-  http.read_timeout = nil
-  # check we can connect.
-  begin http.start
-  rescue => e  
-    #puts e.backtrace.inspect  
-    #print e.class
-    warn_exit "Failed to connect: #{uri.host}:#{uri.port}: #{e.message}", 3
-  end
-
-  # Add a blank line if headers were output.
-  print "\n" if $http_print ;
-
-  begin
-    response = http.request(request) { |res| 
-      print_http_response(res)
-      #puts res.code
-      res.read_body do |segment|
-        print segment
-      end
-    }
-    case response
-    when Net::HTTPSuccess, Net::HTTPRedirection
-      # OK
-    when Net::HTTPNotFound
-      warn_exit "404 Not found: #{uri}", 9
-      #print response.body
-    else
-      warn_exit "#{response.code}: #{uri}", 9
-      # Unreachable
-      response.error!
-    end
-  rescue EOFError => e
-    warn_exit "IO Error: "+e.message, 3
-  end
-end
-
-def print_http_request(uri, request)
-  return unless $print_http
-  #print "Request\n"
-  print request.method," ",uri, "\n"
-  print_headers("  ",request)
-end
-
-def print_http_response(response)
-  return unless $print_http
-  #print "Response\n"
-  print response.code, " ", response.message, "\n"
-  print_headers("  ",response)
-end
-
-def print_headers(marker, headers)
-  headers.each do |k,v| 
-    k = k.split('-').map{|w| w.capitalize}.join('-')+':'
-    printf "%s%-20s %s\n",marker,k,v
-  end
-end
-
-def content_type(file)
-  file =~ /\.([^.]*)$/
-  ext = $1
-  mt = $fileMediaTypes[ext]
-  cs = $charset[mt]
-  mt = mt+';charset='+cs if ! cs.nil?
-  return mt
-end
-
-def charset(content_type)
-  return $charset[content_type]
-end
-
-def warn_exit(msg, rc)
-    warn msg
-    exit rc ;
-end
-
-def parseURI(uri_string)
-  begin
-    return URI.parse(uri_string).to_s
-  rescue URI::InvalidURIError => err
-    warn_exit "Bad URI: <#{uri_string}>", 2
-  end
-end
-
-## ---- Command
-
-def cmd_soh(command=nil)
-  ## Command line
-  options = {}
-  optparse = OptionParser.new do |opts|
-    # Set a banner, displayed at the top
-    # of the help screen.
-    case $cmd
-    when "s-http", "sparql-http", "soh"
-      banner="$cmd [get|post|put|delete] datasetURI graph [file]"
-    when "s-get", "s-head", "s-delete"
-      banner="$cmd  datasetURI graph"
-    end
-
-    opts.banner = $banner
-    # Define the options, and what they do
-    
-    options[:verbose] = false
-    opts.on( '-v', '--verbose', 'Verbose' ) do
-      options[:verbose] = true
-    end
-    
-    options[:version] = false
-    opts.on( '--version', 'Print version and exit' ) do
-      print "#{SOH_NAME} #{SOH_VERSION}\n"
-      exit
-    end
-    
-    # This displays the help screen, all programs are
-    # assumed to have this option.
-    opts.on( '-h', '--help', 'Display this screen and exit' ) do
-      puts opts
-      exit
-    end
-  end
-
-  begin optparse.parse!    
-  rescue OptionParser::InvalidArgument => e
-    warn e
-    exit
-  end
-
-  $verbose = options[:verbose]
-  $print_http = $verbose
-
-  if command.nil?
-    if ARGV.size == 0
-      warn "No command given: expected one of 'get', 'put', 'post', 'delete', 'query' or 'update'"
-      exit 1
-    end
-    cmdPrint=ARGV.shift
-    command=cmdPrint.upcase
-  else
-    cmdPrint=command
-  end
-
-  case command
-  when "HEAD", "GET", "DELETE"
-    requiredFile=false
-  when "PUT", "POST"
-    requiredFile=true
-  when "QUERY"
-    cmd_sparql_query
-  when "UPDATE"
-    cmd_sparql_update
-  else
-    warn_exit "Unknown command: #{command}", 2
-  end
-
-  if requiredFile 
-  then
-    if ARGV.size != 3
-      warn_exit "Required: dataset URI, graph URI (or 'default') and file", 1 
-    end
-  else
-    if ARGV.size != 2
-      warn_exit "Required: dataset URI and graph URI (or 'default')", 1 
-    end
-  end
-
-  dataset=parseURI(ARGV.shift)
-  # Relative URI?
-  graph=parseURI(ARGV.shift)
-  file=""
-  if requiredFile
-  then
-    file = ARGV.shift if requiredFile
-    if ! File.exist?(file)
-      warn_exit "No such file: "+file, 3
-    end
-    if File.directory?(file)
-      warn_exit "File is a directory: "+file, 3
-    end
-  end
-
-  case command
-  when "GET"
-    GET(dataset, graph)
-  when "HEAD"
-    HEAD(dataset, graph)
-  when "PUT"
-    PUT(dataset, graph, file)
-  when "DELETE"
-    DELETE(dataset, graph)
-  when "POST"
-    POST(dataset, graph, file)
-  else
-    warn_exit "Internal error: Unknown command: #{cmd}", 2
-  end
-  exit 0
-end
-
-## --------
-def string_or_file(arg)
-  return arg if ! arg.match(/^@/)
-  a=(arg[1..-1])
-  open(a, 'rb'){|f| f.read}
-end
-
-## -------- SPARQL Query
-
-## Choose method
-def SPARQL_query(service, query, query_file, forcePOST=false, args2={})
-   if ! query_file.nil?
-    query = open(query_file, 'rb'){|f| f.read}
-  end
-  if forcePOST || query.length >= 2*1024 
-    SPARQL_query_POST(service, query, args2)
-  else
-    SPARQL_query_GET(service, query, args2)
-  end
-end
-
-## By GET
-
-def SPARQL_query_GET(service, query, args2)
-  args = { "query" => query }
-  args.merge!(args2)
-  qs=args.collect { |k,v| "#{k}=#{uri_escape(v)}" }.join('&')
-  action="#{service}?#{qs}"
-  headers={}
-  headers.merge!($headers)
-  headers[$hAccept]=$accept_results
-  get_worker(action, headers)
-end
-
-## By POST
-
-def SPARQL_query_POST(service, query, args2)
-  # DRY - body/no body for each of request and response.
-  post_params={ "query" => query }
-  post_params.merge!(args2)
-  uri = URI.parse(service)
-  headers={}
-  headers.merge!($headers)
-  headers[$hAccept]=$accept_results
-  execute_post_form_body(uri, headers, post_params)
-end
-
-def execute_post_form_body(uri, headers, post_params)
-  request = Net::HTTP::Post.new(uri.request_uri)
-  qs=post_params.collect { |k,v| "#{k}=#{uri_escape(v)}" }.join('&')
-  headers[$hContentType] = $mtWWWForm
-  headers[$hContentLength] = qs.length.to_s
-  request.initialize_http_header(headers)
-  request.body = qs
-  print_http_request(uri, request)
-  response_print_body(uri, request)
-end
-
-# Usage: -v --help --file= --query=
-def cmd_sparql_query
-  options={}
-  optparse = OptionParser.new do |opts|
-    opts.banner = "Usage: #{$cmd} [--query QUERY] [--service URI] [--post] 'query' | @file"
-    opts.on('--service=URI', '--server=URI', 'SPARQL endpoint') do |uri|
-      options[:service]=uri
-    end
-    opts.on('--query=FILE','--file=FILE', 'Take query from a file') do |file|
-      options[:file]=file
-    end
-    opts.on('--output=TYPE', [:json,:xml,:text,:csv,:tsv],
-            'Set the output argument') do |type|
-      options[:output]=type
-    end
-    opts.on('--accept=TYPE', [:json,:xml,:text,:csv,:tsv], 
-            'Set the accept header type') do |type|
-      options[:accept]=type
-    end
-    options[:verbose] = false
-    opts.on( '--post', 'Force use of POST' ) do
-      options[:post] = true
-    end
-    opts.on( '-v', '--verbose', 'Verbose' ) do
-      options[:verbose] = true
-    end
-    opts.on( '--version', 'Print version and exit' ) do
-      print "#{SOH_NAME} #{SOH_VERSION}\n"
-      exit
-    end 
-    opts.on( '-h', '--help', 'Display this screen and exit' ) do
-      puts opts
-      exit
-    end
-  end
-
-  begin optparse.parse!    
-  rescue OptionParser::InvalidArgument, OptionParser::InvalidOption => e
-    warn e
-    exit 1
-  end
-
-  $verbose = options[:verbose]
-  $print_http = $verbose
-  usePOST = options[:post]
-
-  service = options[:service]
-  warn_exit 'No service specified.  Required --service=URI',1 if service.nil?
-
-  # Query
-  query=nil
-  query_file=options[:file]
-  if query_file.nil? && ARGV.size == 0
-  then
-    warn_exit 'No query specified.',1
-    end
-  if query_file.nil?
-    query = ARGV.shift
-    if query.match(/^@/)
-      query_file = query[1..-1]
-      query = nil
-    end
-  end
-
-  # --output ==> output= (non-standard)
-  args={}
-  case options[:output]
-  when nil
-  when  "json","xml","text","csv","tsv"
-    args['output'] = options[:output]
-  when :json,:xml,:text,:csv,:tsv
-    args['output'] = options[:output].to_s
-  else
-    warn_exit "Unrecognized output type: "+options[:output],2
-  end
-
-  # --accept
-  # options[:accept]
-
-  print "SPARQL #{service}\n" if $verbose
-  #args={"output"=>"text"}
-  SPARQL_query(service, query, query_file, usePOST, args)
-  exit(0)
-end
-
-## -------- SPARQL Update
-
-# Update sent as a WWW form.
-def SPARQL_update_by_form(service, update, args2={})
-  args = {}
-  args.merge!(args2)
-  headers={}
-  headers.merge!($headers)
-  # args? encode?
-  body="update="+uri_escape(update)
-  headers[$hContentType] = $mtWWWForm
-  headers[$hContentLength] = body.length.to_s
-  uri = URI.parse(service)
-  execute_post_form(uri, headers, body)
-end
-
-# DRY - query form.
-def execute_post_form(uri, headers, body)
-  request = Net::HTTP::Post.new(uri.request_uri)
-  request.initialize_http_header(headers)
-  request.body = body
-  print_http_request(uri, request)
-  response_no_body(uri, request)
-end
-
-def SPARQL_update(service, update, args2={})
-  args = {}
-  args.merge!(args2)
-  headers={}
-  headers.merge!($headers)
-  headers[$hContentType] = $mtSparqlUpdate
-  uri = URI.parse(service)
-  request = Net::HTTP::Post.new(uri.request_uri)
-  request.initialize_http_header(headers)
-  request.body = update
-  print_http_request(uri, request)
-  response_no_body(uri, request)
-end
-
-def cmd_sparql_update(by_raw_post=true)
-  # Share with cmd_sparql_query
-  options={}
-  optparse = OptionParser.new do |opts|
-    opts.banner = "Usage: #{$cmd} [--file REQUEST] [--service URI] 'request' | @file"
-    opts.on('--service=URI', '--server=URI', 'SPARQL endpoint') do |uri|
-      options[:service]=uri
-    end
-    opts.on('--update=FILE', '--file=FILE', 'Take update from a file') do |file|
-      options[:file]=file
-    end
-    options[:verbose] = false
-    opts.on( '-v', '--verbose', 'Verbose' ) do
-      options[:verbose] = true
-    end
-    opts.on( '--version', 'Print version and exit' ) do
-      print "#{SOH_NAME} #{SOH_VERSION}\n"
-      exit
-    end 
-    opts.on( '-h', '--help', 'Display this screen and exit' ) do
-      puts opts
-      exit
-    end
-  end
-
-  begin optparse.parse!    
-  rescue OptionParser::InvalidArgument => e
-    warn e
-    exit
-  end
-
-  $verbose = options[:verbose]
-  $print_http = $verbose
-
-  service = options[:service]
-  warn_exit 'No service specified. Required --service=URI',1   if service.nil?
-  
-  update=nil
-  update_file=options[:file]
-
-  if update_file.nil? && ARGV.size == 0
-  then
-    warn_exit 'No update specified.',1
-    end
-  if update_file.nil?
-    update = ARGV.shift
-    if update.match(/^@/)
-      update_file = update[1..-1]
-      update = nil
-    end
-  end
-  
-  print "SPARQL-Update #{service}\n" if $verbose
-  args={}
-
-  # Reads in the file :-(
-  if update.nil?
-  then
-    update = open(update_file, 'rb'){|f| f.read}
-  else
-    update = string_or_file(update)
-  end
-
-  if by_raw_post
-    SPARQL_update(service, update, args)
-  else
-    SPARQL_update_by_form(service, update, args)
-  end
-  exit(0)
-end
-
-## -------
-
-case $cmd
-when "s-http", "sparql-http", "soh"
-  $banner="#{$cmd} [get|post|put|delete] datasetURI graph [file]"
-  cmd_soh
-when "s-get", "s-head", "s-put", "s-delete", "s-post"
-
-  case $cmd
-  when "s-get", "s-head", "s-delete"
-    $banner="#{$cmd} datasetURI graph"
-  when "s-put", "s-post"
-    $banner="#{$cmd} datasetURI graph file"
-  end
-  cmd2 = $cmd.sub(/^s-/, '').upcase
-  cmd_soh cmd2
-
-when "s-query", "sparql-query"
-  cmd_sparql_query
-when "s-update", "sparql-update"
-  cmd_sparql_update true
-when "s-update-form", "sparql-update-form"
-  cmd_sparql_update false
-else 
-  warn_exit "Unknown: "+$cmd, 1
-end

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/s-put
----------------------------------------------------------------------
diff --git a/jena-fuseki/s-put b/jena-fuseki/s-put
deleted file mode 100755
index 4f6590d..0000000
--- a/jena-fuseki/s-put
+++ /dev/null
@@ -1,713 +0,0 @@
-#!/usr/bin/env ruby
-# -*- coding: utf-8 -*-
-
-# 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.
-
-# SPARQL HTTP Update, client.
-
-require 'optparse'
-require 'net/http'
-require 'uri'
-require 'cgi'
-require 'pp'
-require 'ostruct'
-
-# ToDo
-#  Allow a choice of media type for GET
-#   --accept "content-type" (and abbreviations)
-#   --header "Add:this"
-#   --user, --password
-#  Basic authentication: request.basic_auth("username", "password")
-#  Follow redirects => 301:  puts response["location"] # All headers are lowercase?
-
-SOH_NAME="SOH"
-SOH_VERSION="0.0.0"
-
-$proxy = ENV['http_proxy'] ? URI.parse(ENV['http_proxy']) : OpenStruct.new  
-
-# What about direct naming?
-
-# Names
-$mtTurtle           = 'text/turtle;charset=utf-8'
-$mtRDF              = 'application/rdf+xml'
-$mtText             = 'text/plain'
-$mtNTriples         = 'application/n-triples'
-$mtNQuads           = 'application/n-quads'
-$mtJSONLD           = 'application/ld+json'
-$mtTriG             = 'application/trig'
-$mtSparqlResultsX   = 'application/sparql-results+xml'
-$mtSparqlResultsJ   = 'application/sparql-results+json'
-$mtAppJSON          = 'application/json'
-$mtAppXML           = 'application/xml'
-$mtSparqlResultsTSV = 'application/sparql-results+tsv'
-$mtSparqlResultsCSV = 'application/sparql-results+csv'
-$mtSparqlUpdate     = 'application/sparql-update'
-$mtWWWForm          = 'application/x-www-form-urlencoded'
-$mtSparqlQuery      = "application/sparql-query" ;
-
-# Global media type table.
-$fileMediaTypes = {}
-$fileMediaTypes['ttl']   = $mtTurtle
-$fileMediaTypes['n3']    = 'text/n3; charset=utf-8'
-$fileMediaTypes['nt']    = $mtText
-$fileMediaTypes['rdf']   = $mtRDF
-$fileMediaTypes['owl']   = $mtRDF
-$fileMediaTypes['nq']    = $mtNQuads
-$fileMediaTypes['trig']  = $mtTriG
-$fileMediaTypes['json-ld']  = $mtJSONLD
-$fileMediaTypes['jsonld']  = $mtJSONLD
-
-# Global charset : no entry means "don't set"
-$charsetUTF8      = 'utf-8'
-$charset = {}
-$charset[$mtTurtle]   = 'utf-8'
-$charset[$mtText]     = 'ascii'
-$charset[$mtTriG]     = 'utf-8'
-$charset[$mtNQuads]   = 'utf-8'
-
-# Headers
-
-$hContentType         = 'Content-Type'
-# $hContentEncoding     = 'Content-Encoding'
-$hContentLength       = 'Content-Length'
-# $hContentLocation     = 'Content-Location'
-# $hContentRange        = 'Content-Range'
-
-$hAccept              = 'Accept'
-$hAcceptCharset       = 'Accept-Charset'
-$hAcceptEncoding      = 'Accept-Encoding'
-$hAcceptRanges        = 'Accept-Ranges' 
-
-$headers = { "User-Agent" => "#{SOH_NAME}/Fuseki #{SOH_VERSION}"}
-$print_http = false
-
-# Default for GET
-# At least allow anything (and hope!)
-$accept_rdf="#{$mtTurtle} , #{$mtNTriples};q=0.9 , #{$mtRDF};q=0.8 , #{$mtJSONLD};q=0.5"
-# Datasets
-$accept_ds="#{$mtTrig} , #{$mtNQuads};q=0.9 , #{$mtJSONLD};q=0.5"
-# For SPARQL query
-$accept_results="#{$mtSparqlResultsJ} , #{$mtSparqlResultsX};q=0.9 , #{$accept_rdf}"
-
-# Accept any in case of trouble.
-$accept_rdf="#{$accept_rdf} , */*;q=0.1"
-$accept_results="#{$accept_results} , */*;q=0.1" 
-
-# The media type usually forces the charset.
-$accept_charset=nil
-
-## Who we are.
-## Two styles:
-##    s-query .....
-##    soh query .....
-
-$cmd = File.basename($0)
-if $cmd == 'soh'
-then
-  $cmd = (ARGV.size == 0) ? 'soh' : ARGV.shift
-end
-
-if ! $cmd.start_with?('s-') && $cmd != 'soh'
-  $cmd = 's-'+$cmd
-end
-
-## -------- 
-
-def GET(dataset, graph)
-  print "GET #{dataset} #{graph}\n" if $verbose
-  requestURI = target(dataset, graph)
-  headers = {}
-  headers.merge!($headers)
-  headers[$hAccept] = $accept_rdf
-  headers[$hAcceptCharset] = $accept_charset unless $accept_charset.nil?
-  get_worker(requestURI, headers)
-end
-
-def get_worker(requestURI, headers)
-  uri = URI.parse(requestURI)
-  request = Net::HTTP::Get.new(uri.request_uri)
-  request.initialize_http_header(headers)
-  print_http_request(uri, request)
-  response_print_body(uri, request)
-end
-
-def HEAD(dataset, graph)
-  print "HEAD #{dataset} #{graph}\n" if $verbose
-  requestURI = target(dataset, graph)
-  headers = {}
-  headers.merge!($headers)
-  headers[$hAccept] = $accept_rdf
-  headers[$hAcceptCharset] = $accept_charset unless $accept_charset.nil?
-  uri = URI.parse(requestURI)
-  request = Net::HTTP::Head.new(uri.request_uri)
-  request.initialize_http_header(headers)
-  print_http_request(uri, request)
-  response_no_body(uri, request)
-end
-
-def PUT(dataset, graph, file)
-  print "PUT #{dataset} #{graph} #{file}\n" if $verbose
-  send_body(dataset, graph, file, Net::HTTP::Put)
-end
-
-def POST(dataset, graph, file)
-  print "POST #{dataset} #{graph} #{file}\n" if $verbose
-  send_body(dataset, graph, file, Net::HTTP::Post)
-end
-
-def DELETE(dataset, graph)
-  print "DELETE #{dataset} #{graph}\n" if $verbose
-  requestURI = target(dataset, graph)
-  uri = URI.parse(requestURI)
-  request = Net::HTTP::Delete.new(uri.request_uri)
-  headers = {}
-  headers.merge!($headers)
-  request.initialize_http_header(headers)
-  print_http_request(uri, request)
-  response_no_body(uri, request)
-end
-
-def uri_escape(string)
-  CGI.escape(string)
-end
-
-def target(dataset, graph)
-  return dataset+"?default" if graph == "default"
-  return dataset+"?graph="+uri_escape(graph)
-end
-
-def send_body(dataset, graph, file, method)
-  mt = content_type(file)
-  headers = {}
-  headers.merge!($headers)
-  headers[$hContentType] = mt
-  headers[$hContentLength] = File.size(file).to_s
-  ## p headers
-
-  requestURI = target(dataset, graph)
-  uri = URI.parse(requestURI)
-  
-  request = method.new(uri.request_uri)
-  request.initialize_http_header(headers)
-  print_http_request(uri, request)
-  request.body_stream = File.open(file)
-  response_no_body(uri, request)
-end
-
-def response_no_body(uri, request)
-  http = Net::HTTP::Proxy($proxy.host,$proxy.port).new(uri.host, uri.port)
-  http.read_timeout = nil
-  # check we can connect.
-  begin http.start
-  rescue Exception => e  
-    # puts e.message  
-    #puts e.backtrace.inspect  
-    warn_exit "Failed to connect: #{uri.host}:#{uri.port}: #{e.message}", 3
-  end
-  response = http.request(request)
-  print_http_response(response)
-  case response
-  when Net::HTTPSuccess, Net::HTTPRedirection
-    # OK
-  when Net::HTTPNotFound
-    warn_exit "404 Not found: #{uri}", 9
-    #print response.body
-  else
-    warn_exit "#{response.code} #{response.message} #{uri}", 9
-    # Unreachable
-      response.error!
-  end
-  # NO BODY IN RESPONSE
-end
-
-def response_print_body(uri, request)
-  http = Net::HTTP::Proxy($proxy.host,$proxy.port).new(uri.host, uri.port)
-  http.read_timeout = nil
-  # check we can connect.
-  begin http.start
-  rescue => e  
-    #puts e.backtrace.inspect  
-    #print e.class
-    warn_exit "Failed to connect: #{uri.host}:#{uri.port}: #{e.message}", 3
-  end
-
-  # Add a blank line if headers were output.
-  print "\n" if $http_print ;
-
-  begin
-    response = http.request(request) { |res| 
-      print_http_response(res)
-      #puts res.code
-      res.read_body do |segment|
-        print segment
-      end
-    }
-    case response
-    when Net::HTTPSuccess, Net::HTTPRedirection
-      # OK
-    when Net::HTTPNotFound
-      warn_exit "404 Not found: #{uri}", 9
-      #print response.body
-    else
-      warn_exit "#{response.code}: #{uri}", 9
-      # Unreachable
-      response.error!
-    end
-  rescue EOFError => e
-    warn_exit "IO Error: "+e.message, 3
-  end
-end
-
-def print_http_request(uri, request)
-  return unless $print_http
-  #print "Request\n"
-  print request.method," ",uri, "\n"
-  print_headers("  ",request)
-end
-
-def print_http_response(response)
-  return unless $print_http
-  #print "Response\n"
-  print response.code, " ", response.message, "\n"
-  print_headers("  ",response)
-end
-
-def print_headers(marker, headers)
-  headers.each do |k,v| 
-    k = k.split('-').map{|w| w.capitalize}.join('-')+':'
-    printf "%s%-20s %s\n",marker,k,v
-  end
-end
-
-def content_type(file)
-  file =~ /\.([^.]*)$/
-  ext = $1
-  mt = $fileMediaTypes[ext]
-  cs = $charset[mt]
-  mt = mt+';charset='+cs if ! cs.nil?
-  return mt
-end
-
-def charset(content_type)
-  return $charset[content_type]
-end
-
-def warn_exit(msg, rc)
-    warn msg
-    exit rc ;
-end
-
-def parseURI(uri_string)
-  begin
-    return URI.parse(uri_string).to_s
-  rescue URI::InvalidURIError => err
-    warn_exit "Bad URI: <#{uri_string}>", 2
-  end
-end
-
-## ---- Command
-
-def cmd_soh(command=nil)
-  ## Command line
-  options = {}
-  optparse = OptionParser.new do |opts|
-    # Set a banner, displayed at the top
-    # of the help screen.
-    case $cmd
-    when "s-http", "sparql-http", "soh"
-      banner="$cmd [get|post|put|delete] datasetURI graph [file]"
-    when "s-get", "s-head", "s-delete"
-      banner="$cmd  datasetURI graph"
-    end
-
-    opts.banner = $banner
-    # Define the options, and what they do
-    
-    options[:verbose] = false
-    opts.on( '-v', '--verbose', 'Verbose' ) do
-      options[:verbose] = true
-    end
-    
-    options[:version] = false
-    opts.on( '--version', 'Print version and exit' ) do
-      print "#{SOH_NAME} #{SOH_VERSION}\n"
-      exit
-    end
-    
-    # This displays the help screen, all programs are
-    # assumed to have this option.
-    opts.on( '-h', '--help', 'Display this screen and exit' ) do
-      puts opts
-      exit
-    end
-  end
-
-  begin optparse.parse!    
-  rescue OptionParser::InvalidArgument => e
-    warn e
-    exit
-  end
-
-  $verbose = options[:verbose]
-  $print_http = $verbose
-
-  if command.nil?
-    if ARGV.size == 0
-      warn "No command given: expected one of 'get', 'put', 'post', 'delete', 'query' or 'update'"
-      exit 1
-    end
-    cmdPrint=ARGV.shift
-    command=cmdPrint.upcase
-  else
-    cmdPrint=command
-  end
-
-  case command
-  when "HEAD", "GET", "DELETE"
-    requiredFile=false
-  when "PUT", "POST"
-    requiredFile=true
-  when "QUERY"
-    cmd_sparql_query
-  when "UPDATE"
-    cmd_sparql_update
-  else
-    warn_exit "Unknown command: #{command}", 2
-  end
-
-  if requiredFile 
-  then
-    if ARGV.size != 3
-      warn_exit "Required: dataset URI, graph URI (or 'default') and file", 1 
-    end
-  else
-    if ARGV.size != 2
-      warn_exit "Required: dataset URI and graph URI (or 'default')", 1 
-    end
-  end
-
-  dataset=parseURI(ARGV.shift)
-  # Relative URI?
-  graph=parseURI(ARGV.shift)
-  file=""
-  if requiredFile
-  then
-    file = ARGV.shift if requiredFile
-    if ! File.exist?(file)
-      warn_exit "No such file: "+file, 3
-    end
-    if File.directory?(file)
-      warn_exit "File is a directory: "+file, 3
-    end
-  end
-
-  case command
-  when "GET"
-    GET(dataset, graph)
-  when "HEAD"
-    HEAD(dataset, graph)
-  when "PUT"
-    PUT(dataset, graph, file)
-  when "DELETE"
-    DELETE(dataset, graph)
-  when "POST"
-    POST(dataset, graph, file)
-  else
-    warn_exit "Internal error: Unknown command: #{cmd}", 2
-  end
-  exit 0
-end
-
-## --------
-def string_or_file(arg)
-  return arg if ! arg.match(/^@/)
-  a=(arg[1..-1])
-  open(a, 'rb'){|f| f.read}
-end
-
-## -------- SPARQL Query
-
-## Choose method
-def SPARQL_query(service, query, query_file, forcePOST=false, args2={})
-   if ! query_file.nil?
-    query = open(query_file, 'rb'){|f| f.read}
-  end
-  if forcePOST || query.length >= 2*1024 
-    SPARQL_query_POST(service, query, args2)
-  else
-    SPARQL_query_GET(service, query, args2)
-  end
-end
-
-## By GET
-
-def SPARQL_query_GET(service, query, args2)
-  args = { "query" => query }
-  args.merge!(args2)
-  qs=args.collect { |k,v| "#{k}=#{uri_escape(v)}" }.join('&')
-  action="#{service}?#{qs}"
-  headers={}
-  headers.merge!($headers)
-  headers[$hAccept]=$accept_results
-  get_worker(action, headers)
-end
-
-## By POST
-
-def SPARQL_query_POST(service, query, args2)
-  # DRY - body/no body for each of request and response.
-  post_params={ "query" => query }
-  post_params.merge!(args2)
-  uri = URI.parse(service)
-  headers={}
-  headers.merge!($headers)
-  headers[$hAccept]=$accept_results
-  execute_post_form_body(uri, headers, post_params)
-end
-
-def execute_post_form_body(uri, headers, post_params)
-  request = Net::HTTP::Post.new(uri.request_uri)
-  qs=post_params.collect { |k,v| "#{k}=#{uri_escape(v)}" }.join('&')
-  headers[$hContentType] = $mtWWWForm
-  headers[$hContentLength] = qs.length.to_s
-  request.initialize_http_header(headers)
-  request.body = qs
-  print_http_request(uri, request)
-  response_print_body(uri, request)
-end
-
-# Usage: -v --help --file= --query=
-def cmd_sparql_query
-  options={}
-  optparse = OptionParser.new do |opts|
-    opts.banner = "Usage: #{$cmd} [--query QUERY] [--service URI] [--post] 'query' | @file"
-    opts.on('--service=URI', '--server=URI', 'SPARQL endpoint') do |uri|
-      options[:service]=uri
-    end
-    opts.on('--query=FILE','--file=FILE', 'Take query from a file') do |file|
-      options[:file]=file
-    end
-    opts.on('--output=TYPE', [:json,:xml,:text,:csv,:tsv],
-            'Set the output argument') do |type|
-      options[:output]=type
-    end
-    opts.on('--accept=TYPE', [:json,:xml,:text,:csv,:tsv], 
-            'Set the accept header type') do |type|
-      options[:accept]=type
-    end
-    options[:verbose] = false
-    opts.on( '--post', 'Force use of POST' ) do
-      options[:post] = true
-    end
-    opts.on( '-v', '--verbose', 'Verbose' ) do
-      options[:verbose] = true
-    end
-    opts.on( '--version', 'Print version and exit' ) do
-      print "#{SOH_NAME} #{SOH_VERSION}\n"
-      exit
-    end 
-    opts.on( '-h', '--help', 'Display this screen and exit' ) do
-      puts opts
-      exit
-    end
-  end
-
-  begin optparse.parse!    
-  rescue OptionParser::InvalidArgument, OptionParser::InvalidOption => e
-    warn e
-    exit 1
-  end
-
-  $verbose = options[:verbose]
-  $print_http = $verbose
-  usePOST = options[:post]
-
-  service = options[:service]
-  warn_exit 'No service specified.  Required --service=URI',1 if service.nil?
-
-  # Query
-  query=nil
-  query_file=options[:file]
-  if query_file.nil? && ARGV.size == 0
-  then
-    warn_exit 'No query specified.',1
-    end
-  if query_file.nil?
-    query = ARGV.shift
-    if query.match(/^@/)
-      query_file = query[1..-1]
-      query = nil
-    end
-  end
-
-  # --output ==> output= (non-standard)
-  args={}
-  case options[:output]
-  when nil
-  when  "json","xml","text","csv","tsv"
-    args['output'] = options[:output]
-  when :json,:xml,:text,:csv,:tsv
-    args['output'] = options[:output].to_s
-  else
-    warn_exit "Unrecognized output type: "+options[:output],2
-  end
-
-  # --accept
-  # options[:accept]
-
-  print "SPARQL #{service}\n" if $verbose
-  #args={"output"=>"text"}
-  SPARQL_query(service, query, query_file, usePOST, args)
-  exit(0)
-end
-
-## -------- SPARQL Update
-
-# Update sent as a WWW form.
-def SPARQL_update_by_form(service, update, args2={})
-  args = {}
-  args.merge!(args2)
-  headers={}
-  headers.merge!($headers)
-  # args? encode?
-  body="update="+uri_escape(update)
-  headers[$hContentType] = $mtWWWForm
-  headers[$hContentLength] = body.length.to_s
-  uri = URI.parse(service)
-  execute_post_form(uri, headers, body)
-end
-
-# DRY - query form.
-def execute_post_form(uri, headers, body)
-  request = Net::HTTP::Post.new(uri.request_uri)
-  request.initialize_http_header(headers)
-  request.body = body
-  print_http_request(uri, request)
-  response_no_body(uri, request)
-end
-
-def SPARQL_update(service, update, args2={})
-  args = {}
-  args.merge!(args2)
-  headers={}
-  headers.merge!($headers)
-  headers[$hContentType] = $mtSparqlUpdate
-  uri = URI.parse(service)
-  request = Net::HTTP::Post.new(uri.request_uri)
-  request.initialize_http_header(headers)
-  request.body = update
-  print_http_request(uri, request)
-  response_no_body(uri, request)
-end
-
-def cmd_sparql_update(by_raw_post=true)
-  # Share with cmd_sparql_query
-  options={}
-  optparse = OptionParser.new do |opts|
-    opts.banner = "Usage: #{$cmd} [--file REQUEST] [--service URI] 'request' | @file"
-    opts.on('--service=URI', '--server=URI', 'SPARQL endpoint') do |uri|
-      options[:service]=uri
-    end
-    opts.on('--update=FILE', '--file=FILE', 'Take update from a file') do |file|
-      options[:file]=file
-    end
-    options[:verbose] = false
-    opts.on( '-v', '--verbose', 'Verbose' ) do
-      options[:verbose] = true
-    end
-    opts.on( '--version', 'Print version and exit' ) do
-      print "#{SOH_NAME} #{SOH_VERSION}\n"
-      exit
-    end 
-    opts.on( '-h', '--help', 'Display this screen and exit' ) do
-      puts opts
-      exit
-    end
-  end
-
-  begin optparse.parse!    
-  rescue OptionParser::InvalidArgument => e
-    warn e
-    exit
-  end
-
-  $verbose = options[:verbose]
-  $print_http = $verbose
-
-  service = options[:service]
-  warn_exit 'No service specified. Required --service=URI',1   if service.nil?
-  
-  update=nil
-  update_file=options[:file]
-
-  if update_file.nil? && ARGV.size == 0
-  then
-    warn_exit 'No update specified.',1
-    end
-  if update_file.nil?
-    update = ARGV.shift
-    if update.match(/^@/)
-      update_file = update[1..-1]
-      update = nil
-    end
-  end
-  
-  print "SPARQL-Update #{service}\n" if $verbose
-  args={}
-
-  # Reads in the file :-(
-  if update.nil?
-  then
-    update = open(update_file, 'rb'){|f| f.read}
-  else
-    update = string_or_file(update)
-  end
-
-  if by_raw_post
-    SPARQL_update(service, update, args)
-  else
-    SPARQL_update_by_form(service, update, args)
-  end
-  exit(0)
-end
-
-## -------
-
-case $cmd
-when "s-http", "sparql-http", "soh"
-  $banner="#{$cmd} [get|post|put|delete] datasetURI graph [file]"
-  cmd_soh
-when "s-get", "s-head", "s-put", "s-delete", "s-post"
-
-  case $cmd
-  when "s-get", "s-head", "s-delete"
-    $banner="#{$cmd} datasetURI graph"
-  when "s-put", "s-post"
-    $banner="#{$cmd} datasetURI graph file"
-  end
-  cmd2 = $cmd.sub(/^s-/, '').upcase
-  cmd_soh cmd2
-
-when "s-query", "sparql-query"
-  cmd_sparql_query
-when "s-update", "sparql-update"
-  cmd_sparql_update true
-when "s-update-form", "sparql-update-form"
-  cmd_sparql_update false
-else 
-  warn_exit "Unknown: "+$cmd, 1
-end

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/s-query
----------------------------------------------------------------------
diff --git a/jena-fuseki/s-query b/jena-fuseki/s-query
deleted file mode 100755
index 4f6590d..0000000
--- a/jena-fuseki/s-query
+++ /dev/null
@@ -1,713 +0,0 @@
-#!/usr/bin/env ruby
-# -*- coding: utf-8 -*-
-
-# 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.
-
-# SPARQL HTTP Update, client.
-
-require 'optparse'
-require 'net/http'
-require 'uri'
-require 'cgi'
-require 'pp'
-require 'ostruct'
-
-# ToDo
-#  Allow a choice of media type for GET
-#   --accept "content-type" (and abbreviations)
-#   --header "Add:this"
-#   --user, --password
-#  Basic authentication: request.basic_auth("username", "password")
-#  Follow redirects => 301:  puts response["location"] # All headers are lowercase?
-
-SOH_NAME="SOH"
-SOH_VERSION="0.0.0"
-
-$proxy = ENV['http_proxy'] ? URI.parse(ENV['http_proxy']) : OpenStruct.new  
-
-# What about direct naming?
-
-# Names
-$mtTurtle           = 'text/turtle;charset=utf-8'
-$mtRDF              = 'application/rdf+xml'
-$mtText             = 'text/plain'
-$mtNTriples         = 'application/n-triples'
-$mtNQuads           = 'application/n-quads'
-$mtJSONLD           = 'application/ld+json'
-$mtTriG             = 'application/trig'
-$mtSparqlResultsX   = 'application/sparql-results+xml'
-$mtSparqlResultsJ   = 'application/sparql-results+json'
-$mtAppJSON          = 'application/json'
-$mtAppXML           = 'application/xml'
-$mtSparqlResultsTSV = 'application/sparql-results+tsv'
-$mtSparqlResultsCSV = 'application/sparql-results+csv'
-$mtSparqlUpdate     = 'application/sparql-update'
-$mtWWWForm          = 'application/x-www-form-urlencoded'
-$mtSparqlQuery      = "application/sparql-query" ;
-
-# Global media type table.
-$fileMediaTypes = {}
-$fileMediaTypes['ttl']   = $mtTurtle
-$fileMediaTypes['n3']    = 'text/n3; charset=utf-8'
-$fileMediaTypes['nt']    = $mtText
-$fileMediaTypes['rdf']   = $mtRDF
-$fileMediaTypes['owl']   = $mtRDF
-$fileMediaTypes['nq']    = $mtNQuads
-$fileMediaTypes['trig']  = $mtTriG
-$fileMediaTypes['json-ld']  = $mtJSONLD
-$fileMediaTypes['jsonld']  = $mtJSONLD
-
-# Global charset : no entry means "don't set"
-$charsetUTF8      = 'utf-8'
-$charset = {}
-$charset[$mtTurtle]   = 'utf-8'
-$charset[$mtText]     = 'ascii'
-$charset[$mtTriG]     = 'utf-8'
-$charset[$mtNQuads]   = 'utf-8'
-
-# Headers
-
-$hContentType         = 'Content-Type'
-# $hContentEncoding     = 'Content-Encoding'
-$hContentLength       = 'Content-Length'
-# $hContentLocation     = 'Content-Location'
-# $hContentRange        = 'Content-Range'
-
-$hAccept              = 'Accept'
-$hAcceptCharset       = 'Accept-Charset'
-$hAcceptEncoding      = 'Accept-Encoding'
-$hAcceptRanges        = 'Accept-Ranges' 
-
-$headers = { "User-Agent" => "#{SOH_NAME}/Fuseki #{SOH_VERSION}"}
-$print_http = false
-
-# Default for GET
-# At least allow anything (and hope!)
-$accept_rdf="#{$mtTurtle} , #{$mtNTriples};q=0.9 , #{$mtRDF};q=0.8 , #{$mtJSONLD};q=0.5"
-# Datasets
-$accept_ds="#{$mtTrig} , #{$mtNQuads};q=0.9 , #{$mtJSONLD};q=0.5"
-# For SPARQL query
-$accept_results="#{$mtSparqlResultsJ} , #{$mtSparqlResultsX};q=0.9 , #{$accept_rdf}"
-
-# Accept any in case of trouble.
-$accept_rdf="#{$accept_rdf} , */*;q=0.1"
-$accept_results="#{$accept_results} , */*;q=0.1" 
-
-# The media type usually forces the charset.
-$accept_charset=nil
-
-## Who we are.
-## Two styles:
-##    s-query .....
-##    soh query .....
-
-$cmd = File.basename($0)
-if $cmd == 'soh'
-then
-  $cmd = (ARGV.size == 0) ? 'soh' : ARGV.shift
-end
-
-if ! $cmd.start_with?('s-') && $cmd != 'soh'
-  $cmd = 's-'+$cmd
-end
-
-## -------- 
-
-def GET(dataset, graph)
-  print "GET #{dataset} #{graph}\n" if $verbose
-  requestURI = target(dataset, graph)
-  headers = {}
-  headers.merge!($headers)
-  headers[$hAccept] = $accept_rdf
-  headers[$hAcceptCharset] = $accept_charset unless $accept_charset.nil?
-  get_worker(requestURI, headers)
-end
-
-def get_worker(requestURI, headers)
-  uri = URI.parse(requestURI)
-  request = Net::HTTP::Get.new(uri.request_uri)
-  request.initialize_http_header(headers)
-  print_http_request(uri, request)
-  response_print_body(uri, request)
-end
-
-def HEAD(dataset, graph)
-  print "HEAD #{dataset} #{graph}\n" if $verbose
-  requestURI = target(dataset, graph)
-  headers = {}
-  headers.merge!($headers)
-  headers[$hAccept] = $accept_rdf
-  headers[$hAcceptCharset] = $accept_charset unless $accept_charset.nil?
-  uri = URI.parse(requestURI)
-  request = Net::HTTP::Head.new(uri.request_uri)
-  request.initialize_http_header(headers)
-  print_http_request(uri, request)
-  response_no_body(uri, request)
-end
-
-def PUT(dataset, graph, file)
-  print "PUT #{dataset} #{graph} #{file}\n" if $verbose
-  send_body(dataset, graph, file, Net::HTTP::Put)
-end
-
-def POST(dataset, graph, file)
-  print "POST #{dataset} #{graph} #{file}\n" if $verbose
-  send_body(dataset, graph, file, Net::HTTP::Post)
-end
-
-def DELETE(dataset, graph)
-  print "DELETE #{dataset} #{graph}\n" if $verbose
-  requestURI = target(dataset, graph)
-  uri = URI.parse(requestURI)
-  request = Net::HTTP::Delete.new(uri.request_uri)
-  headers = {}
-  headers.merge!($headers)
-  request.initialize_http_header(headers)
-  print_http_request(uri, request)
-  response_no_body(uri, request)
-end
-
-def uri_escape(string)
-  CGI.escape(string)
-end
-
-def target(dataset, graph)
-  return dataset+"?default" if graph == "default"
-  return dataset+"?graph="+uri_escape(graph)
-end
-
-def send_body(dataset, graph, file, method)
-  mt = content_type(file)
-  headers = {}
-  headers.merge!($headers)
-  headers[$hContentType] = mt
-  headers[$hContentLength] = File.size(file).to_s
-  ## p headers
-
-  requestURI = target(dataset, graph)
-  uri = URI.parse(requestURI)
-  
-  request = method.new(uri.request_uri)
-  request.initialize_http_header(headers)
-  print_http_request(uri, request)
-  request.body_stream = File.open(file)
-  response_no_body(uri, request)
-end
-
-def response_no_body(uri, request)
-  http = Net::HTTP::Proxy($proxy.host,$proxy.port).new(uri.host, uri.port)
-  http.read_timeout = nil
-  # check we can connect.
-  begin http.start
-  rescue Exception => e  
-    # puts e.message  
-    #puts e.backtrace.inspect  
-    warn_exit "Failed to connect: #{uri.host}:#{uri.port}: #{e.message}", 3
-  end
-  response = http.request(request)
-  print_http_response(response)
-  case response
-  when Net::HTTPSuccess, Net::HTTPRedirection
-    # OK
-  when Net::HTTPNotFound
-    warn_exit "404 Not found: #{uri}", 9
-    #print response.body
-  else
-    warn_exit "#{response.code} #{response.message} #{uri}", 9
-    # Unreachable
-      response.error!
-  end
-  # NO BODY IN RESPONSE
-end
-
-def response_print_body(uri, request)
-  http = Net::HTTP::Proxy($proxy.host,$proxy.port).new(uri.host, uri.port)
-  http.read_timeout = nil
-  # check we can connect.
-  begin http.start
-  rescue => e  
-    #puts e.backtrace.inspect  
-    #print e.class
-    warn_exit "Failed to connect: #{uri.host}:#{uri.port}: #{e.message}", 3
-  end
-
-  # Add a blank line if headers were output.
-  print "\n" if $http_print ;
-
-  begin
-    response = http.request(request) { |res| 
-      print_http_response(res)
-      #puts res.code
-      res.read_body do |segment|
-        print segment
-      end
-    }
-    case response
-    when Net::HTTPSuccess, Net::HTTPRedirection
-      # OK
-    when Net::HTTPNotFound
-      warn_exit "404 Not found: #{uri}", 9
-      #print response.body
-    else
-      warn_exit "#{response.code}: #{uri}", 9
-      # Unreachable
-      response.error!
-    end
-  rescue EOFError => e
-    warn_exit "IO Error: "+e.message, 3
-  end
-end
-
-def print_http_request(uri, request)
-  return unless $print_http
-  #print "Request\n"
-  print request.method," ",uri, "\n"
-  print_headers("  ",request)
-end
-
-def print_http_response(response)
-  return unless $print_http
-  #print "Response\n"
-  print response.code, " ", response.message, "\n"
-  print_headers("  ",response)
-end
-
-def print_headers(marker, headers)
-  headers.each do |k,v| 
-    k = k.split('-').map{|w| w.capitalize}.join('-')+':'
-    printf "%s%-20s %s\n",marker,k,v
-  end
-end
-
-def content_type(file)
-  file =~ /\.([^.]*)$/
-  ext = $1
-  mt = $fileMediaTypes[ext]
-  cs = $charset[mt]
-  mt = mt+';charset='+cs if ! cs.nil?
-  return mt
-end
-
-def charset(content_type)
-  return $charset[content_type]
-end
-
-def warn_exit(msg, rc)
-    warn msg
-    exit rc ;
-end
-
-def parseURI(uri_string)
-  begin
-    return URI.parse(uri_string).to_s
-  rescue URI::InvalidURIError => err
-    warn_exit "Bad URI: <#{uri_string}>", 2
-  end
-end
-
-## ---- Command
-
-def cmd_soh(command=nil)
-  ## Command line
-  options = {}
-  optparse = OptionParser.new do |opts|
-    # Set a banner, displayed at the top
-    # of the help screen.
-    case $cmd
-    when "s-http", "sparql-http", "soh"
-      banner="$cmd [get|post|put|delete] datasetURI graph [file]"
-    when "s-get", "s-head", "s-delete"
-      banner="$cmd  datasetURI graph"
-    end
-
-    opts.banner = $banner
-    # Define the options, and what they do
-    
-    options[:verbose] = false
-    opts.on( '-v', '--verbose', 'Verbose' ) do
-      options[:verbose] = true
-    end
-    
-    options[:version] = false
-    opts.on( '--version', 'Print version and exit' ) do
-      print "#{SOH_NAME} #{SOH_VERSION}\n"
-      exit
-    end
-    
-    # This displays the help screen, all programs are
-    # assumed to have this option.
-    opts.on( '-h', '--help', 'Display this screen and exit' ) do
-      puts opts
-      exit
-    end
-  end
-
-  begin optparse.parse!    
-  rescue OptionParser::InvalidArgument => e
-    warn e
-    exit
-  end
-
-  $verbose = options[:verbose]
-  $print_http = $verbose
-
-  if command.nil?
-    if ARGV.size == 0
-      warn "No command given: expected one of 'get', 'put', 'post', 'delete', 'query' or 'update'"
-      exit 1
-    end
-    cmdPrint=ARGV.shift
-    command=cmdPrint.upcase
-  else
-    cmdPrint=command
-  end
-
-  case command
-  when "HEAD", "GET", "DELETE"
-    requiredFile=false
-  when "PUT", "POST"
-    requiredFile=true
-  when "QUERY"
-    cmd_sparql_query
-  when "UPDATE"
-    cmd_sparql_update
-  else
-    warn_exit "Unknown command: #{command}", 2
-  end
-
-  if requiredFile 
-  then
-    if ARGV.size != 3
-      warn_exit "Required: dataset URI, graph URI (or 'default') and file", 1 
-    end
-  else
-    if ARGV.size != 2
-      warn_exit "Required: dataset URI and graph URI (or 'default')", 1 
-    end
-  end
-
-  dataset=parseURI(ARGV.shift)
-  # Relative URI?
-  graph=parseURI(ARGV.shift)
-  file=""
-  if requiredFile
-  then
-    file = ARGV.shift if requiredFile
-    if ! File.exist?(file)
-      warn_exit "No such file: "+file, 3
-    end
-    if File.directory?(file)
-      warn_exit "File is a directory: "+file, 3
-    end
-  end
-
-  case command
-  when "GET"
-    GET(dataset, graph)
-  when "HEAD"
-    HEAD(dataset, graph)
-  when "PUT"
-    PUT(dataset, graph, file)
-  when "DELETE"
-    DELETE(dataset, graph)
-  when "POST"
-    POST(dataset, graph, file)
-  else
-    warn_exit "Internal error: Unknown command: #{cmd}", 2
-  end
-  exit 0
-end
-
-## --------
-def string_or_file(arg)
-  return arg if ! arg.match(/^@/)
-  a=(arg[1..-1])
-  open(a, 'rb'){|f| f.read}
-end
-
-## -------- SPARQL Query
-
-## Choose method
-def SPARQL_query(service, query, query_file, forcePOST=false, args2={})
-   if ! query_file.nil?
-    query = open(query_file, 'rb'){|f| f.read}
-  end
-  if forcePOST || query.length >= 2*1024 
-    SPARQL_query_POST(service, query, args2)
-  else
-    SPARQL_query_GET(service, query, args2)
-  end
-end
-
-## By GET
-
-def SPARQL_query_GET(service, query, args2)
-  args = { "query" => query }
-  args.merge!(args2)
-  qs=args.collect { |k,v| "#{k}=#{uri_escape(v)}" }.join('&')
-  action="#{service}?#{qs}"
-  headers={}
-  headers.merge!($headers)
-  headers[$hAccept]=$accept_results
-  get_worker(action, headers)
-end
-
-## By POST
-
-def SPARQL_query_POST(service, query, args2)
-  # DRY - body/no body for each of request and response.
-  post_params={ "query" => query }
-  post_params.merge!(args2)
-  uri = URI.parse(service)
-  headers={}
-  headers.merge!($headers)
-  headers[$hAccept]=$accept_results
-  execute_post_form_body(uri, headers, post_params)
-end
-
-def execute_post_form_body(uri, headers, post_params)
-  request = Net::HTTP::Post.new(uri.request_uri)
-  qs=post_params.collect { |k,v| "#{k}=#{uri_escape(v)}" }.join('&')
-  headers[$hContentType] = $mtWWWForm
-  headers[$hContentLength] = qs.length.to_s
-  request.initialize_http_header(headers)
-  request.body = qs
-  print_http_request(uri, request)
-  response_print_body(uri, request)
-end
-
-# Usage: -v --help --file= --query=
-def cmd_sparql_query
-  options={}
-  optparse = OptionParser.new do |opts|
-    opts.banner = "Usage: #{$cmd} [--query QUERY] [--service URI] [--post] 'query' | @file"
-    opts.on('--service=URI', '--server=URI', 'SPARQL endpoint') do |uri|
-      options[:service]=uri
-    end
-    opts.on('--query=FILE','--file=FILE', 'Take query from a file') do |file|
-      options[:file]=file
-    end
-    opts.on('--output=TYPE', [:json,:xml,:text,:csv,:tsv],
-            'Set the output argument') do |type|
-      options[:output]=type
-    end
-    opts.on('--accept=TYPE', [:json,:xml,:text,:csv,:tsv], 
-            'Set the accept header type') do |type|
-      options[:accept]=type
-    end
-    options[:verbose] = false
-    opts.on( '--post', 'Force use of POST' ) do
-      options[:post] = true
-    end
-    opts.on( '-v', '--verbose', 'Verbose' ) do
-      options[:verbose] = true
-    end
-    opts.on( '--version', 'Print version and exit' ) do
-      print "#{SOH_NAME} #{SOH_VERSION}\n"
-      exit
-    end 
-    opts.on( '-h', '--help', 'Display this screen and exit' ) do
-      puts opts
-      exit
-    end
-  end
-
-  begin optparse.parse!    
-  rescue OptionParser::InvalidArgument, OptionParser::InvalidOption => e
-    warn e
-    exit 1
-  end
-
-  $verbose = options[:verbose]
-  $print_http = $verbose
-  usePOST = options[:post]
-
-  service = options[:service]
-  warn_exit 'No service specified.  Required --service=URI',1 if service.nil?
-
-  # Query
-  query=nil
-  query_file=options[:file]
-  if query_file.nil? && ARGV.size == 0
-  then
-    warn_exit 'No query specified.',1
-    end
-  if query_file.nil?
-    query = ARGV.shift
-    if query.match(/^@/)
-      query_file = query[1..-1]
-      query = nil
-    end
-  end
-
-  # --output ==> output= (non-standard)
-  args={}
-  case options[:output]
-  when nil
-  when  "json","xml","text","csv","tsv"
-    args['output'] = options[:output]
-  when :json,:xml,:text,:csv,:tsv
-    args['output'] = options[:output].to_s
-  else
-    warn_exit "Unrecognized output type: "+options[:output],2
-  end
-
-  # --accept
-  # options[:accept]
-
-  print "SPARQL #{service}\n" if $verbose
-  #args={"output"=>"text"}
-  SPARQL_query(service, query, query_file, usePOST, args)
-  exit(0)
-end
-
-## -------- SPARQL Update
-
-# Update sent as a WWW form.
-def SPARQL_update_by_form(service, update, args2={})
-  args = {}
-  args.merge!(args2)
-  headers={}
-  headers.merge!($headers)
-  # args? encode?
-  body="update="+uri_escape(update)
-  headers[$hContentType] = $mtWWWForm
-  headers[$hContentLength] = body.length.to_s
-  uri = URI.parse(service)
-  execute_post_form(uri, headers, body)
-end
-
-# DRY - query form.
-def execute_post_form(uri, headers, body)
-  request = Net::HTTP::Post.new(uri.request_uri)
-  request.initialize_http_header(headers)
-  request.body = body
-  print_http_request(uri, request)
-  response_no_body(uri, request)
-end
-
-def SPARQL_update(service, update, args2={})
-  args = {}
-  args.merge!(args2)
-  headers={}
-  headers.merge!($headers)
-  headers[$hContentType] = $mtSparqlUpdate
-  uri = URI.parse(service)
-  request = Net::HTTP::Post.new(uri.request_uri)
-  request.initialize_http_header(headers)
-  request.body = update
-  print_http_request(uri, request)
-  response_no_body(uri, request)
-end
-
-def cmd_sparql_update(by_raw_post=true)
-  # Share with cmd_sparql_query
-  options={}
-  optparse = OptionParser.new do |opts|
-    opts.banner = "Usage: #{$cmd} [--file REQUEST] [--service URI] 'request' | @file"
-    opts.on('--service=URI', '--server=URI', 'SPARQL endpoint') do |uri|
-      options[:service]=uri
-    end
-    opts.on('--update=FILE', '--file=FILE', 'Take update from a file') do |file|
-      options[:file]=file
-    end
-    options[:verbose] = false
-    opts.on( '-v', '--verbose', 'Verbose' ) do
-      options[:verbose] = true
-    end
-    opts.on( '--version', 'Print version and exit' ) do
-      print "#{SOH_NAME} #{SOH_VERSION}\n"
-      exit
-    end 
-    opts.on( '-h', '--help', 'Display this screen and exit' ) do
-      puts opts
-      exit
-    end
-  end
-
-  begin optparse.parse!    
-  rescue OptionParser::InvalidArgument => e
-    warn e
-    exit
-  end
-
-  $verbose = options[:verbose]
-  $print_http = $verbose
-
-  service = options[:service]
-  warn_exit 'No service specified. Required --service=URI',1   if service.nil?
-  
-  update=nil
-  update_file=options[:file]
-
-  if update_file.nil? && ARGV.size == 0
-  then
-    warn_exit 'No update specified.',1
-    end
-  if update_file.nil?
-    update = ARGV.shift
-    if update.match(/^@/)
-      update_file = update[1..-1]
-      update = nil
-    end
-  end
-  
-  print "SPARQL-Update #{service}\n" if $verbose
-  args={}
-
-  # Reads in the file :-(
-  if update.nil?
-  then
-    update = open(update_file, 'rb'){|f| f.read}
-  else
-    update = string_or_file(update)
-  end
-
-  if by_raw_post
-    SPARQL_update(service, update, args)
-  else
-    SPARQL_update_by_form(service, update, args)
-  end
-  exit(0)
-end
-
-## -------
-
-case $cmd
-when "s-http", "sparql-http", "soh"
-  $banner="#{$cmd} [get|post|put|delete] datasetURI graph [file]"
-  cmd_soh
-when "s-get", "s-head", "s-put", "s-delete", "s-post"
-
-  case $cmd
-  when "s-get", "s-head", "s-delete"
-    $banner="#{$cmd} datasetURI graph"
-  when "s-put", "s-post"
-    $banner="#{$cmd} datasetURI graph file"
-  end
-  cmd2 = $cmd.sub(/^s-/, '').upcase
-  cmd_soh cmd2
-
-when "s-query", "sparql-query"
-  cmd_sparql_query
-when "s-update", "sparql-update"
-  cmd_sparql_update true
-when "s-update-form", "sparql-update-form"
-  cmd_sparql_update false
-else 
-  warn_exit "Unknown: "+$cmd, 1
-end

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/s-update
----------------------------------------------------------------------
diff --git a/jena-fuseki/s-update b/jena-fuseki/s-update
deleted file mode 100755
index 4f6590d..0000000
--- a/jena-fuseki/s-update
+++ /dev/null
@@ -1,713 +0,0 @@
-#!/usr/bin/env ruby
-# -*- coding: utf-8 -*-
-
-# 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.
-
-# SPARQL HTTP Update, client.
-
-require 'optparse'
-require 'net/http'
-require 'uri'
-require 'cgi'
-require 'pp'
-require 'ostruct'
-
-# ToDo
-#  Allow a choice of media type for GET
-#   --accept "content-type" (and abbreviations)
-#   --header "Add:this"
-#   --user, --password
-#  Basic authentication: request.basic_auth("username", "password")
-#  Follow redirects => 301:  puts response["location"] # All headers are lowercase?
-
-SOH_NAME="SOH"
-SOH_VERSION="0.0.0"
-
-$proxy = ENV['http_proxy'] ? URI.parse(ENV['http_proxy']) : OpenStruct.new  
-
-# What about direct naming?
-
-# Names
-$mtTurtle           = 'text/turtle;charset=utf-8'
-$mtRDF              = 'application/rdf+xml'
-$mtText             = 'text/plain'
-$mtNTriples         = 'application/n-triples'
-$mtNQuads           = 'application/n-quads'
-$mtJSONLD           = 'application/ld+json'
-$mtTriG             = 'application/trig'
-$mtSparqlResultsX   = 'application/sparql-results+xml'
-$mtSparqlResultsJ   = 'application/sparql-results+json'
-$mtAppJSON          = 'application/json'
-$mtAppXML           = 'application/xml'
-$mtSparqlResultsTSV = 'application/sparql-results+tsv'
-$mtSparqlResultsCSV = 'application/sparql-results+csv'
-$mtSparqlUpdate     = 'application/sparql-update'
-$mtWWWForm          = 'application/x-www-form-urlencoded'
-$mtSparqlQuery      = "application/sparql-query" ;
-
-# Global media type table.
-$fileMediaTypes = {}
-$fileMediaTypes['ttl']   = $mtTurtle
-$fileMediaTypes['n3']    = 'text/n3; charset=utf-8'
-$fileMediaTypes['nt']    = $mtText
-$fileMediaTypes['rdf']   = $mtRDF
-$fileMediaTypes['owl']   = $mtRDF
-$fileMediaTypes['nq']    = $mtNQuads
-$fileMediaTypes['trig']  = $mtTriG
-$fileMediaTypes['json-ld']  = $mtJSONLD
-$fileMediaTypes['jsonld']  = $mtJSONLD
-
-# Global charset : no entry means "don't set"
-$charsetUTF8      = 'utf-8'
-$charset = {}
-$charset[$mtTurtle]   = 'utf-8'
-$charset[$mtText]     = 'ascii'
-$charset[$mtTriG]     = 'utf-8'
-$charset[$mtNQuads]   = 'utf-8'
-
-# Headers
-
-$hContentType         = 'Content-Type'
-# $hContentEncoding     = 'Content-Encoding'
-$hContentLength       = 'Content-Length'
-# $hContentLocation     = 'Content-Location'
-# $hContentRange        = 'Content-Range'
-
-$hAccept              = 'Accept'
-$hAcceptCharset       = 'Accept-Charset'
-$hAcceptEncoding      = 'Accept-Encoding'
-$hAcceptRanges        = 'Accept-Ranges' 
-
-$headers = { "User-Agent" => "#{SOH_NAME}/Fuseki #{SOH_VERSION}"}
-$print_http = false
-
-# Default for GET
-# At least allow anything (and hope!)
-$accept_rdf="#{$mtTurtle} , #{$mtNTriples};q=0.9 , #{$mtRDF};q=0.8 , #{$mtJSONLD};q=0.5"
-# Datasets
-$accept_ds="#{$mtTrig} , #{$mtNQuads};q=0.9 , #{$mtJSONLD};q=0.5"
-# For SPARQL query
-$accept_results="#{$mtSparqlResultsJ} , #{$mtSparqlResultsX};q=0.9 , #{$accept_rdf}"
-
-# Accept any in case of trouble.
-$accept_rdf="#{$accept_rdf} , */*;q=0.1"
-$accept_results="#{$accept_results} , */*;q=0.1" 
-
-# The media type usually forces the charset.
-$accept_charset=nil
-
-## Who we are.
-## Two styles:
-##    s-query .....
-##    soh query .....
-
-$cmd = File.basename($0)
-if $cmd == 'soh'
-then
-  $cmd = (ARGV.size == 0) ? 'soh' : ARGV.shift
-end
-
-if ! $cmd.start_with?('s-') && $cmd != 'soh'
-  $cmd = 's-'+$cmd
-end
-
-## -------- 
-
-def GET(dataset, graph)
-  print "GET #{dataset} #{graph}\n" if $verbose
-  requestURI = target(dataset, graph)
-  headers = {}
-  headers.merge!($headers)
-  headers[$hAccept] = $accept_rdf
-  headers[$hAcceptCharset] = $accept_charset unless $accept_charset.nil?
-  get_worker(requestURI, headers)
-end
-
-def get_worker(requestURI, headers)
-  uri = URI.parse(requestURI)
-  request = Net::HTTP::Get.new(uri.request_uri)
-  request.initialize_http_header(headers)
-  print_http_request(uri, request)
-  response_print_body(uri, request)
-end
-
-def HEAD(dataset, graph)
-  print "HEAD #{dataset} #{graph}\n" if $verbose
-  requestURI = target(dataset, graph)
-  headers = {}
-  headers.merge!($headers)
-  headers[$hAccept] = $accept_rdf
-  headers[$hAcceptCharset] = $accept_charset unless $accept_charset.nil?
-  uri = URI.parse(requestURI)
-  request = Net::HTTP::Head.new(uri.request_uri)
-  request.initialize_http_header(headers)
-  print_http_request(uri, request)
-  response_no_body(uri, request)
-end
-
-def PUT(dataset, graph, file)
-  print "PUT #{dataset} #{graph} #{file}\n" if $verbose
-  send_body(dataset, graph, file, Net::HTTP::Put)
-end
-
-def POST(dataset, graph, file)
-  print "POST #{dataset} #{graph} #{file}\n" if $verbose
-  send_body(dataset, graph, file, Net::HTTP::Post)
-end
-
-def DELETE(dataset, graph)
-  print "DELETE #{dataset} #{graph}\n" if $verbose
-  requestURI = target(dataset, graph)
-  uri = URI.parse(requestURI)
-  request = Net::HTTP::Delete.new(uri.request_uri)
-  headers = {}
-  headers.merge!($headers)
-  request.initialize_http_header(headers)
-  print_http_request(uri, request)
-  response_no_body(uri, request)
-end
-
-def uri_escape(string)
-  CGI.escape(string)
-end
-
-def target(dataset, graph)
-  return dataset+"?default" if graph == "default"
-  return dataset+"?graph="+uri_escape(graph)
-end
-
-def send_body(dataset, graph, file, method)
-  mt = content_type(file)
-  headers = {}
-  headers.merge!($headers)
-  headers[$hContentType] = mt
-  headers[$hContentLength] = File.size(file).to_s
-  ## p headers
-
-  requestURI = target(dataset, graph)
-  uri = URI.parse(requestURI)
-  
-  request = method.new(uri.request_uri)
-  request.initialize_http_header(headers)
-  print_http_request(uri, request)
-  request.body_stream = File.open(file)
-  response_no_body(uri, request)
-end
-
-def response_no_body(uri, request)
-  http = Net::HTTP::Proxy($proxy.host,$proxy.port).new(uri.host, uri.port)
-  http.read_timeout = nil
-  # check we can connect.
-  begin http.start
-  rescue Exception => e  
-    # puts e.message  
-    #puts e.backtrace.inspect  
-    warn_exit "Failed to connect: #{uri.host}:#{uri.port}: #{e.message}", 3
-  end
-  response = http.request(request)
-  print_http_response(response)
-  case response
-  when Net::HTTPSuccess, Net::HTTPRedirection
-    # OK
-  when Net::HTTPNotFound
-    warn_exit "404 Not found: #{uri}", 9
-    #print response.body
-  else
-    warn_exit "#{response.code} #{response.message} #{uri}", 9
-    # Unreachable
-      response.error!
-  end
-  # NO BODY IN RESPONSE
-end
-
-def response_print_body(uri, request)
-  http = Net::HTTP::Proxy($proxy.host,$proxy.port).new(uri.host, uri.port)
-  http.read_timeout = nil
-  # check we can connect.
-  begin http.start
-  rescue => e  
-    #puts e.backtrace.inspect  
-    #print e.class
-    warn_exit "Failed to connect: #{uri.host}:#{uri.port}: #{e.message}", 3
-  end
-
-  # Add a blank line if headers were output.
-  print "\n" if $http_print ;
-
-  begin
-    response = http.request(request) { |res| 
-      print_http_response(res)
-      #puts res.code
-      res.read_body do |segment|
-        print segment
-      end
-    }
-    case response
-    when Net::HTTPSuccess, Net::HTTPRedirection
-      # OK
-    when Net::HTTPNotFound
-      warn_exit "404 Not found: #{uri}", 9
-      #print response.body
-    else
-      warn_exit "#{response.code}: #{uri}", 9
-      # Unreachable
-      response.error!
-    end
-  rescue EOFError => e
-    warn_exit "IO Error: "+e.message, 3
-  end
-end
-
-def print_http_request(uri, request)
-  return unless $print_http
-  #print "Request\n"
-  print request.method," ",uri, "\n"
-  print_headers("  ",request)
-end
-
-def print_http_response(response)
-  return unless $print_http
-  #print "Response\n"
-  print response.code, " ", response.message, "\n"
-  print_headers("  ",response)
-end
-
-def print_headers(marker, headers)
-  headers.each do |k,v| 
-    k = k.split('-').map{|w| w.capitalize}.join('-')+':'
-    printf "%s%-20s %s\n",marker,k,v
-  end
-end
-
-def content_type(file)
-  file =~ /\.([^.]*)$/
-  ext = $1
-  mt = $fileMediaTypes[ext]
-  cs = $charset[mt]
-  mt = mt+';charset='+cs if ! cs.nil?
-  return mt
-end
-
-def charset(content_type)
-  return $charset[content_type]
-end
-
-def warn_exit(msg, rc)
-    warn msg
-    exit rc ;
-end
-
-def parseURI(uri_string)
-  begin
-    return URI.parse(uri_string).to_s
-  rescue URI::InvalidURIError => err
-    warn_exit "Bad URI: <#{uri_string}>", 2
-  end
-end
-
-## ---- Command
-
-def cmd_soh(command=nil)
-  ## Command line
-  options = {}
-  optparse = OptionParser.new do |opts|
-    # Set a banner, displayed at the top
-    # of the help screen.
-    case $cmd
-    when "s-http", "sparql-http", "soh"
-      banner="$cmd [get|post|put|delete] datasetURI graph [file]"
-    when "s-get", "s-head", "s-delete"
-      banner="$cmd  datasetURI graph"
-    end
-
-    opts.banner = $banner
-    # Define the options, and what they do
-    
-    options[:verbose] = false
-    opts.on( '-v', '--verbose', 'Verbose' ) do
-      options[:verbose] = true
-    end
-    
-    options[:version] = false
-    opts.on( '--version', 'Print version and exit' ) do
-      print "#{SOH_NAME} #{SOH_VERSION}\n"
-      exit
-    end
-    
-    # This displays the help screen, all programs are
-    # assumed to have this option.
-    opts.on( '-h', '--help', 'Display this screen and exit' ) do
-      puts opts
-      exit
-    end
-  end
-
-  begin optparse.parse!    
-  rescue OptionParser::InvalidArgument => e
-    warn e
-    exit
-  end
-
-  $verbose = options[:verbose]
-  $print_http = $verbose
-
-  if command.nil?
-    if ARGV.size == 0
-      warn "No command given: expected one of 'get', 'put', 'post', 'delete', 'query' or 'update'"
-      exit 1
-    end
-    cmdPrint=ARGV.shift
-    command=cmdPrint.upcase
-  else
-    cmdPrint=command
-  end
-
-  case command
-  when "HEAD", "GET", "DELETE"
-    requiredFile=false
-  when "PUT", "POST"
-    requiredFile=true
-  when "QUERY"
-    cmd_sparql_query
-  when "UPDATE"
-    cmd_sparql_update
-  else
-    warn_exit "Unknown command: #{command}", 2
-  end
-
-  if requiredFile 
-  then
-    if ARGV.size != 3
-      warn_exit "Required: dataset URI, graph URI (or 'default') and file", 1 
-    end
-  else
-    if ARGV.size != 2
-      warn_exit "Required: dataset URI and graph URI (or 'default')", 1 
-    end
-  end
-
-  dataset=parseURI(ARGV.shift)
-  # Relative URI?
-  graph=parseURI(ARGV.shift)
-  file=""
-  if requiredFile
-  then
-    file = ARGV.shift if requiredFile
-    if ! File.exist?(file)
-      warn_exit "No such file: "+file, 3
-    end
-    if File.directory?(file)
-      warn_exit "File is a directory: "+file, 3
-    end
-  end
-
-  case command
-  when "GET"
-    GET(dataset, graph)
-  when "HEAD"
-    HEAD(dataset, graph)
-  when "PUT"
-    PUT(dataset, graph, file)
-  when "DELETE"
-    DELETE(dataset, graph)
-  when "POST"
-    POST(dataset, graph, file)
-  else
-    warn_exit "Internal error: Unknown command: #{cmd}", 2
-  end
-  exit 0
-end
-
-## --------
-def string_or_file(arg)
-  return arg if ! arg.match(/^@/)
-  a=(arg[1..-1])
-  open(a, 'rb'){|f| f.read}
-end
-
-## -------- SPARQL Query
-
-## Choose method
-def SPARQL_query(service, query, query_file, forcePOST=false, args2={})
-   if ! query_file.nil?
-    query = open(query_file, 'rb'){|f| f.read}
-  end
-  if forcePOST || query.length >= 2*1024 
-    SPARQL_query_POST(service, query, args2)
-  else
-    SPARQL_query_GET(service, query, args2)
-  end
-end
-
-## By GET
-
-def SPARQL_query_GET(service, query, args2)
-  args = { "query" => query }
-  args.merge!(args2)
-  qs=args.collect { |k,v| "#{k}=#{uri_escape(v)}" }.join('&')
-  action="#{service}?#{qs}"
-  headers={}
-  headers.merge!($headers)
-  headers[$hAccept]=$accept_results
-  get_worker(action, headers)
-end
-
-## By POST
-
-def SPARQL_query_POST(service, query, args2)
-  # DRY - body/no body for each of request and response.
-  post_params={ "query" => query }
-  post_params.merge!(args2)
-  uri = URI.parse(service)
-  headers={}
-  headers.merge!($headers)
-  headers[$hAccept]=$accept_results
-  execute_post_form_body(uri, headers, post_params)
-end
-
-def execute_post_form_body(uri, headers, post_params)
-  request = Net::HTTP::Post.new(uri.request_uri)
-  qs=post_params.collect { |k,v| "#{k}=#{uri_escape(v)}" }.join('&')
-  headers[$hContentType] = $mtWWWForm
-  headers[$hContentLength] = qs.length.to_s
-  request.initialize_http_header(headers)
-  request.body = qs
-  print_http_request(uri, request)
-  response_print_body(uri, request)
-end
-
-# Usage: -v --help --file= --query=
-def cmd_sparql_query
-  options={}
-  optparse = OptionParser.new do |opts|
-    opts.banner = "Usage: #{$cmd} [--query QUERY] [--service URI] [--post] 'query' | @file"
-    opts.on('--service=URI', '--server=URI', 'SPARQL endpoint') do |uri|
-      options[:service]=uri
-    end
-    opts.on('--query=FILE','--file=FILE', 'Take query from a file') do |file|
-      options[:file]=file
-    end
-    opts.on('--output=TYPE', [:json,:xml,:text,:csv,:tsv],
-            'Set the output argument') do |type|
-      options[:output]=type
-    end
-    opts.on('--accept=TYPE', [:json,:xml,:text,:csv,:tsv], 
-            'Set the accept header type') do |type|
-      options[:accept]=type
-    end
-    options[:verbose] = false
-    opts.on( '--post', 'Force use of POST' ) do
-      options[:post] = true
-    end
-    opts.on( '-v', '--verbose', 'Verbose' ) do
-      options[:verbose] = true
-    end
-    opts.on( '--version', 'Print version and exit' ) do
-      print "#{SOH_NAME} #{SOH_VERSION}\n"
-      exit
-    end 
-    opts.on( '-h', '--help', 'Display this screen and exit' ) do
-      puts opts
-      exit
-    end
-  end
-
-  begin optparse.parse!    
-  rescue OptionParser::InvalidArgument, OptionParser::InvalidOption => e
-    warn e
-    exit 1
-  end
-
-  $verbose = options[:verbose]
-  $print_http = $verbose
-  usePOST = options[:post]
-
-  service = options[:service]
-  warn_exit 'No service specified.  Required --service=URI',1 if service.nil?
-
-  # Query
-  query=nil
-  query_file=options[:file]
-  if query_file.nil? && ARGV.size == 0
-  then
-    warn_exit 'No query specified.',1
-    end
-  if query_file.nil?
-    query = ARGV.shift
-    if query.match(/^@/)
-      query_file = query[1..-1]
-      query = nil
-    end
-  end
-
-  # --output ==> output= (non-standard)
-  args={}
-  case options[:output]
-  when nil
-  when  "json","xml","text","csv","tsv"
-    args['output'] = options[:output]
-  when :json,:xml,:text,:csv,:tsv
-    args['output'] = options[:output].to_s
-  else
-    warn_exit "Unrecognized output type: "+options[:output],2
-  end
-
-  # --accept
-  # options[:accept]
-
-  print "SPARQL #{service}\n" if $verbose
-  #args={"output"=>"text"}
-  SPARQL_query(service, query, query_file, usePOST, args)
-  exit(0)
-end
-
-## -------- SPARQL Update
-
-# Update sent as a WWW form.
-def SPARQL_update_by_form(service, update, args2={})
-  args = {}
-  args.merge!(args2)
-  headers={}
-  headers.merge!($headers)
-  # args? encode?
-  body="update="+uri_escape(update)
-  headers[$hContentType] = $mtWWWForm
-  headers[$hContentLength] = body.length.to_s
-  uri = URI.parse(service)
-  execute_post_form(uri, headers, body)
-end
-
-# DRY - query form.
-def execute_post_form(uri, headers, body)
-  request = Net::HTTP::Post.new(uri.request_uri)
-  request.initialize_http_header(headers)
-  request.body = body
-  print_http_request(uri, request)
-  response_no_body(uri, request)
-end
-
-def SPARQL_update(service, update, args2={})
-  args = {}
-  args.merge!(args2)
-  headers={}
-  headers.merge!($headers)
-  headers[$hContentType] = $mtSparqlUpdate
-  uri = URI.parse(service)
-  request = Net::HTTP::Post.new(uri.request_uri)
-  request.initialize_http_header(headers)
-  request.body = update
-  print_http_request(uri, request)
-  response_no_body(uri, request)
-end
-
-def cmd_sparql_update(by_raw_post=true)
-  # Share with cmd_sparql_query
-  options={}
-  optparse = OptionParser.new do |opts|
-    opts.banner = "Usage: #{$cmd} [--file REQUEST] [--service URI] 'request' | @file"
-    opts.on('--service=URI', '--server=URI', 'SPARQL endpoint') do |uri|
-      options[:service]=uri
-    end
-    opts.on('--update=FILE', '--file=FILE', 'Take update from a file') do |file|
-      options[:file]=file
-    end
-    options[:verbose] = false
-    opts.on( '-v', '--verbose', 'Verbose' ) do
-      options[:verbose] = true
-    end
-    opts.on( '--version', 'Print version and exit' ) do
-      print "#{SOH_NAME} #{SOH_VERSION}\n"
-      exit
-    end 
-    opts.on( '-h', '--help', 'Display this screen and exit' ) do
-      puts opts
-      exit
-    end
-  end
-
-  begin optparse.parse!    
-  rescue OptionParser::InvalidArgument => e
-    warn e
-    exit
-  end
-
-  $verbose = options[:verbose]
-  $print_http = $verbose
-
-  service = options[:service]
-  warn_exit 'No service specified. Required --service=URI',1   if service.nil?
-  
-  update=nil
-  update_file=options[:file]
-
-  if update_file.nil? && ARGV.size == 0
-  then
-    warn_exit 'No update specified.',1
-    end
-  if update_file.nil?
-    update = ARGV.shift
-    if update.match(/^@/)
-      update_file = update[1..-1]
-      update = nil
-    end
-  end
-  
-  print "SPARQL-Update #{service}\n" if $verbose
-  args={}
-
-  # Reads in the file :-(
-  if update.nil?
-  then
-    update = open(update_file, 'rb'){|f| f.read}
-  else
-    update = string_or_file(update)
-  end
-
-  if by_raw_post
-    SPARQL_update(service, update, args)
-  else
-    SPARQL_update_by_form(service, update, args)
-  end
-  exit(0)
-end
-
-## -------
-
-case $cmd
-when "s-http", "sparql-http", "soh"
-  $banner="#{$cmd} [get|post|put|delete] datasetURI graph [file]"
-  cmd_soh
-when "s-get", "s-head", "s-put", "s-delete", "s-post"
-
-  case $cmd
-  when "s-get", "s-head", "s-delete"
-    $banner="#{$cmd} datasetURI graph"
-  when "s-put", "s-post"
-    $banner="#{$cmd} datasetURI graph file"
-  end
-  cmd2 = $cmd.sub(/^s-/, '').upcase
-  cmd_soh cmd2
-
-when "s-query", "sparql-query"
-  cmd_sparql_query
-when "s-update", "sparql-update"
-  cmd_sparql_update true
-when "s-update-form", "sparql-update-form"
-  cmd_sparql_update false
-else 
-  warn_exit "Unknown: "+$cmd, 1
-end


[16/23] jena git commit: Rename folder jena-fuseki to jena-fuseki1

Posted by an...@apache.org.
http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/main/java/org/apache/jena/fuseki/FusekiNotFoundException.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/main/java/org/apache/jena/fuseki/FusekiNotFoundException.java b/jena-fuseki/src/main/java/org/apache/jena/fuseki/FusekiNotFoundException.java
deleted file mode 100644
index be9be90..0000000
--- a/jena-fuseki/src/main/java/org/apache/jena/fuseki/FusekiNotFoundException.java
+++ /dev/null
@@ -1,26 +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.fuseki;
-
-import org.apache.jena.web.HttpSC ;
-
-public class FusekiNotFoundException extends FusekiRequestException
-{
-    public FusekiNotFoundException(String msg)    { super(HttpSC.NOT_FOUND_404, msg) ; }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/main/java/org/apache/jena/fuseki/FusekiRequestException.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/main/java/org/apache/jena/fuseki/FusekiRequestException.java b/jena-fuseki/src/main/java/org/apache/jena/fuseki/FusekiRequestException.java
deleted file mode 100644
index e197be2..0000000
--- a/jena-fuseki/src/main/java/org/apache/jena/fuseki/FusekiRequestException.java
+++ /dev/null
@@ -1,57 +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.fuseki;
-
-import org.apache.jena.web.HttpSC ;
-
-
-public class FusekiRequestException extends FusekiException
-{
-    public static FusekiRequestException create(int code, String msg)
-    {
-        if ( code == HttpSC.NOT_FOUND_404 )
-            return new FusekiNotFoundException(msg) ;
-        return new FusekiRequestException(code, msg) ;
-    }
-    
-    private final int statusCode ;
-    private final String responseMessage ;
-    protected FusekiRequestException(int code, String msg)
-    {
-        super(msg) ;
-        this.statusCode = code ;
-        responseMessage = msg ;
-    }
-    
-    public int getStatusCode()
-    {
-        return statusCode ;
-    }
-
-    public String getResponseMessage()
-    {
-        return responseMessage ;
-    }
-
-    @Override
-    public String toString()
-    {
-        return "HTTP: "+statusCode+" "+getMessage() ;
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/main/java/org/apache/jena/fuseki/HttpNames.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/main/java/org/apache/jena/fuseki/HttpNames.java b/jena-fuseki/src/main/java/org/apache/jena/fuseki/HttpNames.java
deleted file mode 100644
index 65d73c7..0000000
--- a/jena-fuseki/src/main/java/org/apache/jena/fuseki/HttpNames.java
+++ /dev/null
@@ -1,94 +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.fuseki;
-
-public class HttpNames
-{
-    // Request
-    public static final String hAccept              = "Accept" ;
-    public static final String hAcceptEncoding      = "Accept-Encoding" ;
-    public static final String hAcceptCharset       = "Accept-Charset" ;
-    //public static final String hAcceptLanguage      = "Accept-Language" ;
-
-    // Response
-    public static final String xhAcceptRanges        = "Accept-Ranges" ;
-    public static final String hAllow               = "Allow" ;
-    public static final String hContentEncoding     = "Content-Encoding" ;
-    public static final String hContentLengh        = "Content-Length" ;
-    public static final String hContentLocation     = "Content-Location" ;
-    public static final String hContentRange        = "Content-Range" ;
-    public static final String hContentType         = "Content-Type" ;
-    public static final String hRetryAfter          = "Retry-After" ;
-    public static final String hServer              = "Server" ;
-    public static final String hLocation            = "Location" ; 
-    public static final String hVary                = "Vary" ;
-    public static final String charset              = "charset" ;
-    
-    // CORS: 
-    //   http://www.w3.org/TR/cors/  http://esw.w3.org/CORS_Enabled
-    public static final String hAccessControlAllowOrigin  = "Access-Control-Allow-Origin" ;
-    public static final String hAccessControlAllowHeaders = "Access-Control-Allow-Headers" ;
-    
-    // Fuseki parameter names 
-    public static final String paramGraph           = "graph" ;
-    public static final String paramGraphDefault    = "default" ;
-
-    public static final String paramQuery           = "query" ;
-    public static final String paramQueryRef        = "query-ref" ;
-    public static final String paramDefaultGraphURI = "default-graph-uri" ;
-    public static final String paramNamedGraphURI   = "named-graph-uri" ;
-    
-    public static final String paramStyleSheet      = "stylesheet" ;
-    public static final String paramAccept          = "accept" ;
-    public static final String paramOutput1         = "output" ;        // See Yahoo! developer: http://developer.yahoo.net/common/json.html 
-    public static final String paramOutput2         = "format" ;        // Alternative name 
-    public static final String paramCallback        = "callback" ;
-    public static final String paramForceAccept     = "force-accept" ;  // Force the accept header at the last moment
-    public static final String paramTimeout         = "timeout" ;
-    
-    public static final String paramUpdate          = "update" ;
-    public static final String paramRequest         = "request" ; 
-    public static final String paramUsingGraphURI        = "using-graph-uri" ;
-    public static final String paramUsingNamedGraphURI   = "using-named-graph-uri" ;
-    
-    public static final String METHOD_DELETE        = "DELETE";
-    public static final String METHOD_HEAD          = "HEAD";
-    public static final String METHOD_GET           = "GET";
-    public static final String METHOD_OPTIONS       = "OPTIONS";
-    public static final String METHOD_PATCH         = "PATCH" ;
-    public static final String METHOD_POST          = "POST";
-    public static final String METHOD_PUT           = "PUT";
-    public static final String METHOD_TRACE         = "TRACE";
-
-    public static final String HEADER_IFMODSINCE    = "If-Modified-Since";
-    public static final String HEADER_LASTMOD       = "Last-Modified";
-    
-    // Names for services in the default configuration
-    public static final String ServiceQuery         = "query" ;
-    public static final String ServiceQueryAlt      = "sparql" ;
-    public static final String ServiceUpdate        = "update" ;
-    public static final String ServiceData          = "data" ;
-    public static final String ServiceUpload        = "upload" ;
-    public static final String ServiceGeneralQuery  = "/sparql" ;
-    
-    // Posisble values of fields.
-    // TODO Pull in from results writer.
-    public static final String valueDefault    = "default" ;
-    
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/main/java/org/apache/jena/fuseki/Test.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/main/java/org/apache/jena/fuseki/Test.java b/jena-fuseki/src/main/java/org/apache/jena/fuseki/Test.java
deleted file mode 100644
index b4f5fed..0000000
--- a/jena-fuseki/src/main/java/org/apache/jena/fuseki/Test.java
+++ /dev/null
@@ -1,25 +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.fuseki;
-
-public class Test
-{
-    public static void init() { System.out.println("INIT called") ; }
-}
-

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/main/java/org/apache/jena/fuseki/conneg/ConNeg.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/main/java/org/apache/jena/fuseki/conneg/ConNeg.java b/jena-fuseki/src/main/java/org/apache/jena/fuseki/conneg/ConNeg.java
deleted file mode 100644
index b448c6c..0000000
--- a/jena-fuseki/src/main/java/org/apache/jena/fuseki/conneg/ConNeg.java
+++ /dev/null
@@ -1,205 +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.fuseki.conneg;
-
-import static org.apache.jena.fuseki.HttpNames.hAcceptCharset ;
-
-import javax.servlet.http.HttpServletRequest ;
-
-import org.apache.jena.atlas.web.AcceptList ;
-import org.apache.jena.atlas.web.MediaRange ;
-import org.apache.jena.atlas.web.MediaType ;
-import org.slf4j.Logger ;
-import org.slf4j.LoggerFactory ;
-
-/**
- * <p>Content negotiation is a mechanism defined in the HTTP specification
- * that makes it possible to serve different versions of a document
- * (or more generally, a resource representation) at the same URI, so that
- * user agents can specify which version fit their capabilities the best.</p>
- *
- * <p>ConNeg is used in Fuseki to help matching the content media type requested
- * by the user, against the list of offered media types.</p>
- *
- * @see <a href="http://en.wikipedia.org/wiki/Content_negotiation">http://en.wikipedia.org/wiki/Content_negotiation</a>
- * @see <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1">http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1</a>
- */
-public class ConNeg
-{
-    private static Logger log = LoggerFactory.getLogger(ConNeg.class) ;
-    // See riot.ContentNeg (client side).
-    // http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1
-
-    /**
-     * Parses the content type. It splits the string by semi-colon and finds the
-     * other features such as the "q" quality factor.  For a complete documentation
-     * on how the parsing happens, see
-     * <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1">http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1</a>.
-     *
-     * @param contentType content type string
-     * @return parsed media type
-     */
-    static public MediaType parse(String contentType)
-    {
-        try {
-            return MediaType.create(contentType) ;
-        } catch (RuntimeException ex) { return null ; }
-    }
-
-    /**
-     * <p>Creates a {@link AcceptList} with the given HTTP header string and
-     * uses the {@link AcceptList#match(MediaType)} method to decide which
-     * media type matches the HTTP header string.</p>
-     *
-     * <p>The <em>q</em> quality factor is used to decide which choice is the best
-     * match.</p>
-     *
-     * @param headerString HTTP header string
-     * @param offerList accept list
-     * @return matched media type
-     */
-    static public MediaType match(String headerString, AcceptList offerList)
-    {
-        AcceptList l = new AcceptList(headerString) ;
-        return AcceptList.match(l, offerList) ;
-    }
-
-    /**
-     * Match a single media type against a header string.
-     *
-     * @param headerString HTTP header string
-     * @param mediaRangeStr Semi-colon separated list of media types
-     * @return the matched media type or <code>null</code> if there was no match
-     */
-    public static String match(String headerString, String mediaRangeStr)
-    {
-        AcceptList l = new AcceptList(headerString) ;
-        MediaRange aItem = new MediaRange(mediaRangeStr) ;  // MediaType
-        MediaType m = l.match(aItem) ;
-        if ( m == null )
-            return null ;
-        return m.toHeaderString() ;
-    }
-
-    /**
-     * Split and trims a string using a given regex.
-     *
-     * @param s string
-     * @param splitStr given regex
-     * @return an array with the trimmed strings found
-     */
-    /*package*/ static String[] split(String s, String splitStr)
-    {
-        String[] x = s.split(splitStr,2) ;
-        for ( int i = 0 ; i < x.length ; i++ )
-        {
-            x[i] = x[i].trim() ;
-        }
-        return x ;
-    }
-
-    /**
-     * <p>Chooses the charset by using the Accept-Charset HTTP header.</p>
-     *
-     * <p>See {@link ConNeg#choose(String, AcceptList, MediaType)}.</p>
-     *
-     * @param httpRequest HTTP request
-     * @param myPrefs accept list
-     * @param defaultMediaType default media type
-     * @return media type chosen
-     */
-    public static MediaType chooseCharset(HttpServletRequest httpRequest,
-                                          AcceptList myPrefs,
-                                          MediaType defaultMediaType)
-    {
-        String a = httpRequest.getHeader(hAcceptCharset) ;
-        if ( log.isDebugEnabled() )
-            log.debug("Accept-Charset request: "+a) ;
-        
-        MediaType item = choose(a, myPrefs, defaultMediaType) ;
-        
-        if ( log.isDebugEnabled() )
-            log.debug("Charset chosen: "+item) ;
-    
-        return item ;
-    }
-
-    /**
-     * <p>Choose the content media type by extracting the Accept HTTP header from
-     * the HTTP request and choosing
-     * (see {@link ConNeg#choose(String, AcceptList, MediaType)}) a content media
-     * type that matches the header.</p>
-     *
-     * @param httpRequest HTTP request
-     * @param myPrefs accept list
-     * @param defaultMediaType default media type
-     * @return media type chosen
-     */
-    public static MediaType chooseContentType(HttpServletRequest httpRequest,
-                                              AcceptList myPrefs,
-                                              MediaType defaultMediaType)
-    {
-        String a = WebLib.getAccept(httpRequest) ;
-        if ( log.isDebugEnabled() )
-            log.debug("Accept request: "+a) ;
-        
-        MediaType item = choose(a, myPrefs, defaultMediaType) ;
-    
-        if ( log.isDebugEnabled() )
-            log.debug("Content type chosen: "+item) ;
-    
-        return item ;
-    }
-
-    /**
-     * <p>This method receives a HTTP header string, an {@link AcceptList} and a
-     * default {@link MediaType}.</p>
-     *
-     * <p>If the header string is null, it returns the given default MediaType.</p>
-     *
-     * <p>Otherwise it builds an {@link AcceptList} object with the header string
-     * and uses it to match against the given MediaType.</p>
-     *
-     * @param headerString HTTP header string
-     * @param myPrefs accept list
-     * @param defaultMediaType default media type
-     * @return a media type or <code>null</code> if none matched or if the
-     *          HTTP header string and the default media type are <code>null</code>.
-     */
-    private static MediaType choose(String headerString, AcceptList myPrefs,
-                                    MediaType defaultMediaType)
-    {
-        if ( headerString == null )
-            return defaultMediaType ;
-        
-        AcceptList headerList = new AcceptList(headerString) ;
-        
-        if ( myPrefs == null )
-        {
-            MediaType i = headerList.first() ;
-            if ( i == null ) return defaultMediaType ;
-            return i ;
-        }
-    
-        MediaType i = AcceptList.match(headerList, myPrefs) ;
-        if ( i == null )
-            return defaultMediaType ;
-        return i ;
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/main/java/org/apache/jena/fuseki/conneg/WebLib.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/main/java/org/apache/jena/fuseki/conneg/WebLib.java b/jena-fuseki/src/main/java/org/apache/jena/fuseki/conneg/WebLib.java
deleted file mode 100644
index fdeb139..0000000
--- a/jena-fuseki/src/main/java/org/apache/jena/fuseki/conneg/WebLib.java
+++ /dev/null
@@ -1,60 +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.fuseki.conneg;
-
-import java.util.Enumeration ;
-
-import javax.servlet.http.HttpServletRequest ;
-
-import org.apache.jena.fuseki.HttpNames ;
-
-public class WebLib
-{
-    /** Split a string, removing whitespace around the split string.
-     * e.g. Use in splitting HTTP accept/content-type headers.  
-     */
-    public static String[] split(String s, String splitStr)
-    {
-        String[] x = s.split(splitStr,2) ;
-        for ( int i = 0 ; i < x.length ; i++ )
-        {
-            x[i] = x[i].trim() ;
-        }
-        return x ;
-    }
-
-    /** Migrate to WebLib */
-    public static String getAccept(HttpServletRequest httpRequest)
-    {
-        // There can be multiple accept headers -- note many tools don't allow these to be this way (e.g. wget, curl)
-        Enumeration<String> en = httpRequest.getHeaders(HttpNames.hAccept) ;
-        if ( ! en.hasMoreElements() )
-            return null ;
-        StringBuilder sb = new StringBuilder() ;
-        String sep = "" ;
-        for ( ; en.hasMoreElements() ; )
-        {
-            String x = en.nextElement() ;
-            sb.append(sep) ;
-            sep = ", " ;
-            sb.append(x) ;
-        }
-        return sb.toString() ;
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/main/java/org/apache/jena/fuseki/mgt/ActionBackup.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/main/java/org/apache/jena/fuseki/mgt/ActionBackup.java b/jena-fuseki/src/main/java/org/apache/jena/fuseki/mgt/ActionBackup.java
deleted file mode 100644
index c36e8be..0000000
--- a/jena-fuseki/src/main/java/org/apache/jena/fuseki/mgt/ActionBackup.java
+++ /dev/null
@@ -1,196 +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.fuseki.mgt ;
-
-import static java.lang.String.format ;
-
-import java.io.* ;
-import java.util.concurrent.Callable ;
-import java.util.concurrent.ExecutorService ;
-import java.util.concurrent.Executors ;
-import java.util.zip.GZIPOutputStream ;
-
-import javax.servlet.http.HttpServletRequest ;
-import javax.servlet.http.HttpServletResponse ;
-
-import org.apache.jena.atlas.io.IO ;
-import org.apache.jena.atlas.lib.FileOps ;
-import org.apache.jena.atlas.logging.Log ;
-import org.apache.jena.fuseki.FusekiException ;
-import org.apache.jena.fuseki.FusekiLib ;
-import org.apache.jena.fuseki.server.DatasetRef ;
-import org.apache.jena.fuseki.server.DatasetRegistry ;
-import org.apache.jena.fuseki.servlets.HttpAction ;
-import org.apache.jena.fuseki.servlets.ServletBase ;
-import org.apache.jena.riot.Lang ;
-import org.apache.jena.riot.RDFDataMgr ;
-import org.apache.jena.web.HttpSC ;
-
-import com.hp.hpl.jena.sparql.core.DatasetGraph ;
-import com.hp.hpl.jena.sparql.util.Utils ;
-
-public class ActionBackup extends ServletBase
-{
-    public ActionBackup() { super() ; }
-
-    // Limit to one backup at a time.
-    public static final ExecutorService backupService = Executors.newFixedThreadPool(1) ;
-    
-    @Override
-    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException
-    {
-        String dataset = FusekiLib.safeParameter(request, "dataset") ;
-        if ( dataset == null )
-        {
-            response.sendError(HttpSC.BAD_REQUEST_400, "Required parameter missing: ?dataset=") ;
-            return ;
-        }
-        
-        if ( ! dataset.startsWith("/") )
-            dataset="/"+dataset ;
-        
-        // HttpSession session = request.getSession(true) ;
-        // session.setAttribute("dataset", dataset) ;
-        // session.setMaxInactiveInterval(15*60) ; // 10 mins
-
-        boolean known = DatasetRegistry.get().isRegistered(dataset) ;
-        if (!known)
-        {
-            response.sendError(HttpSC.BAD_REQUEST_400, "No such dataset: " + dataset) ;
-            return ;
-        }
-        
-        long id = allocRequestId(request, response);
-        HttpAction action = new HttpAction(id, request, response, false) ;
-        DatasetRef ref = DatasetRegistry.get().get(dataset) ;
-        action.setDataset(ref);
-        scheduleBackup(action) ;
-    }
-
-    static final String BackupArea = "backups" ;  
-    
-    private void scheduleBackup(final HttpAction action)
-    {
-        String dsName = action.dsRef.name ;
-        final String ds = dsName.startsWith("/")? dsName : "/"+dsName ;
-        
-        String timestamp = Utils.nowAsString("yyyy-MM-dd_HH-mm-ss") ;
-        final String filename = BackupArea + ds + "_" + timestamp ;
-        FileOps.ensureDir(BackupArea) ;
-        
-        try {
-            final Callable<Boolean> task = new Callable<Boolean>() {
-                @Override
-                public Boolean call() throws Exception
-                {
-                    log.info(format("[%d] Start backup %s to '%s'", action.id, ds, filename)) ;
-                    action.beginRead() ;
-                    try {
-                        backup(action.getActiveDSG(), filename) ;
-                        log.info(format("[%d] Finish backup %s to '%s'", action.id, ds, filename)) ;
-                    }
-                    catch ( RuntimeException ex )
-                    {
-                        log.info(format("[%d] Exception during backup: ", action.id, ex.getMessage()), ex) ;
-                        return Boolean.FALSE ;
-                    }
-                    finally {
-                        action.endRead() ;
-                    }
-                    return Boolean.TRUE ;
-                }} ;
-            
-            log.info(format("[%d] Schedule backup %s to '%s'", action.id, ds, filename)) ;                
-            backupService.submit(task) ;
-        } 
-        //catch (FusekiException ex)
-        catch (RuntimeException ex)
-        {
-            log.warn("Unanticipated exception", ex) ;
-            try { action.response.sendError(HttpSC.INTERNAL_SERVER_ERROR_500, ex.getMessage()) ; }
-            catch (IOException e) { IO.exception(e) ; }
-            return ;            
-        }
-        
-        successPage(action, "Backup scheduled - see server log for details") ;
-    }
-    
-    // Share with new ServletBase.
-    protected static void successPage(HttpAction action, String message)
-    {
-        try {
-            action.response.setContentType("text/html");
-            action.response.setStatus(HttpSC.OK_200);
-            PrintWriter out = action.response.getWriter() ;
-            out.println("<html>") ;
-            out.println("<head>") ;
-            out.println("</head>") ;
-            out.println("<body>") ;
-            out.println("<h1>Success</h1>");
-            if ( message != null )
-            {
-                out.println("<p>") ;
-                out.println(message) ;
-                out.println("</p>") ;
-            }
-            out.println("</body>") ;
-            out.println("</html>") ;
-            out.flush() ;
-        } catch (IOException ex) { IO.exception(ex) ; }
-    }
-    
-    public static void backup(DatasetGraph dsg, String backupfile)
-    {
-        if ( ! backupfile.endsWith(".nq") )
-            backupfile = backupfile+".nq" ;
-        
-        OutputStream out = null ;
-        try
-        {
-            if ( true )
-            {
-                // This seems to achive about the same as "gzip -6"
-                // It's not too expensive in elapsed time but it's not zero cost.
-                // GZip, large buffer.
-                out = new FileOutputStream(backupfile+".gz") ;
-                out = new GZIPOutputStream(out, 8*1024) ;
-                out = new BufferedOutputStream(out) ;
-            }
-            else
-            {
-                out = new FileOutputStream(backupfile) ;
-                out = new BufferedOutputStream(out) ;
-            }
-            
-            RDFDataMgr.write(out, dsg,Lang.NQUADS) ;
-            out.close() ;
-            out = null ;
-        } 
-        catch (FileNotFoundException e)
-        {
-            Log.warn(ActionBackup.class, "File not found: "+backupfile) ;
-            throw new FusekiException("File not found: "+backupfile) ;
-        } 
-        catch (IOException e) { IO.exception(e) ; }
-        finally {
-            try { if (out != null) out.close() ; }
-            catch (IOException e) { /* ignore */ }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/main/java/org/apache/jena/fuseki/mgt/ActionDataset.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/main/java/org/apache/jena/fuseki/mgt/ActionDataset.java b/jena-fuseki/src/main/java/org/apache/jena/fuseki/mgt/ActionDataset.java
deleted file mode 100644
index fc3d395..0000000
--- a/jena-fuseki/src/main/java/org/apache/jena/fuseki/mgt/ActionDataset.java
+++ /dev/null
@@ -1,121 +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.fuseki.mgt;
-
-import java.io.IOException ;
-import java.io.UnsupportedEncodingException ;
-
-import javax.servlet.ServletOutputStream ;
-import javax.servlet.http.HttpServlet ;
-import javax.servlet.http.HttpServletRequest ;
-import javax.servlet.http.HttpServletResponse ;
-import javax.servlet.http.HttpSession ;
-
-import org.apache.commons.codec.binary.Base64 ;
-import org.apache.jena.fuseki.FusekiLib ;
-import org.apache.jena.fuseki.HttpNames ;
-import org.apache.jena.fuseki.server.DatasetRegistry ;
-import org.apache.jena.web.HttpSC ;
-
-/** Log-in and choose dataset */
-public class ActionDataset extends HttpServlet
-{
-    @Override
-    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException
-    {
-//        request.getRemoteUser() ;
-//        request.getUserPrincipal() ;
-        
-        String dataset = FusekiLib.safeParameter(request, "dataset") ;
-        HttpSession session = request.getSession(true) ;
-        session.setAttribute("dataset", dataset) ;
-        session.setMaxInactiveInterval(15*60) ; // 10 mins
-        
-        boolean known = DatasetRegistry.get().isRegistered(dataset) ;
-        if ( !known )
-        {
-            response.sendError(HttpSC.BAD_REQUEST_400, "No such dataset: "+dataset) ;
-            return ;
-        }
-        
-        if ( true )
-        {
-            // Redirect to GET page.
-            response.setHeader(HttpNames.hLocation, PageNames.pageAfterLogin) ;
-            response.setStatus(HttpSC.SEE_OTHER_303) ;
-        }
-        else
-        {
-            // Welcome style - but HTML inline :-(
-            response.setContentType("text/html");
-            response.setStatus(HttpSC.OK_200) ;
-            ServletOutputStream out = response.getOutputStream() ;
-            out.print("<p>"+dataset+"("+known+")</p>") ;
-
-            for ( String name : DatasetRegistry.get().keys() ) {
-                out.print("<li>") ;
-                out.print(name) ;
-                out.println("</li>") ;
-            }
-            out.println("</ul>") ;
-            out.println("<p><a href=\"info\">Next</a></p>") ;
-        }
-        
-//        Cookie cookie = new Cookie("org.apache.jena.fuseki.session", dataset) ;
-//        // 24 hours.
-//        cookie.setMaxAge(24*60*60) ;
-        
-    }
-    
-    /**
-     * This method returns true if the HttpServletRequest contains a valid
-     * authorisation header
-     * @param req The HttpServletRequest to test
-     * @return true if the Authorisation header is valid
-     */
-
-    private boolean authenticate(HttpServletRequest req)
-    {
-        String authhead=req.getHeader("Authorization");
-
-        if(authhead!=null)
-        {
-            byte[] up = Base64.decodeBase64(authhead.substring(6)) ;
-            // Decode the authorisation String
-            String usernpass ;
-            try
-            {
-                usernpass = new String(up, "ascii") ;
-            } catch (UnsupportedEncodingException e)
-            {
-                e.printStackTrace();
-                usernpass = null ;
-            }
-            // Split the username from the password
-            String user=usernpass.substring(0,usernpass.indexOf(":"));
-            String password=usernpass.substring(usernpass.indexOf(":")+1);
-
-            if (user.equals("user") && password.equals("pass"))
-                return true;
-        }
-
-        return false;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/main/java/org/apache/jena/fuseki/mgt/ManagementServer.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/main/java/org/apache/jena/fuseki/mgt/ManagementServer.java b/jena-fuseki/src/main/java/org/apache/jena/fuseki/mgt/ManagementServer.java
deleted file mode 100644
index 5e9dca9..0000000
--- a/jena-fuseki/src/main/java/org/apache/jena/fuseki/mgt/ManagementServer.java
+++ /dev/null
@@ -1,99 +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.fuseki.mgt;
-
-import static org.apache.jena.fuseki.Fuseki.serverLog ;
-
-import java.util.List ;
-
-import javax.servlet.http.HttpServlet ;
-
-import org.apache.jena.fuseki.Fuseki ;
-import org.apache.jena.fuseki.server.FusekiErrorHandler ;
-import org.apache.jena.fuseki.servlets.DumpServlet ;
-import org.eclipse.jetty.server.Connector ;
-import org.eclipse.jetty.server.Server ;
-import org.eclipse.jetty.server.nio.SelectChannelConnector ;
-import org.eclipse.jetty.servlet.ServletContextHandler ;
-import org.eclipse.jetty.servlet.ServletHolder ;
-
-public class ManagementServer
-{
-    public static Server createManagementServer(int mgtPort)
-    {
-        Fuseki.serverLog.info("Adding management functions") ;
-        
-        // Separate Jetty server
-        Server server = new Server() ;
-        
-//        BlockingChannelConnector bcConnector = new BlockingChannelConnector() ;
-//        bcConnector.setUseDirectBuffers(false) ;
-//        Connector connector = bcConnector ;
-        
-        Connector connector = new SelectChannelConnector() ;
-        // Ignore idle time. 
-        // If set, then if this goes off, it keeps going off and you get a lot of log messages.
-        connector.setMaxIdleTime(0) ; // Jetty outputs a lot of messages if this goes off.
-        connector.setPort(mgtPort);
-        server.addConnector(connector) ;
-        
-        ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
-        context.setErrorHandler(new FusekiErrorHandler()) ;
-        server.setHandler(context);
-        
-        // Add the server control servlet
-        addServlet(context, new MgtCmdServlet(),    "/mgt") ;
-        addServlet(context, new DumpServlet(),      "/dump") ;
-        addServlet(context, new StatsServlet(),     "/stats") ;
-        addServlet(context, new PingServlet(),      "/ping") ;
-        
-        return server ; 
-        // Old plan
-//      // Development : server control panel.
-//      addServlet(context, new ServerServlet(), "/server") ;
-//      addServlet(context, new ActionBackup(), "/backup") ;
-    }
-
-    // SHARE
-    private static void addServlet(ServletContextHandler context, String datasetPath, HttpServlet servlet, List<String> pathSpecs)
-    {
-        for ( String pathSpec : pathSpecs )
-        {
-            if ( pathSpec.endsWith("/") )
-                pathSpec = pathSpec.substring(0, pathSpec.length()-1) ;
-            if ( pathSpec.startsWith("/") )
-                pathSpec = pathSpec.substring(1, pathSpec.length()) ;
-            addServlet(context, servlet, datasetPath+"/"+pathSpec) ;
-        }
-    }
-
-    private static void addServlet(ServletContextHandler context, HttpServlet servlet, String pathSpec)
-    {
-        ServletHolder holder = new ServletHolder(servlet) ;
-        addServlet(context, holder, pathSpec) ;
-    }
-    
-    private static void addServlet(ServletContextHandler context, ServletHolder holder, String pathSpec)
-    {
-        serverLog.debug("Add servlet @ "+pathSpec) ;
-        context.addServlet(holder, pathSpec) ;
-    }
-
-}
-

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/main/java/org/apache/jena/fuseki/mgt/MgtCmdServlet.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/main/java/org/apache/jena/fuseki/mgt/MgtCmdServlet.java b/jena-fuseki/src/main/java/org/apache/jena/fuseki/mgt/MgtCmdServlet.java
deleted file mode 100644
index 5385e75..0000000
--- a/jena-fuseki/src/main/java/org/apache/jena/fuseki/mgt/MgtCmdServlet.java
+++ /dev/null
@@ -1,169 +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.
- */
-
-/** A servlet that dumps its request
- */
-
-// Could be neater - much, much neater!
-
-package org.apache.jena.fuseki.mgt ;
-
-import java.io.IOException ;
-import java.io.PrintWriter ;
-
-import javax.servlet.http.HttpServlet ;
-import javax.servlet.http.HttpServletRequest ;
-import javax.servlet.http.HttpServletResponse ;
-
-import org.apache.jena.fuseki.Fuseki ;
-import org.apache.jena.fuseki.server.DatasetRef ;
-import org.apache.jena.fuseki.server.SPARQLServer ;
-import org.apache.jena.fuseki.server.ServiceRef ;
-import org.apache.jena.web.HttpSC ;
-import org.slf4j.Logger ;
-
-import com.hp.hpl.jena.Jena ;
-import com.hp.hpl.jena.query.ARQ ;
-import com.hp.hpl.jena.tdb.TDB ;
-
-/** Control functions for a Fuskei server */
-
-public class MgtCmdServlet extends HttpServlet
-{
-    // Experimental - likely to change. 
-    private static Logger log = Fuseki.serverLog ;
-
-    public MgtCmdServlet()
-    {
-
-    }
-
-    @Override
-    public void init()
-    {
-        return ;
-    }
-
-    public static String paramCmd     = "cmd" ;
-    public static String cmdBackup    = "backup" ;          // &dataset=/datasetname
-    public static String cmdRestart   = "restart" ;         // Not implemented.
-    public static String cmdShutdown  = "shutdown" ;        // Server stops, no questions asked. (Not implemented)
-
-    ActionBackup         actionBackup = new ActionBackup() ;
-
-    @Override
-    public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException
-    {
-        // Commands format:
-        // ?cmd=backup&<other args per command>
-
-        String[] args = req.getParameterValues(paramCmd) ;
-        if ( args == null ) {
-            resp.setContentType("text/plain") ;
-            resp.setStatus(HttpSC.BAD_REQUEST_400) ;
-
-            return ;
-        }
-        for ( String cmd : args ) {
-            if ( log.isInfoEnabled() )
-                log.info("Management command: " + cmd) ;
-
-            if ( cmd.equalsIgnoreCase(cmdBackup) ) {
-                actionBackup.doPost(req, resp) ;
-                continue ;
-            }
-            if ( cmd.equalsIgnoreCase(cmdRestart) ) {
-
-                continue ;
-            }
-            if ( cmd.equalsIgnoreCase(cmdShutdown) ) {
-                Fuseki.getServer().stop() ;
-                continue ;
-            }
-            log.warn("Unrecognized command : " + cmd) ;
-
-        }
-    }
-
-    @Override
-    public void doGet(HttpServletRequest req, HttpServletResponse resp)
-    {
-        try {
-            // serverLog.info("Fuseki Server Config servlet") ;
-
-            PrintWriter out = resp.getWriter() ;
-            resp.setContentType("text/plain") ;
-            SPARQLServer server = Fuseki.getServer() ;
-
-            out.println("Software:") ;
-            String fusekiVersion = Fuseki.VERSION ;
-            if ( fusekiVersion.equals("${project.version}") )
-                fusekiVersion = "(development)" ;
-
-            out.printf("  %s %s\n", Fuseki.NAME, fusekiVersion) ;
-            out.printf("  %s %s\n", TDB.NAME, TDB.VERSION) ;
-            out.printf("  %s %s\n", ARQ.NAME, ARQ.VERSION) ;
-            out.printf("  %s %s\n", Jena.NAME, Jena.VERSION) ;
-
-            // out.printf("Port: %s\n",
-            // server.getServer().getConnectors()[0].getPort()) ;
-            out.println() ;
-
-            for ( DatasetRef dsRef : server.getDatasets() ) {
-                datasetRefDetails(out, dsRef) ;
-                out.println() ;
-            }
-        }
-        catch (IOException ex) {}
-    }
-
-    private static void datasetRefDetails(PrintWriter out, DatasetRef dsRef)
-    {
-        if ( dsRef.name != null )
-            out.println("Name = " + dsRef.name) ;
-        else
-            out.println("Name = <unset>") ;
-
-        endpointDetail(out, "Query", dsRef, dsRef.query) ;
-        endpointDetail(out, "Update", dsRef, dsRef.update) ;
-        endpointDetail(out, "Upload", dsRef, dsRef.upload) ;
-        endpointDetail(out, "Graphs(Read)", dsRef, dsRef.readGraphStore) ;
-        endpointDetail(out, "Graphs(RW)", dsRef, dsRef.readWriteGraphStore) ;
-    }
-
-    private static void endpointDetail(PrintWriter out, String label, DatasetRef dsRef, ServiceRef service)
-    {
-        boolean first = true ;
-        out.printf("   %-15s :: ", label) ;
-
-        for ( String s : service.endpoints ) {
-            if ( !first )
-                out.print(" , ") ;
-            first = false ;
-            s = "/" + dsRef.name + "/" + s ;
-            out.print(s) ;
-        }
-        out.println() ;
-    }
-
-    @Override
-    public String getServletInfo()
-    {
-        return "Fuseki Control Servlet" ;
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/main/java/org/apache/jena/fuseki/mgt/MgtFunctions.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/main/java/org/apache/jena/fuseki/mgt/MgtFunctions.java b/jena-fuseki/src/main/java/org/apache/jena/fuseki/mgt/MgtFunctions.java
deleted file mode 100644
index e43b1e2..0000000
--- a/jena-fuseki/src/main/java/org/apache/jena/fuseki/mgt/MgtFunctions.java
+++ /dev/null
@@ -1,180 +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.fuseki.mgt;
-
-import java.util.List ;
-
-import javax.servlet.http.HttpServletRequest ;
-import javax.servlet.http.HttpSession ;
-
-import org.apache.jena.atlas.io.IndentedLineBuffer ;
-import org.apache.jena.atlas.iterator.Iter ;
-import org.apache.jena.fuseki.Fuseki ;
-import org.apache.jena.fuseki.server.DatasetRef ;
-import org.apache.jena.fuseki.server.DatasetRegistry ;
-import org.apache.jena.fuseki.server.ServiceRef ;
-
-import com.hp.hpl.jena.shared.PrefixMapping ;
-import com.hp.hpl.jena.sparql.core.DatasetGraph ;
-import com.hp.hpl.jena.sparql.core.Prologue ;
-import com.hp.hpl.jena.sparql.serializer.PrologueSerializer ;
-import com.hp.hpl.jena.tdb.store.DatasetGraphTDB ;
-
-/** Avoid code in JSPs */
-public class MgtFunctions
-{
-    /** Return the name of the current dataset */ 
-    public static String dataset(HttpServletRequest request, String dftValue)
-    {
-        String ds = dataset(request) ;
-        if ( ds == null )
-            return dftValue ;
-        return ds ;
-    }
-    
-    /** Return the name of the current dataset */ 
-    public static String dataset(HttpServletRequest request)
-    {
-        HttpSession session = request.getSession(false) ;
-        if ( session == null )
-            return "No session";
-        String ds = (String)session.getAttribute("dataset") ;
-        return ds ;
-    }
-
-    /** Return the dataset description reference for currnet dataset */  
-    public static DatasetRef datasetDesc(HttpServletRequest request)
-    {
-        HttpSession session = request.getSession(false) ;
-        if ( session == null )
-            return null ;
-        String ds = (String)session.getAttribute("dataset") ;
-        return DatasetRegistry.get().get(ds) ;
-    }
-
-    /** Return lists of datasets */ 
-    public static List<String> datasets(HttpServletRequest request)
-    {
-        return Iter.toList(DatasetRegistry.get().keys()) ;
-    }
-
-    /** Return name of */  
-    public static String actionDataset(HttpServletRequest request)
-    {
-        return PageNames.actionDatasetNames ;
-    }
-
-    // Service name getters ...
-    
-    /** Return a SPARQL query service name for the dataset */
-    public static String serviceQuery(String dataset)
-    {
-        String dft = "sparql" ; 
-        DatasetRef ref = getFromRegistry(dataset) ;
-        if ( ref == null )
-            return dft ;
-        return serviceNameOrDefault(ref.query, dft) ;
-    }
-    
-    /** Return a SPARQL update service name for the dataset */
-    public static String serviceUpdate(String dataset)
-    {
-        String dft = "update" ; 
-        DatasetRef ref = getFromRegistry(dataset) ;
-        if ( ref == null )
-            return dft ;
-        return serviceNameOrDefault(ref.update, dft) ;
-    }
-    
-    /** Return a SPARQL upload service name for the dataset */
-    public static String serviceUpload(String dataset)
-    {
-        String dft = "upload" ;
-        DatasetRef ref = getFromRegistry(dataset) ;
-        if ( ref == null )
-            return dft ;
-        return serviceNameOrDefault(ref.upload, dft) ;
-    }
-
-    /** Return a SPARQL Graph Store Protocol (Read) service name for the dataset */
-    public static String serviceGraphRead(String dataset)
-    {
-        String dft = "get" ;
-        DatasetRef ref = getFromRegistry(dataset) ;
-        if ( ref == null )
-            return dft ;
-        return serviceNameOrDefault(ref.readGraphStore, dft) ;
-    }
-
-    /** Return a SPARQL Graph Store Protocol (Read-Write) service name for the dataset */
-    public static String serviceGraphReadWrite(String dataset)
-    {
-        String dft = "data" ;
-        DatasetRef ref = getFromRegistry(dataset) ;
-        if ( ref == null )
-            return dft ;
-        return serviceNameOrDefault(ref.readWriteGraphStore, dft) ;
-    }
-
-    private static DatasetRef getFromRegistry(String dataset)
-    {
-        DatasetRegistry registry = DatasetRegistry.get() ;
-        if ( registry == null )
-        {
-            Fuseki.serverLog.warn("No dataset registry") ;
-            return null ;
-        }
-        
-        DatasetRef ref = registry.get(dataset) ;
-        if ( ref == null )
-            Fuseki.serverLog.warn("Dataset not found: "+dataset) ;
-        return ref ;
-    }
-
-    private static String serviceNameOrDefault(ServiceRef service, String defaultValue)
-    {
-        if ( service.endpoints.isEmpty() )
-            return defaultValue ;
-        String x = service.endpoints.get(0) ;
-        if ( x.startsWith("/") )
-            x = x.substring(1) ;
-        return x ;
-    }
-    
-    /** Return prefixes for the datasets, SPARQL syntax. */ 
-    public static String prefixes(HttpServletRequest request)
-    {
-        String dsName = dataset(request) ;
-        DatasetRef desc = getFromRegistry(dsName) ;
-        if ( desc == null )
-            return "<not found>" ;
-        DatasetGraph dsg = desc.dataset ; 
-        
-        if ( dsg instanceof DatasetGraphTDB )
-        {
-            PrefixMapping pmap = ((DatasetGraphTDB)dsg).getPrefixes().getPrefixMapping() ;
-            Prologue prologue = new Prologue(pmap) ;
-            IndentedLineBuffer buff = new IndentedLineBuffer() ;
-            PrologueSerializer.output(buff, prologue) ;
-            buff.append("\n") ;
-            return buff.asString() ;
-        }
-        return "" ;
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/main/java/org/apache/jena/fuseki/mgt/PageNames.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/main/java/org/apache/jena/fuseki/mgt/PageNames.java b/jena-fuseki/src/main/java/org/apache/jena/fuseki/mgt/PageNames.java
deleted file mode 100644
index 4dc315b..0000000
--- a/jena-fuseki/src/main/java/org/apache/jena/fuseki/mgt/PageNames.java
+++ /dev/null
@@ -1,33 +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.fuseki.mgt;
-
-public class PageNames
-{
-    //public static final String pageControlPanel     = "/control-panel.tpl" ;
-    
-    /** The dispatch URL for the place to go after login (0.2.1 - login = choose dataset) */
-    public static final String pageAfterLogin      = "/sparql.tpl" ;
-    
-    /** This is the full web dispatch URL: control-panel.tpl knowns 
-     * the name indirectly because it gets it via velocity
-     * calling mgt.actionDataset.
-     */
-    public static final String actionDatasetNames   = "/$/datasets" ;
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/main/java/org/apache/jena/fuseki/mgt/PingServlet.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/main/java/org/apache/jena/fuseki/mgt/PingServlet.java b/jena-fuseki/src/main/java/org/apache/jena/fuseki/mgt/PingServlet.java
deleted file mode 100644
index 5d4ca53..0000000
--- a/jena-fuseki/src/main/java/org/apache/jena/fuseki/mgt/PingServlet.java
+++ /dev/null
@@ -1,75 +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.fuseki.mgt;
-
-import static org.apache.jena.riot.WebContent.charsetUTF8 ;
-import static org.apache.jena.riot.WebContent.contentTypeTextPlain ;
-
-import java.io.IOException ;
-
-import javax.servlet.ServletOutputStream ;
-import javax.servlet.http.HttpServlet ;
-import javax.servlet.http.HttpServletRequest ;
-import javax.servlet.http.HttpServletResponse ;
-
-import org.apache.jena.fuseki.Fuseki ;
-import org.apache.jena.riot.web.HttpNames ;
-import org.apache.jena.web.HttpSC ;
-
-import com.hp.hpl.jena.sparql.util.Utils ;
-
-/** 
- * The ping servlet provides a low costy, uncached endpoint that can be used
- * to determine if this component is running and responding.  For example,
- * a nagios check should use this endpoint.    
- */
-public class PingServlet extends HttpServlet
-{
-    @Override
-    protected void doGet(HttpServletRequest req, HttpServletResponse resp) {
-        doCommon(req, resp); 
-    }
-    
-    @Override
-    protected void doPost(HttpServletRequest req, HttpServletResponse resp) {
-        doCommon(req, resp); 
-    }
-    
-
-    @Override
-    protected void doHead(HttpServletRequest req, HttpServletResponse resp) {
-        doCommon(req, resp); 
-    }
-
-    protected void doCommon(HttpServletRequest request, HttpServletResponse response) {
-        try {
-            response.setHeader(HttpNames.hCacheControl, "must-revalidate,no-cache,no-store");
-            response.setHeader(HttpNames.hPragma, "no-cache");
-            response.setContentType(contentTypeTextPlain);
-            response.setCharacterEncoding(charsetUTF8) ;
-            response.setStatus(HttpSC.OK_200);
-            ServletOutputStream out = response.getOutputStream() ;
-            out.println(Utils.nowAsXSDDateTimeString());
-        } catch (IOException ex) {
-            Fuseki.serverLog.warn("ping :: IOException :: "+ex.getMessage());
-        }
-    }
-}
-
-

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/main/java/org/apache/jena/fuseki/mgt/StatsServlet.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/main/java/org/apache/jena/fuseki/mgt/StatsServlet.java b/jena-fuseki/src/main/java/org/apache/jena/fuseki/mgt/StatsServlet.java
deleted file mode 100644
index e165355..0000000
--- a/jena-fuseki/src/main/java/org/apache/jena/fuseki/mgt/StatsServlet.java
+++ /dev/null
@@ -1,171 +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.fuseki.mgt;
-
-import java.io.IOException ;
-import java.util.Iterator ;
-
-import javax.servlet.ServletOutputStream ;
-import javax.servlet.http.HttpServlet ;
-import javax.servlet.http.HttpServletRequest ;
-import javax.servlet.http.HttpServletResponse ;
-
-import org.apache.jena.atlas.json.JSON ;
-import org.apache.jena.atlas.json.JsonArray ;
-import org.apache.jena.atlas.json.JsonObject ;
-import org.apache.jena.fuseki.server.* ;
-import org.apache.jena.riot.WebContent ;
-
-public class StatsServlet extends HttpServlet
-{
-    @Override
-    protected void doGet(HttpServletRequest req, HttpServletResponse resp)
-        //throws ServletException, IOException
-    {
-        try {
-            // Conneg etc.
-            statsJSON(req, resp) ;
-        } catch (IOException e)
-        { }
-    }
-    
-    private void statsJSON(HttpServletRequest req, HttpServletResponse resp) throws IOException
-    {
-        ServletOutputStream out = resp.getOutputStream() ;
-        resp.setContentType(WebContent.contentTypeJSON);
-        resp.setCharacterEncoding(WebContent.charsetUTF8) ;
-
-        /*
-         * { "server" : ....   
-         *    "datasets" : {
-         *       "ds1": { counters... }
-         *       GSP stucture?
-         *         
-         */
-        
-        JsonObject obj = new JsonObject() ;
-        JsonObject datasets = new JsonObject() ;
-        JsonObject server = new JsonObject() ;
-        server.put("host", req.getLocalName()+":"+req.getLocalPort()) ;
-        
-        for ( String ds : DatasetRegistry.get().keys() )
-            statsJSON(datasets, ds) ; 
-        
-        obj.put("server", server) ;
-        obj.put("datasets", datasets) ;
-        
-        JSON.write(out, obj) ;
-        out.flush() ;
-    }
-    
-    private void statsJSON(JsonObject datasets, String ds) {
-        DatasetRef desc = DatasetRegistry.get().get(ds) ;
-        JsonObject stats = new JsonObject() ;
-        datasets.put(ds, stats) ;
-        stats.put(CounterName.Requests.name(),      desc.getCounters().value(CounterName.Requests)) ;
-        stats.put(CounterName.RequestsGood.name(),  desc.getCounters().value(CounterName.RequestsGood)) ;
-        stats.put(CounterName.RequestsBad.name(),   desc.getCounters().value(CounterName.RequestsBad)) ;
-        JsonObject services = new JsonObject() ;
-
-//        JsonArray endpoints = new JsonArray() ;
-//        services.put("endpoints", endpoints) ;
-//        JsonArray srvNames = new JsonArray() ;
-//        services.put("names", srvNames) ;
-        
-        // There can be several endpoints for one service.
-        for ( ServiceRef srvRef : desc.getServiceRefs() ) {
-            JsonObject epStats = new JsonObject() ;
-            statsJSON(epStats, srvRef) ;
-            services.put(srvRef.name, epStats) ;
-            JsonArray endpoints = new JsonArray() ;
-            epStats.put("endpoints", endpoints) ;
-            for ( String ep : srvRef.endpoints) {
-                endpoints.add(ep) ;
-            }
-        }
-        stats.put("services", services) ;
-    }
-
-    private void statsJSON(JsonObject epStats, ServiceRef srvRef) {
-        for (CounterName cn : srvRef.getCounters().counters()) {
-            Counter c = srvRef.getCounters().get(cn) ;
-            epStats.put(cn.name(), c.value()) ;
-        }
-    }
-
-    private void statsTxt(HttpServletResponse resp) throws IOException
-    {
-        ServletOutputStream out = resp.getOutputStream() ;
-        resp.setContentType(WebContent.contentTypeTextPlain);
-        resp.setCharacterEncoding(WebContent.charsetUTF8) ;
-
-        Iterator<String> iter = DatasetRegistry.get().keys().iterator() ;
-        while(iter.hasNext())
-        {
-            String ds = iter.next() ;
-            DatasetRef desc = DatasetRegistry.get().get(ds) ;
-            statsTxt(out, desc) ;
-            if ( iter.hasNext() )
-                out.println() ;
-        }
-        out.flush() ;
-    }
-    private void statsTxt(ServletOutputStream out, DatasetRef desc) throws IOException
-    {
-        out.println("Dataset: "+desc.name) ;
-        out.println("    Requests      = "+desc.getCounters().value(CounterName.Requests)) ;
-        out.println("    Good          = "+desc.getCounters().value(CounterName.RequestsGood)) ;
-        out.println("    Bad           = "+desc.getCounters().value(CounterName.RequestsBad)) ;
-
-        out.println("  SPARQL Query:") ;
-        out.println("    Request       = "+desc.query.getCounters().value(CounterName.Requests)) ;
-        out.println("    Good          = "+desc.query.getCounters().value(CounterName.RequestsGood)) ;
-        out.println("    Bad requests  = "+desc.query.getCounters().value(CounterName.RequestsBad)) ;
-        out.println("    Timeouts      = "+desc.query.getCounters().value(CounterName.QueryTimeouts)) ;
-        out.println("    Bad exec      = "+desc.query.getCounters().value(CounterName.QueryExecErrors)) ;
-
-        out.println("  SPARQL Update:") ;
-        out.println("    Request       = "+desc.update.getCounters().value(CounterName.Requests)) ;
-        out.println("    Good          = "+desc.update.getCounters().value(CounterName.RequestsGood)) ;
-        out.println("    Bad requests  = "+desc.update.getCounters().value(CounterName.RequestsBad)) ;
-        out.println("    Bad exec      = "+desc.update.getCounters().value(CounterName.UpdateExecErrors)) ;
-        
-        out.println("  Upload:") ;
-        out.println("    Requests      = "+desc.upload.getCounters().value(CounterName.Requests)) ;
-        out.println("    Good          = "+desc.upload.getCounters().value(CounterName.RequestsGood)) ;
-        out.println("    Bad           = "+desc.upload.getCounters().value(CounterName.RequestsBad)) ;
-        
-        out.println("  SPARQL Graph Store Protocol:") ;
-        out.println("    GETs          = "+gspValue(desc, CounterName.GSPget)+ " (good="+gspValue(desc, CounterName.GSPgetGood)+"/bad="+gspValue(desc, CounterName.GSPgetBad)+")") ;
-        out.println("    PUTs          = "+gspValue(desc, CounterName.GSPput)+ " (good="+gspValue(desc, CounterName.GSPputGood)+"/bad="+gspValue(desc, CounterName.GSPputBad)+")") ;
-        out.println("    POSTs         = "+gspValue(desc, CounterName.GSPpost)+ " (good="+gspValue(desc, CounterName.GSPpostGood)+"/bad="+gspValue(desc, CounterName.GSPpostBad)+")") ;
-        out.println("    DELETEs       = "+gspValue(desc, CounterName.GSPdelete)+ " (good="+gspValue(desc, CounterName.GSPdeleteGood)+"/bad="+gspValue(desc, CounterName.GSPdeleteBad)+")") ;
-        out.println("    HEADs         = "+gspValue(desc, CounterName.GSPhead)+ " (good="+gspValue(desc, CounterName.GSPheadGood)+"/bad="+gspValue(desc, CounterName.GSPheadBad)+")") ;
-    }
-    
-    private long gspValue(DatasetRef desc, CounterName cn) {
-        long x1 = desc.readGraphStore.getCounters().value(cn) ;
-        long x2 = desc.readWriteGraphStore.getCounters().value(cn) ;
-        return x1+x2 ;
-    }
-    
-    
-}
-
-

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/main/java/org/apache/jena/fuseki/migrate/GraphLoadUtils.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/main/java/org/apache/jena/fuseki/migrate/GraphLoadUtils.java b/jena-fuseki/src/main/java/org/apache/jena/fuseki/migrate/GraphLoadUtils.java
deleted file mode 100644
index da16863..0000000
--- a/jena-fuseki/src/main/java/org/apache/jena/fuseki/migrate/GraphLoadUtils.java
+++ /dev/null
@@ -1,76 +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.fuseki.migrate;
-
-import org.apache.jena.atlas.web.TypedInputStream ;
-import org.apache.jena.fuseki.Fuseki ;
-import org.apache.jena.riot.RDFDataMgr ;
-import org.apache.jena.riot.system.StreamRDF ;
-import org.apache.jena.riot.system.StreamRDFLib ;
-
-import com.hp.hpl.jena.graph.Factory ;
-import com.hp.hpl.jena.graph.Graph ;
-import com.hp.hpl.jena.rdf.model.Model ;
-import com.hp.hpl.jena.rdf.model.ModelFactory ;
-
-/** A packaging of code to do a controlled read of a graph or model */
-
-public class GraphLoadUtils
-{
-    // ---- Model level
-    
-    public static Model readModel(String uri, int limit)
-    {
-        Graph g = Factory.createGraphMem() ;
-        readUtil(g, uri, limit) ;
-        return ModelFactory.createModelForGraph(g) ;
-    }
-    
-    public static void loadModel(Model model, String uri, int limit) 
-    {
-        Graph g = model.getGraph() ;
-        readUtil(g, uri, limit) ;
-    }
-
-    // ---- Graph level
-    
-    public static Graph readGraph(String uri, int limit)
-    {
-        Graph g = Factory.createGraphMem() ;
-        readUtil(g, uri, limit) ;
-        return g ;
-    }
-    
-    public static void loadGraph(Graph g, String uri, int limit) 
-    {
-        readUtil(g, uri, limit) ;
-    }
-    
-    // ** Worker.
-    private static void readUtil(Graph graph, String uri, int limit)
-    {
-        // We need to do this ourselves, not via riot, to use the webStreamManager
-        StreamRDF sink = StreamRDFLib.graph(graph) ;
-        sink = new SinkRDFLimited(sink, limit) ;
-
-        TypedInputStream input = Fuseki.webStreamManager.open(uri) ;
-        RDFDataMgr.parse(sink, input, uri) ;
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/main/java/org/apache/jena/fuseki/migrate/Registry.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/main/java/org/apache/jena/fuseki/migrate/Registry.java b/jena-fuseki/src/main/java/org/apache/jena/fuseki/migrate/Registry.java
deleted file mode 100644
index ca30be1..0000000
--- a/jena-fuseki/src/main/java/org/apache/jena/fuseki/migrate/Registry.java
+++ /dev/null
@@ -1,42 +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.fuseki.migrate;
-
-import java.util.Collection ;
-import java.util.HashMap ;
-import java.util.Map ;
-
-public class Registry<T>
-{
-    protected Map<String, T> registry = new HashMap<String, T>() ;
-    
-    public Registry() {}
-    
-    public void put(String key, T value) { registry.put(key, value) ; }
-    
-    public T get(String key) { return registry.get(key) ; }
-    
-    public boolean isRegistered(String key) { return registry.containsKey(key) ; }
-    public void remove(String key) { registry.remove(key) ; } 
-    public Collection<String> keys() { return registry.keySet() ; }
-    //public Iterator<String> keys() { return registry.keySet().iterator() ; }
-    
-    public int size() { return registry.size() ; }
-    public boolean isEmpty() { return registry.isEmpty() ; }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/main/java/org/apache/jena/fuseki/migrate/SinkRDFLimited.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/main/java/org/apache/jena/fuseki/migrate/SinkRDFLimited.java b/jena-fuseki/src/main/java/org/apache/jena/fuseki/migrate/SinkRDFLimited.java
deleted file mode 100644
index 514d756..0000000
--- a/jena-fuseki/src/main/java/org/apache/jena/fuseki/migrate/SinkRDFLimited.java
+++ /dev/null
@@ -1,55 +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.fuseki.migrate;
-
-import org.apache.jena.riot.system.StreamRDF ;
-import org.apache.jena.riot.system.StreamRDFWrapper ;
-
-import com.hp.hpl.jena.graph.Triple ;
-import com.hp.hpl.jena.sparql.core.Quad ;
-
-public class SinkRDFLimited extends StreamRDFWrapper
-{
-   private long count = 0 ;
-   private final long limit ;
-    
-    public SinkRDFLimited(StreamRDF output, long limit)
-    {
-        super(output) ;
-        this.limit = limit ;
-    }
-
-    @Override
-    public void triple(Triple triple)
-    { 
-        count++ ;
-        super.triple(triple) ;
-    }
-
-    @Override
-    public void quad(Quad quad)
-    { 
-        count++ ;
-        super.quad(quad) ;
-    }
-
-    public long getCount() { return count ; } 
-    public long getLimit() { return limit ; }
-}
-

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/Counter.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/Counter.java b/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/Counter.java
deleted file mode 100644
index 88d4d37..0000000
--- a/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/Counter.java
+++ /dev/null
@@ -1,34 +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.fuseki.server;
-
-import java.util.concurrent.atomic.AtomicLong ;
-
-/** A statistics counter */
-public class Counter
-{
-    private AtomicLong counter = new AtomicLong(0) ;
-    
-    public Counter()    {}
-    
-    public void inc()   { counter.incrementAndGet() ; } 
-    public void dec()   { counter.decrementAndGet() ; } 
-    public long value() { return counter.get() ; } 
-}
-

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/CounterMXBean.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/CounterMXBean.java b/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/CounterMXBean.java
deleted file mode 100644
index 2de7658..0000000
--- a/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/CounterMXBean.java
+++ /dev/null
@@ -1,25 +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.fuseki.server;
-
-public interface CounterMXBean
-{
-    long getValue() ; 
-}
-

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/CounterName.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/CounterName.java b/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/CounterName.java
deleted file mode 100644
index 2952aa8..0000000
--- a/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/CounterName.java
+++ /dev/null
@@ -1,83 +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.fuseki.server;
-
-/** Names for all counters */ 
-public enum CounterName {
-    // There are generic names - apply to all services and datasets
-    // and specific ones.
-
-    
-    // Total request received
-    Requests("requests"),
-    // .. of which some and "good" and some are "bad".
-    // #"good" + #"bad" roughly equals #"requests"
-    // except that the total is incremented at the start, and the outcome at the end.
-    // There may also be short term consistency issues.
-    RequestsGood("requests.good"),
-    RequestsBad("requests.bad") ,
-    
-    // SPARQL Protocol - query and update - together with upload.  
-    
-    // Query - standard and ... 
-    QueryTimeouts("query.timeouts") ,
-    QueryExecErrors("query.execerrors") ,
-    
-    // Update - standard and ...
-    UpdateExecErrors("update.execerrors"),
-    
-    // Upload ... standard counters
-    
-    // Graph Store Protocol.
-
-    // For each HTTP method
-    GSPget("gsp.get.requests") ,
-    GSPgetGood("gsp.get.requests.good") ,
-    GSPgetBad("gsp.get.requests.bad") ,
-
-    GSPpost("gsp.post.requests") ,
-    GSPpostGood("gsp.post.requests.good") ,
-    GSPpostBad("gsp.post.requests.bad") ,
-
-    GSPdelete("gsp.delete.requests") ,
-    GSPdeleteGood("gsp.delete.requests.good") ,
-    GSPdeleteBad("gsp.delete.requests.bad") ,
-
-    GSPput("gsp.put.requests") ,
-    GSPputGood("gsp.put.requests.good") ,
-    GSPputBad("gsp.put.requests.bad") ,
-
-    GSPhead("gsp.head.requests") ,
-    GSPheadGood("gsp.head.requests.good") ,
-    GSPheadBad("gsp.head.requests.bad") ,
-
-    GSPpatch("gsp.patch.requests") ,
-    GSPpatchGood("gsp.patch.requests.good") ,
-    GSPpatchBad("gsp.patch.requests.bad") ,
-
-    GSPoptions("gsp.options.requests") ,
-    GSPoptionsGood("gsp.options.requests.good") ,
-    GSPoptionsBad("gsp.options.requests.bad") ,
-    
-    ;
-    
-    private String name ;
-    private CounterName(String name) { this.name = name ; }
-    
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/CounterSet.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/CounterSet.java b/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/CounterSet.java
deleted file mode 100644
index 7d0d622..0000000
--- a/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/CounterSet.java
+++ /dev/null
@@ -1,70 +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.fuseki.server ;
-
-import java.util.Collection ;
-import java.util.HashMap ;
-import java.util.Map ;
-
-import org.slf4j.Logger ;
-import org.slf4j.LoggerFactory ;
-
-/** A collection of counters */
-public class CounterSet {
-    private static Logger             log      = LoggerFactory.getLogger(CounterSet.class) ;
-
-    private Map<CounterName, Counter> counters = new HashMap<CounterName, Counter>() ;
-
-    public CounterSet() {}
-
-    public Collection<CounterName> counters() {
-        return counters.keySet() ;
-    }
-
-    public void inc(CounterName c) {
-        get(c).inc() ;
-    }
-
-    public void dec(CounterName c) {
-        get(c).dec() ;
-    }
-
-    public long value(CounterName c) {
-        return get(c).value() ;
-    }
-
-    public void add(CounterName counterName) {
-        if ( counters.containsKey(counterName) ) {
-            log.warn("Duplicate counter in counter set: " + counterName) ;
-            return ;
-        }
-        counters.put(counterName, new Counter()) ;
-    }
-
-    public boolean contains(CounterName cn) {
-        return counters.containsKey(cn) ;
-    }
-
-    public Counter get(CounterName cn) {
-        Counter c = counters.get(cn) ;
-        if ( c == null )
-            log.warn("No counter in counter set: " + cn) ;
-        return c ;
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/Counters.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/Counters.java b/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/Counters.java
deleted file mode 100644
index 4e5ca4b..0000000
--- a/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/Counters.java
+++ /dev/null
@@ -1,25 +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.fuseki.server;
-
-/** Objects that have a counter set */ 
-public interface Counters {
-    public  CounterSet getCounters() ;
-}
-

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/DatasetMXBean.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/DatasetMXBean.java b/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/DatasetMXBean.java
deleted file mode 100644
index bf38229..0000000
--- a/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/DatasetMXBean.java
+++ /dev/null
@@ -1,35 +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.fuseki.server;
-
-public interface DatasetMXBean
-{
-    String getName() ;
-    
-    long getRequests() ;
-    long getRequestsGood() ;
-    long getRequestsBad() ;
-    
-//    void enable() ;
-//    void disable() ;
-//    void setReadOnly() ;
-//    boolean getReadOnly() ;
-    
-}
-


[14/23] jena git commit: Rename folder jena-fuseki to jena-fuseki1

Posted by an...@apache.org.
http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/HttpAction.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/HttpAction.java b/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/HttpAction.java
deleted file mode 100644
index 39663dd..0000000
--- a/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/HttpAction.java
+++ /dev/null
@@ -1,290 +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.fuseki.servlets;
-
-import static com.hp.hpl.jena.query.ReadWrite.READ ;
-import static com.hp.hpl.jena.query.ReadWrite.WRITE ;
-
-import java.util.HashMap ;
-import java.util.Map ;
-
-import javax.servlet.http.HttpServletRequest ;
-import javax.servlet.http.HttpServletResponse ;
-
-import org.apache.jena.atlas.logging.Log ;
-import org.apache.jena.atlas.web.MediaType ;
-import org.apache.jena.fuseki.DEF ;
-import org.apache.jena.fuseki.conneg.ConNeg ;
-import org.apache.jena.fuseki.server.DatasetRef ;
-import org.apache.jena.fuseki.server.ServiceRef ;
-
-import com.hp.hpl.jena.query.ReadWrite ;
-import com.hp.hpl.jena.sparql.SystemARQ ;
-import com.hp.hpl.jena.sparql.core.DatasetGraph ;
-import com.hp.hpl.jena.sparql.core.DatasetGraphWithLock ;
-import com.hp.hpl.jena.sparql.core.DatasetGraphWrapper ;
-import com.hp.hpl.jena.sparql.core.Transactional ;
-
-/**
- * HTTP action that represents the user request lifecycle. Its state is handled in the
- * {@link SPARQL_ServletBase#executeLifecycle(HttpAction)} method.
- */
-public class HttpAction
-{
-    public final long id ;
-    public final boolean verbose ;
-    
-    // Phase two items - set and valida after the datasetRef is known.  
-    private DatasetGraph dsg ;                  // The data
-    public DatasetRef dsRef ;
-    public ServiceRef srvRef ;
-    
-    private Transactional transactional ;
-    private boolean isTransactional;
-    private DatasetGraph    activeDSG ;             // Set when inside begin/end.
-    private ReadWrite       activeMode ;            // Set when inside begin/end.
-    
-    private boolean startTimeIsSet = false ;
-    private boolean finishTimeIsSet = false ;
-
-    private long startTime = -2 ;
-    private long finishTime = -2 ;
-    
-    // Incoming
-    //public final 
-    
-    // Outcome.
-    int statusCode = -1 ;
-    String message = null ;
-    int contentLength = -1 ;
-    String contentType = null ;
-    
-    // Cleared to archive:
-    Map <String, String> headers = new HashMap<String, String>() ;
-    public HttpServletRequest request;
-    public HttpServletResponseTracker response ;
-
-    /**
-     * Creates a new HTTP Action, using the HTTP request and response, and a given ID.
-     *
-     * @param id given ID
-     * @param request HTTP request
-     * @param response HTTP response
-     * @param verbose verbose flag
-     */
-    public HttpAction(long id, HttpServletRequest request, HttpServletResponse response, boolean verbose) {
-        this.id = id ;
-        this.request = request ;
-        this.response = new HttpServletResponseTracker(this, response) ;
-        // Should this be set when setDataset is called from the dataset context?
-        // Currently server-wide, e.g. from the command line.
-        this.verbose = verbose ;
-    }
-
-    /**
-     * <p>Sets the action dataset. Setting a {@link DatasetRef} will replace any existing DatasetRef, as well as
-     * as the {@link DatasetGraph} of the current HTTP Action.</p>
-     *
-     * <p>Once it has updated its members, the HTTP Action will change its transactional state and
-     * {@link Transactional} instance according to its base dataset graph.</p>
-     *
-     * @param desc {@link DatasetRef}
-     * @see Transactional
-     * @see DatasetGraphWrapper
-     */
-    public void setDataset(DatasetRef desc) {
-        this.dsRef = desc ;
-        this.dsg = desc.dataset ;
-        DatasetGraph basedsg = unwrap(dsg) ;
-
-        if ( isTransactional(basedsg) && isTransactional(dsg) ) {
-            // Use transactional if it looks safe - abort is necessary.
-            transactional = (Transactional)dsg ;
-            isTransactional = true ;
-        } else {
-            // Unsure if safe
-            transactional = new DatasetGraphWithLock(dsg) ;
-            // No real abort.
-            isTransactional = false ;
-        }
-    }
-
-    /**
-     * Returns <code>true</code> iff the given {@link DatasetGraph} is an instance of {@link Transactional},
-     * <code>false otherwise</code>.
-     *
-     * @param dsg a {@link DatasetGraph}
-     * @return <code>true</code> iff the given {@link DatasetGraph} is an instance of {@link Transactional},
-     * <code>false otherwise</code>
-     */
-    private static boolean isTransactional(DatasetGraph dsg) {
-        return (dsg instanceof Transactional) ;
-    }
-
-    /**
-     * A {@link DatasetGraph} may contain other <strong>wrapped DatasetGraph's</strong>. This method will return
-     * the first instance (including the argument to this method) that <strong>is not</strong> an instance of
-     * {@link DatasetGraphWrapper}.
-     *
-     * @param dsg a {@link DatasetGraph}
-     * @return the first found {@link DatasetGraph} that is not an instance of {@link DatasetGraphWrapper}
-     */
-    private static DatasetGraph unwrap(DatasetGraph dsg) {
-        while (dsg instanceof DatasetGraphWrapper) {
-            dsg = ((DatasetGraphWrapper)dsg).getWrapped() ;
-        }
-        return dsg ;
-    }
-
-    /**
-     * Sets the {@link ServiceRef}.
-     *
-     * @param srvRef a {@link ServiceRef}
-     */
-    public void setService(ServiceRef srvRef) {
-        this.srvRef = srvRef ; 
-    }
-    
-    /**
-     * Returns whether or not the underlying DatasetGraph is fully transactional (supports rollback).
-     * @return <code>true</code> if the underlying DatasetGraph is fully transactional (supports rollback),
-     * <code>false</code> otherwise.
-     */
-    public boolean isTransactional() {
-        return isTransactional ;
-    }
-
-    public void beginRead() {
-        activeMode = READ ;
-        transactional.begin(READ) ;
-        activeDSG = dsg ;
-        dsRef.startTxn(READ) ;
-    }
-
-    public void endRead() {
-        dsRef.finishTxn(READ) ;
-        activeMode = null ;
-        transactional.end() ;
-        activeDSG = null ;
-    }
-
-    public void beginWrite() {
-        transactional.begin(WRITE) ;
-        activeMode = WRITE ;
-        activeDSG = dsg ;
-        dsRef.startTxn(WRITE) ;
-    }
-
-    public void commit() {
-        transactional.commit() ;
-        activeDSG = null ;
-    }
-
-    public void abort() {
-        try { transactional.abort() ; } 
-        catch (Exception ex) {
-            // Some datasets claim to be transactional but
-            // don't provide a real abort. We tried to avoid
-            // them earlier but even if they sneek through,
-            // we try to continue server operation.
-            Log.warn(this, "Exception during abort (operation attempts to continue): "+ex.getMessage()) ; 
-        }
-        activeDSG = null ;
-    }
-
-    public void endWrite() {
-        dsRef.finishTxn(WRITE) ;
-        activeMode = null ;
-
-        if ( transactional.isInTransaction() ) {
-            Log.warn(this, "Transaction still active in endWriter - no commit or abort seen (forced abort)") ;
-            try {
-                transactional.abort() ;
-            } catch (RuntimeException ex) {
-                Log.warn(this, "Exception in forced abort (trying to continue)", ex) ;
-            }
-        }
-        transactional.end() ;
-        activeDSG = null ;
-    }
-   
-    public final DatasetGraph getActiveDSG() {
-        return activeDSG ;
-    }
-
-    public final DatasetRef getDatasetRef() {
-        return dsRef ;
-    }
-
-    /** Reduce to a size that can be kept around for sometime */
-    public void minimize() {
-        this.request = null ;
-        this.response = null ;
-    }
-
-    public void setStartTime() {
-        if ( startTimeIsSet ) 
-            Log.warn(this,  "Start time reset") ;
-        startTimeIsSet = true ;
-        this.startTime = System.nanoTime() ;
-    }
-
-    public void setFinishTime() {
-        if ( finishTimeIsSet ) 
-            Log.warn(this,  "Finish time reset") ;
-        finishTimeIsSet = true ;
-        this.finishTime = System.nanoTime() ;
-    }
-
-    public HttpServletRequest getRequest()              { return request ; }
-
-    public HttpServletResponseTracker getResponse()     { return response ; }
-    
-    /** Return the recorded time taken in milliseconds. 
-     *  {@linkplain #setStartTime} and {@linkplain #setFinishTime}
-     *  must have been called.
-     */
-    public long getTime()
-    {
-        if ( ! startTimeIsSet ) 
-            Log.warn(this,  "Start time not set") ;
-        if ( ! finishTimeIsSet ) 
-            Log.warn(this,  "Finish time not set") ;
-        return (finishTime-startTime)/(1000*1000) ;
-    }
-
-    public void sync() {
-        SystemARQ.sync(dsg) ;
-    }
-
-    public static MediaType contentNegotationRDF(HttpAction action) {
-        MediaType mt = ConNeg.chooseContentType(action.request, DEF.rdfOffer, DEF.acceptRDFXML) ;
-        if ( mt == null )
-            return null ;
-        if ( mt.getContentType() != null )
-            action.response.setContentType(mt.getContentType()) ;
-        if ( mt.getCharset() != null )
-            action.response.setCharacterEncoding(mt.getCharset()) ;
-        return mt ;
-    }
-
-    public static MediaType contentNegotationQuads(HttpAction action) {
-        return ConNeg.chooseContentType(action.request, DEF.quadsOffer, DEF.acceptNQuads) ;
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/HttpServletResponseTracker.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/HttpServletResponseTracker.java b/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/HttpServletResponseTracker.java
deleted file mode 100644
index c39e728..0000000
--- a/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/HttpServletResponseTracker.java
+++ /dev/null
@@ -1,140 +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.fuseki.servlets;
-
-import java.io.IOException ;
-
-import javax.servlet.http.HttpServletResponse ;
-import javax.servlet.http.HttpServletResponseWrapper ;
-
-import org.apache.jena.atlas.logging.Log ;
-
-/** Intercepting wrapper so we can track the response settings for logging purposes */
-
-public class HttpServletResponseTracker extends HttpServletResponseWrapper
-{
-    private final HttpAction action ;
-
-    public HttpServletResponseTracker(HttpAction action, HttpServletResponse response)
-    {
-        super(response) ;
-        this.action = action ;
-    }
-
-    @Override
-    public void sendError(int sc, String msg) throws IOException
-    {
-        action.statusCode = sc ;
-        action.message = msg ;
-        super.sendError(sc, msg) ;
-    }
-
-    @Override
-    public void sendError(int sc) throws IOException
-    {
-        action.statusCode = sc ;
-        action.message = null ;
-        super.sendError(sc) ;
-    }
-
-    @Override
-    public void setHeader(String name, String value)
-    {
-        super.setHeader(name, value) ;
-        action.headers.put(name, value) ;
-    }
-
-    @Override
-    public void addHeader(String name, String value)
-    {
-        Log.warn(this, "Unexpected addHeader - not recorded in log") ;
-        super.addHeader(name, value) ;
-    }
-    @Override
-    public void setStatus(int sc) 
-    {
-        action.statusCode = sc ;
-        action.message = null ;
-        super.setStatus(sc) ;
-    }
-
-    @Override
-    @Deprecated
-    public void setStatus(int sc, String sm)
-    {
-        action.statusCode = sc ;
-        action.message = sm ;
-        super.setStatus(sc, sm) ;
-    }
-
-    @Override
-    public void setContentLength(int len)
-    {
-        action.contentLength = len ;
-        super.setContentLength(len) ;
-    }
-
-    @Override
-    public void setContentType(String type)
-    {
-        action.contentType = type ;
-        super.setContentType(type) ;
-    }
-      
-      // From HttpServletResponse
-//      public void addCookie(Cookie cookie) {}
-//      public boolean containsHeader(String name) {}
-//      public String encodeURL(String url) { }
-//      public String encodeRedirectURL(String url) {}
-//      public String encodeUrl(String url) {}
-//      public String encodeRedirectUrl(String url) {}
-//      public void sendError(int sc, String msg) throws IOException
-//      public void sendError(int sc) throws IOException
-//      public void sendRedirect(String location) throws IOException {}
-//      public void setDateHeader(String name, long date) {}
-//      public void addDateHeader(String name, long date) {}
-//      public void setHeader(String name, String value)
-//      public void addHeader(String name, String value)
-//      public void setIntHeader(String name, int value) {}
-//      public void addIntHeader(String name, int value) {}
-//      public void setStatus(int sc) 
-//      public void setStatus(int sc, String sm)
-//      public void sendRedirect(String location) throws IOException {}
-//      public void setDateHeader(String name, long date) {}
-//      public void addDateHeader(String name, long date) {}
-        
-        // From ServletResponse.
-//         public ServletResponse getResponse() {}
-//         public void setResponse(ServletResponse response) {}
-//         public void setCharacterEncoding(String charset) {}
-//         public String getCharacterEncoding() {}
-//         public ServletOutputStream getOutputStream() throws IOException {}
-//         public PrintWriter getWriter() throws IOException {}
-//         public void setContentLength(int len) {}
-//         public void setContentType(String type) {}
-//         public String getContentType() {
-//         public void setBufferSize(int size) {}
-//         public int getBufferSize() {}
-//         public void flushBuffer() throws IOException {}
-//         public boolean isCommitted() {}
-//         public void reset() {}
-//         public void resetBuffer() {}
-//         public void setLocale(Locale loc) {}
-//         public Locale getLocale() {}
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/NullOutputStream.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/NullOutputStream.java b/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/NullOutputStream.java
deleted file mode 100644
index 63e6562..0000000
--- a/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/NullOutputStream.java
+++ /dev/null
@@ -1,53 +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.fuseki.servlets;
-
-import java.io.* ;
-
-/** 
-* Code needed to implement an OutputStream that does nothing.
-*/
-
-
-public class NullOutputStream extends /*Filter*/OutputStream
-{
-	public NullOutputStream()
-	{
-	}
-
-	// The OutputStream operations
-	@Override
-    public void close() { /* .close() ;*/ }
-	@Override
-    public void flush() { /* .flush() ;*/ }
-
-	// Need to implement this one.
-	@Override
-    public void write(int b) { /* .write(b) ;*/ }
-	@Override
-    public void write(byte b[]) { /* this.write(b, 0, b.length) ; */}
-
-	// Good to implement this one.
-	@Override
-    public void write(byte[] b, int off, int len)
-	{
-		// Work function
-	}
-	
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/REST_Quads.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/REST_Quads.java b/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/REST_Quads.java
deleted file mode 100644
index 06c38b7..0000000
--- a/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/REST_Quads.java
+++ /dev/null
@@ -1,211 +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.fuseki.servlets;
-
-import static java.lang.String.format ;
-
-import java.io.IOException ;
-
-import javax.servlet.ServletOutputStream ;
-
-import org.apache.jena.atlas.web.MediaType ;
-import org.apache.jena.atlas.web.TypedOutputStream ;
-import org.apache.jena.fuseki.Fuseki ;
-import org.apache.jena.fuseki.HttpNames ;
-import org.apache.jena.riot.Lang ;
-import org.apache.jena.riot.RDFDataMgr ;
-import org.apache.jena.riot.RDFLanguages ;
-import org.apache.jena.riot.ReaderRIOT ;
-import org.apache.jena.riot.system.StreamRDF ;
-import org.apache.jena.riot.system.StreamRDFLib ;
-
-import com.hp.hpl.jena.graph.Graph ;
-import com.hp.hpl.jena.graph.Node ;
-import com.hp.hpl.jena.graph.NodeFactory ;
-import com.hp.hpl.jena.sparql.core.DatasetGraph ;
-
-/** 
- * Servlet that serves up quads for a dataset.
- */
-
-public class REST_Quads extends SPARQL_REST
-{
-    public REST_Quads()     { super(); }
-    
-    @Override
-    protected void validate(HttpAction action)
-    {
-        // already checked?
-    }
-    
-    @Override
-    protected void doGet(HttpAction action)
-    {
-        MediaType mediaType = HttpAction.contentNegotationQuads(action) ;
-        ServletOutputStream output ;
-        try { output = action.response.getOutputStream() ; }
-        catch (IOException ex) { errorOccurred(ex) ; output = null ; }
-        
-        TypedOutputStream out = new TypedOutputStream(output, mediaType) ;
-        Lang lang = RDFLanguages.contentTypeToLang(mediaType.getContentType()) ;
-        if ( lang == null )
-            lang = RDFLanguages.TRIG ;
-
-        if ( action.verbose )
-            log.info(format("[%d]   Get: Content-Type=%s, Charset=%s => %s", 
-                                  action.id, mediaType.getContentType(), mediaType.getCharset(), lang.getName())) ;
-        if ( ! RDFLanguages.isQuads(lang) )
-            errorBadRequest("Not a quads format: "+mediaType) ;
-        
-        action.beginRead() ;
-        try {
-            DatasetGraph dsg = action.getActiveDSG() ;
-            RDFDataMgr.write(out, dsg, lang) ;
-            success(action) ;
-        } finally { action.endRead() ; }
-    }
-    
-    @Override
-    protected void doOptions(HttpAction action)
-    {
-        action.response.setHeader(HttpNames.hAllow, "GET, HEAD, OPTIONS") ;
-        action.response.setHeader(HttpNames.hContentLengh, "0") ;
-        success(action) ;
-    }
-
-    @Override
-    protected void doHead(HttpAction action)
-    {
-        action.beginRead() ;
-        try { 
-            MediaType mediaType = HttpAction.contentNegotationQuads(action) ;
-            success(action) ;
-        } finally { action.endRead() ; }
-    }
-
-    static int counter = 0 ;
-    @Override
-    protected void doPost(HttpAction action)
-    { 
-        if ( ! action.getDatasetRef().allowDatasetUpdate )
-            errorMethodNotAllowed("POST") ;
-
-        // Graph Store Protocol mode - POST triples to dataset causes
-        // a new graph to be created and the new URI returned via Location.
-        // Normally off.  
-        // When off, POST of triples goes to default graph.
-        boolean gspMode = Fuseki.graphStoreProtocolPostCreate ;
-        
-        // Code to pass the GSP test suite.
-        // Not necessarily good code.
-        String x = action.request.getContentType() ;
-        if ( x == null )
-            errorBadRequest("Content-type required for data format") ;
-        
-        MediaType mediaType = MediaType.create(x) ;
-        Lang lang = RDFLanguages.contentTypeToLang(mediaType.getContentType()) ;
-        if ( lang == null )
-            lang = RDFLanguages.TRIG ;
-
-        if ( action.verbose )
-            log.info(format("[%d]   Post: Content-Type=%s, Charset=%s => %s", 
-                                  action.id, mediaType.getContentType(), mediaType.getCharset(), lang.getName())) ;
-        
-        if ( RDFLanguages.isQuads(lang) )
-            doPostQuads(action, lang) ;
-        else if ( gspMode && RDFLanguages.isTriples(lang) )
-            doPostTriplesGSP(action, lang) ;
-        else if ( RDFLanguages.isTriples(lang) )
-            doPostTriples(action, lang) ;
-        else
-            errorBadRequest("Not a triples or quads format: "+mediaType) ;
-    }
-        
-    protected void doPostQuads(HttpAction action, Lang lang)
-    {
-        action.beginWrite() ;
-        try {
-            String name = action.request.getRequestURL().toString() ;
-            DatasetGraph dsg = action.getActiveDSG() ;
-            StreamRDF dest = StreamRDFLib.dataset(dsg) ;
-            ReaderRIOT reader = RDFDataMgr.createReader(lang) ;
-            reader.read(action.request.getInputStream(), name, null, dest, null);
-            action.commit();
-            success(action) ;
-        } catch (IOException ex) { action.abort() ; } 
-        finally { action.endWrite() ; }
-    }
-    
-  
-    // POST triples to dataset -- send to default graph.  
-    protected void doPostTriples(HttpAction action, Lang lang) 
-    {
-        action.beginWrite() ;
-        try {
-            DatasetGraph dsg = action.getActiveDSG() ;
-            // This should not be anythign other than the datasets name via this route.  
-            String name = action.request.getRequestURL().toString() ;
-            //log.info(format("[%d] ** Content-length: %d", action.id, action.request.getContentLength())) ;  
-            Graph g = dsg.getDefaultGraph() ;
-            StreamRDF dest = StreamRDFLib.graph(g) ;
-            ReaderRIOT reader = RDFDataMgr.createReader(lang) ;
-            reader.read(action.request.getInputStream(), name, null, dest, null);
-            action.commit();
-            success(action) ;
-        } catch (IOException ex) { action.abort() ; } 
-        finally { action.endWrite() ; }
-    }
-    
-    protected void doPostTriplesGSP(HttpAction action, Lang lang) 
-    {
-        action.beginWrite() ;
-        try {
-            DatasetGraph dsg = action.getActiveDSG() ;
-            //log.info(format("[%d] ** Content-length: %d", action.id, action.request.getContentLength())) ;  
-            
-            String name = action.request.getRequestURL().toString() ;
-            if ( ! name.endsWith("/") )
-                name = name+ "/"  ;
-            name = name+(++counter) ;
-            Node gn = NodeFactory.createURI(name) ;
-            Graph g = dsg.getGraph(gn) ;
-            StreamRDF dest = StreamRDFLib.graph(g) ;
-            ReaderRIOT reader = RDFDataMgr.createReader(lang) ;
-            reader.read(action.request.getInputStream(), name, null, dest, null);
-            log.info(format("[%d] Location: %s", action.id, name)) ;
-            action.response.setHeader("Location",  name) ;
-            action.commit();
-            successCreated(action) ;
-        } catch (IOException ex) { action.abort() ; } 
-        finally { action.endWrite() ; }
-    }
-
-    @Override
-    protected void doDelete(HttpAction action)
-    { errorMethodNotAllowed("DELETE") ; }
-
-    @Override
-    protected void doPut(HttpAction action)
-    { errorMethodNotAllowed("PUT") ; }
-
-    @Override
-    protected void doPatch(HttpAction action)
-    { errorMethodNotAllowed("PATCH") ; }
-}
-

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/ResponseCallback.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/ResponseCallback.java b/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/ResponseCallback.java
deleted file mode 100644
index 1a78627..0000000
--- a/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/ResponseCallback.java
+++ /dev/null
@@ -1,24 +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.fuseki.servlets ;
-
-public interface ResponseCallback
-{
-    public void callback(boolean successfulOperation) ;
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/ResponseModel.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/ResponseModel.java b/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/ResponseModel.java
deleted file mode 100644
index f2172f0..0000000
--- a/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/ResponseModel.java
+++ /dev/null
@@ -1,143 +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.fuseki.servlets;
-
-import static org.apache.jena.fuseki.servlets.ServletBase.error ;
-import static org.apache.jena.fuseki.servlets.ServletBase.errorBadRequest ;
-import static org.apache.jena.fuseki.servlets.ServletBase.errorOccurred ;
-
-import java.util.HashMap ;
-import java.util.Map ;
-
-import javax.servlet.ServletOutputStream ;
-import javax.servlet.http.HttpServletRequest ;
-import javax.servlet.http.HttpServletResponse ;
-
-import org.apache.jena.atlas.web.MediaType ;
-import org.apache.jena.fuseki.DEF ;
-import org.apache.jena.fuseki.Fuseki ;
-import org.apache.jena.fuseki.conneg.ConNeg ;
-import org.apache.jena.fuseki.conneg.WebLib ;
-import org.apache.jena.riot.Lang ;
-import org.apache.jena.riot.RDFDataMgr ;
-import org.apache.jena.riot.RDFLanguages ;
-import org.apache.jena.riot.WebContent ;
-import org.apache.jena.web.HttpSC ;
-import org.slf4j.Logger ;
-
-import com.hp.hpl.jena.rdf.model.Model ;
-
-public class ResponseModel
-{
-    private static Logger slog = ServletBase.log ;
-
-    // Short names for "output="
-    private static final String contentOutputJSONLD        = "json-ld" ;
-    private static final String contentOutputJSONRDF       = "json-rdf" ;
-    private static final String contentOutputJSON          = "json" ;
-    private static final String contentOutputXML           = "xml" ;
-    private static final String contentOutputText          = "text" ;
-    private static final String contentOutputTTL           = "ttl" ;
-    private static final String contentOutputNT            = "nt" ;
-
-    public static Map<String,String> shortNamesModel = new HashMap<String, String>() ;
-    static {
-
-        // Some short names.  keys are lowercase.
-        ResponseOps.put(shortNamesModel, contentOutputJSONLD, WebContent.contentTypeJSONLD) ;
-        ResponseOps.put(shortNamesModel, contentOutputJSONRDF, WebContent.contentTypeRDFJSON) ;
-        ResponseOps.put(shortNamesModel, contentOutputJSON, WebContent.contentTypeJSONLD) ;
-        ResponseOps.put(shortNamesModel, contentOutputXML,  WebContent.contentTypeRDFXML) ;
-        ResponseOps.put(shortNamesModel, contentOutputText, WebContent.contentTypeTurtle) ;
-        ResponseOps.put(shortNamesModel, contentOutputTTL,  WebContent.contentTypeTurtle) ;
-        ResponseOps.put(shortNamesModel, contentOutputNT,   WebContent.contentTypeNTriples) ;
-    }
-
-    public static void doResponseModel(HttpAction action, Model model) 
-    {
-        HttpServletRequest request = action.request ;
-        HttpServletResponse response = action.response ;
-        
-        String mimeType = null ;        // Header request type 
-
-        // TODO Use MediaType throughout.
-        MediaType i = ConNeg.chooseContentType(request, DEF.rdfOffer, DEF.acceptRDFXML) ;
-        if ( i != null )
-            mimeType = i.getContentType() ;
-
-        String outputField = ResponseOps.paramOutput(request, shortNamesModel) ;
-        if ( outputField != null )
-            mimeType = outputField ;
-
-        String writerMimeType = mimeType ;
-
-        if ( mimeType == null )
-        {
-            Fuseki.requestLog.warn("Can't find MIME type for response") ;
-            String x = WebLib.getAccept(request) ;
-            String msg ;
-            if ( x == null )
-                msg = "No Accept: header" ;
-            else
-                msg = "Accept: "+x+" : Not understood" ;
-            error(HttpSC.NOT_ACCEPTABLE_406, msg) ;
-        }
-
-        String contentType = mimeType ;
-        String charset =     WebContent.charsetUTF8 ;
-
-        String forceAccept = ResponseOps.paramForceAccept(request) ;
-        if ( forceAccept != null )
-        {
-            contentType = forceAccept ;
-            charset = WebContent.charsetUTF8 ;
-        }
-
-        Lang lang = RDFLanguages.contentTypeToLang(contentType) ;
-        if ( lang == null )
-            errorBadRequest("Can't determine output content type: "+contentType) ;
-        
-//        if ( rdfw instanceof RDFXMLWriterI )
-//            rdfw.setProperty("showXmlDeclaration", "true") ;
-
-    //        // Write locally to check it's possible.
-    //        // Time/space tradeoff.
-    //        try {
-    //            OutputStream out = new NullOutputStream() ;
-    //            RDFDataMgr.write(out, model, lang) ;
-    //            IO.flush(out) ;
-    //        } catch (JenaException ex)
-    //        {
-    //            SPARQL_ServletBase.errorOccurred(ex) ;
-    //        }
-
-        try {
-            ResponseResultSet.setHttpResponse(request, response, contentType, charset) ; 
-            response.setStatus(HttpSC.OK_200) ;
-            ServletOutputStream out = response.getOutputStream() ;
-            RDFDataMgr.write(out, model, lang) ;
-            out.flush() ;
-        }
-        catch (Exception ex) { 
-            slog.info("Exception while writing the response model: "+ex.getMessage(), ex) ;
-            errorOccurred("Exception while writing the response model: "+ex.getMessage(), ex) ;
-        }
-    }
-}
-

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/ResponseOps.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/ResponseOps.java b/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/ResponseOps.java
deleted file mode 100644
index 62ad6d5..0000000
--- a/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/ResponseOps.java
+++ /dev/null
@@ -1,94 +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.fuseki.servlets;
-
-import java.io.IOException ;
-import java.util.Locale ;
-import java.util.Map ;
-
-import javax.servlet.http.HttpServletRequest ;
-
-import org.apache.jena.fuseki.HttpNames ;
-
-public class ResponseOps
-{
-    // Helpers
-    public static void put(Map<String, String> map, String key, String value)
-    {
-        map.put(key.toLowerCase(Locale.ROOT), value) ;
-    }
-    
-    public static boolean isEOFexception(IOException ioEx)
-    {
-        if ( ioEx.getClass().getName().equals("org.mortbay.jetty.EofException eofEx") )
-            return true ;
-        if ( ioEx instanceof java.io.EOFException )
-            return true ;
-        return false ;
-    }
-
-    public static String paramForceAccept(HttpServletRequest request)
-    {
-        String x = fetchParam(request, HttpNames.paramForceAccept) ;
-        return x ; 
-    }
-
-    public static String paramStylesheet(HttpServletRequest request)
-    { return fetchParam(request, HttpNames.paramStyleSheet) ; }
-
-    public static String paramOutput(HttpServletRequest request, Map<String,String> map)
-    {
-        // Two names.
-        String x = fetchParam(request, HttpNames.paramOutput1) ;
-        if ( x == null )
-            x = fetchParam(request, HttpNames.paramOutput2) ;
-        return expandShortName(x, map) ;
-    }
-
-    public static String expandShortName(String str, Map<String,String> map)
-    {
-        if ( str == null )
-            return null ;
-        // Force keys to lower case. See put() above.
-        String key = str.toLowerCase(Locale.ROOT) ;
-        String str2 = map.get(key) ;
-        if ( str2 == null )
-            return str ;
-        return str2 ;
-    }
-
-    public static String paramCallback(HttpServletRequest request)
-    { 
-        return fetchParam(request, HttpNames.paramCallback) ;
-    }
-
-    public static String fetchParam(HttpServletRequest request, String parameterName)
-    {
-        String value = request.getParameter(parameterName) ;
-        if ( value != null )
-        {
-            value = value.trim() ;
-            if ( value.length() == 0 )
-                value = null ;
-        }
-        return value ;
-    }
-
-}
-

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/ResponseResultSet.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/ResponseResultSet.java b/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/ResponseResultSet.java
deleted file mode 100644
index c42378b..0000000
--- a/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/ResponseResultSet.java
+++ /dev/null
@@ -1,320 +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.fuseki.servlets;
-
-import static java.lang.String.format ;
-import static org.apache.jena.atlas.lib.Lib.equal ;
-import static org.apache.jena.fuseki.servlets.ServletBase.errorBadRequest ;
-import static org.apache.jena.fuseki.servlets.ServletBase.errorOccurred ;
-import static org.apache.jena.fuseki.servlets.ServletBase.log ;
-
-import java.io.IOException ;
-import java.util.HashMap ;
-import java.util.Map ;
-
-import javax.servlet.ServletOutputStream ;
-import javax.servlet.http.HttpServletRequest ;
-import javax.servlet.http.HttpServletResponse ;
-
-import org.apache.commons.lang.StringUtils ;
-import org.apache.jena.atlas.web.AcceptList ;
-import org.apache.jena.atlas.web.MediaType ;
-import org.apache.jena.fuseki.DEF ;
-import org.apache.jena.fuseki.FusekiException ;
-import org.apache.jena.fuseki.conneg.ConNeg ;
-import org.apache.jena.riot.ResultSetMgr ;
-import org.apache.jena.riot.WebContent ;
-import org.apache.jena.riot.resultset.ResultSetLang ;
-import org.apache.jena.web.HttpSC ;
-import org.slf4j.Logger ;
-import org.slf4j.LoggerFactory ;
-
-import com.hp.hpl.jena.query.QueryCancelledException ;
-import com.hp.hpl.jena.query.ResultSet ;
-import com.hp.hpl.jena.query.ResultSetFormatter ;
-import com.hp.hpl.jena.sparql.core.Prologue ;
-
-/** This is the content negotiation for each kind of SPARQL query result */ 
-public class ResponseResultSet
-{
-    private static Logger xlog = LoggerFactory.getLogger(ResponseResultSet.class) ;
-    private static Logger slog = ServletBase.log ;
-
-    // Short names for "output="
-    private static final String contentOutputJSON          = "json" ;
-    private static final String contentOutputXML           = "xml" ;
-    private static final String contentOutputSPARQL        = "sparql" ;
-    private static final String contentOutputText          = "text" ;
-    private static final String contentOutputCSV           = "csv" ;
-    private static final String contentOutputTSV           = "tsv" ;
-    private static final String contentOutputThrift        = "thrift" ;
-    
-    public static Map<String,String> shortNamesResultSet = new HashMap<String, String>() ;
-    static {
-        // Some short names.  keys are lowercase.
-        ResponseOps.put(shortNamesResultSet, contentOutputJSON,   WebContent.contentTypeResultsJSON) ;
-        ResponseOps.put(shortNamesResultSet, contentOutputSPARQL, WebContent.contentTypeResultsXML) ;
-        ResponseOps.put(shortNamesResultSet, contentOutputXML,    WebContent.contentTypeResultsXML) ;
-        ResponseOps.put(shortNamesResultSet, contentOutputText,   WebContent.contentTypeTextPlain) ;
-        ResponseOps.put(shortNamesResultSet, contentOutputCSV,    WebContent.contentTypeTextCSV) ;
-        ResponseOps.put(shortNamesResultSet, contentOutputTSV,    WebContent.contentTypeTextTSV) ;
-        ResponseOps.put(shortNamesResultSet, contentOutputThrift, WebContent.contentTypeResultsThrift) ;
-    }
-    
-    interface OutputContent { void output(ServletOutputStream out) ; }
-
-    public static void doResponseResultSet(HttpAction action, Boolean booleanResult)
-    {
-        doResponseResultSet$(action, null, booleanResult, null, DEF.rsOfferTable) ;
-    }
-
-    public static void doResponseResultSet(HttpAction action, ResultSet resultSet, Prologue qPrologue)
-    {
-        doResponseResultSet$(action, resultSet, null, qPrologue, DEF.rsOfferTable) ;
-    }
-    
-    // If we refactor the conneg into a single function, we can split boolean and result set handling. 
-    
-    // One or the other argument must be null
-    private static void doResponseResultSet$(HttpAction action,
-                                             ResultSet resultSet, Boolean booleanResult, 
-                                             Prologue qPrologue, 
-                                             AcceptList contentTypeOffer) 
-    {
-        HttpServletRequest request = action.request ;
-        HttpServletResponse response = action.response ;
-        long id = action.id ;
-        
-        if ( resultSet == null && booleanResult == null )
-        {
-            xlog.warn("doResponseResult: Both result set and boolean result are null") ; 
-            throw new FusekiException("Both result set and boolean result are null") ;
-        }
-        
-        if ( resultSet != null && booleanResult != null )
-        {
-            xlog.warn("doResponseResult: Both result set and boolean result are set") ; 
-            throw new FusekiException("Both result set and boolean result are set") ;
-        }
-
-        String mimeType = null ; 
-        MediaType i = ConNeg.chooseContentType(request, contentTypeOffer, DEF.acceptRSXML) ;
-        if ( i != null )
-            mimeType = i.getContentType() ;
-        
-        // Override content type
-        // Does &output= override?
-        // Requested output type by the web form or &output= in the request.
-        String outputField = ResponseOps.paramOutput(request, shortNamesResultSet) ;    // Expands short names
-        if ( outputField != null )
-            mimeType = outputField ;
-        
-        String serializationType = mimeType ;           // Choose the serializer based on this.
-        String contentType = mimeType ;                 // Set the HTTP respose header to this.
-             
-        // Stylesheet - change to application/xml.
-        final String stylesheetURL = ResponseOps.paramStylesheet(request) ;
-        if ( stylesheetURL != null && equal(serializationType,WebContent.contentTypeResultsXML) )
-            contentType = WebContent.contentTypeXML ;
-        
-        // Force to text/plain?
-        String forceAccept = ResponseOps.paramForceAccept(request) ;
-        if ( forceAccept != null )
-            contentType = WebContent.contentTypeTextPlain ;
-
-        // Better : dispatch on MediaType
-        // Fuseki2 uses the SPARQL parser/write registry.
-        if ( equal(serializationType, WebContent.contentTypeResultsXML) )
-            sparqlXMLOutput(action, contentType, resultSet, stylesheetURL, booleanResult) ;
-        else if ( equal(serializationType, WebContent.contentTypeResultsJSON) )
-            jsonOutput(action, contentType, resultSet, booleanResult) ;
-        else if ( equal(serializationType, WebContent.contentTypeTextPlain) )
-            textOutput(action, contentType, resultSet, qPrologue, booleanResult) ;
-        else if ( equal(serializationType, WebContent.contentTypeTextCSV) ) 
-            csvOutput(action, contentType, resultSet, booleanResult) ;
-        else if (equal(serializationType, WebContent.contentTypeTextTSV) )
-            tsvOutput(action, contentType, resultSet, booleanResult) ;
-        else if (equal(serializationType, WebContent.contentTypeResultsThrift) )
-            thriftOutput(action, contentType, resultSet, booleanResult) ;
-        else
-            errorBadRequest("Can't determine output serialization: "+serializationType) ;
-    }
-    
-    
-    public static void setHttpResponse(HttpServletRequest httpRequest,
-                                       HttpServletResponse httpResponse,
-                                       String contentType, String charset) 
-    {
-        // ---- Set up HTTP Response
-        // Stop caching (not that ?queryString URLs are cached anyway)
-        if ( true )
-        {
-            httpResponse.setHeader("Cache-Control", "no-cache") ;
-            httpResponse.setHeader("Pragma", "no-cache") ;
-        }
-        // See: http://www.w3.org/International/O-HTTP-charset.html
-        if ( contentType != null )
-        {
-            if ( charset != null && ! isXML(contentType) )
-                contentType = contentType+"; charset="+charset ;
-            log.trace("Content-Type for response: "+contentType) ;
-            httpResponse.setContentType(contentType) ;
-        }
-    }
-
-    private static boolean isXML(String contentType)
-    {
-        return contentType.equals(WebContent.contentTypeRDFXML)
-            || contentType.equals(WebContent.contentTypeResultsXML)
-            || contentType.equals(WebContent.contentTypeXML) ; 
-    }
-
-    private static void sparqlXMLOutput(HttpAction action, String contentType, final ResultSet resultSet, final String stylesheetURL, final Boolean booleanResult)
-    {
-        OutputContent proc = 
-            new OutputContent(){
-            @Override
-            public void output(ServletOutputStream out)
-            {
-                if ( resultSet != null )
-                    ResultSetFormatter.outputAsXML(out, resultSet, stylesheetURL) ;
-                if ( booleanResult != null )
-                    ResultSetFormatter.outputAsXML(out, booleanResult, stylesheetURL) ;
-            }} ;
-            output(action, contentType, null, proc) ;
-        }
-    
-    private static void jsonOutput(HttpAction action, String contentType, final ResultSet resultSet, final Boolean booleanResult)
-    {
-        OutputContent proc = new OutputContent(){
-            @Override
-            public void output(ServletOutputStream out)
-            {
-                if ( resultSet != null )
-                    ResultSetFormatter.outputAsJSON(out, resultSet) ;
-                if (  booleanResult != null )
-                    ResultSetFormatter.outputAsJSON(out, booleanResult ) ;
-            }
-        } ;
-        
-        try {
-            String callback = ResponseOps.paramCallback(action.request) ;
-            ServletOutputStream out = action.response.getOutputStream() ;
-
-            if ( callback != null )
-            {
-                callback = StringUtils.replaceChars(callback, "\r", "") ;
-                callback = StringUtils.replaceChars(callback, "\n", "") ;
-                out.print(callback) ;
-                out.println("(") ;
-            }
-
-            output(action, contentType, WebContent.charsetUTF8, proc) ;
-
-            if ( callback != null )
-                out.println(")") ;
-        } catch (IOException ex) { errorOccurred(ex) ; }
-    }
-    
-    private static void textOutput(HttpAction action, String contentType, final ResultSet resultSet, final Prologue qPrologue, final Boolean booleanResult)
-    {
-        // Text is not streaming.
-        OutputContent proc =  new OutputContent(){
-            @Override
-            public void output(ServletOutputStream out)
-            {
-                if ( resultSet != null )
-                    ResultSetFormatter.out(out, resultSet, qPrologue) ;
-                if (  booleanResult != null )
-                    ResultSetFormatter.out(out, booleanResult ) ;
-            }
-        };
-
-        output(action, contentType, WebContent.charsetUTF8, proc) ;
-    }
-
-    private static void csvOutput(HttpAction action, String contentType, final ResultSet resultSet, final Boolean booleanResult) {
-        OutputContent proc = new OutputContent(){
-            @Override
-            public void output(ServletOutputStream out)
-            {
-                if ( resultSet != null )
-                    ResultSetFormatter.outputAsCSV(out, resultSet) ;
-                if (  booleanResult != null )
-                    ResultSetFormatter.outputAsCSV(out, booleanResult ) ;
-            }
-        } ;
-        output(action, contentType, WebContent.charsetUTF8, proc) ; 
-    }
-
-    private static void tsvOutput(HttpAction action, String contentType, final ResultSet resultSet, final Boolean booleanResult) {
-        OutputContent proc = new OutputContent(){
-            @Override
-            public void output(ServletOutputStream out)
-            {
-                if ( resultSet != null )
-                    ResultSetFormatter.outputAsTSV(out, resultSet) ;
-                if (  booleanResult != null )
-                    ResultSetFormatter.outputAsTSV(out, booleanResult ) ;
-            }
-        } ;
-        output(action, contentType, WebContent.charsetUTF8, proc) ; 
-    }
-
-    private static void thriftOutput(HttpAction action, String contentType, final ResultSet resultSet, final Boolean booleanResult) {
-        OutputContent proc = new OutputContent(){
-            @Override
-            public void output(ServletOutputStream out)
-            {
-                if ( resultSet != null )
-                    ResultSetMgr.write(out, resultSet, ResultSetLang.SPARQLResultSetThrift) ;
-                if ( booleanResult != null )
-                    slog.error("Can't write boolen result in thrift") ;
-            }
-        } ;
-        output(action, contentType, WebContent.charsetUTF8, proc) ; 
-    }
-
-    private static void output(HttpAction action, String contentType, String charset, OutputContent proc) 
-    {
-        try {
-            setHttpResponse(action.request, action.response, contentType, charset) ; 
-            action.response.setStatus(HttpSC.OK_200) ;
-            ServletOutputStream out = action.response.getOutputStream() ;
-            try
-            {
-                proc.output(out) ;
-                out.flush() ;
-            } catch (QueryCancelledException ex) {
-                // Bother.  Status code 200 already sent.
-                slog.info(format("[%d] Query Cancelled - results truncated (but 200 already sent)", action.id)) ;
-                out.println() ;
-                out.println("##  Query cancelled due to timeout during execution   ##") ;
-                out.println("##  ****          Incomplete results           ****   ##") ;
-                out.flush() ;
-                // No point raising an exception - 200 was sent already.  
-                //errorOccurred(ex) ;
-            }
-        // Includes client gone.
-        } catch (IOException ex) 
-        { errorOccurred(ex) ; }
-        // Do not call httpResponse.flushBuffer(); here - Jetty closes the stream if it is a gzip stream
-        // then the JSON callback closing details can't be added. 
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Protocol.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Protocol.java b/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Protocol.java
deleted file mode 100644
index ed57a37..0000000
--- a/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Protocol.java
+++ /dev/null
@@ -1,101 +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.fuseki.servlets;
-
-import static org.apache.jena.fuseki.HttpNames.paramDefaultGraphURI ;
-import static org.apache.jena.fuseki.HttpNames.paramNamedGraphURI ;
-
-import java.util.Arrays ;
-import java.util.Collections ;
-import java.util.List ;
-
-import javax.servlet.http.HttpServletRequest ;
-
-import org.apache.jena.atlas.iterator.Filter ;
-import org.apache.jena.atlas.iterator.Iter ;
-import org.apache.jena.atlas.lib.Lib ;
-
-import com.hp.hpl.jena.query.Query ;
-import com.hp.hpl.jena.query.QueryParseException ;
-import com.hp.hpl.jena.sparql.core.DatasetDescription ;
-
-/** Support for the SPARQL protocol (SPARQL Query, SPARQL Update)
- */
-public  abstract class SPARQL_Protocol extends SPARQL_ServletBase
-{
-    protected SPARQL_Protocol() { super() ; }
-
-    protected static String messageForQPE(QueryParseException ex)
-    {
-        if ( ex.getMessage() != null )
-            return ex.getMessage() ;
-        if ( ex.getCause() != null )
-            return Lib.classShortName(ex.getCause().getClass()) ;
-        return null ;
-    }
-    
-    protected static DatasetDescription getDatasetDescription(HttpAction action)
-    {
-        List<String> graphURLs = toStrList(action.request.getParameterValues(paramDefaultGraphURI)) ;
-        List<String> namedGraphs = toStrList(action.request.getParameterValues(paramNamedGraphURI)) ;
-        
-        graphURLs = removeEmptyValues(graphURLs) ;
-        namedGraphs = removeEmptyValues(namedGraphs) ;
-        
-        if ( graphURLs.size() == 0 && namedGraphs.size() == 0 )
-            return null ;
-        return DatasetDescription.create(graphURLs, namedGraphs) ;
-    }
-    
-    protected static DatasetDescription getDatasetDescription(Query query)
-    {
-        return DatasetDescription.create(query) ;
-    }
-   
-    private static List<String> toStrList(String[] array)
-    {
-        if ( array == null )
-            return Collections.emptyList() ;
-        return Arrays.asList(array) ;
-    }
-
-    private static List<String> removeEmptyValues(List<String> list)
-    {
-        return Iter.iter(list).filter(acceptNonEmpty).toList() ;
-    }
-    
-    private static Filter<String> acceptNonEmpty = new Filter<String>(){ 
-        @Override
-        public boolean accept(String item)
-        {
-            return item != null && item.length() != 0 ;
-        }
-    } ;
-    
-    protected static int countParamOccurences(HttpServletRequest request, String param)
-    {
-        String[] x = request.getParameterValues(param) ;
-        if ( x == null )
-            return 0 ;
-        return x.length ;
-    }
-    
-
-}
-

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Query.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Query.java b/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Query.java
deleted file mode 100644
index 06f8340..0000000
--- a/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Query.java
+++ /dev/null
@@ -1,387 +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.fuseki.servlets;
-
-import static java.lang.String.format ;
-import static org.apache.jena.fuseki.HttpNames.* ;
-import static org.apache.jena.fuseki.server.CounterName.QueryExecErrors ;
-import static org.apache.jena.fuseki.server.CounterName.QueryTimeouts ;
-import static org.apache.jena.fuseki.server.CounterName.RequestsBad ;
-
-import java.io.IOException ;
-import java.io.InputStream ;
-import java.util.* ;
-
-import javax.servlet.http.HttpServletRequest ;
-import javax.servlet.http.HttpServletResponse ;
-
-import org.apache.jena.atlas.RuntimeIOException ;
-import org.apache.jena.atlas.io.IO ;
-import org.apache.jena.atlas.io.IndentedLineBuffer ;
-import org.apache.jena.atlas.web.ContentType ;
-import org.apache.jena.fuseki.FusekiException ;
-import org.apache.jena.fuseki.FusekiLib ;
-import org.apache.jena.fuseki.HttpNames ;
-import org.apache.jena.riot.WebContent ;
-import org.apache.jena.riot.web.HttpOp ;
-import org.apache.jena.web.HttpSC ;
-
-import com.hp.hpl.jena.query.* ;
-import com.hp.hpl.jena.rdf.model.Model ;
-import com.hp.hpl.jena.sparql.core.Prologue ;
-import com.hp.hpl.jena.sparql.resultset.SPARQLResult ;
-
-/**
- * Handles SPARQL Query requests.
- */
-public abstract class SPARQL_Query extends SPARQL_Protocol
-{
-    public SPARQL_Query()   { super() ; }
-
-    // Choose REST verbs to support.
-    
-    @Override
-    protected void doPost(HttpServletRequest request, HttpServletResponse response)
-    { doCommon(request, response) ; }
-    
-    @Override
-    protected void doGet(HttpServletRequest request, HttpServletResponse response)
-    { doCommon(request, response) ; }
-
-    // HEAD
-    
-    @Override
-    protected void doOptions(HttpServletRequest request, HttpServletResponse response)
-    {
-        setCommonHeadersForOptions(response) ;
-        response.setHeader(HttpNames.hAllow, "GET,OPTIONS,POST");
-        response.setHeader(HttpNames.hContentLengh, "0") ;
-    }
-    
-    @Override
-    protected final void perform(HttpAction action)
-    {
-        // GET
-        if ( action.request.getMethod().equals(HttpNames.METHOD_GET) ) {
-            executeWithParameter(action) ;
-            return ;
-        }
-
-        ContentType ct = FusekiLib.getContentType(action) ;
-        if ( ct == null ) {
-            // Validation check it's POST with ?query=
-            executeWithParameter(action) ;
-            return ;
-        }
-        
-        String incoming = ct.getContentType() ;
-        // POST application/sparql-query
-        if (WebContent.contentTypeSPARQLQuery.equals(incoming)) {
-            executeBody(action) ;
-            return ;
-        }
-        // POST application/x-www-form-url
-        if (WebContent.contentTypeHTMLForm.equals(incoming)) {
-            executeWithParameter(action) ;
-            return ;
-        }
-        
-        error(HttpSC.UNSUPPORTED_MEDIA_TYPE_415, "Bad content type: "+incoming) ;
-    }
-
-    // All the params we support
-
-    protected static List<String> allParams  = Arrays.asList(paramQuery, 
-                                                             paramDefaultGraphURI, paramNamedGraphURI, 
-                                                             paramQueryRef,
-                                                             paramStyleSheet,
-                                                             paramAccept,
-                                                             paramOutput1, paramOutput2, 
-                                                             paramCallback, 
-                                                             paramForceAccept,
-                                                             paramTimeout) ;
-
-    @Override
-    protected void validate(HttpAction action)
-    {
-        String method = action.request.getMethod().toUpperCase(Locale.ROOT) ;
-        
-        if ( ! HttpNames.METHOD_POST.equals(method) && ! HttpNames.METHOD_GET.equals(method) )
-            errorMethodNotAllowed("Not a GET or POST request") ;
-            
-        if ( HttpNames.METHOD_GET.equals(method) && action.request.getQueryString() == null )
-        {
-            warning("Service Description / SPARQL Query / "+action.request.getRequestURI()) ;
-            errorNotFound("Service Description: "+action.request.getRequestURI()) ;
-        }
-        
-        // Use of the dataset describing parameters is check later.
-        try {
-            validateParams(action.request, allParams) ;
-            validateRequest(action) ; 
-        } catch (ActionErrorException ex) { 
-            throw ex ; 
-        } 
-        // Query not yet parsed.
-    }
-    
-    /**
-     * Validate the request after checking HTTP method and HTTP Parameters.
-     * @param action HTTP Action
-     */
-    protected abstract void validateRequest(HttpAction action) ;
-    
-    /**
-     * Helper method for validating request.
-     * @param request HTTP request
-     * @param params parameters in a collection of Strings
-     */
-    protected void validateParams(HttpServletRequest request, Collection<String> params)
-    {
-        ContentType ct = FusekiLib.getContentType(request) ;
-        boolean mustHaveQueryParam = true ;
-        if ( ct != null )
-        {
-            String incoming = ct.getContentType() ;
-            
-            if ( WebContent.contentTypeSPARQLQuery.equals(incoming) )
-            {
-                mustHaveQueryParam = false ;
-                //error(HttpSC.UNSUPPORTED_MEDIA_TYPE_415, "Unofficial "+WebContent.contentTypeSPARQLQuery+" not supported") ;
-            }
-            else if ( WebContent.contentTypeHTMLForm.equals(incoming) ) {}
-            else
-                error(HttpSC.UNSUPPORTED_MEDIA_TYPE_415, "Unsupported: "+incoming) ;
-        }
-        
-        // GET/POST of a form at this point.
-        
-        if ( mustHaveQueryParam )
-        {
-            int N = countParamOccurences(request, paramQuery) ; 
-            
-            if ( N == 0 ) errorBadRequest("SPARQL Query: No 'query=' parameter") ;
-            if ( N > 1 ) errorBadRequest("SPARQL Query: Multiple 'query=' parameters") ;
-            
-            // application/sparql-query does not use a query param.
-            String queryStr = request.getParameter(HttpNames.paramQuery) ;
-            
-            if ( queryStr == null )
-                errorBadRequest("SPARQL Query: No query specified (no 'query=' found)") ;
-            if ( queryStr.isEmpty() )
-                errorBadRequest("SPARQL Query: Empty query string") ;
-        }
-
-        if ( params != null )
-        {
-            Enumeration<String> en = request.getParameterNames() ;
-            for ( ; en.hasMoreElements() ; )
-            {
-                String name = en.nextElement() ;
-                if ( ! params.contains(name) )
-                    warning("SPARQL Query: Unrecognize request parameter (ignored): "+name) ;
-            }
-        }
-    }
-
-    private void executeWithParameter(HttpAction action)
-    {
-        String queryString = action.request.getParameter(paramQuery) ;
-        execute(queryString, action) ;
-    }
-
-    private void executeBody(HttpAction action)
-    {
-        String queryString = null ;
-        try { 
-            InputStream input = action.request.getInputStream() ; 
-            queryString = IO.readWholeFileAsUTF8(input) ;
-        }
-        catch (IOException ex) { errorOccurred(ex) ; }
-        execute(queryString, action) ;
-    }
-
-    private void execute(String queryString, HttpAction action)
-    {
-        String queryStringLog = formatForLog(queryString) ;
-        if ( action.verbose )
-            log.info(format("[%d] Query = \n%s", action.id, queryString));
-        else
-            log.info(format("[%d] Query = %s", action.id, queryStringLog));
-
-        Query query = null ;
-        try {
-            // NB syntax is ARQ (a superset of SPARQL)
-            query = QueryFactory.create(queryString, "http://example/query-base", Syntax.syntaxARQ) ;
-            queryStringLog = formatForLog(query) ;
-            validateQuery(action, query) ;
-        } catch (ActionErrorException ex) {
-            incCounter(action.srvRef, RequestsBad) ;
-            throw ex ;
-        } catch (QueryParseException ex) {
-            incCounter(action.srvRef, RequestsBad) ;
-            errorBadRequest("Parse error: \n" + queryString + "\n\r" + messageForQPE(ex)) ;
-        } catch (RuntimeIOException ex) {
-            errorBadRequest("Runtime IO Exception: \n" + queryString + "\n\r" + ex.getMessage()) ;
-        }
-        // Should not happen.
-        catch (QueryException ex) {
-            errorBadRequest("Error: \n" + queryString + "\n\r" + ex.getMessage()) ;
-        }
-        
-        // Assumes finished whole thing by end of sendResult. 
-        action.beginRead() ;
-        try {
-            Dataset dataset = decideDataset(action, query, queryStringLog) ; 
-            try(QueryExecution qExec = createQueryExecution(query, dataset)) {
-                SPARQLResult result = executeQuery(action, qExec, query, queryStringLog) ;
-                // Deals with exceptions itself.
-                sendResults(action, result, query.getPrologue()) ;
-            }
-        } catch (QueryCancelledException ex) {
-            // Additional counter information.
-            incCounter(action.srvRef, QueryTimeouts) ; 
-            throw ex ; 
-        } catch (RuntimeIOException ex) {
-            incCounter(action.srvRef, QueryExecErrors) ;
-            throw ex ;
-        } catch (QueryExecException ex) { 
-            // Additional counter information.
-            incCounter(action.srvRef, QueryExecErrors) ; 
-            throw ex ;
-        } finally { 
-            action.endRead() ;
-        }
-    }
-
-    /**
-     * Check the query, throwing ActionErrorException when not valid, or calling super#error.
-     * @param action HTTP Action
-     * @param query the Query
-     */
-    protected abstract void validateQuery(HttpAction action, Query query) ;
-
-    protected QueryExecution createQueryExecution(Query query, Dataset dataset)
-    {
-        return QueryExecutionFactory.create(query, dataset) ;
-    }
-
-    protected SPARQLResult executeQuery(HttpAction action, QueryExecution qExec, Query query, String queryStringLog)
-    {
-        setAnyTimeouts(qExec, action);
-
-        if ( query.isSelectType() )
-        {
-            ResultSet rs = qExec.execSelect() ;
-            
-            // Force some query execution now.
-            //
-            // If the timeout-first-row goes off, the output stream has not 
-            // been started so the HTTP error code is sent. 
-            
-            rs.hasNext() ;
-
-            // If we wanted perfect query time cancellation, we could consume the result now
-            // to see if the timeout-end-of-query goes off.  
-            
-            //rs = ResultSetFactory.copyResults(rs) ;
-
-            log.info(format("[%d] exec/select", action.id)) ;
-            return new SPARQLResult(rs) ;
-        }
-
-        if ( query.isConstructType() )
-        {
-            Model model = qExec.execConstruct() ;
-            log.info(format("[%d] exec/construct", action.id)) ;
-            return new SPARQLResult(model) ;
-        }
-
-        if ( query.isDescribeType() )
-        {
-            Model model = qExec.execDescribe() ;
-            log.info(format("[%d] exec/describe",action.id)) ;
-            return new SPARQLResult(model) ;
-        }
-
-        if ( query.isAskType() )
-        {
-            boolean b = qExec.execAsk() ;
-            log.info(format("[%d] exec/ask",action.id)) ;
-            return new SPARQLResult(b) ;
-        }
-
-        errorBadRequest("Unknown query type - "+queryStringLog) ;
-        return null ;
-    }
-
-    private void setAnyTimeouts(QueryExecution qexec, HttpAction action) {
-        if (!(action.getDatasetRef().allowTimeoutOverride))
-            return;
-
-        long desiredTimeout = Long.MAX_VALUE;
-        String timeoutHeader = action.request.getHeader("Timeout");
-        String timeoutParameter = action.request.getParameter("timeout");
-        if (timeoutHeader != null) {
-            try {
-                desiredTimeout = (int) Float.parseFloat(timeoutHeader) * 1000;
-            } catch (NumberFormatException e) {
-                throw new FusekiException("Timeout header must be a number", e);
-            }
-        } else if (timeoutParameter != null) {
-            try {
-                desiredTimeout = (int) Float.parseFloat(timeoutParameter) * 1000;
-            } catch (NumberFormatException e) {
-                throw new FusekiException("timeout parameter must be a number", e);
-            }
-        }
-
-        desiredTimeout = Math.min(action.getDatasetRef().maximumTimeoutOverride, desiredTimeout);
-        if (desiredTimeout != Long.MAX_VALUE)
-            qexec.setTimeout(desiredTimeout);
-    }
-
-    protected abstract Dataset decideDataset(HttpAction action, Query query, String queryStringLog) ;
-
-    protected void sendResults(HttpAction action, SPARQLResult result, Prologue qPrologue)
-    {
-        if ( result.isResultSet() )
-            ResponseResultSet.doResponseResultSet(action, result.getResultSet(), qPrologue) ;
-        else if ( result.isGraph() )
-            ResponseModel.doResponseModel(action, result.getModel()) ;
-        else if ( result.isBoolean() )
-            ResponseResultSet.doResponseResultSet(action, result.getBooleanResult()) ;
-        else
-            errorOccurred("Unknown or invalid result type") ;
-    }
-    
-    private String formatForLog(Query query)
-    {
-        IndentedLineBuffer out = new IndentedLineBuffer() ;
-        out.setFlatMode(true) ;
-        query.serialize(out) ;
-        return out.asString() ;
-    }
-        
-    private String getRemoteString(String queryURI)
-    {
-        return HttpOp.execHttpGetString(queryURI) ;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_QueryDataset.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_QueryDataset.java b/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_QueryDataset.java
deleted file mode 100644
index 9e9df36..0000000
--- a/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_QueryDataset.java
+++ /dev/null
@@ -1,60 +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.fuseki.servlets;
-
-import com.hp.hpl.jena.query.Dataset ;
-import com.hp.hpl.jena.query.DatasetFactory ;
-import com.hp.hpl.jena.query.Query ;
-import com.hp.hpl.jena.sparql.core.DatasetDescription ;
-import com.hp.hpl.jena.sparql.core.DatasetGraph ;
-import com.hp.hpl.jena.sparql.core.DynamicDatasets ;
-
-public class SPARQL_QueryDataset extends SPARQL_Query
-{
-    public SPARQL_QueryDataset(boolean verbose)     { super() ; }
-
-    public SPARQL_QueryDataset()
-    { this(false) ; }
-    
-    @Override
-    protected void validateRequest(HttpAction action) 
-    { }
-
-    @Override
-    protected void validateQuery(HttpAction action, Query query) 
-    { }
-   
-    @Override
-    protected Dataset decideDataset(HttpAction action, Query query, String queryStringLog) 
-    { 
-        DatasetGraph dsg = action.getActiveDSG() ;
-        
-        // query.getDatasetDescription() ;
-        
-        // Protocol.
-        DatasetDescription dsDesc = getDatasetDescription(action) ;
-        if (dsDesc != null )
-        {
-            //errorBadRequest("SPARQL Query: Dataset description in the protocol request") ;
-            dsg = DynamicDatasets.dynamicDataset(dsDesc, dsg, false) ;
-        }
-        
-        return DatasetFactory.create(dsg) ;
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_QueryGeneral.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_QueryGeneral.java b/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_QueryGeneral.java
deleted file mode 100644
index a022e96..0000000
--- a/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_QueryGeneral.java
+++ /dev/null
@@ -1,143 +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.fuseki.servlets;
-
-import static java.lang.String.format ;
-
-import java.util.List ;
-
-import org.apache.jena.atlas.lib.InternalErrorException ;
-import org.apache.jena.fuseki.migrate.GraphLoadUtils ;
-import org.apache.jena.riot.RiotException ;
-
-import com.hp.hpl.jena.query.Dataset ;
-import com.hp.hpl.jena.query.DatasetFactory ;
-import com.hp.hpl.jena.query.Query ;
-import com.hp.hpl.jena.rdf.model.Model ;
-import com.hp.hpl.jena.rdf.model.ModelFactory ;
-import com.hp.hpl.jena.sparql.core.DatasetDescription ;
-
-public class SPARQL_QueryGeneral extends SPARQL_Query
-{
-    final static int MaxTriples = 100*1000 ; 
-    
-    public SPARQL_QueryGeneral()    { super() ; }
-
-    @Override
-    protected void validateRequest(HttpAction action) {}
-
-    @Override
-    protected void validateQuery(HttpAction action, Query query) {}
-    
-    @Override
-    protected String mapRequestToDataset(String uri)
-    { return null ; }
-    
-    @Override
-    protected Dataset decideDataset(HttpAction action, Query query, String queryStringLog) 
-    {
-        DatasetDescription datasetDesc = getDatasetDescription(action) ;
-        if ( datasetDesc == null )
-            datasetDesc = getDatasetDescription(query) ;
-        if ( datasetDesc == null )
-            errorBadRequest("No dataset description in protocol request or in the query string") ;
-
-        return datasetFromDescription(action, datasetDesc) ;
-    }
-
-    /**
-     * Construct a Dataset based on a dataset description.
-     */
-    
-    protected static Dataset datasetFromDescription(HttpAction action, DatasetDescription datasetDesc)
-    {
-        try {
-            if ( datasetDesc == null )
-                return null ;
-            if ( datasetDesc.isEmpty() )
-                return null ;
-            
-            List<String> graphURLs = datasetDesc.getDefaultGraphURIs() ;
-            List<String> namedGraphs = datasetDesc.getNamedGraphURIs() ;
-            
-            if ( graphURLs.size() == 0 && namedGraphs.size() == 0 )
-                    return null ;
-            
-            Dataset dataset = DatasetFactory.createMem() ;
-            // Look in cache for loaded graphs!!
-
-            // ---- Default graph
-            {
-                Model model = ModelFactory.createDefaultModel() ;
-                for ( String uri : graphURLs )
-                {
-                    if ( uri == null || uri.equals("") )
-                        throw new InternalErrorException("Default graph URI is null or the empty string")  ;
-
-                    try {
-                        //TODO Clearup - RIOT integration.
-                        GraphLoadUtils.loadModel(model, uri, MaxTriples) ;
-                        log.info(format("[%d] Load (default graph) %s", action.id, uri)) ;
-                    } catch (RiotException ex) {
-                        log.info(format("[%d] Parsing error loading %s: %s", action.id, uri, ex.getMessage())) ;
-                        errorBadRequest("Failed to load URL (parse error) "+uri+" : "+ex.getMessage()) ;
-                    } catch (Exception ex)
-                    {
-                        log.info(format("[%d] Failed to load (default) %s: %s", action.id, uri, ex.getMessage())) ;
-                        errorBadRequest("Failed to load URL "+uri) ;
-                    }
-                }
-                dataset.setDefaultModel(model) ;
-            }
-            // ---- Named graphs
-            if ( namedGraphs != null )
-            {
-                for ( String uri : namedGraphs )
-                {
-                    if ( uri == null || uri.equals("") )
-                        throw new InternalErrorException("Named graph URI is null or the empty string")  ;
-
-                    try {
-                        Model model = ModelFactory.createDefaultModel() ;
-                        GraphLoadUtils.loadModel(model, uri, MaxTriples) ;
-                        log.info(format("[%d] Load (named graph) %s", action.id, uri)) ;
-                        dataset.addNamedModel(uri, model) ;
-                    } catch (RiotException ex) {
-                        log.info(format("[%d] Parsing error loading %s: %s", action.id, uri, ex.getMessage())) ;
-                        errorBadRequest("Failed to load URL (parse error) "+uri+" : "+ex.getMessage()) ;
-                    } catch (Exception ex)
-                    {
-                        log.info(format("[%d] Failed to load (named graph) %s: %s", action.id, uri, ex.getMessage())) ;
-                        errorBadRequest("Failed to load URL "+uri) ;
-                    }
-                }
-            }
-            
-            return dataset ;
-            
-        } 
-        catch (ActionErrorException ex) { throw ex ; }
-        catch (Exception ex)
-        {
-            log.info(format("[%d] SPARQL parameter error: "+ex.getMessage(),action.id, ex)) ;
-            errorBadRequest("Parameter error: "+ex.getMessage());
-            return null ;
-        }
-    }
-}


[07/23] jena git commit: Rename folder jena-fuseki to jena-fuseki1

Posted by an...@apache.org.
http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/s-update
----------------------------------------------------------------------
diff --git a/jena-fuseki1/s-update b/jena-fuseki1/s-update
new file mode 100755
index 0000000..4f6590d
--- /dev/null
+++ b/jena-fuseki1/s-update
@@ -0,0 +1,713 @@
+#!/usr/bin/env ruby
+# -*- coding: utf-8 -*-
+
+# 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.
+
+# SPARQL HTTP Update, client.
+
+require 'optparse'
+require 'net/http'
+require 'uri'
+require 'cgi'
+require 'pp'
+require 'ostruct'
+
+# ToDo
+#  Allow a choice of media type for GET
+#   --accept "content-type" (and abbreviations)
+#   --header "Add:this"
+#   --user, --password
+#  Basic authentication: request.basic_auth("username", "password")
+#  Follow redirects => 301:  puts response["location"] # All headers are lowercase?
+
+SOH_NAME="SOH"
+SOH_VERSION="0.0.0"
+
+$proxy = ENV['http_proxy'] ? URI.parse(ENV['http_proxy']) : OpenStruct.new  
+
+# What about direct naming?
+
+# Names
+$mtTurtle           = 'text/turtle;charset=utf-8'
+$mtRDF              = 'application/rdf+xml'
+$mtText             = 'text/plain'
+$mtNTriples         = 'application/n-triples'
+$mtNQuads           = 'application/n-quads'
+$mtJSONLD           = 'application/ld+json'
+$mtTriG             = 'application/trig'
+$mtSparqlResultsX   = 'application/sparql-results+xml'
+$mtSparqlResultsJ   = 'application/sparql-results+json'
+$mtAppJSON          = 'application/json'
+$mtAppXML           = 'application/xml'
+$mtSparqlResultsTSV = 'application/sparql-results+tsv'
+$mtSparqlResultsCSV = 'application/sparql-results+csv'
+$mtSparqlUpdate     = 'application/sparql-update'
+$mtWWWForm          = 'application/x-www-form-urlencoded'
+$mtSparqlQuery      = "application/sparql-query" ;
+
+# Global media type table.
+$fileMediaTypes = {}
+$fileMediaTypes['ttl']   = $mtTurtle
+$fileMediaTypes['n3']    = 'text/n3; charset=utf-8'
+$fileMediaTypes['nt']    = $mtText
+$fileMediaTypes['rdf']   = $mtRDF
+$fileMediaTypes['owl']   = $mtRDF
+$fileMediaTypes['nq']    = $mtNQuads
+$fileMediaTypes['trig']  = $mtTriG
+$fileMediaTypes['json-ld']  = $mtJSONLD
+$fileMediaTypes['jsonld']  = $mtJSONLD
+
+# Global charset : no entry means "don't set"
+$charsetUTF8      = 'utf-8'
+$charset = {}
+$charset[$mtTurtle]   = 'utf-8'
+$charset[$mtText]     = 'ascii'
+$charset[$mtTriG]     = 'utf-8'
+$charset[$mtNQuads]   = 'utf-8'
+
+# Headers
+
+$hContentType         = 'Content-Type'
+# $hContentEncoding     = 'Content-Encoding'
+$hContentLength       = 'Content-Length'
+# $hContentLocation     = 'Content-Location'
+# $hContentRange        = 'Content-Range'
+
+$hAccept              = 'Accept'
+$hAcceptCharset       = 'Accept-Charset'
+$hAcceptEncoding      = 'Accept-Encoding'
+$hAcceptRanges        = 'Accept-Ranges' 
+
+$headers = { "User-Agent" => "#{SOH_NAME}/Fuseki #{SOH_VERSION}"}
+$print_http = false
+
+# Default for GET
+# At least allow anything (and hope!)
+$accept_rdf="#{$mtTurtle} , #{$mtNTriples};q=0.9 , #{$mtRDF};q=0.8 , #{$mtJSONLD};q=0.5"
+# Datasets
+$accept_ds="#{$mtTrig} , #{$mtNQuads};q=0.9 , #{$mtJSONLD};q=0.5"
+# For SPARQL query
+$accept_results="#{$mtSparqlResultsJ} , #{$mtSparqlResultsX};q=0.9 , #{$accept_rdf}"
+
+# Accept any in case of trouble.
+$accept_rdf="#{$accept_rdf} , */*;q=0.1"
+$accept_results="#{$accept_results} , */*;q=0.1" 
+
+# The media type usually forces the charset.
+$accept_charset=nil
+
+## Who we are.
+## Two styles:
+##    s-query .....
+##    soh query .....
+
+$cmd = File.basename($0)
+if $cmd == 'soh'
+then
+  $cmd = (ARGV.size == 0) ? 'soh' : ARGV.shift
+end
+
+if ! $cmd.start_with?('s-') && $cmd != 'soh'
+  $cmd = 's-'+$cmd
+end
+
+## -------- 
+
+def GET(dataset, graph)
+  print "GET #{dataset} #{graph}\n" if $verbose
+  requestURI = target(dataset, graph)
+  headers = {}
+  headers.merge!($headers)
+  headers[$hAccept] = $accept_rdf
+  headers[$hAcceptCharset] = $accept_charset unless $accept_charset.nil?
+  get_worker(requestURI, headers)
+end
+
+def get_worker(requestURI, headers)
+  uri = URI.parse(requestURI)
+  request = Net::HTTP::Get.new(uri.request_uri)
+  request.initialize_http_header(headers)
+  print_http_request(uri, request)
+  response_print_body(uri, request)
+end
+
+def HEAD(dataset, graph)
+  print "HEAD #{dataset} #{graph}\n" if $verbose
+  requestURI = target(dataset, graph)
+  headers = {}
+  headers.merge!($headers)
+  headers[$hAccept] = $accept_rdf
+  headers[$hAcceptCharset] = $accept_charset unless $accept_charset.nil?
+  uri = URI.parse(requestURI)
+  request = Net::HTTP::Head.new(uri.request_uri)
+  request.initialize_http_header(headers)
+  print_http_request(uri, request)
+  response_no_body(uri, request)
+end
+
+def PUT(dataset, graph, file)
+  print "PUT #{dataset} #{graph} #{file}\n" if $verbose
+  send_body(dataset, graph, file, Net::HTTP::Put)
+end
+
+def POST(dataset, graph, file)
+  print "POST #{dataset} #{graph} #{file}\n" if $verbose
+  send_body(dataset, graph, file, Net::HTTP::Post)
+end
+
+def DELETE(dataset, graph)
+  print "DELETE #{dataset} #{graph}\n" if $verbose
+  requestURI = target(dataset, graph)
+  uri = URI.parse(requestURI)
+  request = Net::HTTP::Delete.new(uri.request_uri)
+  headers = {}
+  headers.merge!($headers)
+  request.initialize_http_header(headers)
+  print_http_request(uri, request)
+  response_no_body(uri, request)
+end
+
+def uri_escape(string)
+  CGI.escape(string)
+end
+
+def target(dataset, graph)
+  return dataset+"?default" if graph == "default"
+  return dataset+"?graph="+uri_escape(graph)
+end
+
+def send_body(dataset, graph, file, method)
+  mt = content_type(file)
+  headers = {}
+  headers.merge!($headers)
+  headers[$hContentType] = mt
+  headers[$hContentLength] = File.size(file).to_s
+  ## p headers
+
+  requestURI = target(dataset, graph)
+  uri = URI.parse(requestURI)
+  
+  request = method.new(uri.request_uri)
+  request.initialize_http_header(headers)
+  print_http_request(uri, request)
+  request.body_stream = File.open(file)
+  response_no_body(uri, request)
+end
+
+def response_no_body(uri, request)
+  http = Net::HTTP::Proxy($proxy.host,$proxy.port).new(uri.host, uri.port)
+  http.read_timeout = nil
+  # check we can connect.
+  begin http.start
+  rescue Exception => e  
+    # puts e.message  
+    #puts e.backtrace.inspect  
+    warn_exit "Failed to connect: #{uri.host}:#{uri.port}: #{e.message}", 3
+  end
+  response = http.request(request)
+  print_http_response(response)
+  case response
+  when Net::HTTPSuccess, Net::HTTPRedirection
+    # OK
+  when Net::HTTPNotFound
+    warn_exit "404 Not found: #{uri}", 9
+    #print response.body
+  else
+    warn_exit "#{response.code} #{response.message} #{uri}", 9
+    # Unreachable
+      response.error!
+  end
+  # NO BODY IN RESPONSE
+end
+
+def response_print_body(uri, request)
+  http = Net::HTTP::Proxy($proxy.host,$proxy.port).new(uri.host, uri.port)
+  http.read_timeout = nil
+  # check we can connect.
+  begin http.start
+  rescue => e  
+    #puts e.backtrace.inspect  
+    #print e.class
+    warn_exit "Failed to connect: #{uri.host}:#{uri.port}: #{e.message}", 3
+  end
+
+  # Add a blank line if headers were output.
+  print "\n" if $http_print ;
+
+  begin
+    response = http.request(request) { |res| 
+      print_http_response(res)
+      #puts res.code
+      res.read_body do |segment|
+        print segment
+      end
+    }
+    case response
+    when Net::HTTPSuccess, Net::HTTPRedirection
+      # OK
+    when Net::HTTPNotFound
+      warn_exit "404 Not found: #{uri}", 9
+      #print response.body
+    else
+      warn_exit "#{response.code}: #{uri}", 9
+      # Unreachable
+      response.error!
+    end
+  rescue EOFError => e
+    warn_exit "IO Error: "+e.message, 3
+  end
+end
+
+def print_http_request(uri, request)
+  return unless $print_http
+  #print "Request\n"
+  print request.method," ",uri, "\n"
+  print_headers("  ",request)
+end
+
+def print_http_response(response)
+  return unless $print_http
+  #print "Response\n"
+  print response.code, " ", response.message, "\n"
+  print_headers("  ",response)
+end
+
+def print_headers(marker, headers)
+  headers.each do |k,v| 
+    k = k.split('-').map{|w| w.capitalize}.join('-')+':'
+    printf "%s%-20s %s\n",marker,k,v
+  end
+end
+
+def content_type(file)
+  file =~ /\.([^.]*)$/
+  ext = $1
+  mt = $fileMediaTypes[ext]
+  cs = $charset[mt]
+  mt = mt+';charset='+cs if ! cs.nil?
+  return mt
+end
+
+def charset(content_type)
+  return $charset[content_type]
+end
+
+def warn_exit(msg, rc)
+    warn msg
+    exit rc ;
+end
+
+def parseURI(uri_string)
+  begin
+    return URI.parse(uri_string).to_s
+  rescue URI::InvalidURIError => err
+    warn_exit "Bad URI: <#{uri_string}>", 2
+  end
+end
+
+## ---- Command
+
+def cmd_soh(command=nil)
+  ## Command line
+  options = {}
+  optparse = OptionParser.new do |opts|
+    # Set a banner, displayed at the top
+    # of the help screen.
+    case $cmd
+    when "s-http", "sparql-http", "soh"
+      banner="$cmd [get|post|put|delete] datasetURI graph [file]"
+    when "s-get", "s-head", "s-delete"
+      banner="$cmd  datasetURI graph"
+    end
+
+    opts.banner = $banner
+    # Define the options, and what they do
+    
+    options[:verbose] = false
+    opts.on( '-v', '--verbose', 'Verbose' ) do
+      options[:verbose] = true
+    end
+    
+    options[:version] = false
+    opts.on( '--version', 'Print version and exit' ) do
+      print "#{SOH_NAME} #{SOH_VERSION}\n"
+      exit
+    end
+    
+    # This displays the help screen, all programs are
+    # assumed to have this option.
+    opts.on( '-h', '--help', 'Display this screen and exit' ) do
+      puts opts
+      exit
+    end
+  end
+
+  begin optparse.parse!    
+  rescue OptionParser::InvalidArgument => e
+    warn e
+    exit
+  end
+
+  $verbose = options[:verbose]
+  $print_http = $verbose
+
+  if command.nil?
+    if ARGV.size == 0
+      warn "No command given: expected one of 'get', 'put', 'post', 'delete', 'query' or 'update'"
+      exit 1
+    end
+    cmdPrint=ARGV.shift
+    command=cmdPrint.upcase
+  else
+    cmdPrint=command
+  end
+
+  case command
+  when "HEAD", "GET", "DELETE"
+    requiredFile=false
+  when "PUT", "POST"
+    requiredFile=true
+  when "QUERY"
+    cmd_sparql_query
+  when "UPDATE"
+    cmd_sparql_update
+  else
+    warn_exit "Unknown command: #{command}", 2
+  end
+
+  if requiredFile 
+  then
+    if ARGV.size != 3
+      warn_exit "Required: dataset URI, graph URI (or 'default') and file", 1 
+    end
+  else
+    if ARGV.size != 2
+      warn_exit "Required: dataset URI and graph URI (or 'default')", 1 
+    end
+  end
+
+  dataset=parseURI(ARGV.shift)
+  # Relative URI?
+  graph=parseURI(ARGV.shift)
+  file=""
+  if requiredFile
+  then
+    file = ARGV.shift if requiredFile
+    if ! File.exist?(file)
+      warn_exit "No such file: "+file, 3
+    end
+    if File.directory?(file)
+      warn_exit "File is a directory: "+file, 3
+    end
+  end
+
+  case command
+  when "GET"
+    GET(dataset, graph)
+  when "HEAD"
+    HEAD(dataset, graph)
+  when "PUT"
+    PUT(dataset, graph, file)
+  when "DELETE"
+    DELETE(dataset, graph)
+  when "POST"
+    POST(dataset, graph, file)
+  else
+    warn_exit "Internal error: Unknown command: #{cmd}", 2
+  end
+  exit 0
+end
+
+## --------
+def string_or_file(arg)
+  return arg if ! arg.match(/^@/)
+  a=(arg[1..-1])
+  open(a, 'rb'){|f| f.read}
+end
+
+## -------- SPARQL Query
+
+## Choose method
+def SPARQL_query(service, query, query_file, forcePOST=false, args2={})
+   if ! query_file.nil?
+    query = open(query_file, 'rb'){|f| f.read}
+  end
+  if forcePOST || query.length >= 2*1024 
+    SPARQL_query_POST(service, query, args2)
+  else
+    SPARQL_query_GET(service, query, args2)
+  end
+end
+
+## By GET
+
+def SPARQL_query_GET(service, query, args2)
+  args = { "query" => query }
+  args.merge!(args2)
+  qs=args.collect { |k,v| "#{k}=#{uri_escape(v)}" }.join('&')
+  action="#{service}?#{qs}"
+  headers={}
+  headers.merge!($headers)
+  headers[$hAccept]=$accept_results
+  get_worker(action, headers)
+end
+
+## By POST
+
+def SPARQL_query_POST(service, query, args2)
+  # DRY - body/no body for each of request and response.
+  post_params={ "query" => query }
+  post_params.merge!(args2)
+  uri = URI.parse(service)
+  headers={}
+  headers.merge!($headers)
+  headers[$hAccept]=$accept_results
+  execute_post_form_body(uri, headers, post_params)
+end
+
+def execute_post_form_body(uri, headers, post_params)
+  request = Net::HTTP::Post.new(uri.request_uri)
+  qs=post_params.collect { |k,v| "#{k}=#{uri_escape(v)}" }.join('&')
+  headers[$hContentType] = $mtWWWForm
+  headers[$hContentLength] = qs.length.to_s
+  request.initialize_http_header(headers)
+  request.body = qs
+  print_http_request(uri, request)
+  response_print_body(uri, request)
+end
+
+# Usage: -v --help --file= --query=
+def cmd_sparql_query
+  options={}
+  optparse = OptionParser.new do |opts|
+    opts.banner = "Usage: #{$cmd} [--query QUERY] [--service URI] [--post] 'query' | @file"
+    opts.on('--service=URI', '--server=URI', 'SPARQL endpoint') do |uri|
+      options[:service]=uri
+    end
+    opts.on('--query=FILE','--file=FILE', 'Take query from a file') do |file|
+      options[:file]=file
+    end
+    opts.on('--output=TYPE', [:json,:xml,:text,:csv,:tsv],
+            'Set the output argument') do |type|
+      options[:output]=type
+    end
+    opts.on('--accept=TYPE', [:json,:xml,:text,:csv,:tsv], 
+            'Set the accept header type') do |type|
+      options[:accept]=type
+    end
+    options[:verbose] = false
+    opts.on( '--post', 'Force use of POST' ) do
+      options[:post] = true
+    end
+    opts.on( '-v', '--verbose', 'Verbose' ) do
+      options[:verbose] = true
+    end
+    opts.on( '--version', 'Print version and exit' ) do
+      print "#{SOH_NAME} #{SOH_VERSION}\n"
+      exit
+    end 
+    opts.on( '-h', '--help', 'Display this screen and exit' ) do
+      puts opts
+      exit
+    end
+  end
+
+  begin optparse.parse!    
+  rescue OptionParser::InvalidArgument, OptionParser::InvalidOption => e
+    warn e
+    exit 1
+  end
+
+  $verbose = options[:verbose]
+  $print_http = $verbose
+  usePOST = options[:post]
+
+  service = options[:service]
+  warn_exit 'No service specified.  Required --service=URI',1 if service.nil?
+
+  # Query
+  query=nil
+  query_file=options[:file]
+  if query_file.nil? && ARGV.size == 0
+  then
+    warn_exit 'No query specified.',1
+    end
+  if query_file.nil?
+    query = ARGV.shift
+    if query.match(/^@/)
+      query_file = query[1..-1]
+      query = nil
+    end
+  end
+
+  # --output ==> output= (non-standard)
+  args={}
+  case options[:output]
+  when nil
+  when  "json","xml","text","csv","tsv"
+    args['output'] = options[:output]
+  when :json,:xml,:text,:csv,:tsv
+    args['output'] = options[:output].to_s
+  else
+    warn_exit "Unrecognized output type: "+options[:output],2
+  end
+
+  # --accept
+  # options[:accept]
+
+  print "SPARQL #{service}\n" if $verbose
+  #args={"output"=>"text"}
+  SPARQL_query(service, query, query_file, usePOST, args)
+  exit(0)
+end
+
+## -------- SPARQL Update
+
+# Update sent as a WWW form.
+def SPARQL_update_by_form(service, update, args2={})
+  args = {}
+  args.merge!(args2)
+  headers={}
+  headers.merge!($headers)
+  # args? encode?
+  body="update="+uri_escape(update)
+  headers[$hContentType] = $mtWWWForm
+  headers[$hContentLength] = body.length.to_s
+  uri = URI.parse(service)
+  execute_post_form(uri, headers, body)
+end
+
+# DRY - query form.
+def execute_post_form(uri, headers, body)
+  request = Net::HTTP::Post.new(uri.request_uri)
+  request.initialize_http_header(headers)
+  request.body = body
+  print_http_request(uri, request)
+  response_no_body(uri, request)
+end
+
+def SPARQL_update(service, update, args2={})
+  args = {}
+  args.merge!(args2)
+  headers={}
+  headers.merge!($headers)
+  headers[$hContentType] = $mtSparqlUpdate
+  uri = URI.parse(service)
+  request = Net::HTTP::Post.new(uri.request_uri)
+  request.initialize_http_header(headers)
+  request.body = update
+  print_http_request(uri, request)
+  response_no_body(uri, request)
+end
+
+def cmd_sparql_update(by_raw_post=true)
+  # Share with cmd_sparql_query
+  options={}
+  optparse = OptionParser.new do |opts|
+    opts.banner = "Usage: #{$cmd} [--file REQUEST] [--service URI] 'request' | @file"
+    opts.on('--service=URI', '--server=URI', 'SPARQL endpoint') do |uri|
+      options[:service]=uri
+    end
+    opts.on('--update=FILE', '--file=FILE', 'Take update from a file') do |file|
+      options[:file]=file
+    end
+    options[:verbose] = false
+    opts.on( '-v', '--verbose', 'Verbose' ) do
+      options[:verbose] = true
+    end
+    opts.on( '--version', 'Print version and exit' ) do
+      print "#{SOH_NAME} #{SOH_VERSION}\n"
+      exit
+    end 
+    opts.on( '-h', '--help', 'Display this screen and exit' ) do
+      puts opts
+      exit
+    end
+  end
+
+  begin optparse.parse!    
+  rescue OptionParser::InvalidArgument => e
+    warn e
+    exit
+  end
+
+  $verbose = options[:verbose]
+  $print_http = $verbose
+
+  service = options[:service]
+  warn_exit 'No service specified. Required --service=URI',1   if service.nil?
+  
+  update=nil
+  update_file=options[:file]
+
+  if update_file.nil? && ARGV.size == 0
+  then
+    warn_exit 'No update specified.',1
+    end
+  if update_file.nil?
+    update = ARGV.shift
+    if update.match(/^@/)
+      update_file = update[1..-1]
+      update = nil
+    end
+  end
+  
+  print "SPARQL-Update #{service}\n" if $verbose
+  args={}
+
+  # Reads in the file :-(
+  if update.nil?
+  then
+    update = open(update_file, 'rb'){|f| f.read}
+  else
+    update = string_or_file(update)
+  end
+
+  if by_raw_post
+    SPARQL_update(service, update, args)
+  else
+    SPARQL_update_by_form(service, update, args)
+  end
+  exit(0)
+end
+
+## -------
+
+case $cmd
+when "s-http", "sparql-http", "soh"
+  $banner="#{$cmd} [get|post|put|delete] datasetURI graph [file]"
+  cmd_soh
+when "s-get", "s-head", "s-put", "s-delete", "s-post"
+
+  case $cmd
+  when "s-get", "s-head", "s-delete"
+    $banner="#{$cmd} datasetURI graph"
+  when "s-put", "s-post"
+    $banner="#{$cmd} datasetURI graph file"
+  end
+  cmd2 = $cmd.sub(/^s-/, '').upcase
+  cmd_soh cmd2
+
+when "s-query", "sparql-query"
+  cmd_sparql_query
+when "s-update", "sparql-update"
+  cmd_sparql_update true
+when "s-update-form", "sparql-update-form"
+  cmd_sparql_update false
+else 
+  warn_exit "Unknown: "+$cmd, 1
+end

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/s-update-form
----------------------------------------------------------------------
diff --git a/jena-fuseki1/s-update-form b/jena-fuseki1/s-update-form
new file mode 100755
index 0000000..4f6590d
--- /dev/null
+++ b/jena-fuseki1/s-update-form
@@ -0,0 +1,713 @@
+#!/usr/bin/env ruby
+# -*- coding: utf-8 -*-
+
+# 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.
+
+# SPARQL HTTP Update, client.
+
+require 'optparse'
+require 'net/http'
+require 'uri'
+require 'cgi'
+require 'pp'
+require 'ostruct'
+
+# ToDo
+#  Allow a choice of media type for GET
+#   --accept "content-type" (and abbreviations)
+#   --header "Add:this"
+#   --user, --password
+#  Basic authentication: request.basic_auth("username", "password")
+#  Follow redirects => 301:  puts response["location"] # All headers are lowercase?
+
+SOH_NAME="SOH"
+SOH_VERSION="0.0.0"
+
+$proxy = ENV['http_proxy'] ? URI.parse(ENV['http_proxy']) : OpenStruct.new  
+
+# What about direct naming?
+
+# Names
+$mtTurtle           = 'text/turtle;charset=utf-8'
+$mtRDF              = 'application/rdf+xml'
+$mtText             = 'text/plain'
+$mtNTriples         = 'application/n-triples'
+$mtNQuads           = 'application/n-quads'
+$mtJSONLD           = 'application/ld+json'
+$mtTriG             = 'application/trig'
+$mtSparqlResultsX   = 'application/sparql-results+xml'
+$mtSparqlResultsJ   = 'application/sparql-results+json'
+$mtAppJSON          = 'application/json'
+$mtAppXML           = 'application/xml'
+$mtSparqlResultsTSV = 'application/sparql-results+tsv'
+$mtSparqlResultsCSV = 'application/sparql-results+csv'
+$mtSparqlUpdate     = 'application/sparql-update'
+$mtWWWForm          = 'application/x-www-form-urlencoded'
+$mtSparqlQuery      = "application/sparql-query" ;
+
+# Global media type table.
+$fileMediaTypes = {}
+$fileMediaTypes['ttl']   = $mtTurtle
+$fileMediaTypes['n3']    = 'text/n3; charset=utf-8'
+$fileMediaTypes['nt']    = $mtText
+$fileMediaTypes['rdf']   = $mtRDF
+$fileMediaTypes['owl']   = $mtRDF
+$fileMediaTypes['nq']    = $mtNQuads
+$fileMediaTypes['trig']  = $mtTriG
+$fileMediaTypes['json-ld']  = $mtJSONLD
+$fileMediaTypes['jsonld']  = $mtJSONLD
+
+# Global charset : no entry means "don't set"
+$charsetUTF8      = 'utf-8'
+$charset = {}
+$charset[$mtTurtle]   = 'utf-8'
+$charset[$mtText]     = 'ascii'
+$charset[$mtTriG]     = 'utf-8'
+$charset[$mtNQuads]   = 'utf-8'
+
+# Headers
+
+$hContentType         = 'Content-Type'
+# $hContentEncoding     = 'Content-Encoding'
+$hContentLength       = 'Content-Length'
+# $hContentLocation     = 'Content-Location'
+# $hContentRange        = 'Content-Range'
+
+$hAccept              = 'Accept'
+$hAcceptCharset       = 'Accept-Charset'
+$hAcceptEncoding      = 'Accept-Encoding'
+$hAcceptRanges        = 'Accept-Ranges' 
+
+$headers = { "User-Agent" => "#{SOH_NAME}/Fuseki #{SOH_VERSION}"}
+$print_http = false
+
+# Default for GET
+# At least allow anything (and hope!)
+$accept_rdf="#{$mtTurtle} , #{$mtNTriples};q=0.9 , #{$mtRDF};q=0.8 , #{$mtJSONLD};q=0.5"
+# Datasets
+$accept_ds="#{$mtTrig} , #{$mtNQuads};q=0.9 , #{$mtJSONLD};q=0.5"
+# For SPARQL query
+$accept_results="#{$mtSparqlResultsJ} , #{$mtSparqlResultsX};q=0.9 , #{$accept_rdf}"
+
+# Accept any in case of trouble.
+$accept_rdf="#{$accept_rdf} , */*;q=0.1"
+$accept_results="#{$accept_results} , */*;q=0.1" 
+
+# The media type usually forces the charset.
+$accept_charset=nil
+
+## Who we are.
+## Two styles:
+##    s-query .....
+##    soh query .....
+
+$cmd = File.basename($0)
+if $cmd == 'soh'
+then
+  $cmd = (ARGV.size == 0) ? 'soh' : ARGV.shift
+end
+
+if ! $cmd.start_with?('s-') && $cmd != 'soh'
+  $cmd = 's-'+$cmd
+end
+
+## -------- 
+
+def GET(dataset, graph)
+  print "GET #{dataset} #{graph}\n" if $verbose
+  requestURI = target(dataset, graph)
+  headers = {}
+  headers.merge!($headers)
+  headers[$hAccept] = $accept_rdf
+  headers[$hAcceptCharset] = $accept_charset unless $accept_charset.nil?
+  get_worker(requestURI, headers)
+end
+
+def get_worker(requestURI, headers)
+  uri = URI.parse(requestURI)
+  request = Net::HTTP::Get.new(uri.request_uri)
+  request.initialize_http_header(headers)
+  print_http_request(uri, request)
+  response_print_body(uri, request)
+end
+
+def HEAD(dataset, graph)
+  print "HEAD #{dataset} #{graph}\n" if $verbose
+  requestURI = target(dataset, graph)
+  headers = {}
+  headers.merge!($headers)
+  headers[$hAccept] = $accept_rdf
+  headers[$hAcceptCharset] = $accept_charset unless $accept_charset.nil?
+  uri = URI.parse(requestURI)
+  request = Net::HTTP::Head.new(uri.request_uri)
+  request.initialize_http_header(headers)
+  print_http_request(uri, request)
+  response_no_body(uri, request)
+end
+
+def PUT(dataset, graph, file)
+  print "PUT #{dataset} #{graph} #{file}\n" if $verbose
+  send_body(dataset, graph, file, Net::HTTP::Put)
+end
+
+def POST(dataset, graph, file)
+  print "POST #{dataset} #{graph} #{file}\n" if $verbose
+  send_body(dataset, graph, file, Net::HTTP::Post)
+end
+
+def DELETE(dataset, graph)
+  print "DELETE #{dataset} #{graph}\n" if $verbose
+  requestURI = target(dataset, graph)
+  uri = URI.parse(requestURI)
+  request = Net::HTTP::Delete.new(uri.request_uri)
+  headers = {}
+  headers.merge!($headers)
+  request.initialize_http_header(headers)
+  print_http_request(uri, request)
+  response_no_body(uri, request)
+end
+
+def uri_escape(string)
+  CGI.escape(string)
+end
+
+def target(dataset, graph)
+  return dataset+"?default" if graph == "default"
+  return dataset+"?graph="+uri_escape(graph)
+end
+
+def send_body(dataset, graph, file, method)
+  mt = content_type(file)
+  headers = {}
+  headers.merge!($headers)
+  headers[$hContentType] = mt
+  headers[$hContentLength] = File.size(file).to_s
+  ## p headers
+
+  requestURI = target(dataset, graph)
+  uri = URI.parse(requestURI)
+  
+  request = method.new(uri.request_uri)
+  request.initialize_http_header(headers)
+  print_http_request(uri, request)
+  request.body_stream = File.open(file)
+  response_no_body(uri, request)
+end
+
+def response_no_body(uri, request)
+  http = Net::HTTP::Proxy($proxy.host,$proxy.port).new(uri.host, uri.port)
+  http.read_timeout = nil
+  # check we can connect.
+  begin http.start
+  rescue Exception => e  
+    # puts e.message  
+    #puts e.backtrace.inspect  
+    warn_exit "Failed to connect: #{uri.host}:#{uri.port}: #{e.message}", 3
+  end
+  response = http.request(request)
+  print_http_response(response)
+  case response
+  when Net::HTTPSuccess, Net::HTTPRedirection
+    # OK
+  when Net::HTTPNotFound
+    warn_exit "404 Not found: #{uri}", 9
+    #print response.body
+  else
+    warn_exit "#{response.code} #{response.message} #{uri}", 9
+    # Unreachable
+      response.error!
+  end
+  # NO BODY IN RESPONSE
+end
+
+def response_print_body(uri, request)
+  http = Net::HTTP::Proxy($proxy.host,$proxy.port).new(uri.host, uri.port)
+  http.read_timeout = nil
+  # check we can connect.
+  begin http.start
+  rescue => e  
+    #puts e.backtrace.inspect  
+    #print e.class
+    warn_exit "Failed to connect: #{uri.host}:#{uri.port}: #{e.message}", 3
+  end
+
+  # Add a blank line if headers were output.
+  print "\n" if $http_print ;
+
+  begin
+    response = http.request(request) { |res| 
+      print_http_response(res)
+      #puts res.code
+      res.read_body do |segment|
+        print segment
+      end
+    }
+    case response
+    when Net::HTTPSuccess, Net::HTTPRedirection
+      # OK
+    when Net::HTTPNotFound
+      warn_exit "404 Not found: #{uri}", 9
+      #print response.body
+    else
+      warn_exit "#{response.code}: #{uri}", 9
+      # Unreachable
+      response.error!
+    end
+  rescue EOFError => e
+    warn_exit "IO Error: "+e.message, 3
+  end
+end
+
+def print_http_request(uri, request)
+  return unless $print_http
+  #print "Request\n"
+  print request.method," ",uri, "\n"
+  print_headers("  ",request)
+end
+
+def print_http_response(response)
+  return unless $print_http
+  #print "Response\n"
+  print response.code, " ", response.message, "\n"
+  print_headers("  ",response)
+end
+
+def print_headers(marker, headers)
+  headers.each do |k,v| 
+    k = k.split('-').map{|w| w.capitalize}.join('-')+':'
+    printf "%s%-20s %s\n",marker,k,v
+  end
+end
+
+def content_type(file)
+  file =~ /\.([^.]*)$/
+  ext = $1
+  mt = $fileMediaTypes[ext]
+  cs = $charset[mt]
+  mt = mt+';charset='+cs if ! cs.nil?
+  return mt
+end
+
+def charset(content_type)
+  return $charset[content_type]
+end
+
+def warn_exit(msg, rc)
+    warn msg
+    exit rc ;
+end
+
+def parseURI(uri_string)
+  begin
+    return URI.parse(uri_string).to_s
+  rescue URI::InvalidURIError => err
+    warn_exit "Bad URI: <#{uri_string}>", 2
+  end
+end
+
+## ---- Command
+
+def cmd_soh(command=nil)
+  ## Command line
+  options = {}
+  optparse = OptionParser.new do |opts|
+    # Set a banner, displayed at the top
+    # of the help screen.
+    case $cmd
+    when "s-http", "sparql-http", "soh"
+      banner="$cmd [get|post|put|delete] datasetURI graph [file]"
+    when "s-get", "s-head", "s-delete"
+      banner="$cmd  datasetURI graph"
+    end
+
+    opts.banner = $banner
+    # Define the options, and what they do
+    
+    options[:verbose] = false
+    opts.on( '-v', '--verbose', 'Verbose' ) do
+      options[:verbose] = true
+    end
+    
+    options[:version] = false
+    opts.on( '--version', 'Print version and exit' ) do
+      print "#{SOH_NAME} #{SOH_VERSION}\n"
+      exit
+    end
+    
+    # This displays the help screen, all programs are
+    # assumed to have this option.
+    opts.on( '-h', '--help', 'Display this screen and exit' ) do
+      puts opts
+      exit
+    end
+  end
+
+  begin optparse.parse!    
+  rescue OptionParser::InvalidArgument => e
+    warn e
+    exit
+  end
+
+  $verbose = options[:verbose]
+  $print_http = $verbose
+
+  if command.nil?
+    if ARGV.size == 0
+      warn "No command given: expected one of 'get', 'put', 'post', 'delete', 'query' or 'update'"
+      exit 1
+    end
+    cmdPrint=ARGV.shift
+    command=cmdPrint.upcase
+  else
+    cmdPrint=command
+  end
+
+  case command
+  when "HEAD", "GET", "DELETE"
+    requiredFile=false
+  when "PUT", "POST"
+    requiredFile=true
+  when "QUERY"
+    cmd_sparql_query
+  when "UPDATE"
+    cmd_sparql_update
+  else
+    warn_exit "Unknown command: #{command}", 2
+  end
+
+  if requiredFile 
+  then
+    if ARGV.size != 3
+      warn_exit "Required: dataset URI, graph URI (or 'default') and file", 1 
+    end
+  else
+    if ARGV.size != 2
+      warn_exit "Required: dataset URI and graph URI (or 'default')", 1 
+    end
+  end
+
+  dataset=parseURI(ARGV.shift)
+  # Relative URI?
+  graph=parseURI(ARGV.shift)
+  file=""
+  if requiredFile
+  then
+    file = ARGV.shift if requiredFile
+    if ! File.exist?(file)
+      warn_exit "No such file: "+file, 3
+    end
+    if File.directory?(file)
+      warn_exit "File is a directory: "+file, 3
+    end
+  end
+
+  case command
+  when "GET"
+    GET(dataset, graph)
+  when "HEAD"
+    HEAD(dataset, graph)
+  when "PUT"
+    PUT(dataset, graph, file)
+  when "DELETE"
+    DELETE(dataset, graph)
+  when "POST"
+    POST(dataset, graph, file)
+  else
+    warn_exit "Internal error: Unknown command: #{cmd}", 2
+  end
+  exit 0
+end
+
+## --------
+def string_or_file(arg)
+  return arg if ! arg.match(/^@/)
+  a=(arg[1..-1])
+  open(a, 'rb'){|f| f.read}
+end
+
+## -------- SPARQL Query
+
+## Choose method
+def SPARQL_query(service, query, query_file, forcePOST=false, args2={})
+   if ! query_file.nil?
+    query = open(query_file, 'rb'){|f| f.read}
+  end
+  if forcePOST || query.length >= 2*1024 
+    SPARQL_query_POST(service, query, args2)
+  else
+    SPARQL_query_GET(service, query, args2)
+  end
+end
+
+## By GET
+
+def SPARQL_query_GET(service, query, args2)
+  args = { "query" => query }
+  args.merge!(args2)
+  qs=args.collect { |k,v| "#{k}=#{uri_escape(v)}" }.join('&')
+  action="#{service}?#{qs}"
+  headers={}
+  headers.merge!($headers)
+  headers[$hAccept]=$accept_results
+  get_worker(action, headers)
+end
+
+## By POST
+
+def SPARQL_query_POST(service, query, args2)
+  # DRY - body/no body for each of request and response.
+  post_params={ "query" => query }
+  post_params.merge!(args2)
+  uri = URI.parse(service)
+  headers={}
+  headers.merge!($headers)
+  headers[$hAccept]=$accept_results
+  execute_post_form_body(uri, headers, post_params)
+end
+
+def execute_post_form_body(uri, headers, post_params)
+  request = Net::HTTP::Post.new(uri.request_uri)
+  qs=post_params.collect { |k,v| "#{k}=#{uri_escape(v)}" }.join('&')
+  headers[$hContentType] = $mtWWWForm
+  headers[$hContentLength] = qs.length.to_s
+  request.initialize_http_header(headers)
+  request.body = qs
+  print_http_request(uri, request)
+  response_print_body(uri, request)
+end
+
+# Usage: -v --help --file= --query=
+def cmd_sparql_query
+  options={}
+  optparse = OptionParser.new do |opts|
+    opts.banner = "Usage: #{$cmd} [--query QUERY] [--service URI] [--post] 'query' | @file"
+    opts.on('--service=URI', '--server=URI', 'SPARQL endpoint') do |uri|
+      options[:service]=uri
+    end
+    opts.on('--query=FILE','--file=FILE', 'Take query from a file') do |file|
+      options[:file]=file
+    end
+    opts.on('--output=TYPE', [:json,:xml,:text,:csv,:tsv],
+            'Set the output argument') do |type|
+      options[:output]=type
+    end
+    opts.on('--accept=TYPE', [:json,:xml,:text,:csv,:tsv], 
+            'Set the accept header type') do |type|
+      options[:accept]=type
+    end
+    options[:verbose] = false
+    opts.on( '--post', 'Force use of POST' ) do
+      options[:post] = true
+    end
+    opts.on( '-v', '--verbose', 'Verbose' ) do
+      options[:verbose] = true
+    end
+    opts.on( '--version', 'Print version and exit' ) do
+      print "#{SOH_NAME} #{SOH_VERSION}\n"
+      exit
+    end 
+    opts.on( '-h', '--help', 'Display this screen and exit' ) do
+      puts opts
+      exit
+    end
+  end
+
+  begin optparse.parse!    
+  rescue OptionParser::InvalidArgument, OptionParser::InvalidOption => e
+    warn e
+    exit 1
+  end
+
+  $verbose = options[:verbose]
+  $print_http = $verbose
+  usePOST = options[:post]
+
+  service = options[:service]
+  warn_exit 'No service specified.  Required --service=URI',1 if service.nil?
+
+  # Query
+  query=nil
+  query_file=options[:file]
+  if query_file.nil? && ARGV.size == 0
+  then
+    warn_exit 'No query specified.',1
+    end
+  if query_file.nil?
+    query = ARGV.shift
+    if query.match(/^@/)
+      query_file = query[1..-1]
+      query = nil
+    end
+  end
+
+  # --output ==> output= (non-standard)
+  args={}
+  case options[:output]
+  when nil
+  when  "json","xml","text","csv","tsv"
+    args['output'] = options[:output]
+  when :json,:xml,:text,:csv,:tsv
+    args['output'] = options[:output].to_s
+  else
+    warn_exit "Unrecognized output type: "+options[:output],2
+  end
+
+  # --accept
+  # options[:accept]
+
+  print "SPARQL #{service}\n" if $verbose
+  #args={"output"=>"text"}
+  SPARQL_query(service, query, query_file, usePOST, args)
+  exit(0)
+end
+
+## -------- SPARQL Update
+
+# Update sent as a WWW form.
+def SPARQL_update_by_form(service, update, args2={})
+  args = {}
+  args.merge!(args2)
+  headers={}
+  headers.merge!($headers)
+  # args? encode?
+  body="update="+uri_escape(update)
+  headers[$hContentType] = $mtWWWForm
+  headers[$hContentLength] = body.length.to_s
+  uri = URI.parse(service)
+  execute_post_form(uri, headers, body)
+end
+
+# DRY - query form.
+def execute_post_form(uri, headers, body)
+  request = Net::HTTP::Post.new(uri.request_uri)
+  request.initialize_http_header(headers)
+  request.body = body
+  print_http_request(uri, request)
+  response_no_body(uri, request)
+end
+
+def SPARQL_update(service, update, args2={})
+  args = {}
+  args.merge!(args2)
+  headers={}
+  headers.merge!($headers)
+  headers[$hContentType] = $mtSparqlUpdate
+  uri = URI.parse(service)
+  request = Net::HTTP::Post.new(uri.request_uri)
+  request.initialize_http_header(headers)
+  request.body = update
+  print_http_request(uri, request)
+  response_no_body(uri, request)
+end
+
+def cmd_sparql_update(by_raw_post=true)
+  # Share with cmd_sparql_query
+  options={}
+  optparse = OptionParser.new do |opts|
+    opts.banner = "Usage: #{$cmd} [--file REQUEST] [--service URI] 'request' | @file"
+    opts.on('--service=URI', '--server=URI', 'SPARQL endpoint') do |uri|
+      options[:service]=uri
+    end
+    opts.on('--update=FILE', '--file=FILE', 'Take update from a file') do |file|
+      options[:file]=file
+    end
+    options[:verbose] = false
+    opts.on( '-v', '--verbose', 'Verbose' ) do
+      options[:verbose] = true
+    end
+    opts.on( '--version', 'Print version and exit' ) do
+      print "#{SOH_NAME} #{SOH_VERSION}\n"
+      exit
+    end 
+    opts.on( '-h', '--help', 'Display this screen and exit' ) do
+      puts opts
+      exit
+    end
+  end
+
+  begin optparse.parse!    
+  rescue OptionParser::InvalidArgument => e
+    warn e
+    exit
+  end
+
+  $verbose = options[:verbose]
+  $print_http = $verbose
+
+  service = options[:service]
+  warn_exit 'No service specified. Required --service=URI',1   if service.nil?
+  
+  update=nil
+  update_file=options[:file]
+
+  if update_file.nil? && ARGV.size == 0
+  then
+    warn_exit 'No update specified.',1
+    end
+  if update_file.nil?
+    update = ARGV.shift
+    if update.match(/^@/)
+      update_file = update[1..-1]
+      update = nil
+    end
+  end
+  
+  print "SPARQL-Update #{service}\n" if $verbose
+  args={}
+
+  # Reads in the file :-(
+  if update.nil?
+  then
+    update = open(update_file, 'rb'){|f| f.read}
+  else
+    update = string_or_file(update)
+  end
+
+  if by_raw_post
+    SPARQL_update(service, update, args)
+  else
+    SPARQL_update_by_form(service, update, args)
+  end
+  exit(0)
+end
+
+## -------
+
+case $cmd
+when "s-http", "sparql-http", "soh"
+  $banner="#{$cmd} [get|post|put|delete] datasetURI graph [file]"
+  cmd_soh
+when "s-get", "s-head", "s-put", "s-delete", "s-post"
+
+  case $cmd
+  when "s-get", "s-head", "s-delete"
+    $banner="#{$cmd} datasetURI graph"
+  when "s-put", "s-post"
+    $banner="#{$cmd} datasetURI graph file"
+  end
+  cmd2 = $cmd.sub(/^s-/, '').upcase
+  cmd_soh cmd2
+
+when "s-query", "sparql-query"
+  cmd_sparql_query
+when "s-update", "sparql-update"
+  cmd_sparql_update true
+when "s-update-form", "sparql-update-form"
+  cmd_sparql_update false
+else 
+  warn_exit "Unknown: "+$cmd, 1
+end

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/soh
----------------------------------------------------------------------
diff --git a/jena-fuseki1/soh b/jena-fuseki1/soh
new file mode 100755
index 0000000..4f6590d
--- /dev/null
+++ b/jena-fuseki1/soh
@@ -0,0 +1,713 @@
+#!/usr/bin/env ruby
+# -*- coding: utf-8 -*-
+
+# 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.
+
+# SPARQL HTTP Update, client.
+
+require 'optparse'
+require 'net/http'
+require 'uri'
+require 'cgi'
+require 'pp'
+require 'ostruct'
+
+# ToDo
+#  Allow a choice of media type for GET
+#   --accept "content-type" (and abbreviations)
+#   --header "Add:this"
+#   --user, --password
+#  Basic authentication: request.basic_auth("username", "password")
+#  Follow redirects => 301:  puts response["location"] # All headers are lowercase?
+
+SOH_NAME="SOH"
+SOH_VERSION="0.0.0"
+
+$proxy = ENV['http_proxy'] ? URI.parse(ENV['http_proxy']) : OpenStruct.new  
+
+# What about direct naming?
+
+# Names
+$mtTurtle           = 'text/turtle;charset=utf-8'
+$mtRDF              = 'application/rdf+xml'
+$mtText             = 'text/plain'
+$mtNTriples         = 'application/n-triples'
+$mtNQuads           = 'application/n-quads'
+$mtJSONLD           = 'application/ld+json'
+$mtTriG             = 'application/trig'
+$mtSparqlResultsX   = 'application/sparql-results+xml'
+$mtSparqlResultsJ   = 'application/sparql-results+json'
+$mtAppJSON          = 'application/json'
+$mtAppXML           = 'application/xml'
+$mtSparqlResultsTSV = 'application/sparql-results+tsv'
+$mtSparqlResultsCSV = 'application/sparql-results+csv'
+$mtSparqlUpdate     = 'application/sparql-update'
+$mtWWWForm          = 'application/x-www-form-urlencoded'
+$mtSparqlQuery      = "application/sparql-query" ;
+
+# Global media type table.
+$fileMediaTypes = {}
+$fileMediaTypes['ttl']   = $mtTurtle
+$fileMediaTypes['n3']    = 'text/n3; charset=utf-8'
+$fileMediaTypes['nt']    = $mtText
+$fileMediaTypes['rdf']   = $mtRDF
+$fileMediaTypes['owl']   = $mtRDF
+$fileMediaTypes['nq']    = $mtNQuads
+$fileMediaTypes['trig']  = $mtTriG
+$fileMediaTypes['json-ld']  = $mtJSONLD
+$fileMediaTypes['jsonld']  = $mtJSONLD
+
+# Global charset : no entry means "don't set"
+$charsetUTF8      = 'utf-8'
+$charset = {}
+$charset[$mtTurtle]   = 'utf-8'
+$charset[$mtText]     = 'ascii'
+$charset[$mtTriG]     = 'utf-8'
+$charset[$mtNQuads]   = 'utf-8'
+
+# Headers
+
+$hContentType         = 'Content-Type'
+# $hContentEncoding     = 'Content-Encoding'
+$hContentLength       = 'Content-Length'
+# $hContentLocation     = 'Content-Location'
+# $hContentRange        = 'Content-Range'
+
+$hAccept              = 'Accept'
+$hAcceptCharset       = 'Accept-Charset'
+$hAcceptEncoding      = 'Accept-Encoding'
+$hAcceptRanges        = 'Accept-Ranges' 
+
+$headers = { "User-Agent" => "#{SOH_NAME}/Fuseki #{SOH_VERSION}"}
+$print_http = false
+
+# Default for GET
+# At least allow anything (and hope!)
+$accept_rdf="#{$mtTurtle} , #{$mtNTriples};q=0.9 , #{$mtRDF};q=0.8 , #{$mtJSONLD};q=0.5"
+# Datasets
+$accept_ds="#{$mtTrig} , #{$mtNQuads};q=0.9 , #{$mtJSONLD};q=0.5"
+# For SPARQL query
+$accept_results="#{$mtSparqlResultsJ} , #{$mtSparqlResultsX};q=0.9 , #{$accept_rdf}"
+
+# Accept any in case of trouble.
+$accept_rdf="#{$accept_rdf} , */*;q=0.1"
+$accept_results="#{$accept_results} , */*;q=0.1" 
+
+# The media type usually forces the charset.
+$accept_charset=nil
+
+## Who we are.
+## Two styles:
+##    s-query .....
+##    soh query .....
+
+$cmd = File.basename($0)
+if $cmd == 'soh'
+then
+  $cmd = (ARGV.size == 0) ? 'soh' : ARGV.shift
+end
+
+if ! $cmd.start_with?('s-') && $cmd != 'soh'
+  $cmd = 's-'+$cmd
+end
+
+## -------- 
+
+def GET(dataset, graph)
+  print "GET #{dataset} #{graph}\n" if $verbose
+  requestURI = target(dataset, graph)
+  headers = {}
+  headers.merge!($headers)
+  headers[$hAccept] = $accept_rdf
+  headers[$hAcceptCharset] = $accept_charset unless $accept_charset.nil?
+  get_worker(requestURI, headers)
+end
+
+def get_worker(requestURI, headers)
+  uri = URI.parse(requestURI)
+  request = Net::HTTP::Get.new(uri.request_uri)
+  request.initialize_http_header(headers)
+  print_http_request(uri, request)
+  response_print_body(uri, request)
+end
+
+def HEAD(dataset, graph)
+  print "HEAD #{dataset} #{graph}\n" if $verbose
+  requestURI = target(dataset, graph)
+  headers = {}
+  headers.merge!($headers)
+  headers[$hAccept] = $accept_rdf
+  headers[$hAcceptCharset] = $accept_charset unless $accept_charset.nil?
+  uri = URI.parse(requestURI)
+  request = Net::HTTP::Head.new(uri.request_uri)
+  request.initialize_http_header(headers)
+  print_http_request(uri, request)
+  response_no_body(uri, request)
+end
+
+def PUT(dataset, graph, file)
+  print "PUT #{dataset} #{graph} #{file}\n" if $verbose
+  send_body(dataset, graph, file, Net::HTTP::Put)
+end
+
+def POST(dataset, graph, file)
+  print "POST #{dataset} #{graph} #{file}\n" if $verbose
+  send_body(dataset, graph, file, Net::HTTP::Post)
+end
+
+def DELETE(dataset, graph)
+  print "DELETE #{dataset} #{graph}\n" if $verbose
+  requestURI = target(dataset, graph)
+  uri = URI.parse(requestURI)
+  request = Net::HTTP::Delete.new(uri.request_uri)
+  headers = {}
+  headers.merge!($headers)
+  request.initialize_http_header(headers)
+  print_http_request(uri, request)
+  response_no_body(uri, request)
+end
+
+def uri_escape(string)
+  CGI.escape(string)
+end
+
+def target(dataset, graph)
+  return dataset+"?default" if graph == "default"
+  return dataset+"?graph="+uri_escape(graph)
+end
+
+def send_body(dataset, graph, file, method)
+  mt = content_type(file)
+  headers = {}
+  headers.merge!($headers)
+  headers[$hContentType] = mt
+  headers[$hContentLength] = File.size(file).to_s
+  ## p headers
+
+  requestURI = target(dataset, graph)
+  uri = URI.parse(requestURI)
+  
+  request = method.new(uri.request_uri)
+  request.initialize_http_header(headers)
+  print_http_request(uri, request)
+  request.body_stream = File.open(file)
+  response_no_body(uri, request)
+end
+
+def response_no_body(uri, request)
+  http = Net::HTTP::Proxy($proxy.host,$proxy.port).new(uri.host, uri.port)
+  http.read_timeout = nil
+  # check we can connect.
+  begin http.start
+  rescue Exception => e  
+    # puts e.message  
+    #puts e.backtrace.inspect  
+    warn_exit "Failed to connect: #{uri.host}:#{uri.port}: #{e.message}", 3
+  end
+  response = http.request(request)
+  print_http_response(response)
+  case response
+  when Net::HTTPSuccess, Net::HTTPRedirection
+    # OK
+  when Net::HTTPNotFound
+    warn_exit "404 Not found: #{uri}", 9
+    #print response.body
+  else
+    warn_exit "#{response.code} #{response.message} #{uri}", 9
+    # Unreachable
+      response.error!
+  end
+  # NO BODY IN RESPONSE
+end
+
+def response_print_body(uri, request)
+  http = Net::HTTP::Proxy($proxy.host,$proxy.port).new(uri.host, uri.port)
+  http.read_timeout = nil
+  # check we can connect.
+  begin http.start
+  rescue => e  
+    #puts e.backtrace.inspect  
+    #print e.class
+    warn_exit "Failed to connect: #{uri.host}:#{uri.port}: #{e.message}", 3
+  end
+
+  # Add a blank line if headers were output.
+  print "\n" if $http_print ;
+
+  begin
+    response = http.request(request) { |res| 
+      print_http_response(res)
+      #puts res.code
+      res.read_body do |segment|
+        print segment
+      end
+    }
+    case response
+    when Net::HTTPSuccess, Net::HTTPRedirection
+      # OK
+    when Net::HTTPNotFound
+      warn_exit "404 Not found: #{uri}", 9
+      #print response.body
+    else
+      warn_exit "#{response.code}: #{uri}", 9
+      # Unreachable
+      response.error!
+    end
+  rescue EOFError => e
+    warn_exit "IO Error: "+e.message, 3
+  end
+end
+
+def print_http_request(uri, request)
+  return unless $print_http
+  #print "Request\n"
+  print request.method," ",uri, "\n"
+  print_headers("  ",request)
+end
+
+def print_http_response(response)
+  return unless $print_http
+  #print "Response\n"
+  print response.code, " ", response.message, "\n"
+  print_headers("  ",response)
+end
+
+def print_headers(marker, headers)
+  headers.each do |k,v| 
+    k = k.split('-').map{|w| w.capitalize}.join('-')+':'
+    printf "%s%-20s %s\n",marker,k,v
+  end
+end
+
+def content_type(file)
+  file =~ /\.([^.]*)$/
+  ext = $1
+  mt = $fileMediaTypes[ext]
+  cs = $charset[mt]
+  mt = mt+';charset='+cs if ! cs.nil?
+  return mt
+end
+
+def charset(content_type)
+  return $charset[content_type]
+end
+
+def warn_exit(msg, rc)
+    warn msg
+    exit rc ;
+end
+
+def parseURI(uri_string)
+  begin
+    return URI.parse(uri_string).to_s
+  rescue URI::InvalidURIError => err
+    warn_exit "Bad URI: <#{uri_string}>", 2
+  end
+end
+
+## ---- Command
+
+def cmd_soh(command=nil)
+  ## Command line
+  options = {}
+  optparse = OptionParser.new do |opts|
+    # Set a banner, displayed at the top
+    # of the help screen.
+    case $cmd
+    when "s-http", "sparql-http", "soh"
+      banner="$cmd [get|post|put|delete] datasetURI graph [file]"
+    when "s-get", "s-head", "s-delete"
+      banner="$cmd  datasetURI graph"
+    end
+
+    opts.banner = $banner
+    # Define the options, and what they do
+    
+    options[:verbose] = false
+    opts.on( '-v', '--verbose', 'Verbose' ) do
+      options[:verbose] = true
+    end
+    
+    options[:version] = false
+    opts.on( '--version', 'Print version and exit' ) do
+      print "#{SOH_NAME} #{SOH_VERSION}\n"
+      exit
+    end
+    
+    # This displays the help screen, all programs are
+    # assumed to have this option.
+    opts.on( '-h', '--help', 'Display this screen and exit' ) do
+      puts opts
+      exit
+    end
+  end
+
+  begin optparse.parse!    
+  rescue OptionParser::InvalidArgument => e
+    warn e
+    exit
+  end
+
+  $verbose = options[:verbose]
+  $print_http = $verbose
+
+  if command.nil?
+    if ARGV.size == 0
+      warn "No command given: expected one of 'get', 'put', 'post', 'delete', 'query' or 'update'"
+      exit 1
+    end
+    cmdPrint=ARGV.shift
+    command=cmdPrint.upcase
+  else
+    cmdPrint=command
+  end
+
+  case command
+  when "HEAD", "GET", "DELETE"
+    requiredFile=false
+  when "PUT", "POST"
+    requiredFile=true
+  when "QUERY"
+    cmd_sparql_query
+  when "UPDATE"
+    cmd_sparql_update
+  else
+    warn_exit "Unknown command: #{command}", 2
+  end
+
+  if requiredFile 
+  then
+    if ARGV.size != 3
+      warn_exit "Required: dataset URI, graph URI (or 'default') and file", 1 
+    end
+  else
+    if ARGV.size != 2
+      warn_exit "Required: dataset URI and graph URI (or 'default')", 1 
+    end
+  end
+
+  dataset=parseURI(ARGV.shift)
+  # Relative URI?
+  graph=parseURI(ARGV.shift)
+  file=""
+  if requiredFile
+  then
+    file = ARGV.shift if requiredFile
+    if ! File.exist?(file)
+      warn_exit "No such file: "+file, 3
+    end
+    if File.directory?(file)
+      warn_exit "File is a directory: "+file, 3
+    end
+  end
+
+  case command
+  when "GET"
+    GET(dataset, graph)
+  when "HEAD"
+    HEAD(dataset, graph)
+  when "PUT"
+    PUT(dataset, graph, file)
+  when "DELETE"
+    DELETE(dataset, graph)
+  when "POST"
+    POST(dataset, graph, file)
+  else
+    warn_exit "Internal error: Unknown command: #{cmd}", 2
+  end
+  exit 0
+end
+
+## --------
+def string_or_file(arg)
+  return arg if ! arg.match(/^@/)
+  a=(arg[1..-1])
+  open(a, 'rb'){|f| f.read}
+end
+
+## -------- SPARQL Query
+
+## Choose method
+def SPARQL_query(service, query, query_file, forcePOST=false, args2={})
+   if ! query_file.nil?
+    query = open(query_file, 'rb'){|f| f.read}
+  end
+  if forcePOST || query.length >= 2*1024 
+    SPARQL_query_POST(service, query, args2)
+  else
+    SPARQL_query_GET(service, query, args2)
+  end
+end
+
+## By GET
+
+def SPARQL_query_GET(service, query, args2)
+  args = { "query" => query }
+  args.merge!(args2)
+  qs=args.collect { |k,v| "#{k}=#{uri_escape(v)}" }.join('&')
+  action="#{service}?#{qs}"
+  headers={}
+  headers.merge!($headers)
+  headers[$hAccept]=$accept_results
+  get_worker(action, headers)
+end
+
+## By POST
+
+def SPARQL_query_POST(service, query, args2)
+  # DRY - body/no body for each of request and response.
+  post_params={ "query" => query }
+  post_params.merge!(args2)
+  uri = URI.parse(service)
+  headers={}
+  headers.merge!($headers)
+  headers[$hAccept]=$accept_results
+  execute_post_form_body(uri, headers, post_params)
+end
+
+def execute_post_form_body(uri, headers, post_params)
+  request = Net::HTTP::Post.new(uri.request_uri)
+  qs=post_params.collect { |k,v| "#{k}=#{uri_escape(v)}" }.join('&')
+  headers[$hContentType] = $mtWWWForm
+  headers[$hContentLength] = qs.length.to_s
+  request.initialize_http_header(headers)
+  request.body = qs
+  print_http_request(uri, request)
+  response_print_body(uri, request)
+end
+
+# Usage: -v --help --file= --query=
+def cmd_sparql_query
+  options={}
+  optparse = OptionParser.new do |opts|
+    opts.banner = "Usage: #{$cmd} [--query QUERY] [--service URI] [--post] 'query' | @file"
+    opts.on('--service=URI', '--server=URI', 'SPARQL endpoint') do |uri|
+      options[:service]=uri
+    end
+    opts.on('--query=FILE','--file=FILE', 'Take query from a file') do |file|
+      options[:file]=file
+    end
+    opts.on('--output=TYPE', [:json,:xml,:text,:csv,:tsv],
+            'Set the output argument') do |type|
+      options[:output]=type
+    end
+    opts.on('--accept=TYPE', [:json,:xml,:text,:csv,:tsv], 
+            'Set the accept header type') do |type|
+      options[:accept]=type
+    end
+    options[:verbose] = false
+    opts.on( '--post', 'Force use of POST' ) do
+      options[:post] = true
+    end
+    opts.on( '-v', '--verbose', 'Verbose' ) do
+      options[:verbose] = true
+    end
+    opts.on( '--version', 'Print version and exit' ) do
+      print "#{SOH_NAME} #{SOH_VERSION}\n"
+      exit
+    end 
+    opts.on( '-h', '--help', 'Display this screen and exit' ) do
+      puts opts
+      exit
+    end
+  end
+
+  begin optparse.parse!    
+  rescue OptionParser::InvalidArgument, OptionParser::InvalidOption => e
+    warn e
+    exit 1
+  end
+
+  $verbose = options[:verbose]
+  $print_http = $verbose
+  usePOST = options[:post]
+
+  service = options[:service]
+  warn_exit 'No service specified.  Required --service=URI',1 if service.nil?
+
+  # Query
+  query=nil
+  query_file=options[:file]
+  if query_file.nil? && ARGV.size == 0
+  then
+    warn_exit 'No query specified.',1
+    end
+  if query_file.nil?
+    query = ARGV.shift
+    if query.match(/^@/)
+      query_file = query[1..-1]
+      query = nil
+    end
+  end
+
+  # --output ==> output= (non-standard)
+  args={}
+  case options[:output]
+  when nil
+  when  "json","xml","text","csv","tsv"
+    args['output'] = options[:output]
+  when :json,:xml,:text,:csv,:tsv
+    args['output'] = options[:output].to_s
+  else
+    warn_exit "Unrecognized output type: "+options[:output],2
+  end
+
+  # --accept
+  # options[:accept]
+
+  print "SPARQL #{service}\n" if $verbose
+  #args={"output"=>"text"}
+  SPARQL_query(service, query, query_file, usePOST, args)
+  exit(0)
+end
+
+## -------- SPARQL Update
+
+# Update sent as a WWW form.
+def SPARQL_update_by_form(service, update, args2={})
+  args = {}
+  args.merge!(args2)
+  headers={}
+  headers.merge!($headers)
+  # args? encode?
+  body="update="+uri_escape(update)
+  headers[$hContentType] = $mtWWWForm
+  headers[$hContentLength] = body.length.to_s
+  uri = URI.parse(service)
+  execute_post_form(uri, headers, body)
+end
+
+# DRY - query form.
+def execute_post_form(uri, headers, body)
+  request = Net::HTTP::Post.new(uri.request_uri)
+  request.initialize_http_header(headers)
+  request.body = body
+  print_http_request(uri, request)
+  response_no_body(uri, request)
+end
+
+def SPARQL_update(service, update, args2={})
+  args = {}
+  args.merge!(args2)
+  headers={}
+  headers.merge!($headers)
+  headers[$hContentType] = $mtSparqlUpdate
+  uri = URI.parse(service)
+  request = Net::HTTP::Post.new(uri.request_uri)
+  request.initialize_http_header(headers)
+  request.body = update
+  print_http_request(uri, request)
+  response_no_body(uri, request)
+end
+
+def cmd_sparql_update(by_raw_post=true)
+  # Share with cmd_sparql_query
+  options={}
+  optparse = OptionParser.new do |opts|
+    opts.banner = "Usage: #{$cmd} [--file REQUEST] [--service URI] 'request' | @file"
+    opts.on('--service=URI', '--server=URI', 'SPARQL endpoint') do |uri|
+      options[:service]=uri
+    end
+    opts.on('--update=FILE', '--file=FILE', 'Take update from a file') do |file|
+      options[:file]=file
+    end
+    options[:verbose] = false
+    opts.on( '-v', '--verbose', 'Verbose' ) do
+      options[:verbose] = true
+    end
+    opts.on( '--version', 'Print version and exit' ) do
+      print "#{SOH_NAME} #{SOH_VERSION}\n"
+      exit
+    end 
+    opts.on( '-h', '--help', 'Display this screen and exit' ) do
+      puts opts
+      exit
+    end
+  end
+
+  begin optparse.parse!    
+  rescue OptionParser::InvalidArgument => e
+    warn e
+    exit
+  end
+
+  $verbose = options[:verbose]
+  $print_http = $verbose
+
+  service = options[:service]
+  warn_exit 'No service specified. Required --service=URI',1   if service.nil?
+  
+  update=nil
+  update_file=options[:file]
+
+  if update_file.nil? && ARGV.size == 0
+  then
+    warn_exit 'No update specified.',1
+    end
+  if update_file.nil?
+    update = ARGV.shift
+    if update.match(/^@/)
+      update_file = update[1..-1]
+      update = nil
+    end
+  end
+  
+  print "SPARQL-Update #{service}\n" if $verbose
+  args={}
+
+  # Reads in the file :-(
+  if update.nil?
+  then
+    update = open(update_file, 'rb'){|f| f.read}
+  else
+    update = string_or_file(update)
+  end
+
+  if by_raw_post
+    SPARQL_update(service, update, args)
+  else
+    SPARQL_update_by_form(service, update, args)
+  end
+  exit(0)
+end
+
+## -------
+
+case $cmd
+when "s-http", "sparql-http", "soh"
+  $banner="#{$cmd} [get|post|put|delete] datasetURI graph [file]"
+  cmd_soh
+when "s-get", "s-head", "s-put", "s-delete", "s-post"
+
+  case $cmd
+  when "s-get", "s-head", "s-delete"
+    $banner="#{$cmd} datasetURI graph"
+  when "s-put", "s-post"
+    $banner="#{$cmd} datasetURI graph file"
+  end
+  cmd2 = $cmd.sub(/^s-/, '').upcase
+  cmd_soh cmd2
+
+when "s-query", "sparql-query"
+  cmd_sparql_query
+when "s-update", "sparql-update"
+  cmd_sparql_update true
+when "s-update-form", "sparql-update-form"
+  cmd_sparql_update false
+else 
+  warn_exit "Unknown: "+$cmd, 1
+end

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src-dev/dev/RunFuseki.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src-dev/dev/RunFuseki.java b/jena-fuseki1/src-dev/dev/RunFuseki.java
new file mode 100644
index 0000000..74f678c
--- /dev/null
+++ b/jena-fuseki1/src-dev/dev/RunFuseki.java
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package dev;
+
+import org.apache.jena.fuseki.FusekiCmd ;
+
+public class RunFuseki
+{
+    public static void main(String[] args)
+    {
+        //demo() ;
+        //FusekiCmd.main("--config=config.ttl") ; System.exit(0) ;
+        main1() ;
+    }
+    
+    public static void demo()
+    {
+        String DIR="DemoServer" ;
+        FusekiCmd.main("--config="+name(DIR,"config.ttl"), "--pages="+name(DIR, "demo-pages")) ;
+        System.exit(0) ;
+    }
+    
+    public static String name(String DIR, String filename)
+    {
+        StringBuilder sb = new StringBuilder() ;
+        if ( ! filename.startsWith("/") )
+        {
+            sb.append(DIR) ;
+            if ( ! DIR.endsWith("/") )
+                sb.append("/") ;
+        }
+        sb.append(filename) ;
+        return sb.toString() ;
+    }
+    
+    private static void main1()
+    {
+        String tmpdir = System.getenv("TMPDIR") ;
+        if ( tmpdir == null )
+            tmpdir = System.getenv("TMP") ;
+        if ( tmpdir == null )
+            tmpdir = System.getenv("HOME")+"/tmp" ;
+        if ( ! tmpdir.endsWith("/") )
+            tmpdir = tmpdir+"/" ;
+        
+        FusekiCmd.main(
+                     //  "-v",
+                     "--mem", "--update", "/ds"
+                     //"--update", "--loc="+tmpdir+"DB", "--set=tdb:unionDefaultGraph=true", "/ds"
+                     //"--update", "--mem", "/ds"
+
+                     //"--update", "--memtdb", "--set=tdb:unionDefaultGraph=true", "/ds"
+                     
+                    //"--debug",
+                    //"--update",
+                    //"--timeout=1000,5000",
+                    //"--set=arq:queryTimeout=1000",
+                    //"--port=3030",
+                    //"--mgtPort=3031",
+                    //"--mem",
+                    //"--home=/home/afs/Projects/Fuseki",
+                    //"--loc=DB",
+                    //"--file=D.nt",
+                    //"--gzip=no",
+                    //"--desc=desc.ttl",
+                    //--pages=
+                    //"--jetty-config=jetty-fuseki.xml",
+                    //"--config=config-tdb.ttl"
+                    // "/ds"
+                    ) ;
+        System.exit(0) ;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/main/java/org/apache/jena/fuseki/DEF.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/java/org/apache/jena/fuseki/DEF.java b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/DEF.java
new file mode 100644
index 0000000..c24f7e3
--- /dev/null
+++ b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/DEF.java
@@ -0,0 +1,66 @@
+/*
+ * 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.fuseki;
+
+import static org.apache.jena.riot.WebContent.* ;
+import org.apache.jena.atlas.web.AcceptList ;
+import org.apache.jena.atlas.web.MediaType ;
+
+public class DEF
+{
+    public static final MediaType acceptRDFXML        = MediaType.create(contentTypeRDFXML) ;
+    public static final MediaType acceptNQuads        = MediaType.create(contentTypeNQuads) ;
+    public static final MediaType acceptRSXML         = MediaType.create(contentTypeResultsXML) ;
+
+    public static final AcceptList rdfOffer           = AcceptList.create(contentTypeTurtle, 
+                                                                          contentTypeTurtleAlt1,
+                                                                          contentTypeTurtleAlt2,
+                                                                          contentTypeNTriples,
+                                                                          contentTypeNTriplesAlt,
+                                                                          contentTypeRDFXML,
+                                                                          contentTypeJSONLD,
+                                                                          contentTypeRDFJSON,
+                                                                          contentTypeRDFThrift
+                                                                          ) ;
+    
+    public static final AcceptList quadsOffer         = AcceptList.create(contentTypeTriG,
+                                                                          contentTypeTriGAlt1,
+                                                                          contentTypeTriGAlt2,
+                                                                          contentTypeJSONLD,
+                                                                          contentTypeNQuads,
+                                                                          contentTypeNQuadsAlt1,
+                                                                          contentTypeNQuadsAlt2 
+                                                                          ) ;
+    
+    public static final AcceptList rsOfferTable            = AcceptList.create(contentTypeResultsJSON,
+                                                                          contentTypeTextCSV,
+                                                                          contentTypeTextTSV,
+                                                                          contentTypeResultsXML,
+                                                                          contentTypeResultsThrift,
+                                                                          contentTypeTextPlain
+                                                                          ) ;
+    
+    public static final AcceptList rsOfferBoolean            = AcceptList.create(contentTypeResultsJSON,
+                                                                          contentTypeTextCSV,
+                                                                          contentTypeTextTSV,
+                                                                          contentTypeResultsXML,
+                                                                          contentTypeTextPlain
+                                                                          ) ;
+
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/main/java/org/apache/jena/fuseki/EmbeddedFusekiServer.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/java/org/apache/jena/fuseki/EmbeddedFusekiServer.java b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/EmbeddedFusekiServer.java
new file mode 100644
index 0000000..0261b67
--- /dev/null
+++ b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/EmbeddedFusekiServer.java
@@ -0,0 +1,86 @@
+/*
+ * 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.fuseki;
+
+import org.apache.jena.atlas.lib.FileOps ;
+import org.apache.jena.fuseki.server.FusekiConfig ;
+import org.apache.jena.fuseki.server.SPARQLServer ;
+import org.apache.jena.fuseki.server.ServerConfig ;
+
+import com.hp.hpl.jena.sparql.core.DatasetGraph ;
+import com.hp.hpl.jena.sparql.core.DatasetGraphFactory ;
+import com.hp.hpl.jena.tdb.TDBFactory ;
+
+/** Embedded (same JVM) server.
+ * <p>Example for one server per test suite: 
+ * <pre>
+    private static EmbeddedFusekiServer server = null ;
+    \@BeforeClass public static void beforeClass() { 
+        server = EmbeddedFusekiServer.createMemByPath(3030, "/test") ;
+        server.start() ;
+    \@AfterClass  public static void afterClass()  { 
+        server.stop() ;
+    }
+    </pre>
+ */
+public class EmbeddedFusekiServer
+{
+    
+    public static EmbeddedFusekiServer mem(int port, String datasetPath) {
+        DatasetGraph dsg = DatasetGraphFactory.createMem() ;
+        return EmbeddedFusekiServer.create(port, dsg, datasetPath) ;
+    }
+    
+    public static EmbeddedFusekiServer memTDB(int port, String datasetPath) {
+        DatasetGraph dsg = TDBFactory.createDatasetGraph() ;
+        return EmbeddedFusekiServer.create(port, dsg, datasetPath) ;
+    }
+
+    public static EmbeddedFusekiServer create(int port, DatasetGraph dsg, String datasetPath) {
+        ServerConfig conf = FusekiConfig.defaultConfiguration(datasetPath, dsg, true, true) ;
+        conf.port = port ;
+        conf.pagesPort = port ;
+        if ( ! FileOps.exists(conf.pages) )
+            conf.pages = null ;
+        return new EmbeddedFusekiServer(conf) ;
+    }
+        
+    public static EmbeddedFusekiServer configure(int port, String fileConfig) {
+        ServerConfig conf = FusekiConfig.configure(fileConfig) ;
+        conf.port = port ;
+        conf.pagesPort = port ;
+        if ( ! FileOps.exists(conf.pages) )
+            conf.pages = null ;
+        return new EmbeddedFusekiServer(conf) ;
+    }
+    
+    private SPARQLServer server = null ;
+    
+    public EmbeddedFusekiServer(ServerConfig conf) {
+        server = new SPARQLServer(conf) ;
+    }
+    
+    public void start() {
+        server.start() ;
+    }
+    
+    public void stop() {
+        server.stop() ;
+    }
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/main/java/org/apache/jena/fuseki/Fuseki.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/java/org/apache/jena/fuseki/Fuseki.java b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/Fuseki.java
new file mode 100644
index 0000000..c62ba1f
--- /dev/null
+++ b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/Fuseki.java
@@ -0,0 +1,174 @@
+/*
+ * 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.fuseki;
+
+import org.apache.jena.fuseki.server.SPARQLServer ;
+import org.apache.jena.riot.RIOT ;
+import org.apache.jena.riot.system.stream.LocatorFTP ;
+import org.apache.jena.riot.system.stream.LocatorHTTP ;
+import org.apache.jena.riot.system.stream.StreamManager ;
+import org.slf4j.Logger ;
+import org.slf4j.LoggerFactory ;
+
+import com.hp.hpl.jena.query.ARQ ;
+import com.hp.hpl.jena.sparql.SystemARQ ;
+import com.hp.hpl.jena.sparql.lib.Metadata ;
+import com.hp.hpl.jena.sparql.mgt.SystemInfo ;
+import com.hp.hpl.jena.sparql.util.Context ;
+import com.hp.hpl.jena.sparql.util.MappingRegistry ;
+import com.hp.hpl.jena.tdb.TDB ;
+import com.hp.hpl.jena.tdb.transaction.TransactionManager ;
+
+/**
+ * <p>The main class enabling us to:</p> 
+ * <ol>
+ * <li>create instances of a Fuseki server e.g.
+ * the ARQ, RIOT and TDB server stack</li>
+ * <li>get server global {@link com.hp.hpl.jena.sparql.util.Context} e.g. 
+ * named values used to pass implementation-specific parameters across 
+ * general interfaces.</li>
+ * <li>get the {@link org.apache.jena.fuseki.server.SPARQLServer} instance.</li>
+ * <li>set the {@link org.apache.jena.fuseki.server.SPARQLServer} instance.</li>
+ *
+ */
+public class Fuseki
+{
+    /** Path to ???*/
+    static public String PATH = "org.apache.jena.fuseki" ;
+    
+    /** a unique IRI for the Fuseki namespace*/
+    static public String FusekiIRI = "http://jena.apache.org/Fuseki" ;
+    
+    /** Fuseki home environment, usually set to $FUSEKI_HOME */
+    static public String FusekiHomeEnv = "FUSEKI_HOME" ;
+    
+    /** a unique IRI including the symbol notation for which properties should be appended */
+    static public String FusekiSymbolIRI = "http://jena.apache.org/fuseki#" ;
+    
+    /** ??? */
+    static public String PagesStatic = "pages" ;
+    
+    /** 
+     * TEMPORARY - this enables POST of triples to the dataset URI causing a graph to be created.
+     * POSTing to /dataset?graph=uri is preferred 
+     */
+    static public boolean graphStoreProtocolPostCreate = false ;
+    
+    /** an relative path to the location of <code>fuseki-properties.xml</code> file */
+    static private String metadataLocation = "org/apache/jena/fuseki/fuseki-properties.xml" ;
+    
+    /** Object which holds metadata specified within {@link Fuseki#metadataLocation} */
+    static private Metadata metadata = initMetadata() ;
+    
+    private static Metadata initMetadata()
+    {
+        Metadata m = new Metadata() ;
+        //m.addMetadata(metadataDevLocation) ;
+        m.addMetadata(metadataLocation) ;
+        return m ;
+    }
+    
+    /** The name of the Fuseki server. Set to the string <code>Fuseki</code> by default.*/
+    static public final String NAME             = "Fuseki" ;
+    
+    /** Version of this Fuseki instance */
+    static public final String VERSION          = metadata.get(PATH+".version", "development");
+    
+    /** Date when Fuseki was built */
+    static public final String BUILD_DATE       = metadata.get(PATH+".build.datetime", "unknown") ; // call Date if unavailable.
+    
+    /** An identifier for the HTTP Fuseki server instance*/
+    static public final String serverHttpName   = NAME+" ("+VERSION+")" ;    
+    
+    /** Actual log file for operations */
+    public static final String requestLogName   = PATH+".Fuseki" ;
+    
+    /** Instance of log for operations */
+    public static final Logger requestLog       = LoggerFactory.getLogger(requestLogName) ;
+    
+    /** Actual log file for general server messages.*/
+    public static final String serverLogName    = PATH+".Server" ;
+    
+    /** Instance of log for general server messages */
+    public static final Logger serverLog        = LoggerFactory.getLogger(serverLogName) ;
+    
+    /** Actual log file for config server messages. */
+    public static final String configLogName    = PATH+".Config" ;
+    
+    /** Instance of log for config server message s*/
+    public static final Logger configLog        = LoggerFactory.getLogger(configLogName) ;
+    
+    /** Instance of log for config server message s*/
+    public static boolean verboseLogging        = false ;
+    
+    /** An instance of management for stream opening, including redirecting through a 
+     * location mapper whereby a name (e.g. URL) is redirected to another name (e.g. local file).
+     * */
+    public static final StreamManager webStreamManager ;
+    static {
+        webStreamManager = new StreamManager() ;
+        // Only know how to handle http and ftp URLs - nothing local.
+        webStreamManager.addLocator(new LocatorHTTP()) ;
+        webStreamManager.addLocator(new LocatorFTP()) ;
+    }
+    
+    private static boolean initialized = false ;
+    
+    /**
+     * Initialize an instance of the Fuseki server stack.
+     */
+    public synchronized static void init()
+    {
+        if ( initialized )
+            return ;
+        initialized = true ;
+        ARQ.init() ;
+        SystemInfo sysInfo = new SystemInfo(FusekiIRI, PATH, VERSION, BUILD_DATE) ;
+        SystemARQ.registerSubSystem(sysInfo) ;
+        RIOT.init() ;
+        TDB.init() ;
+        MappingRegistry.addPrefixMapping("fuseki", FusekiSymbolIRI) ;
+        
+        TDB.setOptimizerWarningFlag(false) ;
+        // Don't set TDB batch commits.
+        // This can be slower, but it less memory hungry and more predictable. 
+        TransactionManager.QueueBatchSize = 0 ;
+    }
+  
+    /**
+     * Get server global {@link com.hp.hpl.jena.sparql.util.Context}.
+     * @return {@link com.hp.hpl.jena.query.ARQ#getContext()}
+     */
+    public static Context getContext()
+    {
+        return ARQ.getContext() ;
+    }
+    
+    // Temporary ...
+    private static SPARQLServer server ;
+    
+    /** set/specify the {@link org.apache.jena.fuseki.server.SPARQLServer} instance.*/
+    public static void setServer(SPARQLServer _server)      { server = _server ; }
+    
+    /** get the {@link org.apache.jena.fuseki.server.SPARQLServer} instance. */
+    public static SPARQLServer getServer()                  { return server ; }
+
+    // Force a call to init.
+    static { init() ; }
+}


[03/23] jena git commit: Rename folder jena-fuseki to jena-fuseki1

Posted by an...@apache.org.
http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Query.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Query.java b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Query.java
new file mode 100644
index 0000000..06f8340
--- /dev/null
+++ b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Query.java
@@ -0,0 +1,387 @@
+/*
+ * 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.fuseki.servlets;
+
+import static java.lang.String.format ;
+import static org.apache.jena.fuseki.HttpNames.* ;
+import static org.apache.jena.fuseki.server.CounterName.QueryExecErrors ;
+import static org.apache.jena.fuseki.server.CounterName.QueryTimeouts ;
+import static org.apache.jena.fuseki.server.CounterName.RequestsBad ;
+
+import java.io.IOException ;
+import java.io.InputStream ;
+import java.util.* ;
+
+import javax.servlet.http.HttpServletRequest ;
+import javax.servlet.http.HttpServletResponse ;
+
+import org.apache.jena.atlas.RuntimeIOException ;
+import org.apache.jena.atlas.io.IO ;
+import org.apache.jena.atlas.io.IndentedLineBuffer ;
+import org.apache.jena.atlas.web.ContentType ;
+import org.apache.jena.fuseki.FusekiException ;
+import org.apache.jena.fuseki.FusekiLib ;
+import org.apache.jena.fuseki.HttpNames ;
+import org.apache.jena.riot.WebContent ;
+import org.apache.jena.riot.web.HttpOp ;
+import org.apache.jena.web.HttpSC ;
+
+import com.hp.hpl.jena.query.* ;
+import com.hp.hpl.jena.rdf.model.Model ;
+import com.hp.hpl.jena.sparql.core.Prologue ;
+import com.hp.hpl.jena.sparql.resultset.SPARQLResult ;
+
+/**
+ * Handles SPARQL Query requests.
+ */
+public abstract class SPARQL_Query extends SPARQL_Protocol
+{
+    public SPARQL_Query()   { super() ; }
+
+    // Choose REST verbs to support.
+    
+    @Override
+    protected void doPost(HttpServletRequest request, HttpServletResponse response)
+    { doCommon(request, response) ; }
+    
+    @Override
+    protected void doGet(HttpServletRequest request, HttpServletResponse response)
+    { doCommon(request, response) ; }
+
+    // HEAD
+    
+    @Override
+    protected void doOptions(HttpServletRequest request, HttpServletResponse response)
+    {
+        setCommonHeadersForOptions(response) ;
+        response.setHeader(HttpNames.hAllow, "GET,OPTIONS,POST");
+        response.setHeader(HttpNames.hContentLengh, "0") ;
+    }
+    
+    @Override
+    protected final void perform(HttpAction action)
+    {
+        // GET
+        if ( action.request.getMethod().equals(HttpNames.METHOD_GET) ) {
+            executeWithParameter(action) ;
+            return ;
+        }
+
+        ContentType ct = FusekiLib.getContentType(action) ;
+        if ( ct == null ) {
+            // Validation check it's POST with ?query=
+            executeWithParameter(action) ;
+            return ;
+        }
+        
+        String incoming = ct.getContentType() ;
+        // POST application/sparql-query
+        if (WebContent.contentTypeSPARQLQuery.equals(incoming)) {
+            executeBody(action) ;
+            return ;
+        }
+        // POST application/x-www-form-url
+        if (WebContent.contentTypeHTMLForm.equals(incoming)) {
+            executeWithParameter(action) ;
+            return ;
+        }
+        
+        error(HttpSC.UNSUPPORTED_MEDIA_TYPE_415, "Bad content type: "+incoming) ;
+    }
+
+    // All the params we support
+
+    protected static List<String> allParams  = Arrays.asList(paramQuery, 
+                                                             paramDefaultGraphURI, paramNamedGraphURI, 
+                                                             paramQueryRef,
+                                                             paramStyleSheet,
+                                                             paramAccept,
+                                                             paramOutput1, paramOutput2, 
+                                                             paramCallback, 
+                                                             paramForceAccept,
+                                                             paramTimeout) ;
+
+    @Override
+    protected void validate(HttpAction action)
+    {
+        String method = action.request.getMethod().toUpperCase(Locale.ROOT) ;
+        
+        if ( ! HttpNames.METHOD_POST.equals(method) && ! HttpNames.METHOD_GET.equals(method) )
+            errorMethodNotAllowed("Not a GET or POST request") ;
+            
+        if ( HttpNames.METHOD_GET.equals(method) && action.request.getQueryString() == null )
+        {
+            warning("Service Description / SPARQL Query / "+action.request.getRequestURI()) ;
+            errorNotFound("Service Description: "+action.request.getRequestURI()) ;
+        }
+        
+        // Use of the dataset describing parameters is check later.
+        try {
+            validateParams(action.request, allParams) ;
+            validateRequest(action) ; 
+        } catch (ActionErrorException ex) { 
+            throw ex ; 
+        } 
+        // Query not yet parsed.
+    }
+    
+    /**
+     * Validate the request after checking HTTP method and HTTP Parameters.
+     * @param action HTTP Action
+     */
+    protected abstract void validateRequest(HttpAction action) ;
+    
+    /**
+     * Helper method for validating request.
+     * @param request HTTP request
+     * @param params parameters in a collection of Strings
+     */
+    protected void validateParams(HttpServletRequest request, Collection<String> params)
+    {
+        ContentType ct = FusekiLib.getContentType(request) ;
+        boolean mustHaveQueryParam = true ;
+        if ( ct != null )
+        {
+            String incoming = ct.getContentType() ;
+            
+            if ( WebContent.contentTypeSPARQLQuery.equals(incoming) )
+            {
+                mustHaveQueryParam = false ;
+                //error(HttpSC.UNSUPPORTED_MEDIA_TYPE_415, "Unofficial "+WebContent.contentTypeSPARQLQuery+" not supported") ;
+            }
+            else if ( WebContent.contentTypeHTMLForm.equals(incoming) ) {}
+            else
+                error(HttpSC.UNSUPPORTED_MEDIA_TYPE_415, "Unsupported: "+incoming) ;
+        }
+        
+        // GET/POST of a form at this point.
+        
+        if ( mustHaveQueryParam )
+        {
+            int N = countParamOccurences(request, paramQuery) ; 
+            
+            if ( N == 0 ) errorBadRequest("SPARQL Query: No 'query=' parameter") ;
+            if ( N > 1 ) errorBadRequest("SPARQL Query: Multiple 'query=' parameters") ;
+            
+            // application/sparql-query does not use a query param.
+            String queryStr = request.getParameter(HttpNames.paramQuery) ;
+            
+            if ( queryStr == null )
+                errorBadRequest("SPARQL Query: No query specified (no 'query=' found)") ;
+            if ( queryStr.isEmpty() )
+                errorBadRequest("SPARQL Query: Empty query string") ;
+        }
+
+        if ( params != null )
+        {
+            Enumeration<String> en = request.getParameterNames() ;
+            for ( ; en.hasMoreElements() ; )
+            {
+                String name = en.nextElement() ;
+                if ( ! params.contains(name) )
+                    warning("SPARQL Query: Unrecognize request parameter (ignored): "+name) ;
+            }
+        }
+    }
+
+    private void executeWithParameter(HttpAction action)
+    {
+        String queryString = action.request.getParameter(paramQuery) ;
+        execute(queryString, action) ;
+    }
+
+    private void executeBody(HttpAction action)
+    {
+        String queryString = null ;
+        try { 
+            InputStream input = action.request.getInputStream() ; 
+            queryString = IO.readWholeFileAsUTF8(input) ;
+        }
+        catch (IOException ex) { errorOccurred(ex) ; }
+        execute(queryString, action) ;
+    }
+
+    private void execute(String queryString, HttpAction action)
+    {
+        String queryStringLog = formatForLog(queryString) ;
+        if ( action.verbose )
+            log.info(format("[%d] Query = \n%s", action.id, queryString));
+        else
+            log.info(format("[%d] Query = %s", action.id, queryStringLog));
+
+        Query query = null ;
+        try {
+            // NB syntax is ARQ (a superset of SPARQL)
+            query = QueryFactory.create(queryString, "http://example/query-base", Syntax.syntaxARQ) ;
+            queryStringLog = formatForLog(query) ;
+            validateQuery(action, query) ;
+        } catch (ActionErrorException ex) {
+            incCounter(action.srvRef, RequestsBad) ;
+            throw ex ;
+        } catch (QueryParseException ex) {
+            incCounter(action.srvRef, RequestsBad) ;
+            errorBadRequest("Parse error: \n" + queryString + "\n\r" + messageForQPE(ex)) ;
+        } catch (RuntimeIOException ex) {
+            errorBadRequest("Runtime IO Exception: \n" + queryString + "\n\r" + ex.getMessage()) ;
+        }
+        // Should not happen.
+        catch (QueryException ex) {
+            errorBadRequest("Error: \n" + queryString + "\n\r" + ex.getMessage()) ;
+        }
+        
+        // Assumes finished whole thing by end of sendResult. 
+        action.beginRead() ;
+        try {
+            Dataset dataset = decideDataset(action, query, queryStringLog) ; 
+            try(QueryExecution qExec = createQueryExecution(query, dataset)) {
+                SPARQLResult result = executeQuery(action, qExec, query, queryStringLog) ;
+                // Deals with exceptions itself.
+                sendResults(action, result, query.getPrologue()) ;
+            }
+        } catch (QueryCancelledException ex) {
+            // Additional counter information.
+            incCounter(action.srvRef, QueryTimeouts) ; 
+            throw ex ; 
+        } catch (RuntimeIOException ex) {
+            incCounter(action.srvRef, QueryExecErrors) ;
+            throw ex ;
+        } catch (QueryExecException ex) { 
+            // Additional counter information.
+            incCounter(action.srvRef, QueryExecErrors) ; 
+            throw ex ;
+        } finally { 
+            action.endRead() ;
+        }
+    }
+
+    /**
+     * Check the query, throwing ActionErrorException when not valid, or calling super#error.
+     * @param action HTTP Action
+     * @param query the Query
+     */
+    protected abstract void validateQuery(HttpAction action, Query query) ;
+
+    protected QueryExecution createQueryExecution(Query query, Dataset dataset)
+    {
+        return QueryExecutionFactory.create(query, dataset) ;
+    }
+
+    protected SPARQLResult executeQuery(HttpAction action, QueryExecution qExec, Query query, String queryStringLog)
+    {
+        setAnyTimeouts(qExec, action);
+
+        if ( query.isSelectType() )
+        {
+            ResultSet rs = qExec.execSelect() ;
+            
+            // Force some query execution now.
+            //
+            // If the timeout-first-row goes off, the output stream has not 
+            // been started so the HTTP error code is sent. 
+            
+            rs.hasNext() ;
+
+            // If we wanted perfect query time cancellation, we could consume the result now
+            // to see if the timeout-end-of-query goes off.  
+            
+            //rs = ResultSetFactory.copyResults(rs) ;
+
+            log.info(format("[%d] exec/select", action.id)) ;
+            return new SPARQLResult(rs) ;
+        }
+
+        if ( query.isConstructType() )
+        {
+            Model model = qExec.execConstruct() ;
+            log.info(format("[%d] exec/construct", action.id)) ;
+            return new SPARQLResult(model) ;
+        }
+
+        if ( query.isDescribeType() )
+        {
+            Model model = qExec.execDescribe() ;
+            log.info(format("[%d] exec/describe",action.id)) ;
+            return new SPARQLResult(model) ;
+        }
+
+        if ( query.isAskType() )
+        {
+            boolean b = qExec.execAsk() ;
+            log.info(format("[%d] exec/ask",action.id)) ;
+            return new SPARQLResult(b) ;
+        }
+
+        errorBadRequest("Unknown query type - "+queryStringLog) ;
+        return null ;
+    }
+
+    private void setAnyTimeouts(QueryExecution qexec, HttpAction action) {
+        if (!(action.getDatasetRef().allowTimeoutOverride))
+            return;
+
+        long desiredTimeout = Long.MAX_VALUE;
+        String timeoutHeader = action.request.getHeader("Timeout");
+        String timeoutParameter = action.request.getParameter("timeout");
+        if (timeoutHeader != null) {
+            try {
+                desiredTimeout = (int) Float.parseFloat(timeoutHeader) * 1000;
+            } catch (NumberFormatException e) {
+                throw new FusekiException("Timeout header must be a number", e);
+            }
+        } else if (timeoutParameter != null) {
+            try {
+                desiredTimeout = (int) Float.parseFloat(timeoutParameter) * 1000;
+            } catch (NumberFormatException e) {
+                throw new FusekiException("timeout parameter must be a number", e);
+            }
+        }
+
+        desiredTimeout = Math.min(action.getDatasetRef().maximumTimeoutOverride, desiredTimeout);
+        if (desiredTimeout != Long.MAX_VALUE)
+            qexec.setTimeout(desiredTimeout);
+    }
+
+    protected abstract Dataset decideDataset(HttpAction action, Query query, String queryStringLog) ;
+
+    protected void sendResults(HttpAction action, SPARQLResult result, Prologue qPrologue)
+    {
+        if ( result.isResultSet() )
+            ResponseResultSet.doResponseResultSet(action, result.getResultSet(), qPrologue) ;
+        else if ( result.isGraph() )
+            ResponseModel.doResponseModel(action, result.getModel()) ;
+        else if ( result.isBoolean() )
+            ResponseResultSet.doResponseResultSet(action, result.getBooleanResult()) ;
+        else
+            errorOccurred("Unknown or invalid result type") ;
+    }
+    
+    private String formatForLog(Query query)
+    {
+        IndentedLineBuffer out = new IndentedLineBuffer() ;
+        out.setFlatMode(true) ;
+        query.serialize(out) ;
+        return out.asString() ;
+    }
+        
+    private String getRemoteString(String queryURI)
+    {
+        return HttpOp.execHttpGetString(queryURI) ;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_QueryDataset.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_QueryDataset.java b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_QueryDataset.java
new file mode 100644
index 0000000..9e9df36
--- /dev/null
+++ b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_QueryDataset.java
@@ -0,0 +1,60 @@
+/*
+ * 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.fuseki.servlets;
+
+import com.hp.hpl.jena.query.Dataset ;
+import com.hp.hpl.jena.query.DatasetFactory ;
+import com.hp.hpl.jena.query.Query ;
+import com.hp.hpl.jena.sparql.core.DatasetDescription ;
+import com.hp.hpl.jena.sparql.core.DatasetGraph ;
+import com.hp.hpl.jena.sparql.core.DynamicDatasets ;
+
+public class SPARQL_QueryDataset extends SPARQL_Query
+{
+    public SPARQL_QueryDataset(boolean verbose)     { super() ; }
+
+    public SPARQL_QueryDataset()
+    { this(false) ; }
+    
+    @Override
+    protected void validateRequest(HttpAction action) 
+    { }
+
+    @Override
+    protected void validateQuery(HttpAction action, Query query) 
+    { }
+   
+    @Override
+    protected Dataset decideDataset(HttpAction action, Query query, String queryStringLog) 
+    { 
+        DatasetGraph dsg = action.getActiveDSG() ;
+        
+        // query.getDatasetDescription() ;
+        
+        // Protocol.
+        DatasetDescription dsDesc = getDatasetDescription(action) ;
+        if (dsDesc != null )
+        {
+            //errorBadRequest("SPARQL Query: Dataset description in the protocol request") ;
+            dsg = DynamicDatasets.dynamicDataset(dsDesc, dsg, false) ;
+        }
+        
+        return DatasetFactory.create(dsg) ;
+    }
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_QueryGeneral.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_QueryGeneral.java b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_QueryGeneral.java
new file mode 100644
index 0000000..a022e96
--- /dev/null
+++ b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_QueryGeneral.java
@@ -0,0 +1,143 @@
+/*
+ * 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.fuseki.servlets;
+
+import static java.lang.String.format ;
+
+import java.util.List ;
+
+import org.apache.jena.atlas.lib.InternalErrorException ;
+import org.apache.jena.fuseki.migrate.GraphLoadUtils ;
+import org.apache.jena.riot.RiotException ;
+
+import com.hp.hpl.jena.query.Dataset ;
+import com.hp.hpl.jena.query.DatasetFactory ;
+import com.hp.hpl.jena.query.Query ;
+import com.hp.hpl.jena.rdf.model.Model ;
+import com.hp.hpl.jena.rdf.model.ModelFactory ;
+import com.hp.hpl.jena.sparql.core.DatasetDescription ;
+
+public class SPARQL_QueryGeneral extends SPARQL_Query
+{
+    final static int MaxTriples = 100*1000 ; 
+    
+    public SPARQL_QueryGeneral()    { super() ; }
+
+    @Override
+    protected void validateRequest(HttpAction action) {}
+
+    @Override
+    protected void validateQuery(HttpAction action, Query query) {}
+    
+    @Override
+    protected String mapRequestToDataset(String uri)
+    { return null ; }
+    
+    @Override
+    protected Dataset decideDataset(HttpAction action, Query query, String queryStringLog) 
+    {
+        DatasetDescription datasetDesc = getDatasetDescription(action) ;
+        if ( datasetDesc == null )
+            datasetDesc = getDatasetDescription(query) ;
+        if ( datasetDesc == null )
+            errorBadRequest("No dataset description in protocol request or in the query string") ;
+
+        return datasetFromDescription(action, datasetDesc) ;
+    }
+
+    /**
+     * Construct a Dataset based on a dataset description.
+     */
+    
+    protected static Dataset datasetFromDescription(HttpAction action, DatasetDescription datasetDesc)
+    {
+        try {
+            if ( datasetDesc == null )
+                return null ;
+            if ( datasetDesc.isEmpty() )
+                return null ;
+            
+            List<String> graphURLs = datasetDesc.getDefaultGraphURIs() ;
+            List<String> namedGraphs = datasetDesc.getNamedGraphURIs() ;
+            
+            if ( graphURLs.size() == 0 && namedGraphs.size() == 0 )
+                    return null ;
+            
+            Dataset dataset = DatasetFactory.createMem() ;
+            // Look in cache for loaded graphs!!
+
+            // ---- Default graph
+            {
+                Model model = ModelFactory.createDefaultModel() ;
+                for ( String uri : graphURLs )
+                {
+                    if ( uri == null || uri.equals("") )
+                        throw new InternalErrorException("Default graph URI is null or the empty string")  ;
+
+                    try {
+                        //TODO Clearup - RIOT integration.
+                        GraphLoadUtils.loadModel(model, uri, MaxTriples) ;
+                        log.info(format("[%d] Load (default graph) %s", action.id, uri)) ;
+                    } catch (RiotException ex) {
+                        log.info(format("[%d] Parsing error loading %s: %s", action.id, uri, ex.getMessage())) ;
+                        errorBadRequest("Failed to load URL (parse error) "+uri+" : "+ex.getMessage()) ;
+                    } catch (Exception ex)
+                    {
+                        log.info(format("[%d] Failed to load (default) %s: %s", action.id, uri, ex.getMessage())) ;
+                        errorBadRequest("Failed to load URL "+uri) ;
+                    }
+                }
+                dataset.setDefaultModel(model) ;
+            }
+            // ---- Named graphs
+            if ( namedGraphs != null )
+            {
+                for ( String uri : namedGraphs )
+                {
+                    if ( uri == null || uri.equals("") )
+                        throw new InternalErrorException("Named graph URI is null or the empty string")  ;
+
+                    try {
+                        Model model = ModelFactory.createDefaultModel() ;
+                        GraphLoadUtils.loadModel(model, uri, MaxTriples) ;
+                        log.info(format("[%d] Load (named graph) %s", action.id, uri)) ;
+                        dataset.addNamedModel(uri, model) ;
+                    } catch (RiotException ex) {
+                        log.info(format("[%d] Parsing error loading %s: %s", action.id, uri, ex.getMessage())) ;
+                        errorBadRequest("Failed to load URL (parse error) "+uri+" : "+ex.getMessage()) ;
+                    } catch (Exception ex)
+                    {
+                        log.info(format("[%d] Failed to load (named graph) %s: %s", action.id, uri, ex.getMessage())) ;
+                        errorBadRequest("Failed to load URL "+uri) ;
+                    }
+                }
+            }
+            
+            return dataset ;
+            
+        } 
+        catch (ActionErrorException ex) { throw ex ; }
+        catch (Exception ex)
+        {
+            log.info(format("[%d] SPARQL parameter error: "+ex.getMessage(),action.id, ex)) ;
+            errorBadRequest("Parameter error: "+ex.getMessage());
+            return null ;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_REST.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_REST.java b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_REST.java
new file mode 100644
index 0000000..4ab386b
--- /dev/null
+++ b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_REST.java
@@ -0,0 +1,354 @@
+/*
+ * 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.fuseki.servlets;
+
+import static org.apache.jena.fuseki.HttpNames.* ;
+
+import java.io.IOException ;
+import java.io.InputStream ;
+import java.util.Enumeration ;
+import java.util.Locale ;
+
+import javax.servlet.ServletException ;
+import javax.servlet.http.HttpServletRequest ;
+import javax.servlet.http.HttpServletResponse ;
+
+import org.apache.jena.fuseki.HttpNames ;
+import org.apache.jena.fuseki.server.CounterName ;
+import org.apache.jena.riot.Lang ;
+import org.apache.jena.riot.RDFDataMgr ;
+import org.apache.jena.riot.ReaderRIOT ;
+import org.apache.jena.riot.RiotException ;
+import org.apache.jena.riot.system.ErrorHandler ;
+import org.apache.jena.riot.system.ErrorHandlerFactory ;
+import org.apache.jena.riot.system.IRIResolver ;
+import org.apache.jena.riot.system.StreamRDF ;
+import org.slf4j.Logger ;
+import org.slf4j.LoggerFactory ;
+
+import com.hp.hpl.jena.graph.Graph ;
+import com.hp.hpl.jena.graph.Node ;
+import com.hp.hpl.jena.graph.NodeFactory ;
+import com.hp.hpl.jena.sparql.core.DatasetGraph ;
+
+public abstract class SPARQL_REST extends SPARQL_ServletBase
+{
+    protected static Logger classLog = LoggerFactory.getLogger(SPARQL_REST.class) ;
+    
+    protected static ErrorHandler errorHandler = ErrorHandlerFactory.errorHandlerStd(log) ;
+
+    protected final static Target determineTarget(HttpAction action) {
+        // Delayed until inside a transaction.
+        if ( action.getActiveDSG() == null )
+            errorOccurred("Internal error : No action graph (not in a transaction?)") ;
+        
+        boolean dftGraph = getOneOnly(action.request, HttpNames.paramGraphDefault) != null ;
+        String uri = getOneOnly(action.request, HttpNames.paramGraph) ;
+        
+        if ( !dftGraph && uri == null ) {
+            // Direct naming or error.
+            uri = action.request.getRequestURL().toString() ;
+            if ( action.request.getRequestURI().equals(action.getDatasetRef().name) )
+                // No name 
+                errorBadRequest("Neither default graph nor named graph specified; no direct name") ;
+        }
+        
+        if ( dftGraph )
+            return Target.createDefault(action.getActiveDSG()) ;
+        
+        // Named graph
+        if ( uri.equals(HttpNames.valueDefault ) )
+            // But "named" default
+            return Target.createDefault(action.getActiveDSG()) ;
+        
+        // Strictly, a bit naughty on the URI resolution.  But more sensible. 
+        // Base is dataset.
+        String base = action.request.getRequestURL().toString() ; //wholeRequestURL(request) ;
+        // Make sure it ends in "/", ie. dataset as container.
+        if ( action.request.getQueryString() != null && ! base.endsWith("/") )
+            base = base + "/" ;
+        
+        String absUri = IRIResolver.resolveString(uri, base) ;
+        Node gn = NodeFactory.createURI(absUri) ;
+        return Target.createNamed(action.getActiveDSG(), absUri, gn) ;
+    }
+    
+
+    // struct for target
+    protected static final class Target
+    {
+        final boolean isDefault ;
+        final DatasetGraph dsg ;
+        private Graph _graph ;
+        final String name ;
+        final Node graphName ;
+
+        static Target createNamed(DatasetGraph dsg, String name, Node graphName) {
+            return new Target(false, dsg, name, graphName) ;
+        }
+
+        static Target createDefault(DatasetGraph dsg) {
+            return new Target(true, dsg, null, null) ;
+        }
+
+        private Target(boolean isDefault, DatasetGraph dsg, String name, Node graphName) {
+            this.isDefault = isDefault ;
+            this.dsg = dsg ;
+            this._graph = null ;
+            this.name  = name ;
+            this.graphName = graphName ;
+
+            if ( isDefault )
+            {
+                if ( name != null || graphName != null )
+                    throw new IllegalArgumentException("Inconsistent: default and a graph name/node") ;       
+            }
+            else
+            {
+                if ( name == null || graphName == null )
+                    throw new IllegalArgumentException("Inconsistent: not default and/or no graph name/node") ;
+            }                
+        }
+
+        /** Get a graph for the action - this may create a graph in the dataset - this is not a test for graph existence */
+        public Graph graph() {
+            if ( ! isGraphSet() )
+            {
+                if ( isDefault ) 
+                    _graph = dsg.getDefaultGraph() ;
+                else
+                    _graph = dsg.getGraph(graphName) ;
+            }
+            return _graph ;
+        }
+
+        public boolean exists()
+        {
+            if ( isDefault ) return true ;
+            return dsg.containsGraph(graphName) ;
+        }
+
+        public boolean isGraphSet()
+        {
+            return _graph != null ;
+        }
+
+        @Override
+        public String toString()
+        {
+            if ( isDefault ) return "default" ;
+            return name ;
+        }
+    }
+
+    public SPARQL_REST()
+    { super() ; }
+
+    @Override
+    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+        // Direct all verbs to our common framework.
+        doCommon(request, response) ;
+    }
+    
+    private void maybeSetLastModified(HttpServletResponse resp, long lastModified) {
+        if (resp.containsHeader(HEADER_LASTMOD)) return ;
+        if (lastModified >= 0) resp.setDateHeader(HEADER_LASTMOD, lastModified);
+    }
+    
+    @Override
+    protected void perform(HttpAction action) {
+        dispatch(action) ;
+    }
+
+    private void dispatch(HttpAction action) {
+        HttpServletRequest req = action.request ;
+        HttpServletResponse resp = action.response ;
+        String method = req.getMethod().toUpperCase(Locale.ROOT) ;
+
+        if (method.equals(METHOD_GET))
+            doGet$(action);
+        else if (method.equals(METHOD_HEAD))
+            doHead$(action);
+        else if (method.equals(METHOD_POST))
+            doPost$(action);
+        else if (method.equals(METHOD_PATCH))
+            doPatch$(action) ;
+        else if (method.equals(METHOD_OPTIONS))
+            doOptions$(action) ;
+        else if (method.equals(METHOD_TRACE))
+            //doTrace(action) ;
+            errorMethodNotAllowed("TRACE") ;
+        else if (method.equals(METHOD_PUT))
+            doPut$(action) ;   
+        else if (method.equals(METHOD_DELETE))
+            doDelete$(action) ;
+        else
+            errorNotImplemented("Unknown method: "+method) ;
+    }
+
+    // Counter wrappers
+    
+    protected void doGet$(HttpAction action) {
+        incCounter(action.srvRef, CounterName.GSPget) ;
+        try {
+            doGet(action) ;
+            incCounter(action.srvRef, CounterName.GSPgetGood) ;
+        } catch ( ActionErrorException ex) {
+            incCounter(action.srvRef, CounterName.GSPgetBad) ;
+            throw ex ;
+        }
+    }
+
+    protected void doHead$(HttpAction action) {
+        incCounter(action.srvRef, CounterName.GSPhead) ;
+        try {
+            doHead(action) ;
+            incCounter(action.srvRef, CounterName.GSPheadGood) ;
+        } catch ( ActionErrorException ex) {
+            incCounter(action.srvRef, CounterName.GSPheadBad) ;
+            throw ex ;
+        }
+    }
+
+    protected void doPost$(HttpAction action) {
+        incCounter(action.srvRef, CounterName.GSPpost) ;
+        try {
+            doPost(action) ;
+            incCounter(action.srvRef, CounterName.GSPpostGood) ;
+        } catch ( ActionErrorException ex) {
+            incCounter(action.srvRef, CounterName.GSPpostBad) ;
+            throw ex ;
+        }
+    }
+
+    protected void doPatch$(HttpAction action) {
+        incCounter(action.srvRef, CounterName.GSPpatch) ;
+        try {
+            doPatch(action) ;
+            incCounter(action.srvRef, CounterName.GSPpatchGood) ;
+        } catch ( ActionErrorException ex) {
+            incCounter(action.srvRef, CounterName.GSPpatchBad) ;
+            throw ex ;
+        }
+    }
+
+    protected void doDelete$(HttpAction action) {
+        incCounter(action.srvRef, CounterName.GSPdelete) ;
+        try {
+            doDelete(action) ;
+            incCounter(action.srvRef, CounterName.GSPdeleteGood) ;
+        } catch ( ActionErrorException ex) {
+            incCounter(action.srvRef, CounterName.GSPdeleteBad) ;
+            throw ex ;
+        }
+    }
+
+    protected void doPut$(HttpAction action) {
+        incCounter(action.srvRef, CounterName.GSPput) ;
+        try {
+            doPut(action) ;
+            incCounter(action.srvRef, CounterName.GSPputGood) ;
+        } catch ( ActionErrorException ex) {
+            incCounter(action.srvRef, CounterName.GSPputBad) ;
+            throw ex ;
+        }
+    }
+
+    protected void doOptions$(HttpAction action) {
+        incCounter(action.srvRef, CounterName.GSPoptions) ;
+        try {
+            doOptions(action) ;
+            incCounter(action.srvRef, CounterName.GSPoptionsGood) ;
+        } catch ( ActionErrorException ex) {
+            incCounter(action.srvRef, CounterName.GSPoptionsBad) ;
+            throw ex ;
+        }
+    }
+    
+    protected abstract void doGet(HttpAction action) ;
+    protected abstract void doHead(HttpAction action) ;
+    protected abstract void doPost(HttpAction action) ;
+    protected abstract void doPatch(HttpAction action) ;
+    protected abstract void doDelete(HttpAction action) ;
+    protected abstract void doPut(HttpAction action) ;
+    protected abstract void doOptions(HttpAction action) ;
+    
+    // @@ Move to SPARQL_ServletBase
+    // Check for all RiotReader
+    public static void parse(HttpAction action, StreamRDF dest, InputStream input, Lang lang, String base) {
+        try {
+            ReaderRIOT r = RDFDataMgr.createReader(lang) ;
+            if ( r == null )
+                errorBadRequest("No parser for language '"+lang.getName()+"'") ;
+            r.setErrorHandler(errorHandler); 
+            r.read(input, base, null, dest, null) ; 
+        } 
+        catch (RiotException ex) { errorBadRequest("Parse error: "+ex.getMessage()) ; }
+    }
+
+    @Override
+    protected void validate(HttpAction action)
+    {
+        HttpServletRequest request = action.request ;
+        // Direct naming.
+        if ( request.getQueryString() == null )
+            //errorBadRequest("No query string") ;
+            return ;
+        
+        String g = request.getParameter(HttpNames.paramGraph) ;
+        String d = request.getParameter(HttpNames.paramGraphDefault) ;
+        
+        if ( g != null && d !=null )
+            errorBadRequest("Both ?default and ?graph in the query string of the request") ;
+        
+        if ( g == null && d == null )
+            errorBadRequest("Neither ?default nor ?graph in the query string of the request") ;
+        
+        int x1 = SPARQL_Protocol.countParamOccurences(request, HttpNames.paramGraph) ;
+        int x2 = SPARQL_Protocol.countParamOccurences(request, HttpNames.paramGraphDefault) ;
+        
+        if ( x1 > 1 )
+            errorBadRequest("Multiple ?default in the query string of the request") ;
+        if ( x2 > 1 )
+            errorBadRequest("Multiple ?graph in the query string of the request") ;
+        
+        Enumeration<String> en = request.getParameterNames() ;
+        for ( ; en.hasMoreElements() ; )
+        {
+            String h = en.nextElement() ;
+            if ( ! HttpNames.paramGraph.equals(h) && ! HttpNames.paramGraphDefault.equals(h) )
+                errorBadRequest("Unknown parameter '"+h+"'") ;
+            // one of ?default and &graph
+            if ( request.getParameterValues(h).length != 1 )
+                errorBadRequest("Multiple parameters '"+h+"'") ;
+        }
+    }
+
+    protected static String getOneOnly(HttpServletRequest request, String name)
+    {
+        String[] values = request.getParameterValues(name) ;
+        if ( values == null )
+            return null ;
+        if ( values.length == 0 )
+            return null ;
+        if ( values.length > 1 )
+            errorBadRequest("Multiple occurrences of '"+name+"'") ;
+        return values[0] ;
+    }
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_REST_R.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_REST_R.java b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_REST_R.java
new file mode 100644
index 0000000..0c02b51
--- /dev/null
+++ b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_REST_R.java
@@ -0,0 +1,128 @@
+/*
+ * 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.fuseki.servlets;
+
+import static java.lang.String.format ;
+
+import java.io.IOException ;
+
+import javax.servlet.ServletOutputStream ;
+
+import org.apache.jena.atlas.web.MediaType ;
+import org.apache.jena.atlas.web.TypedOutputStream ;
+import org.apache.jena.fuseki.HttpNames ;
+import org.apache.jena.riot.* ;
+
+import com.hp.hpl.jena.graph.Graph ;
+
+/** Only the READ operations */
+public class SPARQL_REST_R extends SPARQL_REST
+{
+    public SPARQL_REST_R()
+    { super() ; }
+    
+    
+    @Override
+    protected String mapRequestToDataset(String uri) { return mapRequestToDatasetLongest$(uri) ; } 
+
+    @Override
+    protected void doGet(HttpAction action)
+    {
+        // Assume success - do the set up before grabbing the lock.
+        // Sets content type.
+        MediaType mediaType = HttpAction.contentNegotationRDF(action) ;
+       
+        ServletOutputStream output ;
+        try { output = action.response.getOutputStream() ; }
+        catch (IOException ex) { errorOccurred(ex) ; output = null ; }
+        
+        TypedOutputStream out = new TypedOutputStream(output, mediaType) ;
+        Lang lang = RDFLanguages.contentTypeToLang(mediaType.getContentType()) ;
+
+        if ( action.verbose )
+            log.info(format("[%d]   Get: Content-Type=%s, Charset=%s => %s", 
+                            action.id, mediaType.getContentType(), mediaType.getCharset(), lang.getName())) ;
+
+        action.beginRead() ;
+        setCommonHeaders(action.response) ;
+
+        try {
+            Target target = determineTarget(action) ;
+            if ( log.isDebugEnabled() )
+                log.debug("GET->"+target) ;
+            boolean exists = target.exists() ;
+            if ( ! exists )
+                errorNotFound("No such graph: <"+target.name+">") ;
+            // If we want to set the Content-Length, we need to buffer.
+            //response.setContentLength(??) ;
+            String ct = lang.getContentType().toHeaderString() ;
+            action.response.setContentType(ct) ;
+            Graph g = target.graph() ;
+            //Special case RDF/XML to be the plain (faster, less readable) form
+            RDFFormat fmt = 
+                ( lang == Lang.RDFXML ) ? RDFFormat.RDFXML_PLAIN : RDFWriterRegistry.defaultSerialization(lang) ;  
+            RDFDataMgr.write(out, g, fmt) ;
+            success(action) ;
+        } finally { action.endRead() ; }
+    }
+    
+    @Override
+    protected void doOptions(HttpAction action)
+    {
+        setCommonHeadersForOptions(action.response) ;
+        action.response.setHeader(HttpNames.hAllow, "GET,HEAD,OPTIONS") ;
+        action.response.setHeader(HttpNames.hContentLengh, "0") ;
+        success(action) ;
+    }
+
+    @Override
+    protected void doHead(HttpAction action)
+    {
+        setCommonHeaders(action.response) ;
+        action.beginRead() ;
+        try { 
+            Target target = determineTarget(action) ;
+            if ( log.isDebugEnabled() )
+                log.debug("HEAD->"+target) ;
+            if ( ! target.exists() )
+            {
+                successNotFound(action) ;
+                return ;
+            }
+            MediaType mediaType = HttpAction.contentNegotationRDF(action) ;
+            success(action) ;
+        } finally { action.endRead() ; }
+    }
+
+    @Override
+    protected void doPost(HttpAction action)
+    { errorMethodNotAllowed("POST") ; }
+
+    @Override
+    protected void doDelete(HttpAction action)
+    { errorMethodNotAllowed("DELETE") ; }
+
+    @Override
+    protected void doPut(HttpAction action)
+    { errorMethodNotAllowed("PUT") ; }
+
+    @Override
+    protected void doPatch(HttpAction action)
+    { errorMethodNotAllowed("PATCH") ; }
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_REST_RW.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_REST_RW.java b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_REST_RW.java
new file mode 100644
index 0000000..712d543
--- /dev/null
+++ b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_REST_RW.java
@@ -0,0 +1,232 @@
+/*
+ * 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.fuseki.servlets;
+
+import static java.lang.String.format ;
+
+import java.io.IOException ;
+import java.io.InputStream ;
+import java.util.Map ;
+import java.util.Map.Entry ;
+
+import org.apache.jena.atlas.io.IO ;
+import org.apache.jena.atlas.web.ContentType ;
+import org.apache.jena.fuseki.FusekiLib ;
+import org.apache.jena.fuseki.HttpNames ;
+import org.apache.jena.riot.Lang ;
+import org.apache.jena.riot.RDFLanguages ;
+import org.apache.jena.riot.RiotException ;
+import org.apache.jena.riot.WebContent ;
+import org.apache.jena.riot.system.StreamRDF ;
+import org.apache.jena.riot.system.StreamRDFLib ;
+import org.apache.jena.web.HttpSC ;
+
+import com.hp.hpl.jena.graph.Graph ;
+import com.hp.hpl.jena.sparql.graph.GraphFactory ;
+
+/** The WRITE operations added to the READ operations */
+public class SPARQL_REST_RW extends SPARQL_REST_R
+{
+    public SPARQL_REST_RW()
+    { super() ; }
+
+    @Override
+    protected void doOptions(HttpAction action)
+    {
+        setCommonHeadersForOptions(action.response) ;
+        action.response.setHeader(HttpNames.hAllow, "GET,HEAD,OPTIONS,PUT,DELETE,POST");
+        action.response.setHeader(HttpNames.hContentLengh, "0") ;
+        success(action) ;
+    }
+    
+    @Override
+    protected void doDelete(HttpAction action)
+    {
+        action.beginWrite() ;
+        try {
+            Target target = determineTarget(action) ;
+            if ( log.isDebugEnabled() )
+                log.debug("DELETE->"+target) ;
+            boolean existedBefore = target.exists() ; 
+            if ( ! existedBefore)
+            {
+                // commit, not abort, because locking "transactions" don't support abort. 
+                action.commit() ;
+                errorNotFound("No such graph: "+target.name) ;
+            } 
+            deleteGraph(action) ;
+            action.commit() ;
+        }
+        finally { action.endWrite() ; }
+        ServletBase.successNoContent(action) ;
+    }
+
+    @Override
+    protected void doPut(HttpAction action)     { doPutPost(action, true) ; }
+
+    @Override
+    protected void doPost(HttpAction action)     { doPutPost(action, false) ; }
+
+    private void doPutPost(HttpAction action, boolean overwrite) {
+        ContentType ct = FusekiLib.getContentType(action) ;
+        if ( ct == null )
+            errorBadRequest("No Content-Type:") ;
+
+        // Helper case - if it's a possible HTTP file upload, pretend that's the action.
+        if ( WebContent.contentTypeMultipartFormData.equalsIgnoreCase(ct.getContentType()) ) {
+            String base = wholeRequestURL(action.request) ;
+            SPARQL_Upload.upload(action, base) ;
+            return ; 
+        }
+
+        if ( WebContent.matchContentType(WebContent.ctMultipartMixed, ct) )
+            error(HttpSC.UNSUPPORTED_MEDIA_TYPE_415, "multipart/mixed not supported") ;
+        
+        boolean existedBefore = false ;
+        if ( action.isTransactional() )
+            existedBefore = addDataIntoTxn(action, overwrite) ;
+        else
+            existedBefore = addDataIntoNonTxn(action, overwrite) ;
+            
+        if ( existedBefore )
+            ServletBase.successNoContent(action) ;
+        else
+            ServletBase.successCreated(action) ;
+    }
+
+    /** Directly add data in a transaction.
+     * Assumes recovery from parse errors by transaction abort.
+     * Return whether the target existed before.
+     * @param action
+     * @param cleanDest Whether to remove data first (true = PUT, false = POST)
+     * @return whether the target existed beforehand
+     */
+    protected static boolean addDataIntoTxn(HttpAction action, boolean overwrite) {   
+        action.beginWrite();
+        Target target = determineTarget(action) ;
+        boolean existedBefore = false ;
+        try {
+            if ( log.isDebugEnabled() )
+                log.debug("  ->"+target) ;
+            existedBefore = target.exists() ;
+            Graph g = target.graph() ;
+            if ( overwrite && existedBefore )
+                clearGraph(target) ;
+            StreamRDF sink = StreamRDFLib.graph(g) ;
+            incomingData(action, sink);
+            action.commit() ;
+            return existedBefore ;
+        } catch (RiotException ex) { 
+            // Parse error
+            action.abort() ;
+            errorBadRequest(ex.getMessage()) ;
+            return existedBefore ;
+        } catch (Exception ex) {
+            // Something else went wrong.  Backout.
+            action.abort() ;
+            errorOccurred(ex.getMessage()) ;
+            return existedBefore ;
+        } finally {
+            action.endWrite() ;
+        }
+    }
+
+    /** Add data where the destination does not support full transactions.
+     *  In particular, with no abort, and actions probably going to the real storage
+     *  parse errors can lead to partial updates.  Instead, parse to a temporary
+     *  graph, then insert that data.  
+     * @param action
+     * @param cleanDest Whether to remove data first (true = PUT, false = POST)
+     * @return whether the target existed beforehand.
+     */
+    
+    protected static boolean addDataIntoNonTxn(HttpAction action, boolean overwrite) {
+        Graph graphTmp = GraphFactory.createGraphMem() ;
+        StreamRDF dest = StreamRDFLib.graph(graphTmp) ;
+
+        try { incomingData(action, dest); }
+        catch (RiotException ex) {
+            errorBadRequest(ex.getMessage()) ;
+            return false ;
+        }
+        // Now insert into dataset
+        action.beginWrite() ;
+        Target target = determineTarget(action) ;
+        boolean existedBefore = false ;
+        try {
+            if ( log.isDebugEnabled() )
+                log.debug("  ->"+target) ;
+            existedBefore = target.exists() ; 
+            if ( overwrite && existedBefore )
+                clearGraph(target) ;
+            FusekiLib.addDataInto(graphTmp, target.dsg, target.graphName) ;
+            action.commit() ;
+            return existedBefore ;
+        } catch (Exception ex) {
+            // We parsed into a temporary graph so an exception at this point
+            // is not because of a parse error.
+            // We're in the non-transactional branch, this probably will not work
+            // but it might and there is no harm safely trying. 
+            try { action.abort() ; } catch (Exception ex2) {} 
+            errorOccurred(ex.getMessage()) ;
+            return existedBefore ;            
+        } finally { action.endWrite() ; }
+    }
+    
+    private static void incomingData(HttpAction action, StreamRDF dest) {
+        String base = wholeRequestURL(action.request) ;
+        ContentType ct = FusekiLib.getContentType(action) ;
+        Lang lang = RDFLanguages.contentTypeToLang(ct.getContentType()) ;
+        if ( lang == null ) {
+            errorBadRequest("Unknown content type for triples: " + ct) ;
+            return ;
+        }
+        InputStream input = null ;
+        try { input = action.request.getInputStream() ; } 
+        catch (IOException ex) { IO.exception(ex) ; }
+    
+        int len = action.request.getContentLength() ;
+        if ( action.verbose ) {
+            if ( len >= 0 )
+                log.info(format("[%d]   Body: Content-Length=%d, Content-Type=%s, Charset=%s => %s", action.id, len,
+                                ct.getContentType(), ct.getCharset(), lang.getName())) ;
+            else
+                log.info(format("[%d]   Body: Content-Type=%s, Charset=%s => %s", action.id, ct.getContentType(),
+                                ct.getCharset(), lang.getName())) ;
+        }
+    
+        parse(action, dest, input, lang, base) ;
+    }
+
+    protected static void deleteGraph(HttpAction action) {
+        Target target = determineTarget(action) ;
+        if ( target.isDefault )
+            target.graph().clear() ;
+        else
+            action.getActiveDSG().removeGraph(target.graphName) ;
+    }
+
+    protected static void clearGraph(Target target) {
+        Graph g = target.graph() ;
+        g.clear() ;
+        Map<String, String> pm = g.getPrefixMapping().getNsPrefixMap() ;
+        for ( Entry<String, String> e : pm.entrySet() ) 
+            g.getPrefixMapping().removeNsPrefix(e.getKey()) ;
+    }
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_ServletBase.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_ServletBase.java b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_ServletBase.java
new file mode 100644
index 0000000..a3d5271
--- /dev/null
+++ b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_ServletBase.java
@@ -0,0 +1,458 @@
+/*
+ * 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.fuseki.servlets;
+
+import static java.lang.String.format ;
+import static org.apache.jena.fuseki.server.CounterName.Requests ;
+import static org.apache.jena.fuseki.server.CounterName.RequestsBad ;
+import static org.apache.jena.fuseki.server.CounterName.RequestsGood ;
+
+import java.io.IOException ;
+import java.util.Enumeration ;
+import java.util.Map ;
+import java.util.concurrent.atomic.AtomicLong ;
+
+import javax.servlet.ServletException ;
+import javax.servlet.http.HttpServletRequest ;
+import javax.servlet.http.HttpServletResponse ;
+
+import org.apache.jena.atlas.RuntimeIOException ;
+import org.apache.jena.fuseki.Fuseki ;
+import org.apache.jena.fuseki.HttpNames ;
+import org.apache.jena.fuseki.server.* ;
+import org.apache.jena.web.HttpSC ;
+
+import com.hp.hpl.jena.query.ARQ ;
+import com.hp.hpl.jena.query.QueryCancelledException ;
+import com.hp.hpl.jena.sparql.util.Context ;
+
+/**
+ * Base servlet for SPARQL requests.
+ */
+public abstract class SPARQL_ServletBase extends ServletBase
+{
+    /**
+     * Creates a new SPARQL base Servlet.
+     */
+    protected SPARQL_ServletBase()      {   super() ; }
+    
+    // Common framework for handling HTTP requests
+    /**
+     * Handles GET and POST requests.
+     * @param request HTTP request
+     * @param response HTTP response
+     */
+    protected void doCommon(HttpServletRequest request, HttpServletResponse response)
+    //throws ServletException, IOException
+    {
+        try {
+            long id = allocRequestId(request, response);
+            
+            // Lifecycle
+            HttpAction action = allocHttpAction(id, request, response) ;
+            // then add to doCommonWorker
+            // work with HttpServletResponseTracker
+            
+            printRequest(action) ;
+            action.setStartTime() ;
+            
+            response = action.response ;
+            initResponse(request, response) ;
+            Context cxt = ARQ.getContext() ;
+            
+            try {
+                execCommonWorker(action) ;
+            } catch (QueryCancelledException ex) {
+                // Also need the per query info ...
+                String message = String.format("The query timed out (restricted to %s ms)", cxt.get(ARQ.queryTimeout));
+                // Possibility :: response.setHeader("Retry-after", "600") ;    // 5 minutes
+                responseSendError(response, HttpSC.SERVICE_UNAVAILABLE_503, message);
+            } catch (ActionErrorException ex) {
+                if ( ex.exception != null )
+                    ex.exception.printStackTrace(System.err) ;
+                // Log message done by printResponse in a moment.
+                if ( ex.message != null )
+                    responseSendError(response, ex.rc, ex.message) ;
+                else
+                    responseSendError(response, ex.rc) ;
+            } catch (RuntimeIOException ex) {
+                log.warn(format("[%d] Runtime IO Exception (client left?) RC = %d", id, HttpSC.INTERNAL_SERVER_ERROR_500)) ;
+                responseSendError(response, HttpSC.INTERNAL_SERVER_ERROR_500, ex.getMessage()) ;
+            } catch (Throwable ex) {
+                // This should not happen.
+                //ex.printStackTrace(System.err) ;
+                log.warn(format("[%d] RC = %d : %s", id, HttpSC.INTERNAL_SERVER_ERROR_500, ex.getMessage()), ex) ;
+                responseSendError(response, HttpSC.INTERNAL_SERVER_ERROR_500, ex.getMessage()) ;
+            }
+    
+            action.setFinishTime() ;
+            printResponse(action) ;
+            archiveHttpAction(action) ;
+        } catch (Throwable th) {
+            log.error("Internal error", th) ;
+        }
+    }
+
+    // ---- Operation lifecycle
+
+    /**
+     * Returns a fresh HTTP Action for this request.
+     * @param id the Request ID
+     * @param request HTTP request
+     * @param response HTTP response
+     * @return a new HTTP Action
+     */
+    protected HttpAction allocHttpAction(long id, HttpServletRequest request, HttpServletResponse response) {
+        // Need a way to set verbose logging on a per servlet and per request basis. 
+        return new HttpAction(id, request, response, verboseLogging) ;
+    }
+
+    /**
+     * Validates a HTTP Action.
+     * @param action HTTP Action
+     */
+    protected abstract void validate(HttpAction action) ;
+
+    /**
+     * Performs the HTTP Action.
+     * @param action HTTP Action
+     */
+    protected abstract void perform(HttpAction action) ;
+
+    /**
+     * Default start step.
+     * @param action HTTP Action
+     */
+    protected void startRequest(HttpAction action) {
+    }
+
+    /**
+     * Default finish step.
+     * @param action HTTP Action
+     */
+    protected void finishRequest(HttpAction action) { }
+
+    /**
+     * Archives the HTTP Action.
+     * @param action HTTP Action
+     * @see HttpAction#minimize()
+     */
+    private void archiveHttpAction(HttpAction action)
+    {
+        action.minimize() ;
+    }
+
+    /**
+     * Executes common tasks, including mapping the request to the right dataset, setting the dataset into the HTTP
+     * action, and retrieving the service for the dataset requested. Finally, it calls the
+     * {@link #executeAction(HttpAction)} method, which executes the HTTP Action life cycle.
+     * @param action HTTP Action
+     */
+    private void execCommonWorker(HttpAction action)
+    {
+        DatasetRef dsRef = null ;
+        String uri = action.request.getRequestURI() ;
+
+        String datasetUri = mapRequestToDataset(uri) ;
+        
+        if ( datasetUri != null ) {
+            dsRef = DatasetRegistry.get().get(datasetUri) ;
+            if ( dsRef == null ) {
+                errorNotFound("No dataset for URI: "+datasetUri) ;
+                return ;
+            }
+        } else
+            dsRef = FusekiConfig.serviceOnlyDatasetRef() ;
+
+        action.setDataset(dsRef) ;
+        String serviceName = mapRequestToService(dsRef, uri, datasetUri) ;
+        ServiceRef srvRef = dsRef.getServiceRef(serviceName) ;
+        action.setService(srvRef) ;
+        executeAction(action) ;
+    }
+
+    /**
+     * Utility method, that increments and returns the AtomicLong value.
+     * @param x AtomicLong
+     */
+    protected void inc(AtomicLong x)
+    {
+        x.incrementAndGet() ;
+    }
+
+    /**
+     * Executes the HTTP Action. Serves as intercept point for the UberServlet.
+     * @param action HTTP Action
+     */
+    protected void executeAction(HttpAction action)
+    {
+        executeLifecycle(action) ;
+    }
+    
+    /**
+     * Handles the service request lifecycle. Called directly by the UberServlet,
+     * which has not done any stats by this point.
+     * @param action {@link HttpAction}
+     * @see HttpAction
+     */
+    protected void executeLifecycle(HttpAction action)
+    {
+        incCounter(action.dsRef, Requests) ;
+        incCounter(action.srvRef, Requests) ;
+
+        startRequest(action) ;
+        try {
+            validate(action) ;
+        } catch (ActionErrorException ex) {
+            incCounter(action.dsRef,RequestsBad) ;
+            throw ex ;
+        }
+
+        try {
+            perform(action) ;
+            // Success
+            incCounter(action.srvRef, RequestsGood) ;
+            incCounter(action.dsRef, RequestsGood) ;
+        } catch (ActionErrorException ex) {
+            incCounter(action.srvRef, RequestsBad) ;
+            incCounter(action.dsRef, RequestsBad) ;
+            throw ex ;
+        } catch (QueryCancelledException ex) {
+            incCounter(action.srvRef, RequestsBad) ;
+            incCounter(action.dsRef, RequestsBad) ;
+            throw ex ;
+        } finally {
+            finishRequest(action) ;
+        }
+    }
+
+    /**
+     * Increments a counter.
+     * @param counters a {@link Counter}
+     * @param name a {@link CounterName}
+     */
+    protected static void incCounter(Counters counters, CounterName name) {
+        try {
+            if ( counters.getCounters().contains(name) )
+                counters.getCounters().inc(name) ;
+        } catch (Exception ex) {
+            Fuseki.serverLog.warn("Exception on counter inc", ex) ;
+        }
+    }
+
+    /**
+     * Decrements a counter.
+     * @param counters a {@link Counter}
+     * @param name a {@link CounterName}
+     */
+    protected static void decCounter(Counters counters, CounterName name) {
+        try {
+            if ( counters.getCounters().contains(name) )
+                counters.getCounters().dec(name) ;
+        } catch (Exception ex) {
+            Fuseki.serverLog.warn("Exception on counter dec", ex) ;
+        }
+    }
+
+    /**
+     * <p>Sends an <strong>error</strong> when the PATCH method is called.</p>
+     * <p>Throws ServletException or IOException as per overloaded method signature.</p>
+     * @param request HTTP request
+     * @param response HTTP response
+     * @throws ServletException from overloaded method signature
+     * @throws IOException from overloaded method signature
+     */
+    protected void doPatch(HttpServletRequest request, HttpServletResponse response)
+    throws ServletException, IOException
+    {
+        response.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED, "HTTP PATCH not supported");
+    }
+
+    /**
+     * Prints the HTTP Action request to the program log, using the INFO level.
+     * @param action {@link HttpAction}
+     */
+    private void printRequest(HttpAction action)
+    {
+        String url = wholeRequestURL(action.request) ;
+        String method = action.request.getMethod() ;
+
+        log.info(format("[%d] %s %s", action.id, method, url)) ;
+        if ( action.verbose ) {
+            Enumeration<String> en = action.request.getHeaderNames() ;
+            for (; en.hasMoreElements();) {
+                String h = en.nextElement() ;
+                Enumeration<String> vals = action.request.getHeaders(h) ;
+                if (!vals.hasMoreElements())
+                    log.info(format("[%d]   ", action.id, h)) ;
+                else {
+                    for (; vals.hasMoreElements();)
+                        log.info(format("[%d]   %-20s %s", action.id, h, vals.nextElement())) ;
+                }
+            }
+        }
+    }
+
+    /**
+     * Initiates the response, by setting common headers such as Access-Control-Allow-Origin and Server, and
+     * the Vary header if the request method used was a GET.
+     * @param request HTTP request
+     * @param response HTTP response
+     */
+    private void initResponse(HttpServletRequest request, HttpServletResponse response)
+    {
+        setCommonHeaders(response) ;
+        String method = request.getMethod() ;
+        // All GET and HEAD operations are sensitive to conneg so ...
+        if ( HttpNames.METHOD_GET.equalsIgnoreCase(method) || HttpNames.METHOD_HEAD.equalsIgnoreCase(method) )
+            setVaryHeader(response) ;
+    }
+
+    /**
+     * Prints the HTTP Action response to the program log, using the INFO level.
+     * @param action {@link HttpAction}
+     */
+    private void printResponse(HttpAction action)
+    {
+        long time = action.getTime() ;
+        
+        HttpServletResponseTracker response = action.response ;
+        if ( action.verbose )
+        {
+            if ( action.contentType != null )
+                log.info(format("[%d]   %-20s %s", action.id, HttpNames.hContentType, action.contentType)) ;
+            if ( action.contentLength != -1 )
+                log.info(format("[%d]   %-20s %d", action.id, HttpNames.hContentLengh, action.contentLength)) ;
+            for ( Map.Entry<String, String> e: action.headers.entrySet() )
+                log.info(format("[%d]   %-20s %s", action.id, e.getKey(), e.getValue())) ;
+        }
+
+        String timeStr = fmtMillis(time) ;
+
+        if ( action.message == null )
+            log.info(String.format("[%d] %d %s (%s) ", action.id, action.statusCode, HttpSC.getMessage(action.statusCode), timeStr)) ;
+        else
+            log.info(String.format("[%d] %d %s (%s) ", action.id, action.statusCode, action.message, timeStr)) ;
+    }
+
+    /**
+     * <p>Given a time epoch, it will return the time in milli seconds if it is less than 1000,
+     * otherwise it will normalize it to display as second.</p>
+     * <p>It appends a 'ms' suffix when using milli seconds, and ditto <i>s</i> for seconds.</p>
+     * <p>For instance: </p>
+     * <ul>
+     * <li>10 emits 10 ms</li>
+     * <li>999 emits 999 ms</li>
+     * <li>1000 emits 1.000000 s</li>
+     * <li>10000 emits 10.000000 s</li>
+     * </ul>
+     * @param time the time epoch
+     * @return the time in milli seconds or in seconds
+     */
+    private static String fmtMillis(long time)
+    {
+        // Millis only? seconds only?
+        if ( time < 1000 )
+            return String.format("%,d ms", time) ;
+        return String.format("%,.3f s", time/1000.0) ;
+    }
+
+    /**
+     * Map request to uri in the registry. null means no mapping done (passthrough).
+     * @param uri the URI
+     * @return the dataset
+     */
+    protected String mapRequestToDataset(String uri) 
+    {
+        return mapRequestToDataset$(uri) ;
+    }
+    
+    /**
+     * A possible implementation for mapRequestToDataset(String) that assumes the form /dataset/service.
+     * @param uri the URI
+     * @return the dataset
+     */
+    protected static String mapRequestToDataset$(String uri)
+    {
+        // Chop off trailing part - the service selector
+        // e.g. /dataset/sparql => /dataset 
+        int i = uri.lastIndexOf('/') ;
+        if ( i == -1 )
+            return null ;
+        if ( i == 0 )
+        {
+            // started with '/' - leave.
+            return uri ;
+        }
+        
+        return uri.substring(0, i) ;
+    }
+
+    /**
+     * Maps a request to a service (e.g. Query, Update).
+     * @param dsRef a {@link DatasetRef}
+     * @param uri the URI
+     * @param datasetURI the dataset URI
+     * @return an empty String (i.e. "") if the DatasetRef is null, or if its name is longer than the URI's name.
+     * Otherwise will return the service name.
+     */
+    protected String mapRequestToService(DatasetRef dsRef, String uri, String datasetURI)
+    {
+        if ( dsRef == null )
+            return "" ;
+        if ( dsRef.name.length() >= uri.length() )
+            return "" ;
+        return uri.substring(dsRef.name.length()+1) ;   // Skip the separating "/"
+        
+    }
+    
+    /**
+     * Implementation of mapRequestToDataset(String) that looks for the longest match in the registry.
+     * This includes use in direct naming GSP.
+     * @param uri the URI
+     * @return <code>null</code> if the URI is null, otherwise will return the longest match in the registry.
+     */
+    protected static String mapRequestToDatasetLongest$(String uri) 
+    {
+        if ( uri == null )
+            return null ;
+        
+        // This covers local, using the URI as a direct name for
+        // a graph, not just using the indirect ?graph= or ?default 
+        // forms.
+
+        String ds = null ;
+        for ( String ds2 : DatasetRegistry.get().keys() ) {
+            if ( ! uri.startsWith(ds2) )
+                continue ;
+
+            if ( ds == null )
+            {
+                ds = ds2 ;
+                continue ; 
+            }
+            if ( ds.length() < ds2.length() )
+            {
+                ds = ds2 ;
+                continue ;
+            }
+        }
+        return ds ;
+    }
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_UberServlet.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_UberServlet.java b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_UberServlet.java
new file mode 100644
index 0000000..0c10cee
--- /dev/null
+++ b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_UberServlet.java
@@ -0,0 +1,338 @@
+/**
+ * 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.fuseki.servlets;
+
+import static java.lang.String.format ;
+
+import java.util.List ;
+
+import javax.servlet.http.HttpServletRequest ;
+import javax.servlet.http.HttpServletResponse ;
+
+import org.apache.jena.atlas.web.MediaType ;
+import org.apache.jena.fuseki.DEF ;
+import org.apache.jena.fuseki.FusekiException ;
+import org.apache.jena.fuseki.HttpNames ;
+import org.apache.jena.fuseki.conneg.ConNeg ;
+import org.apache.jena.fuseki.server.DatasetRef ;
+import org.apache.jena.fuseki.server.ServiceRef ;
+import org.apache.jena.riot.WebContent ;
+
+/** This servlet can be attached to a dataset location
+ *  and acts as a router for all SPARQL operations
+ *  (query, update, graph store, both direct and indirect naming). 
+ */
+public abstract class SPARQL_UberServlet extends SPARQL_ServletBase
+{
+    protected abstract boolean allowQuery(HttpAction action) ;
+    protected abstract boolean allowUpdate(HttpAction action) ;
+    protected abstract boolean allowREST_R(HttpAction action) ;
+    protected abstract boolean allowREST_W(HttpAction action) ;
+    protected abstract boolean allowQuadsR(HttpAction action) ;
+    protected abstract boolean allowQuadsW(HttpAction action) ;
+    
+    public static class ReadOnly extends SPARQL_UberServlet
+    {
+        public ReadOnly()    { super() ; }
+        @Override protected boolean allowQuery(HttpAction action)    { return true ; }
+        @Override protected boolean allowUpdate(HttpAction action)   { return false ; }
+        @Override protected boolean allowREST_R(HttpAction action)   { return true ; }
+        @Override protected boolean allowREST_W(HttpAction action)   { return false ; }
+        @Override protected boolean allowQuadsR(HttpAction action)   { return true ; }
+        @Override protected boolean allowQuadsW(HttpAction action)   { return false ; }
+    }
+
+    public static class ReadWrite extends SPARQL_UberServlet
+    {
+        public ReadWrite()    { super() ; }
+        @Override protected boolean allowQuery(HttpAction action)    { return true ; }
+        @Override protected boolean allowUpdate(HttpAction action)   { return true ; }
+        @Override protected boolean allowREST_R(HttpAction action)   { return true ; }
+        @Override protected boolean allowREST_W(HttpAction action)   { return true ; }
+        @Override protected boolean allowQuadsR(HttpAction action)   { return true ; }
+        @Override protected boolean allowQuadsW(HttpAction action)   { return true ; }
+    }
+
+    public static class AccessByConfig extends SPARQL_UberServlet
+    {
+        public AccessByConfig()    { super() ; }
+        @Override protected boolean allowQuery(HttpAction action)    { return isEnabled(action.dsRef.query) ; }
+        @Override protected boolean allowUpdate(HttpAction action)   { return isEnabled(action.dsRef.update) ; }
+        @Override protected boolean allowREST_R(HttpAction action)   { return isEnabled(action.dsRef.readGraphStore) || allowREST_W(action); }
+        @Override protected boolean allowREST_W(HttpAction action)   { return isEnabled(action.dsRef.readWriteGraphStore) ; }
+        // Quad operations tied to presence/absence of GSP.
+        @Override protected boolean allowQuadsR(HttpAction action)   { return isEnabled(action.dsRef.readGraphStore) ; }
+        @Override protected boolean allowQuadsW(HttpAction action)   { return isEnabled(action.dsRef.readWriteGraphStore) ; }
+
+        private boolean isEnabled(ServiceRef service) { return service.isActive() ; } 
+    }
+    
+    /*  This can be used for a single servlet for everything (über-servlet)
+     *  
+     *  It can check for a request that looks like a service request and passes it on.
+     * This takes precedence over direct naming.
+     */
+    
+    // Refactor? Extract the direct naming handling.
+    // To test: enable in SPARQLServer.configureOneDataset
+    
+    private final SPARQL_ServletBase queryServlet    = new SPARQL_QueryDataset() ;
+    private final SPARQL_ServletBase updateServlet   = new SPARQL_Update() ;
+    private final SPARQL_ServletBase uploadServlet   = new SPARQL_Upload() ;
+    private final SPARQL_REST        restServlet_RW  = new SPARQL_REST_RW() ;
+    private final SPARQL_REST        restServlet_R   = new SPARQL_REST_R() ;
+    private final SPARQL_ServletBase restQuads       = new REST_Quads() ;
+    
+    public SPARQL_UberServlet() { super(); }
+
+    private String getEPName(String dsname, List<String> endpoints)
+    {
+        if (endpoints == null || endpoints.size() == 0) return null ;
+        String x = endpoints.get(0) ;
+        if ( ! dsname.endsWith("/") )
+            x = dsname+"/"+x ;
+        else
+            x = dsname+x ;
+        return x ;
+    }
+    
+    // These calls should not happen because we hook in at executeAction
+    @Override protected void validate(HttpAction action) { throw new FusekiException("Call to SPARQL_UberServlet.validate") ; }
+    @Override protected void perform(HttpAction action)  { throw new FusekiException("Call to SPARQL_UberServlet.perform") ; }
+
+    /** Map request to uri in the registry.
+     *  null means no mapping done 
+     */
+    @Override
+    protected String mapRequestToDataset(String uri) 
+    {
+        return mapRequestToDatasetLongest$(uri) ;
+    }
+    
+
+    /** Intercept the processing cycle at the point where the action has been set up,
+     *  the dataset target decided but no validation or execution has been done, 
+     *  nor any stats have been done.
+     */
+    @Override
+    protected void executeAction(HttpAction action)
+    {
+        long id = action.id ;
+        HttpServletRequest request = action.request ;
+        HttpServletResponse response = action.response ;
+        String uri = request.getRequestURI() ;
+        String method = request.getMethod() ;
+        DatasetRef desc = action.dsRef ;
+        
+        String trailing = findTrailing(uri, desc.name) ;
+        String qs = request.getQueryString() ;
+
+        boolean hasParams = request.getParameterMap().size() > 0 ;
+        
+        // Test for parameters - includes HTML forms.
+        boolean hasParamQuery           = request.getParameter(HttpNames.paramQuery) != null ;
+        // Include old name "request="
+        boolean hasParamUpdate          = request.getParameter(HttpNames.paramUpdate) != null || request.getParameter(HttpNames.paramRequest) != null ;
+        boolean hasParamGraph           = request.getParameter(HttpNames.paramGraph) != null ;
+        boolean hasParamGraphDefault    = request.getParameter(HttpNames.paramGraphDefault) != null ;
+        boolean isForm                  = WebContent.contentTypeHTMLForm.equalsIgnoreCase(request.getContentType()) ;
+
+        String ct = request.getContentType() ;
+        String charset = request.getCharacterEncoding() ;
+        
+        MediaType mt = null ;
+        if ( ct != null )
+            mt = MediaType.create(ct, charset) ;
+        
+        log.info(format("[%d] All: %s %s :: '%s' :: %s ? %s", id, method, desc.name, trailing, (mt==null?"<none>":mt), (qs==null?"":qs))) ;
+                       
+        boolean hasTrailing = ( trailing.length() != 0 ) ;
+        
+        if ( ! hasTrailing && ! hasParams )
+        {
+            restQuads.executeLifecycle(action) ;
+            return ;
+        }
+        
+        if ( ! hasTrailing )
+        {
+            // Has params of some kind.
+            if ( hasParamQuery || WebContent.contentTypeSPARQLQuery.equalsIgnoreCase(ct) )
+            {
+                // SPARQL Query
+                if ( ! allowQuery(action))
+                    errorForbidden("Forbidden: SPARQL query") ; 
+                executeRequest(action, queryServlet, desc.query) ;
+                return ;
+            }
+                 
+            if ( hasParamUpdate || WebContent.contentTypeSPARQLUpdate.equalsIgnoreCase(ct) )
+            {
+                // SPARQL Update
+                if ( ! allowQuery(action))
+                    errorForbidden("Forbidden: SPARQL query") ; 
+                executeRequest(action, updateServlet, desc.update) ;
+                return ;
+            }
+            
+            if ( hasParamGraph || hasParamGraphDefault )
+            {
+                doGraphStoreProtocol(action) ;
+                return ;
+            }
+            
+            errorBadRequest("Malformed request") ;
+            errorForbidden("Forbidden: SPARQL Graph Store Protocol : Read operation : "+method) ;
+        }
+        
+        final boolean checkForPossibleService = true ;
+        if ( checkForPossibleService )
+        {
+            // There is a trailing part.
+            // Check it's not the same name as a registered service.
+            // If so, dispatch to that service.
+            if ( serviceDispatch(action, desc.query, trailing, queryServlet) ) return ; 
+            if ( serviceDispatch(action, desc.update, trailing, updateServlet) ) return ; 
+            if ( serviceDispatch(action, desc.upload, trailing, uploadServlet) ) return ; 
+            if ( serviceDispatch(action, desc.readGraphStore, trailing, restServlet_R) ) return ; 
+            if ( serviceDispatch(action, desc.readWriteGraphStore, trailing, restServlet_RW) ) return ; 
+        }       
+        // There is a trailing part - params are illegal by this point.
+        if ( hasParams )
+            // ?? Revisit to include query-on-one-graph 
+            //errorBadRequest("Can't invoke a query-string service on a direct named graph") ;
+            errorNotFound("Not found: dataset='"+printName(desc.name)+"' service='"+printName(trailing)+"'");
+
+        // There is a trailing part - not a service, no params ==> GSP direct naming.
+        doGraphStoreProtocol(action) ;
+    }
+    
+    private String printName(String x) {
+        if ( x.startsWith("/") )
+            return x.substring(1) ;
+        return x ;
+    }
+    
+    private void doGraphStoreProtocol(HttpAction action)
+    {
+        // The GSP servlets handle direct and indirect naming. 
+        DatasetRef desc = action.dsRef ;
+        String method = action.request.getMethod() ;
+        
+        if ( HttpNames.METHOD_GET.equalsIgnoreCase(method) ||
+             HttpNames.METHOD_HEAD.equalsIgnoreCase(method) ) 
+       {
+           if ( ! allowREST_R(action))
+           // Graphs Store Protocol, indirect naming, read
+           // Indirect naming. Prefer the R service if available.
+           if ( desc.readGraphStore.isActive() )
+               executeRequest(action, restServlet_R, desc.readGraphStore) ;
+           else if ( desc.readWriteGraphStore.isActive() )
+               executeRequest(action, restServlet_RW, desc.readWriteGraphStore) ;
+           else
+               errorMethodNotAllowed(method) ;
+           return ;
+       }
+       
+       // Graphs Store Protocol, indirect naming, write
+       if ( ! allowREST_W(action))
+           errorForbidden("Forbidden: SPARQL Graph Store Protocol : Write operation : "+method) ;
+       executeRequest(action, restServlet_RW, desc.readWriteGraphStore) ;
+       return ;
+    }
+
+    private void executeRequest(HttpAction action, SPARQL_ServletBase servlet, ServiceRef service)
+    {
+        if ( service.endpoints.size() == 0 )
+            errorMethodNotAllowed(action.request.getMethod()) ;
+        servlet.executeLifecycle(action) ;
+    }
+
+    private void executeRequest(HttpAction action,SPARQL_ServletBase servlet)
+    {
+        servlet.executeLifecycle(action) ;
+//      // Forwarded dispatch.
+//      try
+//      {
+//          String target = getEPName(desc.name, endpointList) ;
+//          if ( target == null )
+//              errorMethodNotAllowed(request.getMethod()) ;
+//          // ** relative servlet forward
+//          request.getRequestDispatcher(target).forward(request, response) ;    
+        
+
+//          // ** absolute srvlet forward
+//          // getServletContext().getRequestDispatcher(target) ;
+//      } catch (Exception e) { errorOccurred(e) ; }        
+    }
+
+    protected static MediaType contentNegotationQuads(HttpAction action)
+    {
+        MediaType mt = ConNeg.chooseContentType(action.request, DEF.quadsOffer, DEF.acceptNQuads) ;
+        if ( mt == null )
+            return null ;
+        if ( mt.getContentType() != null )
+            action.response.setContentType(mt.getContentType());
+        if ( mt.getCharset() != null )
+        action.response.setCharacterEncoding(mt.getCharset()) ;
+        return mt ;
+    }
+
+    /** return true if dispatched */
+    private boolean serviceDispatch(HttpAction action, ServiceRef service, String srvName , SPARQL_ServletBase servlet)
+    {
+        if ( ! service.endpoints.contains(srvName) )
+            return false ;
+        servlet.executeLifecycle(action) ;
+        return true ;
+    }
+
+    /** Find the graph (direct naming) or service name */ 
+    protected String findTrailing(String uri, String dsname) 
+    {
+        if ( dsname.length() >= uri.length() )
+            return "" ;
+        return uri.substring(dsname.length()+1) ;   // Skip the separating "/"
+    }
+
+    @Override
+    protected void doHead(HttpServletRequest request, HttpServletResponse response)
+    { doCommon(request, response) ; }
+    
+    @Override
+    protected void doGet(HttpServletRequest request, HttpServletResponse response)
+    { doCommon(request, response) ; }
+
+    @Override
+    protected void doPost(HttpServletRequest request, HttpServletResponse response)
+    { doCommon(request, response) ; }
+
+    @Override
+    protected void doOptions(HttpServletRequest request, HttpServletResponse response)
+    { doCommon(request, response) ; }
+    
+    @Override
+    protected void doPut(HttpServletRequest request, HttpServletResponse response)
+    { doCommon(request, response) ; }
+
+    @Override
+    protected void doDelete(HttpServletRequest request, HttpServletResponse response)
+    { doCommon(request, response) ; }
+}
+


[20/23] jena git commit: Rename folder jena-fuseki to jena-fuseki1

Posted by an...@apache.org.
http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/dist/LICENSE
----------------------------------------------------------------------
diff --git a/jena-fuseki/dist/LICENSE b/jena-fuseki/dist/LICENSE
deleted file mode 100644
index 45a6ca4..0000000
--- a/jena-fuseki/dist/LICENSE
+++ /dev/null
@@ -1,548 +0,0 @@
-
-                                 Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-- - - - - - - - - - - - - - - - - - - - - - - 
-
-  (c) Copyright 2003, Plugged In Software 
-
-  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.
-
-- - - - - - - - - - - - - - - - - - - - - - - 
-
-http://www.slf4j.org/license.html
-
- Copyright (c) 2004-2011 QOS.ch
- All rights reserved.
-
- Permission is hereby granted, free  of charge, to any person obtaining
- a  copy  of this  software  and  associated  documentation files  (the
- "Software"), to  deal in  the Software without  restriction, including
- without limitation  the rights to  use, copy, modify,  merge, publish,
- distribute,  sublicense, and/or sell  copies of  the Software,  and to
- permit persons to whom the Software  is furnished to do so, subject to
- the following conditions:
- 
- The  above  copyright  notice  and  this permission  notice  shall  be
- included in all copies or substantial portions of the Software.
- 
- THE  SOFTWARE IS  PROVIDED  "AS  IS", WITHOUT  WARRANTY  OF ANY  KIND,
- EXPRESS OR  IMPLIED, INCLUDING  BUT NOT LIMITED  TO THE  WARRANTIES OF
- MERCHANTABILITY,    FITNESS    FOR    A   PARTICULAR    PURPOSE    AND
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- OF CONTRACT, TORT OR OTHERWISE,  ARISING FROM, OUT OF OR IN CONNECTION
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-- - - - - - - - - - - - - - - - - - - - - - - 
-
-==============================================================
- Jetty Web Container
- Copyright 1995-2012 Mort Bay Consulting Pty Ltd.
-==============================================================
-
-The Jetty Web Container is Copyright Mort Bay Consulting Pty Ltd
-unless otherwise noted.
-
-Jetty is dual licensed under both
-
-  * The Apache 2.0 License
-    http://www.apache.org/licenses/LICENSE-2.0.html
-
-      and
-
-  * The Eclipse Public 1.0 License
-    http://www.eclipse.org/legal/epl-v10.html
-
-Jetty may be distributed under either license.
-
-The javax.servlet package used was sourced from the Apache
-Software Foundation and is distributed under the apache 2.0
-license.
-
-The UnixCrypt.java code implements the one way cryptography used by
-Unix systems for simple password protection.  Copyright 1996 Aki Yoshida,
-modified April 2001  by Iris Van den Broeke, Daniel Deville.
-Permission to use, copy, modify and distribute UnixCrypt
-for non-commercial or commercial purposes and without fee is
-granted provided that the copyright notice appears in all copies.
-
-- - - - - - - - - - - - - - - - - - - - - - - 
-
-From Apache HttpComponents Client
-
-This project contains annotations derived from JCIP-ANNOTATIONS
-Copyright (c) 2005 Brian Goetz and Tim Peierls.
-See http://www.jcip.net and the Creative Commons Attribution License 
-(http://creativecommons.org/licenses/by/2.5)
-
-- - - - - - - - - - - - - - - - - - - - - - - 
-
-From Apache Lucene
-
-Some code in core/src/java/org/apache/lucene/util/UnicodeUtil.java was
-derived from unicode conversion examples available at
-http://www.unicode.org/Public/PROGRAMS/CVTUTF.  Here is the copyright
-from those sources:
-
-/*
- * Copyright 2001-2004 Unicode, Inc.
- * 
- * Disclaimer
- * 
- * This source code is provided as is by Unicode, Inc. No claims are
- * made as to fitness for any particular purpose. No warranties of any
- * kind are expressed or implied. The recipient agrees to determine
- * applicability of information provided. If this file has been
- * purchased on magnetic or optical media from Unicode, Inc., the
- * sole remedy for any claim will be exchange of defective media
- * within 90 days of receipt.
- * 
- * Limitations on Rights to Redistribute This Code
- * 
- * Unicode, Inc. hereby grants the right to freely use the information
- * supplied in this file in the creation of products supporting the
- * Unicode Standard, and to make copies of this file in any form
- * for internal or external distribution as long as this notice
- * remains attached.
- */
-
-
-Some code in core/src/java/org/apache/lucene/util/ArrayUtil.java was
-derived from Python 2.4.2 sources available at
-http://www.python.org. Full license is here:
-
-  http://www.python.org/download/releases/2.4.2/license/
-
-Some code in core/src/java/org/apache/lucene/util/UnicodeUtil.java was
-derived from Python 3.1.2 sources available at
-http://www.python.org. Full license is here:
-
-  http://www.python.org/download/releases/3.1.2/license/
-
-Some code in core/src/java/org/apache/lucene/util/automaton was
-derived from Brics automaton sources available at
-www.brics.dk/automaton/. Here is the copyright from those sources:
-
-/*
- * Copyright (c) 2001-2009 Anders Moeller
- * 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.
- */
- 
-The levenshtein automata tables in core/src/java/org/apache/lucene/util/automaton 
-were automatically generated with the moman/finenight FSA package.
-Here is the copyright for those sources:
-
-# Copyright (c) 2010, Jean-Philippe Barrette-LaPierre, <jp...@rrette.com>
-#
-# Permission is hereby granted, free of charge, to any person
-# obtaining a copy of this software and associated documentation
-# files (the "Software"), to deal in the Software without
-# restriction, including without limitation the rights to use,
-# copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the
-# Software is furnished to do so, subject to the following
-# conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-# OTHER DEALINGS IN THE SOFTWARE.
-
-Some code in core/src/java/org/apache/lucene/util/UnicodeUtil.java was
-derived from ICU (http://www.icu-project.org)
-The full license is available here: 
-  http://source.icu-project.org/repos/icu/icu/trunk/license.html
-
-/*
- * Copyright (C) 1999-2010, International Business Machines
- * Corporation and others.  All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy 
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights 
- * to use, copy, modify, merge, publish, distribute, and/or sell copies of the 
- * Software, and to permit persons to whom the Software is furnished to do so, 
- * provided that the above copyright notice(s) and this permission notice appear 
- * in all copies of the Software and that both the above copyright notice(s) and
- * this permission notice appear in supporting documentation.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. 
- * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE 
- * LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR 
- * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER 
- * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT 
- * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Except as contained in this notice, the name of a copyright holder shall not 
- * be used in advertising or otherwise to promote the sale, use or other 
- * dealings in this Software without prior written authorization of the 
- * copyright holder.
- */
- 
-The following license applies to the Snowball stemmers:
-
-Copyright (c) 2001, Dr Martin Porter
-Copyright (c) 2002, Richard Boulton
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-    * Redistributions of source code must retain the above copyright notice,
-    * this list of conditions and the following disclaimer.
-    * 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.
-    * Neither the name of the copyright holders nor the names of its contributors
-    * may be used to endorse or promote products derived from this software
-    * without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT OWNER OR CONTRIBUTORS 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.
-
-The following license applies to the KStemmer:
-
-Copyright © 2003,
-Center for Intelligent Information Retrieval,
-University of Massachusetts, Amherst.
-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 names "Center for Intelligent Information Retrieval" and
-"University of Massachusetts" must not be used to endorse or promote products
-derived from this software without prior written permission. To obtain
-permission, contact info@ciir.cs.umass.edu.
-
-THIS SOFTWARE IS PROVIDED BY UNIVERSITY OF MASSACHUSETTS AND OTHER CONTRIBUTORS
-"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 COPYRIGHT HOLDERS OR CONTRIBUTORS 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.
-
-The following license applies to the Morfologik project:
-
-Copyright (c) 2006 Dawid Weiss
-Copyright (c) 2007-2011 Dawid Weiss, Marcin Miłkowski
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification, 
-are permitted provided that the following conditions are met:
-
-    * Redistributions of source code must retain the above copyright notice, 
-    this list of conditions and the following disclaimer.
-    
-    * 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.
-    
-    * Neither the name of Morfologik nor the names of its contributors 
-    may be used to endorse or promote products derived from this software 
-    without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT HOLDER OR CONTRIBUTORS 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.
-
----
-
-The dictionary comes from Morfologik project. Morfologik uses data from 
-Polish ispell/myspell dictionary hosted at http://www.sjp.pl/slownik/en/ and 
-is licenced on the terms of (inter alia) LGPL and Creative Commons 
-ShareAlike. The part-of-speech tags were added in Morfologik project and
-are not found in the data from sjp.pl. The tagset is similar to IPI PAN
-tagset.
-
----
-
-The following license applies to the Morfeusz project,
-used by org.apache.lucene.analysis.morfologik.
-
-BSD-licensed dictionary of Polish (SGJP)
-http://sgjp.pl/morfeusz/
-
-Copyright © 2011 Zygmunt Saloni, Włodzimierz Gruszczyński, 
-	    	 Marcin Woliński, Robert Wołosz
-
-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.
-
-THIS SOFTWARE IS PROVIDED BY COPYRIGHT HOLDERS “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 COPYRIGHT  HOLDERS OR  CONTRIBUTORS 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.
-
-

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/dist/NOTICE
----------------------------------------------------------------------
diff --git a/jena-fuseki/dist/NOTICE b/jena-fuseki/dist/NOTICE
deleted file mode 100644
index 33231f9..0000000
--- a/jena-fuseki/dist/NOTICE
+++ /dev/null
@@ -1,216 +0,0 @@
-Apache Jena - module Fuseki
-Copyright 2011, 2012, 2013, 2014, 2015 The Apache Software Foundation
-
-This product includes software developed at
-The Apache Software Foundation (http://www.apache.org/).
-
-Portions of this software were originally based on the following:
-  - Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Hewlett-Packard Development Company, LP
-  - Copyright 2010, 2011 Epimorphics Ltd.
-  - Copyright 2010, 2011 Talis Systems Ltd.
-These have been licensed to the Apache Software Foundation under a software grant.
-
-- - - - - - - - - - - - - - - - - - - - - - - 
-
-slf4j:
- Copyright (c) 2004-2011 QOS.ch
- All rights reserved.
-
-- - - - - - - - - - - - - - - - - - - - - - -
-
-(c) Copyright 2003, Plugged In Software 
-This product includes software developed by
-PluggedIn Software under a BSD license.
-
-- - - - - - - - - - - - - - - - - - - - - - -
-
- Jetty Web Container
- Copyright 1995-2012 Mort Bay Consulting Pty Ltd.
-
-under the Apache 2.0 License. 
-
-The Jetty Web Container includes:
-
-UnixCrypt.java
-Copyright 1996 Aki Yoshida,
-modified April 2001  by Iris Van den Broeke, Daniel Deville.
-
-- - - - - - - - - - - - - - - - - - - - - - -
-
-From Apache HttpComponents Client:
-
-This project contains annotations derived from JCIP-ANNOTATIONS
-Copyright (c) 2005 Brian Goetz and Tim Peierls. See http://www.jcip.net
-
-- - - - - - - - - - - - - - - - - - - - - - -
-
-  Apache Xerces Java
-   Copyright 1999-2013 The Apache Software Foundation
-
-   This product includes software developed at
-   The Apache Software Foundation (http://www.apache.org/).
-
-   Portions of this software were originally based on the following:
-     - software copyright (c) 1999, IBM Corporation., http://www.ibm.com.
-     - software copyright (c) 1999, Sun Microsystems., http://www.sun.com.
-     - voluntary contributions made by Paul Eng on behalf of the 
-       Apache Software Foundation that were originally developed at iClick, Inc.,
-       software copyright (c) 1999.
-
-- - - - - - - - - - - - - - - - - - - - - - -
-
-From Apache Lucene:
-
-ICU4J, (under analysis/icu) is licensed under an MIT styles license
-and Copyright (c) 1995-2008 International Business Machines Corporation and others
-
-Some data files (under analysis/icu/src/data) are derived from Unicode data such
-as the Unicode Character Database. See http://unicode.org/copyright.html for more
-details.
-
-Brics Automaton (under core/src/java/org/apache/lucene/util/automaton) is 
-BSD-licensed, created by Anders Møller. See http://www.brics.dk/automaton/
-
-The levenshtein automata tables (under core/src/java/org/apache/lucene/util/automaton) were
-automatically generated with the moman/finenight FSA library, created by
-Jean-Philippe Barrette-LaPierre. This library is available under an MIT license,
-see http://sites.google.com/site/rrettesite/moman and 
-http://bitbucket.org/jpbarrette/moman/overview/
-
-This product includes code (JaspellTernarySearchTrie) from Java Spelling 
-Checking Package (jaspell): http://jaspell.sourceforge.net/
-License: The BSD License (http://www.opensource.org/licenses/bsd-license.php)
-
-The snowball stemmers in
-  analysis/common/src/java/net/sf/snowball
-were developed by Martin Porter and Richard Boulton.
-The snowball stopword lists in
-  analysis/common/src/resources/org/apache/lucene/analysis/snowball
-were developed by Martin Porter and Richard Boulton.
-The full snowball package is available from
-  http://snowball.tartarus.org/
-
-The KStem stemmer in
-  analysis/common/src/org/apache/lucene/analysis/en
-was developed by Bob Krovetz and Sergio Guzman-Lara (CIIR-UMass Amherst)
-under the BSD-license.
-
-The Arabic,Persian,Romanian,Bulgarian, and Hindi analyzers (common) come with a default
-stopword list that is BSD-licensed created by Jacques Savoy.
-See http://members.unine.ch/jacques.savoy/clef/index.html.
-
-The German,Spanish,Finnish,French,Hungarian,Italian,Portuguese,Russian and Swedish light stemmers
-(common) are based on BSD-licensed reference implementations created by Jacques Savoy and
-Ljiljana Dolamic.
-
-The Stempel analyzer (stempel) includes BSD-licensed software developed 
-by the Egothor project http://egothor.sf.net/, created by Leo Galambos, Martin Kvapil,
-and Edmond Nolan.
-
-The Polish analyzer (stempel) comes with a default
-stopword list that is BSD-licensed created by the Carrot2 project. The file resides
-in stempel/src/resources/org/apache/lucene/analysis/pl/stopwords.txt.
-See http://project.carrot2.org/license.html.
-
-The SmartChineseAnalyzer source code (smartcn) was
-provided by Xiaoping Gao and copyright 2009 by www.imdict.net.
-
-WordBreakTestUnicode_*.java (under modules/analysis/common/src/test/) 
-is derived from Unicode data such as the Unicode Character Database. 
-See http://unicode.org/copyright.html for more details.
-
-The Morfologik analyzer (morfologik) includes BSD-licensed software
-developed by Dawid Weiss and Marcin Miłkowski (http://morfologik.blogspot.com/).
-
-Morfologik uses data from Polish ispell/myspell dictionary
-(http://www.sjp.pl/slownik/en/) licenced on the terms of (inter alia)
-LGPL and Creative Commons ShareAlike.
-
-Morfologic includes data from BSD-licensed dictionary of Polish (SGJP)
-(http://sgjp.pl/morfeusz/)
-
-Servlet-api.jar and javax.servlet-*.jar are under the CDDL license, the original
-source code for this can be found at http://www.eclipse.org/jetty/downloads.php
-
-===========================================================================
-Kuromoji Japanese Morphological Analyzer - Apache Lucene Integration
-===========================================================================
-
-This software includes a binary and/or source version of data from
-
-  mecab-ipadic-2.7.0-20070801
-
-which can be obtained from
-
-  http://atilika.com/releases/mecab-ipadic/mecab-ipadic-2.7.0-20070801.tar.gz
-
-or
-
-  http://jaist.dl.sourceforge.net/project/mecab/mecab-ipadic/2.7.0-20070801/mecab-ipadic-2.7.0-20070801.tar.gz
-
-===========================================================================
-mecab-ipadic-2.7.0-20070801 Notice
-===========================================================================
-
-Nara Institute of Science and Technology (NAIST),
-the copyright holders, disclaims all warranties with regard to this
-software, including all implied warranties of merchantability and
-fitness, in no event shall NAIST be liable for
-any special, indirect or consequential damages or any damages
-whatsoever resulting from loss of use, data or profits, whether in an
-action of contract, negligence or other tortuous action, arising out
-of or in connection with the use or performance of this software.
-
-A large portion of the dictionary entries
-originate from ICOT Free Software.  The following conditions for ICOT
-Free Software applies to the current dictionary as well.
-
-Each User may also freely distribute the Program, whether in its
-original form or modified, to any third party or parties, PROVIDED
-that the provisions of Section 3 ("NO WARRANTY") will ALWAYS appear
-on, or be attached to, the Program, which is distributed substantially
-in the same form as set out herein and that such intended
-distribution, if actually made, will neither violate or otherwise
-contravene any of the laws and regulations of the countries having
-jurisdiction over the User or the intended distribution itself.
-
-NO WARRANTY
-
-The program was produced on an experimental basis in the course of the
-research and development conducted during the project and is provided
-to users as so produced on an experimental basis.  Accordingly, the
-program is provided without any warranty whatsoever, whether express,
-implied, statutory or otherwise.  The term "warranty" used herein
-includes, but is not limited to, any warranty of the quality,
-performance, merchantability and fitness for a particular purpose of
-the program and the nonexistence of any infringement or violation of
-any right of any third party.
-
-Each user of the program will agree and understand, and be deemed to
-have agreed and understood, that there is no warranty whatsoever for
-the program and, accordingly, the entire risk arising from or
-otherwise connected with the program is assumed by the user.
-
-Therefore, neither ICOT, the copyright holder, or any other
-organization that participated in or was otherwise related to the
-development of the program and their respective officials, directors,
-officers and other employees shall be held liable for any and all
-damages, including, without limitation, general, special, incidental
-and consequential damages, arising out of or otherwise in connection
-with the use or inability to use the program or any product, material
-or result produced or otherwise obtained by using the program,
-regardless of whether they have been advised of, or otherwise had
-knowledge of, the possibility of such damages at any time during the
-project or thereafter.  Each user will be deemed to have agreed to the
-foregoing by his or her commencement of use of the program.  The term
-"use" as used herein includes, but is not limited to, the use,
-modification, copying and distribution of the program and the
-production of secondary products from the program.
-
-In the case where the program, whether in its original form or
-modified, was distributed or delivered to or received by a user from
-any person, organization or entity other than ICOT, unless it makes or
-grants independently of ICOT any specific warranty to the user in
-writing, such person, organization or entity, will also be exempted
-from and not be held liable to the user for any such damages as noted
-above as far as the program is concerned.

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/fuseki
----------------------------------------------------------------------
diff --git a/jena-fuseki/fuseki b/jena-fuseki/fuseki
deleted file mode 100755
index aeedd83..0000000
--- a/jena-fuseki/fuseki
+++ /dev/null
@@ -1,399 +0,0 @@
-#!/usr/bin/env bash
-
-# 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.
-#
-# =========
-#
-# Startup script for Fuseki under *nix systems (works with cygwin too)
-#
-# Configuration
-# -------------
-# Default values are loaded from /etc/default/fuseki, if it exists.
-#
-# JAVA
-#   Command to invoke Java. If not set, java (from the PATH) will be used.
-#
-# JAVA_OPTIONS
-#   Extra options to pass to the JVM.
-#
-# FUSEKI_HOME
-#   Where Fuseki is installed.  If not set, the script will try
-#   to guess it based on the script invokation path.
-#
-# FUSEKI_RUN
-#   Where the fuseki.pid file should be stored.  It defaults
-#   first available of /var/run, /usr/var/run, and /tmp if not set.
-#
-# FUSEKI_PID
-#   The FUSEKI PID file, defaults to $FUSEKI_RUN/fuseki.pid
-#
-# FUSEKI_ARGS
-#   The arguments to pass to the Fuseki server on the command line. Defaults to:
-#    --update --loc=$FUSKEI_DATA_DIR /ds    # if FUSEKI_CONF is not set
-#    --config=$FUSEKI_CONF                  # if FUSEKI_CONF is set
-#
-# FUSEKI_CONF
-#   The Fuseki configuration file, usually in RDF Turtle notation.
-#
-# FUSEKI_USER
-#   If set, the server will be run as this user
-#
-# FUSEKI_DATA_DIR
-#   The location of the data directory Fuseki will use (i.e. the value of --loc).
-#   Defaults to $FUSEKI_HOME/DB
-#
-# FUSEKI_LOGS
-#   Directory where logs will be generated. Defaults to $FUSEKI_HOME/log
-#
-# FUSEKI_LOGS_STDERROUT
-#   Log file with stderr and stdout log output from Fuseki. Defaults to
-#   $FUSEKI_LOGS/stderrout.log
-
-### BEGIN INIT INFO
-# Provides:          fuseki
-# Required-Start:    $remote_fs $network
-# Required-Stop:     $remote_fs $network
-# Default-Start:     3 4 5
-# Default-Stop:      0 1 2 6
-# Short-Description: Start Jena Fuseki at boot time
-# Description:       Jena Fuseki is a service that provides a SPARQL API over HTTP to one more RDF triple stores
-### END INIT INFO
-
-usage()
-{
-  echo "Usage: ${0##*/} {start|stop|restart|status}"
-  exit 1
-}
-
-[ $# -gt 0 ] || usage
-
-# Utility functions:
-findDirectory()
-{
-  local L OP=$1
-  shift
-  for L in "$@"; do
-    [ "$OP" "$L" ] || continue
-    printf %s "$L"
-    break
-  done
-}
-
-running()
-{
-  local PID=$(cat "$1" 2>/dev/null) || return 1
-  kill -0 "$PID" 2>/dev/null
-}
-
-# Are we running in cygwin?
-cygwin=false
-case "`uname`" in
-    CYGWIN*) cygwin=true;;
-esac
-
-
-NAME=fuseki
-[ -f "/etc/default/$NAME" ] && . /etc/default/$NAME
-
-# Set FUSKEI_HOME to the script invocation directory if it is not specified
-if [ -z "$FUSEKI_HOME" ]
-then
-  SCRIPT="$0"
-  # Catch common issue: script has been symlinked
-  if [ -L "$SCRIPT" ]
-  then
-    SCRIPT="$(readlink "$0")"
-    # If link is relative
-    case "$SCRIPT" in
-      /*) ;; # fine
-      *) SCRIPT=$( dirname "$0" )/$SCRIPT;; # fix
-    esac
-  fi
-
-  # Work out root from script location
-  FUSEKI_HOME="$( cd "$( dirname "$SCRIPT" )" && pwd )"
-
-fi
-
-# Deal with more Cygwin path issues
-if [ "$cygwin" == "true" ]
-then
-  FUSEKI_HOME=`cygpath -w "$FUSEKI_HOME"`
- fi
-
-#echo "DEBUG: FUSEKI_HOME=$FUSEKI_HOME"
-
-if [ ! -e "$FUSEKI_HOME" ]
-then
-  echo "$FUSEKI_HOME does not exist" 1>&2
-  exit 1
-fi
-
-
-# Find a location for the pid file
-if [ -z "$FUSEKI_RUN" ]
-then
-  FUSEKI_RUN=$(findDirectory -w /var/run /usr/var/run $FUSEKI_HOME /tmp)
-fi
-
-# Get PID file name
-if [ -z "$FUSEKI_PID" ]
-then
-  FUSEKI_PID="$FUSEKI_RUN/fuseki.pid"
-fi
-
-# Log directory
-if [ -z "$FUSEKI_LOGS" ]
-then
-  FUSEKI_LOGS="$FUSEKI_HOME/log"
-fi
-
-# Std Err and Out log
-if [ -z "$FUSEKI_LOGS_STDERROUT" ]
-then
-  FUSEKI_LOGS_STDERROUT="$FUSEKI_LOGS/stderrout.log"
-fi
-
-# Data directory
-if [ -z "$FUSEKI_DATA_DIR" ]
-then
-  FUSEKI_DATA_DIR="$FUSEKI_HOME/DB"
-fi
-
-# Set up JAVA if not set
-if [ -z "$JAVA" ]
-then
-  JAVA=$(which java)
-fi
-if [ -z "$JAVA" ]
-then
-  echo "Cannot find a Java JDK. Please set either set JAVA or put java (>=1.7) in your PATH." 2>&2
-  exit 1
-fi
-
-# The location of the start up JAR
-FUSEKI_START=$FUSEKI_HOME/fuseki-server.jar
-
-# Deal with Cygwin path issues
-if [ "$cygwin" == "true" ]
-then
-  DATA_DIR=`cygpath -w "$FUSEKI_DATA_DIR"`
-  FUSEKI_START=`cygpath -w "$FUSEKI_START"`
-else
-  DATA_DIR="$FUSEKI_DATA_DIR"
-fi
-
-#######################################
-#
-# TODO - Read these items from a Config file!
-#
-
-# Some JVM settings
-if [ -z "$JAVA_OPTIONS" ]
-then
-  JAVA_OPTIONS="-Xmx1200M"
-fi
-
-
-# Default Fuseki Arguments
-if [ -z "$FUSEKI_ARGS" ]
-then
-  if [ -z "$FUSEKI_CONF" ]
-  then
-    FUSEKI_ARGS="--update --loc=$DATA_DIR /ds"
-  else
-    FUSEKI_ARGS="--config=$FUSEKI_CONF"
-  fi
-fi
-
-if [ ! -z "$FUSEKI_HOME" ]
-then
-    FUSEKI_ADDITIONAL_ARGS=(--home "$FUSEKI_HOME")
-fi
-
-# Run command
-
-RUN_ARGS=(${JAVA_OPTIONS[@]} -jar "$FUSEKI_START" "${FUSEKI_ADDITIONAL_ARGS[@]}" $FUSEKI_ARGS)
-RUN_CMD=("$JAVA" "${RUN_ARGS[@]}")
-
-
-#######################################
-
-#####################################################
-# Comment these out after you're happy with what
-# the script is doing.
-#####################################################
-if (( DEBUG ))
-then
-  echo "FUSEKI_HOME    =  $FUSEKI_HOME"
-  echo "FUSEKI_CONF    =  $FUSEKI_CONF"
-  echo "FUSEKI_RUN     =  $FUSEKI_RUN"
-  echo "FUSEKI_PID     =  $FUSEKI_PID"
-  echo "FUSEKI_ARGS    =  $FUSEKI_ARGS"
-  echo "FUSEKI_START   =  $FUSEKI_START"
-  echo "CONFIGS        =  ${CONFIGS[*]}"
-  echo "JAVA           =  $JAVA"
-  echo "JAVA_OPTIONS   =  ${JAVA_OPTIONS[*]}"
-  echo "RUN_ARGS       =  ${RUN_ARGS[@]}"
-  echo "RUN_CMD        =  ${RUN_CMD[@]}"
-fi
-
-NO_START=0
-
-# Life cycle functions
-start() {
-
-  if (( NO_START )); then
-    echo "Not starting Fuseki - NO_START=1";
-    exit
-  fi
-
-  # Make sure the data and log directories exist
-  mkdir -p "$FUSEKI_DATA_DIR"
-  mkdir -p "$FUSEKI_LOGS"
-  if [ ! -z "$FUSEKI_USER" ]
-  then
-    chown "$FUSEKI_USER" "$FUSEKI_DATA_DIR" "$FUSEKI_LOGS"
-  fi
-
-  echo -n "Starting Fuseki: "
-  if type start-stop-daemon > /dev/null 2>&1
-  then
-    unset CH_USER
-    if [ -n "$FUSEKI_USER" ]
-    then
-      CH_USER="--chuid $FUSEKI_USER"
-    fi
-    if start-stop-daemon --start $CH_USER --chdir "$FUSEKI_HOME" --background --make-pidfile --pidfile "$FUSEKI_PID" --startas /bin/bash -- -c "exec $JAVA ${RUN_ARGS[*]} > $FUSEKI_LOGS_STDERROUT 2>&1"
-    then
-      sleep 1
-      if running "$FUSEKI_PID"
-      then
-        print_started
-      else
-        print_failed
-      fi
-    fi
-  else
-    if running $FUSEKI_PID
-    then
-        echo "Already Running!"
-        exit 1
-      else
-        # dead pid file - remove
-        rm -f "$FUSEKI_PID"
-    fi
-    if [ "$FUSEKI_USER" ]
-    then
-      touch "$FUSEKI_PID"
-      chown "$FUSEKI_USER" "$FUSEKI_PID"
-      su - "$FUSEKI_USER" -c "
-        echo 'Redirecting Fuseki stderr/stdout to $FUSEKI_LOGS_STDERROUT'
-        exec ${RUN_CMD[*]} &> '$FUSEKI_LOGS_STDERROUT' &
-        disown \$!
-        echo \$! > '$FUSEKI_PID'"
-    else
-      echo "Redirecting Fuseki stderr/stdout to $FUSEKI_LOGS_STDERROUT"
-      exec "${RUN_CMD[@]}" &> "$FUSEKI_LOGS_STDERROUT" &
-      disown $!
-      echo $! > "$FUSEKI_PID"
-    fi
-
-    print_started
-  fi
-}
-
-print_started() {
-  echo "STARTED Fuseki `date`"
-  echo "PID=$(cat "$FUSEKI_PID" 2>/dev/null)"
-}
-
-print_failed() {
-  echo "FAILED to start Fuseki `date`"
-}
-
-delete_fuseki_pid_file() {
-  rm -f "$FUSEKI_PID"
-}
-
-stop() {
-  echo -n "Stopping Fuseki: "
-
-  if ! running "$FUSEKI_PID"
-    then
-    echo "Fuseki is not running"
-    exit 1
-  fi
-
-  ###############################################################
-  # !!!! This code needs to be improved, too many repeats !!!!  #
-  ###############################################################
-  if type start-stop-daemon > /dev/null 2>&1; then
-    start-stop-daemon --stop --pidfile "$FUSEKI_PID" --chdir "$FUSEKI_HOME" --startas "$JAVA" --signal HUP
-
-    ## Die after a 30 second timeout
-    TIMEOUT=30
-    while running "$FUSEKI_PID"; do
-      if (( TIMEOUT-- == 0 )); then
-        start-stop-daemon --stop --pidfile "$FUSEKI_PID" --chdir "$FUSEKI_HOME" --startas "$JAVA" --signal KILL
-      fi
-        sleep 1
-    done
-    delete_fuseki_pid_file
-    echo OK
-  else
-    PID=$(cat "$FUSEKI_PID" 2>/dev/null)
-    kill "$PID" 2>/dev/null
-
-    TIMEOUT=30
-    while running $FUSEKI_PID; do
-      if (( TIMEOUT-- == 0 )); then
-        kill -KILL "$PID" 2>/dev/null
-      fi
-      sleep 1
-    done
-    delete_fuseki_pid_file
-    echo "OK"
-  fi
-}
-
-case $1 in
-  start)
-    start
-  ;;
-  stop)
-    stop
-  ;;
-  restart)
-    stop
-    start
-  ;;
-  status)
-    if running $FUSEKI_PID
-    then
-      echo -n "Fuseki is running with pid: "
-      echo `cat "$FUSEKI_PID"`
-    else
-      echo "Fuseki is not running"
-    fi
-  ;;
-  *)
-    usage
-  ;;
-esac
-
-exit 0

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/fuseki-server
----------------------------------------------------------------------
diff --git a/jena-fuseki/fuseki-server b/jena-fuseki/fuseki-server
deleted file mode 100755
index d62a079..0000000
--- a/jena-fuseki/fuseki-server
+++ /dev/null
@@ -1,61 +0,0 @@
-#!/bin/sh
-
-# 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.
-
-export FUSEKI_HOME="${FUSEKI_HOME:-$PWD}"
-
-if [ ! -e "$FUSEKI_HOME" ]
-then
-    echo "$FUSEKI_HOME does not exist" 1>&2
-    exit 1
-    fi
-
-JAR1="$FUSEKI_HOME/fuseki-server.jar"
-JAR2="$FUSEKI_HOME/jena-fuseki-*-server.jar"
-JAR=""
-
-for J in "$JAR1" "$JAR2"
-do
-    # Expand
-    J="$(echo $J)"
-    if [ -e "$J" ]
-    then
-	JAR="$J"
-	break
-    fi
-done
-
-if [ "$JAR" = "" ]
-then
-    echo "Can't find jarfile to run"
-    exit 1
-fi
-
-# Deal with Cygwin path issues
-cygwin=false
-case "`uname`" in
-    CYGWIN*) cygwin=true;;
-esac
-if [ "$cygwin" = "true" ]
-then
-    JAR=`cygpath -w "$JAR"`
-    FUSEKI_HOME=`cygpath -w "$FUSEKI_HOME"`
-fi
-
-JVM_ARGS=${JVM_ARGS:--Xmx1200M}
-
-exec java  $JVM_ARGS -jar "$JAR" "$@"

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/fuseki-server.bat
----------------------------------------------------------------------
diff --git a/jena-fuseki/fuseki-server.bat b/jena-fuseki/fuseki-server.bat
deleted file mode 100644
index 5881660..0000000
--- a/jena-fuseki/fuseki-server.bat
+++ /dev/null
@@ -1,19 +0,0 @@
-@REM Licensed to the Apache Software Foundation (ASF) under one
-@REM or more contributor license agreements.  See the NOTICE file
-@REM distributed with this work for additional information
-@REM regarding copyright ownership.  The ASF licenses this file
-@REM to you under the Apache License, Version 2.0 (the
-@REM "License"); you may not use this file except in compliance
-@REM with the License.  You may obtain a copy of the License at
-@REM
-@REM     http://www.apache.org/licenses/LICENSE-2.0
-@REM
-@REM Unless required by applicable law or agreed to in writing, software
-@REM distributed under the License is distributed on an "AS IS" BASIS,
-@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-@REM See the License for the specific language governing permissions and
-@REM limitations under the License.
-
-@echo off
-@REM modify this to name the server jar
-java -Xmx1200M -jar fuseki-server.jar %*

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/jetty-fuseki.xml
----------------------------------------------------------------------
diff --git a/jena-fuseki/jetty-fuseki.xml b/jena-fuseki/jetty-fuseki.xml
deleted file mode 100644
index 245b7c3..0000000
--- a/jena-fuseki/jetty-fuseki.xml
+++ /dev/null
@@ -1,47 +0,0 @@
-<?xml version="1.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.
--->
-
-<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
- 
-<!-- 
-  Reference: http://wiki.eclipse.org/Jetty/Reference/jetty.xml_syntax
-  http://wiki.eclipse.org/Jetty/Reference/jetty.xml
--->
-
-<Configure id="Fuseki" class="org.eclipse.jetty.server.Server">
-  <Call name="addConnector">
-    <Arg>
-      <!-- org.eclipse.jetty.server.nio.BlockingChannelConnector -->
-      <!-- org.eclipse.jetty.server.nio.SelectChannelConnector -->
-      <New class="org.eclipse.jetty.server.nio.SelectChannelConnector">
-	<!-- BlockingChannelConnector specific:
-	     <Set name="useDirectBuffer">false</Set>
-	-->
-	<!-- Only listen to interface ...
-	<Set name="host">localhost</Set>
-	-->
-	<Set name="port">3535</Set>
-	<Set name="maxIdleTime">0</Set>
-	<!-- All connectors -->
-	<Set name="requestHeaderSize">65536</Set>       <!-- 64*1024 -->
-	<Set name="requestBufferSize">5242880</Set>     <!-- 5*1024*1024 -->
-	<Set name="responseBufferSize">5242880</Set>    <!-- 5*1024*1024 -->
-      </New>
-    </Arg>
-  </Call>
-</Configure>

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/make_cp_mvn
----------------------------------------------------------------------
diff --git a/jena-fuseki/make_cp_mvn b/jena-fuseki/make_cp_mvn
deleted file mode 100755
index d8b245e..0000000
--- a/jena-fuseki/make_cp_mvn
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/usr/bin/perl
-# 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.
-#
-# Write a run script.
-
-$POM="pom.xml" ;
-$POM = @ARGV[0] if ( defined(@ARGV[0]) ) ;
-
-if ( ! -e "$POM" )
-{
-    print STDERR "No POM file: $POM\n" ;
-    exit 1 ;
-}
-$M2=$ENV{'M2_REPO'} ;
-print "#!/bin/bash\n" ;
-print "# Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0"
-print "\n" ;
-print 'XCP="' ;
-
-open(X, "mvn -f $POM dependency:build-classpath |") ;
-while(<X>)
-{
-    next if /\[INFO\]/ ;
-    next if /^Download/ ;
-    chop ;
-    #s!$M2/org/apache/jena/jena-[^/]*/[^/]*/[^/]*.jar:!!g ;
-    print "$_" ;
-}
-print "\"\n" ;
-print "\n" ;
-
-print "if [ \"\$CP\" != \'\' ]\n" ;
-print "then\n" ;
-print "   XCP=\"\$CP:\$XCP\"\n" ;
-print "fi\n" ;
-print "\n" ;
-print "echo \"\$XCP\"\n"
-

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/make_links
----------------------------------------------------------------------
diff --git a/jena-fuseki/make_links b/jena-fuseki/make_links
deleted file mode 100755
index 7eb82b9..0000000
--- a/jena-fuseki/make_links
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/bash
-# Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
-
-SOH=${SOH:-soh}
-for s in s-head s-get s-put s-post s-delete s-query s-update s-update-form
-do
-    rm -f $s
-    #ln -s "$SOH" $s
-    cp "$SOH" $s
-done

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/pages/books.ttl
----------------------------------------------------------------------
diff --git a/jena-fuseki/pages/books.ttl b/jena-fuseki/pages/books.ttl
deleted file mode 100644
index eeeadb6..0000000
--- a/jena-fuseki/pages/books.ttl
+++ /dev/null
@@ -1,47 +0,0 @@
-# Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
-@prefix dc:        <http://purl.org/dc/elements/1.1/> .
-@prefix vcard:     <http://www.w3.org/2001/vcard-rdf/3.0#> .
-@prefix ns:        <http://example.org/ns#> .
-
-@prefix :          <http://example.org/book/> .
-
-# A small dataset for usage examples of Fuseki
-# This data is intentionaly irregular (e.g. different ways to
-# record the book creator) as if the information is either an
-# aggregation or was created at different times.
-
-:book1
-    dc:title    "Harry Potter and the Philosopher's Stone" ;
-    dc:creator  "J.K. Rowling" ;
-    .
-    
-:book2
-    dc:title    "Harry Potter and the Chamber of Secrets" ;
-    dc:creator  _:a .
-    
-:book3
-    dc:title    "Harry Potter and the Prisoner Of Azkaban" ;
-    dc:creator  _:a .
-    
-:book4
-    dc:title    "Harry Potter and the Goblet of Fire" .
-    
-:book5
-    dc:title    "Harry Potter and the Order of the Phoenix";
-    dc:creator  "J.K. Rowling" ;
-    .
-
-:book6
-    dc:title    "Harry Potter and the Half-Blood Prince";
-    dc:creator  "J.K. Rowling" .
-
-:book7
-    dc:title    "Harry Potter and the Deathly Hallows" ;
-    dc:creator  "J.K. Rowling" .
-_:a
-    vcard:FN "J.K. Rowling" ;
-    vcard:N
-        [ vcard:Family "Rowling" ;
-          vcard:Given "Joanna" 
-        ]
-    .

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/pages/control-panel.tpl
----------------------------------------------------------------------
diff --git a/jena-fuseki/pages/control-panel.tpl b/jena-fuseki/pages/control-panel.tpl
deleted file mode 100644
index b69994e..0000000
--- a/jena-fuseki/pages/control-panel.tpl
+++ /dev/null
@@ -1,41 +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.
--->
-<html>
-  <head>
-    <title>Fuseki - A SPARQL 1.1 Server</title>
-    <link rel="stylesheet" type="text/css" href="fuseki.css" />
-  </head>
-
-  <body>
-    <h1>Fuseki Control Panel</h1>
-
-#set( $datasets = $mgt.datasets($request) )
-#set( $action   = $mgt.actionDataset($request) )
-
-    <div class="moreindent">
-    <form action="${action}" method="post">
-      Dataset: <select name="dataset">
-#foreach($ds in $datasets)
-        <option value="${ds}">${ds}</option>
-#end
-      <div>
-        <input type="submit" value="Select">
-      </div>
-    </form>
-    </div>
-  </body>
-</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/pages/data-validator.html
----------------------------------------------------------------------
diff --git a/jena-fuseki/pages/data-validator.html b/jena-fuseki/pages/data-validator.html
deleted file mode 100644
index 0c90949..0000000
--- a/jena-fuseki/pages/data-validator.html
+++ /dev/null
@@ -1,67 +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.
--->
-
-<html xmlns="http://www.w3.org/1999/xhtml">
-  <head><title>SPARQLer Data Validator</title>
-    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-    <link rel="stylesheet" type="text/css" href="fuseki.css" />
-  </head>
-  <body>
-    <h1>SPARQLer Data Validator</h1>
-    <div class="moreindent">
-      <form action="validate/data" method="post" accept-charset="UTF-8" >
-	    <textarea name="data" cols="70" rows="30">
-# Prefixes for Turtle or TriG - these can be edited or removed.
-@base          &lt;http://example.org/base/> .
-@prefix :      &lt;http://example.org/> .
-@prefix xsd:   &lt;http://www.w3.org/2001/XMLSchema#> .
-@prefix rdf:   &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
-@prefix rdfs:  &lt;http://www.w3.org/2000/01/rdf-schema#> .
-@prefix owl:   &lt;http://www.w3.org/2002/07/owl#> .
-
-
-</textarea>
-<br/>
-Input syntax:
-<input type="radio" name="languageSyntax" value="Turtle" checked="checked"/>Turtle
-<input type="radio" name="languageSyntax" value="TriG"/>TriG
-<input type="radio" name="languageSyntax" value="N-Triples"/>N-Triples
-<input type="radio" name="languageSyntax" value="N-Quads"/>N-Quad
-  <br/>
-      <!--
-Output syntax:
-  <input type="checkbox" name="outputFormat" value="sparql" checked="checked"/>SPARQL
-  <input type="checkbox" name="outputFormat" value="algebra"/>SPARQL algebra
-  <input type="checkbox" name="outputFormat" value="quads"/>SPARQL algebra (quads)
-  <br/>
-
-  Line numbers:
-  <input type="radio" name="linenumbers" value="true" checked="checked"/>Yes
-  <input type="radio" name="linenumbers" value="false"/>No
-  <br/>
-      -->
-        <input type="submit" value="Validate RDF Data" />
-      </form>
-      <hr/>
-Parsing provided by <a href="http://jena.apache.org/documentation/io/riot.html">Jena/RIOT</a>.
-Questions to 
-<href="mailto:users@jena.apache.org?s=[Data Validator]: "
- >the Jena users mailing list</a>
-(include full details of input).
-    </div>
-  </body>
-</html>

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/pages/favicon.ico
----------------------------------------------------------------------
diff --git a/jena-fuseki/pages/favicon.ico b/jena-fuseki/pages/favicon.ico
deleted file mode 100644
index f5d685e..0000000
Binary files a/jena-fuseki/pages/favicon.ico and /dev/null differ

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/pages/fuseki.css
----------------------------------------------------------------------
diff --git a/jena-fuseki/pages/fuseki.css b/jena-fuseki/pages/fuseki.css
deleted file mode 100644
index cb4aa20..0000000
--- a/jena-fuseki/pages/fuseki.css
+++ /dev/null
@@ -1,148 +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.
-*/
-body {
-    font-family: Verdana, Arial, Helvetica, sans-serif ;
-    font-size: 10pt ;
-    line-height: 18pt ;
-    color: black;
-    background: white ;
-    margin: 0 ;
-}
-
-p { margin-left: 2% ; margin-right: 2% ; }
-
-.warning { color: #FF0000 ; }
-.error   { color: #FF0000 ;  font-weight: bold; }
-
-/* Makes lists a little tighter
-li { line-height: 14pt ; }
-*/
-
-textarea { background-color: #F0F0F0 ; }
-
-table {
-  font-family: Verdana, Arial, sans-serif ;
-  font-size: 10pt ;
-  border-collapse: collapse;
-  border: 1px solid black ;
-  cellspacing: 0 ;
-  cellpadding: 0 
-}
-
-td {
-  border: 1px solid #808080 ;
-  empty-cells: show;
-  padding: 5 ;
-  spacing: 0 ;
-  vertical-align:top;
-  text-align:center
-}
-
-
-th {
-  border: 1px solid #808080 ;
-  empty-cells: show;
-  padding: 5 ;
-  vertical-align:top;
-  text-align:center
-}
-
-.box 
-{ margin-left :     5% ;
-  margin-right :    5% ;
-  border:           solid ;
-  border-width:     thin; 
-  background-color: #F0F0F0; 
-  padding:          2mm;
-  page-break-inside: avoid ;
-}
-
-.noindent     { margin-left: -5% ; margin-right: -5%; }
-.moreindent   { margin-left:  5% ; margin-right:  5%; }
-
-
-/* Use this for the document title as displayed on the page at the top. */
-
-
-h1 {
-    text-align:center ;
-    font-size: 14pt;
-    line-height: 24pt ;
-    font-weight: bold;
-    color:#000;
-    background:#CADFF4;
-    padding: 0 ;
-    margin: 0 ;
-    padding-left: 1ex;
-    padding-right: 1ex;
-    text-align:center;
-}
-
-h2 {
-    font-size: 12pt;
-    line-height: 16pt ;
-    font-size: 110%;
-    font-weight: bold;
-    color: #003399;
-    background:#CADFF4;
-    margin-bottom:5px;
-    padding-left: 1ex;
-    padding-right: 1ex;
-}
-
-h3, h4, h5 {
-    font-size: 100%;
-    font-weight: bold;
-    margin-bottom:3px;
-}
-
-ul { list-style-type: disc }
-dt { font-weight: bold }
-
-/* Change background/foreground colour on hover */
-
-A:link { color: rgb(0, 0, 255) }        /* for unvisited links */
-A:hover { color: rgb(255, 0, 0) }       /* when mouse is over link */
-
-/* No extra space between paragraphs : inherits from body */
-pre {
-    font-family: monospace;
-    font-size: 10pt ;
-    line-height: 14pt ;
-    margin-top: 1 ;
-    margin-bottom: 1 ;
-    margin-left: 5ex ;
-    }
-
-/* Some general utility definitions */
-.centered {
-    text-align: center;
-}
-
-.caption {
-    text-align: center;
-    font-size: smaller;
-}
-
-code {
-    font-size: 10pt;
-}
-
-.footnote {
-    font-size: smaller;
-    border-top: thin solid gray;
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/pages/fuseki.html
----------------------------------------------------------------------
diff --git a/jena-fuseki/pages/fuseki.html b/jena-fuseki/pages/fuseki.html
deleted file mode 100644
index 0ed9e8a..0000000
--- a/jena-fuseki/pages/fuseki.html
+++ /dev/null
@@ -1,55 +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.
--->
-
-<html>
-  <head>
-    <title>Fuseki - A SPARQL 1.1 Server</title>
-    <link rel="stylesheet" type="text/css" href="fuseki.css" />
-    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-  </head>
-
-  <body>
-    <h1>Fuseki</h1>
-
-    <h2>Server Management</h2>
-    <p><a href="control-panel.tpl">Control Panel</a></p>
-    
-    <h2>Documentation</h2>
-    <p><a href="http://jena.apache.org/documentation/serving_data/index.html">Fuseki documentation</a></p>
-
-    <h2>Validators</h2>
-    <ul>
-      <li><a href="query-validator.html">SPARQL query validator</a></li>
-      <li><a href="update-validator.html">SPARQL update validator</a></li>
-      <li><a href="data-validator.html">RDF data validator</a></li>
-      <li><a href="iri-validator.html">IRI validator</a></li>
-    </ul>
-
-    <h2>General SPARQL Service</h2>
-    <ul>
-      <li><a href="sparql.html">SPARQL query form</a></li>
-    </ul>
-
-    <h2>Standards</h2>
-    <ul>
-      <li> <a href="http://www.w3.org/TR/sparql11-query/">SPARQL 1.1 Query</a></li>
-      <li> <a href="http://www.w3.org/TR/sparql11-update/">SPARQL 1.1 Update</a></li>
-      <li> <a href="http://www.w3.org/TR/sparql11-protocol/">SPARQL 1.1 Protocol</a></li>
-      <li> <a href="http://www.w3.org/TR/sparql11-http-rdf-update/">SPARQL 1.1 Uniform HTTP Protocol for Managing RDF Graphs</a>
-    </ul>
-  </body>
-</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/pages/iri-validator.html
----------------------------------------------------------------------
diff --git a/jena-fuseki/pages/iri-validator.html b/jena-fuseki/pages/iri-validator.html
deleted file mode 100644
index 2c8f7cc..0000000
--- a/jena-fuseki/pages/iri-validator.html
+++ /dev/null
@@ -1,38 +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.
--->
-
-<html xmlns="http://www.w3.org/1999/xhtml">
-  <head><title>SPARQLer IRI Validator</title>
-  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-  <link rel="stylesheet" type="text/css" href="fuseki.css" />
-  </head>
-  <body>
-    <h1>SPARQLer IRI Validator</h1>
-
-    <div class="moreindent">
-
-      <form action="validate/iri"  accept-charset="UTF-8">
-	    <p>
-	      <textarea name="iri" cols="70" rows="2"></textarea>
-
-          <input type="submit" value="Validate IRI" />
-	    </p>
-      </form>
-      <hr/>
-    </div>
-  </body>
-</html>

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/pages/ping.txt
----------------------------------------------------------------------
diff --git a/jena-fuseki/pages/ping.txt b/jena-fuseki/pages/ping.txt
deleted file mode 100644
index 1323ba7..0000000
--- a/jena-fuseki/pages/ping.txt
+++ /dev/null
@@ -1 +0,0 @@
-Ping!

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/pages/query-validator.html
----------------------------------------------------------------------
diff --git a/jena-fuseki/pages/query-validator.html b/jena-fuseki/pages/query-validator.html
deleted file mode 100644
index 85b9119..0000000
--- a/jena-fuseki/pages/query-validator.html
+++ /dev/null
@@ -1,71 +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.
--->
-
-<html xmlns="http://www.w3.org/1999/xhtml">
-  <head><title>SPARQLer Query Validator</title>
-    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-  <link rel="stylesheet" type="text/css" href="fuseki.css" />
-
-  </head>
-  <body>
-    <h1>SPARQLer Query Validator</h1>
-
-    <div class="moreindent">
-
-      <form action="validate/query" method="post" accept-charset="UTF-8">
-	<p>
-	  <textarea name="query" cols="70" rows="30">
-PREFIX xsd:     &lt;http://www.w3.org/2001/XMLSchema#>
-PREFIX rdf:     &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
-PREFIX rdfs:    &lt;http://www.w3.org/2000/01/rdf-schema#>
-PREFIX owl:     &lt;http://www.w3.org/2002/07/owl#>
-PREFIX fn:      &lt;http://www.w3.org/2005/xpath-functions#>
-PREFIX apf:     &lt;http://jena.hpl.hp.com/ARQ/property#>
-PREFIX dc:      &lt;http://purl.org/dc/elements/1.1/>
-
-SELECT ?book ?title
-WHERE
-   { ?book dc:title ?title }</textarea>
-<br/>
-  Input syntax:<br/>
-    <input type="radio" name="languageSyntax" value="SPARQL" checked="checked"/>SPARQL
-    <input type="radio" name="languageSyntax" value="ARQ"/>SPARQL extended syntax
-  <br/>
-  <br/>
-Output:<br/>
-  <input type="checkbox" name="outputFormat" value="sparql" checked="checked"/>SPARQL<br/>
-  <input type="checkbox" name="outputFormat" value="algebra"/>SPARQL algebra<br/>
-  <input type="checkbox" name="outputFormat" value="quads"/>SPARQL algebra (quads)<br/>
-  <input type="checkbox" name="outputFormat" value="opt"/>SPARQL algebra
-(general optimizations)<br/>
-  <input type="checkbox" name="outputFormat" value="optquads"/>SPARQL algebra
-(quads, general optimizations)<br/>
-  <br/>
-  Line numbers:
-  <input type="radio" name="linenumbers" value="true" checked="checked"/>Yes
-  <input type="radio" name="linenumbers" value="false"/>No
-  <br/>
-
-
-  <input type="submit" value="Validate SPARQL Query" />
-	</p>
-      </form>
-
-      <hr/>
-    </div>
-  </body>
-</html>

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/pages/robots.txt
----------------------------------------------------------------------
diff --git a/jena-fuseki/pages/robots.txt b/jena-fuseki/pages/robots.txt
deleted file mode 100644
index 1f53798..0000000
--- a/jena-fuseki/pages/robots.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-User-agent: *
-Disallow: /

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/pages/sparql.html
----------------------------------------------------------------------
diff --git a/jena-fuseki/pages/sparql.html b/jena-fuseki/pages/sparql.html
deleted file mode 100644
index e29b040..0000000
--- a/jena-fuseki/pages/sparql.html
+++ /dev/null
@@ -1,68 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-
-<!--
-   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.
--->
-<html xmlns="http://www.w3.org/1999/xhtml">
-  <head><title>SPARQLer</title>
-    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-    <link rel="stylesheet" type="text/css" href="fuseki.css" />
-  </head>
-
-  <body>
-    <h1>SPARQLer - General purpose processor</h1>
-
-    <div class="moreindent">
-
-      <form action="sparql" method="get">
-        <p>General SPARQL query : input query, set any options and press "Get Results"</p>
-        <p>
-          <textarea name="query" cols="70" rows="20"></textarea>
-          <br/>
-          Target graph URI (or use <code>FROM</code> in the query)
-          <input name="default-graph-uri" size="25" value="" />
-          <br/>
-
-          Output: <select name="output">
-            <option value="json">JSON</option>
-            <option value="xml">XML</option>
-            <option value="text">Text</option>
-            <option value="csv">CSV</option>
-            <option value="tsv">TSV</option>
-          </select>
-          <br/>
-          If XML output, XSLT style sheet (blank for none): 
-          <select name="stylesheet">
-            <option value=""></option>
-            <option value="/xml-to-html.xsl">xml-to-html</option>
-            <option value="/xml-to-html-links.xsl">xml-to-html-links</option>
-            <option value="/xml-to-html-plain.xsl">xml-to-html-plain</option>
-          </select>
-          <br/>
-          <input type="checkbox" name="force-accept" value="text/plain"/>
-          Force the accept header to <tt>text/plain</tt> regardless 
-          <br/>
-          <input type="submit" value="Get Results" />
-        </p>
-      </form>
-    </div>
-
-    <hr/>
-
-  </body>
-</html>

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/pages/sparql.tpl
----------------------------------------------------------------------
diff --git a/jena-fuseki/pages/sparql.tpl b/jena-fuseki/pages/sparql.tpl
deleted file mode 100644
index 2cd5241..0000000
--- a/jena-fuseki/pages/sparql.tpl
+++ /dev/null
@@ -1,96 +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.
--->
-
-<html>
-  <head>
-    <title>Fuseki</title>
-    <link rel="stylesheet" type="text/css" href="fuseki.css" />
-  </head>
-  <body>
-#set( $ds = $mgt.dataset($request, "") )
-#set( $srvQuery = $mgt.serviceQuery($ds) )
-#set( $srvUpdate = $mgt.serviceUpdate($ds) )
-#set( $srvUpload= $mgt.serviceUpload($ds) )
-#set( $srvGraphR = $mgt.serviceGraphRead($ds) )
-#set( $srvGraphRW = $mgt.serviceGraphReadWrite($ds) )
-
-<!-- error case ... -->
-<!-- Debug
-<ul>
-  <li>${ds}</li>
-  <li>$srvQuery</li>
-  <li>$srvUpdate</li>
-  <li>$srvUpload</li>
-  <li>$srvGraphR</li>
-  <li>$srvGraphRW</li>
-</ul>
--->
-
-    <h1>Fuseki Query</h1>
-    Dataset: ${ds}
-    <hr/>
-
-    <p><b>SPARQL Query</b></p>
-    <div class="moreindent">
-      <form action="${ds}/${srvQuery}" method="GET"  accept-charset="UTF-8">
-        <textarea name="query" cols="70" rows="10"></textarea>
-        <br/>
-
-        Output: <select name="output">
-          <option value="text">Text</option>
-          <option value="json">JSON</option>
-          <option value="xml">XML</option>
-          <option value="csv">CSV</option>
-          <option value="tsv">TSV</option>
-        </select>
-        <br/>
-	    If XML output, add XSLT style sheet (blank for none): 
-        <select name="stylesheet">
-          <option value=""></option>
-          <option value="/xml-to-html.xsl">xml-to-html</option>
-          <option value="/xml-to-html-links.xsl">xml-to-html-links</option>
-          <option value="/xml-to-html-plain.xsl">xml-to-html-plain</option>
-        </select>
-        <br/>
-        <input type="checkbox" name="force-accept" value="text/plain"/>
-        Force the accept header to <tt>text/plain</tt> regardless.
-	    <br/>
-	    <input type="submit" value="Get Results" />
-      </form>
-    </div>
-    <hr/>
-
-    <p><b>SPARQL Update</b></p>
-    <div class="moreindent">
-      <form action="${ds}/${srvUpdate}" method="post" accept-charset="UTF-8">
-        <textarea name="update" cols="70" rows="10"></textarea>
-	    <br/>
-        <input type="submit" value="Perform update" />
-      </form>
-    </div>
-    <hr/>
-    <p><b>File upload</b></p>
-    <div class="moreindent">
-      <form action="${ds}/${srvUpload}" enctype="multipart/form-data" method="post">
-        File: <input type="file" name="UNSET FILE NAME" size="40" multiple=""><br/>
-        Graph: <input name="graph" size="20" value="default"/><br/>
-        <input type="submit" value="Upload">
-      </form>
-    </div>
-    <hr/>
-      </body>
-</html>   

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/pages/update-validator.html
----------------------------------------------------------------------
diff --git a/jena-fuseki/pages/update-validator.html b/jena-fuseki/pages/update-validator.html
deleted file mode 100644
index 92f21bc..0000000
--- a/jena-fuseki/pages/update-validator.html
+++ /dev/null
@@ -1,62 +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.
--->
-<html xmlns="http://www.w3.org/1999/xhtml">
-  <head><title>SPARQLer Update Validator</title>
-    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-  <link rel="stylesheet" type="text/css" href="fuseki.css" />
-
-  </head>
-  <body>
-    <h1>SPARQLer Update Validator</h1>
-
-    <div class="moreindent">
-
-
-      <form action="validate/update" method="post" accept-charset="UTF-8">
-	  <textarea name="update" cols="70" rows="30">
-PREFIX xsd:     &lt;http://www.w3.org/2001/XMLSchema#>
-PREFIX rdf:     &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
-PREFIX rdfs:    &lt;http://www.w3.org/2000/01/rdf-schema#>
-PREFIX owl:     &lt;http://www.w3.org/2002/07/owl#>
-PREFIX fn:      &lt;http://www.w3.org/2005/xpath-functions#>
-PREFIX apf:     &lt;http://jena.hpl.hp.com/ARQ/property#>
-
-</textarea>
-<br/>
-  Input syntax:
-    <input type="radio" name="languageSyntax" value="SPARQL" checked="checked"/>SPARQL
-    <input type="radio" name="languageSyntax" value="ARQ"/>SPARQL extended syntax
-  <br/>
-<!--
-Output syntax:
-  <input type="checkbox" name="outputFormat" value="sparql" checked="checked"/>SPARQL
-  <input type="checkbox" name="outputFormat" value="algebra"/>SPARQL algebra
-  <input type="checkbox" name="outputFormat" value="quads"/>SPARQL algebra (quads)
-  <br/>
--->
-  Line numbers:
-  <input type="radio" name="linenumbers" value="true" checked="checked"/>Yes
-  <input type="radio" name="linenumbers" value="false"/>No
-  <br/>
-
-  <input type="submit" value="Validate SPARQL Update" />
-      </form>
-
-      <hr/>
-    </div>
-  </body>
-</html>


[12/23] jena git commit: Rename folder jena-fuseki to jena-fuseki1

Posted by an...@apache.org.
http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/ServletBase.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/ServletBase.java b/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/ServletBase.java
deleted file mode 100644
index 7a74fa9..0000000
--- a/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/ServletBase.java
+++ /dev/null
@@ -1,242 +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.fuseki.servlets;
-
-import java.io.IOException ;
-import java.io.PrintWriter ;
-import java.util.concurrent.atomic.AtomicLong ;
-
-import javax.servlet.http.HttpServlet ;
-import javax.servlet.http.HttpServletRequest ;
-import javax.servlet.http.HttpServletResponse ;
-
-import org.apache.jena.atlas.lib.StrUtils ;
-import org.apache.jena.fuseki.Fuseki ;
-import org.apache.jena.fuseki.HttpNames ;
-import org.apache.jena.web.HttpSC ;
-import org.slf4j.Logger ;
-
-/**
- * An abstract HTTP Servlet. Contains implementation methods for setting the request status in a HTTP Action,
- * and a mechanism to allocate unique ID's to new requests.
- */
-public abstract class ServletBase extends HttpServlet
-{
-    protected static final Logger log = Fuseki.requestLog ;
-    public final boolean verboseLogging = Fuseki.verboseLogging ;
-    private static AtomicLong requestIdAlloc = new AtomicLong(0) ;
-
-    protected ServletBase()     { }
-    
-    /**
-     * Helper method which gets a unique request ID and appends it as a header to the response
-     * @param request  HTTP Request
-     * @param response HTTP Response
-     * @return Request ID
-     */
-    protected long allocRequestId(HttpServletRequest request, HttpServletResponse response) {
-        long id = requestIdAlloc.incrementAndGet();
-        addRequestId(response, id);
-        return id;
-    }
-    
-    /**
-     * Helper method for attaching a request ID to a response as a header
-     * @param response Response
-     * @param id Request ID
-     */
-    protected void addRequestId(HttpServletResponse response, long id) {
-        response.addHeader("Fuseki-Request-ID", Long.toString(id));
-    }
-    
-    protected void responseSendError(HttpServletResponse response, int statusCode, String message)
-    {
-        try { response.sendError(statusCode, message) ; }
-        catch (IOException ex) { errorOccurred(ex) ; }
-        catch (IllegalStateException ex) { }
-    }
-    
-    protected void responseSendError(HttpServletResponse response, int statusCode)
-    {
-        try { response.sendError(statusCode) ; }
-        catch (IOException ex) { errorOccurred(ex) ; }
-    }
-
-    /**
-     * Returns the HTTP request URL, appended with any additional URL parameters used.
-     *
-     * @param request HTTP request
-     * @return complete request URL
-     */
-    protected static String wholeRequestURL(HttpServletRequest request)
-    {
-        StringBuffer sb = request.getRequestURL() ;
-        String queryString = request.getQueryString() ;
-        if ( queryString != null )
-        {
-            sb.append("?") ;
-            sb.append(queryString) ;
-        }
-        return sb.toString() ;
-    }
-    
-    protected static void successNoContent(HttpAction action)
-    {
-        success(action, HttpSC.NO_CONTENT_204);
-    }
-    
-    protected static void success(HttpAction action)
-    {
-        success(action, HttpSC.OK_200);
-    }
-
-    protected static void successCreated(HttpAction action)
-    {
-        success(action, HttpSC.CREATED_201);
-    }
-    
-    // When 404 is no big deal e.g. HEAD
-    protected static void successNotFound(HttpAction action) 
-    {
-        success(action, HttpSC.NOT_FOUND_404) ;
-    }
-
-    //
-    protected static void success(HttpAction action, int httpStatusCode)
-    {
-        action.response.setStatus(httpStatusCode);
-    }
-    
-    protected static void successPage(HttpAction action, String message)
-    {
-        try {
-            action.response.setContentType("text/html");
-            action.response.setStatus(HttpSC.OK_200);
-            PrintWriter out = action.response.getWriter() ;
-            out.println("<html>") ;
-            out.println("<head>") ;
-            out.println("</head>") ;
-            out.println("<body>") ;
-            out.println("<h1>Success</h1>");
-            if ( message != null )
-            {
-                out.println("<p>") ;
-                out.println(message) ;
-                out.println("</p>") ;
-            }
-            out.println("</body>") ;
-            out.println("</html>") ;
-            out.flush() ;
-        } catch (IOException ex) { errorOccurred(ex) ; }
-    }
-    
-    protected static void warning(String string)
-    {
-        log.warn(string) ;
-    }
-    
-    protected static void warning(String string, Throwable thorwable)
-    {
-        log.warn(string, thorwable) ;
-    }
-    
-    protected static void errorBadRequest(String string)
-    {
-        error(HttpSC.BAD_REQUEST_400, string) ;
-    }
-
-    protected static void errorNotFound(String string)
-    {
-        error(HttpSC.NOT_FOUND_404, string) ;
-    }
-
-    protected static void errorNotImplemented(String msg)
-    {
-        error(HttpSC.NOT_IMPLEMENTED_501, msg) ;
-    }
-    
-    protected static void errorMethodNotAllowed(String method)
-    {
-        error(HttpSC.METHOD_NOT_ALLOWED_405, "HTTP method not allowed: "+method) ;
-    }
-
-    protected static void errorForbidden(String msg)
-    {
-        if ( msg != null )
-            error(HttpSC.FORBIDDEN_403, msg) ;
-        else
-            error(HttpSC.FORBIDDEN_403, "Forbidden") ;
-    }
-    
-    protected static void error(int statusCode)
-    {
-        throw new ActionErrorException(null, null, statusCode) ;
-    }
-    
-
-    protected static void error(int statusCode, String string)
-    {
-        throw new ActionErrorException(null, string, statusCode) ;
-    }
-    
-    protected static void errorOccurred(String message)
-    {
-        errorOccurred(message, null) ;
-    }
-
-    protected static void errorOccurred(Throwable ex)
-    {
-        errorOccurred(null, ex) ;
-    }
-
-    protected static void errorOccurred(String message, Throwable ex)
-    {
-        throw new ActionErrorException(ex, message, HttpSC.INTERNAL_SERVER_ERROR_500) ;
-    }
-    
-    protected static String formatForLog(String string)
-    {
-        string = string.replace('\n', ' ') ;
-        string = string.replace('\r', ' ') ;
-        return string ; 
-    }
-
-    static String varyHeaderSetting = 
-        StrUtils.strjoin(",", 
-                         HttpNames.hAccept, 
-                         HttpNames.hAcceptEncoding, 
-                         HttpNames.hAcceptCharset ) ;
-    
-    public static void setVaryHeader(HttpServletResponse httpResponse)
-    {
-        httpResponse.setHeader(HttpNames.hVary, varyHeaderSetting) ;
-    }
-
-    public static void setCommonHeadersForOptions(HttpServletResponse httpResponse)
-    {
-        httpResponse.setHeader(HttpNames.hAccessControlAllowHeaders, "X-Requested-With, Content-Type, Authorization") ;
-        setCommonHeaders(httpResponse) ;
-    }
-    
-    public static void setCommonHeaders(HttpServletResponse httpResponse)
-    {
-        httpResponse.setHeader(HttpNames.hAccessControlAllowOrigin, "*") ;
-        httpResponse.setHeader(HttpNames.hServer, Fuseki.serverHttpName) ;
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SimpleVelocity.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SimpleVelocity.java b/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SimpleVelocity.java
deleted file mode 100644
index 7f5cad9..0000000
--- a/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SimpleVelocity.java
+++ /dev/null
@@ -1,78 +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.fuseki.servlets;
-
-import java.io.IOException ;
-import java.io.Writer ;
-import java.util.Map ;
-
-import org.apache.velocity.Template ;
-import org.apache.velocity.VelocityContext ;
-import org.apache.velocity.app.VelocityEngine ;
-import org.apache.velocity.exception.MethodInvocationException ;
-import org.apache.velocity.exception.ParseErrorException ;
-import org.apache.velocity.exception.ResourceNotFoundException ;
-import org.apache.velocity.runtime.RuntimeConstants ;
-import org.apache.velocity.runtime.log.LogChute ;
-import org.apache.velocity.runtime.log.NullLogChute ;
-import org.slf4j.Logger ;
-import org.slf4j.LoggerFactory ;
-
-public class SimpleVelocity
-{
-    private static LogChute velocityLogChute = new NullLogChute() ;
-    private static Logger velocityLog = LoggerFactory.getLogger("Velocity");
-
-    /** Process a template */
-    public static void process(String base, String path, Writer out, Map<String, Object> params)
-    {
-        process(base, path, out, createContext(params)) ;
-    }
-    
-    /** Process a template */
-    public static void process(String base, String path, Writer out, VelocityContext context)
-    {
-        VelocityEngine velocity = new VelocityEngine() ;
-        // Turn off logging - catch exceptions and log ourselves
-        velocity.setProperty(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM, velocityLogChute) ;
-        velocity.setProperty(RuntimeConstants.INPUT_ENCODING, "UTF-8") ;
-        velocity.setProperty(RuntimeConstants.FILE_RESOURCE_LOADER_PATH, base) ;
-        velocity.init() ;
-        try {
-            Template temp = velocity.getTemplate(path) ;
-            temp.merge(context, out) ;
-            out.flush();
-        } 
-        catch (ResourceNotFoundException ex) { velocityLog.error("Resource not found: "+ex.getMessage()) ; }
-        catch (ParseErrorException ex)       { velocityLog.error("Parse error ("+path+") : "+ex.getMessage()) ; }
-        catch (MethodInvocationException ex) { velocityLog.error("Method invocation exception ("+path+") : "+ex.getMessage()) ; }
-        catch (IOException ex)               { velocityLog.warn("IOException", ex) ; }
-    }
-    
-    public static VelocityContext createContext(Map<String, Object> params)
-    {
-        // Velocity requires a mutable map.
-        // Scala leads to immutable maps ... be safe and copy.
-        VelocityContext context = new VelocityContext() ;
-        for ( Map.Entry<String, Object> e : params.entrySet() )
-            context.put(e.getKey(), e.getValue()) ;
-        return context ;
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SimpleVelocityServlet.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SimpleVelocityServlet.java b/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SimpleVelocityServlet.java
deleted file mode 100644
index 8773eba..0000000
--- a/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SimpleVelocityServlet.java
+++ /dev/null
@@ -1,178 +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.fuseki.servlets;
-
-import java.io.IOException ;
-import java.io.Writer ;
-import java.util.Map ;
-
-import javax.servlet.http.HttpServlet ;
-import javax.servlet.http.HttpServletRequest ;
-import javax.servlet.http.HttpServletResponse ;
-
-import org.apache.velocity.VelocityContext ;
-import org.apache.velocity.app.VelocityEngine ;
-import org.apache.velocity.runtime.RuntimeConstants ;
-import org.apache.velocity.runtime.RuntimeServices ;
-import org.apache.velocity.runtime.log.LogChute ;
-import org.apache.velocity.runtime.log.NullLogChute ;
-import org.slf4j.Logger ;
-import org.slf4j.LoggerFactory ;
-
-
-/** Simple servlet that uses <a href="http://velocity.apache.org/">Velocity</a>
- *  to format pages.  It isolates the use of velocity by taking a configuration map. 
- *  Use with a servlet mapping of "*.vm" or some such extension.
- */
-public class SimpleVelocityServlet extends HttpServlet
-{
-    //private static Logger log = LoggerFactory.getLogger(SimpleVelocityServlet.class) ;
-    /* Velocity logging
-     * Instead of internal velocity logging, we catch the exceptions, 
-     * log the message ourselves. This gives a celaner log file without
-     * loosing information that the application could use.  
-     */
-    
-    private static Logger vlog = LoggerFactory.getLogger("Velocity") ;
-    private static LogChute velocityLog = new NullLogChute() ;
-    //private static LogChute velocityLog = new SimpleSLF4JLogChute(vlog) ;
-    
-    private String docbase ;
-    private VelocityEngine velocity ;
-    private String functionsName = null ;
-    private final Map<String, Object> datamodel ;
-    
-    public SimpleVelocityServlet(String base, Map<String, Object> datamodel)
-    {
-        this.docbase = base ;
-        this.datamodel = datamodel ;
-        velocity = new VelocityEngine();
-        // Turn off logging - catch exceptions and log ourselves
-        velocity.setProperty( RuntimeConstants.RUNTIME_LOG_LOGSYSTEM, velocityLog) ;
-        velocity.setProperty( RuntimeConstants.INPUT_ENCODING, "UTF-8" ) ;
-        velocity.setProperty( RuntimeConstants.FILE_RESOURCE_LOADER_PATH, base) ;
-        velocity.init();
-    }
-    
-    // See also 
-    @Override
-    public void doGet(HttpServletRequest req, HttpServletResponse resp)
-    {
-        process(req, resp) ;
-    }
-    
-    @Override
-    public void doPost(HttpServletRequest req, HttpServletResponse resp)
-    {
-        process(req, resp) ;
-    }
-
-    private void process(HttpServletRequest req, HttpServletResponse resp)
-    {
-        try
-        {
-            resp.setContentType("text/html") ;
-            resp.setCharacterEncoding("UTF-8") ;
-            Writer out = resp.getWriter() ;
-            String path = path(req) ;
-            VelocityContext vc = SimpleVelocity.createContext(datamodel) ;
-            vc.put("request", req) ;
-            SimpleVelocity.process(docbase, path, out, vc) ;
-        } catch (IOException ex)
-        {
-            vlog.warn("IOException", ex) ;
-        }
-    }
-    
-    private String path(HttpServletRequest request)
-    {     
-        String path = request.getPathInfo();
-        if (path != null) return path;
-        path = request.getServletPath();
-        if (path != null) return path;
-        return null ;
-    }
-
-    @Override
-    public String getServletInfo()
-    {
-        return "Lightweight Velocity Servlet";
-    }
-    
-    /** Velocity logger to SLF4J */ 
-    static class SimpleSLF4JLogChute implements LogChute
-    {
-        // Uusally for debugging only.
-        private Logger logger ;
-
-        SimpleSLF4JLogChute( Logger log )
-        {
-            this.logger = log ; 
-        }
-        
-        @Override
-        public void init(RuntimeServices rs) throws Exception
-        { }
-
-        @Override
-        public void log(int level, String message)
-        {
-            if ( logger == null ) return ;
-            switch(level)
-            {
-                case LogChute.TRACE_ID : logger.trace(message) ; return ;
-                case LogChute.DEBUG_ID : logger.debug(message) ; return ;
-                case LogChute.INFO_ID :  logger.info(message) ;  return ;
-                case LogChute.WARN_ID :  logger.warn(message) ;  return ;
-                case LogChute.ERROR_ID : logger.error(message) ; return ;
-            }
-        }
-
-        @Override
-        public void log(int level, String message, Throwable t)
-        {
-            if ( logger == null ) return ;
-            // Forget the stack trace - velcoity internal - long - unhelpful to application. 
-            t = null ;
-            switch (level)
-            {
-                case LogChute.TRACE_ID : logger.trace(message, t) ; return ;
-                case LogChute.DEBUG_ID : logger.debug(message, t) ; return ;
-                case LogChute.INFO_ID :  logger.info(message, t) ;  return ;
-                case LogChute.WARN_ID :  logger.warn(message, t) ;  return ;
-                case LogChute.ERROR_ID : logger.error(message, t) ; return ;
-            }
-        }
-
-        @Override
-        public boolean isLevelEnabled(int level)
-        {
-            switch(level)
-            {
-                case LogChute.TRACE_ID:   return logger.isTraceEnabled() ;
-                case LogChute.DEBUG_ID:   return logger.isDebugEnabled() ;
-                case LogChute.INFO_ID:    return logger.isInfoEnabled() ;
-                case LogChute.WARN_ID:    return logger.isWarnEnabled() ;
-                case LogChute.ERROR_ID:   return logger.isErrorEnabled() ;
-            }
-            return true ;
-        }
-    }
-}
-

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/main/java/org/apache/jena/fuseki/validation/DataValidator.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/main/java/org/apache/jena/fuseki/validation/DataValidator.java b/jena-fuseki/src/main/java/org/apache/jena/fuseki/validation/DataValidator.java
deleted file mode 100644
index 6105562..0000000
--- a/jena-fuseki/src/main/java/org/apache/jena/fuseki/validation/DataValidator.java
+++ /dev/null
@@ -1,237 +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.fuseki.validation;
-
-import static org.apache.jena.riot.SysRIOT.fmtMessage ;
-
-import java.io.IOException ;
-import java.io.PrintStream ;
-import java.io.Reader ;
-import java.io.StringReader ;
-
-import javax.servlet.ServletOutputStream ;
-import javax.servlet.http.HttpServletRequest ;
-import javax.servlet.http.HttpServletResponse ;
-
-import org.apache.jena.atlas.io.IO ;
-import org.apache.jena.atlas.lib.Sink ;
-import org.apache.jena.fuseki.FusekiLib ;
-import org.apache.jena.riot.Lang ;
-import org.apache.jena.riot.RDFLanguages ;
-import org.apache.jena.riot.RiotException ;
-import org.apache.jena.riot.RiotReader ;
-import org.apache.jena.riot.lang.LangRIOT ;
-import org.apache.jena.riot.system.ErrorHandler ;
-import org.apache.jena.riot.system.RiotLib ;
-import org.apache.jena.riot.system.StreamRDF ;
-import org.apache.jena.riot.system.StreamRDFLib ;
-import org.apache.jena.riot.tokens.Tokenizer ;
-import org.apache.jena.riot.tokens.TokenizerFactory ;
-
-import com.hp.hpl.jena.graph.Node ;
-import com.hp.hpl.jena.sparql.core.Quad ;
-import com.hp.hpl.jena.sparql.serializer.SerializationContext ;
-import com.hp.hpl.jena.sparql.util.FmtUtils ;
-
-public class DataValidator extends ValidatorBase
-{
-    public DataValidator() 
-    { }
-  
-    static final String paramLineNumbers      = "linenumbers" ;
-    static final String paramFormat           = "outputFormat" ;
-    static final String paramIndirection      = "url" ;
-    static final String paramData             = "data" ;
-    static final String paramSyntax           = "languageSyntax" ;
-    //static final String paramSyntaxExtended   = "extendedSyntax" ;
-    
-    @Override
-    protected void execute(HttpServletRequest httpRequest, HttpServletResponse httpResponse)
-    {
-        try {
-//            if ( log.isInfoEnabled() )
-//                log.info("data validation request") ;
-            
-            Tokenizer tokenizer = createTokenizer(httpRequest, httpResponse) ;
-            if ( tokenizer == null )
-                return ;
-            
-            String syntax = FusekiLib.safeParameter(httpRequest, paramSyntax) ;
-            if ( syntax == null || syntax.equals("") )
-                syntax = RDFLanguages.NQUADS.getName() ;
-
-            Lang language = RDFLanguages.shortnameToLang(syntax) ;
-            if ( language == null )
-            {
-                httpResponse.sendError(HttpServletResponse.SC_BAD_REQUEST, "Unknown syntax: "+syntax) ;
-                return ;
-            }
-
-            ServletOutputStream outStream = httpResponse.getOutputStream() ;
-            ErrorHandlerMsg errorHandler = new ErrorHandlerMsg(outStream) ;
-            
-            PrintStream stdout = System.out ;
-            PrintStream stderr = System.err ;
-            System.setOut(new PrintStream(outStream)) ;
-            System.setErr(new PrintStream(outStream)) ;
-
-            // Headers
-            setHeaders(httpResponse) ;
-
-            outStream.println("<html>") ;
-            printHead(outStream, "Jena Data Validator Report") ;
-            outStream.println("<body>") ;
-            
-            outStream.println("<h1>RIOT Parser Report</h1>") ;
-            outStream.println("<p>Line and column numbers refer to original input</p>") ;
-            outStream.println("<p>&nbsp;</p>") ;
-            try {
-                LangRIOT parser = setupParser(tokenizer, language, errorHandler, outStream) ;
-                startFixed(outStream) ;
-                RiotException exception = null ;
-                try {
-                    parser.parse() ;
-                    System.out.flush() ;
-                    System.err.flush() ;
-                } catch (RiotException ex) { exception = ex ; }
-            } finally 
-            {
-                finishFixed(outStream) ;
-                System.out.flush() ;
-                System.err.flush() ;
-                System.setOut(stdout) ;
-                System.setErr(stdout) ;
-            }
-            
-            outStream.println("</body>") ;
-            outStream.println("</html>") ;
-        } catch (Exception ex)
-        {
-            serviceLog.warn("Exception in validationRequest",ex) ;
-        }
-    }
-    
-    static final long LIMIT = 50000 ;
-    
-    
-    private LangRIOT setupParser(Tokenizer tokenizer, Lang language, ErrorHandler errorHandler, final ServletOutputStream outStream)
-    {
-        Sink<Quad> sink = new Sink<Quad>()
-        {
-            SerializationContext sCxt = new SerializationContext() ;
-            @Override
-            public void send(Quad quad)
-            {
-                // Clean up!
-                StringBuilder sb = new StringBuilder() ;
-
-                sb.append(formatNode(quad.getSubject())) ;
-                sb.append("  ") ;
-                sb.append(formatNode(quad.getPredicate())) ;
-                sb.append("  ") ;
-                sb.append(formatNode(quad.getObject())) ;
-                
-                if ( ! quad.isTriple() )
-                {
-                    sb.append("  ") ;
-                    sb.append(formatNode(quad.getGraph())) ;
-                }
-
-                String $ = htmlQuote(sb.toString()) ;
-                try { 
-                    outStream.print($) ;
-                    outStream.println(" .") ;
-                } catch (IOException ex) { IO.exception(ex) ; }
-            }
-            @Override
-            public void close() {}
-            @Override
-            public void flush() {}
-            String formatNode(Node n) { return FmtUtils.stringForNode(n, sCxt) ; }
-        } ;
-
-        StreamRDF dest = StreamRDFLib.sinkQuads(sink) ;
-        @SuppressWarnings("deprecation")
-        LangRIOT parser = RiotReader.createParser(tokenizer, language, null, dest) ;
-        // Don't resolve IRIs.  Do checking.
-        parser.setProfile(RiotLib.profile(null, false, true, errorHandler)) ;
-        return parser ;
-    }
-
-    // Error handler that records messages
-    private static class ErrorHandlerMsg implements ErrorHandler
-    {
-        private ServletOutputStream out ;
-
-        ErrorHandlerMsg(ServletOutputStream out) { this.out = out ; }
-        
-        @Override
-        public void warning(String message, long line, long col)
-        { output(message, line, col, "Warning", "warning") ; }
-    
-        // Attempt to continue.
-        @Override
-        public void error(String message, long line, long col)
-        { output(message, line, col, "Error", "error") ; }
-    
-        @Override
-        public void fatal(String message, long line, long col)
-        { output(message, line, col, "Fatal", "error") ; throw new RiotException(fmtMessage(message, line, col)) ; }
-        
-        private void output(String message, long line, long col, String typeName, String className)
-        {
-            try {
-                String str = fmtMessage(message, line, col) ;
-                //String str = typeName+": "+message ;
-                str = htmlQuote(str) ;
-                out.print("<div class=\""+className+"\">") ;
-                out.print(str) ;
-                out.print("</div>") ;
-            } catch (IOException ex) { IO.exception(ex) ; }
-        }
-    }
-    
-    private Tokenizer createTokenizer(HttpServletRequest httpRequest, HttpServletResponse httpResponse) throws Exception
-    {
-        Reader reader = null ;  
-        String[] args = httpRequest.getParameterValues(paramData) ;
-        if ( args == null || args.length == 0 )
-        {
-            // Not a form?
-            reader = httpRequest.getReader() ;
-        }
-        else if ( args.length > 1 )
-        {
-            httpResponse.sendError(HttpServletResponse.SC_BAD_REQUEST, "Too many parameters for '"+paramData+"='") ;
-            return null ;
-        }
-        else
-        {
-            reader = new StringReader(args[0]) ;
-        }
-        
-        if ( reader == null )
-        {
-            httpResponse.sendError(HttpServletResponse.SC_BAD_REQUEST, "Can't find data to validate") ;
-            return null ;
-        }
-        
-        return TokenizerFactory.makeTokenizer(reader) ;
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/main/java/org/apache/jena/fuseki/validation/IRIValidator.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/main/java/org/apache/jena/fuseki/validation/IRIValidator.java b/jena-fuseki/src/main/java/org/apache/jena/fuseki/validation/IRIValidator.java
deleted file mode 100644
index 2972b49..0000000
--- a/jena-fuseki/src/main/java/org/apache/jena/fuseki/validation/IRIValidator.java
+++ /dev/null
@@ -1,99 +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.fuseki.validation;
-
-import java.io.IOException ;
-import java.io.PrintStream ;
-import java.util.Iterator ;
-
-import javax.servlet.ServletOutputStream ;
-import javax.servlet.http.HttpServletRequest ;
-import javax.servlet.http.HttpServletResponse ;
-
-import org.apache.jena.iri.IRI ;
-import org.apache.jena.iri.IRIFactory ;
-import org.apache.jena.iri.Violation ;
-import org.apache.jena.riot.system.IRIResolver ;
-
-public class IRIValidator extends ValidatorBase
-{
-    public IRIValidator() 
-    { }
-  
-    static final String paramIRI      = "iri" ;
-    //static IRIFactory iriFactory = IRIFactory.iriImplementation() ;
-    static IRIFactory iriFactory = IRIResolver.iriFactory ;
-    
-    @Override
-    protected void execute(HttpServletRequest httpRequest, HttpServletResponse httpResponse)
-    {
-        try {
-            String[] args = httpRequest.getParameterValues(paramIRI) ;
-            ServletOutputStream outStream = httpResponse.getOutputStream() ;
-            PrintStream stdout = System.out ;
-            PrintStream stderr = System.err ;
-            System.setOut(new PrintStream(outStream)) ;
-            System.setErr(new PrintStream(outStream)) ;
-
-            setHeaders(httpResponse) ;
-
-            outStream.println("<html>") ;
-            printHead(outStream, "Jena IRI Validator Report") ;
-            outStream.println("<body>") ;
-
-            outStream.println("<h1>IRI Report</h1>") ;
-
-            startFixed(outStream) ;
-
-            try {
-                boolean first = true ;
-                for ( String iriStr : args )
-                {
-                    if ( ! first )
-                        System.out.println() ;
-                    first = false ;
-
-                    IRI iri = iriFactory.create(iriStr) ;
-                    System.out.println(iriStr + " ==> "+iri) ;
-                    if ( iri.isRelative() )
-                        System.out.println("Relative IRI: "+iriStr) ;
-
-                    Iterator<Violation> vIter = iri.violations(true) ;
-                    for ( ; vIter.hasNext() ; )
-                    {
-                        String str = vIter.next().getShortMessage() ;
-                        str = htmlQuote(str) ;
-                        
-                        System.out.println(str) ;
-                    }
-                }
-            } finally 
-            {
-                finishFixed(outStream) ;
-                System.out.flush() ;
-                System.err.flush() ;
-                System.setOut(stdout) ;
-                System.setErr(stdout) ;
-            }
-
-            outStream.println("</body>") ;
-            outStream.println("</html>") ;
-        } catch (IOException ex) {}
-    } 
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/main/java/org/apache/jena/fuseki/validation/QueryValidator.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/main/java/org/apache/jena/fuseki/validation/QueryValidator.java b/jena-fuseki/src/main/java/org/apache/jena/fuseki/validation/QueryValidator.java
deleted file mode 100644
index 75ad901..0000000
--- a/jena-fuseki/src/main/java/org/apache/jena/fuseki/validation/QueryValidator.java
+++ /dev/null
@@ -1,269 +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.fuseki.validation;
-
-import java.io.IOException ;
-
-import javax.servlet.ServletOutputStream ;
-import javax.servlet.http.HttpServletRequest ;
-import javax.servlet.http.HttpServletResponse ;
-
-import org.apache.jena.atlas.io.IndentedLineBuffer ;
-import org.apache.jena.atlas.io.IndentedWriter ;
-
-import com.hp.hpl.jena.query.Query ;
-import com.hp.hpl.jena.query.QueryFactory ;
-import com.hp.hpl.jena.query.Syntax ;
-import com.hp.hpl.jena.sparql.ARQException ;
-import com.hp.hpl.jena.sparql.algebra.Algebra ;
-import com.hp.hpl.jena.sparql.algebra.Op ;
-import com.hp.hpl.jena.sparql.serializer.SerializationContext ;
-
-public class QueryValidator extends ValidatorBase 
-{
-    public QueryValidator() 
-    { }
-
-    static final String paramLineNumbers      = "linenumbers" ;
-    static final String paramFormat           = "outputFormat" ;
-    static final String paramQuery            = "query" ;
-    static final String paramSyntax           = "languageSyntax" ;
-    //static final String paramSyntaxExtended   = "extendedSyntax" ;
-    
-    @Override
-    protected void execute(HttpServletRequest httpRequest, HttpServletResponse httpResponse)
-    {
-        try {
-//            if ( log.isInfoEnabled() )
-//                log.info("validation request") ;
-            
-            String[] args = httpRequest.getParameterValues(paramQuery) ;
-            
-            if ( args == null || args.length == 0 )
-            {
-                httpResponse.sendError(HttpServletResponse.SC_BAD_REQUEST, "No query parameter to validator") ;
-                return ;
-            }
-            
-            if ( args.length > 1 )
-            {
-                httpResponse.sendError(HttpServletResponse.SC_BAD_REQUEST, "Too many query parameters") ;
-                return ;
-            }
-
-            final String queryString = httpRequest.getParameter(paramQuery).replaceAll("(\r|\n| )*$", "") ;
-//            queryString = queryString.replace("\r\n", "\n") ;
-//            queryString.replaceAll("(\r|\n| )*$", "") ;
-            
-            String querySyntax = httpRequest.getParameter(paramSyntax) ;
-            if ( querySyntax == null || querySyntax.equals("") )
-                querySyntax = "SPARQL" ;
-
-            Syntax language = Syntax.lookup(querySyntax) ;
-            if ( language == null )
-            {
-                httpResponse.sendError(HttpServletResponse.SC_BAD_REQUEST, "Unknown syntax: "+querySyntax) ;
-                return ;
-            }
-            
-            String lineNumbersArg = httpRequest.getParameter(paramLineNumbers) ; 
-
-            String a[] = httpRequest.getParameterValues(paramFormat) ;
-            
-            boolean outputSPARQL = false ;
-            boolean outputPrefix = false ;
-            boolean outputAlgebra = false ;
-            boolean outputQuads = false ;
-            boolean outputOptimized = false ;
-            boolean outputOptimizedQuads = false ;
-            
-            if ( a != null )
-            {
-                for ( String anA : a )
-                {
-                    if ( anA.equals( "sparql" ) )
-                    {
-                        outputSPARQL = true;
-                    }
-                    if ( anA.equals( "prefix" ) )
-                    {
-                        outputPrefix = true;
-                    }
-                    if ( anA.equals( "algebra" ) )
-                    {
-                        outputAlgebra = true;
-                    }
-                    if ( anA.equals( "quads" ) )
-                    {
-                        outputQuads = true;
-                    }
-                    if ( anA.equals( "opt" ) )
-                    {
-                        outputOptimized = true;
-                    }
-                    if ( anA.equals( "optquads" ) )
-                    {
-                        outputOptimizedQuads = true;
-                    }
-                }
-            }
-            
-//            if ( ! outputSPARQL && ! outputPrefix )
-//                outputSPARQL = true ;
-            
-            boolean lineNumbers = true ;
-            
-            if ( lineNumbersArg != null )
-                lineNumbers = lineNumbersArg.equalsIgnoreCase("true") || lineNumbersArg.equalsIgnoreCase("yes") ;
-            
-            // Headers
-            setHeaders(httpResponse) ;
-            
-            ServletOutputStream outStream = httpResponse.getOutputStream() ;
-
-            outStream.println("<html>") ;
-            
-            printHead(outStream, "SPARQL Query Validation Report") ;
-            
-            outStream.println("<body>") ;
-            outStream.println("<h1>SPARQL Query Validator</h1>") ;
-            // Print query as received
-            {
-                outStream.println("<p>Input:</p>") ;
-                // Not Java's finest hour.
-                Content c = new Content(){
-                    @Override
-                    public void print(IndentedWriter out)
-                    { out.print(queryString) ; }
-                } ;
-                output(outStream, c, lineNumbers) ;
-            }
-            
-            // Attempt to parse it.
-            Query query = null ;
-            try {
-                query = QueryFactory.create(queryString, "http://example/base/", language) ;
-            } catch (ARQException ex)
-            {
-                // Over generous exception (should be QueryException)
-                // but this makes the code robust.
-                outStream.println("<p>Syntax error:</p>") ;
-                startFixed(outStream) ;
-                outStream.println(ex.getMessage()) ;
-                finishFixed(outStream) ;
-            }
-            catch (RuntimeException ex)
-            { 
-                outStream.println("<p>Internal error:</p>") ;
-                startFixed(outStream) ;
-                outStream.println(ex.getMessage()) ;
-                finishFixed(outStream) ;
-            }
-            
-            if ( query != null )
-            {
-                if ( outputSPARQL )
-                    outputSyntax(outStream, query, lineNumbers) ;
-                
-                if ( outputAlgebra )
-                    outputAlgebra(outStream, query, lineNumbers) ;
-                
-                if ( outputQuads )
-                    outputAlgebraQuads(outStream, query, lineNumbers) ;
-                
-                if ( outputOptimized )
-                    outputAlgebraOpt(outStream, query, lineNumbers) ;
-
-                if ( outputOptimizedQuads )
-                    outputAlgebraOptQuads(outStream, query, lineNumbers) ;
-            }
-            
-            outStream.println("</body>") ;
-            outStream.println("</html>") ;
-            
-        } catch (Exception ex)
-        {
-            serviceLog.warn("Exception in doGet",ex) ;
-        }
-    }
-    
-    interface Content { void print(IndentedWriter out) ; }
-    
-    private void outputSyntax(ServletOutputStream outStream, final Query query, boolean lineNumbers) throws IOException
-    {
-        outStream.println("<p>Formatted, parsed query:</p>") ;
-        Content c = new Content(){
-            @Override
-            public void print(IndentedWriter out)
-            { query.serialize(out) ; }
-        } ;
-        output(outStream, c, lineNumbers) ;
-    }
-    
-    private void outputAlgebra(ServletOutputStream outStream, final Query query, boolean lineNumbers) throws IOException
-    {
-        outStream.println("<p>Algebra structure:</p>") ;
-        final Op op = Algebra.compile(query) ;   // No optimization
-        output(outStream, query, op, lineNumbers) ;
-    }
-        
-    private void outputAlgebraOpt(ServletOutputStream outStream, final Query query, boolean lineNumbers) throws IOException
-    {
-        outStream.println("<p>Alebgra, with general triple optimizations:</p>") ;
-        final Op op = Algebra.optimize(Algebra.compile(query)) ;
-        output(outStream, query, op, lineNumbers) ;
-    }
-        
-    private void outputAlgebraQuads(ServletOutputStream outStream, final Query query, boolean lineNumbers) throws IOException
-    {
-        outStream.println("<p>Quad structure:</p>") ;
-        final Op op = Algebra.toQuadForm(Algebra.compile(query)) ;
-        output(outStream, query, op, lineNumbers) ;
-    }
-
-    private void outputAlgebraOptQuads(ServletOutputStream outStream, final Query query, boolean lineNumbers) throws IOException
-    {
-        outStream.println("<p>Alebgra, with general quads optimizations:</p>") ;
-        final Op op = Algebra.optimize(Algebra.toQuadForm(Algebra.compile(query))) ;
-        output(outStream, query, op, lineNumbers) ;
-    }
-    
-    private void output(ServletOutputStream outStream, Query query, final Op op, boolean lineNumbers) throws IOException
-    {
-        final SerializationContext sCxt = new SerializationContext(query) ;
-        Content c = new Content(){
-            @Override
-            public void print(IndentedWriter out)
-            {  op.output(out, sCxt) ; }
-        } ;
-        output(outStream, c , lineNumbers) ;
-    }
-
-    private void output(ServletOutputStream outStream, Content content, boolean lineNumbers) throws IOException
-    {
-        startFixed(outStream) ;
-        IndentedLineBuffer out = new IndentedLineBuffer(lineNumbers) ; 
-        content.print(out) ;
-        out.flush() ;  
-        String x = htmlQuote(out.asString()) ;
-        byte b[] = x.getBytes("UTF-8") ;
-        outStream.write(b) ;
-        finishFixed(outStream) ;
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/main/java/org/apache/jena/fuseki/validation/UpdateValidator.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/main/java/org/apache/jena/fuseki/validation/UpdateValidator.java b/jena-fuseki/src/main/java/org/apache/jena/fuseki/validation/UpdateValidator.java
deleted file mode 100644
index dd63de8..0000000
--- a/jena-fuseki/src/main/java/org/apache/jena/fuseki/validation/UpdateValidator.java
+++ /dev/null
@@ -1,174 +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.fuseki.validation;
-
-import java.io.IOException ;
-
-import javax.servlet.ServletOutputStream ;
-import javax.servlet.http.HttpServletRequest ;
-import javax.servlet.http.HttpServletResponse ;
-
-import org.apache.jena.atlas.io.IndentedLineBuffer ;
-import org.apache.jena.atlas.io.IndentedWriter ;
-
-import com.hp.hpl.jena.query.Syntax ;
-import com.hp.hpl.jena.sparql.ARQException ;
-import com.hp.hpl.jena.update.UpdateFactory ;
-import com.hp.hpl.jena.update.UpdateRequest ;
-
-public class UpdateValidator extends ValidatorBase
-{
-    public UpdateValidator() 
-    { }
-    
-    static final String paramLineNumbers      = "linenumbers" ;
-    static final String paramFormat           = "outputFormat" ;
-    static final String paramUpdate            = "update" ;
-    static final String paramSyntax           = "languageSyntax" ;
-    //static final String paramSyntaxExtended   = "extendedSyntax" ;
-    
-    @Override
-    protected void execute(HttpServletRequest httpRequest, HttpServletResponse httpResponse)
-    {
-        try {
-//            if ( log.isInfoEnabled() )
-//                log.info("validation request") ;
-            
-            String[] args = httpRequest.getParameterValues(paramUpdate) ;
-            
-            if ( args == null || args.length == 0 )
-            {
-                httpResponse.sendError(HttpServletResponse.SC_BAD_REQUEST, "No update parameter to validator") ;
-                return ;
-            }
-            
-            if ( args.length > 1 )
-            {
-                httpResponse.sendError(HttpServletResponse.SC_BAD_REQUEST, "Too many update parameters") ;
-                return ;
-            }
-
-            final String updateString = httpRequest.getParameter(paramUpdate).replaceAll("(\r|\n| )*$", "") ;
-            
-            String updateSyntax = httpRequest.getParameter(paramSyntax) ;
-            if ( updateSyntax == null || updateSyntax.equals("") )
-                updateSyntax = "SPARQL" ;
-
-            Syntax language = Syntax.lookup(updateSyntax) ;
-            if ( language == null )
-            {
-                httpResponse.sendError(HttpServletResponse.SC_BAD_REQUEST, "Unknown syntax: "+updateSyntax) ;
-                return ;
-            }
-            
-            String lineNumbersArg = httpRequest.getParameter(paramLineNumbers) ; 
-            String a[] = httpRequest.getParameterValues(paramFormat) ;
-            
-            // Currently default.
-            boolean outputSPARQL = true ;
-            boolean lineNumbers = true ;
-            
-            if ( lineNumbersArg != null )
-                lineNumbers = lineNumbersArg.equalsIgnoreCase("true") || lineNumbersArg.equalsIgnoreCase("yes") ;
-            
-            // Headers
-            setHeaders(httpResponse) ;
-
-            ServletOutputStream outStream = httpResponse.getOutputStream() ;
-
-            outStream.println("<html>") ;
-            
-            printHead(outStream, "SPARQL Update Validation Report") ;
-            
-            outStream.println("<body>") ;
-            outStream.println("<h1>SPARQL Update Validator</h1>") ;
-            
-            // Print as received
-            {
-                outStream.println("<p>Input:</p>") ;
-                // Not Java's finest hour.
-                Content c = new Content(){
-                    @Override
-                    public void print(IndentedWriter out)
-                    { out.print(updateString) ; }
-                } ;
-                output(outStream, c, lineNumbers) ;
-            }
-            
-            // Attempt to parse it.
-            UpdateRequest request= null ;
-            try {
-                request = UpdateFactory.create(updateString, "http://example/base/", language) ;
-            } catch (ARQException ex)
-            {
-                // Over generous exception (should be QueryException)
-                // but this makes the code robust.
-                outStream.println("<p>Syntax error:</p>") ;
-                startFixed(outStream) ;
-                outStream.println(ex.getMessage()) ;
-                finishFixed(outStream) ;
-            }
-            catch (RuntimeException ex)
-            { 
-                outStream.println("<p>Internal error:</p>") ;
-                startFixed(outStream) ;
-                outStream.println(ex.getMessage()) ;
-                finishFixed(outStream) ;
-            }
-            
-            // Because we pass into anon inner classes
-            final UpdateRequest updateRequest = request ;
-            
-            // OK?  Pretty print
-            if ( updateRequest != null && outputSPARQL )
-            {
-                outStream.println("<p>Formatted, parsed update request:</p>") ;
-                Content c = new Content(){
-                    @Override
-                    public void print(IndentedWriter out)
-                    {
-                        updateRequest.output(out) ;
-                    }
-                        
-                } ;
-                output(outStream, c, lineNumbers) ;
-            }
-            outStream.println("</body>") ;
-            outStream.println("</html>") ;
-            
-        } catch (Exception ex)
-        {
-            serviceLog.warn("Exception in doGet",ex) ;
-        }
-    }
-
-    interface Content { void print(IndentedWriter out) ; }
-    
-    private void output(ServletOutputStream outStream, Content content, boolean lineNumbers) throws IOException
-    {
-        startFixed(outStream) ;
-        IndentedLineBuffer out = new IndentedLineBuffer(lineNumbers) ; 
-        content.print(out) ;
-        out.flush() ;  
-        String x = htmlQuote(out.asString()) ;
-        byte b[] = x.getBytes("UTF-8") ;
-        outStream.write(b) ;
-        finishFixed(outStream) ;
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/main/java/org/apache/jena/fuseki/validation/ValidatorBase.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/main/java/org/apache/jena/fuseki/validation/ValidatorBase.java b/jena-fuseki/src/main/java/org/apache/jena/fuseki/validation/ValidatorBase.java
deleted file mode 100644
index 61820f4..0000000
--- a/jena-fuseki/src/main/java/org/apache/jena/fuseki/validation/ValidatorBase.java
+++ /dev/null
@@ -1,120 +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.fuseki.validation;
-
-import java.io.IOException ;
-
-import javax.servlet.ServletConfig ;
-import javax.servlet.ServletException ;
-import javax.servlet.ServletOutputStream ;
-import javax.servlet.http.HttpServlet ;
-import javax.servlet.http.HttpServletRequest ;
-import javax.servlet.http.HttpServletResponse ;
-
-import org.apache.jena.fuseki.Fuseki ;
-import org.apache.jena.fuseki.servlets.ServletBase ;
-import org.slf4j.Logger ;
-
-public abstract class ValidatorBase extends HttpServlet 
-{
-    protected static Logger serviceLog = Fuseki.requestLog ;
-
-    public static final String cssFile          = "/fuseki.css" ;
-    public static final String respService      = "X-Service" ;
-
-    
-    @Override
-    public void init() throws ServletException
-    { super.init() ; }
-
-    @Override
-    public void init(ServletConfig config) throws ServletException
-    { super.init(config) ; }
-    
-    @Override
-    public void destroy()
-    { }
-    
-    @Override
-    public void doGet(HttpServletRequest httpRequest, HttpServletResponse httpResponse)
-    { execute(httpRequest, httpResponse) ; }
-
-    @Override
-    public void doPost(HttpServletRequest httpRequest, HttpServletResponse httpResponse)
-    { execute(httpRequest, httpResponse) ; }
-    
-    protected abstract void execute(HttpServletRequest httpRequest, HttpServletResponse httpResponse) ;
-
-    protected static void setHeaders(HttpServletResponse httpResponse)
-    {
-        ServletBase.setCommonHeaders(httpResponse) ; 
-        httpResponse.setCharacterEncoding("UTF-8") ;
-        httpResponse.setContentType("text/html") ;
-        httpResponse.setHeader(respService, "Fuseki/ARQ SPARQL Query Validator: http://jena.apache.org/") ;
-    }
-    
-    protected static String htmlQuote(String str)
-    {
-        StringBuilder sBuff = new StringBuilder() ;
-        for ( int i = 0 ; i < str.length() ; i++ )
-        {
-            char ch = str.charAt(i) ;
-            switch (ch)
-            {
-                case '<': sBuff.append("&lt;") ; break ;
-                case '>': sBuff.append("&gt;") ; break ;
-                case '&': sBuff.append("&amp;") ; break ;
-                default: 
-                    // Work around Eclipe bug with StringBuffer.append(char)
-                    //try { sBuff.append(ch) ; } catch (Exception ex) {}
-                    sBuff.append(ch) ;
-                    break ;  
-            }
-        }
-        return sBuff.toString() ; 
-    }
-
-    protected static void startFixed(ServletOutputStream outStream) throws IOException
-    {
-        outStream.println("<pre class=\"box\">") ;
-    }
-
-    protected static void columns(String prefix, ServletOutputStream outStream) throws IOException
-    {
-        outStream.print(prefix) ;
-        outStream.println("         1         2         3         4         5         6         7") ;
-        outStream.print(prefix) ;
-        outStream.println("12345678901234567890123456789012345678901234567890123456789012345678901234567890") ;
-    }
-    
-    protected static void finishFixed(ServletOutputStream outStream) throws IOException
-    {
-        outStream.println("</pre>") ;
-    }
-    
-    protected static void printHead(ServletOutputStream outStream, String title) throws IOException
-    {
-        outStream.println("<head>") ;
-        outStream.println(" <title>"+title+"</title>") ;
-        outStream.println("   <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">") ;
-        outStream.println("   <link rel=\"stylesheet\" type=\"text/css\" href=\""+cssFile+"\" />") ;
-        //outStream.println() ;
-        outStream.println("</head>") ;
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/main/resources/META-INF/DEPENDENCIES
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/main/resources/META-INF/DEPENDENCIES b/jena-fuseki/src/main/resources/META-INF/DEPENDENCIES
deleted file mode 100644
index 910b788..0000000
--- a/jena-fuseki/src/main/resources/META-INF/DEPENDENCIES
+++ /dev/null
@@ -1,24 +0,0 @@
-This file lists the dependences for Apache Jena Fuseki.
-  Version numbers are given in the POM file for a particular distribution. 
-
-Apache Projects:   Apache Software License
-  Apache Jena, including the Jena IRI library
-  Apache Xerces-J
-  Apache log4j
-  Apache HttpComponents (HTTP Client)
-  Apache Commons Codec
-  Apache Common FileUpload
-
-ICU4J : http://icu-project.org/
-   IBM X License (to version ICU4J 3.4.4)
-
-SLF4J : http://www.slf4j.org/
-  Copyright (c) 2004-2008 QOS.ch
-  MIT License
-
-JUnit : http://junit.org/
-  Common Public License - v 1.0
-
-Jetty: http://www.eclipse.org/jetty/
-  Apache License 2.0 
-  (also avilable under Eclipse Public License 1.0)

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/main/resources/META-INF/LICENSE
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/main/resources/META-INF/LICENSE b/jena-fuseki/src/main/resources/META-INF/LICENSE
deleted file mode 100644
index d645695..0000000
--- a/jena-fuseki/src/main/resources/META-INF/LICENSE
+++ /dev/null
@@ -1,202 +0,0 @@
-
-                                 Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-   END OF TERMS AND CONDITIONS
-
-   APPENDIX: How to apply the Apache License to your work.
-
-      To apply the Apache License to your work, attach the following
-      boilerplate notice, with the fields enclosed by brackets "[]"
-      replaced with your own identifying information. (Don't include
-      the brackets!)  The text should be enclosed in the appropriate
-      comment syntax for the file format. We also recommend that a
-      file or class name and description of purpose be included on the
-      same "printed page" as the copyright notice for easier
-      identification within third-party archives.
-
-   Copyright [yyyy] [name of copyright owner]
-
-   Licensed 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.

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/main/resources/META-INF/NOTICE
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/main/resources/META-INF/NOTICE b/jena-fuseki/src/main/resources/META-INF/NOTICE
deleted file mode 100644
index 1bf7fa8..0000000
--- a/jena-fuseki/src/main/resources/META-INF/NOTICE
+++ /dev/null
@@ -1,16 +0,0 @@
-Apache Jena - module Fuseki
-Copyright 2011, 2012, 2013, 2014, 2015 The Apache Software Foundation
-
-This product includes software developed at
-The Apache Software Foundation (http://www.apache.org/).
-
-Portions of this software were originally based on the following:
-  - Copyright 2005, 2006, 2007, 2008, 2009 Hewlett-Packard Development Company, LP
-  - Copyright 2010, 2011 Epimorphics Ltd.
-  - Copyright 2010, 2011 Talis Systems Ltd.
-These have been licensed to the Apache Software Foundation under a software grant.
-
-- - - - - - - - - - - - - - - - - - - - - - - 
-
-Portions of this software include software from  Mort Bay Consulting Pty. Ltd.
- - Copyright (c) 2004-2009 Mort Bay Consulting Pty. Ltd.

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/main/resources/org/apache/jena/fuseki/fuseki-properties.xml
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/main/resources/org/apache/jena/fuseki/fuseki-properties.xml b/jena-fuseki/src/main/resources/org/apache/jena/fuseki/fuseki-properties.xml
deleted file mode 100644
index 34082eb..0000000
--- a/jena-fuseki/src/main/resources/org/apache/jena/fuseki/fuseki-properties.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
-<!-- Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0" -->
-<properties version="1.0">
-  <comment>Fuseki System Properties</comment>
-  <entry key="org.apache.jena.fuseki.version">${project.version}</entry>
-  <entry key="org.apache.jena.fuseki.build.datetime">${build.time.xsd}</entry>
-</properties>

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/test/java/org/apache/jena/fuseki/ServerTest.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/test/java/org/apache/jena/fuseki/ServerTest.java b/jena-fuseki/src/test/java/org/apache/jena/fuseki/ServerTest.java
deleted file mode 100644
index 18150b1..0000000
--- a/jena-fuseki/src/test/java/org/apache/jena/fuseki/ServerTest.java
+++ /dev/null
@@ -1,111 +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.fuseki;
-
-import com.hp.hpl.jena.graph.Graph ;
-import com.hp.hpl.jena.graph.Node ;
-import com.hp.hpl.jena.graph.NodeFactory ;
-import com.hp.hpl.jena.rdf.model.Model ;
-import com.hp.hpl.jena.rdf.model.ModelFactory ;
-import com.hp.hpl.jena.sparql.core.DatasetGraph ;
-import com.hp.hpl.jena.sparql.core.DatasetGraphFactory ;
-import com.hp.hpl.jena.sparql.modify.request.Target ;
-import com.hp.hpl.jena.sparql.modify.request.UpdateDrop ;
-import com.hp.hpl.jena.sparql.sse.SSE ;
-import com.hp.hpl.jena.update.Update ;
-import com.hp.hpl.jena.update.UpdateExecutionFactory ;
-import com.hp.hpl.jena.update.UpdateProcessor ;
-
-/** Manage a server for testing.
- * Example for one server per test suite: 
- * <pre>
-    \@BeforeClass public static void beforeClass() { ServerTest.allocServer() ; }
-    \@AfterClass  public static void afterClass()  { ServerTest.freeServer() ; }
-    \@Before      public void beforeTest()         { ServerTest.resetServer() ; }
-    </pre>
- */
-public class ServerTest
-{
-    // Abstraction that runs a SPARQL server for tests.
-    
-    public static final int port             = 3635 ;   // Different to the Fuseki2 test port.
-    public static final String urlRoot       = "http://localhost:"+port+"/" ;
-    public static final String datasetPath   = "/dataset" ;
-    public static final String serviceUpdate = "http://localhost:"+port+datasetPath+"/update" ; 
-    public static final String serviceQuery  = "http://localhost:"+port+datasetPath+"/query" ; 
-    public static final String serviceREST   = "http://localhost:"+port+datasetPath+"/data" ; // ??????
-    
-    public static final String gn1       = "http://graph/1" ;
-    public static final String gn2       = "http://graph/2" ;
-    public static final String gn99      = "http://graph/99" ;
-    
-    public static final Node n1          = NodeFactory.createURI("http://graph/1") ;
-    public static final Node n2          = NodeFactory.createURI("http://graph/2") ;
-    public static final Node n99         = NodeFactory.createURI("http://graph/99") ;
-    
-    public static final Graph graph1     = SSE.parseGraph("(base <http://example/> (graph (<x> <p> 1)))") ;
-    public static final Graph graph2     = SSE.parseGraph("(base <http://example/> (graph (<x> <p> 2)))") ;
-    
-    public static final Model model1     = ModelFactory.createModelForGraph(graph1) ;
-    public static final Model model2     = ModelFactory.createModelForGraph(graph2) ;
-    
-    private static EmbeddedFusekiServer server = null ;
-    
-    // reference count of start/stop server
-    private static int countServer = 0 ; 
-    
-    // This will cause there to be one server over all tests.
-    // Must be after initialization of counters 
-    //static { allocServer() ; }
-
-    static public void allocServer()
-    {
-        if ( countServer == 0 )
-            setupServer() ;
-        countServer++ ;
-    }
-    
-    static public void freeServer() 
-    {
-        if ( countServer >= 0 ) {
-            countServer -- ;
-            if ( countServer == 0 )
-                teardownServer() ;
-        }
-    }
-    
-    protected static void setupServer()
-    {
-        DatasetGraph dsg = DatasetGraphFactory.createMem() ;
-        server = EmbeddedFusekiServer.create(port, dsg, datasetPath) ;
-        server.start() ;
-    }
-    
-    protected static void teardownServer() {
-        if ( server != null )
-            server.stop() ;
-        server = null ;
-    }
-    public static void resetServer()
-    {
-        Update clearRequest = new UpdateDrop(Target.ALL) ;
-        UpdateProcessor proc = UpdateExecutionFactory.createRemote(clearRequest, ServerTest.serviceUpdate) ;
-        proc.execute() ;
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/test/java/org/apache/jena/fuseki/TS_Fuseki.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/test/java/org/apache/jena/fuseki/TS_Fuseki.java b/jena-fuseki/src/test/java/org/apache/jena/fuseki/TS_Fuseki.java
deleted file mode 100644
index 693217f..0000000
--- a/jena-fuseki/src/test/java/org/apache/jena/fuseki/TS_Fuseki.java
+++ /dev/null
@@ -1,61 +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.fuseki;
-
-import org.apache.http.client.HttpClient ;
-import org.apache.jena.atlas.logging.LogCtl ;
-import org.apache.jena.fuseki.http.TestDatasetAccessorHTTP ;
-import org.apache.jena.fuseki.http.TestDatasetGraphAccessorHTTP ;
-import org.apache.jena.fuseki.http.TestHttpOp ;
-import org.apache.jena.riot.web.HttpOp ;
-import org.junit.AfterClass ;
-import org.junit.BeforeClass ;
-import org.junit.runner.RunWith ;
-import org.junit.runners.Suite ;
-
-@RunWith(Suite.class)
-@Suite.SuiteClasses( {
-    TestHttpOp.class
-    , TestSPARQLProtocol.class
-    , TestDatasetGraphAccessorHTTP.class
-    , TestDatasetAccessorHTTP.class
-    , TestQuery.class
-    , TestAuth.class
-})
-public class TS_Fuseki extends ServerTest
-{
-    // Use HttpOp caching of connections during testing to stop
-    // swamping  kernel socket management (seems to be most
-    // acute on Java 1.6)
-    
-    static HttpClient defaultHttpClient = HttpOp.getDefaultHttpClient() ;
-    // Used for all tests except auth tests.
-    static HttpClient globalCachingClient = HttpOp.createCachingHttpClient() ;
-    
-    @BeforeClass public static void beforeClassAbstract1() {
-        HttpOp.setDefaultHttpClient(globalCachingClient) ;
-    }
-    
-    @AfterClass public static void afterClassAbstract1() {
-        HttpOp.setDefaultHttpClient(defaultHttpClient) ;
-    }
-    
-    @BeforeClass static public void beforeClass() { LogCtl.disable(Fuseki.requestLogName) ; }
-    @AfterClass static public void afterClass()   { LogCtl.setInfo(Fuseki.requestLogName) ;}
-}


[05/23] jena git commit: Rename folder jena-fuseki to jena-fuseki1

Posted by an...@apache.org.
http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/main/java/org/apache/jena/fuseki/mgt/StatsServlet.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/java/org/apache/jena/fuseki/mgt/StatsServlet.java b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/mgt/StatsServlet.java
new file mode 100644
index 0000000..e165355
--- /dev/null
+++ b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/mgt/StatsServlet.java
@@ -0,0 +1,171 @@
+/**
+ * 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.fuseki.mgt;
+
+import java.io.IOException ;
+import java.util.Iterator ;
+
+import javax.servlet.ServletOutputStream ;
+import javax.servlet.http.HttpServlet ;
+import javax.servlet.http.HttpServletRequest ;
+import javax.servlet.http.HttpServletResponse ;
+
+import org.apache.jena.atlas.json.JSON ;
+import org.apache.jena.atlas.json.JsonArray ;
+import org.apache.jena.atlas.json.JsonObject ;
+import org.apache.jena.fuseki.server.* ;
+import org.apache.jena.riot.WebContent ;
+
+public class StatsServlet extends HttpServlet
+{
+    @Override
+    protected void doGet(HttpServletRequest req, HttpServletResponse resp)
+        //throws ServletException, IOException
+    {
+        try {
+            // Conneg etc.
+            statsJSON(req, resp) ;
+        } catch (IOException e)
+        { }
+    }
+    
+    private void statsJSON(HttpServletRequest req, HttpServletResponse resp) throws IOException
+    {
+        ServletOutputStream out = resp.getOutputStream() ;
+        resp.setContentType(WebContent.contentTypeJSON);
+        resp.setCharacterEncoding(WebContent.charsetUTF8) ;
+
+        /*
+         * { "server" : ....   
+         *    "datasets" : {
+         *       "ds1": { counters... }
+         *       GSP stucture?
+         *         
+         */
+        
+        JsonObject obj = new JsonObject() ;
+        JsonObject datasets = new JsonObject() ;
+        JsonObject server = new JsonObject() ;
+        server.put("host", req.getLocalName()+":"+req.getLocalPort()) ;
+        
+        for ( String ds : DatasetRegistry.get().keys() )
+            statsJSON(datasets, ds) ; 
+        
+        obj.put("server", server) ;
+        obj.put("datasets", datasets) ;
+        
+        JSON.write(out, obj) ;
+        out.flush() ;
+    }
+    
+    private void statsJSON(JsonObject datasets, String ds) {
+        DatasetRef desc = DatasetRegistry.get().get(ds) ;
+        JsonObject stats = new JsonObject() ;
+        datasets.put(ds, stats) ;
+        stats.put(CounterName.Requests.name(),      desc.getCounters().value(CounterName.Requests)) ;
+        stats.put(CounterName.RequestsGood.name(),  desc.getCounters().value(CounterName.RequestsGood)) ;
+        stats.put(CounterName.RequestsBad.name(),   desc.getCounters().value(CounterName.RequestsBad)) ;
+        JsonObject services = new JsonObject() ;
+
+//        JsonArray endpoints = new JsonArray() ;
+//        services.put("endpoints", endpoints) ;
+//        JsonArray srvNames = new JsonArray() ;
+//        services.put("names", srvNames) ;
+        
+        // There can be several endpoints for one service.
+        for ( ServiceRef srvRef : desc.getServiceRefs() ) {
+            JsonObject epStats = new JsonObject() ;
+            statsJSON(epStats, srvRef) ;
+            services.put(srvRef.name, epStats) ;
+            JsonArray endpoints = new JsonArray() ;
+            epStats.put("endpoints", endpoints) ;
+            for ( String ep : srvRef.endpoints) {
+                endpoints.add(ep) ;
+            }
+        }
+        stats.put("services", services) ;
+    }
+
+    private void statsJSON(JsonObject epStats, ServiceRef srvRef) {
+        for (CounterName cn : srvRef.getCounters().counters()) {
+            Counter c = srvRef.getCounters().get(cn) ;
+            epStats.put(cn.name(), c.value()) ;
+        }
+    }
+
+    private void statsTxt(HttpServletResponse resp) throws IOException
+    {
+        ServletOutputStream out = resp.getOutputStream() ;
+        resp.setContentType(WebContent.contentTypeTextPlain);
+        resp.setCharacterEncoding(WebContent.charsetUTF8) ;
+
+        Iterator<String> iter = DatasetRegistry.get().keys().iterator() ;
+        while(iter.hasNext())
+        {
+            String ds = iter.next() ;
+            DatasetRef desc = DatasetRegistry.get().get(ds) ;
+            statsTxt(out, desc) ;
+            if ( iter.hasNext() )
+                out.println() ;
+        }
+        out.flush() ;
+    }
+    private void statsTxt(ServletOutputStream out, DatasetRef desc) throws IOException
+    {
+        out.println("Dataset: "+desc.name) ;
+        out.println("    Requests      = "+desc.getCounters().value(CounterName.Requests)) ;
+        out.println("    Good          = "+desc.getCounters().value(CounterName.RequestsGood)) ;
+        out.println("    Bad           = "+desc.getCounters().value(CounterName.RequestsBad)) ;
+
+        out.println("  SPARQL Query:") ;
+        out.println("    Request       = "+desc.query.getCounters().value(CounterName.Requests)) ;
+        out.println("    Good          = "+desc.query.getCounters().value(CounterName.RequestsGood)) ;
+        out.println("    Bad requests  = "+desc.query.getCounters().value(CounterName.RequestsBad)) ;
+        out.println("    Timeouts      = "+desc.query.getCounters().value(CounterName.QueryTimeouts)) ;
+        out.println("    Bad exec      = "+desc.query.getCounters().value(CounterName.QueryExecErrors)) ;
+
+        out.println("  SPARQL Update:") ;
+        out.println("    Request       = "+desc.update.getCounters().value(CounterName.Requests)) ;
+        out.println("    Good          = "+desc.update.getCounters().value(CounterName.RequestsGood)) ;
+        out.println("    Bad requests  = "+desc.update.getCounters().value(CounterName.RequestsBad)) ;
+        out.println("    Bad exec      = "+desc.update.getCounters().value(CounterName.UpdateExecErrors)) ;
+        
+        out.println("  Upload:") ;
+        out.println("    Requests      = "+desc.upload.getCounters().value(CounterName.Requests)) ;
+        out.println("    Good          = "+desc.upload.getCounters().value(CounterName.RequestsGood)) ;
+        out.println("    Bad           = "+desc.upload.getCounters().value(CounterName.RequestsBad)) ;
+        
+        out.println("  SPARQL Graph Store Protocol:") ;
+        out.println("    GETs          = "+gspValue(desc, CounterName.GSPget)+ " (good="+gspValue(desc, CounterName.GSPgetGood)+"/bad="+gspValue(desc, CounterName.GSPgetBad)+")") ;
+        out.println("    PUTs          = "+gspValue(desc, CounterName.GSPput)+ " (good="+gspValue(desc, CounterName.GSPputGood)+"/bad="+gspValue(desc, CounterName.GSPputBad)+")") ;
+        out.println("    POSTs         = "+gspValue(desc, CounterName.GSPpost)+ " (good="+gspValue(desc, CounterName.GSPpostGood)+"/bad="+gspValue(desc, CounterName.GSPpostBad)+")") ;
+        out.println("    DELETEs       = "+gspValue(desc, CounterName.GSPdelete)+ " (good="+gspValue(desc, CounterName.GSPdeleteGood)+"/bad="+gspValue(desc, CounterName.GSPdeleteBad)+")") ;
+        out.println("    HEADs         = "+gspValue(desc, CounterName.GSPhead)+ " (good="+gspValue(desc, CounterName.GSPheadGood)+"/bad="+gspValue(desc, CounterName.GSPheadBad)+")") ;
+    }
+    
+    private long gspValue(DatasetRef desc, CounterName cn) {
+        long x1 = desc.readGraphStore.getCounters().value(cn) ;
+        long x2 = desc.readWriteGraphStore.getCounters().value(cn) ;
+        return x1+x2 ;
+    }
+    
+    
+}
+
+

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/main/java/org/apache/jena/fuseki/migrate/GraphLoadUtils.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/java/org/apache/jena/fuseki/migrate/GraphLoadUtils.java b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/migrate/GraphLoadUtils.java
new file mode 100644
index 0000000..da16863
--- /dev/null
+++ b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/migrate/GraphLoadUtils.java
@@ -0,0 +1,76 @@
+/*
+ * 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.fuseki.migrate;
+
+import org.apache.jena.atlas.web.TypedInputStream ;
+import org.apache.jena.fuseki.Fuseki ;
+import org.apache.jena.riot.RDFDataMgr ;
+import org.apache.jena.riot.system.StreamRDF ;
+import org.apache.jena.riot.system.StreamRDFLib ;
+
+import com.hp.hpl.jena.graph.Factory ;
+import com.hp.hpl.jena.graph.Graph ;
+import com.hp.hpl.jena.rdf.model.Model ;
+import com.hp.hpl.jena.rdf.model.ModelFactory ;
+
+/** A packaging of code to do a controlled read of a graph or model */
+
+public class GraphLoadUtils
+{
+    // ---- Model level
+    
+    public static Model readModel(String uri, int limit)
+    {
+        Graph g = Factory.createGraphMem() ;
+        readUtil(g, uri, limit) ;
+        return ModelFactory.createModelForGraph(g) ;
+    }
+    
+    public static void loadModel(Model model, String uri, int limit) 
+    {
+        Graph g = model.getGraph() ;
+        readUtil(g, uri, limit) ;
+    }
+
+    // ---- Graph level
+    
+    public static Graph readGraph(String uri, int limit)
+    {
+        Graph g = Factory.createGraphMem() ;
+        readUtil(g, uri, limit) ;
+        return g ;
+    }
+    
+    public static void loadGraph(Graph g, String uri, int limit) 
+    {
+        readUtil(g, uri, limit) ;
+    }
+    
+    // ** Worker.
+    private static void readUtil(Graph graph, String uri, int limit)
+    {
+        // We need to do this ourselves, not via riot, to use the webStreamManager
+        StreamRDF sink = StreamRDFLib.graph(graph) ;
+        sink = new SinkRDFLimited(sink, limit) ;
+
+        TypedInputStream input = Fuseki.webStreamManager.open(uri) ;
+        RDFDataMgr.parse(sink, input, uri) ;
+    }
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/main/java/org/apache/jena/fuseki/migrate/Registry.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/java/org/apache/jena/fuseki/migrate/Registry.java b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/migrate/Registry.java
new file mode 100644
index 0000000..ca30be1
--- /dev/null
+++ b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/migrate/Registry.java
@@ -0,0 +1,42 @@
+/*
+ * 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.fuseki.migrate;
+
+import java.util.Collection ;
+import java.util.HashMap ;
+import java.util.Map ;
+
+public class Registry<T>
+{
+    protected Map<String, T> registry = new HashMap<String, T>() ;
+    
+    public Registry() {}
+    
+    public void put(String key, T value) { registry.put(key, value) ; }
+    
+    public T get(String key) { return registry.get(key) ; }
+    
+    public boolean isRegistered(String key) { return registry.containsKey(key) ; }
+    public void remove(String key) { registry.remove(key) ; } 
+    public Collection<String> keys() { return registry.keySet() ; }
+    //public Iterator<String> keys() { return registry.keySet().iterator() ; }
+    
+    public int size() { return registry.size() ; }
+    public boolean isEmpty() { return registry.isEmpty() ; }
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/main/java/org/apache/jena/fuseki/migrate/SinkRDFLimited.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/java/org/apache/jena/fuseki/migrate/SinkRDFLimited.java b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/migrate/SinkRDFLimited.java
new file mode 100644
index 0000000..514d756
--- /dev/null
+++ b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/migrate/SinkRDFLimited.java
@@ -0,0 +1,55 @@
+/*
+ * 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.fuseki.migrate;
+
+import org.apache.jena.riot.system.StreamRDF ;
+import org.apache.jena.riot.system.StreamRDFWrapper ;
+
+import com.hp.hpl.jena.graph.Triple ;
+import com.hp.hpl.jena.sparql.core.Quad ;
+
+public class SinkRDFLimited extends StreamRDFWrapper
+{
+   private long count = 0 ;
+   private final long limit ;
+    
+    public SinkRDFLimited(StreamRDF output, long limit)
+    {
+        super(output) ;
+        this.limit = limit ;
+    }
+
+    @Override
+    public void triple(Triple triple)
+    { 
+        count++ ;
+        super.triple(triple) ;
+    }
+
+    @Override
+    public void quad(Quad quad)
+    { 
+        count++ ;
+        super.quad(quad) ;
+    }
+
+    public long getCount() { return count ; } 
+    public long getLimit() { return limit ; }
+}
+

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/main/java/org/apache/jena/fuseki/server/Counter.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/java/org/apache/jena/fuseki/server/Counter.java b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/server/Counter.java
new file mode 100644
index 0000000..88d4d37
--- /dev/null
+++ b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/server/Counter.java
@@ -0,0 +1,34 @@
+/**
+ * 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.fuseki.server;
+
+import java.util.concurrent.atomic.AtomicLong ;
+
+/** A statistics counter */
+public class Counter
+{
+    private AtomicLong counter = new AtomicLong(0) ;
+    
+    public Counter()    {}
+    
+    public void inc()   { counter.incrementAndGet() ; } 
+    public void dec()   { counter.decrementAndGet() ; } 
+    public long value() { return counter.get() ; } 
+}
+

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/main/java/org/apache/jena/fuseki/server/CounterMXBean.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/java/org/apache/jena/fuseki/server/CounterMXBean.java b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/server/CounterMXBean.java
new file mode 100644
index 0000000..2de7658
--- /dev/null
+++ b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/server/CounterMXBean.java
@@ -0,0 +1,25 @@
+/**
+ * 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.fuseki.server;
+
+public interface CounterMXBean
+{
+    long getValue() ; 
+}
+

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/main/java/org/apache/jena/fuseki/server/CounterName.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/java/org/apache/jena/fuseki/server/CounterName.java b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/server/CounterName.java
new file mode 100644
index 0000000..2952aa8
--- /dev/null
+++ b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/server/CounterName.java
@@ -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 org.apache.jena.fuseki.server;
+
+/** Names for all counters */ 
+public enum CounterName {
+    // There are generic names - apply to all services and datasets
+    // and specific ones.
+
+    
+    // Total request received
+    Requests("requests"),
+    // .. of which some and "good" and some are "bad".
+    // #"good" + #"bad" roughly equals #"requests"
+    // except that the total is incremented at the start, and the outcome at the end.
+    // There may also be short term consistency issues.
+    RequestsGood("requests.good"),
+    RequestsBad("requests.bad") ,
+    
+    // SPARQL Protocol - query and update - together with upload.  
+    
+    // Query - standard and ... 
+    QueryTimeouts("query.timeouts") ,
+    QueryExecErrors("query.execerrors") ,
+    
+    // Update - standard and ...
+    UpdateExecErrors("update.execerrors"),
+    
+    // Upload ... standard counters
+    
+    // Graph Store Protocol.
+
+    // For each HTTP method
+    GSPget("gsp.get.requests") ,
+    GSPgetGood("gsp.get.requests.good") ,
+    GSPgetBad("gsp.get.requests.bad") ,
+
+    GSPpost("gsp.post.requests") ,
+    GSPpostGood("gsp.post.requests.good") ,
+    GSPpostBad("gsp.post.requests.bad") ,
+
+    GSPdelete("gsp.delete.requests") ,
+    GSPdeleteGood("gsp.delete.requests.good") ,
+    GSPdeleteBad("gsp.delete.requests.bad") ,
+
+    GSPput("gsp.put.requests") ,
+    GSPputGood("gsp.put.requests.good") ,
+    GSPputBad("gsp.put.requests.bad") ,
+
+    GSPhead("gsp.head.requests") ,
+    GSPheadGood("gsp.head.requests.good") ,
+    GSPheadBad("gsp.head.requests.bad") ,
+
+    GSPpatch("gsp.patch.requests") ,
+    GSPpatchGood("gsp.patch.requests.good") ,
+    GSPpatchBad("gsp.patch.requests.bad") ,
+
+    GSPoptions("gsp.options.requests") ,
+    GSPoptionsGood("gsp.options.requests.good") ,
+    GSPoptionsBad("gsp.options.requests.bad") ,
+    
+    ;
+    
+    private String name ;
+    private CounterName(String name) { this.name = name ; }
+    
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/main/java/org/apache/jena/fuseki/server/CounterSet.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/java/org/apache/jena/fuseki/server/CounterSet.java b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/server/CounterSet.java
new file mode 100644
index 0000000..7d0d622
--- /dev/null
+++ b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/server/CounterSet.java
@@ -0,0 +1,70 @@
+/**
+ * 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.fuseki.server ;
+
+import java.util.Collection ;
+import java.util.HashMap ;
+import java.util.Map ;
+
+import org.slf4j.Logger ;
+import org.slf4j.LoggerFactory ;
+
+/** A collection of counters */
+public class CounterSet {
+    private static Logger             log      = LoggerFactory.getLogger(CounterSet.class) ;
+
+    private Map<CounterName, Counter> counters = new HashMap<CounterName, Counter>() ;
+
+    public CounterSet() {}
+
+    public Collection<CounterName> counters() {
+        return counters.keySet() ;
+    }
+
+    public void inc(CounterName c) {
+        get(c).inc() ;
+    }
+
+    public void dec(CounterName c) {
+        get(c).dec() ;
+    }
+
+    public long value(CounterName c) {
+        return get(c).value() ;
+    }
+
+    public void add(CounterName counterName) {
+        if ( counters.containsKey(counterName) ) {
+            log.warn("Duplicate counter in counter set: " + counterName) ;
+            return ;
+        }
+        counters.put(counterName, new Counter()) ;
+    }
+
+    public boolean contains(CounterName cn) {
+        return counters.containsKey(cn) ;
+    }
+
+    public Counter get(CounterName cn) {
+        Counter c = counters.get(cn) ;
+        if ( c == null )
+            log.warn("No counter in counter set: " + cn) ;
+        return c ;
+    }
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/main/java/org/apache/jena/fuseki/server/Counters.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/java/org/apache/jena/fuseki/server/Counters.java b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/server/Counters.java
new file mode 100644
index 0000000..4e5ca4b
--- /dev/null
+++ b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/server/Counters.java
@@ -0,0 +1,25 @@
+/**
+ * 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.fuseki.server;
+
+/** Objects that have a counter set */ 
+public interface Counters {
+    public  CounterSet getCounters() ;
+}
+

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/main/java/org/apache/jena/fuseki/server/DatasetMXBean.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/java/org/apache/jena/fuseki/server/DatasetMXBean.java b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/server/DatasetMXBean.java
new file mode 100644
index 0000000..bf38229
--- /dev/null
+++ b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/server/DatasetMXBean.java
@@ -0,0 +1,35 @@
+/**
+ * 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.fuseki.server;
+
+public interface DatasetMXBean
+{
+    String getName() ;
+    
+    long getRequests() ;
+    long getRequestsGood() ;
+    long getRequestsBad() ;
+    
+//    void enable() ;
+//    void disable() ;
+//    void setReadOnly() ;
+//    boolean getReadOnly() ;
+    
+}
+

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/main/java/org/apache/jena/fuseki/server/DatasetRef.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/java/org/apache/jena/fuseki/server/DatasetRef.java b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/server/DatasetRef.java
new file mode 100644
index 0000000..040c759
--- /dev/null
+++ b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/server/DatasetRef.java
@@ -0,0 +1,241 @@
+/*
+ * 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.fuseki.server;
+
+import java.util.* ;
+import java.util.concurrent.atomic.AtomicLong ;
+
+import org.apache.jena.fuseki.Fuseki ;
+
+import com.hp.hpl.jena.query.ReadWrite ;
+import com.hp.hpl.jena.sparql.core.DatasetGraph ;
+
+public class DatasetRef implements DatasetMXBean, Counters
+{
+    public String name                          = null ;
+    public DatasetGraph dataset                 = null ;
+
+    public ServiceRef query                     = new ServiceRef("query") ;
+    public ServiceRef update                    = new ServiceRef("update") ;
+    public ServiceRef upload                    = new ServiceRef("upload") ;
+    public ServiceRef readGraphStore            = new ServiceRef("gspRead") ;
+    public ServiceRef readWriteGraphStore       = new ServiceRef("gspReadWrite") ; 
+    
+    // Dataset-level counters.
+    private final CounterSet counters           = new CounterSet() ;
+    @Override
+    public  CounterSet getCounters() { return counters ; }
+    
+    private Map<String, ServiceRef> endpoints   = new HashMap<String, ServiceRef>() ;
+    private List<ServiceRef> serviceRefs        = new ArrayList<ServiceRef>() ;
+    private boolean initialized = false ;
+    
+    // Two step initiation (c.f. Builder pattern)
+    // Create object - incrementally set state - call init to calculate internal datastructures.
+    public DatasetRef() {}
+    public void init() {
+        if ( initialized )
+            Fuseki.serverLog.warn("Already initialized: dataset = "+name) ;
+        initialized = true ;
+        initServices() ;
+    }
+    
+    @Override public String toString() { return "DatasetRef:'"+name+"'" ; }  
+    
+    private void initServices() {
+        add(query) ;
+        add(update) ;
+        add(upload) ;
+        add(readGraphStore) ;
+        add(readWriteGraphStore) ;
+        addCounters() ;
+    }
+    
+    private void add(ServiceRef srvRef) {
+        serviceRefs.add(srvRef) ;
+        for ( String ep : srvRef.endpoints )
+            endpoints.put(ep, srvRef) ;
+    }
+
+    public ServiceRef getServiceRef(String service) {
+        if ( ! initialized )
+            Fuseki.serverLog.error("Not initialized: dataset = "+name) ;
+        if ( service.startsWith("/") )
+            service = service.substring(1, service.length()) ; 
+        return endpoints.get(service) ;
+    }
+
+    public Collection<ServiceRef> getServiceRefs() {
+        return serviceRefs ;
+    }
+
+    /** Counter of active read transactions */
+    public AtomicLong   activeReadTxn           = new AtomicLong(0) ;
+    
+    /** Counter of active write transactions */
+    public AtomicLong   activeWriteTxn          = new AtomicLong(0) ;
+
+    /** Cumulative counter of read transactions */
+    public AtomicLong   totalReadTxn            = new AtomicLong(0) ;
+
+    /** Cumulative counter of writer transactions */
+    public AtomicLong   totalWriteTxn           = new AtomicLong(0) ;
+    
+//    /** Count of requests received - anyzservice */
+//    public AtomicLong   countServiceRequests    = new AtomicLong(0) ;
+//    /** Count of requests received that fail in some way */
+//    public AtomicLong   countServiceRequestsBad = new AtomicLong(0) ;
+//    /** Count of requests received that fail in some way */
+//    public AtomicLong   countServiceRequestsOK  = new AtomicLong(0) ;
+//
+//    // SPARQL Query
+//    
+//    /** Count of SPARQL Queries successfully executed */
+//    public AtomicLong   countQueryOK            = new AtomicLong(0) ;
+//    /** Count of SPARQL Queries with syntax errors */
+//    public AtomicLong   countQueryBadSyntax     = new AtomicLong(0) ;
+//    /** Count of SPARQL Queries with timeout on execution */
+//    public AtomicLong   countQueryTimeout       = new AtomicLong(0) ;
+//    /** Count of SPARQL Queries with execution errors (not timeouts) */
+//    public AtomicLong   countQueryBadExecution  = new AtomicLong(0) ;
+
+    public void startTxn(ReadWrite mode)
+    {
+        switch(mode)
+        {
+            case READ:  
+                activeReadTxn.getAndIncrement() ;
+                totalReadTxn.getAndIncrement() ;
+                break ;
+            case WRITE:
+                activeWriteTxn.getAndIncrement() ;
+                totalWriteTxn.getAndIncrement() ;
+                break ;
+        }
+    }
+    
+    public void finishTxn(ReadWrite mode)
+    {
+        switch(mode)
+        {
+            case READ:  
+                activeReadTxn.decrementAndGet() ;
+                break ;
+            case WRITE:
+                activeWriteTxn.decrementAndGet() ;
+                break ;
+        }
+    }
+
+    //TODO Need to be able to set this from the config file.  
+    public boolean allowDatasetUpdate           = false;
+    
+    public boolean allowTimeoutOverride         = false;
+    public long maximumTimeoutOverride          = Long.MAX_VALUE;
+    
+    public boolean isReadOnly()
+    {
+        return ! allowDatasetUpdate &&
+               ! update.isActive() && 
+               ! upload.isActive() &&
+               ! readWriteGraphStore.isActive()
+               ;
+    }
+    
+    // MBean
+    
+    @Override
+    public String getName()     { return name ; }
+
+    @Override public long getRequests() { 
+        return counters.value(CounterName.Requests) ;
+    }
+
+    @Override
+    public long getRequestsGood() {
+        return counters.value(CounterName.RequestsGood) ;
+    }
+    @Override
+    public long getRequestsBad() {
+        return counters.value(CounterName.RequestsBad) ;
+    }
+    
+    private void addCounters() {
+        getCounters().add(CounterName.Requests) ;
+        getCounters().add(CounterName.RequestsGood) ;
+        getCounters().add(CounterName.RequestsBad) ;
+
+        query.getCounters().add(CounterName.Requests) ;
+        query.getCounters().add(CounterName.RequestsGood) ;
+        query.getCounters().add(CounterName.RequestsBad) ;
+        query.getCounters().add(CounterName.QueryTimeouts) ;
+        query.getCounters().add(CounterName.QueryExecErrors) ;
+
+        update.getCounters().add(CounterName.Requests) ;
+        update.getCounters().add(CounterName.RequestsGood) ;
+        update.getCounters().add(CounterName.RequestsBad) ;
+        update.getCounters().add(CounterName.UpdateExecErrors) ;
+
+        upload.getCounters().add(CounterName.Requests) ;
+        upload.getCounters().add(CounterName.RequestsGood) ;
+        upload.getCounters().add(CounterName.RequestsBad) ;
+
+        addCountersForGSP(readWriteGraphStore.getCounters(), false) ;
+        if ( readGraphStore != readWriteGraphStore )
+            addCountersForGSP(readGraphStore.getCounters(), true) ;
+    }
+
+    private void addCountersForGSP(CounterSet cs, boolean readWrite) {
+        cs.add(CounterName.Requests) ;
+        cs.add(CounterName.RequestsGood) ;
+        cs.add(CounterName.RequestsBad) ;
+
+        cs.add(CounterName.GSPget) ;
+        cs.add(CounterName.GSPgetGood) ;
+        cs.add(CounterName.GSPgetBad) ;
+
+        cs.add(CounterName.GSPhead) ;
+        cs.add(CounterName.GSPheadGood) ;
+        cs.add(CounterName.GSPheadBad) ;
+
+        // Add anyway.
+        // if ( ! readWrite )
+        // return ;
+
+        cs.add(CounterName.GSPput) ;
+        cs.add(CounterName.GSPputGood) ;
+        cs.add(CounterName.GSPputBad) ;
+
+        cs.add(CounterName.GSPpost) ;
+        cs.add(CounterName.GSPpostGood) ;
+        cs.add(CounterName.GSPpostBad) ;
+
+        cs.add(CounterName.GSPdelete) ;
+        cs.add(CounterName.GSPdeleteGood) ;
+        cs.add(CounterName.GSPdeleteBad) ;
+
+        cs.add(CounterName.GSPpatch) ;
+        cs.add(CounterName.GSPpatchGood) ;
+        cs.add(CounterName.GSPpatchBad) ;
+
+        cs.add(CounterName.GSPoptions) ;
+        cs.add(CounterName.GSPoptionsGood) ;
+        cs.add(CounterName.GSPoptionsBad) ;
+    }
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/main/java/org/apache/jena/fuseki/server/DatasetRegistry.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/java/org/apache/jena/fuseki/server/DatasetRegistry.java b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/server/DatasetRegistry.java
new file mode 100644
index 0000000..152e8cd
--- /dev/null
+++ b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/server/DatasetRegistry.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.fuseki.server;
+
+import org.apache.jena.fuseki.migrate.Registry ;
+
+public class DatasetRegistry extends Registry<DatasetRef>
+{
+    private static DatasetRegistry singleton = new DatasetRegistry() ;
+
+    public static DatasetRegistry get() { return singleton ; }
+    
+    private DatasetRegistry() {}
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/main/java/org/apache/jena/fuseki/server/FusekiConfig.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/java/org/apache/jena/fuseki/server/FusekiConfig.java b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/server/FusekiConfig.java
new file mode 100644
index 0000000..9c36a7c
--- /dev/null
+++ b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/server/FusekiConfig.java
@@ -0,0 +1,374 @@
+/*
+ * 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.fuseki.server;
+
+import java.lang.reflect.Method ;
+import java.util.ArrayList ;
+import java.util.Arrays ;
+import java.util.List ;
+
+import org.apache.jena.atlas.iterator.Iter ;
+import org.apache.jena.atlas.lib.StrUtils ;
+import org.apache.jena.fuseki.Fuseki ;
+import org.apache.jena.fuseki.FusekiConfigException ;
+import org.apache.jena.fuseki.HttpNames ;
+import org.slf4j.Logger ;
+
+import com.hp.hpl.jena.assembler.Assembler ;
+import com.hp.hpl.jena.assembler.JA ;
+import com.hp.hpl.jena.query.ARQ ;
+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.QuerySolutionMap ;
+import com.hp.hpl.jena.query.ResultSet ;
+import com.hp.hpl.jena.query.ResultSetFactory ;
+import com.hp.hpl.jena.rdf.model.Literal ;
+import com.hp.hpl.jena.rdf.model.Model ;
+import com.hp.hpl.jena.rdf.model.RDFNode ;
+import com.hp.hpl.jena.rdf.model.ResIterator ;
+import com.hp.hpl.jena.rdf.model.Resource ;
+import com.hp.hpl.jena.rdf.model.Statement ;
+import com.hp.hpl.jena.rdf.model.StmtIterator ;
+import com.hp.hpl.jena.shared.PrefixMapping ;
+import com.hp.hpl.jena.sparql.core.DatasetGraph ;
+import com.hp.hpl.jena.sparql.core.DatasetGraphFactory ;
+import com.hp.hpl.jena.sparql.core.DatasetGraphReadOnly ;
+import com.hp.hpl.jena.sparql.core.assembler.AssemblerUtils ;
+import com.hp.hpl.jena.tdb.TDB ;
+import com.hp.hpl.jena.util.FileManager ;
+import com.hp.hpl.jena.vocabulary.RDF ;
+import com.hp.hpl.jena.vocabulary.RDFS ;
+
+public class FusekiConfig
+{
+    static { Fuseki.init(); }
+
+    // The datastructure that captures a servers configuration.
+    
+    // Server port
+    int port ;
+    // Management command port - -1 for none.
+    int mgtPort ;           
+    List<DatasetRef> datasets = null ;
+    
+    
+    private static Logger log = Fuseki.configLog ;
+    
+    private static String prefixes = StrUtils.strjoinNL(
+    "PREFIX fu:     <http://jena.apache.org/fuseki#>" ,
+    "PREFIX rdf:    <http://www.w3.org/1999/02/22-rdf-syntax-ns#>",
+    "PREFIX rdfs:   <http://www.w3.org/2000/01/rdf-schema#>",
+    "PREFIX tdb:    <http://jena.hpl.hp.com/2008/tdb#>",
+    "PREFIX list:   <http://jena.hpl.hp.com/ARQ/list#>",
+    "PREFIX list:   <http://jena.hpl.hp.com/ARQ/list#>",
+    "PREFIX xsd:     <http://www.w3.org/2001/XMLSchema#>",
+    "PREFIX apf:     <http://jena.hpl.hp.com/ARQ/property#>", 
+    "PREFIX afn:     <http://jena.hpl.hp.com/ARQ/function#>" ,
+    "") ;
+    
+    public static ServerConfig defaultConfiguration(String datasetPath, DatasetGraph dsg, boolean allowUpdate, boolean listenLocal)
+    {
+        DatasetRef dbDesc = new DatasetRef() ;
+        dbDesc.name = datasetPath ;
+        dbDesc.dataset = dsg ;
+        dbDesc.query.endpoints.add(HttpNames.ServiceQuery) ;
+        dbDesc.query.endpoints.add(HttpNames.ServiceQueryAlt) ;
+
+        if ( allowUpdate )
+        {
+            dbDesc.update.endpoints.add(HttpNames.ServiceUpdate) ;
+            dbDesc.upload.endpoints.add(HttpNames.ServiceUpload) ;
+            dbDesc.readWriteGraphStore.endpoints.add(HttpNames.ServiceData) ;
+            dbDesc.allowDatasetUpdate = true ;
+        }
+        else
+            dbDesc.readGraphStore.endpoints.add(HttpNames.ServiceData) ;
+        ServerConfig config = new ServerConfig() ;
+        config.datasets = Arrays.asList(dbDesc) ;
+        config.port = 3030 ;
+        config.mgtPort = 3031 ;
+        config.pagesPort = config.port ;
+        config.loopback = listenLocal ;
+        config.jettyConfigFile = null ;
+        config.pages = Fuseki.PagesStatic ;
+        config.enableCompression = true ;
+        config.verboseLogging = false ;
+        return config ;
+    }
+    
+    public static ServerConfig configure(String filename)
+    {
+        // Be absolutely sure everything has initialized.
+        // Some initialization registers assemblers and sets abbreviation vocabulary. 
+        ARQ.init();
+        TDB.init() ;
+        Fuseki.init() ;
+        Model m = FileManager.get().loadModel(filename) ;
+
+        // Find one server.
+        List<Resource> servers = getByType(FusekiVocab.tServer, m) ;
+        if ( servers.size() == 0 )
+            throw new FusekiConfigException("No server found (no resource with type "+strForResource(FusekiVocab.tServer)) ;
+        if ( servers.size() > 1 )
+            throw new FusekiConfigException(servers.size()+" servers found (must be exactly one in a configuration file)") ;
+        
+        // ---- Server 
+        Resource server = servers.get(0) ;
+        processServer(server) ;
+
+        // ---- Services
+        ResultSet rs = query("SELECT * { ?s fu:services [ list:member ?member ] }", m) ; 
+        if ( ! rs.hasNext() )
+            log.warn("No services found") ;
+        
+        List<DatasetRef> services =  new ArrayList<DatasetRef>() ; 
+        
+        for ( ; rs.hasNext() ; )
+        {
+            QuerySolution soln = rs.next() ;
+            Resource svc = soln.getResource("member") ;
+            DatasetRef sd = processService(svc) ;
+            services.add(sd) ;
+        }
+        
+        // TODO Properties for the other fields.
+        ServerConfig config = new ServerConfig() ;
+        config.datasets = services ;
+        config.port = 3030 ;
+        config.mgtPort = 3031 ;
+        config.pagesPort = config.port ;
+        config.jettyConfigFile = null ;
+        config.pages = Fuseki.PagesStatic ;
+        config.enableCompression = true ;
+        config.verboseLogging = false ;
+        return config ;
+    }
+    
+
+    // DatasetRef used where there isn't a real Dataset e.g. the SPARQL processor.  
+    
+    private static DatasetRef noDataset      = new DatasetRef() ;
+    private static DatasetGraph dummyDSG        = new DatasetGraphReadOnly(DatasetGraphFactory.createMemFixed()) ;
+    static {
+        noDataset.name = "" ;
+        noDataset.dataset = dummyDSG ;
+        noDataset.query.endpoints.add(HttpNames.ServiceQuery) ;
+        noDataset.query.endpoints.add(HttpNames.ServiceQueryAlt) ;
+        noDataset.allowDatasetUpdate = false ;
+        noDataset.init();
+        // Don't register it.  
+        // This is used as a placeholder and shoudl not be found by "all datasets"  
+        // DatasetRegistry.get().put("", noDataset) ;
+    }
+
+    /** Return the DatasetRef (read-only) for when there is no dataset, just a SPARQL Query processor */ 
+    public static DatasetRef serviceOnlyDatasetRef() { return noDataset ; }
+
+    private static void processServer(Resource server)
+    {
+        // Global, currently.
+        AssemblerUtils.setContext(server, Fuseki.getContext()) ;
+        
+        StmtIterator sIter = server.listProperties(JA.loadClass) ;
+        for( ; sIter.hasNext(); )
+        {
+            Statement s = sIter.nextStatement() ;
+            RDFNode rn = s.getObject() ;
+            String className = null ;
+            if ( rn instanceof Resource )
+            {
+                String uri = ((Resource)rn).getURI() ;
+                if ( uri == null )
+                {
+                    log.warn("Blank node for class to load") ;
+                    continue ;
+                }
+                String javaScheme = "java:" ;
+                if ( ! uri.startsWith(javaScheme) )
+                {
+                    log.warn("Class to load is not 'java:': "+uri) ;
+                    continue ;
+                }
+                className = uri.substring(javaScheme.length()) ;
+            }
+            if ( rn instanceof Literal )
+                className = ((Literal)rn).getLexicalForm() ; 
+            /*Loader.*/loadAndInit(className) ;
+        }
+        // ----
+    }
+
+    private static void loadAndInit(String className)
+    {
+        try {
+            Class<?> classObj = Class.forName(className);
+            log.info("Loaded "+className) ;
+            Method initMethod = classObj.getMethod("init");
+            initMethod.invoke(null);
+        } catch (ClassNotFoundException ex)
+        {
+            log.warn("Class not found: "+className);
+        } 
+        catch (Exception e)         { throw new FusekiConfigException(e) ; }
+    }
+
+    private static DatasetRef processService(Resource svc)
+    {
+        log.info("Service: "+nodeLabel(svc)) ;
+        DatasetRef sDesc = new DatasetRef() ;
+        sDesc.name = ((Literal)getOne(svc, "fu:name")).getLexicalForm() ;
+        log.info("  name = "+sDesc.name) ;
+
+        addServiceEP("query", sDesc.name, sDesc.query, svc, "fu:serviceQuery") ; 
+        addServiceEP("update", sDesc.name, sDesc.update, svc, "fu:serviceUpdate") ; 
+        addServiceEP("upload", sDesc.name, sDesc.upload, svc, "fu:serviceUpload") ;
+        addServiceEP("graphStore(RW)", sDesc.name, sDesc.readWriteGraphStore, svc, "fu:serviceReadWriteGraphStore") ;
+        addServiceEP("graphStore(R)", sDesc.name, sDesc.readGraphStore, svc, "fu:serviceReadGraphStore") ;
+        // Extract timeout overriding configuration if present.
+        if (svc.hasProperty(FusekiVocab.pAllowTimeoutOverride)) {
+            sDesc.allowTimeoutOverride = svc.getProperty(FusekiVocab.pAllowTimeoutOverride).getObject().asLiteral().getBoolean();
+            if (svc.hasProperty(FusekiVocab.pMaximumTimeoutOverride)) {
+                sDesc.maximumTimeoutOverride = (int) (svc.getProperty(FusekiVocab.pMaximumTimeoutOverride).getObject().asLiteral().getFloat() * 1000);
+            }
+        }
+        
+        Resource datasetDesc = ((Resource)getOne(svc, "fu:dataset")) ;
+
+        // Check if it is in the model.
+        if ( ! datasetDesc.hasProperty(RDF.type) )
+            throw new FusekiConfigException("No rdf:type for dataset "+nodeLabel(datasetDesc)) ;
+        
+        Dataset ds = (Dataset)Assembler.general.open(datasetDesc)  ;
+        sDesc.dataset = ds.asDatasetGraph() ; 
+        return sDesc ;
+        
+    }
+    
+    private static RDFNode getOne(Resource svc, String property)
+    {
+        String ln = property.substring(property.indexOf(':')+1) ;
+        ResultSet rs = query("SELECT * { ?svc "+property+" ?x}", svc.getModel(), "svc", svc) ;
+        if ( ! rs.hasNext() )
+            throw new FusekiConfigException("No "+ln+" for service "+nodeLabel(svc)) ;
+        RDFNode x = rs.next().get("x") ;
+        if ( rs.hasNext() )
+            throw new FusekiConfigException("Multiple "+ln+" for service "+nodeLabel(svc)) ;
+        return x ;
+    }
+    
+    private static List<Resource> getByType(Resource type, Model m)
+    {
+        ResIterator rIter = m.listSubjectsWithProperty(RDF.type, type) ;
+        return Iter.toList(rIter) ;
+    }
+
+    private static void addServiceEP(String label, String name, ServiceRef service, Resource svc, String property)
+    {
+        ResultSet rs = query("SELECT * { ?svc "+property+" ?ep}", svc.getModel(), "svc", svc) ;
+        for ( ; rs.hasNext() ; )
+        {
+            QuerySolution soln = rs.next() ;
+            String epName = soln.getLiteral("ep").getLexicalForm() ;
+            service.endpoints.add(epName) ;
+            log.info("  "+label+" = /"+name+"/"+epName) ;
+        }
+    }
+
+
+    private static ResultSet query(String string, Model m)
+    {
+        return query(string, m, null, null) ;
+    }
+
+    private static ResultSet query(String string, Model m, String varName, RDFNode value)
+    {
+        Query query = QueryFactory.create(prefixes+string) ;
+        QuerySolutionMap initValues = null ;
+        if ( varName != null )
+            initValues = querySolution(varName, value) ;
+        try(QueryExecution qExec = QueryExecutionFactory.create(query, m, initValues)) {
+            ResultSet rs = ResultSetFactory.copyResults(qExec.execSelect()) ;
+            return rs ;
+        }
+    }
+    
+    private static QuerySolutionMap querySolution(String varName, RDFNode value)
+    {
+        QuerySolutionMap qsm = new QuerySolutionMap() ;
+        querySolution(qsm, varName, value) ;
+        return qsm ;
+    }
+    
+    private static QuerySolutionMap querySolution(QuerySolutionMap qsm, String varName, RDFNode value)
+    {
+        qsm.add(varName, value) ;
+        return qsm ;
+    }
+    
+    // Node presentation
+    private static String nodeLabel(RDFNode n)
+    {
+        if ( n == null )
+            return "<null>" ;
+        if ( n instanceof Resource )
+            return strForResource((Resource)n) ;
+        
+        Literal lit = (Literal)n ;
+        return lit.getLexicalForm() ;
+    }
+    
+    private static String strForResource(Resource r) { return strForResource(r, r.getModel()) ; }
+    
+    private static String strForResource(Resource r, PrefixMapping pm)
+    {
+        if ( r == null )
+            return "NULL ";
+        if ( r.hasProperty(RDFS.label))
+        {
+            RDFNode n = r.getProperty(RDFS.label).getObject() ;
+            if ( n instanceof Literal )
+                return ((Literal)n).getString() ;
+        }
+        
+        if ( r.isAnon() )
+            return "<<blank node>>" ;
+
+        if ( pm == null )
+            pm = r.getModel() ;
+
+        return strForURI(r.getURI(), pm ) ;
+    }
+    
+    private static String strForURI(String uri, PrefixMapping pm)
+    {
+        if ( pm != null )
+        {
+            String x = pm.shortForm(uri) ;
+            
+            if ( ! x.equals(uri) )
+                return x ;
+        }
+        return "<"+uri+">" ;
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/main/java/org/apache/jena/fuseki/server/FusekiErrorHandler.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/java/org/apache/jena/fuseki/server/FusekiErrorHandler.java b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/server/FusekiErrorHandler.java
new file mode 100644
index 0000000..d1660f5
--- /dev/null
+++ b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/server/FusekiErrorHandler.java
@@ -0,0 +1,92 @@
+/*
+ * 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.fuseki.server;
+
+import static java.lang.String.format ;
+
+import java.io.* ;
+
+import javax.servlet.http.HttpServletRequest ;
+import javax.servlet.http.HttpServletResponse ;
+
+import org.apache.jena.fuseki.Fuseki ;
+import org.apache.jena.web.HttpSC ;
+import org.eclipse.jetty.http.HttpHeaders ;
+import org.eclipse.jetty.http.HttpMethods ;
+import org.eclipse.jetty.http.MimeTypes ;
+import org.eclipse.jetty.server.AbstractHttpConnection ;
+import org.eclipse.jetty.server.Request ;
+import org.eclipse.jetty.server.handler.ErrorHandler ;
+
+public class FusekiErrorHandler extends ErrorHandler
+{
+    @Override
+    public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException
+    {
+        AbstractHttpConnection connection = AbstractHttpConnection.getCurrentConnection();
+        connection.getRequest().setHandled(true);
+        String method = request.getMethod();
+     
+        if(!method.equals(HttpMethods.GET) && !method.equals(HttpMethods.POST) && !method.equals(HttpMethods.HEAD))
+            return;
+        
+        response.setContentType(MimeTypes.TEXT_PLAIN_UTF_8) ;
+        response.setHeader(HttpHeaders.CACHE_CONTROL, "must-revalidate,no-cache,no-store") ;
+        
+        ByteArrayOutputStream bytes = new ByteArrayOutputStream(1024) ;
+        //String writer = IO.UTF8(null) ;
+        try(Writer writer = new OutputStreamWriter(bytes, "UTF-8")) {
+
+            handleErrorPage(request, writer, connection.getResponse().getStatus(), connection.getResponse().getReason());
+
+            if ( ! Fuseki.VERSION.equalsIgnoreCase("development") )
+            {
+                writer.write("\n") ;
+                writer.write("\n") ;
+                writer.write(format("Fuseki - version %s (Build date: %s)\n", Fuseki.VERSION, Fuseki.BUILD_DATE)) ;
+            }
+            writer.flush();
+        }
+        response.setContentLength(bytes.size()) ;
+        // Copy
+        response.getOutputStream().write(bytes.toByteArray()) ;
+    }
+    
+    @Override
+    protected void handleErrorPage(HttpServletRequest request, Writer writer, int code, String message)
+        throws IOException
+    {
+        if ( message == null )
+            message = HttpSC.getMessage(code) ;
+        writer.write(format("Error %d: %s\n", code, message)) ;
+        
+        Throwable th = (Throwable)request.getAttribute("javax.servlet.error.exception");
+        while(th!=null)
+        {
+            writer.write("\n");
+            StringWriter sw = new StringWriter();
+            PrintWriter pw = new PrintWriter(sw);
+            th.printStackTrace(pw);
+            pw.flush();
+            writer.write(sw.getBuffer().toString());
+            writer.write("\n");
+            th = th.getCause();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/main/java/org/apache/jena/fuseki/server/FusekiServletContextListener.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/java/org/apache/jena/fuseki/server/FusekiServletContextListener.java b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/server/FusekiServletContextListener.java
new file mode 100644
index 0000000..f1c9642
--- /dev/null
+++ b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/server/FusekiServletContextListener.java
@@ -0,0 +1,43 @@
+/**
+ * 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.fuseki.server;
+
+import javax.servlet.ServletContextEvent ;
+import javax.servlet.ServletContextListener ;
+
+public class FusekiServletContextListener implements ServletContextListener {
+    // This could do the initialization. 
+    private final SPARQLServer sparqlServer ;
+    public FusekiServletContextListener(SPARQLServer sparqlServer) {
+        this.sparqlServer = sparqlServer ;
+    }
+
+    @Override
+    public void contextInitialized(ServletContextEvent sce) {
+//        Fuseki.serverLog.info("contextInitialized") ;
+//        for ( DatasetRef dsRef : sparqlServer.getDatasets() )
+//            Fuseki.serverLog.info("Dataset: "+dsRef.getName()) ;
+    }
+
+    @Override
+    public void contextDestroyed(ServletContextEvent sce) {
+//        Fuseki.serverLog.info("contextDestroyed") ;
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/main/java/org/apache/jena/fuseki/server/FusekiVocab.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/java/org/apache/jena/fuseki/server/FusekiVocab.java b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/server/FusekiVocab.java
new file mode 100644
index 0000000..d4d4e54
--- /dev/null
+++ b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/server/FusekiVocab.java
@@ -0,0 +1,62 @@
+/*
+ * 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.fuseki.server;
+
+import org.apache.jena.fuseki.FusekiException ;
+import org.apache.jena.iri.IRI ;
+import org.apache.jena.riot.system.IRIResolver ;
+
+import com.hp.hpl.jena.rdf.model.Property ;
+import com.hp.hpl.jena.rdf.model.Resource ;
+import com.hp.hpl.jena.rdf.model.ResourceFactory ;
+
+public class FusekiVocab
+{
+    public static String NS = "http://jena.apache.org/fuseki#" ;
+
+    public static final Resource tServer = resource("Server") ;
+
+    public static final Property pServices = property("services") ;
+    public static final Property pServiceName = property("name") ;
+    
+    public static final Property pServiceQueryEP = property("serviceQuery") ;
+    public static final Property pServiceUpdateEP = property("serviceUpdate") ;
+    public static final Property pServiceUploadEP = property("serviceUpload") ;
+    public static final Property pServiceReadWriteGraphStoreEP = property("serviceReadWriteGraphStore") ;
+    public static final Property pServiceReadgraphStoreEP = property("serviceReadGraphStore") ;
+
+    public static final Property pAllowTimeoutOverride = property("allowTimeoutOverride");
+    public static final Property pMaximumTimeoutOverride = property("maximumTimeoutOverride");
+
+    private static Resource resource(String localname) { return ResourceFactory.createResource(iri(localname)) ; }
+    private static Property property(String localname) { return ResourceFactory.createProperty(iri(localname)) ; }
+        
+    private static String iri(String localname)
+    {
+        String uri = NS+localname ;
+        IRI iri = IRIResolver.parseIRI(uri) ;
+        if ( iri.hasViolation(true) )
+            throw new FusekiException("Bad IRI: "+iri) ;
+        if ( ! iri.isAbsolute() )
+            throw new FusekiException("Bad IRI: "+iri) ;
+        
+        return uri ;
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/main/java/org/apache/jena/fuseki/server/SPARQLServer.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/java/org/apache/jena/fuseki/server/SPARQLServer.java b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/server/SPARQLServer.java
new file mode 100644
index 0000000..7448eb2
--- /dev/null
+++ b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/server/SPARQLServer.java
@@ -0,0 +1,484 @@
+/*
+ * 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.fuseki.server ;
+
+import static java.lang.String.format ;
+import static org.apache.jena.fuseki.Fuseki.serverLog ;
+
+import java.io.FileInputStream ;
+import java.util.* ;
+
+import javax.servlet.DispatcherType ;
+import javax.servlet.http.HttpServlet ;
+
+import org.apache.jena.atlas.lib.FileOps ;
+import org.apache.jena.fuseki.Fuseki ;
+import org.apache.jena.fuseki.FusekiException ;
+import org.apache.jena.fuseki.HttpNames ;
+import org.apache.jena.fuseki.mgt.ActionDataset ;
+import org.apache.jena.fuseki.mgt.MgtFunctions ;
+import org.apache.jena.fuseki.mgt.PageNames ;
+import org.apache.jena.fuseki.servlets.* ;
+import org.apache.jena.fuseki.validation.DataValidator ;
+import org.apache.jena.fuseki.validation.IRIValidator ;
+import org.apache.jena.fuseki.validation.QueryValidator ;
+import org.apache.jena.fuseki.validation.UpdateValidator ;
+import org.apache.jena.riot.WebContent ;
+import org.eclipse.jetty.http.MimeTypes ;
+import org.eclipse.jetty.security.* ;
+import org.eclipse.jetty.security.authentication.BasicAuthenticator ;
+import org.eclipse.jetty.server.Connector ;
+import org.eclipse.jetty.server.Server ;
+import org.eclipse.jetty.server.nio.BlockingChannelConnector ;
+import org.eclipse.jetty.servlet.DefaultServlet ;
+import org.eclipse.jetty.servlet.ServletContextHandler ;
+import org.eclipse.jetty.servlet.ServletHolder ;
+import org.eclipse.jetty.servlets.GzipFilter ;
+import org.eclipse.jetty.util.security.Constraint ;
+import org.eclipse.jetty.xml.XmlConfiguration ;
+
+import com.hp.hpl.jena.sparql.mgt.ARQMgt ;
+import com.hp.hpl.jena.sparql.util.Utils ;
+
+/**
+ * SPARQLServer is the Jena server instance which wraps/utilizes 
+ * {@link org.eclipse.jetty.server.Server}. This class provides
+ * immediate access to the {@link org.eclipse.jetty.server.Server#start()} and 
+ * {@link org.eclipse.jetty.server.Server#stop()} commands as well as obtaining
+ * instances of the server and server configuration. Finally we can obtain 
+ * instances of {@link org.apache.jena.fuseki.server.ServerConfig}.
+ *
+ */
+public class SPARQLServer {
+    static {
+        Fuseki.init() ;
+    }
+
+    private ServerConfig        serverConfig ;
+
+    private Server              server         = null ;
+    private static List<String> epDataset      = Arrays.asList("*") ;
+
+    /**
+     * Default constructor which requires a {@link org.apache.jena.fuseki.server.ServerConfig}
+     * object as input. We use this config to specify (verbose) logging, enable compression
+     * etc. 
+     * @param config
+     */
+    public SPARQLServer(ServerConfig config) {
+        this.serverConfig = config ;
+        // Currently server-wide.
+        Fuseki.verboseLogging = config.verboseLogging ;
+
+        // GZip compression
+        // Note that regardless of this setting we'll always leave it turned off
+        // for the servlets
+        // where it makes no sense to have it turned on e.g. update and upload
+
+        ServletContextHandler context = buildServer(serverConfig.jettyConfigFile, config.enableCompression) ;
+        configureDatasets(context) ;
+    }
+
+    private void configureDatasets(ServletContextHandler context) {
+        // Build them all.
+        for (DatasetRef dsDesc : serverConfig.datasets)
+            configureOneDataset(context, dsDesc, serverConfig.enableCompression) ;
+        
+    }
+    
+    /**
+     * Initialize the {@link SPARQLServer} instance.
+     */
+    public void start() {
+        String now = Utils.nowAsString() ;
+        serverLog.info(format("%s %s %s", Fuseki.NAME, Fuseki.VERSION, Fuseki.BUILD_DATE)) ;
+        // This does not get set usefully for Jetty as we use it.
+        // String jettyVersion = org.eclipse.jetty.server.Server.getVersion() ;
+        // serverLog.info(format("Jetty %s",jettyVersion)) ;
+        String host = server.getConnectors()[0].getHost() ;
+        if ( host != null )
+            serverLog.info("Incoming connections limited to " + host) ;
+        serverLog.info(format("Started %s on port %d", now, server.getConnectors()[0].getPort())) ;
+
+        try {
+            server.start() ;
+        } catch (java.net.BindException ex) {
+            serverLog.error("SPARQLServer: Failed to start server: " + ex.getMessage()) ;
+            System.exit(1) ;
+        } catch (Exception ex) {
+            serverLog.error("SPARQLServer: Failed to start server: " + ex.getMessage(), ex) ;
+            System.exit(1) ;
+        }
+
+        ServletContextHandler context = (ServletContextHandler)server.getHandler() ;
+    }
+
+    /**
+     * Stop the {@link SPARQLServer} instance.
+     */
+    public void stop() {
+        String now = Utils.nowAsString() ;
+        serverLog.info(format("Stopped %s on port %d", now, server.getConnectors()[0].getPort())) ;
+        try {
+            server.stop() ;
+        } catch (Exception ex) {
+            Fuseki.serverLog.warn("SPARQLServer: Exception while stopping server: " + ex.getMessage(), ex) ;
+        }
+        removeJMX() ;
+    }
+
+    /**
+     * Get the Jetty instance.
+     * @return Server
+     */
+    public Server getServer() {
+        return server ;
+    }
+
+    /**
+     * Get the datasets associated with the server.
+     * @return returns the datasets via {@link org.apache.jena.fuseki.server.ServerConfig#datasets}
+     */
+    public List<DatasetRef> getDatasets() {
+        return serverConfig.datasets ;
+    }
+
+    /**
+     * Obtain the {@link org.apache.jena.fuseki.server.ServerConfig}
+     * @return ServerConfig
+     */
+    public ServerConfig getServerConfig() {
+        return serverConfig ;
+    }
+
+    // Later : private and in constructor.
+    private ServletContextHandler buildServer(String jettyConfig, boolean enableCompression) {
+        if ( jettyConfig != null ) {
+            // --jetty-config=jetty-fuseki.xml
+            // for detailed configuration of the server using Jetty features.
+            server = configServer(jettyConfig) ;
+        } else
+            server = defaultServerConfig(serverConfig.port, serverConfig.loopback) ;
+        // Keep the server to a maximum number of threads.
+        // server.setThreadPool(new QueuedThreadPool(ThreadPoolSize)) ;
+
+        ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS) ;
+        context.setErrorHandler(new FusekiErrorHandler()) ;
+        context.addEventListener(new FusekiServletContextListener(this));
+        
+        // Increase form size.
+        context.getServletContext().getContextHandler().setMaxFormContentSize(10 * 1000 * 1000) ;
+
+        // Wire up authentication if appropriate
+        if ( jettyConfig == null && serverConfig.authConfigFile != null ) {
+            Constraint constraint = new Constraint() ;
+            constraint.setName(Constraint.__BASIC_AUTH) ;
+            constraint.setRoles(new String[]{"fuseki"}) ;
+            constraint.setAuthenticate(true) ;
+
+            ConstraintMapping mapping = new ConstraintMapping() ;
+            mapping.setConstraint(constraint) ;
+            mapping.setPathSpec("/*") ;
+
+            IdentityService identService = new DefaultIdentityService() ;
+
+            ConstraintSecurityHandler securityHandler = new ConstraintSecurityHandler() ;
+            securityHandler.addConstraintMapping(mapping) ;
+            securityHandler.setIdentityService(identService) ;
+
+            HashLoginService loginService = new HashLoginService("Fuseki Authentication", serverConfig.authConfigFile) ;
+            loginService.setIdentityService(identService) ;
+
+            securityHandler.setLoginService(loginService) ;
+            securityHandler.setAuthenticator(new BasicAuthenticator()) ;
+
+            context.setSecurityHandler(securityHandler) ;
+
+            serverLog.debug("Basic Auth Configuration = " + serverConfig.authConfigFile) ;
+        }
+
+        // Wire up context handler to server
+        server.setHandler(context) ;
+
+        // Constants. Add RDF types.
+        MimeTypes mt = new MimeTypes() ;
+        mt.addMimeMapping("rdf", WebContent.contentTypeRDFXML + ";charset=utf-8") ;
+        mt.addMimeMapping("ttl", WebContent.contentTypeTurtle + ";charset=utf-8") ;
+        mt.addMimeMapping("nt", WebContent.contentTypeNTriples + ";charset=ascii") ;
+        mt.addMimeMapping("nq", WebContent.contentTypeNQuads + ";charset=ascii") ;
+        mt.addMimeMapping("trig", WebContent.contentTypeTriG + ";charset=utf-8") ;
+
+        // mt.addMimeMapping("tpl", "text/html;charset=utf-8") ;
+        context.setMimeTypes(mt) ;
+        server.setHandler(context) ;
+
+        serverLog.debug("Pages = " + serverConfig.pages) ;
+
+        boolean installManager = true ;
+        boolean installServices = true ;
+
+        String validationRoot = "/validate" ;
+
+        // Should all services be /_/.... or some such?
+
+        if ( installManager || installServices ) {
+            // TODO Respect port.
+            if ( serverConfig.pagesPort != serverConfig.port )
+                serverLog.warn("Not supported yet - pages on a different port to services") ;
+             if ( serverConfig.pages != null ) {
+                 if ( ! FileOps.exists(serverConfig.pages) )
+                     serverLog.warn("No pages directory - "+serverConfig.pages) ;
+                String base = serverConfig.pages ;
+                Map<String, Object> data = new HashMap<String, Object>() ;
+                data.put("mgt", new MgtFunctions()) ;
+                SimpleVelocityServlet templateEngine = new SimpleVelocityServlet(base, data) ;
+                addServlet(context, templateEngine, "*.tpl", false) ;
+             }
+        }
+
+        if ( installManager ) {
+            // Action when control panel selects a dataset.
+            HttpServlet datasetChooser = new ActionDataset() ;
+            addServlet(context, datasetChooser, PageNames.actionDatasetNames, false) ;
+        }
+
+        if ( installServices ) {
+            // Validators
+            HttpServlet validateQuery = new QueryValidator() ;
+            HttpServlet validateUpdate = new UpdateValidator() ;
+            HttpServlet validateData = new DataValidator() ;
+            HttpServlet validateIRI = new IRIValidator() ;
+
+            HttpServlet dumpService = new DumpServlet() ;
+            HttpServlet generalQueryService = new SPARQL_QueryGeneral() ;
+
+            addServlet(context, validateQuery, validationRoot + "/query", false) ;
+            addServlet(context, validateUpdate, validationRoot + "/update", false) ;
+            addServlet(context, validateData, validationRoot + "/data", false) ;
+            addServlet(context, validateIRI, validationRoot + "/iri", false) ;
+
+            // general query processor.
+            addServlet(context, generalQueryService, HttpNames.ServiceGeneralQuery, enableCompression) ;
+        }
+
+        if ( installManager || installServices ) {
+            String[] files = {"fuseki.html", "index.html"} ;
+            context.setWelcomeFiles(files) ;
+            addContent(context, "/", serverConfig.pages) ;
+        }
+
+        return context ;
+    }
+
+    /** Experimental - off by default. The überservlet sits on the dataset name and handles all requests.
+      * Includes direct naming and quad access to the dataset. 
+      */
+    public static boolean       überServlet       = false ;
+    
+    private static List<String> ListOfEmptyString = Arrays.asList("") ;
+
+    private void configureOneDataset(ServletContextHandler context, DatasetRef dsDesc, boolean enableCompression) {
+        String datasetPath = dsDesc.name ;
+        if ( datasetPath.equals("/") )
+            datasetPath = "" ;
+        else
+            if ( !datasetPath.startsWith("/") )
+                datasetPath = "/" + datasetPath ;
+
+        if ( datasetPath.endsWith("/") )
+            datasetPath = datasetPath.substring(0, datasetPath.length() - 1) ;
+
+        dsDesc.init() ;
+
+        DatasetRegistry.get().put(datasetPath, dsDesc) ;
+        serverLog.info(format("Dataset path = %s", datasetPath)) ;
+
+        HttpServlet sparqlQuery = new SPARQL_QueryDataset() ;
+        HttpServlet sparqlUpdate = new SPARQL_Update() ;
+        HttpServlet sparqlUpload = new SPARQL_Upload() ;
+        HttpServlet sparqlHttpR = new SPARQL_REST_R() ;
+        HttpServlet sparqlHttpRW = new SPARQL_REST_RW() ;
+        HttpServlet sparqlDataset = new SPARQL_UberServlet.AccessByConfig() ;
+
+        if ( !überServlet ) {
+            // If uberserver, these are unnecessary but can be used.
+            // If just means the überservlet isn't handling these operations.
+            addServlet(context, datasetPath, sparqlQuery, dsDesc.query, enableCompression) ;
+            addServlet(context, datasetPath, sparqlUpdate, dsDesc.update, false) ;
+            addServlet(context, datasetPath, sparqlUpload, dsDesc.upload, false) ; // No point - no results of any size.
+            addServlet(context, datasetPath, sparqlHttpR, dsDesc.readGraphStore, enableCompression) ;
+            addServlet(context, datasetPath, sparqlHttpRW, dsDesc.readWriteGraphStore, enableCompression) ;
+            // This adds direct operations on the dataset itself.
+            // addServlet(context, datasetPath, sparqlDataset,
+            // ListOfEmptyString, enableCompression) ;
+        } else {
+            // This is the servlet that analyses requests and dispatches them to
+            // the appropriate servlet.
+            // SPARQL Query, SPARQL Update -- handles dataset?query=
+            // dataset?update=
+            // Graph Store Protocol (direct and indirect naming) if enabled.
+            // GET/PUT/POST on the dataset itself.
+            // It also checks for a request that looks like a service request
+            // and passes it
+            // on to the service (this takes precedence over direct naming).
+            addServlet(context, datasetPath, sparqlDataset, epDataset, enableCompression) ;
+        }
+
+        // Add JMX beans to record daatset and it's services.
+        addJMX(dsDesc) ;
+    }
+
+    private static Server configServer(String jettyConfig) {
+        try {
+            serverLog.info("Jetty server config file = " + jettyConfig) ;
+            Server server = new Server() ;
+            XmlConfiguration configuration = new XmlConfiguration(new FileInputStream(jettyConfig)) ;
+            configuration.configure(server) ;
+            return server ;
+        } catch (Exception ex) {
+            serverLog.error("SPARQLServer: Failed to configure server: " + ex.getMessage(), ex) ;
+            throw new FusekiException("Failed to configure a server using configuration file '" + jettyConfig + "'") ;
+        }
+    }
+
+    private static Server defaultServerConfig(int port, boolean loopback) {
+        // Server, with one NIO-based connector, large input buffer size (for
+        // long URLs, POSTed forms (queries, updates)).
+        Server server = new Server() ;
+
+        // Using "= new SelectChannelConnector() ;" on Darwin (OS/X) causes
+        // problems
+        // with initialization not seen (thread scheduling?) in Joseki.
+
+        // BlockingChannelConnector is better for pumping large responses back
+        // but there have been observed problems with DirectMemory allocation
+        // (-XX:MaxDirectMemorySize=1G does not help)
+        // Connector connector = new SelectChannelConnector() ;
+
+        // Connector and specific settings.
+        BlockingChannelConnector bcConnector = new BlockingChannelConnector() ;
+        // bcConnector.setUseDirectBuffers(false) ;
+
+        Connector connector = bcConnector ;
+        // Ignore. If set, then if this goes off, it keeps going off
+        // and you get a lot of log messages.
+        connector.setMaxIdleTime(0) ; // Jetty outputs a lot of messages if this
+                                      // goes off.
+        if ( loopback )
+            connector.setHost("localhost");
+        connector.setPort(port) ;
+        // Some people do try very large operations ...
+        connector.setRequestHeaderSize(64 * 1024) ;
+        connector.setRequestBufferSize(5 * 1024 * 1024) ;
+        connector.setResponseBufferSize(5 * 1024 * 1024) ;
+        server.addConnector(connector) ;
+        return server ;
+    }
+
+    private static void addContent(ServletContextHandler context, String pathSpec, String pages) {
+        DefaultServlet staticServlet = new DefaultServlet() ;
+        ServletHolder staticContent = new ServletHolder(staticServlet) ;
+        staticContent.setInitParameter("resourceBase", pages) ;
+
+        // Note we set GZip to false for static content because the Jetty
+        // DefaultServlet has
+        // a built-in GZip capability that is better for static content than the
+        // mechanism the
+        // GzipFilter uses for dynamic content
+        addServlet(context, staticContent, pathSpec, false) ;
+    }
+
+    private void addServlet(ServletContextHandler context, String datasetPath, HttpServlet servlet,
+                            ServiceRef serviceRef, boolean enableCompression) {
+        addServlet(context, datasetPath, servlet, serviceRef.endpoints, enableCompression) ;
+    }
+
+    // SHARE
+    private static void addServlet(ServletContextHandler context, String datasetPath, HttpServlet servlet,
+                                   List<String> pathSpecs, boolean enableCompression) {
+        for (String pathSpec : pathSpecs) {
+            if ( pathSpec.equals("") ) {
+                // "" is special -- add as "base" and "base/"
+                addServlet(context, servlet, datasetPath + "/", enableCompression) ;
+                addServlet(context, servlet, datasetPath, enableCompression) ;
+                continue ;
+            }
+
+            if ( pathSpec.endsWith("/") )
+                pathSpec = pathSpec.substring(0, pathSpec.length() - 1) ;
+            if ( pathSpec.startsWith("/") )
+                pathSpec = pathSpec.substring(1, pathSpec.length()) ;
+            addServlet(context, servlet, datasetPath + "/" + pathSpec, enableCompression) ;
+        }
+    }
+
+    private static void addServlet(ServletContextHandler context, HttpServlet servlet, String pathSpec,
+                                   boolean enableCompression) {
+        ServletHolder holder = new ServletHolder(servlet) ;
+        addServlet(context, holder, pathSpec, enableCompression) ;
+    }
+
+    private static void addServlet(ServletContextHandler context, ServletHolder holder, String pathSpec,
+                                   boolean enableCompression) {
+        if ( serverLog.isDebugEnabled() ) {
+            if ( enableCompression )
+                serverLog.debug("Add servlet @ " + pathSpec + " (with gzip)") ;
+            else
+                serverLog.debug("Add servlet @ " + pathSpec) ;
+        }
+        context.addServlet(holder, pathSpec) ;
+
+        if ( enableCompression )
+            context.addFilter(GzipFilter.class, pathSpec, EnumSet.allOf(DispatcherType.class)) ;
+    }
+
+    private void addJMX() {
+        DatasetRegistry registry = DatasetRegistry.get() ;
+        for (String ds : registry.keys()) {
+            DatasetRef dsRef = registry.get(ds) ;
+            addJMX(dsRef) ;
+        }
+    }
+
+    private void addJMX(DatasetRef dsRef) {
+        String x = dsRef.name ;
+        // if ( x.startsWith("/") )
+        // x = x.substring(1) ;
+        ARQMgt.register(Fuseki.PATH + ".dataset:name=" + x, dsRef) ;
+        // For all endpoints
+        for (ServiceRef sRef : dsRef.getServiceRefs()) {
+            ARQMgt.register(Fuseki.PATH + ".dataset:name=" + x + "/" + sRef.name, sRef) ;
+        }
+    }
+
+    private void removeJMX() {
+        DatasetRegistry registry = DatasetRegistry.get() ;
+        for (String ds : registry.keys()) {
+            DatasetRef ref = registry.get(ds) ;
+        }
+    }
+
+    private void removeJMX(DatasetRef dsRef) {
+        String x = dsRef.getName() ;
+        ARQMgt.unregister(Fuseki.PATH + ".dataset:name=" + x) ;
+        for (ServiceRef sRef : dsRef.getServiceRefs()) {
+            ARQMgt.unregister(Fuseki.PATH + ".dataset:name=" + x + "/" + sRef.name) ;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/main/java/org/apache/jena/fuseki/server/ServerConfig.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/java/org/apache/jena/fuseki/server/ServerConfig.java b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/server/ServerConfig.java
new file mode 100644
index 0000000..4e0b865
--- /dev/null
+++ b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/server/ServerConfig.java
@@ -0,0 +1,55 @@
+/**
+ * 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.fuseki.server;
+
+import java.util.List ;
+
+/** This represents a configuration of a SPARQL server.
+ */
+
+public class ServerConfig
+{
+    public ServerConfig() {}
+    
+    /** Port to run the server service on */
+    public int port ;
+    /** Port for the management interface : -1 for no management interface */ 
+    public int mgtPort ;
+    /** Port for the pages UI : this can be the same as the services port. */ 
+    public int pagesPort ;
+    /** Jetty config file - if null, use the built-in configuration of Jetty */
+    public String jettyConfigFile = null ;
+    /** Listen only on the loopback (localhost) interface */
+    public boolean loopback = false ;
+    /** The local directory for serving the static pages */ 
+    public String pages ;
+    /** The list of datasets */
+    public List<DatasetRef> datasets ;
+    /** Enable Accept-Encoding compression. Set to false by default.*/
+    public boolean enableCompression = false ;
+    
+    /** Enable additional logging */
+    public boolean verboseLogging = false ;
+    /**
+     * Authentication config file used to setup Jetty Basic auth, if a Jetty config file was set this is ignored since Jetty config allows much more complex auth methods to be implemented
+     */
+    public String authConfigFile ;
+
+}
+


[21/23] jena git commit: Rename folder jena-fuseki to jena-fuseki1

Posted by an...@apache.org.
Rename folder jena-fuseki to jena-fuseki1


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

Branch: refs/heads/master
Commit: 662cf71df29f2ed38f43f5e704a2d4a73cb7617d
Parents: 368d051
Author: Andy Seaborne <an...@apache.org>
Authored: Thu Mar 5 15:04:30 2015 +0000
Committer: Andy Seaborne <an...@apache.org>
Committed: Thu Mar 5 15:04:30 2015 +0000

----------------------------------------------------------------------
 jena-fuseki/.gitignore                          |   1 -
 jena-fuseki/DEPENDENCIES                        |  21 -
 jena-fuseki/Data/books.ttl                      |  62 --
 jena-fuseki/Data/test_abox.ttl                  |  21 -
 jena-fuseki/Data/test_data_rdfs.ttl             |  28 -
 jena-fuseki/Data/test_tbox.ttl                  |  25 -
 jena-fuseki/LICENSE                             | 224 ------
 jena-fuseki/NOTICE                              |  16 -
 jena-fuseki/ReleaseNotes.txt                    | 104 ---
 jena-fuseki/SEE_FUSEKI2                         |   0
 jena-fuseki/assembly-dist.xml                   |  82 ---
 jena-fuseki/assembly-soh.xml                    |  41 --
 jena-fuseki/config-examples.ttl                 | 123 ----
 jena-fuseki/config-inf-tdb.ttl                  |  52 --
 jena-fuseki/config-tdb-text.ttl                 |  93 ---
 jena-fuseki/config-tdb.ttl                      |  72 --
 jena-fuseki/config.ttl                          |  65 --
 jena-fuseki/dist/ABOUT                          |   1 -
 jena-fuseki/dist/LICENSE                        | 548 --------------
 jena-fuseki/dist/NOTICE                         | 216 ------
 jena-fuseki/fuseki                              | 399 -----------
 jena-fuseki/fuseki-server                       |  61 --
 jena-fuseki/fuseki-server.bat                   |  19 -
 jena-fuseki/jetty-fuseki.xml                    |  47 --
 jena-fuseki/make_cp_mvn                         |  52 --
 jena-fuseki/make_links                          |  10 -
 jena-fuseki/pages/books.ttl                     |  47 --
 jena-fuseki/pages/control-panel.tpl             |  41 --
 jena-fuseki/pages/data-validator.html           |  67 --
 jena-fuseki/pages/favicon.ico                   | Bin 1085 -> 0 bytes
 jena-fuseki/pages/fuseki.css                    | 148 ----
 jena-fuseki/pages/fuseki.html                   |  55 --
 jena-fuseki/pages/iri-validator.html            |  38 -
 jena-fuseki/pages/ping.txt                      |   1 -
 jena-fuseki/pages/query-validator.html          |  71 --
 jena-fuseki/pages/robots.txt                    |   2 -
 jena-fuseki/pages/sparql.html                   |  68 --
 jena-fuseki/pages/sparql.tpl                    |  96 ---
 jena-fuseki/pages/update-validator.html         |  62 --
 jena-fuseki/pages/xml-to-html-links.xsl         | 227 ------
 jena-fuseki/pages/xml-to-html-plain.xsl         | 187 -----
 jena-fuseki/pages/xml-to-html.xsl               | 187 -----
 jena-fuseki/pom.xml                             | 374 ----------
 jena-fuseki/run-fuseki                          |  64 --
 jena-fuseki/s-delete                            | 713 -------------------
 jena-fuseki/s-get                               | 713 -------------------
 jena-fuseki/s-head                              | 713 -------------------
 jena-fuseki/s-post                              | 713 -------------------
 jena-fuseki/s-put                               | 713 -------------------
 jena-fuseki/s-query                             | 713 -------------------
 jena-fuseki/s-update                            | 713 -------------------
 jena-fuseki/s-update-form                       | 713 -------------------
 jena-fuseki/soh                                 | 713 -------------------
 jena-fuseki/src-dev/dev/RunFuseki.java          |  90 ---
 .../main/java/org/apache/jena/fuseki/DEF.java   |  66 --
 .../jena/fuseki/EmbeddedFusekiServer.java       |  86 ---
 .../java/org/apache/jena/fuseki/Fuseki.java     | 174 -----
 .../java/org/apache/jena/fuseki/FusekiCmd.java  | 508 -------------
 .../jena/fuseki/FusekiConfigException.java      |  28 -
 .../org/apache/jena/fuseki/FusekiException.java |  29 -
 .../java/org/apache/jena/fuseki/FusekiLib.java  | 148 ----
 .../jena/fuseki/FusekiNotFoundException.java    |  26 -
 .../jena/fuseki/FusekiRequestException.java     |  57 --
 .../java/org/apache/jena/fuseki/HttpNames.java  |  94 ---
 .../main/java/org/apache/jena/fuseki/Test.java  |  25 -
 .../org/apache/jena/fuseki/conneg/ConNeg.java   | 205 ------
 .../org/apache/jena/fuseki/conneg/WebLib.java   |  60 --
 .../apache/jena/fuseki/mgt/ActionBackup.java    | 196 -----
 .../apache/jena/fuseki/mgt/ActionDataset.java   | 121 ----
 .../jena/fuseki/mgt/ManagementServer.java       |  99 ---
 .../apache/jena/fuseki/mgt/MgtCmdServlet.java   | 169 -----
 .../apache/jena/fuseki/mgt/MgtFunctions.java    | 180 -----
 .../org/apache/jena/fuseki/mgt/PageNames.java   |  33 -
 .../org/apache/jena/fuseki/mgt/PingServlet.java |  75 --
 .../apache/jena/fuseki/mgt/StatsServlet.java    | 171 -----
 .../jena/fuseki/migrate/GraphLoadUtils.java     |  76 --
 .../apache/jena/fuseki/migrate/Registry.java    |  42 --
 .../jena/fuseki/migrate/SinkRDFLimited.java     |  55 --
 .../org/apache/jena/fuseki/server/Counter.java  |  34 -
 .../jena/fuseki/server/CounterMXBean.java       |  25 -
 .../apache/jena/fuseki/server/CounterName.java  |  83 ---
 .../apache/jena/fuseki/server/CounterSet.java   |  70 --
 .../org/apache/jena/fuseki/server/Counters.java |  25 -
 .../jena/fuseki/server/DatasetMXBean.java       |  35 -
 .../apache/jena/fuseki/server/DatasetRef.java   | 241 -------
 .../jena/fuseki/server/DatasetRegistry.java     |  30 -
 .../apache/jena/fuseki/server/FusekiConfig.java | 374 ----------
 .../jena/fuseki/server/FusekiErrorHandler.java  |  92 ---
 .../server/FusekiServletContextListener.java    |  43 --
 .../apache/jena/fuseki/server/FusekiVocab.java  |  62 --
 .../apache/jena/fuseki/server/SPARQLServer.java | 484 -------------
 .../apache/jena/fuseki/server/ServerConfig.java |  55 --
 .../jena/fuseki/server/ServiceMXBean.java       |  32 -
 .../apache/jena/fuseki/server/ServiceRef.java   |  63 --
 .../fuseki/servlets/ActionErrorException.java   |  32 -
 .../fuseki/servlets/ConcurrencyPolicyMRSW.java  | 113 ---
 .../jena/fuseki/servlets/DumpServlet.java       | 313 --------
 .../apache/jena/fuseki/servlets/HttpAction.java | 290 --------
 .../servlets/HttpServletResponseTracker.java    | 140 ----
 .../jena/fuseki/servlets/NullOutputStream.java  |  53 --
 .../apache/jena/fuseki/servlets/REST_Quads.java | 211 ------
 .../jena/fuseki/servlets/ResponseCallback.java  |  24 -
 .../jena/fuseki/servlets/ResponseModel.java     | 143 ----
 .../jena/fuseki/servlets/ResponseOps.java       |  94 ---
 .../jena/fuseki/servlets/ResponseResultSet.java | 320 ---------
 .../jena/fuseki/servlets/SPARQL_Protocol.java   | 101 ---
 .../jena/fuseki/servlets/SPARQL_Query.java      | 387 ----------
 .../fuseki/servlets/SPARQL_QueryDataset.java    |  60 --
 .../fuseki/servlets/SPARQL_QueryGeneral.java    | 143 ----
 .../jena/fuseki/servlets/SPARQL_REST.java       | 354 ---------
 .../jena/fuseki/servlets/SPARQL_REST_R.java     | 128 ----
 .../jena/fuseki/servlets/SPARQL_REST_RW.java    | 232 ------
 .../fuseki/servlets/SPARQL_ServletBase.java     | 458 ------------
 .../fuseki/servlets/SPARQL_UberServlet.java     | 338 ---------
 .../jena/fuseki/servlets/SPARQL_Update.java     | 308 --------
 .../jena/fuseki/servlets/SPARQL_Upload.java     | 260 -------
 .../jena/fuseki/servlets/ServletBase.java       | 242 -------
 .../jena/fuseki/servlets/SimpleVelocity.java    |  78 --
 .../fuseki/servlets/SimpleVelocityServlet.java  | 178 -----
 .../jena/fuseki/validation/DataValidator.java   | 237 ------
 .../jena/fuseki/validation/IRIValidator.java    |  99 ---
 .../jena/fuseki/validation/QueryValidator.java  | 269 -------
 .../jena/fuseki/validation/UpdateValidator.java | 174 -----
 .../jena/fuseki/validation/ValidatorBase.java   | 120 ----
 .../src/main/resources/META-INF/DEPENDENCIES    |  24 -
 jena-fuseki/src/main/resources/META-INF/LICENSE | 202 ------
 jena-fuseki/src/main/resources/META-INF/NOTICE  |  16 -
 .../apache/jena/fuseki/fuseki-properties.xml    |   8 -
 .../java/org/apache/jena/fuseki/ServerTest.java | 111 ---
 .../java/org/apache/jena/fuseki/TS_Fuseki.java  |  61 --
 .../java/org/apache/jena/fuseki/TestAuth.java   | 429 -----------
 .../java/org/apache/jena/fuseki/TestQuery.java  | 117 ---
 .../apache/jena/fuseki/TestSPARQLProtocol.java  |  95 ---
 .../fuseki/http/TestDatasetAccessorHTTP.java    | 261 -------
 .../http/TestDatasetGraphAccessorHTTP.java      |  43 --
 .../org/apache/jena/fuseki/http/TestHttpOp.java | 214 ------
 jena-fuseki/src/test/resources/log4j.properties |  20 -
 jena-fuseki/tdb.ttl                             |  30 -
 jena-fuseki1/.gitignore                         |   1 +
 jena-fuseki1/DEPENDENCIES                       |  21 +
 jena-fuseki1/Data/books.ttl                     |  62 ++
 jena-fuseki1/Data/test_abox.ttl                 |  21 +
 jena-fuseki1/Data/test_data_rdfs.ttl            |  28 +
 jena-fuseki1/Data/test_tbox.ttl                 |  25 +
 jena-fuseki1/LICENSE                            | 224 ++++++
 jena-fuseki1/NOTICE                             |  16 +
 jena-fuseki1/ReleaseNotes.txt                   | 104 +++
 jena-fuseki1/SEE_FUSEKI2                        |   0
 jena-fuseki1/assembly-dist.xml                  |  82 +++
 jena-fuseki1/assembly-soh.xml                   |  41 ++
 jena-fuseki1/config-examples.ttl                | 123 ++++
 jena-fuseki1/config-inf-tdb.ttl                 |  52 ++
 jena-fuseki1/config-tdb-text.ttl                |  93 +++
 jena-fuseki1/config-tdb.ttl                     |  72 ++
 jena-fuseki1/config.ttl                         |  65 ++
 jena-fuseki1/dist/ABOUT                         |   1 +
 jena-fuseki1/dist/LICENSE                       | 548 ++++++++++++++
 jena-fuseki1/dist/NOTICE                        | 216 ++++++
 jena-fuseki1/fuseki                             | 399 +++++++++++
 jena-fuseki1/fuseki-server                      |  61 ++
 jena-fuseki1/fuseki-server.bat                  |  19 +
 jena-fuseki1/jetty-fuseki.xml                   |  47 ++
 jena-fuseki1/make_cp_mvn                        |  52 ++
 jena-fuseki1/make_links                         |  10 +
 jena-fuseki1/pages/books.ttl                    |  47 ++
 jena-fuseki1/pages/control-panel.tpl            |  41 ++
 jena-fuseki1/pages/data-validator.html          |  67 ++
 jena-fuseki1/pages/favicon.ico                  | Bin 0 -> 1085 bytes
 jena-fuseki1/pages/fuseki.css                   | 148 ++++
 jena-fuseki1/pages/fuseki.html                  |  55 ++
 jena-fuseki1/pages/iri-validator.html           |  38 +
 jena-fuseki1/pages/ping.txt                     |   1 +
 jena-fuseki1/pages/query-validator.html         |  71 ++
 jena-fuseki1/pages/robots.txt                   |   2 +
 jena-fuseki1/pages/sparql.html                  |  68 ++
 jena-fuseki1/pages/sparql.tpl                   |  96 +++
 jena-fuseki1/pages/update-validator.html        |  62 ++
 jena-fuseki1/pages/xml-to-html-links.xsl        | 227 ++++++
 jena-fuseki1/pages/xml-to-html-plain.xsl        | 187 +++++
 jena-fuseki1/pages/xml-to-html.xsl              | 187 +++++
 jena-fuseki1/pom.xml                            | 374 ++++++++++
 jena-fuseki1/run-fuseki                         |  64 ++
 jena-fuseki1/s-delete                           | 713 +++++++++++++++++++
 jena-fuseki1/s-get                              | 713 +++++++++++++++++++
 jena-fuseki1/s-head                             | 713 +++++++++++++++++++
 jena-fuseki1/s-post                             | 713 +++++++++++++++++++
 jena-fuseki1/s-put                              | 713 +++++++++++++++++++
 jena-fuseki1/s-query                            | 713 +++++++++++++++++++
 jena-fuseki1/s-update                           | 713 +++++++++++++++++++
 jena-fuseki1/s-update-form                      | 713 +++++++++++++++++++
 jena-fuseki1/soh                                | 713 +++++++++++++++++++
 jena-fuseki1/src-dev/dev/RunFuseki.java         |  90 +++
 .../main/java/org/apache/jena/fuseki/DEF.java   |  66 ++
 .../jena/fuseki/EmbeddedFusekiServer.java       |  86 +++
 .../java/org/apache/jena/fuseki/Fuseki.java     | 174 +++++
 .../java/org/apache/jena/fuseki/FusekiCmd.java  | 508 +++++++++++++
 .../jena/fuseki/FusekiConfigException.java      |  28 +
 .../org/apache/jena/fuseki/FusekiException.java |  29 +
 .../java/org/apache/jena/fuseki/FusekiLib.java  | 148 ++++
 .../jena/fuseki/FusekiNotFoundException.java    |  26 +
 .../jena/fuseki/FusekiRequestException.java     |  57 ++
 .../java/org/apache/jena/fuseki/HttpNames.java  |  94 +++
 .../main/java/org/apache/jena/fuseki/Test.java  |  25 +
 .../org/apache/jena/fuseki/conneg/ConNeg.java   | 205 ++++++
 .../org/apache/jena/fuseki/conneg/WebLib.java   |  60 ++
 .../apache/jena/fuseki/mgt/ActionBackup.java    | 196 +++++
 .../apache/jena/fuseki/mgt/ActionDataset.java   | 121 ++++
 .../jena/fuseki/mgt/ManagementServer.java       |  99 +++
 .../apache/jena/fuseki/mgt/MgtCmdServlet.java   | 169 +++++
 .../apache/jena/fuseki/mgt/MgtFunctions.java    | 180 +++++
 .../org/apache/jena/fuseki/mgt/PageNames.java   |  33 +
 .../org/apache/jena/fuseki/mgt/PingServlet.java |  75 ++
 .../apache/jena/fuseki/mgt/StatsServlet.java    | 171 +++++
 .../jena/fuseki/migrate/GraphLoadUtils.java     |  76 ++
 .../apache/jena/fuseki/migrate/Registry.java    |  42 ++
 .../jena/fuseki/migrate/SinkRDFLimited.java     |  55 ++
 .../org/apache/jena/fuseki/server/Counter.java  |  34 +
 .../jena/fuseki/server/CounterMXBean.java       |  25 +
 .../apache/jena/fuseki/server/CounterName.java  |  83 +++
 .../apache/jena/fuseki/server/CounterSet.java   |  70 ++
 .../org/apache/jena/fuseki/server/Counters.java |  25 +
 .../jena/fuseki/server/DatasetMXBean.java       |  35 +
 .../apache/jena/fuseki/server/DatasetRef.java   | 241 +++++++
 .../jena/fuseki/server/DatasetRegistry.java     |  30 +
 .../apache/jena/fuseki/server/FusekiConfig.java | 374 ++++++++++
 .../jena/fuseki/server/FusekiErrorHandler.java  |  92 +++
 .../server/FusekiServletContextListener.java    |  43 ++
 .../apache/jena/fuseki/server/FusekiVocab.java  |  62 ++
 .../apache/jena/fuseki/server/SPARQLServer.java | 484 +++++++++++++
 .../apache/jena/fuseki/server/ServerConfig.java |  55 ++
 .../jena/fuseki/server/ServiceMXBean.java       |  32 +
 .../apache/jena/fuseki/server/ServiceRef.java   |  63 ++
 .../fuseki/servlets/ActionErrorException.java   |  32 +
 .../fuseki/servlets/ConcurrencyPolicyMRSW.java  | 113 +++
 .../jena/fuseki/servlets/DumpServlet.java       | 313 ++++++++
 .../apache/jena/fuseki/servlets/HttpAction.java | 290 ++++++++
 .../servlets/HttpServletResponseTracker.java    | 140 ++++
 .../jena/fuseki/servlets/NullOutputStream.java  |  53 ++
 .../apache/jena/fuseki/servlets/REST_Quads.java | 211 ++++++
 .../jena/fuseki/servlets/ResponseCallback.java  |  24 +
 .../jena/fuseki/servlets/ResponseModel.java     | 143 ++++
 .../jena/fuseki/servlets/ResponseOps.java       |  94 +++
 .../jena/fuseki/servlets/ResponseResultSet.java | 320 +++++++++
 .../jena/fuseki/servlets/SPARQL_Protocol.java   | 101 +++
 .../jena/fuseki/servlets/SPARQL_Query.java      | 387 ++++++++++
 .../fuseki/servlets/SPARQL_QueryDataset.java    |  60 ++
 .../fuseki/servlets/SPARQL_QueryGeneral.java    | 143 ++++
 .../jena/fuseki/servlets/SPARQL_REST.java       | 354 +++++++++
 .../jena/fuseki/servlets/SPARQL_REST_R.java     | 128 ++++
 .../jena/fuseki/servlets/SPARQL_REST_RW.java    | 232 ++++++
 .../fuseki/servlets/SPARQL_ServletBase.java     | 458 ++++++++++++
 .../fuseki/servlets/SPARQL_UberServlet.java     | 338 +++++++++
 .../jena/fuseki/servlets/SPARQL_Update.java     | 308 ++++++++
 .../jena/fuseki/servlets/SPARQL_Upload.java     | 260 +++++++
 .../jena/fuseki/servlets/ServletBase.java       | 242 +++++++
 .../jena/fuseki/servlets/SimpleVelocity.java    |  78 ++
 .../fuseki/servlets/SimpleVelocityServlet.java  | 178 +++++
 .../jena/fuseki/validation/DataValidator.java   | 237 ++++++
 .../jena/fuseki/validation/IRIValidator.java    |  99 +++
 .../jena/fuseki/validation/QueryValidator.java  | 269 +++++++
 .../jena/fuseki/validation/UpdateValidator.java | 174 +++++
 .../jena/fuseki/validation/ValidatorBase.java   | 120 ++++
 .../src/main/resources/META-INF/DEPENDENCIES    |  24 +
 .../src/main/resources/META-INF/LICENSE         | 202 ++++++
 jena-fuseki1/src/main/resources/META-INF/NOTICE |  16 +
 .../apache/jena/fuseki/fuseki-properties.xml    |   8 +
 .../java/org/apache/jena/fuseki/ServerTest.java | 111 +++
 .../java/org/apache/jena/fuseki/TS_Fuseki.java  |  61 ++
 .../java/org/apache/jena/fuseki/TestAuth.java   | 429 +++++++++++
 .../java/org/apache/jena/fuseki/TestQuery.java  | 117 +++
 .../apache/jena/fuseki/TestSPARQLProtocol.java  |  95 +++
 .../fuseki/http/TestDatasetAccessorHTTP.java    | 261 +++++++
 .../http/TestDatasetGraphAccessorHTTP.java      |  43 ++
 .../org/apache/jena/fuseki/http/TestHttpOp.java | 214 ++++++
 .../src/test/resources/log4j.properties         |  20 +
 jena-fuseki1/tdb.ttl                            |  30 +
 pom.xml                                         |   4 +-
 277 files changed, 22628 insertions(+), 22628 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/.gitignore
----------------------------------------------------------------------
diff --git a/jena-fuseki/.gitignore b/jena-fuseki/.gitignore
deleted file mode 100644
index 54526a5..0000000
--- a/jena-fuseki/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-run_cp

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/DEPENDENCIES
----------------------------------------------------------------------
diff --git a/jena-fuseki/DEPENDENCIES b/jena-fuseki/DEPENDENCIES
deleted file mode 100644
index 7dece40..0000000
--- a/jena-fuseki/DEPENDENCIES
+++ /dev/null
@@ -1,21 +0,0 @@
-This file lists the dependences for Apache Jena Fuseki.
-  Version numbers are given in the POM file for a particular distribution. 
-
-Apache Projects:   Apache Software License
-  Apache Jena, including the Jena IRI library
-  Apache Xerces-J
-  Apache log4j
-  Apache HttpComponents (HTTP Client)
-  Apache Commons Codec
-  Apache Common FileUpload
-
-SLF4J : http://www.slf4j.org/
-  Copyright (c) 2004-2008 QOS.ch
-  MIT License
-
-JUnit : http://junit.org/
-  Common Public License - v 1.0
-
-Jetty: http://www.eclipse.org/jetty/
-  Apache License 2.0 
-  (also avilable under Eclipse Public License 1.0)

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/Data/books.ttl
----------------------------------------------------------------------
diff --git a/jena-fuseki/Data/books.ttl b/jena-fuseki/Data/books.ttl
deleted file mode 100644
index 7957323..0000000
--- a/jena-fuseki/Data/books.ttl
+++ /dev/null
@@ -1,62 +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.
-
-@prefix dc:        <http://purl.org/dc/elements/1.1/> .
-@prefix vcard:     <http://www.w3.org/2001/vcard-rdf/3.0#> .
-@prefix ns:        <http://example.org/ns#> .
-
-@prefix :          <http://example.org/book/> .
-
-# A small dataset for usage examples of Joseki
-# This data is intentionaly irregular (e.g. different ways to
-# record the book creator) as if the information is either an
-# aggregation or was created at different times.
-
-:book1
-    dc:title    "Harry Potter and the Philosopher's Stone" ;
-    dc:creator  "J.K. Rowling" ;
-    .
-    
-:book2
-    dc:title    "Harry Potter and the Chamber of Secrets" ;
-    dc:creator  _:a .
-    
-:book3
-    dc:title    "Harry Potter and the Prisoner Of Azkaban" ;
-    dc:creator  _:a .
-    
-:book4
-    dc:title    "Harry Potter and the Goblet of Fire" .
-    
-:book5
-    dc:title    "Harry Potter and the Order of the Phoenix";
-    dc:creator  "J.K. Rowling" ;
-    .
-
-:book6
-    dc:title    "Harry Potter and the Half-Blood Prince";
-    dc:creator  "J.K. Rowling" .
-
-:book7
-    dc:title    "Harry Potter and the Deathly Hallows" ;
-    dc:creator  "J.K. Rowling" .
-_:a
-    vcard:FN "J.K. Rowling" ;
-    vcard:N
-        [ vcard:Family "Rowling" ;
-          vcard:Given "Joanna" 
-        ]
-    .

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/Data/test_abox.ttl
----------------------------------------------------------------------
diff --git a/jena-fuseki/Data/test_abox.ttl b/jena-fuseki/Data/test_abox.ttl
deleted file mode 100644
index bb3939a..0000000
--- a/jena-fuseki/Data/test_abox.ttl
+++ /dev/null
@@ -1,21 +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.
-
-@prefix rdf:        <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
-@prefix :           <http://example/ns#> .
-
-:x rdf:type :A .
-

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/Data/test_data_rdfs.ttl
----------------------------------------------------------------------
diff --git a/jena-fuseki/Data/test_data_rdfs.ttl b/jena-fuseki/Data/test_data_rdfs.ttl
deleted file mode 100644
index 9e6daf1..0000000
--- a/jena-fuseki/Data/test_data_rdfs.ttl
+++ /dev/null
@@ -1,28 +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.
-
-@prefix rdf:        <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
-@prefix rdfs:       <http://www.w3.org/2000/01/rdf-schema#> .
-
-@prefix :           <http://example/ns#> .
-
-:A a rdfs:Class .
-:B a rdfs:Class .
-
-:A rdfs:subClassOf :B .
-
-:x rdf:type :A .
-

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/Data/test_tbox.ttl
----------------------------------------------------------------------
diff --git a/jena-fuseki/Data/test_tbox.ttl b/jena-fuseki/Data/test_tbox.ttl
deleted file mode 100644
index fae2124..0000000
--- a/jena-fuseki/Data/test_tbox.ttl
+++ /dev/null
@@ -1,25 +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.
-
-@prefix rdf:        <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
-@prefix rdfs:       <http://www.w3.org/2000/01/rdf-schema#> .
-
-@prefix :           <http://example/ns#> .
-
-:A a rdfs:Class .
-:B a rdfs:Class .
-
-:A rdfs:subClassOf :B .

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/LICENSE
----------------------------------------------------------------------
diff --git a/jena-fuseki/LICENSE b/jena-fuseki/LICENSE
deleted file mode 100644
index 5110d66..0000000
--- a/jena-fuseki/LICENSE
+++ /dev/null
@@ -1,224 +0,0 @@
-
-                                 Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-   END OF TERMS AND CONDITIONS
-
-   APPENDIX: How to apply the Apache License to your work.
-
-      To apply the Apache License to your work, attach the following
-      boilerplate notice, with the fields enclosed by brackets "[]"
-      replaced with your own identifying information. (Don't include
-      the brackets!)  The text should be enclosed in the appropriate
-      comment syntax for the file format. We also recommend that a
-      file or class name and description of purpose be included on the
-      same "printed page" as the copyright notice for easier
-      identification within third-party archives.
-
-   Copyright [yyyy] [name of copyright owner]
-
-   Licensed 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.
-
-- - - - - - - - - - - - - - - - - - - - - - - 
-
-==============================================================
- Jetty Web Container
- Copyright 1995-2012 Mort Bay Consulting Pty Ltd.
-==============================================================
-
-The Jetty Web Container is Copyright Mort Bay Consulting Pty Ltd
-unless otherwise noted.
-
-Jetty is dual licensed under both
-
-  * The Apache 2.0 License
-    http://www.apache.org/licenses/LICENSE-2.0.html
-
-      and
-
-  * The Eclipse Public 1.0 License
-    http://www.eclipse.org/legal/epl-v10.html
-
-Jetty may be distributed under either license.

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/NOTICE
----------------------------------------------------------------------
diff --git a/jena-fuseki/NOTICE b/jena-fuseki/NOTICE
deleted file mode 100644
index 1bf7fa8..0000000
--- a/jena-fuseki/NOTICE
+++ /dev/null
@@ -1,16 +0,0 @@
-Apache Jena - module Fuseki
-Copyright 2011, 2012, 2013, 2014, 2015 The Apache Software Foundation
-
-This product includes software developed at
-The Apache Software Foundation (http://www.apache.org/).
-
-Portions of this software were originally based on the following:
-  - Copyright 2005, 2006, 2007, 2008, 2009 Hewlett-Packard Development Company, LP
-  - Copyright 2010, 2011 Epimorphics Ltd.
-  - Copyright 2010, 2011 Talis Systems Ltd.
-These have been licensed to the Apache Software Foundation under a software grant.
-
-- - - - - - - - - - - - - - - - - - - - - - - 
-
-Portions of this software include software from  Mort Bay Consulting Pty. Ltd.
- - Copyright (c) 2004-2009 Mort Bay Consulting Pty. Ltd.

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/ReleaseNotes.txt
----------------------------------------------------------------------
diff --git a/jena-fuseki/ReleaseNotes.txt b/jena-fuseki/ReleaseNotes.txt
deleted file mode 100644
index c849d56..0000000
--- a/jena-fuseki/ReleaseNotes.txt
+++ /dev/null
@@ -1,104 +0,0 @@
-==== Fuseki
-
-== Fuseki 1.0.1
-
-+ JENA-600 : Support GZipped uploads correctly i.e. files with .foo.gz style
-             extensions
-
-== Fuseki 1.0.0
-This is the final version of what was 0.2.8
-
-== Fuseki 0.2.8
-
-+ jena-text added to the server : Lucene/solr backed search:
-  http://jena.apache.org/documentation/query/text-query.html
-  
-+ Upgrade to Jetty 8.1.11.v20130520  
-+ JENA-522 : Fix of occasional "Currently in a locked region" errors
-+ JENA-499 : --localhost will cause the server to only listen to the loopback interface
-
-== Fuseki 0.2.7
-
-+ JENA-422 : Improved service startup script (Linux)
-+ JENA-440 : Query timeouts fixed.  Fuseki behavior may change
-             to the reflect the fixes to ARQ in this area.
-+ Exact layout in output format Turtle may vary due to changes in Jena.
-+ JENA-439 : Return 503, not 408, on query timeout.
-+ JENA-433 : Absent Accept header could cause NPE.
-
-== Fuseki 0.2.6
-
-+ Upgrade to Jetty 8.1.8.v20121106
-+ Uses Jena 2.10.0.
-+ JENA-376 : Fuseki linux service script : Either use options as given or use defaults, not append defaults to any given.
-+ JENA-387 : Fuseki includes request ID in response headers as Fuseki-Request-ID to allow correlating problem HTTP responses with Fuseki log output
-+ JENA-309 : If supported by the underlying storage engine, Fuseki can exploit transactions in order to stream SPARQL Update requests
-
-== Fuseki 0.2.5
-
-+ JENA-334 - Fix for Fuseki start script fails when invoked with full pathname
-
-== Fuseki 0.2.4
-
-+ Upgrade Jetty dependency to 7.6.5.v20120716
-+ JENA-307 - Close QueryExecution object after query execution. 
-+ JENA-295 - Implement using-graph-uri= and using-named-graph-uri=
-+ Add support for default-graph-uri= and named-graph-uri= query parameters to a dataset.
-  It picks the specific graphs out of the dataset for the query. 
-
-== Fuseki 0.2.3
-
-+ Add a script to support running Fuseki as a service (JENA-268)
-+ (TDB change) Remove excessive and harmless warnings in log file.
-
-== Fuseki 0.2.2
-
-+ This version picks up bug fixes from TDB and ARQ.
-  This includes problems with concurrent operations.
-
-== Fuseki 0.2.1
-
-+ Switch from JSPs to Velocity.
-  This means the standalone jar does not contain a JSP engine anymore.  
-
-+ Service by configuration file, command line argument --config=
-
-+ Add a servlet filter that processes Accept-Encoding 
-  Result are now compressed if the client request asks for that (JENA-209)
-
-+ Rename packages to be org.apache.jena.fuseki.
-
-+ --jetty-config= Use a file to configure the jetty server (connector type, parms of connector like "host").  
-  Replaces --host.  See Jetty configuration documentation.
-
-+ General purpose SPARQL processor servlet written (not enabled)  
-
-+ XSLT style sheet for SPARQL XML results now puts clickable links in the results - query goes back to the server.
-
-+ JENA-74 (from Brian McBride): --host= to select the interface to listen on.  Use with --host=localhost if using Apache as a front-end. 
-
-+ Add --timeout: adds a timeout to all query executions
-
-+ Split logging into 2 loggers: general messages and per-request messages.
-  http://openjena.org/wiki/Fuseki#Logging
-
-== Fuseki 0.2.0
-
-+ Validators now include:
-  Query
-  Update
-  RDF (non-XML formats)
-  IRI
-
-+ HTTP request error pages now in "text/plain;charset=utf-8"
-+ Location of a TDB database must exist when server starts.
-
-+ Form parameter name for SPARQL Update sent by HTML form changed from request= to update=
-  Likely direction of SPARQL-WG.
-
-+ Internal consistency checking (also TDB internal consistecy checking).
-  You should not see any warnings.
-
-== Fuseki 0.1.0
-First release.
-

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/SEE_FUSEKI2
----------------------------------------------------------------------
diff --git a/jena-fuseki/SEE_FUSEKI2 b/jena-fuseki/SEE_FUSEKI2
deleted file mode 100644
index e69de29..0000000

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/assembly-dist.xml
----------------------------------------------------------------------
diff --git a/jena-fuseki/assembly-dist.xml b/jena-fuseki/assembly-dist.xml
deleted file mode 100644
index b1ba86b..0000000
--- a/jena-fuseki/assembly-dist.xml
+++ /dev/null
@@ -1,82 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-   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.
--->
-
-<!-- 
-The distribution.
-Assumes jar made and onejar has been assembled.
--->
-
-<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
-  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-  xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
-
-  <id>distribution</id>
-
-  <formats>
-    <format>zip</format>
-    <format>tar.gz</format>
-  </formats>
-
-  <baseDirectory>${project.artifactId}-${project.version}</baseDirectory>
-
-  <files>
-    <file>
-      <source>${project.build.directory}/${server.jar.name}.jar</source>
-      <outputDirectory></outputDirectory>
-      <destName>fuseki-server.jar</destName>
-    </file>
-    <!-- include sources in binary distribution?
-    <file>
-      <source>${project.artifactId}-${project.version}-sources.jar</source>
-      <outputDirectory></outputDirectory>
-    </file>
-    -->
-    <file>
-      <source>dist/LICENSE</source>
-      <destName>LICENSE</destName>
-    </file>
-    <file>
-      <source>dist/NOTICE</source>
-      <destName>NOTICE</destName>
-    </file>
-  </files>
-
-  <fileSets>
-    <fileSet>
-      <outputDirectory></outputDirectory>
-      <includes>
-        <include>README*</include>
-        <include>ReleaseNotes.txt</include>
-      </includes>
-    </fileSet>
-
-    <fileSet>
-      <outputDirectory></outputDirectory>
-      <includes>
-        <include>log4j.properties</include>
-        <include>fuseki</include>
-        <include>fuseki-server</include>
-        <include>fuseki-server.bat</include>
-        <include>config*.ttl</include>
-        <include>s-*</include>
-        <include>pages/*</include>
-        <include>Data/*</include>
-      </includes>
-    </fileSet>
-  </fileSets>
-</assembly>

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/assembly-soh.xml
----------------------------------------------------------------------
diff --git a/jena-fuseki/assembly-soh.xml b/jena-fuseki/assembly-soh.xml
deleted file mode 100644
index f379911..0000000
--- a/jena-fuseki/assembly-soh.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-   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.
--->
-<!-- 
-The SOH distribution.
--->
-
-<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
-  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-  xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
-
-  <id>soh</id>
-
-  <formats>
-    <format>zip</format>
-  </formats>
-
-  <baseDirectory>apache-${project.artifactId}-${project.version}</baseDirectory>
-
-  <fileSets>
-    <fileSet>
-      <includes>
-	<include>s-*</include>
-      </includes>
-    </fileSet>
-  </fileSets>
-</assembly>

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/config-examples.ttl
----------------------------------------------------------------------
diff --git a/jena-fuseki/config-examples.ttl b/jena-fuseki/config-examples.ttl
deleted file mode 100644
index cff5141..0000000
--- a/jena-fuseki/config-examples.ttl
+++ /dev/null
@@ -1,123 +0,0 @@
-# Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
-
-## A collection of example configurations for Fuseki
-
-@prefix :        <#> .
-@prefix fuseki:  <http://jena.apache.org/fuseki#> .
-@prefix rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
-
-@prefix rdfs:   <http://www.w3.org/2000/01/rdf-schema#> .
-@prefix tdb:     <http://jena.hpl.hp.com/2008/tdb#> .
-@prefix ja:      <http://jena.hpl.hp.com/2005/11/Assembler#> .
-
-[] rdf:type fuseki:Server ;
-   # Timeout - server-wide default: milliseconds.
-   # Format 1: "1000" -- 1 second timeout
-   # Format 2: "10000,60000" -- 10s timeout to first result, then 60s timeout to for rest of query.
-   # See java doc for ARQ.queryTimeout
-   # ja:context [ ja:cxtName "arq:queryTimeout" ;  ja:cxtValue "10000" ] ;
-
-   # ja:loadClass "your.code.Class" ;
-
-   fuseki:services (
-     <#service1>
-     <#service2>
-     <#service3>
-   ) .
-
-# Custom code.
-[] ja:loadClass "com.hp.hpl.jena.tdb.TDB" .
-
-# TDB
-tdb:DatasetTDB  rdfs:subClassOf  ja:RDFDataset .
-tdb:GraphTDB    rdfs:subClassOf  ja:Model .
-
-## ---------------------------------------------------------------
-## Updatable in-memory dataset.
-
-<#service1> rdf:type fuseki:Service ;
-    # URI of the dataset -- http://host:port/ds
-    fuseki:name                     "ds" ; 
-
-    # SPARQL query services e.g. http://host:port/ds/sparql?query=...
-    fuseki:serviceQuery             "sparql" ;
-    fuseki:serviceQuery             "query" ;
-    # SPARQL Update service -- http://host:port/ds/update?request=...
-    fuseki:serviceUpdate            "update" ;   # SPARQL query service -- /ds/update
-
-    # Upload service -- http://host:port/ds/upload?graph=default or ?graph=URI or ?default
-    # followed by a multipart body, each part being RDF syntax.
-    # Syntax determined by the file name extension.
-    fuseki:serviceUpload            "upload" ;   # Non-SPARQL upload service
-
-    # SPARQL Graph store protocol (read and write)
-    # GET, PUT, POST DELETE to http://host:port/ds/data?graph= or ?default=
-    fuseki:serviceReadWriteGraphStore      "data" ;     
-
-    # A separate read-only graph store endpoint:
-    fuseki:serviceReadGraphStore       "get" ;   # Graph store protocol (read only) -- /ds/get
-
-    fuseki:dataset           <#emptyDataset> ;
-    .
-
-## In-memory, initially empty.
-<#emptyDataset> rdf:type ja:RDFDataset .
-
-## ---------------------------------------------------------------
-## Read-only access to a small books database.
-
-<#service2> rdf:type fuseki:Service ;
-    fuseki:name                     "books" ;    # http://host:port/books
-    fuseki:serviceQuery             "query" ;    # SPARQL query service
-    fuseki:serviceReadGraphStore    "get" ;      # SPARQL Graph store protocol (read only)
-    fuseki:dataset                   <#books> ;
-    # Configuration
-    .
-    
-<#books>    rdf:type ja:RDFDataset ;
-    rdfs:label "Books" ;
-    ja:defaultGraph 
-      [ rdfs:label "books.ttl" ;
-        a ja:MemoryModel ;
-        ja:content [ja:externalContent <file:Data/books.ttl> ] ;
-      ] ;
-    .
-## ---------------------------------------------------------------
-## TDB dataset with only SPARQL query.
-
-<#service3>  rdf:type fuseki:Service ;
-    fuseki:name              "inf" ;             # http://host/inf
-    fuseki:serviceQuery      "sparql" ;          # SPARQL query service
-    fuseki:dataset           <#dataset> ;
-    .
-
-<#dataset> rdf:type       ja:RDFDataset ;
-    ja:defaultGraph       <#model_inf_2> ;
-     .
-
-# ---- RDFS Inference models
-# These must be incorporate in a dataset in order to use them.
-# All in one file.
-
-<#model_inf_1> a ja:InfModel ;
-    rdfs:label "Inf-1" ;
-    ja:baseModel 
-        [ a ja:MemoryModel ;
-          ja:content [ja:externalContent <file:Data/test_data_rdfs.ttl>] ;
-        ] ;
-    ja:reasoner
-         [ ja:reasonerURL <http://jena.hpl.hp.com/2003/RDFSExptRuleReasoner> ]
-    .
-
-# Separate ABox and TBox
-
-<#model_inf_2> a ja:InfModel ;
-    rdfs:label "Inf-2" ;
-    ja:baseModel 
-        [ a ja:MemoryModel ;
-          ja:content [ja:externalContent <file:Data/test_abox.ttl>] ;
-          ja:content [ja:externalContent <file:Data/test_tbox.ttl>] ;
-        ] ;
-    ja:reasoner
-         [ ja:reasonerURL <http://jena.hpl.hp.com/2003/RDFSExptRuleReasoner> ] 
-    . 

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/config-inf-tdb.ttl
----------------------------------------------------------------------
diff --git a/jena-fuseki/config-inf-tdb.ttl b/jena-fuseki/config-inf-tdb.ttl
deleted file mode 100644
index 6a4a08c..0000000
--- a/jena-fuseki/config-inf-tdb.ttl
+++ /dev/null
@@ -1,52 +0,0 @@
-# Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
-
-@prefix :        <#> .
-@prefix fuseki:  <http://jena.apache.org/fuseki#> .
-@prefix rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
-
-@prefix rdfs:   <http://www.w3.org/2000/01/rdf-schema#> .
-@prefix tdb:     <http://jena.hpl.hp.com/2008/tdb#> .
-@prefix ja:      <http://jena.hpl.hp.com/2005/11/Assembler#> .
-
-[] rdf:type fuseki:Server ;
-   fuseki:services (
-     <#service1>
-   ) .
-
-# Custom code.
-[] ja:loadClass "com.hp.hpl.jena.tdb.TDB" .
-
-# TDB
-tdb:DatasetTDB  rdfs:subClassOf  ja:RDFDataset .
-tdb:GraphTDB    rdfs:subClassOf  ja:Model .
-
-## ---------------------------------------------------------------
-## Service with only SPARQL query on an inference model.
-## Inference model bbase data in TDB.
-
-<#service1>  rdf:type fuseki:Service ;
-    fuseki:name              "inf" ;             # http://host/inf
-    fuseki:serviceQuery      "sparql" ;          # SPARQL query service
-    fuseki:serviceUpdate     "update" ;
-    fuseki:dataset           <#dataset> ;
-    .
-
-<#dataset> rdf:type       ja:RDFDataset ;
-    ja:defaultGraph       <#model_inf> ;
-     .
-
-<#model_inf> a ja:InfModel ;
-     ja:baseModel <#tdbGraph> ;
-     ja:reasoner [
-         ja:reasonerURL <http://jena.hpl.hp.com/2003/OWLFBRuleReasoner>
-     ] .
-
-<#tdbDataset> rdf:type tdb:DatasetTDB ;
-    tdb:location "DB" ;
-    # If the unionDefaultGraph is used, then the "update" service should be removed.
-    # The unionDefaultGraph is read only.
-    # tdb:unionDefaultGraph true ;
-    .
-
-<#tdbGraph> rdf:type tdb:GraphTDB ;
-    tdb:dataset <#tdbDataset> .

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/config-tdb-text.ttl
----------------------------------------------------------------------
diff --git a/jena-fuseki/config-tdb-text.ttl b/jena-fuseki/config-tdb-text.ttl
deleted file mode 100644
index e0ff09d..0000000
--- a/jena-fuseki/config-tdb-text.ttl
+++ /dev/null
@@ -1,93 +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.
-
-## Example of a TDB dataset and text index published using Fuseki
-
-@prefix :        <#> .
-@prefix fuseki:  <http://jena.apache.org/fuseki#> .
-@prefix rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
-@prefix rdfs:    <http://www.w3.org/2000/01/rdf-schema#> .
-@prefix tdb:     <http://jena.hpl.hp.com/2008/tdb#> .
-@prefix ja:      <http://jena.hpl.hp.com/2005/11/Assembler#> .
-@prefix text:    <http://jena.apache.org/text#> .
-
-[] rdf:type fuseki:Server ;
-   # Timeout - server-wide default: milliseconds.
-   # Format 1: "1000" -- 1 second timeout
-   # Format 2: "10000,60000" -- 10s timeout to first result, then 60s timeout to for rest of query.
-   # See java doc for ARQ.queryTimeout
-   # ja:context [ ja:cxtName "arq:queryTimeout" ;  ja:cxtValue "10000" ] ;
-   # ja:loadClass "your.code.Class" ;
-
-   fuseki:services (
-     <#service_text_tdb>
-   ) .
-
-# TDB
-[] ja:loadClass "com.hp.hpl.jena.tdb.TDB" .
-tdb:DatasetTDB  rdfs:subClassOf  ja:RDFDataset .
-tdb:GraphTDB    rdfs:subClassOf  ja:Model .
-
-# Text
-[] ja:loadClass "org.apache.jena.query.text.TextQuery" .
-text:TextDataset      rdfs:subClassOf   ja:RDFDataset .
-#text:TextIndexSolr    rdfs:subClassOf   text:TextIndex .
-text:TextIndexLucene  rdfs:subClassOf   text:TextIndex .
-
-## ---------------------------------------------------------------
-
-<#service_text_tdb> rdf:type fuseki:Service ;
-    rdfs:label                      "TDB/text service" ;
-    fuseki:name                     "ds" ;
-    fuseki:serviceQuery             "query" ;
-    fuseki:serviceQuery             "sparql" ;
-    fuseki:serviceUpdate            "update" ;
-    fuseki:serviceUpload            "upload" ;
-    fuseki:serviceReadGraphStore    "get" ;
-    fuseki:serviceReadWriteGraphStore    "data" ;
-    fuseki:dataset                  <#text_dataset> ;
-    .
-
-<#text_dataset> rdf:type     text:TextDataset ;
-    text:dataset   <#dataset> ;
-    ##text:index   <#indexSolr> ;
-    text:index     <#indexLucene> ;
-    .
-
-<#dataset> rdf:type      tdb:DatasetTDB ;
-    tdb:location "DB" ;
-    ##tdb:unionDefaultGraph true ;
-    .
-
-<#indexSolr> a text:TextIndexSolr ;
-    #text:server <http://localhost:8983/solr/COLLECTION> ;
-    text:server <embedded:SolrARQ> ;
-    text:entityMap <#entMap> ;
-    .
-
-<#indexLucene> a text:TextIndexLucene ;
-    text:directory <file:Lucene> ;
-    ##text:directory "mem" ;
-    text:entityMap <#entMap> ;
-    .
-
-<#entMap> a text:EntityMap ;
-    text:entityField      "uri" ;
-    text:defaultField     "text" ;        ## Should be defined in the text:map.
-    text:map (
-         # rdfs:label            
-         [ text:field "text" ; text:predicate rdfs:label ]
-         ) .

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/config-tdb.ttl
----------------------------------------------------------------------
diff --git a/jena-fuseki/config-tdb.ttl b/jena-fuseki/config-tdb.ttl
deleted file mode 100644
index 4194189..0000000
--- a/jena-fuseki/config-tdb.ttl
+++ /dev/null
@@ -1,72 +0,0 @@
-# Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
-
-## Example of a TDB dataset published using Fuseki: persistent storage.
-
-@prefix :        <#> .
-@prefix fuseki:  <http://jena.apache.org/fuseki#> .
-@prefix rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
-@prefix rdfs:    <http://www.w3.org/2000/01/rdf-schema#> .
-@prefix tdb:     <http://jena.hpl.hp.com/2008/tdb#> .
-@prefix ja:      <http://jena.hpl.hp.com/2005/11/Assembler#> .
-
-[] rdf:type fuseki:Server ;
-   # Timeout - server-wide default: milliseconds.
-   # Format 1: "1000" -- 1 second timeout
-   # Format 2: "10000,60000" -- 10s timeout to first result, then 60s timeout to for rest of query.
-   # See java doc for ARQ.queryTimeout
-   # ja:context [ ja:cxtName "arq:queryTimeout" ;  ja:cxtValue "10000" ] ;
-   # ja:loadClass "your.code.Class" ;
-
-   fuseki:services (
-     <#service_tdb_read_only>
-     <#service_tdb_all>
-   ) .
-
-# TDB
-[] ja:loadClass "com.hp.hpl.jena.tdb.TDB" .
-tdb:DatasetTDB  rdfs:subClassOf  ja:RDFDataset .
-tdb:GraphTDB    rdfs:subClassOf  ja:Model .
-
-## ---------------------------------------------------------------
-## Read-only TDB dataset (only read services enabled).
-
-<#service_tdb_read_only> rdf:type fuseki:Service ;
-    rdfs:label                      "TDB Service (R)" ;
-    fuseki:name                     "ds" ;
-    fuseki:serviceQuery             "query" ;
-    fuseki:serviceQuery             "sparql" ;
-    # Don't allow SPARQL Update.
-    #fuseki:serviceUpdate            "update" ;
-    # Use the read-only service.
-    fuseki:serviceReadGraphStore    "data" ;
-    fuseki:serviceReadGraphStore    "get" ;
-    fuseki:dataset           <#tdb_dataset_read> ;
-    .
-
-<#tdb_dataset_read> rdf:type      tdb:DatasetTDB ;
-    tdb:location "DB1" ;
-    tdb:unionDefaultGraph true ;
-    .
-
-## ---------------------------------------------------------------
-## Updatable TDB dataset with all services enabled.
-
-<#service_tdb_all> rdf:type fuseki:Service ;
-    rdfs:label                      "TDB Service (RW)" ;
-    fuseki:name                     "data" ;
-    fuseki:serviceQuery             "query" ;
-    fuseki:serviceQuery             "sparql" ;
-    fuseki:serviceUpdate            "update" ;
-    fuseki:serviceUpload            "upload" ;
-    fuseki:serviceReadWriteGraphStore      "data" ;
-    # A separate read-only graph store endpoint:
-    fuseki:serviceReadGraphStore       "get" ;
-    fuseki:dataset           <#tdb_dataset_readwrite> ;
-    .
-
-<#tdb_dataset_readwrite> rdf:type      tdb:DatasetTDB ;
-    tdb:location "DB2" ;
-##     # Query timeout on this dataset (milliseconds)
-##     ja:context [ ja:cxtName "arq:queryTimeout" ;  ja:cxtValue "1000" ] ;
-##     # Default graph for query is the (read-only) union of all named graphs.
-     .

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/config.ttl
----------------------------------------------------------------------
diff --git a/jena-fuseki/config.ttl b/jena-fuseki/config.ttl
deleted file mode 100644
index 5ea8cd0..0000000
--- a/jena-fuseki/config.ttl
+++ /dev/null
@@ -1,65 +0,0 @@
-# Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
-
-## Basic Fuseki configuation file.
-## 
-## See also config-tdb.ttl for TDB specific examples.
-## See also config-examples.ttl for commented examples.
-
-@prefix :        <#> .
-@prefix fuseki:  <http://jena.apache.org/fuseki#> .
-@prefix rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
-
-@prefix rdfs:    <http://www.w3.org/2000/01/rdf-schema#> .
-@prefix tdb:     <http://jena.hpl.hp.com/2008/tdb#> .
-@prefix ja:      <http://jena.hpl.hp.com/2005/11/Assembler#> .
-
-[] rdf:type fuseki:Server ;
-   # Timeout - server-wide default: milliseconds.
-   # Format 1: "1000" -- 1 second timeout
-   # Format 2: "10000,60000" -- 10s timeout to first result, then 60s timeout for the rest of query.
-   # See java doc for ARQ.queryTimeout
-   # ja:context [ ja:cxtName "arq:queryTimeout" ;  ja:cxtValue "10000" ] ;
-
-   # ja:loadClass "your.code.Class" ;
-
-   fuseki:services (
-     <#service1>
-     <#service2>
-   ) .
-
-## ---------------------------------------------------------------
-## Updatable in-memory dataset.
-
-<#service1> rdf:type fuseki:Service ;
-    # URI of the dataset -- http://host:port/ds
-    fuseki:name                        "ds" ; 
-    fuseki:serviceQuery                "sparql" ;
-    fuseki:serviceQuery                "query" ;
-    fuseki:serviceUpdate               "update" ;
-    fuseki:serviceUpload               "upload" ;
-    fuseki:serviceReadWriteGraphStore  "data" ;     
-    fuseki:serviceReadGraphStore       "get" ;
-    fuseki:dataset                     <#emptyDataset> ;
-    .
-
-## In-memory, initially empty.
-<#emptyDataset> rdf:type ja:RDFDataset .
-
-## ---------------------------------------------------------------
-## Read-only access to a small books database.
-
-<#service2> rdf:type fuseki:Service ;
-    fuseki:name                     "books" ;
-    fuseki:serviceQuery             "query" ;
-    fuseki:serviceReadGraphStore    "get" ;
-    fuseki:dataset                   <#books> ;
-    .
-    
-<#books>    rdf:type ja:RDFDataset ;
-    rdfs:label "Books" ;
-    ja:defaultGraph 
-      [ rdfs:label "books.ttl" ;
-        a ja:MemoryModel ;
-        ja:content [ja:externalContent <file:Data/books.ttl> ] ;
-      ] ;
-    .

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/dist/ABOUT
----------------------------------------------------------------------
diff --git a/jena-fuseki/dist/ABOUT b/jena-fuseki/dist/ABOUT
deleted file mode 100644
index cee2ca2..0000000
--- a/jena-fuseki/dist/ABOUT
+++ /dev/null
@@ -1 +0,0 @@
-This directory holds the material needed for inclusion in the Fuseki distribution.
\ No newline at end of file


[04/23] jena git commit: Rename folder jena-fuseki to jena-fuseki1

Posted by an...@apache.org.
http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/main/java/org/apache/jena/fuseki/server/ServiceMXBean.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/java/org/apache/jena/fuseki/server/ServiceMXBean.java b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/server/ServiceMXBean.java
new file mode 100644
index 0000000..11c7330
--- /dev/null
+++ b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/server/ServiceMXBean.java
@@ -0,0 +1,32 @@
+/**
+ * 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.fuseki.server;
+
+public interface ServiceMXBean
+{
+    String getName() ;
+    
+    long getRequests() ;
+    long getRequestsGood() ;
+    long getRequestsBad() ;
+    
+//    void enable() ;
+//    void disable() ;
+}
+

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/main/java/org/apache/jena/fuseki/server/ServiceRef.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/java/org/apache/jena/fuseki/server/ServiceRef.java b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/server/ServiceRef.java
new file mode 100644
index 0000000..6236050
--- /dev/null
+++ b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/server/ServiceRef.java
@@ -0,0 +1,63 @@
+/**
+ * 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.fuseki.server;
+
+import java.util.ArrayList ;
+import java.util.List ;
+
+/** Configuration of an individual service */
+public class ServiceRef implements ServiceMXBean, Counters
+{
+    public final String name ;
+    
+    // Service-level counters.
+    private final CounterSet counters           = new CounterSet() ;
+    @Override
+    public  CounterSet getCounters() { return counters ; }
+
+    /** Endpoints (as absolute path URLs) */
+    public List<String> endpoints               = new ArrayList<String>() ;
+    
+    // Attach counters to services or datasets 
+    // Can we have a counter of the same name on different services?
+    // Cost : number of maps.
+    // +ve: Multiple services with the same name counter
+    
+    public ServiceRef(String serviceName) {
+        this.name = serviceName ;
+    }
+    
+    public boolean isActive() { return endpoints.isEmpty() ; }
+
+    @Override
+    public String getName()     { return name ; }
+
+    @Override public long getRequests() { 
+        return counters.value(CounterName.Requests) ;
+    }
+    @Override
+    public long getRequestsGood() {
+        return counters.value(CounterName.RequestsGood) ;
+    }
+    @Override
+    public long getRequestsBad() {
+        return counters.value(CounterName.RequestsBad) ;
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/ActionErrorException.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/ActionErrorException.java b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/ActionErrorException.java
new file mode 100644
index 0000000..6c5ebe9
--- /dev/null
+++ b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/ActionErrorException.java
@@ -0,0 +1,32 @@
+/*
+ * 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.fuseki.servlets;
+
+class ActionErrorException extends RuntimeException
+{
+    final Throwable exception ;
+    final String message ;
+    final int rc ;
+    ActionErrorException(Throwable ex, String message, int rc)
+    {
+        this.exception = ex ;
+        this.message = message ;
+        this.rc = rc ;
+    }
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/ConcurrencyPolicyMRSW.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/ConcurrencyPolicyMRSW.java b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/ConcurrencyPolicyMRSW.java
new file mode 100644
index 0000000..259453d
--- /dev/null
+++ b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/ConcurrencyPolicyMRSW.java
@@ -0,0 +1,113 @@
+/*
+ * 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.fuseki.servlets;
+
+import java.util.ConcurrentModificationException ;
+import java.util.concurrent.atomic.AtomicLong ;
+
+import org.apache.jena.fuseki.Fuseki ;
+import org.slf4j.Logger ;
+
+public final class ConcurrencyPolicyMRSW
+{
+    static private Logger log = Fuseki.requestLog ; //org.slf4j.LoggerFactory.getLogger(ConcurrencyPolicyMRSW.class) ;
+    static private final boolean logging = false ; //log.isDebugEnabled() ;
+    
+    // This is a simplified version of ConcurrencyPolicyMRSW from TDB. 
+    private final AtomicLong readCounter = new AtomicLong(0) ;
+    private final AtomicLong writeCounter = new AtomicLong(0) ;
+    static private final AtomicLong policyCounter = new AtomicLong(0) ;
+
+    public ConcurrencyPolicyMRSW()
+    { policyCounter.incrementAndGet() ; }
+
+    // Loggin -inside the operation.
+    
+    //@Override
+    public void startRead()
+    {
+        readCounter.getAndIncrement() ;
+        log() ;
+        checkConcurrency() ;
+    }
+
+    //@Override
+    public void finishRead()
+    {
+        log() ;
+        readCounter.decrementAndGet() ;
+        checkConcurrency() ;
+    }
+
+    //@Override
+    public void startUpdate()
+    {
+        writeCounter.getAndIncrement() ;
+        log() ;
+        checkConcurrency() ;
+    }
+
+    //@Override
+    public void finishUpdate()
+    {
+        log() ;
+        writeCounter.decrementAndGet() ;
+        checkConcurrency() ;
+    }
+
+    private synchronized void checkConcurrency()
+    {
+        long R = readCounter.get() ;
+        long W = writeCounter.get() ;
+        long id = policyCounter.get();
+        if ( R > 0 && W > 0 )
+            policyError(id, R, W) ;
+        if ( W > 1 )
+            policyError(id, R, W) ;
+    }
+
+    private void log()
+    {
+        if ( ! logging ) 
+            return ;
+        long R , W , id ;
+        synchronized(this)
+        {
+            R = readCounter.get() ;
+            W = writeCounter.get() ;
+            id = policyCounter.get();
+        }
+        log.info(format(id, R, W)) ;
+    }
+    
+    private static void policyError(long id, long R, long W)
+    {
+        policyError(format(id, R, W)) ;
+    }
+
+    private static void policyError(String message)
+    {
+        throw new ConcurrentModificationException(message) ;
+    }
+    
+    private static String format(long id, long R, long W)
+    {
+        return String.format("(lock=%d) Reader = %d, Writer = %d", id, R, W) ;
+    }
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/DumpServlet.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/DumpServlet.java b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/DumpServlet.java
new file mode 100644
index 0000000..7ece249
--- /dev/null
+++ b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/DumpServlet.java
@@ -0,0 +1,313 @@
+/*
+ * 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.
+ */
+
+/** A servlet that dumps its request
+ */
+
+// Could be neater - much, much neater!
+package org.apache.jena.fuseki.servlets;
+
+import java.io.BufferedReader ;
+import java.io.IOException ;
+import java.io.PrintWriter ;
+import java.io.StringWriter ;
+import java.util.Date ;
+import java.util.Enumeration ;
+import java.util.Locale ;
+import java.util.Properties ;
+
+import javax.servlet.ServletContext ;
+import javax.servlet.http.Cookie ;
+import javax.servlet.http.HttpServlet ;
+import javax.servlet.http.HttpServletRequest ;
+import javax.servlet.http.HttpServletResponse ;
+
+public class DumpServlet extends HttpServlet
+{
+    private static final long serialVersionUID = 99L;  // Serilizable.
+
+
+    public DumpServlet()
+    {
+
+    }
+
+    @Override
+    public void init()
+    {
+        return ;
+    }
+
+    @Override
+    public void doGet(HttpServletRequest req, HttpServletResponse resp)
+    {
+        try {
+            PrintWriter out = resp.getWriter() ;
+            resp.setContentType("text/html");
+
+            String now = new Date().toString() ;
+
+            // HEAD
+            out.println("<html>") ;
+            out.println("<head>") ;
+            out.println("<Title>Dump @ "+now+"</Title>") ;
+            // Reduce the desire to cache it.
+            out.println("<meta CONTENT=now HTTP-EQUIV=expires>") ;
+            out.println("</head>") ;
+
+            // BODY
+            out.println("<body>") ;
+            out.println("<pre>") ;
+
+            out.println("Dump : "+now);
+            out.println() ;
+            out.println("==== Request");
+            out.println() ;
+            out.print(dumpRequest(req)) ;
+            out.println() ;
+                        
+            out.println(">>>> Body");
+            out.println() ;
+            printBody(out, req) ;
+            out.println("<<<< Body");
+            
+            out.println("==== ServletContext");
+            out.println() ;
+            out.print(dumpServletContext());
+            out.println() ;
+
+            out.println("==== Environment");
+            out.println() ;
+            out.print(dumpEnvironment());
+            out.println() ;
+
+            out.println("</pre>") ;
+
+            out.println("</body>") ;
+            out.println("</html>") ;
+            out.flush() ;
+        } catch (IOException e)
+        { }
+    }
+
+    // This resets the input stream
+
+    static public String dumpRequest(HttpServletRequest req)
+    { 
+         StringWriter sw = new StringWriter() ;
+         try( PrintWriter pw = new PrintWriter(sw) ) {
+            // Standard environment
+            pw.println("Method:                 "+req.getMethod());
+            pw.println("getContentLength:       "+Integer.toString(req.getContentLength()));
+            pw.println("getContentType:         "+req.getContentType());
+            pw.println("getRequestURI:          "+req.getRequestURI());
+            pw.println("getRequestURL:          "+req.getRequestURL());
+            pw.println("getContextPath:         "+req.getContextPath());
+            pw.println("getServletPath:         "+req.getServletPath());
+            pw.println("getPathInfo:            "+req.getPathInfo());
+            pw.println("getPathTranslated:      "+req.getPathTranslated());
+            pw.println("getQueryString:         "+req.getQueryString());
+            pw.println("getProtocol:            "+req.getProtocol());
+            pw.println("getScheme:              "+req.getScheme());
+            pw.println("getServerName:          "+req.getServerName());
+            pw.println("getServerPort:          "+req.getServerPort());
+            pw.println("getRemoteUser:          "+req.getRemoteUser());
+            pw.println("getRemoteAddr:          "+req.getRemoteAddr());
+            pw.println("getRemoteHost:          "+req.getRemoteHost());
+            pw.println("getRequestedSessionId:  "+req.getRequestedSessionId());
+            {
+                Cookie c[] = req.getCookies() ;
+                if ( c == null )
+                    pw.println("getCookies:            <none>");
+                else
+                {
+                    for ( Cookie aC : c )
+                    {
+                        pw.println( "Cookie:        " + aC.getName() );
+                        pw.println( "    value:     " + aC.getValue() );
+                        pw.println( "    version:   " + aC.getVersion() );
+                        pw.println( "    comment:   " + aC.getComment() );
+                        pw.println( "    domain:    " + aC.getDomain() );
+                        pw.println( "    maxAge:    " + aC.getMaxAge() );
+                        pw.println( "    path:      " + aC.getPath() );
+                        pw.println( "    secure:    " + aC.getSecure() );
+                        pw.println();
+                    }
+                }
+            }
+            
+            {
+                // To do: create a string for the output so can send to console and return it.
+                Enumeration<String> en = req.getHeaderNames() ;
+
+                for ( ; en.hasMoreElements() ; )
+                {
+                    String name = en.nextElement() ;
+                    String value = req.getHeader(name) ;
+                    pw.println("Head: "+name + " = " + value) ;
+                }
+            }
+            
+            Enumeration<String> en2 = req.getAttributeNames() ;
+            if ( en2.hasMoreElements() )
+                pw.println();
+            for ( ; en2.hasMoreElements() ; )
+            {
+                String name = en2.nextElement() ;
+                String value = req.getAttribute(name).toString() ;
+                pw.println("Attr: "+name + " = " + value) ;
+            }
+
+            // Note that doing this on a form causes the forms content (body) to be read
+            // and parsed as form variables.
+//            en = req.getParameterNames() ;
+//            if ( en.hasMoreElements() )
+//                pw.println();
+//            for ( ; en.hasMoreElements() ; )
+//            {
+//                String name = (String)en.nextElement() ;
+//                String value = req.getParameter(name) ;
+//                pw.println("Param: "+name + " = " + value) ;
+//            }
+
+
+            
+//            MultiMap<String, String> map = WebLib.parseQueryString(req) ;
+//            for ( String name : map.keys() )
+//                for ( String value : map.get(name) )
+//                    pw.println("Param: "+name + " = " + value) ;
+            
+            Enumeration<Locale> en = req.getLocales() ;
+            if ( en.hasMoreElements() )
+                pw.println();
+            for ( ; en.hasMoreElements() ; )
+            {
+                String name = en.nextElement().toString() ;
+                pw.println("Locale: "+name) ;
+            }
+
+            pw.println() ;
+            pw.flush();
+            //printBody(pw, req) ;
+            return sw.toString() ;
+        }
+         
+    }
+
+    static void printBody(PrintWriter pw, HttpServletRequest req) throws IOException
+    {
+        BufferedReader in = req.getReader() ;
+        if ( req.getContentLength() > 0 )
+            // Need +2 because last line may not have a CR/LF on it.
+            in.mark(req.getContentLength()+2) ;
+        else
+            // This is a dump - try to do something that works, even if inefficient.
+            in.mark(100*1024) ;
+
+        while(true)
+        {
+            String x = in.readLine() ;
+            if ( x == null )
+                break ;
+            x = x.replaceAll("&", "&amp;") ;
+            x = x.replaceAll("<", "&lt;") ;
+            x = x.replaceAll(">", "&gt;") ;
+            pw.println(x) ;
+        }
+        try { in.reset() ;} catch (IOException e) { System.out.println("DumpServlet: Reset of content failed: "+e) ; }
+    }
+    
+    /**
+     * <code>dumpEnvironment</code>
+     * @return String that is the HTML of the System properties as name/value pairs.
+     * The values are with single quotes independent of whether or not the value has
+     * single quotes in it.
+     */
+    static public String dumpEnvironment()
+    {
+        Properties properties = System.getProperties();
+
+        StringWriter sw = new StringWriter() ;
+        try(PrintWriter pw = new PrintWriter(sw) ) {
+            Enumeration<Object> en = properties.keys();
+            while(en.hasMoreElements())
+            {
+                String key = en.nextElement().toString();
+                pw.println(key+": '"+properties.getProperty(key)+"'");
+            }
+            pw.println() ;
+            pw.flush() ;
+            return sw.toString() ; 
+        }
+    }
+
+    public String dumpServletContext()
+    {
+        StringWriter sw = new StringWriter() ;
+        try(PrintWriter pw = new PrintWriter(sw)) {
+
+            ServletContext sc =  getServletContext();
+            pw.println("majorVersion: '"+sc.getMajorVersion()+"'");
+            pw.println("minorVersion: '"+sc.getMinorVersion()+"'");
+            pw.println("contextName:  '"+sc.getServletContextName()+"'");
+            pw.println("servletInfo:  '"+getServletInfo()+"'");
+            pw.println("serverInfo:  '"+sc.getServerInfo()+"'");
+
+            {
+                Enumeration<String> en = sc.getInitParameterNames();
+                if (en != null) {
+                    pw.println("initParameters: ");
+                    while(en.hasMoreElements())
+                    {
+                        String key = en.nextElement();
+                        pw.println(key+": '"+sc.getInitParameter(key)+"'");
+                    }
+                }
+            }
+
+            {
+                Enumeration<String> en = sc.getAttributeNames();
+                if (en != null) {
+                    pw.println("attributes: ");
+                    while(en.hasMoreElements())
+                    {
+                        String key = en.nextElement();
+                        pw.println(key+": '"+sc.getAttribute(key)+"'");
+                    }
+                }
+            }
+            pw.println() ;
+            pw.close() ;
+        }
+        return sw.toString() ;      
+    }
+
+    
+    @Override
+    public void doPost(HttpServletRequest req, HttpServletResponse resp)
+    {
+        doGet(req, resp) ;
+    }
+
+
+    @Override
+    public String getServletInfo()
+    {
+        return "Dump";
+    }
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/HttpAction.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/HttpAction.java b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/HttpAction.java
new file mode 100644
index 0000000..39663dd
--- /dev/null
+++ b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/HttpAction.java
@@ -0,0 +1,290 @@
+/*
+ * 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.fuseki.servlets;
+
+import static com.hp.hpl.jena.query.ReadWrite.READ ;
+import static com.hp.hpl.jena.query.ReadWrite.WRITE ;
+
+import java.util.HashMap ;
+import java.util.Map ;
+
+import javax.servlet.http.HttpServletRequest ;
+import javax.servlet.http.HttpServletResponse ;
+
+import org.apache.jena.atlas.logging.Log ;
+import org.apache.jena.atlas.web.MediaType ;
+import org.apache.jena.fuseki.DEF ;
+import org.apache.jena.fuseki.conneg.ConNeg ;
+import org.apache.jena.fuseki.server.DatasetRef ;
+import org.apache.jena.fuseki.server.ServiceRef ;
+
+import com.hp.hpl.jena.query.ReadWrite ;
+import com.hp.hpl.jena.sparql.SystemARQ ;
+import com.hp.hpl.jena.sparql.core.DatasetGraph ;
+import com.hp.hpl.jena.sparql.core.DatasetGraphWithLock ;
+import com.hp.hpl.jena.sparql.core.DatasetGraphWrapper ;
+import com.hp.hpl.jena.sparql.core.Transactional ;
+
+/**
+ * HTTP action that represents the user request lifecycle. Its state is handled in the
+ * {@link SPARQL_ServletBase#executeLifecycle(HttpAction)} method.
+ */
+public class HttpAction
+{
+    public final long id ;
+    public final boolean verbose ;
+    
+    // Phase two items - set and valida after the datasetRef is known.  
+    private DatasetGraph dsg ;                  // The data
+    public DatasetRef dsRef ;
+    public ServiceRef srvRef ;
+    
+    private Transactional transactional ;
+    private boolean isTransactional;
+    private DatasetGraph    activeDSG ;             // Set when inside begin/end.
+    private ReadWrite       activeMode ;            // Set when inside begin/end.
+    
+    private boolean startTimeIsSet = false ;
+    private boolean finishTimeIsSet = false ;
+
+    private long startTime = -2 ;
+    private long finishTime = -2 ;
+    
+    // Incoming
+    //public final 
+    
+    // Outcome.
+    int statusCode = -1 ;
+    String message = null ;
+    int contentLength = -1 ;
+    String contentType = null ;
+    
+    // Cleared to archive:
+    Map <String, String> headers = new HashMap<String, String>() ;
+    public HttpServletRequest request;
+    public HttpServletResponseTracker response ;
+
+    /**
+     * Creates a new HTTP Action, using the HTTP request and response, and a given ID.
+     *
+     * @param id given ID
+     * @param request HTTP request
+     * @param response HTTP response
+     * @param verbose verbose flag
+     */
+    public HttpAction(long id, HttpServletRequest request, HttpServletResponse response, boolean verbose) {
+        this.id = id ;
+        this.request = request ;
+        this.response = new HttpServletResponseTracker(this, response) ;
+        // Should this be set when setDataset is called from the dataset context?
+        // Currently server-wide, e.g. from the command line.
+        this.verbose = verbose ;
+    }
+
+    /**
+     * <p>Sets the action dataset. Setting a {@link DatasetRef} will replace any existing DatasetRef, as well as
+     * as the {@link DatasetGraph} of the current HTTP Action.</p>
+     *
+     * <p>Once it has updated its members, the HTTP Action will change its transactional state and
+     * {@link Transactional} instance according to its base dataset graph.</p>
+     *
+     * @param desc {@link DatasetRef}
+     * @see Transactional
+     * @see DatasetGraphWrapper
+     */
+    public void setDataset(DatasetRef desc) {
+        this.dsRef = desc ;
+        this.dsg = desc.dataset ;
+        DatasetGraph basedsg = unwrap(dsg) ;
+
+        if ( isTransactional(basedsg) && isTransactional(dsg) ) {
+            // Use transactional if it looks safe - abort is necessary.
+            transactional = (Transactional)dsg ;
+            isTransactional = true ;
+        } else {
+            // Unsure if safe
+            transactional = new DatasetGraphWithLock(dsg) ;
+            // No real abort.
+            isTransactional = false ;
+        }
+    }
+
+    /**
+     * Returns <code>true</code> iff the given {@link DatasetGraph} is an instance of {@link Transactional},
+     * <code>false otherwise</code>.
+     *
+     * @param dsg a {@link DatasetGraph}
+     * @return <code>true</code> iff the given {@link DatasetGraph} is an instance of {@link Transactional},
+     * <code>false otherwise</code>
+     */
+    private static boolean isTransactional(DatasetGraph dsg) {
+        return (dsg instanceof Transactional) ;
+    }
+
+    /**
+     * A {@link DatasetGraph} may contain other <strong>wrapped DatasetGraph's</strong>. This method will return
+     * the first instance (including the argument to this method) that <strong>is not</strong> an instance of
+     * {@link DatasetGraphWrapper}.
+     *
+     * @param dsg a {@link DatasetGraph}
+     * @return the first found {@link DatasetGraph} that is not an instance of {@link DatasetGraphWrapper}
+     */
+    private static DatasetGraph unwrap(DatasetGraph dsg) {
+        while (dsg instanceof DatasetGraphWrapper) {
+            dsg = ((DatasetGraphWrapper)dsg).getWrapped() ;
+        }
+        return dsg ;
+    }
+
+    /**
+     * Sets the {@link ServiceRef}.
+     *
+     * @param srvRef a {@link ServiceRef}
+     */
+    public void setService(ServiceRef srvRef) {
+        this.srvRef = srvRef ; 
+    }
+    
+    /**
+     * Returns whether or not the underlying DatasetGraph is fully transactional (supports rollback).
+     * @return <code>true</code> if the underlying DatasetGraph is fully transactional (supports rollback),
+     * <code>false</code> otherwise.
+     */
+    public boolean isTransactional() {
+        return isTransactional ;
+    }
+
+    public void beginRead() {
+        activeMode = READ ;
+        transactional.begin(READ) ;
+        activeDSG = dsg ;
+        dsRef.startTxn(READ) ;
+    }
+
+    public void endRead() {
+        dsRef.finishTxn(READ) ;
+        activeMode = null ;
+        transactional.end() ;
+        activeDSG = null ;
+    }
+
+    public void beginWrite() {
+        transactional.begin(WRITE) ;
+        activeMode = WRITE ;
+        activeDSG = dsg ;
+        dsRef.startTxn(WRITE) ;
+    }
+
+    public void commit() {
+        transactional.commit() ;
+        activeDSG = null ;
+    }
+
+    public void abort() {
+        try { transactional.abort() ; } 
+        catch (Exception ex) {
+            // Some datasets claim to be transactional but
+            // don't provide a real abort. We tried to avoid
+            // them earlier but even if they sneek through,
+            // we try to continue server operation.
+            Log.warn(this, "Exception during abort (operation attempts to continue): "+ex.getMessage()) ; 
+        }
+        activeDSG = null ;
+    }
+
+    public void endWrite() {
+        dsRef.finishTxn(WRITE) ;
+        activeMode = null ;
+
+        if ( transactional.isInTransaction() ) {
+            Log.warn(this, "Transaction still active in endWriter - no commit or abort seen (forced abort)") ;
+            try {
+                transactional.abort() ;
+            } catch (RuntimeException ex) {
+                Log.warn(this, "Exception in forced abort (trying to continue)", ex) ;
+            }
+        }
+        transactional.end() ;
+        activeDSG = null ;
+    }
+   
+    public final DatasetGraph getActiveDSG() {
+        return activeDSG ;
+    }
+
+    public final DatasetRef getDatasetRef() {
+        return dsRef ;
+    }
+
+    /** Reduce to a size that can be kept around for sometime */
+    public void minimize() {
+        this.request = null ;
+        this.response = null ;
+    }
+
+    public void setStartTime() {
+        if ( startTimeIsSet ) 
+            Log.warn(this,  "Start time reset") ;
+        startTimeIsSet = true ;
+        this.startTime = System.nanoTime() ;
+    }
+
+    public void setFinishTime() {
+        if ( finishTimeIsSet ) 
+            Log.warn(this,  "Finish time reset") ;
+        finishTimeIsSet = true ;
+        this.finishTime = System.nanoTime() ;
+    }
+
+    public HttpServletRequest getRequest()              { return request ; }
+
+    public HttpServletResponseTracker getResponse()     { return response ; }
+    
+    /** Return the recorded time taken in milliseconds. 
+     *  {@linkplain #setStartTime} and {@linkplain #setFinishTime}
+     *  must have been called.
+     */
+    public long getTime()
+    {
+        if ( ! startTimeIsSet ) 
+            Log.warn(this,  "Start time not set") ;
+        if ( ! finishTimeIsSet ) 
+            Log.warn(this,  "Finish time not set") ;
+        return (finishTime-startTime)/(1000*1000) ;
+    }
+
+    public void sync() {
+        SystemARQ.sync(dsg) ;
+    }
+
+    public static MediaType contentNegotationRDF(HttpAction action) {
+        MediaType mt = ConNeg.chooseContentType(action.request, DEF.rdfOffer, DEF.acceptRDFXML) ;
+        if ( mt == null )
+            return null ;
+        if ( mt.getContentType() != null )
+            action.response.setContentType(mt.getContentType()) ;
+        if ( mt.getCharset() != null )
+            action.response.setCharacterEncoding(mt.getCharset()) ;
+        return mt ;
+    }
+
+    public static MediaType contentNegotationQuads(HttpAction action) {
+        return ConNeg.chooseContentType(action.request, DEF.quadsOffer, DEF.acceptNQuads) ;
+    }
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/HttpServletResponseTracker.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/HttpServletResponseTracker.java b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/HttpServletResponseTracker.java
new file mode 100644
index 0000000..c39e728
--- /dev/null
+++ b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/HttpServletResponseTracker.java
@@ -0,0 +1,140 @@
+/*
+ * 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.fuseki.servlets;
+
+import java.io.IOException ;
+
+import javax.servlet.http.HttpServletResponse ;
+import javax.servlet.http.HttpServletResponseWrapper ;
+
+import org.apache.jena.atlas.logging.Log ;
+
+/** Intercepting wrapper so we can track the response settings for logging purposes */
+
+public class HttpServletResponseTracker extends HttpServletResponseWrapper
+{
+    private final HttpAction action ;
+
+    public HttpServletResponseTracker(HttpAction action, HttpServletResponse response)
+    {
+        super(response) ;
+        this.action = action ;
+    }
+
+    @Override
+    public void sendError(int sc, String msg) throws IOException
+    {
+        action.statusCode = sc ;
+        action.message = msg ;
+        super.sendError(sc, msg) ;
+    }
+
+    @Override
+    public void sendError(int sc) throws IOException
+    {
+        action.statusCode = sc ;
+        action.message = null ;
+        super.sendError(sc) ;
+    }
+
+    @Override
+    public void setHeader(String name, String value)
+    {
+        super.setHeader(name, value) ;
+        action.headers.put(name, value) ;
+    }
+
+    @Override
+    public void addHeader(String name, String value)
+    {
+        Log.warn(this, "Unexpected addHeader - not recorded in log") ;
+        super.addHeader(name, value) ;
+    }
+    @Override
+    public void setStatus(int sc) 
+    {
+        action.statusCode = sc ;
+        action.message = null ;
+        super.setStatus(sc) ;
+    }
+
+    @Override
+    @Deprecated
+    public void setStatus(int sc, String sm)
+    {
+        action.statusCode = sc ;
+        action.message = sm ;
+        super.setStatus(sc, sm) ;
+    }
+
+    @Override
+    public void setContentLength(int len)
+    {
+        action.contentLength = len ;
+        super.setContentLength(len) ;
+    }
+
+    @Override
+    public void setContentType(String type)
+    {
+        action.contentType = type ;
+        super.setContentType(type) ;
+    }
+      
+      // From HttpServletResponse
+//      public void addCookie(Cookie cookie) {}
+//      public boolean containsHeader(String name) {}
+//      public String encodeURL(String url) { }
+//      public String encodeRedirectURL(String url) {}
+//      public String encodeUrl(String url) {}
+//      public String encodeRedirectUrl(String url) {}
+//      public void sendError(int sc, String msg) throws IOException
+//      public void sendError(int sc) throws IOException
+//      public void sendRedirect(String location) throws IOException {}
+//      public void setDateHeader(String name, long date) {}
+//      public void addDateHeader(String name, long date) {}
+//      public void setHeader(String name, String value)
+//      public void addHeader(String name, String value)
+//      public void setIntHeader(String name, int value) {}
+//      public void addIntHeader(String name, int value) {}
+//      public void setStatus(int sc) 
+//      public void setStatus(int sc, String sm)
+//      public void sendRedirect(String location) throws IOException {}
+//      public void setDateHeader(String name, long date) {}
+//      public void addDateHeader(String name, long date) {}
+        
+        // From ServletResponse.
+//         public ServletResponse getResponse() {}
+//         public void setResponse(ServletResponse response) {}
+//         public void setCharacterEncoding(String charset) {}
+//         public String getCharacterEncoding() {}
+//         public ServletOutputStream getOutputStream() throws IOException {}
+//         public PrintWriter getWriter() throws IOException {}
+//         public void setContentLength(int len) {}
+//         public void setContentType(String type) {}
+//         public String getContentType() {
+//         public void setBufferSize(int size) {}
+//         public int getBufferSize() {}
+//         public void flushBuffer() throws IOException {}
+//         public boolean isCommitted() {}
+//         public void reset() {}
+//         public void resetBuffer() {}
+//         public void setLocale(Locale loc) {}
+//         public Locale getLocale() {}
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/NullOutputStream.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/NullOutputStream.java b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/NullOutputStream.java
new file mode 100644
index 0000000..63e6562
--- /dev/null
+++ b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/NullOutputStream.java
@@ -0,0 +1,53 @@
+/*
+ * 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.fuseki.servlets;
+
+import java.io.* ;
+
+/** 
+* Code needed to implement an OutputStream that does nothing.
+*/
+
+
+public class NullOutputStream extends /*Filter*/OutputStream
+{
+	public NullOutputStream()
+	{
+	}
+
+	// The OutputStream operations
+	@Override
+    public void close() { /* .close() ;*/ }
+	@Override
+    public void flush() { /* .flush() ;*/ }
+
+	// Need to implement this one.
+	@Override
+    public void write(int b) { /* .write(b) ;*/ }
+	@Override
+    public void write(byte b[]) { /* this.write(b, 0, b.length) ; */}
+
+	// Good to implement this one.
+	@Override
+    public void write(byte[] b, int off, int len)
+	{
+		// Work function
+	}
+	
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/REST_Quads.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/REST_Quads.java b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/REST_Quads.java
new file mode 100644
index 0000000..06c38b7
--- /dev/null
+++ b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/REST_Quads.java
@@ -0,0 +1,211 @@
+/**
+ * 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.fuseki.servlets;
+
+import static java.lang.String.format ;
+
+import java.io.IOException ;
+
+import javax.servlet.ServletOutputStream ;
+
+import org.apache.jena.atlas.web.MediaType ;
+import org.apache.jena.atlas.web.TypedOutputStream ;
+import org.apache.jena.fuseki.Fuseki ;
+import org.apache.jena.fuseki.HttpNames ;
+import org.apache.jena.riot.Lang ;
+import org.apache.jena.riot.RDFDataMgr ;
+import org.apache.jena.riot.RDFLanguages ;
+import org.apache.jena.riot.ReaderRIOT ;
+import org.apache.jena.riot.system.StreamRDF ;
+import org.apache.jena.riot.system.StreamRDFLib ;
+
+import com.hp.hpl.jena.graph.Graph ;
+import com.hp.hpl.jena.graph.Node ;
+import com.hp.hpl.jena.graph.NodeFactory ;
+import com.hp.hpl.jena.sparql.core.DatasetGraph ;
+
+/** 
+ * Servlet that serves up quads for a dataset.
+ */
+
+public class REST_Quads extends SPARQL_REST
+{
+    public REST_Quads()     { super(); }
+    
+    @Override
+    protected void validate(HttpAction action)
+    {
+        // already checked?
+    }
+    
+    @Override
+    protected void doGet(HttpAction action)
+    {
+        MediaType mediaType = HttpAction.contentNegotationQuads(action) ;
+        ServletOutputStream output ;
+        try { output = action.response.getOutputStream() ; }
+        catch (IOException ex) { errorOccurred(ex) ; output = null ; }
+        
+        TypedOutputStream out = new TypedOutputStream(output, mediaType) ;
+        Lang lang = RDFLanguages.contentTypeToLang(mediaType.getContentType()) ;
+        if ( lang == null )
+            lang = RDFLanguages.TRIG ;
+
+        if ( action.verbose )
+            log.info(format("[%d]   Get: Content-Type=%s, Charset=%s => %s", 
+                                  action.id, mediaType.getContentType(), mediaType.getCharset(), lang.getName())) ;
+        if ( ! RDFLanguages.isQuads(lang) )
+            errorBadRequest("Not a quads format: "+mediaType) ;
+        
+        action.beginRead() ;
+        try {
+            DatasetGraph dsg = action.getActiveDSG() ;
+            RDFDataMgr.write(out, dsg, lang) ;
+            success(action) ;
+        } finally { action.endRead() ; }
+    }
+    
+    @Override
+    protected void doOptions(HttpAction action)
+    {
+        action.response.setHeader(HttpNames.hAllow, "GET, HEAD, OPTIONS") ;
+        action.response.setHeader(HttpNames.hContentLengh, "0") ;
+        success(action) ;
+    }
+
+    @Override
+    protected void doHead(HttpAction action)
+    {
+        action.beginRead() ;
+        try { 
+            MediaType mediaType = HttpAction.contentNegotationQuads(action) ;
+            success(action) ;
+        } finally { action.endRead() ; }
+    }
+
+    static int counter = 0 ;
+    @Override
+    protected void doPost(HttpAction action)
+    { 
+        if ( ! action.getDatasetRef().allowDatasetUpdate )
+            errorMethodNotAllowed("POST") ;
+
+        // Graph Store Protocol mode - POST triples to dataset causes
+        // a new graph to be created and the new URI returned via Location.
+        // Normally off.  
+        // When off, POST of triples goes to default graph.
+        boolean gspMode = Fuseki.graphStoreProtocolPostCreate ;
+        
+        // Code to pass the GSP test suite.
+        // Not necessarily good code.
+        String x = action.request.getContentType() ;
+        if ( x == null )
+            errorBadRequest("Content-type required for data format") ;
+        
+        MediaType mediaType = MediaType.create(x) ;
+        Lang lang = RDFLanguages.contentTypeToLang(mediaType.getContentType()) ;
+        if ( lang == null )
+            lang = RDFLanguages.TRIG ;
+
+        if ( action.verbose )
+            log.info(format("[%d]   Post: Content-Type=%s, Charset=%s => %s", 
+                                  action.id, mediaType.getContentType(), mediaType.getCharset(), lang.getName())) ;
+        
+        if ( RDFLanguages.isQuads(lang) )
+            doPostQuads(action, lang) ;
+        else if ( gspMode && RDFLanguages.isTriples(lang) )
+            doPostTriplesGSP(action, lang) ;
+        else if ( RDFLanguages.isTriples(lang) )
+            doPostTriples(action, lang) ;
+        else
+            errorBadRequest("Not a triples or quads format: "+mediaType) ;
+    }
+        
+    protected void doPostQuads(HttpAction action, Lang lang)
+    {
+        action.beginWrite() ;
+        try {
+            String name = action.request.getRequestURL().toString() ;
+            DatasetGraph dsg = action.getActiveDSG() ;
+            StreamRDF dest = StreamRDFLib.dataset(dsg) ;
+            ReaderRIOT reader = RDFDataMgr.createReader(lang) ;
+            reader.read(action.request.getInputStream(), name, null, dest, null);
+            action.commit();
+            success(action) ;
+        } catch (IOException ex) { action.abort() ; } 
+        finally { action.endWrite() ; }
+    }
+    
+  
+    // POST triples to dataset -- send to default graph.  
+    protected void doPostTriples(HttpAction action, Lang lang) 
+    {
+        action.beginWrite() ;
+        try {
+            DatasetGraph dsg = action.getActiveDSG() ;
+            // This should not be anythign other than the datasets name via this route.  
+            String name = action.request.getRequestURL().toString() ;
+            //log.info(format("[%d] ** Content-length: %d", action.id, action.request.getContentLength())) ;  
+            Graph g = dsg.getDefaultGraph() ;
+            StreamRDF dest = StreamRDFLib.graph(g) ;
+            ReaderRIOT reader = RDFDataMgr.createReader(lang) ;
+            reader.read(action.request.getInputStream(), name, null, dest, null);
+            action.commit();
+            success(action) ;
+        } catch (IOException ex) { action.abort() ; } 
+        finally { action.endWrite() ; }
+    }
+    
+    protected void doPostTriplesGSP(HttpAction action, Lang lang) 
+    {
+        action.beginWrite() ;
+        try {
+            DatasetGraph dsg = action.getActiveDSG() ;
+            //log.info(format("[%d] ** Content-length: %d", action.id, action.request.getContentLength())) ;  
+            
+            String name = action.request.getRequestURL().toString() ;
+            if ( ! name.endsWith("/") )
+                name = name+ "/"  ;
+            name = name+(++counter) ;
+            Node gn = NodeFactory.createURI(name) ;
+            Graph g = dsg.getGraph(gn) ;
+            StreamRDF dest = StreamRDFLib.graph(g) ;
+            ReaderRIOT reader = RDFDataMgr.createReader(lang) ;
+            reader.read(action.request.getInputStream(), name, null, dest, null);
+            log.info(format("[%d] Location: %s", action.id, name)) ;
+            action.response.setHeader("Location",  name) ;
+            action.commit();
+            successCreated(action) ;
+        } catch (IOException ex) { action.abort() ; } 
+        finally { action.endWrite() ; }
+    }
+
+    @Override
+    protected void doDelete(HttpAction action)
+    { errorMethodNotAllowed("DELETE") ; }
+
+    @Override
+    protected void doPut(HttpAction action)
+    { errorMethodNotAllowed("PUT") ; }
+
+    @Override
+    protected void doPatch(HttpAction action)
+    { errorMethodNotAllowed("PATCH") ; }
+}
+

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/ResponseCallback.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/ResponseCallback.java b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/ResponseCallback.java
new file mode 100644
index 0000000..1a78627
--- /dev/null
+++ b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/ResponseCallback.java
@@ -0,0 +1,24 @@
+/*
+ * 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.fuseki.servlets ;
+
+public interface ResponseCallback
+{
+    public void callback(boolean successfulOperation) ;
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/ResponseModel.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/ResponseModel.java b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/ResponseModel.java
new file mode 100644
index 0000000..f2172f0
--- /dev/null
+++ b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/ResponseModel.java
@@ -0,0 +1,143 @@
+/*
+ * 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.fuseki.servlets;
+
+import static org.apache.jena.fuseki.servlets.ServletBase.error ;
+import static org.apache.jena.fuseki.servlets.ServletBase.errorBadRequest ;
+import static org.apache.jena.fuseki.servlets.ServletBase.errorOccurred ;
+
+import java.util.HashMap ;
+import java.util.Map ;
+
+import javax.servlet.ServletOutputStream ;
+import javax.servlet.http.HttpServletRequest ;
+import javax.servlet.http.HttpServletResponse ;
+
+import org.apache.jena.atlas.web.MediaType ;
+import org.apache.jena.fuseki.DEF ;
+import org.apache.jena.fuseki.Fuseki ;
+import org.apache.jena.fuseki.conneg.ConNeg ;
+import org.apache.jena.fuseki.conneg.WebLib ;
+import org.apache.jena.riot.Lang ;
+import org.apache.jena.riot.RDFDataMgr ;
+import org.apache.jena.riot.RDFLanguages ;
+import org.apache.jena.riot.WebContent ;
+import org.apache.jena.web.HttpSC ;
+import org.slf4j.Logger ;
+
+import com.hp.hpl.jena.rdf.model.Model ;
+
+public class ResponseModel
+{
+    private static Logger slog = ServletBase.log ;
+
+    // Short names for "output="
+    private static final String contentOutputJSONLD        = "json-ld" ;
+    private static final String contentOutputJSONRDF       = "json-rdf" ;
+    private static final String contentOutputJSON          = "json" ;
+    private static final String contentOutputXML           = "xml" ;
+    private static final String contentOutputText          = "text" ;
+    private static final String contentOutputTTL           = "ttl" ;
+    private static final String contentOutputNT            = "nt" ;
+
+    public static Map<String,String> shortNamesModel = new HashMap<String, String>() ;
+    static {
+
+        // Some short names.  keys are lowercase.
+        ResponseOps.put(shortNamesModel, contentOutputJSONLD, WebContent.contentTypeJSONLD) ;
+        ResponseOps.put(shortNamesModel, contentOutputJSONRDF, WebContent.contentTypeRDFJSON) ;
+        ResponseOps.put(shortNamesModel, contentOutputJSON, WebContent.contentTypeJSONLD) ;
+        ResponseOps.put(shortNamesModel, contentOutputXML,  WebContent.contentTypeRDFXML) ;
+        ResponseOps.put(shortNamesModel, contentOutputText, WebContent.contentTypeTurtle) ;
+        ResponseOps.put(shortNamesModel, contentOutputTTL,  WebContent.contentTypeTurtle) ;
+        ResponseOps.put(shortNamesModel, contentOutputNT,   WebContent.contentTypeNTriples) ;
+    }
+
+    public static void doResponseModel(HttpAction action, Model model) 
+    {
+        HttpServletRequest request = action.request ;
+        HttpServletResponse response = action.response ;
+        
+        String mimeType = null ;        // Header request type 
+
+        // TODO Use MediaType throughout.
+        MediaType i = ConNeg.chooseContentType(request, DEF.rdfOffer, DEF.acceptRDFXML) ;
+        if ( i != null )
+            mimeType = i.getContentType() ;
+
+        String outputField = ResponseOps.paramOutput(request, shortNamesModel) ;
+        if ( outputField != null )
+            mimeType = outputField ;
+
+        String writerMimeType = mimeType ;
+
+        if ( mimeType == null )
+        {
+            Fuseki.requestLog.warn("Can't find MIME type for response") ;
+            String x = WebLib.getAccept(request) ;
+            String msg ;
+            if ( x == null )
+                msg = "No Accept: header" ;
+            else
+                msg = "Accept: "+x+" : Not understood" ;
+            error(HttpSC.NOT_ACCEPTABLE_406, msg) ;
+        }
+
+        String contentType = mimeType ;
+        String charset =     WebContent.charsetUTF8 ;
+
+        String forceAccept = ResponseOps.paramForceAccept(request) ;
+        if ( forceAccept != null )
+        {
+            contentType = forceAccept ;
+            charset = WebContent.charsetUTF8 ;
+        }
+
+        Lang lang = RDFLanguages.contentTypeToLang(contentType) ;
+        if ( lang == null )
+            errorBadRequest("Can't determine output content type: "+contentType) ;
+        
+//        if ( rdfw instanceof RDFXMLWriterI )
+//            rdfw.setProperty("showXmlDeclaration", "true") ;
+
+    //        // Write locally to check it's possible.
+    //        // Time/space tradeoff.
+    //        try {
+    //            OutputStream out = new NullOutputStream() ;
+    //            RDFDataMgr.write(out, model, lang) ;
+    //            IO.flush(out) ;
+    //        } catch (JenaException ex)
+    //        {
+    //            SPARQL_ServletBase.errorOccurred(ex) ;
+    //        }
+
+        try {
+            ResponseResultSet.setHttpResponse(request, response, contentType, charset) ; 
+            response.setStatus(HttpSC.OK_200) ;
+            ServletOutputStream out = response.getOutputStream() ;
+            RDFDataMgr.write(out, model, lang) ;
+            out.flush() ;
+        }
+        catch (Exception ex) { 
+            slog.info("Exception while writing the response model: "+ex.getMessage(), ex) ;
+            errorOccurred("Exception while writing the response model: "+ex.getMessage(), ex) ;
+        }
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/ResponseOps.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/ResponseOps.java b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/ResponseOps.java
new file mode 100644
index 0000000..62ad6d5
--- /dev/null
+++ b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/ResponseOps.java
@@ -0,0 +1,94 @@
+/*
+ * 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.fuseki.servlets;
+
+import java.io.IOException ;
+import java.util.Locale ;
+import java.util.Map ;
+
+import javax.servlet.http.HttpServletRequest ;
+
+import org.apache.jena.fuseki.HttpNames ;
+
+public class ResponseOps
+{
+    // Helpers
+    public static void put(Map<String, String> map, String key, String value)
+    {
+        map.put(key.toLowerCase(Locale.ROOT), value) ;
+    }
+    
+    public static boolean isEOFexception(IOException ioEx)
+    {
+        if ( ioEx.getClass().getName().equals("org.mortbay.jetty.EofException eofEx") )
+            return true ;
+        if ( ioEx instanceof java.io.EOFException )
+            return true ;
+        return false ;
+    }
+
+    public static String paramForceAccept(HttpServletRequest request)
+    {
+        String x = fetchParam(request, HttpNames.paramForceAccept) ;
+        return x ; 
+    }
+
+    public static String paramStylesheet(HttpServletRequest request)
+    { return fetchParam(request, HttpNames.paramStyleSheet) ; }
+
+    public static String paramOutput(HttpServletRequest request, Map<String,String> map)
+    {
+        // Two names.
+        String x = fetchParam(request, HttpNames.paramOutput1) ;
+        if ( x == null )
+            x = fetchParam(request, HttpNames.paramOutput2) ;
+        return expandShortName(x, map) ;
+    }
+
+    public static String expandShortName(String str, Map<String,String> map)
+    {
+        if ( str == null )
+            return null ;
+        // Force keys to lower case. See put() above.
+        String key = str.toLowerCase(Locale.ROOT) ;
+        String str2 = map.get(key) ;
+        if ( str2 == null )
+            return str ;
+        return str2 ;
+    }
+
+    public static String paramCallback(HttpServletRequest request)
+    { 
+        return fetchParam(request, HttpNames.paramCallback) ;
+    }
+
+    public static String fetchParam(HttpServletRequest request, String parameterName)
+    {
+        String value = request.getParameter(parameterName) ;
+        if ( value != null )
+        {
+            value = value.trim() ;
+            if ( value.length() == 0 )
+                value = null ;
+        }
+        return value ;
+    }
+
+}
+

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/ResponseResultSet.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/ResponseResultSet.java b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/ResponseResultSet.java
new file mode 100644
index 0000000..c42378b
--- /dev/null
+++ b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/ResponseResultSet.java
@@ -0,0 +1,320 @@
+/*
+ * 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.fuseki.servlets;
+
+import static java.lang.String.format ;
+import static org.apache.jena.atlas.lib.Lib.equal ;
+import static org.apache.jena.fuseki.servlets.ServletBase.errorBadRequest ;
+import static org.apache.jena.fuseki.servlets.ServletBase.errorOccurred ;
+import static org.apache.jena.fuseki.servlets.ServletBase.log ;
+
+import java.io.IOException ;
+import java.util.HashMap ;
+import java.util.Map ;
+
+import javax.servlet.ServletOutputStream ;
+import javax.servlet.http.HttpServletRequest ;
+import javax.servlet.http.HttpServletResponse ;
+
+import org.apache.commons.lang.StringUtils ;
+import org.apache.jena.atlas.web.AcceptList ;
+import org.apache.jena.atlas.web.MediaType ;
+import org.apache.jena.fuseki.DEF ;
+import org.apache.jena.fuseki.FusekiException ;
+import org.apache.jena.fuseki.conneg.ConNeg ;
+import org.apache.jena.riot.ResultSetMgr ;
+import org.apache.jena.riot.WebContent ;
+import org.apache.jena.riot.resultset.ResultSetLang ;
+import org.apache.jena.web.HttpSC ;
+import org.slf4j.Logger ;
+import org.slf4j.LoggerFactory ;
+
+import com.hp.hpl.jena.query.QueryCancelledException ;
+import com.hp.hpl.jena.query.ResultSet ;
+import com.hp.hpl.jena.query.ResultSetFormatter ;
+import com.hp.hpl.jena.sparql.core.Prologue ;
+
+/** This is the content negotiation for each kind of SPARQL query result */ 
+public class ResponseResultSet
+{
+    private static Logger xlog = LoggerFactory.getLogger(ResponseResultSet.class) ;
+    private static Logger slog = ServletBase.log ;
+
+    // Short names for "output="
+    private static final String contentOutputJSON          = "json" ;
+    private static final String contentOutputXML           = "xml" ;
+    private static final String contentOutputSPARQL        = "sparql" ;
+    private static final String contentOutputText          = "text" ;
+    private static final String contentOutputCSV           = "csv" ;
+    private static final String contentOutputTSV           = "tsv" ;
+    private static final String contentOutputThrift        = "thrift" ;
+    
+    public static Map<String,String> shortNamesResultSet = new HashMap<String, String>() ;
+    static {
+        // Some short names.  keys are lowercase.
+        ResponseOps.put(shortNamesResultSet, contentOutputJSON,   WebContent.contentTypeResultsJSON) ;
+        ResponseOps.put(shortNamesResultSet, contentOutputSPARQL, WebContent.contentTypeResultsXML) ;
+        ResponseOps.put(shortNamesResultSet, contentOutputXML,    WebContent.contentTypeResultsXML) ;
+        ResponseOps.put(shortNamesResultSet, contentOutputText,   WebContent.contentTypeTextPlain) ;
+        ResponseOps.put(shortNamesResultSet, contentOutputCSV,    WebContent.contentTypeTextCSV) ;
+        ResponseOps.put(shortNamesResultSet, contentOutputTSV,    WebContent.contentTypeTextTSV) ;
+        ResponseOps.put(shortNamesResultSet, contentOutputThrift, WebContent.contentTypeResultsThrift) ;
+    }
+    
+    interface OutputContent { void output(ServletOutputStream out) ; }
+
+    public static void doResponseResultSet(HttpAction action, Boolean booleanResult)
+    {
+        doResponseResultSet$(action, null, booleanResult, null, DEF.rsOfferTable) ;
+    }
+
+    public static void doResponseResultSet(HttpAction action, ResultSet resultSet, Prologue qPrologue)
+    {
+        doResponseResultSet$(action, resultSet, null, qPrologue, DEF.rsOfferTable) ;
+    }
+    
+    // If we refactor the conneg into a single function, we can split boolean and result set handling. 
+    
+    // One or the other argument must be null
+    private static void doResponseResultSet$(HttpAction action,
+                                             ResultSet resultSet, Boolean booleanResult, 
+                                             Prologue qPrologue, 
+                                             AcceptList contentTypeOffer) 
+    {
+        HttpServletRequest request = action.request ;
+        HttpServletResponse response = action.response ;
+        long id = action.id ;
+        
+        if ( resultSet == null && booleanResult == null )
+        {
+            xlog.warn("doResponseResult: Both result set and boolean result are null") ; 
+            throw new FusekiException("Both result set and boolean result are null") ;
+        }
+        
+        if ( resultSet != null && booleanResult != null )
+        {
+            xlog.warn("doResponseResult: Both result set and boolean result are set") ; 
+            throw new FusekiException("Both result set and boolean result are set") ;
+        }
+
+        String mimeType = null ; 
+        MediaType i = ConNeg.chooseContentType(request, contentTypeOffer, DEF.acceptRSXML) ;
+        if ( i != null )
+            mimeType = i.getContentType() ;
+        
+        // Override content type
+        // Does &output= override?
+        // Requested output type by the web form or &output= in the request.
+        String outputField = ResponseOps.paramOutput(request, shortNamesResultSet) ;    // Expands short names
+        if ( outputField != null )
+            mimeType = outputField ;
+        
+        String serializationType = mimeType ;           // Choose the serializer based on this.
+        String contentType = mimeType ;                 // Set the HTTP respose header to this.
+             
+        // Stylesheet - change to application/xml.
+        final String stylesheetURL = ResponseOps.paramStylesheet(request) ;
+        if ( stylesheetURL != null && equal(serializationType,WebContent.contentTypeResultsXML) )
+            contentType = WebContent.contentTypeXML ;
+        
+        // Force to text/plain?
+        String forceAccept = ResponseOps.paramForceAccept(request) ;
+        if ( forceAccept != null )
+            contentType = WebContent.contentTypeTextPlain ;
+
+        // Better : dispatch on MediaType
+        // Fuseki2 uses the SPARQL parser/write registry.
+        if ( equal(serializationType, WebContent.contentTypeResultsXML) )
+            sparqlXMLOutput(action, contentType, resultSet, stylesheetURL, booleanResult) ;
+        else if ( equal(serializationType, WebContent.contentTypeResultsJSON) )
+            jsonOutput(action, contentType, resultSet, booleanResult) ;
+        else if ( equal(serializationType, WebContent.contentTypeTextPlain) )
+            textOutput(action, contentType, resultSet, qPrologue, booleanResult) ;
+        else if ( equal(serializationType, WebContent.contentTypeTextCSV) ) 
+            csvOutput(action, contentType, resultSet, booleanResult) ;
+        else if (equal(serializationType, WebContent.contentTypeTextTSV) )
+            tsvOutput(action, contentType, resultSet, booleanResult) ;
+        else if (equal(serializationType, WebContent.contentTypeResultsThrift) )
+            thriftOutput(action, contentType, resultSet, booleanResult) ;
+        else
+            errorBadRequest("Can't determine output serialization: "+serializationType) ;
+    }
+    
+    
+    public static void setHttpResponse(HttpServletRequest httpRequest,
+                                       HttpServletResponse httpResponse,
+                                       String contentType, String charset) 
+    {
+        // ---- Set up HTTP Response
+        // Stop caching (not that ?queryString URLs are cached anyway)
+        if ( true )
+        {
+            httpResponse.setHeader("Cache-Control", "no-cache") ;
+            httpResponse.setHeader("Pragma", "no-cache") ;
+        }
+        // See: http://www.w3.org/International/O-HTTP-charset.html
+        if ( contentType != null )
+        {
+            if ( charset != null && ! isXML(contentType) )
+                contentType = contentType+"; charset="+charset ;
+            log.trace("Content-Type for response: "+contentType) ;
+            httpResponse.setContentType(contentType) ;
+        }
+    }
+
+    private static boolean isXML(String contentType)
+    {
+        return contentType.equals(WebContent.contentTypeRDFXML)
+            || contentType.equals(WebContent.contentTypeResultsXML)
+            || contentType.equals(WebContent.contentTypeXML) ; 
+    }
+
+    private static void sparqlXMLOutput(HttpAction action, String contentType, final ResultSet resultSet, final String stylesheetURL, final Boolean booleanResult)
+    {
+        OutputContent proc = 
+            new OutputContent(){
+            @Override
+            public void output(ServletOutputStream out)
+            {
+                if ( resultSet != null )
+                    ResultSetFormatter.outputAsXML(out, resultSet, stylesheetURL) ;
+                if ( booleanResult != null )
+                    ResultSetFormatter.outputAsXML(out, booleanResult, stylesheetURL) ;
+            }} ;
+            output(action, contentType, null, proc) ;
+        }
+    
+    private static void jsonOutput(HttpAction action, String contentType, final ResultSet resultSet, final Boolean booleanResult)
+    {
+        OutputContent proc = new OutputContent(){
+            @Override
+            public void output(ServletOutputStream out)
+            {
+                if ( resultSet != null )
+                    ResultSetFormatter.outputAsJSON(out, resultSet) ;
+                if (  booleanResult != null )
+                    ResultSetFormatter.outputAsJSON(out, booleanResult ) ;
+            }
+        } ;
+        
+        try {
+            String callback = ResponseOps.paramCallback(action.request) ;
+            ServletOutputStream out = action.response.getOutputStream() ;
+
+            if ( callback != null )
+            {
+                callback = StringUtils.replaceChars(callback, "\r", "") ;
+                callback = StringUtils.replaceChars(callback, "\n", "") ;
+                out.print(callback) ;
+                out.println("(") ;
+            }
+
+            output(action, contentType, WebContent.charsetUTF8, proc) ;
+
+            if ( callback != null )
+                out.println(")") ;
+        } catch (IOException ex) { errorOccurred(ex) ; }
+    }
+    
+    private static void textOutput(HttpAction action, String contentType, final ResultSet resultSet, final Prologue qPrologue, final Boolean booleanResult)
+    {
+        // Text is not streaming.
+        OutputContent proc =  new OutputContent(){
+            @Override
+            public void output(ServletOutputStream out)
+            {
+                if ( resultSet != null )
+                    ResultSetFormatter.out(out, resultSet, qPrologue) ;
+                if (  booleanResult != null )
+                    ResultSetFormatter.out(out, booleanResult ) ;
+            }
+        };
+
+        output(action, contentType, WebContent.charsetUTF8, proc) ;
+    }
+
+    private static void csvOutput(HttpAction action, String contentType, final ResultSet resultSet, final Boolean booleanResult) {
+        OutputContent proc = new OutputContent(){
+            @Override
+            public void output(ServletOutputStream out)
+            {
+                if ( resultSet != null )
+                    ResultSetFormatter.outputAsCSV(out, resultSet) ;
+                if (  booleanResult != null )
+                    ResultSetFormatter.outputAsCSV(out, booleanResult ) ;
+            }
+        } ;
+        output(action, contentType, WebContent.charsetUTF8, proc) ; 
+    }
+
+    private static void tsvOutput(HttpAction action, String contentType, final ResultSet resultSet, final Boolean booleanResult) {
+        OutputContent proc = new OutputContent(){
+            @Override
+            public void output(ServletOutputStream out)
+            {
+                if ( resultSet != null )
+                    ResultSetFormatter.outputAsTSV(out, resultSet) ;
+                if (  booleanResult != null )
+                    ResultSetFormatter.outputAsTSV(out, booleanResult ) ;
+            }
+        } ;
+        output(action, contentType, WebContent.charsetUTF8, proc) ; 
+    }
+
+    private static void thriftOutput(HttpAction action, String contentType, final ResultSet resultSet, final Boolean booleanResult) {
+        OutputContent proc = new OutputContent(){
+            @Override
+            public void output(ServletOutputStream out)
+            {
+                if ( resultSet != null )
+                    ResultSetMgr.write(out, resultSet, ResultSetLang.SPARQLResultSetThrift) ;
+                if ( booleanResult != null )
+                    slog.error("Can't write boolen result in thrift") ;
+            }
+        } ;
+        output(action, contentType, WebContent.charsetUTF8, proc) ; 
+    }
+
+    private static void output(HttpAction action, String contentType, String charset, OutputContent proc) 
+    {
+        try {
+            setHttpResponse(action.request, action.response, contentType, charset) ; 
+            action.response.setStatus(HttpSC.OK_200) ;
+            ServletOutputStream out = action.response.getOutputStream() ;
+            try
+            {
+                proc.output(out) ;
+                out.flush() ;
+            } catch (QueryCancelledException ex) {
+                // Bother.  Status code 200 already sent.
+                slog.info(format("[%d] Query Cancelled - results truncated (but 200 already sent)", action.id)) ;
+                out.println() ;
+                out.println("##  Query cancelled due to timeout during execution   ##") ;
+                out.println("##  ****          Incomplete results           ****   ##") ;
+                out.flush() ;
+                // No point raising an exception - 200 was sent already.  
+                //errorOccurred(ex) ;
+            }
+        // Includes client gone.
+        } catch (IOException ex) 
+        { errorOccurred(ex) ; }
+        // Do not call httpResponse.flushBuffer(); here - Jetty closes the stream if it is a gzip stream
+        // then the JSON callback closing details can't be added. 
+    }
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Protocol.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Protocol.java b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Protocol.java
new file mode 100644
index 0000000..ed57a37
--- /dev/null
+++ b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Protocol.java
@@ -0,0 +1,101 @@
+/**
+ * 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.fuseki.servlets;
+
+import static org.apache.jena.fuseki.HttpNames.paramDefaultGraphURI ;
+import static org.apache.jena.fuseki.HttpNames.paramNamedGraphURI ;
+
+import java.util.Arrays ;
+import java.util.Collections ;
+import java.util.List ;
+
+import javax.servlet.http.HttpServletRequest ;
+
+import org.apache.jena.atlas.iterator.Filter ;
+import org.apache.jena.atlas.iterator.Iter ;
+import org.apache.jena.atlas.lib.Lib ;
+
+import com.hp.hpl.jena.query.Query ;
+import com.hp.hpl.jena.query.QueryParseException ;
+import com.hp.hpl.jena.sparql.core.DatasetDescription ;
+
+/** Support for the SPARQL protocol (SPARQL Query, SPARQL Update)
+ */
+public  abstract class SPARQL_Protocol extends SPARQL_ServletBase
+{
+    protected SPARQL_Protocol() { super() ; }
+
+    protected static String messageForQPE(QueryParseException ex)
+    {
+        if ( ex.getMessage() != null )
+            return ex.getMessage() ;
+        if ( ex.getCause() != null )
+            return Lib.classShortName(ex.getCause().getClass()) ;
+        return null ;
+    }
+    
+    protected static DatasetDescription getDatasetDescription(HttpAction action)
+    {
+        List<String> graphURLs = toStrList(action.request.getParameterValues(paramDefaultGraphURI)) ;
+        List<String> namedGraphs = toStrList(action.request.getParameterValues(paramNamedGraphURI)) ;
+        
+        graphURLs = removeEmptyValues(graphURLs) ;
+        namedGraphs = removeEmptyValues(namedGraphs) ;
+        
+        if ( graphURLs.size() == 0 && namedGraphs.size() == 0 )
+            return null ;
+        return DatasetDescription.create(graphURLs, namedGraphs) ;
+    }
+    
+    protected static DatasetDescription getDatasetDescription(Query query)
+    {
+        return DatasetDescription.create(query) ;
+    }
+   
+    private static List<String> toStrList(String[] array)
+    {
+        if ( array == null )
+            return Collections.emptyList() ;
+        return Arrays.asList(array) ;
+    }
+
+    private static List<String> removeEmptyValues(List<String> list)
+    {
+        return Iter.iter(list).filter(acceptNonEmpty).toList() ;
+    }
+    
+    private static Filter<String> acceptNonEmpty = new Filter<String>(){ 
+        @Override
+        public boolean accept(String item)
+        {
+            return item != null && item.length() != 0 ;
+        }
+    } ;
+    
+    protected static int countParamOccurences(HttpServletRequest request, String param)
+    {
+        String[] x = request.getParameterValues(param) ;
+        if ( x == null )
+            return 0 ;
+        return x.length ;
+    }
+    
+
+}
+


[23/23] jena git commit: Update for jena-fuseki1 rename

Posted by an...@apache.org.
Update for jena-fuseki1 rename


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

Branch: refs/heads/master
Commit: 4692c73971e8c50de44d0f3db207da4cc87ec47a
Parents: 6f32e59
Author: Andy Seaborne <an...@apache.org>
Authored: Thu Mar 5 15:34:03 2015 +0000
Committer: Andy Seaborne <an...@apache.org>
Committed: Thu Mar 5 15:34:03 2015 +0000

----------------------------------------------------------------------
 jena-jdbc/jena-jdbc-driver-bundle/pom.xml | 4 ++--
 jena-jdbc/jena-jdbc-driver-remote/pom.xml | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/4692c739/jena-jdbc/jena-jdbc-driver-bundle/pom.xml
----------------------------------------------------------------------
diff --git a/jena-jdbc/jena-jdbc-driver-bundle/pom.xml b/jena-jdbc/jena-jdbc-driver-bundle/pom.xml
index 5dc268b..2464475 100644
--- a/jena-jdbc/jena-jdbc-driver-bundle/pom.xml
+++ b/jena-jdbc/jena-jdbc-driver-bundle/pom.xml
@@ -89,13 +89,13 @@
 		</dependency>
 		<dependency>
 			<groupId>org.apache.jena</groupId>
-			<artifactId>jena-fuseki</artifactId>
+			<artifactId>jena-fuseki1</artifactId>
 			<version>1.1.2-SNAPSHOT</version>
 			<scope>test</scope>
 		</dependency>
 		<dependency>
 			<groupId>org.apache.jena</groupId>
-			<artifactId>jena-fuseki</artifactId>
+			<artifactId>jena-fuseki1</artifactId>
 			<version>1.1.2-SNAPSHOT</version>
 			<classifier>tests</classifier>
 			<scope>test</scope>

http://git-wip-us.apache.org/repos/asf/jena/blob/4692c739/jena-jdbc/jena-jdbc-driver-remote/pom.xml
----------------------------------------------------------------------
diff --git a/jena-jdbc/jena-jdbc-driver-remote/pom.xml b/jena-jdbc/jena-jdbc-driver-remote/pom.xml
index de17114..c0af72b 100644
--- a/jena-jdbc/jena-jdbc-driver-remote/pom.xml
+++ b/jena-jdbc/jena-jdbc-driver-remote/pom.xml
@@ -48,13 +48,13 @@
 		</dependency>
 		<dependency>
 			<groupId>org.apache.jena</groupId>
-			<artifactId>jena-fuseki</artifactId>
+			<artifactId>jena-fuseki1</artifactId>
 			<version>1.1.2-SNAPSHOT</version>
 			<scope>test</scope>
 		</dependency>
 		<dependency>
 			<groupId>org.apache.jena</groupId>
-			<artifactId>jena-fuseki</artifactId>
+			<artifactId>jena-fuseki1</artifactId>
 			<version>1.1.2-SNAPSHOT</version>
 			<scope>test</scope>
 			<classifier>tests</classifier>


[13/23] jena git commit: Rename folder jena-fuseki to jena-fuseki1

Posted by an...@apache.org.
http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_REST.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_REST.java b/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_REST.java
deleted file mode 100644
index 4ab386b..0000000
--- a/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_REST.java
+++ /dev/null
@@ -1,354 +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.fuseki.servlets;
-
-import static org.apache.jena.fuseki.HttpNames.* ;
-
-import java.io.IOException ;
-import java.io.InputStream ;
-import java.util.Enumeration ;
-import java.util.Locale ;
-
-import javax.servlet.ServletException ;
-import javax.servlet.http.HttpServletRequest ;
-import javax.servlet.http.HttpServletResponse ;
-
-import org.apache.jena.fuseki.HttpNames ;
-import org.apache.jena.fuseki.server.CounterName ;
-import org.apache.jena.riot.Lang ;
-import org.apache.jena.riot.RDFDataMgr ;
-import org.apache.jena.riot.ReaderRIOT ;
-import org.apache.jena.riot.RiotException ;
-import org.apache.jena.riot.system.ErrorHandler ;
-import org.apache.jena.riot.system.ErrorHandlerFactory ;
-import org.apache.jena.riot.system.IRIResolver ;
-import org.apache.jena.riot.system.StreamRDF ;
-import org.slf4j.Logger ;
-import org.slf4j.LoggerFactory ;
-
-import com.hp.hpl.jena.graph.Graph ;
-import com.hp.hpl.jena.graph.Node ;
-import com.hp.hpl.jena.graph.NodeFactory ;
-import com.hp.hpl.jena.sparql.core.DatasetGraph ;
-
-public abstract class SPARQL_REST extends SPARQL_ServletBase
-{
-    protected static Logger classLog = LoggerFactory.getLogger(SPARQL_REST.class) ;
-    
-    protected static ErrorHandler errorHandler = ErrorHandlerFactory.errorHandlerStd(log) ;
-
-    protected final static Target determineTarget(HttpAction action) {
-        // Delayed until inside a transaction.
-        if ( action.getActiveDSG() == null )
-            errorOccurred("Internal error : No action graph (not in a transaction?)") ;
-        
-        boolean dftGraph = getOneOnly(action.request, HttpNames.paramGraphDefault) != null ;
-        String uri = getOneOnly(action.request, HttpNames.paramGraph) ;
-        
-        if ( !dftGraph && uri == null ) {
-            // Direct naming or error.
-            uri = action.request.getRequestURL().toString() ;
-            if ( action.request.getRequestURI().equals(action.getDatasetRef().name) )
-                // No name 
-                errorBadRequest("Neither default graph nor named graph specified; no direct name") ;
-        }
-        
-        if ( dftGraph )
-            return Target.createDefault(action.getActiveDSG()) ;
-        
-        // Named graph
-        if ( uri.equals(HttpNames.valueDefault ) )
-            // But "named" default
-            return Target.createDefault(action.getActiveDSG()) ;
-        
-        // Strictly, a bit naughty on the URI resolution.  But more sensible. 
-        // Base is dataset.
-        String base = action.request.getRequestURL().toString() ; //wholeRequestURL(request) ;
-        // Make sure it ends in "/", ie. dataset as container.
-        if ( action.request.getQueryString() != null && ! base.endsWith("/") )
-            base = base + "/" ;
-        
-        String absUri = IRIResolver.resolveString(uri, base) ;
-        Node gn = NodeFactory.createURI(absUri) ;
-        return Target.createNamed(action.getActiveDSG(), absUri, gn) ;
-    }
-    
-
-    // struct for target
-    protected static final class Target
-    {
-        final boolean isDefault ;
-        final DatasetGraph dsg ;
-        private Graph _graph ;
-        final String name ;
-        final Node graphName ;
-
-        static Target createNamed(DatasetGraph dsg, String name, Node graphName) {
-            return new Target(false, dsg, name, graphName) ;
-        }
-
-        static Target createDefault(DatasetGraph dsg) {
-            return new Target(true, dsg, null, null) ;
-        }
-
-        private Target(boolean isDefault, DatasetGraph dsg, String name, Node graphName) {
-            this.isDefault = isDefault ;
-            this.dsg = dsg ;
-            this._graph = null ;
-            this.name  = name ;
-            this.graphName = graphName ;
-
-            if ( isDefault )
-            {
-                if ( name != null || graphName != null )
-                    throw new IllegalArgumentException("Inconsistent: default and a graph name/node") ;       
-            }
-            else
-            {
-                if ( name == null || graphName == null )
-                    throw new IllegalArgumentException("Inconsistent: not default and/or no graph name/node") ;
-            }                
-        }
-
-        /** Get a graph for the action - this may create a graph in the dataset - this is not a test for graph existence */
-        public Graph graph() {
-            if ( ! isGraphSet() )
-            {
-                if ( isDefault ) 
-                    _graph = dsg.getDefaultGraph() ;
-                else
-                    _graph = dsg.getGraph(graphName) ;
-            }
-            return _graph ;
-        }
-
-        public boolean exists()
-        {
-            if ( isDefault ) return true ;
-            return dsg.containsGraph(graphName) ;
-        }
-
-        public boolean isGraphSet()
-        {
-            return _graph != null ;
-        }
-
-        @Override
-        public String toString()
-        {
-            if ( isDefault ) return "default" ;
-            return name ;
-        }
-    }
-
-    public SPARQL_REST()
-    { super() ; }
-
-    @Override
-    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
-        // Direct all verbs to our common framework.
-        doCommon(request, response) ;
-    }
-    
-    private void maybeSetLastModified(HttpServletResponse resp, long lastModified) {
-        if (resp.containsHeader(HEADER_LASTMOD)) return ;
-        if (lastModified >= 0) resp.setDateHeader(HEADER_LASTMOD, lastModified);
-    }
-    
-    @Override
-    protected void perform(HttpAction action) {
-        dispatch(action) ;
-    }
-
-    private void dispatch(HttpAction action) {
-        HttpServletRequest req = action.request ;
-        HttpServletResponse resp = action.response ;
-        String method = req.getMethod().toUpperCase(Locale.ROOT) ;
-
-        if (method.equals(METHOD_GET))
-            doGet$(action);
-        else if (method.equals(METHOD_HEAD))
-            doHead$(action);
-        else if (method.equals(METHOD_POST))
-            doPost$(action);
-        else if (method.equals(METHOD_PATCH))
-            doPatch$(action) ;
-        else if (method.equals(METHOD_OPTIONS))
-            doOptions$(action) ;
-        else if (method.equals(METHOD_TRACE))
-            //doTrace(action) ;
-            errorMethodNotAllowed("TRACE") ;
-        else if (method.equals(METHOD_PUT))
-            doPut$(action) ;   
-        else if (method.equals(METHOD_DELETE))
-            doDelete$(action) ;
-        else
-            errorNotImplemented("Unknown method: "+method) ;
-    }
-
-    // Counter wrappers
-    
-    protected void doGet$(HttpAction action) {
-        incCounter(action.srvRef, CounterName.GSPget) ;
-        try {
-            doGet(action) ;
-            incCounter(action.srvRef, CounterName.GSPgetGood) ;
-        } catch ( ActionErrorException ex) {
-            incCounter(action.srvRef, CounterName.GSPgetBad) ;
-            throw ex ;
-        }
-    }
-
-    protected void doHead$(HttpAction action) {
-        incCounter(action.srvRef, CounterName.GSPhead) ;
-        try {
-            doHead(action) ;
-            incCounter(action.srvRef, CounterName.GSPheadGood) ;
-        } catch ( ActionErrorException ex) {
-            incCounter(action.srvRef, CounterName.GSPheadBad) ;
-            throw ex ;
-        }
-    }
-
-    protected void doPost$(HttpAction action) {
-        incCounter(action.srvRef, CounterName.GSPpost) ;
-        try {
-            doPost(action) ;
-            incCounter(action.srvRef, CounterName.GSPpostGood) ;
-        } catch ( ActionErrorException ex) {
-            incCounter(action.srvRef, CounterName.GSPpostBad) ;
-            throw ex ;
-        }
-    }
-
-    protected void doPatch$(HttpAction action) {
-        incCounter(action.srvRef, CounterName.GSPpatch) ;
-        try {
-            doPatch(action) ;
-            incCounter(action.srvRef, CounterName.GSPpatchGood) ;
-        } catch ( ActionErrorException ex) {
-            incCounter(action.srvRef, CounterName.GSPpatchBad) ;
-            throw ex ;
-        }
-    }
-
-    protected void doDelete$(HttpAction action) {
-        incCounter(action.srvRef, CounterName.GSPdelete) ;
-        try {
-            doDelete(action) ;
-            incCounter(action.srvRef, CounterName.GSPdeleteGood) ;
-        } catch ( ActionErrorException ex) {
-            incCounter(action.srvRef, CounterName.GSPdeleteBad) ;
-            throw ex ;
-        }
-    }
-
-    protected void doPut$(HttpAction action) {
-        incCounter(action.srvRef, CounterName.GSPput) ;
-        try {
-            doPut(action) ;
-            incCounter(action.srvRef, CounterName.GSPputGood) ;
-        } catch ( ActionErrorException ex) {
-            incCounter(action.srvRef, CounterName.GSPputBad) ;
-            throw ex ;
-        }
-    }
-
-    protected void doOptions$(HttpAction action) {
-        incCounter(action.srvRef, CounterName.GSPoptions) ;
-        try {
-            doOptions(action) ;
-            incCounter(action.srvRef, CounterName.GSPoptionsGood) ;
-        } catch ( ActionErrorException ex) {
-            incCounter(action.srvRef, CounterName.GSPoptionsBad) ;
-            throw ex ;
-        }
-    }
-    
-    protected abstract void doGet(HttpAction action) ;
-    protected abstract void doHead(HttpAction action) ;
-    protected abstract void doPost(HttpAction action) ;
-    protected abstract void doPatch(HttpAction action) ;
-    protected abstract void doDelete(HttpAction action) ;
-    protected abstract void doPut(HttpAction action) ;
-    protected abstract void doOptions(HttpAction action) ;
-    
-    // @@ Move to SPARQL_ServletBase
-    // Check for all RiotReader
-    public static void parse(HttpAction action, StreamRDF dest, InputStream input, Lang lang, String base) {
-        try {
-            ReaderRIOT r = RDFDataMgr.createReader(lang) ;
-            if ( r == null )
-                errorBadRequest("No parser for language '"+lang.getName()+"'") ;
-            r.setErrorHandler(errorHandler); 
-            r.read(input, base, null, dest, null) ; 
-        } 
-        catch (RiotException ex) { errorBadRequest("Parse error: "+ex.getMessage()) ; }
-    }
-
-    @Override
-    protected void validate(HttpAction action)
-    {
-        HttpServletRequest request = action.request ;
-        // Direct naming.
-        if ( request.getQueryString() == null )
-            //errorBadRequest("No query string") ;
-            return ;
-        
-        String g = request.getParameter(HttpNames.paramGraph) ;
-        String d = request.getParameter(HttpNames.paramGraphDefault) ;
-        
-        if ( g != null && d !=null )
-            errorBadRequest("Both ?default and ?graph in the query string of the request") ;
-        
-        if ( g == null && d == null )
-            errorBadRequest("Neither ?default nor ?graph in the query string of the request") ;
-        
-        int x1 = SPARQL_Protocol.countParamOccurences(request, HttpNames.paramGraph) ;
-        int x2 = SPARQL_Protocol.countParamOccurences(request, HttpNames.paramGraphDefault) ;
-        
-        if ( x1 > 1 )
-            errorBadRequest("Multiple ?default in the query string of the request") ;
-        if ( x2 > 1 )
-            errorBadRequest("Multiple ?graph in the query string of the request") ;
-        
-        Enumeration<String> en = request.getParameterNames() ;
-        for ( ; en.hasMoreElements() ; )
-        {
-            String h = en.nextElement() ;
-            if ( ! HttpNames.paramGraph.equals(h) && ! HttpNames.paramGraphDefault.equals(h) )
-                errorBadRequest("Unknown parameter '"+h+"'") ;
-            // one of ?default and &graph
-            if ( request.getParameterValues(h).length != 1 )
-                errorBadRequest("Multiple parameters '"+h+"'") ;
-        }
-    }
-
-    protected static String getOneOnly(HttpServletRequest request, String name)
-    {
-        String[] values = request.getParameterValues(name) ;
-        if ( values == null )
-            return null ;
-        if ( values.length == 0 )
-            return null ;
-        if ( values.length > 1 )
-            errorBadRequest("Multiple occurrences of '"+name+"'") ;
-        return values[0] ;
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_REST_R.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_REST_R.java b/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_REST_R.java
deleted file mode 100644
index 0c02b51..0000000
--- a/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_REST_R.java
+++ /dev/null
@@ -1,128 +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.fuseki.servlets;
-
-import static java.lang.String.format ;
-
-import java.io.IOException ;
-
-import javax.servlet.ServletOutputStream ;
-
-import org.apache.jena.atlas.web.MediaType ;
-import org.apache.jena.atlas.web.TypedOutputStream ;
-import org.apache.jena.fuseki.HttpNames ;
-import org.apache.jena.riot.* ;
-
-import com.hp.hpl.jena.graph.Graph ;
-
-/** Only the READ operations */
-public class SPARQL_REST_R extends SPARQL_REST
-{
-    public SPARQL_REST_R()
-    { super() ; }
-    
-    
-    @Override
-    protected String mapRequestToDataset(String uri) { return mapRequestToDatasetLongest$(uri) ; } 
-
-    @Override
-    protected void doGet(HttpAction action)
-    {
-        // Assume success - do the set up before grabbing the lock.
-        // Sets content type.
-        MediaType mediaType = HttpAction.contentNegotationRDF(action) ;
-       
-        ServletOutputStream output ;
-        try { output = action.response.getOutputStream() ; }
-        catch (IOException ex) { errorOccurred(ex) ; output = null ; }
-        
-        TypedOutputStream out = new TypedOutputStream(output, mediaType) ;
-        Lang lang = RDFLanguages.contentTypeToLang(mediaType.getContentType()) ;
-
-        if ( action.verbose )
-            log.info(format("[%d]   Get: Content-Type=%s, Charset=%s => %s", 
-                            action.id, mediaType.getContentType(), mediaType.getCharset(), lang.getName())) ;
-
-        action.beginRead() ;
-        setCommonHeaders(action.response) ;
-
-        try {
-            Target target = determineTarget(action) ;
-            if ( log.isDebugEnabled() )
-                log.debug("GET->"+target) ;
-            boolean exists = target.exists() ;
-            if ( ! exists )
-                errorNotFound("No such graph: <"+target.name+">") ;
-            // If we want to set the Content-Length, we need to buffer.
-            //response.setContentLength(??) ;
-            String ct = lang.getContentType().toHeaderString() ;
-            action.response.setContentType(ct) ;
-            Graph g = target.graph() ;
-            //Special case RDF/XML to be the plain (faster, less readable) form
-            RDFFormat fmt = 
-                ( lang == Lang.RDFXML ) ? RDFFormat.RDFXML_PLAIN : RDFWriterRegistry.defaultSerialization(lang) ;  
-            RDFDataMgr.write(out, g, fmt) ;
-            success(action) ;
-        } finally { action.endRead() ; }
-    }
-    
-    @Override
-    protected void doOptions(HttpAction action)
-    {
-        setCommonHeadersForOptions(action.response) ;
-        action.response.setHeader(HttpNames.hAllow, "GET,HEAD,OPTIONS") ;
-        action.response.setHeader(HttpNames.hContentLengh, "0") ;
-        success(action) ;
-    }
-
-    @Override
-    protected void doHead(HttpAction action)
-    {
-        setCommonHeaders(action.response) ;
-        action.beginRead() ;
-        try { 
-            Target target = determineTarget(action) ;
-            if ( log.isDebugEnabled() )
-                log.debug("HEAD->"+target) ;
-            if ( ! target.exists() )
-            {
-                successNotFound(action) ;
-                return ;
-            }
-            MediaType mediaType = HttpAction.contentNegotationRDF(action) ;
-            success(action) ;
-        } finally { action.endRead() ; }
-    }
-
-    @Override
-    protected void doPost(HttpAction action)
-    { errorMethodNotAllowed("POST") ; }
-
-    @Override
-    protected void doDelete(HttpAction action)
-    { errorMethodNotAllowed("DELETE") ; }
-
-    @Override
-    protected void doPut(HttpAction action)
-    { errorMethodNotAllowed("PUT") ; }
-
-    @Override
-    protected void doPatch(HttpAction action)
-    { errorMethodNotAllowed("PATCH") ; }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_REST_RW.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_REST_RW.java b/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_REST_RW.java
deleted file mode 100644
index 712d543..0000000
--- a/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_REST_RW.java
+++ /dev/null
@@ -1,232 +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.fuseki.servlets;
-
-import static java.lang.String.format ;
-
-import java.io.IOException ;
-import java.io.InputStream ;
-import java.util.Map ;
-import java.util.Map.Entry ;
-
-import org.apache.jena.atlas.io.IO ;
-import org.apache.jena.atlas.web.ContentType ;
-import org.apache.jena.fuseki.FusekiLib ;
-import org.apache.jena.fuseki.HttpNames ;
-import org.apache.jena.riot.Lang ;
-import org.apache.jena.riot.RDFLanguages ;
-import org.apache.jena.riot.RiotException ;
-import org.apache.jena.riot.WebContent ;
-import org.apache.jena.riot.system.StreamRDF ;
-import org.apache.jena.riot.system.StreamRDFLib ;
-import org.apache.jena.web.HttpSC ;
-
-import com.hp.hpl.jena.graph.Graph ;
-import com.hp.hpl.jena.sparql.graph.GraphFactory ;
-
-/** The WRITE operations added to the READ operations */
-public class SPARQL_REST_RW extends SPARQL_REST_R
-{
-    public SPARQL_REST_RW()
-    { super() ; }
-
-    @Override
-    protected void doOptions(HttpAction action)
-    {
-        setCommonHeadersForOptions(action.response) ;
-        action.response.setHeader(HttpNames.hAllow, "GET,HEAD,OPTIONS,PUT,DELETE,POST");
-        action.response.setHeader(HttpNames.hContentLengh, "0") ;
-        success(action) ;
-    }
-    
-    @Override
-    protected void doDelete(HttpAction action)
-    {
-        action.beginWrite() ;
-        try {
-            Target target = determineTarget(action) ;
-            if ( log.isDebugEnabled() )
-                log.debug("DELETE->"+target) ;
-            boolean existedBefore = target.exists() ; 
-            if ( ! existedBefore)
-            {
-                // commit, not abort, because locking "transactions" don't support abort. 
-                action.commit() ;
-                errorNotFound("No such graph: "+target.name) ;
-            } 
-            deleteGraph(action) ;
-            action.commit() ;
-        }
-        finally { action.endWrite() ; }
-        ServletBase.successNoContent(action) ;
-    }
-
-    @Override
-    protected void doPut(HttpAction action)     { doPutPost(action, true) ; }
-
-    @Override
-    protected void doPost(HttpAction action)     { doPutPost(action, false) ; }
-
-    private void doPutPost(HttpAction action, boolean overwrite) {
-        ContentType ct = FusekiLib.getContentType(action) ;
-        if ( ct == null )
-            errorBadRequest("No Content-Type:") ;
-
-        // Helper case - if it's a possible HTTP file upload, pretend that's the action.
-        if ( WebContent.contentTypeMultipartFormData.equalsIgnoreCase(ct.getContentType()) ) {
-            String base = wholeRequestURL(action.request) ;
-            SPARQL_Upload.upload(action, base) ;
-            return ; 
-        }
-
-        if ( WebContent.matchContentType(WebContent.ctMultipartMixed, ct) )
-            error(HttpSC.UNSUPPORTED_MEDIA_TYPE_415, "multipart/mixed not supported") ;
-        
-        boolean existedBefore = false ;
-        if ( action.isTransactional() )
-            existedBefore = addDataIntoTxn(action, overwrite) ;
-        else
-            existedBefore = addDataIntoNonTxn(action, overwrite) ;
-            
-        if ( existedBefore )
-            ServletBase.successNoContent(action) ;
-        else
-            ServletBase.successCreated(action) ;
-    }
-
-    /** Directly add data in a transaction.
-     * Assumes recovery from parse errors by transaction abort.
-     * Return whether the target existed before.
-     * @param action
-     * @param cleanDest Whether to remove data first (true = PUT, false = POST)
-     * @return whether the target existed beforehand
-     */
-    protected static boolean addDataIntoTxn(HttpAction action, boolean overwrite) {   
-        action.beginWrite();
-        Target target = determineTarget(action) ;
-        boolean existedBefore = false ;
-        try {
-            if ( log.isDebugEnabled() )
-                log.debug("  ->"+target) ;
-            existedBefore = target.exists() ;
-            Graph g = target.graph() ;
-            if ( overwrite && existedBefore )
-                clearGraph(target) ;
-            StreamRDF sink = StreamRDFLib.graph(g) ;
-            incomingData(action, sink);
-            action.commit() ;
-            return existedBefore ;
-        } catch (RiotException ex) { 
-            // Parse error
-            action.abort() ;
-            errorBadRequest(ex.getMessage()) ;
-            return existedBefore ;
-        } catch (Exception ex) {
-            // Something else went wrong.  Backout.
-            action.abort() ;
-            errorOccurred(ex.getMessage()) ;
-            return existedBefore ;
-        } finally {
-            action.endWrite() ;
-        }
-    }
-
-    /** Add data where the destination does not support full transactions.
-     *  In particular, with no abort, and actions probably going to the real storage
-     *  parse errors can lead to partial updates.  Instead, parse to a temporary
-     *  graph, then insert that data.  
-     * @param action
-     * @param cleanDest Whether to remove data first (true = PUT, false = POST)
-     * @return whether the target existed beforehand.
-     */
-    
-    protected static boolean addDataIntoNonTxn(HttpAction action, boolean overwrite) {
-        Graph graphTmp = GraphFactory.createGraphMem() ;
-        StreamRDF dest = StreamRDFLib.graph(graphTmp) ;
-
-        try { incomingData(action, dest); }
-        catch (RiotException ex) {
-            errorBadRequest(ex.getMessage()) ;
-            return false ;
-        }
-        // Now insert into dataset
-        action.beginWrite() ;
-        Target target = determineTarget(action) ;
-        boolean existedBefore = false ;
-        try {
-            if ( log.isDebugEnabled() )
-                log.debug("  ->"+target) ;
-            existedBefore = target.exists() ; 
-            if ( overwrite && existedBefore )
-                clearGraph(target) ;
-            FusekiLib.addDataInto(graphTmp, target.dsg, target.graphName) ;
-            action.commit() ;
-            return existedBefore ;
-        } catch (Exception ex) {
-            // We parsed into a temporary graph so an exception at this point
-            // is not because of a parse error.
-            // We're in the non-transactional branch, this probably will not work
-            // but it might and there is no harm safely trying. 
-            try { action.abort() ; } catch (Exception ex2) {} 
-            errorOccurred(ex.getMessage()) ;
-            return existedBefore ;            
-        } finally { action.endWrite() ; }
-    }
-    
-    private static void incomingData(HttpAction action, StreamRDF dest) {
-        String base = wholeRequestURL(action.request) ;
-        ContentType ct = FusekiLib.getContentType(action) ;
-        Lang lang = RDFLanguages.contentTypeToLang(ct.getContentType()) ;
-        if ( lang == null ) {
-            errorBadRequest("Unknown content type for triples: " + ct) ;
-            return ;
-        }
-        InputStream input = null ;
-        try { input = action.request.getInputStream() ; } 
-        catch (IOException ex) { IO.exception(ex) ; }
-    
-        int len = action.request.getContentLength() ;
-        if ( action.verbose ) {
-            if ( len >= 0 )
-                log.info(format("[%d]   Body: Content-Length=%d, Content-Type=%s, Charset=%s => %s", action.id, len,
-                                ct.getContentType(), ct.getCharset(), lang.getName())) ;
-            else
-                log.info(format("[%d]   Body: Content-Type=%s, Charset=%s => %s", action.id, ct.getContentType(),
-                                ct.getCharset(), lang.getName())) ;
-        }
-    
-        parse(action, dest, input, lang, base) ;
-    }
-
-    protected static void deleteGraph(HttpAction action) {
-        Target target = determineTarget(action) ;
-        if ( target.isDefault )
-            target.graph().clear() ;
-        else
-            action.getActiveDSG().removeGraph(target.graphName) ;
-    }
-
-    protected static void clearGraph(Target target) {
-        Graph g = target.graph() ;
-        g.clear() ;
-        Map<String, String> pm = g.getPrefixMapping().getNsPrefixMap() ;
-        for ( Entry<String, String> e : pm.entrySet() ) 
-            g.getPrefixMapping().removeNsPrefix(e.getKey()) ;
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_ServletBase.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_ServletBase.java b/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_ServletBase.java
deleted file mode 100644
index a3d5271..0000000
--- a/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_ServletBase.java
+++ /dev/null
@@ -1,458 +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.fuseki.servlets;
-
-import static java.lang.String.format ;
-import static org.apache.jena.fuseki.server.CounterName.Requests ;
-import static org.apache.jena.fuseki.server.CounterName.RequestsBad ;
-import static org.apache.jena.fuseki.server.CounterName.RequestsGood ;
-
-import java.io.IOException ;
-import java.util.Enumeration ;
-import java.util.Map ;
-import java.util.concurrent.atomic.AtomicLong ;
-
-import javax.servlet.ServletException ;
-import javax.servlet.http.HttpServletRequest ;
-import javax.servlet.http.HttpServletResponse ;
-
-import org.apache.jena.atlas.RuntimeIOException ;
-import org.apache.jena.fuseki.Fuseki ;
-import org.apache.jena.fuseki.HttpNames ;
-import org.apache.jena.fuseki.server.* ;
-import org.apache.jena.web.HttpSC ;
-
-import com.hp.hpl.jena.query.ARQ ;
-import com.hp.hpl.jena.query.QueryCancelledException ;
-import com.hp.hpl.jena.sparql.util.Context ;
-
-/**
- * Base servlet for SPARQL requests.
- */
-public abstract class SPARQL_ServletBase extends ServletBase
-{
-    /**
-     * Creates a new SPARQL base Servlet.
-     */
-    protected SPARQL_ServletBase()      {   super() ; }
-    
-    // Common framework for handling HTTP requests
-    /**
-     * Handles GET and POST requests.
-     * @param request HTTP request
-     * @param response HTTP response
-     */
-    protected void doCommon(HttpServletRequest request, HttpServletResponse response)
-    //throws ServletException, IOException
-    {
-        try {
-            long id = allocRequestId(request, response);
-            
-            // Lifecycle
-            HttpAction action = allocHttpAction(id, request, response) ;
-            // then add to doCommonWorker
-            // work with HttpServletResponseTracker
-            
-            printRequest(action) ;
-            action.setStartTime() ;
-            
-            response = action.response ;
-            initResponse(request, response) ;
-            Context cxt = ARQ.getContext() ;
-            
-            try {
-                execCommonWorker(action) ;
-            } catch (QueryCancelledException ex) {
-                // Also need the per query info ...
-                String message = String.format("The query timed out (restricted to %s ms)", cxt.get(ARQ.queryTimeout));
-                // Possibility :: response.setHeader("Retry-after", "600") ;    // 5 minutes
-                responseSendError(response, HttpSC.SERVICE_UNAVAILABLE_503, message);
-            } catch (ActionErrorException ex) {
-                if ( ex.exception != null )
-                    ex.exception.printStackTrace(System.err) ;
-                // Log message done by printResponse in a moment.
-                if ( ex.message != null )
-                    responseSendError(response, ex.rc, ex.message) ;
-                else
-                    responseSendError(response, ex.rc) ;
-            } catch (RuntimeIOException ex) {
-                log.warn(format("[%d] Runtime IO Exception (client left?) RC = %d", id, HttpSC.INTERNAL_SERVER_ERROR_500)) ;
-                responseSendError(response, HttpSC.INTERNAL_SERVER_ERROR_500, ex.getMessage()) ;
-            } catch (Throwable ex) {
-                // This should not happen.
-                //ex.printStackTrace(System.err) ;
-                log.warn(format("[%d] RC = %d : %s", id, HttpSC.INTERNAL_SERVER_ERROR_500, ex.getMessage()), ex) ;
-                responseSendError(response, HttpSC.INTERNAL_SERVER_ERROR_500, ex.getMessage()) ;
-            }
-    
-            action.setFinishTime() ;
-            printResponse(action) ;
-            archiveHttpAction(action) ;
-        } catch (Throwable th) {
-            log.error("Internal error", th) ;
-        }
-    }
-
-    // ---- Operation lifecycle
-
-    /**
-     * Returns a fresh HTTP Action for this request.
-     * @param id the Request ID
-     * @param request HTTP request
-     * @param response HTTP response
-     * @return a new HTTP Action
-     */
-    protected HttpAction allocHttpAction(long id, HttpServletRequest request, HttpServletResponse response) {
-        // Need a way to set verbose logging on a per servlet and per request basis. 
-        return new HttpAction(id, request, response, verboseLogging) ;
-    }
-
-    /**
-     * Validates a HTTP Action.
-     * @param action HTTP Action
-     */
-    protected abstract void validate(HttpAction action) ;
-
-    /**
-     * Performs the HTTP Action.
-     * @param action HTTP Action
-     */
-    protected abstract void perform(HttpAction action) ;
-
-    /**
-     * Default start step.
-     * @param action HTTP Action
-     */
-    protected void startRequest(HttpAction action) {
-    }
-
-    /**
-     * Default finish step.
-     * @param action HTTP Action
-     */
-    protected void finishRequest(HttpAction action) { }
-
-    /**
-     * Archives the HTTP Action.
-     * @param action HTTP Action
-     * @see HttpAction#minimize()
-     */
-    private void archiveHttpAction(HttpAction action)
-    {
-        action.minimize() ;
-    }
-
-    /**
-     * Executes common tasks, including mapping the request to the right dataset, setting the dataset into the HTTP
-     * action, and retrieving the service for the dataset requested. Finally, it calls the
-     * {@link #executeAction(HttpAction)} method, which executes the HTTP Action life cycle.
-     * @param action HTTP Action
-     */
-    private void execCommonWorker(HttpAction action)
-    {
-        DatasetRef dsRef = null ;
-        String uri = action.request.getRequestURI() ;
-
-        String datasetUri = mapRequestToDataset(uri) ;
-        
-        if ( datasetUri != null ) {
-            dsRef = DatasetRegistry.get().get(datasetUri) ;
-            if ( dsRef == null ) {
-                errorNotFound("No dataset for URI: "+datasetUri) ;
-                return ;
-            }
-        } else
-            dsRef = FusekiConfig.serviceOnlyDatasetRef() ;
-
-        action.setDataset(dsRef) ;
-        String serviceName = mapRequestToService(dsRef, uri, datasetUri) ;
-        ServiceRef srvRef = dsRef.getServiceRef(serviceName) ;
-        action.setService(srvRef) ;
-        executeAction(action) ;
-    }
-
-    /**
-     * Utility method, that increments and returns the AtomicLong value.
-     * @param x AtomicLong
-     */
-    protected void inc(AtomicLong x)
-    {
-        x.incrementAndGet() ;
-    }
-
-    /**
-     * Executes the HTTP Action. Serves as intercept point for the UberServlet.
-     * @param action HTTP Action
-     */
-    protected void executeAction(HttpAction action)
-    {
-        executeLifecycle(action) ;
-    }
-    
-    /**
-     * Handles the service request lifecycle. Called directly by the UberServlet,
-     * which has not done any stats by this point.
-     * @param action {@link HttpAction}
-     * @see HttpAction
-     */
-    protected void executeLifecycle(HttpAction action)
-    {
-        incCounter(action.dsRef, Requests) ;
-        incCounter(action.srvRef, Requests) ;
-
-        startRequest(action) ;
-        try {
-            validate(action) ;
-        } catch (ActionErrorException ex) {
-            incCounter(action.dsRef,RequestsBad) ;
-            throw ex ;
-        }
-
-        try {
-            perform(action) ;
-            // Success
-            incCounter(action.srvRef, RequestsGood) ;
-            incCounter(action.dsRef, RequestsGood) ;
-        } catch (ActionErrorException ex) {
-            incCounter(action.srvRef, RequestsBad) ;
-            incCounter(action.dsRef, RequestsBad) ;
-            throw ex ;
-        } catch (QueryCancelledException ex) {
-            incCounter(action.srvRef, RequestsBad) ;
-            incCounter(action.dsRef, RequestsBad) ;
-            throw ex ;
-        } finally {
-            finishRequest(action) ;
-        }
-    }
-
-    /**
-     * Increments a counter.
-     * @param counters a {@link Counter}
-     * @param name a {@link CounterName}
-     */
-    protected static void incCounter(Counters counters, CounterName name) {
-        try {
-            if ( counters.getCounters().contains(name) )
-                counters.getCounters().inc(name) ;
-        } catch (Exception ex) {
-            Fuseki.serverLog.warn("Exception on counter inc", ex) ;
-        }
-    }
-
-    /**
-     * Decrements a counter.
-     * @param counters a {@link Counter}
-     * @param name a {@link CounterName}
-     */
-    protected static void decCounter(Counters counters, CounterName name) {
-        try {
-            if ( counters.getCounters().contains(name) )
-                counters.getCounters().dec(name) ;
-        } catch (Exception ex) {
-            Fuseki.serverLog.warn("Exception on counter dec", ex) ;
-        }
-    }
-
-    /**
-     * <p>Sends an <strong>error</strong> when the PATCH method is called.</p>
-     * <p>Throws ServletException or IOException as per overloaded method signature.</p>
-     * @param request HTTP request
-     * @param response HTTP response
-     * @throws ServletException from overloaded method signature
-     * @throws IOException from overloaded method signature
-     */
-    protected void doPatch(HttpServletRequest request, HttpServletResponse response)
-    throws ServletException, IOException
-    {
-        response.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED, "HTTP PATCH not supported");
-    }
-
-    /**
-     * Prints the HTTP Action request to the program log, using the INFO level.
-     * @param action {@link HttpAction}
-     */
-    private void printRequest(HttpAction action)
-    {
-        String url = wholeRequestURL(action.request) ;
-        String method = action.request.getMethod() ;
-
-        log.info(format("[%d] %s %s", action.id, method, url)) ;
-        if ( action.verbose ) {
-            Enumeration<String> en = action.request.getHeaderNames() ;
-            for (; en.hasMoreElements();) {
-                String h = en.nextElement() ;
-                Enumeration<String> vals = action.request.getHeaders(h) ;
-                if (!vals.hasMoreElements())
-                    log.info(format("[%d]   ", action.id, h)) ;
-                else {
-                    for (; vals.hasMoreElements();)
-                        log.info(format("[%d]   %-20s %s", action.id, h, vals.nextElement())) ;
-                }
-            }
-        }
-    }
-
-    /**
-     * Initiates the response, by setting common headers such as Access-Control-Allow-Origin and Server, and
-     * the Vary header if the request method used was a GET.
-     * @param request HTTP request
-     * @param response HTTP response
-     */
-    private void initResponse(HttpServletRequest request, HttpServletResponse response)
-    {
-        setCommonHeaders(response) ;
-        String method = request.getMethod() ;
-        // All GET and HEAD operations are sensitive to conneg so ...
-        if ( HttpNames.METHOD_GET.equalsIgnoreCase(method) || HttpNames.METHOD_HEAD.equalsIgnoreCase(method) )
-            setVaryHeader(response) ;
-    }
-
-    /**
-     * Prints the HTTP Action response to the program log, using the INFO level.
-     * @param action {@link HttpAction}
-     */
-    private void printResponse(HttpAction action)
-    {
-        long time = action.getTime() ;
-        
-        HttpServletResponseTracker response = action.response ;
-        if ( action.verbose )
-        {
-            if ( action.contentType != null )
-                log.info(format("[%d]   %-20s %s", action.id, HttpNames.hContentType, action.contentType)) ;
-            if ( action.contentLength != -1 )
-                log.info(format("[%d]   %-20s %d", action.id, HttpNames.hContentLengh, action.contentLength)) ;
-            for ( Map.Entry<String, String> e: action.headers.entrySet() )
-                log.info(format("[%d]   %-20s %s", action.id, e.getKey(), e.getValue())) ;
-        }
-
-        String timeStr = fmtMillis(time) ;
-
-        if ( action.message == null )
-            log.info(String.format("[%d] %d %s (%s) ", action.id, action.statusCode, HttpSC.getMessage(action.statusCode), timeStr)) ;
-        else
-            log.info(String.format("[%d] %d %s (%s) ", action.id, action.statusCode, action.message, timeStr)) ;
-    }
-
-    /**
-     * <p>Given a time epoch, it will return the time in milli seconds if it is less than 1000,
-     * otherwise it will normalize it to display as second.</p>
-     * <p>It appends a 'ms' suffix when using milli seconds, and ditto <i>s</i> for seconds.</p>
-     * <p>For instance: </p>
-     * <ul>
-     * <li>10 emits 10 ms</li>
-     * <li>999 emits 999 ms</li>
-     * <li>1000 emits 1.000000 s</li>
-     * <li>10000 emits 10.000000 s</li>
-     * </ul>
-     * @param time the time epoch
-     * @return the time in milli seconds or in seconds
-     */
-    private static String fmtMillis(long time)
-    {
-        // Millis only? seconds only?
-        if ( time < 1000 )
-            return String.format("%,d ms", time) ;
-        return String.format("%,.3f s", time/1000.0) ;
-    }
-
-    /**
-     * Map request to uri in the registry. null means no mapping done (passthrough).
-     * @param uri the URI
-     * @return the dataset
-     */
-    protected String mapRequestToDataset(String uri) 
-    {
-        return mapRequestToDataset$(uri) ;
-    }
-    
-    /**
-     * A possible implementation for mapRequestToDataset(String) that assumes the form /dataset/service.
-     * @param uri the URI
-     * @return the dataset
-     */
-    protected static String mapRequestToDataset$(String uri)
-    {
-        // Chop off trailing part - the service selector
-        // e.g. /dataset/sparql => /dataset 
-        int i = uri.lastIndexOf('/') ;
-        if ( i == -1 )
-            return null ;
-        if ( i == 0 )
-        {
-            // started with '/' - leave.
-            return uri ;
-        }
-        
-        return uri.substring(0, i) ;
-    }
-
-    /**
-     * Maps a request to a service (e.g. Query, Update).
-     * @param dsRef a {@link DatasetRef}
-     * @param uri the URI
-     * @param datasetURI the dataset URI
-     * @return an empty String (i.e. "") if the DatasetRef is null, or if its name is longer than the URI's name.
-     * Otherwise will return the service name.
-     */
-    protected String mapRequestToService(DatasetRef dsRef, String uri, String datasetURI)
-    {
-        if ( dsRef == null )
-            return "" ;
-        if ( dsRef.name.length() >= uri.length() )
-            return "" ;
-        return uri.substring(dsRef.name.length()+1) ;   // Skip the separating "/"
-        
-    }
-    
-    /**
-     * Implementation of mapRequestToDataset(String) that looks for the longest match in the registry.
-     * This includes use in direct naming GSP.
-     * @param uri the URI
-     * @return <code>null</code> if the URI is null, otherwise will return the longest match in the registry.
-     */
-    protected static String mapRequestToDatasetLongest$(String uri) 
-    {
-        if ( uri == null )
-            return null ;
-        
-        // This covers local, using the URI as a direct name for
-        // a graph, not just using the indirect ?graph= or ?default 
-        // forms.
-
-        String ds = null ;
-        for ( String ds2 : DatasetRegistry.get().keys() ) {
-            if ( ! uri.startsWith(ds2) )
-                continue ;
-
-            if ( ds == null )
-            {
-                ds = ds2 ;
-                continue ; 
-            }
-            if ( ds.length() < ds2.length() )
-            {
-                ds = ds2 ;
-                continue ;
-            }
-        }
-        return ds ;
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_UberServlet.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_UberServlet.java b/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_UberServlet.java
deleted file mode 100644
index 0c10cee..0000000
--- a/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_UberServlet.java
+++ /dev/null
@@ -1,338 +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.fuseki.servlets;
-
-import static java.lang.String.format ;
-
-import java.util.List ;
-
-import javax.servlet.http.HttpServletRequest ;
-import javax.servlet.http.HttpServletResponse ;
-
-import org.apache.jena.atlas.web.MediaType ;
-import org.apache.jena.fuseki.DEF ;
-import org.apache.jena.fuseki.FusekiException ;
-import org.apache.jena.fuseki.HttpNames ;
-import org.apache.jena.fuseki.conneg.ConNeg ;
-import org.apache.jena.fuseki.server.DatasetRef ;
-import org.apache.jena.fuseki.server.ServiceRef ;
-import org.apache.jena.riot.WebContent ;
-
-/** This servlet can be attached to a dataset location
- *  and acts as a router for all SPARQL operations
- *  (query, update, graph store, both direct and indirect naming). 
- */
-public abstract class SPARQL_UberServlet extends SPARQL_ServletBase
-{
-    protected abstract boolean allowQuery(HttpAction action) ;
-    protected abstract boolean allowUpdate(HttpAction action) ;
-    protected abstract boolean allowREST_R(HttpAction action) ;
-    protected abstract boolean allowREST_W(HttpAction action) ;
-    protected abstract boolean allowQuadsR(HttpAction action) ;
-    protected abstract boolean allowQuadsW(HttpAction action) ;
-    
-    public static class ReadOnly extends SPARQL_UberServlet
-    {
-        public ReadOnly()    { super() ; }
-        @Override protected boolean allowQuery(HttpAction action)    { return true ; }
-        @Override protected boolean allowUpdate(HttpAction action)   { return false ; }
-        @Override protected boolean allowREST_R(HttpAction action)   { return true ; }
-        @Override protected boolean allowREST_W(HttpAction action)   { return false ; }
-        @Override protected boolean allowQuadsR(HttpAction action)   { return true ; }
-        @Override protected boolean allowQuadsW(HttpAction action)   { return false ; }
-    }
-
-    public static class ReadWrite extends SPARQL_UberServlet
-    {
-        public ReadWrite()    { super() ; }
-        @Override protected boolean allowQuery(HttpAction action)    { return true ; }
-        @Override protected boolean allowUpdate(HttpAction action)   { return true ; }
-        @Override protected boolean allowREST_R(HttpAction action)   { return true ; }
-        @Override protected boolean allowREST_W(HttpAction action)   { return true ; }
-        @Override protected boolean allowQuadsR(HttpAction action)   { return true ; }
-        @Override protected boolean allowQuadsW(HttpAction action)   { return true ; }
-    }
-
-    public static class AccessByConfig extends SPARQL_UberServlet
-    {
-        public AccessByConfig()    { super() ; }
-        @Override protected boolean allowQuery(HttpAction action)    { return isEnabled(action.dsRef.query) ; }
-        @Override protected boolean allowUpdate(HttpAction action)   { return isEnabled(action.dsRef.update) ; }
-        @Override protected boolean allowREST_R(HttpAction action)   { return isEnabled(action.dsRef.readGraphStore) || allowREST_W(action); }
-        @Override protected boolean allowREST_W(HttpAction action)   { return isEnabled(action.dsRef.readWriteGraphStore) ; }
-        // Quad operations tied to presence/absence of GSP.
-        @Override protected boolean allowQuadsR(HttpAction action)   { return isEnabled(action.dsRef.readGraphStore) ; }
-        @Override protected boolean allowQuadsW(HttpAction action)   { return isEnabled(action.dsRef.readWriteGraphStore) ; }
-
-        private boolean isEnabled(ServiceRef service) { return service.isActive() ; } 
-    }
-    
-    /*  This can be used for a single servlet for everything (über-servlet)
-     *  
-     *  It can check for a request that looks like a service request and passes it on.
-     * This takes precedence over direct naming.
-     */
-    
-    // Refactor? Extract the direct naming handling.
-    // To test: enable in SPARQLServer.configureOneDataset
-    
-    private final SPARQL_ServletBase queryServlet    = new SPARQL_QueryDataset() ;
-    private final SPARQL_ServletBase updateServlet   = new SPARQL_Update() ;
-    private final SPARQL_ServletBase uploadServlet   = new SPARQL_Upload() ;
-    private final SPARQL_REST        restServlet_RW  = new SPARQL_REST_RW() ;
-    private final SPARQL_REST        restServlet_R   = new SPARQL_REST_R() ;
-    private final SPARQL_ServletBase restQuads       = new REST_Quads() ;
-    
-    public SPARQL_UberServlet() { super(); }
-
-    private String getEPName(String dsname, List<String> endpoints)
-    {
-        if (endpoints == null || endpoints.size() == 0) return null ;
-        String x = endpoints.get(0) ;
-        if ( ! dsname.endsWith("/") )
-            x = dsname+"/"+x ;
-        else
-            x = dsname+x ;
-        return x ;
-    }
-    
-    // These calls should not happen because we hook in at executeAction
-    @Override protected void validate(HttpAction action) { throw new FusekiException("Call to SPARQL_UberServlet.validate") ; }
-    @Override protected void perform(HttpAction action)  { throw new FusekiException("Call to SPARQL_UberServlet.perform") ; }
-
-    /** Map request to uri in the registry.
-     *  null means no mapping done 
-     */
-    @Override
-    protected String mapRequestToDataset(String uri) 
-    {
-        return mapRequestToDatasetLongest$(uri) ;
-    }
-    
-
-    /** Intercept the processing cycle at the point where the action has been set up,
-     *  the dataset target decided but no validation or execution has been done, 
-     *  nor any stats have been done.
-     */
-    @Override
-    protected void executeAction(HttpAction action)
-    {
-        long id = action.id ;
-        HttpServletRequest request = action.request ;
-        HttpServletResponse response = action.response ;
-        String uri = request.getRequestURI() ;
-        String method = request.getMethod() ;
-        DatasetRef desc = action.dsRef ;
-        
-        String trailing = findTrailing(uri, desc.name) ;
-        String qs = request.getQueryString() ;
-
-        boolean hasParams = request.getParameterMap().size() > 0 ;
-        
-        // Test for parameters - includes HTML forms.
-        boolean hasParamQuery           = request.getParameter(HttpNames.paramQuery) != null ;
-        // Include old name "request="
-        boolean hasParamUpdate          = request.getParameter(HttpNames.paramUpdate) != null || request.getParameter(HttpNames.paramRequest) != null ;
-        boolean hasParamGraph           = request.getParameter(HttpNames.paramGraph) != null ;
-        boolean hasParamGraphDefault    = request.getParameter(HttpNames.paramGraphDefault) != null ;
-        boolean isForm                  = WebContent.contentTypeHTMLForm.equalsIgnoreCase(request.getContentType()) ;
-
-        String ct = request.getContentType() ;
-        String charset = request.getCharacterEncoding() ;
-        
-        MediaType mt = null ;
-        if ( ct != null )
-            mt = MediaType.create(ct, charset) ;
-        
-        log.info(format("[%d] All: %s %s :: '%s' :: %s ? %s", id, method, desc.name, trailing, (mt==null?"<none>":mt), (qs==null?"":qs))) ;
-                       
-        boolean hasTrailing = ( trailing.length() != 0 ) ;
-        
-        if ( ! hasTrailing && ! hasParams )
-        {
-            restQuads.executeLifecycle(action) ;
-            return ;
-        }
-        
-        if ( ! hasTrailing )
-        {
-            // Has params of some kind.
-            if ( hasParamQuery || WebContent.contentTypeSPARQLQuery.equalsIgnoreCase(ct) )
-            {
-                // SPARQL Query
-                if ( ! allowQuery(action))
-                    errorForbidden("Forbidden: SPARQL query") ; 
-                executeRequest(action, queryServlet, desc.query) ;
-                return ;
-            }
-                 
-            if ( hasParamUpdate || WebContent.contentTypeSPARQLUpdate.equalsIgnoreCase(ct) )
-            {
-                // SPARQL Update
-                if ( ! allowQuery(action))
-                    errorForbidden("Forbidden: SPARQL query") ; 
-                executeRequest(action, updateServlet, desc.update) ;
-                return ;
-            }
-            
-            if ( hasParamGraph || hasParamGraphDefault )
-            {
-                doGraphStoreProtocol(action) ;
-                return ;
-            }
-            
-            errorBadRequest("Malformed request") ;
-            errorForbidden("Forbidden: SPARQL Graph Store Protocol : Read operation : "+method) ;
-        }
-        
-        final boolean checkForPossibleService = true ;
-        if ( checkForPossibleService )
-        {
-            // There is a trailing part.
-            // Check it's not the same name as a registered service.
-            // If so, dispatch to that service.
-            if ( serviceDispatch(action, desc.query, trailing, queryServlet) ) return ; 
-            if ( serviceDispatch(action, desc.update, trailing, updateServlet) ) return ; 
-            if ( serviceDispatch(action, desc.upload, trailing, uploadServlet) ) return ; 
-            if ( serviceDispatch(action, desc.readGraphStore, trailing, restServlet_R) ) return ; 
-            if ( serviceDispatch(action, desc.readWriteGraphStore, trailing, restServlet_RW) ) return ; 
-        }       
-        // There is a trailing part - params are illegal by this point.
-        if ( hasParams )
-            // ?? Revisit to include query-on-one-graph 
-            //errorBadRequest("Can't invoke a query-string service on a direct named graph") ;
-            errorNotFound("Not found: dataset='"+printName(desc.name)+"' service='"+printName(trailing)+"'");
-
-        // There is a trailing part - not a service, no params ==> GSP direct naming.
-        doGraphStoreProtocol(action) ;
-    }
-    
-    private String printName(String x) {
-        if ( x.startsWith("/") )
-            return x.substring(1) ;
-        return x ;
-    }
-    
-    private void doGraphStoreProtocol(HttpAction action)
-    {
-        // The GSP servlets handle direct and indirect naming. 
-        DatasetRef desc = action.dsRef ;
-        String method = action.request.getMethod() ;
-        
-        if ( HttpNames.METHOD_GET.equalsIgnoreCase(method) ||
-             HttpNames.METHOD_HEAD.equalsIgnoreCase(method) ) 
-       {
-           if ( ! allowREST_R(action))
-           // Graphs Store Protocol, indirect naming, read
-           // Indirect naming. Prefer the R service if available.
-           if ( desc.readGraphStore.isActive() )
-               executeRequest(action, restServlet_R, desc.readGraphStore) ;
-           else if ( desc.readWriteGraphStore.isActive() )
-               executeRequest(action, restServlet_RW, desc.readWriteGraphStore) ;
-           else
-               errorMethodNotAllowed(method) ;
-           return ;
-       }
-       
-       // Graphs Store Protocol, indirect naming, write
-       if ( ! allowREST_W(action))
-           errorForbidden("Forbidden: SPARQL Graph Store Protocol : Write operation : "+method) ;
-       executeRequest(action, restServlet_RW, desc.readWriteGraphStore) ;
-       return ;
-    }
-
-    private void executeRequest(HttpAction action, SPARQL_ServletBase servlet, ServiceRef service)
-    {
-        if ( service.endpoints.size() == 0 )
-            errorMethodNotAllowed(action.request.getMethod()) ;
-        servlet.executeLifecycle(action) ;
-    }
-
-    private void executeRequest(HttpAction action,SPARQL_ServletBase servlet)
-    {
-        servlet.executeLifecycle(action) ;
-//      // Forwarded dispatch.
-//      try
-//      {
-//          String target = getEPName(desc.name, endpointList) ;
-//          if ( target == null )
-//              errorMethodNotAllowed(request.getMethod()) ;
-//          // ** relative servlet forward
-//          request.getRequestDispatcher(target).forward(request, response) ;    
-        
-
-//          // ** absolute srvlet forward
-//          // getServletContext().getRequestDispatcher(target) ;
-//      } catch (Exception e) { errorOccurred(e) ; }        
-    }
-
-    protected static MediaType contentNegotationQuads(HttpAction action)
-    {
-        MediaType mt = ConNeg.chooseContentType(action.request, DEF.quadsOffer, DEF.acceptNQuads) ;
-        if ( mt == null )
-            return null ;
-        if ( mt.getContentType() != null )
-            action.response.setContentType(mt.getContentType());
-        if ( mt.getCharset() != null )
-        action.response.setCharacterEncoding(mt.getCharset()) ;
-        return mt ;
-    }
-
-    /** return true if dispatched */
-    private boolean serviceDispatch(HttpAction action, ServiceRef service, String srvName , SPARQL_ServletBase servlet)
-    {
-        if ( ! service.endpoints.contains(srvName) )
-            return false ;
-        servlet.executeLifecycle(action) ;
-        return true ;
-    }
-
-    /** Find the graph (direct naming) or service name */ 
-    protected String findTrailing(String uri, String dsname) 
-    {
-        if ( dsname.length() >= uri.length() )
-            return "" ;
-        return uri.substring(dsname.length()+1) ;   // Skip the separating "/"
-    }
-
-    @Override
-    protected void doHead(HttpServletRequest request, HttpServletResponse response)
-    { doCommon(request, response) ; }
-    
-    @Override
-    protected void doGet(HttpServletRequest request, HttpServletResponse response)
-    { doCommon(request, response) ; }
-
-    @Override
-    protected void doPost(HttpServletRequest request, HttpServletResponse response)
-    { doCommon(request, response) ; }
-
-    @Override
-    protected void doOptions(HttpServletRequest request, HttpServletResponse response)
-    { doCommon(request, response) ; }
-    
-    @Override
-    protected void doPut(HttpServletRequest request, HttpServletResponse response)
-    { doCommon(request, response) ; }
-
-    @Override
-    protected void doDelete(HttpServletRequest request, HttpServletResponse response)
-    { doCommon(request, response) ; }
-}
-

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Update.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Update.java b/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Update.java
deleted file mode 100644
index f16f634..0000000
--- a/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Update.java
+++ /dev/null
@@ -1,308 +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.fuseki.servlets;
-
-import static java.lang.String.format ;
-import static org.apache.jena.fuseki.Fuseki.requestLog ;
-import static org.apache.jena.fuseki.HttpNames.paramRequest ;
-import static org.apache.jena.fuseki.HttpNames.paramUpdate ;
-import static org.apache.jena.fuseki.HttpNames.paramUsingGraphURI ;
-import static org.apache.jena.fuseki.HttpNames.paramUsingNamedGraphURI ;
-import static org.apache.jena.fuseki.server.CounterName.UpdateExecErrors ;
-
-import java.io.ByteArrayInputStream ;
-import java.io.IOException ;
-import java.io.InputStream ;
-import java.util.Arrays ;
-import java.util.Collection ;
-import java.util.Enumeration ;
-import java.util.List ;
-
-import javax.servlet.ServletException ;
-import javax.servlet.http.HttpServletRequest ;
-import javax.servlet.http.HttpServletResponse ;
-
-import org.apache.jena.atlas.io.IO ;
-import org.apache.jena.atlas.lib.StrUtils ;
-import org.apache.jena.atlas.web.ContentType ;
-import org.apache.jena.fuseki.FusekiLib ;
-import org.apache.jena.fuseki.HttpNames ;
-import org.apache.jena.iri.IRI ;
-import org.apache.jena.riot.WebContent ;
-import org.apache.jena.riot.system.IRIResolver ;
-import org.apache.jena.web.HttpSC ;
-
-import com.hp.hpl.jena.graph.Node ;
-import com.hp.hpl.jena.graph.NodeFactory ;
-import com.hp.hpl.jena.query.QueryParseException ;
-import com.hp.hpl.jena.query.Syntax ;
-import com.hp.hpl.jena.sparql.modify.UsingList ;
-import com.hp.hpl.jena.update.UpdateAction ;
-import com.hp.hpl.jena.update.UpdateException ;
-import com.hp.hpl.jena.update.UpdateFactory ;
-import com.hp.hpl.jena.update.UpdateRequest ;
-
-public class SPARQL_Update extends SPARQL_Protocol
-{
-    // Base URI used to isolate parsing from the current directory of the server. 
-    private static final String UpdateParseBase = "http://example/update-base/" ;
-    private static final IRIResolver resolver = IRIResolver.create(UpdateParseBase) ;
-    
-    public SPARQL_Update()
-    { super() ; }
-
-    @Override
-    protected void doGet(HttpServletRequest request, HttpServletResponse response)
-    throws ServletException, IOException
-    {
-        response.sendError(HttpSC.BAD_REQUEST_400, "Attempt to perform SPARQL update by GET.  Use POST") ;
-    }
-    
-    @Override
-    protected void doPost(HttpServletRequest request, HttpServletResponse response)
-    throws ServletException, IOException
-    {
-        doCommon(request, response) ;
-    }
-    
-    @Override
-    protected void doOptions(HttpServletRequest request, HttpServletResponse response)
-    {
-        setCommonHeadersForOptions(response) ;
-        response.setHeader(HttpNames.hAllow, "OPTIONS,POST");
-        response.setHeader(HttpNames.hContentLengh, "0") ;
-    }
-
-    @Override
-    protected void perform(HttpAction action)
-    {
-        // WebContent needs to migrate to using ContentType.
-        String ctStr ;
-        {
-            ContentType ct = FusekiLib.getContentType(action) ;
-            if ( ct == null )
-                ctStr = WebContent.contentTypeSPARQLUpdate ;
-            else
-                ctStr = ct.getContentType() ;
-        }
-
-        if (WebContent.contentTypeSPARQLUpdate.equals(ctStr))
-        {
-            executeBody(action) ;
-            return ;
-        }
-        if (WebContent.contentTypeHTMLForm.equals(ctStr))
-        {
-            executeForm(action) ;
-            return ;
-        }
-        error(HttpSC.UNSUPPORTED_MEDIA_TYPE_415, "Bad content type: " + action.request.getContentType()) ;
-    }
-
-    protected static List<String> paramsForm = Arrays.asList(paramRequest, paramUpdate, 
-                                                             paramUsingGraphURI, paramUsingNamedGraphURI) ;
-    protected static List<String> paramsPOST = Arrays.asList(paramUsingGraphURI, paramUsingNamedGraphURI) ;
-    
-    @Override
-    protected void validate(HttpAction action)
-    {
-        HttpServletRequest request = action.request ;
-        
-        if ( ! HttpNames.METHOD_POST.equalsIgnoreCase(request.getMethod()) )
-            errorMethodNotAllowed("SPARQL Update : use POST") ;
-        
-        ContentType incoming = FusekiLib.getContentType(action) ;
-        String ctStr = ( incoming == null ) ? WebContent.contentTypeSPARQLUpdate : incoming.getContentType() ;
-        // ----
-        
-        if ( WebContent.contentTypeSPARQLUpdate.equals(ctStr) )
-        {
-            String charset = request.getCharacterEncoding() ;
-            if ( charset != null && ! charset.equalsIgnoreCase(WebContent.charsetUTF8) )
-                errorBadRequest("Bad charset: "+charset) ;
-            validate(request, paramsPOST) ;
-            return ;
-        }
-        
-        if ( WebContent.contentTypeHTMLForm.equals(ctStr) )
-        {
-            int x = countParamOccurences(request, paramUpdate) + countParamOccurences(request, paramRequest) ;
-            if ( x == 0 )
-                errorBadRequest("SPARQL Update: No 'update=' parameter") ;
-            if ( x != 1 )
-                errorBadRequest("SPARQL Update: Multiple 'update=' parameters") ;
-            
-            String requestStr = request.getParameter(paramUpdate) ;
-            if ( requestStr == null )
-                requestStr = request.getParameter(paramRequest) ;
-            if ( requestStr == null )
-                errorBadRequest("SPARQL Update: No update= in HTML form") ;
-            validate(request, paramsForm) ;
-            return ;
-        }
-        
-        error(HttpSC.UNSUPPORTED_MEDIA_TYPE_415, "Must be "+WebContent.contentTypeSPARQLUpdate+" or "+WebContent.contentTypeHTMLForm+" (got "+ctStr+")") ;
-    }
-    
-    protected void validate(HttpServletRequest request, Collection<String> params)
-    {
-        if ( params != null )
-        {
-            Enumeration<String> en = request.getParameterNames() ;
-            for ( ; en.hasMoreElements() ; )
-            {
-                String name = en.nextElement() ;
-                if ( ! params.contains(name) )
-                    warning("SPARQL Update: Unrecognize request parameter (ignored): "+name) ;
-            }
-        }
-    }
-
-    private void executeBody(HttpAction action)
-    {
-        InputStream input = null ;
-        try { input = action.request.getInputStream() ; }
-        catch (IOException ex) { errorOccurred(ex) ; }
-
-        if ( action.verbose )
-        {
-            // Verbose mode only .... capture request for logging (does not scale). 
-            String requestStr = null ;
-            try { requestStr = IO.readWholeFileAsUTF8(input) ; }
-            catch (IOException ex) { IO.exception(ex) ; }
-            requestLog.info(format("[%d] Update = %s", action.id, formatForLog(requestStr))) ;
-            
-            input = new ByteArrayInputStream(requestStr.getBytes());
-            requestStr = null;
-        }
-        
-        execute(action, input) ;
-        successNoContent(action) ;
-    }
-
-    private void executeForm(HttpAction action)
-    {
-        String requestStr = action.request.getParameter(paramUpdate) ;
-        if ( requestStr == null )
-            requestStr = action.request.getParameter(paramRequest) ;
-        
-        if ( action.verbose )
-            //requestLog.info(format("[%d] Form update = %s", action.id, formatForLog(requestStr))) ;
-            requestLog.info(format("[%d] Form update = \n%s", action.id, requestStr)) ;
-        // A little ugly because we are taking a copy of the string, but hopefully shouldn't be too big if we are in this code-path
-        // If we didn't want this additional copy, we could make the parser take a Reader in addition to an InputStream
-        byte[] b = StrUtils.asUTF8bytes(requestStr) ;
-        ByteArrayInputStream input = new ByteArrayInputStream(b);
-        requestStr = null;  // free it early at least
-        execute(action, input);
-        successPage(action,"Update succeeded") ;
-    }
-    
-    private void execute(HttpAction action, InputStream input)
-    {
-        UsingList usingList = processProtocol(action.request) ;
-        
-        // If the dsg is transactional, then we can parse and execute the update in a streaming fashion.
-        // If it isn't, we need to read the entire update request before performing any updates, because
-        // we have to attempt to make the request atomic in the face of malformed queries
-        UpdateRequest req = null ;
-        if (!action.isTransactional()) 
-        {
-            try {
-                // TODO implement a spill-to-disk version of this
-                req = UpdateFactory.read(usingList, input, UpdateParseBase, Syntax.syntaxARQ);
-            }
-            catch (UpdateException ex) { errorBadRequest(ex.getMessage()) ; return ; }
-            catch (QueryParseException ex) { errorBadRequest(messageForQPE(ex)) ; return ; }
-        }
-        
-        action.beginWrite() ;
-        try {
-            if (req == null )
-                UpdateAction.parseExecute(usingList, action.getActiveDSG(), input, UpdateParseBase, Syntax.syntaxARQ);
-            else
-                UpdateAction.execute(req, action.getActiveDSG()) ;
-            action.commit() ;
-        } catch (UpdateException ex) {
-            action.abort() ;
-            incCounter(action.srvRef, UpdateExecErrors) ;
-            errorOccurred(ex.getMessage()) ;
-        } catch (QueryParseException ex) {
-            action.abort() ;
-            // Counter inc'ed further out.
-            errorBadRequest(messageForQPE(ex)) ;
-        } catch (Throwable ex) {
-            if ( ! ( ex instanceof ActionErrorException ) )
-            {
-                try { action.abort() ; } catch (Exception ex2) {}
-                errorOccurred(ex.getMessage(), ex) ;
-            }
-        } finally { action.endWrite(); }
-    }
-
-    /* [It is an error to supply the using-graph-uri or using-named-graph-uri parameters 
-     * when using this protocol to convey a SPARQL 1.1 Update request that contains an 
-     * operation that uses the USING, USING NAMED, or WITH clause.]
-     * 
-     * We will simply capture any using parameters here and pass them to the parser, which will be
-     * responsible for throwing an UpdateException if the query violates the above requirement,
-     * and will also be responsible for adding the using parameters to update queries that can
-     * accept them.
-     */
-    private UsingList processProtocol(HttpServletRequest request)
-    {
-        UsingList toReturn = new UsingList();
-        
-        String[] usingArgs = request.getParameterValues(paramUsingGraphURI) ;
-        String[] usingNamedArgs = request.getParameterValues(paramUsingNamedGraphURI) ;
-        if ( usingArgs == null && usingNamedArgs == null )
-            return toReturn;
-        if ( usingArgs == null )
-            usingArgs = new String[0] ;
-        if ( usingNamedArgs == null )
-            usingNamedArgs = new String[0] ;
-        // Impossible.
-//        if ( usingArgs.length == 0 && usingNamedArgs.length == 0 )
-//            return ;
-        
-        for (String nodeUri : usingArgs)
-        {
-            toReturn.addUsing(createNode(nodeUri));
-        }
-        for (String nodeUri : usingNamedArgs)
-        {
-            toReturn.addUsingNamed(createNode(nodeUri));
-        }
-        
-        return toReturn;
-    }
-    
-    private static Node createNode(String x)
-    {
-        try {
-            IRI iri = resolver.resolve(x) ;
-            return NodeFactory.createURI(iri.toString()) ;
-        } catch (Exception ex)
-        {
-            errorBadRequest("SPARQL Update: bad IRI: "+x) ;
-            return null ;
-        }
-        
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Upload.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Upload.java b/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Upload.java
deleted file mode 100644
index d21855f..0000000
--- a/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Upload.java
+++ /dev/null
@@ -1,260 +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.fuseki.servlets;
-
-import static java.lang.String.format ;
-
-import java.io.IOException ;
-import java.io.InputStream ;
-import java.io.PrintWriter ;
-import java.util.zip.GZIPInputStream ;
-
-import javax.servlet.ServletException ;
-import javax.servlet.http.HttpServletRequest ;
-import javax.servlet.http.HttpServletResponse ;
-
-import org.apache.commons.fileupload.FileItemIterator ;
-import org.apache.commons.fileupload.FileItemStream ;
-import org.apache.commons.fileupload.servlet.ServletFileUpload ;
-import org.apache.commons.fileupload.util.Streams ;
-import org.apache.jena.atlas.lib.Pair ;
-import org.apache.jena.atlas.web.ContentType ;
-import org.apache.jena.fuseki.FusekiLib ;
-import org.apache.jena.fuseki.HttpNames ;
-import org.apache.jena.iri.IRI ;
-import org.apache.jena.riot.Lang ;
-import org.apache.jena.riot.RDFLanguages ;
-import org.apache.jena.riot.lang.StreamRDFCounting ;
-import org.apache.jena.riot.system.* ;
-import org.apache.jena.web.HttpSC ;
-
-import com.hp.hpl.jena.graph.Graph ;
-import com.hp.hpl.jena.graph.Node ;
-import com.hp.hpl.jena.graph.NodeFactory ;
-import com.hp.hpl.jena.sparql.core.Quad ;
-import com.hp.hpl.jena.sparql.graph.GraphFactory ;
-
-public class SPARQL_Upload extends SPARQL_ServletBase 
-{
-    private static ErrorHandler errorHandler = ErrorHandlerFactory.errorHandlerStd(log) ;
-    
-    public SPARQL_Upload() {
-        super() ;
-    }
-
-    // Methods to respond to.
-    @Override
-    protected void doPost(HttpServletRequest request, HttpServletResponse response)
-    throws ServletException, IOException
-    {
-        doCommon(request, response) ;
-    }
-    
-    @Override
-    protected void doOptions(HttpServletRequest request, HttpServletResponse response)
-    {
-        setCommonHeadersForOptions(response) ;    
-        response.setHeader(HttpNames.hAllow, "OPTIONS,POST");
-        response.setHeader(HttpNames.hContentLengh, "0") ;
-    }
-    
-    @Override
-    protected void perform(HttpAction action)
-    {
-        // Only allows one file in the upload.
-        boolean isMultipart = ServletFileUpload.isMultipartContent(action.request);
-        if ( ! isMultipart )
-            error(HttpSC.BAD_REQUEST_400 , "Not a file upload") ;
-        long count = upload(action, "http://example/upload-base/") ;
-        try {
-            action.response.setContentType("text/html") ;
-            action.response.setStatus(HttpSC.OK_200);
-            PrintWriter out = action.response.getWriter() ;
-            out.println("<html>") ;
-            out.println("<head>") ;
-            out.println("</head>") ;
-            out.println("<body>") ;
-            out.println("<h1>Success</h1>");
-            out.println("<p>") ;
-            out.println("Triples = "+count + "\n");
-            out.println("<p>") ;
-            out.println("</p>") ;
-            out.println("<button onclick=\"timeFunction()\">Back to Fuseki</button>");
-            out.println("</p>") ;
-            out.println("<script type=\"text/javascript\">");
-            out.println("function timeFunction(){");
-            out.println("window.location.href = \"/fuseki.html\";}");
-            out.println("</script>");
-            out.println("</body>") ;
-            out.println("</html>") ;
-            out.flush() ;
-            success(action) ;
-        }
-        catch (Exception ex) { errorOccurred(ex) ; }
-    }
-    
-    // Also used by SPARQL_REST
-    static public long upload(HttpAction action, String base)
-    {
-        if ( action.isTransactional() )
-            return uploadTxn(action, base) ;
-        else
-            return uploadNonTxn(action, base) ;
-    }
-
-    /** Non-transaction - buffer to a temporary graph so that parse errors
-     * are caught before inserting any data. 
-     */
-     private static long uploadNonTxn(HttpAction action, String base) {
-         Pair<String, Graph> p = uploadWorker(action, base) ;
-         String graphName = p.getLeft() ;
-         Graph graphTmp = p.getRight() ;
-         long tripleCount = graphTmp.size() ;
-
-         log.info(format("[%d] Upload: Graph: %s (%d triple(s))", 
-                         action.id, graphName,  tripleCount)) ;
-
-         Node gn = graphName.equals(HttpNames.valueDefault)
-             ? Quad.defaultGraphNodeGenerated 
-             : NodeFactory.createURI(graphName) ;
-
-         action.beginWrite() ;
-         try {
-            FusekiLib.addDataInto(graphTmp, action.getActiveDSG(), gn) ;
-            action.commit() ;
-            return tripleCount ;
-        } catch (RuntimeException ex)
-        {
-            // If anything went wrong, try to backout.
-            try { action.abort() ; } catch (Exception ex2) {}
-            errorOccurred(ex.getMessage()) ;
-            return -1 ;
-        } 
-        finally { action.endWrite() ; }
-    }
-
-     /** Transactional - we'd like data to go straight to the destination, with an abort on parse error.
-      * But file upload with a name means that the name can be after the data
-      * (it is in the Fuseki default pages).
-      * Use Graph Store protocol for bulk uploads.
-      * (It would be possible to process the incoming stream and see the graph name first.)
-      */
-      private static long uploadTxn(HttpAction action, String base) {
-          // We can't do better than the non-transaction approach.
-          return uploadNonTxn(action, base) ;
-      }
-     
-    /**  process an HTTP upload of RDF.
-     *   We can't stream straight into a dataset because the graph name can be after the data. 
-     *  @return graph name and count
-     */
-    
-    static private Pair<String, Graph> uploadWorker(HttpAction action, String base)
-    {
-        Graph graphTmp = GraphFactory.createDefaultGraph() ;
-        ServletFileUpload upload = new ServletFileUpload();
-        String graphName = null ;
-        long count = -1 ;
-        
-        String name = null ;  
-        ContentType ct = null ;
-        Lang lang = null ;
-
-        try {
-            FileItemIterator iter = upload.getItemIterator(action.request);
-            while (iter.hasNext()) {
-                FileItemStream item = iter.next();
-                String fieldName = item.getFieldName();
-                InputStream stream = item.openStream();
-                if (item.isFormField())
-                {
-                    // Graph name.
-                    String value = Streams.asString(stream, "UTF-8") ;
-                    if ( fieldName.equals(HttpNames.paramGraph) )
-                    {
-                        graphName = value ;
-                        if ( graphName != null && ! graphName.equals("") && ! graphName.equals(HttpNames.valueDefault) )
-                        {
-                            IRI iri = IRIResolver.parseIRI(value) ;
-                            if ( iri.hasViolation(false) )
-                                errorBadRequest("Bad IRI: "+graphName) ;
-                            if ( iri.getScheme() == null )
-                                errorBadRequest("Bad IRI: no IRI scheme name: "+graphName) ;
-                            if ( iri.getScheme().equalsIgnoreCase("http") || iri.getScheme().equalsIgnoreCase("https")) 
-                            {
-                                // Redundant??
-                                if ( iri.getRawHost() == null ) 
-                                    errorBadRequest("Bad IRI: no host name: "+graphName) ;
-                                if ( iri.getRawPath() == null || iri.getRawPath().length() == 0 )
-                                    errorBadRequest("Bad IRI: no path: "+graphName) ;
-                                if ( iri.getRawPath().charAt(0) != '/' )
-                                    errorBadRequest("Bad IRI: Path does not start '/': "+graphName) ;
-                            } 
-                        }
-                    }
-                    else if ( fieldName.equals(HttpNames.paramDefaultGraphURI) )
-                        graphName = null ;
-                    else
-                        // Add file type?
-                        log.info(format("[%d] Upload: Field=%s ignored", action.id, fieldName)) ;
-                } else {
-                    // Process the input stream
-                    name = item.getName() ; 
-                    if ( name == null || name.equals("") || name.equals("UNSET FILE NAME") ) 
-                        errorBadRequest("No name for content - can't determine RDF syntax") ;
-
-                    String contentTypeHeader = item.getContentType() ;
-                    ct = ContentType.create(contentTypeHeader) ;
-
-                    lang = RDFLanguages.contentTypeToLang(ct.getContentType()) ;
-
-                    if ( lang == null ) {
-                        lang = RDFLanguages.filenameToLang(name) ;
-                        
-                        //JENA-600 filenameToLang() strips off certain extensions such as .gz and 
-                        //we need to ensure that if there was a .gz extension present we wrap the stream accordingly
-                        if (name.endsWith(".gz"))
-                            stream = new GZIPInputStream(stream);
-                    }
-                    if ( lang == null )
-                        // Desperate.
-                        lang = RDFLanguages.RDFXML ;
-
-                    log.info(format("[%d] Upload: Filename: %s, Content-Type=%s, Charset=%s => %s", 
-                                    action.id, name,  ct.getContentType(), ct.getCharset(), lang.getName())) ;
-                    
-                    StreamRDF x = StreamRDFLib.graph(graphTmp) ;
-                    StreamRDFCounting dest =  StreamRDFLib.count(x) ;
-                    SPARQL_REST.parse(action, dest, stream, lang, base);
-                    count = dest.count() ;
-                }
-            }    
-
-            if ( graphName == null || graphName.equals("") ) 
-                graphName = HttpNames.valueDefault ;
-            return Pair.create(graphName, graphTmp) ;
-        }
-        catch (ActionErrorException ex) { throw ex ; }
-        catch (Exception ex)            { errorOccurred(ex) ; return null ; }
-    }            
-
-    @Override
-    protected void validate(HttpAction action)
-    {}
-}


[19/23] jena git commit: Rename folder jena-fuseki to jena-fuseki1

Posted by an...@apache.org.
http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/pages/xml-to-html-links.xsl
----------------------------------------------------------------------
diff --git a/jena-fuseki/pages/xml-to-html-links.xsl b/jena-fuseki/pages/xml-to-html-links.xsl
deleted file mode 100644
index 66b04eb..0000000
--- a/jena-fuseki/pages/xml-to-html-links.xsl
+++ /dev/null
@@ -1,227 +0,0 @@
-<?xml version="1.0"?>
-
-<!--
-
-XSLT script to format SPARQL Query Results XML Format into xhtml
-
-Copyright © 2004, 2005 World Wide Web Consortium, (Massachusetts
-Institute of Technology, European Research Consortium for
-Informatics and Mathematics, Keio University). All Rights
-Reserved. This work is distributed under the W3C® Software
-License [1] in the hope that it will be useful, but WITHOUT ANY
-WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.
-
-[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
-
-Version 1 : Dave Beckett (DAWG)
-Version 2 : Jeen Broekstra (DAWG)
-Customization for SPARQler: Andy Seaborne
-URIs as hrefs in results : Bob DuCharme & Andy Seaborne
-
-> -    <xsl:for-each select="//res:head/res:variable">
-> +    <xsl:for-each select="/res:sparql/res:head/res:variable">
-
--->
-
-<xsl:stylesheet version="1.0"
-		xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-		xmlns="http://www.w3.org/1999/xhtml"
-		xmlns:res="http://www.w3.org/2005/sparql-results#"
-		xmlns:fn="http://www.w3.org/2005/xpath-functions"
-		exclude-result-prefixes="res xsl">
-
-  <!--
-    <xsl:output
-    method="html"
-    media-type="text/html"
-    doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
-    indent="yes"
-    encoding="UTF-8"/>
-  -->
-
-  <!-- or this? -->
-
-  <xsl:output
-   method="xml" 
-   indent="yes"
-   encoding="UTF-8" 
-   doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
-   doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
-   omit-xml-declaration="no" />
-
-    <xsl:template match="res:link">
-      <p>Link to <xsl:value-of select="@href"/></p>
-    </xsl:template>
-
-    <xsl:template name="header">
-      <div>
-        <h2>Header</h2>
-        <xsl:apply-templates select="res:head/res:link"/>
-      </div>
-    </xsl:template>
-
-  <xsl:template name="boolean-result">
-    <div>
-      <p>ASK => <xsl:value-of select="res:boolean"/></p>
-    </div>
-  </xsl:template>
-
-
-  <xsl:template name="vb-result">
-    <div>
-      <table>
-	<xsl:text>
-	</xsl:text>
-	<tr>
-	  <xsl:for-each select="res:head/res:variable">
-	    <th><xsl:value-of select="@name"/></th>
-	  </xsl:for-each>
-	</tr>
-	<xsl:text>
-	</xsl:text>
-	<xsl:for-each select="res:results/res:result">
-	  <tr>
-	    <xsl:apply-templates select="."/>
-	  </tr>
-	</xsl:for-each>
-      </table>
-    </div>
-  </xsl:template>
-
-  <xsl:template match="res:result">
-    <xsl:variable name="current" select="."/>
-    <xsl:for-each select="/res:sparql/res:head/res:variable">
-      <xsl:variable name="name" select="@name"/>
-      <td>
-	<xsl:choose>
-	  <xsl:when test="$current/res:binding[@name=$name]">
-	    <!-- apply template for the correct value type (bnode, uri, literal) -->
-	    <xsl:apply-templates select="$current/res:binding[@name=$name]"/>
-	  </xsl:when>
-	  <xsl:otherwise>
-	    <!-- no binding available for this variable in this solution -->
-	  </xsl:otherwise>
-	</xsl:choose>
-      </td>
-    </xsl:for-each>
-  </xsl:template>
-
-  <xsl:template match="res:bnode">
-    <xsl:text>_:</xsl:text>
-    <xsl:value-of select="text()"/>
-  </xsl:template>
-
-  <xsl:template name="replace-string">
-    <xsl:param name="text"/>
-    <xsl:param name="replace"/>
-    <xsl:param name="with"/>
-    <xsl:choose>
-      <xsl:when test="contains($text,$replace)">
-	<xsl:value-of select="substring-before($text,$replace)"/>
-	<xsl:value-of select="$with"/>
-	<xsl:call-template name="replace-string">
-	  <xsl:with-param name="text"
-			  select="substring-after($text,$replace)"/>
-	  <xsl:with-param name="replace" select="$replace"/>
-	  <xsl:with-param name="with" select="$with"/>
-	</xsl:call-template>
-      </xsl:when>
-      <xsl:otherwise>
-	<xsl:value-of select="$text"/>
-      </xsl:otherwise>
-    </xsl:choose>
-  </xsl:template>
-
-
-  <xsl:template match="res:uri">
-    <!-- MUST be XSLT 1.0 :-( -->
-
-    <!-- Roughly: SELECT ($uri AS ?subject) ?predicate ?object { $uri ?predicate ?object } -->
-    <!-- XSLT 2.0
-    <xsl:variable name="x"><xsl:value-of select="fn:encode-for-uri(.)"/></xsl:variable>
-    -->
-
-    <xsl:variable name="x"><xsl:value-of select="."/></xsl:variable>
-    <xsl:variable name="q">SELECT%20%28%3C<xsl:value-of select="$x"/>%3E%20AS%20%3Fsubject%29%20%3Fpredicate%20%3Fobject%20%7B%3C<xsl:value-of select="$x"/>%3E%20%3Fpredicate%20%3Fobject%20%7D</xsl:variable>
-
-    <!-- Escape any # -->
-    <xsl:variable name="q2">
-      <xsl:call-template name="replace-string">
-	<xsl:with-param name="text" select="$q"/>
-	<xsl:with-param name="replace" select="'#'" />
-	<xsl:with-param name="with" select="'%23'"/>
-      </xsl:call-template>
-    </xsl:variable>
-
-    <!-- XSLT 2.0
-       <xsl:value-of select="fn:replace('$q','#','%25')"/>
-    -->
-
-    <xsl:text>&lt;</xsl:text>
-    <a href="?query={$q2}&amp;output=xml&amp;stylesheet=%2Fxml-to-html-links.xsl">
-      <xsl:text></xsl:text>
-      <xsl:value-of select="."/>
-    </a>
-    <xsl:text>&gt;</xsl:text>
-  </xsl:template>
-
-  <xsl:template match="res:literal">
-    <xsl:text>"</xsl:text>
-    <xsl:value-of select="text()"/>
-    <xsl:text>"</xsl:text>
-
-    <xsl:choose>
-      <xsl:when test="@datatype">
-        <!-- datatyped literal value -->
-        ^^&lt;<xsl:value-of select="@datatype"/>&gt;
-      </xsl:when>
-      <xsl:when test="@xml:lang">
-        <!-- lang-string -->
-        @<xsl:value-of select="@xml:lang"/>
-      </xsl:when>
-    </xsl:choose>
-  </xsl:template>
-
-  <xsl:template match="res:sparql">
-    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-      <head>
-	<title>SPARQLer Query Results</title>
-	<style>
-	  <![CDATA[
-	  h1 { font-size: 150% ; }
-	  h2 { font-size: 125% ; }
-	  table { border-collapse: collapse ; border: 1px solid black ; }
-	  td, th
- 	  { border: 1px solid black ;
-	    padding-left:0.5em; padding-right: 0.5em; 
-	    padding-top:0.2ex ; padding-bottom:0.2ex 
-	  }
-	  ]]>
-	</style>
-      </head>
-      <body>
-
-
-	<h1>SPARQLer Query Results</h1>
-
-	<xsl:if test="res:head/res:link">
-	  <xsl:call-template name="header"/>
-	</xsl:if>
-
-	<xsl:choose>
-	  <xsl:when test="res:boolean">
-	    <xsl:call-template name="boolean-result" />
-	  </xsl:when>
-
-	  <xsl:when test="res:results">
-	    <xsl:call-template name="vb-result" />
-	  </xsl:when>
-
-	</xsl:choose>
-
-
-      </body>
-    </html>
-  </xsl:template>
-</xsl:stylesheet>

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/pages/xml-to-html-plain.xsl
----------------------------------------------------------------------
diff --git a/jena-fuseki/pages/xml-to-html-plain.xsl b/jena-fuseki/pages/xml-to-html-plain.xsl
deleted file mode 100644
index 1878ab0..0000000
--- a/jena-fuseki/pages/xml-to-html-plain.xsl
+++ /dev/null
@@ -1,187 +0,0 @@
-<?xml version="1.0"?>
-
-<!--
-
-XSLT script to format SPARQL Query Results XML Format into xhtml
-
-Copyright © 2004, 2005 World Wide Web Consortium, (Massachusetts
-Institute of Technology, European Research Consortium for
-Informatics and Mathematics, Keio University). All Rights
-Reserved. This work is distributed under the W3C® Software
-License [1] in the hope that it will be useful, but WITHOUT ANY
-WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.
-
-[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
-
-Version 1 : Dave Beckett (DAWG)
-Version 2 : Jeen Broekstra (DAWG)
-Customization for SPARQler: Andy Seaborne
-Fix:
-
-> -    <xsl:for-each select="//res:head/res:variable">
-> +    <xsl:for-each select="/res:sparql/res:head/res:variable">
-
--->
-
-<xsl:stylesheet version="1.0"
-		xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-		xmlns="http://www.w3.org/1999/xhtml"
-		xmlns:res="http://www.w3.org/2005/sparql-results#"
-		exclude-result-prefixes="res xsl">
-
-  <!--
-    <xsl:output
-    method="html"
-    media-type="text/html"
-    doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
-    indent="yes"
-    encoding="UTF-8"/>
-  -->
-
-  <!-- or this? -->
-
-  <xsl:output
-   method="xml" 
-   indent="yes"
-   encoding="UTF-8" 
-   doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
-   doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
-   omit-xml-declaration="no" />
-
-
-  <xsl:template name="header">
-    <div>
-      <h2>Header</h2>
-      <xsl:for-each select="res:head/res:link"> 
-	<p>Link to <xsl:value-of select="@href"/></p>
-      </xsl:for-each>
-    </div>
-  </xsl:template>
-
-  <xsl:template name="boolean-result">
-    <div>
-      <!--      
-	<h2>Boolean Result</h2>
-      -->      
-      <p>ASK => <xsl:value-of select="res:boolean"/></p>
-    </div>
-  </xsl:template>
-
-
-  <xsl:template name="vb-result">
-    <div>
-      <!--
-	<h2>Variable Bindings Result</h2>
-	<p>Ordered: <xsl:value-of select="res:results/@ordered"/></p>
-	<p>Distinct: <xsl:value-of select="res:results/@distinct"/></p>
-      -->
-
-      <table>
-	<xsl:text>
-	</xsl:text>
-	<tr>
-	  <xsl:for-each select="res:head/res:variable">
-	    <th><xsl:value-of select="@name"/></th>
-	  </xsl:for-each>
-	</tr>
-	<xsl:text>
-	</xsl:text>
-	<xsl:for-each select="res:results/res:result">
-	  <tr>
-	    <xsl:apply-templates select="."/>
-	  </tr>
-	</xsl:for-each>
-      </table>
-    </div>
-  </xsl:template>
-
-  <xsl:template match="res:result">
-    <xsl:variable name="current" select="."/>
-    <xsl:for-each select="/res:sparql/res:head/res:variable">
-      <xsl:variable name="name" select="@name"/>
-      <td>
-	<xsl:choose>
-	  <xsl:when test="$current/res:binding[@name=$name]">
-	    <!-- apply template for the correct value type (bnode, uri, literal) -->
-	    <xsl:apply-templates select="$current/res:binding[@name=$name]"/>
-	  </xsl:when>
-	  <xsl:otherwise>
-	    <!-- no binding available for this variable in this solution -->
-	  </xsl:otherwise>
-	</xsl:choose>
-      </td>
-    </xsl:for-each>
-  </xsl:template>
-
-  <xsl:template match="res:bnode">
-    <xsl:text>_:</xsl:text>
-    <xsl:value-of select="text()"/>
-  </xsl:template>
-
-  <xsl:template match="res:uri">
-    <xsl:variable name="uri" select="text()"/>
-    <xsl:text>&lt;</xsl:text>
-    <xsl:value-of select="$uri"/>
-    <xsl:text>&gt;</xsl:text>
-  </xsl:template>
-
-  <xsl:template match="res:literal">
-    <xsl:text>"</xsl:text>
-    <xsl:value-of select="text()"/>
-    <xsl:text>"</xsl:text>
-
-    <xsl:choose>
-      <xsl:when test="@datatype">
-	<!-- datatyped literal value -->
-	^^&lt;<xsl:value-of select="@datatype"/>&gt;
-      </xsl:when>
-      <xsl:when test="@xml:lang">
-	<!-- lang-string -->
-	@<xsl:value-of select="@xml:lang"/>
-      </xsl:when>
-    </xsl:choose>
-  </xsl:template>
-
-  <xsl:template match="res:sparql">
-    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-      <head>
-	<title>SPARQLer Query Results</title>
-	<style>
-	  <![CDATA[
-	  h1 { font-size: 150% ; }
-	  h2 { font-size: 125% ; }
-	  table { border-collapse: collapse ; border: 1px solid black ; }
-	  td, th
- 	  { border: 1px solid black ;
-	    padding-left:0.5em; padding-right: 0.5em; 
-	    padding-top:0.2ex ; padding-bottom:0.2ex 
-	  }
-	  ]]>
-	</style>
-      </head>
-      <body>
-
-
-	<h1>SPARQLer Query Results</h1>
-
-	<xsl:if test="res:head/res:link">
-	  <xsl:call-template name="header"/>
-	</xsl:if>
-
-	<xsl:choose>
-	  <xsl:when test="res:boolean">
-	    <xsl:call-template name="boolean-result" />
-	  </xsl:when>
-
-	  <xsl:when test="res:results">
-	    <xsl:call-template name="vb-result" />
-	  </xsl:when>
-
-	</xsl:choose>
-
-
-      </body>
-    </html>
-  </xsl:template>
-</xsl:stylesheet>

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/pages/xml-to-html.xsl
----------------------------------------------------------------------
diff --git a/jena-fuseki/pages/xml-to-html.xsl b/jena-fuseki/pages/xml-to-html.xsl
deleted file mode 100644
index 1878ab0..0000000
--- a/jena-fuseki/pages/xml-to-html.xsl
+++ /dev/null
@@ -1,187 +0,0 @@
-<?xml version="1.0"?>
-
-<!--
-
-XSLT script to format SPARQL Query Results XML Format into xhtml
-
-Copyright © 2004, 2005 World Wide Web Consortium, (Massachusetts
-Institute of Technology, European Research Consortium for
-Informatics and Mathematics, Keio University). All Rights
-Reserved. This work is distributed under the W3C® Software
-License [1] in the hope that it will be useful, but WITHOUT ANY
-WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.
-
-[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
-
-Version 1 : Dave Beckett (DAWG)
-Version 2 : Jeen Broekstra (DAWG)
-Customization for SPARQler: Andy Seaborne
-Fix:
-
-> -    <xsl:for-each select="//res:head/res:variable">
-> +    <xsl:for-each select="/res:sparql/res:head/res:variable">
-
--->
-
-<xsl:stylesheet version="1.0"
-		xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-		xmlns="http://www.w3.org/1999/xhtml"
-		xmlns:res="http://www.w3.org/2005/sparql-results#"
-		exclude-result-prefixes="res xsl">
-
-  <!--
-    <xsl:output
-    method="html"
-    media-type="text/html"
-    doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
-    indent="yes"
-    encoding="UTF-8"/>
-  -->
-
-  <!-- or this? -->
-
-  <xsl:output
-   method="xml" 
-   indent="yes"
-   encoding="UTF-8" 
-   doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
-   doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
-   omit-xml-declaration="no" />
-
-
-  <xsl:template name="header">
-    <div>
-      <h2>Header</h2>
-      <xsl:for-each select="res:head/res:link"> 
-	<p>Link to <xsl:value-of select="@href"/></p>
-      </xsl:for-each>
-    </div>
-  </xsl:template>
-
-  <xsl:template name="boolean-result">
-    <div>
-      <!--      
-	<h2>Boolean Result</h2>
-      -->      
-      <p>ASK => <xsl:value-of select="res:boolean"/></p>
-    </div>
-  </xsl:template>
-
-
-  <xsl:template name="vb-result">
-    <div>
-      <!--
-	<h2>Variable Bindings Result</h2>
-	<p>Ordered: <xsl:value-of select="res:results/@ordered"/></p>
-	<p>Distinct: <xsl:value-of select="res:results/@distinct"/></p>
-      -->
-
-      <table>
-	<xsl:text>
-	</xsl:text>
-	<tr>
-	  <xsl:for-each select="res:head/res:variable">
-	    <th><xsl:value-of select="@name"/></th>
-	  </xsl:for-each>
-	</tr>
-	<xsl:text>
-	</xsl:text>
-	<xsl:for-each select="res:results/res:result">
-	  <tr>
-	    <xsl:apply-templates select="."/>
-	  </tr>
-	</xsl:for-each>
-      </table>
-    </div>
-  </xsl:template>
-
-  <xsl:template match="res:result">
-    <xsl:variable name="current" select="."/>
-    <xsl:for-each select="/res:sparql/res:head/res:variable">
-      <xsl:variable name="name" select="@name"/>
-      <td>
-	<xsl:choose>
-	  <xsl:when test="$current/res:binding[@name=$name]">
-	    <!-- apply template for the correct value type (bnode, uri, literal) -->
-	    <xsl:apply-templates select="$current/res:binding[@name=$name]"/>
-	  </xsl:when>
-	  <xsl:otherwise>
-	    <!-- no binding available for this variable in this solution -->
-	  </xsl:otherwise>
-	</xsl:choose>
-      </td>
-    </xsl:for-each>
-  </xsl:template>
-
-  <xsl:template match="res:bnode">
-    <xsl:text>_:</xsl:text>
-    <xsl:value-of select="text()"/>
-  </xsl:template>
-
-  <xsl:template match="res:uri">
-    <xsl:variable name="uri" select="text()"/>
-    <xsl:text>&lt;</xsl:text>
-    <xsl:value-of select="$uri"/>
-    <xsl:text>&gt;</xsl:text>
-  </xsl:template>
-
-  <xsl:template match="res:literal">
-    <xsl:text>"</xsl:text>
-    <xsl:value-of select="text()"/>
-    <xsl:text>"</xsl:text>
-
-    <xsl:choose>
-      <xsl:when test="@datatype">
-	<!-- datatyped literal value -->
-	^^&lt;<xsl:value-of select="@datatype"/>&gt;
-      </xsl:when>
-      <xsl:when test="@xml:lang">
-	<!-- lang-string -->
-	@<xsl:value-of select="@xml:lang"/>
-      </xsl:when>
-    </xsl:choose>
-  </xsl:template>
-
-  <xsl:template match="res:sparql">
-    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-      <head>
-	<title>SPARQLer Query Results</title>
-	<style>
-	  <![CDATA[
-	  h1 { font-size: 150% ; }
-	  h2 { font-size: 125% ; }
-	  table { border-collapse: collapse ; border: 1px solid black ; }
-	  td, th
- 	  { border: 1px solid black ;
-	    padding-left:0.5em; padding-right: 0.5em; 
-	    padding-top:0.2ex ; padding-bottom:0.2ex 
-	  }
-	  ]]>
-	</style>
-      </head>
-      <body>
-
-
-	<h1>SPARQLer Query Results</h1>
-
-	<xsl:if test="res:head/res:link">
-	  <xsl:call-template name="header"/>
-	</xsl:if>
-
-	<xsl:choose>
-	  <xsl:when test="res:boolean">
-	    <xsl:call-template name="boolean-result" />
-	  </xsl:when>
-
-	  <xsl:when test="res:results">
-	    <xsl:call-template name="vb-result" />
-	  </xsl:when>
-
-	</xsl:choose>
-
-
-      </body>
-    </html>
-  </xsl:template>
-</xsl:stylesheet>

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/pom.xml
----------------------------------------------------------------------
diff --git a/jena-fuseki/pom.xml b/jena-fuseki/pom.xml
deleted file mode 100644
index c1d19d3..0000000
--- a/jena-fuseki/pom.xml
+++ /dev/null
@@ -1,374 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-   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.
--->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-  <artifactId>jena-fuseki</artifactId>
-  <packaging>jar</packaging>
-  <name>Apache Jena - Fuseki1 (SPARQL 1.1 Server)</name>
-  <version>1.1.2-SNAPSHOT</version>
-  <description>Fuseki is a SPARQL 1.1 Server which provides query, update and graph store protocol endpoints that can be used to expose triple store(s) over HTTP</description>
-  <url>http://jena.apache.org/</url>
-
-  <parent>
-    <groupId>org.apache.jena</groupId>
-    <artifactId>jena-parent</artifactId>
-    <version>12-SNAPSHOT</version>
-    <relativePath>../jena-parent</relativePath>
-  </parent> 
-
-  <!-- Need if the parent is a snapshot -->
-  <repositories>
-    <repository>
-      <id>apache.snapshots</id>
-      <name>Apache Snapshot Repository</name>
-      <url>http://repository.apache.org/snapshots</url>
-      <releases>
-	<enabled>false</enabled>
-      </releases>
-    </repository>
-  </repositories>
-
-  <organization>
-    <name>Apache Jena</name>
-    <url>http://jena.apache.org/</url>
-  </organization>
-
-  <licenses>
-    <license>
-      <name>Apache 2.0 License</name>
-      <url>http://www.apache.org/licenses/LICENSE-2.0</url>
-    </license>
-  </licenses>
-
-  <properties>
-    <this.root>${project.artifactId}-${project.version}</this.root>
-    <server.jar.name>${this.root}-server</server.jar.name>
-
-    <!--
-    <assembly.soh.name>${this.root}</assembly.soh.name>
-    -->
-
-    <ver.jetty>8.1.14.v20131031</ver.jetty>
-    <ver.velocity>1.7</ver.velocity>
-    
-    <maven.build.timestamp.format>yyyy-MM-dd'T'HH:mm:ssZ</maven.build.timestamp.format>
-    <build.time.xsd>${maven.build.timestamp}</build.time.xsd>
-
-  </properties>
-
-  <dependencies>
-
-    <dependency>
-      <groupId>org.apache.jena</groupId>
-      <artifactId>jena-arq</artifactId>
-      <version>2.13.0-SNAPSHOT</version>
-    </dependency>
-
-    <dependency>
-      <groupId>org.apache.jena</groupId>
-      <artifactId>jena-arq</artifactId>
-      <version>2.13.0-SNAPSHOT</version>
-      <classifier>tests</classifier>
-      <scope>test</scope>
-    </dependency>
-
-    <dependency>
-      <groupId>org.apache.jena</groupId>
-      <artifactId>jena-core</artifactId>
-      <version>2.13.0-SNAPSHOT</version>
-    </dependency>
-
-    <dependency>
-      <groupId>org.apache.jena</groupId>
-      <artifactId>jena-tdb</artifactId>
-      <version>1.1.2-SNAPSHOT</version>
-    </dependency>
-
-    <!--
-    <dependency>
-      <groupId>org.apache.jena</groupId>
-      <artifactId>sdb</artifactId>
-      <version>${ver.sdb}</version>
-      <optional>true</optional>
-    </dependency>
-    -->
-
-    <dependency>
-      <groupId>org.apache.jena</groupId>
-      <artifactId>jena-text</artifactId>
-      <version>1.1.2-SNAPSHOT</version>
-      <exclusions>
-        <!-- 
-	  Get this via commons-fileupload and also via jena-text/sol4j
-	  Choose the commons-fileupload route
-	-->
-        <exclusion>
-          <groupId>commons-io</groupId>
-          <artifactId>commons-io</artifactId>
-        </exclusion>
-      </exclusions>
-
-    </dependency>
-
-    <dependency>
-      <groupId>org.apache.jena</groupId>
-      <artifactId>jena-spatial</artifactId>
-      <version>1.1.2-SNAPSHOT</version>
-    </dependency>
-
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <scope>test</scope>
-    </dependency>
-
-    <dependency>
-      <groupId>org.apache.httpcomponents</groupId>
-      <artifactId>httpclient</artifactId>
-      <exclusions>
-        <!-- Replace with slf4j adapter -->
-        <exclusion>
-          <groupId>commons-logging</groupId>
-          <artifactId>commons-logging</artifactId>
-        </exclusion>
-      </exclusions>
-    </dependency>
-
-    <dependency>
-      <groupId>commons-fileupload</groupId>
-      <artifactId>commons-fileupload</artifactId>
-    </dependency>
-
-    <!-- ?? Use one of the combined artifacts for Jetty -->
-    <!-- jetty-webapp + jetty-util -->
-
-    <dependency>
-      <groupId>org.eclipse.jetty</groupId>
-      <artifactId>jetty-server</artifactId>
-      <version>${ver.jetty}</version>
-    </dependency>    
-
-    <dependency>
-      <groupId>org.eclipse.jetty</groupId>
-      <artifactId>jetty-servlet</artifactId>
-      <version>${ver.jetty}</version>
-    </dependency>    
-
-    <!-- used ? - ->
-    <dependency>
-      <groupId>org.eclipse.jetty</groupId>
-      <artifactId>jetty-webapp</artifactId>
-      <version>${ver.jetty}</version>
-    </dependency>    
-    -->
-
-    <dependency>
-      <groupId>org.eclipse.jetty</groupId>
-      <artifactId>jetty-servlets</artifactId>
-      <version>${ver.jetty}</version>
-    </dependency> 
-
-     <dependency>
-      <groupId>org.eclipse.jetty</groupId>
-      <artifactId>jetty-xml</artifactId>
-      <version>${ver.jetty}</version>
-    </dependency> 
-    
-    <dependency>
-      <groupId>org.eclipse.jetty</groupId>
-      <artifactId>jetty-security</artifactId>
-      <version>${ver.jetty}</version>
-    </dependency> 
-    
-    <dependency>
-      <groupId>org.eclipse.jetty</groupId>
-      <artifactId>jetty-util</artifactId>
-      <version>${ver.jetty}</version>
-    </dependency> 
-
-    <dependency>
-      <groupId>org.apache.velocity</groupId>
-      <artifactId>velocity</artifactId>
-      <version>${ver.velocity}</version>
-    </dependency>
-
-    <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-api</artifactId>
-    </dependency>
-
-    <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-log4j12</artifactId>
-    </dependency>
-
-    <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>jcl-over-slf4j</artifactId>
-    </dependency>
-
-    <!-- Needed because the Fuseki test suite resets logging levels -->
-    <dependency>
-      <groupId>log4j</groupId>
-      <artifactId>log4j</artifactId>
-    </dependency>
-  </dependencies>
-
-  <build>
-    <resources>
-      <resource>
-        <filtering>false</filtering>
-        <directory>src/main/resources</directory>
-        <excludes>
-          <exclude>org/apache/jena/fuseki/fuseki-properties.xml</exclude>
-        </excludes>
-      </resource>
-      <resource>
-        <filtering>true</filtering>
-        <directory>src/main/resources</directory>
-        <includes>
-          <include>org/apache/jena/fuseki/fuseki-properties.xml</include>
-        </includes>
-      </resource>
-    </resources>
-    
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-javadoc-plugin</artifactId>
-        <configuration>
-          <version>true</version>
-          <show>public</show>
-          <quiet>true</quiet>
-          <encoding>UTF-8</encoding>
-          <windowtitle>Apache Jena Fuseki</windowtitle>
-          <doctitle>Apache Jena Fuseki ${project.version}</doctitle>
-          <bottom>Licenced under the Apache License, Version 2.0</bottom>
-        </configuration>
-      </plugin>
-      
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-jar-plugin</artifactId>
-        <executions>
-          <execution>
-            <goals>
-              <goal>test-jar</goal>
-            </goals>
-          </execution>
-        </executions>
-      </plugin>
-
-
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-surefire-plugin</artifactId>
-        <configuration>
-          <includes>
-            <include>**/TS_*.java</include>
-          </includes>
-        </configuration>
-      </plugin>
-
-      <plugin>
-	<groupId>org.apache.maven.plugins</groupId>
-	<artifactId>maven-shade-plugin</artifactId>
-	<version>2.1</version>
-	<configuration>
-	  <shadedArtifactAttached>true</shadedArtifactAttached>
-	  <shadedClassifierName>server</shadedClassifierName>
-	  <transformers>
-	    <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
-	      <mainClass>org.apache.jena.fuseki.FusekiCmd</mainClass>
-	    </transformer>
-	    <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
-	    <transformer implementation="org.apache.maven.plugins.shade.resource.ApacheLicenseResourceTransformer" />
-	    <transformer implementation="org.apache.maven.plugins.shade.resource.ApacheNoticeResourceTransformer">
-	      <addHeader>false</addHeader>
-	    </transformer>
-	  </transformers>
-	  <filters>
-	    <filter>
-	      <artifact>*:*</artifact>
-	      <excludes>
-		<!-- Some jars are signed but shading breaks that.
-		     Don't include signing files.
-		-->
-		<exclude>META-INF/*.SF</exclude>
-		<exclude>META-INF/*.DSA</exclude>
-		<exclude>META-INF/*.RSA</exclude>
-	      </excludes>
-	    </filter>
-	  </filters>
-	</configuration>
-	<executions>
-	  <execution>
-	    <phase>package</phase>
-	    <goals>
-	      <goal>shade</goal>
-	    </goals>
-	  </execution>
-	</executions>
-      </plugin>
-
-      <plugin>
-        <artifactId>maven-assembly-plugin</artifactId>
-	<!-- After shared jar - same phase -->
-        <executions>
-	  <!--
-          <execution>
-            <id>create-soh-assembly</id>
-            <phase>package</phase>
-            <goals><goal>single</goal></goals>
-            <configuration>
-              <finalName>${assembly.soh.name}</finalName>
-              <!- -<appendAssemblyId>false</appendAssemblyId> - ->
-              <descriptors>
-                <descriptor>assembly-soh.xml</descriptor>
-              </descriptors>
-            </configuration>
-          </execution>
-          -->
-
-          <execution>
-            <id>create-zip-assembly</id>
-            <phase>package</phase>
-            <goals><goal>single</goal></goals>
-            <configuration>
-	      <descriptors>
-                <descriptor>assembly-dist.xml</descriptor>
-              </descriptors>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-      
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-resources-plugin</artifactId>
-        <configuration>
-          <encoding>UTF-8</encoding>
-        </configuration>
-      </plugin>
-
-    </plugins>
-
-  </build>
-  
-</project>

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/run-fuseki
----------------------------------------------------------------------
diff --git a/jena-fuseki/run-fuseki b/jena-fuseki/run-fuseki
deleted file mode 100755
index 98b0d45..0000000
--- a/jena-fuseki/run-fuseki
+++ /dev/null
@@ -1,64 +0,0 @@
-#!/usr/bin/env bash
-
-# 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.
-
-## Run Fuseki, include development code if it looks like it's available.
-## Or --pages=
-
-export FUSEKI_HOME=${FUSEKI_HOME:-$HOME/Jena/jena-fuseki}
-if [ ! -e $FUSEKI_HOME ]
-then
-    echo "$FUSEKI_HOME does not exist" 1>&2
-    exit 1
-    fi
-if [ ! -d $FUSEKI_HOME ]
-then
-    echo "$FUSEKI_HOME exists but is not a directory" 1>&2
-    exit 1
-    fi
-
-CP="$(. $FUSEKI_HOME/run_cp)"
-
-if [ -e "$FUSEKI_HOME/classes" ]
-then
-    CP="$FUSEKI_HOME/classes:$CP"
-elif [ -e "$FUSEKI_HOME/target/classes" ]
-then
-    CP="$FUSEKI_HOME/target/classes:$CP"
-else
-    echo "No Fuseki1 classes" 2>&1
-fi
-
-# Prepend any development directories here
-DEVDIRS="jena-core jena-tdb jena-arq jena-text"
-for X in $DEVDIRS
-do
-    CPX="$FUSEKI_HOME/../$X/classes"
-    if [ -e "$CPX" ]
-    then
-	CP="$CPX:$CP"
-    fi
-done
-
-FUSEKI_LOG=${FUSEKI_LOG:-}
-JVM_ARGS="${JVM_ARGS:--Xmx1200M}"
-#JVM_ARGS="$JVM_ARGS -XX:MaxDirectMemorySize=1G"
-
-#echo $CP
-
-exec java -cp "$CP" $JVM_ARGS $FUSEKI_LOG org.apache.jena.fuseki.FusekiCmd \
-    --home="$FUSEKI_HOME" "$@"

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/s-delete
----------------------------------------------------------------------
diff --git a/jena-fuseki/s-delete b/jena-fuseki/s-delete
deleted file mode 100755
index 4f6590d..0000000
--- a/jena-fuseki/s-delete
+++ /dev/null
@@ -1,713 +0,0 @@
-#!/usr/bin/env ruby
-# -*- coding: utf-8 -*-
-
-# 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.
-
-# SPARQL HTTP Update, client.
-
-require 'optparse'
-require 'net/http'
-require 'uri'
-require 'cgi'
-require 'pp'
-require 'ostruct'
-
-# ToDo
-#  Allow a choice of media type for GET
-#   --accept "content-type" (and abbreviations)
-#   --header "Add:this"
-#   --user, --password
-#  Basic authentication: request.basic_auth("username", "password")
-#  Follow redirects => 301:  puts response["location"] # All headers are lowercase?
-
-SOH_NAME="SOH"
-SOH_VERSION="0.0.0"
-
-$proxy = ENV['http_proxy'] ? URI.parse(ENV['http_proxy']) : OpenStruct.new  
-
-# What about direct naming?
-
-# Names
-$mtTurtle           = 'text/turtle;charset=utf-8'
-$mtRDF              = 'application/rdf+xml'
-$mtText             = 'text/plain'
-$mtNTriples         = 'application/n-triples'
-$mtNQuads           = 'application/n-quads'
-$mtJSONLD           = 'application/ld+json'
-$mtTriG             = 'application/trig'
-$mtSparqlResultsX   = 'application/sparql-results+xml'
-$mtSparqlResultsJ   = 'application/sparql-results+json'
-$mtAppJSON          = 'application/json'
-$mtAppXML           = 'application/xml'
-$mtSparqlResultsTSV = 'application/sparql-results+tsv'
-$mtSparqlResultsCSV = 'application/sparql-results+csv'
-$mtSparqlUpdate     = 'application/sparql-update'
-$mtWWWForm          = 'application/x-www-form-urlencoded'
-$mtSparqlQuery      = "application/sparql-query" ;
-
-# Global media type table.
-$fileMediaTypes = {}
-$fileMediaTypes['ttl']   = $mtTurtle
-$fileMediaTypes['n3']    = 'text/n3; charset=utf-8'
-$fileMediaTypes['nt']    = $mtText
-$fileMediaTypes['rdf']   = $mtRDF
-$fileMediaTypes['owl']   = $mtRDF
-$fileMediaTypes['nq']    = $mtNQuads
-$fileMediaTypes['trig']  = $mtTriG
-$fileMediaTypes['json-ld']  = $mtJSONLD
-$fileMediaTypes['jsonld']  = $mtJSONLD
-
-# Global charset : no entry means "don't set"
-$charsetUTF8      = 'utf-8'
-$charset = {}
-$charset[$mtTurtle]   = 'utf-8'
-$charset[$mtText]     = 'ascii'
-$charset[$mtTriG]     = 'utf-8'
-$charset[$mtNQuads]   = 'utf-8'
-
-# Headers
-
-$hContentType         = 'Content-Type'
-# $hContentEncoding     = 'Content-Encoding'
-$hContentLength       = 'Content-Length'
-# $hContentLocation     = 'Content-Location'
-# $hContentRange        = 'Content-Range'
-
-$hAccept              = 'Accept'
-$hAcceptCharset       = 'Accept-Charset'
-$hAcceptEncoding      = 'Accept-Encoding'
-$hAcceptRanges        = 'Accept-Ranges' 
-
-$headers = { "User-Agent" => "#{SOH_NAME}/Fuseki #{SOH_VERSION}"}
-$print_http = false
-
-# Default for GET
-# At least allow anything (and hope!)
-$accept_rdf="#{$mtTurtle} , #{$mtNTriples};q=0.9 , #{$mtRDF};q=0.8 , #{$mtJSONLD};q=0.5"
-# Datasets
-$accept_ds="#{$mtTrig} , #{$mtNQuads};q=0.9 , #{$mtJSONLD};q=0.5"
-# For SPARQL query
-$accept_results="#{$mtSparqlResultsJ} , #{$mtSparqlResultsX};q=0.9 , #{$accept_rdf}"
-
-# Accept any in case of trouble.
-$accept_rdf="#{$accept_rdf} , */*;q=0.1"
-$accept_results="#{$accept_results} , */*;q=0.1" 
-
-# The media type usually forces the charset.
-$accept_charset=nil
-
-## Who we are.
-## Two styles:
-##    s-query .....
-##    soh query .....
-
-$cmd = File.basename($0)
-if $cmd == 'soh'
-then
-  $cmd = (ARGV.size == 0) ? 'soh' : ARGV.shift
-end
-
-if ! $cmd.start_with?('s-') && $cmd != 'soh'
-  $cmd = 's-'+$cmd
-end
-
-## -------- 
-
-def GET(dataset, graph)
-  print "GET #{dataset} #{graph}\n" if $verbose
-  requestURI = target(dataset, graph)
-  headers = {}
-  headers.merge!($headers)
-  headers[$hAccept] = $accept_rdf
-  headers[$hAcceptCharset] = $accept_charset unless $accept_charset.nil?
-  get_worker(requestURI, headers)
-end
-
-def get_worker(requestURI, headers)
-  uri = URI.parse(requestURI)
-  request = Net::HTTP::Get.new(uri.request_uri)
-  request.initialize_http_header(headers)
-  print_http_request(uri, request)
-  response_print_body(uri, request)
-end
-
-def HEAD(dataset, graph)
-  print "HEAD #{dataset} #{graph}\n" if $verbose
-  requestURI = target(dataset, graph)
-  headers = {}
-  headers.merge!($headers)
-  headers[$hAccept] = $accept_rdf
-  headers[$hAcceptCharset] = $accept_charset unless $accept_charset.nil?
-  uri = URI.parse(requestURI)
-  request = Net::HTTP::Head.new(uri.request_uri)
-  request.initialize_http_header(headers)
-  print_http_request(uri, request)
-  response_no_body(uri, request)
-end
-
-def PUT(dataset, graph, file)
-  print "PUT #{dataset} #{graph} #{file}\n" if $verbose
-  send_body(dataset, graph, file, Net::HTTP::Put)
-end
-
-def POST(dataset, graph, file)
-  print "POST #{dataset} #{graph} #{file}\n" if $verbose
-  send_body(dataset, graph, file, Net::HTTP::Post)
-end
-
-def DELETE(dataset, graph)
-  print "DELETE #{dataset} #{graph}\n" if $verbose
-  requestURI = target(dataset, graph)
-  uri = URI.parse(requestURI)
-  request = Net::HTTP::Delete.new(uri.request_uri)
-  headers = {}
-  headers.merge!($headers)
-  request.initialize_http_header(headers)
-  print_http_request(uri, request)
-  response_no_body(uri, request)
-end
-
-def uri_escape(string)
-  CGI.escape(string)
-end
-
-def target(dataset, graph)
-  return dataset+"?default" if graph == "default"
-  return dataset+"?graph="+uri_escape(graph)
-end
-
-def send_body(dataset, graph, file, method)
-  mt = content_type(file)
-  headers = {}
-  headers.merge!($headers)
-  headers[$hContentType] = mt
-  headers[$hContentLength] = File.size(file).to_s
-  ## p headers
-
-  requestURI = target(dataset, graph)
-  uri = URI.parse(requestURI)
-  
-  request = method.new(uri.request_uri)
-  request.initialize_http_header(headers)
-  print_http_request(uri, request)
-  request.body_stream = File.open(file)
-  response_no_body(uri, request)
-end
-
-def response_no_body(uri, request)
-  http = Net::HTTP::Proxy($proxy.host,$proxy.port).new(uri.host, uri.port)
-  http.read_timeout = nil
-  # check we can connect.
-  begin http.start
-  rescue Exception => e  
-    # puts e.message  
-    #puts e.backtrace.inspect  
-    warn_exit "Failed to connect: #{uri.host}:#{uri.port}: #{e.message}", 3
-  end
-  response = http.request(request)
-  print_http_response(response)
-  case response
-  when Net::HTTPSuccess, Net::HTTPRedirection
-    # OK
-  when Net::HTTPNotFound
-    warn_exit "404 Not found: #{uri}", 9
-    #print response.body
-  else
-    warn_exit "#{response.code} #{response.message} #{uri}", 9
-    # Unreachable
-      response.error!
-  end
-  # NO BODY IN RESPONSE
-end
-
-def response_print_body(uri, request)
-  http = Net::HTTP::Proxy($proxy.host,$proxy.port).new(uri.host, uri.port)
-  http.read_timeout = nil
-  # check we can connect.
-  begin http.start
-  rescue => e  
-    #puts e.backtrace.inspect  
-    #print e.class
-    warn_exit "Failed to connect: #{uri.host}:#{uri.port}: #{e.message}", 3
-  end
-
-  # Add a blank line if headers were output.
-  print "\n" if $http_print ;
-
-  begin
-    response = http.request(request) { |res| 
-      print_http_response(res)
-      #puts res.code
-      res.read_body do |segment|
-        print segment
-      end
-    }
-    case response
-    when Net::HTTPSuccess, Net::HTTPRedirection
-      # OK
-    when Net::HTTPNotFound
-      warn_exit "404 Not found: #{uri}", 9
-      #print response.body
-    else
-      warn_exit "#{response.code}: #{uri}", 9
-      # Unreachable
-      response.error!
-    end
-  rescue EOFError => e
-    warn_exit "IO Error: "+e.message, 3
-  end
-end
-
-def print_http_request(uri, request)
-  return unless $print_http
-  #print "Request\n"
-  print request.method," ",uri, "\n"
-  print_headers("  ",request)
-end
-
-def print_http_response(response)
-  return unless $print_http
-  #print "Response\n"
-  print response.code, " ", response.message, "\n"
-  print_headers("  ",response)
-end
-
-def print_headers(marker, headers)
-  headers.each do |k,v| 
-    k = k.split('-').map{|w| w.capitalize}.join('-')+':'
-    printf "%s%-20s %s\n",marker,k,v
-  end
-end
-
-def content_type(file)
-  file =~ /\.([^.]*)$/
-  ext = $1
-  mt = $fileMediaTypes[ext]
-  cs = $charset[mt]
-  mt = mt+';charset='+cs if ! cs.nil?
-  return mt
-end
-
-def charset(content_type)
-  return $charset[content_type]
-end
-
-def warn_exit(msg, rc)
-    warn msg
-    exit rc ;
-end
-
-def parseURI(uri_string)
-  begin
-    return URI.parse(uri_string).to_s
-  rescue URI::InvalidURIError => err
-    warn_exit "Bad URI: <#{uri_string}>", 2
-  end
-end
-
-## ---- Command
-
-def cmd_soh(command=nil)
-  ## Command line
-  options = {}
-  optparse = OptionParser.new do |opts|
-    # Set a banner, displayed at the top
-    # of the help screen.
-    case $cmd
-    when "s-http", "sparql-http", "soh"
-      banner="$cmd [get|post|put|delete] datasetURI graph [file]"
-    when "s-get", "s-head", "s-delete"
-      banner="$cmd  datasetURI graph"
-    end
-
-    opts.banner = $banner
-    # Define the options, and what they do
-    
-    options[:verbose] = false
-    opts.on( '-v', '--verbose', 'Verbose' ) do
-      options[:verbose] = true
-    end
-    
-    options[:version] = false
-    opts.on( '--version', 'Print version and exit' ) do
-      print "#{SOH_NAME} #{SOH_VERSION}\n"
-      exit
-    end
-    
-    # This displays the help screen, all programs are
-    # assumed to have this option.
-    opts.on( '-h', '--help', 'Display this screen and exit' ) do
-      puts opts
-      exit
-    end
-  end
-
-  begin optparse.parse!    
-  rescue OptionParser::InvalidArgument => e
-    warn e
-    exit
-  end
-
-  $verbose = options[:verbose]
-  $print_http = $verbose
-
-  if command.nil?
-    if ARGV.size == 0
-      warn "No command given: expected one of 'get', 'put', 'post', 'delete', 'query' or 'update'"
-      exit 1
-    end
-    cmdPrint=ARGV.shift
-    command=cmdPrint.upcase
-  else
-    cmdPrint=command
-  end
-
-  case command
-  when "HEAD", "GET", "DELETE"
-    requiredFile=false
-  when "PUT", "POST"
-    requiredFile=true
-  when "QUERY"
-    cmd_sparql_query
-  when "UPDATE"
-    cmd_sparql_update
-  else
-    warn_exit "Unknown command: #{command}", 2
-  end
-
-  if requiredFile 
-  then
-    if ARGV.size != 3
-      warn_exit "Required: dataset URI, graph URI (or 'default') and file", 1 
-    end
-  else
-    if ARGV.size != 2
-      warn_exit "Required: dataset URI and graph URI (or 'default')", 1 
-    end
-  end
-
-  dataset=parseURI(ARGV.shift)
-  # Relative URI?
-  graph=parseURI(ARGV.shift)
-  file=""
-  if requiredFile
-  then
-    file = ARGV.shift if requiredFile
-    if ! File.exist?(file)
-      warn_exit "No such file: "+file, 3
-    end
-    if File.directory?(file)
-      warn_exit "File is a directory: "+file, 3
-    end
-  end
-
-  case command
-  when "GET"
-    GET(dataset, graph)
-  when "HEAD"
-    HEAD(dataset, graph)
-  when "PUT"
-    PUT(dataset, graph, file)
-  when "DELETE"
-    DELETE(dataset, graph)
-  when "POST"
-    POST(dataset, graph, file)
-  else
-    warn_exit "Internal error: Unknown command: #{cmd}", 2
-  end
-  exit 0
-end
-
-## --------
-def string_or_file(arg)
-  return arg if ! arg.match(/^@/)
-  a=(arg[1..-1])
-  open(a, 'rb'){|f| f.read}
-end
-
-## -------- SPARQL Query
-
-## Choose method
-def SPARQL_query(service, query, query_file, forcePOST=false, args2={})
-   if ! query_file.nil?
-    query = open(query_file, 'rb'){|f| f.read}
-  end
-  if forcePOST || query.length >= 2*1024 
-    SPARQL_query_POST(service, query, args2)
-  else
-    SPARQL_query_GET(service, query, args2)
-  end
-end
-
-## By GET
-
-def SPARQL_query_GET(service, query, args2)
-  args = { "query" => query }
-  args.merge!(args2)
-  qs=args.collect { |k,v| "#{k}=#{uri_escape(v)}" }.join('&')
-  action="#{service}?#{qs}"
-  headers={}
-  headers.merge!($headers)
-  headers[$hAccept]=$accept_results
-  get_worker(action, headers)
-end
-
-## By POST
-
-def SPARQL_query_POST(service, query, args2)
-  # DRY - body/no body for each of request and response.
-  post_params={ "query" => query }
-  post_params.merge!(args2)
-  uri = URI.parse(service)
-  headers={}
-  headers.merge!($headers)
-  headers[$hAccept]=$accept_results
-  execute_post_form_body(uri, headers, post_params)
-end
-
-def execute_post_form_body(uri, headers, post_params)
-  request = Net::HTTP::Post.new(uri.request_uri)
-  qs=post_params.collect { |k,v| "#{k}=#{uri_escape(v)}" }.join('&')
-  headers[$hContentType] = $mtWWWForm
-  headers[$hContentLength] = qs.length.to_s
-  request.initialize_http_header(headers)
-  request.body = qs
-  print_http_request(uri, request)
-  response_print_body(uri, request)
-end
-
-# Usage: -v --help --file= --query=
-def cmd_sparql_query
-  options={}
-  optparse = OptionParser.new do |opts|
-    opts.banner = "Usage: #{$cmd} [--query QUERY] [--service URI] [--post] 'query' | @file"
-    opts.on('--service=URI', '--server=URI', 'SPARQL endpoint') do |uri|
-      options[:service]=uri
-    end
-    opts.on('--query=FILE','--file=FILE', 'Take query from a file') do |file|
-      options[:file]=file
-    end
-    opts.on('--output=TYPE', [:json,:xml,:text,:csv,:tsv],
-            'Set the output argument') do |type|
-      options[:output]=type
-    end
-    opts.on('--accept=TYPE', [:json,:xml,:text,:csv,:tsv], 
-            'Set the accept header type') do |type|
-      options[:accept]=type
-    end
-    options[:verbose] = false
-    opts.on( '--post', 'Force use of POST' ) do
-      options[:post] = true
-    end
-    opts.on( '-v', '--verbose', 'Verbose' ) do
-      options[:verbose] = true
-    end
-    opts.on( '--version', 'Print version and exit' ) do
-      print "#{SOH_NAME} #{SOH_VERSION}\n"
-      exit
-    end 
-    opts.on( '-h', '--help', 'Display this screen and exit' ) do
-      puts opts
-      exit
-    end
-  end
-
-  begin optparse.parse!    
-  rescue OptionParser::InvalidArgument, OptionParser::InvalidOption => e
-    warn e
-    exit 1
-  end
-
-  $verbose = options[:verbose]
-  $print_http = $verbose
-  usePOST = options[:post]
-
-  service = options[:service]
-  warn_exit 'No service specified.  Required --service=URI',1 if service.nil?
-
-  # Query
-  query=nil
-  query_file=options[:file]
-  if query_file.nil? && ARGV.size == 0
-  then
-    warn_exit 'No query specified.',1
-    end
-  if query_file.nil?
-    query = ARGV.shift
-    if query.match(/^@/)
-      query_file = query[1..-1]
-      query = nil
-    end
-  end
-
-  # --output ==> output= (non-standard)
-  args={}
-  case options[:output]
-  when nil
-  when  "json","xml","text","csv","tsv"
-    args['output'] = options[:output]
-  when :json,:xml,:text,:csv,:tsv
-    args['output'] = options[:output].to_s
-  else
-    warn_exit "Unrecognized output type: "+options[:output],2
-  end
-
-  # --accept
-  # options[:accept]
-
-  print "SPARQL #{service}\n" if $verbose
-  #args={"output"=>"text"}
-  SPARQL_query(service, query, query_file, usePOST, args)
-  exit(0)
-end
-
-## -------- SPARQL Update
-
-# Update sent as a WWW form.
-def SPARQL_update_by_form(service, update, args2={})
-  args = {}
-  args.merge!(args2)
-  headers={}
-  headers.merge!($headers)
-  # args? encode?
-  body="update="+uri_escape(update)
-  headers[$hContentType] = $mtWWWForm
-  headers[$hContentLength] = body.length.to_s
-  uri = URI.parse(service)
-  execute_post_form(uri, headers, body)
-end
-
-# DRY - query form.
-def execute_post_form(uri, headers, body)
-  request = Net::HTTP::Post.new(uri.request_uri)
-  request.initialize_http_header(headers)
-  request.body = body
-  print_http_request(uri, request)
-  response_no_body(uri, request)
-end
-
-def SPARQL_update(service, update, args2={})
-  args = {}
-  args.merge!(args2)
-  headers={}
-  headers.merge!($headers)
-  headers[$hContentType] = $mtSparqlUpdate
-  uri = URI.parse(service)
-  request = Net::HTTP::Post.new(uri.request_uri)
-  request.initialize_http_header(headers)
-  request.body = update
-  print_http_request(uri, request)
-  response_no_body(uri, request)
-end
-
-def cmd_sparql_update(by_raw_post=true)
-  # Share with cmd_sparql_query
-  options={}
-  optparse = OptionParser.new do |opts|
-    opts.banner = "Usage: #{$cmd} [--file REQUEST] [--service URI] 'request' | @file"
-    opts.on('--service=URI', '--server=URI', 'SPARQL endpoint') do |uri|
-      options[:service]=uri
-    end
-    opts.on('--update=FILE', '--file=FILE', 'Take update from a file') do |file|
-      options[:file]=file
-    end
-    options[:verbose] = false
-    opts.on( '-v', '--verbose', 'Verbose' ) do
-      options[:verbose] = true
-    end
-    opts.on( '--version', 'Print version and exit' ) do
-      print "#{SOH_NAME} #{SOH_VERSION}\n"
-      exit
-    end 
-    opts.on( '-h', '--help', 'Display this screen and exit' ) do
-      puts opts
-      exit
-    end
-  end
-
-  begin optparse.parse!    
-  rescue OptionParser::InvalidArgument => e
-    warn e
-    exit
-  end
-
-  $verbose = options[:verbose]
-  $print_http = $verbose
-
-  service = options[:service]
-  warn_exit 'No service specified. Required --service=URI',1   if service.nil?
-  
-  update=nil
-  update_file=options[:file]
-
-  if update_file.nil? && ARGV.size == 0
-  then
-    warn_exit 'No update specified.',1
-    end
-  if update_file.nil?
-    update = ARGV.shift
-    if update.match(/^@/)
-      update_file = update[1..-1]
-      update = nil
-    end
-  end
-  
-  print "SPARQL-Update #{service}\n" if $verbose
-  args={}
-
-  # Reads in the file :-(
-  if update.nil?
-  then
-    update = open(update_file, 'rb'){|f| f.read}
-  else
-    update = string_or_file(update)
-  end
-
-  if by_raw_post
-    SPARQL_update(service, update, args)
-  else
-    SPARQL_update_by_form(service, update, args)
-  end
-  exit(0)
-end
-
-## -------
-
-case $cmd
-when "s-http", "sparql-http", "soh"
-  $banner="#{$cmd} [get|post|put|delete] datasetURI graph [file]"
-  cmd_soh
-when "s-get", "s-head", "s-put", "s-delete", "s-post"
-
-  case $cmd
-  when "s-get", "s-head", "s-delete"
-    $banner="#{$cmd} datasetURI graph"
-  when "s-put", "s-post"
-    $banner="#{$cmd} datasetURI graph file"
-  end
-  cmd2 = $cmd.sub(/^s-/, '').upcase
-  cmd_soh cmd2
-
-when "s-query", "sparql-query"
-  cmd_sparql_query
-when "s-update", "sparql-update"
-  cmd_sparql_update true
-when "s-update-form", "sparql-update-form"
-  cmd_sparql_update false
-else 
-  warn_exit "Unknown: "+$cmd, 1
-end

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/s-get
----------------------------------------------------------------------
diff --git a/jena-fuseki/s-get b/jena-fuseki/s-get
deleted file mode 100755
index 4f6590d..0000000
--- a/jena-fuseki/s-get
+++ /dev/null
@@ -1,713 +0,0 @@
-#!/usr/bin/env ruby
-# -*- coding: utf-8 -*-
-
-# 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.
-
-# SPARQL HTTP Update, client.
-
-require 'optparse'
-require 'net/http'
-require 'uri'
-require 'cgi'
-require 'pp'
-require 'ostruct'
-
-# ToDo
-#  Allow a choice of media type for GET
-#   --accept "content-type" (and abbreviations)
-#   --header "Add:this"
-#   --user, --password
-#  Basic authentication: request.basic_auth("username", "password")
-#  Follow redirects => 301:  puts response["location"] # All headers are lowercase?
-
-SOH_NAME="SOH"
-SOH_VERSION="0.0.0"
-
-$proxy = ENV['http_proxy'] ? URI.parse(ENV['http_proxy']) : OpenStruct.new  
-
-# What about direct naming?
-
-# Names
-$mtTurtle           = 'text/turtle;charset=utf-8'
-$mtRDF              = 'application/rdf+xml'
-$mtText             = 'text/plain'
-$mtNTriples         = 'application/n-triples'
-$mtNQuads           = 'application/n-quads'
-$mtJSONLD           = 'application/ld+json'
-$mtTriG             = 'application/trig'
-$mtSparqlResultsX   = 'application/sparql-results+xml'
-$mtSparqlResultsJ   = 'application/sparql-results+json'
-$mtAppJSON          = 'application/json'
-$mtAppXML           = 'application/xml'
-$mtSparqlResultsTSV = 'application/sparql-results+tsv'
-$mtSparqlResultsCSV = 'application/sparql-results+csv'
-$mtSparqlUpdate     = 'application/sparql-update'
-$mtWWWForm          = 'application/x-www-form-urlencoded'
-$mtSparqlQuery      = "application/sparql-query" ;
-
-# Global media type table.
-$fileMediaTypes = {}
-$fileMediaTypes['ttl']   = $mtTurtle
-$fileMediaTypes['n3']    = 'text/n3; charset=utf-8'
-$fileMediaTypes['nt']    = $mtText
-$fileMediaTypes['rdf']   = $mtRDF
-$fileMediaTypes['owl']   = $mtRDF
-$fileMediaTypes['nq']    = $mtNQuads
-$fileMediaTypes['trig']  = $mtTriG
-$fileMediaTypes['json-ld']  = $mtJSONLD
-$fileMediaTypes['jsonld']  = $mtJSONLD
-
-# Global charset : no entry means "don't set"
-$charsetUTF8      = 'utf-8'
-$charset = {}
-$charset[$mtTurtle]   = 'utf-8'
-$charset[$mtText]     = 'ascii'
-$charset[$mtTriG]     = 'utf-8'
-$charset[$mtNQuads]   = 'utf-8'
-
-# Headers
-
-$hContentType         = 'Content-Type'
-# $hContentEncoding     = 'Content-Encoding'
-$hContentLength       = 'Content-Length'
-# $hContentLocation     = 'Content-Location'
-# $hContentRange        = 'Content-Range'
-
-$hAccept              = 'Accept'
-$hAcceptCharset       = 'Accept-Charset'
-$hAcceptEncoding      = 'Accept-Encoding'
-$hAcceptRanges        = 'Accept-Ranges' 
-
-$headers = { "User-Agent" => "#{SOH_NAME}/Fuseki #{SOH_VERSION}"}
-$print_http = false
-
-# Default for GET
-# At least allow anything (and hope!)
-$accept_rdf="#{$mtTurtle} , #{$mtNTriples};q=0.9 , #{$mtRDF};q=0.8 , #{$mtJSONLD};q=0.5"
-# Datasets
-$accept_ds="#{$mtTrig} , #{$mtNQuads};q=0.9 , #{$mtJSONLD};q=0.5"
-# For SPARQL query
-$accept_results="#{$mtSparqlResultsJ} , #{$mtSparqlResultsX};q=0.9 , #{$accept_rdf}"
-
-# Accept any in case of trouble.
-$accept_rdf="#{$accept_rdf} , */*;q=0.1"
-$accept_results="#{$accept_results} , */*;q=0.1" 
-
-# The media type usually forces the charset.
-$accept_charset=nil
-
-## Who we are.
-## Two styles:
-##    s-query .....
-##    soh query .....
-
-$cmd = File.basename($0)
-if $cmd == 'soh'
-then
-  $cmd = (ARGV.size == 0) ? 'soh' : ARGV.shift
-end
-
-if ! $cmd.start_with?('s-') && $cmd != 'soh'
-  $cmd = 's-'+$cmd
-end
-
-## -------- 
-
-def GET(dataset, graph)
-  print "GET #{dataset} #{graph}\n" if $verbose
-  requestURI = target(dataset, graph)
-  headers = {}
-  headers.merge!($headers)
-  headers[$hAccept] = $accept_rdf
-  headers[$hAcceptCharset] = $accept_charset unless $accept_charset.nil?
-  get_worker(requestURI, headers)
-end
-
-def get_worker(requestURI, headers)
-  uri = URI.parse(requestURI)
-  request = Net::HTTP::Get.new(uri.request_uri)
-  request.initialize_http_header(headers)
-  print_http_request(uri, request)
-  response_print_body(uri, request)
-end
-
-def HEAD(dataset, graph)
-  print "HEAD #{dataset} #{graph}\n" if $verbose
-  requestURI = target(dataset, graph)
-  headers = {}
-  headers.merge!($headers)
-  headers[$hAccept] = $accept_rdf
-  headers[$hAcceptCharset] = $accept_charset unless $accept_charset.nil?
-  uri = URI.parse(requestURI)
-  request = Net::HTTP::Head.new(uri.request_uri)
-  request.initialize_http_header(headers)
-  print_http_request(uri, request)
-  response_no_body(uri, request)
-end
-
-def PUT(dataset, graph, file)
-  print "PUT #{dataset} #{graph} #{file}\n" if $verbose
-  send_body(dataset, graph, file, Net::HTTP::Put)
-end
-
-def POST(dataset, graph, file)
-  print "POST #{dataset} #{graph} #{file}\n" if $verbose
-  send_body(dataset, graph, file, Net::HTTP::Post)
-end
-
-def DELETE(dataset, graph)
-  print "DELETE #{dataset} #{graph}\n" if $verbose
-  requestURI = target(dataset, graph)
-  uri = URI.parse(requestURI)
-  request = Net::HTTP::Delete.new(uri.request_uri)
-  headers = {}
-  headers.merge!($headers)
-  request.initialize_http_header(headers)
-  print_http_request(uri, request)
-  response_no_body(uri, request)
-end
-
-def uri_escape(string)
-  CGI.escape(string)
-end
-
-def target(dataset, graph)
-  return dataset+"?default" if graph == "default"
-  return dataset+"?graph="+uri_escape(graph)
-end
-
-def send_body(dataset, graph, file, method)
-  mt = content_type(file)
-  headers = {}
-  headers.merge!($headers)
-  headers[$hContentType] = mt
-  headers[$hContentLength] = File.size(file).to_s
-  ## p headers
-
-  requestURI = target(dataset, graph)
-  uri = URI.parse(requestURI)
-  
-  request = method.new(uri.request_uri)
-  request.initialize_http_header(headers)
-  print_http_request(uri, request)
-  request.body_stream = File.open(file)
-  response_no_body(uri, request)
-end
-
-def response_no_body(uri, request)
-  http = Net::HTTP::Proxy($proxy.host,$proxy.port).new(uri.host, uri.port)
-  http.read_timeout = nil
-  # check we can connect.
-  begin http.start
-  rescue Exception => e  
-    # puts e.message  
-    #puts e.backtrace.inspect  
-    warn_exit "Failed to connect: #{uri.host}:#{uri.port}: #{e.message}", 3
-  end
-  response = http.request(request)
-  print_http_response(response)
-  case response
-  when Net::HTTPSuccess, Net::HTTPRedirection
-    # OK
-  when Net::HTTPNotFound
-    warn_exit "404 Not found: #{uri}", 9
-    #print response.body
-  else
-    warn_exit "#{response.code} #{response.message} #{uri}", 9
-    # Unreachable
-      response.error!
-  end
-  # NO BODY IN RESPONSE
-end
-
-def response_print_body(uri, request)
-  http = Net::HTTP::Proxy($proxy.host,$proxy.port).new(uri.host, uri.port)
-  http.read_timeout = nil
-  # check we can connect.
-  begin http.start
-  rescue => e  
-    #puts e.backtrace.inspect  
-    #print e.class
-    warn_exit "Failed to connect: #{uri.host}:#{uri.port}: #{e.message}", 3
-  end
-
-  # Add a blank line if headers were output.
-  print "\n" if $http_print ;
-
-  begin
-    response = http.request(request) { |res| 
-      print_http_response(res)
-      #puts res.code
-      res.read_body do |segment|
-        print segment
-      end
-    }
-    case response
-    when Net::HTTPSuccess, Net::HTTPRedirection
-      # OK
-    when Net::HTTPNotFound
-      warn_exit "404 Not found: #{uri}", 9
-      #print response.body
-    else
-      warn_exit "#{response.code}: #{uri}", 9
-      # Unreachable
-      response.error!
-    end
-  rescue EOFError => e
-    warn_exit "IO Error: "+e.message, 3
-  end
-end
-
-def print_http_request(uri, request)
-  return unless $print_http
-  #print "Request\n"
-  print request.method," ",uri, "\n"
-  print_headers("  ",request)
-end
-
-def print_http_response(response)
-  return unless $print_http
-  #print "Response\n"
-  print response.code, " ", response.message, "\n"
-  print_headers("  ",response)
-end
-
-def print_headers(marker, headers)
-  headers.each do |k,v| 
-    k = k.split('-').map{|w| w.capitalize}.join('-')+':'
-    printf "%s%-20s %s\n",marker,k,v
-  end
-end
-
-def content_type(file)
-  file =~ /\.([^.]*)$/
-  ext = $1
-  mt = $fileMediaTypes[ext]
-  cs = $charset[mt]
-  mt = mt+';charset='+cs if ! cs.nil?
-  return mt
-end
-
-def charset(content_type)
-  return $charset[content_type]
-end
-
-def warn_exit(msg, rc)
-    warn msg
-    exit rc ;
-end
-
-def parseURI(uri_string)
-  begin
-    return URI.parse(uri_string).to_s
-  rescue URI::InvalidURIError => err
-    warn_exit "Bad URI: <#{uri_string}>", 2
-  end
-end
-
-## ---- Command
-
-def cmd_soh(command=nil)
-  ## Command line
-  options = {}
-  optparse = OptionParser.new do |opts|
-    # Set a banner, displayed at the top
-    # of the help screen.
-    case $cmd
-    when "s-http", "sparql-http", "soh"
-      banner="$cmd [get|post|put|delete] datasetURI graph [file]"
-    when "s-get", "s-head", "s-delete"
-      banner="$cmd  datasetURI graph"
-    end
-
-    opts.banner = $banner
-    # Define the options, and what they do
-    
-    options[:verbose] = false
-    opts.on( '-v', '--verbose', 'Verbose' ) do
-      options[:verbose] = true
-    end
-    
-    options[:version] = false
-    opts.on( '--version', 'Print version and exit' ) do
-      print "#{SOH_NAME} #{SOH_VERSION}\n"
-      exit
-    end
-    
-    # This displays the help screen, all programs are
-    # assumed to have this option.
-    opts.on( '-h', '--help', 'Display this screen and exit' ) do
-      puts opts
-      exit
-    end
-  end
-
-  begin optparse.parse!    
-  rescue OptionParser::InvalidArgument => e
-    warn e
-    exit
-  end
-
-  $verbose = options[:verbose]
-  $print_http = $verbose
-
-  if command.nil?
-    if ARGV.size == 0
-      warn "No command given: expected one of 'get', 'put', 'post', 'delete', 'query' or 'update'"
-      exit 1
-    end
-    cmdPrint=ARGV.shift
-    command=cmdPrint.upcase
-  else
-    cmdPrint=command
-  end
-
-  case command
-  when "HEAD", "GET", "DELETE"
-    requiredFile=false
-  when "PUT", "POST"
-    requiredFile=true
-  when "QUERY"
-    cmd_sparql_query
-  when "UPDATE"
-    cmd_sparql_update
-  else
-    warn_exit "Unknown command: #{command}", 2
-  end
-
-  if requiredFile 
-  then
-    if ARGV.size != 3
-      warn_exit "Required: dataset URI, graph URI (or 'default') and file", 1 
-    end
-  else
-    if ARGV.size != 2
-      warn_exit "Required: dataset URI and graph URI (or 'default')", 1 
-    end
-  end
-
-  dataset=parseURI(ARGV.shift)
-  # Relative URI?
-  graph=parseURI(ARGV.shift)
-  file=""
-  if requiredFile
-  then
-    file = ARGV.shift if requiredFile
-    if ! File.exist?(file)
-      warn_exit "No such file: "+file, 3
-    end
-    if File.directory?(file)
-      warn_exit "File is a directory: "+file, 3
-    end
-  end
-
-  case command
-  when "GET"
-    GET(dataset, graph)
-  when "HEAD"
-    HEAD(dataset, graph)
-  when "PUT"
-    PUT(dataset, graph, file)
-  when "DELETE"
-    DELETE(dataset, graph)
-  when "POST"
-    POST(dataset, graph, file)
-  else
-    warn_exit "Internal error: Unknown command: #{cmd}", 2
-  end
-  exit 0
-end
-
-## --------
-def string_or_file(arg)
-  return arg if ! arg.match(/^@/)
-  a=(arg[1..-1])
-  open(a, 'rb'){|f| f.read}
-end
-
-## -------- SPARQL Query
-
-## Choose method
-def SPARQL_query(service, query, query_file, forcePOST=false, args2={})
-   if ! query_file.nil?
-    query = open(query_file, 'rb'){|f| f.read}
-  end
-  if forcePOST || query.length >= 2*1024 
-    SPARQL_query_POST(service, query, args2)
-  else
-    SPARQL_query_GET(service, query, args2)
-  end
-end
-
-## By GET
-
-def SPARQL_query_GET(service, query, args2)
-  args = { "query" => query }
-  args.merge!(args2)
-  qs=args.collect { |k,v| "#{k}=#{uri_escape(v)}" }.join('&')
-  action="#{service}?#{qs}"
-  headers={}
-  headers.merge!($headers)
-  headers[$hAccept]=$accept_results
-  get_worker(action, headers)
-end
-
-## By POST
-
-def SPARQL_query_POST(service, query, args2)
-  # DRY - body/no body for each of request and response.
-  post_params={ "query" => query }
-  post_params.merge!(args2)
-  uri = URI.parse(service)
-  headers={}
-  headers.merge!($headers)
-  headers[$hAccept]=$accept_results
-  execute_post_form_body(uri, headers, post_params)
-end
-
-def execute_post_form_body(uri, headers, post_params)
-  request = Net::HTTP::Post.new(uri.request_uri)
-  qs=post_params.collect { |k,v| "#{k}=#{uri_escape(v)}" }.join('&')
-  headers[$hContentType] = $mtWWWForm
-  headers[$hContentLength] = qs.length.to_s
-  request.initialize_http_header(headers)
-  request.body = qs
-  print_http_request(uri, request)
-  response_print_body(uri, request)
-end
-
-# Usage: -v --help --file= --query=
-def cmd_sparql_query
-  options={}
-  optparse = OptionParser.new do |opts|
-    opts.banner = "Usage: #{$cmd} [--query QUERY] [--service URI] [--post] 'query' | @file"
-    opts.on('--service=URI', '--server=URI', 'SPARQL endpoint') do |uri|
-      options[:service]=uri
-    end
-    opts.on('--query=FILE','--file=FILE', 'Take query from a file') do |file|
-      options[:file]=file
-    end
-    opts.on('--output=TYPE', [:json,:xml,:text,:csv,:tsv],
-            'Set the output argument') do |type|
-      options[:output]=type
-    end
-    opts.on('--accept=TYPE', [:json,:xml,:text,:csv,:tsv], 
-            'Set the accept header type') do |type|
-      options[:accept]=type
-    end
-    options[:verbose] = false
-    opts.on( '--post', 'Force use of POST' ) do
-      options[:post] = true
-    end
-    opts.on( '-v', '--verbose', 'Verbose' ) do
-      options[:verbose] = true
-    end
-    opts.on( '--version', 'Print version and exit' ) do
-      print "#{SOH_NAME} #{SOH_VERSION}\n"
-      exit
-    end 
-    opts.on( '-h', '--help', 'Display this screen and exit' ) do
-      puts opts
-      exit
-    end
-  end
-
-  begin optparse.parse!    
-  rescue OptionParser::InvalidArgument, OptionParser::InvalidOption => e
-    warn e
-    exit 1
-  end
-
-  $verbose = options[:verbose]
-  $print_http = $verbose
-  usePOST = options[:post]
-
-  service = options[:service]
-  warn_exit 'No service specified.  Required --service=URI',1 if service.nil?
-
-  # Query
-  query=nil
-  query_file=options[:file]
-  if query_file.nil? && ARGV.size == 0
-  then
-    warn_exit 'No query specified.',1
-    end
-  if query_file.nil?
-    query = ARGV.shift
-    if query.match(/^@/)
-      query_file = query[1..-1]
-      query = nil
-    end
-  end
-
-  # --output ==> output= (non-standard)
-  args={}
-  case options[:output]
-  when nil
-  when  "json","xml","text","csv","tsv"
-    args['output'] = options[:output]
-  when :json,:xml,:text,:csv,:tsv
-    args['output'] = options[:output].to_s
-  else
-    warn_exit "Unrecognized output type: "+options[:output],2
-  end
-
-  # --accept
-  # options[:accept]
-
-  print "SPARQL #{service}\n" if $verbose
-  #args={"output"=>"text"}
-  SPARQL_query(service, query, query_file, usePOST, args)
-  exit(0)
-end
-
-## -------- SPARQL Update
-
-# Update sent as a WWW form.
-def SPARQL_update_by_form(service, update, args2={})
-  args = {}
-  args.merge!(args2)
-  headers={}
-  headers.merge!($headers)
-  # args? encode?
-  body="update="+uri_escape(update)
-  headers[$hContentType] = $mtWWWForm
-  headers[$hContentLength] = body.length.to_s
-  uri = URI.parse(service)
-  execute_post_form(uri, headers, body)
-end
-
-# DRY - query form.
-def execute_post_form(uri, headers, body)
-  request = Net::HTTP::Post.new(uri.request_uri)
-  request.initialize_http_header(headers)
-  request.body = body
-  print_http_request(uri, request)
-  response_no_body(uri, request)
-end
-
-def SPARQL_update(service, update, args2={})
-  args = {}
-  args.merge!(args2)
-  headers={}
-  headers.merge!($headers)
-  headers[$hContentType] = $mtSparqlUpdate
-  uri = URI.parse(service)
-  request = Net::HTTP::Post.new(uri.request_uri)
-  request.initialize_http_header(headers)
-  request.body = update
-  print_http_request(uri, request)
-  response_no_body(uri, request)
-end
-
-def cmd_sparql_update(by_raw_post=true)
-  # Share with cmd_sparql_query
-  options={}
-  optparse = OptionParser.new do |opts|
-    opts.banner = "Usage: #{$cmd} [--file REQUEST] [--service URI] 'request' | @file"
-    opts.on('--service=URI', '--server=URI', 'SPARQL endpoint') do |uri|
-      options[:service]=uri
-    end
-    opts.on('--update=FILE', '--file=FILE', 'Take update from a file') do |file|
-      options[:file]=file
-    end
-    options[:verbose] = false
-    opts.on( '-v', '--verbose', 'Verbose' ) do
-      options[:verbose] = true
-    end
-    opts.on( '--version', 'Print version and exit' ) do
-      print "#{SOH_NAME} #{SOH_VERSION}\n"
-      exit
-    end 
-    opts.on( '-h', '--help', 'Display this screen and exit' ) do
-      puts opts
-      exit
-    end
-  end
-
-  begin optparse.parse!    
-  rescue OptionParser::InvalidArgument => e
-    warn e
-    exit
-  end
-
-  $verbose = options[:verbose]
-  $print_http = $verbose
-
-  service = options[:service]
-  warn_exit 'No service specified. Required --service=URI',1   if service.nil?
-  
-  update=nil
-  update_file=options[:file]
-
-  if update_file.nil? && ARGV.size == 0
-  then
-    warn_exit 'No update specified.',1
-    end
-  if update_file.nil?
-    update = ARGV.shift
-    if update.match(/^@/)
-      update_file = update[1..-1]
-      update = nil
-    end
-  end
-  
-  print "SPARQL-Update #{service}\n" if $verbose
-  args={}
-
-  # Reads in the file :-(
-  if update.nil?
-  then
-    update = open(update_file, 'rb'){|f| f.read}
-  else
-    update = string_or_file(update)
-  end
-
-  if by_raw_post
-    SPARQL_update(service, update, args)
-  else
-    SPARQL_update_by_form(service, update, args)
-  end
-  exit(0)
-end
-
-## -------
-
-case $cmd
-when "s-http", "sparql-http", "soh"
-  $banner="#{$cmd} [get|post|put|delete] datasetURI graph [file]"
-  cmd_soh
-when "s-get", "s-head", "s-put", "s-delete", "s-post"
-
-  case $cmd
-  when "s-get", "s-head", "s-delete"
-    $banner="#{$cmd} datasetURI graph"
-  when "s-put", "s-post"
-    $banner="#{$cmd} datasetURI graph file"
-  end
-  cmd2 = $cmd.sub(/^s-/, '').upcase
-  cmd_soh cmd2
-
-when "s-query", "sparql-query"
-  cmd_sparql_query
-when "s-update", "sparql-update"
-  cmd_sparql_update true
-when "s-update-form", "sparql-update-form"
-  cmd_sparql_update false
-else 
-  warn_exit "Unknown: "+$cmd, 1
-end

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/s-head
----------------------------------------------------------------------
diff --git a/jena-fuseki/s-head b/jena-fuseki/s-head
deleted file mode 100755
index 4f6590d..0000000
--- a/jena-fuseki/s-head
+++ /dev/null
@@ -1,713 +0,0 @@
-#!/usr/bin/env ruby
-# -*- coding: utf-8 -*-
-
-# 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.
-
-# SPARQL HTTP Update, client.
-
-require 'optparse'
-require 'net/http'
-require 'uri'
-require 'cgi'
-require 'pp'
-require 'ostruct'
-
-# ToDo
-#  Allow a choice of media type for GET
-#   --accept "content-type" (and abbreviations)
-#   --header "Add:this"
-#   --user, --password
-#  Basic authentication: request.basic_auth("username", "password")
-#  Follow redirects => 301:  puts response["location"] # All headers are lowercase?
-
-SOH_NAME="SOH"
-SOH_VERSION="0.0.0"
-
-$proxy = ENV['http_proxy'] ? URI.parse(ENV['http_proxy']) : OpenStruct.new  
-
-# What about direct naming?
-
-# Names
-$mtTurtle           = 'text/turtle;charset=utf-8'
-$mtRDF              = 'application/rdf+xml'
-$mtText             = 'text/plain'
-$mtNTriples         = 'application/n-triples'
-$mtNQuads           = 'application/n-quads'
-$mtJSONLD           = 'application/ld+json'
-$mtTriG             = 'application/trig'
-$mtSparqlResultsX   = 'application/sparql-results+xml'
-$mtSparqlResultsJ   = 'application/sparql-results+json'
-$mtAppJSON          = 'application/json'
-$mtAppXML           = 'application/xml'
-$mtSparqlResultsTSV = 'application/sparql-results+tsv'
-$mtSparqlResultsCSV = 'application/sparql-results+csv'
-$mtSparqlUpdate     = 'application/sparql-update'
-$mtWWWForm          = 'application/x-www-form-urlencoded'
-$mtSparqlQuery      = "application/sparql-query" ;
-
-# Global media type table.
-$fileMediaTypes = {}
-$fileMediaTypes['ttl']   = $mtTurtle
-$fileMediaTypes['n3']    = 'text/n3; charset=utf-8'
-$fileMediaTypes['nt']    = $mtText
-$fileMediaTypes['rdf']   = $mtRDF
-$fileMediaTypes['owl']   = $mtRDF
-$fileMediaTypes['nq']    = $mtNQuads
-$fileMediaTypes['trig']  = $mtTriG
-$fileMediaTypes['json-ld']  = $mtJSONLD
-$fileMediaTypes['jsonld']  = $mtJSONLD
-
-# Global charset : no entry means "don't set"
-$charsetUTF8      = 'utf-8'
-$charset = {}
-$charset[$mtTurtle]   = 'utf-8'
-$charset[$mtText]     = 'ascii'
-$charset[$mtTriG]     = 'utf-8'
-$charset[$mtNQuads]   = 'utf-8'
-
-# Headers
-
-$hContentType         = 'Content-Type'
-# $hContentEncoding     = 'Content-Encoding'
-$hContentLength       = 'Content-Length'
-# $hContentLocation     = 'Content-Location'
-# $hContentRange        = 'Content-Range'
-
-$hAccept              = 'Accept'
-$hAcceptCharset       = 'Accept-Charset'
-$hAcceptEncoding      = 'Accept-Encoding'
-$hAcceptRanges        = 'Accept-Ranges' 
-
-$headers = { "User-Agent" => "#{SOH_NAME}/Fuseki #{SOH_VERSION}"}
-$print_http = false
-
-# Default for GET
-# At least allow anything (and hope!)
-$accept_rdf="#{$mtTurtle} , #{$mtNTriples};q=0.9 , #{$mtRDF};q=0.8 , #{$mtJSONLD};q=0.5"
-# Datasets
-$accept_ds="#{$mtTrig} , #{$mtNQuads};q=0.9 , #{$mtJSONLD};q=0.5"
-# For SPARQL query
-$accept_results="#{$mtSparqlResultsJ} , #{$mtSparqlResultsX};q=0.9 , #{$accept_rdf}"
-
-# Accept any in case of trouble.
-$accept_rdf="#{$accept_rdf} , */*;q=0.1"
-$accept_results="#{$accept_results} , */*;q=0.1" 
-
-# The media type usually forces the charset.
-$accept_charset=nil
-
-## Who we are.
-## Two styles:
-##    s-query .....
-##    soh query .....
-
-$cmd = File.basename($0)
-if $cmd == 'soh'
-then
-  $cmd = (ARGV.size == 0) ? 'soh' : ARGV.shift
-end
-
-if ! $cmd.start_with?('s-') && $cmd != 'soh'
-  $cmd = 's-'+$cmd
-end
-
-## -------- 
-
-def GET(dataset, graph)
-  print "GET #{dataset} #{graph}\n" if $verbose
-  requestURI = target(dataset, graph)
-  headers = {}
-  headers.merge!($headers)
-  headers[$hAccept] = $accept_rdf
-  headers[$hAcceptCharset] = $accept_charset unless $accept_charset.nil?
-  get_worker(requestURI, headers)
-end
-
-def get_worker(requestURI, headers)
-  uri = URI.parse(requestURI)
-  request = Net::HTTP::Get.new(uri.request_uri)
-  request.initialize_http_header(headers)
-  print_http_request(uri, request)
-  response_print_body(uri, request)
-end
-
-def HEAD(dataset, graph)
-  print "HEAD #{dataset} #{graph}\n" if $verbose
-  requestURI = target(dataset, graph)
-  headers = {}
-  headers.merge!($headers)
-  headers[$hAccept] = $accept_rdf
-  headers[$hAcceptCharset] = $accept_charset unless $accept_charset.nil?
-  uri = URI.parse(requestURI)
-  request = Net::HTTP::Head.new(uri.request_uri)
-  request.initialize_http_header(headers)
-  print_http_request(uri, request)
-  response_no_body(uri, request)
-end
-
-def PUT(dataset, graph, file)
-  print "PUT #{dataset} #{graph} #{file}\n" if $verbose
-  send_body(dataset, graph, file, Net::HTTP::Put)
-end
-
-def POST(dataset, graph, file)
-  print "POST #{dataset} #{graph} #{file}\n" if $verbose
-  send_body(dataset, graph, file, Net::HTTP::Post)
-end
-
-def DELETE(dataset, graph)
-  print "DELETE #{dataset} #{graph}\n" if $verbose
-  requestURI = target(dataset, graph)
-  uri = URI.parse(requestURI)
-  request = Net::HTTP::Delete.new(uri.request_uri)
-  headers = {}
-  headers.merge!($headers)
-  request.initialize_http_header(headers)
-  print_http_request(uri, request)
-  response_no_body(uri, request)
-end
-
-def uri_escape(string)
-  CGI.escape(string)
-end
-
-def target(dataset, graph)
-  return dataset+"?default" if graph == "default"
-  return dataset+"?graph="+uri_escape(graph)
-end
-
-def send_body(dataset, graph, file, method)
-  mt = content_type(file)
-  headers = {}
-  headers.merge!($headers)
-  headers[$hContentType] = mt
-  headers[$hContentLength] = File.size(file).to_s
-  ## p headers
-
-  requestURI = target(dataset, graph)
-  uri = URI.parse(requestURI)
-  
-  request = method.new(uri.request_uri)
-  request.initialize_http_header(headers)
-  print_http_request(uri, request)
-  request.body_stream = File.open(file)
-  response_no_body(uri, request)
-end
-
-def response_no_body(uri, request)
-  http = Net::HTTP::Proxy($proxy.host,$proxy.port).new(uri.host, uri.port)
-  http.read_timeout = nil
-  # check we can connect.
-  begin http.start
-  rescue Exception => e  
-    # puts e.message  
-    #puts e.backtrace.inspect  
-    warn_exit "Failed to connect: #{uri.host}:#{uri.port}: #{e.message}", 3
-  end
-  response = http.request(request)
-  print_http_response(response)
-  case response
-  when Net::HTTPSuccess, Net::HTTPRedirection
-    # OK
-  when Net::HTTPNotFound
-    warn_exit "404 Not found: #{uri}", 9
-    #print response.body
-  else
-    warn_exit "#{response.code} #{response.message} #{uri}", 9
-    # Unreachable
-      response.error!
-  end
-  # NO BODY IN RESPONSE
-end
-
-def response_print_body(uri, request)
-  http = Net::HTTP::Proxy($proxy.host,$proxy.port).new(uri.host, uri.port)
-  http.read_timeout = nil
-  # check we can connect.
-  begin http.start
-  rescue => e  
-    #puts e.backtrace.inspect  
-    #print e.class
-    warn_exit "Failed to connect: #{uri.host}:#{uri.port}: #{e.message}", 3
-  end
-
-  # Add a blank line if headers were output.
-  print "\n" if $http_print ;
-
-  begin
-    response = http.request(request) { |res| 
-      print_http_response(res)
-      #puts res.code
-      res.read_body do |segment|
-        print segment
-      end
-    }
-    case response
-    when Net::HTTPSuccess, Net::HTTPRedirection
-      # OK
-    when Net::HTTPNotFound
-      warn_exit "404 Not found: #{uri}", 9
-      #print response.body
-    else
-      warn_exit "#{response.code}: #{uri}", 9
-      # Unreachable
-      response.error!
-    end
-  rescue EOFError => e
-    warn_exit "IO Error: "+e.message, 3
-  end
-end
-
-def print_http_request(uri, request)
-  return unless $print_http
-  #print "Request\n"
-  print request.method," ",uri, "\n"
-  print_headers("  ",request)
-end
-
-def print_http_response(response)
-  return unless $print_http
-  #print "Response\n"
-  print response.code, " ", response.message, "\n"
-  print_headers("  ",response)
-end
-
-def print_headers(marker, headers)
-  headers.each do |k,v| 
-    k = k.split('-').map{|w| w.capitalize}.join('-')+':'
-    printf "%s%-20s %s\n",marker,k,v
-  end
-end
-
-def content_type(file)
-  file =~ /\.([^.]*)$/
-  ext = $1
-  mt = $fileMediaTypes[ext]
-  cs = $charset[mt]
-  mt = mt+';charset='+cs if ! cs.nil?
-  return mt
-end
-
-def charset(content_type)
-  return $charset[content_type]
-end
-
-def warn_exit(msg, rc)
-    warn msg
-    exit rc ;
-end
-
-def parseURI(uri_string)
-  begin
-    return URI.parse(uri_string).to_s
-  rescue URI::InvalidURIError => err
-    warn_exit "Bad URI: <#{uri_string}>", 2
-  end
-end
-
-## ---- Command
-
-def cmd_soh(command=nil)
-  ## Command line
-  options = {}
-  optparse = OptionParser.new do |opts|
-    # Set a banner, displayed at the top
-    # of the help screen.
-    case $cmd
-    when "s-http", "sparql-http", "soh"
-      banner="$cmd [get|post|put|delete] datasetURI graph [file]"
-    when "s-get", "s-head", "s-delete"
-      banner="$cmd  datasetURI graph"
-    end
-
-    opts.banner = $banner
-    # Define the options, and what they do
-    
-    options[:verbose] = false
-    opts.on( '-v', '--verbose', 'Verbose' ) do
-      options[:verbose] = true
-    end
-    
-    options[:version] = false
-    opts.on( '--version', 'Print version and exit' ) do
-      print "#{SOH_NAME} #{SOH_VERSION}\n"
-      exit
-    end
-    
-    # This displays the help screen, all programs are
-    # assumed to have this option.
-    opts.on( '-h', '--help', 'Display this screen and exit' ) do
-      puts opts
-      exit
-    end
-  end
-
-  begin optparse.parse!    
-  rescue OptionParser::InvalidArgument => e
-    warn e
-    exit
-  end
-
-  $verbose = options[:verbose]
-  $print_http = $verbose
-
-  if command.nil?
-    if ARGV.size == 0
-      warn "No command given: expected one of 'get', 'put', 'post', 'delete', 'query' or 'update'"
-      exit 1
-    end
-    cmdPrint=ARGV.shift
-    command=cmdPrint.upcase
-  else
-    cmdPrint=command
-  end
-
-  case command
-  when "HEAD", "GET", "DELETE"
-    requiredFile=false
-  when "PUT", "POST"
-    requiredFile=true
-  when "QUERY"
-    cmd_sparql_query
-  when "UPDATE"
-    cmd_sparql_update
-  else
-    warn_exit "Unknown command: #{command}", 2
-  end
-
-  if requiredFile 
-  then
-    if ARGV.size != 3
-      warn_exit "Required: dataset URI, graph URI (or 'default') and file", 1 
-    end
-  else
-    if ARGV.size != 2
-      warn_exit "Required: dataset URI and graph URI (or 'default')", 1 
-    end
-  end
-
-  dataset=parseURI(ARGV.shift)
-  # Relative URI?
-  graph=parseURI(ARGV.shift)
-  file=""
-  if requiredFile
-  then
-    file = ARGV.shift if requiredFile
-    if ! File.exist?(file)
-      warn_exit "No such file: "+file, 3
-    end
-    if File.directory?(file)
-      warn_exit "File is a directory: "+file, 3
-    end
-  end
-
-  case command
-  when "GET"
-    GET(dataset, graph)
-  when "HEAD"
-    HEAD(dataset, graph)
-  when "PUT"
-    PUT(dataset, graph, file)
-  when "DELETE"
-    DELETE(dataset, graph)
-  when "POST"
-    POST(dataset, graph, file)
-  else
-    warn_exit "Internal error: Unknown command: #{cmd}", 2
-  end
-  exit 0
-end
-
-## --------
-def string_or_file(arg)
-  return arg if ! arg.match(/^@/)
-  a=(arg[1..-1])
-  open(a, 'rb'){|f| f.read}
-end
-
-## -------- SPARQL Query
-
-## Choose method
-def SPARQL_query(service, query, query_file, forcePOST=false, args2={})
-   if ! query_file.nil?
-    query = open(query_file, 'rb'){|f| f.read}
-  end
-  if forcePOST || query.length >= 2*1024 
-    SPARQL_query_POST(service, query, args2)
-  else
-    SPARQL_query_GET(service, query, args2)
-  end
-end
-
-## By GET
-
-def SPARQL_query_GET(service, query, args2)
-  args = { "query" => query }
-  args.merge!(args2)
-  qs=args.collect { |k,v| "#{k}=#{uri_escape(v)}" }.join('&')
-  action="#{service}?#{qs}"
-  headers={}
-  headers.merge!($headers)
-  headers[$hAccept]=$accept_results
-  get_worker(action, headers)
-end
-
-## By POST
-
-def SPARQL_query_POST(service, query, args2)
-  # DRY - body/no body for each of request and response.
-  post_params={ "query" => query }
-  post_params.merge!(args2)
-  uri = URI.parse(service)
-  headers={}
-  headers.merge!($headers)
-  headers[$hAccept]=$accept_results
-  execute_post_form_body(uri, headers, post_params)
-end
-
-def execute_post_form_body(uri, headers, post_params)
-  request = Net::HTTP::Post.new(uri.request_uri)
-  qs=post_params.collect { |k,v| "#{k}=#{uri_escape(v)}" }.join('&')
-  headers[$hContentType] = $mtWWWForm
-  headers[$hContentLength] = qs.length.to_s
-  request.initialize_http_header(headers)
-  request.body = qs
-  print_http_request(uri, request)
-  response_print_body(uri, request)
-end
-
-# Usage: -v --help --file= --query=
-def cmd_sparql_query
-  options={}
-  optparse = OptionParser.new do |opts|
-    opts.banner = "Usage: #{$cmd} [--query QUERY] [--service URI] [--post] 'query' | @file"
-    opts.on('--service=URI', '--server=URI', 'SPARQL endpoint') do |uri|
-      options[:service]=uri
-    end
-    opts.on('--query=FILE','--file=FILE', 'Take query from a file') do |file|
-      options[:file]=file
-    end
-    opts.on('--output=TYPE', [:json,:xml,:text,:csv,:tsv],
-            'Set the output argument') do |type|
-      options[:output]=type
-    end
-    opts.on('--accept=TYPE', [:json,:xml,:text,:csv,:tsv], 
-            'Set the accept header type') do |type|
-      options[:accept]=type
-    end
-    options[:verbose] = false
-    opts.on( '--post', 'Force use of POST' ) do
-      options[:post] = true
-    end
-    opts.on( '-v', '--verbose', 'Verbose' ) do
-      options[:verbose] = true
-    end
-    opts.on( '--version', 'Print version and exit' ) do
-      print "#{SOH_NAME} #{SOH_VERSION}\n"
-      exit
-    end 
-    opts.on( '-h', '--help', 'Display this screen and exit' ) do
-      puts opts
-      exit
-    end
-  end
-
-  begin optparse.parse!    
-  rescue OptionParser::InvalidArgument, OptionParser::InvalidOption => e
-    warn e
-    exit 1
-  end
-
-  $verbose = options[:verbose]
-  $print_http = $verbose
-  usePOST = options[:post]
-
-  service = options[:service]
-  warn_exit 'No service specified.  Required --service=URI',1 if service.nil?
-
-  # Query
-  query=nil
-  query_file=options[:file]
-  if query_file.nil? && ARGV.size == 0
-  then
-    warn_exit 'No query specified.',1
-    end
-  if query_file.nil?
-    query = ARGV.shift
-    if query.match(/^@/)
-      query_file = query[1..-1]
-      query = nil
-    end
-  end
-
-  # --output ==> output= (non-standard)
-  args={}
-  case options[:output]
-  when nil
-  when  "json","xml","text","csv","tsv"
-    args['output'] = options[:output]
-  when :json,:xml,:text,:csv,:tsv
-    args['output'] = options[:output].to_s
-  else
-    warn_exit "Unrecognized output type: "+options[:output],2
-  end
-
-  # --accept
-  # options[:accept]
-
-  print "SPARQL #{service}\n" if $verbose
-  #args={"output"=>"text"}
-  SPARQL_query(service, query, query_file, usePOST, args)
-  exit(0)
-end
-
-## -------- SPARQL Update
-
-# Update sent as a WWW form.
-def SPARQL_update_by_form(service, update, args2={})
-  args = {}
-  args.merge!(args2)
-  headers={}
-  headers.merge!($headers)
-  # args? encode?
-  body="update="+uri_escape(update)
-  headers[$hContentType] = $mtWWWForm
-  headers[$hContentLength] = body.length.to_s
-  uri = URI.parse(service)
-  execute_post_form(uri, headers, body)
-end
-
-# DRY - query form.
-def execute_post_form(uri, headers, body)
-  request = Net::HTTP::Post.new(uri.request_uri)
-  request.initialize_http_header(headers)
-  request.body = body
-  print_http_request(uri, request)
-  response_no_body(uri, request)
-end
-
-def SPARQL_update(service, update, args2={})
-  args = {}
-  args.merge!(args2)
-  headers={}
-  headers.merge!($headers)
-  headers[$hContentType] = $mtSparqlUpdate
-  uri = URI.parse(service)
-  request = Net::HTTP::Post.new(uri.request_uri)
-  request.initialize_http_header(headers)
-  request.body = update
-  print_http_request(uri, request)
-  response_no_body(uri, request)
-end
-
-def cmd_sparql_update(by_raw_post=true)
-  # Share with cmd_sparql_query
-  options={}
-  optparse = OptionParser.new do |opts|
-    opts.banner = "Usage: #{$cmd} [--file REQUEST] [--service URI] 'request' | @file"
-    opts.on('--service=URI', '--server=URI', 'SPARQL endpoint') do |uri|
-      options[:service]=uri
-    end
-    opts.on('--update=FILE', '--file=FILE', 'Take update from a file') do |file|
-      options[:file]=file
-    end
-    options[:verbose] = false
-    opts.on( '-v', '--verbose', 'Verbose' ) do
-      options[:verbose] = true
-    end
-    opts.on( '--version', 'Print version and exit' ) do
-      print "#{SOH_NAME} #{SOH_VERSION}\n"
-      exit
-    end 
-    opts.on( '-h', '--help', 'Display this screen and exit' ) do
-      puts opts
-      exit
-    end
-  end
-
-  begin optparse.parse!    
-  rescue OptionParser::InvalidArgument => e
-    warn e
-    exit
-  end
-
-  $verbose = options[:verbose]
-  $print_http = $verbose
-
-  service = options[:service]
-  warn_exit 'No service specified. Required --service=URI',1   if service.nil?
-  
-  update=nil
-  update_file=options[:file]
-
-  if update_file.nil? && ARGV.size == 0
-  then
-    warn_exit 'No update specified.',1
-    end
-  if update_file.nil?
-    update = ARGV.shift
-    if update.match(/^@/)
-      update_file = update[1..-1]
-      update = nil
-    end
-  end
-  
-  print "SPARQL-Update #{service}\n" if $verbose
-  args={}
-
-  # Reads in the file :-(
-  if update.nil?
-  then
-    update = open(update_file, 'rb'){|f| f.read}
-  else
-    update = string_or_file(update)
-  end
-
-  if by_raw_post
-    SPARQL_update(service, update, args)
-  else
-    SPARQL_update_by_form(service, update, args)
-  end
-  exit(0)
-end
-
-## -------
-
-case $cmd
-when "s-http", "sparql-http", "soh"
-  $banner="#{$cmd} [get|post|put|delete] datasetURI graph [file]"
-  cmd_soh
-when "s-get", "s-head", "s-put", "s-delete", "s-post"
-
-  case $cmd
-  when "s-get", "s-head", "s-delete"
-    $banner="#{$cmd} datasetURI graph"
-  when "s-put", "s-post"
-    $banner="#{$cmd} datasetURI graph file"
-  end
-  cmd2 = $cmd.sub(/^s-/, '').upcase
-  cmd_soh cmd2
-
-when "s-query", "sparql-query"
-  cmd_sparql_query
-when "s-update", "sparql-update"
-  cmd_sparql_update true
-when "s-update-form", "sparql-update-form"
-  cmd_sparql_update false
-else 
-  warn_exit "Unknown: "+$cmd, 1
-end


[09/23] jena git commit: Rename folder jena-fuseki to jena-fuseki1

Posted by an...@apache.org.
http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/pages/sparql.tpl
----------------------------------------------------------------------
diff --git a/jena-fuseki1/pages/sparql.tpl b/jena-fuseki1/pages/sparql.tpl
new file mode 100644
index 0000000..2cd5241
--- /dev/null
+++ b/jena-fuseki1/pages/sparql.tpl
@@ -0,0 +1,96 @@
+<!--
+   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.
+-->
+
+<html>
+  <head>
+    <title>Fuseki</title>
+    <link rel="stylesheet" type="text/css" href="fuseki.css" />
+  </head>
+  <body>
+#set( $ds = $mgt.dataset($request, "") )
+#set( $srvQuery = $mgt.serviceQuery($ds) )
+#set( $srvUpdate = $mgt.serviceUpdate($ds) )
+#set( $srvUpload= $mgt.serviceUpload($ds) )
+#set( $srvGraphR = $mgt.serviceGraphRead($ds) )
+#set( $srvGraphRW = $mgt.serviceGraphReadWrite($ds) )
+
+<!-- error case ... -->
+<!-- Debug
+<ul>
+  <li>${ds}</li>
+  <li>$srvQuery</li>
+  <li>$srvUpdate</li>
+  <li>$srvUpload</li>
+  <li>$srvGraphR</li>
+  <li>$srvGraphRW</li>
+</ul>
+-->
+
+    <h1>Fuseki Query</h1>
+    Dataset: ${ds}
+    <hr/>
+
+    <p><b>SPARQL Query</b></p>
+    <div class="moreindent">
+      <form action="${ds}/${srvQuery}" method="GET"  accept-charset="UTF-8">
+        <textarea name="query" cols="70" rows="10"></textarea>
+        <br/>
+
+        Output: <select name="output">
+          <option value="text">Text</option>
+          <option value="json">JSON</option>
+          <option value="xml">XML</option>
+          <option value="csv">CSV</option>
+          <option value="tsv">TSV</option>
+        </select>
+        <br/>
+	    If XML output, add XSLT style sheet (blank for none): 
+        <select name="stylesheet">
+          <option value=""></option>
+          <option value="/xml-to-html.xsl">xml-to-html</option>
+          <option value="/xml-to-html-links.xsl">xml-to-html-links</option>
+          <option value="/xml-to-html-plain.xsl">xml-to-html-plain</option>
+        </select>
+        <br/>
+        <input type="checkbox" name="force-accept" value="text/plain"/>
+        Force the accept header to <tt>text/plain</tt> regardless.
+	    <br/>
+	    <input type="submit" value="Get Results" />
+      </form>
+    </div>
+    <hr/>
+
+    <p><b>SPARQL Update</b></p>
+    <div class="moreindent">
+      <form action="${ds}/${srvUpdate}" method="post" accept-charset="UTF-8">
+        <textarea name="update" cols="70" rows="10"></textarea>
+	    <br/>
+        <input type="submit" value="Perform update" />
+      </form>
+    </div>
+    <hr/>
+    <p><b>File upload</b></p>
+    <div class="moreindent">
+      <form action="${ds}/${srvUpload}" enctype="multipart/form-data" method="post">
+        File: <input type="file" name="UNSET FILE NAME" size="40" multiple=""><br/>
+        Graph: <input name="graph" size="20" value="default"/><br/>
+        <input type="submit" value="Upload">
+      </form>
+    </div>
+    <hr/>
+      </body>
+</html>   

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/pages/update-validator.html
----------------------------------------------------------------------
diff --git a/jena-fuseki1/pages/update-validator.html b/jena-fuseki1/pages/update-validator.html
new file mode 100644
index 0000000..92f21bc
--- /dev/null
+++ b/jena-fuseki1/pages/update-validator.html
@@ -0,0 +1,62 @@
+<!--
+   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.
+-->
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head><title>SPARQLer Update Validator</title>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+  <link rel="stylesheet" type="text/css" href="fuseki.css" />
+
+  </head>
+  <body>
+    <h1>SPARQLer Update Validator</h1>
+
+    <div class="moreindent">
+
+
+      <form action="validate/update" method="post" accept-charset="UTF-8">
+	  <textarea name="update" cols="70" rows="30">
+PREFIX xsd:     &lt;http://www.w3.org/2001/XMLSchema#>
+PREFIX rdf:     &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
+PREFIX rdfs:    &lt;http://www.w3.org/2000/01/rdf-schema#>
+PREFIX owl:     &lt;http://www.w3.org/2002/07/owl#>
+PREFIX fn:      &lt;http://www.w3.org/2005/xpath-functions#>
+PREFIX apf:     &lt;http://jena.hpl.hp.com/ARQ/property#>
+
+</textarea>
+<br/>
+  Input syntax:
+    <input type="radio" name="languageSyntax" value="SPARQL" checked="checked"/>SPARQL
+    <input type="radio" name="languageSyntax" value="ARQ"/>SPARQL extended syntax
+  <br/>
+<!--
+Output syntax:
+  <input type="checkbox" name="outputFormat" value="sparql" checked="checked"/>SPARQL
+  <input type="checkbox" name="outputFormat" value="algebra"/>SPARQL algebra
+  <input type="checkbox" name="outputFormat" value="quads"/>SPARQL algebra (quads)
+  <br/>
+-->
+  Line numbers:
+  <input type="radio" name="linenumbers" value="true" checked="checked"/>Yes
+  <input type="radio" name="linenumbers" value="false"/>No
+  <br/>
+
+  <input type="submit" value="Validate SPARQL Update" />
+      </form>
+
+      <hr/>
+    </div>
+  </body>
+</html>

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/pages/xml-to-html-links.xsl
----------------------------------------------------------------------
diff --git a/jena-fuseki1/pages/xml-to-html-links.xsl b/jena-fuseki1/pages/xml-to-html-links.xsl
new file mode 100644
index 0000000..66b04eb
--- /dev/null
+++ b/jena-fuseki1/pages/xml-to-html-links.xsl
@@ -0,0 +1,227 @@
+<?xml version="1.0"?>
+
+<!--
+
+XSLT script to format SPARQL Query Results XML Format into xhtml
+
+Copyright © 2004, 2005 World Wide Web Consortium, (Massachusetts
+Institute of Technology, European Research Consortium for
+Informatics and Mathematics, Keio University). All Rights
+Reserved. This work is distributed under the W3C® Software
+License [1] in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.
+
+[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
+
+Version 1 : Dave Beckett (DAWG)
+Version 2 : Jeen Broekstra (DAWG)
+Customization for SPARQler: Andy Seaborne
+URIs as hrefs in results : Bob DuCharme & Andy Seaborne
+
+> -    <xsl:for-each select="//res:head/res:variable">
+> +    <xsl:for-each select="/res:sparql/res:head/res:variable">
+
+-->
+
+<xsl:stylesheet version="1.0"
+		xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+		xmlns="http://www.w3.org/1999/xhtml"
+		xmlns:res="http://www.w3.org/2005/sparql-results#"
+		xmlns:fn="http://www.w3.org/2005/xpath-functions"
+		exclude-result-prefixes="res xsl">
+
+  <!--
+    <xsl:output
+    method="html"
+    media-type="text/html"
+    doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
+    indent="yes"
+    encoding="UTF-8"/>
+  -->
+
+  <!-- or this? -->
+
+  <xsl:output
+   method="xml" 
+   indent="yes"
+   encoding="UTF-8" 
+   doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
+   doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
+   omit-xml-declaration="no" />
+
+    <xsl:template match="res:link">
+      <p>Link to <xsl:value-of select="@href"/></p>
+    </xsl:template>
+
+    <xsl:template name="header">
+      <div>
+        <h2>Header</h2>
+        <xsl:apply-templates select="res:head/res:link"/>
+      </div>
+    </xsl:template>
+
+  <xsl:template name="boolean-result">
+    <div>
+      <p>ASK => <xsl:value-of select="res:boolean"/></p>
+    </div>
+  </xsl:template>
+
+
+  <xsl:template name="vb-result">
+    <div>
+      <table>
+	<xsl:text>
+	</xsl:text>
+	<tr>
+	  <xsl:for-each select="res:head/res:variable">
+	    <th><xsl:value-of select="@name"/></th>
+	  </xsl:for-each>
+	</tr>
+	<xsl:text>
+	</xsl:text>
+	<xsl:for-each select="res:results/res:result">
+	  <tr>
+	    <xsl:apply-templates select="."/>
+	  </tr>
+	</xsl:for-each>
+      </table>
+    </div>
+  </xsl:template>
+
+  <xsl:template match="res:result">
+    <xsl:variable name="current" select="."/>
+    <xsl:for-each select="/res:sparql/res:head/res:variable">
+      <xsl:variable name="name" select="@name"/>
+      <td>
+	<xsl:choose>
+	  <xsl:when test="$current/res:binding[@name=$name]">
+	    <!-- apply template for the correct value type (bnode, uri, literal) -->
+	    <xsl:apply-templates select="$current/res:binding[@name=$name]"/>
+	  </xsl:when>
+	  <xsl:otherwise>
+	    <!-- no binding available for this variable in this solution -->
+	  </xsl:otherwise>
+	</xsl:choose>
+      </td>
+    </xsl:for-each>
+  </xsl:template>
+
+  <xsl:template match="res:bnode">
+    <xsl:text>_:</xsl:text>
+    <xsl:value-of select="text()"/>
+  </xsl:template>
+
+  <xsl:template name="replace-string">
+    <xsl:param name="text"/>
+    <xsl:param name="replace"/>
+    <xsl:param name="with"/>
+    <xsl:choose>
+      <xsl:when test="contains($text,$replace)">
+	<xsl:value-of select="substring-before($text,$replace)"/>
+	<xsl:value-of select="$with"/>
+	<xsl:call-template name="replace-string">
+	  <xsl:with-param name="text"
+			  select="substring-after($text,$replace)"/>
+	  <xsl:with-param name="replace" select="$replace"/>
+	  <xsl:with-param name="with" select="$with"/>
+	</xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+	<xsl:value-of select="$text"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+
+  <xsl:template match="res:uri">
+    <!-- MUST be XSLT 1.0 :-( -->
+
+    <!-- Roughly: SELECT ($uri AS ?subject) ?predicate ?object { $uri ?predicate ?object } -->
+    <!-- XSLT 2.0
+    <xsl:variable name="x"><xsl:value-of select="fn:encode-for-uri(.)"/></xsl:variable>
+    -->
+
+    <xsl:variable name="x"><xsl:value-of select="."/></xsl:variable>
+    <xsl:variable name="q">SELECT%20%28%3C<xsl:value-of select="$x"/>%3E%20AS%20%3Fsubject%29%20%3Fpredicate%20%3Fobject%20%7B%3C<xsl:value-of select="$x"/>%3E%20%3Fpredicate%20%3Fobject%20%7D</xsl:variable>
+
+    <!-- Escape any # -->
+    <xsl:variable name="q2">
+      <xsl:call-template name="replace-string">
+	<xsl:with-param name="text" select="$q"/>
+	<xsl:with-param name="replace" select="'#'" />
+	<xsl:with-param name="with" select="'%23'"/>
+      </xsl:call-template>
+    </xsl:variable>
+
+    <!-- XSLT 2.0
+       <xsl:value-of select="fn:replace('$q','#','%25')"/>
+    -->
+
+    <xsl:text>&lt;</xsl:text>
+    <a href="?query={$q2}&amp;output=xml&amp;stylesheet=%2Fxml-to-html-links.xsl">
+      <xsl:text></xsl:text>
+      <xsl:value-of select="."/>
+    </a>
+    <xsl:text>&gt;</xsl:text>
+  </xsl:template>
+
+  <xsl:template match="res:literal">
+    <xsl:text>"</xsl:text>
+    <xsl:value-of select="text()"/>
+    <xsl:text>"</xsl:text>
+
+    <xsl:choose>
+      <xsl:when test="@datatype">
+        <!-- datatyped literal value -->
+        ^^&lt;<xsl:value-of select="@datatype"/>&gt;
+      </xsl:when>
+      <xsl:when test="@xml:lang">
+        <!-- lang-string -->
+        @<xsl:value-of select="@xml:lang"/>
+      </xsl:when>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template match="res:sparql">
+    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+      <head>
+	<title>SPARQLer Query Results</title>
+	<style>
+	  <![CDATA[
+	  h1 { font-size: 150% ; }
+	  h2 { font-size: 125% ; }
+	  table { border-collapse: collapse ; border: 1px solid black ; }
+	  td, th
+ 	  { border: 1px solid black ;
+	    padding-left:0.5em; padding-right: 0.5em; 
+	    padding-top:0.2ex ; padding-bottom:0.2ex 
+	  }
+	  ]]>
+	</style>
+      </head>
+      <body>
+
+
+	<h1>SPARQLer Query Results</h1>
+
+	<xsl:if test="res:head/res:link">
+	  <xsl:call-template name="header"/>
+	</xsl:if>
+
+	<xsl:choose>
+	  <xsl:when test="res:boolean">
+	    <xsl:call-template name="boolean-result" />
+	  </xsl:when>
+
+	  <xsl:when test="res:results">
+	    <xsl:call-template name="vb-result" />
+	  </xsl:when>
+
+	</xsl:choose>
+
+
+      </body>
+    </html>
+  </xsl:template>
+</xsl:stylesheet>

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/pages/xml-to-html-plain.xsl
----------------------------------------------------------------------
diff --git a/jena-fuseki1/pages/xml-to-html-plain.xsl b/jena-fuseki1/pages/xml-to-html-plain.xsl
new file mode 100644
index 0000000..1878ab0
--- /dev/null
+++ b/jena-fuseki1/pages/xml-to-html-plain.xsl
@@ -0,0 +1,187 @@
+<?xml version="1.0"?>
+
+<!--
+
+XSLT script to format SPARQL Query Results XML Format into xhtml
+
+Copyright © 2004, 2005 World Wide Web Consortium, (Massachusetts
+Institute of Technology, European Research Consortium for
+Informatics and Mathematics, Keio University). All Rights
+Reserved. This work is distributed under the W3C® Software
+License [1] in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.
+
+[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
+
+Version 1 : Dave Beckett (DAWG)
+Version 2 : Jeen Broekstra (DAWG)
+Customization for SPARQler: Andy Seaborne
+Fix:
+
+> -    <xsl:for-each select="//res:head/res:variable">
+> +    <xsl:for-each select="/res:sparql/res:head/res:variable">
+
+-->
+
+<xsl:stylesheet version="1.0"
+		xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+		xmlns="http://www.w3.org/1999/xhtml"
+		xmlns:res="http://www.w3.org/2005/sparql-results#"
+		exclude-result-prefixes="res xsl">
+
+  <!--
+    <xsl:output
+    method="html"
+    media-type="text/html"
+    doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
+    indent="yes"
+    encoding="UTF-8"/>
+  -->
+
+  <!-- or this? -->
+
+  <xsl:output
+   method="xml" 
+   indent="yes"
+   encoding="UTF-8" 
+   doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
+   doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
+   omit-xml-declaration="no" />
+
+
+  <xsl:template name="header">
+    <div>
+      <h2>Header</h2>
+      <xsl:for-each select="res:head/res:link"> 
+	<p>Link to <xsl:value-of select="@href"/></p>
+      </xsl:for-each>
+    </div>
+  </xsl:template>
+
+  <xsl:template name="boolean-result">
+    <div>
+      <!--      
+	<h2>Boolean Result</h2>
+      -->      
+      <p>ASK => <xsl:value-of select="res:boolean"/></p>
+    </div>
+  </xsl:template>
+
+
+  <xsl:template name="vb-result">
+    <div>
+      <!--
+	<h2>Variable Bindings Result</h2>
+	<p>Ordered: <xsl:value-of select="res:results/@ordered"/></p>
+	<p>Distinct: <xsl:value-of select="res:results/@distinct"/></p>
+      -->
+
+      <table>
+	<xsl:text>
+	</xsl:text>
+	<tr>
+	  <xsl:for-each select="res:head/res:variable">
+	    <th><xsl:value-of select="@name"/></th>
+	  </xsl:for-each>
+	</tr>
+	<xsl:text>
+	</xsl:text>
+	<xsl:for-each select="res:results/res:result">
+	  <tr>
+	    <xsl:apply-templates select="."/>
+	  </tr>
+	</xsl:for-each>
+      </table>
+    </div>
+  </xsl:template>
+
+  <xsl:template match="res:result">
+    <xsl:variable name="current" select="."/>
+    <xsl:for-each select="/res:sparql/res:head/res:variable">
+      <xsl:variable name="name" select="@name"/>
+      <td>
+	<xsl:choose>
+	  <xsl:when test="$current/res:binding[@name=$name]">
+	    <!-- apply template for the correct value type (bnode, uri, literal) -->
+	    <xsl:apply-templates select="$current/res:binding[@name=$name]"/>
+	  </xsl:when>
+	  <xsl:otherwise>
+	    <!-- no binding available for this variable in this solution -->
+	  </xsl:otherwise>
+	</xsl:choose>
+      </td>
+    </xsl:for-each>
+  </xsl:template>
+
+  <xsl:template match="res:bnode">
+    <xsl:text>_:</xsl:text>
+    <xsl:value-of select="text()"/>
+  </xsl:template>
+
+  <xsl:template match="res:uri">
+    <xsl:variable name="uri" select="text()"/>
+    <xsl:text>&lt;</xsl:text>
+    <xsl:value-of select="$uri"/>
+    <xsl:text>&gt;</xsl:text>
+  </xsl:template>
+
+  <xsl:template match="res:literal">
+    <xsl:text>"</xsl:text>
+    <xsl:value-of select="text()"/>
+    <xsl:text>"</xsl:text>
+
+    <xsl:choose>
+      <xsl:when test="@datatype">
+	<!-- datatyped literal value -->
+	^^&lt;<xsl:value-of select="@datatype"/>&gt;
+      </xsl:when>
+      <xsl:when test="@xml:lang">
+	<!-- lang-string -->
+	@<xsl:value-of select="@xml:lang"/>
+      </xsl:when>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template match="res:sparql">
+    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+      <head>
+	<title>SPARQLer Query Results</title>
+	<style>
+	  <![CDATA[
+	  h1 { font-size: 150% ; }
+	  h2 { font-size: 125% ; }
+	  table { border-collapse: collapse ; border: 1px solid black ; }
+	  td, th
+ 	  { border: 1px solid black ;
+	    padding-left:0.5em; padding-right: 0.5em; 
+	    padding-top:0.2ex ; padding-bottom:0.2ex 
+	  }
+	  ]]>
+	</style>
+      </head>
+      <body>
+
+
+	<h1>SPARQLer Query Results</h1>
+
+	<xsl:if test="res:head/res:link">
+	  <xsl:call-template name="header"/>
+	</xsl:if>
+
+	<xsl:choose>
+	  <xsl:when test="res:boolean">
+	    <xsl:call-template name="boolean-result" />
+	  </xsl:when>
+
+	  <xsl:when test="res:results">
+	    <xsl:call-template name="vb-result" />
+	  </xsl:when>
+
+	</xsl:choose>
+
+
+      </body>
+    </html>
+  </xsl:template>
+</xsl:stylesheet>

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/pages/xml-to-html.xsl
----------------------------------------------------------------------
diff --git a/jena-fuseki1/pages/xml-to-html.xsl b/jena-fuseki1/pages/xml-to-html.xsl
new file mode 100644
index 0000000..1878ab0
--- /dev/null
+++ b/jena-fuseki1/pages/xml-to-html.xsl
@@ -0,0 +1,187 @@
+<?xml version="1.0"?>
+
+<!--
+
+XSLT script to format SPARQL Query Results XML Format into xhtml
+
+Copyright © 2004, 2005 World Wide Web Consortium, (Massachusetts
+Institute of Technology, European Research Consortium for
+Informatics and Mathematics, Keio University). All Rights
+Reserved. This work is distributed under the W3C® Software
+License [1] in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.
+
+[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
+
+Version 1 : Dave Beckett (DAWG)
+Version 2 : Jeen Broekstra (DAWG)
+Customization for SPARQler: Andy Seaborne
+Fix:
+
+> -    <xsl:for-each select="//res:head/res:variable">
+> +    <xsl:for-each select="/res:sparql/res:head/res:variable">
+
+-->
+
+<xsl:stylesheet version="1.0"
+		xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+		xmlns="http://www.w3.org/1999/xhtml"
+		xmlns:res="http://www.w3.org/2005/sparql-results#"
+		exclude-result-prefixes="res xsl">
+
+  <!--
+    <xsl:output
+    method="html"
+    media-type="text/html"
+    doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
+    indent="yes"
+    encoding="UTF-8"/>
+  -->
+
+  <!-- or this? -->
+
+  <xsl:output
+   method="xml" 
+   indent="yes"
+   encoding="UTF-8" 
+   doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
+   doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
+   omit-xml-declaration="no" />
+
+
+  <xsl:template name="header">
+    <div>
+      <h2>Header</h2>
+      <xsl:for-each select="res:head/res:link"> 
+	<p>Link to <xsl:value-of select="@href"/></p>
+      </xsl:for-each>
+    </div>
+  </xsl:template>
+
+  <xsl:template name="boolean-result">
+    <div>
+      <!--      
+	<h2>Boolean Result</h2>
+      -->      
+      <p>ASK => <xsl:value-of select="res:boolean"/></p>
+    </div>
+  </xsl:template>
+
+
+  <xsl:template name="vb-result">
+    <div>
+      <!--
+	<h2>Variable Bindings Result</h2>
+	<p>Ordered: <xsl:value-of select="res:results/@ordered"/></p>
+	<p>Distinct: <xsl:value-of select="res:results/@distinct"/></p>
+      -->
+
+      <table>
+	<xsl:text>
+	</xsl:text>
+	<tr>
+	  <xsl:for-each select="res:head/res:variable">
+	    <th><xsl:value-of select="@name"/></th>
+	  </xsl:for-each>
+	</tr>
+	<xsl:text>
+	</xsl:text>
+	<xsl:for-each select="res:results/res:result">
+	  <tr>
+	    <xsl:apply-templates select="."/>
+	  </tr>
+	</xsl:for-each>
+      </table>
+    </div>
+  </xsl:template>
+
+  <xsl:template match="res:result">
+    <xsl:variable name="current" select="."/>
+    <xsl:for-each select="/res:sparql/res:head/res:variable">
+      <xsl:variable name="name" select="@name"/>
+      <td>
+	<xsl:choose>
+	  <xsl:when test="$current/res:binding[@name=$name]">
+	    <!-- apply template for the correct value type (bnode, uri, literal) -->
+	    <xsl:apply-templates select="$current/res:binding[@name=$name]"/>
+	  </xsl:when>
+	  <xsl:otherwise>
+	    <!-- no binding available for this variable in this solution -->
+	  </xsl:otherwise>
+	</xsl:choose>
+      </td>
+    </xsl:for-each>
+  </xsl:template>
+
+  <xsl:template match="res:bnode">
+    <xsl:text>_:</xsl:text>
+    <xsl:value-of select="text()"/>
+  </xsl:template>
+
+  <xsl:template match="res:uri">
+    <xsl:variable name="uri" select="text()"/>
+    <xsl:text>&lt;</xsl:text>
+    <xsl:value-of select="$uri"/>
+    <xsl:text>&gt;</xsl:text>
+  </xsl:template>
+
+  <xsl:template match="res:literal">
+    <xsl:text>"</xsl:text>
+    <xsl:value-of select="text()"/>
+    <xsl:text>"</xsl:text>
+
+    <xsl:choose>
+      <xsl:when test="@datatype">
+	<!-- datatyped literal value -->
+	^^&lt;<xsl:value-of select="@datatype"/>&gt;
+      </xsl:when>
+      <xsl:when test="@xml:lang">
+	<!-- lang-string -->
+	@<xsl:value-of select="@xml:lang"/>
+      </xsl:when>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template match="res:sparql">
+    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+      <head>
+	<title>SPARQLer Query Results</title>
+	<style>
+	  <![CDATA[
+	  h1 { font-size: 150% ; }
+	  h2 { font-size: 125% ; }
+	  table { border-collapse: collapse ; border: 1px solid black ; }
+	  td, th
+ 	  { border: 1px solid black ;
+	    padding-left:0.5em; padding-right: 0.5em; 
+	    padding-top:0.2ex ; padding-bottom:0.2ex 
+	  }
+	  ]]>
+	</style>
+      </head>
+      <body>
+
+
+	<h1>SPARQLer Query Results</h1>
+
+	<xsl:if test="res:head/res:link">
+	  <xsl:call-template name="header"/>
+	</xsl:if>
+
+	<xsl:choose>
+	  <xsl:when test="res:boolean">
+	    <xsl:call-template name="boolean-result" />
+	  </xsl:when>
+
+	  <xsl:when test="res:results">
+	    <xsl:call-template name="vb-result" />
+	  </xsl:when>
+
+	</xsl:choose>
+
+
+      </body>
+    </html>
+  </xsl:template>
+</xsl:stylesheet>

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/pom.xml
----------------------------------------------------------------------
diff --git a/jena-fuseki1/pom.xml b/jena-fuseki1/pom.xml
new file mode 100644
index 0000000..c1d19d3
--- /dev/null
+++ b/jena-fuseki1/pom.xml
@@ -0,0 +1,374 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+   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.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>jena-fuseki</artifactId>
+  <packaging>jar</packaging>
+  <name>Apache Jena - Fuseki1 (SPARQL 1.1 Server)</name>
+  <version>1.1.2-SNAPSHOT</version>
+  <description>Fuseki is a SPARQL 1.1 Server which provides query, update and graph store protocol endpoints that can be used to expose triple store(s) over HTTP</description>
+  <url>http://jena.apache.org/</url>
+
+  <parent>
+    <groupId>org.apache.jena</groupId>
+    <artifactId>jena-parent</artifactId>
+    <version>12-SNAPSHOT</version>
+    <relativePath>../jena-parent</relativePath>
+  </parent> 
+
+  <!-- Need if the parent is a snapshot -->
+  <repositories>
+    <repository>
+      <id>apache.snapshots</id>
+      <name>Apache Snapshot Repository</name>
+      <url>http://repository.apache.org/snapshots</url>
+      <releases>
+	<enabled>false</enabled>
+      </releases>
+    </repository>
+  </repositories>
+
+  <organization>
+    <name>Apache Jena</name>
+    <url>http://jena.apache.org/</url>
+  </organization>
+
+  <licenses>
+    <license>
+      <name>Apache 2.0 License</name>
+      <url>http://www.apache.org/licenses/LICENSE-2.0</url>
+    </license>
+  </licenses>
+
+  <properties>
+    <this.root>${project.artifactId}-${project.version}</this.root>
+    <server.jar.name>${this.root}-server</server.jar.name>
+
+    <!--
+    <assembly.soh.name>${this.root}</assembly.soh.name>
+    -->
+
+    <ver.jetty>8.1.14.v20131031</ver.jetty>
+    <ver.velocity>1.7</ver.velocity>
+    
+    <maven.build.timestamp.format>yyyy-MM-dd'T'HH:mm:ssZ</maven.build.timestamp.format>
+    <build.time.xsd>${maven.build.timestamp}</build.time.xsd>
+
+  </properties>
+
+  <dependencies>
+
+    <dependency>
+      <groupId>org.apache.jena</groupId>
+      <artifactId>jena-arq</artifactId>
+      <version>2.13.0-SNAPSHOT</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.jena</groupId>
+      <artifactId>jena-arq</artifactId>
+      <version>2.13.0-SNAPSHOT</version>
+      <classifier>tests</classifier>
+      <scope>test</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.jena</groupId>
+      <artifactId>jena-core</artifactId>
+      <version>2.13.0-SNAPSHOT</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.jena</groupId>
+      <artifactId>jena-tdb</artifactId>
+      <version>1.1.2-SNAPSHOT</version>
+    </dependency>
+
+    <!--
+    <dependency>
+      <groupId>org.apache.jena</groupId>
+      <artifactId>sdb</artifactId>
+      <version>${ver.sdb}</version>
+      <optional>true</optional>
+    </dependency>
+    -->
+
+    <dependency>
+      <groupId>org.apache.jena</groupId>
+      <artifactId>jena-text</artifactId>
+      <version>1.1.2-SNAPSHOT</version>
+      <exclusions>
+        <!-- 
+	  Get this via commons-fileupload and also via jena-text/sol4j
+	  Choose the commons-fileupload route
+	-->
+        <exclusion>
+          <groupId>commons-io</groupId>
+          <artifactId>commons-io</artifactId>
+        </exclusion>
+      </exclusions>
+
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.jena</groupId>
+      <artifactId>jena-spatial</artifactId>
+      <version>1.1.2-SNAPSHOT</version>
+    </dependency>
+
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.httpcomponents</groupId>
+      <artifactId>httpclient</artifactId>
+      <exclusions>
+        <!-- Replace with slf4j adapter -->
+        <exclusion>
+          <groupId>commons-logging</groupId>
+          <artifactId>commons-logging</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+
+    <dependency>
+      <groupId>commons-fileupload</groupId>
+      <artifactId>commons-fileupload</artifactId>
+    </dependency>
+
+    <!-- ?? Use one of the combined artifacts for Jetty -->
+    <!-- jetty-webapp + jetty-util -->
+
+    <dependency>
+      <groupId>org.eclipse.jetty</groupId>
+      <artifactId>jetty-server</artifactId>
+      <version>${ver.jetty}</version>
+    </dependency>    
+
+    <dependency>
+      <groupId>org.eclipse.jetty</groupId>
+      <artifactId>jetty-servlet</artifactId>
+      <version>${ver.jetty}</version>
+    </dependency>    
+
+    <!-- used ? - ->
+    <dependency>
+      <groupId>org.eclipse.jetty</groupId>
+      <artifactId>jetty-webapp</artifactId>
+      <version>${ver.jetty}</version>
+    </dependency>    
+    -->
+
+    <dependency>
+      <groupId>org.eclipse.jetty</groupId>
+      <artifactId>jetty-servlets</artifactId>
+      <version>${ver.jetty}</version>
+    </dependency> 
+
+     <dependency>
+      <groupId>org.eclipse.jetty</groupId>
+      <artifactId>jetty-xml</artifactId>
+      <version>${ver.jetty}</version>
+    </dependency> 
+    
+    <dependency>
+      <groupId>org.eclipse.jetty</groupId>
+      <artifactId>jetty-security</artifactId>
+      <version>${ver.jetty}</version>
+    </dependency> 
+    
+    <dependency>
+      <groupId>org.eclipse.jetty</groupId>
+      <artifactId>jetty-util</artifactId>
+      <version>${ver.jetty}</version>
+    </dependency> 
+
+    <dependency>
+      <groupId>org.apache.velocity</groupId>
+      <artifactId>velocity</artifactId>
+      <version>${ver.velocity}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-log4j12</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>jcl-over-slf4j</artifactId>
+    </dependency>
+
+    <!-- Needed because the Fuseki test suite resets logging levels -->
+    <dependency>
+      <groupId>log4j</groupId>
+      <artifactId>log4j</artifactId>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <resources>
+      <resource>
+        <filtering>false</filtering>
+        <directory>src/main/resources</directory>
+        <excludes>
+          <exclude>org/apache/jena/fuseki/fuseki-properties.xml</exclude>
+        </excludes>
+      </resource>
+      <resource>
+        <filtering>true</filtering>
+        <directory>src/main/resources</directory>
+        <includes>
+          <include>org/apache/jena/fuseki/fuseki-properties.xml</include>
+        </includes>
+      </resource>
+    </resources>
+    
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-javadoc-plugin</artifactId>
+        <configuration>
+          <version>true</version>
+          <show>public</show>
+          <quiet>true</quiet>
+          <encoding>UTF-8</encoding>
+          <windowtitle>Apache Jena Fuseki</windowtitle>
+          <doctitle>Apache Jena Fuseki ${project.version}</doctitle>
+          <bottom>Licenced under the Apache License, Version 2.0</bottom>
+        </configuration>
+      </plugin>
+      
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jar-plugin</artifactId>
+        <executions>
+          <execution>
+            <goals>
+              <goal>test-jar</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+
+
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <includes>
+            <include>**/TS_*.java</include>
+          </includes>
+        </configuration>
+      </plugin>
+
+      <plugin>
+	<groupId>org.apache.maven.plugins</groupId>
+	<artifactId>maven-shade-plugin</artifactId>
+	<version>2.1</version>
+	<configuration>
+	  <shadedArtifactAttached>true</shadedArtifactAttached>
+	  <shadedClassifierName>server</shadedClassifierName>
+	  <transformers>
+	    <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
+	      <mainClass>org.apache.jena.fuseki.FusekiCmd</mainClass>
+	    </transformer>
+	    <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
+	    <transformer implementation="org.apache.maven.plugins.shade.resource.ApacheLicenseResourceTransformer" />
+	    <transformer implementation="org.apache.maven.plugins.shade.resource.ApacheNoticeResourceTransformer">
+	      <addHeader>false</addHeader>
+	    </transformer>
+	  </transformers>
+	  <filters>
+	    <filter>
+	      <artifact>*:*</artifact>
+	      <excludes>
+		<!-- Some jars are signed but shading breaks that.
+		     Don't include signing files.
+		-->
+		<exclude>META-INF/*.SF</exclude>
+		<exclude>META-INF/*.DSA</exclude>
+		<exclude>META-INF/*.RSA</exclude>
+	      </excludes>
+	    </filter>
+	  </filters>
+	</configuration>
+	<executions>
+	  <execution>
+	    <phase>package</phase>
+	    <goals>
+	      <goal>shade</goal>
+	    </goals>
+	  </execution>
+	</executions>
+      </plugin>
+
+      <plugin>
+        <artifactId>maven-assembly-plugin</artifactId>
+	<!-- After shared jar - same phase -->
+        <executions>
+	  <!--
+          <execution>
+            <id>create-soh-assembly</id>
+            <phase>package</phase>
+            <goals><goal>single</goal></goals>
+            <configuration>
+              <finalName>${assembly.soh.name}</finalName>
+              <!- -<appendAssemblyId>false</appendAssemblyId> - ->
+              <descriptors>
+                <descriptor>assembly-soh.xml</descriptor>
+              </descriptors>
+            </configuration>
+          </execution>
+          -->
+
+          <execution>
+            <id>create-zip-assembly</id>
+            <phase>package</phase>
+            <goals><goal>single</goal></goals>
+            <configuration>
+	      <descriptors>
+                <descriptor>assembly-dist.xml</descriptor>
+              </descriptors>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-resources-plugin</artifactId>
+        <configuration>
+          <encoding>UTF-8</encoding>
+        </configuration>
+      </plugin>
+
+    </plugins>
+
+  </build>
+  
+</project>

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/run-fuseki
----------------------------------------------------------------------
diff --git a/jena-fuseki1/run-fuseki b/jena-fuseki1/run-fuseki
new file mode 100755
index 0000000..98b0d45
--- /dev/null
+++ b/jena-fuseki1/run-fuseki
@@ -0,0 +1,64 @@
+#!/usr/bin/env bash
+
+# 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.
+
+## Run Fuseki, include development code if it looks like it's available.
+## Or --pages=
+
+export FUSEKI_HOME=${FUSEKI_HOME:-$HOME/Jena/jena-fuseki}
+if [ ! -e $FUSEKI_HOME ]
+then
+    echo "$FUSEKI_HOME does not exist" 1>&2
+    exit 1
+    fi
+if [ ! -d $FUSEKI_HOME ]
+then
+    echo "$FUSEKI_HOME exists but is not a directory" 1>&2
+    exit 1
+    fi
+
+CP="$(. $FUSEKI_HOME/run_cp)"
+
+if [ -e "$FUSEKI_HOME/classes" ]
+then
+    CP="$FUSEKI_HOME/classes:$CP"
+elif [ -e "$FUSEKI_HOME/target/classes" ]
+then
+    CP="$FUSEKI_HOME/target/classes:$CP"
+else
+    echo "No Fuseki1 classes" 2>&1
+fi
+
+# Prepend any development directories here
+DEVDIRS="jena-core jena-tdb jena-arq jena-text"
+for X in $DEVDIRS
+do
+    CPX="$FUSEKI_HOME/../$X/classes"
+    if [ -e "$CPX" ]
+    then
+	CP="$CPX:$CP"
+    fi
+done
+
+FUSEKI_LOG=${FUSEKI_LOG:-}
+JVM_ARGS="${JVM_ARGS:--Xmx1200M}"
+#JVM_ARGS="$JVM_ARGS -XX:MaxDirectMemorySize=1G"
+
+#echo $CP
+
+exec java -cp "$CP" $JVM_ARGS $FUSEKI_LOG org.apache.jena.fuseki.FusekiCmd \
+    --home="$FUSEKI_HOME" "$@"

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/s-delete
----------------------------------------------------------------------
diff --git a/jena-fuseki1/s-delete b/jena-fuseki1/s-delete
new file mode 100755
index 0000000..4f6590d
--- /dev/null
+++ b/jena-fuseki1/s-delete
@@ -0,0 +1,713 @@
+#!/usr/bin/env ruby
+# -*- coding: utf-8 -*-
+
+# 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.
+
+# SPARQL HTTP Update, client.
+
+require 'optparse'
+require 'net/http'
+require 'uri'
+require 'cgi'
+require 'pp'
+require 'ostruct'
+
+# ToDo
+#  Allow a choice of media type for GET
+#   --accept "content-type" (and abbreviations)
+#   --header "Add:this"
+#   --user, --password
+#  Basic authentication: request.basic_auth("username", "password")
+#  Follow redirects => 301:  puts response["location"] # All headers are lowercase?
+
+SOH_NAME="SOH"
+SOH_VERSION="0.0.0"
+
+$proxy = ENV['http_proxy'] ? URI.parse(ENV['http_proxy']) : OpenStruct.new  
+
+# What about direct naming?
+
+# Names
+$mtTurtle           = 'text/turtle;charset=utf-8'
+$mtRDF              = 'application/rdf+xml'
+$mtText             = 'text/plain'
+$mtNTriples         = 'application/n-triples'
+$mtNQuads           = 'application/n-quads'
+$mtJSONLD           = 'application/ld+json'
+$mtTriG             = 'application/trig'
+$mtSparqlResultsX   = 'application/sparql-results+xml'
+$mtSparqlResultsJ   = 'application/sparql-results+json'
+$mtAppJSON          = 'application/json'
+$mtAppXML           = 'application/xml'
+$mtSparqlResultsTSV = 'application/sparql-results+tsv'
+$mtSparqlResultsCSV = 'application/sparql-results+csv'
+$mtSparqlUpdate     = 'application/sparql-update'
+$mtWWWForm          = 'application/x-www-form-urlencoded'
+$mtSparqlQuery      = "application/sparql-query" ;
+
+# Global media type table.
+$fileMediaTypes = {}
+$fileMediaTypes['ttl']   = $mtTurtle
+$fileMediaTypes['n3']    = 'text/n3; charset=utf-8'
+$fileMediaTypes['nt']    = $mtText
+$fileMediaTypes['rdf']   = $mtRDF
+$fileMediaTypes['owl']   = $mtRDF
+$fileMediaTypes['nq']    = $mtNQuads
+$fileMediaTypes['trig']  = $mtTriG
+$fileMediaTypes['json-ld']  = $mtJSONLD
+$fileMediaTypes['jsonld']  = $mtJSONLD
+
+# Global charset : no entry means "don't set"
+$charsetUTF8      = 'utf-8'
+$charset = {}
+$charset[$mtTurtle]   = 'utf-8'
+$charset[$mtText]     = 'ascii'
+$charset[$mtTriG]     = 'utf-8'
+$charset[$mtNQuads]   = 'utf-8'
+
+# Headers
+
+$hContentType         = 'Content-Type'
+# $hContentEncoding     = 'Content-Encoding'
+$hContentLength       = 'Content-Length'
+# $hContentLocation     = 'Content-Location'
+# $hContentRange        = 'Content-Range'
+
+$hAccept              = 'Accept'
+$hAcceptCharset       = 'Accept-Charset'
+$hAcceptEncoding      = 'Accept-Encoding'
+$hAcceptRanges        = 'Accept-Ranges' 
+
+$headers = { "User-Agent" => "#{SOH_NAME}/Fuseki #{SOH_VERSION}"}
+$print_http = false
+
+# Default for GET
+# At least allow anything (and hope!)
+$accept_rdf="#{$mtTurtle} , #{$mtNTriples};q=0.9 , #{$mtRDF};q=0.8 , #{$mtJSONLD};q=0.5"
+# Datasets
+$accept_ds="#{$mtTrig} , #{$mtNQuads};q=0.9 , #{$mtJSONLD};q=0.5"
+# For SPARQL query
+$accept_results="#{$mtSparqlResultsJ} , #{$mtSparqlResultsX};q=0.9 , #{$accept_rdf}"
+
+# Accept any in case of trouble.
+$accept_rdf="#{$accept_rdf} , */*;q=0.1"
+$accept_results="#{$accept_results} , */*;q=0.1" 
+
+# The media type usually forces the charset.
+$accept_charset=nil
+
+## Who we are.
+## Two styles:
+##    s-query .....
+##    soh query .....
+
+$cmd = File.basename($0)
+if $cmd == 'soh'
+then
+  $cmd = (ARGV.size == 0) ? 'soh' : ARGV.shift
+end
+
+if ! $cmd.start_with?('s-') && $cmd != 'soh'
+  $cmd = 's-'+$cmd
+end
+
+## -------- 
+
+def GET(dataset, graph)
+  print "GET #{dataset} #{graph}\n" if $verbose
+  requestURI = target(dataset, graph)
+  headers = {}
+  headers.merge!($headers)
+  headers[$hAccept] = $accept_rdf
+  headers[$hAcceptCharset] = $accept_charset unless $accept_charset.nil?
+  get_worker(requestURI, headers)
+end
+
+def get_worker(requestURI, headers)
+  uri = URI.parse(requestURI)
+  request = Net::HTTP::Get.new(uri.request_uri)
+  request.initialize_http_header(headers)
+  print_http_request(uri, request)
+  response_print_body(uri, request)
+end
+
+def HEAD(dataset, graph)
+  print "HEAD #{dataset} #{graph}\n" if $verbose
+  requestURI = target(dataset, graph)
+  headers = {}
+  headers.merge!($headers)
+  headers[$hAccept] = $accept_rdf
+  headers[$hAcceptCharset] = $accept_charset unless $accept_charset.nil?
+  uri = URI.parse(requestURI)
+  request = Net::HTTP::Head.new(uri.request_uri)
+  request.initialize_http_header(headers)
+  print_http_request(uri, request)
+  response_no_body(uri, request)
+end
+
+def PUT(dataset, graph, file)
+  print "PUT #{dataset} #{graph} #{file}\n" if $verbose
+  send_body(dataset, graph, file, Net::HTTP::Put)
+end
+
+def POST(dataset, graph, file)
+  print "POST #{dataset} #{graph} #{file}\n" if $verbose
+  send_body(dataset, graph, file, Net::HTTP::Post)
+end
+
+def DELETE(dataset, graph)
+  print "DELETE #{dataset} #{graph}\n" if $verbose
+  requestURI = target(dataset, graph)
+  uri = URI.parse(requestURI)
+  request = Net::HTTP::Delete.new(uri.request_uri)
+  headers = {}
+  headers.merge!($headers)
+  request.initialize_http_header(headers)
+  print_http_request(uri, request)
+  response_no_body(uri, request)
+end
+
+def uri_escape(string)
+  CGI.escape(string)
+end
+
+def target(dataset, graph)
+  return dataset+"?default" if graph == "default"
+  return dataset+"?graph="+uri_escape(graph)
+end
+
+def send_body(dataset, graph, file, method)
+  mt = content_type(file)
+  headers = {}
+  headers.merge!($headers)
+  headers[$hContentType] = mt
+  headers[$hContentLength] = File.size(file).to_s
+  ## p headers
+
+  requestURI = target(dataset, graph)
+  uri = URI.parse(requestURI)
+  
+  request = method.new(uri.request_uri)
+  request.initialize_http_header(headers)
+  print_http_request(uri, request)
+  request.body_stream = File.open(file)
+  response_no_body(uri, request)
+end
+
+def response_no_body(uri, request)
+  http = Net::HTTP::Proxy($proxy.host,$proxy.port).new(uri.host, uri.port)
+  http.read_timeout = nil
+  # check we can connect.
+  begin http.start
+  rescue Exception => e  
+    # puts e.message  
+    #puts e.backtrace.inspect  
+    warn_exit "Failed to connect: #{uri.host}:#{uri.port}: #{e.message}", 3
+  end
+  response = http.request(request)
+  print_http_response(response)
+  case response
+  when Net::HTTPSuccess, Net::HTTPRedirection
+    # OK
+  when Net::HTTPNotFound
+    warn_exit "404 Not found: #{uri}", 9
+    #print response.body
+  else
+    warn_exit "#{response.code} #{response.message} #{uri}", 9
+    # Unreachable
+      response.error!
+  end
+  # NO BODY IN RESPONSE
+end
+
+def response_print_body(uri, request)
+  http = Net::HTTP::Proxy($proxy.host,$proxy.port).new(uri.host, uri.port)
+  http.read_timeout = nil
+  # check we can connect.
+  begin http.start
+  rescue => e  
+    #puts e.backtrace.inspect  
+    #print e.class
+    warn_exit "Failed to connect: #{uri.host}:#{uri.port}: #{e.message}", 3
+  end
+
+  # Add a blank line if headers were output.
+  print "\n" if $http_print ;
+
+  begin
+    response = http.request(request) { |res| 
+      print_http_response(res)
+      #puts res.code
+      res.read_body do |segment|
+        print segment
+      end
+    }
+    case response
+    when Net::HTTPSuccess, Net::HTTPRedirection
+      # OK
+    when Net::HTTPNotFound
+      warn_exit "404 Not found: #{uri}", 9
+      #print response.body
+    else
+      warn_exit "#{response.code}: #{uri}", 9
+      # Unreachable
+      response.error!
+    end
+  rescue EOFError => e
+    warn_exit "IO Error: "+e.message, 3
+  end
+end
+
+def print_http_request(uri, request)
+  return unless $print_http
+  #print "Request\n"
+  print request.method," ",uri, "\n"
+  print_headers("  ",request)
+end
+
+def print_http_response(response)
+  return unless $print_http
+  #print "Response\n"
+  print response.code, " ", response.message, "\n"
+  print_headers("  ",response)
+end
+
+def print_headers(marker, headers)
+  headers.each do |k,v| 
+    k = k.split('-').map{|w| w.capitalize}.join('-')+':'
+    printf "%s%-20s %s\n",marker,k,v
+  end
+end
+
+def content_type(file)
+  file =~ /\.([^.]*)$/
+  ext = $1
+  mt = $fileMediaTypes[ext]
+  cs = $charset[mt]
+  mt = mt+';charset='+cs if ! cs.nil?
+  return mt
+end
+
+def charset(content_type)
+  return $charset[content_type]
+end
+
+def warn_exit(msg, rc)
+    warn msg
+    exit rc ;
+end
+
+def parseURI(uri_string)
+  begin
+    return URI.parse(uri_string).to_s
+  rescue URI::InvalidURIError => err
+    warn_exit "Bad URI: <#{uri_string}>", 2
+  end
+end
+
+## ---- Command
+
+def cmd_soh(command=nil)
+  ## Command line
+  options = {}
+  optparse = OptionParser.new do |opts|
+    # Set a banner, displayed at the top
+    # of the help screen.
+    case $cmd
+    when "s-http", "sparql-http", "soh"
+      banner="$cmd [get|post|put|delete] datasetURI graph [file]"
+    when "s-get", "s-head", "s-delete"
+      banner="$cmd  datasetURI graph"
+    end
+
+    opts.banner = $banner
+    # Define the options, and what they do
+    
+    options[:verbose] = false
+    opts.on( '-v', '--verbose', 'Verbose' ) do
+      options[:verbose] = true
+    end
+    
+    options[:version] = false
+    opts.on( '--version', 'Print version and exit' ) do
+      print "#{SOH_NAME} #{SOH_VERSION}\n"
+      exit
+    end
+    
+    # This displays the help screen, all programs are
+    # assumed to have this option.
+    opts.on( '-h', '--help', 'Display this screen and exit' ) do
+      puts opts
+      exit
+    end
+  end
+
+  begin optparse.parse!    
+  rescue OptionParser::InvalidArgument => e
+    warn e
+    exit
+  end
+
+  $verbose = options[:verbose]
+  $print_http = $verbose
+
+  if command.nil?
+    if ARGV.size == 0
+      warn "No command given: expected one of 'get', 'put', 'post', 'delete', 'query' or 'update'"
+      exit 1
+    end
+    cmdPrint=ARGV.shift
+    command=cmdPrint.upcase
+  else
+    cmdPrint=command
+  end
+
+  case command
+  when "HEAD", "GET", "DELETE"
+    requiredFile=false
+  when "PUT", "POST"
+    requiredFile=true
+  when "QUERY"
+    cmd_sparql_query
+  when "UPDATE"
+    cmd_sparql_update
+  else
+    warn_exit "Unknown command: #{command}", 2
+  end
+
+  if requiredFile 
+  then
+    if ARGV.size != 3
+      warn_exit "Required: dataset URI, graph URI (or 'default') and file", 1 
+    end
+  else
+    if ARGV.size != 2
+      warn_exit "Required: dataset URI and graph URI (or 'default')", 1 
+    end
+  end
+
+  dataset=parseURI(ARGV.shift)
+  # Relative URI?
+  graph=parseURI(ARGV.shift)
+  file=""
+  if requiredFile
+  then
+    file = ARGV.shift if requiredFile
+    if ! File.exist?(file)
+      warn_exit "No such file: "+file, 3
+    end
+    if File.directory?(file)
+      warn_exit "File is a directory: "+file, 3
+    end
+  end
+
+  case command
+  when "GET"
+    GET(dataset, graph)
+  when "HEAD"
+    HEAD(dataset, graph)
+  when "PUT"
+    PUT(dataset, graph, file)
+  when "DELETE"
+    DELETE(dataset, graph)
+  when "POST"
+    POST(dataset, graph, file)
+  else
+    warn_exit "Internal error: Unknown command: #{cmd}", 2
+  end
+  exit 0
+end
+
+## --------
+def string_or_file(arg)
+  return arg if ! arg.match(/^@/)
+  a=(arg[1..-1])
+  open(a, 'rb'){|f| f.read}
+end
+
+## -------- SPARQL Query
+
+## Choose method
+def SPARQL_query(service, query, query_file, forcePOST=false, args2={})
+   if ! query_file.nil?
+    query = open(query_file, 'rb'){|f| f.read}
+  end
+  if forcePOST || query.length >= 2*1024 
+    SPARQL_query_POST(service, query, args2)
+  else
+    SPARQL_query_GET(service, query, args2)
+  end
+end
+
+## By GET
+
+def SPARQL_query_GET(service, query, args2)
+  args = { "query" => query }
+  args.merge!(args2)
+  qs=args.collect { |k,v| "#{k}=#{uri_escape(v)}" }.join('&')
+  action="#{service}?#{qs}"
+  headers={}
+  headers.merge!($headers)
+  headers[$hAccept]=$accept_results
+  get_worker(action, headers)
+end
+
+## By POST
+
+def SPARQL_query_POST(service, query, args2)
+  # DRY - body/no body for each of request and response.
+  post_params={ "query" => query }
+  post_params.merge!(args2)
+  uri = URI.parse(service)
+  headers={}
+  headers.merge!($headers)
+  headers[$hAccept]=$accept_results
+  execute_post_form_body(uri, headers, post_params)
+end
+
+def execute_post_form_body(uri, headers, post_params)
+  request = Net::HTTP::Post.new(uri.request_uri)
+  qs=post_params.collect { |k,v| "#{k}=#{uri_escape(v)}" }.join('&')
+  headers[$hContentType] = $mtWWWForm
+  headers[$hContentLength] = qs.length.to_s
+  request.initialize_http_header(headers)
+  request.body = qs
+  print_http_request(uri, request)
+  response_print_body(uri, request)
+end
+
+# Usage: -v --help --file= --query=
+def cmd_sparql_query
+  options={}
+  optparse = OptionParser.new do |opts|
+    opts.banner = "Usage: #{$cmd} [--query QUERY] [--service URI] [--post] 'query' | @file"
+    opts.on('--service=URI', '--server=URI', 'SPARQL endpoint') do |uri|
+      options[:service]=uri
+    end
+    opts.on('--query=FILE','--file=FILE', 'Take query from a file') do |file|
+      options[:file]=file
+    end
+    opts.on('--output=TYPE', [:json,:xml,:text,:csv,:tsv],
+            'Set the output argument') do |type|
+      options[:output]=type
+    end
+    opts.on('--accept=TYPE', [:json,:xml,:text,:csv,:tsv], 
+            'Set the accept header type') do |type|
+      options[:accept]=type
+    end
+    options[:verbose] = false
+    opts.on( '--post', 'Force use of POST' ) do
+      options[:post] = true
+    end
+    opts.on( '-v', '--verbose', 'Verbose' ) do
+      options[:verbose] = true
+    end
+    opts.on( '--version', 'Print version and exit' ) do
+      print "#{SOH_NAME} #{SOH_VERSION}\n"
+      exit
+    end 
+    opts.on( '-h', '--help', 'Display this screen and exit' ) do
+      puts opts
+      exit
+    end
+  end
+
+  begin optparse.parse!    
+  rescue OptionParser::InvalidArgument, OptionParser::InvalidOption => e
+    warn e
+    exit 1
+  end
+
+  $verbose = options[:verbose]
+  $print_http = $verbose
+  usePOST = options[:post]
+
+  service = options[:service]
+  warn_exit 'No service specified.  Required --service=URI',1 if service.nil?
+
+  # Query
+  query=nil
+  query_file=options[:file]
+  if query_file.nil? && ARGV.size == 0
+  then
+    warn_exit 'No query specified.',1
+    end
+  if query_file.nil?
+    query = ARGV.shift
+    if query.match(/^@/)
+      query_file = query[1..-1]
+      query = nil
+    end
+  end
+
+  # --output ==> output= (non-standard)
+  args={}
+  case options[:output]
+  when nil
+  when  "json","xml","text","csv","tsv"
+    args['output'] = options[:output]
+  when :json,:xml,:text,:csv,:tsv
+    args['output'] = options[:output].to_s
+  else
+    warn_exit "Unrecognized output type: "+options[:output],2
+  end
+
+  # --accept
+  # options[:accept]
+
+  print "SPARQL #{service}\n" if $verbose
+  #args={"output"=>"text"}
+  SPARQL_query(service, query, query_file, usePOST, args)
+  exit(0)
+end
+
+## -------- SPARQL Update
+
+# Update sent as a WWW form.
+def SPARQL_update_by_form(service, update, args2={})
+  args = {}
+  args.merge!(args2)
+  headers={}
+  headers.merge!($headers)
+  # args? encode?
+  body="update="+uri_escape(update)
+  headers[$hContentType] = $mtWWWForm
+  headers[$hContentLength] = body.length.to_s
+  uri = URI.parse(service)
+  execute_post_form(uri, headers, body)
+end
+
+# DRY - query form.
+def execute_post_form(uri, headers, body)
+  request = Net::HTTP::Post.new(uri.request_uri)
+  request.initialize_http_header(headers)
+  request.body = body
+  print_http_request(uri, request)
+  response_no_body(uri, request)
+end
+
+def SPARQL_update(service, update, args2={})
+  args = {}
+  args.merge!(args2)
+  headers={}
+  headers.merge!($headers)
+  headers[$hContentType] = $mtSparqlUpdate
+  uri = URI.parse(service)
+  request = Net::HTTP::Post.new(uri.request_uri)
+  request.initialize_http_header(headers)
+  request.body = update
+  print_http_request(uri, request)
+  response_no_body(uri, request)
+end
+
+def cmd_sparql_update(by_raw_post=true)
+  # Share with cmd_sparql_query
+  options={}
+  optparse = OptionParser.new do |opts|
+    opts.banner = "Usage: #{$cmd} [--file REQUEST] [--service URI] 'request' | @file"
+    opts.on('--service=URI', '--server=URI', 'SPARQL endpoint') do |uri|
+      options[:service]=uri
+    end
+    opts.on('--update=FILE', '--file=FILE', 'Take update from a file') do |file|
+      options[:file]=file
+    end
+    options[:verbose] = false
+    opts.on( '-v', '--verbose', 'Verbose' ) do
+      options[:verbose] = true
+    end
+    opts.on( '--version', 'Print version and exit' ) do
+      print "#{SOH_NAME} #{SOH_VERSION}\n"
+      exit
+    end 
+    opts.on( '-h', '--help', 'Display this screen and exit' ) do
+      puts opts
+      exit
+    end
+  end
+
+  begin optparse.parse!    
+  rescue OptionParser::InvalidArgument => e
+    warn e
+    exit
+  end
+
+  $verbose = options[:verbose]
+  $print_http = $verbose
+
+  service = options[:service]
+  warn_exit 'No service specified. Required --service=URI',1   if service.nil?
+  
+  update=nil
+  update_file=options[:file]
+
+  if update_file.nil? && ARGV.size == 0
+  then
+    warn_exit 'No update specified.',1
+    end
+  if update_file.nil?
+    update = ARGV.shift
+    if update.match(/^@/)
+      update_file = update[1..-1]
+      update = nil
+    end
+  end
+  
+  print "SPARQL-Update #{service}\n" if $verbose
+  args={}
+
+  # Reads in the file :-(
+  if update.nil?
+  then
+    update = open(update_file, 'rb'){|f| f.read}
+  else
+    update = string_or_file(update)
+  end
+
+  if by_raw_post
+    SPARQL_update(service, update, args)
+  else
+    SPARQL_update_by_form(service, update, args)
+  end
+  exit(0)
+end
+
+## -------
+
+case $cmd
+when "s-http", "sparql-http", "soh"
+  $banner="#{$cmd} [get|post|put|delete] datasetURI graph [file]"
+  cmd_soh
+when "s-get", "s-head", "s-put", "s-delete", "s-post"
+
+  case $cmd
+  when "s-get", "s-head", "s-delete"
+    $banner="#{$cmd} datasetURI graph"
+  when "s-put", "s-post"
+    $banner="#{$cmd} datasetURI graph file"
+  end
+  cmd2 = $cmd.sub(/^s-/, '').upcase
+  cmd_soh cmd2
+
+when "s-query", "sparql-query"
+  cmd_sparql_query
+when "s-update", "sparql-update"
+  cmd_sparql_update true
+when "s-update-form", "sparql-update-form"
+  cmd_sparql_update false
+else 
+  warn_exit "Unknown: "+$cmd, 1
+end

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/s-get
----------------------------------------------------------------------
diff --git a/jena-fuseki1/s-get b/jena-fuseki1/s-get
new file mode 100755
index 0000000..4f6590d
--- /dev/null
+++ b/jena-fuseki1/s-get
@@ -0,0 +1,713 @@
+#!/usr/bin/env ruby
+# -*- coding: utf-8 -*-
+
+# 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.
+
+# SPARQL HTTP Update, client.
+
+require 'optparse'
+require 'net/http'
+require 'uri'
+require 'cgi'
+require 'pp'
+require 'ostruct'
+
+# ToDo
+#  Allow a choice of media type for GET
+#   --accept "content-type" (and abbreviations)
+#   --header "Add:this"
+#   --user, --password
+#  Basic authentication: request.basic_auth("username", "password")
+#  Follow redirects => 301:  puts response["location"] # All headers are lowercase?
+
+SOH_NAME="SOH"
+SOH_VERSION="0.0.0"
+
+$proxy = ENV['http_proxy'] ? URI.parse(ENV['http_proxy']) : OpenStruct.new  
+
+# What about direct naming?
+
+# Names
+$mtTurtle           = 'text/turtle;charset=utf-8'
+$mtRDF              = 'application/rdf+xml'
+$mtText             = 'text/plain'
+$mtNTriples         = 'application/n-triples'
+$mtNQuads           = 'application/n-quads'
+$mtJSONLD           = 'application/ld+json'
+$mtTriG             = 'application/trig'
+$mtSparqlResultsX   = 'application/sparql-results+xml'
+$mtSparqlResultsJ   = 'application/sparql-results+json'
+$mtAppJSON          = 'application/json'
+$mtAppXML           = 'application/xml'
+$mtSparqlResultsTSV = 'application/sparql-results+tsv'
+$mtSparqlResultsCSV = 'application/sparql-results+csv'
+$mtSparqlUpdate     = 'application/sparql-update'
+$mtWWWForm          = 'application/x-www-form-urlencoded'
+$mtSparqlQuery      = "application/sparql-query" ;
+
+# Global media type table.
+$fileMediaTypes = {}
+$fileMediaTypes['ttl']   = $mtTurtle
+$fileMediaTypes['n3']    = 'text/n3; charset=utf-8'
+$fileMediaTypes['nt']    = $mtText
+$fileMediaTypes['rdf']   = $mtRDF
+$fileMediaTypes['owl']   = $mtRDF
+$fileMediaTypes['nq']    = $mtNQuads
+$fileMediaTypes['trig']  = $mtTriG
+$fileMediaTypes['json-ld']  = $mtJSONLD
+$fileMediaTypes['jsonld']  = $mtJSONLD
+
+# Global charset : no entry means "don't set"
+$charsetUTF8      = 'utf-8'
+$charset = {}
+$charset[$mtTurtle]   = 'utf-8'
+$charset[$mtText]     = 'ascii'
+$charset[$mtTriG]     = 'utf-8'
+$charset[$mtNQuads]   = 'utf-8'
+
+# Headers
+
+$hContentType         = 'Content-Type'
+# $hContentEncoding     = 'Content-Encoding'
+$hContentLength       = 'Content-Length'
+# $hContentLocation     = 'Content-Location'
+# $hContentRange        = 'Content-Range'
+
+$hAccept              = 'Accept'
+$hAcceptCharset       = 'Accept-Charset'
+$hAcceptEncoding      = 'Accept-Encoding'
+$hAcceptRanges        = 'Accept-Ranges' 
+
+$headers = { "User-Agent" => "#{SOH_NAME}/Fuseki #{SOH_VERSION}"}
+$print_http = false
+
+# Default for GET
+# At least allow anything (and hope!)
+$accept_rdf="#{$mtTurtle} , #{$mtNTriples};q=0.9 , #{$mtRDF};q=0.8 , #{$mtJSONLD};q=0.5"
+# Datasets
+$accept_ds="#{$mtTrig} , #{$mtNQuads};q=0.9 , #{$mtJSONLD};q=0.5"
+# For SPARQL query
+$accept_results="#{$mtSparqlResultsJ} , #{$mtSparqlResultsX};q=0.9 , #{$accept_rdf}"
+
+# Accept any in case of trouble.
+$accept_rdf="#{$accept_rdf} , */*;q=0.1"
+$accept_results="#{$accept_results} , */*;q=0.1" 
+
+# The media type usually forces the charset.
+$accept_charset=nil
+
+## Who we are.
+## Two styles:
+##    s-query .....
+##    soh query .....
+
+$cmd = File.basename($0)
+if $cmd == 'soh'
+then
+  $cmd = (ARGV.size == 0) ? 'soh' : ARGV.shift
+end
+
+if ! $cmd.start_with?('s-') && $cmd != 'soh'
+  $cmd = 's-'+$cmd
+end
+
+## -------- 
+
+def GET(dataset, graph)
+  print "GET #{dataset} #{graph}\n" if $verbose
+  requestURI = target(dataset, graph)
+  headers = {}
+  headers.merge!($headers)
+  headers[$hAccept] = $accept_rdf
+  headers[$hAcceptCharset] = $accept_charset unless $accept_charset.nil?
+  get_worker(requestURI, headers)
+end
+
+def get_worker(requestURI, headers)
+  uri = URI.parse(requestURI)
+  request = Net::HTTP::Get.new(uri.request_uri)
+  request.initialize_http_header(headers)
+  print_http_request(uri, request)
+  response_print_body(uri, request)
+end
+
+def HEAD(dataset, graph)
+  print "HEAD #{dataset} #{graph}\n" if $verbose
+  requestURI = target(dataset, graph)
+  headers = {}
+  headers.merge!($headers)
+  headers[$hAccept] = $accept_rdf
+  headers[$hAcceptCharset] = $accept_charset unless $accept_charset.nil?
+  uri = URI.parse(requestURI)
+  request = Net::HTTP::Head.new(uri.request_uri)
+  request.initialize_http_header(headers)
+  print_http_request(uri, request)
+  response_no_body(uri, request)
+end
+
+def PUT(dataset, graph, file)
+  print "PUT #{dataset} #{graph} #{file}\n" if $verbose
+  send_body(dataset, graph, file, Net::HTTP::Put)
+end
+
+def POST(dataset, graph, file)
+  print "POST #{dataset} #{graph} #{file}\n" if $verbose
+  send_body(dataset, graph, file, Net::HTTP::Post)
+end
+
+def DELETE(dataset, graph)
+  print "DELETE #{dataset} #{graph}\n" if $verbose
+  requestURI = target(dataset, graph)
+  uri = URI.parse(requestURI)
+  request = Net::HTTP::Delete.new(uri.request_uri)
+  headers = {}
+  headers.merge!($headers)
+  request.initialize_http_header(headers)
+  print_http_request(uri, request)
+  response_no_body(uri, request)
+end
+
+def uri_escape(string)
+  CGI.escape(string)
+end
+
+def target(dataset, graph)
+  return dataset+"?default" if graph == "default"
+  return dataset+"?graph="+uri_escape(graph)
+end
+
+def send_body(dataset, graph, file, method)
+  mt = content_type(file)
+  headers = {}
+  headers.merge!($headers)
+  headers[$hContentType] = mt
+  headers[$hContentLength] = File.size(file).to_s
+  ## p headers
+
+  requestURI = target(dataset, graph)
+  uri = URI.parse(requestURI)
+  
+  request = method.new(uri.request_uri)
+  request.initialize_http_header(headers)
+  print_http_request(uri, request)
+  request.body_stream = File.open(file)
+  response_no_body(uri, request)
+end
+
+def response_no_body(uri, request)
+  http = Net::HTTP::Proxy($proxy.host,$proxy.port).new(uri.host, uri.port)
+  http.read_timeout = nil
+  # check we can connect.
+  begin http.start
+  rescue Exception => e  
+    # puts e.message  
+    #puts e.backtrace.inspect  
+    warn_exit "Failed to connect: #{uri.host}:#{uri.port}: #{e.message}", 3
+  end
+  response = http.request(request)
+  print_http_response(response)
+  case response
+  when Net::HTTPSuccess, Net::HTTPRedirection
+    # OK
+  when Net::HTTPNotFound
+    warn_exit "404 Not found: #{uri}", 9
+    #print response.body
+  else
+    warn_exit "#{response.code} #{response.message} #{uri}", 9
+    # Unreachable
+      response.error!
+  end
+  # NO BODY IN RESPONSE
+end
+
+def response_print_body(uri, request)
+  http = Net::HTTP::Proxy($proxy.host,$proxy.port).new(uri.host, uri.port)
+  http.read_timeout = nil
+  # check we can connect.
+  begin http.start
+  rescue => e  
+    #puts e.backtrace.inspect  
+    #print e.class
+    warn_exit "Failed to connect: #{uri.host}:#{uri.port}: #{e.message}", 3
+  end
+
+  # Add a blank line if headers were output.
+  print "\n" if $http_print ;
+
+  begin
+    response = http.request(request) { |res| 
+      print_http_response(res)
+      #puts res.code
+      res.read_body do |segment|
+        print segment
+      end
+    }
+    case response
+    when Net::HTTPSuccess, Net::HTTPRedirection
+      # OK
+    when Net::HTTPNotFound
+      warn_exit "404 Not found: #{uri}", 9
+      #print response.body
+    else
+      warn_exit "#{response.code}: #{uri}", 9
+      # Unreachable
+      response.error!
+    end
+  rescue EOFError => e
+    warn_exit "IO Error: "+e.message, 3
+  end
+end
+
+def print_http_request(uri, request)
+  return unless $print_http
+  #print "Request\n"
+  print request.method," ",uri, "\n"
+  print_headers("  ",request)
+end
+
+def print_http_response(response)
+  return unless $print_http
+  #print "Response\n"
+  print response.code, " ", response.message, "\n"
+  print_headers("  ",response)
+end
+
+def print_headers(marker, headers)
+  headers.each do |k,v| 
+    k = k.split('-').map{|w| w.capitalize}.join('-')+':'
+    printf "%s%-20s %s\n",marker,k,v
+  end
+end
+
+def content_type(file)
+  file =~ /\.([^.]*)$/
+  ext = $1
+  mt = $fileMediaTypes[ext]
+  cs = $charset[mt]
+  mt = mt+';charset='+cs if ! cs.nil?
+  return mt
+end
+
+def charset(content_type)
+  return $charset[content_type]
+end
+
+def warn_exit(msg, rc)
+    warn msg
+    exit rc ;
+end
+
+def parseURI(uri_string)
+  begin
+    return URI.parse(uri_string).to_s
+  rescue URI::InvalidURIError => err
+    warn_exit "Bad URI: <#{uri_string}>", 2
+  end
+end
+
+## ---- Command
+
+def cmd_soh(command=nil)
+  ## Command line
+  options = {}
+  optparse = OptionParser.new do |opts|
+    # Set a banner, displayed at the top
+    # of the help screen.
+    case $cmd
+    when "s-http", "sparql-http", "soh"
+      banner="$cmd [get|post|put|delete] datasetURI graph [file]"
+    when "s-get", "s-head", "s-delete"
+      banner="$cmd  datasetURI graph"
+    end
+
+    opts.banner = $banner
+    # Define the options, and what they do
+    
+    options[:verbose] = false
+    opts.on( '-v', '--verbose', 'Verbose' ) do
+      options[:verbose] = true
+    end
+    
+    options[:version] = false
+    opts.on( '--version', 'Print version and exit' ) do
+      print "#{SOH_NAME} #{SOH_VERSION}\n"
+      exit
+    end
+    
+    # This displays the help screen, all programs are
+    # assumed to have this option.
+    opts.on( '-h', '--help', 'Display this screen and exit' ) do
+      puts opts
+      exit
+    end
+  end
+
+  begin optparse.parse!    
+  rescue OptionParser::InvalidArgument => e
+    warn e
+    exit
+  end
+
+  $verbose = options[:verbose]
+  $print_http = $verbose
+
+  if command.nil?
+    if ARGV.size == 0
+      warn "No command given: expected one of 'get', 'put', 'post', 'delete', 'query' or 'update'"
+      exit 1
+    end
+    cmdPrint=ARGV.shift
+    command=cmdPrint.upcase
+  else
+    cmdPrint=command
+  end
+
+  case command
+  when "HEAD", "GET", "DELETE"
+    requiredFile=false
+  when "PUT", "POST"
+    requiredFile=true
+  when "QUERY"
+    cmd_sparql_query
+  when "UPDATE"
+    cmd_sparql_update
+  else
+    warn_exit "Unknown command: #{command}", 2
+  end
+
+  if requiredFile 
+  then
+    if ARGV.size != 3
+      warn_exit "Required: dataset URI, graph URI (or 'default') and file", 1 
+    end
+  else
+    if ARGV.size != 2
+      warn_exit "Required: dataset URI and graph URI (or 'default')", 1 
+    end
+  end
+
+  dataset=parseURI(ARGV.shift)
+  # Relative URI?
+  graph=parseURI(ARGV.shift)
+  file=""
+  if requiredFile
+  then
+    file = ARGV.shift if requiredFile
+    if ! File.exist?(file)
+      warn_exit "No such file: "+file, 3
+    end
+    if File.directory?(file)
+      warn_exit "File is a directory: "+file, 3
+    end
+  end
+
+  case command
+  when "GET"
+    GET(dataset, graph)
+  when "HEAD"
+    HEAD(dataset, graph)
+  when "PUT"
+    PUT(dataset, graph, file)
+  when "DELETE"
+    DELETE(dataset, graph)
+  when "POST"
+    POST(dataset, graph, file)
+  else
+    warn_exit "Internal error: Unknown command: #{cmd}", 2
+  end
+  exit 0
+end
+
+## --------
+def string_or_file(arg)
+  return arg if ! arg.match(/^@/)
+  a=(arg[1..-1])
+  open(a, 'rb'){|f| f.read}
+end
+
+## -------- SPARQL Query
+
+## Choose method
+def SPARQL_query(service, query, query_file, forcePOST=false, args2={})
+   if ! query_file.nil?
+    query = open(query_file, 'rb'){|f| f.read}
+  end
+  if forcePOST || query.length >= 2*1024 
+    SPARQL_query_POST(service, query, args2)
+  else
+    SPARQL_query_GET(service, query, args2)
+  end
+end
+
+## By GET
+
+def SPARQL_query_GET(service, query, args2)
+  args = { "query" => query }
+  args.merge!(args2)
+  qs=args.collect { |k,v| "#{k}=#{uri_escape(v)}" }.join('&')
+  action="#{service}?#{qs}"
+  headers={}
+  headers.merge!($headers)
+  headers[$hAccept]=$accept_results
+  get_worker(action, headers)
+end
+
+## By POST
+
+def SPARQL_query_POST(service, query, args2)
+  # DRY - body/no body for each of request and response.
+  post_params={ "query" => query }
+  post_params.merge!(args2)
+  uri = URI.parse(service)
+  headers={}
+  headers.merge!($headers)
+  headers[$hAccept]=$accept_results
+  execute_post_form_body(uri, headers, post_params)
+end
+
+def execute_post_form_body(uri, headers, post_params)
+  request = Net::HTTP::Post.new(uri.request_uri)
+  qs=post_params.collect { |k,v| "#{k}=#{uri_escape(v)}" }.join('&')
+  headers[$hContentType] = $mtWWWForm
+  headers[$hContentLength] = qs.length.to_s
+  request.initialize_http_header(headers)
+  request.body = qs
+  print_http_request(uri, request)
+  response_print_body(uri, request)
+end
+
+# Usage: -v --help --file= --query=
+def cmd_sparql_query
+  options={}
+  optparse = OptionParser.new do |opts|
+    opts.banner = "Usage: #{$cmd} [--query QUERY] [--service URI] [--post] 'query' | @file"
+    opts.on('--service=URI', '--server=URI', 'SPARQL endpoint') do |uri|
+      options[:service]=uri
+    end
+    opts.on('--query=FILE','--file=FILE', 'Take query from a file') do |file|
+      options[:file]=file
+    end
+    opts.on('--output=TYPE', [:json,:xml,:text,:csv,:tsv],
+            'Set the output argument') do |type|
+      options[:output]=type
+    end
+    opts.on('--accept=TYPE', [:json,:xml,:text,:csv,:tsv], 
+            'Set the accept header type') do |type|
+      options[:accept]=type
+    end
+    options[:verbose] = false
+    opts.on( '--post', 'Force use of POST' ) do
+      options[:post] = true
+    end
+    opts.on( '-v', '--verbose', 'Verbose' ) do
+      options[:verbose] = true
+    end
+    opts.on( '--version', 'Print version and exit' ) do
+      print "#{SOH_NAME} #{SOH_VERSION}\n"
+      exit
+    end 
+    opts.on( '-h', '--help', 'Display this screen and exit' ) do
+      puts opts
+      exit
+    end
+  end
+
+  begin optparse.parse!    
+  rescue OptionParser::InvalidArgument, OptionParser::InvalidOption => e
+    warn e
+    exit 1
+  end
+
+  $verbose = options[:verbose]
+  $print_http = $verbose
+  usePOST = options[:post]
+
+  service = options[:service]
+  warn_exit 'No service specified.  Required --service=URI',1 if service.nil?
+
+  # Query
+  query=nil
+  query_file=options[:file]
+  if query_file.nil? && ARGV.size == 0
+  then
+    warn_exit 'No query specified.',1
+    end
+  if query_file.nil?
+    query = ARGV.shift
+    if query.match(/^@/)
+      query_file = query[1..-1]
+      query = nil
+    end
+  end
+
+  # --output ==> output= (non-standard)
+  args={}
+  case options[:output]
+  when nil
+  when  "json","xml","text","csv","tsv"
+    args['output'] = options[:output]
+  when :json,:xml,:text,:csv,:tsv
+    args['output'] = options[:output].to_s
+  else
+    warn_exit "Unrecognized output type: "+options[:output],2
+  end
+
+  # --accept
+  # options[:accept]
+
+  print "SPARQL #{service}\n" if $verbose
+  #args={"output"=>"text"}
+  SPARQL_query(service, query, query_file, usePOST, args)
+  exit(0)
+end
+
+## -------- SPARQL Update
+
+# Update sent as a WWW form.
+def SPARQL_update_by_form(service, update, args2={})
+  args = {}
+  args.merge!(args2)
+  headers={}
+  headers.merge!($headers)
+  # args? encode?
+  body="update="+uri_escape(update)
+  headers[$hContentType] = $mtWWWForm
+  headers[$hContentLength] = body.length.to_s
+  uri = URI.parse(service)
+  execute_post_form(uri, headers, body)
+end
+
+# DRY - query form.
+def execute_post_form(uri, headers, body)
+  request = Net::HTTP::Post.new(uri.request_uri)
+  request.initialize_http_header(headers)
+  request.body = body
+  print_http_request(uri, request)
+  response_no_body(uri, request)
+end
+
+def SPARQL_update(service, update, args2={})
+  args = {}
+  args.merge!(args2)
+  headers={}
+  headers.merge!($headers)
+  headers[$hContentType] = $mtSparqlUpdate
+  uri = URI.parse(service)
+  request = Net::HTTP::Post.new(uri.request_uri)
+  request.initialize_http_header(headers)
+  request.body = update
+  print_http_request(uri, request)
+  response_no_body(uri, request)
+end
+
+def cmd_sparql_update(by_raw_post=true)
+  # Share with cmd_sparql_query
+  options={}
+  optparse = OptionParser.new do |opts|
+    opts.banner = "Usage: #{$cmd} [--file REQUEST] [--service URI] 'request' | @file"
+    opts.on('--service=URI', '--server=URI', 'SPARQL endpoint') do |uri|
+      options[:service]=uri
+    end
+    opts.on('--update=FILE', '--file=FILE', 'Take update from a file') do |file|
+      options[:file]=file
+    end
+    options[:verbose] = false
+    opts.on( '-v', '--verbose', 'Verbose' ) do
+      options[:verbose] = true
+    end
+    opts.on( '--version', 'Print version and exit' ) do
+      print "#{SOH_NAME} #{SOH_VERSION}\n"
+      exit
+    end 
+    opts.on( '-h', '--help', 'Display this screen and exit' ) do
+      puts opts
+      exit
+    end
+  end
+
+  begin optparse.parse!    
+  rescue OptionParser::InvalidArgument => e
+    warn e
+    exit
+  end
+
+  $verbose = options[:verbose]
+  $print_http = $verbose
+
+  service = options[:service]
+  warn_exit 'No service specified. Required --service=URI',1   if service.nil?
+  
+  update=nil
+  update_file=options[:file]
+
+  if update_file.nil? && ARGV.size == 0
+  then
+    warn_exit 'No update specified.',1
+    end
+  if update_file.nil?
+    update = ARGV.shift
+    if update.match(/^@/)
+      update_file = update[1..-1]
+      update = nil
+    end
+  end
+  
+  print "SPARQL-Update #{service}\n" if $verbose
+  args={}
+
+  # Reads in the file :-(
+  if update.nil?
+  then
+    update = open(update_file, 'rb'){|f| f.read}
+  else
+    update = string_or_file(update)
+  end
+
+  if by_raw_post
+    SPARQL_update(service, update, args)
+  else
+    SPARQL_update_by_form(service, update, args)
+  end
+  exit(0)
+end
+
+## -------
+
+case $cmd
+when "s-http", "sparql-http", "soh"
+  $banner="#{$cmd} [get|post|put|delete] datasetURI graph [file]"
+  cmd_soh
+when "s-get", "s-head", "s-put", "s-delete", "s-post"
+
+  case $cmd
+  when "s-get", "s-head", "s-delete"
+    $banner="#{$cmd} datasetURI graph"
+  when "s-put", "s-post"
+    $banner="#{$cmd} datasetURI graph file"
+  end
+  cmd2 = $cmd.sub(/^s-/, '').upcase
+  cmd_soh cmd2
+
+when "s-query", "sparql-query"
+  cmd_sparql_query
+when "s-update", "sparql-update"
+  cmd_sparql_update true
+when "s-update-form", "sparql-update-form"
+  cmd_sparql_update false
+else 
+  warn_exit "Unknown: "+$cmd, 1
+end


[15/23] jena git commit: Rename folder jena-fuseki to jena-fuseki1

Posted by an...@apache.org.
http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/DatasetRef.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/DatasetRef.java b/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/DatasetRef.java
deleted file mode 100644
index 040c759..0000000
--- a/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/DatasetRef.java
+++ /dev/null
@@ -1,241 +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.fuseki.server;
-
-import java.util.* ;
-import java.util.concurrent.atomic.AtomicLong ;
-
-import org.apache.jena.fuseki.Fuseki ;
-
-import com.hp.hpl.jena.query.ReadWrite ;
-import com.hp.hpl.jena.sparql.core.DatasetGraph ;
-
-public class DatasetRef implements DatasetMXBean, Counters
-{
-    public String name                          = null ;
-    public DatasetGraph dataset                 = null ;
-
-    public ServiceRef query                     = new ServiceRef("query") ;
-    public ServiceRef update                    = new ServiceRef("update") ;
-    public ServiceRef upload                    = new ServiceRef("upload") ;
-    public ServiceRef readGraphStore            = new ServiceRef("gspRead") ;
-    public ServiceRef readWriteGraphStore       = new ServiceRef("gspReadWrite") ; 
-    
-    // Dataset-level counters.
-    private final CounterSet counters           = new CounterSet() ;
-    @Override
-    public  CounterSet getCounters() { return counters ; }
-    
-    private Map<String, ServiceRef> endpoints   = new HashMap<String, ServiceRef>() ;
-    private List<ServiceRef> serviceRefs        = new ArrayList<ServiceRef>() ;
-    private boolean initialized = false ;
-    
-    // Two step initiation (c.f. Builder pattern)
-    // Create object - incrementally set state - call init to calculate internal datastructures.
-    public DatasetRef() {}
-    public void init() {
-        if ( initialized )
-            Fuseki.serverLog.warn("Already initialized: dataset = "+name) ;
-        initialized = true ;
-        initServices() ;
-    }
-    
-    @Override public String toString() { return "DatasetRef:'"+name+"'" ; }  
-    
-    private void initServices() {
-        add(query) ;
-        add(update) ;
-        add(upload) ;
-        add(readGraphStore) ;
-        add(readWriteGraphStore) ;
-        addCounters() ;
-    }
-    
-    private void add(ServiceRef srvRef) {
-        serviceRefs.add(srvRef) ;
-        for ( String ep : srvRef.endpoints )
-            endpoints.put(ep, srvRef) ;
-    }
-
-    public ServiceRef getServiceRef(String service) {
-        if ( ! initialized )
-            Fuseki.serverLog.error("Not initialized: dataset = "+name) ;
-        if ( service.startsWith("/") )
-            service = service.substring(1, service.length()) ; 
-        return endpoints.get(service) ;
-    }
-
-    public Collection<ServiceRef> getServiceRefs() {
-        return serviceRefs ;
-    }
-
-    /** Counter of active read transactions */
-    public AtomicLong   activeReadTxn           = new AtomicLong(0) ;
-    
-    /** Counter of active write transactions */
-    public AtomicLong   activeWriteTxn          = new AtomicLong(0) ;
-
-    /** Cumulative counter of read transactions */
-    public AtomicLong   totalReadTxn            = new AtomicLong(0) ;
-
-    /** Cumulative counter of writer transactions */
-    public AtomicLong   totalWriteTxn           = new AtomicLong(0) ;
-    
-//    /** Count of requests received - anyzservice */
-//    public AtomicLong   countServiceRequests    = new AtomicLong(0) ;
-//    /** Count of requests received that fail in some way */
-//    public AtomicLong   countServiceRequestsBad = new AtomicLong(0) ;
-//    /** Count of requests received that fail in some way */
-//    public AtomicLong   countServiceRequestsOK  = new AtomicLong(0) ;
-//
-//    // SPARQL Query
-//    
-//    /** Count of SPARQL Queries successfully executed */
-//    public AtomicLong   countQueryOK            = new AtomicLong(0) ;
-//    /** Count of SPARQL Queries with syntax errors */
-//    public AtomicLong   countQueryBadSyntax     = new AtomicLong(0) ;
-//    /** Count of SPARQL Queries with timeout on execution */
-//    public AtomicLong   countQueryTimeout       = new AtomicLong(0) ;
-//    /** Count of SPARQL Queries with execution errors (not timeouts) */
-//    public AtomicLong   countQueryBadExecution  = new AtomicLong(0) ;
-
-    public void startTxn(ReadWrite mode)
-    {
-        switch(mode)
-        {
-            case READ:  
-                activeReadTxn.getAndIncrement() ;
-                totalReadTxn.getAndIncrement() ;
-                break ;
-            case WRITE:
-                activeWriteTxn.getAndIncrement() ;
-                totalWriteTxn.getAndIncrement() ;
-                break ;
-        }
-    }
-    
-    public void finishTxn(ReadWrite mode)
-    {
-        switch(mode)
-        {
-            case READ:  
-                activeReadTxn.decrementAndGet() ;
-                break ;
-            case WRITE:
-                activeWriteTxn.decrementAndGet() ;
-                break ;
-        }
-    }
-
-    //TODO Need to be able to set this from the config file.  
-    public boolean allowDatasetUpdate           = false;
-    
-    public boolean allowTimeoutOverride         = false;
-    public long maximumTimeoutOverride          = Long.MAX_VALUE;
-    
-    public boolean isReadOnly()
-    {
-        return ! allowDatasetUpdate &&
-               ! update.isActive() && 
-               ! upload.isActive() &&
-               ! readWriteGraphStore.isActive()
-               ;
-    }
-    
-    // MBean
-    
-    @Override
-    public String getName()     { return name ; }
-
-    @Override public long getRequests() { 
-        return counters.value(CounterName.Requests) ;
-    }
-
-    @Override
-    public long getRequestsGood() {
-        return counters.value(CounterName.RequestsGood) ;
-    }
-    @Override
-    public long getRequestsBad() {
-        return counters.value(CounterName.RequestsBad) ;
-    }
-    
-    private void addCounters() {
-        getCounters().add(CounterName.Requests) ;
-        getCounters().add(CounterName.RequestsGood) ;
-        getCounters().add(CounterName.RequestsBad) ;
-
-        query.getCounters().add(CounterName.Requests) ;
-        query.getCounters().add(CounterName.RequestsGood) ;
-        query.getCounters().add(CounterName.RequestsBad) ;
-        query.getCounters().add(CounterName.QueryTimeouts) ;
-        query.getCounters().add(CounterName.QueryExecErrors) ;
-
-        update.getCounters().add(CounterName.Requests) ;
-        update.getCounters().add(CounterName.RequestsGood) ;
-        update.getCounters().add(CounterName.RequestsBad) ;
-        update.getCounters().add(CounterName.UpdateExecErrors) ;
-
-        upload.getCounters().add(CounterName.Requests) ;
-        upload.getCounters().add(CounterName.RequestsGood) ;
-        upload.getCounters().add(CounterName.RequestsBad) ;
-
-        addCountersForGSP(readWriteGraphStore.getCounters(), false) ;
-        if ( readGraphStore != readWriteGraphStore )
-            addCountersForGSP(readGraphStore.getCounters(), true) ;
-    }
-
-    private void addCountersForGSP(CounterSet cs, boolean readWrite) {
-        cs.add(CounterName.Requests) ;
-        cs.add(CounterName.RequestsGood) ;
-        cs.add(CounterName.RequestsBad) ;
-
-        cs.add(CounterName.GSPget) ;
-        cs.add(CounterName.GSPgetGood) ;
-        cs.add(CounterName.GSPgetBad) ;
-
-        cs.add(CounterName.GSPhead) ;
-        cs.add(CounterName.GSPheadGood) ;
-        cs.add(CounterName.GSPheadBad) ;
-
-        // Add anyway.
-        // if ( ! readWrite )
-        // return ;
-
-        cs.add(CounterName.GSPput) ;
-        cs.add(CounterName.GSPputGood) ;
-        cs.add(CounterName.GSPputBad) ;
-
-        cs.add(CounterName.GSPpost) ;
-        cs.add(CounterName.GSPpostGood) ;
-        cs.add(CounterName.GSPpostBad) ;
-
-        cs.add(CounterName.GSPdelete) ;
-        cs.add(CounterName.GSPdeleteGood) ;
-        cs.add(CounterName.GSPdeleteBad) ;
-
-        cs.add(CounterName.GSPpatch) ;
-        cs.add(CounterName.GSPpatchGood) ;
-        cs.add(CounterName.GSPpatchBad) ;
-
-        cs.add(CounterName.GSPoptions) ;
-        cs.add(CounterName.GSPoptionsGood) ;
-        cs.add(CounterName.GSPoptionsBad) ;
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/DatasetRegistry.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/DatasetRegistry.java b/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/DatasetRegistry.java
deleted file mode 100644
index 152e8cd..0000000
--- a/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/DatasetRegistry.java
+++ /dev/null
@@ -1,30 +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.fuseki.server;
-
-import org.apache.jena.fuseki.migrate.Registry ;
-
-public class DatasetRegistry extends Registry<DatasetRef>
-{
-    private static DatasetRegistry singleton = new DatasetRegistry() ;
-
-    public static DatasetRegistry get() { return singleton ; }
-    
-    private DatasetRegistry() {}
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/FusekiConfig.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/FusekiConfig.java b/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/FusekiConfig.java
deleted file mode 100644
index 9c36a7c..0000000
--- a/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/FusekiConfig.java
+++ /dev/null
@@ -1,374 +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.fuseki.server;
-
-import java.lang.reflect.Method ;
-import java.util.ArrayList ;
-import java.util.Arrays ;
-import java.util.List ;
-
-import org.apache.jena.atlas.iterator.Iter ;
-import org.apache.jena.atlas.lib.StrUtils ;
-import org.apache.jena.fuseki.Fuseki ;
-import org.apache.jena.fuseki.FusekiConfigException ;
-import org.apache.jena.fuseki.HttpNames ;
-import org.slf4j.Logger ;
-
-import com.hp.hpl.jena.assembler.Assembler ;
-import com.hp.hpl.jena.assembler.JA ;
-import com.hp.hpl.jena.query.ARQ ;
-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.QuerySolutionMap ;
-import com.hp.hpl.jena.query.ResultSet ;
-import com.hp.hpl.jena.query.ResultSetFactory ;
-import com.hp.hpl.jena.rdf.model.Literal ;
-import com.hp.hpl.jena.rdf.model.Model ;
-import com.hp.hpl.jena.rdf.model.RDFNode ;
-import com.hp.hpl.jena.rdf.model.ResIterator ;
-import com.hp.hpl.jena.rdf.model.Resource ;
-import com.hp.hpl.jena.rdf.model.Statement ;
-import com.hp.hpl.jena.rdf.model.StmtIterator ;
-import com.hp.hpl.jena.shared.PrefixMapping ;
-import com.hp.hpl.jena.sparql.core.DatasetGraph ;
-import com.hp.hpl.jena.sparql.core.DatasetGraphFactory ;
-import com.hp.hpl.jena.sparql.core.DatasetGraphReadOnly ;
-import com.hp.hpl.jena.sparql.core.assembler.AssemblerUtils ;
-import com.hp.hpl.jena.tdb.TDB ;
-import com.hp.hpl.jena.util.FileManager ;
-import com.hp.hpl.jena.vocabulary.RDF ;
-import com.hp.hpl.jena.vocabulary.RDFS ;
-
-public class FusekiConfig
-{
-    static { Fuseki.init(); }
-
-    // The datastructure that captures a servers configuration.
-    
-    // Server port
-    int port ;
-    // Management command port - -1 for none.
-    int mgtPort ;           
-    List<DatasetRef> datasets = null ;
-    
-    
-    private static Logger log = Fuseki.configLog ;
-    
-    private static String prefixes = StrUtils.strjoinNL(
-    "PREFIX fu:     <http://jena.apache.org/fuseki#>" ,
-    "PREFIX rdf:    <http://www.w3.org/1999/02/22-rdf-syntax-ns#>",
-    "PREFIX rdfs:   <http://www.w3.org/2000/01/rdf-schema#>",
-    "PREFIX tdb:    <http://jena.hpl.hp.com/2008/tdb#>",
-    "PREFIX list:   <http://jena.hpl.hp.com/ARQ/list#>",
-    "PREFIX list:   <http://jena.hpl.hp.com/ARQ/list#>",
-    "PREFIX xsd:     <http://www.w3.org/2001/XMLSchema#>",
-    "PREFIX apf:     <http://jena.hpl.hp.com/ARQ/property#>", 
-    "PREFIX afn:     <http://jena.hpl.hp.com/ARQ/function#>" ,
-    "") ;
-    
-    public static ServerConfig defaultConfiguration(String datasetPath, DatasetGraph dsg, boolean allowUpdate, boolean listenLocal)
-    {
-        DatasetRef dbDesc = new DatasetRef() ;
-        dbDesc.name = datasetPath ;
-        dbDesc.dataset = dsg ;
-        dbDesc.query.endpoints.add(HttpNames.ServiceQuery) ;
-        dbDesc.query.endpoints.add(HttpNames.ServiceQueryAlt) ;
-
-        if ( allowUpdate )
-        {
-            dbDesc.update.endpoints.add(HttpNames.ServiceUpdate) ;
-            dbDesc.upload.endpoints.add(HttpNames.ServiceUpload) ;
-            dbDesc.readWriteGraphStore.endpoints.add(HttpNames.ServiceData) ;
-            dbDesc.allowDatasetUpdate = true ;
-        }
-        else
-            dbDesc.readGraphStore.endpoints.add(HttpNames.ServiceData) ;
-        ServerConfig config = new ServerConfig() ;
-        config.datasets = Arrays.asList(dbDesc) ;
-        config.port = 3030 ;
-        config.mgtPort = 3031 ;
-        config.pagesPort = config.port ;
-        config.loopback = listenLocal ;
-        config.jettyConfigFile = null ;
-        config.pages = Fuseki.PagesStatic ;
-        config.enableCompression = true ;
-        config.verboseLogging = false ;
-        return config ;
-    }
-    
-    public static ServerConfig configure(String filename)
-    {
-        // Be absolutely sure everything has initialized.
-        // Some initialization registers assemblers and sets abbreviation vocabulary. 
-        ARQ.init();
-        TDB.init() ;
-        Fuseki.init() ;
-        Model m = FileManager.get().loadModel(filename) ;
-
-        // Find one server.
-        List<Resource> servers = getByType(FusekiVocab.tServer, m) ;
-        if ( servers.size() == 0 )
-            throw new FusekiConfigException("No server found (no resource with type "+strForResource(FusekiVocab.tServer)) ;
-        if ( servers.size() > 1 )
-            throw new FusekiConfigException(servers.size()+" servers found (must be exactly one in a configuration file)") ;
-        
-        // ---- Server 
-        Resource server = servers.get(0) ;
-        processServer(server) ;
-
-        // ---- Services
-        ResultSet rs = query("SELECT * { ?s fu:services [ list:member ?member ] }", m) ; 
-        if ( ! rs.hasNext() )
-            log.warn("No services found") ;
-        
-        List<DatasetRef> services =  new ArrayList<DatasetRef>() ; 
-        
-        for ( ; rs.hasNext() ; )
-        {
-            QuerySolution soln = rs.next() ;
-            Resource svc = soln.getResource("member") ;
-            DatasetRef sd = processService(svc) ;
-            services.add(sd) ;
-        }
-        
-        // TODO Properties for the other fields.
-        ServerConfig config = new ServerConfig() ;
-        config.datasets = services ;
-        config.port = 3030 ;
-        config.mgtPort = 3031 ;
-        config.pagesPort = config.port ;
-        config.jettyConfigFile = null ;
-        config.pages = Fuseki.PagesStatic ;
-        config.enableCompression = true ;
-        config.verboseLogging = false ;
-        return config ;
-    }
-    
-
-    // DatasetRef used where there isn't a real Dataset e.g. the SPARQL processor.  
-    
-    private static DatasetRef noDataset      = new DatasetRef() ;
-    private static DatasetGraph dummyDSG        = new DatasetGraphReadOnly(DatasetGraphFactory.createMemFixed()) ;
-    static {
-        noDataset.name = "" ;
-        noDataset.dataset = dummyDSG ;
-        noDataset.query.endpoints.add(HttpNames.ServiceQuery) ;
-        noDataset.query.endpoints.add(HttpNames.ServiceQueryAlt) ;
-        noDataset.allowDatasetUpdate = false ;
-        noDataset.init();
-        // Don't register it.  
-        // This is used as a placeholder and shoudl not be found by "all datasets"  
-        // DatasetRegistry.get().put("", noDataset) ;
-    }
-
-    /** Return the DatasetRef (read-only) for when there is no dataset, just a SPARQL Query processor */ 
-    public static DatasetRef serviceOnlyDatasetRef() { return noDataset ; }
-
-    private static void processServer(Resource server)
-    {
-        // Global, currently.
-        AssemblerUtils.setContext(server, Fuseki.getContext()) ;
-        
-        StmtIterator sIter = server.listProperties(JA.loadClass) ;
-        for( ; sIter.hasNext(); )
-        {
-            Statement s = sIter.nextStatement() ;
-            RDFNode rn = s.getObject() ;
-            String className = null ;
-            if ( rn instanceof Resource )
-            {
-                String uri = ((Resource)rn).getURI() ;
-                if ( uri == null )
-                {
-                    log.warn("Blank node for class to load") ;
-                    continue ;
-                }
-                String javaScheme = "java:" ;
-                if ( ! uri.startsWith(javaScheme) )
-                {
-                    log.warn("Class to load is not 'java:': "+uri) ;
-                    continue ;
-                }
-                className = uri.substring(javaScheme.length()) ;
-            }
-            if ( rn instanceof Literal )
-                className = ((Literal)rn).getLexicalForm() ; 
-            /*Loader.*/loadAndInit(className) ;
-        }
-        // ----
-    }
-
-    private static void loadAndInit(String className)
-    {
-        try {
-            Class<?> classObj = Class.forName(className);
-            log.info("Loaded "+className) ;
-            Method initMethod = classObj.getMethod("init");
-            initMethod.invoke(null);
-        } catch (ClassNotFoundException ex)
-        {
-            log.warn("Class not found: "+className);
-        } 
-        catch (Exception e)         { throw new FusekiConfigException(e) ; }
-    }
-
-    private static DatasetRef processService(Resource svc)
-    {
-        log.info("Service: "+nodeLabel(svc)) ;
-        DatasetRef sDesc = new DatasetRef() ;
-        sDesc.name = ((Literal)getOne(svc, "fu:name")).getLexicalForm() ;
-        log.info("  name = "+sDesc.name) ;
-
-        addServiceEP("query", sDesc.name, sDesc.query, svc, "fu:serviceQuery") ; 
-        addServiceEP("update", sDesc.name, sDesc.update, svc, "fu:serviceUpdate") ; 
-        addServiceEP("upload", sDesc.name, sDesc.upload, svc, "fu:serviceUpload") ;
-        addServiceEP("graphStore(RW)", sDesc.name, sDesc.readWriteGraphStore, svc, "fu:serviceReadWriteGraphStore") ;
-        addServiceEP("graphStore(R)", sDesc.name, sDesc.readGraphStore, svc, "fu:serviceReadGraphStore") ;
-        // Extract timeout overriding configuration if present.
-        if (svc.hasProperty(FusekiVocab.pAllowTimeoutOverride)) {
-            sDesc.allowTimeoutOverride = svc.getProperty(FusekiVocab.pAllowTimeoutOverride).getObject().asLiteral().getBoolean();
-            if (svc.hasProperty(FusekiVocab.pMaximumTimeoutOverride)) {
-                sDesc.maximumTimeoutOverride = (int) (svc.getProperty(FusekiVocab.pMaximumTimeoutOverride).getObject().asLiteral().getFloat() * 1000);
-            }
-        }
-        
-        Resource datasetDesc = ((Resource)getOne(svc, "fu:dataset")) ;
-
-        // Check if it is in the model.
-        if ( ! datasetDesc.hasProperty(RDF.type) )
-            throw new FusekiConfigException("No rdf:type for dataset "+nodeLabel(datasetDesc)) ;
-        
-        Dataset ds = (Dataset)Assembler.general.open(datasetDesc)  ;
-        sDesc.dataset = ds.asDatasetGraph() ; 
-        return sDesc ;
-        
-    }
-    
-    private static RDFNode getOne(Resource svc, String property)
-    {
-        String ln = property.substring(property.indexOf(':')+1) ;
-        ResultSet rs = query("SELECT * { ?svc "+property+" ?x}", svc.getModel(), "svc", svc) ;
-        if ( ! rs.hasNext() )
-            throw new FusekiConfigException("No "+ln+" for service "+nodeLabel(svc)) ;
-        RDFNode x = rs.next().get("x") ;
-        if ( rs.hasNext() )
-            throw new FusekiConfigException("Multiple "+ln+" for service "+nodeLabel(svc)) ;
-        return x ;
-    }
-    
-    private static List<Resource> getByType(Resource type, Model m)
-    {
-        ResIterator rIter = m.listSubjectsWithProperty(RDF.type, type) ;
-        return Iter.toList(rIter) ;
-    }
-
-    private static void addServiceEP(String label, String name, ServiceRef service, Resource svc, String property)
-    {
-        ResultSet rs = query("SELECT * { ?svc "+property+" ?ep}", svc.getModel(), "svc", svc) ;
-        for ( ; rs.hasNext() ; )
-        {
-            QuerySolution soln = rs.next() ;
-            String epName = soln.getLiteral("ep").getLexicalForm() ;
-            service.endpoints.add(epName) ;
-            log.info("  "+label+" = /"+name+"/"+epName) ;
-        }
-    }
-
-
-    private static ResultSet query(String string, Model m)
-    {
-        return query(string, m, null, null) ;
-    }
-
-    private static ResultSet query(String string, Model m, String varName, RDFNode value)
-    {
-        Query query = QueryFactory.create(prefixes+string) ;
-        QuerySolutionMap initValues = null ;
-        if ( varName != null )
-            initValues = querySolution(varName, value) ;
-        try(QueryExecution qExec = QueryExecutionFactory.create(query, m, initValues)) {
-            ResultSet rs = ResultSetFactory.copyResults(qExec.execSelect()) ;
-            return rs ;
-        }
-    }
-    
-    private static QuerySolutionMap querySolution(String varName, RDFNode value)
-    {
-        QuerySolutionMap qsm = new QuerySolutionMap() ;
-        querySolution(qsm, varName, value) ;
-        return qsm ;
-    }
-    
-    private static QuerySolutionMap querySolution(QuerySolutionMap qsm, String varName, RDFNode value)
-    {
-        qsm.add(varName, value) ;
-        return qsm ;
-    }
-    
-    // Node presentation
-    private static String nodeLabel(RDFNode n)
-    {
-        if ( n == null )
-            return "<null>" ;
-        if ( n instanceof Resource )
-            return strForResource((Resource)n) ;
-        
-        Literal lit = (Literal)n ;
-        return lit.getLexicalForm() ;
-    }
-    
-    private static String strForResource(Resource r) { return strForResource(r, r.getModel()) ; }
-    
-    private static String strForResource(Resource r, PrefixMapping pm)
-    {
-        if ( r == null )
-            return "NULL ";
-        if ( r.hasProperty(RDFS.label))
-        {
-            RDFNode n = r.getProperty(RDFS.label).getObject() ;
-            if ( n instanceof Literal )
-                return ((Literal)n).getString() ;
-        }
-        
-        if ( r.isAnon() )
-            return "<<blank node>>" ;
-
-        if ( pm == null )
-            pm = r.getModel() ;
-
-        return strForURI(r.getURI(), pm ) ;
-    }
-    
-    private static String strForURI(String uri, PrefixMapping pm)
-    {
-        if ( pm != null )
-        {
-            String x = pm.shortForm(uri) ;
-            
-            if ( ! x.equals(uri) )
-                return x ;
-        }
-        return "<"+uri+">" ;
-    }
-}
-

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/FusekiErrorHandler.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/FusekiErrorHandler.java b/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/FusekiErrorHandler.java
deleted file mode 100644
index d1660f5..0000000
--- a/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/FusekiErrorHandler.java
+++ /dev/null
@@ -1,92 +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.fuseki.server;
-
-import static java.lang.String.format ;
-
-import java.io.* ;
-
-import javax.servlet.http.HttpServletRequest ;
-import javax.servlet.http.HttpServletResponse ;
-
-import org.apache.jena.fuseki.Fuseki ;
-import org.apache.jena.web.HttpSC ;
-import org.eclipse.jetty.http.HttpHeaders ;
-import org.eclipse.jetty.http.HttpMethods ;
-import org.eclipse.jetty.http.MimeTypes ;
-import org.eclipse.jetty.server.AbstractHttpConnection ;
-import org.eclipse.jetty.server.Request ;
-import org.eclipse.jetty.server.handler.ErrorHandler ;
-
-public class FusekiErrorHandler extends ErrorHandler
-{
-    @Override
-    public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException
-    {
-        AbstractHttpConnection connection = AbstractHttpConnection.getCurrentConnection();
-        connection.getRequest().setHandled(true);
-        String method = request.getMethod();
-     
-        if(!method.equals(HttpMethods.GET) && !method.equals(HttpMethods.POST) && !method.equals(HttpMethods.HEAD))
-            return;
-        
-        response.setContentType(MimeTypes.TEXT_PLAIN_UTF_8) ;
-        response.setHeader(HttpHeaders.CACHE_CONTROL, "must-revalidate,no-cache,no-store") ;
-        
-        ByteArrayOutputStream bytes = new ByteArrayOutputStream(1024) ;
-        //String writer = IO.UTF8(null) ;
-        try(Writer writer = new OutputStreamWriter(bytes, "UTF-8")) {
-
-            handleErrorPage(request, writer, connection.getResponse().getStatus(), connection.getResponse().getReason());
-
-            if ( ! Fuseki.VERSION.equalsIgnoreCase("development") )
-            {
-                writer.write("\n") ;
-                writer.write("\n") ;
-                writer.write(format("Fuseki - version %s (Build date: %s)\n", Fuseki.VERSION, Fuseki.BUILD_DATE)) ;
-            }
-            writer.flush();
-        }
-        response.setContentLength(bytes.size()) ;
-        // Copy
-        response.getOutputStream().write(bytes.toByteArray()) ;
-    }
-    
-    @Override
-    protected void handleErrorPage(HttpServletRequest request, Writer writer, int code, String message)
-        throws IOException
-    {
-        if ( message == null )
-            message = HttpSC.getMessage(code) ;
-        writer.write(format("Error %d: %s\n", code, message)) ;
-        
-        Throwable th = (Throwable)request.getAttribute("javax.servlet.error.exception");
-        while(th!=null)
-        {
-            writer.write("\n");
-            StringWriter sw = new StringWriter();
-            PrintWriter pw = new PrintWriter(sw);
-            th.printStackTrace(pw);
-            pw.flush();
-            writer.write(sw.getBuffer().toString());
-            writer.write("\n");
-            th = th.getCause();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/FusekiServletContextListener.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/FusekiServletContextListener.java b/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/FusekiServletContextListener.java
deleted file mode 100644
index f1c9642..0000000
--- a/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/FusekiServletContextListener.java
+++ /dev/null
@@ -1,43 +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.fuseki.server;
-
-import javax.servlet.ServletContextEvent ;
-import javax.servlet.ServletContextListener ;
-
-public class FusekiServletContextListener implements ServletContextListener {
-    // This could do the initialization. 
-    private final SPARQLServer sparqlServer ;
-    public FusekiServletContextListener(SPARQLServer sparqlServer) {
-        this.sparqlServer = sparqlServer ;
-    }
-
-    @Override
-    public void contextInitialized(ServletContextEvent sce) {
-//        Fuseki.serverLog.info("contextInitialized") ;
-//        for ( DatasetRef dsRef : sparqlServer.getDatasets() )
-//            Fuseki.serverLog.info("Dataset: "+dsRef.getName()) ;
-    }
-
-    @Override
-    public void contextDestroyed(ServletContextEvent sce) {
-//        Fuseki.serverLog.info("contextDestroyed") ;
-    }
-}
-

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/FusekiVocab.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/FusekiVocab.java b/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/FusekiVocab.java
deleted file mode 100644
index d4d4e54..0000000
--- a/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/FusekiVocab.java
+++ /dev/null
@@ -1,62 +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.fuseki.server;
-
-import org.apache.jena.fuseki.FusekiException ;
-import org.apache.jena.iri.IRI ;
-import org.apache.jena.riot.system.IRIResolver ;
-
-import com.hp.hpl.jena.rdf.model.Property ;
-import com.hp.hpl.jena.rdf.model.Resource ;
-import com.hp.hpl.jena.rdf.model.ResourceFactory ;
-
-public class FusekiVocab
-{
-    public static String NS = "http://jena.apache.org/fuseki#" ;
-
-    public static final Resource tServer = resource("Server") ;
-
-    public static final Property pServices = property("services") ;
-    public static final Property pServiceName = property("name") ;
-    
-    public static final Property pServiceQueryEP = property("serviceQuery") ;
-    public static final Property pServiceUpdateEP = property("serviceUpdate") ;
-    public static final Property pServiceUploadEP = property("serviceUpload") ;
-    public static final Property pServiceReadWriteGraphStoreEP = property("serviceReadWriteGraphStore") ;
-    public static final Property pServiceReadgraphStoreEP = property("serviceReadGraphStore") ;
-
-    public static final Property pAllowTimeoutOverride = property("allowTimeoutOverride");
-    public static final Property pMaximumTimeoutOverride = property("maximumTimeoutOverride");
-
-    private static Resource resource(String localname) { return ResourceFactory.createResource(iri(localname)) ; }
-    private static Property property(String localname) { return ResourceFactory.createProperty(iri(localname)) ; }
-        
-    private static String iri(String localname)
-    {
-        String uri = NS+localname ;
-        IRI iri = IRIResolver.parseIRI(uri) ;
-        if ( iri.hasViolation(true) )
-            throw new FusekiException("Bad IRI: "+iri) ;
-        if ( ! iri.isAbsolute() )
-            throw new FusekiException("Bad IRI: "+iri) ;
-        
-        return uri ;
-    }
-}
-

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/SPARQLServer.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/SPARQLServer.java b/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/SPARQLServer.java
deleted file mode 100644
index 7448eb2..0000000
--- a/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/SPARQLServer.java
+++ /dev/null
@@ -1,484 +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.fuseki.server ;
-
-import static java.lang.String.format ;
-import static org.apache.jena.fuseki.Fuseki.serverLog ;
-
-import java.io.FileInputStream ;
-import java.util.* ;
-
-import javax.servlet.DispatcherType ;
-import javax.servlet.http.HttpServlet ;
-
-import org.apache.jena.atlas.lib.FileOps ;
-import org.apache.jena.fuseki.Fuseki ;
-import org.apache.jena.fuseki.FusekiException ;
-import org.apache.jena.fuseki.HttpNames ;
-import org.apache.jena.fuseki.mgt.ActionDataset ;
-import org.apache.jena.fuseki.mgt.MgtFunctions ;
-import org.apache.jena.fuseki.mgt.PageNames ;
-import org.apache.jena.fuseki.servlets.* ;
-import org.apache.jena.fuseki.validation.DataValidator ;
-import org.apache.jena.fuseki.validation.IRIValidator ;
-import org.apache.jena.fuseki.validation.QueryValidator ;
-import org.apache.jena.fuseki.validation.UpdateValidator ;
-import org.apache.jena.riot.WebContent ;
-import org.eclipse.jetty.http.MimeTypes ;
-import org.eclipse.jetty.security.* ;
-import org.eclipse.jetty.security.authentication.BasicAuthenticator ;
-import org.eclipse.jetty.server.Connector ;
-import org.eclipse.jetty.server.Server ;
-import org.eclipse.jetty.server.nio.BlockingChannelConnector ;
-import org.eclipse.jetty.servlet.DefaultServlet ;
-import org.eclipse.jetty.servlet.ServletContextHandler ;
-import org.eclipse.jetty.servlet.ServletHolder ;
-import org.eclipse.jetty.servlets.GzipFilter ;
-import org.eclipse.jetty.util.security.Constraint ;
-import org.eclipse.jetty.xml.XmlConfiguration ;
-
-import com.hp.hpl.jena.sparql.mgt.ARQMgt ;
-import com.hp.hpl.jena.sparql.util.Utils ;
-
-/**
- * SPARQLServer is the Jena server instance which wraps/utilizes 
- * {@link org.eclipse.jetty.server.Server}. This class provides
- * immediate access to the {@link org.eclipse.jetty.server.Server#start()} and 
- * {@link org.eclipse.jetty.server.Server#stop()} commands as well as obtaining
- * instances of the server and server configuration. Finally we can obtain 
- * instances of {@link org.apache.jena.fuseki.server.ServerConfig}.
- *
- */
-public class SPARQLServer {
-    static {
-        Fuseki.init() ;
-    }
-
-    private ServerConfig        serverConfig ;
-
-    private Server              server         = null ;
-    private static List<String> epDataset      = Arrays.asList("*") ;
-
-    /**
-     * Default constructor which requires a {@link org.apache.jena.fuseki.server.ServerConfig}
-     * object as input. We use this config to specify (verbose) logging, enable compression
-     * etc. 
-     * @param config
-     */
-    public SPARQLServer(ServerConfig config) {
-        this.serverConfig = config ;
-        // Currently server-wide.
-        Fuseki.verboseLogging = config.verboseLogging ;
-
-        // GZip compression
-        // Note that regardless of this setting we'll always leave it turned off
-        // for the servlets
-        // where it makes no sense to have it turned on e.g. update and upload
-
-        ServletContextHandler context = buildServer(serverConfig.jettyConfigFile, config.enableCompression) ;
-        configureDatasets(context) ;
-    }
-
-    private void configureDatasets(ServletContextHandler context) {
-        // Build them all.
-        for (DatasetRef dsDesc : serverConfig.datasets)
-            configureOneDataset(context, dsDesc, serverConfig.enableCompression) ;
-        
-    }
-    
-    /**
-     * Initialize the {@link SPARQLServer} instance.
-     */
-    public void start() {
-        String now = Utils.nowAsString() ;
-        serverLog.info(format("%s %s %s", Fuseki.NAME, Fuseki.VERSION, Fuseki.BUILD_DATE)) ;
-        // This does not get set usefully for Jetty as we use it.
-        // String jettyVersion = org.eclipse.jetty.server.Server.getVersion() ;
-        // serverLog.info(format("Jetty %s",jettyVersion)) ;
-        String host = server.getConnectors()[0].getHost() ;
-        if ( host != null )
-            serverLog.info("Incoming connections limited to " + host) ;
-        serverLog.info(format("Started %s on port %d", now, server.getConnectors()[0].getPort())) ;
-
-        try {
-            server.start() ;
-        } catch (java.net.BindException ex) {
-            serverLog.error("SPARQLServer: Failed to start server: " + ex.getMessage()) ;
-            System.exit(1) ;
-        } catch (Exception ex) {
-            serverLog.error("SPARQLServer: Failed to start server: " + ex.getMessage(), ex) ;
-            System.exit(1) ;
-        }
-
-        ServletContextHandler context = (ServletContextHandler)server.getHandler() ;
-    }
-
-    /**
-     * Stop the {@link SPARQLServer} instance.
-     */
-    public void stop() {
-        String now = Utils.nowAsString() ;
-        serverLog.info(format("Stopped %s on port %d", now, server.getConnectors()[0].getPort())) ;
-        try {
-            server.stop() ;
-        } catch (Exception ex) {
-            Fuseki.serverLog.warn("SPARQLServer: Exception while stopping server: " + ex.getMessage(), ex) ;
-        }
-        removeJMX() ;
-    }
-
-    /**
-     * Get the Jetty instance.
-     * @return Server
-     */
-    public Server getServer() {
-        return server ;
-    }
-
-    /**
-     * Get the datasets associated with the server.
-     * @return returns the datasets via {@link org.apache.jena.fuseki.server.ServerConfig#datasets}
-     */
-    public List<DatasetRef> getDatasets() {
-        return serverConfig.datasets ;
-    }
-
-    /**
-     * Obtain the {@link org.apache.jena.fuseki.server.ServerConfig}
-     * @return ServerConfig
-     */
-    public ServerConfig getServerConfig() {
-        return serverConfig ;
-    }
-
-    // Later : private and in constructor.
-    private ServletContextHandler buildServer(String jettyConfig, boolean enableCompression) {
-        if ( jettyConfig != null ) {
-            // --jetty-config=jetty-fuseki.xml
-            // for detailed configuration of the server using Jetty features.
-            server = configServer(jettyConfig) ;
-        } else
-            server = defaultServerConfig(serverConfig.port, serverConfig.loopback) ;
-        // Keep the server to a maximum number of threads.
-        // server.setThreadPool(new QueuedThreadPool(ThreadPoolSize)) ;
-
-        ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS) ;
-        context.setErrorHandler(new FusekiErrorHandler()) ;
-        context.addEventListener(new FusekiServletContextListener(this));
-        
-        // Increase form size.
-        context.getServletContext().getContextHandler().setMaxFormContentSize(10 * 1000 * 1000) ;
-
-        // Wire up authentication if appropriate
-        if ( jettyConfig == null && serverConfig.authConfigFile != null ) {
-            Constraint constraint = new Constraint() ;
-            constraint.setName(Constraint.__BASIC_AUTH) ;
-            constraint.setRoles(new String[]{"fuseki"}) ;
-            constraint.setAuthenticate(true) ;
-
-            ConstraintMapping mapping = new ConstraintMapping() ;
-            mapping.setConstraint(constraint) ;
-            mapping.setPathSpec("/*") ;
-
-            IdentityService identService = new DefaultIdentityService() ;
-
-            ConstraintSecurityHandler securityHandler = new ConstraintSecurityHandler() ;
-            securityHandler.addConstraintMapping(mapping) ;
-            securityHandler.setIdentityService(identService) ;
-
-            HashLoginService loginService = new HashLoginService("Fuseki Authentication", serverConfig.authConfigFile) ;
-            loginService.setIdentityService(identService) ;
-
-            securityHandler.setLoginService(loginService) ;
-            securityHandler.setAuthenticator(new BasicAuthenticator()) ;
-
-            context.setSecurityHandler(securityHandler) ;
-
-            serverLog.debug("Basic Auth Configuration = " + serverConfig.authConfigFile) ;
-        }
-
-        // Wire up context handler to server
-        server.setHandler(context) ;
-
-        // Constants. Add RDF types.
-        MimeTypes mt = new MimeTypes() ;
-        mt.addMimeMapping("rdf", WebContent.contentTypeRDFXML + ";charset=utf-8") ;
-        mt.addMimeMapping("ttl", WebContent.contentTypeTurtle + ";charset=utf-8") ;
-        mt.addMimeMapping("nt", WebContent.contentTypeNTriples + ";charset=ascii") ;
-        mt.addMimeMapping("nq", WebContent.contentTypeNQuads + ";charset=ascii") ;
-        mt.addMimeMapping("trig", WebContent.contentTypeTriG + ";charset=utf-8") ;
-
-        // mt.addMimeMapping("tpl", "text/html;charset=utf-8") ;
-        context.setMimeTypes(mt) ;
-        server.setHandler(context) ;
-
-        serverLog.debug("Pages = " + serverConfig.pages) ;
-
-        boolean installManager = true ;
-        boolean installServices = true ;
-
-        String validationRoot = "/validate" ;
-
-        // Should all services be /_/.... or some such?
-
-        if ( installManager || installServices ) {
-            // TODO Respect port.
-            if ( serverConfig.pagesPort != serverConfig.port )
-                serverLog.warn("Not supported yet - pages on a different port to services") ;
-             if ( serverConfig.pages != null ) {
-                 if ( ! FileOps.exists(serverConfig.pages) )
-                     serverLog.warn("No pages directory - "+serverConfig.pages) ;
-                String base = serverConfig.pages ;
-                Map<String, Object> data = new HashMap<String, Object>() ;
-                data.put("mgt", new MgtFunctions()) ;
-                SimpleVelocityServlet templateEngine = new SimpleVelocityServlet(base, data) ;
-                addServlet(context, templateEngine, "*.tpl", false) ;
-             }
-        }
-
-        if ( installManager ) {
-            // Action when control panel selects a dataset.
-            HttpServlet datasetChooser = new ActionDataset() ;
-            addServlet(context, datasetChooser, PageNames.actionDatasetNames, false) ;
-        }
-
-        if ( installServices ) {
-            // Validators
-            HttpServlet validateQuery = new QueryValidator() ;
-            HttpServlet validateUpdate = new UpdateValidator() ;
-            HttpServlet validateData = new DataValidator() ;
-            HttpServlet validateIRI = new IRIValidator() ;
-
-            HttpServlet dumpService = new DumpServlet() ;
-            HttpServlet generalQueryService = new SPARQL_QueryGeneral() ;
-
-            addServlet(context, validateQuery, validationRoot + "/query", false) ;
-            addServlet(context, validateUpdate, validationRoot + "/update", false) ;
-            addServlet(context, validateData, validationRoot + "/data", false) ;
-            addServlet(context, validateIRI, validationRoot + "/iri", false) ;
-
-            // general query processor.
-            addServlet(context, generalQueryService, HttpNames.ServiceGeneralQuery, enableCompression) ;
-        }
-
-        if ( installManager || installServices ) {
-            String[] files = {"fuseki.html", "index.html"} ;
-            context.setWelcomeFiles(files) ;
-            addContent(context, "/", serverConfig.pages) ;
-        }
-
-        return context ;
-    }
-
-    /** Experimental - off by default. The überservlet sits on the dataset name and handles all requests.
-      * Includes direct naming and quad access to the dataset. 
-      */
-    public static boolean       überServlet       = false ;
-    
-    private static List<String> ListOfEmptyString = Arrays.asList("") ;
-
-    private void configureOneDataset(ServletContextHandler context, DatasetRef dsDesc, boolean enableCompression) {
-        String datasetPath = dsDesc.name ;
-        if ( datasetPath.equals("/") )
-            datasetPath = "" ;
-        else
-            if ( !datasetPath.startsWith("/") )
-                datasetPath = "/" + datasetPath ;
-
-        if ( datasetPath.endsWith("/") )
-            datasetPath = datasetPath.substring(0, datasetPath.length() - 1) ;
-
-        dsDesc.init() ;
-
-        DatasetRegistry.get().put(datasetPath, dsDesc) ;
-        serverLog.info(format("Dataset path = %s", datasetPath)) ;
-
-        HttpServlet sparqlQuery = new SPARQL_QueryDataset() ;
-        HttpServlet sparqlUpdate = new SPARQL_Update() ;
-        HttpServlet sparqlUpload = new SPARQL_Upload() ;
-        HttpServlet sparqlHttpR = new SPARQL_REST_R() ;
-        HttpServlet sparqlHttpRW = new SPARQL_REST_RW() ;
-        HttpServlet sparqlDataset = new SPARQL_UberServlet.AccessByConfig() ;
-
-        if ( !überServlet ) {
-            // If uberserver, these are unnecessary but can be used.
-            // If just means the überservlet isn't handling these operations.
-            addServlet(context, datasetPath, sparqlQuery, dsDesc.query, enableCompression) ;
-            addServlet(context, datasetPath, sparqlUpdate, dsDesc.update, false) ;
-            addServlet(context, datasetPath, sparqlUpload, dsDesc.upload, false) ; // No point - no results of any size.
-            addServlet(context, datasetPath, sparqlHttpR, dsDesc.readGraphStore, enableCompression) ;
-            addServlet(context, datasetPath, sparqlHttpRW, dsDesc.readWriteGraphStore, enableCompression) ;
-            // This adds direct operations on the dataset itself.
-            // addServlet(context, datasetPath, sparqlDataset,
-            // ListOfEmptyString, enableCompression) ;
-        } else {
-            // This is the servlet that analyses requests and dispatches them to
-            // the appropriate servlet.
-            // SPARQL Query, SPARQL Update -- handles dataset?query=
-            // dataset?update=
-            // Graph Store Protocol (direct and indirect naming) if enabled.
-            // GET/PUT/POST on the dataset itself.
-            // It also checks for a request that looks like a service request
-            // and passes it
-            // on to the service (this takes precedence over direct naming).
-            addServlet(context, datasetPath, sparqlDataset, epDataset, enableCompression) ;
-        }
-
-        // Add JMX beans to record daatset and it's services.
-        addJMX(dsDesc) ;
-    }
-
-    private static Server configServer(String jettyConfig) {
-        try {
-            serverLog.info("Jetty server config file = " + jettyConfig) ;
-            Server server = new Server() ;
-            XmlConfiguration configuration = new XmlConfiguration(new FileInputStream(jettyConfig)) ;
-            configuration.configure(server) ;
-            return server ;
-        } catch (Exception ex) {
-            serverLog.error("SPARQLServer: Failed to configure server: " + ex.getMessage(), ex) ;
-            throw new FusekiException("Failed to configure a server using configuration file '" + jettyConfig + "'") ;
-        }
-    }
-
-    private static Server defaultServerConfig(int port, boolean loopback) {
-        // Server, with one NIO-based connector, large input buffer size (for
-        // long URLs, POSTed forms (queries, updates)).
-        Server server = new Server() ;
-
-        // Using "= new SelectChannelConnector() ;" on Darwin (OS/X) causes
-        // problems
-        // with initialization not seen (thread scheduling?) in Joseki.
-
-        // BlockingChannelConnector is better for pumping large responses back
-        // but there have been observed problems with DirectMemory allocation
-        // (-XX:MaxDirectMemorySize=1G does not help)
-        // Connector connector = new SelectChannelConnector() ;
-
-        // Connector and specific settings.
-        BlockingChannelConnector bcConnector = new BlockingChannelConnector() ;
-        // bcConnector.setUseDirectBuffers(false) ;
-
-        Connector connector = bcConnector ;
-        // Ignore. If set, then if this goes off, it keeps going off
-        // and you get a lot of log messages.
-        connector.setMaxIdleTime(0) ; // Jetty outputs a lot of messages if this
-                                      // goes off.
-        if ( loopback )
-            connector.setHost("localhost");
-        connector.setPort(port) ;
-        // Some people do try very large operations ...
-        connector.setRequestHeaderSize(64 * 1024) ;
-        connector.setRequestBufferSize(5 * 1024 * 1024) ;
-        connector.setResponseBufferSize(5 * 1024 * 1024) ;
-        server.addConnector(connector) ;
-        return server ;
-    }
-
-    private static void addContent(ServletContextHandler context, String pathSpec, String pages) {
-        DefaultServlet staticServlet = new DefaultServlet() ;
-        ServletHolder staticContent = new ServletHolder(staticServlet) ;
-        staticContent.setInitParameter("resourceBase", pages) ;
-
-        // Note we set GZip to false for static content because the Jetty
-        // DefaultServlet has
-        // a built-in GZip capability that is better for static content than the
-        // mechanism the
-        // GzipFilter uses for dynamic content
-        addServlet(context, staticContent, pathSpec, false) ;
-    }
-
-    private void addServlet(ServletContextHandler context, String datasetPath, HttpServlet servlet,
-                            ServiceRef serviceRef, boolean enableCompression) {
-        addServlet(context, datasetPath, servlet, serviceRef.endpoints, enableCompression) ;
-    }
-
-    // SHARE
-    private static void addServlet(ServletContextHandler context, String datasetPath, HttpServlet servlet,
-                                   List<String> pathSpecs, boolean enableCompression) {
-        for (String pathSpec : pathSpecs) {
-            if ( pathSpec.equals("") ) {
-                // "" is special -- add as "base" and "base/"
-                addServlet(context, servlet, datasetPath + "/", enableCompression) ;
-                addServlet(context, servlet, datasetPath, enableCompression) ;
-                continue ;
-            }
-
-            if ( pathSpec.endsWith("/") )
-                pathSpec = pathSpec.substring(0, pathSpec.length() - 1) ;
-            if ( pathSpec.startsWith("/") )
-                pathSpec = pathSpec.substring(1, pathSpec.length()) ;
-            addServlet(context, servlet, datasetPath + "/" + pathSpec, enableCompression) ;
-        }
-    }
-
-    private static void addServlet(ServletContextHandler context, HttpServlet servlet, String pathSpec,
-                                   boolean enableCompression) {
-        ServletHolder holder = new ServletHolder(servlet) ;
-        addServlet(context, holder, pathSpec, enableCompression) ;
-    }
-
-    private static void addServlet(ServletContextHandler context, ServletHolder holder, String pathSpec,
-                                   boolean enableCompression) {
-        if ( serverLog.isDebugEnabled() ) {
-            if ( enableCompression )
-                serverLog.debug("Add servlet @ " + pathSpec + " (with gzip)") ;
-            else
-                serverLog.debug("Add servlet @ " + pathSpec) ;
-        }
-        context.addServlet(holder, pathSpec) ;
-
-        if ( enableCompression )
-            context.addFilter(GzipFilter.class, pathSpec, EnumSet.allOf(DispatcherType.class)) ;
-    }
-
-    private void addJMX() {
-        DatasetRegistry registry = DatasetRegistry.get() ;
-        for (String ds : registry.keys()) {
-            DatasetRef dsRef = registry.get(ds) ;
-            addJMX(dsRef) ;
-        }
-    }
-
-    private void addJMX(DatasetRef dsRef) {
-        String x = dsRef.name ;
-        // if ( x.startsWith("/") )
-        // x = x.substring(1) ;
-        ARQMgt.register(Fuseki.PATH + ".dataset:name=" + x, dsRef) ;
-        // For all endpoints
-        for (ServiceRef sRef : dsRef.getServiceRefs()) {
-            ARQMgt.register(Fuseki.PATH + ".dataset:name=" + x + "/" + sRef.name, sRef) ;
-        }
-    }
-
-    private void removeJMX() {
-        DatasetRegistry registry = DatasetRegistry.get() ;
-        for (String ds : registry.keys()) {
-            DatasetRef ref = registry.get(ds) ;
-        }
-    }
-
-    private void removeJMX(DatasetRef dsRef) {
-        String x = dsRef.getName() ;
-        ARQMgt.unregister(Fuseki.PATH + ".dataset:name=" + x) ;
-        for (ServiceRef sRef : dsRef.getServiceRefs()) {
-            ARQMgt.unregister(Fuseki.PATH + ".dataset:name=" + x + "/" + sRef.name) ;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/ServerConfig.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/ServerConfig.java b/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/ServerConfig.java
deleted file mode 100644
index 4e0b865..0000000
--- a/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/ServerConfig.java
+++ /dev/null
@@ -1,55 +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.fuseki.server;
-
-import java.util.List ;
-
-/** This represents a configuration of a SPARQL server.
- */
-
-public class ServerConfig
-{
-    public ServerConfig() {}
-    
-    /** Port to run the server service on */
-    public int port ;
-    /** Port for the management interface : -1 for no management interface */ 
-    public int mgtPort ;
-    /** Port for the pages UI : this can be the same as the services port. */ 
-    public int pagesPort ;
-    /** Jetty config file - if null, use the built-in configuration of Jetty */
-    public String jettyConfigFile = null ;
-    /** Listen only on the loopback (localhost) interface */
-    public boolean loopback = false ;
-    /** The local directory for serving the static pages */ 
-    public String pages ;
-    /** The list of datasets */
-    public List<DatasetRef> datasets ;
-    /** Enable Accept-Encoding compression. Set to false by default.*/
-    public boolean enableCompression = false ;
-    
-    /** Enable additional logging */
-    public boolean verboseLogging = false ;
-    /**
-     * Authentication config file used to setup Jetty Basic auth, if a Jetty config file was set this is ignored since Jetty config allows much more complex auth methods to be implemented
-     */
-    public String authConfigFile ;
-
-}
-

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/ServiceMXBean.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/ServiceMXBean.java b/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/ServiceMXBean.java
deleted file mode 100644
index 11c7330..0000000
--- a/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/ServiceMXBean.java
+++ /dev/null
@@ -1,32 +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.fuseki.server;
-
-public interface ServiceMXBean
-{
-    String getName() ;
-    
-    long getRequests() ;
-    long getRequestsGood() ;
-    long getRequestsBad() ;
-    
-//    void enable() ;
-//    void disable() ;
-}
-

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/ServiceRef.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/ServiceRef.java b/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/ServiceRef.java
deleted file mode 100644
index 6236050..0000000
--- a/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/ServiceRef.java
+++ /dev/null
@@ -1,63 +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.fuseki.server;
-
-import java.util.ArrayList ;
-import java.util.List ;
-
-/** Configuration of an individual service */
-public class ServiceRef implements ServiceMXBean, Counters
-{
-    public final String name ;
-    
-    // Service-level counters.
-    private final CounterSet counters           = new CounterSet() ;
-    @Override
-    public  CounterSet getCounters() { return counters ; }
-
-    /** Endpoints (as absolute path URLs) */
-    public List<String> endpoints               = new ArrayList<String>() ;
-    
-    // Attach counters to services or datasets 
-    // Can we have a counter of the same name on different services?
-    // Cost : number of maps.
-    // +ve: Multiple services with the same name counter
-    
-    public ServiceRef(String serviceName) {
-        this.name = serviceName ;
-    }
-    
-    public boolean isActive() { return endpoints.isEmpty() ; }
-
-    @Override
-    public String getName()     { return name ; }
-
-    @Override public long getRequests() { 
-        return counters.value(CounterName.Requests) ;
-    }
-    @Override
-    public long getRequestsGood() {
-        return counters.value(CounterName.RequestsGood) ;
-    }
-    @Override
-    public long getRequestsBad() {
-        return counters.value(CounterName.RequestsBad) ;
-    }
-}
-

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/ActionErrorException.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/ActionErrorException.java b/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/ActionErrorException.java
deleted file mode 100644
index 6c5ebe9..0000000
--- a/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/ActionErrorException.java
+++ /dev/null
@@ -1,32 +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.fuseki.servlets;
-
-class ActionErrorException extends RuntimeException
-{
-    final Throwable exception ;
-    final String message ;
-    final int rc ;
-    ActionErrorException(Throwable ex, String message, int rc)
-    {
-        this.exception = ex ;
-        this.message = message ;
-        this.rc = rc ;
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/ConcurrencyPolicyMRSW.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/ConcurrencyPolicyMRSW.java b/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/ConcurrencyPolicyMRSW.java
deleted file mode 100644
index 259453d..0000000
--- a/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/ConcurrencyPolicyMRSW.java
+++ /dev/null
@@ -1,113 +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.fuseki.servlets;
-
-import java.util.ConcurrentModificationException ;
-import java.util.concurrent.atomic.AtomicLong ;
-
-import org.apache.jena.fuseki.Fuseki ;
-import org.slf4j.Logger ;
-
-public final class ConcurrencyPolicyMRSW
-{
-    static private Logger log = Fuseki.requestLog ; //org.slf4j.LoggerFactory.getLogger(ConcurrencyPolicyMRSW.class) ;
-    static private final boolean logging = false ; //log.isDebugEnabled() ;
-    
-    // This is a simplified version of ConcurrencyPolicyMRSW from TDB. 
-    private final AtomicLong readCounter = new AtomicLong(0) ;
-    private final AtomicLong writeCounter = new AtomicLong(0) ;
-    static private final AtomicLong policyCounter = new AtomicLong(0) ;
-
-    public ConcurrencyPolicyMRSW()
-    { policyCounter.incrementAndGet() ; }
-
-    // Loggin -inside the operation.
-    
-    //@Override
-    public void startRead()
-    {
-        readCounter.getAndIncrement() ;
-        log() ;
-        checkConcurrency() ;
-    }
-
-    //@Override
-    public void finishRead()
-    {
-        log() ;
-        readCounter.decrementAndGet() ;
-        checkConcurrency() ;
-    }
-
-    //@Override
-    public void startUpdate()
-    {
-        writeCounter.getAndIncrement() ;
-        log() ;
-        checkConcurrency() ;
-    }
-
-    //@Override
-    public void finishUpdate()
-    {
-        log() ;
-        writeCounter.decrementAndGet() ;
-        checkConcurrency() ;
-    }
-
-    private synchronized void checkConcurrency()
-    {
-        long R = readCounter.get() ;
-        long W = writeCounter.get() ;
-        long id = policyCounter.get();
-        if ( R > 0 && W > 0 )
-            policyError(id, R, W) ;
-        if ( W > 1 )
-            policyError(id, R, W) ;
-    }
-
-    private void log()
-    {
-        if ( ! logging ) 
-            return ;
-        long R , W , id ;
-        synchronized(this)
-        {
-            R = readCounter.get() ;
-            W = writeCounter.get() ;
-            id = policyCounter.get();
-        }
-        log.info(format(id, R, W)) ;
-    }
-    
-    private static void policyError(long id, long R, long W)
-    {
-        policyError(format(id, R, W)) ;
-    }
-
-    private static void policyError(String message)
-    {
-        throw new ConcurrentModificationException(message) ;
-    }
-    
-    private static String format(long id, long R, long W)
-    {
-        return String.format("(lock=%d) Reader = %d, Writer = %d", id, R, W) ;
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/DumpServlet.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/DumpServlet.java b/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/DumpServlet.java
deleted file mode 100644
index 7ece249..0000000
--- a/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/DumpServlet.java
+++ /dev/null
@@ -1,313 +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.
- */
-
-/** A servlet that dumps its request
- */
-
-// Could be neater - much, much neater!
-package org.apache.jena.fuseki.servlets;
-
-import java.io.BufferedReader ;
-import java.io.IOException ;
-import java.io.PrintWriter ;
-import java.io.StringWriter ;
-import java.util.Date ;
-import java.util.Enumeration ;
-import java.util.Locale ;
-import java.util.Properties ;
-
-import javax.servlet.ServletContext ;
-import javax.servlet.http.Cookie ;
-import javax.servlet.http.HttpServlet ;
-import javax.servlet.http.HttpServletRequest ;
-import javax.servlet.http.HttpServletResponse ;
-
-public class DumpServlet extends HttpServlet
-{
-    private static final long serialVersionUID = 99L;  // Serilizable.
-
-
-    public DumpServlet()
-    {
-
-    }
-
-    @Override
-    public void init()
-    {
-        return ;
-    }
-
-    @Override
-    public void doGet(HttpServletRequest req, HttpServletResponse resp)
-    {
-        try {
-            PrintWriter out = resp.getWriter() ;
-            resp.setContentType("text/html");
-
-            String now = new Date().toString() ;
-
-            // HEAD
-            out.println("<html>") ;
-            out.println("<head>") ;
-            out.println("<Title>Dump @ "+now+"</Title>") ;
-            // Reduce the desire to cache it.
-            out.println("<meta CONTENT=now HTTP-EQUIV=expires>") ;
-            out.println("</head>") ;
-
-            // BODY
-            out.println("<body>") ;
-            out.println("<pre>") ;
-
-            out.println("Dump : "+now);
-            out.println() ;
-            out.println("==== Request");
-            out.println() ;
-            out.print(dumpRequest(req)) ;
-            out.println() ;
-                        
-            out.println(">>>> Body");
-            out.println() ;
-            printBody(out, req) ;
-            out.println("<<<< Body");
-            
-            out.println("==== ServletContext");
-            out.println() ;
-            out.print(dumpServletContext());
-            out.println() ;
-
-            out.println("==== Environment");
-            out.println() ;
-            out.print(dumpEnvironment());
-            out.println() ;
-
-            out.println("</pre>") ;
-
-            out.println("</body>") ;
-            out.println("</html>") ;
-            out.flush() ;
-        } catch (IOException e)
-        { }
-    }
-
-    // This resets the input stream
-
-    static public String dumpRequest(HttpServletRequest req)
-    { 
-         StringWriter sw = new StringWriter() ;
-         try( PrintWriter pw = new PrintWriter(sw) ) {
-            // Standard environment
-            pw.println("Method:                 "+req.getMethod());
-            pw.println("getContentLength:       "+Integer.toString(req.getContentLength()));
-            pw.println("getContentType:         "+req.getContentType());
-            pw.println("getRequestURI:          "+req.getRequestURI());
-            pw.println("getRequestURL:          "+req.getRequestURL());
-            pw.println("getContextPath:         "+req.getContextPath());
-            pw.println("getServletPath:         "+req.getServletPath());
-            pw.println("getPathInfo:            "+req.getPathInfo());
-            pw.println("getPathTranslated:      "+req.getPathTranslated());
-            pw.println("getQueryString:         "+req.getQueryString());
-            pw.println("getProtocol:            "+req.getProtocol());
-            pw.println("getScheme:              "+req.getScheme());
-            pw.println("getServerName:          "+req.getServerName());
-            pw.println("getServerPort:          "+req.getServerPort());
-            pw.println("getRemoteUser:          "+req.getRemoteUser());
-            pw.println("getRemoteAddr:          "+req.getRemoteAddr());
-            pw.println("getRemoteHost:          "+req.getRemoteHost());
-            pw.println("getRequestedSessionId:  "+req.getRequestedSessionId());
-            {
-                Cookie c[] = req.getCookies() ;
-                if ( c == null )
-                    pw.println("getCookies:            <none>");
-                else
-                {
-                    for ( Cookie aC : c )
-                    {
-                        pw.println( "Cookie:        " + aC.getName() );
-                        pw.println( "    value:     " + aC.getValue() );
-                        pw.println( "    version:   " + aC.getVersion() );
-                        pw.println( "    comment:   " + aC.getComment() );
-                        pw.println( "    domain:    " + aC.getDomain() );
-                        pw.println( "    maxAge:    " + aC.getMaxAge() );
-                        pw.println( "    path:      " + aC.getPath() );
-                        pw.println( "    secure:    " + aC.getSecure() );
-                        pw.println();
-                    }
-                }
-            }
-            
-            {
-                // To do: create a string for the output so can send to console and return it.
-                Enumeration<String> en = req.getHeaderNames() ;
-
-                for ( ; en.hasMoreElements() ; )
-                {
-                    String name = en.nextElement() ;
-                    String value = req.getHeader(name) ;
-                    pw.println("Head: "+name + " = " + value) ;
-                }
-            }
-            
-            Enumeration<String> en2 = req.getAttributeNames() ;
-            if ( en2.hasMoreElements() )
-                pw.println();
-            for ( ; en2.hasMoreElements() ; )
-            {
-                String name = en2.nextElement() ;
-                String value = req.getAttribute(name).toString() ;
-                pw.println("Attr: "+name + " = " + value) ;
-            }
-
-            // Note that doing this on a form causes the forms content (body) to be read
-            // and parsed as form variables.
-//            en = req.getParameterNames() ;
-//            if ( en.hasMoreElements() )
-//                pw.println();
-//            for ( ; en.hasMoreElements() ; )
-//            {
-//                String name = (String)en.nextElement() ;
-//                String value = req.getParameter(name) ;
-//                pw.println("Param: "+name + " = " + value) ;
-//            }
-
-
-            
-//            MultiMap<String, String> map = WebLib.parseQueryString(req) ;
-//            for ( String name : map.keys() )
-//                for ( String value : map.get(name) )
-//                    pw.println("Param: "+name + " = " + value) ;
-            
-            Enumeration<Locale> en = req.getLocales() ;
-            if ( en.hasMoreElements() )
-                pw.println();
-            for ( ; en.hasMoreElements() ; )
-            {
-                String name = en.nextElement().toString() ;
-                pw.println("Locale: "+name) ;
-            }
-
-            pw.println() ;
-            pw.flush();
-            //printBody(pw, req) ;
-            return sw.toString() ;
-        }
-         
-    }
-
-    static void printBody(PrintWriter pw, HttpServletRequest req) throws IOException
-    {
-        BufferedReader in = req.getReader() ;
-        if ( req.getContentLength() > 0 )
-            // Need +2 because last line may not have a CR/LF on it.
-            in.mark(req.getContentLength()+2) ;
-        else
-            // This is a dump - try to do something that works, even if inefficient.
-            in.mark(100*1024) ;
-
-        while(true)
-        {
-            String x = in.readLine() ;
-            if ( x == null )
-                break ;
-            x = x.replaceAll("&", "&amp;") ;
-            x = x.replaceAll("<", "&lt;") ;
-            x = x.replaceAll(">", "&gt;") ;
-            pw.println(x) ;
-        }
-        try { in.reset() ;} catch (IOException e) { System.out.println("DumpServlet: Reset of content failed: "+e) ; }
-    }
-    
-    /**
-     * <code>dumpEnvironment</code>
-     * @return String that is the HTML of the System properties as name/value pairs.
-     * The values are with single quotes independent of whether or not the value has
-     * single quotes in it.
-     */
-    static public String dumpEnvironment()
-    {
-        Properties properties = System.getProperties();
-
-        StringWriter sw = new StringWriter() ;
-        try(PrintWriter pw = new PrintWriter(sw) ) {
-            Enumeration<Object> en = properties.keys();
-            while(en.hasMoreElements())
-            {
-                String key = en.nextElement().toString();
-                pw.println(key+": '"+properties.getProperty(key)+"'");
-            }
-            pw.println() ;
-            pw.flush() ;
-            return sw.toString() ; 
-        }
-    }
-
-    public String dumpServletContext()
-    {
-        StringWriter sw = new StringWriter() ;
-        try(PrintWriter pw = new PrintWriter(sw)) {
-
-            ServletContext sc =  getServletContext();
-            pw.println("majorVersion: '"+sc.getMajorVersion()+"'");
-            pw.println("minorVersion: '"+sc.getMinorVersion()+"'");
-            pw.println("contextName:  '"+sc.getServletContextName()+"'");
-            pw.println("servletInfo:  '"+getServletInfo()+"'");
-            pw.println("serverInfo:  '"+sc.getServerInfo()+"'");
-
-            {
-                Enumeration<String> en = sc.getInitParameterNames();
-                if (en != null) {
-                    pw.println("initParameters: ");
-                    while(en.hasMoreElements())
-                    {
-                        String key = en.nextElement();
-                        pw.println(key+": '"+sc.getInitParameter(key)+"'");
-                    }
-                }
-            }
-
-            {
-                Enumeration<String> en = sc.getAttributeNames();
-                if (en != null) {
-                    pw.println("attributes: ");
-                    while(en.hasMoreElements())
-                    {
-                        String key = en.nextElement();
-                        pw.println(key+": '"+sc.getAttribute(key)+"'");
-                    }
-                }
-            }
-            pw.println() ;
-            pw.close() ;
-        }
-        return sw.toString() ;      
-    }
-
-    
-    @Override
-    public void doPost(HttpServletRequest req, HttpServletResponse resp)
-    {
-        doGet(req, resp) ;
-    }
-
-
-    @Override
-    public String getServletInfo()
-    {
-        return "Dump";
-    }
-}


[22/23] jena git commit: Rename artifact jena-fuseki as jena-fuseki1

Posted by an...@apache.org.
Rename artifact jena-fuseki as jena-fuseki1


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

Branch: refs/heads/master
Commit: 6f32e5935c0d29a4601af1acbcda1cc188502594
Parents: 662cf71
Author: Andy Seaborne <an...@apache.org>
Authored: Thu Mar 5 15:06:09 2015 +0000
Committer: Andy Seaborne <an...@apache.org>
Committed: Thu Mar 5 15:06:09 2015 +0000

----------------------------------------------------------------------
 jena-fuseki1/pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/6f32e593/jena-fuseki1/pom.xml
----------------------------------------------------------------------
diff --git a/jena-fuseki1/pom.xml b/jena-fuseki1/pom.xml
index c1d19d3..2e7805a 100644
--- a/jena-fuseki1/pom.xml
+++ b/jena-fuseki1/pom.xml
@@ -18,7 +18,7 @@
 
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
   <modelVersion>4.0.0</modelVersion>
-  <artifactId>jena-fuseki</artifactId>
+  <artifactId>jena-fuseki1</artifactId>
   <packaging>jar</packaging>
   <name>Apache Jena - Fuseki1 (SPARQL 1.1 Server)</name>
   <version>1.1.2-SNAPSHOT</version>


[08/23] jena git commit: Rename folder jena-fuseki to jena-fuseki1

Posted by an...@apache.org.
http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/s-head
----------------------------------------------------------------------
diff --git a/jena-fuseki1/s-head b/jena-fuseki1/s-head
new file mode 100755
index 0000000..4f6590d
--- /dev/null
+++ b/jena-fuseki1/s-head
@@ -0,0 +1,713 @@
+#!/usr/bin/env ruby
+# -*- coding: utf-8 -*-
+
+# 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.
+
+# SPARQL HTTP Update, client.
+
+require 'optparse'
+require 'net/http'
+require 'uri'
+require 'cgi'
+require 'pp'
+require 'ostruct'
+
+# ToDo
+#  Allow a choice of media type for GET
+#   --accept "content-type" (and abbreviations)
+#   --header "Add:this"
+#   --user, --password
+#  Basic authentication: request.basic_auth("username", "password")
+#  Follow redirects => 301:  puts response["location"] # All headers are lowercase?
+
+SOH_NAME="SOH"
+SOH_VERSION="0.0.0"
+
+$proxy = ENV['http_proxy'] ? URI.parse(ENV['http_proxy']) : OpenStruct.new  
+
+# What about direct naming?
+
+# Names
+$mtTurtle           = 'text/turtle;charset=utf-8'
+$mtRDF              = 'application/rdf+xml'
+$mtText             = 'text/plain'
+$mtNTriples         = 'application/n-triples'
+$mtNQuads           = 'application/n-quads'
+$mtJSONLD           = 'application/ld+json'
+$mtTriG             = 'application/trig'
+$mtSparqlResultsX   = 'application/sparql-results+xml'
+$mtSparqlResultsJ   = 'application/sparql-results+json'
+$mtAppJSON          = 'application/json'
+$mtAppXML           = 'application/xml'
+$mtSparqlResultsTSV = 'application/sparql-results+tsv'
+$mtSparqlResultsCSV = 'application/sparql-results+csv'
+$mtSparqlUpdate     = 'application/sparql-update'
+$mtWWWForm          = 'application/x-www-form-urlencoded'
+$mtSparqlQuery      = "application/sparql-query" ;
+
+# Global media type table.
+$fileMediaTypes = {}
+$fileMediaTypes['ttl']   = $mtTurtle
+$fileMediaTypes['n3']    = 'text/n3; charset=utf-8'
+$fileMediaTypes['nt']    = $mtText
+$fileMediaTypes['rdf']   = $mtRDF
+$fileMediaTypes['owl']   = $mtRDF
+$fileMediaTypes['nq']    = $mtNQuads
+$fileMediaTypes['trig']  = $mtTriG
+$fileMediaTypes['json-ld']  = $mtJSONLD
+$fileMediaTypes['jsonld']  = $mtJSONLD
+
+# Global charset : no entry means "don't set"
+$charsetUTF8      = 'utf-8'
+$charset = {}
+$charset[$mtTurtle]   = 'utf-8'
+$charset[$mtText]     = 'ascii'
+$charset[$mtTriG]     = 'utf-8'
+$charset[$mtNQuads]   = 'utf-8'
+
+# Headers
+
+$hContentType         = 'Content-Type'
+# $hContentEncoding     = 'Content-Encoding'
+$hContentLength       = 'Content-Length'
+# $hContentLocation     = 'Content-Location'
+# $hContentRange        = 'Content-Range'
+
+$hAccept              = 'Accept'
+$hAcceptCharset       = 'Accept-Charset'
+$hAcceptEncoding      = 'Accept-Encoding'
+$hAcceptRanges        = 'Accept-Ranges' 
+
+$headers = { "User-Agent" => "#{SOH_NAME}/Fuseki #{SOH_VERSION}"}
+$print_http = false
+
+# Default for GET
+# At least allow anything (and hope!)
+$accept_rdf="#{$mtTurtle} , #{$mtNTriples};q=0.9 , #{$mtRDF};q=0.8 , #{$mtJSONLD};q=0.5"
+# Datasets
+$accept_ds="#{$mtTrig} , #{$mtNQuads};q=0.9 , #{$mtJSONLD};q=0.5"
+# For SPARQL query
+$accept_results="#{$mtSparqlResultsJ} , #{$mtSparqlResultsX};q=0.9 , #{$accept_rdf}"
+
+# Accept any in case of trouble.
+$accept_rdf="#{$accept_rdf} , */*;q=0.1"
+$accept_results="#{$accept_results} , */*;q=0.1" 
+
+# The media type usually forces the charset.
+$accept_charset=nil
+
+## Who we are.
+## Two styles:
+##    s-query .....
+##    soh query .....
+
+$cmd = File.basename($0)
+if $cmd == 'soh'
+then
+  $cmd = (ARGV.size == 0) ? 'soh' : ARGV.shift
+end
+
+if ! $cmd.start_with?('s-') && $cmd != 'soh'
+  $cmd = 's-'+$cmd
+end
+
+## -------- 
+
+def GET(dataset, graph)
+  print "GET #{dataset} #{graph}\n" if $verbose
+  requestURI = target(dataset, graph)
+  headers = {}
+  headers.merge!($headers)
+  headers[$hAccept] = $accept_rdf
+  headers[$hAcceptCharset] = $accept_charset unless $accept_charset.nil?
+  get_worker(requestURI, headers)
+end
+
+def get_worker(requestURI, headers)
+  uri = URI.parse(requestURI)
+  request = Net::HTTP::Get.new(uri.request_uri)
+  request.initialize_http_header(headers)
+  print_http_request(uri, request)
+  response_print_body(uri, request)
+end
+
+def HEAD(dataset, graph)
+  print "HEAD #{dataset} #{graph}\n" if $verbose
+  requestURI = target(dataset, graph)
+  headers = {}
+  headers.merge!($headers)
+  headers[$hAccept] = $accept_rdf
+  headers[$hAcceptCharset] = $accept_charset unless $accept_charset.nil?
+  uri = URI.parse(requestURI)
+  request = Net::HTTP::Head.new(uri.request_uri)
+  request.initialize_http_header(headers)
+  print_http_request(uri, request)
+  response_no_body(uri, request)
+end
+
+def PUT(dataset, graph, file)
+  print "PUT #{dataset} #{graph} #{file}\n" if $verbose
+  send_body(dataset, graph, file, Net::HTTP::Put)
+end
+
+def POST(dataset, graph, file)
+  print "POST #{dataset} #{graph} #{file}\n" if $verbose
+  send_body(dataset, graph, file, Net::HTTP::Post)
+end
+
+def DELETE(dataset, graph)
+  print "DELETE #{dataset} #{graph}\n" if $verbose
+  requestURI = target(dataset, graph)
+  uri = URI.parse(requestURI)
+  request = Net::HTTP::Delete.new(uri.request_uri)
+  headers = {}
+  headers.merge!($headers)
+  request.initialize_http_header(headers)
+  print_http_request(uri, request)
+  response_no_body(uri, request)
+end
+
+def uri_escape(string)
+  CGI.escape(string)
+end
+
+def target(dataset, graph)
+  return dataset+"?default" if graph == "default"
+  return dataset+"?graph="+uri_escape(graph)
+end
+
+def send_body(dataset, graph, file, method)
+  mt = content_type(file)
+  headers = {}
+  headers.merge!($headers)
+  headers[$hContentType] = mt
+  headers[$hContentLength] = File.size(file).to_s
+  ## p headers
+
+  requestURI = target(dataset, graph)
+  uri = URI.parse(requestURI)
+  
+  request = method.new(uri.request_uri)
+  request.initialize_http_header(headers)
+  print_http_request(uri, request)
+  request.body_stream = File.open(file)
+  response_no_body(uri, request)
+end
+
+def response_no_body(uri, request)
+  http = Net::HTTP::Proxy($proxy.host,$proxy.port).new(uri.host, uri.port)
+  http.read_timeout = nil
+  # check we can connect.
+  begin http.start
+  rescue Exception => e  
+    # puts e.message  
+    #puts e.backtrace.inspect  
+    warn_exit "Failed to connect: #{uri.host}:#{uri.port}: #{e.message}", 3
+  end
+  response = http.request(request)
+  print_http_response(response)
+  case response
+  when Net::HTTPSuccess, Net::HTTPRedirection
+    # OK
+  when Net::HTTPNotFound
+    warn_exit "404 Not found: #{uri}", 9
+    #print response.body
+  else
+    warn_exit "#{response.code} #{response.message} #{uri}", 9
+    # Unreachable
+      response.error!
+  end
+  # NO BODY IN RESPONSE
+end
+
+def response_print_body(uri, request)
+  http = Net::HTTP::Proxy($proxy.host,$proxy.port).new(uri.host, uri.port)
+  http.read_timeout = nil
+  # check we can connect.
+  begin http.start
+  rescue => e  
+    #puts e.backtrace.inspect  
+    #print e.class
+    warn_exit "Failed to connect: #{uri.host}:#{uri.port}: #{e.message}", 3
+  end
+
+  # Add a blank line if headers were output.
+  print "\n" if $http_print ;
+
+  begin
+    response = http.request(request) { |res| 
+      print_http_response(res)
+      #puts res.code
+      res.read_body do |segment|
+        print segment
+      end
+    }
+    case response
+    when Net::HTTPSuccess, Net::HTTPRedirection
+      # OK
+    when Net::HTTPNotFound
+      warn_exit "404 Not found: #{uri}", 9
+      #print response.body
+    else
+      warn_exit "#{response.code}: #{uri}", 9
+      # Unreachable
+      response.error!
+    end
+  rescue EOFError => e
+    warn_exit "IO Error: "+e.message, 3
+  end
+end
+
+def print_http_request(uri, request)
+  return unless $print_http
+  #print "Request\n"
+  print request.method," ",uri, "\n"
+  print_headers("  ",request)
+end
+
+def print_http_response(response)
+  return unless $print_http
+  #print "Response\n"
+  print response.code, " ", response.message, "\n"
+  print_headers("  ",response)
+end
+
+def print_headers(marker, headers)
+  headers.each do |k,v| 
+    k = k.split('-').map{|w| w.capitalize}.join('-')+':'
+    printf "%s%-20s %s\n",marker,k,v
+  end
+end
+
+def content_type(file)
+  file =~ /\.([^.]*)$/
+  ext = $1
+  mt = $fileMediaTypes[ext]
+  cs = $charset[mt]
+  mt = mt+';charset='+cs if ! cs.nil?
+  return mt
+end
+
+def charset(content_type)
+  return $charset[content_type]
+end
+
+def warn_exit(msg, rc)
+    warn msg
+    exit rc ;
+end
+
+def parseURI(uri_string)
+  begin
+    return URI.parse(uri_string).to_s
+  rescue URI::InvalidURIError => err
+    warn_exit "Bad URI: <#{uri_string}>", 2
+  end
+end
+
+## ---- Command
+
+def cmd_soh(command=nil)
+  ## Command line
+  options = {}
+  optparse = OptionParser.new do |opts|
+    # Set a banner, displayed at the top
+    # of the help screen.
+    case $cmd
+    when "s-http", "sparql-http", "soh"
+      banner="$cmd [get|post|put|delete] datasetURI graph [file]"
+    when "s-get", "s-head", "s-delete"
+      banner="$cmd  datasetURI graph"
+    end
+
+    opts.banner = $banner
+    # Define the options, and what they do
+    
+    options[:verbose] = false
+    opts.on( '-v', '--verbose', 'Verbose' ) do
+      options[:verbose] = true
+    end
+    
+    options[:version] = false
+    opts.on( '--version', 'Print version and exit' ) do
+      print "#{SOH_NAME} #{SOH_VERSION}\n"
+      exit
+    end
+    
+    # This displays the help screen, all programs are
+    # assumed to have this option.
+    opts.on( '-h', '--help', 'Display this screen and exit' ) do
+      puts opts
+      exit
+    end
+  end
+
+  begin optparse.parse!    
+  rescue OptionParser::InvalidArgument => e
+    warn e
+    exit
+  end
+
+  $verbose = options[:verbose]
+  $print_http = $verbose
+
+  if command.nil?
+    if ARGV.size == 0
+      warn "No command given: expected one of 'get', 'put', 'post', 'delete', 'query' or 'update'"
+      exit 1
+    end
+    cmdPrint=ARGV.shift
+    command=cmdPrint.upcase
+  else
+    cmdPrint=command
+  end
+
+  case command
+  when "HEAD", "GET", "DELETE"
+    requiredFile=false
+  when "PUT", "POST"
+    requiredFile=true
+  when "QUERY"
+    cmd_sparql_query
+  when "UPDATE"
+    cmd_sparql_update
+  else
+    warn_exit "Unknown command: #{command}", 2
+  end
+
+  if requiredFile 
+  then
+    if ARGV.size != 3
+      warn_exit "Required: dataset URI, graph URI (or 'default') and file", 1 
+    end
+  else
+    if ARGV.size != 2
+      warn_exit "Required: dataset URI and graph URI (or 'default')", 1 
+    end
+  end
+
+  dataset=parseURI(ARGV.shift)
+  # Relative URI?
+  graph=parseURI(ARGV.shift)
+  file=""
+  if requiredFile
+  then
+    file = ARGV.shift if requiredFile
+    if ! File.exist?(file)
+      warn_exit "No such file: "+file, 3
+    end
+    if File.directory?(file)
+      warn_exit "File is a directory: "+file, 3
+    end
+  end
+
+  case command
+  when "GET"
+    GET(dataset, graph)
+  when "HEAD"
+    HEAD(dataset, graph)
+  when "PUT"
+    PUT(dataset, graph, file)
+  when "DELETE"
+    DELETE(dataset, graph)
+  when "POST"
+    POST(dataset, graph, file)
+  else
+    warn_exit "Internal error: Unknown command: #{cmd}", 2
+  end
+  exit 0
+end
+
+## --------
+def string_or_file(arg)
+  return arg if ! arg.match(/^@/)
+  a=(arg[1..-1])
+  open(a, 'rb'){|f| f.read}
+end
+
+## -------- SPARQL Query
+
+## Choose method
+def SPARQL_query(service, query, query_file, forcePOST=false, args2={})
+   if ! query_file.nil?
+    query = open(query_file, 'rb'){|f| f.read}
+  end
+  if forcePOST || query.length >= 2*1024 
+    SPARQL_query_POST(service, query, args2)
+  else
+    SPARQL_query_GET(service, query, args2)
+  end
+end
+
+## By GET
+
+def SPARQL_query_GET(service, query, args2)
+  args = { "query" => query }
+  args.merge!(args2)
+  qs=args.collect { |k,v| "#{k}=#{uri_escape(v)}" }.join('&')
+  action="#{service}?#{qs}"
+  headers={}
+  headers.merge!($headers)
+  headers[$hAccept]=$accept_results
+  get_worker(action, headers)
+end
+
+## By POST
+
+def SPARQL_query_POST(service, query, args2)
+  # DRY - body/no body for each of request and response.
+  post_params={ "query" => query }
+  post_params.merge!(args2)
+  uri = URI.parse(service)
+  headers={}
+  headers.merge!($headers)
+  headers[$hAccept]=$accept_results
+  execute_post_form_body(uri, headers, post_params)
+end
+
+def execute_post_form_body(uri, headers, post_params)
+  request = Net::HTTP::Post.new(uri.request_uri)
+  qs=post_params.collect { |k,v| "#{k}=#{uri_escape(v)}" }.join('&')
+  headers[$hContentType] = $mtWWWForm
+  headers[$hContentLength] = qs.length.to_s
+  request.initialize_http_header(headers)
+  request.body = qs
+  print_http_request(uri, request)
+  response_print_body(uri, request)
+end
+
+# Usage: -v --help --file= --query=
+def cmd_sparql_query
+  options={}
+  optparse = OptionParser.new do |opts|
+    opts.banner = "Usage: #{$cmd} [--query QUERY] [--service URI] [--post] 'query' | @file"
+    opts.on('--service=URI', '--server=URI', 'SPARQL endpoint') do |uri|
+      options[:service]=uri
+    end
+    opts.on('--query=FILE','--file=FILE', 'Take query from a file') do |file|
+      options[:file]=file
+    end
+    opts.on('--output=TYPE', [:json,:xml,:text,:csv,:tsv],
+            'Set the output argument') do |type|
+      options[:output]=type
+    end
+    opts.on('--accept=TYPE', [:json,:xml,:text,:csv,:tsv], 
+            'Set the accept header type') do |type|
+      options[:accept]=type
+    end
+    options[:verbose] = false
+    opts.on( '--post', 'Force use of POST' ) do
+      options[:post] = true
+    end
+    opts.on( '-v', '--verbose', 'Verbose' ) do
+      options[:verbose] = true
+    end
+    opts.on( '--version', 'Print version and exit' ) do
+      print "#{SOH_NAME} #{SOH_VERSION}\n"
+      exit
+    end 
+    opts.on( '-h', '--help', 'Display this screen and exit' ) do
+      puts opts
+      exit
+    end
+  end
+
+  begin optparse.parse!    
+  rescue OptionParser::InvalidArgument, OptionParser::InvalidOption => e
+    warn e
+    exit 1
+  end
+
+  $verbose = options[:verbose]
+  $print_http = $verbose
+  usePOST = options[:post]
+
+  service = options[:service]
+  warn_exit 'No service specified.  Required --service=URI',1 if service.nil?
+
+  # Query
+  query=nil
+  query_file=options[:file]
+  if query_file.nil? && ARGV.size == 0
+  then
+    warn_exit 'No query specified.',1
+    end
+  if query_file.nil?
+    query = ARGV.shift
+    if query.match(/^@/)
+      query_file = query[1..-1]
+      query = nil
+    end
+  end
+
+  # --output ==> output= (non-standard)
+  args={}
+  case options[:output]
+  when nil
+  when  "json","xml","text","csv","tsv"
+    args['output'] = options[:output]
+  when :json,:xml,:text,:csv,:tsv
+    args['output'] = options[:output].to_s
+  else
+    warn_exit "Unrecognized output type: "+options[:output],2
+  end
+
+  # --accept
+  # options[:accept]
+
+  print "SPARQL #{service}\n" if $verbose
+  #args={"output"=>"text"}
+  SPARQL_query(service, query, query_file, usePOST, args)
+  exit(0)
+end
+
+## -------- SPARQL Update
+
+# Update sent as a WWW form.
+def SPARQL_update_by_form(service, update, args2={})
+  args = {}
+  args.merge!(args2)
+  headers={}
+  headers.merge!($headers)
+  # args? encode?
+  body="update="+uri_escape(update)
+  headers[$hContentType] = $mtWWWForm
+  headers[$hContentLength] = body.length.to_s
+  uri = URI.parse(service)
+  execute_post_form(uri, headers, body)
+end
+
+# DRY - query form.
+def execute_post_form(uri, headers, body)
+  request = Net::HTTP::Post.new(uri.request_uri)
+  request.initialize_http_header(headers)
+  request.body = body
+  print_http_request(uri, request)
+  response_no_body(uri, request)
+end
+
+def SPARQL_update(service, update, args2={})
+  args = {}
+  args.merge!(args2)
+  headers={}
+  headers.merge!($headers)
+  headers[$hContentType] = $mtSparqlUpdate
+  uri = URI.parse(service)
+  request = Net::HTTP::Post.new(uri.request_uri)
+  request.initialize_http_header(headers)
+  request.body = update
+  print_http_request(uri, request)
+  response_no_body(uri, request)
+end
+
+def cmd_sparql_update(by_raw_post=true)
+  # Share with cmd_sparql_query
+  options={}
+  optparse = OptionParser.new do |opts|
+    opts.banner = "Usage: #{$cmd} [--file REQUEST] [--service URI] 'request' | @file"
+    opts.on('--service=URI', '--server=URI', 'SPARQL endpoint') do |uri|
+      options[:service]=uri
+    end
+    opts.on('--update=FILE', '--file=FILE', 'Take update from a file') do |file|
+      options[:file]=file
+    end
+    options[:verbose] = false
+    opts.on( '-v', '--verbose', 'Verbose' ) do
+      options[:verbose] = true
+    end
+    opts.on( '--version', 'Print version and exit' ) do
+      print "#{SOH_NAME} #{SOH_VERSION}\n"
+      exit
+    end 
+    opts.on( '-h', '--help', 'Display this screen and exit' ) do
+      puts opts
+      exit
+    end
+  end
+
+  begin optparse.parse!    
+  rescue OptionParser::InvalidArgument => e
+    warn e
+    exit
+  end
+
+  $verbose = options[:verbose]
+  $print_http = $verbose
+
+  service = options[:service]
+  warn_exit 'No service specified. Required --service=URI',1   if service.nil?
+  
+  update=nil
+  update_file=options[:file]
+
+  if update_file.nil? && ARGV.size == 0
+  then
+    warn_exit 'No update specified.',1
+    end
+  if update_file.nil?
+    update = ARGV.shift
+    if update.match(/^@/)
+      update_file = update[1..-1]
+      update = nil
+    end
+  end
+  
+  print "SPARQL-Update #{service}\n" if $verbose
+  args={}
+
+  # Reads in the file :-(
+  if update.nil?
+  then
+    update = open(update_file, 'rb'){|f| f.read}
+  else
+    update = string_or_file(update)
+  end
+
+  if by_raw_post
+    SPARQL_update(service, update, args)
+  else
+    SPARQL_update_by_form(service, update, args)
+  end
+  exit(0)
+end
+
+## -------
+
+case $cmd
+when "s-http", "sparql-http", "soh"
+  $banner="#{$cmd} [get|post|put|delete] datasetURI graph [file]"
+  cmd_soh
+when "s-get", "s-head", "s-put", "s-delete", "s-post"
+
+  case $cmd
+  when "s-get", "s-head", "s-delete"
+    $banner="#{$cmd} datasetURI graph"
+  when "s-put", "s-post"
+    $banner="#{$cmd} datasetURI graph file"
+  end
+  cmd2 = $cmd.sub(/^s-/, '').upcase
+  cmd_soh cmd2
+
+when "s-query", "sparql-query"
+  cmd_sparql_query
+when "s-update", "sparql-update"
+  cmd_sparql_update true
+when "s-update-form", "sparql-update-form"
+  cmd_sparql_update false
+else 
+  warn_exit "Unknown: "+$cmd, 1
+end

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/s-post
----------------------------------------------------------------------
diff --git a/jena-fuseki1/s-post b/jena-fuseki1/s-post
new file mode 100755
index 0000000..4f6590d
--- /dev/null
+++ b/jena-fuseki1/s-post
@@ -0,0 +1,713 @@
+#!/usr/bin/env ruby
+# -*- coding: utf-8 -*-
+
+# 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.
+
+# SPARQL HTTP Update, client.
+
+require 'optparse'
+require 'net/http'
+require 'uri'
+require 'cgi'
+require 'pp'
+require 'ostruct'
+
+# ToDo
+#  Allow a choice of media type for GET
+#   --accept "content-type" (and abbreviations)
+#   --header "Add:this"
+#   --user, --password
+#  Basic authentication: request.basic_auth("username", "password")
+#  Follow redirects => 301:  puts response["location"] # All headers are lowercase?
+
+SOH_NAME="SOH"
+SOH_VERSION="0.0.0"
+
+$proxy = ENV['http_proxy'] ? URI.parse(ENV['http_proxy']) : OpenStruct.new  
+
+# What about direct naming?
+
+# Names
+$mtTurtle           = 'text/turtle;charset=utf-8'
+$mtRDF              = 'application/rdf+xml'
+$mtText             = 'text/plain'
+$mtNTriples         = 'application/n-triples'
+$mtNQuads           = 'application/n-quads'
+$mtJSONLD           = 'application/ld+json'
+$mtTriG             = 'application/trig'
+$mtSparqlResultsX   = 'application/sparql-results+xml'
+$mtSparqlResultsJ   = 'application/sparql-results+json'
+$mtAppJSON          = 'application/json'
+$mtAppXML           = 'application/xml'
+$mtSparqlResultsTSV = 'application/sparql-results+tsv'
+$mtSparqlResultsCSV = 'application/sparql-results+csv'
+$mtSparqlUpdate     = 'application/sparql-update'
+$mtWWWForm          = 'application/x-www-form-urlencoded'
+$mtSparqlQuery      = "application/sparql-query" ;
+
+# Global media type table.
+$fileMediaTypes = {}
+$fileMediaTypes['ttl']   = $mtTurtle
+$fileMediaTypes['n3']    = 'text/n3; charset=utf-8'
+$fileMediaTypes['nt']    = $mtText
+$fileMediaTypes['rdf']   = $mtRDF
+$fileMediaTypes['owl']   = $mtRDF
+$fileMediaTypes['nq']    = $mtNQuads
+$fileMediaTypes['trig']  = $mtTriG
+$fileMediaTypes['json-ld']  = $mtJSONLD
+$fileMediaTypes['jsonld']  = $mtJSONLD
+
+# Global charset : no entry means "don't set"
+$charsetUTF8      = 'utf-8'
+$charset = {}
+$charset[$mtTurtle]   = 'utf-8'
+$charset[$mtText]     = 'ascii'
+$charset[$mtTriG]     = 'utf-8'
+$charset[$mtNQuads]   = 'utf-8'
+
+# Headers
+
+$hContentType         = 'Content-Type'
+# $hContentEncoding     = 'Content-Encoding'
+$hContentLength       = 'Content-Length'
+# $hContentLocation     = 'Content-Location'
+# $hContentRange        = 'Content-Range'
+
+$hAccept              = 'Accept'
+$hAcceptCharset       = 'Accept-Charset'
+$hAcceptEncoding      = 'Accept-Encoding'
+$hAcceptRanges        = 'Accept-Ranges' 
+
+$headers = { "User-Agent" => "#{SOH_NAME}/Fuseki #{SOH_VERSION}"}
+$print_http = false
+
+# Default for GET
+# At least allow anything (and hope!)
+$accept_rdf="#{$mtTurtle} , #{$mtNTriples};q=0.9 , #{$mtRDF};q=0.8 , #{$mtJSONLD};q=0.5"
+# Datasets
+$accept_ds="#{$mtTrig} , #{$mtNQuads};q=0.9 , #{$mtJSONLD};q=0.5"
+# For SPARQL query
+$accept_results="#{$mtSparqlResultsJ} , #{$mtSparqlResultsX};q=0.9 , #{$accept_rdf}"
+
+# Accept any in case of trouble.
+$accept_rdf="#{$accept_rdf} , */*;q=0.1"
+$accept_results="#{$accept_results} , */*;q=0.1" 
+
+# The media type usually forces the charset.
+$accept_charset=nil
+
+## Who we are.
+## Two styles:
+##    s-query .....
+##    soh query .....
+
+$cmd = File.basename($0)
+if $cmd == 'soh'
+then
+  $cmd = (ARGV.size == 0) ? 'soh' : ARGV.shift
+end
+
+if ! $cmd.start_with?('s-') && $cmd != 'soh'
+  $cmd = 's-'+$cmd
+end
+
+## -------- 
+
+def GET(dataset, graph)
+  print "GET #{dataset} #{graph}\n" if $verbose
+  requestURI = target(dataset, graph)
+  headers = {}
+  headers.merge!($headers)
+  headers[$hAccept] = $accept_rdf
+  headers[$hAcceptCharset] = $accept_charset unless $accept_charset.nil?
+  get_worker(requestURI, headers)
+end
+
+def get_worker(requestURI, headers)
+  uri = URI.parse(requestURI)
+  request = Net::HTTP::Get.new(uri.request_uri)
+  request.initialize_http_header(headers)
+  print_http_request(uri, request)
+  response_print_body(uri, request)
+end
+
+def HEAD(dataset, graph)
+  print "HEAD #{dataset} #{graph}\n" if $verbose
+  requestURI = target(dataset, graph)
+  headers = {}
+  headers.merge!($headers)
+  headers[$hAccept] = $accept_rdf
+  headers[$hAcceptCharset] = $accept_charset unless $accept_charset.nil?
+  uri = URI.parse(requestURI)
+  request = Net::HTTP::Head.new(uri.request_uri)
+  request.initialize_http_header(headers)
+  print_http_request(uri, request)
+  response_no_body(uri, request)
+end
+
+def PUT(dataset, graph, file)
+  print "PUT #{dataset} #{graph} #{file}\n" if $verbose
+  send_body(dataset, graph, file, Net::HTTP::Put)
+end
+
+def POST(dataset, graph, file)
+  print "POST #{dataset} #{graph} #{file}\n" if $verbose
+  send_body(dataset, graph, file, Net::HTTP::Post)
+end
+
+def DELETE(dataset, graph)
+  print "DELETE #{dataset} #{graph}\n" if $verbose
+  requestURI = target(dataset, graph)
+  uri = URI.parse(requestURI)
+  request = Net::HTTP::Delete.new(uri.request_uri)
+  headers = {}
+  headers.merge!($headers)
+  request.initialize_http_header(headers)
+  print_http_request(uri, request)
+  response_no_body(uri, request)
+end
+
+def uri_escape(string)
+  CGI.escape(string)
+end
+
+def target(dataset, graph)
+  return dataset+"?default" if graph == "default"
+  return dataset+"?graph="+uri_escape(graph)
+end
+
+def send_body(dataset, graph, file, method)
+  mt = content_type(file)
+  headers = {}
+  headers.merge!($headers)
+  headers[$hContentType] = mt
+  headers[$hContentLength] = File.size(file).to_s
+  ## p headers
+
+  requestURI = target(dataset, graph)
+  uri = URI.parse(requestURI)
+  
+  request = method.new(uri.request_uri)
+  request.initialize_http_header(headers)
+  print_http_request(uri, request)
+  request.body_stream = File.open(file)
+  response_no_body(uri, request)
+end
+
+def response_no_body(uri, request)
+  http = Net::HTTP::Proxy($proxy.host,$proxy.port).new(uri.host, uri.port)
+  http.read_timeout = nil
+  # check we can connect.
+  begin http.start
+  rescue Exception => e  
+    # puts e.message  
+    #puts e.backtrace.inspect  
+    warn_exit "Failed to connect: #{uri.host}:#{uri.port}: #{e.message}", 3
+  end
+  response = http.request(request)
+  print_http_response(response)
+  case response
+  when Net::HTTPSuccess, Net::HTTPRedirection
+    # OK
+  when Net::HTTPNotFound
+    warn_exit "404 Not found: #{uri}", 9
+    #print response.body
+  else
+    warn_exit "#{response.code} #{response.message} #{uri}", 9
+    # Unreachable
+      response.error!
+  end
+  # NO BODY IN RESPONSE
+end
+
+def response_print_body(uri, request)
+  http = Net::HTTP::Proxy($proxy.host,$proxy.port).new(uri.host, uri.port)
+  http.read_timeout = nil
+  # check we can connect.
+  begin http.start
+  rescue => e  
+    #puts e.backtrace.inspect  
+    #print e.class
+    warn_exit "Failed to connect: #{uri.host}:#{uri.port}: #{e.message}", 3
+  end
+
+  # Add a blank line if headers were output.
+  print "\n" if $http_print ;
+
+  begin
+    response = http.request(request) { |res| 
+      print_http_response(res)
+      #puts res.code
+      res.read_body do |segment|
+        print segment
+      end
+    }
+    case response
+    when Net::HTTPSuccess, Net::HTTPRedirection
+      # OK
+    when Net::HTTPNotFound
+      warn_exit "404 Not found: #{uri}", 9
+      #print response.body
+    else
+      warn_exit "#{response.code}: #{uri}", 9
+      # Unreachable
+      response.error!
+    end
+  rescue EOFError => e
+    warn_exit "IO Error: "+e.message, 3
+  end
+end
+
+def print_http_request(uri, request)
+  return unless $print_http
+  #print "Request\n"
+  print request.method," ",uri, "\n"
+  print_headers("  ",request)
+end
+
+def print_http_response(response)
+  return unless $print_http
+  #print "Response\n"
+  print response.code, " ", response.message, "\n"
+  print_headers("  ",response)
+end
+
+def print_headers(marker, headers)
+  headers.each do |k,v| 
+    k = k.split('-').map{|w| w.capitalize}.join('-')+':'
+    printf "%s%-20s %s\n",marker,k,v
+  end
+end
+
+def content_type(file)
+  file =~ /\.([^.]*)$/
+  ext = $1
+  mt = $fileMediaTypes[ext]
+  cs = $charset[mt]
+  mt = mt+';charset='+cs if ! cs.nil?
+  return mt
+end
+
+def charset(content_type)
+  return $charset[content_type]
+end
+
+def warn_exit(msg, rc)
+    warn msg
+    exit rc ;
+end
+
+def parseURI(uri_string)
+  begin
+    return URI.parse(uri_string).to_s
+  rescue URI::InvalidURIError => err
+    warn_exit "Bad URI: <#{uri_string}>", 2
+  end
+end
+
+## ---- Command
+
+def cmd_soh(command=nil)
+  ## Command line
+  options = {}
+  optparse = OptionParser.new do |opts|
+    # Set a banner, displayed at the top
+    # of the help screen.
+    case $cmd
+    when "s-http", "sparql-http", "soh"
+      banner="$cmd [get|post|put|delete] datasetURI graph [file]"
+    when "s-get", "s-head", "s-delete"
+      banner="$cmd  datasetURI graph"
+    end
+
+    opts.banner = $banner
+    # Define the options, and what they do
+    
+    options[:verbose] = false
+    opts.on( '-v', '--verbose', 'Verbose' ) do
+      options[:verbose] = true
+    end
+    
+    options[:version] = false
+    opts.on( '--version', 'Print version and exit' ) do
+      print "#{SOH_NAME} #{SOH_VERSION}\n"
+      exit
+    end
+    
+    # This displays the help screen, all programs are
+    # assumed to have this option.
+    opts.on( '-h', '--help', 'Display this screen and exit' ) do
+      puts opts
+      exit
+    end
+  end
+
+  begin optparse.parse!    
+  rescue OptionParser::InvalidArgument => e
+    warn e
+    exit
+  end
+
+  $verbose = options[:verbose]
+  $print_http = $verbose
+
+  if command.nil?
+    if ARGV.size == 0
+      warn "No command given: expected one of 'get', 'put', 'post', 'delete', 'query' or 'update'"
+      exit 1
+    end
+    cmdPrint=ARGV.shift
+    command=cmdPrint.upcase
+  else
+    cmdPrint=command
+  end
+
+  case command
+  when "HEAD", "GET", "DELETE"
+    requiredFile=false
+  when "PUT", "POST"
+    requiredFile=true
+  when "QUERY"
+    cmd_sparql_query
+  when "UPDATE"
+    cmd_sparql_update
+  else
+    warn_exit "Unknown command: #{command}", 2
+  end
+
+  if requiredFile 
+  then
+    if ARGV.size != 3
+      warn_exit "Required: dataset URI, graph URI (or 'default') and file", 1 
+    end
+  else
+    if ARGV.size != 2
+      warn_exit "Required: dataset URI and graph URI (or 'default')", 1 
+    end
+  end
+
+  dataset=parseURI(ARGV.shift)
+  # Relative URI?
+  graph=parseURI(ARGV.shift)
+  file=""
+  if requiredFile
+  then
+    file = ARGV.shift if requiredFile
+    if ! File.exist?(file)
+      warn_exit "No such file: "+file, 3
+    end
+    if File.directory?(file)
+      warn_exit "File is a directory: "+file, 3
+    end
+  end
+
+  case command
+  when "GET"
+    GET(dataset, graph)
+  when "HEAD"
+    HEAD(dataset, graph)
+  when "PUT"
+    PUT(dataset, graph, file)
+  when "DELETE"
+    DELETE(dataset, graph)
+  when "POST"
+    POST(dataset, graph, file)
+  else
+    warn_exit "Internal error: Unknown command: #{cmd}", 2
+  end
+  exit 0
+end
+
+## --------
+def string_or_file(arg)
+  return arg if ! arg.match(/^@/)
+  a=(arg[1..-1])
+  open(a, 'rb'){|f| f.read}
+end
+
+## -------- SPARQL Query
+
+## Choose method
+def SPARQL_query(service, query, query_file, forcePOST=false, args2={})
+   if ! query_file.nil?
+    query = open(query_file, 'rb'){|f| f.read}
+  end
+  if forcePOST || query.length >= 2*1024 
+    SPARQL_query_POST(service, query, args2)
+  else
+    SPARQL_query_GET(service, query, args2)
+  end
+end
+
+## By GET
+
+def SPARQL_query_GET(service, query, args2)
+  args = { "query" => query }
+  args.merge!(args2)
+  qs=args.collect { |k,v| "#{k}=#{uri_escape(v)}" }.join('&')
+  action="#{service}?#{qs}"
+  headers={}
+  headers.merge!($headers)
+  headers[$hAccept]=$accept_results
+  get_worker(action, headers)
+end
+
+## By POST
+
+def SPARQL_query_POST(service, query, args2)
+  # DRY - body/no body for each of request and response.
+  post_params={ "query" => query }
+  post_params.merge!(args2)
+  uri = URI.parse(service)
+  headers={}
+  headers.merge!($headers)
+  headers[$hAccept]=$accept_results
+  execute_post_form_body(uri, headers, post_params)
+end
+
+def execute_post_form_body(uri, headers, post_params)
+  request = Net::HTTP::Post.new(uri.request_uri)
+  qs=post_params.collect { |k,v| "#{k}=#{uri_escape(v)}" }.join('&')
+  headers[$hContentType] = $mtWWWForm
+  headers[$hContentLength] = qs.length.to_s
+  request.initialize_http_header(headers)
+  request.body = qs
+  print_http_request(uri, request)
+  response_print_body(uri, request)
+end
+
+# Usage: -v --help --file= --query=
+def cmd_sparql_query
+  options={}
+  optparse = OptionParser.new do |opts|
+    opts.banner = "Usage: #{$cmd} [--query QUERY] [--service URI] [--post] 'query' | @file"
+    opts.on('--service=URI', '--server=URI', 'SPARQL endpoint') do |uri|
+      options[:service]=uri
+    end
+    opts.on('--query=FILE','--file=FILE', 'Take query from a file') do |file|
+      options[:file]=file
+    end
+    opts.on('--output=TYPE', [:json,:xml,:text,:csv,:tsv],
+            'Set the output argument') do |type|
+      options[:output]=type
+    end
+    opts.on('--accept=TYPE', [:json,:xml,:text,:csv,:tsv], 
+            'Set the accept header type') do |type|
+      options[:accept]=type
+    end
+    options[:verbose] = false
+    opts.on( '--post', 'Force use of POST' ) do
+      options[:post] = true
+    end
+    opts.on( '-v', '--verbose', 'Verbose' ) do
+      options[:verbose] = true
+    end
+    opts.on( '--version', 'Print version and exit' ) do
+      print "#{SOH_NAME} #{SOH_VERSION}\n"
+      exit
+    end 
+    opts.on( '-h', '--help', 'Display this screen and exit' ) do
+      puts opts
+      exit
+    end
+  end
+
+  begin optparse.parse!    
+  rescue OptionParser::InvalidArgument, OptionParser::InvalidOption => e
+    warn e
+    exit 1
+  end
+
+  $verbose = options[:verbose]
+  $print_http = $verbose
+  usePOST = options[:post]
+
+  service = options[:service]
+  warn_exit 'No service specified.  Required --service=URI',1 if service.nil?
+
+  # Query
+  query=nil
+  query_file=options[:file]
+  if query_file.nil? && ARGV.size == 0
+  then
+    warn_exit 'No query specified.',1
+    end
+  if query_file.nil?
+    query = ARGV.shift
+    if query.match(/^@/)
+      query_file = query[1..-1]
+      query = nil
+    end
+  end
+
+  # --output ==> output= (non-standard)
+  args={}
+  case options[:output]
+  when nil
+  when  "json","xml","text","csv","tsv"
+    args['output'] = options[:output]
+  when :json,:xml,:text,:csv,:tsv
+    args['output'] = options[:output].to_s
+  else
+    warn_exit "Unrecognized output type: "+options[:output],2
+  end
+
+  # --accept
+  # options[:accept]
+
+  print "SPARQL #{service}\n" if $verbose
+  #args={"output"=>"text"}
+  SPARQL_query(service, query, query_file, usePOST, args)
+  exit(0)
+end
+
+## -------- SPARQL Update
+
+# Update sent as a WWW form.
+def SPARQL_update_by_form(service, update, args2={})
+  args = {}
+  args.merge!(args2)
+  headers={}
+  headers.merge!($headers)
+  # args? encode?
+  body="update="+uri_escape(update)
+  headers[$hContentType] = $mtWWWForm
+  headers[$hContentLength] = body.length.to_s
+  uri = URI.parse(service)
+  execute_post_form(uri, headers, body)
+end
+
+# DRY - query form.
+def execute_post_form(uri, headers, body)
+  request = Net::HTTP::Post.new(uri.request_uri)
+  request.initialize_http_header(headers)
+  request.body = body
+  print_http_request(uri, request)
+  response_no_body(uri, request)
+end
+
+def SPARQL_update(service, update, args2={})
+  args = {}
+  args.merge!(args2)
+  headers={}
+  headers.merge!($headers)
+  headers[$hContentType] = $mtSparqlUpdate
+  uri = URI.parse(service)
+  request = Net::HTTP::Post.new(uri.request_uri)
+  request.initialize_http_header(headers)
+  request.body = update
+  print_http_request(uri, request)
+  response_no_body(uri, request)
+end
+
+def cmd_sparql_update(by_raw_post=true)
+  # Share with cmd_sparql_query
+  options={}
+  optparse = OptionParser.new do |opts|
+    opts.banner = "Usage: #{$cmd} [--file REQUEST] [--service URI] 'request' | @file"
+    opts.on('--service=URI', '--server=URI', 'SPARQL endpoint') do |uri|
+      options[:service]=uri
+    end
+    opts.on('--update=FILE', '--file=FILE', 'Take update from a file') do |file|
+      options[:file]=file
+    end
+    options[:verbose] = false
+    opts.on( '-v', '--verbose', 'Verbose' ) do
+      options[:verbose] = true
+    end
+    opts.on( '--version', 'Print version and exit' ) do
+      print "#{SOH_NAME} #{SOH_VERSION}\n"
+      exit
+    end 
+    opts.on( '-h', '--help', 'Display this screen and exit' ) do
+      puts opts
+      exit
+    end
+  end
+
+  begin optparse.parse!    
+  rescue OptionParser::InvalidArgument => e
+    warn e
+    exit
+  end
+
+  $verbose = options[:verbose]
+  $print_http = $verbose
+
+  service = options[:service]
+  warn_exit 'No service specified. Required --service=URI',1   if service.nil?
+  
+  update=nil
+  update_file=options[:file]
+
+  if update_file.nil? && ARGV.size == 0
+  then
+    warn_exit 'No update specified.',1
+    end
+  if update_file.nil?
+    update = ARGV.shift
+    if update.match(/^@/)
+      update_file = update[1..-1]
+      update = nil
+    end
+  end
+  
+  print "SPARQL-Update #{service}\n" if $verbose
+  args={}
+
+  # Reads in the file :-(
+  if update.nil?
+  then
+    update = open(update_file, 'rb'){|f| f.read}
+  else
+    update = string_or_file(update)
+  end
+
+  if by_raw_post
+    SPARQL_update(service, update, args)
+  else
+    SPARQL_update_by_form(service, update, args)
+  end
+  exit(0)
+end
+
+## -------
+
+case $cmd
+when "s-http", "sparql-http", "soh"
+  $banner="#{$cmd} [get|post|put|delete] datasetURI graph [file]"
+  cmd_soh
+when "s-get", "s-head", "s-put", "s-delete", "s-post"
+
+  case $cmd
+  when "s-get", "s-head", "s-delete"
+    $banner="#{$cmd} datasetURI graph"
+  when "s-put", "s-post"
+    $banner="#{$cmd} datasetURI graph file"
+  end
+  cmd2 = $cmd.sub(/^s-/, '').upcase
+  cmd_soh cmd2
+
+when "s-query", "sparql-query"
+  cmd_sparql_query
+when "s-update", "sparql-update"
+  cmd_sparql_update true
+when "s-update-form", "sparql-update-form"
+  cmd_sparql_update false
+else 
+  warn_exit "Unknown: "+$cmd, 1
+end

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/s-put
----------------------------------------------------------------------
diff --git a/jena-fuseki1/s-put b/jena-fuseki1/s-put
new file mode 100755
index 0000000..4f6590d
--- /dev/null
+++ b/jena-fuseki1/s-put
@@ -0,0 +1,713 @@
+#!/usr/bin/env ruby
+# -*- coding: utf-8 -*-
+
+# 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.
+
+# SPARQL HTTP Update, client.
+
+require 'optparse'
+require 'net/http'
+require 'uri'
+require 'cgi'
+require 'pp'
+require 'ostruct'
+
+# ToDo
+#  Allow a choice of media type for GET
+#   --accept "content-type" (and abbreviations)
+#   --header "Add:this"
+#   --user, --password
+#  Basic authentication: request.basic_auth("username", "password")
+#  Follow redirects => 301:  puts response["location"] # All headers are lowercase?
+
+SOH_NAME="SOH"
+SOH_VERSION="0.0.0"
+
+$proxy = ENV['http_proxy'] ? URI.parse(ENV['http_proxy']) : OpenStruct.new  
+
+# What about direct naming?
+
+# Names
+$mtTurtle           = 'text/turtle;charset=utf-8'
+$mtRDF              = 'application/rdf+xml'
+$mtText             = 'text/plain'
+$mtNTriples         = 'application/n-triples'
+$mtNQuads           = 'application/n-quads'
+$mtJSONLD           = 'application/ld+json'
+$mtTriG             = 'application/trig'
+$mtSparqlResultsX   = 'application/sparql-results+xml'
+$mtSparqlResultsJ   = 'application/sparql-results+json'
+$mtAppJSON          = 'application/json'
+$mtAppXML           = 'application/xml'
+$mtSparqlResultsTSV = 'application/sparql-results+tsv'
+$mtSparqlResultsCSV = 'application/sparql-results+csv'
+$mtSparqlUpdate     = 'application/sparql-update'
+$mtWWWForm          = 'application/x-www-form-urlencoded'
+$mtSparqlQuery      = "application/sparql-query" ;
+
+# Global media type table.
+$fileMediaTypes = {}
+$fileMediaTypes['ttl']   = $mtTurtle
+$fileMediaTypes['n3']    = 'text/n3; charset=utf-8'
+$fileMediaTypes['nt']    = $mtText
+$fileMediaTypes['rdf']   = $mtRDF
+$fileMediaTypes['owl']   = $mtRDF
+$fileMediaTypes['nq']    = $mtNQuads
+$fileMediaTypes['trig']  = $mtTriG
+$fileMediaTypes['json-ld']  = $mtJSONLD
+$fileMediaTypes['jsonld']  = $mtJSONLD
+
+# Global charset : no entry means "don't set"
+$charsetUTF8      = 'utf-8'
+$charset = {}
+$charset[$mtTurtle]   = 'utf-8'
+$charset[$mtText]     = 'ascii'
+$charset[$mtTriG]     = 'utf-8'
+$charset[$mtNQuads]   = 'utf-8'
+
+# Headers
+
+$hContentType         = 'Content-Type'
+# $hContentEncoding     = 'Content-Encoding'
+$hContentLength       = 'Content-Length'
+# $hContentLocation     = 'Content-Location'
+# $hContentRange        = 'Content-Range'
+
+$hAccept              = 'Accept'
+$hAcceptCharset       = 'Accept-Charset'
+$hAcceptEncoding      = 'Accept-Encoding'
+$hAcceptRanges        = 'Accept-Ranges' 
+
+$headers = { "User-Agent" => "#{SOH_NAME}/Fuseki #{SOH_VERSION}"}
+$print_http = false
+
+# Default for GET
+# At least allow anything (and hope!)
+$accept_rdf="#{$mtTurtle} , #{$mtNTriples};q=0.9 , #{$mtRDF};q=0.8 , #{$mtJSONLD};q=0.5"
+# Datasets
+$accept_ds="#{$mtTrig} , #{$mtNQuads};q=0.9 , #{$mtJSONLD};q=0.5"
+# For SPARQL query
+$accept_results="#{$mtSparqlResultsJ} , #{$mtSparqlResultsX};q=0.9 , #{$accept_rdf}"
+
+# Accept any in case of trouble.
+$accept_rdf="#{$accept_rdf} , */*;q=0.1"
+$accept_results="#{$accept_results} , */*;q=0.1" 
+
+# The media type usually forces the charset.
+$accept_charset=nil
+
+## Who we are.
+## Two styles:
+##    s-query .....
+##    soh query .....
+
+$cmd = File.basename($0)
+if $cmd == 'soh'
+then
+  $cmd = (ARGV.size == 0) ? 'soh' : ARGV.shift
+end
+
+if ! $cmd.start_with?('s-') && $cmd != 'soh'
+  $cmd = 's-'+$cmd
+end
+
+## -------- 
+
+def GET(dataset, graph)
+  print "GET #{dataset} #{graph}\n" if $verbose
+  requestURI = target(dataset, graph)
+  headers = {}
+  headers.merge!($headers)
+  headers[$hAccept] = $accept_rdf
+  headers[$hAcceptCharset] = $accept_charset unless $accept_charset.nil?
+  get_worker(requestURI, headers)
+end
+
+def get_worker(requestURI, headers)
+  uri = URI.parse(requestURI)
+  request = Net::HTTP::Get.new(uri.request_uri)
+  request.initialize_http_header(headers)
+  print_http_request(uri, request)
+  response_print_body(uri, request)
+end
+
+def HEAD(dataset, graph)
+  print "HEAD #{dataset} #{graph}\n" if $verbose
+  requestURI = target(dataset, graph)
+  headers = {}
+  headers.merge!($headers)
+  headers[$hAccept] = $accept_rdf
+  headers[$hAcceptCharset] = $accept_charset unless $accept_charset.nil?
+  uri = URI.parse(requestURI)
+  request = Net::HTTP::Head.new(uri.request_uri)
+  request.initialize_http_header(headers)
+  print_http_request(uri, request)
+  response_no_body(uri, request)
+end
+
+def PUT(dataset, graph, file)
+  print "PUT #{dataset} #{graph} #{file}\n" if $verbose
+  send_body(dataset, graph, file, Net::HTTP::Put)
+end
+
+def POST(dataset, graph, file)
+  print "POST #{dataset} #{graph} #{file}\n" if $verbose
+  send_body(dataset, graph, file, Net::HTTP::Post)
+end
+
+def DELETE(dataset, graph)
+  print "DELETE #{dataset} #{graph}\n" if $verbose
+  requestURI = target(dataset, graph)
+  uri = URI.parse(requestURI)
+  request = Net::HTTP::Delete.new(uri.request_uri)
+  headers = {}
+  headers.merge!($headers)
+  request.initialize_http_header(headers)
+  print_http_request(uri, request)
+  response_no_body(uri, request)
+end
+
+def uri_escape(string)
+  CGI.escape(string)
+end
+
+def target(dataset, graph)
+  return dataset+"?default" if graph == "default"
+  return dataset+"?graph="+uri_escape(graph)
+end
+
+def send_body(dataset, graph, file, method)
+  mt = content_type(file)
+  headers = {}
+  headers.merge!($headers)
+  headers[$hContentType] = mt
+  headers[$hContentLength] = File.size(file).to_s
+  ## p headers
+
+  requestURI = target(dataset, graph)
+  uri = URI.parse(requestURI)
+  
+  request = method.new(uri.request_uri)
+  request.initialize_http_header(headers)
+  print_http_request(uri, request)
+  request.body_stream = File.open(file)
+  response_no_body(uri, request)
+end
+
+def response_no_body(uri, request)
+  http = Net::HTTP::Proxy($proxy.host,$proxy.port).new(uri.host, uri.port)
+  http.read_timeout = nil
+  # check we can connect.
+  begin http.start
+  rescue Exception => e  
+    # puts e.message  
+    #puts e.backtrace.inspect  
+    warn_exit "Failed to connect: #{uri.host}:#{uri.port}: #{e.message}", 3
+  end
+  response = http.request(request)
+  print_http_response(response)
+  case response
+  when Net::HTTPSuccess, Net::HTTPRedirection
+    # OK
+  when Net::HTTPNotFound
+    warn_exit "404 Not found: #{uri}", 9
+    #print response.body
+  else
+    warn_exit "#{response.code} #{response.message} #{uri}", 9
+    # Unreachable
+      response.error!
+  end
+  # NO BODY IN RESPONSE
+end
+
+def response_print_body(uri, request)
+  http = Net::HTTP::Proxy($proxy.host,$proxy.port).new(uri.host, uri.port)
+  http.read_timeout = nil
+  # check we can connect.
+  begin http.start
+  rescue => e  
+    #puts e.backtrace.inspect  
+    #print e.class
+    warn_exit "Failed to connect: #{uri.host}:#{uri.port}: #{e.message}", 3
+  end
+
+  # Add a blank line if headers were output.
+  print "\n" if $http_print ;
+
+  begin
+    response = http.request(request) { |res| 
+      print_http_response(res)
+      #puts res.code
+      res.read_body do |segment|
+        print segment
+      end
+    }
+    case response
+    when Net::HTTPSuccess, Net::HTTPRedirection
+      # OK
+    when Net::HTTPNotFound
+      warn_exit "404 Not found: #{uri}", 9
+      #print response.body
+    else
+      warn_exit "#{response.code}: #{uri}", 9
+      # Unreachable
+      response.error!
+    end
+  rescue EOFError => e
+    warn_exit "IO Error: "+e.message, 3
+  end
+end
+
+def print_http_request(uri, request)
+  return unless $print_http
+  #print "Request\n"
+  print request.method," ",uri, "\n"
+  print_headers("  ",request)
+end
+
+def print_http_response(response)
+  return unless $print_http
+  #print "Response\n"
+  print response.code, " ", response.message, "\n"
+  print_headers("  ",response)
+end
+
+def print_headers(marker, headers)
+  headers.each do |k,v| 
+    k = k.split('-').map{|w| w.capitalize}.join('-')+':'
+    printf "%s%-20s %s\n",marker,k,v
+  end
+end
+
+def content_type(file)
+  file =~ /\.([^.]*)$/
+  ext = $1
+  mt = $fileMediaTypes[ext]
+  cs = $charset[mt]
+  mt = mt+';charset='+cs if ! cs.nil?
+  return mt
+end
+
+def charset(content_type)
+  return $charset[content_type]
+end
+
+def warn_exit(msg, rc)
+    warn msg
+    exit rc ;
+end
+
+def parseURI(uri_string)
+  begin
+    return URI.parse(uri_string).to_s
+  rescue URI::InvalidURIError => err
+    warn_exit "Bad URI: <#{uri_string}>", 2
+  end
+end
+
+## ---- Command
+
+def cmd_soh(command=nil)
+  ## Command line
+  options = {}
+  optparse = OptionParser.new do |opts|
+    # Set a banner, displayed at the top
+    # of the help screen.
+    case $cmd
+    when "s-http", "sparql-http", "soh"
+      banner="$cmd [get|post|put|delete] datasetURI graph [file]"
+    when "s-get", "s-head", "s-delete"
+      banner="$cmd  datasetURI graph"
+    end
+
+    opts.banner = $banner
+    # Define the options, and what they do
+    
+    options[:verbose] = false
+    opts.on( '-v', '--verbose', 'Verbose' ) do
+      options[:verbose] = true
+    end
+    
+    options[:version] = false
+    opts.on( '--version', 'Print version and exit' ) do
+      print "#{SOH_NAME} #{SOH_VERSION}\n"
+      exit
+    end
+    
+    # This displays the help screen, all programs are
+    # assumed to have this option.
+    opts.on( '-h', '--help', 'Display this screen and exit' ) do
+      puts opts
+      exit
+    end
+  end
+
+  begin optparse.parse!    
+  rescue OptionParser::InvalidArgument => e
+    warn e
+    exit
+  end
+
+  $verbose = options[:verbose]
+  $print_http = $verbose
+
+  if command.nil?
+    if ARGV.size == 0
+      warn "No command given: expected one of 'get', 'put', 'post', 'delete', 'query' or 'update'"
+      exit 1
+    end
+    cmdPrint=ARGV.shift
+    command=cmdPrint.upcase
+  else
+    cmdPrint=command
+  end
+
+  case command
+  when "HEAD", "GET", "DELETE"
+    requiredFile=false
+  when "PUT", "POST"
+    requiredFile=true
+  when "QUERY"
+    cmd_sparql_query
+  when "UPDATE"
+    cmd_sparql_update
+  else
+    warn_exit "Unknown command: #{command}", 2
+  end
+
+  if requiredFile 
+  then
+    if ARGV.size != 3
+      warn_exit "Required: dataset URI, graph URI (or 'default') and file", 1 
+    end
+  else
+    if ARGV.size != 2
+      warn_exit "Required: dataset URI and graph URI (or 'default')", 1 
+    end
+  end
+
+  dataset=parseURI(ARGV.shift)
+  # Relative URI?
+  graph=parseURI(ARGV.shift)
+  file=""
+  if requiredFile
+  then
+    file = ARGV.shift if requiredFile
+    if ! File.exist?(file)
+      warn_exit "No such file: "+file, 3
+    end
+    if File.directory?(file)
+      warn_exit "File is a directory: "+file, 3
+    end
+  end
+
+  case command
+  when "GET"
+    GET(dataset, graph)
+  when "HEAD"
+    HEAD(dataset, graph)
+  when "PUT"
+    PUT(dataset, graph, file)
+  when "DELETE"
+    DELETE(dataset, graph)
+  when "POST"
+    POST(dataset, graph, file)
+  else
+    warn_exit "Internal error: Unknown command: #{cmd}", 2
+  end
+  exit 0
+end
+
+## --------
+def string_or_file(arg)
+  return arg if ! arg.match(/^@/)
+  a=(arg[1..-1])
+  open(a, 'rb'){|f| f.read}
+end
+
+## -------- SPARQL Query
+
+## Choose method
+def SPARQL_query(service, query, query_file, forcePOST=false, args2={})
+   if ! query_file.nil?
+    query = open(query_file, 'rb'){|f| f.read}
+  end
+  if forcePOST || query.length >= 2*1024 
+    SPARQL_query_POST(service, query, args2)
+  else
+    SPARQL_query_GET(service, query, args2)
+  end
+end
+
+## By GET
+
+def SPARQL_query_GET(service, query, args2)
+  args = { "query" => query }
+  args.merge!(args2)
+  qs=args.collect { |k,v| "#{k}=#{uri_escape(v)}" }.join('&')
+  action="#{service}?#{qs}"
+  headers={}
+  headers.merge!($headers)
+  headers[$hAccept]=$accept_results
+  get_worker(action, headers)
+end
+
+## By POST
+
+def SPARQL_query_POST(service, query, args2)
+  # DRY - body/no body for each of request and response.
+  post_params={ "query" => query }
+  post_params.merge!(args2)
+  uri = URI.parse(service)
+  headers={}
+  headers.merge!($headers)
+  headers[$hAccept]=$accept_results
+  execute_post_form_body(uri, headers, post_params)
+end
+
+def execute_post_form_body(uri, headers, post_params)
+  request = Net::HTTP::Post.new(uri.request_uri)
+  qs=post_params.collect { |k,v| "#{k}=#{uri_escape(v)}" }.join('&')
+  headers[$hContentType] = $mtWWWForm
+  headers[$hContentLength] = qs.length.to_s
+  request.initialize_http_header(headers)
+  request.body = qs
+  print_http_request(uri, request)
+  response_print_body(uri, request)
+end
+
+# Usage: -v --help --file= --query=
+def cmd_sparql_query
+  options={}
+  optparse = OptionParser.new do |opts|
+    opts.banner = "Usage: #{$cmd} [--query QUERY] [--service URI] [--post] 'query' | @file"
+    opts.on('--service=URI', '--server=URI', 'SPARQL endpoint') do |uri|
+      options[:service]=uri
+    end
+    opts.on('--query=FILE','--file=FILE', 'Take query from a file') do |file|
+      options[:file]=file
+    end
+    opts.on('--output=TYPE', [:json,:xml,:text,:csv,:tsv],
+            'Set the output argument') do |type|
+      options[:output]=type
+    end
+    opts.on('--accept=TYPE', [:json,:xml,:text,:csv,:tsv], 
+            'Set the accept header type') do |type|
+      options[:accept]=type
+    end
+    options[:verbose] = false
+    opts.on( '--post', 'Force use of POST' ) do
+      options[:post] = true
+    end
+    opts.on( '-v', '--verbose', 'Verbose' ) do
+      options[:verbose] = true
+    end
+    opts.on( '--version', 'Print version and exit' ) do
+      print "#{SOH_NAME} #{SOH_VERSION}\n"
+      exit
+    end 
+    opts.on( '-h', '--help', 'Display this screen and exit' ) do
+      puts opts
+      exit
+    end
+  end
+
+  begin optparse.parse!    
+  rescue OptionParser::InvalidArgument, OptionParser::InvalidOption => e
+    warn e
+    exit 1
+  end
+
+  $verbose = options[:verbose]
+  $print_http = $verbose
+  usePOST = options[:post]
+
+  service = options[:service]
+  warn_exit 'No service specified.  Required --service=URI',1 if service.nil?
+
+  # Query
+  query=nil
+  query_file=options[:file]
+  if query_file.nil? && ARGV.size == 0
+  then
+    warn_exit 'No query specified.',1
+    end
+  if query_file.nil?
+    query = ARGV.shift
+    if query.match(/^@/)
+      query_file = query[1..-1]
+      query = nil
+    end
+  end
+
+  # --output ==> output= (non-standard)
+  args={}
+  case options[:output]
+  when nil
+  when  "json","xml","text","csv","tsv"
+    args['output'] = options[:output]
+  when :json,:xml,:text,:csv,:tsv
+    args['output'] = options[:output].to_s
+  else
+    warn_exit "Unrecognized output type: "+options[:output],2
+  end
+
+  # --accept
+  # options[:accept]
+
+  print "SPARQL #{service}\n" if $verbose
+  #args={"output"=>"text"}
+  SPARQL_query(service, query, query_file, usePOST, args)
+  exit(0)
+end
+
+## -------- SPARQL Update
+
+# Update sent as a WWW form.
+def SPARQL_update_by_form(service, update, args2={})
+  args = {}
+  args.merge!(args2)
+  headers={}
+  headers.merge!($headers)
+  # args? encode?
+  body="update="+uri_escape(update)
+  headers[$hContentType] = $mtWWWForm
+  headers[$hContentLength] = body.length.to_s
+  uri = URI.parse(service)
+  execute_post_form(uri, headers, body)
+end
+
+# DRY - query form.
+def execute_post_form(uri, headers, body)
+  request = Net::HTTP::Post.new(uri.request_uri)
+  request.initialize_http_header(headers)
+  request.body = body
+  print_http_request(uri, request)
+  response_no_body(uri, request)
+end
+
+def SPARQL_update(service, update, args2={})
+  args = {}
+  args.merge!(args2)
+  headers={}
+  headers.merge!($headers)
+  headers[$hContentType] = $mtSparqlUpdate
+  uri = URI.parse(service)
+  request = Net::HTTP::Post.new(uri.request_uri)
+  request.initialize_http_header(headers)
+  request.body = update
+  print_http_request(uri, request)
+  response_no_body(uri, request)
+end
+
+def cmd_sparql_update(by_raw_post=true)
+  # Share with cmd_sparql_query
+  options={}
+  optparse = OptionParser.new do |opts|
+    opts.banner = "Usage: #{$cmd} [--file REQUEST] [--service URI] 'request' | @file"
+    opts.on('--service=URI', '--server=URI', 'SPARQL endpoint') do |uri|
+      options[:service]=uri
+    end
+    opts.on('--update=FILE', '--file=FILE', 'Take update from a file') do |file|
+      options[:file]=file
+    end
+    options[:verbose] = false
+    opts.on( '-v', '--verbose', 'Verbose' ) do
+      options[:verbose] = true
+    end
+    opts.on( '--version', 'Print version and exit' ) do
+      print "#{SOH_NAME} #{SOH_VERSION}\n"
+      exit
+    end 
+    opts.on( '-h', '--help', 'Display this screen and exit' ) do
+      puts opts
+      exit
+    end
+  end
+
+  begin optparse.parse!    
+  rescue OptionParser::InvalidArgument => e
+    warn e
+    exit
+  end
+
+  $verbose = options[:verbose]
+  $print_http = $verbose
+
+  service = options[:service]
+  warn_exit 'No service specified. Required --service=URI',1   if service.nil?
+  
+  update=nil
+  update_file=options[:file]
+
+  if update_file.nil? && ARGV.size == 0
+  then
+    warn_exit 'No update specified.',1
+    end
+  if update_file.nil?
+    update = ARGV.shift
+    if update.match(/^@/)
+      update_file = update[1..-1]
+      update = nil
+    end
+  end
+  
+  print "SPARQL-Update #{service}\n" if $verbose
+  args={}
+
+  # Reads in the file :-(
+  if update.nil?
+  then
+    update = open(update_file, 'rb'){|f| f.read}
+  else
+    update = string_or_file(update)
+  end
+
+  if by_raw_post
+    SPARQL_update(service, update, args)
+  else
+    SPARQL_update_by_form(service, update, args)
+  end
+  exit(0)
+end
+
+## -------
+
+case $cmd
+when "s-http", "sparql-http", "soh"
+  $banner="#{$cmd} [get|post|put|delete] datasetURI graph [file]"
+  cmd_soh
+when "s-get", "s-head", "s-put", "s-delete", "s-post"
+
+  case $cmd
+  when "s-get", "s-head", "s-delete"
+    $banner="#{$cmd} datasetURI graph"
+  when "s-put", "s-post"
+    $banner="#{$cmd} datasetURI graph file"
+  end
+  cmd2 = $cmd.sub(/^s-/, '').upcase
+  cmd_soh cmd2
+
+when "s-query", "sparql-query"
+  cmd_sparql_query
+when "s-update", "sparql-update"
+  cmd_sparql_update true
+when "s-update-form", "sparql-update-form"
+  cmd_sparql_update false
+else 
+  warn_exit "Unknown: "+$cmd, 1
+end

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/s-query
----------------------------------------------------------------------
diff --git a/jena-fuseki1/s-query b/jena-fuseki1/s-query
new file mode 100755
index 0000000..4f6590d
--- /dev/null
+++ b/jena-fuseki1/s-query
@@ -0,0 +1,713 @@
+#!/usr/bin/env ruby
+# -*- coding: utf-8 -*-
+
+# 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.
+
+# SPARQL HTTP Update, client.
+
+require 'optparse'
+require 'net/http'
+require 'uri'
+require 'cgi'
+require 'pp'
+require 'ostruct'
+
+# ToDo
+#  Allow a choice of media type for GET
+#   --accept "content-type" (and abbreviations)
+#   --header "Add:this"
+#   --user, --password
+#  Basic authentication: request.basic_auth("username", "password")
+#  Follow redirects => 301:  puts response["location"] # All headers are lowercase?
+
+SOH_NAME="SOH"
+SOH_VERSION="0.0.0"
+
+$proxy = ENV['http_proxy'] ? URI.parse(ENV['http_proxy']) : OpenStruct.new  
+
+# What about direct naming?
+
+# Names
+$mtTurtle           = 'text/turtle;charset=utf-8'
+$mtRDF              = 'application/rdf+xml'
+$mtText             = 'text/plain'
+$mtNTriples         = 'application/n-triples'
+$mtNQuads           = 'application/n-quads'
+$mtJSONLD           = 'application/ld+json'
+$mtTriG             = 'application/trig'
+$mtSparqlResultsX   = 'application/sparql-results+xml'
+$mtSparqlResultsJ   = 'application/sparql-results+json'
+$mtAppJSON          = 'application/json'
+$mtAppXML           = 'application/xml'
+$mtSparqlResultsTSV = 'application/sparql-results+tsv'
+$mtSparqlResultsCSV = 'application/sparql-results+csv'
+$mtSparqlUpdate     = 'application/sparql-update'
+$mtWWWForm          = 'application/x-www-form-urlencoded'
+$mtSparqlQuery      = "application/sparql-query" ;
+
+# Global media type table.
+$fileMediaTypes = {}
+$fileMediaTypes['ttl']   = $mtTurtle
+$fileMediaTypes['n3']    = 'text/n3; charset=utf-8'
+$fileMediaTypes['nt']    = $mtText
+$fileMediaTypes['rdf']   = $mtRDF
+$fileMediaTypes['owl']   = $mtRDF
+$fileMediaTypes['nq']    = $mtNQuads
+$fileMediaTypes['trig']  = $mtTriG
+$fileMediaTypes['json-ld']  = $mtJSONLD
+$fileMediaTypes['jsonld']  = $mtJSONLD
+
+# Global charset : no entry means "don't set"
+$charsetUTF8      = 'utf-8'
+$charset = {}
+$charset[$mtTurtle]   = 'utf-8'
+$charset[$mtText]     = 'ascii'
+$charset[$mtTriG]     = 'utf-8'
+$charset[$mtNQuads]   = 'utf-8'
+
+# Headers
+
+$hContentType         = 'Content-Type'
+# $hContentEncoding     = 'Content-Encoding'
+$hContentLength       = 'Content-Length'
+# $hContentLocation     = 'Content-Location'
+# $hContentRange        = 'Content-Range'
+
+$hAccept              = 'Accept'
+$hAcceptCharset       = 'Accept-Charset'
+$hAcceptEncoding      = 'Accept-Encoding'
+$hAcceptRanges        = 'Accept-Ranges' 
+
+$headers = { "User-Agent" => "#{SOH_NAME}/Fuseki #{SOH_VERSION}"}
+$print_http = false
+
+# Default for GET
+# At least allow anything (and hope!)
+$accept_rdf="#{$mtTurtle} , #{$mtNTriples};q=0.9 , #{$mtRDF};q=0.8 , #{$mtJSONLD};q=0.5"
+# Datasets
+$accept_ds="#{$mtTrig} , #{$mtNQuads};q=0.9 , #{$mtJSONLD};q=0.5"
+# For SPARQL query
+$accept_results="#{$mtSparqlResultsJ} , #{$mtSparqlResultsX};q=0.9 , #{$accept_rdf}"
+
+# Accept any in case of trouble.
+$accept_rdf="#{$accept_rdf} , */*;q=0.1"
+$accept_results="#{$accept_results} , */*;q=0.1" 
+
+# The media type usually forces the charset.
+$accept_charset=nil
+
+## Who we are.
+## Two styles:
+##    s-query .....
+##    soh query .....
+
+$cmd = File.basename($0)
+if $cmd == 'soh'
+then
+  $cmd = (ARGV.size == 0) ? 'soh' : ARGV.shift
+end
+
+if ! $cmd.start_with?('s-') && $cmd != 'soh'
+  $cmd = 's-'+$cmd
+end
+
+## -------- 
+
+def GET(dataset, graph)
+  print "GET #{dataset} #{graph}\n" if $verbose
+  requestURI = target(dataset, graph)
+  headers = {}
+  headers.merge!($headers)
+  headers[$hAccept] = $accept_rdf
+  headers[$hAcceptCharset] = $accept_charset unless $accept_charset.nil?
+  get_worker(requestURI, headers)
+end
+
+def get_worker(requestURI, headers)
+  uri = URI.parse(requestURI)
+  request = Net::HTTP::Get.new(uri.request_uri)
+  request.initialize_http_header(headers)
+  print_http_request(uri, request)
+  response_print_body(uri, request)
+end
+
+def HEAD(dataset, graph)
+  print "HEAD #{dataset} #{graph}\n" if $verbose
+  requestURI = target(dataset, graph)
+  headers = {}
+  headers.merge!($headers)
+  headers[$hAccept] = $accept_rdf
+  headers[$hAcceptCharset] = $accept_charset unless $accept_charset.nil?
+  uri = URI.parse(requestURI)
+  request = Net::HTTP::Head.new(uri.request_uri)
+  request.initialize_http_header(headers)
+  print_http_request(uri, request)
+  response_no_body(uri, request)
+end
+
+def PUT(dataset, graph, file)
+  print "PUT #{dataset} #{graph} #{file}\n" if $verbose
+  send_body(dataset, graph, file, Net::HTTP::Put)
+end
+
+def POST(dataset, graph, file)
+  print "POST #{dataset} #{graph} #{file}\n" if $verbose
+  send_body(dataset, graph, file, Net::HTTP::Post)
+end
+
+def DELETE(dataset, graph)
+  print "DELETE #{dataset} #{graph}\n" if $verbose
+  requestURI = target(dataset, graph)
+  uri = URI.parse(requestURI)
+  request = Net::HTTP::Delete.new(uri.request_uri)
+  headers = {}
+  headers.merge!($headers)
+  request.initialize_http_header(headers)
+  print_http_request(uri, request)
+  response_no_body(uri, request)
+end
+
+def uri_escape(string)
+  CGI.escape(string)
+end
+
+def target(dataset, graph)
+  return dataset+"?default" if graph == "default"
+  return dataset+"?graph="+uri_escape(graph)
+end
+
+def send_body(dataset, graph, file, method)
+  mt = content_type(file)
+  headers = {}
+  headers.merge!($headers)
+  headers[$hContentType] = mt
+  headers[$hContentLength] = File.size(file).to_s
+  ## p headers
+
+  requestURI = target(dataset, graph)
+  uri = URI.parse(requestURI)
+  
+  request = method.new(uri.request_uri)
+  request.initialize_http_header(headers)
+  print_http_request(uri, request)
+  request.body_stream = File.open(file)
+  response_no_body(uri, request)
+end
+
+def response_no_body(uri, request)
+  http = Net::HTTP::Proxy($proxy.host,$proxy.port).new(uri.host, uri.port)
+  http.read_timeout = nil
+  # check we can connect.
+  begin http.start
+  rescue Exception => e  
+    # puts e.message  
+    #puts e.backtrace.inspect  
+    warn_exit "Failed to connect: #{uri.host}:#{uri.port}: #{e.message}", 3
+  end
+  response = http.request(request)
+  print_http_response(response)
+  case response
+  when Net::HTTPSuccess, Net::HTTPRedirection
+    # OK
+  when Net::HTTPNotFound
+    warn_exit "404 Not found: #{uri}", 9
+    #print response.body
+  else
+    warn_exit "#{response.code} #{response.message} #{uri}", 9
+    # Unreachable
+      response.error!
+  end
+  # NO BODY IN RESPONSE
+end
+
+def response_print_body(uri, request)
+  http = Net::HTTP::Proxy($proxy.host,$proxy.port).new(uri.host, uri.port)
+  http.read_timeout = nil
+  # check we can connect.
+  begin http.start
+  rescue => e  
+    #puts e.backtrace.inspect  
+    #print e.class
+    warn_exit "Failed to connect: #{uri.host}:#{uri.port}: #{e.message}", 3
+  end
+
+  # Add a blank line if headers were output.
+  print "\n" if $http_print ;
+
+  begin
+    response = http.request(request) { |res| 
+      print_http_response(res)
+      #puts res.code
+      res.read_body do |segment|
+        print segment
+      end
+    }
+    case response
+    when Net::HTTPSuccess, Net::HTTPRedirection
+      # OK
+    when Net::HTTPNotFound
+      warn_exit "404 Not found: #{uri}", 9
+      #print response.body
+    else
+      warn_exit "#{response.code}: #{uri}", 9
+      # Unreachable
+      response.error!
+    end
+  rescue EOFError => e
+    warn_exit "IO Error: "+e.message, 3
+  end
+end
+
+def print_http_request(uri, request)
+  return unless $print_http
+  #print "Request\n"
+  print request.method," ",uri, "\n"
+  print_headers("  ",request)
+end
+
+def print_http_response(response)
+  return unless $print_http
+  #print "Response\n"
+  print response.code, " ", response.message, "\n"
+  print_headers("  ",response)
+end
+
+def print_headers(marker, headers)
+  headers.each do |k,v| 
+    k = k.split('-').map{|w| w.capitalize}.join('-')+':'
+    printf "%s%-20s %s\n",marker,k,v
+  end
+end
+
+def content_type(file)
+  file =~ /\.([^.]*)$/
+  ext = $1
+  mt = $fileMediaTypes[ext]
+  cs = $charset[mt]
+  mt = mt+';charset='+cs if ! cs.nil?
+  return mt
+end
+
+def charset(content_type)
+  return $charset[content_type]
+end
+
+def warn_exit(msg, rc)
+    warn msg
+    exit rc ;
+end
+
+def parseURI(uri_string)
+  begin
+    return URI.parse(uri_string).to_s
+  rescue URI::InvalidURIError => err
+    warn_exit "Bad URI: <#{uri_string}>", 2
+  end
+end
+
+## ---- Command
+
+def cmd_soh(command=nil)
+  ## Command line
+  options = {}
+  optparse = OptionParser.new do |opts|
+    # Set a banner, displayed at the top
+    # of the help screen.
+    case $cmd
+    when "s-http", "sparql-http", "soh"
+      banner="$cmd [get|post|put|delete] datasetURI graph [file]"
+    when "s-get", "s-head", "s-delete"
+      banner="$cmd  datasetURI graph"
+    end
+
+    opts.banner = $banner
+    # Define the options, and what they do
+    
+    options[:verbose] = false
+    opts.on( '-v', '--verbose', 'Verbose' ) do
+      options[:verbose] = true
+    end
+    
+    options[:version] = false
+    opts.on( '--version', 'Print version and exit' ) do
+      print "#{SOH_NAME} #{SOH_VERSION}\n"
+      exit
+    end
+    
+    # This displays the help screen, all programs are
+    # assumed to have this option.
+    opts.on( '-h', '--help', 'Display this screen and exit' ) do
+      puts opts
+      exit
+    end
+  end
+
+  begin optparse.parse!    
+  rescue OptionParser::InvalidArgument => e
+    warn e
+    exit
+  end
+
+  $verbose = options[:verbose]
+  $print_http = $verbose
+
+  if command.nil?
+    if ARGV.size == 0
+      warn "No command given: expected one of 'get', 'put', 'post', 'delete', 'query' or 'update'"
+      exit 1
+    end
+    cmdPrint=ARGV.shift
+    command=cmdPrint.upcase
+  else
+    cmdPrint=command
+  end
+
+  case command
+  when "HEAD", "GET", "DELETE"
+    requiredFile=false
+  when "PUT", "POST"
+    requiredFile=true
+  when "QUERY"
+    cmd_sparql_query
+  when "UPDATE"
+    cmd_sparql_update
+  else
+    warn_exit "Unknown command: #{command}", 2
+  end
+
+  if requiredFile 
+  then
+    if ARGV.size != 3
+      warn_exit "Required: dataset URI, graph URI (or 'default') and file", 1 
+    end
+  else
+    if ARGV.size != 2
+      warn_exit "Required: dataset URI and graph URI (or 'default')", 1 
+    end
+  end
+
+  dataset=parseURI(ARGV.shift)
+  # Relative URI?
+  graph=parseURI(ARGV.shift)
+  file=""
+  if requiredFile
+  then
+    file = ARGV.shift if requiredFile
+    if ! File.exist?(file)
+      warn_exit "No such file: "+file, 3
+    end
+    if File.directory?(file)
+      warn_exit "File is a directory: "+file, 3
+    end
+  end
+
+  case command
+  when "GET"
+    GET(dataset, graph)
+  when "HEAD"
+    HEAD(dataset, graph)
+  when "PUT"
+    PUT(dataset, graph, file)
+  when "DELETE"
+    DELETE(dataset, graph)
+  when "POST"
+    POST(dataset, graph, file)
+  else
+    warn_exit "Internal error: Unknown command: #{cmd}", 2
+  end
+  exit 0
+end
+
+## --------
+def string_or_file(arg)
+  return arg if ! arg.match(/^@/)
+  a=(arg[1..-1])
+  open(a, 'rb'){|f| f.read}
+end
+
+## -------- SPARQL Query
+
+## Choose method
+def SPARQL_query(service, query, query_file, forcePOST=false, args2={})
+   if ! query_file.nil?
+    query = open(query_file, 'rb'){|f| f.read}
+  end
+  if forcePOST || query.length >= 2*1024 
+    SPARQL_query_POST(service, query, args2)
+  else
+    SPARQL_query_GET(service, query, args2)
+  end
+end
+
+## By GET
+
+def SPARQL_query_GET(service, query, args2)
+  args = { "query" => query }
+  args.merge!(args2)
+  qs=args.collect { |k,v| "#{k}=#{uri_escape(v)}" }.join('&')
+  action="#{service}?#{qs}"
+  headers={}
+  headers.merge!($headers)
+  headers[$hAccept]=$accept_results
+  get_worker(action, headers)
+end
+
+## By POST
+
+def SPARQL_query_POST(service, query, args2)
+  # DRY - body/no body for each of request and response.
+  post_params={ "query" => query }
+  post_params.merge!(args2)
+  uri = URI.parse(service)
+  headers={}
+  headers.merge!($headers)
+  headers[$hAccept]=$accept_results
+  execute_post_form_body(uri, headers, post_params)
+end
+
+def execute_post_form_body(uri, headers, post_params)
+  request = Net::HTTP::Post.new(uri.request_uri)
+  qs=post_params.collect { |k,v| "#{k}=#{uri_escape(v)}" }.join('&')
+  headers[$hContentType] = $mtWWWForm
+  headers[$hContentLength] = qs.length.to_s
+  request.initialize_http_header(headers)
+  request.body = qs
+  print_http_request(uri, request)
+  response_print_body(uri, request)
+end
+
+# Usage: -v --help --file= --query=
+def cmd_sparql_query
+  options={}
+  optparse = OptionParser.new do |opts|
+    opts.banner = "Usage: #{$cmd} [--query QUERY] [--service URI] [--post] 'query' | @file"
+    opts.on('--service=URI', '--server=URI', 'SPARQL endpoint') do |uri|
+      options[:service]=uri
+    end
+    opts.on('--query=FILE','--file=FILE', 'Take query from a file') do |file|
+      options[:file]=file
+    end
+    opts.on('--output=TYPE', [:json,:xml,:text,:csv,:tsv],
+            'Set the output argument') do |type|
+      options[:output]=type
+    end
+    opts.on('--accept=TYPE', [:json,:xml,:text,:csv,:tsv], 
+            'Set the accept header type') do |type|
+      options[:accept]=type
+    end
+    options[:verbose] = false
+    opts.on( '--post', 'Force use of POST' ) do
+      options[:post] = true
+    end
+    opts.on( '-v', '--verbose', 'Verbose' ) do
+      options[:verbose] = true
+    end
+    opts.on( '--version', 'Print version and exit' ) do
+      print "#{SOH_NAME} #{SOH_VERSION}\n"
+      exit
+    end 
+    opts.on( '-h', '--help', 'Display this screen and exit' ) do
+      puts opts
+      exit
+    end
+  end
+
+  begin optparse.parse!    
+  rescue OptionParser::InvalidArgument, OptionParser::InvalidOption => e
+    warn e
+    exit 1
+  end
+
+  $verbose = options[:verbose]
+  $print_http = $verbose
+  usePOST = options[:post]
+
+  service = options[:service]
+  warn_exit 'No service specified.  Required --service=URI',1 if service.nil?
+
+  # Query
+  query=nil
+  query_file=options[:file]
+  if query_file.nil? && ARGV.size == 0
+  then
+    warn_exit 'No query specified.',1
+    end
+  if query_file.nil?
+    query = ARGV.shift
+    if query.match(/^@/)
+      query_file = query[1..-1]
+      query = nil
+    end
+  end
+
+  # --output ==> output= (non-standard)
+  args={}
+  case options[:output]
+  when nil
+  when  "json","xml","text","csv","tsv"
+    args['output'] = options[:output]
+  when :json,:xml,:text,:csv,:tsv
+    args['output'] = options[:output].to_s
+  else
+    warn_exit "Unrecognized output type: "+options[:output],2
+  end
+
+  # --accept
+  # options[:accept]
+
+  print "SPARQL #{service}\n" if $verbose
+  #args={"output"=>"text"}
+  SPARQL_query(service, query, query_file, usePOST, args)
+  exit(0)
+end
+
+## -------- SPARQL Update
+
+# Update sent as a WWW form.
+def SPARQL_update_by_form(service, update, args2={})
+  args = {}
+  args.merge!(args2)
+  headers={}
+  headers.merge!($headers)
+  # args? encode?
+  body="update="+uri_escape(update)
+  headers[$hContentType] = $mtWWWForm
+  headers[$hContentLength] = body.length.to_s
+  uri = URI.parse(service)
+  execute_post_form(uri, headers, body)
+end
+
+# DRY - query form.
+def execute_post_form(uri, headers, body)
+  request = Net::HTTP::Post.new(uri.request_uri)
+  request.initialize_http_header(headers)
+  request.body = body
+  print_http_request(uri, request)
+  response_no_body(uri, request)
+end
+
+def SPARQL_update(service, update, args2={})
+  args = {}
+  args.merge!(args2)
+  headers={}
+  headers.merge!($headers)
+  headers[$hContentType] = $mtSparqlUpdate
+  uri = URI.parse(service)
+  request = Net::HTTP::Post.new(uri.request_uri)
+  request.initialize_http_header(headers)
+  request.body = update
+  print_http_request(uri, request)
+  response_no_body(uri, request)
+end
+
+def cmd_sparql_update(by_raw_post=true)
+  # Share with cmd_sparql_query
+  options={}
+  optparse = OptionParser.new do |opts|
+    opts.banner = "Usage: #{$cmd} [--file REQUEST] [--service URI] 'request' | @file"
+    opts.on('--service=URI', '--server=URI', 'SPARQL endpoint') do |uri|
+      options[:service]=uri
+    end
+    opts.on('--update=FILE', '--file=FILE', 'Take update from a file') do |file|
+      options[:file]=file
+    end
+    options[:verbose] = false
+    opts.on( '-v', '--verbose', 'Verbose' ) do
+      options[:verbose] = true
+    end
+    opts.on( '--version', 'Print version and exit' ) do
+      print "#{SOH_NAME} #{SOH_VERSION}\n"
+      exit
+    end 
+    opts.on( '-h', '--help', 'Display this screen and exit' ) do
+      puts opts
+      exit
+    end
+  end
+
+  begin optparse.parse!    
+  rescue OptionParser::InvalidArgument => e
+    warn e
+    exit
+  end
+
+  $verbose = options[:verbose]
+  $print_http = $verbose
+
+  service = options[:service]
+  warn_exit 'No service specified. Required --service=URI',1   if service.nil?
+  
+  update=nil
+  update_file=options[:file]
+
+  if update_file.nil? && ARGV.size == 0
+  then
+    warn_exit 'No update specified.',1
+    end
+  if update_file.nil?
+    update = ARGV.shift
+    if update.match(/^@/)
+      update_file = update[1..-1]
+      update = nil
+    end
+  end
+  
+  print "SPARQL-Update #{service}\n" if $verbose
+  args={}
+
+  # Reads in the file :-(
+  if update.nil?
+  then
+    update = open(update_file, 'rb'){|f| f.read}
+  else
+    update = string_or_file(update)
+  end
+
+  if by_raw_post
+    SPARQL_update(service, update, args)
+  else
+    SPARQL_update_by_form(service, update, args)
+  end
+  exit(0)
+end
+
+## -------
+
+case $cmd
+when "s-http", "sparql-http", "soh"
+  $banner="#{$cmd} [get|post|put|delete] datasetURI graph [file]"
+  cmd_soh
+when "s-get", "s-head", "s-put", "s-delete", "s-post"
+
+  case $cmd
+  when "s-get", "s-head", "s-delete"
+    $banner="#{$cmd} datasetURI graph"
+  when "s-put", "s-post"
+    $banner="#{$cmd} datasetURI graph file"
+  end
+  cmd2 = $cmd.sub(/^s-/, '').upcase
+  cmd_soh cmd2
+
+when "s-query", "sparql-query"
+  cmd_sparql_query
+when "s-update", "sparql-update"
+  cmd_sparql_update true
+when "s-update-form", "sparql-update-form"
+  cmd_sparql_update false
+else 
+  warn_exit "Unknown: "+$cmd, 1
+end


[10/23] jena git commit: Rename folder jena-fuseki to jena-fuseki1

Posted by an...@apache.org.
http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/config-tdb-text.ttl
----------------------------------------------------------------------
diff --git a/jena-fuseki1/config-tdb-text.ttl b/jena-fuseki1/config-tdb-text.ttl
new file mode 100644
index 0000000..e0ff09d
--- /dev/null
+++ b/jena-fuseki1/config-tdb-text.ttl
@@ -0,0 +1,93 @@
+# 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.
+
+## Example of a TDB dataset and text index published using Fuseki
+
+@prefix :        <#> .
+@prefix fuseki:  <http://jena.apache.org/fuseki#> .
+@prefix rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+@prefix rdfs:    <http://www.w3.org/2000/01/rdf-schema#> .
+@prefix tdb:     <http://jena.hpl.hp.com/2008/tdb#> .
+@prefix ja:      <http://jena.hpl.hp.com/2005/11/Assembler#> .
+@prefix text:    <http://jena.apache.org/text#> .
+
+[] rdf:type fuseki:Server ;
+   # Timeout - server-wide default: milliseconds.
+   # Format 1: "1000" -- 1 second timeout
+   # Format 2: "10000,60000" -- 10s timeout to first result, then 60s timeout to for rest of query.
+   # See java doc for ARQ.queryTimeout
+   # ja:context [ ja:cxtName "arq:queryTimeout" ;  ja:cxtValue "10000" ] ;
+   # ja:loadClass "your.code.Class" ;
+
+   fuseki:services (
+     <#service_text_tdb>
+   ) .
+
+# TDB
+[] ja:loadClass "com.hp.hpl.jena.tdb.TDB" .
+tdb:DatasetTDB  rdfs:subClassOf  ja:RDFDataset .
+tdb:GraphTDB    rdfs:subClassOf  ja:Model .
+
+# Text
+[] ja:loadClass "org.apache.jena.query.text.TextQuery" .
+text:TextDataset      rdfs:subClassOf   ja:RDFDataset .
+#text:TextIndexSolr    rdfs:subClassOf   text:TextIndex .
+text:TextIndexLucene  rdfs:subClassOf   text:TextIndex .
+
+## ---------------------------------------------------------------
+
+<#service_text_tdb> rdf:type fuseki:Service ;
+    rdfs:label                      "TDB/text service" ;
+    fuseki:name                     "ds" ;
+    fuseki:serviceQuery             "query" ;
+    fuseki:serviceQuery             "sparql" ;
+    fuseki:serviceUpdate            "update" ;
+    fuseki:serviceUpload            "upload" ;
+    fuseki:serviceReadGraphStore    "get" ;
+    fuseki:serviceReadWriteGraphStore    "data" ;
+    fuseki:dataset                  <#text_dataset> ;
+    .
+
+<#text_dataset> rdf:type     text:TextDataset ;
+    text:dataset   <#dataset> ;
+    ##text:index   <#indexSolr> ;
+    text:index     <#indexLucene> ;
+    .
+
+<#dataset> rdf:type      tdb:DatasetTDB ;
+    tdb:location "DB" ;
+    ##tdb:unionDefaultGraph true ;
+    .
+
+<#indexSolr> a text:TextIndexSolr ;
+    #text:server <http://localhost:8983/solr/COLLECTION> ;
+    text:server <embedded:SolrARQ> ;
+    text:entityMap <#entMap> ;
+    .
+
+<#indexLucene> a text:TextIndexLucene ;
+    text:directory <file:Lucene> ;
+    ##text:directory "mem" ;
+    text:entityMap <#entMap> ;
+    .
+
+<#entMap> a text:EntityMap ;
+    text:entityField      "uri" ;
+    text:defaultField     "text" ;        ## Should be defined in the text:map.
+    text:map (
+         # rdfs:label            
+         [ text:field "text" ; text:predicate rdfs:label ]
+         ) .

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/config-tdb.ttl
----------------------------------------------------------------------
diff --git a/jena-fuseki1/config-tdb.ttl b/jena-fuseki1/config-tdb.ttl
new file mode 100644
index 0000000..4194189
--- /dev/null
+++ b/jena-fuseki1/config-tdb.ttl
@@ -0,0 +1,72 @@
+# Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
+
+## Example of a TDB dataset published using Fuseki: persistent storage.
+
+@prefix :        <#> .
+@prefix fuseki:  <http://jena.apache.org/fuseki#> .
+@prefix rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+@prefix rdfs:    <http://www.w3.org/2000/01/rdf-schema#> .
+@prefix tdb:     <http://jena.hpl.hp.com/2008/tdb#> .
+@prefix ja:      <http://jena.hpl.hp.com/2005/11/Assembler#> .
+
+[] rdf:type fuseki:Server ;
+   # Timeout - server-wide default: milliseconds.
+   # Format 1: "1000" -- 1 second timeout
+   # Format 2: "10000,60000" -- 10s timeout to first result, then 60s timeout to for rest of query.
+   # See java doc for ARQ.queryTimeout
+   # ja:context [ ja:cxtName "arq:queryTimeout" ;  ja:cxtValue "10000" ] ;
+   # ja:loadClass "your.code.Class" ;
+
+   fuseki:services (
+     <#service_tdb_read_only>
+     <#service_tdb_all>
+   ) .
+
+# TDB
+[] ja:loadClass "com.hp.hpl.jena.tdb.TDB" .
+tdb:DatasetTDB  rdfs:subClassOf  ja:RDFDataset .
+tdb:GraphTDB    rdfs:subClassOf  ja:Model .
+
+## ---------------------------------------------------------------
+## Read-only TDB dataset (only read services enabled).
+
+<#service_tdb_read_only> rdf:type fuseki:Service ;
+    rdfs:label                      "TDB Service (R)" ;
+    fuseki:name                     "ds" ;
+    fuseki:serviceQuery             "query" ;
+    fuseki:serviceQuery             "sparql" ;
+    # Don't allow SPARQL Update.
+    #fuseki:serviceUpdate            "update" ;
+    # Use the read-only service.
+    fuseki:serviceReadGraphStore    "data" ;
+    fuseki:serviceReadGraphStore    "get" ;
+    fuseki:dataset           <#tdb_dataset_read> ;
+    .
+
+<#tdb_dataset_read> rdf:type      tdb:DatasetTDB ;
+    tdb:location "DB1" ;
+    tdb:unionDefaultGraph true ;
+    .
+
+## ---------------------------------------------------------------
+## Updatable TDB dataset with all services enabled.
+
+<#service_tdb_all> rdf:type fuseki:Service ;
+    rdfs:label                      "TDB Service (RW)" ;
+    fuseki:name                     "data" ;
+    fuseki:serviceQuery             "query" ;
+    fuseki:serviceQuery             "sparql" ;
+    fuseki:serviceUpdate            "update" ;
+    fuseki:serviceUpload            "upload" ;
+    fuseki:serviceReadWriteGraphStore      "data" ;
+    # A separate read-only graph store endpoint:
+    fuseki:serviceReadGraphStore       "get" ;
+    fuseki:dataset           <#tdb_dataset_readwrite> ;
+    .
+
+<#tdb_dataset_readwrite> rdf:type      tdb:DatasetTDB ;
+    tdb:location "DB2" ;
+##     # Query timeout on this dataset (milliseconds)
+##     ja:context [ ja:cxtName "arq:queryTimeout" ;  ja:cxtValue "1000" ] ;
+##     # Default graph for query is the (read-only) union of all named graphs.
+     .

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/config.ttl
----------------------------------------------------------------------
diff --git a/jena-fuseki1/config.ttl b/jena-fuseki1/config.ttl
new file mode 100644
index 0000000..5ea8cd0
--- /dev/null
+++ b/jena-fuseki1/config.ttl
@@ -0,0 +1,65 @@
+# Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
+
+## Basic Fuseki configuation file.
+## 
+## See also config-tdb.ttl for TDB specific examples.
+## See also config-examples.ttl for commented examples.
+
+@prefix :        <#> .
+@prefix fuseki:  <http://jena.apache.org/fuseki#> .
+@prefix rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+
+@prefix rdfs:    <http://www.w3.org/2000/01/rdf-schema#> .
+@prefix tdb:     <http://jena.hpl.hp.com/2008/tdb#> .
+@prefix ja:      <http://jena.hpl.hp.com/2005/11/Assembler#> .
+
+[] rdf:type fuseki:Server ;
+   # Timeout - server-wide default: milliseconds.
+   # Format 1: "1000" -- 1 second timeout
+   # Format 2: "10000,60000" -- 10s timeout to first result, then 60s timeout for the rest of query.
+   # See java doc for ARQ.queryTimeout
+   # ja:context [ ja:cxtName "arq:queryTimeout" ;  ja:cxtValue "10000" ] ;
+
+   # ja:loadClass "your.code.Class" ;
+
+   fuseki:services (
+     <#service1>
+     <#service2>
+   ) .
+
+## ---------------------------------------------------------------
+## Updatable in-memory dataset.
+
+<#service1> rdf:type fuseki:Service ;
+    # URI of the dataset -- http://host:port/ds
+    fuseki:name                        "ds" ; 
+    fuseki:serviceQuery                "sparql" ;
+    fuseki:serviceQuery                "query" ;
+    fuseki:serviceUpdate               "update" ;
+    fuseki:serviceUpload               "upload" ;
+    fuseki:serviceReadWriteGraphStore  "data" ;     
+    fuseki:serviceReadGraphStore       "get" ;
+    fuseki:dataset                     <#emptyDataset> ;
+    .
+
+## In-memory, initially empty.
+<#emptyDataset> rdf:type ja:RDFDataset .
+
+## ---------------------------------------------------------------
+## Read-only access to a small books database.
+
+<#service2> rdf:type fuseki:Service ;
+    fuseki:name                     "books" ;
+    fuseki:serviceQuery             "query" ;
+    fuseki:serviceReadGraphStore    "get" ;
+    fuseki:dataset                   <#books> ;
+    .
+    
+<#books>    rdf:type ja:RDFDataset ;
+    rdfs:label "Books" ;
+    ja:defaultGraph 
+      [ rdfs:label "books.ttl" ;
+        a ja:MemoryModel ;
+        ja:content [ja:externalContent <file:Data/books.ttl> ] ;
+      ] ;
+    .

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/dist/ABOUT
----------------------------------------------------------------------
diff --git a/jena-fuseki1/dist/ABOUT b/jena-fuseki1/dist/ABOUT
new file mode 100644
index 0000000..cee2ca2
--- /dev/null
+++ b/jena-fuseki1/dist/ABOUT
@@ -0,0 +1 @@
+This directory holds the material needed for inclusion in the Fuseki distribution.
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/dist/LICENSE
----------------------------------------------------------------------
diff --git a/jena-fuseki1/dist/LICENSE b/jena-fuseki1/dist/LICENSE
new file mode 100644
index 0000000..45a6ca4
--- /dev/null
+++ b/jena-fuseki1/dist/LICENSE
@@ -0,0 +1,548 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+- - - - - - - - - - - - - - - - - - - - - - - 
+
+  (c) Copyright 2003, Plugged In Software 
+
+  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.
+
+- - - - - - - - - - - - - - - - - - - - - - - 
+
+http://www.slf4j.org/license.html
+
+ Copyright (c) 2004-2011 QOS.ch
+ All rights reserved.
+
+ Permission is hereby granted, free  of charge, to any person obtaining
+ a  copy  of this  software  and  associated  documentation files  (the
+ "Software"), to  deal in  the Software without  restriction, including
+ without limitation  the rights to  use, copy, modify,  merge, publish,
+ distribute,  sublicense, and/or sell  copies of  the Software,  and to
+ permit persons to whom the Software  is furnished to do so, subject to
+ the following conditions:
+ 
+ The  above  copyright  notice  and  this permission  notice  shall  be
+ included in all copies or substantial portions of the Software.
+ 
+ THE  SOFTWARE IS  PROVIDED  "AS  IS", WITHOUT  WARRANTY  OF ANY  KIND,
+ EXPRESS OR  IMPLIED, INCLUDING  BUT NOT LIMITED  TO THE  WARRANTIES OF
+ MERCHANTABILITY,    FITNESS    FOR    A   PARTICULAR    PURPOSE    AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ OF CONTRACT, TORT OR OTHERWISE,  ARISING FROM, OUT OF OR IN CONNECTION
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+- - - - - - - - - - - - - - - - - - - - - - - 
+
+==============================================================
+ Jetty Web Container
+ Copyright 1995-2012 Mort Bay Consulting Pty Ltd.
+==============================================================
+
+The Jetty Web Container is Copyright Mort Bay Consulting Pty Ltd
+unless otherwise noted.
+
+Jetty is dual licensed under both
+
+  * The Apache 2.0 License
+    http://www.apache.org/licenses/LICENSE-2.0.html
+
+      and
+
+  * The Eclipse Public 1.0 License
+    http://www.eclipse.org/legal/epl-v10.html
+
+Jetty may be distributed under either license.
+
+The javax.servlet package used was sourced from the Apache
+Software Foundation and is distributed under the apache 2.0
+license.
+
+The UnixCrypt.java code implements the one way cryptography used by
+Unix systems for simple password protection.  Copyright 1996 Aki Yoshida,
+modified April 2001  by Iris Van den Broeke, Daniel Deville.
+Permission to use, copy, modify and distribute UnixCrypt
+for non-commercial or commercial purposes and without fee is
+granted provided that the copyright notice appears in all copies.
+
+- - - - - - - - - - - - - - - - - - - - - - - 
+
+From Apache HttpComponents Client
+
+This project contains annotations derived from JCIP-ANNOTATIONS
+Copyright (c) 2005 Brian Goetz and Tim Peierls.
+See http://www.jcip.net and the Creative Commons Attribution License 
+(http://creativecommons.org/licenses/by/2.5)
+
+- - - - - - - - - - - - - - - - - - - - - - - 
+
+From Apache Lucene
+
+Some code in core/src/java/org/apache/lucene/util/UnicodeUtil.java was
+derived from unicode conversion examples available at
+http://www.unicode.org/Public/PROGRAMS/CVTUTF.  Here is the copyright
+from those sources:
+
+/*
+ * Copyright 2001-2004 Unicode, Inc.
+ * 
+ * Disclaimer
+ * 
+ * This source code is provided as is by Unicode, Inc. No claims are
+ * made as to fitness for any particular purpose. No warranties of any
+ * kind are expressed or implied. The recipient agrees to determine
+ * applicability of information provided. If this file has been
+ * purchased on magnetic or optical media from Unicode, Inc., the
+ * sole remedy for any claim will be exchange of defective media
+ * within 90 days of receipt.
+ * 
+ * Limitations on Rights to Redistribute This Code
+ * 
+ * Unicode, Inc. hereby grants the right to freely use the information
+ * supplied in this file in the creation of products supporting the
+ * Unicode Standard, and to make copies of this file in any form
+ * for internal or external distribution as long as this notice
+ * remains attached.
+ */
+
+
+Some code in core/src/java/org/apache/lucene/util/ArrayUtil.java was
+derived from Python 2.4.2 sources available at
+http://www.python.org. Full license is here:
+
+  http://www.python.org/download/releases/2.4.2/license/
+
+Some code in core/src/java/org/apache/lucene/util/UnicodeUtil.java was
+derived from Python 3.1.2 sources available at
+http://www.python.org. Full license is here:
+
+  http://www.python.org/download/releases/3.1.2/license/
+
+Some code in core/src/java/org/apache/lucene/util/automaton was
+derived from Brics automaton sources available at
+www.brics.dk/automaton/. Here is the copyright from those sources:
+
+/*
+ * Copyright (c) 2001-2009 Anders Moeller
+ * 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.
+ */
+ 
+The levenshtein automata tables in core/src/java/org/apache/lucene/util/automaton 
+were automatically generated with the moman/finenight FSA package.
+Here is the copyright for those sources:
+
+# Copyright (c) 2010, Jean-Philippe Barrette-LaPierre, <jp...@rrette.com>
+#
+# Permission is hereby granted, free of charge, to any person
+# obtaining a copy of this software and associated documentation
+# files (the "Software"), to deal in the Software without
+# restriction, including without limitation the rights to use,
+# copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following
+# conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+# OTHER DEALINGS IN THE SOFTWARE.
+
+Some code in core/src/java/org/apache/lucene/util/UnicodeUtil.java was
+derived from ICU (http://www.icu-project.org)
+The full license is available here: 
+  http://source.icu-project.org/repos/icu/icu/trunk/license.html
+
+/*
+ * Copyright (C) 1999-2010, International Business Machines
+ * Corporation and others.  All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy 
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights 
+ * to use, copy, modify, merge, publish, distribute, and/or sell copies of the 
+ * Software, and to permit persons to whom the Software is furnished to do so, 
+ * provided that the above copyright notice(s) and this permission notice appear 
+ * in all copies of the Software and that both the above copyright notice(s) and
+ * this permission notice appear in supporting documentation.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. 
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE 
+ * LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR 
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER 
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT 
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder shall not 
+ * be used in advertising or otherwise to promote the sale, use or other 
+ * dealings in this Software without prior written authorization of the 
+ * copyright holder.
+ */
+ 
+The following license applies to the Snowball stemmers:
+
+Copyright (c) 2001, Dr Martin Porter
+Copyright (c) 2002, Richard Boulton
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice,
+    * this list of conditions and the following disclaimer.
+    * 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.
+    * Neither the name of the copyright holders nor the names of its contributors
+    * may be used to endorse or promote products derived from this software
+    * without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT OWNER OR CONTRIBUTORS 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.
+
+The following license applies to the KStemmer:
+
+Copyright © 2003,
+Center for Intelligent Information Retrieval,
+University of Massachusetts, Amherst.
+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 names "Center for Intelligent Information Retrieval" and
+"University of Massachusetts" must not be used to endorse or promote products
+derived from this software without prior written permission. To obtain
+permission, contact info@ciir.cs.umass.edu.
+
+THIS SOFTWARE IS PROVIDED BY UNIVERSITY OF MASSACHUSETTS AND OTHER CONTRIBUTORS
+"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 COPYRIGHT HOLDERS OR CONTRIBUTORS 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.
+
+The following license applies to the Morfologik project:
+
+Copyright (c) 2006 Dawid Weiss
+Copyright (c) 2007-2011 Dawid Weiss, Marcin Miłkowski
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, 
+are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice, 
+    this list of conditions and the following disclaimer.
+    
+    * 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.
+    
+    * Neither the name of Morfologik nor the names of its contributors 
+    may be used to endorse or promote products derived from this software 
+    without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT HOLDER OR CONTRIBUTORS 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.
+
+---
+
+The dictionary comes from Morfologik project. Morfologik uses data from 
+Polish ispell/myspell dictionary hosted at http://www.sjp.pl/slownik/en/ and 
+is licenced on the terms of (inter alia) LGPL and Creative Commons 
+ShareAlike. The part-of-speech tags were added in Morfologik project and
+are not found in the data from sjp.pl. The tagset is similar to IPI PAN
+tagset.
+
+---
+
+The following license applies to the Morfeusz project,
+used by org.apache.lucene.analysis.morfologik.
+
+BSD-licensed dictionary of Polish (SGJP)
+http://sgjp.pl/morfeusz/
+
+Copyright © 2011 Zygmunt Saloni, Włodzimierz Gruszczyński, 
+	    	 Marcin Woliński, Robert Wołosz
+
+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.
+
+THIS SOFTWARE IS PROVIDED BY COPYRIGHT HOLDERS “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 COPYRIGHT  HOLDERS OR  CONTRIBUTORS 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.
+
+

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/dist/NOTICE
----------------------------------------------------------------------
diff --git a/jena-fuseki1/dist/NOTICE b/jena-fuseki1/dist/NOTICE
new file mode 100644
index 0000000..33231f9
--- /dev/null
+++ b/jena-fuseki1/dist/NOTICE
@@ -0,0 +1,216 @@
+Apache Jena - module Fuseki
+Copyright 2011, 2012, 2013, 2014, 2015 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+
+Portions of this software were originally based on the following:
+  - Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Hewlett-Packard Development Company, LP
+  - Copyright 2010, 2011 Epimorphics Ltd.
+  - Copyright 2010, 2011 Talis Systems Ltd.
+These have been licensed to the Apache Software Foundation under a software grant.
+
+- - - - - - - - - - - - - - - - - - - - - - - 
+
+slf4j:
+ Copyright (c) 2004-2011 QOS.ch
+ All rights reserved.
+
+- - - - - - - - - - - - - - - - - - - - - - -
+
+(c) Copyright 2003, Plugged In Software 
+This product includes software developed by
+PluggedIn Software under a BSD license.
+
+- - - - - - - - - - - - - - - - - - - - - - -
+
+ Jetty Web Container
+ Copyright 1995-2012 Mort Bay Consulting Pty Ltd.
+
+under the Apache 2.0 License. 
+
+The Jetty Web Container includes:
+
+UnixCrypt.java
+Copyright 1996 Aki Yoshida,
+modified April 2001  by Iris Van den Broeke, Daniel Deville.
+
+- - - - - - - - - - - - - - - - - - - - - - -
+
+From Apache HttpComponents Client:
+
+This project contains annotations derived from JCIP-ANNOTATIONS
+Copyright (c) 2005 Brian Goetz and Tim Peierls. See http://www.jcip.net
+
+- - - - - - - - - - - - - - - - - - - - - - -
+
+  Apache Xerces Java
+   Copyright 1999-2013 The Apache Software Foundation
+
+   This product includes software developed at
+   The Apache Software Foundation (http://www.apache.org/).
+
+   Portions of this software were originally based on the following:
+     - software copyright (c) 1999, IBM Corporation., http://www.ibm.com.
+     - software copyright (c) 1999, Sun Microsystems., http://www.sun.com.
+     - voluntary contributions made by Paul Eng on behalf of the 
+       Apache Software Foundation that were originally developed at iClick, Inc.,
+       software copyright (c) 1999.
+
+- - - - - - - - - - - - - - - - - - - - - - -
+
+From Apache Lucene:
+
+ICU4J, (under analysis/icu) is licensed under an MIT styles license
+and Copyright (c) 1995-2008 International Business Machines Corporation and others
+
+Some data files (under analysis/icu/src/data) are derived from Unicode data such
+as the Unicode Character Database. See http://unicode.org/copyright.html for more
+details.
+
+Brics Automaton (under core/src/java/org/apache/lucene/util/automaton) is 
+BSD-licensed, created by Anders Møller. See http://www.brics.dk/automaton/
+
+The levenshtein automata tables (under core/src/java/org/apache/lucene/util/automaton) were
+automatically generated with the moman/finenight FSA library, created by
+Jean-Philippe Barrette-LaPierre. This library is available under an MIT license,
+see http://sites.google.com/site/rrettesite/moman and 
+http://bitbucket.org/jpbarrette/moman/overview/
+
+This product includes code (JaspellTernarySearchTrie) from Java Spelling 
+Checking Package (jaspell): http://jaspell.sourceforge.net/
+License: The BSD License (http://www.opensource.org/licenses/bsd-license.php)
+
+The snowball stemmers in
+  analysis/common/src/java/net/sf/snowball
+were developed by Martin Porter and Richard Boulton.
+The snowball stopword lists in
+  analysis/common/src/resources/org/apache/lucene/analysis/snowball
+were developed by Martin Porter and Richard Boulton.
+The full snowball package is available from
+  http://snowball.tartarus.org/
+
+The KStem stemmer in
+  analysis/common/src/org/apache/lucene/analysis/en
+was developed by Bob Krovetz and Sergio Guzman-Lara (CIIR-UMass Amherst)
+under the BSD-license.
+
+The Arabic,Persian,Romanian,Bulgarian, and Hindi analyzers (common) come with a default
+stopword list that is BSD-licensed created by Jacques Savoy.
+See http://members.unine.ch/jacques.savoy/clef/index.html.
+
+The German,Spanish,Finnish,French,Hungarian,Italian,Portuguese,Russian and Swedish light stemmers
+(common) are based on BSD-licensed reference implementations created by Jacques Savoy and
+Ljiljana Dolamic.
+
+The Stempel analyzer (stempel) includes BSD-licensed software developed 
+by the Egothor project http://egothor.sf.net/, created by Leo Galambos, Martin Kvapil,
+and Edmond Nolan.
+
+The Polish analyzer (stempel) comes with a default
+stopword list that is BSD-licensed created by the Carrot2 project. The file resides
+in stempel/src/resources/org/apache/lucene/analysis/pl/stopwords.txt.
+See http://project.carrot2.org/license.html.
+
+The SmartChineseAnalyzer source code (smartcn) was
+provided by Xiaoping Gao and copyright 2009 by www.imdict.net.
+
+WordBreakTestUnicode_*.java (under modules/analysis/common/src/test/) 
+is derived from Unicode data such as the Unicode Character Database. 
+See http://unicode.org/copyright.html for more details.
+
+The Morfologik analyzer (morfologik) includes BSD-licensed software
+developed by Dawid Weiss and Marcin Miłkowski (http://morfologik.blogspot.com/).
+
+Morfologik uses data from Polish ispell/myspell dictionary
+(http://www.sjp.pl/slownik/en/) licenced on the terms of (inter alia)
+LGPL and Creative Commons ShareAlike.
+
+Morfologic includes data from BSD-licensed dictionary of Polish (SGJP)
+(http://sgjp.pl/morfeusz/)
+
+Servlet-api.jar and javax.servlet-*.jar are under the CDDL license, the original
+source code for this can be found at http://www.eclipse.org/jetty/downloads.php
+
+===========================================================================
+Kuromoji Japanese Morphological Analyzer - Apache Lucene Integration
+===========================================================================
+
+This software includes a binary and/or source version of data from
+
+  mecab-ipadic-2.7.0-20070801
+
+which can be obtained from
+
+  http://atilika.com/releases/mecab-ipadic/mecab-ipadic-2.7.0-20070801.tar.gz
+
+or
+
+  http://jaist.dl.sourceforge.net/project/mecab/mecab-ipadic/2.7.0-20070801/mecab-ipadic-2.7.0-20070801.tar.gz
+
+===========================================================================
+mecab-ipadic-2.7.0-20070801 Notice
+===========================================================================
+
+Nara Institute of Science and Technology (NAIST),
+the copyright holders, disclaims all warranties with regard to this
+software, including all implied warranties of merchantability and
+fitness, in no event shall NAIST be liable for
+any special, indirect or consequential damages or any damages
+whatsoever resulting from loss of use, data or profits, whether in an
+action of contract, negligence or other tortuous action, arising out
+of or in connection with the use or performance of this software.
+
+A large portion of the dictionary entries
+originate from ICOT Free Software.  The following conditions for ICOT
+Free Software applies to the current dictionary as well.
+
+Each User may also freely distribute the Program, whether in its
+original form or modified, to any third party or parties, PROVIDED
+that the provisions of Section 3 ("NO WARRANTY") will ALWAYS appear
+on, or be attached to, the Program, which is distributed substantially
+in the same form as set out herein and that such intended
+distribution, if actually made, will neither violate or otherwise
+contravene any of the laws and regulations of the countries having
+jurisdiction over the User or the intended distribution itself.
+
+NO WARRANTY
+
+The program was produced on an experimental basis in the course of the
+research and development conducted during the project and is provided
+to users as so produced on an experimental basis.  Accordingly, the
+program is provided without any warranty whatsoever, whether express,
+implied, statutory or otherwise.  The term "warranty" used herein
+includes, but is not limited to, any warranty of the quality,
+performance, merchantability and fitness for a particular purpose of
+the program and the nonexistence of any infringement or violation of
+any right of any third party.
+
+Each user of the program will agree and understand, and be deemed to
+have agreed and understood, that there is no warranty whatsoever for
+the program and, accordingly, the entire risk arising from or
+otherwise connected with the program is assumed by the user.
+
+Therefore, neither ICOT, the copyright holder, or any other
+organization that participated in or was otherwise related to the
+development of the program and their respective officials, directors,
+officers and other employees shall be held liable for any and all
+damages, including, without limitation, general, special, incidental
+and consequential damages, arising out of or otherwise in connection
+with the use or inability to use the program or any product, material
+or result produced or otherwise obtained by using the program,
+regardless of whether they have been advised of, or otherwise had
+knowledge of, the possibility of such damages at any time during the
+project or thereafter.  Each user will be deemed to have agreed to the
+foregoing by his or her commencement of use of the program.  The term
+"use" as used herein includes, but is not limited to, the use,
+modification, copying and distribution of the program and the
+production of secondary products from the program.
+
+In the case where the program, whether in its original form or
+modified, was distributed or delivered to or received by a user from
+any person, organization or entity other than ICOT, unless it makes or
+grants independently of ICOT any specific warranty to the user in
+writing, such person, organization or entity, will also be exempted
+from and not be held liable to the user for any such damages as noted
+above as far as the program is concerned.

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/fuseki
----------------------------------------------------------------------
diff --git a/jena-fuseki1/fuseki b/jena-fuseki1/fuseki
new file mode 100755
index 0000000..aeedd83
--- /dev/null
+++ b/jena-fuseki1/fuseki
@@ -0,0 +1,399 @@
+#!/usr/bin/env bash
+
+# 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.
+#
+# =========
+#
+# Startup script for Fuseki under *nix systems (works with cygwin too)
+#
+# Configuration
+# -------------
+# Default values are loaded from /etc/default/fuseki, if it exists.
+#
+# JAVA
+#   Command to invoke Java. If not set, java (from the PATH) will be used.
+#
+# JAVA_OPTIONS
+#   Extra options to pass to the JVM.
+#
+# FUSEKI_HOME
+#   Where Fuseki is installed.  If not set, the script will try
+#   to guess it based on the script invokation path.
+#
+# FUSEKI_RUN
+#   Where the fuseki.pid file should be stored.  It defaults
+#   first available of /var/run, /usr/var/run, and /tmp if not set.
+#
+# FUSEKI_PID
+#   The FUSEKI PID file, defaults to $FUSEKI_RUN/fuseki.pid
+#
+# FUSEKI_ARGS
+#   The arguments to pass to the Fuseki server on the command line. Defaults to:
+#    --update --loc=$FUSKEI_DATA_DIR /ds    # if FUSEKI_CONF is not set
+#    --config=$FUSEKI_CONF                  # if FUSEKI_CONF is set
+#
+# FUSEKI_CONF
+#   The Fuseki configuration file, usually in RDF Turtle notation.
+#
+# FUSEKI_USER
+#   If set, the server will be run as this user
+#
+# FUSEKI_DATA_DIR
+#   The location of the data directory Fuseki will use (i.e. the value of --loc).
+#   Defaults to $FUSEKI_HOME/DB
+#
+# FUSEKI_LOGS
+#   Directory where logs will be generated. Defaults to $FUSEKI_HOME/log
+#
+# FUSEKI_LOGS_STDERROUT
+#   Log file with stderr and stdout log output from Fuseki. Defaults to
+#   $FUSEKI_LOGS/stderrout.log
+
+### BEGIN INIT INFO
+# Provides:          fuseki
+# Required-Start:    $remote_fs $network
+# Required-Stop:     $remote_fs $network
+# Default-Start:     3 4 5
+# Default-Stop:      0 1 2 6
+# Short-Description: Start Jena Fuseki at boot time
+# Description:       Jena Fuseki is a service that provides a SPARQL API over HTTP to one more RDF triple stores
+### END INIT INFO
+
+usage()
+{
+  echo "Usage: ${0##*/} {start|stop|restart|status}"
+  exit 1
+}
+
+[ $# -gt 0 ] || usage
+
+# Utility functions:
+findDirectory()
+{
+  local L OP=$1
+  shift
+  for L in "$@"; do
+    [ "$OP" "$L" ] || continue
+    printf %s "$L"
+    break
+  done
+}
+
+running()
+{
+  local PID=$(cat "$1" 2>/dev/null) || return 1
+  kill -0 "$PID" 2>/dev/null
+}
+
+# Are we running in cygwin?
+cygwin=false
+case "`uname`" in
+    CYGWIN*) cygwin=true;;
+esac
+
+
+NAME=fuseki
+[ -f "/etc/default/$NAME" ] && . /etc/default/$NAME
+
+# Set FUSKEI_HOME to the script invocation directory if it is not specified
+if [ -z "$FUSEKI_HOME" ]
+then
+  SCRIPT="$0"
+  # Catch common issue: script has been symlinked
+  if [ -L "$SCRIPT" ]
+  then
+    SCRIPT="$(readlink "$0")"
+    # If link is relative
+    case "$SCRIPT" in
+      /*) ;; # fine
+      *) SCRIPT=$( dirname "$0" )/$SCRIPT;; # fix
+    esac
+  fi
+
+  # Work out root from script location
+  FUSEKI_HOME="$( cd "$( dirname "$SCRIPT" )" && pwd )"
+
+fi
+
+# Deal with more Cygwin path issues
+if [ "$cygwin" == "true" ]
+then
+  FUSEKI_HOME=`cygpath -w "$FUSEKI_HOME"`
+ fi
+
+#echo "DEBUG: FUSEKI_HOME=$FUSEKI_HOME"
+
+if [ ! -e "$FUSEKI_HOME" ]
+then
+  echo "$FUSEKI_HOME does not exist" 1>&2
+  exit 1
+fi
+
+
+# Find a location for the pid file
+if [ -z "$FUSEKI_RUN" ]
+then
+  FUSEKI_RUN=$(findDirectory -w /var/run /usr/var/run $FUSEKI_HOME /tmp)
+fi
+
+# Get PID file name
+if [ -z "$FUSEKI_PID" ]
+then
+  FUSEKI_PID="$FUSEKI_RUN/fuseki.pid"
+fi
+
+# Log directory
+if [ -z "$FUSEKI_LOGS" ]
+then
+  FUSEKI_LOGS="$FUSEKI_HOME/log"
+fi
+
+# Std Err and Out log
+if [ -z "$FUSEKI_LOGS_STDERROUT" ]
+then
+  FUSEKI_LOGS_STDERROUT="$FUSEKI_LOGS/stderrout.log"
+fi
+
+# Data directory
+if [ -z "$FUSEKI_DATA_DIR" ]
+then
+  FUSEKI_DATA_DIR="$FUSEKI_HOME/DB"
+fi
+
+# Set up JAVA if not set
+if [ -z "$JAVA" ]
+then
+  JAVA=$(which java)
+fi
+if [ -z "$JAVA" ]
+then
+  echo "Cannot find a Java JDK. Please set either set JAVA or put java (>=1.7) in your PATH." 2>&2
+  exit 1
+fi
+
+# The location of the start up JAR
+FUSEKI_START=$FUSEKI_HOME/fuseki-server.jar
+
+# Deal with Cygwin path issues
+if [ "$cygwin" == "true" ]
+then
+  DATA_DIR=`cygpath -w "$FUSEKI_DATA_DIR"`
+  FUSEKI_START=`cygpath -w "$FUSEKI_START"`
+else
+  DATA_DIR="$FUSEKI_DATA_DIR"
+fi
+
+#######################################
+#
+# TODO - Read these items from a Config file!
+#
+
+# Some JVM settings
+if [ -z "$JAVA_OPTIONS" ]
+then
+  JAVA_OPTIONS="-Xmx1200M"
+fi
+
+
+# Default Fuseki Arguments
+if [ -z "$FUSEKI_ARGS" ]
+then
+  if [ -z "$FUSEKI_CONF" ]
+  then
+    FUSEKI_ARGS="--update --loc=$DATA_DIR /ds"
+  else
+    FUSEKI_ARGS="--config=$FUSEKI_CONF"
+  fi
+fi
+
+if [ ! -z "$FUSEKI_HOME" ]
+then
+    FUSEKI_ADDITIONAL_ARGS=(--home "$FUSEKI_HOME")
+fi
+
+# Run command
+
+RUN_ARGS=(${JAVA_OPTIONS[@]} -jar "$FUSEKI_START" "${FUSEKI_ADDITIONAL_ARGS[@]}" $FUSEKI_ARGS)
+RUN_CMD=("$JAVA" "${RUN_ARGS[@]}")
+
+
+#######################################
+
+#####################################################
+# Comment these out after you're happy with what
+# the script is doing.
+#####################################################
+if (( DEBUG ))
+then
+  echo "FUSEKI_HOME    =  $FUSEKI_HOME"
+  echo "FUSEKI_CONF    =  $FUSEKI_CONF"
+  echo "FUSEKI_RUN     =  $FUSEKI_RUN"
+  echo "FUSEKI_PID     =  $FUSEKI_PID"
+  echo "FUSEKI_ARGS    =  $FUSEKI_ARGS"
+  echo "FUSEKI_START   =  $FUSEKI_START"
+  echo "CONFIGS        =  ${CONFIGS[*]}"
+  echo "JAVA           =  $JAVA"
+  echo "JAVA_OPTIONS   =  ${JAVA_OPTIONS[*]}"
+  echo "RUN_ARGS       =  ${RUN_ARGS[@]}"
+  echo "RUN_CMD        =  ${RUN_CMD[@]}"
+fi
+
+NO_START=0
+
+# Life cycle functions
+start() {
+
+  if (( NO_START )); then
+    echo "Not starting Fuseki - NO_START=1";
+    exit
+  fi
+
+  # Make sure the data and log directories exist
+  mkdir -p "$FUSEKI_DATA_DIR"
+  mkdir -p "$FUSEKI_LOGS"
+  if [ ! -z "$FUSEKI_USER" ]
+  then
+    chown "$FUSEKI_USER" "$FUSEKI_DATA_DIR" "$FUSEKI_LOGS"
+  fi
+
+  echo -n "Starting Fuseki: "
+  if type start-stop-daemon > /dev/null 2>&1
+  then
+    unset CH_USER
+    if [ -n "$FUSEKI_USER" ]
+    then
+      CH_USER="--chuid $FUSEKI_USER"
+    fi
+    if start-stop-daemon --start $CH_USER --chdir "$FUSEKI_HOME" --background --make-pidfile --pidfile "$FUSEKI_PID" --startas /bin/bash -- -c "exec $JAVA ${RUN_ARGS[*]} > $FUSEKI_LOGS_STDERROUT 2>&1"
+    then
+      sleep 1
+      if running "$FUSEKI_PID"
+      then
+        print_started
+      else
+        print_failed
+      fi
+    fi
+  else
+    if running $FUSEKI_PID
+    then
+        echo "Already Running!"
+        exit 1
+      else
+        # dead pid file - remove
+        rm -f "$FUSEKI_PID"
+    fi
+    if [ "$FUSEKI_USER" ]
+    then
+      touch "$FUSEKI_PID"
+      chown "$FUSEKI_USER" "$FUSEKI_PID"
+      su - "$FUSEKI_USER" -c "
+        echo 'Redirecting Fuseki stderr/stdout to $FUSEKI_LOGS_STDERROUT'
+        exec ${RUN_CMD[*]} &> '$FUSEKI_LOGS_STDERROUT' &
+        disown \$!
+        echo \$! > '$FUSEKI_PID'"
+    else
+      echo "Redirecting Fuseki stderr/stdout to $FUSEKI_LOGS_STDERROUT"
+      exec "${RUN_CMD[@]}" &> "$FUSEKI_LOGS_STDERROUT" &
+      disown $!
+      echo $! > "$FUSEKI_PID"
+    fi
+
+    print_started
+  fi
+}
+
+print_started() {
+  echo "STARTED Fuseki `date`"
+  echo "PID=$(cat "$FUSEKI_PID" 2>/dev/null)"
+}
+
+print_failed() {
+  echo "FAILED to start Fuseki `date`"
+}
+
+delete_fuseki_pid_file() {
+  rm -f "$FUSEKI_PID"
+}
+
+stop() {
+  echo -n "Stopping Fuseki: "
+
+  if ! running "$FUSEKI_PID"
+    then
+    echo "Fuseki is not running"
+    exit 1
+  fi
+
+  ###############################################################
+  # !!!! This code needs to be improved, too many repeats !!!!  #
+  ###############################################################
+  if type start-stop-daemon > /dev/null 2>&1; then
+    start-stop-daemon --stop --pidfile "$FUSEKI_PID" --chdir "$FUSEKI_HOME" --startas "$JAVA" --signal HUP
+
+    ## Die after a 30 second timeout
+    TIMEOUT=30
+    while running "$FUSEKI_PID"; do
+      if (( TIMEOUT-- == 0 )); then
+        start-stop-daemon --stop --pidfile "$FUSEKI_PID" --chdir "$FUSEKI_HOME" --startas "$JAVA" --signal KILL
+      fi
+        sleep 1
+    done
+    delete_fuseki_pid_file
+    echo OK
+  else
+    PID=$(cat "$FUSEKI_PID" 2>/dev/null)
+    kill "$PID" 2>/dev/null
+
+    TIMEOUT=30
+    while running $FUSEKI_PID; do
+      if (( TIMEOUT-- == 0 )); then
+        kill -KILL "$PID" 2>/dev/null
+      fi
+      sleep 1
+    done
+    delete_fuseki_pid_file
+    echo "OK"
+  fi
+}
+
+case $1 in
+  start)
+    start
+  ;;
+  stop)
+    stop
+  ;;
+  restart)
+    stop
+    start
+  ;;
+  status)
+    if running $FUSEKI_PID
+    then
+      echo -n "Fuseki is running with pid: "
+      echo `cat "$FUSEKI_PID"`
+    else
+      echo "Fuseki is not running"
+    fi
+  ;;
+  *)
+    usage
+  ;;
+esac
+
+exit 0

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/fuseki-server
----------------------------------------------------------------------
diff --git a/jena-fuseki1/fuseki-server b/jena-fuseki1/fuseki-server
new file mode 100755
index 0000000..d62a079
--- /dev/null
+++ b/jena-fuseki1/fuseki-server
@@ -0,0 +1,61 @@
+#!/bin/sh
+
+# 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.
+
+export FUSEKI_HOME="${FUSEKI_HOME:-$PWD}"
+
+if [ ! -e "$FUSEKI_HOME" ]
+then
+    echo "$FUSEKI_HOME does not exist" 1>&2
+    exit 1
+    fi
+
+JAR1="$FUSEKI_HOME/fuseki-server.jar"
+JAR2="$FUSEKI_HOME/jena-fuseki-*-server.jar"
+JAR=""
+
+for J in "$JAR1" "$JAR2"
+do
+    # Expand
+    J="$(echo $J)"
+    if [ -e "$J" ]
+    then
+	JAR="$J"
+	break
+    fi
+done
+
+if [ "$JAR" = "" ]
+then
+    echo "Can't find jarfile to run"
+    exit 1
+fi
+
+# Deal with Cygwin path issues
+cygwin=false
+case "`uname`" in
+    CYGWIN*) cygwin=true;;
+esac
+if [ "$cygwin" = "true" ]
+then
+    JAR=`cygpath -w "$JAR"`
+    FUSEKI_HOME=`cygpath -w "$FUSEKI_HOME"`
+fi
+
+JVM_ARGS=${JVM_ARGS:--Xmx1200M}
+
+exec java  $JVM_ARGS -jar "$JAR" "$@"

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/fuseki-server.bat
----------------------------------------------------------------------
diff --git a/jena-fuseki1/fuseki-server.bat b/jena-fuseki1/fuseki-server.bat
new file mode 100644
index 0000000..5881660
--- /dev/null
+++ b/jena-fuseki1/fuseki-server.bat
@@ -0,0 +1,19 @@
+@REM Licensed to the Apache Software Foundation (ASF) under one
+@REM or more contributor license agreements.  See the NOTICE file
+@REM distributed with this work for additional information
+@REM regarding copyright ownership.  The ASF licenses this file
+@REM to you under the Apache License, Version 2.0 (the
+@REM "License"); you may not use this file except in compliance
+@REM with the License.  You may obtain a copy of the License at
+@REM
+@REM     http://www.apache.org/licenses/LICENSE-2.0
+@REM
+@REM Unless required by applicable law or agreed to in writing, software
+@REM distributed under the License is distributed on an "AS IS" BASIS,
+@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@REM See the License for the specific language governing permissions and
+@REM limitations under the License.
+
+@echo off
+@REM modify this to name the server jar
+java -Xmx1200M -jar fuseki-server.jar %*

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/jetty-fuseki.xml
----------------------------------------------------------------------
diff --git a/jena-fuseki1/jetty-fuseki.xml b/jena-fuseki1/jetty-fuseki.xml
new file mode 100644
index 0000000..245b7c3
--- /dev/null
+++ b/jena-fuseki1/jetty-fuseki.xml
@@ -0,0 +1,47 @@
+<?xml version="1.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.
+-->
+
+<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
+ 
+<!-- 
+  Reference: http://wiki.eclipse.org/Jetty/Reference/jetty.xml_syntax
+  http://wiki.eclipse.org/Jetty/Reference/jetty.xml
+-->
+
+<Configure id="Fuseki" class="org.eclipse.jetty.server.Server">
+  <Call name="addConnector">
+    <Arg>
+      <!-- org.eclipse.jetty.server.nio.BlockingChannelConnector -->
+      <!-- org.eclipse.jetty.server.nio.SelectChannelConnector -->
+      <New class="org.eclipse.jetty.server.nio.SelectChannelConnector">
+	<!-- BlockingChannelConnector specific:
+	     <Set name="useDirectBuffer">false</Set>
+	-->
+	<!-- Only listen to interface ...
+	<Set name="host">localhost</Set>
+	-->
+	<Set name="port">3535</Set>
+	<Set name="maxIdleTime">0</Set>
+	<!-- All connectors -->
+	<Set name="requestHeaderSize">65536</Set>       <!-- 64*1024 -->
+	<Set name="requestBufferSize">5242880</Set>     <!-- 5*1024*1024 -->
+	<Set name="responseBufferSize">5242880</Set>    <!-- 5*1024*1024 -->
+      </New>
+    </Arg>
+  </Call>
+</Configure>

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/make_cp_mvn
----------------------------------------------------------------------
diff --git a/jena-fuseki1/make_cp_mvn b/jena-fuseki1/make_cp_mvn
new file mode 100755
index 0000000..d8b245e
--- /dev/null
+++ b/jena-fuseki1/make_cp_mvn
@@ -0,0 +1,52 @@
+#!/usr/bin/perl
+# 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.
+#
+# Write a run script.
+
+$POM="pom.xml" ;
+$POM = @ARGV[0] if ( defined(@ARGV[0]) ) ;
+
+if ( ! -e "$POM" )
+{
+    print STDERR "No POM file: $POM\n" ;
+    exit 1 ;
+}
+$M2=$ENV{'M2_REPO'} ;
+print "#!/bin/bash\n" ;
+print "# Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0"
+print "\n" ;
+print 'XCP="' ;
+
+open(X, "mvn -f $POM dependency:build-classpath |") ;
+while(<X>)
+{
+    next if /\[INFO\]/ ;
+    next if /^Download/ ;
+    chop ;
+    #s!$M2/org/apache/jena/jena-[^/]*/[^/]*/[^/]*.jar:!!g ;
+    print "$_" ;
+}
+print "\"\n" ;
+print "\n" ;
+
+print "if [ \"\$CP\" != \'\' ]\n" ;
+print "then\n" ;
+print "   XCP=\"\$CP:\$XCP\"\n" ;
+print "fi\n" ;
+print "\n" ;
+print "echo \"\$XCP\"\n"
+

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/make_links
----------------------------------------------------------------------
diff --git a/jena-fuseki1/make_links b/jena-fuseki1/make_links
new file mode 100755
index 0000000..7eb82b9
--- /dev/null
+++ b/jena-fuseki1/make_links
@@ -0,0 +1,10 @@
+#!/bin/bash
+# Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
+
+SOH=${SOH:-soh}
+for s in s-head s-get s-put s-post s-delete s-query s-update s-update-form
+do
+    rm -f $s
+    #ln -s "$SOH" $s
+    cp "$SOH" $s
+done

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/pages/books.ttl
----------------------------------------------------------------------
diff --git a/jena-fuseki1/pages/books.ttl b/jena-fuseki1/pages/books.ttl
new file mode 100644
index 0000000..eeeadb6
--- /dev/null
+++ b/jena-fuseki1/pages/books.ttl
@@ -0,0 +1,47 @@
+# Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
+@prefix dc:        <http://purl.org/dc/elements/1.1/> .
+@prefix vcard:     <http://www.w3.org/2001/vcard-rdf/3.0#> .
+@prefix ns:        <http://example.org/ns#> .
+
+@prefix :          <http://example.org/book/> .
+
+# A small dataset for usage examples of Fuseki
+# This data is intentionaly irregular (e.g. different ways to
+# record the book creator) as if the information is either an
+# aggregation or was created at different times.
+
+:book1
+    dc:title    "Harry Potter and the Philosopher's Stone" ;
+    dc:creator  "J.K. Rowling" ;
+    .
+    
+:book2
+    dc:title    "Harry Potter and the Chamber of Secrets" ;
+    dc:creator  _:a .
+    
+:book3
+    dc:title    "Harry Potter and the Prisoner Of Azkaban" ;
+    dc:creator  _:a .
+    
+:book4
+    dc:title    "Harry Potter and the Goblet of Fire" .
+    
+:book5
+    dc:title    "Harry Potter and the Order of the Phoenix";
+    dc:creator  "J.K. Rowling" ;
+    .
+
+:book6
+    dc:title    "Harry Potter and the Half-Blood Prince";
+    dc:creator  "J.K. Rowling" .
+
+:book7
+    dc:title    "Harry Potter and the Deathly Hallows" ;
+    dc:creator  "J.K. Rowling" .
+_:a
+    vcard:FN "J.K. Rowling" ;
+    vcard:N
+        [ vcard:Family "Rowling" ;
+          vcard:Given "Joanna" 
+        ]
+    .

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/pages/control-panel.tpl
----------------------------------------------------------------------
diff --git a/jena-fuseki1/pages/control-panel.tpl b/jena-fuseki1/pages/control-panel.tpl
new file mode 100644
index 0000000..b69994e
--- /dev/null
+++ b/jena-fuseki1/pages/control-panel.tpl
@@ -0,0 +1,41 @@
+<!--
+   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.
+-->
+<html>
+  <head>
+    <title>Fuseki - A SPARQL 1.1 Server</title>
+    <link rel="stylesheet" type="text/css" href="fuseki.css" />
+  </head>
+
+  <body>
+    <h1>Fuseki Control Panel</h1>
+
+#set( $datasets = $mgt.datasets($request) )
+#set( $action   = $mgt.actionDataset($request) )
+
+    <div class="moreindent">
+    <form action="${action}" method="post">
+      Dataset: <select name="dataset">
+#foreach($ds in $datasets)
+        <option value="${ds}">${ds}</option>
+#end
+      <div>
+        <input type="submit" value="Select">
+      </div>
+    </form>
+    </div>
+  </body>
+</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/pages/data-validator.html
----------------------------------------------------------------------
diff --git a/jena-fuseki1/pages/data-validator.html b/jena-fuseki1/pages/data-validator.html
new file mode 100644
index 0000000..0c90949
--- /dev/null
+++ b/jena-fuseki1/pages/data-validator.html
@@ -0,0 +1,67 @@
+<!--
+   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.
+-->
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head><title>SPARQLer Data Validator</title>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+    <link rel="stylesheet" type="text/css" href="fuseki.css" />
+  </head>
+  <body>
+    <h1>SPARQLer Data Validator</h1>
+    <div class="moreindent">
+      <form action="validate/data" method="post" accept-charset="UTF-8" >
+	    <textarea name="data" cols="70" rows="30">
+# Prefixes for Turtle or TriG - these can be edited or removed.
+@base          &lt;http://example.org/base/> .
+@prefix :      &lt;http://example.org/> .
+@prefix xsd:   &lt;http://www.w3.org/2001/XMLSchema#> .
+@prefix rdf:   &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+@prefix rdfs:  &lt;http://www.w3.org/2000/01/rdf-schema#> .
+@prefix owl:   &lt;http://www.w3.org/2002/07/owl#> .
+
+
+</textarea>
+<br/>
+Input syntax:
+<input type="radio" name="languageSyntax" value="Turtle" checked="checked"/>Turtle
+<input type="radio" name="languageSyntax" value="TriG"/>TriG
+<input type="radio" name="languageSyntax" value="N-Triples"/>N-Triples
+<input type="radio" name="languageSyntax" value="N-Quads"/>N-Quad
+  <br/>
+      <!--
+Output syntax:
+  <input type="checkbox" name="outputFormat" value="sparql" checked="checked"/>SPARQL
+  <input type="checkbox" name="outputFormat" value="algebra"/>SPARQL algebra
+  <input type="checkbox" name="outputFormat" value="quads"/>SPARQL algebra (quads)
+  <br/>
+
+  Line numbers:
+  <input type="radio" name="linenumbers" value="true" checked="checked"/>Yes
+  <input type="radio" name="linenumbers" value="false"/>No
+  <br/>
+      -->
+        <input type="submit" value="Validate RDF Data" />
+      </form>
+      <hr/>
+Parsing provided by <a href="http://jena.apache.org/documentation/io/riot.html">Jena/RIOT</a>.
+Questions to 
+<href="mailto:users@jena.apache.org?s=[Data Validator]: "
+ >the Jena users mailing list</a>
+(include full details of input).
+    </div>
+  </body>
+</html>

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/pages/favicon.ico
----------------------------------------------------------------------
diff --git a/jena-fuseki1/pages/favicon.ico b/jena-fuseki1/pages/favicon.ico
new file mode 100644
index 0000000..f5d685e
Binary files /dev/null and b/jena-fuseki1/pages/favicon.ico differ

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/pages/fuseki.css
----------------------------------------------------------------------
diff --git a/jena-fuseki1/pages/fuseki.css b/jena-fuseki1/pages/fuseki.css
new file mode 100644
index 0000000..cb4aa20
--- /dev/null
+++ b/jena-fuseki1/pages/fuseki.css
@@ -0,0 +1,148 @@
+/**
+   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.
+*/
+body {
+    font-family: Verdana, Arial, Helvetica, sans-serif ;
+    font-size: 10pt ;
+    line-height: 18pt ;
+    color: black;
+    background: white ;
+    margin: 0 ;
+}
+
+p { margin-left: 2% ; margin-right: 2% ; }
+
+.warning { color: #FF0000 ; }
+.error   { color: #FF0000 ;  font-weight: bold; }
+
+/* Makes lists a little tighter
+li { line-height: 14pt ; }
+*/
+
+textarea { background-color: #F0F0F0 ; }
+
+table {
+  font-family: Verdana, Arial, sans-serif ;
+  font-size: 10pt ;
+  border-collapse: collapse;
+  border: 1px solid black ;
+  cellspacing: 0 ;
+  cellpadding: 0 
+}
+
+td {
+  border: 1px solid #808080 ;
+  empty-cells: show;
+  padding: 5 ;
+  spacing: 0 ;
+  vertical-align:top;
+  text-align:center
+}
+
+
+th {
+  border: 1px solid #808080 ;
+  empty-cells: show;
+  padding: 5 ;
+  vertical-align:top;
+  text-align:center
+}
+
+.box 
+{ margin-left :     5% ;
+  margin-right :    5% ;
+  border:           solid ;
+  border-width:     thin; 
+  background-color: #F0F0F0; 
+  padding:          2mm;
+  page-break-inside: avoid ;
+}
+
+.noindent     { margin-left: -5% ; margin-right: -5%; }
+.moreindent   { margin-left:  5% ; margin-right:  5%; }
+
+
+/* Use this for the document title as displayed on the page at the top. */
+
+
+h1 {
+    text-align:center ;
+    font-size: 14pt;
+    line-height: 24pt ;
+    font-weight: bold;
+    color:#000;
+    background:#CADFF4;
+    padding: 0 ;
+    margin: 0 ;
+    padding-left: 1ex;
+    padding-right: 1ex;
+    text-align:center;
+}
+
+h2 {
+    font-size: 12pt;
+    line-height: 16pt ;
+    font-size: 110%;
+    font-weight: bold;
+    color: #003399;
+    background:#CADFF4;
+    margin-bottom:5px;
+    padding-left: 1ex;
+    padding-right: 1ex;
+}
+
+h3, h4, h5 {
+    font-size: 100%;
+    font-weight: bold;
+    margin-bottom:3px;
+}
+
+ul { list-style-type: disc }
+dt { font-weight: bold }
+
+/* Change background/foreground colour on hover */
+
+A:link { color: rgb(0, 0, 255) }        /* for unvisited links */
+A:hover { color: rgb(255, 0, 0) }       /* when mouse is over link */
+
+/* No extra space between paragraphs : inherits from body */
+pre {
+    font-family: monospace;
+    font-size: 10pt ;
+    line-height: 14pt ;
+    margin-top: 1 ;
+    margin-bottom: 1 ;
+    margin-left: 5ex ;
+    }
+
+/* Some general utility definitions */
+.centered {
+    text-align: center;
+}
+
+.caption {
+    text-align: center;
+    font-size: smaller;
+}
+
+code {
+    font-size: 10pt;
+}
+
+.footnote {
+    font-size: smaller;
+    border-top: thin solid gray;
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/pages/fuseki.html
----------------------------------------------------------------------
diff --git a/jena-fuseki1/pages/fuseki.html b/jena-fuseki1/pages/fuseki.html
new file mode 100644
index 0000000..0ed9e8a
--- /dev/null
+++ b/jena-fuseki1/pages/fuseki.html
@@ -0,0 +1,55 @@
+<!--
+   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.
+-->
+
+<html>
+  <head>
+    <title>Fuseki - A SPARQL 1.1 Server</title>
+    <link rel="stylesheet" type="text/css" href="fuseki.css" />
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+  </head>
+
+  <body>
+    <h1>Fuseki</h1>
+
+    <h2>Server Management</h2>
+    <p><a href="control-panel.tpl">Control Panel</a></p>
+    
+    <h2>Documentation</h2>
+    <p><a href="http://jena.apache.org/documentation/serving_data/index.html">Fuseki documentation</a></p>
+
+    <h2>Validators</h2>
+    <ul>
+      <li><a href="query-validator.html">SPARQL query validator</a></li>
+      <li><a href="update-validator.html">SPARQL update validator</a></li>
+      <li><a href="data-validator.html">RDF data validator</a></li>
+      <li><a href="iri-validator.html">IRI validator</a></li>
+    </ul>
+
+    <h2>General SPARQL Service</h2>
+    <ul>
+      <li><a href="sparql.html">SPARQL query form</a></li>
+    </ul>
+
+    <h2>Standards</h2>
+    <ul>
+      <li> <a href="http://www.w3.org/TR/sparql11-query/">SPARQL 1.1 Query</a></li>
+      <li> <a href="http://www.w3.org/TR/sparql11-update/">SPARQL 1.1 Update</a></li>
+      <li> <a href="http://www.w3.org/TR/sparql11-protocol/">SPARQL 1.1 Protocol</a></li>
+      <li> <a href="http://www.w3.org/TR/sparql11-http-rdf-update/">SPARQL 1.1 Uniform HTTP Protocol for Managing RDF Graphs</a>
+    </ul>
+  </body>
+</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/pages/iri-validator.html
----------------------------------------------------------------------
diff --git a/jena-fuseki1/pages/iri-validator.html b/jena-fuseki1/pages/iri-validator.html
new file mode 100644
index 0000000..2c8f7cc
--- /dev/null
+++ b/jena-fuseki1/pages/iri-validator.html
@@ -0,0 +1,38 @@
+<!--
+   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.
+-->
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head><title>SPARQLer IRI Validator</title>
+  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+  <link rel="stylesheet" type="text/css" href="fuseki.css" />
+  </head>
+  <body>
+    <h1>SPARQLer IRI Validator</h1>
+
+    <div class="moreindent">
+
+      <form action="validate/iri"  accept-charset="UTF-8">
+	    <p>
+	      <textarea name="iri" cols="70" rows="2"></textarea>
+
+          <input type="submit" value="Validate IRI" />
+	    </p>
+      </form>
+      <hr/>
+    </div>
+  </body>
+</html>

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/pages/ping.txt
----------------------------------------------------------------------
diff --git a/jena-fuseki1/pages/ping.txt b/jena-fuseki1/pages/ping.txt
new file mode 100644
index 0000000..1323ba7
--- /dev/null
+++ b/jena-fuseki1/pages/ping.txt
@@ -0,0 +1 @@
+Ping!

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/pages/query-validator.html
----------------------------------------------------------------------
diff --git a/jena-fuseki1/pages/query-validator.html b/jena-fuseki1/pages/query-validator.html
new file mode 100644
index 0000000..85b9119
--- /dev/null
+++ b/jena-fuseki1/pages/query-validator.html
@@ -0,0 +1,71 @@
+<!--
+   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.
+-->
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head><title>SPARQLer Query Validator</title>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+  <link rel="stylesheet" type="text/css" href="fuseki.css" />
+
+  </head>
+  <body>
+    <h1>SPARQLer Query Validator</h1>
+
+    <div class="moreindent">
+
+      <form action="validate/query" method="post" accept-charset="UTF-8">
+	<p>
+	  <textarea name="query" cols="70" rows="30">
+PREFIX xsd:     &lt;http://www.w3.org/2001/XMLSchema#>
+PREFIX rdf:     &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
+PREFIX rdfs:    &lt;http://www.w3.org/2000/01/rdf-schema#>
+PREFIX owl:     &lt;http://www.w3.org/2002/07/owl#>
+PREFIX fn:      &lt;http://www.w3.org/2005/xpath-functions#>
+PREFIX apf:     &lt;http://jena.hpl.hp.com/ARQ/property#>
+PREFIX dc:      &lt;http://purl.org/dc/elements/1.1/>
+
+SELECT ?book ?title
+WHERE
+   { ?book dc:title ?title }</textarea>
+<br/>
+  Input syntax:<br/>
+    <input type="radio" name="languageSyntax" value="SPARQL" checked="checked"/>SPARQL
+    <input type="radio" name="languageSyntax" value="ARQ"/>SPARQL extended syntax
+  <br/>
+  <br/>
+Output:<br/>
+  <input type="checkbox" name="outputFormat" value="sparql" checked="checked"/>SPARQL<br/>
+  <input type="checkbox" name="outputFormat" value="algebra"/>SPARQL algebra<br/>
+  <input type="checkbox" name="outputFormat" value="quads"/>SPARQL algebra (quads)<br/>
+  <input type="checkbox" name="outputFormat" value="opt"/>SPARQL algebra
+(general optimizations)<br/>
+  <input type="checkbox" name="outputFormat" value="optquads"/>SPARQL algebra
+(quads, general optimizations)<br/>
+  <br/>
+  Line numbers:
+  <input type="radio" name="linenumbers" value="true" checked="checked"/>Yes
+  <input type="radio" name="linenumbers" value="false"/>No
+  <br/>
+
+
+  <input type="submit" value="Validate SPARQL Query" />
+	</p>
+      </form>
+
+      <hr/>
+    </div>
+  </body>
+</html>

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/pages/robots.txt
----------------------------------------------------------------------
diff --git a/jena-fuseki1/pages/robots.txt b/jena-fuseki1/pages/robots.txt
new file mode 100644
index 0000000..1f53798
--- /dev/null
+++ b/jena-fuseki1/pages/robots.txt
@@ -0,0 +1,2 @@
+User-agent: *
+Disallow: /

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/pages/sparql.html
----------------------------------------------------------------------
diff --git a/jena-fuseki1/pages/sparql.html b/jena-fuseki1/pages/sparql.html
new file mode 100644
index 0000000..e29b040
--- /dev/null
+++ b/jena-fuseki1/pages/sparql.html
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<!--
+   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.
+-->
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head><title>SPARQLer</title>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+    <link rel="stylesheet" type="text/css" href="fuseki.css" />
+  </head>
+
+  <body>
+    <h1>SPARQLer - General purpose processor</h1>
+
+    <div class="moreindent">
+
+      <form action="sparql" method="get">
+        <p>General SPARQL query : input query, set any options and press "Get Results"</p>
+        <p>
+          <textarea name="query" cols="70" rows="20"></textarea>
+          <br/>
+          Target graph URI (or use <code>FROM</code> in the query)
+          <input name="default-graph-uri" size="25" value="" />
+          <br/>
+
+          Output: <select name="output">
+            <option value="json">JSON</option>
+            <option value="xml">XML</option>
+            <option value="text">Text</option>
+            <option value="csv">CSV</option>
+            <option value="tsv">TSV</option>
+          </select>
+          <br/>
+          If XML output, XSLT style sheet (blank for none): 
+          <select name="stylesheet">
+            <option value=""></option>
+            <option value="/xml-to-html.xsl">xml-to-html</option>
+            <option value="/xml-to-html-links.xsl">xml-to-html-links</option>
+            <option value="/xml-to-html-plain.xsl">xml-to-html-plain</option>
+          </select>
+          <br/>
+          <input type="checkbox" name="force-accept" value="text/plain"/>
+          Force the accept header to <tt>text/plain</tt> regardless 
+          <br/>
+          <input type="submit" value="Get Results" />
+        </p>
+      </form>
+    </div>
+
+    <hr/>
+
+  </body>
+</html>


[11/23] jena git commit: Rename folder jena-fuseki to jena-fuseki1

Posted by an...@apache.org.
http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/test/java/org/apache/jena/fuseki/TestAuth.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/test/java/org/apache/jena/fuseki/TestAuth.java b/jena-fuseki/src/test/java/org/apache/jena/fuseki/TestAuth.java
deleted file mode 100644
index 4cff28d..0000000
--- a/jena-fuseki/src/test/java/org/apache/jena/fuseki/TestAuth.java
+++ /dev/null
@@ -1,429 +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.fuseki;
-
-import java.io.File ;
-import java.io.FileWriter ;
-import java.io.IOException ;
-import java.net.URI ;
-import java.net.URISyntaxException ;
-import java.util.HashMap ;
-import java.util.Map ;
-
-import org.apache.jena.atlas.logging.LogCtl ;
-import org.apache.jena.atlas.web.HttpException ;
-import org.apache.jena.atlas.web.auth.PreemptiveBasicAuthenticator ;
-import org.apache.jena.atlas.web.auth.ScopedAuthenticator ;
-import org.apache.jena.atlas.web.auth.ServiceAuthenticator ;
-import org.apache.jena.atlas.web.auth.SimpleAuthenticator ;
-import org.apache.jena.fuseki.server.FusekiConfig ;
-import org.apache.jena.fuseki.server.SPARQLServer ;
-import org.apache.jena.fuseki.server.ServerConfig ;
-import org.junit.AfterClass ;
-import org.junit.Assert ;
-import org.junit.BeforeClass ;
-import org.junit.Test ;
-
-import com.hp.hpl.jena.query.ARQ ;
-import com.hp.hpl.jena.query.DatasetAccessor ;
-import com.hp.hpl.jena.query.DatasetAccessorFactory ;
-import com.hp.hpl.jena.query.QueryExecutionFactory ;
-import com.hp.hpl.jena.rdf.model.Model ;
-import com.hp.hpl.jena.sparql.core.DatasetGraph ;
-import com.hp.hpl.jena.sparql.core.DatasetGraphFactory ;
-import com.hp.hpl.jena.sparql.engine.http.QueryEngineHTTP ;
-import com.hp.hpl.jena.sparql.engine.http.QueryExceptionHTTP ;
-import com.hp.hpl.jena.sparql.engine.http.Service ;
-import com.hp.hpl.jena.sparql.modify.UpdateProcessRemoteBase ;
-import com.hp.hpl.jena.sparql.util.Context ;
-import com.hp.hpl.jena.update.UpdateExecutionFactory ;
-import com.hp.hpl.jena.update.UpdateFactory ;
-import com.hp.hpl.jena.update.UpdateRequest ;
-
-/**
- * Tests Fuseki operation with authentication enabled
- */
-public class TestAuth {
-    // Use different port etc because sometimes the previous testing servers
-    // don't release ports fast enough (OS issue / Linux)
-    public static final int authPort             = ServerTest.port+10 ;
-    public static final String authUrlRoot       = "http://localhost:"+authPort+"/" ;
-    public static final String authDatasetPath   = "/dataset" ;
-    public static final String authServiceUpdate = "http://localhost:"+authPort+authDatasetPath+"/update" ; 
-    public static final String authServiceQuery  = "http://localhost:"+authPort+authDatasetPath+"/query" ; 
-    public static final String authServiceREST   = "http://localhost:"+authPort+authDatasetPath+"/data" ;
-
-    
-    private static File realmFile;
-    private static SPARQLServer server;
-
-    /**
-     * Sets up the authentication for tests
-     * @throws IOException
-     */
-    @BeforeClass
-    public static void setup() throws IOException {
-        realmFile = File.createTempFile("realm", ".properties");
-
-        try(FileWriter writer = new FileWriter(realmFile)) {
-            writer.write("allowed: password, fuseki\n");
-            writer.write("forbidden: password, other");
-        }
-
-        LogCtl.logLevel(Fuseki.serverLog.getName(), org.apache.log4j.Level.WARN, java.util.logging.Level.WARNING);
-        LogCtl.logLevel(Fuseki.requestLog.getName(), org.apache.log4j.Level.WARN, java.util.logging.Level.WARNING);
-        LogCtl.logLevel("org.eclipse.jetty", org.apache.log4j.Level.WARN, java.util.logging.Level.WARNING);
-
-        DatasetGraph dsg = DatasetGraphFactory.createMem();
-        // This must agree with ServerTest
-        ServerConfig conf = FusekiConfig.defaultConfiguration(authDatasetPath, dsg, true, true);
-        conf.port = authPort ;
-        conf.pagesPort = authPort ;
-        conf.authConfigFile = realmFile.getAbsolutePath();
-
-        server = new SPARQLServer(conf);
-        server.start();
-    }
-
-    /**
-     * Tears down authentication test setup
-     */
-    @AfterClass
-    public static void teardown() {
-        server.stop();
-
-        realmFile.delete();
-    }
-
-    @Test(expected = QueryExceptionHTTP.class)
-    public void query_with_auth_01() {
-        QueryEngineHTTP qe = (QueryEngineHTTP) QueryExecutionFactory.sparqlService(authServiceQuery, "ASK { }");
-        // No auth credentials should result in an error
-        qe.execAsk();
-    }
-
-    @Test(expected = QueryExceptionHTTP.class)
-    public void query_with_auth_02() {
-        QueryEngineHTTP qe = (QueryEngineHTTP) QueryExecutionFactory.sparqlService(authServiceQuery, "ASK { }");
-        // Auth credentials for valid user with bad password
-        qe.setBasicAuthentication("allowed", "incorrect".toCharArray());
-        qe.execAsk();
-    }
-
-    @Test
-    public void query_with_auth_03() {
-        QueryEngineHTTP qe = (QueryEngineHTTP) QueryExecutionFactory.sparqlService(authServiceQuery, "ASK { }");
-        // Auth credentials for valid user with correct password
-        qe.setBasicAuthentication("allowed", "password".toCharArray());
-        Assert.assertTrue(qe.execAsk());
-    }
-
-    @Test(expected = QueryExceptionHTTP.class)
-    public void query_with_auth_04() {
-        QueryEngineHTTP qe = (QueryEngineHTTP) QueryExecutionFactory.sparqlService(authServiceQuery, "ASK { }");
-        // Auth credentials for valid user with correct password BUT not in
-        // correct role
-        qe.setBasicAuthentication("forbidden", "password".toCharArray());
-        qe.execAsk();
-    }
-
-    @Test
-    public void query_with_auth_05() {
-        // Uses auth and enables compression
-        QueryEngineHTTP qe = (QueryEngineHTTP) QueryExecutionFactory.sparqlService(authServiceQuery, "ASK { }");
-        qe.setAllowDeflate(true);
-        qe.setAllowGZip(true);
-
-        // Auth credentials for valid user with correct password
-        qe.setBasicAuthentication("allowed", "password".toCharArray());
-        Assert.assertTrue(qe.execAsk());
-    }
-
-    @Test(expected = QueryExceptionHTTP.class)
-    public void query_with_auth_06() {
-        // Uses auth and enables compression
-        QueryEngineHTTP qe = (QueryEngineHTTP) QueryExecutionFactory.sparqlService(authServiceQuery, "ASK { }");
-        qe.setAllowDeflate(true);
-        qe.setAllowGZip(true);
-
-        // Auth credentials for valid user with bad password
-        qe.setBasicAuthentication("allowed", "incorrect".toCharArray());
-        qe.execAsk();
-    }
-
-    @Test(expected = QueryExceptionHTTP.class)
-    public void query_with_auth_07() throws URISyntaxException {
-        QueryEngineHTTP qe = (QueryEngineHTTP) QueryExecutionFactory.sparqlService(authServiceQuery, "ASK { }");
-
-        // Auth credentials for valid user with correct password but scoped to
-        // wrong URI
-        ScopedAuthenticator authenticator = new ScopedAuthenticator(new URI("http://example"), "allowed",
-                "password".toCharArray());
-        qe.setAuthenticator(authenticator);
-        qe.execAsk();
-    }
-
-    @Test
-    public void query_with_auth_08() throws URISyntaxException {
-        QueryEngineHTTP qe = (QueryEngineHTTP) QueryExecutionFactory.sparqlService(authServiceQuery, "ASK { }");
-
-        // Auth credentials for valid user with correct password and scoped to
-        // correct URI
-        ScopedAuthenticator authenticator = new ScopedAuthenticator(new URI(authServiceQuery), "allowed", "password".toCharArray());
-        qe.setAuthenticator(authenticator);
-        Assert.assertTrue(qe.execAsk());
-    }
-
-    @Test
-    public void query_with_auth_09() throws URISyntaxException {
-        QueryEngineHTTP qe = (QueryEngineHTTP) QueryExecutionFactory.sparqlService(authServiceQuery, "ASK { }");
-
-        // Auth credentials for valid user with correct password using
-        // pre-emptive auth
-        ScopedAuthenticator authenticator = new ScopedAuthenticator(new URI(authServiceQuery), "allowed", "password".toCharArray());
-        qe.setAuthenticator(new PreemptiveBasicAuthenticator(authenticator));
-        Assert.assertTrue(qe.execAsk());
-    }
-
-    @Test
-    public void query_with_auth_10() {
-        Context ctx = ARQ.getContext();
-        try {
-            QueryEngineHTTP qe = (QueryEngineHTTP) QueryExecutionFactory.sparqlService(authServiceQuery, "ASK { }");
-
-            // Auth credentials for valid user with correct password and scoped
-            // to correct URI
-            // Provided via Service Context and its associated authenticator
-            Map<String, Context> serviceContext = new HashMap<String, Context>();
-            Context authContext = new Context();
-            authContext.put(Service.queryAuthUser, "allowed");
-            authContext.put(Service.queryAuthPwd, "password");
-            serviceContext.put(authServiceQuery, authContext);
-            ctx.put(Service.serviceContext, serviceContext);
-
-            qe.setAuthenticator(new ServiceAuthenticator());
-            Assert.assertTrue(qe.execAsk());
-        } finally {
-            ctx.remove(Service.serviceContext);
-        }
-    }
-    
-    @Test
-    public void query_with_auth_11() {
-        Context ctx = ARQ.getContext();
-        try {
-            QueryEngineHTTP qe = (QueryEngineHTTP) QueryExecutionFactory.sparqlService(authServiceQuery, "ASK { }");
-
-            // Auth credentials for valid user with correct password and scoped
-            // to base URI of the actual service URL
-            // Provided via Service Context and its associated authenticator
-            Map<String, Context> serviceContext = new HashMap<String, Context>();
-            Context authContext = new Context();
-            authContext.put(Service.queryAuthUser, "allowed");
-            authContext.put(Service.queryAuthPwd, "password");
-            serviceContext.put(authUrlRoot, authContext);
-            ctx.put(Service.serviceContext, serviceContext);
-
-            qe.setAuthenticator(new ServiceAuthenticator());
-            Assert.assertTrue(qe.execAsk());
-        } finally {
-            ctx.remove(Service.serviceContext);
-        }
-    }
-    
-    @Test
-    public void query_with_auth_12() {
-        ARQ.getContext().remove(Service.serviceContext);
-
-        QueryEngineHTTP qe = (QueryEngineHTTP) QueryExecutionFactory.sparqlService(authServiceQuery, "ASK { }");
-
-        // Auth credentials for valid user with correct password
-        // Use service authenticator with fallback credentials.
-        qe.setAuthenticator(new ServiceAuthenticator("allowed", "password".toCharArray()));
-        Assert.assertTrue(qe.execAsk());
-     }
-    
-    @Test
-    public void query_with_auth_13() throws URISyntaxException {
-        QueryEngineHTTP qe = (QueryEngineHTTP) QueryExecutionFactory.sparqlService(authServiceQuery, "ASK { }");
-
-        // Auth credentials for valid user with correct password and scoped to
-        // base URI of the actual service URL
-        ScopedAuthenticator authenticator = new ScopedAuthenticator(new URI(authUrlRoot), "allowed", "password".toCharArray());
-        qe.setAuthenticator(authenticator);
-        Assert.assertTrue(qe.execAsk());
-    }
-    
-    @Test
-    public void query_with_auth_14() throws URISyntaxException {
-        QueryEngineHTTP qe = (QueryEngineHTTP) QueryExecutionFactory.sparqlService(authServiceQuery, "ASK { }");
-
-        // Auth credentials for valid user with correct password and scoped to
-        // base URI of the actual service URL
-        ScopedAuthenticator authenticator = new ScopedAuthenticator(new URI("http://localhost:" + authPort), "allowed", "password".toCharArray());
-        qe.setAuthenticator(authenticator);
-        Assert.assertTrue(qe.execAsk());
-    }
-
-    @Test(expected = HttpException.class)
-    public void update_with_auth_01() {
-        UpdateRequest updates = UpdateFactory.create("CREATE SILENT GRAPH <http://graph>");
-        UpdateProcessRemoteBase ue = (UpdateProcessRemoteBase) UpdateExecutionFactory.createRemote(updates, authServiceUpdate);
-        // No auth credentials should result in an error
-        ue.execute();
-    }
-
-    @Test(expected = HttpException.class)
-    public void update_with_auth_02() {
-        UpdateRequest updates = UpdateFactory.create("CREATE SILENT GRAPH <http://graph>");
-        UpdateProcessRemoteBase ue = (UpdateProcessRemoteBase) UpdateExecutionFactory.createRemote(updates, authServiceUpdate);
-        // Auth credentials for valid user with bad password
-        ue.setAuthentication("allowed", "incorrect".toCharArray());
-        ue.execute();
-    }
-
-    @Test
-    public void update_with_auth_03() {
-        UpdateRequest updates = UpdateFactory.create("CREATE SILENT GRAPH <http://graph>");
-        UpdateProcessRemoteBase ue = (UpdateProcessRemoteBase) UpdateExecutionFactory.createRemote(updates, authServiceUpdate);
-        // Auth credentials for valid user with correct password
-        ue.setAuthentication("allowed", "password".toCharArray());
-        ue.execute();
-    }
-
-    @Test(expected = HttpException.class)
-    public void update_with_auth_04() {
-        UpdateRequest updates = UpdateFactory.create("CREATE SILENT GRAPH <http://graph>");
-        UpdateProcessRemoteBase ue = (UpdateProcessRemoteBase) UpdateExecutionFactory.createRemote(updates, authServiceUpdate);
-        // Auth credentials for valid user with correct password BUT not in
-        // correct role
-        ue.setAuthentication("forbidden", "password".toCharArray());
-        ue.execute();
-    }
-
-    @Test(expected = HttpException.class)
-    public void update_with_auth_05() {
-        UpdateRequest updates = UpdateFactory.create("CREATE SILENT GRAPH <http://graph>");
-        UpdateProcessRemoteBase ue = (UpdateProcessRemoteBase) UpdateExecutionFactory.createRemoteForm(updates, authServiceUpdate);
-        // No auth credentials should result in an error
-        ue.execute();
-    }
-
-    @Test(expected = HttpException.class)
-    public void update_with_auth_06() {
-        UpdateRequest updates = UpdateFactory.create("CREATE SILENT GRAPH <http://graph>");
-        UpdateProcessRemoteBase ue = (UpdateProcessRemoteBase) UpdateExecutionFactory.createRemoteForm(updates, authServiceUpdate);
-        // Auth credentials for valid user with bad password
-        ue.setAuthentication("allowed", "incorrect".toCharArray());
-        ue.execute();
-    }
-
-    @Test
-    public void update_with_auth_07() {
-        UpdateRequest updates = UpdateFactory.create("CREATE SILENT GRAPH <http://graph>");
-        UpdateProcessRemoteBase ue = (UpdateProcessRemoteBase) UpdateExecutionFactory.createRemoteForm(updates, authServiceUpdate);
-        // Auth credentials for valid user with correct password
-        ue.setAuthentication("allowed", "password".toCharArray());
-        ue.execute();
-    }
-
-    @Test(expected = HttpException.class)
-    public void update_with_auth_08() {
-        UpdateRequest updates = UpdateFactory.create("CREATE SILENT GRAPH <http://graph>");
-        UpdateProcessRemoteBase ue = (UpdateProcessRemoteBase) UpdateExecutionFactory.createRemoteForm(updates, authServiceUpdate);
-        // Auth credentials for valid user with correct password BUT not in
-        // correct role
-        ue.setAuthentication("forbidden", "password".toCharArray());
-        ue.execute();
-    }
-
-    @Test(expected = HttpException.class)
-    public void update_with_auth_09() throws URISyntaxException {
-        UpdateRequest updates = UpdateFactory.create("CREATE SILENT GRAPH <http://graph>");
-        UpdateProcessRemoteBase ue = (UpdateProcessRemoteBase) UpdateExecutionFactory.createRemote(updates, authServiceUpdate);
-
-        // Auth credentials for valid user with correct password but scoped to
-        // wrong URI
-        ScopedAuthenticator authenticator = new ScopedAuthenticator(new URI("http://example"), "allowed",
-                "password".toCharArray());
-        ue.setAuthenticator(authenticator);
-        ue.execute();
-    }
-
-    @Test
-    public void update_with_auth_10() throws URISyntaxException {
-        UpdateRequest updates = UpdateFactory.create("CREATE SILENT GRAPH <http://graph>");
-        UpdateProcessRemoteBase ue = (UpdateProcessRemoteBase) UpdateExecutionFactory.createRemote(updates, authServiceUpdate);
-
-        // Auth credentials for valid user with correct password scoped to
-        // correct URI
-        ScopedAuthenticator authenticator = new ScopedAuthenticator(new URI(authServiceUpdate), "allowed", "password".toCharArray());
-        ue.setAuthenticator(authenticator);
-        ue.execute();
-    }
-
-    @Test
-    public void update_with_auth_11() throws URISyntaxException {
-        UpdateRequest updates = UpdateFactory.create("CREATE SILENT GRAPH <http://graph>");
-        UpdateProcessRemoteBase ue = (UpdateProcessRemoteBase) UpdateExecutionFactory.createRemote(updates, authServiceUpdate);
-
-        // Auth credentials for valid user with correct password scoped to
-        // correct URI
-        // Also using pre-emptive auth
-        ScopedAuthenticator authenticator = new ScopedAuthenticator(new URI(authServiceUpdate), "allowed", "password".toCharArray());
-        ue.setAuthenticator(new PreemptiveBasicAuthenticator(authenticator));
-        ue.execute();
-    }
-    
-    @Test(expected = HttpException.class)
-    public void graphstore_with_auth_01() {       
-        // No auth credentials
-        DatasetAccessor accessor = DatasetAccessorFactory.createHTTP(authServiceREST);
-        accessor.getModel();
-    }
-    
-    @Test(expected = HttpException.class)
-    public void graphstore_with_auth_02() {
-        // Incorrect auth credentials
-        DatasetAccessor accessor = DatasetAccessorFactory.createHTTP(authServiceREST, new SimpleAuthenticator("allowed", "incorrect".toCharArray()));
-        accessor.getModel();
-    }
-    
-    @Test
-    public void graphstore_with_auth_03() {
-        // Correct auth credentials
-        DatasetAccessor accessor = DatasetAccessorFactory.createHTTP(authServiceREST, new SimpleAuthenticator("allowed", "password".toCharArray()));
-        Model m = accessor.getModel();
-        Assert.assertTrue(m.isEmpty());
-    }
-    
-    @Test(expected = HttpException.class)
-    public void graphstore_with_auth_04() throws URISyntaxException {
-        // Correct auth credentials scoped to wrong URI
-        DatasetAccessor accessor = DatasetAccessorFactory.createHTTP(authServiceREST, new ScopedAuthenticator(new URI("http://example.org/"), "allowed", "password".toCharArray()));
-        accessor.getModel();
-    }
-    
-    @Test
-    public void graphstore_with_auth_05() throws URISyntaxException {
-        // Correct auth credentials scoped to correct URI
-        DatasetAccessor accessor = DatasetAccessorFactory.createHTTP(authServiceREST, new ScopedAuthenticator(new URI(authServiceREST), "allowed", "password".toCharArray()));
-        accessor.getModel();
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/test/java/org/apache/jena/fuseki/TestQuery.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/test/java/org/apache/jena/fuseki/TestQuery.java b/jena-fuseki/src/test/java/org/apache/jena/fuseki/TestQuery.java
deleted file mode 100644
index 5748dc4..0000000
--- a/jena-fuseki/src/test/java/org/apache/jena/fuseki/TestQuery.java
+++ /dev/null
@@ -1,117 +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.fuseki;
-
-import java.io.IOException ;
-import java.net.HttpURLConnection ;
-import java.net.URL ;
-
-import static org.apache.jena.fuseki.ServerTest.* ;
-
-import org.junit.AfterClass ;
-import org.junit.Assert ;
-import org.junit.BeforeClass ;
-import org.junit.Test ;
-import org.apache.jena.atlas.junit.BaseTest ;
-import com.hp.hpl.jena.query.* ;
-import com.hp.hpl.jena.sparql.core.Var ;
-import com.hp.hpl.jena.sparql.engine.binding.Binding ;
-import com.hp.hpl.jena.sparql.resultset.ResultSetCompare ;
-import com.hp.hpl.jena.sparql.sse.Item ;
-import com.hp.hpl.jena.sparql.sse.SSE ;
-import com.hp.hpl.jena.sparql.sse.builders.BuilderResultSet ;
-import com.hp.hpl.jena.sparql.util.Convert ;
-
-public class TestQuery extends BaseTest 
-{
-    protected static ResultSet rs1 = null ; 
-    static {
-        Item item = SSE.parseItem("(resultset (?s ?p ?o) (row (?s <x>)(?p <p>)(?o 1)))") ;
-        rs1 = BuilderResultSet.build(item) ;
-    }
-    
-    // DRY - test protocol?
-    @BeforeClass public static void beforeClass()
-    {
-        ServerTest.allocServer() ;
-        ServerTest.resetServer() ;
-        DatasetAccessor du = DatasetAccessorFactory.createHTTP(serviceREST) ;
-        du.putModel(model1) ;
-        du.putModel(gn1, model2) ;
-    }
-    
-    @AfterClass public static void afterClass()
-    {
-        DatasetAccessor du = DatasetAccessorFactory.createHTTP(serviceREST) ;
-        du.deleteDefault() ;
-        ServerTest.freeServer() ;
-    }
-    
-    @Test public void query_01()
-    {
-        execQuery("SELECT * {?s ?p ?o}", 1) ;
-    }
-    
-    @Test public void query_recursive_01()
-    {
-        String query = "SELECT * WHERE { SERVICE <" + serviceQuery + "> { ?s ?p ?o . BIND(?o AS ?x) } }";
-        try(QueryExecution qExec = QueryExecutionFactory.sparqlService(serviceQuery, query)) {
-            ResultSet rs = qExec.execSelect();
-            
-            Var x = Var.alloc("x");
-            while (rs.hasNext()) {
-                Binding b = rs.nextBinding();
-                Assert.assertNotNull(b.get(x));
-            }
-        }
-    }
-    
-    @Test public void query_with_params_01()
-    {
-        String query = "ASK { }";
-        try(QueryExecution qExec = QueryExecutionFactory.sparqlService(serviceQuery + "?output=json", query)) {
-            boolean result = qExec.execAsk();
-            Assert.assertTrue(result);
-        }
-    }
-    
-    @Test public void request_id_header_01() throws IOException
-    {
-        String qs = Convert.encWWWForm("ASK{}") ;
-        URL u = new URL(serviceQuery+"?query="+qs);
-        HttpURLConnection conn = (HttpURLConnection) u.openConnection();
-        Assert.assertTrue(conn.getHeaderField("Fuseki-Request-ID") != null);
-    }
-
-    private void execQuery(String queryString, int exceptedRowCount)
-    {
-        QueryExecution qExec = QueryExecutionFactory.sparqlService(serviceQuery, queryString) ;
-        ResultSet rs = qExec.execSelect() ;
-        int x = ResultSetFormatter.consume(rs) ;
-        assertEquals(exceptedRowCount, x) ;
-    }
-    
-    private void execQuery(String queryString, ResultSet expectedResultSet)
-    {
-        QueryExecution qExec = QueryExecutionFactory.sparqlService(serviceQuery, queryString) ;
-        ResultSet rs = qExec.execSelect() ;
-        boolean b = ResultSetCompare.equalsByTerm(rs, expectedResultSet) ;
-        assertTrue("Result sets different", b) ;
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/test/java/org/apache/jena/fuseki/TestSPARQLProtocol.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/test/java/org/apache/jena/fuseki/TestSPARQLProtocol.java b/jena-fuseki/src/test/java/org/apache/jena/fuseki/TestSPARQLProtocol.java
deleted file mode 100644
index 3b86e17..0000000
--- a/jena-fuseki/src/test/java/org/apache/jena/fuseki/TestSPARQLProtocol.java
+++ /dev/null
@@ -1,95 +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.fuseki;
-
-import static org.apache.jena.fuseki.ServerTest.* ;
-import org.apache.jena.atlas.junit.BaseTest ;
-import org.apache.jena.riot.WebContent ;
-import org.junit.AfterClass ;
-import org.junit.BeforeClass ;
-import org.junit.Test ;
-
-import com.hp.hpl.jena.query.* ;
-import com.hp.hpl.jena.sparql.engine.http.QueryEngineHTTP ;
-import com.hp.hpl.jena.sparql.util.Convert ;
-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 ;
-// Generally poke the server using Jena APIs
-// SPARQL Query
-// SPARQL Update
-//   GSP is done in TestDatasetAccessorHTTP
-
-public class TestSPARQLProtocol extends BaseTest
-{
-    @BeforeClass public static void beforeClass()
-    {
-        ServerTest.allocServer() ;
-        ServerTest.resetServer() ;
-        // Load some data.
-        DatasetAccessor du = DatasetAccessorFactory.createHTTP(serviceREST) ;
-        du.putModel(model1) ;
-        du.putModel(gn1, model2) ;
-    }
-    
-    @AfterClass public static void afterClass()
-    {
-        ServerTest.resetServer() ;
-        ServerTest.freeServer() ;
-    }
-    
-    static String query(String base, String queryString)
-    {
-        return base+"?query="+Convert.encWWWForm(queryString) ;
-    }
-    
-    @Test public void query_01()
-    {
-        Query query = QueryFactory.create("SELECT * { ?s ?p ?o }") ;
-        QueryExecution qexec = QueryExecutionFactory.sparqlService(serviceQuery, query) ;
-        ResultSet rs = qexec.execSelect() ;
-        int x = ResultSetFormatter.consume(rs) ;
-        assertTrue( x != 0 ) ;
-    }
-
-    @Test public void query_02()
-    {
-        Query query = QueryFactory.create("SELECT * { ?s ?p ?o }") ;
-        QueryEngineHTTP engine = QueryExecutionFactory.createServiceRequest(serviceQuery, query) ;
-        engine.setSelectContentType(WebContent.contentTypeResultsJSON) ;
-        ResultSet rs = engine.execSelect() ;
-        int x = ResultSetFormatter.consume(rs) ;
-        assertTrue( x != 0 ) ;
-    }
-
-    @Test public void update_01()
-    {
-        UpdateRequest update = UpdateFactory.create("INSERT DATA {}") ;
-        UpdateProcessor proc = UpdateExecutionFactory.createRemote(update, serviceUpdate) ;
-        proc.execute() ;
-    }
-    
-    @Test public void update_02()
-    {
-        UpdateRequest update = UpdateFactory.create("INSERT DATA {}") ;
-        UpdateProcessor proc = UpdateExecutionFactory.createRemoteForm(update, serviceUpdate) ;
-        proc.execute() ;
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/test/java/org/apache/jena/fuseki/http/TestDatasetAccessorHTTP.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/test/java/org/apache/jena/fuseki/http/TestDatasetAccessorHTTP.java b/jena-fuseki/src/test/java/org/apache/jena/fuseki/http/TestDatasetAccessorHTTP.java
deleted file mode 100644
index f8cf8fd..0000000
--- a/jena-fuseki/src/test/java/org/apache/jena/fuseki/http/TestDatasetAccessorHTTP.java
+++ /dev/null
@@ -1,261 +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.fuseki.http;
-
-import static org.apache.jena.fuseki.ServerTest.* ;
-import org.apache.jena.atlas.junit.BaseTest ;
-import org.apache.jena.atlas.web.HttpException ;
-import org.apache.jena.fuseki.ServerTest ;
-import org.apache.jena.riot.web.HttpOp ;
-import org.apache.jena.web.HttpSC ;
-import org.junit.AfterClass ;
-import org.junit.Before ;
-import org.junit.BeforeClass ;
-import org.junit.Test ;
-
-import com.hp.hpl.jena.query.DatasetAccessor ;
-import com.hp.hpl.jena.query.DatasetAccessorFactory ;
-import com.hp.hpl.jena.rdf.model.Model ;
-import com.hp.hpl.jena.rdf.model.ModelFactory ;
-
-
-public class TestDatasetAccessorHTTP extends BaseTest 
-{
-    //Model level testing.
-    
-    static final String datasetURI_not_1    = "http://localhost:"+port+"/junk" ;
-    static final String datasetURI_not_2    = serviceREST+"/not" ;
-    static final String datasetURI_not_3    = "http://localhost:"+port+datasetPath+"/not/data" ;
-    
-    @BeforeClass public static void beforeClass()   { ServerTest.allocServer() ; }
-    @AfterClass public static void afterClass()     { ServerTest.freeServer() ; }
-    @Before public void before()                    { ServerTest.resetServer() ; }
-    
-    @Test(expected=HttpException.class)
-    public void test_ds_1()
-    {
-        // Can't GET the dataset service.
-        try {
-            HttpOp.execHttpGet(serviceREST) ;
-        } catch (HttpException ex) {
-            assertTrue(HttpSC.isClientError(ex.getResponseCode())) ;
-            throw ex ;
-        }
-    }
-    
-    @Test(expected=HttpException.class)
-    public void test_ds_2()
-    {
-        try {
-            HttpOp.execHttpGet(datasetURI_not_1) ;
-        } catch (HttpException ex) {
-            assertEquals(HttpSC.NOT_FOUND_404, ex.getResponseCode()) ;
-            throw ex ;
-        }
-    }
-
-    @Test(expected=HttpException.class)
-    public void test_ds_3()
-    {
-        try {
-            HttpOp.execHttpGet(datasetURI_not_2) ;
-        } catch (HttpException ex) {
-            assertEquals(HttpSC.NOT_FOUND_404, ex.getResponseCode()) ;
-            throw ex ;
-        }
-    }
-
-    @Test
-    public void test_404_1()
-    {
-        // Not the right service.
-        DatasetAccessor du = DatasetAccessorFactory.createHTTP(datasetURI_not_1) ;
-        Model graph = du.getModel(gn99) ;
-        assertNull(graph) ; 
-    }
-
-    @Test
-    public void test_404_2()
-    {
-        DatasetAccessor du = DatasetAccessorFactory.createHTTP(datasetURI_not_2) ;
-        Model graph = du.getModel(gn99) ;
-        assertNull(graph) ;
-    }
-
-    @Test
-    public void test_404_3()
-    {
-        // Right service, wrong graph
-        DatasetAccessor du = DatasetAccessorFactory.createHTTP(serviceREST) ;
-        Model graph = du.getModel(gn99) ;
-        assertNull(graph) ;
-    }
-
-    @Test public void head_01()
-    {
-        DatasetAccessor du = create() ;
-        boolean b = du.containsModel(gn1) ;
-        assertFalse("Blank remote dataset as a named graph", b) ;
-    }
-
-    @Test public void head_02()
-    {
-        DatasetAccessor du = create() ;
-        du.putModel(gn1, model1) ;
-        boolean exists = du.containsModel(gn1) ;
-        assertTrue(exists) ;
-        exists = du.containsModel(gn2) ;
-        assertFalse("Expected gn2 not to exist (1)", exists) ;
-
-        exists = du.containsModel(gn2) ;
-        assertFalse("Expected gn2 not to exist (2)", exists) ;
-        // Clearup
-        du.deleteModel(gn1) ;
-    }
-
-    @Test public void get_01()
-    {
-        DatasetAccessor du = create() ;
-        Model graph = du.getModel() ;
-        assertTrue(graph.isEmpty()) ;
-    }
-    
-    @Test public void get_02()
-    {
-        DatasetAccessor du = create() ;
-        Model graph = du.getModel(gn1) ;
-        assertNull(graph) ;
-    }
-
-    @Test public void delete_01()
-    {
-        DatasetAccessor du = create() ;
-        du.deleteDefault() ;
-    }
-
-    @Test public void delete_02()
-    {
-        DatasetAccessor du = create() ;
-        du.deleteModel(gn1) ;
-        boolean exists = du.containsModel(gn1) ;
-        assertFalse("Expected gn1 not to exist", exists) ;
-    }
-
-    @Test public void put_01()
-    {
-        DatasetAccessor du = create() ;
-        du.putModel(model1) ;
-        Model graph = du.getModel() ;
-        assertTrue(graph.isIsomorphicWith(model1)) ;
-        // Empty it.
-        du.deleteDefault() ;
-        graph = du.getModel() ;
-        assertTrue(graph.isEmpty()) ;
-    }
-    
-    @Test public void put_02()
-    {
-        DatasetAccessor du = create() ;
-        du.putModel(gn1, model1) ;
-        boolean exists = du.containsModel(gn1) ;
-        assertTrue(exists) ;
-        exists = du.containsModel(gn2) ;
-        assertFalse("Expected gn2 not to exist", exists) ;
-        
-        Model graph = du.getModel() ;
-        assertTrue(graph.isEmpty()) ;
-        graph = du.getModel(gn1) ;
-        assertTrue(graph.isIsomorphicWith(model1)) ;
-        
-        du.deleteModel(gn1) ;
-        exists = du.containsModel(gn1) ;
-        assertFalse("Expected gn1 not to exist", exists) ;
-        
-        graph = du.getModel(gn1) ;
-        assertNull(graph) ;
-    }
-
-    @Test public void put_03()
-    {
-        DatasetAccessor du = create() ;
-        du.putModel(model1) ;
-        du.putModel(model2) ;  // PUT overwrites
-        Model graph = du.getModel() ;
-        assertFalse(graph.isIsomorphicWith(model1)) ;
-        assertTrue(graph.isIsomorphicWith(model2)) ;
-        // Empty it.
-        du.deleteDefault() ;
-        graph = du.getModel() ;
-        assertTrue(graph.isEmpty()) ;
-    }
-
-    @Test public void post_01()
-    {
-        DatasetAccessor du = create() ;
-        du.putModel(model1) ;
-        du.add(model2) ;  // POST appends
-        Model graph = du.getModel() ;
-        
-        Model graph3 = ModelFactory.createDefaultModel() ;
-        graph3.add(model1) ;
-        graph3.add(model2) ;
-        
-        assertFalse(graph.isIsomorphicWith(model1)) ;
-        assertFalse(graph.isIsomorphicWith(model2)) ;
-        assertTrue(graph.isIsomorphicWith(graph3)) ;
-        // Empty it.
-        du.deleteDefault() ;
-        graph = du.getModel() ;
-        assertTrue(graph.isEmpty()) ;
-    }
-
-    @Test public void post_02()
-    {
-        DatasetAccessor du = create() ;
-        du.add(model1) ;
-        du.add(model2) ;
-        Model graph = du.getModel() ;
-        
-        Model graph3 = ModelFactory.createDefaultModel() ;
-        graph3.add(model1) ;
-        graph3.add(model2) ;
-        
-        assertFalse(graph.isIsomorphicWith(model1)) ;
-        assertFalse(graph.isIsomorphicWith(model2)) ;
-        assertTrue(graph.isIsomorphicWith(graph3)) ;
-        // Empty it.
-        du.deleteDefault() ;
-        graph = du.getModel() ;
-        assertTrue(graph.isEmpty()) ;
-    }
-    
-    @Test public void clearup_1()
-    {
-        DatasetAccessor du = create() ;
-        du.deleteDefault() ;
-        du.deleteModel(gn1) ;
-        du.deleteModel(gn2) ;
-        du.deleteModel(gn99) ;
-    }
-
-    static DatasetAccessor create()
-    {
-        return DatasetAccessorFactory.createHTTP(ServerTest.serviceREST) ;
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/test/java/org/apache/jena/fuseki/http/TestDatasetGraphAccessorHTTP.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/test/java/org/apache/jena/fuseki/http/TestDatasetGraphAccessorHTTP.java b/jena-fuseki/src/test/java/org/apache/jena/fuseki/http/TestDatasetGraphAccessorHTTP.java
deleted file mode 100644
index 7687b2c..0000000
--- a/jena-fuseki/src/test/java/org/apache/jena/fuseki/http/TestDatasetGraphAccessorHTTP.java
+++ /dev/null
@@ -1,43 +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.fuseki.http;
-
-import org.apache.jena.fuseki.ServerTest ;
-import org.apache.jena.web.AbstractTestDatasetGraphAccessor ;
-import org.apache.jena.web.DatasetGraphAccessor ;
-import org.apache.jena.web.DatasetGraphAccessorHTTP ;
-import org.junit.AfterClass ;
-import org.junit.Before ;
-import org.junit.BeforeClass ;
-
-public class TestDatasetGraphAccessorHTTP extends AbstractTestDatasetGraphAccessor
-{
-    @BeforeClass public static void beforeClass() { ServerTest.allocServer() ; }
-    @AfterClass public static void afterClass() { ServerTest.freeServer() ; }
-    @Before public void before() { 
-        ServerTest.resetServer() ; 
-    }
-
-    
-    @Override
-    protected DatasetGraphAccessor getDatasetUpdater()
-    {
-        return new DatasetGraphAccessorHTTP(ServerTest.serviceREST) ;
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/test/java/org/apache/jena/fuseki/http/TestHttpOp.java
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/test/java/org/apache/jena/fuseki/http/TestHttpOp.java b/jena-fuseki/src/test/java/org/apache/jena/fuseki/http/TestHttpOp.java
deleted file mode 100644
index 1c5ccd5..0000000
--- a/jena-fuseki/src/test/java/org/apache/jena/fuseki/http/TestHttpOp.java
+++ /dev/null
@@ -1,214 +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.fuseki.http;
-
-import java.io.IOException ;
-
-import org.apache.jena.atlas.io.IO ;
-import org.apache.jena.atlas.junit.BaseTest ;
-import org.apache.jena.atlas.web.HttpException ;
-import org.apache.jena.atlas.web.TypedInputStream ;
-import org.apache.jena.fuseki.ServerTest ;
-import org.apache.jena.riot.WebContent ;
-import org.apache.jena.riot.system.IRILib ;
-import org.apache.jena.riot.web.HttpOp ;
-import org.apache.jena.web.HttpSC ;
-import org.junit.AfterClass ;
-import org.junit.BeforeClass ;
-import org.junit.Test ;
-
-import com.hp.hpl.jena.sparql.engine.http.Params ;
-import com.hp.hpl.jena.util.FileUtils ;
-
-// This a mixture of testing HttpOp and testing basic operation of the SPARQL server
-// especially error cases abnd unusual usage that the higher level APIs don't use.
-public class TestHttpOp extends BaseTest {
-    
-    static String pingURL = ServerTest.urlRoot+"ping.txt" ;
-    @BeforeClass public static void beforeClass() { ServerTest.allocServer() ; }
-    @AfterClass  public static void afterClass()  { ServerTest.freeServer() ; }
-    
-    static String graphURL = ServerTest.serviceREST+"?default" ;
-    static String queryURL = ServerTest.serviceQuery ;
-    static String updateURL = ServerTest.serviceUpdate ;
-    
-    static String simpleQuery = queryURL+"?query="+IRILib.encodeUriComponent("ASK{}") ;
-    
-    // Basic operations
-    
-    @Test public void httpGet_01() {
-        TypedInputStream in = HttpOp.execHttpGet(pingURL) ;
-        IO.close(in) ;
-    }
-    
-    @Test(expected=HttpException.class) 
-    public void httpGet_02() {
-        try {
-            TypedInputStream in = HttpOp.execHttpGet(ServerTest.urlRoot+"does-not-exist") ;
-            IO.close(in) ;
-        } catch(HttpException ex) {
-            assertEquals(HttpSC.NOT_FOUND_404, ex.getResponseCode()) ;
-            throw ex ;
-        }
-    }
-
-    @Test public void httpGet_03() throws IOException {
-        String x = HttpOp.execHttpGetString(pingURL) ;
-        String y = FileUtils.readWholeFileAsUTF8("pages/ping.txt") ;
-        assertEquals(y,x) ;
-    }   
-    
-    @Test public void httpGet_04() {
-        String x = HttpOp.execHttpGetString(ServerTest.urlRoot+"does-not-exist") ;
-        assertNull(x) ;
-    }
-    
-    @Test public void httpGet_05() {
-        TypedInputStream in = HttpOp.execHttpGet(simpleQuery) ;
-        IO.close(in) ;
-    }
-    
-    // SPARQL Query
-    
-    @Test public void queryGet_01() {
-        TypedInputStream in = HttpOp.execHttpGet(simpleQuery) ;
-        IO.close(in) ;
-    }
-
-    @Test(expected=HttpException.class)
-    public void queryGet_02() {
-        try {
-            // No query.
-            TypedInputStream in = HttpOp.execHttpGet(queryURL+"?query=") ;
-            IO.close(in) ;
-        } catch (HttpException ex) {
-            assertEquals(ex.getResponseCode(), HttpSC.BAD_REQUEST_400) ;
-            throw ex ; 
-        }
-    }
-
-//    @Test(expected=HttpException.class)
-//    public void queryGet_03() {
-//        try {
-//            // Service description.
-//            TypedInputStream in = HttpOp.execHttpGet(queryURL) ;
-//            IO.close(in) ;
-//        } catch (HttpException ex) {
-//            assertEquals(ex.getResponseCode(), HttpSC.NOT_FOUND_404) ;
-//            throw ex ; 
-//        }
-//    }
-
-    @Test(expected=HttpException.class)
-    public void httpPost_01() {
-        try {
-            HttpOp.execHttpPost(queryURL, "ASK{}", "text/plain") ;
-        } catch (HttpException ex) {
-            assertEquals(ex.getResponseCode(), HttpSC.UNSUPPORTED_MEDIA_TYPE_415) ;
-            throw ex ;
-        }
-    }
-    
-    @Test(expected=HttpException.class)
-    public void httpPost_02() {
-        try {
-            HttpOp.execHttpPost(queryURL, "ASK{}", WebContent.contentTypeSPARQLQuery) ;
-        } catch (HttpException ex) {
-            assertEquals(ex.getResponseCode(), HttpSC.UNSUPPORTED_MEDIA_TYPE_415) ;
-            throw ex ;
-        }
-    }
-    
-    @Test(expected=HttpException.class)
-    public void httpPost_03() {
-        try {
-            HttpOp.execHttpPost(queryURL, "ASK{}", WebContent.contentTypeOctets) ;
-        } catch (HttpException ex) {
-            assertEquals(ex.getResponseCode(), HttpSC.UNSUPPORTED_MEDIA_TYPE_415) ;
-            throw ex ;
-        }
-    }
-        
-    @Test public void httpPost_04() {
-        Params params = new Params() ;
-        params.addParam("query", "ASK{}") ;
-        TypedInputStream in = HttpOp.execHttpPostFormStream(queryURL, params, WebContent.contentTypeResultsJSON) ;
-        IO.close(in) ;
-    }
-    
-    @Test(expected=HttpException.class)
-    public void httpPost_05() {
-        Params params = new Params() ;
-        params.addParam("query", "ASK{}") ;
-        TypedInputStream in = null ;
-        try {
-            // Query to Update 
-            in = HttpOp.execHttpPostFormStream(updateURL, params, WebContent.contentTypeResultsJSON) ;
-        } catch (HttpException ex) {
-            assertEquals(ex.getResponseCode(), HttpSC.BAD_REQUEST_400) ;
-            throw ex ;
-        }
-        finally { IO.close(in) ; }
-    }
-    
-    @Test public void httpPost_06() {
-        Params params = new Params() ;
-        params.addParam("request", "CLEAR ALL") ;
-        HttpOp.execHttpPostForm(updateURL, params) ;
-    }
-    
-    // GSP
-    @Test public void gsp_01() {
-        String x = HttpOp.execHttpGetString(graphURL, "application/rdf+xml") ;
-        assertTrue(x.contains("</")) ;
-        assertTrue(x.contains(":RDF")) ;
-    }
-
-    @Test public void gsp_02() {
-        String x = HttpOp.execHttpGetString(graphURL, "application/n-triples") ;
-        assertTrue(x.isEmpty()) ;
-    }
-    
-    static String graphString = "@prefix : <http://example/> . :s :p :o ." ;
-    
-    @Test public void gsp_03() {
-        HttpOp.execHttpPut(graphURL, WebContent.contentTypeTurtle, graphString) ;
-    }
-    
-    @Test public void gsp_04() {
-        HttpOp.execHttpPut(graphURL, WebContent.contentTypeTurtle, graphString) ;
-        String s1 = HttpOp.execHttpGetString(graphURL, WebContent.contentTypeNTriples) ;
-        assertFalse(s1.isEmpty()) ;
-        HttpOp.execHttpDelete(graphURL) ;
-        String s2 = HttpOp.execHttpGetString(graphURL, WebContent.contentTypeNTriples) ;
-        assertTrue(s2.isEmpty()) ;
-    }
-    
-    @Test public void gsp_05() {
-        HttpOp.execHttpDelete(graphURL) ;
-        
-        HttpOp.execHttpPost(graphURL, WebContent.contentTypeTurtle, graphString) ;
-        String s1 = HttpOp.execHttpGetString(graphURL, WebContent.contentTypeNTriples) ;
-        assertFalse(s1.isEmpty()) ;
-        HttpOp.execHttpDelete(graphURL) ;
-        String s2 = HttpOp.execHttpGetString(graphURL, WebContent.contentTypeNTriples) ;
-        assertTrue(s2.isEmpty()) ;
-    }
-}
-

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/src/test/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/jena-fuseki/src/test/resources/log4j.properties b/jena-fuseki/src/test/resources/log4j.properties
deleted file mode 100644
index da8f386..0000000
--- a/jena-fuseki/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,20 +0,0 @@
-log4j.rootLogger=INFO,stdlog
-
-log4j.appender.stdlog=org.apache.log4j.ConsoleAppender
-log4j.appender.stdlog.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdlog.layout.ConversionPattern=%d{HH:mm:ss} %-5p %-25c{1} :: %m%n
-
-# Jena Dependency log levels
-log4j.logger.com.hp.hpl.jena.arq.info=INFO
-log4j.logger.com.hp.hpl.jena.arq.exec=INFO
-log4j.logger.com.hp.hpl.jena=WARN
-log4j.logger.org.apache.jena=WARN
-log4j.logger.org.apache.jena.riot=INFO
-
-# Jetty - Fuseki catches Jetty errors and reports them.
-log4j.logger.org.eclipse.jetty=FATAL
-
-# Fuseki
-log4j.logger.org.apache.jena.fuseki.Server=WARN
-log4j.logger.org.apache.jena.fuseki.Fuseki=WARN
-log4j.logger.org.apache.jena.fuseki=WARN
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki/tdb.ttl
----------------------------------------------------------------------
diff --git a/jena-fuseki/tdb.ttl b/jena-fuseki/tdb.ttl
deleted file mode 100644
index 6cc1130..0000000
--- a/jena-fuseki/tdb.ttl
+++ /dev/null
@@ -1,30 +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.
-
-@prefix tdb:     <http://jena.hpl.hp.com/2008/tdb#> .
-@prefix rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
-@prefix rdfs:    <http://www.w3.org/2000/01/rdf-schema#> .
-@prefix ja:      <http://jena.hpl.hp.com/2005/11/Assembler#> .
-@prefix tdb:     <http://jena.hpl.hp.com/2008/tdb#> .
-
-[] ja:loadClass "com.hp.hpl.jena.tdb.TDB" .
-tdb:DatasetTDB  rdfs:subClassOf  ja:RDFDataset .
-tdb:GraphTDB    rdfs:subClassOf  ja:Model .
-
- <#dataset> rdf:type      tdb:DatasetTDB ;
-     tdb:location "DB" ;
-##      tdb:unionDefaultGraph true ;
-     .

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/.gitignore
----------------------------------------------------------------------
diff --git a/jena-fuseki1/.gitignore b/jena-fuseki1/.gitignore
new file mode 100644
index 0000000..54526a5
--- /dev/null
+++ b/jena-fuseki1/.gitignore
@@ -0,0 +1 @@
+run_cp

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/DEPENDENCIES
----------------------------------------------------------------------
diff --git a/jena-fuseki1/DEPENDENCIES b/jena-fuseki1/DEPENDENCIES
new file mode 100644
index 0000000..7dece40
--- /dev/null
+++ b/jena-fuseki1/DEPENDENCIES
@@ -0,0 +1,21 @@
+This file lists the dependences for Apache Jena Fuseki.
+  Version numbers are given in the POM file for a particular distribution. 
+
+Apache Projects:   Apache Software License
+  Apache Jena, including the Jena IRI library
+  Apache Xerces-J
+  Apache log4j
+  Apache HttpComponents (HTTP Client)
+  Apache Commons Codec
+  Apache Common FileUpload
+
+SLF4J : http://www.slf4j.org/
+  Copyright (c) 2004-2008 QOS.ch
+  MIT License
+
+JUnit : http://junit.org/
+  Common Public License - v 1.0
+
+Jetty: http://www.eclipse.org/jetty/
+  Apache License 2.0 
+  (also avilable under Eclipse Public License 1.0)

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/Data/books.ttl
----------------------------------------------------------------------
diff --git a/jena-fuseki1/Data/books.ttl b/jena-fuseki1/Data/books.ttl
new file mode 100644
index 0000000..7957323
--- /dev/null
+++ b/jena-fuseki1/Data/books.ttl
@@ -0,0 +1,62 @@
+# 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.
+
+@prefix dc:        <http://purl.org/dc/elements/1.1/> .
+@prefix vcard:     <http://www.w3.org/2001/vcard-rdf/3.0#> .
+@prefix ns:        <http://example.org/ns#> .
+
+@prefix :          <http://example.org/book/> .
+
+# A small dataset for usage examples of Joseki
+# This data is intentionaly irregular (e.g. different ways to
+# record the book creator) as if the information is either an
+# aggregation or was created at different times.
+
+:book1
+    dc:title    "Harry Potter and the Philosopher's Stone" ;
+    dc:creator  "J.K. Rowling" ;
+    .
+    
+:book2
+    dc:title    "Harry Potter and the Chamber of Secrets" ;
+    dc:creator  _:a .
+    
+:book3
+    dc:title    "Harry Potter and the Prisoner Of Azkaban" ;
+    dc:creator  _:a .
+    
+:book4
+    dc:title    "Harry Potter and the Goblet of Fire" .
+    
+:book5
+    dc:title    "Harry Potter and the Order of the Phoenix";
+    dc:creator  "J.K. Rowling" ;
+    .
+
+:book6
+    dc:title    "Harry Potter and the Half-Blood Prince";
+    dc:creator  "J.K. Rowling" .
+
+:book7
+    dc:title    "Harry Potter and the Deathly Hallows" ;
+    dc:creator  "J.K. Rowling" .
+_:a
+    vcard:FN "J.K. Rowling" ;
+    vcard:N
+        [ vcard:Family "Rowling" ;
+          vcard:Given "Joanna" 
+        ]
+    .

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/Data/test_abox.ttl
----------------------------------------------------------------------
diff --git a/jena-fuseki1/Data/test_abox.ttl b/jena-fuseki1/Data/test_abox.ttl
new file mode 100644
index 0000000..bb3939a
--- /dev/null
+++ b/jena-fuseki1/Data/test_abox.ttl
@@ -0,0 +1,21 @@
+# 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.
+
+@prefix rdf:        <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+@prefix :           <http://example/ns#> .
+
+:x rdf:type :A .
+

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/Data/test_data_rdfs.ttl
----------------------------------------------------------------------
diff --git a/jena-fuseki1/Data/test_data_rdfs.ttl b/jena-fuseki1/Data/test_data_rdfs.ttl
new file mode 100644
index 0000000..9e6daf1
--- /dev/null
+++ b/jena-fuseki1/Data/test_data_rdfs.ttl
@@ -0,0 +1,28 @@
+# 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.
+
+@prefix rdf:        <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+@prefix rdfs:       <http://www.w3.org/2000/01/rdf-schema#> .
+
+@prefix :           <http://example/ns#> .
+
+:A a rdfs:Class .
+:B a rdfs:Class .
+
+:A rdfs:subClassOf :B .
+
+:x rdf:type :A .
+

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/Data/test_tbox.ttl
----------------------------------------------------------------------
diff --git a/jena-fuseki1/Data/test_tbox.ttl b/jena-fuseki1/Data/test_tbox.ttl
new file mode 100644
index 0000000..fae2124
--- /dev/null
+++ b/jena-fuseki1/Data/test_tbox.ttl
@@ -0,0 +1,25 @@
+# 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.
+
+@prefix rdf:        <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+@prefix rdfs:       <http://www.w3.org/2000/01/rdf-schema#> .
+
+@prefix :           <http://example/ns#> .
+
+:A a rdfs:Class .
+:B a rdfs:Class .
+
+:A rdfs:subClassOf :B .

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/LICENSE
----------------------------------------------------------------------
diff --git a/jena-fuseki1/LICENSE b/jena-fuseki1/LICENSE
new file mode 100644
index 0000000..5110d66
--- /dev/null
+++ b/jena-fuseki1/LICENSE
@@ -0,0 +1,224 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed 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.
+
+- - - - - - - - - - - - - - - - - - - - - - - 
+
+==============================================================
+ Jetty Web Container
+ Copyright 1995-2012 Mort Bay Consulting Pty Ltd.
+==============================================================
+
+The Jetty Web Container is Copyright Mort Bay Consulting Pty Ltd
+unless otherwise noted.
+
+Jetty is dual licensed under both
+
+  * The Apache 2.0 License
+    http://www.apache.org/licenses/LICENSE-2.0.html
+
+      and
+
+  * The Eclipse Public 1.0 License
+    http://www.eclipse.org/legal/epl-v10.html
+
+Jetty may be distributed under either license.

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/NOTICE
----------------------------------------------------------------------
diff --git a/jena-fuseki1/NOTICE b/jena-fuseki1/NOTICE
new file mode 100644
index 0000000..1bf7fa8
--- /dev/null
+++ b/jena-fuseki1/NOTICE
@@ -0,0 +1,16 @@
+Apache Jena - module Fuseki
+Copyright 2011, 2012, 2013, 2014, 2015 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+
+Portions of this software were originally based on the following:
+  - Copyright 2005, 2006, 2007, 2008, 2009 Hewlett-Packard Development Company, LP
+  - Copyright 2010, 2011 Epimorphics Ltd.
+  - Copyright 2010, 2011 Talis Systems Ltd.
+These have been licensed to the Apache Software Foundation under a software grant.
+
+- - - - - - - - - - - - - - - - - - - - - - - 
+
+Portions of this software include software from  Mort Bay Consulting Pty. Ltd.
+ - Copyright (c) 2004-2009 Mort Bay Consulting Pty. Ltd.

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/ReleaseNotes.txt
----------------------------------------------------------------------
diff --git a/jena-fuseki1/ReleaseNotes.txt b/jena-fuseki1/ReleaseNotes.txt
new file mode 100644
index 0000000..c849d56
--- /dev/null
+++ b/jena-fuseki1/ReleaseNotes.txt
@@ -0,0 +1,104 @@
+==== Fuseki
+
+== Fuseki 1.0.1
+
++ JENA-600 : Support GZipped uploads correctly i.e. files with .foo.gz style
+             extensions
+
+== Fuseki 1.0.0
+This is the final version of what was 0.2.8
+
+== Fuseki 0.2.8
+
++ jena-text added to the server : Lucene/solr backed search:
+  http://jena.apache.org/documentation/query/text-query.html
+  
++ Upgrade to Jetty 8.1.11.v20130520  
++ JENA-522 : Fix of occasional "Currently in a locked region" errors
++ JENA-499 : --localhost will cause the server to only listen to the loopback interface
+
+== Fuseki 0.2.7
+
++ JENA-422 : Improved service startup script (Linux)
++ JENA-440 : Query timeouts fixed.  Fuseki behavior may change
+             to the reflect the fixes to ARQ in this area.
++ Exact layout in output format Turtle may vary due to changes in Jena.
++ JENA-439 : Return 503, not 408, on query timeout.
++ JENA-433 : Absent Accept header could cause NPE.
+
+== Fuseki 0.2.6
+
++ Upgrade to Jetty 8.1.8.v20121106
++ Uses Jena 2.10.0.
++ JENA-376 : Fuseki linux service script : Either use options as given or use defaults, not append defaults to any given.
++ JENA-387 : Fuseki includes request ID in response headers as Fuseki-Request-ID to allow correlating problem HTTP responses with Fuseki log output
++ JENA-309 : If supported by the underlying storage engine, Fuseki can exploit transactions in order to stream SPARQL Update requests
+
+== Fuseki 0.2.5
+
++ JENA-334 - Fix for Fuseki start script fails when invoked with full pathname
+
+== Fuseki 0.2.4
+
++ Upgrade Jetty dependency to 7.6.5.v20120716
++ JENA-307 - Close QueryExecution object after query execution. 
++ JENA-295 - Implement using-graph-uri= and using-named-graph-uri=
++ Add support for default-graph-uri= and named-graph-uri= query parameters to a dataset.
+  It picks the specific graphs out of the dataset for the query. 
+
+== Fuseki 0.2.3
+
++ Add a script to support running Fuseki as a service (JENA-268)
++ (TDB change) Remove excessive and harmless warnings in log file.
+
+== Fuseki 0.2.2
+
++ This version picks up bug fixes from TDB and ARQ.
+  This includes problems with concurrent operations.
+
+== Fuseki 0.2.1
+
++ Switch from JSPs to Velocity.
+  This means the standalone jar does not contain a JSP engine anymore.  
+
++ Service by configuration file, command line argument --config=
+
++ Add a servlet filter that processes Accept-Encoding 
+  Result are now compressed if the client request asks for that (JENA-209)
+
++ Rename packages to be org.apache.jena.fuseki.
+
++ --jetty-config= Use a file to configure the jetty server (connector type, parms of connector like "host").  
+  Replaces --host.  See Jetty configuration documentation.
+
++ General purpose SPARQL processor servlet written (not enabled)  
+
++ XSLT style sheet for SPARQL XML results now puts clickable links in the results - query goes back to the server.
+
++ JENA-74 (from Brian McBride): --host= to select the interface to listen on.  Use with --host=localhost if using Apache as a front-end. 
+
++ Add --timeout: adds a timeout to all query executions
+
++ Split logging into 2 loggers: general messages and per-request messages.
+  http://openjena.org/wiki/Fuseki#Logging
+
+== Fuseki 0.2.0
+
++ Validators now include:
+  Query
+  Update
+  RDF (non-XML formats)
+  IRI
+
++ HTTP request error pages now in "text/plain;charset=utf-8"
++ Location of a TDB database must exist when server starts.
+
++ Form parameter name for SPARQL Update sent by HTML form changed from request= to update=
+  Likely direction of SPARQL-WG.
+
++ Internal consistency checking (also TDB internal consistecy checking).
+  You should not see any warnings.
+
+== Fuseki 0.1.0
+First release.
+

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/SEE_FUSEKI2
----------------------------------------------------------------------
diff --git a/jena-fuseki1/SEE_FUSEKI2 b/jena-fuseki1/SEE_FUSEKI2
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/assembly-dist.xml
----------------------------------------------------------------------
diff --git a/jena-fuseki1/assembly-dist.xml b/jena-fuseki1/assembly-dist.xml
new file mode 100644
index 0000000..b1ba86b
--- /dev/null
+++ b/jena-fuseki1/assembly-dist.xml
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+   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.
+-->
+
+<!-- 
+The distribution.
+Assumes jar made and onejar has been assembled.
+-->
+
+<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
+
+  <id>distribution</id>
+
+  <formats>
+    <format>zip</format>
+    <format>tar.gz</format>
+  </formats>
+
+  <baseDirectory>${project.artifactId}-${project.version}</baseDirectory>
+
+  <files>
+    <file>
+      <source>${project.build.directory}/${server.jar.name}.jar</source>
+      <outputDirectory></outputDirectory>
+      <destName>fuseki-server.jar</destName>
+    </file>
+    <!-- include sources in binary distribution?
+    <file>
+      <source>${project.artifactId}-${project.version}-sources.jar</source>
+      <outputDirectory></outputDirectory>
+    </file>
+    -->
+    <file>
+      <source>dist/LICENSE</source>
+      <destName>LICENSE</destName>
+    </file>
+    <file>
+      <source>dist/NOTICE</source>
+      <destName>NOTICE</destName>
+    </file>
+  </files>
+
+  <fileSets>
+    <fileSet>
+      <outputDirectory></outputDirectory>
+      <includes>
+        <include>README*</include>
+        <include>ReleaseNotes.txt</include>
+      </includes>
+    </fileSet>
+
+    <fileSet>
+      <outputDirectory></outputDirectory>
+      <includes>
+        <include>log4j.properties</include>
+        <include>fuseki</include>
+        <include>fuseki-server</include>
+        <include>fuseki-server.bat</include>
+        <include>config*.ttl</include>
+        <include>s-*</include>
+        <include>pages/*</include>
+        <include>Data/*</include>
+      </includes>
+    </fileSet>
+  </fileSets>
+</assembly>

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/assembly-soh.xml
----------------------------------------------------------------------
diff --git a/jena-fuseki1/assembly-soh.xml b/jena-fuseki1/assembly-soh.xml
new file mode 100644
index 0000000..f379911
--- /dev/null
+++ b/jena-fuseki1/assembly-soh.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+   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.
+-->
+<!-- 
+The SOH distribution.
+-->
+
+<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
+
+  <id>soh</id>
+
+  <formats>
+    <format>zip</format>
+  </formats>
+
+  <baseDirectory>apache-${project.artifactId}-${project.version}</baseDirectory>
+
+  <fileSets>
+    <fileSet>
+      <includes>
+	<include>s-*</include>
+      </includes>
+    </fileSet>
+  </fileSets>
+</assembly>

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/config-examples.ttl
----------------------------------------------------------------------
diff --git a/jena-fuseki1/config-examples.ttl b/jena-fuseki1/config-examples.ttl
new file mode 100644
index 0000000..cff5141
--- /dev/null
+++ b/jena-fuseki1/config-examples.ttl
@@ -0,0 +1,123 @@
+# Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
+
+## A collection of example configurations for Fuseki
+
+@prefix :        <#> .
+@prefix fuseki:  <http://jena.apache.org/fuseki#> .
+@prefix rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+
+@prefix rdfs:   <http://www.w3.org/2000/01/rdf-schema#> .
+@prefix tdb:     <http://jena.hpl.hp.com/2008/tdb#> .
+@prefix ja:      <http://jena.hpl.hp.com/2005/11/Assembler#> .
+
+[] rdf:type fuseki:Server ;
+   # Timeout - server-wide default: milliseconds.
+   # Format 1: "1000" -- 1 second timeout
+   # Format 2: "10000,60000" -- 10s timeout to first result, then 60s timeout to for rest of query.
+   # See java doc for ARQ.queryTimeout
+   # ja:context [ ja:cxtName "arq:queryTimeout" ;  ja:cxtValue "10000" ] ;
+
+   # ja:loadClass "your.code.Class" ;
+
+   fuseki:services (
+     <#service1>
+     <#service2>
+     <#service3>
+   ) .
+
+# Custom code.
+[] ja:loadClass "com.hp.hpl.jena.tdb.TDB" .
+
+# TDB
+tdb:DatasetTDB  rdfs:subClassOf  ja:RDFDataset .
+tdb:GraphTDB    rdfs:subClassOf  ja:Model .
+
+## ---------------------------------------------------------------
+## Updatable in-memory dataset.
+
+<#service1> rdf:type fuseki:Service ;
+    # URI of the dataset -- http://host:port/ds
+    fuseki:name                     "ds" ; 
+
+    # SPARQL query services e.g. http://host:port/ds/sparql?query=...
+    fuseki:serviceQuery             "sparql" ;
+    fuseki:serviceQuery             "query" ;
+    # SPARQL Update service -- http://host:port/ds/update?request=...
+    fuseki:serviceUpdate            "update" ;   # SPARQL query service -- /ds/update
+
+    # Upload service -- http://host:port/ds/upload?graph=default or ?graph=URI or ?default
+    # followed by a multipart body, each part being RDF syntax.
+    # Syntax determined by the file name extension.
+    fuseki:serviceUpload            "upload" ;   # Non-SPARQL upload service
+
+    # SPARQL Graph store protocol (read and write)
+    # GET, PUT, POST DELETE to http://host:port/ds/data?graph= or ?default=
+    fuseki:serviceReadWriteGraphStore      "data" ;     
+
+    # A separate read-only graph store endpoint:
+    fuseki:serviceReadGraphStore       "get" ;   # Graph store protocol (read only) -- /ds/get
+
+    fuseki:dataset           <#emptyDataset> ;
+    .
+
+## In-memory, initially empty.
+<#emptyDataset> rdf:type ja:RDFDataset .
+
+## ---------------------------------------------------------------
+## Read-only access to a small books database.
+
+<#service2> rdf:type fuseki:Service ;
+    fuseki:name                     "books" ;    # http://host:port/books
+    fuseki:serviceQuery             "query" ;    # SPARQL query service
+    fuseki:serviceReadGraphStore    "get" ;      # SPARQL Graph store protocol (read only)
+    fuseki:dataset                   <#books> ;
+    # Configuration
+    .
+    
+<#books>    rdf:type ja:RDFDataset ;
+    rdfs:label "Books" ;
+    ja:defaultGraph 
+      [ rdfs:label "books.ttl" ;
+        a ja:MemoryModel ;
+        ja:content [ja:externalContent <file:Data/books.ttl> ] ;
+      ] ;
+    .
+## ---------------------------------------------------------------
+## TDB dataset with only SPARQL query.
+
+<#service3>  rdf:type fuseki:Service ;
+    fuseki:name              "inf" ;             # http://host/inf
+    fuseki:serviceQuery      "sparql" ;          # SPARQL query service
+    fuseki:dataset           <#dataset> ;
+    .
+
+<#dataset> rdf:type       ja:RDFDataset ;
+    ja:defaultGraph       <#model_inf_2> ;
+     .
+
+# ---- RDFS Inference models
+# These must be incorporate in a dataset in order to use them.
+# All in one file.
+
+<#model_inf_1> a ja:InfModel ;
+    rdfs:label "Inf-1" ;
+    ja:baseModel 
+        [ a ja:MemoryModel ;
+          ja:content [ja:externalContent <file:Data/test_data_rdfs.ttl>] ;
+        ] ;
+    ja:reasoner
+         [ ja:reasonerURL <http://jena.hpl.hp.com/2003/RDFSExptRuleReasoner> ]
+    .
+
+# Separate ABox and TBox
+
+<#model_inf_2> a ja:InfModel ;
+    rdfs:label "Inf-2" ;
+    ja:baseModel 
+        [ a ja:MemoryModel ;
+          ja:content [ja:externalContent <file:Data/test_abox.ttl>] ;
+          ja:content [ja:externalContent <file:Data/test_tbox.ttl>] ;
+        ] ;
+    ja:reasoner
+         [ ja:reasonerURL <http://jena.hpl.hp.com/2003/RDFSExptRuleReasoner> ] 
+    . 

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/config-inf-tdb.ttl
----------------------------------------------------------------------
diff --git a/jena-fuseki1/config-inf-tdb.ttl b/jena-fuseki1/config-inf-tdb.ttl
new file mode 100644
index 0000000..6a4a08c
--- /dev/null
+++ b/jena-fuseki1/config-inf-tdb.ttl
@@ -0,0 +1,52 @@
+# Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
+
+@prefix :        <#> .
+@prefix fuseki:  <http://jena.apache.org/fuseki#> .
+@prefix rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+
+@prefix rdfs:   <http://www.w3.org/2000/01/rdf-schema#> .
+@prefix tdb:     <http://jena.hpl.hp.com/2008/tdb#> .
+@prefix ja:      <http://jena.hpl.hp.com/2005/11/Assembler#> .
+
+[] rdf:type fuseki:Server ;
+   fuseki:services (
+     <#service1>
+   ) .
+
+# Custom code.
+[] ja:loadClass "com.hp.hpl.jena.tdb.TDB" .
+
+# TDB
+tdb:DatasetTDB  rdfs:subClassOf  ja:RDFDataset .
+tdb:GraphTDB    rdfs:subClassOf  ja:Model .
+
+## ---------------------------------------------------------------
+## Service with only SPARQL query on an inference model.
+## Inference model bbase data in TDB.
+
+<#service1>  rdf:type fuseki:Service ;
+    fuseki:name              "inf" ;             # http://host/inf
+    fuseki:serviceQuery      "sparql" ;          # SPARQL query service
+    fuseki:serviceUpdate     "update" ;
+    fuseki:dataset           <#dataset> ;
+    .
+
+<#dataset> rdf:type       ja:RDFDataset ;
+    ja:defaultGraph       <#model_inf> ;
+     .
+
+<#model_inf> a ja:InfModel ;
+     ja:baseModel <#tdbGraph> ;
+     ja:reasoner [
+         ja:reasonerURL <http://jena.hpl.hp.com/2003/OWLFBRuleReasoner>
+     ] .
+
+<#tdbDataset> rdf:type tdb:DatasetTDB ;
+    tdb:location "DB" ;
+    # If the unionDefaultGraph is used, then the "update" service should be removed.
+    # The unionDefaultGraph is read only.
+    # tdb:unionDefaultGraph true ;
+    .
+
+<#tdbGraph> rdf:type tdb:GraphTDB ;
+    tdb:dataset <#tdbDataset> .


[06/23] jena git commit: Rename folder jena-fuseki to jena-fuseki1

Posted by an...@apache.org.
http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/main/java/org/apache/jena/fuseki/FusekiCmd.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/java/org/apache/jena/fuseki/FusekiCmd.java b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/FusekiCmd.java
new file mode 100644
index 0000000..77bafe8
--- /dev/null
+++ b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/FusekiCmd.java
@@ -0,0 +1,508 @@
+/*
+ * 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.fuseki;
+
+import static org.apache.jena.fuseki.Fuseki.serverLog ;
+
+import java.io.File ;
+import java.io.InputStream ;
+import java.util.List ;
+
+import org.apache.jena.atlas.io.IO ;
+import org.apache.jena.atlas.lib.FileOps ;
+import org.apache.jena.atlas.lib.Lib ;
+import org.apache.jena.atlas.lib.StrUtils ;
+import org.apache.jena.atlas.logging.LogCtl ;
+import org.apache.jena.fuseki.mgt.ManagementServer ;
+import org.apache.jena.fuseki.server.FusekiConfig ;
+import org.apache.jena.fuseki.server.SPARQLServer ;
+import org.apache.jena.fuseki.server.ServerConfig ;
+import org.apache.jena.riot.Lang ;
+import org.apache.jena.riot.RDFDataMgr ;
+import org.apache.jena.riot.RDFLanguages ;
+import org.apache.jena.riot.SysRIOT ;
+import org.eclipse.jetty.server.Server ;
+import org.slf4j.Logger ;
+import arq.cmd.CmdException ;
+import arq.cmdline.ArgDecl ;
+import arq.cmdline.CmdARQ ;
+import arq.cmdline.ModDatasetAssembler ;
+
+import com.hp.hpl.jena.query.ARQ ;
+import com.hp.hpl.jena.query.Dataset ;
+import com.hp.hpl.jena.sparql.core.DatasetGraph ;
+import com.hp.hpl.jena.sparql.core.DatasetGraphFactory ;
+import com.hp.hpl.jena.tdb.TDB ;
+import com.hp.hpl.jena.tdb.TDBFactory ;
+import com.hp.hpl.jena.tdb.sys.Names ;
+import com.hp.hpl.jena.tdb.transaction.TransactionManager ;
+
+public class FusekiCmd extends CmdARQ
+{
+    private static String log4Jsetup = StrUtils.strjoinNL(
+          "## Plain output to stdout"
+          , "log4j.appender.jena.plain=org.apache.log4j.ConsoleAppender"
+          , "log4j.appender.jena.plain.target=System.out"
+          , "log4j.appender.jena.plain.layout=org.apache.log4j.PatternLayout"
+          , "log4j.appender.jena.plain.layout.ConversionPattern=%d{HH:mm:ss} %-5p %m%n"
+          
+          , "## Plain output with level, to stderr"
+          , "log4j.appender.jena.plainlevel=org.apache.log4j.ConsoleAppender"
+          , "log4j.appender.jena.plainlevel.target=System.err"
+          , "log4j.appender.jena.plainlevel.layout=org.apache.log4j.PatternLayout"
+          , "log4j.appender.jena.plainlevel.layout.ConversionPattern=%d{HH:mm:ss} %-5p %m%n"
+          
+          , "## Everything"
+          , "log4j.rootLogger=INFO, jena.plain"
+          , "log4j.logger.com.hp.hpl.jena=WARN"
+          , "log4j.logger.org.openjena=WARN"
+          , "log4j.logger.org.apache.jena=WARN"
+          
+          , "# Server log."
+          , "log4j.logger.org.apache.jena.fuseki.Server=INFO"
+          , "# Request log."
+          , "log4j.logger.org.apache.jena.fuseki.Fuseki=INFO"
+          , "log4j.logger.org.apache.jena.tdb.loader=INFO"
+          , "log4j.logger.org.eclipse.jetty=ERROR"
+          
+          , "## Parser output"
+          , "log4j.additivity."+SysRIOT.riotLoggerName+"=false"
+          , "log4j.logger."+SysRIOT.riotLoggerName+"=INFO, jena.plainlevel "
+        ) ;
+
+    
+    // Set logging.
+    // 1/ Use log4j.configuration is defined.
+    // 2/ Use file:log4j.properties 
+    // 3/ Use Built in.
+    
+    static void setLogging() {
+        // No loggers have been created but configuration may have been set up. 
+        String x = System.getProperty("log4j.configuration", null) ;
+        
+        if ( x != null && ! x.equals("set") ) {
+            // "set" indicates that CmdMain set logging.
+            // Use standard log4j initialization.
+            return ;
+        }
+        
+        String fn = "log4j.properties" ;
+        File f = new File(fn) ;
+        if ( f.exists() ) {
+            // Use file log4j.properties
+            System.setProperty("log4j.configuration", "file:"+fn) ;
+            return ;
+        }
+        // Use built-in for Fuseki.
+        LogCtl.resetLogging(log4Jsetup) ;     
+    }
+    
+    static { setLogging() ; }
+
+    // Arguments:
+    // --update
+    
+    // Specific switches:
+    
+    // --admin=on/off
+    
+    // --http-update
+    // --http-get
+    
+    // --sparql-query
+    // --sparql-update
+    
+    // pages/validators/
+    // pages/control/
+    // pages/query/ or /pages/sparql/
+    
+    private static ArgDecl argMgtPort       = new ArgDecl(ArgDecl.HasValue, "mgtPort", "mgtport") ;
+    private static ArgDecl argMem           = new ArgDecl(ArgDecl.NoValue,  "mem") ;
+    private static ArgDecl argAllowUpdate   = new ArgDecl(ArgDecl.NoValue,  "update", "allowUpdate") ;
+    private static ArgDecl argFile          = new ArgDecl(ArgDecl.HasValue, "file") ;
+    private static ArgDecl argMemTDB        = new ArgDecl(ArgDecl.NoValue,  "memtdb", "memTDB") ;
+    private static ArgDecl argTDB           = new ArgDecl(ArgDecl.HasValue, "loc", "location") ;
+    private static ArgDecl argPort          = new ArgDecl(ArgDecl.HasValue, "port") ;
+    private static ArgDecl argLocalhost     = new ArgDecl(ArgDecl.NoValue, "localhost", "local") ;
+    private static ArgDecl argTimeout       = new ArgDecl(ArgDecl.HasValue, "timeout") ;
+    private static ArgDecl argFusekiConfig  = new ArgDecl(ArgDecl.HasValue, "config", "conf") ;
+    private static ArgDecl argJettyConfig   = new ArgDecl(ArgDecl.HasValue, "jetty-config") ;
+    private static ArgDecl argGZip          = new ArgDecl(ArgDecl.HasValue, "gzip") ;
+    private static ArgDecl argUber          = new ArgDecl(ArgDecl.NoValue,  "uber", "über") ;   // Use the überservlet (experimental)
+    private static ArgDecl argBasicAuth     = new ArgDecl(ArgDecl.HasValue, "basic-auth") ;
+    
+    private static ArgDecl argGSP           = new ArgDecl(ArgDecl.NoValue,  "gsp") ;    // GSP compliance mode
+    
+    private static ArgDecl argHome          = new ArgDecl(ArgDecl.HasValue, "home") ;
+    private static ArgDecl argPages         = new ArgDecl(ArgDecl.HasValue, "pages") ;
+    
+    //private static ModLocation          modLocation =  new ModLocation() ;
+    private static ModDatasetAssembler  modDataset = new ModDatasetAssembler() ;
+    
+    // fuseki [--mem|--desc assembler.ttl] [--port PORT] **** /datasetURI
+
+    static public void main(String...argv)
+    {
+        // Just to make sure ...
+        ARQ.init() ;
+        TDB.init() ;
+        Fuseki.init() ;
+        new FusekiCmd(argv).mainRun() ;
+    }
+    
+    private int port                    = 3030 ;
+    private int mgtPort                 = -1 ;
+    private boolean listenLocal         = false ;
+
+    private DatasetGraph dsg            = null ; 
+    private String datasetPath          = null ;
+    private boolean allowUpdate         = false ;
+    
+    private String fusekiConfigFile     = null ;
+    private boolean enableCompression   = true ;
+    private String jettyConfigFile      = null ;
+    private String authConfigFile       = null ;
+    private String homeDir              = null ;
+    private String pagesDir             = null ;
+    
+    public FusekiCmd(String...argv)
+    {
+        super(argv) ;
+        
+        if ( false )
+            // Consider ...
+            TransactionManager.QueueBatchSize =  TransactionManager.QueueBatchSize / 2 ;
+        
+        getUsage().startCategory("Fuseki") ;
+        addModule(modDataset) ;
+        add(argMem,     "--mem",                "Create an in-memory, non-persistent dataset for the server") ;
+        add(argFile,    "--file=FILE",          "Create an in-memory, non-persistent dataset for the server, initialised with the contents of the file") ;
+        add(argTDB,     "--loc=DIR",            "Use an existing TDB database (or create if does not exist)") ;
+        add(argMemTDB,  "--memTDB",             "Create an in-memory, non-persistent dataset using TDB (testing only)") ;
+        add(argPort,    "--port",               "Listen on this port number") ;
+        add(argPages,   "--pages=DIR",          "Set of pages to serve as static content") ; 
+        // Set via jetty config file.
+        add(argLocalhost,   "--localhost",      "Listen only on the localhost interface") ;
+        add(argTimeout, "--timeout=",           "Global timeout applied to queries (value in ms) -- format is X[,Y] ") ;
+        add(argAllowUpdate, "--update",         "Allow updates (via SPARQL Update and SPARQL HTTP Update)") ;
+        add(argFusekiConfig, "--config=",       "Use a configuration file to determine the services") ;
+        add(argJettyConfig, "--jetty-config=FILE",  "Set up the server (not services) with a Jetty XML file") ;
+        add(argBasicAuth, "--basic-auth=FILE",  "Configure basic auth using provided Jetty realm file, ignored if --jetty-config is used") ;
+        add(argMgtPort, "--mgtPort=port",       "Enable the management commands on the given port") ; 
+        add(argHome, "--home=DIR",              "Root of Fuseki installation (overrides environment variable FUSEKI_HOME)") ; 
+        add(argGZip, "--gzip=on|off",           "Enable GZip compression (HTTP Accept-Encoding) if request header set") ;
+        
+        add(argUber) ;
+        //add(argGSP) ;
+        
+        super.modVersion.addClass(TDB.class) ;
+        super.modVersion.addClass(Fuseki.class) ;
+    }
+
+    static String argUsage = "[--config=FILE] [--mem|--desc=AssemblerFile|--file=FILE] [--port PORT] /DatasetPathName" ; 
+    
+    @Override
+    protected String getSummary()
+    {
+        return getCommandName()+" "+argUsage ;
+    }
+
+    @Override
+    protected void processModulesAndArgs()
+    {
+        int x = 0 ;
+        
+        Logger log = Fuseki.serverLog ;
+        
+        if ( contains(argFusekiConfig) )
+            fusekiConfigFile = getValue(argFusekiConfig) ;
+        
+        ArgDecl assemblerDescDecl = new ArgDecl(ArgDecl.HasValue, "desc", "dataset") ;
+        if ( contains(argMem) ) x++ ; 
+        if ( contains(argFile) ) x++ ;
+        if ( contains(assemblerDescDecl) ) x++ ;
+        if ( contains(argTDB) ) x++ ;
+        if ( contains(argMemTDB) ) x++ ;
+
+        if ( fusekiConfigFile != null )
+        {
+            if ( x >= 1 )
+                throw new CmdException("Dataset specified on the command line but a configuration file also given.") ;
+        }
+        else
+        {
+            if ( x != 1 )
+                throw new CmdException("Required: either --config=FILE or one of --mem, --file, --loc or --desc") ;
+        }
+        
+        // One of:
+        // argMem, argFile, argMemTDB, argTDB, 
+        
+        
+        if ( contains(argMem) )
+        {
+            log.info("Dataset: in-memory") ;
+            dsg = DatasetGraphFactory.createMem() ;
+        }
+        if ( contains(argFile) )
+        {
+            dsg = DatasetGraphFactory.createMem() ;
+            // replace by RiotLoader after ARQ refresh.
+            String filename = getValue(argFile) ;
+            log.info("Dataset: in-memory: load file: "+filename) ;
+            if ( ! FileOps.exists(filename) )
+                throw new CmdException("File not found: "+filename) ;
+
+            Lang language = RDFLanguages.filenameToLang(filename) ;
+            if ( language == null )
+                throw new CmdException("Can't guess language for file: "+filename) ;
+            InputStream input = IO.openFile(filename) ; 
+            
+            if ( RDFLanguages.isQuads(language) )
+                RDFDataMgr.read(dsg, filename) ;
+            else
+                RDFDataMgr.read(dsg.getDefaultGraph(), filename) ;
+        }
+        
+        if ( contains(argMemTDB) )
+        {
+            log.info("TDB dataset: in-memory") ;
+            dsg = TDBFactory.createDatasetGraph() ;
+        }
+        
+        if ( contains(argTDB) )
+        {
+            String dir = getValue(argTDB) ;
+            
+            if ( Lib.equal(dir, Names.memName) ) {
+                log.info("TDB dataset: in-memory") ;
+            } else {
+                if ( ! FileOps.exists(dir) )
+                    throw new CmdException("Directory not found: "+dir) ;
+                log.info("TDB dataset: directory="+dir) ;
+            }
+            dsg = TDBFactory.createDatasetGraph(dir) ;
+        }
+        
+        // Otherwise
+        if ( contains(assemblerDescDecl) )
+        {
+            log.info("Dataset from assembler") ;
+            Dataset ds = modDataset.createDataset() ;
+            if ( ds != null )
+                dsg = ds.asDatasetGraph() ;
+        }
+        
+        if ( contains(argFusekiConfig) )
+        {
+            if ( dsg != null )
+                throw new CmdException("(internal error) Dataset specificed on the command line but a a configuration file also given.") ;
+            fusekiConfigFile = getValue(argFusekiConfig) ;
+        }
+        
+        if ( contains(argPort) )
+        {
+            String portStr = getValue(argPort) ;
+            try {
+                port = Integer.parseInt(portStr) ;
+            } catch (NumberFormatException ex)
+            {
+                throw new CmdException(argPort.getKeyName()+" : bad port number: "+portStr) ;
+            }
+        }
+        
+        if ( contains(argMgtPort) )
+        {
+            String mgtPortStr = getValue(argMgtPort) ;
+            try {
+                mgtPort = Integer.parseInt(mgtPortStr) ;
+            } catch (NumberFormatException ex)
+            {
+                throw new CmdException(argMgtPort.getKeyName()+" : bad port number: "+mgtPortStr) ;
+            }
+        }
+
+        if ( contains(argLocalhost) )
+            listenLocal = true ;
+            
+        if ( fusekiConfigFile == null && dsg == null )
+            throw new CmdException("No dataset defined and no configuration file: "+argUsage) ;
+        
+        if ( dsg != null )
+        {
+            if ( getPositional().size() == 0 )
+                throw new CmdException("No dataset path name given") ;
+            if ( getPositional().size() > 1  )
+                throw new CmdException("Multiple dataset path names given") ;
+            datasetPath = getPositionalArg(0) ;
+            if ( datasetPath.length() > 0 && ! datasetPath.startsWith("/") )
+                throw new CmdException("Dataset path name must begin with a /: "+datasetPath) ;
+            
+            allowUpdate = contains(argAllowUpdate) ;
+        }
+        
+        if ( contains(argTimeout) )
+        {
+            String str = getValue(argTimeout) ;
+            ARQ.getContext().set(ARQ.queryTimeout, str) ;
+        }
+        
+        if ( contains(argJettyConfig) )
+        {
+            jettyConfigFile = getValue(argJettyConfig) ;
+            if ( !FileOps.exists(jettyConfigFile) )
+                throw new CmdException("No such file: "+jettyConfigFile) ;
+        }
+        
+        if ( contains(argBasicAuth) )
+        {
+            authConfigFile = getValue(argBasicAuth) ;
+            if ( !FileOps.exists(authConfigFile) )
+                throw new CmdException("No such file: " + authConfigFile) ;
+        }
+        
+        if ( contains(argHome) )
+        {
+           List<String> args = super.getValues(argHome) ;
+           homeDir = args.get(args.size()-1) ;
+        }
+        
+        if ( contains(argPages) )
+        {
+           List<String> args = super.getValues(argPages) ;
+           pagesDir = args.get(args.size()-1) ;
+        }
+
+        if ( contains(argGZip) )
+        {
+            if ( ! hasValueOfTrue(argGZip) && ! hasValueOfFalse(argGZip) )
+                throw new CmdException(argGZip.getNames().get(0)+": Not understood: "+getValue(argGZip)) ;
+            enableCompression = super.hasValueOfTrue(argGZip) ;
+        }
+        
+        if ( contains(argUber) )
+            SPARQLServer.überServlet = true ;
+        
+        if ( contains(argGSP) )
+        {
+            SPARQLServer.überServlet = true ;
+            Fuseki.graphStoreProtocolPostCreate = true ;
+        }
+
+    }
+
+    private static String sort_out_dir(String path)
+    {
+        path.replace('\\', '/') ;
+        if ( ! path.endsWith("/"))
+            path = path +"/" ;
+        return path ;
+    }
+    
+    @Override
+    protected void exec()
+    {
+        if ( homeDir == null )
+        {
+            if ( System.getenv(Fuseki.FusekiHomeEnv) != null )
+                 homeDir = System.getenv(Fuseki.FusekiHomeEnv) ;
+            else
+                 homeDir = "." ;
+        }
+        
+        homeDir = sort_out_dir(homeDir) ;
+        Fuseki.configLog.info("Home Directory: " + FileOps.fullDirectoryPath(homeDir));
+        if ( ! FileOps.exists(homeDir) )
+            Fuseki.configLog.warn("No such directory for Fuseki home: "+homeDir) ;
+        
+        String staticContentDir = pagesDir ;
+        if ( staticContentDir == null )
+            staticContentDir = homeDir+Fuseki.PagesStatic ;
+        
+        Fuseki.configLog.debug("Static Content Directory: "+ FileOps.fullDirectoryPath(staticContentDir)) ;
+
+        if ( ! FileOps.exists(staticContentDir) ) {
+            Fuseki.configLog.warn("No such directory for static content: " + FileOps.fullDirectoryPath(staticContentDir)) ;
+            Fuseki.configLog.warn("You may need to set the --pages or --home option to configure static content correctly");
+        }
+        
+        if ( jettyConfigFile != null )
+            Fuseki.configLog.info("Jetty configuration: "+jettyConfigFile) ;
+        
+        ServerConfig serverConfig ;
+        
+        if ( fusekiConfigFile != null )
+        {
+            Fuseki.configLog.info("Configuration file: "+fusekiConfigFile) ;
+            serverConfig = FusekiConfig.configure(fusekiConfigFile) ;
+        }
+        else 
+        {
+            serverConfig = FusekiConfig.defaultConfiguration(datasetPath, dsg, allowUpdate, listenLocal) ;
+            if ( ! allowUpdate )
+                Fuseki.serverLog.info("Running in read-only mode.");
+        }
+        
+        // TODO Get from parsing config file.
+        serverConfig.port = port ;
+        serverConfig.pages = staticContentDir ;
+        serverConfig.mgtPort = mgtPort ;
+        serverConfig.pagesPort = port ;
+        serverConfig.loopback = listenLocal ;
+        serverConfig.enableCompression = enableCompression ;
+        serverConfig.jettyConfigFile = jettyConfigFile ;
+        serverConfig.authConfigFile = authConfigFile ;
+        serverConfig.verboseLogging = ( super.isVerbose() || super.isDebug() ) ;
+        
+        SPARQLServer server = new SPARQLServer(serverConfig) ;
+        
+        // Temporary
+        Fuseki.setServer(server) ;
+        
+        Server mgtServer = null ;
+        
+        if ( mgtPort > 0 )
+        {
+            Fuseki.configLog.info("Management services on port "+mgtPort) ;
+            mgtServer = ManagementServer.createManagementServer(mgtPort) ;
+            try { mgtServer.start() ; }
+            catch (java.net.BindException ex)
+            { serverLog.error("SPARQLServer: Failed to start management server: " + ex.getMessage()) ; System.exit(1) ; }
+            catch (Exception ex)
+            { serverLog.error("SPARQLServer: Failed to start management server: " + ex.getMessage(), ex) ; System.exit(1) ; }
+        }
+
+        server.start() ;
+        try { server.getServer().join() ; } catch (Exception ex) {}
+
+        if ( mgtServer != null )
+        {
+            try { mgtServer.stop() ; } 
+            catch (Exception e) { serverLog.warn("Failed to cleanly stop the management server", e) ; }
+        }
+        System.exit(0) ;
+    }
+    
+
+    @Override
+    protected String getCommandName()
+    {
+        return "fuseki" ;
+    }
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/main/java/org/apache/jena/fuseki/FusekiConfigException.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/java/org/apache/jena/fuseki/FusekiConfigException.java b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/FusekiConfigException.java
new file mode 100644
index 0000000..5e1b018
--- /dev/null
+++ b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/FusekiConfigException.java
@@ -0,0 +1,28 @@
+/*
+ * 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.fuseki;
+
+
+public class FusekiConfigException extends FusekiException
+{
+    public FusekiConfigException(String msg, Throwable cause)    { super(msg, cause) ; }
+    public FusekiConfigException(String msg)                     { super(msg) ; }
+    public FusekiConfigException(Throwable cause)                { super(cause) ; }
+    public FusekiConfigException()                               { super() ; }
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/main/java/org/apache/jena/fuseki/FusekiException.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/java/org/apache/jena/fuseki/FusekiException.java b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/FusekiException.java
new file mode 100644
index 0000000..04953ce
--- /dev/null
+++ b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/FusekiException.java
@@ -0,0 +1,29 @@
+/*
+ * 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.fuseki;
+
+import com.hp.hpl.jena.sparql.ARQException ;
+
+public class FusekiException extends ARQException
+{
+    public FusekiException(String msg, Throwable cause)    { super(msg, cause) ; }
+    public FusekiException(String msg)                     { super(msg) ; }
+    public FusekiException(Throwable cause)                { super(cause) ; }
+    public FusekiException()                               { super() ; }
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/main/java/org/apache/jena/fuseki/FusekiLib.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/java/org/apache/jena/fuseki/FusekiLib.java b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/FusekiLib.java
new file mode 100644
index 0000000..5324793
--- /dev/null
+++ b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/FusekiLib.java
@@ -0,0 +1,148 @@
+/*
+ * 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.fuseki;
+
+import java.util.Iterator ;
+
+import javax.servlet.http.HttpServletRequest ;
+
+import org.apache.commons.lang.StringUtils ;
+import org.apache.jena.atlas.lib.MultiMap ;
+import org.apache.jena.atlas.lib.MultiMapToList ;
+import org.apache.jena.atlas.web.ContentType ;
+import org.apache.jena.fuseki.servlets.HttpAction ;
+import org.apache.jena.riot.Lang ;
+import org.apache.jena.riot.RDFLanguages ;
+
+import com.hp.hpl.jena.graph.Graph ;
+import com.hp.hpl.jena.graph.Node ;
+import com.hp.hpl.jena.graph.Triple ;
+import com.hp.hpl.jena.shared.PrefixMapping ;
+import com.hp.hpl.jena.sparql.core.DatasetGraph ;
+import com.hp.hpl.jena.sparql.core.Quad ;
+import com.hp.hpl.jena.sparql.util.Convert ;
+
+public class FusekiLib {
+    /** Get the content type of an action or return the default.
+     * @param  action
+     * @return ContentType
+     */
+    public static ContentType getContentType(HttpAction action) {
+        return getContentType(action.request) ;
+    }
+    
+    /** Get the content type of an action or return the default.
+     * @param  request
+     * @return ContentType
+     */
+    public static ContentType getContentType(HttpServletRequest request) {
+        String contentTypeHeader = request.getContentType() ;
+        if ( contentTypeHeader == null ) 
+            return null ;
+        return ContentType.create(contentTypeHeader) ;
+    }
+    
+    /** Get the incoming Lang based on Content-Type of an action.
+     * @param  action
+     * @param  dft Default if no "Content-Type:" found. 
+     * @return ContentType
+     */
+    public static Lang getLangFromAction(HttpAction action, Lang dft) {
+        String contentTypeHeader = action.request.getContentType() ;
+        if ( contentTypeHeader == null )
+            return dft ;
+        return RDFLanguages.contentTypeToLang(contentTypeHeader) ;
+    }
+
+    static String fmtRequest(HttpServletRequest request) {
+        StringBuilder sbuff = new StringBuilder() ;
+        sbuff.append(request.getMethod()) ;
+        sbuff.append(" ") ;
+        sbuff.append(Convert.decWWWForm(request.getRequestURL())) ;
+
+        String qs = request.getQueryString() ;
+        if ( qs != null ) {
+            String tmp = request.getQueryString() ;
+            tmp = Convert.decWWWForm(tmp) ;
+            tmp = tmp.replace('\n', ' ') ;
+            tmp = tmp.replace('\r', ' ') ;
+            sbuff.append("?").append(tmp) ;
+        }
+        return sbuff.toString() ;
+    }
+
+    /** Parse the query string - do not process the body even for a form */
+    public static MultiMap<String, String> parseQueryString(HttpServletRequest req) {
+        MultiMap<String, String> map = MultiMapToList.create() ;
+
+        // Don't use ServletRequest.getParameter or getParamterNames
+        // as that reads form data. This code parses just the query string.
+        if ( req.getQueryString() != null ) {
+            String[] params = req.getQueryString().split("&") ;
+            for ( String p : params )
+            {
+                String[] x = p.split( "=", 2 );
+                String name = null;
+                String value = null;
+
+                if ( x.length == 0 )
+                { // No "="
+                    name = p;
+                    value = "";
+                }
+                else if ( x.length == 1 )
+                { // param=
+                    name = x[0];
+                    value = "";
+                }
+                else
+                { // param=value
+                    name = x[0];
+                    value = x[1];
+                }
+                map.put( name, value );
+            }
+        }
+        return map ;
+    }
+    
+    public static String safeParameter(HttpServletRequest request, String pName) {
+        String value = request.getParameter(pName) ;
+        value = StringUtils.replaceChars(value, "\r", "") ;
+        value = StringUtils.replaceChars(value, "\n", "") ;
+        return value ;
+    }
+
+    // Do the addition directly on the dataset
+    public static void addDataInto(Graph data, DatasetGraph dsg, Node graphName) {
+        // Prefixes?
+        if ( graphName == null )
+            graphName = Quad.defaultGraphNodeGenerated ;
+
+        Iterator<Triple> iter = data.find(Node.ANY, Node.ANY, Node.ANY) ;
+        for (; iter.hasNext();) {
+            Triple t = iter.next() ;
+            dsg.add(graphName, t.getSubject(), t.getPredicate(), t.getObject()) ;
+        }
+
+        PrefixMapping pmapSrc = data.getPrefixMapping() ;
+        PrefixMapping pmapDest = dsg.getDefaultGraph().getPrefixMapping() ;
+        pmapDest.setNsPrefixes(pmapSrc) ;
+    }
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/main/java/org/apache/jena/fuseki/FusekiNotFoundException.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/java/org/apache/jena/fuseki/FusekiNotFoundException.java b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/FusekiNotFoundException.java
new file mode 100644
index 0000000..be9be90
--- /dev/null
+++ b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/FusekiNotFoundException.java
@@ -0,0 +1,26 @@
+/*
+ * 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.fuseki;
+
+import org.apache.jena.web.HttpSC ;
+
+public class FusekiNotFoundException extends FusekiRequestException
+{
+    public FusekiNotFoundException(String msg)    { super(HttpSC.NOT_FOUND_404, msg) ; }
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/main/java/org/apache/jena/fuseki/FusekiRequestException.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/java/org/apache/jena/fuseki/FusekiRequestException.java b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/FusekiRequestException.java
new file mode 100644
index 0000000..e197be2
--- /dev/null
+++ b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/FusekiRequestException.java
@@ -0,0 +1,57 @@
+/*
+ * 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.fuseki;
+
+import org.apache.jena.web.HttpSC ;
+
+
+public class FusekiRequestException extends FusekiException
+{
+    public static FusekiRequestException create(int code, String msg)
+    {
+        if ( code == HttpSC.NOT_FOUND_404 )
+            return new FusekiNotFoundException(msg) ;
+        return new FusekiRequestException(code, msg) ;
+    }
+    
+    private final int statusCode ;
+    private final String responseMessage ;
+    protected FusekiRequestException(int code, String msg)
+    {
+        super(msg) ;
+        this.statusCode = code ;
+        responseMessage = msg ;
+    }
+    
+    public int getStatusCode()
+    {
+        return statusCode ;
+    }
+
+    public String getResponseMessage()
+    {
+        return responseMessage ;
+    }
+
+    @Override
+    public String toString()
+    {
+        return "HTTP: "+statusCode+" "+getMessage() ;
+    }
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/main/java/org/apache/jena/fuseki/HttpNames.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/java/org/apache/jena/fuseki/HttpNames.java b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/HttpNames.java
new file mode 100644
index 0000000..65d73c7
--- /dev/null
+++ b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/HttpNames.java
@@ -0,0 +1,94 @@
+/*
+ * 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.fuseki;
+
+public class HttpNames
+{
+    // Request
+    public static final String hAccept              = "Accept" ;
+    public static final String hAcceptEncoding      = "Accept-Encoding" ;
+    public static final String hAcceptCharset       = "Accept-Charset" ;
+    //public static final String hAcceptLanguage      = "Accept-Language" ;
+
+    // Response
+    public static final String xhAcceptRanges        = "Accept-Ranges" ;
+    public static final String hAllow               = "Allow" ;
+    public static final String hContentEncoding     = "Content-Encoding" ;
+    public static final String hContentLengh        = "Content-Length" ;
+    public static final String hContentLocation     = "Content-Location" ;
+    public static final String hContentRange        = "Content-Range" ;
+    public static final String hContentType         = "Content-Type" ;
+    public static final String hRetryAfter          = "Retry-After" ;
+    public static final String hServer              = "Server" ;
+    public static final String hLocation            = "Location" ; 
+    public static final String hVary                = "Vary" ;
+    public static final String charset              = "charset" ;
+    
+    // CORS: 
+    //   http://www.w3.org/TR/cors/  http://esw.w3.org/CORS_Enabled
+    public static final String hAccessControlAllowOrigin  = "Access-Control-Allow-Origin" ;
+    public static final String hAccessControlAllowHeaders = "Access-Control-Allow-Headers" ;
+    
+    // Fuseki parameter names 
+    public static final String paramGraph           = "graph" ;
+    public static final String paramGraphDefault    = "default" ;
+
+    public static final String paramQuery           = "query" ;
+    public static final String paramQueryRef        = "query-ref" ;
+    public static final String paramDefaultGraphURI = "default-graph-uri" ;
+    public static final String paramNamedGraphURI   = "named-graph-uri" ;
+    
+    public static final String paramStyleSheet      = "stylesheet" ;
+    public static final String paramAccept          = "accept" ;
+    public static final String paramOutput1         = "output" ;        // See Yahoo! developer: http://developer.yahoo.net/common/json.html 
+    public static final String paramOutput2         = "format" ;        // Alternative name 
+    public static final String paramCallback        = "callback" ;
+    public static final String paramForceAccept     = "force-accept" ;  // Force the accept header at the last moment
+    public static final String paramTimeout         = "timeout" ;
+    
+    public static final String paramUpdate          = "update" ;
+    public static final String paramRequest         = "request" ; 
+    public static final String paramUsingGraphURI        = "using-graph-uri" ;
+    public static final String paramUsingNamedGraphURI   = "using-named-graph-uri" ;
+    
+    public static final String METHOD_DELETE        = "DELETE";
+    public static final String METHOD_HEAD          = "HEAD";
+    public static final String METHOD_GET           = "GET";
+    public static final String METHOD_OPTIONS       = "OPTIONS";
+    public static final String METHOD_PATCH         = "PATCH" ;
+    public static final String METHOD_POST          = "POST";
+    public static final String METHOD_PUT           = "PUT";
+    public static final String METHOD_TRACE         = "TRACE";
+
+    public static final String HEADER_IFMODSINCE    = "If-Modified-Since";
+    public static final String HEADER_LASTMOD       = "Last-Modified";
+    
+    // Names for services in the default configuration
+    public static final String ServiceQuery         = "query" ;
+    public static final String ServiceQueryAlt      = "sparql" ;
+    public static final String ServiceUpdate        = "update" ;
+    public static final String ServiceData          = "data" ;
+    public static final String ServiceUpload        = "upload" ;
+    public static final String ServiceGeneralQuery  = "/sparql" ;
+    
+    // Posisble values of fields.
+    // TODO Pull in from results writer.
+    public static final String valueDefault    = "default" ;
+    
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/main/java/org/apache/jena/fuseki/Test.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/java/org/apache/jena/fuseki/Test.java b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/Test.java
new file mode 100644
index 0000000..b4f5fed
--- /dev/null
+++ b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/Test.java
@@ -0,0 +1,25 @@
+/*
+ * 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.fuseki;
+
+public class Test
+{
+    public static void init() { System.out.println("INIT called") ; }
+}
+

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/main/java/org/apache/jena/fuseki/conneg/ConNeg.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/java/org/apache/jena/fuseki/conneg/ConNeg.java b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/conneg/ConNeg.java
new file mode 100644
index 0000000..b448c6c
--- /dev/null
+++ b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/conneg/ConNeg.java
@@ -0,0 +1,205 @@
+/*
+ * 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.fuseki.conneg;
+
+import static org.apache.jena.fuseki.HttpNames.hAcceptCharset ;
+
+import javax.servlet.http.HttpServletRequest ;
+
+import org.apache.jena.atlas.web.AcceptList ;
+import org.apache.jena.atlas.web.MediaRange ;
+import org.apache.jena.atlas.web.MediaType ;
+import org.slf4j.Logger ;
+import org.slf4j.LoggerFactory ;
+
+/**
+ * <p>Content negotiation is a mechanism defined in the HTTP specification
+ * that makes it possible to serve different versions of a document
+ * (or more generally, a resource representation) at the same URI, so that
+ * user agents can specify which version fit their capabilities the best.</p>
+ *
+ * <p>ConNeg is used in Fuseki to help matching the content media type requested
+ * by the user, against the list of offered media types.</p>
+ *
+ * @see <a href="http://en.wikipedia.org/wiki/Content_negotiation">http://en.wikipedia.org/wiki/Content_negotiation</a>
+ * @see <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1">http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1</a>
+ */
+public class ConNeg
+{
+    private static Logger log = LoggerFactory.getLogger(ConNeg.class) ;
+    // See riot.ContentNeg (client side).
+    // http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1
+
+    /**
+     * Parses the content type. It splits the string by semi-colon and finds the
+     * other features such as the "q" quality factor.  For a complete documentation
+     * on how the parsing happens, see
+     * <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1">http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1</a>.
+     *
+     * @param contentType content type string
+     * @return parsed media type
+     */
+    static public MediaType parse(String contentType)
+    {
+        try {
+            return MediaType.create(contentType) ;
+        } catch (RuntimeException ex) { return null ; }
+    }
+
+    /**
+     * <p>Creates a {@link AcceptList} with the given HTTP header string and
+     * uses the {@link AcceptList#match(MediaType)} method to decide which
+     * media type matches the HTTP header string.</p>
+     *
+     * <p>The <em>q</em> quality factor is used to decide which choice is the best
+     * match.</p>
+     *
+     * @param headerString HTTP header string
+     * @param offerList accept list
+     * @return matched media type
+     */
+    static public MediaType match(String headerString, AcceptList offerList)
+    {
+        AcceptList l = new AcceptList(headerString) ;
+        return AcceptList.match(l, offerList) ;
+    }
+
+    /**
+     * Match a single media type against a header string.
+     *
+     * @param headerString HTTP header string
+     * @param mediaRangeStr Semi-colon separated list of media types
+     * @return the matched media type or <code>null</code> if there was no match
+     */
+    public static String match(String headerString, String mediaRangeStr)
+    {
+        AcceptList l = new AcceptList(headerString) ;
+        MediaRange aItem = new MediaRange(mediaRangeStr) ;  // MediaType
+        MediaType m = l.match(aItem) ;
+        if ( m == null )
+            return null ;
+        return m.toHeaderString() ;
+    }
+
+    /**
+     * Split and trims a string using a given regex.
+     *
+     * @param s string
+     * @param splitStr given regex
+     * @return an array with the trimmed strings found
+     */
+    /*package*/ static String[] split(String s, String splitStr)
+    {
+        String[] x = s.split(splitStr,2) ;
+        for ( int i = 0 ; i < x.length ; i++ )
+        {
+            x[i] = x[i].trim() ;
+        }
+        return x ;
+    }
+
+    /**
+     * <p>Chooses the charset by using the Accept-Charset HTTP header.</p>
+     *
+     * <p>See {@link ConNeg#choose(String, AcceptList, MediaType)}.</p>
+     *
+     * @param httpRequest HTTP request
+     * @param myPrefs accept list
+     * @param defaultMediaType default media type
+     * @return media type chosen
+     */
+    public static MediaType chooseCharset(HttpServletRequest httpRequest,
+                                          AcceptList myPrefs,
+                                          MediaType defaultMediaType)
+    {
+        String a = httpRequest.getHeader(hAcceptCharset) ;
+        if ( log.isDebugEnabled() )
+            log.debug("Accept-Charset request: "+a) ;
+        
+        MediaType item = choose(a, myPrefs, defaultMediaType) ;
+        
+        if ( log.isDebugEnabled() )
+            log.debug("Charset chosen: "+item) ;
+    
+        return item ;
+    }
+
+    /**
+     * <p>Choose the content media type by extracting the Accept HTTP header from
+     * the HTTP request and choosing
+     * (see {@link ConNeg#choose(String, AcceptList, MediaType)}) a content media
+     * type that matches the header.</p>
+     *
+     * @param httpRequest HTTP request
+     * @param myPrefs accept list
+     * @param defaultMediaType default media type
+     * @return media type chosen
+     */
+    public static MediaType chooseContentType(HttpServletRequest httpRequest,
+                                              AcceptList myPrefs,
+                                              MediaType defaultMediaType)
+    {
+        String a = WebLib.getAccept(httpRequest) ;
+        if ( log.isDebugEnabled() )
+            log.debug("Accept request: "+a) ;
+        
+        MediaType item = choose(a, myPrefs, defaultMediaType) ;
+    
+        if ( log.isDebugEnabled() )
+            log.debug("Content type chosen: "+item) ;
+    
+        return item ;
+    }
+
+    /**
+     * <p>This method receives a HTTP header string, an {@link AcceptList} and a
+     * default {@link MediaType}.</p>
+     *
+     * <p>If the header string is null, it returns the given default MediaType.</p>
+     *
+     * <p>Otherwise it builds an {@link AcceptList} object with the header string
+     * and uses it to match against the given MediaType.</p>
+     *
+     * @param headerString HTTP header string
+     * @param myPrefs accept list
+     * @param defaultMediaType default media type
+     * @return a media type or <code>null</code> if none matched or if the
+     *          HTTP header string and the default media type are <code>null</code>.
+     */
+    private static MediaType choose(String headerString, AcceptList myPrefs,
+                                    MediaType defaultMediaType)
+    {
+        if ( headerString == null )
+            return defaultMediaType ;
+        
+        AcceptList headerList = new AcceptList(headerString) ;
+        
+        if ( myPrefs == null )
+        {
+            MediaType i = headerList.first() ;
+            if ( i == null ) return defaultMediaType ;
+            return i ;
+        }
+    
+        MediaType i = AcceptList.match(headerList, myPrefs) ;
+        if ( i == null )
+            return defaultMediaType ;
+        return i ;
+    }
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/main/java/org/apache/jena/fuseki/conneg/WebLib.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/java/org/apache/jena/fuseki/conneg/WebLib.java b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/conneg/WebLib.java
new file mode 100644
index 0000000..fdeb139
--- /dev/null
+++ b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/conneg/WebLib.java
@@ -0,0 +1,60 @@
+/*
+ * 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.fuseki.conneg;
+
+import java.util.Enumeration ;
+
+import javax.servlet.http.HttpServletRequest ;
+
+import org.apache.jena.fuseki.HttpNames ;
+
+public class WebLib
+{
+    /** Split a string, removing whitespace around the split string.
+     * e.g. Use in splitting HTTP accept/content-type headers.  
+     */
+    public static String[] split(String s, String splitStr)
+    {
+        String[] x = s.split(splitStr,2) ;
+        for ( int i = 0 ; i < x.length ; i++ )
+        {
+            x[i] = x[i].trim() ;
+        }
+        return x ;
+    }
+
+    /** Migrate to WebLib */
+    public static String getAccept(HttpServletRequest httpRequest)
+    {
+        // There can be multiple accept headers -- note many tools don't allow these to be this way (e.g. wget, curl)
+        Enumeration<String> en = httpRequest.getHeaders(HttpNames.hAccept) ;
+        if ( ! en.hasMoreElements() )
+            return null ;
+        StringBuilder sb = new StringBuilder() ;
+        String sep = "" ;
+        for ( ; en.hasMoreElements() ; )
+        {
+            String x = en.nextElement() ;
+            sb.append(sep) ;
+            sep = ", " ;
+            sb.append(x) ;
+        }
+        return sb.toString() ;
+    }
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/main/java/org/apache/jena/fuseki/mgt/ActionBackup.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/java/org/apache/jena/fuseki/mgt/ActionBackup.java b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/mgt/ActionBackup.java
new file mode 100644
index 0000000..c36e8be
--- /dev/null
+++ b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/mgt/ActionBackup.java
@@ -0,0 +1,196 @@
+/**
+ * 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.fuseki.mgt ;
+
+import static java.lang.String.format ;
+
+import java.io.* ;
+import java.util.concurrent.Callable ;
+import java.util.concurrent.ExecutorService ;
+import java.util.concurrent.Executors ;
+import java.util.zip.GZIPOutputStream ;
+
+import javax.servlet.http.HttpServletRequest ;
+import javax.servlet.http.HttpServletResponse ;
+
+import org.apache.jena.atlas.io.IO ;
+import org.apache.jena.atlas.lib.FileOps ;
+import org.apache.jena.atlas.logging.Log ;
+import org.apache.jena.fuseki.FusekiException ;
+import org.apache.jena.fuseki.FusekiLib ;
+import org.apache.jena.fuseki.server.DatasetRef ;
+import org.apache.jena.fuseki.server.DatasetRegistry ;
+import org.apache.jena.fuseki.servlets.HttpAction ;
+import org.apache.jena.fuseki.servlets.ServletBase ;
+import org.apache.jena.riot.Lang ;
+import org.apache.jena.riot.RDFDataMgr ;
+import org.apache.jena.web.HttpSC ;
+
+import com.hp.hpl.jena.sparql.core.DatasetGraph ;
+import com.hp.hpl.jena.sparql.util.Utils ;
+
+public class ActionBackup extends ServletBase
+{
+    public ActionBackup() { super() ; }
+
+    // Limit to one backup at a time.
+    public static final ExecutorService backupService = Executors.newFixedThreadPool(1) ;
+    
+    @Override
+    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException
+    {
+        String dataset = FusekiLib.safeParameter(request, "dataset") ;
+        if ( dataset == null )
+        {
+            response.sendError(HttpSC.BAD_REQUEST_400, "Required parameter missing: ?dataset=") ;
+            return ;
+        }
+        
+        if ( ! dataset.startsWith("/") )
+            dataset="/"+dataset ;
+        
+        // HttpSession session = request.getSession(true) ;
+        // session.setAttribute("dataset", dataset) ;
+        // session.setMaxInactiveInterval(15*60) ; // 10 mins
+
+        boolean known = DatasetRegistry.get().isRegistered(dataset) ;
+        if (!known)
+        {
+            response.sendError(HttpSC.BAD_REQUEST_400, "No such dataset: " + dataset) ;
+            return ;
+        }
+        
+        long id = allocRequestId(request, response);
+        HttpAction action = new HttpAction(id, request, response, false) ;
+        DatasetRef ref = DatasetRegistry.get().get(dataset) ;
+        action.setDataset(ref);
+        scheduleBackup(action) ;
+    }
+
+    static final String BackupArea = "backups" ;  
+    
+    private void scheduleBackup(final HttpAction action)
+    {
+        String dsName = action.dsRef.name ;
+        final String ds = dsName.startsWith("/")? dsName : "/"+dsName ;
+        
+        String timestamp = Utils.nowAsString("yyyy-MM-dd_HH-mm-ss") ;
+        final String filename = BackupArea + ds + "_" + timestamp ;
+        FileOps.ensureDir(BackupArea) ;
+        
+        try {
+            final Callable<Boolean> task = new Callable<Boolean>() {
+                @Override
+                public Boolean call() throws Exception
+                {
+                    log.info(format("[%d] Start backup %s to '%s'", action.id, ds, filename)) ;
+                    action.beginRead() ;
+                    try {
+                        backup(action.getActiveDSG(), filename) ;
+                        log.info(format("[%d] Finish backup %s to '%s'", action.id, ds, filename)) ;
+                    }
+                    catch ( RuntimeException ex )
+                    {
+                        log.info(format("[%d] Exception during backup: ", action.id, ex.getMessage()), ex) ;
+                        return Boolean.FALSE ;
+                    }
+                    finally {
+                        action.endRead() ;
+                    }
+                    return Boolean.TRUE ;
+                }} ;
+            
+            log.info(format("[%d] Schedule backup %s to '%s'", action.id, ds, filename)) ;                
+            backupService.submit(task) ;
+        } 
+        //catch (FusekiException ex)
+        catch (RuntimeException ex)
+        {
+            log.warn("Unanticipated exception", ex) ;
+            try { action.response.sendError(HttpSC.INTERNAL_SERVER_ERROR_500, ex.getMessage()) ; }
+            catch (IOException e) { IO.exception(e) ; }
+            return ;            
+        }
+        
+        successPage(action, "Backup scheduled - see server log for details") ;
+    }
+    
+    // Share with new ServletBase.
+    protected static void successPage(HttpAction action, String message)
+    {
+        try {
+            action.response.setContentType("text/html");
+            action.response.setStatus(HttpSC.OK_200);
+            PrintWriter out = action.response.getWriter() ;
+            out.println("<html>") ;
+            out.println("<head>") ;
+            out.println("</head>") ;
+            out.println("<body>") ;
+            out.println("<h1>Success</h1>");
+            if ( message != null )
+            {
+                out.println("<p>") ;
+                out.println(message) ;
+                out.println("</p>") ;
+            }
+            out.println("</body>") ;
+            out.println("</html>") ;
+            out.flush() ;
+        } catch (IOException ex) { IO.exception(ex) ; }
+    }
+    
+    public static void backup(DatasetGraph dsg, String backupfile)
+    {
+        if ( ! backupfile.endsWith(".nq") )
+            backupfile = backupfile+".nq" ;
+        
+        OutputStream out = null ;
+        try
+        {
+            if ( true )
+            {
+                // This seems to achive about the same as "gzip -6"
+                // It's not too expensive in elapsed time but it's not zero cost.
+                // GZip, large buffer.
+                out = new FileOutputStream(backupfile+".gz") ;
+                out = new GZIPOutputStream(out, 8*1024) ;
+                out = new BufferedOutputStream(out) ;
+            }
+            else
+            {
+                out = new FileOutputStream(backupfile) ;
+                out = new BufferedOutputStream(out) ;
+            }
+            
+            RDFDataMgr.write(out, dsg,Lang.NQUADS) ;
+            out.close() ;
+            out = null ;
+        } 
+        catch (FileNotFoundException e)
+        {
+            Log.warn(ActionBackup.class, "File not found: "+backupfile) ;
+            throw new FusekiException("File not found: "+backupfile) ;
+        } 
+        catch (IOException e) { IO.exception(e) ; }
+        finally {
+            try { if (out != null) out.close() ; }
+            catch (IOException e) { /* ignore */ }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/main/java/org/apache/jena/fuseki/mgt/ActionDataset.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/java/org/apache/jena/fuseki/mgt/ActionDataset.java b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/mgt/ActionDataset.java
new file mode 100644
index 0000000..fc3d395
--- /dev/null
+++ b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/mgt/ActionDataset.java
@@ -0,0 +1,121 @@
+/*
+ * 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.fuseki.mgt;
+
+import java.io.IOException ;
+import java.io.UnsupportedEncodingException ;
+
+import javax.servlet.ServletOutputStream ;
+import javax.servlet.http.HttpServlet ;
+import javax.servlet.http.HttpServletRequest ;
+import javax.servlet.http.HttpServletResponse ;
+import javax.servlet.http.HttpSession ;
+
+import org.apache.commons.codec.binary.Base64 ;
+import org.apache.jena.fuseki.FusekiLib ;
+import org.apache.jena.fuseki.HttpNames ;
+import org.apache.jena.fuseki.server.DatasetRegistry ;
+import org.apache.jena.web.HttpSC ;
+
+/** Log-in and choose dataset */
+public class ActionDataset extends HttpServlet
+{
+    @Override
+    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException
+    {
+//        request.getRemoteUser() ;
+//        request.getUserPrincipal() ;
+        
+        String dataset = FusekiLib.safeParameter(request, "dataset") ;
+        HttpSession session = request.getSession(true) ;
+        session.setAttribute("dataset", dataset) ;
+        session.setMaxInactiveInterval(15*60) ; // 10 mins
+        
+        boolean known = DatasetRegistry.get().isRegistered(dataset) ;
+        if ( !known )
+        {
+            response.sendError(HttpSC.BAD_REQUEST_400, "No such dataset: "+dataset) ;
+            return ;
+        }
+        
+        if ( true )
+        {
+            // Redirect to GET page.
+            response.setHeader(HttpNames.hLocation, PageNames.pageAfterLogin) ;
+            response.setStatus(HttpSC.SEE_OTHER_303) ;
+        }
+        else
+        {
+            // Welcome style - but HTML inline :-(
+            response.setContentType("text/html");
+            response.setStatus(HttpSC.OK_200) ;
+            ServletOutputStream out = response.getOutputStream() ;
+            out.print("<p>"+dataset+"("+known+")</p>") ;
+
+            for ( String name : DatasetRegistry.get().keys() ) {
+                out.print("<li>") ;
+                out.print(name) ;
+                out.println("</li>") ;
+            }
+            out.println("</ul>") ;
+            out.println("<p><a href=\"info\">Next</a></p>") ;
+        }
+        
+//        Cookie cookie = new Cookie("org.apache.jena.fuseki.session", dataset) ;
+//        // 24 hours.
+//        cookie.setMaxAge(24*60*60) ;
+        
+    }
+    
+    /**
+     * This method returns true if the HttpServletRequest contains a valid
+     * authorisation header
+     * @param req The HttpServletRequest to test
+     * @return true if the Authorisation header is valid
+     */
+
+    private boolean authenticate(HttpServletRequest req)
+    {
+        String authhead=req.getHeader("Authorization");
+
+        if(authhead!=null)
+        {
+            byte[] up = Base64.decodeBase64(authhead.substring(6)) ;
+            // Decode the authorisation String
+            String usernpass ;
+            try
+            {
+                usernpass = new String(up, "ascii") ;
+            } catch (UnsupportedEncodingException e)
+            {
+                e.printStackTrace();
+                usernpass = null ;
+            }
+            // Split the username from the password
+            String user=usernpass.substring(0,usernpass.indexOf(":"));
+            String password=usernpass.substring(usernpass.indexOf(":")+1);
+
+            if (user.equals("user") && password.equals("pass"))
+                return true;
+        }
+
+        return false;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/main/java/org/apache/jena/fuseki/mgt/ManagementServer.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/java/org/apache/jena/fuseki/mgt/ManagementServer.java b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/mgt/ManagementServer.java
new file mode 100644
index 0000000..5e9dca9
--- /dev/null
+++ b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/mgt/ManagementServer.java
@@ -0,0 +1,99 @@
+/**
+ * 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.fuseki.mgt;
+
+import static org.apache.jena.fuseki.Fuseki.serverLog ;
+
+import java.util.List ;
+
+import javax.servlet.http.HttpServlet ;
+
+import org.apache.jena.fuseki.Fuseki ;
+import org.apache.jena.fuseki.server.FusekiErrorHandler ;
+import org.apache.jena.fuseki.servlets.DumpServlet ;
+import org.eclipse.jetty.server.Connector ;
+import org.eclipse.jetty.server.Server ;
+import org.eclipse.jetty.server.nio.SelectChannelConnector ;
+import org.eclipse.jetty.servlet.ServletContextHandler ;
+import org.eclipse.jetty.servlet.ServletHolder ;
+
+public class ManagementServer
+{
+    public static Server createManagementServer(int mgtPort)
+    {
+        Fuseki.serverLog.info("Adding management functions") ;
+        
+        // Separate Jetty server
+        Server server = new Server() ;
+        
+//        BlockingChannelConnector bcConnector = new BlockingChannelConnector() ;
+//        bcConnector.setUseDirectBuffers(false) ;
+//        Connector connector = bcConnector ;
+        
+        Connector connector = new SelectChannelConnector() ;
+        // Ignore idle time. 
+        // If set, then if this goes off, it keeps going off and you get a lot of log messages.
+        connector.setMaxIdleTime(0) ; // Jetty outputs a lot of messages if this goes off.
+        connector.setPort(mgtPort);
+        server.addConnector(connector) ;
+        
+        ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
+        context.setErrorHandler(new FusekiErrorHandler()) ;
+        server.setHandler(context);
+        
+        // Add the server control servlet
+        addServlet(context, new MgtCmdServlet(),    "/mgt") ;
+        addServlet(context, new DumpServlet(),      "/dump") ;
+        addServlet(context, new StatsServlet(),     "/stats") ;
+        addServlet(context, new PingServlet(),      "/ping") ;
+        
+        return server ; 
+        // Old plan
+//      // Development : server control panel.
+//      addServlet(context, new ServerServlet(), "/server") ;
+//      addServlet(context, new ActionBackup(), "/backup") ;
+    }
+
+    // SHARE
+    private static void addServlet(ServletContextHandler context, String datasetPath, HttpServlet servlet, List<String> pathSpecs)
+    {
+        for ( String pathSpec : pathSpecs )
+        {
+            if ( pathSpec.endsWith("/") )
+                pathSpec = pathSpec.substring(0, pathSpec.length()-1) ;
+            if ( pathSpec.startsWith("/") )
+                pathSpec = pathSpec.substring(1, pathSpec.length()) ;
+            addServlet(context, servlet, datasetPath+"/"+pathSpec) ;
+        }
+    }
+
+    private static void addServlet(ServletContextHandler context, HttpServlet servlet, String pathSpec)
+    {
+        ServletHolder holder = new ServletHolder(servlet) ;
+        addServlet(context, holder, pathSpec) ;
+    }
+    
+    private static void addServlet(ServletContextHandler context, ServletHolder holder, String pathSpec)
+    {
+        serverLog.debug("Add servlet @ "+pathSpec) ;
+        context.addServlet(holder, pathSpec) ;
+    }
+
+}
+

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/main/java/org/apache/jena/fuseki/mgt/MgtCmdServlet.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/java/org/apache/jena/fuseki/mgt/MgtCmdServlet.java b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/mgt/MgtCmdServlet.java
new file mode 100644
index 0000000..5385e75
--- /dev/null
+++ b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/mgt/MgtCmdServlet.java
@@ -0,0 +1,169 @@
+/*
+ * 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.
+ */
+
+/** A servlet that dumps its request
+ */
+
+// Could be neater - much, much neater!
+
+package org.apache.jena.fuseki.mgt ;
+
+import java.io.IOException ;
+import java.io.PrintWriter ;
+
+import javax.servlet.http.HttpServlet ;
+import javax.servlet.http.HttpServletRequest ;
+import javax.servlet.http.HttpServletResponse ;
+
+import org.apache.jena.fuseki.Fuseki ;
+import org.apache.jena.fuseki.server.DatasetRef ;
+import org.apache.jena.fuseki.server.SPARQLServer ;
+import org.apache.jena.fuseki.server.ServiceRef ;
+import org.apache.jena.web.HttpSC ;
+import org.slf4j.Logger ;
+
+import com.hp.hpl.jena.Jena ;
+import com.hp.hpl.jena.query.ARQ ;
+import com.hp.hpl.jena.tdb.TDB ;
+
+/** Control functions for a Fuskei server */
+
+public class MgtCmdServlet extends HttpServlet
+{
+    // Experimental - likely to change. 
+    private static Logger log = Fuseki.serverLog ;
+
+    public MgtCmdServlet()
+    {
+
+    }
+
+    @Override
+    public void init()
+    {
+        return ;
+    }
+
+    public static String paramCmd     = "cmd" ;
+    public static String cmdBackup    = "backup" ;          // &dataset=/datasetname
+    public static String cmdRestart   = "restart" ;         // Not implemented.
+    public static String cmdShutdown  = "shutdown" ;        // Server stops, no questions asked. (Not implemented)
+
+    ActionBackup         actionBackup = new ActionBackup() ;
+
+    @Override
+    public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException
+    {
+        // Commands format:
+        // ?cmd=backup&<other args per command>
+
+        String[] args = req.getParameterValues(paramCmd) ;
+        if ( args == null ) {
+            resp.setContentType("text/plain") ;
+            resp.setStatus(HttpSC.BAD_REQUEST_400) ;
+
+            return ;
+        }
+        for ( String cmd : args ) {
+            if ( log.isInfoEnabled() )
+                log.info("Management command: " + cmd) ;
+
+            if ( cmd.equalsIgnoreCase(cmdBackup) ) {
+                actionBackup.doPost(req, resp) ;
+                continue ;
+            }
+            if ( cmd.equalsIgnoreCase(cmdRestart) ) {
+
+                continue ;
+            }
+            if ( cmd.equalsIgnoreCase(cmdShutdown) ) {
+                Fuseki.getServer().stop() ;
+                continue ;
+            }
+            log.warn("Unrecognized command : " + cmd) ;
+
+        }
+    }
+
+    @Override
+    public void doGet(HttpServletRequest req, HttpServletResponse resp)
+    {
+        try {
+            // serverLog.info("Fuseki Server Config servlet") ;
+
+            PrintWriter out = resp.getWriter() ;
+            resp.setContentType("text/plain") ;
+            SPARQLServer server = Fuseki.getServer() ;
+
+            out.println("Software:") ;
+            String fusekiVersion = Fuseki.VERSION ;
+            if ( fusekiVersion.equals("${project.version}") )
+                fusekiVersion = "(development)" ;
+
+            out.printf("  %s %s\n", Fuseki.NAME, fusekiVersion) ;
+            out.printf("  %s %s\n", TDB.NAME, TDB.VERSION) ;
+            out.printf("  %s %s\n", ARQ.NAME, ARQ.VERSION) ;
+            out.printf("  %s %s\n", Jena.NAME, Jena.VERSION) ;
+
+            // out.printf("Port: %s\n",
+            // server.getServer().getConnectors()[0].getPort()) ;
+            out.println() ;
+
+            for ( DatasetRef dsRef : server.getDatasets() ) {
+                datasetRefDetails(out, dsRef) ;
+                out.println() ;
+            }
+        }
+        catch (IOException ex) {}
+    }
+
+    private static void datasetRefDetails(PrintWriter out, DatasetRef dsRef)
+    {
+        if ( dsRef.name != null )
+            out.println("Name = " + dsRef.name) ;
+        else
+            out.println("Name = <unset>") ;
+
+        endpointDetail(out, "Query", dsRef, dsRef.query) ;
+        endpointDetail(out, "Update", dsRef, dsRef.update) ;
+        endpointDetail(out, "Upload", dsRef, dsRef.upload) ;
+        endpointDetail(out, "Graphs(Read)", dsRef, dsRef.readGraphStore) ;
+        endpointDetail(out, "Graphs(RW)", dsRef, dsRef.readWriteGraphStore) ;
+    }
+
+    private static void endpointDetail(PrintWriter out, String label, DatasetRef dsRef, ServiceRef service)
+    {
+        boolean first = true ;
+        out.printf("   %-15s :: ", label) ;
+
+        for ( String s : service.endpoints ) {
+            if ( !first )
+                out.print(" , ") ;
+            first = false ;
+            s = "/" + dsRef.name + "/" + s ;
+            out.print(s) ;
+        }
+        out.println() ;
+    }
+
+    @Override
+    public String getServletInfo()
+    {
+        return "Fuseki Control Servlet" ;
+    }
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/main/java/org/apache/jena/fuseki/mgt/MgtFunctions.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/java/org/apache/jena/fuseki/mgt/MgtFunctions.java b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/mgt/MgtFunctions.java
new file mode 100644
index 0000000..e43b1e2
--- /dev/null
+++ b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/mgt/MgtFunctions.java
@@ -0,0 +1,180 @@
+/*
+ * 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.fuseki.mgt;
+
+import java.util.List ;
+
+import javax.servlet.http.HttpServletRequest ;
+import javax.servlet.http.HttpSession ;
+
+import org.apache.jena.atlas.io.IndentedLineBuffer ;
+import org.apache.jena.atlas.iterator.Iter ;
+import org.apache.jena.fuseki.Fuseki ;
+import org.apache.jena.fuseki.server.DatasetRef ;
+import org.apache.jena.fuseki.server.DatasetRegistry ;
+import org.apache.jena.fuseki.server.ServiceRef ;
+
+import com.hp.hpl.jena.shared.PrefixMapping ;
+import com.hp.hpl.jena.sparql.core.DatasetGraph ;
+import com.hp.hpl.jena.sparql.core.Prologue ;
+import com.hp.hpl.jena.sparql.serializer.PrologueSerializer ;
+import com.hp.hpl.jena.tdb.store.DatasetGraphTDB ;
+
+/** Avoid code in JSPs */
+public class MgtFunctions
+{
+    /** Return the name of the current dataset */ 
+    public static String dataset(HttpServletRequest request, String dftValue)
+    {
+        String ds = dataset(request) ;
+        if ( ds == null )
+            return dftValue ;
+        return ds ;
+    }
+    
+    /** Return the name of the current dataset */ 
+    public static String dataset(HttpServletRequest request)
+    {
+        HttpSession session = request.getSession(false) ;
+        if ( session == null )
+            return "No session";
+        String ds = (String)session.getAttribute("dataset") ;
+        return ds ;
+    }
+
+    /** Return the dataset description reference for currnet dataset */  
+    public static DatasetRef datasetDesc(HttpServletRequest request)
+    {
+        HttpSession session = request.getSession(false) ;
+        if ( session == null )
+            return null ;
+        String ds = (String)session.getAttribute("dataset") ;
+        return DatasetRegistry.get().get(ds) ;
+    }
+
+    /** Return lists of datasets */ 
+    public static List<String> datasets(HttpServletRequest request)
+    {
+        return Iter.toList(DatasetRegistry.get().keys()) ;
+    }
+
+    /** Return name of */  
+    public static String actionDataset(HttpServletRequest request)
+    {
+        return PageNames.actionDatasetNames ;
+    }
+
+    // Service name getters ...
+    
+    /** Return a SPARQL query service name for the dataset */
+    public static String serviceQuery(String dataset)
+    {
+        String dft = "sparql" ; 
+        DatasetRef ref = getFromRegistry(dataset) ;
+        if ( ref == null )
+            return dft ;
+        return serviceNameOrDefault(ref.query, dft) ;
+    }
+    
+    /** Return a SPARQL update service name for the dataset */
+    public static String serviceUpdate(String dataset)
+    {
+        String dft = "update" ; 
+        DatasetRef ref = getFromRegistry(dataset) ;
+        if ( ref == null )
+            return dft ;
+        return serviceNameOrDefault(ref.update, dft) ;
+    }
+    
+    /** Return a SPARQL upload service name for the dataset */
+    public static String serviceUpload(String dataset)
+    {
+        String dft = "upload" ;
+        DatasetRef ref = getFromRegistry(dataset) ;
+        if ( ref == null )
+            return dft ;
+        return serviceNameOrDefault(ref.upload, dft) ;
+    }
+
+    /** Return a SPARQL Graph Store Protocol (Read) service name for the dataset */
+    public static String serviceGraphRead(String dataset)
+    {
+        String dft = "get" ;
+        DatasetRef ref = getFromRegistry(dataset) ;
+        if ( ref == null )
+            return dft ;
+        return serviceNameOrDefault(ref.readGraphStore, dft) ;
+    }
+
+    /** Return a SPARQL Graph Store Protocol (Read-Write) service name for the dataset */
+    public static String serviceGraphReadWrite(String dataset)
+    {
+        String dft = "data" ;
+        DatasetRef ref = getFromRegistry(dataset) ;
+        if ( ref == null )
+            return dft ;
+        return serviceNameOrDefault(ref.readWriteGraphStore, dft) ;
+    }
+
+    private static DatasetRef getFromRegistry(String dataset)
+    {
+        DatasetRegistry registry = DatasetRegistry.get() ;
+        if ( registry == null )
+        {
+            Fuseki.serverLog.warn("No dataset registry") ;
+            return null ;
+        }
+        
+        DatasetRef ref = registry.get(dataset) ;
+        if ( ref == null )
+            Fuseki.serverLog.warn("Dataset not found: "+dataset) ;
+        return ref ;
+    }
+
+    private static String serviceNameOrDefault(ServiceRef service, String defaultValue)
+    {
+        if ( service.endpoints.isEmpty() )
+            return defaultValue ;
+        String x = service.endpoints.get(0) ;
+        if ( x.startsWith("/") )
+            x = x.substring(1) ;
+        return x ;
+    }
+    
+    /** Return prefixes for the datasets, SPARQL syntax. */ 
+    public static String prefixes(HttpServletRequest request)
+    {
+        String dsName = dataset(request) ;
+        DatasetRef desc = getFromRegistry(dsName) ;
+        if ( desc == null )
+            return "<not found>" ;
+        DatasetGraph dsg = desc.dataset ; 
+        
+        if ( dsg instanceof DatasetGraphTDB )
+        {
+            PrefixMapping pmap = ((DatasetGraphTDB)dsg).getPrefixes().getPrefixMapping() ;
+            Prologue prologue = new Prologue(pmap) ;
+            IndentedLineBuffer buff = new IndentedLineBuffer() ;
+            PrologueSerializer.output(buff, prologue) ;
+            buff.append("\n") ;
+            return buff.asString() ;
+        }
+        return "" ;
+    }
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/main/java/org/apache/jena/fuseki/mgt/PageNames.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/java/org/apache/jena/fuseki/mgt/PageNames.java b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/mgt/PageNames.java
new file mode 100644
index 0000000..4dc315b
--- /dev/null
+++ b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/mgt/PageNames.java
@@ -0,0 +1,33 @@
+/*
+ * 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.fuseki.mgt;
+
+public class PageNames
+{
+    //public static final String pageControlPanel     = "/control-panel.tpl" ;
+    
+    /** The dispatch URL for the place to go after login (0.2.1 - login = choose dataset) */
+    public static final String pageAfterLogin      = "/sparql.tpl" ;
+    
+    /** This is the full web dispatch URL: control-panel.tpl knowns 
+     * the name indirectly because it gets it via velocity
+     * calling mgt.actionDataset.
+     */
+    public static final String actionDatasetNames   = "/$/datasets" ;
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/main/java/org/apache/jena/fuseki/mgt/PingServlet.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/java/org/apache/jena/fuseki/mgt/PingServlet.java b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/mgt/PingServlet.java
new file mode 100644
index 0000000..5d4ca53
--- /dev/null
+++ b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/mgt/PingServlet.java
@@ -0,0 +1,75 @@
+/**
+ * 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.fuseki.mgt;
+
+import static org.apache.jena.riot.WebContent.charsetUTF8 ;
+import static org.apache.jena.riot.WebContent.contentTypeTextPlain ;
+
+import java.io.IOException ;
+
+import javax.servlet.ServletOutputStream ;
+import javax.servlet.http.HttpServlet ;
+import javax.servlet.http.HttpServletRequest ;
+import javax.servlet.http.HttpServletResponse ;
+
+import org.apache.jena.fuseki.Fuseki ;
+import org.apache.jena.riot.web.HttpNames ;
+import org.apache.jena.web.HttpSC ;
+
+import com.hp.hpl.jena.sparql.util.Utils ;
+
+/** 
+ * The ping servlet provides a low costy, uncached endpoint that can be used
+ * to determine if this component is running and responding.  For example,
+ * a nagios check should use this endpoint.    
+ */
+public class PingServlet extends HttpServlet
+{
+    @Override
+    protected void doGet(HttpServletRequest req, HttpServletResponse resp) {
+        doCommon(req, resp); 
+    }
+    
+    @Override
+    protected void doPost(HttpServletRequest req, HttpServletResponse resp) {
+        doCommon(req, resp); 
+    }
+    
+
+    @Override
+    protected void doHead(HttpServletRequest req, HttpServletResponse resp) {
+        doCommon(req, resp); 
+    }
+
+    protected void doCommon(HttpServletRequest request, HttpServletResponse response) {
+        try {
+            response.setHeader(HttpNames.hCacheControl, "must-revalidate,no-cache,no-store");
+            response.setHeader(HttpNames.hPragma, "no-cache");
+            response.setContentType(contentTypeTextPlain);
+            response.setCharacterEncoding(charsetUTF8) ;
+            response.setStatus(HttpSC.OK_200);
+            ServletOutputStream out = response.getOutputStream() ;
+            out.println(Utils.nowAsXSDDateTimeString());
+        } catch (IOException ex) {
+            Fuseki.serverLog.warn("ping :: IOException :: "+ex.getMessage());
+        }
+    }
+}
+
+


[02/23] jena git commit: Rename folder jena-fuseki to jena-fuseki1

Posted by an...@apache.org.
http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Update.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Update.java b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Update.java
new file mode 100644
index 0000000..f16f634
--- /dev/null
+++ b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Update.java
@@ -0,0 +1,308 @@
+/*
+ * 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.fuseki.servlets;
+
+import static java.lang.String.format ;
+import static org.apache.jena.fuseki.Fuseki.requestLog ;
+import static org.apache.jena.fuseki.HttpNames.paramRequest ;
+import static org.apache.jena.fuseki.HttpNames.paramUpdate ;
+import static org.apache.jena.fuseki.HttpNames.paramUsingGraphURI ;
+import static org.apache.jena.fuseki.HttpNames.paramUsingNamedGraphURI ;
+import static org.apache.jena.fuseki.server.CounterName.UpdateExecErrors ;
+
+import java.io.ByteArrayInputStream ;
+import java.io.IOException ;
+import java.io.InputStream ;
+import java.util.Arrays ;
+import java.util.Collection ;
+import java.util.Enumeration ;
+import java.util.List ;
+
+import javax.servlet.ServletException ;
+import javax.servlet.http.HttpServletRequest ;
+import javax.servlet.http.HttpServletResponse ;
+
+import org.apache.jena.atlas.io.IO ;
+import org.apache.jena.atlas.lib.StrUtils ;
+import org.apache.jena.atlas.web.ContentType ;
+import org.apache.jena.fuseki.FusekiLib ;
+import org.apache.jena.fuseki.HttpNames ;
+import org.apache.jena.iri.IRI ;
+import org.apache.jena.riot.WebContent ;
+import org.apache.jena.riot.system.IRIResolver ;
+import org.apache.jena.web.HttpSC ;
+
+import com.hp.hpl.jena.graph.Node ;
+import com.hp.hpl.jena.graph.NodeFactory ;
+import com.hp.hpl.jena.query.QueryParseException ;
+import com.hp.hpl.jena.query.Syntax ;
+import com.hp.hpl.jena.sparql.modify.UsingList ;
+import com.hp.hpl.jena.update.UpdateAction ;
+import com.hp.hpl.jena.update.UpdateException ;
+import com.hp.hpl.jena.update.UpdateFactory ;
+import com.hp.hpl.jena.update.UpdateRequest ;
+
+public class SPARQL_Update extends SPARQL_Protocol
+{
+    // Base URI used to isolate parsing from the current directory of the server. 
+    private static final String UpdateParseBase = "http://example/update-base/" ;
+    private static final IRIResolver resolver = IRIResolver.create(UpdateParseBase) ;
+    
+    public SPARQL_Update()
+    { super() ; }
+
+    @Override
+    protected void doGet(HttpServletRequest request, HttpServletResponse response)
+    throws ServletException, IOException
+    {
+        response.sendError(HttpSC.BAD_REQUEST_400, "Attempt to perform SPARQL update by GET.  Use POST") ;
+    }
+    
+    @Override
+    protected void doPost(HttpServletRequest request, HttpServletResponse response)
+    throws ServletException, IOException
+    {
+        doCommon(request, response) ;
+    }
+    
+    @Override
+    protected void doOptions(HttpServletRequest request, HttpServletResponse response)
+    {
+        setCommonHeadersForOptions(response) ;
+        response.setHeader(HttpNames.hAllow, "OPTIONS,POST");
+        response.setHeader(HttpNames.hContentLengh, "0") ;
+    }
+
+    @Override
+    protected void perform(HttpAction action)
+    {
+        // WebContent needs to migrate to using ContentType.
+        String ctStr ;
+        {
+            ContentType ct = FusekiLib.getContentType(action) ;
+            if ( ct == null )
+                ctStr = WebContent.contentTypeSPARQLUpdate ;
+            else
+                ctStr = ct.getContentType() ;
+        }
+
+        if (WebContent.contentTypeSPARQLUpdate.equals(ctStr))
+        {
+            executeBody(action) ;
+            return ;
+        }
+        if (WebContent.contentTypeHTMLForm.equals(ctStr))
+        {
+            executeForm(action) ;
+            return ;
+        }
+        error(HttpSC.UNSUPPORTED_MEDIA_TYPE_415, "Bad content type: " + action.request.getContentType()) ;
+    }
+
+    protected static List<String> paramsForm = Arrays.asList(paramRequest, paramUpdate, 
+                                                             paramUsingGraphURI, paramUsingNamedGraphURI) ;
+    protected static List<String> paramsPOST = Arrays.asList(paramUsingGraphURI, paramUsingNamedGraphURI) ;
+    
+    @Override
+    protected void validate(HttpAction action)
+    {
+        HttpServletRequest request = action.request ;
+        
+        if ( ! HttpNames.METHOD_POST.equalsIgnoreCase(request.getMethod()) )
+            errorMethodNotAllowed("SPARQL Update : use POST") ;
+        
+        ContentType incoming = FusekiLib.getContentType(action) ;
+        String ctStr = ( incoming == null ) ? WebContent.contentTypeSPARQLUpdate : incoming.getContentType() ;
+        // ----
+        
+        if ( WebContent.contentTypeSPARQLUpdate.equals(ctStr) )
+        {
+            String charset = request.getCharacterEncoding() ;
+            if ( charset != null && ! charset.equalsIgnoreCase(WebContent.charsetUTF8) )
+                errorBadRequest("Bad charset: "+charset) ;
+            validate(request, paramsPOST) ;
+            return ;
+        }
+        
+        if ( WebContent.contentTypeHTMLForm.equals(ctStr) )
+        {
+            int x = countParamOccurences(request, paramUpdate) + countParamOccurences(request, paramRequest) ;
+            if ( x == 0 )
+                errorBadRequest("SPARQL Update: No 'update=' parameter") ;
+            if ( x != 1 )
+                errorBadRequest("SPARQL Update: Multiple 'update=' parameters") ;
+            
+            String requestStr = request.getParameter(paramUpdate) ;
+            if ( requestStr == null )
+                requestStr = request.getParameter(paramRequest) ;
+            if ( requestStr == null )
+                errorBadRequest("SPARQL Update: No update= in HTML form") ;
+            validate(request, paramsForm) ;
+            return ;
+        }
+        
+        error(HttpSC.UNSUPPORTED_MEDIA_TYPE_415, "Must be "+WebContent.contentTypeSPARQLUpdate+" or "+WebContent.contentTypeHTMLForm+" (got "+ctStr+")") ;
+    }
+    
+    protected void validate(HttpServletRequest request, Collection<String> params)
+    {
+        if ( params != null )
+        {
+            Enumeration<String> en = request.getParameterNames() ;
+            for ( ; en.hasMoreElements() ; )
+            {
+                String name = en.nextElement() ;
+                if ( ! params.contains(name) )
+                    warning("SPARQL Update: Unrecognize request parameter (ignored): "+name) ;
+            }
+        }
+    }
+
+    private void executeBody(HttpAction action)
+    {
+        InputStream input = null ;
+        try { input = action.request.getInputStream() ; }
+        catch (IOException ex) { errorOccurred(ex) ; }
+
+        if ( action.verbose )
+        {
+            // Verbose mode only .... capture request for logging (does not scale). 
+            String requestStr = null ;
+            try { requestStr = IO.readWholeFileAsUTF8(input) ; }
+            catch (IOException ex) { IO.exception(ex) ; }
+            requestLog.info(format("[%d] Update = %s", action.id, formatForLog(requestStr))) ;
+            
+            input = new ByteArrayInputStream(requestStr.getBytes());
+            requestStr = null;
+        }
+        
+        execute(action, input) ;
+        successNoContent(action) ;
+    }
+
+    private void executeForm(HttpAction action)
+    {
+        String requestStr = action.request.getParameter(paramUpdate) ;
+        if ( requestStr == null )
+            requestStr = action.request.getParameter(paramRequest) ;
+        
+        if ( action.verbose )
+            //requestLog.info(format("[%d] Form update = %s", action.id, formatForLog(requestStr))) ;
+            requestLog.info(format("[%d] Form update = \n%s", action.id, requestStr)) ;
+        // A little ugly because we are taking a copy of the string, but hopefully shouldn't be too big if we are in this code-path
+        // If we didn't want this additional copy, we could make the parser take a Reader in addition to an InputStream
+        byte[] b = StrUtils.asUTF8bytes(requestStr) ;
+        ByteArrayInputStream input = new ByteArrayInputStream(b);
+        requestStr = null;  // free it early at least
+        execute(action, input);
+        successPage(action,"Update succeeded") ;
+    }
+    
+    private void execute(HttpAction action, InputStream input)
+    {
+        UsingList usingList = processProtocol(action.request) ;
+        
+        // If the dsg is transactional, then we can parse and execute the update in a streaming fashion.
+        // If it isn't, we need to read the entire update request before performing any updates, because
+        // we have to attempt to make the request atomic in the face of malformed queries
+        UpdateRequest req = null ;
+        if (!action.isTransactional()) 
+        {
+            try {
+                // TODO implement a spill-to-disk version of this
+                req = UpdateFactory.read(usingList, input, UpdateParseBase, Syntax.syntaxARQ);
+            }
+            catch (UpdateException ex) { errorBadRequest(ex.getMessage()) ; return ; }
+            catch (QueryParseException ex) { errorBadRequest(messageForQPE(ex)) ; return ; }
+        }
+        
+        action.beginWrite() ;
+        try {
+            if (req == null )
+                UpdateAction.parseExecute(usingList, action.getActiveDSG(), input, UpdateParseBase, Syntax.syntaxARQ);
+            else
+                UpdateAction.execute(req, action.getActiveDSG()) ;
+            action.commit() ;
+        } catch (UpdateException ex) {
+            action.abort() ;
+            incCounter(action.srvRef, UpdateExecErrors) ;
+            errorOccurred(ex.getMessage()) ;
+        } catch (QueryParseException ex) {
+            action.abort() ;
+            // Counter inc'ed further out.
+            errorBadRequest(messageForQPE(ex)) ;
+        } catch (Throwable ex) {
+            if ( ! ( ex instanceof ActionErrorException ) )
+            {
+                try { action.abort() ; } catch (Exception ex2) {}
+                errorOccurred(ex.getMessage(), ex) ;
+            }
+        } finally { action.endWrite(); }
+    }
+
+    /* [It is an error to supply the using-graph-uri or using-named-graph-uri parameters 
+     * when using this protocol to convey a SPARQL 1.1 Update request that contains an 
+     * operation that uses the USING, USING NAMED, or WITH clause.]
+     * 
+     * We will simply capture any using parameters here and pass them to the parser, which will be
+     * responsible for throwing an UpdateException if the query violates the above requirement,
+     * and will also be responsible for adding the using parameters to update queries that can
+     * accept them.
+     */
+    private UsingList processProtocol(HttpServletRequest request)
+    {
+        UsingList toReturn = new UsingList();
+        
+        String[] usingArgs = request.getParameterValues(paramUsingGraphURI) ;
+        String[] usingNamedArgs = request.getParameterValues(paramUsingNamedGraphURI) ;
+        if ( usingArgs == null && usingNamedArgs == null )
+            return toReturn;
+        if ( usingArgs == null )
+            usingArgs = new String[0] ;
+        if ( usingNamedArgs == null )
+            usingNamedArgs = new String[0] ;
+        // Impossible.
+//        if ( usingArgs.length == 0 && usingNamedArgs.length == 0 )
+//            return ;
+        
+        for (String nodeUri : usingArgs)
+        {
+            toReturn.addUsing(createNode(nodeUri));
+        }
+        for (String nodeUri : usingNamedArgs)
+        {
+            toReturn.addUsingNamed(createNode(nodeUri));
+        }
+        
+        return toReturn;
+    }
+    
+    private static Node createNode(String x)
+    {
+        try {
+            IRI iri = resolver.resolve(x) ;
+            return NodeFactory.createURI(iri.toString()) ;
+        } catch (Exception ex)
+        {
+            errorBadRequest("SPARQL Update: bad IRI: "+x) ;
+            return null ;
+        }
+        
+    }
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Upload.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Upload.java b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Upload.java
new file mode 100644
index 0000000..d21855f
--- /dev/null
+++ b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Upload.java
@@ -0,0 +1,260 @@
+/*
+ * 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.fuseki.servlets;
+
+import static java.lang.String.format ;
+
+import java.io.IOException ;
+import java.io.InputStream ;
+import java.io.PrintWriter ;
+import java.util.zip.GZIPInputStream ;
+
+import javax.servlet.ServletException ;
+import javax.servlet.http.HttpServletRequest ;
+import javax.servlet.http.HttpServletResponse ;
+
+import org.apache.commons.fileupload.FileItemIterator ;
+import org.apache.commons.fileupload.FileItemStream ;
+import org.apache.commons.fileupload.servlet.ServletFileUpload ;
+import org.apache.commons.fileupload.util.Streams ;
+import org.apache.jena.atlas.lib.Pair ;
+import org.apache.jena.atlas.web.ContentType ;
+import org.apache.jena.fuseki.FusekiLib ;
+import org.apache.jena.fuseki.HttpNames ;
+import org.apache.jena.iri.IRI ;
+import org.apache.jena.riot.Lang ;
+import org.apache.jena.riot.RDFLanguages ;
+import org.apache.jena.riot.lang.StreamRDFCounting ;
+import org.apache.jena.riot.system.* ;
+import org.apache.jena.web.HttpSC ;
+
+import com.hp.hpl.jena.graph.Graph ;
+import com.hp.hpl.jena.graph.Node ;
+import com.hp.hpl.jena.graph.NodeFactory ;
+import com.hp.hpl.jena.sparql.core.Quad ;
+import com.hp.hpl.jena.sparql.graph.GraphFactory ;
+
+public class SPARQL_Upload extends SPARQL_ServletBase 
+{
+    private static ErrorHandler errorHandler = ErrorHandlerFactory.errorHandlerStd(log) ;
+    
+    public SPARQL_Upload() {
+        super() ;
+    }
+
+    // Methods to respond to.
+    @Override
+    protected void doPost(HttpServletRequest request, HttpServletResponse response)
+    throws ServletException, IOException
+    {
+        doCommon(request, response) ;
+    }
+    
+    @Override
+    protected void doOptions(HttpServletRequest request, HttpServletResponse response)
+    {
+        setCommonHeadersForOptions(response) ;    
+        response.setHeader(HttpNames.hAllow, "OPTIONS,POST");
+        response.setHeader(HttpNames.hContentLengh, "0") ;
+    }
+    
+    @Override
+    protected void perform(HttpAction action)
+    {
+        // Only allows one file in the upload.
+        boolean isMultipart = ServletFileUpload.isMultipartContent(action.request);
+        if ( ! isMultipart )
+            error(HttpSC.BAD_REQUEST_400 , "Not a file upload") ;
+        long count = upload(action, "http://example/upload-base/") ;
+        try {
+            action.response.setContentType("text/html") ;
+            action.response.setStatus(HttpSC.OK_200);
+            PrintWriter out = action.response.getWriter() ;
+            out.println("<html>") ;
+            out.println("<head>") ;
+            out.println("</head>") ;
+            out.println("<body>") ;
+            out.println("<h1>Success</h1>");
+            out.println("<p>") ;
+            out.println("Triples = "+count + "\n");
+            out.println("<p>") ;
+            out.println("</p>") ;
+            out.println("<button onclick=\"timeFunction()\">Back to Fuseki</button>");
+            out.println("</p>") ;
+            out.println("<script type=\"text/javascript\">");
+            out.println("function timeFunction(){");
+            out.println("window.location.href = \"/fuseki.html\";}");
+            out.println("</script>");
+            out.println("</body>") ;
+            out.println("</html>") ;
+            out.flush() ;
+            success(action) ;
+        }
+        catch (Exception ex) { errorOccurred(ex) ; }
+    }
+    
+    // Also used by SPARQL_REST
+    static public long upload(HttpAction action, String base)
+    {
+        if ( action.isTransactional() )
+            return uploadTxn(action, base) ;
+        else
+            return uploadNonTxn(action, base) ;
+    }
+
+    /** Non-transaction - buffer to a temporary graph so that parse errors
+     * are caught before inserting any data. 
+     */
+     private static long uploadNonTxn(HttpAction action, String base) {
+         Pair<String, Graph> p = uploadWorker(action, base) ;
+         String graphName = p.getLeft() ;
+         Graph graphTmp = p.getRight() ;
+         long tripleCount = graphTmp.size() ;
+
+         log.info(format("[%d] Upload: Graph: %s (%d triple(s))", 
+                         action.id, graphName,  tripleCount)) ;
+
+         Node gn = graphName.equals(HttpNames.valueDefault)
+             ? Quad.defaultGraphNodeGenerated 
+             : NodeFactory.createURI(graphName) ;
+
+         action.beginWrite() ;
+         try {
+            FusekiLib.addDataInto(graphTmp, action.getActiveDSG(), gn) ;
+            action.commit() ;
+            return tripleCount ;
+        } catch (RuntimeException ex)
+        {
+            // If anything went wrong, try to backout.
+            try { action.abort() ; } catch (Exception ex2) {}
+            errorOccurred(ex.getMessage()) ;
+            return -1 ;
+        } 
+        finally { action.endWrite() ; }
+    }
+
+     /** Transactional - we'd like data to go straight to the destination, with an abort on parse error.
+      * But file upload with a name means that the name can be after the data
+      * (it is in the Fuseki default pages).
+      * Use Graph Store protocol for bulk uploads.
+      * (It would be possible to process the incoming stream and see the graph name first.)
+      */
+      private static long uploadTxn(HttpAction action, String base) {
+          // We can't do better than the non-transaction approach.
+          return uploadNonTxn(action, base) ;
+      }
+     
+    /**  process an HTTP upload of RDF.
+     *   We can't stream straight into a dataset because the graph name can be after the data. 
+     *  @return graph name and count
+     */
+    
+    static private Pair<String, Graph> uploadWorker(HttpAction action, String base)
+    {
+        Graph graphTmp = GraphFactory.createDefaultGraph() ;
+        ServletFileUpload upload = new ServletFileUpload();
+        String graphName = null ;
+        long count = -1 ;
+        
+        String name = null ;  
+        ContentType ct = null ;
+        Lang lang = null ;
+
+        try {
+            FileItemIterator iter = upload.getItemIterator(action.request);
+            while (iter.hasNext()) {
+                FileItemStream item = iter.next();
+                String fieldName = item.getFieldName();
+                InputStream stream = item.openStream();
+                if (item.isFormField())
+                {
+                    // Graph name.
+                    String value = Streams.asString(stream, "UTF-8") ;
+                    if ( fieldName.equals(HttpNames.paramGraph) )
+                    {
+                        graphName = value ;
+                        if ( graphName != null && ! graphName.equals("") && ! graphName.equals(HttpNames.valueDefault) )
+                        {
+                            IRI iri = IRIResolver.parseIRI(value) ;
+                            if ( iri.hasViolation(false) )
+                                errorBadRequest("Bad IRI: "+graphName) ;
+                            if ( iri.getScheme() == null )
+                                errorBadRequest("Bad IRI: no IRI scheme name: "+graphName) ;
+                            if ( iri.getScheme().equalsIgnoreCase("http") || iri.getScheme().equalsIgnoreCase("https")) 
+                            {
+                                // Redundant??
+                                if ( iri.getRawHost() == null ) 
+                                    errorBadRequest("Bad IRI: no host name: "+graphName) ;
+                                if ( iri.getRawPath() == null || iri.getRawPath().length() == 0 )
+                                    errorBadRequest("Bad IRI: no path: "+graphName) ;
+                                if ( iri.getRawPath().charAt(0) != '/' )
+                                    errorBadRequest("Bad IRI: Path does not start '/': "+graphName) ;
+                            } 
+                        }
+                    }
+                    else if ( fieldName.equals(HttpNames.paramDefaultGraphURI) )
+                        graphName = null ;
+                    else
+                        // Add file type?
+                        log.info(format("[%d] Upload: Field=%s ignored", action.id, fieldName)) ;
+                } else {
+                    // Process the input stream
+                    name = item.getName() ; 
+                    if ( name == null || name.equals("") || name.equals("UNSET FILE NAME") ) 
+                        errorBadRequest("No name for content - can't determine RDF syntax") ;
+
+                    String contentTypeHeader = item.getContentType() ;
+                    ct = ContentType.create(contentTypeHeader) ;
+
+                    lang = RDFLanguages.contentTypeToLang(ct.getContentType()) ;
+
+                    if ( lang == null ) {
+                        lang = RDFLanguages.filenameToLang(name) ;
+                        
+                        //JENA-600 filenameToLang() strips off certain extensions such as .gz and 
+                        //we need to ensure that if there was a .gz extension present we wrap the stream accordingly
+                        if (name.endsWith(".gz"))
+                            stream = new GZIPInputStream(stream);
+                    }
+                    if ( lang == null )
+                        // Desperate.
+                        lang = RDFLanguages.RDFXML ;
+
+                    log.info(format("[%d] Upload: Filename: %s, Content-Type=%s, Charset=%s => %s", 
+                                    action.id, name,  ct.getContentType(), ct.getCharset(), lang.getName())) ;
+                    
+                    StreamRDF x = StreamRDFLib.graph(graphTmp) ;
+                    StreamRDFCounting dest =  StreamRDFLib.count(x) ;
+                    SPARQL_REST.parse(action, dest, stream, lang, base);
+                    count = dest.count() ;
+                }
+            }    
+
+            if ( graphName == null || graphName.equals("") ) 
+                graphName = HttpNames.valueDefault ;
+            return Pair.create(graphName, graphTmp) ;
+        }
+        catch (ActionErrorException ex) { throw ex ; }
+        catch (Exception ex)            { errorOccurred(ex) ; return null ; }
+    }            
+
+    @Override
+    protected void validate(HttpAction action)
+    {}
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/ServletBase.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/ServletBase.java b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/ServletBase.java
new file mode 100644
index 0000000..7a74fa9
--- /dev/null
+++ b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/ServletBase.java
@@ -0,0 +1,242 @@
+/*
+ * 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.fuseki.servlets;
+
+import java.io.IOException ;
+import java.io.PrintWriter ;
+import java.util.concurrent.atomic.AtomicLong ;
+
+import javax.servlet.http.HttpServlet ;
+import javax.servlet.http.HttpServletRequest ;
+import javax.servlet.http.HttpServletResponse ;
+
+import org.apache.jena.atlas.lib.StrUtils ;
+import org.apache.jena.fuseki.Fuseki ;
+import org.apache.jena.fuseki.HttpNames ;
+import org.apache.jena.web.HttpSC ;
+import org.slf4j.Logger ;
+
+/**
+ * An abstract HTTP Servlet. Contains implementation methods for setting the request status in a HTTP Action,
+ * and a mechanism to allocate unique ID's to new requests.
+ */
+public abstract class ServletBase extends HttpServlet
+{
+    protected static final Logger log = Fuseki.requestLog ;
+    public final boolean verboseLogging = Fuseki.verboseLogging ;
+    private static AtomicLong requestIdAlloc = new AtomicLong(0) ;
+
+    protected ServletBase()     { }
+    
+    /**
+     * Helper method which gets a unique request ID and appends it as a header to the response
+     * @param request  HTTP Request
+     * @param response HTTP Response
+     * @return Request ID
+     */
+    protected long allocRequestId(HttpServletRequest request, HttpServletResponse response) {
+        long id = requestIdAlloc.incrementAndGet();
+        addRequestId(response, id);
+        return id;
+    }
+    
+    /**
+     * Helper method for attaching a request ID to a response as a header
+     * @param response Response
+     * @param id Request ID
+     */
+    protected void addRequestId(HttpServletResponse response, long id) {
+        response.addHeader("Fuseki-Request-ID", Long.toString(id));
+    }
+    
+    protected void responseSendError(HttpServletResponse response, int statusCode, String message)
+    {
+        try { response.sendError(statusCode, message) ; }
+        catch (IOException ex) { errorOccurred(ex) ; }
+        catch (IllegalStateException ex) { }
+    }
+    
+    protected void responseSendError(HttpServletResponse response, int statusCode)
+    {
+        try { response.sendError(statusCode) ; }
+        catch (IOException ex) { errorOccurred(ex) ; }
+    }
+
+    /**
+     * Returns the HTTP request URL, appended with any additional URL parameters used.
+     *
+     * @param request HTTP request
+     * @return complete request URL
+     */
+    protected static String wholeRequestURL(HttpServletRequest request)
+    {
+        StringBuffer sb = request.getRequestURL() ;
+        String queryString = request.getQueryString() ;
+        if ( queryString != null )
+        {
+            sb.append("?") ;
+            sb.append(queryString) ;
+        }
+        return sb.toString() ;
+    }
+    
+    protected static void successNoContent(HttpAction action)
+    {
+        success(action, HttpSC.NO_CONTENT_204);
+    }
+    
+    protected static void success(HttpAction action)
+    {
+        success(action, HttpSC.OK_200);
+    }
+
+    protected static void successCreated(HttpAction action)
+    {
+        success(action, HttpSC.CREATED_201);
+    }
+    
+    // When 404 is no big deal e.g. HEAD
+    protected static void successNotFound(HttpAction action) 
+    {
+        success(action, HttpSC.NOT_FOUND_404) ;
+    }
+
+    //
+    protected static void success(HttpAction action, int httpStatusCode)
+    {
+        action.response.setStatus(httpStatusCode);
+    }
+    
+    protected static void successPage(HttpAction action, String message)
+    {
+        try {
+            action.response.setContentType("text/html");
+            action.response.setStatus(HttpSC.OK_200);
+            PrintWriter out = action.response.getWriter() ;
+            out.println("<html>") ;
+            out.println("<head>") ;
+            out.println("</head>") ;
+            out.println("<body>") ;
+            out.println("<h1>Success</h1>");
+            if ( message != null )
+            {
+                out.println("<p>") ;
+                out.println(message) ;
+                out.println("</p>") ;
+            }
+            out.println("</body>") ;
+            out.println("</html>") ;
+            out.flush() ;
+        } catch (IOException ex) { errorOccurred(ex) ; }
+    }
+    
+    protected static void warning(String string)
+    {
+        log.warn(string) ;
+    }
+    
+    protected static void warning(String string, Throwable thorwable)
+    {
+        log.warn(string, thorwable) ;
+    }
+    
+    protected static void errorBadRequest(String string)
+    {
+        error(HttpSC.BAD_REQUEST_400, string) ;
+    }
+
+    protected static void errorNotFound(String string)
+    {
+        error(HttpSC.NOT_FOUND_404, string) ;
+    }
+
+    protected static void errorNotImplemented(String msg)
+    {
+        error(HttpSC.NOT_IMPLEMENTED_501, msg) ;
+    }
+    
+    protected static void errorMethodNotAllowed(String method)
+    {
+        error(HttpSC.METHOD_NOT_ALLOWED_405, "HTTP method not allowed: "+method) ;
+    }
+
+    protected static void errorForbidden(String msg)
+    {
+        if ( msg != null )
+            error(HttpSC.FORBIDDEN_403, msg) ;
+        else
+            error(HttpSC.FORBIDDEN_403, "Forbidden") ;
+    }
+    
+    protected static void error(int statusCode)
+    {
+        throw new ActionErrorException(null, null, statusCode) ;
+    }
+    
+
+    protected static void error(int statusCode, String string)
+    {
+        throw new ActionErrorException(null, string, statusCode) ;
+    }
+    
+    protected static void errorOccurred(String message)
+    {
+        errorOccurred(message, null) ;
+    }
+
+    protected static void errorOccurred(Throwable ex)
+    {
+        errorOccurred(null, ex) ;
+    }
+
+    protected static void errorOccurred(String message, Throwable ex)
+    {
+        throw new ActionErrorException(ex, message, HttpSC.INTERNAL_SERVER_ERROR_500) ;
+    }
+    
+    protected static String formatForLog(String string)
+    {
+        string = string.replace('\n', ' ') ;
+        string = string.replace('\r', ' ') ;
+        return string ; 
+    }
+
+    static String varyHeaderSetting = 
+        StrUtils.strjoin(",", 
+                         HttpNames.hAccept, 
+                         HttpNames.hAcceptEncoding, 
+                         HttpNames.hAcceptCharset ) ;
+    
+    public static void setVaryHeader(HttpServletResponse httpResponse)
+    {
+        httpResponse.setHeader(HttpNames.hVary, varyHeaderSetting) ;
+    }
+
+    public static void setCommonHeadersForOptions(HttpServletResponse httpResponse)
+    {
+        httpResponse.setHeader(HttpNames.hAccessControlAllowHeaders, "X-Requested-With, Content-Type, Authorization") ;
+        setCommonHeaders(httpResponse) ;
+    }
+    
+    public static void setCommonHeaders(HttpServletResponse httpResponse)
+    {
+        httpResponse.setHeader(HttpNames.hAccessControlAllowOrigin, "*") ;
+        httpResponse.setHeader(HttpNames.hServer, Fuseki.serverHttpName) ;
+    }
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/SimpleVelocity.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/SimpleVelocity.java b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/SimpleVelocity.java
new file mode 100644
index 0000000..7f5cad9
--- /dev/null
+++ b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/SimpleVelocity.java
@@ -0,0 +1,78 @@
+/**
+ * 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.fuseki.servlets;
+
+import java.io.IOException ;
+import java.io.Writer ;
+import java.util.Map ;
+
+import org.apache.velocity.Template ;
+import org.apache.velocity.VelocityContext ;
+import org.apache.velocity.app.VelocityEngine ;
+import org.apache.velocity.exception.MethodInvocationException ;
+import org.apache.velocity.exception.ParseErrorException ;
+import org.apache.velocity.exception.ResourceNotFoundException ;
+import org.apache.velocity.runtime.RuntimeConstants ;
+import org.apache.velocity.runtime.log.LogChute ;
+import org.apache.velocity.runtime.log.NullLogChute ;
+import org.slf4j.Logger ;
+import org.slf4j.LoggerFactory ;
+
+public class SimpleVelocity
+{
+    private static LogChute velocityLogChute = new NullLogChute() ;
+    private static Logger velocityLog = LoggerFactory.getLogger("Velocity");
+
+    /** Process a template */
+    public static void process(String base, String path, Writer out, Map<String, Object> params)
+    {
+        process(base, path, out, createContext(params)) ;
+    }
+    
+    /** Process a template */
+    public static void process(String base, String path, Writer out, VelocityContext context)
+    {
+        VelocityEngine velocity = new VelocityEngine() ;
+        // Turn off logging - catch exceptions and log ourselves
+        velocity.setProperty(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM, velocityLogChute) ;
+        velocity.setProperty(RuntimeConstants.INPUT_ENCODING, "UTF-8") ;
+        velocity.setProperty(RuntimeConstants.FILE_RESOURCE_LOADER_PATH, base) ;
+        velocity.init() ;
+        try {
+            Template temp = velocity.getTemplate(path) ;
+            temp.merge(context, out) ;
+            out.flush();
+        } 
+        catch (ResourceNotFoundException ex) { velocityLog.error("Resource not found: "+ex.getMessage()) ; }
+        catch (ParseErrorException ex)       { velocityLog.error("Parse error ("+path+") : "+ex.getMessage()) ; }
+        catch (MethodInvocationException ex) { velocityLog.error("Method invocation exception ("+path+") : "+ex.getMessage()) ; }
+        catch (IOException ex)               { velocityLog.warn("IOException", ex) ; }
+    }
+    
+    public static VelocityContext createContext(Map<String, Object> params)
+    {
+        // Velocity requires a mutable map.
+        // Scala leads to immutable maps ... be safe and copy.
+        VelocityContext context = new VelocityContext() ;
+        for ( Map.Entry<String, Object> e : params.entrySet() )
+            context.put(e.getKey(), e.getValue()) ;
+        return context ;
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/SimpleVelocityServlet.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/SimpleVelocityServlet.java b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/SimpleVelocityServlet.java
new file mode 100644
index 0000000..8773eba
--- /dev/null
+++ b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/SimpleVelocityServlet.java
@@ -0,0 +1,178 @@
+/**
+ * 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.fuseki.servlets;
+
+import java.io.IOException ;
+import java.io.Writer ;
+import java.util.Map ;
+
+import javax.servlet.http.HttpServlet ;
+import javax.servlet.http.HttpServletRequest ;
+import javax.servlet.http.HttpServletResponse ;
+
+import org.apache.velocity.VelocityContext ;
+import org.apache.velocity.app.VelocityEngine ;
+import org.apache.velocity.runtime.RuntimeConstants ;
+import org.apache.velocity.runtime.RuntimeServices ;
+import org.apache.velocity.runtime.log.LogChute ;
+import org.apache.velocity.runtime.log.NullLogChute ;
+import org.slf4j.Logger ;
+import org.slf4j.LoggerFactory ;
+
+
+/** Simple servlet that uses <a href="http://velocity.apache.org/">Velocity</a>
+ *  to format pages.  It isolates the use of velocity by taking a configuration map. 
+ *  Use with a servlet mapping of "*.vm" or some such extension.
+ */
+public class SimpleVelocityServlet extends HttpServlet
+{
+    //private static Logger log = LoggerFactory.getLogger(SimpleVelocityServlet.class) ;
+    /* Velocity logging
+     * Instead of internal velocity logging, we catch the exceptions, 
+     * log the message ourselves. This gives a celaner log file without
+     * loosing information that the application could use.  
+     */
+    
+    private static Logger vlog = LoggerFactory.getLogger("Velocity") ;
+    private static LogChute velocityLog = new NullLogChute() ;
+    //private static LogChute velocityLog = new SimpleSLF4JLogChute(vlog) ;
+    
+    private String docbase ;
+    private VelocityEngine velocity ;
+    private String functionsName = null ;
+    private final Map<String, Object> datamodel ;
+    
+    public SimpleVelocityServlet(String base, Map<String, Object> datamodel)
+    {
+        this.docbase = base ;
+        this.datamodel = datamodel ;
+        velocity = new VelocityEngine();
+        // Turn off logging - catch exceptions and log ourselves
+        velocity.setProperty( RuntimeConstants.RUNTIME_LOG_LOGSYSTEM, velocityLog) ;
+        velocity.setProperty( RuntimeConstants.INPUT_ENCODING, "UTF-8" ) ;
+        velocity.setProperty( RuntimeConstants.FILE_RESOURCE_LOADER_PATH, base) ;
+        velocity.init();
+    }
+    
+    // See also 
+    @Override
+    public void doGet(HttpServletRequest req, HttpServletResponse resp)
+    {
+        process(req, resp) ;
+    }
+    
+    @Override
+    public void doPost(HttpServletRequest req, HttpServletResponse resp)
+    {
+        process(req, resp) ;
+    }
+
+    private void process(HttpServletRequest req, HttpServletResponse resp)
+    {
+        try
+        {
+            resp.setContentType("text/html") ;
+            resp.setCharacterEncoding("UTF-8") ;
+            Writer out = resp.getWriter() ;
+            String path = path(req) ;
+            VelocityContext vc = SimpleVelocity.createContext(datamodel) ;
+            vc.put("request", req) ;
+            SimpleVelocity.process(docbase, path, out, vc) ;
+        } catch (IOException ex)
+        {
+            vlog.warn("IOException", ex) ;
+        }
+    }
+    
+    private String path(HttpServletRequest request)
+    {     
+        String path = request.getPathInfo();
+        if (path != null) return path;
+        path = request.getServletPath();
+        if (path != null) return path;
+        return null ;
+    }
+
+    @Override
+    public String getServletInfo()
+    {
+        return "Lightweight Velocity Servlet";
+    }
+    
+    /** Velocity logger to SLF4J */ 
+    static class SimpleSLF4JLogChute implements LogChute
+    {
+        // Uusally for debugging only.
+        private Logger logger ;
+
+        SimpleSLF4JLogChute( Logger log )
+        {
+            this.logger = log ; 
+        }
+        
+        @Override
+        public void init(RuntimeServices rs) throws Exception
+        { }
+
+        @Override
+        public void log(int level, String message)
+        {
+            if ( logger == null ) return ;
+            switch(level)
+            {
+                case LogChute.TRACE_ID : logger.trace(message) ; return ;
+                case LogChute.DEBUG_ID : logger.debug(message) ; return ;
+                case LogChute.INFO_ID :  logger.info(message) ;  return ;
+                case LogChute.WARN_ID :  logger.warn(message) ;  return ;
+                case LogChute.ERROR_ID : logger.error(message) ; return ;
+            }
+        }
+
+        @Override
+        public void log(int level, String message, Throwable t)
+        {
+            if ( logger == null ) return ;
+            // Forget the stack trace - velcoity internal - long - unhelpful to application. 
+            t = null ;
+            switch (level)
+            {
+                case LogChute.TRACE_ID : logger.trace(message, t) ; return ;
+                case LogChute.DEBUG_ID : logger.debug(message, t) ; return ;
+                case LogChute.INFO_ID :  logger.info(message, t) ;  return ;
+                case LogChute.WARN_ID :  logger.warn(message, t) ;  return ;
+                case LogChute.ERROR_ID : logger.error(message, t) ; return ;
+            }
+        }
+
+        @Override
+        public boolean isLevelEnabled(int level)
+        {
+            switch(level)
+            {
+                case LogChute.TRACE_ID:   return logger.isTraceEnabled() ;
+                case LogChute.DEBUG_ID:   return logger.isDebugEnabled() ;
+                case LogChute.INFO_ID:    return logger.isInfoEnabled() ;
+                case LogChute.WARN_ID:    return logger.isWarnEnabled() ;
+                case LogChute.ERROR_ID:   return logger.isErrorEnabled() ;
+            }
+            return true ;
+        }
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/main/java/org/apache/jena/fuseki/validation/DataValidator.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/java/org/apache/jena/fuseki/validation/DataValidator.java b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/validation/DataValidator.java
new file mode 100644
index 0000000..6105562
--- /dev/null
+++ b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/validation/DataValidator.java
@@ -0,0 +1,237 @@
+/*
+ * 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.fuseki.validation;
+
+import static org.apache.jena.riot.SysRIOT.fmtMessage ;
+
+import java.io.IOException ;
+import java.io.PrintStream ;
+import java.io.Reader ;
+import java.io.StringReader ;
+
+import javax.servlet.ServletOutputStream ;
+import javax.servlet.http.HttpServletRequest ;
+import javax.servlet.http.HttpServletResponse ;
+
+import org.apache.jena.atlas.io.IO ;
+import org.apache.jena.atlas.lib.Sink ;
+import org.apache.jena.fuseki.FusekiLib ;
+import org.apache.jena.riot.Lang ;
+import org.apache.jena.riot.RDFLanguages ;
+import org.apache.jena.riot.RiotException ;
+import org.apache.jena.riot.RiotReader ;
+import org.apache.jena.riot.lang.LangRIOT ;
+import org.apache.jena.riot.system.ErrorHandler ;
+import org.apache.jena.riot.system.RiotLib ;
+import org.apache.jena.riot.system.StreamRDF ;
+import org.apache.jena.riot.system.StreamRDFLib ;
+import org.apache.jena.riot.tokens.Tokenizer ;
+import org.apache.jena.riot.tokens.TokenizerFactory ;
+
+import com.hp.hpl.jena.graph.Node ;
+import com.hp.hpl.jena.sparql.core.Quad ;
+import com.hp.hpl.jena.sparql.serializer.SerializationContext ;
+import com.hp.hpl.jena.sparql.util.FmtUtils ;
+
+public class DataValidator extends ValidatorBase
+{
+    public DataValidator() 
+    { }
+  
+    static final String paramLineNumbers      = "linenumbers" ;
+    static final String paramFormat           = "outputFormat" ;
+    static final String paramIndirection      = "url" ;
+    static final String paramData             = "data" ;
+    static final String paramSyntax           = "languageSyntax" ;
+    //static final String paramSyntaxExtended   = "extendedSyntax" ;
+    
+    @Override
+    protected void execute(HttpServletRequest httpRequest, HttpServletResponse httpResponse)
+    {
+        try {
+//            if ( log.isInfoEnabled() )
+//                log.info("data validation request") ;
+            
+            Tokenizer tokenizer = createTokenizer(httpRequest, httpResponse) ;
+            if ( tokenizer == null )
+                return ;
+            
+            String syntax = FusekiLib.safeParameter(httpRequest, paramSyntax) ;
+            if ( syntax == null || syntax.equals("") )
+                syntax = RDFLanguages.NQUADS.getName() ;
+
+            Lang language = RDFLanguages.shortnameToLang(syntax) ;
+            if ( language == null )
+            {
+                httpResponse.sendError(HttpServletResponse.SC_BAD_REQUEST, "Unknown syntax: "+syntax) ;
+                return ;
+            }
+
+            ServletOutputStream outStream = httpResponse.getOutputStream() ;
+            ErrorHandlerMsg errorHandler = new ErrorHandlerMsg(outStream) ;
+            
+            PrintStream stdout = System.out ;
+            PrintStream stderr = System.err ;
+            System.setOut(new PrintStream(outStream)) ;
+            System.setErr(new PrintStream(outStream)) ;
+
+            // Headers
+            setHeaders(httpResponse) ;
+
+            outStream.println("<html>") ;
+            printHead(outStream, "Jena Data Validator Report") ;
+            outStream.println("<body>") ;
+            
+            outStream.println("<h1>RIOT Parser Report</h1>") ;
+            outStream.println("<p>Line and column numbers refer to original input</p>") ;
+            outStream.println("<p>&nbsp;</p>") ;
+            try {
+                LangRIOT parser = setupParser(tokenizer, language, errorHandler, outStream) ;
+                startFixed(outStream) ;
+                RiotException exception = null ;
+                try {
+                    parser.parse() ;
+                    System.out.flush() ;
+                    System.err.flush() ;
+                } catch (RiotException ex) { exception = ex ; }
+            } finally 
+            {
+                finishFixed(outStream) ;
+                System.out.flush() ;
+                System.err.flush() ;
+                System.setOut(stdout) ;
+                System.setErr(stdout) ;
+            }
+            
+            outStream.println("</body>") ;
+            outStream.println("</html>") ;
+        } catch (Exception ex)
+        {
+            serviceLog.warn("Exception in validationRequest",ex) ;
+        }
+    }
+    
+    static final long LIMIT = 50000 ;
+    
+    
+    private LangRIOT setupParser(Tokenizer tokenizer, Lang language, ErrorHandler errorHandler, final ServletOutputStream outStream)
+    {
+        Sink<Quad> sink = new Sink<Quad>()
+        {
+            SerializationContext sCxt = new SerializationContext() ;
+            @Override
+            public void send(Quad quad)
+            {
+                // Clean up!
+                StringBuilder sb = new StringBuilder() ;
+
+                sb.append(formatNode(quad.getSubject())) ;
+                sb.append("  ") ;
+                sb.append(formatNode(quad.getPredicate())) ;
+                sb.append("  ") ;
+                sb.append(formatNode(quad.getObject())) ;
+                
+                if ( ! quad.isTriple() )
+                {
+                    sb.append("  ") ;
+                    sb.append(formatNode(quad.getGraph())) ;
+                }
+
+                String $ = htmlQuote(sb.toString()) ;
+                try { 
+                    outStream.print($) ;
+                    outStream.println(" .") ;
+                } catch (IOException ex) { IO.exception(ex) ; }
+            }
+            @Override
+            public void close() {}
+            @Override
+            public void flush() {}
+            String formatNode(Node n) { return FmtUtils.stringForNode(n, sCxt) ; }
+        } ;
+
+        StreamRDF dest = StreamRDFLib.sinkQuads(sink) ;
+        @SuppressWarnings("deprecation")
+        LangRIOT parser = RiotReader.createParser(tokenizer, language, null, dest) ;
+        // Don't resolve IRIs.  Do checking.
+        parser.setProfile(RiotLib.profile(null, false, true, errorHandler)) ;
+        return parser ;
+    }
+
+    // Error handler that records messages
+    private static class ErrorHandlerMsg implements ErrorHandler
+    {
+        private ServletOutputStream out ;
+
+        ErrorHandlerMsg(ServletOutputStream out) { this.out = out ; }
+        
+        @Override
+        public void warning(String message, long line, long col)
+        { output(message, line, col, "Warning", "warning") ; }
+    
+        // Attempt to continue.
+        @Override
+        public void error(String message, long line, long col)
+        { output(message, line, col, "Error", "error") ; }
+    
+        @Override
+        public void fatal(String message, long line, long col)
+        { output(message, line, col, "Fatal", "error") ; throw new RiotException(fmtMessage(message, line, col)) ; }
+        
+        private void output(String message, long line, long col, String typeName, String className)
+        {
+            try {
+                String str = fmtMessage(message, line, col) ;
+                //String str = typeName+": "+message ;
+                str = htmlQuote(str) ;
+                out.print("<div class=\""+className+"\">") ;
+                out.print(str) ;
+                out.print("</div>") ;
+            } catch (IOException ex) { IO.exception(ex) ; }
+        }
+    }
+    
+    private Tokenizer createTokenizer(HttpServletRequest httpRequest, HttpServletResponse httpResponse) throws Exception
+    {
+        Reader reader = null ;  
+        String[] args = httpRequest.getParameterValues(paramData) ;
+        if ( args == null || args.length == 0 )
+        {
+            // Not a form?
+            reader = httpRequest.getReader() ;
+        }
+        else if ( args.length > 1 )
+        {
+            httpResponse.sendError(HttpServletResponse.SC_BAD_REQUEST, "Too many parameters for '"+paramData+"='") ;
+            return null ;
+        }
+        else
+        {
+            reader = new StringReader(args[0]) ;
+        }
+        
+        if ( reader == null )
+        {
+            httpResponse.sendError(HttpServletResponse.SC_BAD_REQUEST, "Can't find data to validate") ;
+            return null ;
+        }
+        
+        return TokenizerFactory.makeTokenizer(reader) ;
+    }
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/main/java/org/apache/jena/fuseki/validation/IRIValidator.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/java/org/apache/jena/fuseki/validation/IRIValidator.java b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/validation/IRIValidator.java
new file mode 100644
index 0000000..2972b49
--- /dev/null
+++ b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/validation/IRIValidator.java
@@ -0,0 +1,99 @@
+/*
+ * 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.fuseki.validation;
+
+import java.io.IOException ;
+import java.io.PrintStream ;
+import java.util.Iterator ;
+
+import javax.servlet.ServletOutputStream ;
+import javax.servlet.http.HttpServletRequest ;
+import javax.servlet.http.HttpServletResponse ;
+
+import org.apache.jena.iri.IRI ;
+import org.apache.jena.iri.IRIFactory ;
+import org.apache.jena.iri.Violation ;
+import org.apache.jena.riot.system.IRIResolver ;
+
+public class IRIValidator extends ValidatorBase
+{
+    public IRIValidator() 
+    { }
+  
+    static final String paramIRI      = "iri" ;
+    //static IRIFactory iriFactory = IRIFactory.iriImplementation() ;
+    static IRIFactory iriFactory = IRIResolver.iriFactory ;
+    
+    @Override
+    protected void execute(HttpServletRequest httpRequest, HttpServletResponse httpResponse)
+    {
+        try {
+            String[] args = httpRequest.getParameterValues(paramIRI) ;
+            ServletOutputStream outStream = httpResponse.getOutputStream() ;
+            PrintStream stdout = System.out ;
+            PrintStream stderr = System.err ;
+            System.setOut(new PrintStream(outStream)) ;
+            System.setErr(new PrintStream(outStream)) ;
+
+            setHeaders(httpResponse) ;
+
+            outStream.println("<html>") ;
+            printHead(outStream, "Jena IRI Validator Report") ;
+            outStream.println("<body>") ;
+
+            outStream.println("<h1>IRI Report</h1>") ;
+
+            startFixed(outStream) ;
+
+            try {
+                boolean first = true ;
+                for ( String iriStr : args )
+                {
+                    if ( ! first )
+                        System.out.println() ;
+                    first = false ;
+
+                    IRI iri = iriFactory.create(iriStr) ;
+                    System.out.println(iriStr + " ==> "+iri) ;
+                    if ( iri.isRelative() )
+                        System.out.println("Relative IRI: "+iriStr) ;
+
+                    Iterator<Violation> vIter = iri.violations(true) ;
+                    for ( ; vIter.hasNext() ; )
+                    {
+                        String str = vIter.next().getShortMessage() ;
+                        str = htmlQuote(str) ;
+                        
+                        System.out.println(str) ;
+                    }
+                }
+            } finally 
+            {
+                finishFixed(outStream) ;
+                System.out.flush() ;
+                System.err.flush() ;
+                System.setOut(stdout) ;
+                System.setErr(stdout) ;
+            }
+
+            outStream.println("</body>") ;
+            outStream.println("</html>") ;
+        } catch (IOException ex) {}
+    } 
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/main/java/org/apache/jena/fuseki/validation/QueryValidator.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/java/org/apache/jena/fuseki/validation/QueryValidator.java b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/validation/QueryValidator.java
new file mode 100644
index 0000000..75ad901
--- /dev/null
+++ b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/validation/QueryValidator.java
@@ -0,0 +1,269 @@
+/*
+ * 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.fuseki.validation;
+
+import java.io.IOException ;
+
+import javax.servlet.ServletOutputStream ;
+import javax.servlet.http.HttpServletRequest ;
+import javax.servlet.http.HttpServletResponse ;
+
+import org.apache.jena.atlas.io.IndentedLineBuffer ;
+import org.apache.jena.atlas.io.IndentedWriter ;
+
+import com.hp.hpl.jena.query.Query ;
+import com.hp.hpl.jena.query.QueryFactory ;
+import com.hp.hpl.jena.query.Syntax ;
+import com.hp.hpl.jena.sparql.ARQException ;
+import com.hp.hpl.jena.sparql.algebra.Algebra ;
+import com.hp.hpl.jena.sparql.algebra.Op ;
+import com.hp.hpl.jena.sparql.serializer.SerializationContext ;
+
+public class QueryValidator extends ValidatorBase 
+{
+    public QueryValidator() 
+    { }
+
+    static final String paramLineNumbers      = "linenumbers" ;
+    static final String paramFormat           = "outputFormat" ;
+    static final String paramQuery            = "query" ;
+    static final String paramSyntax           = "languageSyntax" ;
+    //static final String paramSyntaxExtended   = "extendedSyntax" ;
+    
+    @Override
+    protected void execute(HttpServletRequest httpRequest, HttpServletResponse httpResponse)
+    {
+        try {
+//            if ( log.isInfoEnabled() )
+//                log.info("validation request") ;
+            
+            String[] args = httpRequest.getParameterValues(paramQuery) ;
+            
+            if ( args == null || args.length == 0 )
+            {
+                httpResponse.sendError(HttpServletResponse.SC_BAD_REQUEST, "No query parameter to validator") ;
+                return ;
+            }
+            
+            if ( args.length > 1 )
+            {
+                httpResponse.sendError(HttpServletResponse.SC_BAD_REQUEST, "Too many query parameters") ;
+                return ;
+            }
+
+            final String queryString = httpRequest.getParameter(paramQuery).replaceAll("(\r|\n| )*$", "") ;
+//            queryString = queryString.replace("\r\n", "\n") ;
+//            queryString.replaceAll("(\r|\n| )*$", "") ;
+            
+            String querySyntax = httpRequest.getParameter(paramSyntax) ;
+            if ( querySyntax == null || querySyntax.equals("") )
+                querySyntax = "SPARQL" ;
+
+            Syntax language = Syntax.lookup(querySyntax) ;
+            if ( language == null )
+            {
+                httpResponse.sendError(HttpServletResponse.SC_BAD_REQUEST, "Unknown syntax: "+querySyntax) ;
+                return ;
+            }
+            
+            String lineNumbersArg = httpRequest.getParameter(paramLineNumbers) ; 
+
+            String a[] = httpRequest.getParameterValues(paramFormat) ;
+            
+            boolean outputSPARQL = false ;
+            boolean outputPrefix = false ;
+            boolean outputAlgebra = false ;
+            boolean outputQuads = false ;
+            boolean outputOptimized = false ;
+            boolean outputOptimizedQuads = false ;
+            
+            if ( a != null )
+            {
+                for ( String anA : a )
+                {
+                    if ( anA.equals( "sparql" ) )
+                    {
+                        outputSPARQL = true;
+                    }
+                    if ( anA.equals( "prefix" ) )
+                    {
+                        outputPrefix = true;
+                    }
+                    if ( anA.equals( "algebra" ) )
+                    {
+                        outputAlgebra = true;
+                    }
+                    if ( anA.equals( "quads" ) )
+                    {
+                        outputQuads = true;
+                    }
+                    if ( anA.equals( "opt" ) )
+                    {
+                        outputOptimized = true;
+                    }
+                    if ( anA.equals( "optquads" ) )
+                    {
+                        outputOptimizedQuads = true;
+                    }
+                }
+            }
+            
+//            if ( ! outputSPARQL && ! outputPrefix )
+//                outputSPARQL = true ;
+            
+            boolean lineNumbers = true ;
+            
+            if ( lineNumbersArg != null )
+                lineNumbers = lineNumbersArg.equalsIgnoreCase("true") || lineNumbersArg.equalsIgnoreCase("yes") ;
+            
+            // Headers
+            setHeaders(httpResponse) ;
+            
+            ServletOutputStream outStream = httpResponse.getOutputStream() ;
+
+            outStream.println("<html>") ;
+            
+            printHead(outStream, "SPARQL Query Validation Report") ;
+            
+            outStream.println("<body>") ;
+            outStream.println("<h1>SPARQL Query Validator</h1>") ;
+            // Print query as received
+            {
+                outStream.println("<p>Input:</p>") ;
+                // Not Java's finest hour.
+                Content c = new Content(){
+                    @Override
+                    public void print(IndentedWriter out)
+                    { out.print(queryString) ; }
+                } ;
+                output(outStream, c, lineNumbers) ;
+            }
+            
+            // Attempt to parse it.
+            Query query = null ;
+            try {
+                query = QueryFactory.create(queryString, "http://example/base/", language) ;
+            } catch (ARQException ex)
+            {
+                // Over generous exception (should be QueryException)
+                // but this makes the code robust.
+                outStream.println("<p>Syntax error:</p>") ;
+                startFixed(outStream) ;
+                outStream.println(ex.getMessage()) ;
+                finishFixed(outStream) ;
+            }
+            catch (RuntimeException ex)
+            { 
+                outStream.println("<p>Internal error:</p>") ;
+                startFixed(outStream) ;
+                outStream.println(ex.getMessage()) ;
+                finishFixed(outStream) ;
+            }
+            
+            if ( query != null )
+            {
+                if ( outputSPARQL )
+                    outputSyntax(outStream, query, lineNumbers) ;
+                
+                if ( outputAlgebra )
+                    outputAlgebra(outStream, query, lineNumbers) ;
+                
+                if ( outputQuads )
+                    outputAlgebraQuads(outStream, query, lineNumbers) ;
+                
+                if ( outputOptimized )
+                    outputAlgebraOpt(outStream, query, lineNumbers) ;
+
+                if ( outputOptimizedQuads )
+                    outputAlgebraOptQuads(outStream, query, lineNumbers) ;
+            }
+            
+            outStream.println("</body>") ;
+            outStream.println("</html>") ;
+            
+        } catch (Exception ex)
+        {
+            serviceLog.warn("Exception in doGet",ex) ;
+        }
+    }
+    
+    interface Content { void print(IndentedWriter out) ; }
+    
+    private void outputSyntax(ServletOutputStream outStream, final Query query, boolean lineNumbers) throws IOException
+    {
+        outStream.println("<p>Formatted, parsed query:</p>") ;
+        Content c = new Content(){
+            @Override
+            public void print(IndentedWriter out)
+            { query.serialize(out) ; }
+        } ;
+        output(outStream, c, lineNumbers) ;
+    }
+    
+    private void outputAlgebra(ServletOutputStream outStream, final Query query, boolean lineNumbers) throws IOException
+    {
+        outStream.println("<p>Algebra structure:</p>") ;
+        final Op op = Algebra.compile(query) ;   // No optimization
+        output(outStream, query, op, lineNumbers) ;
+    }
+        
+    private void outputAlgebraOpt(ServletOutputStream outStream, final Query query, boolean lineNumbers) throws IOException
+    {
+        outStream.println("<p>Alebgra, with general triple optimizations:</p>") ;
+        final Op op = Algebra.optimize(Algebra.compile(query)) ;
+        output(outStream, query, op, lineNumbers) ;
+    }
+        
+    private void outputAlgebraQuads(ServletOutputStream outStream, final Query query, boolean lineNumbers) throws IOException
+    {
+        outStream.println("<p>Quad structure:</p>") ;
+        final Op op = Algebra.toQuadForm(Algebra.compile(query)) ;
+        output(outStream, query, op, lineNumbers) ;
+    }
+
+    private void outputAlgebraOptQuads(ServletOutputStream outStream, final Query query, boolean lineNumbers) throws IOException
+    {
+        outStream.println("<p>Alebgra, with general quads optimizations:</p>") ;
+        final Op op = Algebra.optimize(Algebra.toQuadForm(Algebra.compile(query))) ;
+        output(outStream, query, op, lineNumbers) ;
+    }
+    
+    private void output(ServletOutputStream outStream, Query query, final Op op, boolean lineNumbers) throws IOException
+    {
+        final SerializationContext sCxt = new SerializationContext(query) ;
+        Content c = new Content(){
+            @Override
+            public void print(IndentedWriter out)
+            {  op.output(out, sCxt) ; }
+        } ;
+        output(outStream, c , lineNumbers) ;
+    }
+
+    private void output(ServletOutputStream outStream, Content content, boolean lineNumbers) throws IOException
+    {
+        startFixed(outStream) ;
+        IndentedLineBuffer out = new IndentedLineBuffer(lineNumbers) ; 
+        content.print(out) ;
+        out.flush() ;  
+        String x = htmlQuote(out.asString()) ;
+        byte b[] = x.getBytes("UTF-8") ;
+        outStream.write(b) ;
+        finishFixed(outStream) ;
+    }
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/main/java/org/apache/jena/fuseki/validation/UpdateValidator.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/java/org/apache/jena/fuseki/validation/UpdateValidator.java b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/validation/UpdateValidator.java
new file mode 100644
index 0000000..dd63de8
--- /dev/null
+++ b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/validation/UpdateValidator.java
@@ -0,0 +1,174 @@
+/*
+ * 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.fuseki.validation;
+
+import java.io.IOException ;
+
+import javax.servlet.ServletOutputStream ;
+import javax.servlet.http.HttpServletRequest ;
+import javax.servlet.http.HttpServletResponse ;
+
+import org.apache.jena.atlas.io.IndentedLineBuffer ;
+import org.apache.jena.atlas.io.IndentedWriter ;
+
+import com.hp.hpl.jena.query.Syntax ;
+import com.hp.hpl.jena.sparql.ARQException ;
+import com.hp.hpl.jena.update.UpdateFactory ;
+import com.hp.hpl.jena.update.UpdateRequest ;
+
+public class UpdateValidator extends ValidatorBase
+{
+    public UpdateValidator() 
+    { }
+    
+    static final String paramLineNumbers      = "linenumbers" ;
+    static final String paramFormat           = "outputFormat" ;
+    static final String paramUpdate            = "update" ;
+    static final String paramSyntax           = "languageSyntax" ;
+    //static final String paramSyntaxExtended   = "extendedSyntax" ;
+    
+    @Override
+    protected void execute(HttpServletRequest httpRequest, HttpServletResponse httpResponse)
+    {
+        try {
+//            if ( log.isInfoEnabled() )
+//                log.info("validation request") ;
+            
+            String[] args = httpRequest.getParameterValues(paramUpdate) ;
+            
+            if ( args == null || args.length == 0 )
+            {
+                httpResponse.sendError(HttpServletResponse.SC_BAD_REQUEST, "No update parameter to validator") ;
+                return ;
+            }
+            
+            if ( args.length > 1 )
+            {
+                httpResponse.sendError(HttpServletResponse.SC_BAD_REQUEST, "Too many update parameters") ;
+                return ;
+            }
+
+            final String updateString = httpRequest.getParameter(paramUpdate).replaceAll("(\r|\n| )*$", "") ;
+            
+            String updateSyntax = httpRequest.getParameter(paramSyntax) ;
+            if ( updateSyntax == null || updateSyntax.equals("") )
+                updateSyntax = "SPARQL" ;
+
+            Syntax language = Syntax.lookup(updateSyntax) ;
+            if ( language == null )
+            {
+                httpResponse.sendError(HttpServletResponse.SC_BAD_REQUEST, "Unknown syntax: "+updateSyntax) ;
+                return ;
+            }
+            
+            String lineNumbersArg = httpRequest.getParameter(paramLineNumbers) ; 
+            String a[] = httpRequest.getParameterValues(paramFormat) ;
+            
+            // Currently default.
+            boolean outputSPARQL = true ;
+            boolean lineNumbers = true ;
+            
+            if ( lineNumbersArg != null )
+                lineNumbers = lineNumbersArg.equalsIgnoreCase("true") || lineNumbersArg.equalsIgnoreCase("yes") ;
+            
+            // Headers
+            setHeaders(httpResponse) ;
+
+            ServletOutputStream outStream = httpResponse.getOutputStream() ;
+
+            outStream.println("<html>") ;
+            
+            printHead(outStream, "SPARQL Update Validation Report") ;
+            
+            outStream.println("<body>") ;
+            outStream.println("<h1>SPARQL Update Validator</h1>") ;
+            
+            // Print as received
+            {
+                outStream.println("<p>Input:</p>") ;
+                // Not Java's finest hour.
+                Content c = new Content(){
+                    @Override
+                    public void print(IndentedWriter out)
+                    { out.print(updateString) ; }
+                } ;
+                output(outStream, c, lineNumbers) ;
+            }
+            
+            // Attempt to parse it.
+            UpdateRequest request= null ;
+            try {
+                request = UpdateFactory.create(updateString, "http://example/base/", language) ;
+            } catch (ARQException ex)
+            {
+                // Over generous exception (should be QueryException)
+                // but this makes the code robust.
+                outStream.println("<p>Syntax error:</p>") ;
+                startFixed(outStream) ;
+                outStream.println(ex.getMessage()) ;
+                finishFixed(outStream) ;
+            }
+            catch (RuntimeException ex)
+            { 
+                outStream.println("<p>Internal error:</p>") ;
+                startFixed(outStream) ;
+                outStream.println(ex.getMessage()) ;
+                finishFixed(outStream) ;
+            }
+            
+            // Because we pass into anon inner classes
+            final UpdateRequest updateRequest = request ;
+            
+            // OK?  Pretty print
+            if ( updateRequest != null && outputSPARQL )
+            {
+                outStream.println("<p>Formatted, parsed update request:</p>") ;
+                Content c = new Content(){
+                    @Override
+                    public void print(IndentedWriter out)
+                    {
+                        updateRequest.output(out) ;
+                    }
+                        
+                } ;
+                output(outStream, c, lineNumbers) ;
+            }
+            outStream.println("</body>") ;
+            outStream.println("</html>") ;
+            
+        } catch (Exception ex)
+        {
+            serviceLog.warn("Exception in doGet",ex) ;
+        }
+    }
+
+    interface Content { void print(IndentedWriter out) ; }
+    
+    private void output(ServletOutputStream outStream, Content content, boolean lineNumbers) throws IOException
+    {
+        startFixed(outStream) ;
+        IndentedLineBuffer out = new IndentedLineBuffer(lineNumbers) ; 
+        content.print(out) ;
+        out.flush() ;  
+        String x = htmlQuote(out.asString()) ;
+        byte b[] = x.getBytes("UTF-8") ;
+        outStream.write(b) ;
+        finishFixed(outStream) ;
+    }
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/main/java/org/apache/jena/fuseki/validation/ValidatorBase.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/java/org/apache/jena/fuseki/validation/ValidatorBase.java b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/validation/ValidatorBase.java
new file mode 100644
index 0000000..61820f4
--- /dev/null
+++ b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/validation/ValidatorBase.java
@@ -0,0 +1,120 @@
+/*
+ * 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.fuseki.validation;
+
+import java.io.IOException ;
+
+import javax.servlet.ServletConfig ;
+import javax.servlet.ServletException ;
+import javax.servlet.ServletOutputStream ;
+import javax.servlet.http.HttpServlet ;
+import javax.servlet.http.HttpServletRequest ;
+import javax.servlet.http.HttpServletResponse ;
+
+import org.apache.jena.fuseki.Fuseki ;
+import org.apache.jena.fuseki.servlets.ServletBase ;
+import org.slf4j.Logger ;
+
+public abstract class ValidatorBase extends HttpServlet 
+{
+    protected static Logger serviceLog = Fuseki.requestLog ;
+
+    public static final String cssFile          = "/fuseki.css" ;
+    public static final String respService      = "X-Service" ;
+
+    
+    @Override
+    public void init() throws ServletException
+    { super.init() ; }
+
+    @Override
+    public void init(ServletConfig config) throws ServletException
+    { super.init(config) ; }
+    
+    @Override
+    public void destroy()
+    { }
+    
+    @Override
+    public void doGet(HttpServletRequest httpRequest, HttpServletResponse httpResponse)
+    { execute(httpRequest, httpResponse) ; }
+
+    @Override
+    public void doPost(HttpServletRequest httpRequest, HttpServletResponse httpResponse)
+    { execute(httpRequest, httpResponse) ; }
+    
+    protected abstract void execute(HttpServletRequest httpRequest, HttpServletResponse httpResponse) ;
+
+    protected static void setHeaders(HttpServletResponse httpResponse)
+    {
+        ServletBase.setCommonHeaders(httpResponse) ; 
+        httpResponse.setCharacterEncoding("UTF-8") ;
+        httpResponse.setContentType("text/html") ;
+        httpResponse.setHeader(respService, "Fuseki/ARQ SPARQL Query Validator: http://jena.apache.org/") ;
+    }
+    
+    protected static String htmlQuote(String str)
+    {
+        StringBuilder sBuff = new StringBuilder() ;
+        for ( int i = 0 ; i < str.length() ; i++ )
+        {
+            char ch = str.charAt(i) ;
+            switch (ch)
+            {
+                case '<': sBuff.append("&lt;") ; break ;
+                case '>': sBuff.append("&gt;") ; break ;
+                case '&': sBuff.append("&amp;") ; break ;
+                default: 
+                    // Work around Eclipe bug with StringBuffer.append(char)
+                    //try { sBuff.append(ch) ; } catch (Exception ex) {}
+                    sBuff.append(ch) ;
+                    break ;  
+            }
+        }
+        return sBuff.toString() ; 
+    }
+
+    protected static void startFixed(ServletOutputStream outStream) throws IOException
+    {
+        outStream.println("<pre class=\"box\">") ;
+    }
+
+    protected static void columns(String prefix, ServletOutputStream outStream) throws IOException
+    {
+        outStream.print(prefix) ;
+        outStream.println("         1         2         3         4         5         6         7") ;
+        outStream.print(prefix) ;
+        outStream.println("12345678901234567890123456789012345678901234567890123456789012345678901234567890") ;
+    }
+    
+    protected static void finishFixed(ServletOutputStream outStream) throws IOException
+    {
+        outStream.println("</pre>") ;
+    }
+    
+    protected static void printHead(ServletOutputStream outStream, String title) throws IOException
+    {
+        outStream.println("<head>") ;
+        outStream.println(" <title>"+title+"</title>") ;
+        outStream.println("   <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">") ;
+        outStream.println("   <link rel=\"stylesheet\" type=\"text/css\" href=\""+cssFile+"\" />") ;
+        //outStream.println() ;
+        outStream.println("</head>") ;
+    }
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/662cf71d/jena-fuseki1/src/main/resources/META-INF/DEPENDENCIES
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/resources/META-INF/DEPENDENCIES b/jena-fuseki1/src/main/resources/META-INF/DEPENDENCIES
new file mode 100644
index 0000000..910b788
--- /dev/null
+++ b/jena-fuseki1/src/main/resources/META-INF/DEPENDENCIES
@@ -0,0 +1,24 @@
+This file lists the dependences for Apache Jena Fuseki.
+  Version numbers are given in the POM file for a particular distribution. 
+
+Apache Projects:   Apache Software License
+  Apache Jena, including the Jena IRI library
+  Apache Xerces-J
+  Apache log4j
+  Apache HttpComponents (HTTP Client)
+  Apache Commons Codec
+  Apache Common FileUpload
+
+ICU4J : http://icu-project.org/
+   IBM X License (to version ICU4J 3.4.4)
+
+SLF4J : http://www.slf4j.org/
+  Copyright (c) 2004-2008 QOS.ch
+  MIT License
+
+JUnit : http://junit.org/
+  Common Public License - v 1.0
+
+Jetty: http://www.eclipse.org/jetty/
+  Apache License 2.0 
+  (also avilable under Eclipse Public License 1.0)