Skip to content

vemonet/lsq-anal-sparql

Repository files navigation

Page explaining how to use the actual features of LSQ (which is analyzing SPARQL query logs).

This gives a practical and straightforward example to run the complete workflow with some example DBpedia logs. It was necessary to rewrite it due to the original documentation being out of date (and not straightforward)

Install

Install (we will ignore the deb thing even if I am running Ubuntu, because it is ridiculous to spend that much work on wrapping a cross platform jar file in a deb package which reduce the usability of the software):

mvn -Pdist,standalone clean install
java -jar lsq-cli/target/lsq-cli-2.0.0-SNAPSHOT-jar-with-dependencies.jar
# Now move it somewhere we can reuse it easily
mv lsq-cli/target/lsq-cli-2.0.0-SNAPSHOT-jar-with-dependencies.jar /opt/lsq.jar

Download one of the rare logs example with actual SPARQL queries that is provided in the repository: https://raw.githubusercontent.com/vemonet/LSQ/develop/lsq-core/src/test/resources/logs/virtuoso.dbpedia.log

wget https://raw.githubusercontent.com/vemonet/LSQ/develop/lsq-core/src/test/resources/logs/virtuoso.dbpedia.log

Generate RDF from logs

Run the thing to generate RDF from logs :

java -jar /opt/lsq.jar rx rdfize --endpoint=http://dbpedia.org/sparql virtuoso.dbpedia.log 

Analyze queries structure

Run the thing to analyze the structure of SPARQL queries using docs from http://lsq.aksw.org/v2/usage/benchmarking.html:

  1. Useless command that generate some RDF without interesting informations about the SPARQL endpoint (but required for the next step)
java -jar /opt/lsq.jar rx benchmark create --endpoint http://dbpedia.org/sparql --dataset dbpedia
  1. Another useless command, requires you to take the file generated by the previous command
java -jar /opt/lsq.jar rx benchmark prepare -c xc-dbpedia_2021-10-22.conf.ttl
  1. Finally starting the benchmark on our log file! Be careful you need to change the filename again, and this time LSQ generated a long name. Not sure why there is this foo/*.trig here, the documentation does not mention anything about it.
java -jar /opt/lsq.jar rx benchmark run -c xc-dbpedia_2021-10-22_2021-10-22T12_26_40_828056Z.run.ttl virtuoso.dbpedia.log foo/*.trig

Of course getting an error with: zsh: no matches found: foo/*.trig

So we remove it:

java -jar /opt/lsq.jar rx benchmark run -c xc-dbpedia_2021-10-22_2021-10-22T12_26_40_828056Z.run.ttl virtuoso.dbpedia.log

Done 🎉

Those 3 steps should have been combined, at least the CLI level. There is no reason why the user needs to do them separately and manually handle passing the different files generated.

About

Analyze SPARQL queries with LSQ

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published