This is an automated email from the ASF dual-hosted git repository.

andy pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/jena.git


The following commit(s) were added to refs/heads/main by this push:
     new 50d2f6b  JENA-1806: Move example code to jena-examples
     new 167bd96  Merge pull request #1110 from afs/examples
50d2f6b is described below

commit 50d2f6bcdee7066d91101540f1221600a01b4ab7
Author: Andy Seaborne <[email protected]>
AuthorDate: Fri Nov 12 17:13:46 2021 +0000

    JENA-1806: Move example code to jena-examples
---
 jena-examples/pom.xml                              |  12 ++
 .../src/main/java/arq/examples/ExModelStore01.java |  71 ++++++++++++
 .../main/java/arq/examples/ExModification01.java   |  92 ++++++++++++++++
 .../src/main/java}/arq/examples/ExProg1.java       |   0
 .../src/main/java}/arq/examples/ExProg2.java       |   0
 .../main/java}/arq/examples/ExQuerySelect1.java    |   0
 .../main/java}/arq/examples/ExQuerySelect2.java    |   0
 .../java}/arq/examples/ExQuerySubstitute_01.java   |   5 +-
 .../main/java}/arq/examples/ExampleDBpedia1.java   |   0
 .../main/java}/arq/examples/ExampleDBpedia2.java   |   0
 .../main/java}/arq/examples/ExampleDBpedia3.java   |   0
 .../src/main/java/arq/examples/ExamplesServer.java |  70 ++++++++++++
 .../arq/examples/aggregates/CustomAggregate.java   |   0
 .../main/java/arq/examples/algebra}/AlgebraEx.java |   3 +-
 .../java/arq/examples/algebra}/AlgebraExec.java    |   2 +-
 .../java/arq/examples/auth/ExAuth00_Setup.java     |  99 +++++++++++++++++
 .../examples/auth/ExAuth01_RDFConnectionPW.java    | 108 ++++++++++++++++++
 .../examples/auth/ExAuth02_QueryExecutionPW.java   | 117 ++++++++++++++++++++
 .../examples/auth/ExAuth03_UpdateExecutionPW.java  | 101 +++++++++++++++++
 .../java/arq/examples/auth/ExAuth04_ServicePW.java | 117 ++++++++++++++++++++
 .../arq/examples/bgpmatching/OpExecutorAlt.java    |   0
 .../arq/examples/bgpmatching/StageAltMain.java     |   0
 .../examples/bgpmatching/StageGeneratorAlt.java    |   0
 .../constructquads/ExampleConstructQuads.java      |   0
 .../java}/arq/examples/engine/MyQueryEngine.java   |   0
 .../main/java}/arq/examples/filter/classify.java   |   0
 .../arq/examples/propertyfunction/labelSearch.java |   0
 .../arq/examples/propertyfunction/localname.java   |   0
 .../arq/examples/propertyfunction/uppercase.java   |   0
 .../java}/arq/examples/riot/ExRIOT1_ReadModel.java |   0
 .../arq/examples/riot/ExRIOT2_ReadDataset.java     |   0
 .../java}/arq/examples/riot/ExRIOT3_RDFParser.java |   0
 .../examples/riot/ExRIOT4_StreamRDF_Filter.java    |   0
 .../examples/riot/ExRIOT5_StreamRDFCollect.java    |   0
 .../arq/examples/riot/ExRIOT6_AddNewReader.java    |   0
 .../arq/examples/riot/ExRIOT7_AddNewWriter.java    |   0
 .../arq/examples/riot/ExRIOT8_RelativeURIs.java    |   0
 .../arq/examples/riot/ExRIOT9_AsyncParser.java     |   0
 .../riot/ExRIOT_RDFXML_ReaderProperties.java       |   0
 .../riot/ExRIOT_RDFXML_WriteProperties.java        |   0
 .../java}/arq/examples/riot/ExRIOT_writeModel.java |   0
 .../java}/arq/examples/riot/ExRIOT_writeRDF.java   |   0
 .../java}/arq/examples/riot/Ex_WriteJsonLD.java    |   0
 .../examples/update/UpdateExecuteOperations.java   |   0
 .../arq/examples/update/UpdateProgrammatic.java    |   0
 .../arq/examples/update/UpdateReadFromFile.java    |   0
 .../examples/RDFConnectionExample1.java            |   2 +-
 .../examples/RDFConnectionExample2.java            |   2 +-
 .../examples/RDFConnectionExample3.java            |   2 +-
 .../examples/RDFConnectionExample4.java            |   2 +-
 .../examples/RDFConnectionExample5.java            |   2 +-
 .../examples/RDFConnectionExample6.java            |   2 +-
 .../shacl/examples/Shacl01_validateGraph.java      |   2 +-
 .../examples/Shacl02_validateTransaction.java      |   2 +-
 .../java}/shex/examples/Shex01_validateGraph.java  |   2 +-
 .../java}/shex/examples/Shex02_validateNode.java   |   2 +-
 .../main/java}/shex/examples/Shex03_validate.java  |   2 +-
 .../src/main/java/tdb1}/examples/ExQuadFilter.java |   2 +-
 .../src/main/java/tdb1}/examples/ExTDB1.java       |   2 +-
 .../src/main/java/tdb1}/examples/ExTDB2.java       |   2 +-
 .../src/main/java/tdb1}/examples/ExTDB3.java       |   2 +-
 .../src/main/java/tdb1}/examples/ExTDB4.java       |   2 +-
 .../src/main/java/tdb1}/examples/ExTDB5.java       |   2 +-
 .../src/main/java/tdb1}/examples/ExTDB6.java       |   2 +-
 .../src/main/java/tdb1}/examples/ExTDB_Txn1.java   |   2 +-
 .../src/main/java/tdb1}/examples/ExTDB_Txn2.java   |   2 +-
 .../src/main/java/tdb1}/examples/ExTDB_Txn3.java   |   2 +-
 .../java/org/apache/jena/tdb/sys/SystemTDB.java    | 122 ++++++++++-----------
 68 files changed, 873 insertions(+), 88 deletions(-)

diff --git a/jena-examples/pom.xml b/jena-examples/pom.xml
index 327b42a..ed5f555 100644
--- a/jena-examples/pom.xml
+++ b/jena-examples/pom.xml
@@ -52,6 +52,18 @@
       <version>${project.version}</version>
     </dependency>
     <dependency>
+      <groupId>org.apache.jena</groupId>
+      <artifactId>jena-fuseki-main</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+
+    <!-- Require a logging implementation -->
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-slf4j-impl</artifactId>
+    </dependency>
+
+    <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
     </dependency>
diff --git a/jena-examples/src/main/java/arq/examples/ExModelStore01.java 
b/jena-examples/src/main/java/arq/examples/ExModelStore01.java
new file mode 100644
index 0000000..08fb37b
--- /dev/null
+++ b/jena-examples/src/main/java/arq/examples/ExModelStore01.java
@@ -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.
+ */
+
+package arq.examples;
+
+import org.apache.jena.atlas.lib.StrUtils;
+import org.apache.jena.fuseki.main.FusekiServer;
+import org.apache.jena.fuseki.system.FusekiLogging;
+import org.apache.jena.query.ModelStore;
+import org.apache.jena.rdf.model.Model;
+import org.apache.jena.rdf.model.ModelFactory;
+import org.apache.jena.riot.Lang;
+import org.apache.jena.riot.RDFDataMgr;
+import org.apache.jena.riot.RDFParser;
+import org.apache.jena.sparql.core.DatasetGraph;
+import org.apache.jena.sparql.core.DatasetGraphFactory;
+
+public class ExModelStore01 {
+
+    static String dsName = "data";
+    static DatasetGraph dsg = DatasetGraphFactory.createTxnMem();
+    public static  String rdfString = StrUtils.strjoinNL
+            ("PREFIX : <http://example>"
+            , ":s :p 123 ."
+            );
+    static Model someData = ModelFactory.createDefaultModel();
+
+    public static void main(String ...args) {
+        try {
+            // Setup a server.
+            FusekiLogging.setLogging();
+            FusekiServer server = ExamplesServer.startServer(dsName, dsg, 
false);
+            String dataURL = "http://localhost:"+server.getPort()+"/"+dsName;
+            RDFParser.fromString(rdfString).lang(Lang.TTL).parse(someData);
+            exampleModelStore(dataURL);
+
+        } catch (Throwable th) {
+            th.printStackTrace();
+        } finally {
+            // The server is in the background so explicitly exit the process
+            System.exit(0);
+        }
+    }
+
+    private static void exampleModelStore(String dataURL) {
+        System.out.println();
+        System.out.println("ModelStore - PUT");
+        ModelStore.service(dataURL).defaultModel().PUT(someData);
+
+        System.out.println();
+        System.out.println("ModelStore - GET");
+        Model model = ModelStore.service(dataURL).defaultModel().GET();
+        System.out.println();
+        RDFDataMgr.write(System.out,  model, Lang.TTL);
+    }
+}
diff --git a/jena-examples/src/main/java/arq/examples/ExModification01.java 
b/jena-examples/src/main/java/arq/examples/ExModification01.java
new file mode 100644
index 0000000..70ae8ab
--- /dev/null
+++ b/jena-examples/src/main/java/arq/examples/ExModification01.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 arq.examples;
+
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.apache.jena.fuseki.main.FusekiServer;
+import org.apache.jena.fuseki.system.FusekiLogging;
+import org.apache.jena.http.sys.HttpRequestModifier;
+import org.apache.jena.http.sys.RegistryRequestModifier;
+import org.apache.jena.rdflink.RDFLink;
+import org.apache.jena.rdflink.RDFLinkHTTP;
+import org.apache.jena.sparql.core.DatasetGraph;
+import org.apache.jena.sparql.core.DatasetGraphFactory;
+import org.apache.jena.sparql.exec.http.GSP;
+
+/** Example modifier of HTTP requests (sets "X-Tracker" header). */
+public class ExModification01 {
+
+    static String dsName = "data";
+    static DatasetGraph dsg = DatasetGraphFactory.createTxnMem();
+    static FusekiServer server;
+    static String serverURL;
+    static String dataURL;
+
+
+    public static void main(String ...args) {
+        try {
+            FusekiLogging.setLogging();
+            server = ExamplesServer.startServer(dsName, dsg, true);
+            serverURL = "http://localhost:"+server.getPort()+"/";
+            dataURL = "http://localhost:"+server.getPort()+"/"+dsName;
+
+            exampleMod();
+
+        } catch (Throwable th) {
+            th.printStackTrace();
+        } finally {
+            // The server is in the background so explicitly exit the process
+            System.exit(0);
+        }
+    }
+
+    private static void exampleMod() {
+        AtomicLong counter = new AtomicLong(0);
+
+        HttpRequestModifier modifier = (params, headers)->{
+            long x = counter.incrementAndGet();
+            headers.put("X-Tracker", "Call="+x);
+        };
+        RegistryRequestModifier.get().addPrefix(serverURL, modifier);
+        //RegistryRequestModifier.get().add(dataURL, modifier);
+
+        // GSP : NO MODIFICATION no call to modifyByService
+        // GSP : calls HttpRDF
+        // Pass in request or at least request type.
+        /*
+org.apache.jena.http.sys.RegistryRequestModifier.get()
+auth.examples.ExModification01.exampleMod()
+
+org.apache.jena.http.HttpLib.modifyByService(String, Context, Params, 
Map<String, String>)
+  org.apache.jena.sparql.exec.http.UpdateExecHTTP.execute()
+  org.apache.jena.sparql.exec.http.QueryExecHTTP.query(String)
+  ==> SERVICE via QueryExecHTTP
+  ==> GSP ?
+
+org.apache.jena.sparql.exec.http.TestService.runWithModifier(String, 
HttpRequestModifier, Runnable)
+
+         */
+        GSP.service(dataURL).defaultGraph().GET();
+
+        try ( RDFLink link = RDFLinkHTTP.service(dataURL).build() ) {
+            boolean b = link.queryAsk("ASK{}");
+        }
+    }
+}
diff --git a/jena-arq/src-examples/arq/examples/ExProg1.java 
b/jena-examples/src/main/java/arq/examples/ExProg1.java
similarity index 100%
rename from jena-arq/src-examples/arq/examples/ExProg1.java
rename to jena-examples/src/main/java/arq/examples/ExProg1.java
diff --git a/jena-arq/src-examples/arq/examples/ExProg2.java 
b/jena-examples/src/main/java/arq/examples/ExProg2.java
similarity index 100%
rename from jena-arq/src-examples/arq/examples/ExProg2.java
rename to jena-examples/src/main/java/arq/examples/ExProg2.java
diff --git a/jena-arq/src-examples/arq/examples/ExQuerySelect1.java 
b/jena-examples/src/main/java/arq/examples/ExQuerySelect1.java
similarity index 100%
rename from jena-arq/src-examples/arq/examples/ExQuerySelect1.java
rename to jena-examples/src/main/java/arq/examples/ExQuerySelect1.java
diff --git a/jena-arq/src-examples/arq/examples/ExQuerySelect2.java 
b/jena-examples/src/main/java/arq/examples/ExQuerySelect2.java
similarity index 100%
rename from jena-arq/src-examples/arq/examples/ExQuerySelect2.java
rename to jena-examples/src/main/java/arq/examples/ExQuerySelect2.java
diff --git a/jena-arq/src-examples/arq/examples/ExQuerySubstitute_01.java 
b/jena-examples/src/main/java/arq/examples/ExQuerySubstitute_01.java
similarity index 96%
rename from jena-arq/src-examples/arq/examples/ExQuerySubstitute_01.java
rename to jena-examples/src/main/java/arq/examples/ExQuerySubstitute_01.java
index cc1eb92..141876f 100644
--- a/jena-arq/src-examples/arq/examples/ExQuerySubstitute_01.java
+++ b/jena-examples/src/main/java/arq/examples/ExQuerySubstitute_01.java
@@ -60,15 +60,12 @@ public class ExQuerySubstitute_01 {
                 .select();
         ResultSetFormatter.out(resultSet1);
 
-        // To return the value used for variable substitution, include the 
variable in the SELECT clause.
+        // To return the values used for variable substitution, include the 
variable in the SELECT clause.
         ResultSet resultSet2 = QueryExecution.dataset(dataset)
                 .query(prefixes+"SELECT ?person ?name { ?person foaf:name 
?name }")
                 .substitution("name", name2)
                 .select();
         ResultSetFormatter.out(resultSet2);
-
-
-
     }
 
     private static void addPerson(Dataset dataset, String uri, String name) {
diff --git a/jena-arq/src-examples/arq/examples/ExampleDBpedia1.java 
b/jena-examples/src/main/java/arq/examples/ExampleDBpedia1.java
similarity index 100%
rename from jena-arq/src-examples/arq/examples/ExampleDBpedia1.java
rename to jena-examples/src/main/java/arq/examples/ExampleDBpedia1.java
diff --git a/jena-arq/src-examples/arq/examples/ExampleDBpedia2.java 
b/jena-examples/src/main/java/arq/examples/ExampleDBpedia2.java
similarity index 100%
rename from jena-arq/src-examples/arq/examples/ExampleDBpedia2.java
rename to jena-examples/src/main/java/arq/examples/ExampleDBpedia2.java
diff --git a/jena-arq/src-examples/arq/examples/ExampleDBpedia3.java 
b/jena-examples/src/main/java/arq/examples/ExampleDBpedia3.java
similarity index 100%
rename from jena-arq/src-examples/arq/examples/ExampleDBpedia3.java
rename to jena-examples/src/main/java/arq/examples/ExampleDBpedia3.java
diff --git a/jena-examples/src/main/java/arq/examples/ExamplesServer.java 
b/jena-examples/src/main/java/arq/examples/ExamplesServer.java
new file mode 100644
index 0000000..99ed1fa
--- /dev/null
+++ b/jena-examples/src/main/java/arq/examples/ExamplesServer.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 arq.examples;
+
+import java.util.Objects;
+
+import org.apache.jena.atlas.web.AuthScheme;
+import org.apache.jena.fuseki.auth.Auth;
+import org.apache.jena.fuseki.jetty.JettyLib;
+import org.apache.jena.fuseki.main.FusekiServer;
+import org.apache.jena.sparql.core.DatasetGraph;
+import org.eclipse.jetty.security.SecurityHandler;
+import org.eclipse.jetty.security.UserStore;
+
+/** Support code for examples */
+public class ExamplesServer {
+
+    // Plain server
+    public static FusekiServer startServer(String dsName, DatasetGraph dsg, 
boolean verbose) {
+        FusekiServer server = FusekiServer.create()
+                .port(0)
+                .loopback(true)
+                .verbose(verbose)
+                .enablePing(true)
+                .add(dsName, dsg)
+                .build();
+            server.start();
+            return server;
+    }
+
+
+    // Server with users and password.
+    public static FusekiServer startServerWithAuth(String dsName, DatasetGraph 
dsg, boolean verbose, String user, String password) {
+        Objects.requireNonNull(user);
+        Objects.requireNonNull(password);
+
+        UserStore userStore = JettyLib.makeUserStore(user, password);
+        SecurityHandler sh = JettyLib.makeSecurityHandler("Fuseki",  
userStore, AuthScheme.BASIC);
+
+        FusekiServer server = FusekiServer.create()
+            .port(0)
+            .loopback(true)
+            .verbose(verbose)
+            .enablePing(true)
+            .securityHandler(sh)
+            // Only this user can make requests.
+            .serverAuthPolicy(Auth.policyAllowSpecific(user))
+            .add(dsName, dsg)
+            .build();
+        server.start();
+        return server;
+    }
+
+}
diff --git a/jena-arq/src-examples/arq/examples/aggregates/CustomAggregate.java 
b/jena-examples/src/main/java/arq/examples/aggregates/CustomAggregate.java
similarity index 100%
rename from jena-arq/src-examples/arq/examples/aggregates/CustomAggregate.java
rename to 
jena-examples/src/main/java/arq/examples/aggregates/CustomAggregate.java
diff --git a/jena-arq/src-examples/arq/examples/AlgebraEx.java 
b/jena-examples/src/main/java/arq/examples/algebra/AlgebraEx.java
similarity index 96%
rename from jena-arq/src-examples/arq/examples/AlgebraEx.java
rename to jena-examples/src/main/java/arq/examples/algebra/AlgebraEx.java
index d676d1c..a6fe7e5 100644
--- a/jena-arq/src-examples/arq/examples/AlgebraEx.java
+++ b/jena-examples/src/main/java/arq/examples/algebra/AlgebraEx.java
@@ -16,8 +16,9 @@
  * limitations under the License.
  */
 
-package arq.examples;
+package arq.examples.algebra;
 
+import arq.examples.ExQuerySelect1;
 import org.apache.jena.query.Query ;
 import org.apache.jena.query.QueryFactory ;
 import org.apache.jena.sparql.algebra.Algebra ;
diff --git a/jena-arq/src-examples/arq/examples/AlgebraExec.java 
b/jena-examples/src/main/java/arq/examples/algebra/AlgebraExec.java
similarity index 99%
rename from jena-arq/src-examples/arq/examples/AlgebraExec.java
rename to jena-examples/src/main/java/arq/examples/algebra/AlgebraExec.java
index 722fcb0..8aeb60b 100644
--- a/jena-arq/src-examples/arq/examples/AlgebraExec.java
+++ b/jena-examples/src/main/java/arq/examples/algebra/AlgebraExec.java
@@ -16,7 +16,7 @@
  * limitations under the License.
  */
 
-package arq.examples;
+package arq.examples.algebra;
 
 import java.util.ArrayList ;
 import java.util.List ;
diff --git a/jena-examples/src/main/java/arq/examples/auth/ExAuth00_Setup.java 
b/jena-examples/src/main/java/arq/examples/auth/ExAuth00_Setup.java
new file mode 100644
index 0000000..4b9442a
--- /dev/null
+++ b/jena-examples/src/main/java/arq/examples/auth/ExAuth00_Setup.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 arq.examples.auth;
+
+import java.net.URI;
+
+import arq.examples.ExamplesServer;
+import org.apache.jena.fuseki.main.FusekiServer;
+import org.apache.jena.fuseki.system.FusekiLogging;
+import org.apache.jena.http.auth.AuthEnv;
+import org.apache.jena.query.QueryException;
+import org.apache.jena.query.QueryExecution;
+import org.apache.jena.sparql.core.DatasetGraph;
+import org.apache.jena.sparql.core.DatasetGraphFactory;
+import org.apache.jena.sparql.exec.http.QueryExecutionHTTP;
+
+/** Examples of Authentication setup. */
+public class ExAuth00_Setup {
+
+    static String dsName = "data";
+    static DatasetGraph dsg = DatasetGraphFactory.createTxnMem();
+    static FusekiServer server;
+    static String serverURL;
+    static String dataURL;
+
+    public static void main(String ...args) {
+        try {
+            FusekiLogging.setLogging();
+            server = ExamplesServer.startServerWithAuth(dsName, dsg, false, 
"u", "p");
+            serverURL = "http://localhost:"+server.getPort()+"/";
+            dataURL = "http://localhost:"+server.getPort()+"/"+dsName;
+            System.out.println();
+
+            exampleAuth();
+
+        } catch (Throwable th) {
+            th.printStackTrace();
+        } finally {
+            // The server is in the background so explicitly exit the process
+            System.exit(0);
+        }
+    }
+
+    public static void exampleAuth() {
+
+
+        System.out.println("No auth");
+        operation();
+
+        System.out.println("Register user/password (with challenge)");
+        AuthEnv.get().registerUsernamePassword(URI.create(dataURL), "u", "p");
+        operation();
+
+        AuthEnv.get().clearAuthEnv();
+
+        System.out.println("Operation after environment cleared");
+        operation();
+
+        System.out.println("Register basic auth user/password (without 
challenge)");
+        // Pre-registration. No challenge step. Send password on all request, 
including the first request.
+        AuthEnv.get().registerBasicAuthModifier(dataURL, "u", "p");
+        operation();
+
+        // Clear active
+        System.out.println("Operation, no basic auth registered");
+        AuthEnv.get().clearActiveAuthentication();
+        operation();
+
+    }
+
+    /**
+     * Operation - print whether it succeed or there was an authentication 
rejection.
+     */
+    public static void operation() {
+        try ( QueryExecution qExec = 
QueryExecutionHTTP.service(dataURL).query("ASK{}").build() ) {
+            qExec.execAsk();
+            System.out.println("Operation succeeded");
+        }  catch (QueryException ex) {
+            System.out.println("Operation failed: "+ex.getMessage());
+        }
+        System.out.println();
+    }
+}
diff --git 
a/jena-examples/src/main/java/arq/examples/auth/ExAuth01_RDFConnectionPW.java 
b/jena-examples/src/main/java/arq/examples/auth/ExAuth01_RDFConnectionPW.java
new file mode 100644
index 0000000..a345a61
--- /dev/null
+++ 
b/jena-examples/src/main/java/arq/examples/auth/ExAuth01_RDFConnectionPW.java
@@ -0,0 +1,108 @@
+/*
+ * 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 arq.examples.auth;
+
+import java.net.Authenticator;
+import java.net.URI;
+import java.net.http.HttpClient;
+import java.time.Duration;
+
+import arq.examples.ExamplesServer;
+import org.apache.jena.atlas.lib.StrUtils;
+import org.apache.jena.fuseki.main.FusekiServer;
+import org.apache.jena.fuseki.system.FusekiLogging;
+import org.apache.jena.http.auth.AuthEnv;
+import org.apache.jena.http.auth.AuthLib;
+import org.apache.jena.rdf.model.Model;
+import org.apache.jena.rdf.model.ModelFactory;
+import org.apache.jena.rdfconnection.RDFConnection;
+import org.apache.jena.rdfconnection.RDFConnectionRemote;
+import org.apache.jena.riot.Lang;
+import org.apache.jena.riot.RDFParser;
+import org.apache.jena.sparql.core.DatasetGraph;
+import org.apache.jena.sparql.core.DatasetGraphFactory;
+
+/** Examples of RDFConnection with user/password */
+public class ExAuth01_RDFConnectionPW {
+
+    static String dsName = "data";
+    static DatasetGraph dsg = DatasetGraphFactory.createTxnMem();
+    static FusekiServer server;
+    static String serverURL;
+    static String dataURL;
+    public static  String rdfString = StrUtils.strjoinNL
+                                        ("PREFIX : <http://example>"
+                                        , ":s :p 123 ."
+                                        );
+    static Model someData = ModelFactory.createDefaultModel();
+
+    public static void main(String ...args) {
+        try {
+            // Setup a server.
+            FusekiLogging.setLogging();
+            server = ExamplesServer.startServerWithAuth(dsName, dsg, true, 
"u", "p");
+            serverURL = "http://localhost:"+server.getPort()+"/";
+            dataURL = "http://localhost:"+server.getPort()+"/"+dsName;
+            RDFParser.fromString(rdfString).lang(Lang.TTL).parse(someData);
+
+            // Examples
+            exampleConnectionAuthWithHttpClient();
+
+            exampleConnectionAuthByRegistration();
+
+        } catch (Throwable th) {
+            th.printStackTrace();
+        } finally {
+            // The server is in the background so explicitly exit the process
+            System.exit(0);
+        }
+    }
+
+    // HttpClient
+    public static void exampleConnectionAuthWithHttpClient() {
+        System.out.println();
+        System.out.println("HttpClient + RDFConnectionRemote");
+
+        // Custom HttpClient
+        Authenticator authenticator = AuthLib.authenticator("u", "p");
+        HttpClient httpClient = HttpClient.newBuilder()
+                .connectTimeout(Duration.ofSeconds(10))
+                .authenticator(authenticator)
+                .build();
+        try ( RDFConnection conn = RDFConnectionRemote.service(dataURL)
+                .httpClient(httpClient) // Custom HttpClient
+                .build()) {
+            conn.update("INSERT DATA{}");
+            conn.queryAsk("ASK{}");
+        }
+    }
+
+    public static void exampleConnectionAuthByRegistration() {
+        System.out.println();
+        System.out.println("Register user/password + RDFConnectionRemote");
+        // Register authentication.
+        AuthEnv.get().registerUsernamePassword(URI.create(dataURL), "u", "p");
+
+        // RDFConnection - no special extra setup.
+        try ( RDFConnection conn1 = 
RDFConnectionRemote.service(dataURL).build() ) {
+            System.out.println("conn1: Try to PUT model ...");
+            conn1.put(someData);
+        }
+    }
+}
diff --git 
a/jena-examples/src/main/java/arq/examples/auth/ExAuth02_QueryExecutionPW.java 
b/jena-examples/src/main/java/arq/examples/auth/ExAuth02_QueryExecutionPW.java
new file mode 100644
index 0000000..928ef72
--- /dev/null
+++ 
b/jena-examples/src/main/java/arq/examples/auth/ExAuth02_QueryExecutionPW.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 arq.examples.auth;
+
+import java.net.Authenticator;
+import java.net.URI;
+import java.net.http.HttpClient;
+import java.time.Duration;
+
+import arq.examples.ExamplesServer;
+import org.apache.jena.fuseki.main.FusekiServer;
+import org.apache.jena.fuseki.system.FusekiLogging;
+import org.apache.jena.http.auth.AuthEnv;
+import org.apache.jena.http.auth.AuthLib;
+import org.apache.jena.query.QueryException;
+import org.apache.jena.query.QueryExecution;
+import org.apache.jena.sparql.core.DatasetGraph;
+import org.apache.jena.sparql.core.DatasetGraphFactory;
+import org.apache.jena.sparql.exec.http.QueryExecutionHTTP;
+
+/** Examples of QueryExecution with user/password */
+public class ExAuth02_QueryExecutionPW {
+
+    static String dsName = "data";
+    static DatasetGraph dsg = DatasetGraphFactory.createTxnMem();
+    static FusekiServer server;
+    static String serverURL;
+    static String dataURL;
+
+    public static void main(String ...args) {
+        try {
+            FusekiLogging.setLogging();
+            server = ExamplesServer.startServerWithAuth(dsName, dsg, false, 
"u", "p");
+            serverURL = "http://localhost:"+server.getPort()+"/";
+            dataURL = "http://localhost:"+server.getPort()+"/"+dsName;
+
+            exampleQueryAuthWithHttpClient();
+            exampleQueryAuth();
+
+        } catch (Throwable th) {
+            th.printStackTrace();
+        } finally {
+            // The server is in the background so explicitly exit the process
+            System.exit(0);
+        }
+    }
+
+    // HttpClient
+    public static void exampleQueryAuthWithHttpClient() {
+        System.out.println();
+        System.out.println("HttpClient + QueryExecutionHTTP");
+        Authenticator authenticator = AuthLib.authenticator("u", "p");
+        HttpClient httpClient = HttpClient.newBuilder()
+                .connectTimeout(Duration.ofSeconds(10))
+                .authenticator(authenticator)
+                .build();
+
+        try ( QueryExecution qexec = QueryExecutionHTTP.service(dataURL)
+                .httpClient(httpClient)
+                .endpoint(dataURL)
+                .queryString("ASK{}")
+                .build()) {
+            qexec.execAsk();
+        }
+    }
+
+
+    public static void exampleQueryAuth() {
+        System.out.println();
+        // No auth
+        try ( QueryExecution qExec = 
QueryExecutionHTTP.service(dataURL).query("ASK{}").build() ) {
+            try {
+                System.out.println("Query/no auth");
+                qExec.execAsk();
+                // NB QueryException.
+            }  catch (QueryException ex) {
+                System.out.println("Failed: "+ex.getMessage());
+            }
+        }
+
+        System.out.println();
+        //
+        AuthEnv.get().clearAuthEnv();
+        // This fails if the server requires digest authentication.
+        // java.net.http.HttpClient only provides basic with no challenge.
+        System.out.println("Register user/password (with challenge)");
+
+        AuthEnv.get().registerUsernamePassword(URI.create(dataURL), "u", "p");
+
+//        System.out.println("Register basic auth user/password (without 
challenge)");
+//        // Pre-registration. No challenge step. Send password on all 
request, including the first request.
+//        AuthEnv.get().registerBasicAuthModifier(dataURL, "u", "p");
+
+        try ( QueryExecution qExec = 
QueryExecutionHTTP.service(dataURL).query("ASK{}").build() ) {
+            // Expect success because there will be a challenge and Jena will 
resend with the auth information.
+            System.out.println("Query/auth registered");
+            qExec.execAsk();
+        }
+        AuthEnv.get().clearActiveAuthentication();
+    }
+}
diff --git 
a/jena-examples/src/main/java/arq/examples/auth/ExAuth03_UpdateExecutionPW.java 
b/jena-examples/src/main/java/arq/examples/auth/ExAuth03_UpdateExecutionPW.java
new file mode 100644
index 0000000..6ad4c31
--- /dev/null
+++ 
b/jena-examples/src/main/java/arq/examples/auth/ExAuth03_UpdateExecutionPW.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 arq.examples.auth;
+
+import java.net.Authenticator;
+import java.net.URI;
+import java.net.http.HttpClient;
+import java.time.Duration;
+
+import arq.examples.ExamplesServer;
+import org.apache.jena.atlas.web.HttpException;
+import org.apache.jena.fuseki.main.FusekiServer;
+import org.apache.jena.fuseki.system.FusekiLogging;
+import org.apache.jena.http.auth.AuthEnv;
+import org.apache.jena.http.auth.AuthLib;
+import org.apache.jena.sparql.core.DatasetGraph;
+import org.apache.jena.sparql.core.DatasetGraphFactory;
+import org.apache.jena.sparql.exec.http.UpdateExecutionHTTP;
+import org.apache.jena.update.UpdateExecution;
+
+/** Examples of UpdateExecution with user/password */
+public class ExAuth03_UpdateExecutionPW {
+
+    static String dsName = "data";
+    static DatasetGraph dsg = DatasetGraphFactory.createTxnMem();
+    static FusekiServer server;
+    static String serverURL;
+    static String dataURL;
+
+    public static void main(String ...args) {
+        try {
+            FusekiLogging.setLogging();
+            server = ExamplesServer.startServerWithAuth(dsName, dsg, false, 
"u", "p");
+            serverURL = "http://localhost:"+server.getPort()+"/";
+            dataURL = "http://localhost:"+server.getPort()+"/"+dsName;
+
+            exampleUpdateAuthWithHttpClient();
+            exampleUpdateAuth();
+
+        } catch (Throwable th) {
+            th.printStackTrace();
+        } finally {
+            // The server is in the background so explicitly exit the process
+            System.exit(0);
+        }
+    }
+
+    // HttpClient
+    public static void exampleUpdateAuthWithHttpClient() {
+        System.out.println();
+        System.out.println("HttpClient + UpdateExecutionHTTP");
+        Authenticator authenticator = AuthLib.authenticator("u", "p");
+        HttpClient httpClient = HttpClient.newBuilder()
+                .connectTimeout(Duration.ofSeconds(10))
+                .authenticator(authenticator)
+                .build();
+
+        UpdateExecutionHTTP.service(dataURL)
+                .httpClient(httpClient)
+                .update("CLEAR ALL")
+                .execute();
+    }
+
+    public static void exampleUpdateAuth() {
+        System.out.println();
+        UpdateExecution uExec1 = 
UpdateExecutionHTTP.service(dataURL).update("INSERT DATA{}").build();
+        try {
+            // Expect failed because there is no authentication credentials.
+            System.out.println("Update/no auth");
+            uExec1.execute();
+        } catch (HttpException ex) {
+            System.out.println("Failed: "+ex.getMessage());
+        }
+
+        System.out.println("Register user/password + UpdateExecution");
+        AuthEnv.get().registerUsernamePassword(URI.create(dataURL), "u", "p");
+
+        UpdateExecution uExec3 = UpdateExecutionHTTP.service(dataURL)
+                .update("INSERT DATA{}")
+                .build();
+        // Expect success because there will be a challenge and Jena will 
resend with the auth information.
+        uExec3.execute();
+        AuthEnv.get().clearActiveAuthentication();
+    }
+}
diff --git 
a/jena-examples/src/main/java/arq/examples/auth/ExAuth04_ServicePW.java 
b/jena-examples/src/main/java/arq/examples/auth/ExAuth04_ServicePW.java
new file mode 100644
index 0000000..03c54ef
--- /dev/null
+++ b/jena-examples/src/main/java/arq/examples/auth/ExAuth04_ServicePW.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 arq.examples.auth;
+
+import java.net.Authenticator;
+import java.net.URI;
+import java.net.http.HttpClient;
+import java.time.Duration;
+
+import arq.examples.ExamplesServer;
+import org.apache.jena.atlas.lib.StrUtils;
+import org.apache.jena.fuseki.main.FusekiServer;
+import org.apache.jena.fuseki.system.FusekiLogging;
+import org.apache.jena.http.auth.AuthEnv;
+import org.apache.jena.http.auth.AuthLib;
+import org.apache.jena.query.*;
+import org.apache.jena.riot.Lang;
+import org.apache.jena.riot.RDFParser;
+import org.apache.jena.sparql.core.DatasetGraph;
+import org.apache.jena.sparql.core.DatasetGraphFactory;
+import org.apache.jena.sparql.util.Context;
+import org.apache.jena.sparql.util.ContextAccumulator;
+
+/**
+ * Example of SERVICE to an endpoint which has a password.
+ */
+public class ExAuth04_ServicePW {
+
+    static String dsName = "data";
+    static DatasetGraph dsg = DatasetGraphFactory.createTxnMem();
+    static FusekiServer server;
+    static String serverURL;
+    static String dataURL;
+    public static  String rdfString = StrUtils.strjoinNL
+                                        ("PREFIX : <http://example>"
+                                        , ":s :p 123 ."
+                                        );
+
+    public static void main(String ...args) {
+        try {
+            FusekiLogging.setLogging();
+            server = ExamplesServer.startServerWithAuth(dsName, dsg, true, 
"u", "p");
+            serverURL = "http://localhost:"+server.getPort()+"/";
+            dataURL = "http://localhost:"+server.getPort()+"/"+dsName;
+            RDFParser.fromString(rdfString).lang(Lang.TTL).parse(dsg);
+
+            exampleServiceByRegistry();
+
+            exampleServiceByHttpClient();
+
+        } catch (Throwable th) {
+            th.printStackTrace();
+        } finally {
+            // The server is in the background so explicitly exit the process
+            System.exit(0);
+        }
+    }
+
+    private static void exampleServiceByRegistry() {
+        System.out.println();
+        System.out.println("Register user/password, then make SERVICE call");
+        AuthEnv.get().registerUsernamePassword(URI.create(dataURL), "u", "p");
+        // Local query that calls out.
+        Dataset emptyLocal = DatasetFactory.empty();
+
+        // Registration applies to SERVICE.
+        Query query = QueryFactory.create("SELECT * { SERVICE <"+dataURL+"> { 
?s ?p ?o } }");
+        try ( QueryExecution qExec = 
QueryExecution.create().query(query).dataset(emptyLocal).build() ) {
+            System.out.println("Call using SERVICE...");
+            // Expect success because there will be a challenge and Jena will 
resend with the auth information.
+            // Then when auth is setup, it wil be sent each time (the 
challenge is only on the first time).
+            ResultSet rs = qExec.execSelect();
+            ResultSetFormatter.out(rs);
+        }
+
+        AuthEnv.get().clearActiveAuthentication();
+
+    }
+
+    private static void exampleServiceByHttpClient() {
+        System.out.println();
+        System.out.println("Custom HttpClient + SERVICE call");
+        Authenticator authenticator = AuthLib.authenticator("u", "p");
+        HttpClient httpClient = HttpClient.newBuilder()
+                .connectTimeout(Duration.ofSeconds(10))
+                .authenticator(authenticator)
+                .build();
+        Context cxt = ContextAccumulator.newBuilder().set(ARQ.httpQueryClient, 
httpClient).context();
+
+        Query query = QueryFactory.create("SELECT * { SERVICE <"+dataURL+"> { 
?s ?p ?o } }");
+        Dataset emptyLocal = DatasetFactory.empty();
+        try ( QueryExecution qExec = QueryExecution.create().query(query)
+                                                            
.dataset(emptyLocal)
+                                                            .context(cxt)
+                                                            .build() ) {
+            System.out.println("Call using SERVICE...");
+            ResultSet rs = qExec.execSelect();
+            ResultSetFormatter.out(rs);
+        }
+    }
+}
diff --git a/jena-arq/src-examples/arq/examples/bgpmatching/OpExecutorAlt.java 
b/jena-examples/src/main/java/arq/examples/bgpmatching/OpExecutorAlt.java
similarity index 100%
rename from jena-arq/src-examples/arq/examples/bgpmatching/OpExecutorAlt.java
rename to 
jena-examples/src/main/java/arq/examples/bgpmatching/OpExecutorAlt.java
diff --git a/jena-arq/src-examples/arq/examples/bgpmatching/StageAltMain.java 
b/jena-examples/src/main/java/arq/examples/bgpmatching/StageAltMain.java
similarity index 100%
rename from jena-arq/src-examples/arq/examples/bgpmatching/StageAltMain.java
rename to jena-examples/src/main/java/arq/examples/bgpmatching/StageAltMain.java
diff --git 
a/jena-arq/src-examples/arq/examples/bgpmatching/StageGeneratorAlt.java 
b/jena-examples/src/main/java/arq/examples/bgpmatching/StageGeneratorAlt.java
similarity index 100%
rename from 
jena-arq/src-examples/arq/examples/bgpmatching/StageGeneratorAlt.java
rename to 
jena-examples/src/main/java/arq/examples/bgpmatching/StageGeneratorAlt.java
diff --git 
a/jena-arq/src-examples/arq/examples/constructquads/ExampleConstructQuads.java 
b/jena-examples/src/main/java/arq/examples/constructquads/ExampleConstructQuads.java
similarity index 100%
rename from 
jena-arq/src-examples/arq/examples/constructquads/ExampleConstructQuads.java
rename to 
jena-examples/src/main/java/arq/examples/constructquads/ExampleConstructQuads.java
diff --git a/jena-arq/src-examples/arq/examples/engine/MyQueryEngine.java 
b/jena-examples/src/main/java/arq/examples/engine/MyQueryEngine.java
similarity index 100%
rename from jena-arq/src-examples/arq/examples/engine/MyQueryEngine.java
rename to jena-examples/src/main/java/arq/examples/engine/MyQueryEngine.java
diff --git a/jena-arq/src-examples/arq/examples/filter/classify.java 
b/jena-examples/src/main/java/arq/examples/filter/classify.java
similarity index 100%
rename from jena-arq/src-examples/arq/examples/filter/classify.java
rename to jena-examples/src/main/java/arq/examples/filter/classify.java
diff --git 
a/jena-arq/src-examples/arq/examples/propertyfunction/labelSearch.java 
b/jena-examples/src/main/java/arq/examples/propertyfunction/labelSearch.java
similarity index 100%
rename from jena-arq/src-examples/arq/examples/propertyfunction/labelSearch.java
rename to 
jena-examples/src/main/java/arq/examples/propertyfunction/labelSearch.java
diff --git a/jena-arq/src-examples/arq/examples/propertyfunction/localname.java 
b/jena-examples/src/main/java/arq/examples/propertyfunction/localname.java
similarity index 100%
rename from jena-arq/src-examples/arq/examples/propertyfunction/localname.java
rename to 
jena-examples/src/main/java/arq/examples/propertyfunction/localname.java
diff --git a/jena-arq/src-examples/arq/examples/propertyfunction/uppercase.java 
b/jena-examples/src/main/java/arq/examples/propertyfunction/uppercase.java
similarity index 100%
rename from jena-arq/src-examples/arq/examples/propertyfunction/uppercase.java
rename to 
jena-examples/src/main/java/arq/examples/propertyfunction/uppercase.java
diff --git a/jena-arq/src-examples/arq/examples/riot/ExRIOT1_ReadModel.java 
b/jena-examples/src/main/java/arq/examples/riot/ExRIOT1_ReadModel.java
similarity index 100%
rename from jena-arq/src-examples/arq/examples/riot/ExRIOT1_ReadModel.java
rename to jena-examples/src/main/java/arq/examples/riot/ExRIOT1_ReadModel.java
diff --git a/jena-arq/src-examples/arq/examples/riot/ExRIOT2_ReadDataset.java 
b/jena-examples/src/main/java/arq/examples/riot/ExRIOT2_ReadDataset.java
similarity index 100%
rename from jena-arq/src-examples/arq/examples/riot/ExRIOT2_ReadDataset.java
rename to jena-examples/src/main/java/arq/examples/riot/ExRIOT2_ReadDataset.java
diff --git a/jena-arq/src-examples/arq/examples/riot/ExRIOT3_RDFParser.java 
b/jena-examples/src/main/java/arq/examples/riot/ExRIOT3_RDFParser.java
similarity index 100%
rename from jena-arq/src-examples/arq/examples/riot/ExRIOT3_RDFParser.java
rename to jena-examples/src/main/java/arq/examples/riot/ExRIOT3_RDFParser.java
diff --git 
a/jena-arq/src-examples/arq/examples/riot/ExRIOT4_StreamRDF_Filter.java 
b/jena-examples/src/main/java/arq/examples/riot/ExRIOT4_StreamRDF_Filter.java
similarity index 100%
rename from 
jena-arq/src-examples/arq/examples/riot/ExRIOT4_StreamRDF_Filter.java
rename to 
jena-examples/src/main/java/arq/examples/riot/ExRIOT4_StreamRDF_Filter.java
diff --git 
a/jena-arq/src-examples/arq/examples/riot/ExRIOT5_StreamRDFCollect.java 
b/jena-examples/src/main/java/arq/examples/riot/ExRIOT5_StreamRDFCollect.java
similarity index 100%
rename from 
jena-arq/src-examples/arq/examples/riot/ExRIOT5_StreamRDFCollect.java
rename to 
jena-examples/src/main/java/arq/examples/riot/ExRIOT5_StreamRDFCollect.java
diff --git a/jena-arq/src-examples/arq/examples/riot/ExRIOT6_AddNewReader.java 
b/jena-examples/src/main/java/arq/examples/riot/ExRIOT6_AddNewReader.java
similarity index 100%
rename from jena-arq/src-examples/arq/examples/riot/ExRIOT6_AddNewReader.java
rename to 
jena-examples/src/main/java/arq/examples/riot/ExRIOT6_AddNewReader.java
diff --git a/jena-arq/src-examples/arq/examples/riot/ExRIOT7_AddNewWriter.java 
b/jena-examples/src/main/java/arq/examples/riot/ExRIOT7_AddNewWriter.java
similarity index 100%
rename from jena-arq/src-examples/arq/examples/riot/ExRIOT7_AddNewWriter.java
rename to 
jena-examples/src/main/java/arq/examples/riot/ExRIOT7_AddNewWriter.java
diff --git a/jena-arq/src-examples/arq/examples/riot/ExRIOT8_RelativeURIs.java 
b/jena-examples/src/main/java/arq/examples/riot/ExRIOT8_RelativeURIs.java
similarity index 100%
rename from jena-arq/src-examples/arq/examples/riot/ExRIOT8_RelativeURIs.java
rename to 
jena-examples/src/main/java/arq/examples/riot/ExRIOT8_RelativeURIs.java
diff --git a/jena-arq/src-examples/arq/examples/riot/ExRIOT9_AsyncParser.java 
b/jena-examples/src/main/java/arq/examples/riot/ExRIOT9_AsyncParser.java
similarity index 100%
rename from jena-arq/src-examples/arq/examples/riot/ExRIOT9_AsyncParser.java
rename to jena-examples/src/main/java/arq/examples/riot/ExRIOT9_AsyncParser.java
diff --git 
a/jena-arq/src-examples/arq/examples/riot/ExRIOT_RDFXML_ReaderProperties.java 
b/jena-examples/src/main/java/arq/examples/riot/ExRIOT_RDFXML_ReaderProperties.java
similarity index 100%
rename from 
jena-arq/src-examples/arq/examples/riot/ExRIOT_RDFXML_ReaderProperties.java
rename to 
jena-examples/src/main/java/arq/examples/riot/ExRIOT_RDFXML_ReaderProperties.java
diff --git 
a/jena-arq/src-examples/arq/examples/riot/ExRIOT_RDFXML_WriteProperties.java 
b/jena-examples/src/main/java/arq/examples/riot/ExRIOT_RDFXML_WriteProperties.java
similarity index 100%
rename from 
jena-arq/src-examples/arq/examples/riot/ExRIOT_RDFXML_WriteProperties.java
rename to 
jena-examples/src/main/java/arq/examples/riot/ExRIOT_RDFXML_WriteProperties.java
diff --git a/jena-arq/src-examples/arq/examples/riot/ExRIOT_writeModel.java 
b/jena-examples/src/main/java/arq/examples/riot/ExRIOT_writeModel.java
similarity index 100%
rename from jena-arq/src-examples/arq/examples/riot/ExRIOT_writeModel.java
rename to jena-examples/src/main/java/arq/examples/riot/ExRIOT_writeModel.java
diff --git a/jena-arq/src-examples/arq/examples/riot/ExRIOT_writeRDF.java 
b/jena-examples/src/main/java/arq/examples/riot/ExRIOT_writeRDF.java
similarity index 100%
rename from jena-arq/src-examples/arq/examples/riot/ExRIOT_writeRDF.java
rename to jena-examples/src/main/java/arq/examples/riot/ExRIOT_writeRDF.java
diff --git a/jena-arq/src-examples/arq/examples/riot/Ex_WriteJsonLD.java 
b/jena-examples/src/main/java/arq/examples/riot/Ex_WriteJsonLD.java
similarity index 100%
rename from jena-arq/src-examples/arq/examples/riot/Ex_WriteJsonLD.java
rename to jena-examples/src/main/java/arq/examples/riot/Ex_WriteJsonLD.java
diff --git 
a/jena-arq/src-examples/arq/examples/update/UpdateExecuteOperations.java 
b/jena-examples/src/main/java/arq/examples/update/UpdateExecuteOperations.java
similarity index 100%
rename from 
jena-arq/src-examples/arq/examples/update/UpdateExecuteOperations.java
rename to 
jena-examples/src/main/java/arq/examples/update/UpdateExecuteOperations.java
diff --git a/jena-arq/src-examples/arq/examples/update/UpdateProgrammatic.java 
b/jena-examples/src/main/java/arq/examples/update/UpdateProgrammatic.java
similarity index 100%
rename from jena-arq/src-examples/arq/examples/update/UpdateProgrammatic.java
rename to 
jena-examples/src/main/java/arq/examples/update/UpdateProgrammatic.java
diff --git a/jena-arq/src-examples/arq/examples/update/UpdateReadFromFile.java 
b/jena-examples/src/main/java/arq/examples/update/UpdateReadFromFile.java
similarity index 100%
rename from jena-arq/src-examples/arq/examples/update/UpdateReadFromFile.java
rename to 
jena-examples/src/main/java/arq/examples/update/UpdateReadFromFile.java
diff --git 
a/jena-rdfconnection/src/main/java/org/apache/jena/rdfconnection/examples/RDFConnectionExample1.java
 b/jena-examples/src/main/java/rdfconnection/examples/RDFConnectionExample1.java
similarity index 97%
rename from 
jena-rdfconnection/src/main/java/org/apache/jena/rdfconnection/examples/RDFConnectionExample1.java
rename to 
jena-examples/src/main/java/rdfconnection/examples/RDFConnectionExample1.java
index 81335f2..5d52963 100644
--- 
a/jena-rdfconnection/src/main/java/org/apache/jena/rdfconnection/examples/RDFConnectionExample1.java
+++ 
b/jena-examples/src/main/java/rdfconnection/examples/RDFConnectionExample1.java
@@ -16,7 +16,7 @@
  * limitations under the License.
  */
 
-package org.apache.jena.rdfconnection.examples;
+package rdfconnection.examples;
 
 import org.apache.jena.query.*;
 import org.apache.jena.rdfconnection.RDFConnection;
diff --git 
a/jena-rdfconnection/src/main/java/org/apache/jena/rdfconnection/examples/RDFConnectionExample2.java
 b/jena-examples/src/main/java/rdfconnection/examples/RDFConnectionExample2.java
similarity index 98%
rename from 
jena-rdfconnection/src/main/java/org/apache/jena/rdfconnection/examples/RDFConnectionExample2.java
rename to 
jena-examples/src/main/java/rdfconnection/examples/RDFConnectionExample2.java
index c8412d2..83784b8 100644
--- 
a/jena-rdfconnection/src/main/java/org/apache/jena/rdfconnection/examples/RDFConnectionExample2.java
+++ 
b/jena-examples/src/main/java/rdfconnection/examples/RDFConnectionExample2.java
@@ -16,7 +16,7 @@
  * limitations under the License.
  */
 
-package org.apache.jena.rdfconnection.examples;
+package rdfconnection.examples;
 
 import org.apache.jena.query.*;
 import org.apache.jena.rdfconnection.RDFConnection;
diff --git 
a/jena-rdfconnection/src/main/java/org/apache/jena/rdfconnection/examples/RDFConnectionExample3.java
 b/jena-examples/src/main/java/rdfconnection/examples/RDFConnectionExample3.java
similarity index 97%
rename from 
jena-rdfconnection/src/main/java/org/apache/jena/rdfconnection/examples/RDFConnectionExample3.java
rename to 
jena-examples/src/main/java/rdfconnection/examples/RDFConnectionExample3.java
index 4406a98..34617f0 100644
--- 
a/jena-rdfconnection/src/main/java/org/apache/jena/rdfconnection/examples/RDFConnectionExample3.java
+++ 
b/jena-examples/src/main/java/rdfconnection/examples/RDFConnectionExample3.java
@@ -16,7 +16,7 @@
  * limitations under the License.
  */
 
-package org.apache.jena.rdfconnection.examples;
+package rdfconnection.examples;
 
 import org.apache.jena.query.Query;
 import org.apache.jena.query.QueryFactory;
diff --git 
a/jena-rdfconnection/src/main/java/org/apache/jena/rdfconnection/examples/RDFConnectionExample4.java
 b/jena-examples/src/main/java/rdfconnection/examples/RDFConnectionExample4.java
similarity index 97%
rename from 
jena-rdfconnection/src/main/java/org/apache/jena/rdfconnection/examples/RDFConnectionExample4.java
rename to 
jena-examples/src/main/java/rdfconnection/examples/RDFConnectionExample4.java
index 824bc44..904679e 100644
--- 
a/jena-rdfconnection/src/main/java/org/apache/jena/rdfconnection/examples/RDFConnectionExample4.java
+++ 
b/jena-examples/src/main/java/rdfconnection/examples/RDFConnectionExample4.java
@@ -16,7 +16,7 @@
  * limitations under the License.
  */
 
-package org.apache.jena.rdfconnection.examples;
+package rdfconnection.examples;
 
 import org.apache.jena.query.Query;
 import org.apache.jena.query.QueryFactory;
diff --git 
a/jena-rdfconnection/src/main/java/org/apache/jena/rdfconnection/examples/RDFConnectionExample5.java
 b/jena-examples/src/main/java/rdfconnection/examples/RDFConnectionExample5.java
similarity index 97%
rename from 
jena-rdfconnection/src/main/java/org/apache/jena/rdfconnection/examples/RDFConnectionExample5.java
rename to 
jena-examples/src/main/java/rdfconnection/examples/RDFConnectionExample5.java
index e93d58f..3158125 100644
--- 
a/jena-rdfconnection/src/main/java/org/apache/jena/rdfconnection/examples/RDFConnectionExample5.java
+++ 
b/jena-examples/src/main/java/rdfconnection/examples/RDFConnectionExample5.java
@@ -16,7 +16,7 @@
  * limitations under the License.
  */
 
-package org.apache.jena.rdfconnection.examples;
+package rdfconnection.examples;
 
 import org.apache.jena.query.Query;
 import org.apache.jena.query.QueryFactory;
diff --git 
a/jena-rdfconnection/src/main/java/org/apache/jena/rdfconnection/examples/RDFConnectionExample6.java
 b/jena-examples/src/main/java/rdfconnection/examples/RDFConnectionExample6.java
similarity index 97%
rename from 
jena-rdfconnection/src/main/java/org/apache/jena/rdfconnection/examples/RDFConnectionExample6.java
rename to 
jena-examples/src/main/java/rdfconnection/examples/RDFConnectionExample6.java
index 3778edb..5bb077a 100644
--- 
a/jena-rdfconnection/src/main/java/org/apache/jena/rdfconnection/examples/RDFConnectionExample6.java
+++ 
b/jena-examples/src/main/java/rdfconnection/examples/RDFConnectionExample6.java
@@ -16,7 +16,7 @@
  * limitations under the License.
  */
 
-package org.apache.jena.rdfconnection.examples;
+package rdfconnection.examples;
 
 import org.apache.jena.query.Query;
 import org.apache.jena.query.QueryFactory;
diff --git 
a/jena-shacl/src/main/java/org/apache/jena/shacl/examples/Shacl01_validateGraph.java
 b/jena-examples/src/main/java/shacl/examples/Shacl01_validateGraph.java
similarity index 97%
rename from 
jena-shacl/src/main/java/org/apache/jena/shacl/examples/Shacl01_validateGraph.java
rename to jena-examples/src/main/java/shacl/examples/Shacl01_validateGraph.java
index 36e987b..f4b8e7b 100644
--- 
a/jena-shacl/src/main/java/org/apache/jena/shacl/examples/Shacl01_validateGraph.java
+++ b/jena-examples/src/main/java/shacl/examples/Shacl01_validateGraph.java
@@ -16,7 +16,7 @@
  * limitations under the License.
  */
 
-package org.apache.jena.shacl.examples;
+package shacl.examples;
 
 import org.apache.jena.atlas.logging.LogCtl;
 import org.apache.jena.graph.Graph;
diff --git 
a/jena-shacl/src/main/java/org/apache/jena/shacl/examples/Shacl02_validateTransaction.java
 b/jena-examples/src/main/java/shacl/examples/Shacl02_validateTransaction.java
similarity index 98%
rename from 
jena-shacl/src/main/java/org/apache/jena/shacl/examples/Shacl02_validateTransaction.java
rename to 
jena-examples/src/main/java/shacl/examples/Shacl02_validateTransaction.java
index 467f807..e0c573f 100644
--- 
a/jena-shacl/src/main/java/org/apache/jena/shacl/examples/Shacl02_validateTransaction.java
+++ 
b/jena-examples/src/main/java/shacl/examples/Shacl02_validateTransaction.java
@@ -16,7 +16,7 @@
  * limitations under the License.
  */
 
-package org.apache.jena.shacl.examples;
+package shacl.examples;
 
 import org.apache.jena.atlas.logging.LogCtl;
 import org.apache.jena.graph.Graph;
diff --git 
a/jena-shex/src/main/java/org/apache/jena/shex/examples/Shex01_validateGraph.java
 b/jena-examples/src/main/java/shex/examples/Shex01_validateGraph.java
similarity index 97%
rename from 
jena-shex/src/main/java/org/apache/jena/shex/examples/Shex01_validateGraph.java
rename to jena-examples/src/main/java/shex/examples/Shex01_validateGraph.java
index ea42c54..7ece36f 100644
--- 
a/jena-shex/src/main/java/org/apache/jena/shex/examples/Shex01_validateGraph.java
+++ b/jena-examples/src/main/java/shex/examples/Shex01_validateGraph.java
@@ -16,7 +16,7 @@
  * limitations under the License.
  */
 
-package org.apache.jena.shex.examples;
+package shex.examples;
 
 import org.apache.jena.atlas.logging.LogCtl;
 import org.apache.jena.graph.Graph;
diff --git 
a/jena-shex/src/main/java/org/apache/jena/shex/examples/Shex02_validateNode.java
 b/jena-examples/src/main/java/shex/examples/Shex02_validateNode.java
similarity index 98%
rename from 
jena-shex/src/main/java/org/apache/jena/shex/examples/Shex02_validateNode.java
rename to jena-examples/src/main/java/shex/examples/Shex02_validateNode.java
index 20f9253..814266a 100644
--- 
a/jena-shex/src/main/java/org/apache/jena/shex/examples/Shex02_validateNode.java
+++ b/jena-examples/src/main/java/shex/examples/Shex02_validateNode.java
@@ -16,7 +16,7 @@
  * limitations under the License.
  */
 
-package org.apache.jena.shex.examples;
+package shex.examples;
 
 import org.apache.jena.atlas.logging.LogCtl;
 import org.apache.jena.graph.Graph;
diff --git 
a/jena-shex/src/main/java/org/apache/jena/shex/examples/Shex03_validate.java 
b/jena-examples/src/main/java/shex/examples/Shex03_validate.java
similarity index 98%
rename from 
jena-shex/src/main/java/org/apache/jena/shex/examples/Shex03_validate.java
rename to jena-examples/src/main/java/shex/examples/Shex03_validate.java
index 639a5f3..543d545 100644
--- a/jena-shex/src/main/java/org/apache/jena/shex/examples/Shex03_validate.java
+++ b/jena-examples/src/main/java/shex/examples/Shex03_validate.java
@@ -16,7 +16,7 @@
  * limitations under the License.
  */
 
-package org.apache.jena.shex.examples;
+package shex.examples;
 
 import org.apache.jena.atlas.logging.LogCtl;
 import org.apache.jena.graph.Graph;
diff --git a/jena-tdb/src-examples/tdb/examples/ExQuadFilter.java 
b/jena-examples/src/main/java/tdb1/examples/ExQuadFilter.java
similarity index 99%
rename from jena-tdb/src-examples/tdb/examples/ExQuadFilter.java
rename to jena-examples/src/main/java/tdb1/examples/ExQuadFilter.java
index 95357b8..1bed06e 100644
--- a/jena-tdb/src-examples/tdb/examples/ExQuadFilter.java
+++ b/jena-examples/src/main/java/tdb1/examples/ExQuadFilter.java
@@ -16,7 +16,7 @@
  * limitations under the License.
  */
 
-package tdb.examples;
+package tdb1.examples;
 
 import java.util.function.Predicate;
 
diff --git a/jena-tdb/src-examples/tdb/examples/ExTDB1.java 
b/jena-examples/src/main/java/tdb1/examples/ExTDB1.java
similarity index 98%
rename from jena-tdb/src-examples/tdb/examples/ExTDB1.java
rename to jena-examples/src/main/java/tdb1/examples/ExTDB1.java
index 2ca34d3..cc28c6e 100644
--- a/jena-tdb/src-examples/tdb/examples/ExTDB1.java
+++ b/jena-examples/src/main/java/tdb1/examples/ExTDB1.java
@@ -16,7 +16,7 @@
  * limitations under the License.
  */
 
-package tdb.examples;
+package tdb1.examples;
 
 import org.apache.jena.query.Dataset ;
 import org.apache.jena.rdf.model.Model;
diff --git a/jena-tdb/src-examples/tdb/examples/ExTDB2.java 
b/jena-examples/src/main/java/tdb1/examples/ExTDB2.java
similarity index 98%
rename from jena-tdb/src-examples/tdb/examples/ExTDB2.java
rename to jena-examples/src/main/java/tdb1/examples/ExTDB2.java
index 9548ccf..ac5d86b 100644
--- a/jena-tdb/src-examples/tdb/examples/ExTDB2.java
+++ b/jena-examples/src/main/java/tdb1/examples/ExTDB2.java
@@ -16,7 +16,7 @@
  * limitations under the License.
  */
 
-package tdb.examples;
+package tdb1.examples;
 
 import org.apache.jena.query.Dataset ;
 import org.apache.jena.tdb.TDBFactory ;
diff --git a/jena-tdb/src-examples/tdb/examples/ExTDB3.java 
b/jena-examples/src/main/java/tdb1/examples/ExTDB3.java
similarity index 99%
rename from jena-tdb/src-examples/tdb/examples/ExTDB3.java
rename to jena-examples/src/main/java/tdb1/examples/ExTDB3.java
index 43c6173..1d0699b 100644
--- a/jena-tdb/src-examples/tdb/examples/ExTDB3.java
+++ b/jena-examples/src/main/java/tdb1/examples/ExTDB3.java
@@ -16,7 +16,7 @@
  * limitations under the License.
  */
 
-package tdb.examples;
+package tdb1.examples;
 
 import org.apache.jena.riot.RDFDataMgr ;
 
diff --git a/jena-tdb/src-examples/tdb/examples/ExTDB4.java 
b/jena-examples/src/main/java/tdb1/examples/ExTDB4.java
similarity index 98%
rename from jena-tdb/src-examples/tdb/examples/ExTDB4.java
rename to jena-examples/src/main/java/tdb1/examples/ExTDB4.java
index af7dfd3..5e3ae0a 100644
--- a/jena-tdb/src-examples/tdb/examples/ExTDB4.java
+++ b/jena-examples/src/main/java/tdb1/examples/ExTDB4.java
@@ -16,7 +16,7 @@
  * limitations under the License.
  */
 
-package tdb.examples;
+package tdb1.examples;
 
 import org.apache.jena.query.Dataset ;
 import org.apache.jena.query.Query ;
diff --git a/jena-tdb/src-examples/tdb/examples/ExTDB5.java 
b/jena-examples/src/main/java/tdb1/examples/ExTDB5.java
similarity index 99%
rename from jena-tdb/src-examples/tdb/examples/ExTDB5.java
rename to jena-examples/src/main/java/tdb1/examples/ExTDB5.java
index 2b8df5c..c005327 100644
--- a/jena-tdb/src-examples/tdb/examples/ExTDB5.java
+++ b/jena-examples/src/main/java/tdb1/examples/ExTDB5.java
@@ -16,7 +16,7 @@
  * limitations under the License.
  */
 
-package tdb.examples;
+package tdb1.examples;
 
 import org.apache.jena.query.Dataset;
 import org.apache.jena.query.Query;
diff --git a/jena-tdb/src-examples/tdb/examples/ExTDB6.java 
b/jena-examples/src/main/java/tdb1/examples/ExTDB6.java
similarity index 99%
rename from jena-tdb/src-examples/tdb/examples/ExTDB6.java
rename to jena-examples/src/main/java/tdb1/examples/ExTDB6.java
index ec69c13..e91d33d 100644
--- a/jena-tdb/src-examples/tdb/examples/ExTDB6.java
+++ b/jena-examples/src/main/java/tdb1/examples/ExTDB6.java
@@ -16,7 +16,7 @@
  * limitations under the License.
  */
 
-package tdb.examples;
+package tdb1.examples;
 
 import static java.lang.System.out ;
 
diff --git a/jena-tdb/src-examples/tdb/examples/ExTDB_Txn1.java 
b/jena-examples/src/main/java/tdb1/examples/ExTDB_Txn1.java
similarity index 99%
rename from jena-tdb/src-examples/tdb/examples/ExTDB_Txn1.java
rename to jena-examples/src/main/java/tdb1/examples/ExTDB_Txn1.java
index 4c4a2fa..326103e 100644
--- a/jena-tdb/src-examples/tdb/examples/ExTDB_Txn1.java
+++ b/jena-examples/src/main/java/tdb1/examples/ExTDB_Txn1.java
@@ -16,7 +16,7 @@
  * limitations under the License.
  */
 
-package tdb.examples;
+package tdb1.examples;
 
 import org.apache.jena.query.*;
 import org.apache.jena.system.Txn;
diff --git a/jena-tdb/src-examples/tdb/examples/ExTDB_Txn2.java 
b/jena-examples/src/main/java/tdb1/examples/ExTDB_Txn2.java
similarity index 99%
rename from jena-tdb/src-examples/tdb/examples/ExTDB_Txn2.java
rename to jena-examples/src/main/java/tdb1/examples/ExTDB_Txn2.java
index 3b74518..9af316f 100644
--- a/jena-tdb/src-examples/tdb/examples/ExTDB_Txn2.java
+++ b/jena-examples/src/main/java/tdb1/examples/ExTDB_Txn2.java
@@ -16,7 +16,7 @@
  * limitations under the License.
  */
 
-package tdb.examples;
+package tdb1.examples;
 
 import org.apache.jena.atlas.lib.StrUtils;
 import org.apache.jena.query.Dataset;
diff --git a/jena-tdb/src-examples/tdb/examples/ExTDB_Txn3.java 
b/jena-examples/src/main/java/tdb1/examples/ExTDB_Txn3.java
similarity index 99%
rename from jena-tdb/src-examples/tdb/examples/ExTDB_Txn3.java
rename to jena-examples/src/main/java/tdb1/examples/ExTDB_Txn3.java
index 93f377b..a2710d1 100644
--- a/jena-tdb/src-examples/tdb/examples/ExTDB_Txn3.java
+++ b/jena-examples/src/main/java/tdb1/examples/ExTDB_Txn3.java
@@ -16,7 +16,7 @@
  * limitations under the License.
  */
 
-package tdb.examples;
+package tdb1.examples;
 
 import org.apache.jena.query.*;
 import org.apache.jena.sparql.core.DatasetGraph;
diff --git a/jena-tdb/src/main/java/org/apache/jena/tdb/sys/SystemTDB.java 
b/jena-tdb/src/main/java/org/apache/jena/tdb/sys/SystemTDB.java
index 4c13d55..d8d9b99 100644
--- a/jena-tdb/src/main/java/org/apache/jena/tdb/sys/SystemTDB.java
+++ b/jena-tdb/src/main/java/org/apache/jena/tdb/sys/SystemTDB.java
@@ -42,42 +42,42 @@ import org.slf4j.LoggerFactory ;
 public class SystemTDB
 {
     static { JenaSystem.init(); }
-    
+
     // NB Same logger as the TDB class because this class is the system info 
but kept out of TDB javadoc.
-    // It's visibility is TDB, not really public. 
+    // It's visibility is TDB, not really public.
     private static final Logger log = LoggerFactory.getLogger(TDB.class) ;
-    
+
     /** TDB System log - use for general messages (a few) and warnings.
      *  Generally, do not log events unless you want every user to see them 
every time.
      *  TDB is an embedded database - libraries and embedded systems should be 
seen and not heard.
-     *  @see #errlog 
+     *  @see #errlog
      */
     // This was added quite late in TDB so need to check it's used 
appropriately - check for Log.*
     public static final Logger syslog = LoggerFactory.getLogger(TDB.class) ;
     /** Send warnings and error */
     public static final Logger errlog = LoggerFactory.getLogger(TDB.class) ;
-    
-    // ---- Constants that can't be changed without invalidating on-disk data. 
 
-    
+
+    // ---- Constants that can't be changed without invalidating on-disk data.
+
     /** Size, in bytes, of a Java long */
     public static final int SizeOfLong              = Long.SIZE/Byte.SIZE ;
-    
+
     /** Size, in bytes, of a Java int */
     public static final int SizeOfInt               = Integer.SIZE/Byte.SIZE ;
-    
+
     /** Size, in bytes, of the persistent representation of a node id */
     public static final int SizeOfNodeId            = NodeId.SIZE ;
 
     /** Size, in bytes, of a pointer between blocks */
     public static final int SizeOfPointer           = SizeOfInt ;
-    
+
     // ---- Node table related
-    
+
     /** Size, in bytes, of a triple index record. */
     public static final int LenIndexTripleRecord    = 3 * NodeId.SIZE ;
     /** Size, in bytes, of a quad index record. */
     public static final int LenIndexQuadRecord      = 4 * NodeId.SIZE ;
-    
+
     /** Size, in bytes, of a Node hash.
      * In TDB 0.7.X and before this was 8 bytes (64/8).
      * In TDB 0.8.0 and above it is 16 bytes (128/8).
@@ -87,7 +87,7 @@ public class SystemTDB
     public static final int LenNodeHash             = 128/8 ; // TDB >= 0.8.0
 
     // ---- Symbols and similar
-    
+
     // ---- Record factories
     public final static RecordFactory indexRecordTripleFactory = new 
RecordFactory(LenIndexTripleRecord, 0) ;
     public final static RecordFactory indexRecordQuadFactory = new 
RecordFactory(LenIndexQuadRecord, 0) ;
@@ -102,19 +102,19 @@ public class SystemTDB
     /** Root of TDB-defined parameter names */
     public static final String symbolNamespace      = 
"http://jena.hpl.hp.com/TDB#"; ;
 
-    /** Root of TDB-defined parameter short names */  
+    /** Root of TDB-defined parameter short names */
     public static final String tdbSymbolPrefix      = "tdb" ;
 
-    /** Root of TDB-defined parameter short names, alternate name */  
+    /** Root of TDB-defined parameter short names, alternate name */
     public static final String tdbSymbolPrefix1     = "tdb1" ;
 
-    /** Root of any TDB-defined Java system properties */   
+    /** Root of any TDB-defined Java system properties */
     public static final String tdbPropertyRoot      = "org.apache.jena.tdb" ;
 
     /** Log duplicates during loading */
     public static final Symbol symLogDuplicates     = 
allocSymbol("logDuplicates") ;
 
-    /** File mode : one of "direct", "mapped", "default" */ 
+    /** File mode : one of "direct", "mapped", "default" */
     public static final Symbol symFileMode          = allocSymbol("fileMode") ;
 
     /** Index type */
@@ -132,7 +132,7 @@ public class SystemTDB
         if ( propertyFileName == null )
             propertyFileName = System.getProperty(propertyFileKey2) ;
     }
-    
+
     public static final boolean is64bitSystem = determineIf64Bit() ;
 
     private static Properties properties = readPropertiesFile() ;
@@ -151,14 +151,14 @@ public class SystemTDB
 
     /** order of an in-memory BTree or B+Tree */
     public static final int OrderMem                = 5 ; // 
intValue("OrderMem", 5) ;
-    
+
     /** Size, in bytes, of a segment (used for memory mapped files) */
     public static final int SegmentSize             = 8*1024*1024 ; // 
intValue("SegmentSize", 8*1024*1024) ;
-    
+
     // ---- Cache sizes (within the JVM)
-    
+
     public static final int ObjectFileWriteCacheSize = 8*1024 ;
-    
+
     /** Size of Node to NodeId cache.
      *  Used to map from Node to NodeId spaces.
      *  Used for loading and for query preparation.
@@ -170,18 +170,18 @@ public class SystemTDB
      *  Used for retriveing results.
      */
     public static final int NodeId2NodeCacheSize    = 
intValue("NodeId2NodeCacheSize", ( is64bitSystem ? 500*1000 : 50*1000 ) ) ;
-    
+
     /** Size of Node lookup miss cache. */
     public static final int NodeMissCacheSize       = 100 ;
-    
+
     /** Size of the delayed-write block cache (32 bit systems only) (per file) 
*/
     public static final int BlockWriteCacheSize     = 
intValue("BlockWriteCacheSize", 2*1000) ;
 
     /** Size of read block cache (32 bit systems only).  Increase JVM size as 
necessary. Per file. */
     public static final int BlockReadCacheSize      = 
intValue("BlockReadCacheSize", 10*1000) ;
-    
+
     // ---- Misc
-    
+
 //    /** Number of adds/deletes between calls to sync (-ve to disable) */
 //    public static final int SyncTick                = intValue("SyncTick", 
-1) ;
 
@@ -189,34 +189,34 @@ public class SystemTDB
     public static ReorderTransformation defaultReorderTransform = 
ReorderLib.fixed() ;
 
     public static final ByteOrder NetworkOrder      = ByteOrder.BIG_ENDIAN ;
-    
-    /** Unsupported (for non-standard setups) 
+
+    /** Unsupported (for non-standard setups)
      * @see #enableInlineLiterals
      */
     public static String propertyEnableInlineLiterals1 = 
"org.apache.jena.tdb.store.enableInlineLiterals" ;
-    /** Unsupported (for non-standard setups) 
+    /** Unsupported (for non-standard setups)
      * @see #enableInlineLiterals
      */
     public static String propertyEnableInlineLiterals2 = 
"tdb:store.enableInlineLiterals" ;
     /** <b>Unsupported</b> (for non-standard setups).
      * This controls whether literal values are inlined into NodeIds.
      * This is a major efficiency boost and is the default setting.
-     * It can be set false with {@code 
-Dtdb:store.enableInlineLiterals=false}. 
+     * It can be set false with {@code -Dtdb:store.enableInlineLiterals=false}.
      * Do not mix databases created with this set to different values.
      * Chaos and incorrect results will result.
-     * Use with care. No support. 
-     * Default setting is {@code true}   
+     * Use with care. No support.
+     * Default setting is {@code true}
      */
     public static final boolean enableInlineLiterals ;
     static { // Set enableInlineLiterals from system properties.
         Properties sysProperties = System.getProperties() ;
-        String key = null ; 
+        String key = null ;
         if ( sysProperties.containsKey(propertyEnableInlineLiterals1) )
             key = propertyFileKey1 ;
         else if ( sysProperties.containsKey(propertyEnableInlineLiterals2) )
             key = propertyFileKey2 ;
         if ( key == null )
-            enableInlineLiterals = true ;  // Normal value. 
+            enableInlineLiterals = true ;  // Normal value.
         else
             enableInlineLiterals = 
Boolean.valueOf(sysProperties.getProperty(key)) ;
     }
@@ -224,18 +224,18 @@ public class SystemTDB
 //    public static void setNullOut(boolean nullOut)
 //    { SystemTDB.NullOut = nullOut ; }
 //
-//    /** Are we nulling out unused space in bytebuffers (records, points etc) 
*/ 
+//    /** Are we nulling out unused space in bytebuffers (records, points etc) 
*/
 //    public static boolean getNullOut()
 //    { return SystemTDB.NullOut ; }
 
     /** null out (with the FillByte) freed up space in buffers */
     public static boolean NullOut = false ;
-    
+
     /** FillByte value for NullOut */
     public static final byte FillByte = (byte)0xFF ;
 
     public static boolean Checking = false ;       // This isn't used enough!
-    
+
     /**
      * New feature introduced by JENA-648 to help prevent one common cause of 
TDB corruption.
      * <p>
@@ -247,29 +247,29 @@ public class SystemTDB
 
     // BDB related.
     //public static final int BDB_cacheSizePercent    = 
intValue("BDB_cacheSizePercent", 75) ;
-    
+
     public static void panic(Class<?> clazz, String string)
     {
         Log.error(clazz, string) ;
         throw new TDBException(string) ;
     }
-    
+
     public static Symbol allocSymbol(String shortName)
-    { 
-        if ( shortName.startsWith(SystemTDB.tdbSymbolPrefix)) 
+    {
+        if ( shortName.startsWith(SystemTDB.tdbSymbolPrefix))
             throw new TDBException("Symbol short name begins with the TDB 
namespace prefix: "+shortName) ;
-        if ( shortName.startsWith("http:")) 
+        if ( shortName.startsWith("http:"))
             throw new TDBException("Symbol short name begins with http: 
"+shortName) ;
         return allocSymbol(SystemTDB.symbolNamespace, shortName) ;
     }
-    
+
     private static Symbol allocSymbol(String namespace, String shortName)
     {
         return Symbol.create(namespace+shortName) ;
     }
-    
+
     // ----
-    
+
     private static int intValue(String prefix, String name, int defaultValue)
     {
         if ( ! prefix.endsWith(".") )
@@ -278,18 +278,18 @@ public class SystemTDB
             name = prefix+name ;
         return intValue(name, defaultValue) ;
     }
-    
+
     private static int intValue(String name, int defaultValue)
     {
         if ( name == null ) return defaultValue ;
         if ( name.length() == 0 ) throw new TDBException("Empty string for 
value name") ;
-        
+
         if ( properties == null )
             return defaultValue ;
 
         String x = properties.getProperty(name) ;
         if ( x == null )
-            return defaultValue ; 
+            return defaultValue ;
         TDB.logInfo.info("Set: "+name+" = "+x) ;
         int v = Integer.parseInt(x) ;
         return v ;
@@ -299,14 +299,14 @@ public class SystemTDB
     {
         if ( propertyFileName == null )
             return null ;
-        
+
         Properties p = new Properties() ;
         try
         {
             TDB.logInfo.info("Using properties from '"+propertyFileName+"'") ;
             PropertyUtils.loadFromFile(p, propertyFileName) ;
         } catch (FileNotFoundException ex)
-        { 
+        {
             log.debug("No system properties file ("+propertyFileName+")") ;
             return null ;
         } catch (IOException ex) { IO.exception(ex) ; }
@@ -314,13 +314,13 @@ public class SystemTDB
     }
 
     // --------
-    
+
     public static final boolean isWindows = determineIfWindows() ;     // 
Memory mapped files behave differently.
 
     //Or look in File.listRoots.
     //Alternative method:
     //  
http://stackoverflow.com/questions/1293533/name-of-the-operating-system-in-java-not-os-name
-    
+
     private static boolean determineIfWindows() {
        String s = System.getProperty("os.name") ;
        if ( s == null )
@@ -333,7 +333,7 @@ public class SystemTDB
         String s = System.getProperty("sun.arch.data.model") ;
         if ( s != null )
         {
-            boolean b = s.equals("64") ; 
+            boolean b = s.equals("64") ;
             TDB.logInfo.debug("System architecture: "+(b?"64 bit":"32 bit")) ;
             return b ;
         }
@@ -342,19 +342,19 @@ public class SystemTDB
         if ( s == null )
         {
             log.warn("Can't determine the data model") ;
-            return false ;    
+            return false ;
         }
         log.debug("Can't determine the data model from 'sun.arch.data.model' - 
using java.vm.info") ;
         boolean b = s.contains("64") ;
         TDB.logInfo.debug("System architecture: (from java.vm.info) "+(b?"64 
bit":"32 bit")) ;
         return b ;
     }
-    
+
     // ---- File mode
-    
+
     private static FileMode fileMode = null ;
     public static FileMode fileMode()
-    { 
+    {
         if ( fileMode == null )
             fileMode = determineFileMode() ;
         return fileMode ;
@@ -369,18 +369,18 @@ public class SystemTDB
         }
         fileMode = newFileMode ;
     }
-    
+
     // So the test suite can setup thing up ... very carefully.
     /*package*/ static void internalSetFileMode(FileMode newFileMode)
     {
         fileMode = newFileMode ;
     }
-    
+
     private static FileMode determineFileMode()
     {
         // Be careful that this is not called very, very early, before --set 
might be seen.
         // Hence delayed access above in fileMode().
-        
+
         String x = ARQ.getContext().getAsString(SystemTDB.symFileMode, 
"default") ;
 
         if ( x.equalsIgnoreCase("direct") )
@@ -393,7 +393,7 @@ public class SystemTDB
             TDB.logInfo.info("File mode: mapped (forced)") ;
             return FileMode.mapped ;
         }
-        
+
         if ( x.equalsIgnoreCase("default") )
         {
             if ( is64bitSystem )

Reply via email to