Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
169 commits
Select commit Hold shift + click to select a range
6636524
Add qoxigraph
tanmay-9 Jul 18, 2025
55b7d47
Add qvirtuoso
tanmay-9 Jul 18, 2025
e5af11f
Add qjena
tanmay-9 Jul 18, 2025
2be4079
Add qblazegraph
tanmay-9 Jul 18, 2025
ade0107
Add qmdb
tanmay-9 Jul 18, 2025
e6795aa
Change qoxigraph `example-queries` to `benchmark-queries`
tanmay-9 Jul 18, 2025
0ea5faa
Add `--lenient` and `--ulimit` options to qoxigraph index
tanmay-9 Jul 18, 2025
040d4e6
Change localhost to host_name in qoxigraph query
tanmay-9 Jul 18, 2025
adbaa4a
Change `example-queries` to `benchmark-queries` and localhost to host…
tanmay-9 Jul 18, 2025
9a5bf70
Added isql_port index_arg to qleverfile for qvirtuoso
tanmay-9 Jul 18, 2025
370cb2f
Fix native index_cmd when ulimit is set for qoxigraph
tanmay-9 Jul 19, 2025
f8cdbec
Change `example-queries` to `benchmark-queries` and localhost to host…
tanmay-9 Jul 19, 2025
b92b0ff
Added a way to define engine-specific qleverfile args
tanmay-9 Jul 19, 2025
0afd68a
Add missing host_name arg to qjena query
tanmay-9 Jul 19, 2025
f66d2cd
Change `example-queries` to `benchmark-queries` and localhost to host…
tanmay-9 Jul 21, 2025
1512876
Added mdb specific qleverfile args
tanmay-9 Jul 21, 2025
f7f6ff9
Updated index, start, stop and status commands to use all the new arg…
tanmay-9 Jul 21, 2025
b5dc5ad
Change mdb -> mdb server for qmdb status
tanmay-9 Jul 24, 2025
1b305ab
Added virtuoso specific qleverfile args
tanmay-9 Jul 26, 2025
8e2fd33
Added oxigraph specific qleverfile args
tanmay-9 Jul 26, 2025
c8e7201
Changed example-queries to benchmark-queries and blazegraph.propertie…
tanmay-9 Jul 26, 2025
02e72df
Added blazegraph specific qleverfile and added jvm_args
tanmay-9 Jul 26, 2025
200e0b4
Added web.xml download and override when running start for qblazegraph
tanmay-9 Jul 26, 2025
e8aea41
Add missing host_name to qblazegraph benchmark-queries args
tanmay-9 Jul 26, 2025
09f30c2
Added evaluation app from new-eval-app branch
tanmay-9 Jul 28, 2025
62a70a5
First version of qgraphdb native support
tanmay-9 Jul 30, 2025
e70f769
Fix stop_process_with_regex bug when pinfo["cmdline"] is not a list
tanmay-9 Jul 30, 2025
749d06a
qgraphdb stop relevant_qleverfile_args fix
tanmay-9 Jul 30, 2025
e062a9b
Make qblazegraph status more detailed with a named web.xml file and a…
tanmay-9 Aug 5, 2025
22a57c7
Merge branch 'ad-freiburg:main' into all-new-engines
tanmay-9 Aug 14, 2025
5cf60f4
Merge changes from new-eval-app
tanmay-9 Aug 14, 2025
ad08fcd
Finalized Oxigraph changes
tanmay-9 Aug 24, 2025
c7bbbd6
In `Qleverfile.ohm-planet`, remove obsolete arguments from `osm2rdf` …
hannahbast Aug 23, 2025
0ab40b9
Finalized mdb changes
tanmay-9 Aug 24, 2025
a292dc4
Finalized jena-fuseki changes
tanmay-9 Aug 24, 2025
1ced4e5
Finalized blazegraph changes
tanmay-9 Aug 24, 2025
5dd2769
Finalized virtuoso changes
tanmay-9 Aug 24, 2025
cb96df1
Made GraphDB native mode better
tanmay-9 Aug 24, 2025
4eda7dd
Add engine-specific parameters to qgraphdb setup-config
tanmay-9 Aug 26, 2025
6050182
Add new evaluation app changes
tanmay-9 Aug 27, 2025
e3dfda2
Add timeout to benchmark-queries of qjena, qgraphdb and qblazegraph
tanmay-9 Aug 27, 2025
591311c
Fix qvirtuoso max query mem bug
tanmay-9 Aug 27, 2025
c7e37eb
Fix qgraphdb benchmark-queries override_port bug
tanmay-9 Aug 28, 2025
fba9ac9
Eval app title bug fix
tanmay-9 Aug 28, 2025
3b59937
Add new-eval-app help accordions
tanmay-9 Sep 2, 2025
93d5d2f
Add max-time and restart-on-hang option to benchmark-queries (ongoing)
tanmay-9 Sep 2, 2025
3e1279c
Fix qgraphdb query override_port missing
tanmay-9 Sep 2, 2025
487f3ee
Make graphdb work exactly like other engines and with container systems
tanmay-9 Sep 4, 2025
d313bfe
Correct the graphdb license file url
tanmay-9 Sep 5, 2025
69e1a5e
Take new eval-app changes
tanmay-9 Sep 6, 2025
10895f8
Take more new-eval-app changes
tanmay-9 Sep 6, 2025
3ac026b
Start server if curl return exit code 52 or 7 i.e. server killed
tanmay-9 Sep 6, 2025
d913344
Take new eval-app and serve-eval-app changes
tanmay-9 Sep 9, 2025
5b7e448
Make sortedKbNames functon more robust
tanmay-9 Sep 9, 2025
fbb17af
Update all tables to use domLayout normal
tanmay-9 Sep 12, 2025
c515508
Update benchmark-queries command to add server_restarted status to ou…
tanmay-9 Sep 22, 2025
b7cbb72
Add --total-index/server-memory, --port, --timeout, --system to setup…
tanmay-9 Sep 22, 2025
580af0b
Add timeout support for oxigraph
tanmay-9 Sep 22, 2025
07bb653
Add total index and server memory support to qvirtuoso setup-config c…
tanmay-9 Sep 22, 2025
8961c70
Add total index and server memory support to qblazegraph setup-config…
tanmay-9 Sep 22, 2025
f9ad21c
Add total index and server memory support to qmdb setup-config command
tanmay-9 Sep 22, 2025
645e8de
Add total index and server memory support to qjena setup-config command
tanmay-9 Sep 22, 2025
6cde2af
Add total index and server memory support to qgraphdb setup-config co…
tanmay-9 Sep 22, 2025
e759f66
Add Qleverfile section and option help text metavar
tanmay-9 Sep 22, 2025
28797db
Take new-eval-app changes
tanmay-9 Sep 22, 2025
99ac3b4
Merge remote-tracking branch 'origin/main' into all-new-engines
tanmay-9 Sep 22, 2025
70ca2ac
Fix podman related bugs
tanmay-9 Sep 22, 2025
21516a6
Merge branch 'qlever-dev:main' into all-new-engines
tanmay-9 Oct 9, 2025
0592162
Merge branch 'main' into all-new-engines
tanmay-9 Oct 30, 2025
4cf56d3
Take latest new-eval-app changes
tanmay-9 Oct 30, 2025
757f601
Add overwrite_existing option to qgraphdb index and fix threads int->…
tanmay-9 Nov 6, 2025
8938268
Add container ulimit and optimize database storage to oxigraph index
tanmay-9 Nov 6, 2025
13f5618
Merge branch 'qlever-dev:main' into all-new-engines
tanmay-9 Nov 27, 2025
4d07566
Take latest index-stats new-eval-app changes
tanmay-9 Nov 27, 2025
969ce1c
Make qlever index-stats command more extensible
tanmay-9 Nov 29, 2025
0631be4
Update qjena base jdk Dockerfile
tanmay-9 Nov 29, 2025
76f502b
Add qjena index-stats command
tanmay-9 Nov 29, 2025
d3f6993
Take new-eval-app index stats changes
tanmay-9 Dec 3, 2025
70a88b6
Add index-stats for qblazegraph and qmdb
tanmay-9 Dec 9, 2025
6d142c2
Add a way to set most frequently changed options from CLI for setup-c…
tanmay-9 Dec 22, 2025
a07c314
Merge remote-tracking branch 'origin/main' into all-new-engines
tanmay-9 Dec 22, 2025
7ca5345
Merge branch 'qlever-dev:main' into all-new-engines
tanmay-9 Jan 14, 2026
92604f6
Changes to qlever-control code to allow for quit execution outside a …
ricoandris Feb 9, 2026
ab7f1ff
Add sparql conformance commands
ricoandris Feb 13, 2026
83fa7dd
Add sparql conformance test suite code
ricoandris Feb 13, 2026
7de2739
Merge remote-tracking branch 'test/all-new-engines' into sparql-confo…
ricoandris Feb 13, 2026
7b854ce
Merge branch 'qlever-dev:main' into all-new-engines
tanmay-9 Feb 16, 2026
034175d
Merge changes from new-eval-app branch
tanmay-9 Feb 16, 2026
e20cb35
Add exclude argument to `get_total_size` function to exclude specific…
tanmay-9 Feb 16, 2026
d07b73f
Add `index-stats` command for qoxigraph and qgraphdb
tanmay-9 Feb 16, 2026
c7e45b6
Fix wrong type notation for relevant_qleverfile_arguments method in m…
tanmay-9 Feb 16, 2026
71ea6d2
Add `index-stats` command for qvirtuoso
tanmay-9 Feb 16, 2026
24f9b44
Fix index-stats bugs for qvirtuoso and qmdb
tanmay-9 Feb 16, 2026
ae69d7a
Add blazegraph
ricoandris Feb 14, 2026
b47b388
Add graphdb
ricoandris Feb 14, 2026
cbdf088
Add --rebuild-image option to index commands of all engines that use …
tanmay-9 Feb 19, 2026
aed9936
Add docstrings to qvirtuoso files and use get_ini_sed_cmd function fr…
tanmay-9 Feb 19, 2026
5f7a7b0
Add jena
ricoandris Feb 15, 2026
2bb70c5
Add mdb conformance wiring and defaults
ricoandris Feb 15, 2026
e260d33
Add oxigraph conformance wiring and defaults
ricoandris Feb 15, 2026
096a462
Wire virtuoso conformance engine
ricoandris Feb 15, 2026
e0d49f0
Fix run-in-foreground for start command of all engines
tanmay-9 Feb 26, 2026
9b8835b
Possible graph uri fix for graph db
ricoandris Mar 4, 2026
0edaac5
Remove telnet.
ricoandris Mar 5, 2026
2dd491b
Fix binary for qlever.py
ricoandris Mar 5, 2026
e39247c
Fix jena protocol endpoints
ricoandris Mar 10, 2026
25bf8e5
Fix mdb update tests
ricoandris Mar 10, 2026
bb637cc
Fix virtuoso update tests
ricoandris Mar 12, 2026
cd4f6f9
Merge remote-tracking branch 'origin/main' into all-new-engines
tanmay-9 Mar 19, 2026
c567b8a
Improve logging of virtuoso index process
tanmay-9 Mar 20, 2026
2b51787
Fix broken index-stats command
tanmay-9 Mar 20, 2026
55fff4a
Fix extra space issue in index-stats
tanmay-9 Mar 20, 2026
987fe4c
Merge branch 'qlever-dev:main' into all-new-engines
tanmay-9 Mar 23, 2026
059735a
Take new-eval-app changes
tanmay-9 Mar 23, 2026
4187f33
Improve setup config overridable args
tanmay-9 Mar 23, 2026
d56e4b4
Refactor qlever setup_config so that it can be easily extended and re…
tanmay-9 Mar 23, 2026
b44212e
Improve code reuse by extending qlever setup_config
tanmay-9 Mar 23, 2026
8176db8
Fix buggy lenient index option
tanmay-9 Mar 23, 2026
fab25d2
Take changes from prepare-qlever PR
tanmay-9 Mar 24, 2026
cf731e8
Update qoxigraph's code for final merge
tanmay-9 Mar 24, 2026
f85446f
Take qlever start changes to fix run_in_foreground
tanmay-9 Mar 24, 2026
200ca2e
Fix oxigraph start --run-in-foreground
tanmay-9 Mar 24, 2026
cc80bb3
Remove unnecessary self.script_name from qoxigraph
tanmay-9 Mar 25, 2026
1f35025
Update qoxigraph stop to use dataset name instead of port, add docstr…
tanmay-9 Mar 25, 2026
3a3663b
Use virtuoso's official Docker image
tanmay-9 Mar 26, 2026
bc91252
Update qvirtuoso code fpr mergability
tanmay-9 Mar 28, 2026
709b4c9
Fix virtuoso ld_dir command for multiple input files
tanmay-9 Mar 29, 2026
4cdbf7e
Remove redundant args.name substitution from qvirtuoso stop
tanmay-9 Mar 31, 2026
4824067
Add docstrings and fix code for qmdb
tanmay-9 Mar 31, 2026
c754963
Show container build image output
tanmay-9 Mar 31, 2026
e04c194
Fix qmdb bugs related to --threads and --buffer-tensors
tanmay-9 Apr 1, 2026
1d4fdcf
Merge remote-tracking branch 'origin/main' into all-new-engines
tanmay-9 Apr 1, 2026
fe6e127
Merge remote-tracking branch 'origin/main' into all-new-engines
tanmay-9 Apr 1, 2026
3eb3e8f
Merge branch 'qlever-dev:main' into all-new-engines
tanmay-9 Apr 6, 2026
0888a1c
Add index memory monitoring for qlever and qmdb
tanmay-9 Apr 6, 2026
b89621c
Add a pure-python function to make all changes in single pass through…
tanmay-9 Apr 7, 2026
635bb40
Fix qvirtuoso setup-config --show logic
tanmay-9 Apr 7, 2026
6136133
Stop server when qvirtuoso index errors. Also use new update_ini_valu…
tanmay-9 Apr 7, 2026
faa6843
Merge branch 'qlever-dev:main' into all-new-engines
tanmay-9 Apr 9, 2026
91188ea
Take memory monitor changes
tanmay-9 Apr 10, 2026
d45e047
Fix virtuoso index memory monitor engine
tanmay-9 Apr 10, 2026
8e42681
Fix memory monitoring for virtuoso
tanmay-9 Apr 10, 2026
a045d1c
Fix for blazegraph
ricoandris Apr 22, 2026
3347e9e
Fix Blazegraph construct
ricoandris Apr 23, 2026
2988b66
Add support for multiple test suites
Apr 24, 2026
0dcf5f4
Support new website in visualize command
Apr 25, 2026
f4708bf
Add structured handling of protocol tests
Apr 26, 2026
508d0a2
Merge remote-tracking branch 'origin/main' into all-new-engines
tanmay-9 Apr 28, 2026
581be0b
add standalone entry point and align code with sparql-conformance pro…
ricoandris May 11, 2026
50a6c2d
improve graphdb
ricoandris May 11, 2026
df2c4b3
Fix bug when including tests
ricoandris May 11, 2026
3a93c94
Improve jena results
ricoandris May 11, 2026
7cf8a72
Further improvements
ricoandris May 11, 2026
dbeba8c
Further improvements
ricoandris May 26, 2026
10084e1
Fix engine managers, Introduce mock for service tests.
ricoandris May 29, 2026
3a8669c
Merge branch 'main' into all-new-engines
Qup42 Jun 2, 2026
dc6967d
Introduce reset hook for faster reset betweens tests, bug fixes
ricoandris Jun 22, 2026
e6ffeb9
some fixes
Qup42 Jun 22, 2026
723fd89
Remove forgotten debug print
ricoandris Jun 25, 2026
04589f9
Readd results-dir arg
ricoandris Jun 25, 2026
128f458
Remove forgotten debug logs
ricoandris Jun 28, 2026
1093f06
Add new structured GraphStoreProtocolTests
ricoandris Jun 29, 2026
3bdc564
Add README.md draft and make usage easier
ricoandris Jun 29, 2026
38b6af7
Merge tanmay/all-new-engines into sparql-conformance-command-all-engines
ricoandris Jul 1, 2026
f1ba695
Fix bugs from merge
ricoandris Jul 4, 2026
063aeb0
Optional test status information in the CLI
ricoandris Jul 4, 2026
c983256
Depend on the sparql-conformance package instead of a vendored copy
ricoandris Jul 13, 2026
6739ef5
Remove accidental commited file
ricoandris Jul 13, 2026
63674dd
Remove sparql-conformance dependency
ricoandris Jul 16, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ __pycache__
build/
dist/
*.egg-info
*.memory-log.json
*.swp
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@ On other platforms simply install the `qlever` command-line
[python package using `pipx`/`uv`](https://docs.qlever.dev/quickstart/#others).
Note: QLever will be executed in a container which will come with a performance penalty.

# Optional SPARQL conformance integration

The `qlever` package is independent of the SPARQL conformance test harness and
does not install it. To use the integrated
`sparql_conformance setup|test|analyze|visualize` workflow, install the
[`sparql-conformance`](https://github.com/SIRDNARch/sparql-conformance)
package separately. That package owns the `sparql_conformance` command and
loads qlever-control only when the integration is used.

# Use with your own dataset

To use QLever with your own dataset, you need a `Qleverfile`, like in the
Expand Down
8 changes: 7 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["setuptools>=61.0", "wheel"]
requires = ["setuptools>=64.0", "wheel"]
build-backend = "setuptools.build_meta"

[project]
Expand Down Expand Up @@ -33,7 +33,13 @@ repository = "https://github.com/ad-freiburg/qlever.git"
bugtracker = "https://github.com/ad-freiburg/qlever/issues"

[project.scripts]
"qblazegraph" = "qlever.qlever_main:main"
"qgraphdb" = "qlever.qlever_main:main"
"qjena" = "qlever.qlever_main:main"
"qlever" = "qlever.qlever_main:main"
"qmdb" = "qlever.qlever_main:main"
"qoxigraph" = "qlever.qlever_main:main"
"qvirtuoso" = "qlever.qlever_main:main"

[tool.setuptools]
package-data = { "qlever" = ["Qleverfiles/*", "evaluation/www/*"] }
Expand Down
23 changes: 23 additions & 0 deletions src/qblazegraph/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Use an official OpenJDK runtime as a parent image
FROM docker.io/library/openjdk:26-ea-21-jdk-slim

RUN apt-get update && apt-get install -y wget gzip coreutils curl unzip

WORKDIR /opt

# Download and set up Blazegraph
RUN wget https://github.com/blazegraph/database/releases/download/BLAZEGRAPH_2_1_6_RC/blazegraph.jar

# Set ownership to the user passed by UID and GID
ARG UID
ARG GID
RUN if [ "${UID:-}" != "" ] && [ "${GID:-}" != "" ]; then \
chown -R ${UID}:${GID} /opt; \
fi

RUN chmod u+x blazegraph.jar

# Expose Blazegraph port
# EXPOSE 9999

CMD ["bash"]
33 changes: 33 additions & 0 deletions src/qblazegraph/RWStore.conformance.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# ===================== Basic Configuration =====================
com.bigdata.journal.AbstractJournal.file=blazegraph.jnl
com.bigdata.journal.AbstractJournal.bufferMode=DiskRW
com.bigdata.journal.AbstractJournal.initialExtent=209715200
com.bigdata.journal.AbstractJournal.maximumExtent=200000000000
com.bigdata.rdf.store.AbstractTripleStore.textIndex=false
com.bigdata.rdf.store.AbstractTripleStore.justify=false
com.bigdata.rdf.store.AbstractTripleStore.axiomsClass=com.bigdata.rdf.axioms.NoAxioms
com.bigdata.rdf.store.AbstractTripleStore.quads=true
com.bigdata.rdf.store.AbstractTripleStore.statementIdentifiers=false
com.bigdata.rdf.sail.truthMaintenance=false
com.bigdata.rdf.store.AbstractTripleStore.geoSpatial=false

# ===================== DataLoader Performance =====================
com.bigdata.rdf.store.DataLoader.bufferCapacity=1000000
com.bigdata.rdf.store.DataLoader.queueCapacity=150
com.bigdata.rdf.store.DataLoader.gzipBufferSize=1000000000
com.bigdata.rdf.store.DataLoader.closure=None

# ===================== BTree Tuning (example values; adjust based on your dataset) =====================
# com.bigdata.namespace.kb.lex.BLOBS.com.bigdata.btree.BTree.branchingFactor=576
# com.bigdata.namespace.kb.lex.ID2TERM.com.bigdata.btree.BTree.branchingFactor=781
# com.bigdata.namespace.kb.lex.TERM2ID.com.bigdata.btree.BTree.branchingFactor=380
# com.bigdata.namespace.kb.spo.OSP.com.bigdata.btree.BTree.branchingFactor=737
# com.bigdata.namespace.kb.spo.POS.com.bigdata.btree.BTree.branchingFactor=917
# com.bigdata.namespace.kb.spo.SPO.com.bigdata.btree.BTree.branchingFactor=731

# ===================== Optional Namespace Settings =====================
com.bigdata.namespace.kb.spo.com.bigdata.btree.BTree.branchingFactor=1024
com.bigdata.rdf.store.AbstractTripleStore.namespace=kb

# ===================== RDF & Parser Configuration =====================
com.bigdata.rdf.parser.RDFParserFactory.supportsGZip=true
33 changes: 33 additions & 0 deletions src/qblazegraph/RWStore.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# ===================== Basic Configuration =====================
com.bigdata.journal.AbstractJournal.file=blazegraph.jnl
com.bigdata.journal.AbstractJournal.bufferMode=DiskRW
com.bigdata.journal.AbstractJournal.initialExtent=209715200
com.bigdata.journal.AbstractJournal.maximumExtent=200000000000
com.bigdata.rdf.store.AbstractTripleStore.textIndex=false
com.bigdata.rdf.store.AbstractTripleStore.justify=false
com.bigdata.rdf.store.AbstractTripleStore.axiomsClass=com.bigdata.rdf.axioms.NoAxioms
com.bigdata.rdf.store.AbstractTripleStore.quads=false
com.bigdata.rdf.store.AbstractTripleStore.statementIdentifiers=false
com.bigdata.rdf.sail.truthMaintenance=false
com.bigdata.rdf.store.AbstractTripleStore.geoSpatial=false

# ===================== DataLoader Performance =====================
com.bigdata.rdf.store.DataLoader.bufferCapacity=1000000
com.bigdata.rdf.store.DataLoader.queueCapacity=150
com.bigdata.rdf.store.DataLoader.gzipBufferSize=1000000000
com.bigdata.rdf.store.DataLoader.closure=None

# ===================== BTree Tuning (example values; adjust based on your dataset) =====================
# com.bigdata.namespace.kb.lex.BLOBS.com.bigdata.btree.BTree.branchingFactor=576
# com.bigdata.namespace.kb.lex.ID2TERM.com.bigdata.btree.BTree.branchingFactor=781
# com.bigdata.namespace.kb.lex.TERM2ID.com.bigdata.btree.BTree.branchingFactor=380
# com.bigdata.namespace.kb.spo.OSP.com.bigdata.btree.BTree.branchingFactor=737
# com.bigdata.namespace.kb.spo.POS.com.bigdata.btree.BTree.branchingFactor=917
# com.bigdata.namespace.kb.spo.SPO.com.bigdata.btree.BTree.branchingFactor=731

# ===================== Optional Namespace Settings =====================
com.bigdata.namespace.kb.spo.com.bigdata.btree.BTree.branchingFactor=1024
com.bigdata.rdf.store.AbstractTripleStore.namespace=kb

# ===================== RDF & Parser Configuration =====================
com.bigdata.rdf.parser.RDFParserFactory.supportsGZip=true
Empty file added src/qblazegraph/__init__.py
Empty file.
Empty file.
21 changes: 21 additions & 0 deletions src/qblazegraph/commands/benchmark_queries.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from __future__ import annotations

from qlever.commands.benchmark_queries import (
BenchmarkQueriesCommand as QleverBenchmarkQueriesCommand,
)


class BenchmarkQueriesCommand(QleverBenchmarkQueriesCommand):
def relevant_qleverfile_arguments(self) -> dict[str, list[str]]:
return {
"data": ["name"],
"server": ["host_name", "port", "timeout"],
"ui": ["ui_config"],
}

def execute(self, args) -> bool:
if not args.sparql_endpoint:
args.sparql_endpoint = (
f"{args.host_name}:{args.port}/blazegraph/namespace/kb/sparql"
)
return super().execute(args)
1 change: 1 addition & 0 deletions src/qblazegraph/commands/extract_queries.py
1 change: 1 addition & 0 deletions src/qblazegraph/commands/get_data.py
173 changes: 173 additions & 0 deletions src/qblazegraph/commands/index.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
from __future__ import annotations

from pathlib import Path

import qlever.util as util
from qlever.command import QleverCommand
from qlever.containerize import Containerize
from qlever.log import log


class IndexCommand(QleverCommand):
def __init__(self):
self.script_name = "qblazegraph"

def description(self) -> str:
return "Build the index for a given RDF dataset"

def should_have_qleverfile(self) -> bool:
return True

def relevant_qleverfile_arguments(self) -> dict[str, list[str]]:
return {
"data": ["name", "format"],
"index": ["input_files", "jvm_args", "extra_args"],
"runtime": ["system", "image", "index_container"],
}

def additional_arguments(self, subparser):
subparser.add_argument(
"--blazegraph-jar",
type=str,
default="blazegraph.jar",
help=(
"Path to blazegraph.jar file (default: blazegraph.jar) "
"(this requires that you have Java installed and blazegraph.jar "
"downloaded on your machine)"
),
)
subparser.add_argument(
"--rebuild-image",
action="store_true",
default=False,
help="Rebuild the Docker image to get the latest updates",
)

@staticmethod
def wrap_cmd_in_container(args, cmd: str) -> str:
return Containerize().containerize_command(
cmd=cmd,
container_system=args.system,
run_subcommand="run --rm",
image_name=args.image,
container_name=args.index_container,
volumes=[("$(pwd)", "/opt/index")],
working_directory="/opt/index",
)

def execute(self, args, called_from_conformance_test: bool = False) -> bool:
system = args.system
input_files = args.input_files

jar_path = (
args.blazegraph_jar
if args.system == "native"
else "/opt/blazegraph.jar"
)

index_cmd = (
f"java {args.jvm_args} -cp {jar_path} com.bigdata.rdf.store.DataLoader "
f"{args.extra_args} RWStore.properties {input_files}"
)
# Under a conformance test, redirect all output to the log file so the
# BlazeGraph banner and DataLoader output do not flood stdout; otherwise
# `tee` keeps showing it live.
if called_from_conformance_test:
index_cmd += f" > {args.name}.index-log.txt 2>&1"
else:
index_cmd += f" | tee {args.name}.index-log.txt"

image_id = build_cmd = ""
if args.system == "native":
cmd_to_show = index_cmd
else:
index_cmd = self.wrap_cmd_in_container(args, index_cmd)
dockerfile_dir = Path(__file__).parent.parent
dockerfile_path = dockerfile_dir / "Dockerfile"
build_cmd = (
f"{system} build -f {dockerfile_path} -t {args.image} --build-arg "
f"UID=$(id -u) --build-arg GID=$(id -g) {dockerfile_dir}"
)
image_id = util.get_container_image_id(system, args.image)
cmd_to_show = (
f"{build_cmd}\n\n{index_cmd}"
if not image_id or args.rebuild_image
else index_cmd
)

# Show the command line.
self.show(cmd_to_show, only_show=args.show)
if args.show:
return True

# Check if all of the input files exist.
if not util.input_files_exist(input_files):
return False

# When running natively, check if the binary exists and works.
if args.system == "native":
try:
util.run_command("java --help")
except Exception as e:
log.error(f"Java not found on the machine! - {e}")
log.info(
"Blazegraph needs Java to execute the blazegraph.jar file"
)
return False
if not Path(args.blazegraph_jar).exists():
jar_link = (
"https://github.com/blazegraph/database/releases/download/"
"BLAZEGRAPH_2_1_6_RC/blazegraph.jar"
)
log.error(
"Couldn't find the blazegraph.jar in specified path: "
f"{Path(args.blazegraph_jar).absolute()}\n"
)
log.info(
"Are you sure you downloaded the blazegraph.jar file? "
f"blazegraph.jar can be downloaded from {jar_link}"
)
return False
else:
if Containerize().is_running(args.system, args.index_container):
log.info(
f"{args.system} container {args.index_container} is still up, "
"which means that data loading is in progress. Please wait..."
)
return False
# A previously interrupted run can leave a container with this name
# in a non-running (Created/Exited) state, which makes the
# `docker/podman run --name` below fail with exit code 125. Remove
# any such stale container first.
Containerize.stop_and_remove_container(
args.system, args.index_container
)

if not image_id or args.rebuild_image:
build_successful = util.build_image(
build_cmd, system, args.image
)
if not build_successful:
return False
else:
log.info(f"{args.image} image present on the system\n")

index_jnl = Path("blazegraph.jnl")
if index_jnl.exists():
log.error(
"Blazegraph journal blazegraph.jnl found in current working "
"directory which shows presence of a previous index\n"
)
log.info("Aborting the index operation...")
return False

# Run the index command.
try:
util.run_command(
index_cmd, show_output=not called_from_conformance_test
)
except Exception as e:
log.error(f"Building the index failed: {e}")
return False

return True
Loading