I have a Fuseki server running in my local Windows 11 Docker Desktop.
To load ttl files from java I am following https://jena.apache.org/documentation/rdfconnection/
which gives me code
String localFile = "mdworking.ttl";
ZzzHelperFile.saveStringToFile(myTttString, localFile);
String serviceURL = "http://localhost:3030/mdtest/";
RDFConnectionRemoteBuilder builder = RDFConnectionFuseki.create()
.destination(serviceURL);
RDFConnectionFuseki conn = (RDFConnectionFuseki) builder.build();
{
conn.load(localFile) ;
conn.querySelect("SELECT DISTINCT ?s { ?s ?p ?o }", (qs) -> {
Resource subject = qs.getResource("s") ;
System.out.println("Subject: " + subject) ;
}) ;
}
The output is what I would expect, the list of my Subject.
The Fuseki service output in Docker does not seem unreasonable, (although I dont know what ?default is):
2023-07-03 17:02:27 16:02:27 INFO Fuseki :: [96] POST http://localhost:3030/mdtest/?default
2023-07-03 17:02:27 16:02:27 INFO Fuseki :: [96] Body: Content-Length=117, Content-Type=text/turtle, Charset=UTF-8 => Turtle : Count=4 Triples=4 Quads=0
2023-07-03 17:02:27 16:02:27 INFO Fuseki :: [96] 200 OK (80 ms)
2023-07-03 17:02:28 16:02:28 INFO Fuseki :: [97] GET http://localhost:3030/mdtest/?query=SELECT+DISTINCT+%3Fs+%7B+%3Fs+%3Fp+%3Fo+%7D
2023-07-03 17:02:28 16:02:28 INFO Fuseki :: [97] Query = SELECT DISTINCT ?s { ?s ?p ?o }
2023-07-03 17:02:28 16:02:28 INFO Fuseki :: [97] 200 OK (28 ms)
But then I go to the Fuseki front end my triples are not there in the mdtest dataset.
What I can find at http://localhost:3030/mdtest/?default in the browser are my test triples
@prefix : <http://www.oxfordsemantic.tech/Turtle/> .
:crush a :turtle ;
:eats :coral ;
:enjoys :swimming ;
:is :cool .
If I change the name of mdtest to something that is not a Fuseki dataset then my code throws a not found exception.
Why are my triples not in the Fuseki mdtest dataset that I can see from the Fuseki UI?
Docker image:
ENV FUSEKI_VERSION=4.2.0
POM
<dependency>
<groupId>org.apache.jena</groupId>
<artifactId>jena-arq</artifactId>
<version>4.2.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.jena/jena-rdfconnection -->
<dependency>
<groupId>org.apache.jena</groupId>
<artifactId>jena-rdfconnection</artifactId>
<version>4.2.0</version>
</dependency>
The issue is the use of tdb2:unionDefaultGraph
.
The union is a view of triples in the named graphs - the default graph is not a named graph.
An update goes to the real storage, not the union view. It goes to the real storage default graph.
If you send the RDFConnection.load(graph name, filename)
operation to a named graph, the triples will appear to a query.