Re: Problems when querying the SPARQL with Jena
Shouldn't also 1.8 1.8 be a minimum of 17 given the Jena version 5.0.0-rc1? Best regards, Øyvind On Tue, Mar 12, 2024, 14:54 Andy Seaborne wrote: > > > On 12/03/2024 13:02, Anna P wrote: > > Hi Lorenz, > > Thank you for your reply. Yes, I used maven to build the project. Here > are > > dependencies details: > > Hi Lorenz, > > > > Yes, I used maven to build the project. Here are the dependencies > details: > > > > UTF-8 > > 1.8 > > 1.8 > > > > > > > > > > junit > > junit > > 4.11 > > test > > > > > > org.apache.jena > > apache-jena-libs > > > > pom > > > > > > org.apache.maven.plugins > > maven-assembly-plugin > > Is that creating a jar file to run? > > The assembly plugin does not manage Java's service loader files. Either > it needs doing in some way and put into the assembled jar. > > There is the shade plugin that manages combined service loader files > more easily: > > https://jena.apache.org/documentation/notes/jena-repack.html > > This is how the combined jar jena-fuseki-server is built: > > > https://github.com/apache/jena/blob/main/jena-fuseki2/jena-fuseki-server/pom.xml#L87-L138 > > Andy > > > 3.6.0 > > maven-plugin > > > > > > > > Best regards, > > Pan > > > > On Tue, Mar 12, 2024 at 7:13 AM Lorenz Buehmann < > > buehm...@informatik.uni-leipzig.de> wrote: > > > >> Hi, > >> > >> how did you setup your project? Which Jena version? Do you use Maven? > >> Which dependencies? It looks like ARQ.init() hasn't been called which > >> should happen automatically if the setup of the project is correct. > >> > >> > >> Cheers, > >> Lorenz > >> > >> On 11.03.24 14:44, Anna P wrote: > >>> Dear Jena support team, > >>> > >>> Currently I just started to work on a SPARQL project using Jena and I > >> could > >>> not get a solution when I query a model. > >>> I imported a turtle file and ran a simple query, and the snippet code > is > >>> shown below. However, I got the error. > >>> > >>> public class App { > >>> public static void main(String[] args) { > >>> try { > >>> Model model = RDFDataMgr.loadModel('data.ttl', > Lang.TURTLE); > >>> RDFDataMgr.write(System.out, model, Lang.TURTLE); > >>> String queryString = "SELECT * { ?s ?p ?o }"; > >>> Query query = QueryFactory.create(queryString); > >>> QueryExecution qe = QueryExecutionFactory.create(query, > >> model); > >>> ResultSet results = qe.execSelect(); > >>> ResultSetFormatter.out(System.out, results, query); > >>> qe.close(); > >>> } catch (Exception e) { > >>> e.printStackTrace(); > >>> } > >>> } > >>> } > >>> > >>> Here is the error message: > >>> > >>> org.apache.jena.riot.RiotException: Not registered as a SPARQL result > set > >>> output syntax: Lang:SPARQL-Results-JSON > >>> at > >>> > >> > org.apache.jena.sparql.resultset.ResultsWriter.write(ResultsWriter.java:179) > >>> at > >>> > >> > org.apache.jena.sparql.resultset.ResultsWriter.write(ResultsWriter.java:156) > >>> at > >>> > >> > org.apache.jena.sparql.resultset.ResultsWriter.write(ResultsWriter.java:149) > >>> at > >>> > >> > org.apache.jena.sparql.resultset.ResultsWriter$Builder.write(ResultsWriter.java:96) > >>> at > >>> > >> > org.apache.jena.query.ResultSetFormatter.output(ResultSetFormatter.java:308) > >>> at > >>> > >> > org.apache.jena.query.ResultSetFormatter.outputAsJSON(ResultSetFormatter.java:516) > >>> at de.unistuttgart.ki.esparql.App.main(App.java:46) > >>> > >>> > >>> Thank you for your time and help! > >>> > >>> Best regards, > >>> > >>> Pan > >>> > >> -- > >> Lorenz Bühmann > >> Research Associate/Scientific Developer > >> > >> Email buehm...@infai.org > >> > >> Institute for Applied Informatics e.V. (InfAI) | Goerdelerring 9 | 04109 > >> Leipzig | Germany > >> > >> > > >
Re: Problems when querying the SPARQL with Jena
On 12/03/2024 13:02, Anna P wrote: Hi Lorenz, Thank you for your reply. Yes, I used maven to build the project. Here are dependencies details: Hi Lorenz, Yes, I used maven to build the project. Here are the dependencies details: UTF-8 1.8 1.8 junit junit 4.11 test org.apache.jena apache-jena-libs 5.0.0-rc1 pom org.apache.maven.plugins maven-assembly-plugin Is that creating a jar file to run? The assembly plugin does not manage Java's service loader files. Either it needs doing in some way and put into the assembled jar. There is the shade plugin that manages combined service loader files more easily: https://jena.apache.org/documentation/notes/jena-repack.html This is how the combined jar jena-fuseki-server is built: https://github.com/apache/jena/blob/main/jena-fuseki2/jena-fuseki-server/pom.xml#L87-L138 Andy 3.6.0 maven-plugin Best regards, Pan On Tue, Mar 12, 2024 at 7:13 AM Lorenz Buehmann < buehm...@informatik.uni-leipzig.de> wrote: Hi, how did you setup your project? Which Jena version? Do you use Maven? Which dependencies? It looks like ARQ.init() hasn't been called which should happen automatically if the setup of the project is correct. Cheers, Lorenz On 11.03.24 14:44, Anna P wrote: Dear Jena support team, Currently I just started to work on a SPARQL project using Jena and I could not get a solution when I query a model. I imported a turtle file and ran a simple query, and the snippet code is shown below. However, I got the error. public class App { public static void main(String[] args) { try { Model model = RDFDataMgr.loadModel('data.ttl', Lang.TURTLE); RDFDataMgr.write(System.out, model, Lang.TURTLE); String queryString = "SELECT * { ?s ?p ?o }"; Query query = QueryFactory.create(queryString); QueryExecution qe = QueryExecutionFactory.create(query, model); ResultSet results = qe.execSelect(); ResultSetFormatter.out(System.out, results, query); qe.close(); } catch (Exception e) { e.printStackTrace(); } } } Here is the error message: org.apache.jena.riot.RiotException: Not registered as a SPARQL result set output syntax: Lang:SPARQL-Results-JSON at org.apache.jena.sparql.resultset.ResultsWriter.write(ResultsWriter.java:179) at org.apache.jena.sparql.resultset.ResultsWriter.write(ResultsWriter.java:156) at org.apache.jena.sparql.resultset.ResultsWriter.write(ResultsWriter.java:149) at org.apache.jena.sparql.resultset.ResultsWriter$Builder.write(ResultsWriter.java:96) at org.apache.jena.query.ResultSetFormatter.output(ResultSetFormatter.java:308) at org.apache.jena.query.ResultSetFormatter.outputAsJSON(ResultSetFormatter.java:516) at de.unistuttgart.ki.esparql.App.main(App.java:46) Thank you for your time and help! Best regards, Pan -- Lorenz Bühmann Research Associate/Scientific Developer Email buehm...@infai.org Institute for Applied Informatics e.V. (InfAI) | Goerdelerring 9 | 04109 Leipzig | Germany
Re: Problems when querying the SPARQL with Jena
Hi Vestal, Thank you for your reply. I used the method of ResultSetFormatter "out(OutputStream out, ResultSet resultSet, Prologue prologue)" listed in the javadoc. Here is the link: https://jena.apache.org/documentation/javadoc/arq/org.apache.jena.arq/org/apache/jena/query/ResultSetFormatter.html Class Query is the subclass of Class Prologue, so I think it could be used in this way. Best regards, Pan On Tue, Mar 12, 2024 at 1:30 PM Steve Vestal wrote: > Which line of this code is raising the exception? When I look at the > ResultSetFormatter API online, I see 9 signatures for the out method, > only 2 of which have three parameters, where the third parameter is a > PrefixMapping or Prologue but not a Query. The only one with a Query > parameter is "static void > out(ResultSet qresults, Query query)" (the javadoc doesn't explicitly > say where the output goes). If the exception occurs there, you could > try one of the other PrefixMapping.out methods to see if that avoids the > exception. > > On 3/12/2024 1:13 AM, Lorenz Buehmann wrote: > > Hi, > > > > how did you setup your project? Which Jena version? Do you use Maven? > > Which dependencies? It looks like ARQ.init() hasn't been called which > > should happen automatically if the setup of the project is correct. > > > > > > Cheers, > > Lorenz > > > > On 11.03.24 14:44, Anna P wrote: > >> Dear Jena support team, > >> > >> Currently I just started to work on a SPARQL project using Jena and I > >> could > >> not get a solution when I query a model. > >> I imported a turtle file and ran a simple query, and the snippet code is > >> shown below. However, I got the error. > >> > >> public class App { > >> public static void main(String[] args) { > >> try { > >> Model model = RDFDataMgr.loadModel('data.ttl', > >> Lang.TURTLE); > >> RDFDataMgr.write(System.out, model, Lang.TURTLE); > >> String queryString = "SELECT * { ?s ?p ?o }"; > >> Query query = QueryFactory.create(queryString); > >> QueryExecution qe = QueryExecutionFactory.create(query, > >> model); > >> ResultSet results = qe.execSelect(); > >> ResultSetFormatter.out(System.out, results, query); > >> qe.close(); > >> } catch (Exception e) { > >> e.printStackTrace(); > >> } > >> } > >> } > >> > >> Here is the error message: > >> > >> org.apache.jena.riot.RiotException: Not registered as a SPARQL result > >> set > >> output syntax: Lang:SPARQL-Results-JSON > >> at > >> > org.apache.jena.sparql.resultset.ResultsWriter.write(ResultsWriter.java:179) > > >> > >> at > >> > org.apache.jena.sparql.resultset.ResultsWriter.write(ResultsWriter.java:156) > > >> > >> at > >> > org.apache.jena.sparql.resultset.ResultsWriter.write(ResultsWriter.java:149) > > >> > >> at > >> > org.apache.jena.sparql.resultset.ResultsWriter$Builder.write(ResultsWriter.java:96) > > >> > >> at > >> > org.apache.jena.query.ResultSetFormatter.output(ResultSetFormatter.java:308) > > >> > >> at > >> > org.apache.jena.query.ResultSetFormatter.outputAsJSON(ResultSetFormatter.java:516) > > >> > >> at de.unistuttgart.ki.esparql.App.main(App.java:46) > >> > >> > >> Thank you for your time and help! > >> > >> Best regards, > >> > >> Pan > >> >
Re: Requesting advice on Fuseki memory settings
On Mon, Mar 11, 2024 at 6:28 PM Andy Seaborne wrote: > > > On 11/03/2024 14:35, Gaspar Bartalus wrote: > > Hi Andy, > > > > On Fri, Mar 8, 2024 at 4:41 PM Andy Seaborne wrote: > > > >> > >> > >> On 08/03/2024 10:40, Gaspar Bartalus wrote: > >>> Hi, > >>> > >>> Thanks for the responses. > >>> > >>> We were actually curious if you'd have some explanation for the > >>> linear increase in the storage, and why we are seeing differences > between > >>> the actual size of our dataset and the size it uses on disk. (Changes > >>> between `df -h` and `du -lh`)? > >> > >> Linear increase between compactions or across compactions? The latter > >> sounds like the previous version hasn't been deleted. > >> > > > > Across compactions, increasing linearly over several days, with > compactions > > running every day. The compaction is used with the "deleteOld" parameter, > > and there is only one Data- folder in the volume, so I assume compaction > > itself works as expected. > > Strange - I can't explain that. Could you check that there is only one > Data- directory inside the database directory? > Yes, there is surely just one Data- folder in the database directory. > > What's the disk storage setup? e.g filesystem type. > We have an Azure disk of type Standard SSD LRS with a filesystem of type Ext4. > > Andy > > >> TDB uses sparse files. It allocates 8M chunks per index but that isn't > >> used immediately. Sparse files are reported differently by different > >> tools and also differently by different operating systems. I don't know > >> how k3s is managing the storage. > >> > >> Sometimes it's the size of the file, sometimes it's the amount of space > >> in use. For small databases, there is quite a difference. > >> > >> An empty database is around 220kbytes but you'll see many 8Mbyte files > >> with "ls -l". > >> > >> If you zip the database up, and unpack it then it's 193Mbytes. > >> > >> After a compaction, the previous version of storage can be deleted. The > >> directory "Data-..." - only the highest numbered directory is used. A > >> previous one can be zipped up for backup. > >> > >>> The heap memory has some very minimal peaks, saw-tooth, but otherwise > >> it's > >>> flat. > >> > >> At what amount of memory? > >> > > > > At ~7GB. > > > >> > >>> > >>> Regards, > >>> Gaspar > >>> > >>> On Thu, Mar 7, 2024 at 11:55 PM Andy Seaborne wrote: > >>> > > > On 07/03/2024 13:24, Gaspar Bartalus wrote: > > Dear Jena support team, > > > > We would like to ask you to help us in configuring the memory for our > > jena-fuseki instance running in kubernetes. > > > > *We have the following setup:* > > > > * Jena-fuseki deployed as StatefulSet to a k8s cluster with the > > resource config: > > > > Limits: > > cpu: 2 > > memory: 16Gi > > Requests: > > cpu: 100m > > memory: 11Gi > > > > * The JVM_ARGS has the following value: -Xmx10G > > > > * Our main dataset of type TDB2 contains ~1 million triples. > A million triples doesn't take up much RAM even in a memory dataset. > > In Java, the JVM will grow until it is close to the -Xmx figure. A > major > GC will then free up a lot of memory. But the JVM does not give the > memory back to the kernel. > > TDB2 does not only use heap space. A heap of 2-4G is usually enough > per > dataset, sometimes less (data shape depenendent - e.g. many large > literals used more space. > > Use a profiler to examine the heap in-use, you'll probably see a > saw-tooth shape. > Force a GC and see the level of in-use memory afterwards. > Add some safety margin and work space for requests and try that as the > heap size. > > > * We execute the following type of UPDATE operations: > > - There are triggers in the system (e.g. users of the > application > > changing the data) which start ~50 other update operations containing > > up to ~30K triples. Most of them run in parallel, some are delayed > > with seconds or minutes. > > - There are scheduled UPDATE operations (executed on hourly > basis) > > containing 30K-500K triples. > > - These UPDATE operations usually delete and insert the same > amount > > of triples in the dataset. We use the compact API as a nightly job. > > > > *We are noticing the following behaviour:* > > > > * Fuseki consumes 5-10G of heap memory continuously, as configured in > > the JVM_ARGS. > > > > * There are points in time when the volume usage of the k8s container > > starts to increase suddenly. This does not drop even though > compaction > > is successfully executed and the dataset size (triple count) does not > > increase. See attachment below. > > > > *Our suspicions:* > > > > * garbage collection in Java is often delayed; memory is not freed as > >
Re: Problems when querying the SPARQL with Jena
Hi Lorenz, Thank you for your reply. Yes, I used maven to build the project. Here are dependencies details: Hi Lorenz, Yes, I used maven to build the project. Here are the dependencies details: UTF-8 1.8 1.8 junit junit 4.11 test org.apache.jena apache-jena-libs 5.0.0-rc1 pom org.apache.maven.plugins maven-assembly-plugin 3.6.0 maven-plugin Best regards, Pan On Tue, Mar 12, 2024 at 7:13 AM Lorenz Buehmann < buehm...@informatik.uni-leipzig.de> wrote: > Hi, > > how did you setup your project? Which Jena version? Do you use Maven? > Which dependencies? It looks like ARQ.init() hasn't been called which > should happen automatically if the setup of the project is correct. > > > Cheers, > Lorenz > > On 11.03.24 14:44, Anna P wrote: > > Dear Jena support team, > > > > Currently I just started to work on a SPARQL project using Jena and I > could > > not get a solution when I query a model. > > I imported a turtle file and ran a simple query, and the snippet code is > > shown below. However, I got the error. > > > > public class App { > > public static void main(String[] args) { > > try { > > Model model = RDFDataMgr.loadModel('data.ttl', Lang.TURTLE); > > RDFDataMgr.write(System.out, model, Lang.TURTLE); > > String queryString = "SELECT * { ?s ?p ?o }"; > > Query query = QueryFactory.create(queryString); > > QueryExecution qe = QueryExecutionFactory.create(query, > model); > > ResultSet results = qe.execSelect(); > > ResultSetFormatter.out(System.out, results, query); > > qe.close(); > > } catch (Exception e) { > > e.printStackTrace(); > > } > > } > > } > > > > Here is the error message: > > > > org.apache.jena.riot.RiotException: Not registered as a SPARQL result set > > output syntax: Lang:SPARQL-Results-JSON > > at > > > org.apache.jena.sparql.resultset.ResultsWriter.write(ResultsWriter.java:179) > > at > > > org.apache.jena.sparql.resultset.ResultsWriter.write(ResultsWriter.java:156) > > at > > > org.apache.jena.sparql.resultset.ResultsWriter.write(ResultsWriter.java:149) > > at > > > org.apache.jena.sparql.resultset.ResultsWriter$Builder.write(ResultsWriter.java:96) > > at > > > org.apache.jena.query.ResultSetFormatter.output(ResultSetFormatter.java:308) > > at > > > org.apache.jena.query.ResultSetFormatter.outputAsJSON(ResultSetFormatter.java:516) > > at de.unistuttgart.ki.esparql.App.main(App.java:46) > > > > > > Thank you for your time and help! > > > > Best regards, > > > > Pan > > > -- > Lorenz Bühmann > Research Associate/Scientific Developer > > Email buehm...@infai.org > > Institute for Applied Informatics e.V. (InfAI) | Goerdelerring 9 | 04109 > Leipzig | Germany > >
Re: Problems when querying the SPARQL with Jena
Which line of this code is raising the exception? When I look at the ResultSetFormatter API online, I see 9 signatures for the out method, only 2 of which have three parameters, where the third parameter is a PrefixMapping or Prologue but not a Query. The only one with a Query parameter is "static void out(ResultSet qresults, Query query)" (the javadoc doesn't explicitly say where the output goes). If the exception occurs there, you could try one of the other PrefixMapping.out methods to see if that avoids the exception. On 3/12/2024 1:13 AM, Lorenz Buehmann wrote: Hi, how did you setup your project? Which Jena version? Do you use Maven? Which dependencies? It looks like ARQ.init() hasn't been called which should happen automatically if the setup of the project is correct. Cheers, Lorenz On 11.03.24 14:44, Anna P wrote: Dear Jena support team, Currently I just started to work on a SPARQL project using Jena and I could not get a solution when I query a model. I imported a turtle file and ran a simple query, and the snippet code is shown below. However, I got the error. public class App { public static void main(String[] args) { try { Model model = RDFDataMgr.loadModel('data.ttl', Lang.TURTLE); RDFDataMgr.write(System.out, model, Lang.TURTLE); String queryString = "SELECT * { ?s ?p ?o }"; Query query = QueryFactory.create(queryString); QueryExecution qe = QueryExecutionFactory.create(query, model); ResultSet results = qe.execSelect(); ResultSetFormatter.out(System.out, results, query); qe.close(); } catch (Exception e) { e.printStackTrace(); } } } Here is the error message: org.apache.jena.riot.RiotException: Not registered as a SPARQL result set output syntax: Lang:SPARQL-Results-JSON at org.apache.jena.sparql.resultset.ResultsWriter.write(ResultsWriter.java:179) at org.apache.jena.sparql.resultset.ResultsWriter.write(ResultsWriter.java:156) at org.apache.jena.sparql.resultset.ResultsWriter.write(ResultsWriter.java:149) at org.apache.jena.sparql.resultset.ResultsWriter$Builder.write(ResultsWriter.java:96) at org.apache.jena.query.ResultSetFormatter.output(ResultSetFormatter.java:308) at org.apache.jena.query.ResultSetFormatter.outputAsJSON(ResultSetFormatter.java:516) at de.unistuttgart.ki.esparql.App.main(App.java:46) Thank you for your time and help! Best regards, Pan
Re: Problems when querying the SPARQL with Jena
Hi, how did you setup your project? Which Jena version? Do you use Maven? Which dependencies? It looks like ARQ.init() hasn't been called which should happen automatically if the setup of the project is correct. Cheers, Lorenz On 11.03.24 14:44, Anna P wrote: Dear Jena support team, Currently I just started to work on a SPARQL project using Jena and I could not get a solution when I query a model. I imported a turtle file and ran a simple query, and the snippet code is shown below. However, I got the error. public class App { public static void main(String[] args) { try { Model model = RDFDataMgr.loadModel('data.ttl', Lang.TURTLE); RDFDataMgr.write(System.out, model, Lang.TURTLE); String queryString = "SELECT * { ?s ?p ?o }"; Query query = QueryFactory.create(queryString); QueryExecution qe = QueryExecutionFactory.create(query, model); ResultSet results = qe.execSelect(); ResultSetFormatter.out(System.out, results, query); qe.close(); } catch (Exception e) { e.printStackTrace(); } } } Here is the error message: org.apache.jena.riot.RiotException: Not registered as a SPARQL result set output syntax: Lang:SPARQL-Results-JSON at org.apache.jena.sparql.resultset.ResultsWriter.write(ResultsWriter.java:179) at org.apache.jena.sparql.resultset.ResultsWriter.write(ResultsWriter.java:156) at org.apache.jena.sparql.resultset.ResultsWriter.write(ResultsWriter.java:149) at org.apache.jena.sparql.resultset.ResultsWriter$Builder.write(ResultsWriter.java:96) at org.apache.jena.query.ResultSetFormatter.output(ResultSetFormatter.java:308) at org.apache.jena.query.ResultSetFormatter.outputAsJSON(ResultSetFormatter.java:516) at de.unistuttgart.ki.esparql.App.main(App.java:46) Thank you for your time and help! Best regards, Pan -- Lorenz Bühmann Research Associate/Scientific Developer Email buehm...@infai.org Institute for Applied Informatics e.V. (InfAI) | Goerdelerring 9 | 04109 Leipzig | Germany