Repository: apache/jena
Issue: Fuseki/webapp writes the configuration file with unnecessary additional triples

### Version

4.7.0

### What happened?

When a new database is created in the UI, the configuration file is written to `run/configuration/<nbame>.ttl`. This contains the instantiated template but also additional triples (system definitions, some RDF statements). The latter are unnecessary.

### Relevant output and stacktrace

_No response_

### Are you interested in making a pull request?

Yes

Changed files:
jena-fuseki2/jena-fuseki-webapp/src/test/java/org/apache/jena/fuseki/AbstractTestWebappAuth_JDK.java
jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/mgt/ActionDatasets.java
jena-fuseki2/jena-fuseki-webapp/src/test/java/org/apache/jena/fuseki/TS_FusekiWebapp.java

diff --git a/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/mgt/ActionDatasets.java b/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/mgt/ActionDatasets.java
index f7c6a4b176..ef08684388 100644
--- a/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/mgt/ActionDatasets.java
+++ b/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/mgt/ActionDatasets.java
@@ -141,8 +141,8 @@ public class ActionDatasets extends ActionContainerItem {
 
         try {
             // Where to build the templated service/database.
-            Model model = ModelFactory.createDefaultModel();
-            StreamRDF dest = StreamRDFLib.graph(model.getGraph());
+            Model modelData = ModelFactory.createDefaultModel();
+            StreamRDF dest = StreamRDFLib.graph(modelData.getGraph());
 
             if ( hasParams || WebContent.isHtmlForm(ct) )
                 assemblerFromForm(action, dest);
@@ -151,6 +151,8 @@ public class ActionDatasets extends ActionContainerItem {
             else
                 assemblerFromBody(action, dest);
 
+            Model model = ModelFactory.createDefaultModel();
+            model.add(modelData);
             AssemblerUtils.addRegistered(model);
 
             // ----
@@ -158,7 +160,7 @@ public class ActionDatasets extends ActionContainerItem {
             // anything other than being "for the record".
             systemFileCopy = FusekiWebapp.dirSystemFileArea.resolve(uuid.toString()).toString();
             try ( OutputStream outCopy = IO.openOutputFile(systemFileCopy) ) {
-                RDFDataMgr.write(outCopy, model, Lang.TURTLE);
+                RDFDataMgr.write(outCopy, modelData, Lang.TURTLE);
             }
             // ----
             // Process configuration.
@@ -202,7 +204,7 @@ public class ActionDatasets extends ActionContainerItem {
 
             // Write to configuration directory.
             try ( OutputStream outCopy = IO.openOutputFile(configFile) ) {
-                RDFDataMgr.write(outCopy, model, Lang.TURTLE);
+                RDFDataMgr.write(outCopy, modelData, Lang.TURTLE);
             }
 
             // Currently do nothing with the system database.
@@ -538,8 +540,6 @@ public class ActionDatasets extends ActionContainerItem {
         return stmt;
     }
 
-    // TODO Merge with Upload.incomingData
-
     private static void bodyAsGraph(HttpAction action, StreamRDF dest) {
         HttpServletRequest request = action.getRequest();
         String base = ActionLib.wholeRequestURL(request);
@@ -549,18 +549,6 @@ public class ActionDatasets extends ActionContainerItem {
             ServletOps.errorBadRequest("Unknown content type for triples: " + ct);
             return;
         }
-        // Don't log - assemblers are typically small.
-        // Adding this to the log confuses things.
-        // Reserve logging for data uploads.
-//        long len = request.getContentLengthLong();
-//        if ( action.verbose ) {
-//            if ( len >= 0 )
-//                alog.info(format("[%d]   Body: Content-Length=%d, Content-Type=%s, Charset=%s => %s", action.id, len,
-//                                ct.getContentType(), ct.getCharset(), lang.getName()));
-//            else
-//                alog.info(format("[%d]   Body: Content-Type=%s, Charset=%s => %s", action.id, ct.getContentType(),
-//                                ct.getCharset(), lang.getName()));
-//        }
         dest.prefix("root", base+"#");
         ActionLib.parseOrError(action, dest, lang, base);
     }
diff --git a/jena-fuseki2/jena-fuseki-webapp/src/test/java/org/apache/jena/fuseki/AbstractTestWebappAuth_JDK.java b/jena-fuseki2/jena-fuseki-webapp/src/test/java/org/apache/jena/fuseki/AbstractTestWebappAuth_JDK.java
index 6758061207..c1b4255042 100644
--- a/jena-fuseki2/jena-fuseki-webapp/src/test/java/org/apache/jena/fuseki/AbstractTestWebappAuth_JDK.java
+++ b/jena-fuseki2/jena-fuseki-webapp/src/test/java/org/apache/jena/fuseki/AbstractTestWebappAuth_JDK.java
@@ -47,7 +47,7 @@ public class AbstractTestWebappAuth_JDK {
     protected static final String authServiceREST   = "http://localhost:"+authPort+authDatasetPath+"/data";
     private static File realmFile;
 
-    private static final String FusekiTestHome = "target/FusekiHome";
+    private static final String FusekiTestHome = "target/FusekiTest";
     private static final String FusekiTestBase = FusekiTestHome+"/run";
 
     // False when in TS_FusekiWebapp
diff --git a/jena-fuseki2/jena-fuseki-webapp/src/test/java/org/apache/jena/fuseki/TS_FusekiWebapp.java b/jena-fuseki2/jena-fuseki-webapp/src/test/java/org/apache/jena/fuseki/TS_FusekiWebapp.java
index d412c05352..86ff041b6e 100644
--- a/jena-fuseki2/jena-fuseki-webapp/src/test/java/org/apache/jena/fuseki/TS_FusekiWebapp.java
+++ b/jena-fuseki2/jena-fuseki-webapp/src/test/java/org/apache/jena/fuseki/TS_FusekiWebapp.java
@@ -42,7 +42,7 @@ import org.junit.runners.Suite;
 
 public class TS_FusekiWebapp extends ServerTest
 {
-    public static String FusekiTestHome = "target/FusekiHome";
+    public static String FusekiTestHome = "target/FusekiTest";
     public static String FusekiTestBase = FusekiTestHome+"/run";
 
     @BeforeClass public static void setupForFusekiServer() {