qlever 0.4.3__py3-none-any.whl → 0.5.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of qlever might be problematic. Click here for more details.
- qlever/Qleverfiles/Qleverfile.ohm-planet +37 -0
- qlever/commands/get_data.py +2 -4
- qlever/config.py +14 -11
- qlever/qlever_old.py +10 -9
- {qlever-0.4.3.dist-info → qlever-0.5.0.dist-info}/METADATA +1 -1
- {qlever-0.4.3.dist-info → qlever-0.5.0.dist-info}/RECORD +10 -9
- {qlever-0.4.3.dist-info → qlever-0.5.0.dist-info}/LICENSE +0 -0
- {qlever-0.4.3.dist-info → qlever-0.5.0.dist-info}/WHEEL +0 -0
- {qlever-0.4.3.dist-info → qlever-0.5.0.dist-info}/entry_points.txt +0 -0
- {qlever-0.4.3.dist-info → qlever-0.5.0.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Qleverfile for OHM Planet, use with https://github.com/ad-freiburg/qlever-control
|
|
2
|
+
#
|
|
3
|
+
# qlever get-data # ~20 mins (download PBF, convert to TTL, add GeoSPARQL triples)
|
|
4
|
+
# qlever index # ~10 mins and ~5 GB RAM (on an AMD Ryzen 9 5900X)
|
|
5
|
+
# qlever start # start the server (instantaneous)
|
|
6
|
+
#
|
|
7
|
+
# For `qlever get-data` to work, `osm2rdf` and `spatialjoin` must be installed
|
|
8
|
+
# and included in the `PATH`.
|
|
9
|
+
|
|
10
|
+
[data]
|
|
11
|
+
NAME = ohm-planet
|
|
12
|
+
GET_DATA_URL = $$(curl -s https://planet.openhistoricalmap.org/planet/state.txt)
|
|
13
|
+
GET_DATA_CMD_1 = curl -LRfC - -o ${NAME}.pbf ${GET_DATA_URL}
|
|
14
|
+
GET_DATA_CMD_2 = osm2rdf ${NAME}.pbf -o ${NAME}.ttl --source-dataset OHM --simplify-wkt 0 --write-ogc-geo-triples none 2>&1 | tee ${NAME}.osm2rdf-log.txt
|
|
15
|
+
GET_DATA_CMD_3 = bzcat ${NAME}.ttl.bz2 | \grep "^osm2rdf" | sed -En 's/^osm2rdf(geom)?:(ohm_)?(node|rel|way)[a-z]*_([0-9]+) geo:asWKT "([^\"]+)".*/ohm\3:\4\t\5/p' | tee ${NAME}.spatialjoin-input.tsv | spatialjoin --contains ' ogc:sfContains ' --intersects ' ogc:sfIntersects ' --suffix $$' .\n' -o ${NAME}.spatialjoin-triples.ttl.bz2 2>&1 | tee ${NAME}.spatialjoin-log.txt && rm -f areas events lines points simplelines
|
|
16
|
+
GET_DATA_CMD = ${GET_DATA_CMD_1} && echo && ${GET_DATA_CMD_2} && echo && ${GET_DATA_CMD_3} && bzcat ${NAME}.ttl.bz2 | head -100 | \grep "^@prefix" > ${NAME}.prefix-definitions
|
|
17
|
+
VERSION = $$(date -r ${NAME}.pbf +%d.%m.%Y || echo "NO_DATE")
|
|
18
|
+
DESCRIPTION = OHM Planet, data from ${GET_DATA_URL} version ${VERSION} (with GeoSPARQL predicates ogc:sfContains and ogc:sfIntersects)
|
|
19
|
+
|
|
20
|
+
[index]
|
|
21
|
+
INPUT_FILES = ${data:NAME}.prefix-definitions ${data:NAME}.spatialjoin-triples.ttl.bz2 ${data:NAME}.ttl.bz2
|
|
22
|
+
CAT_INPUT_FILES = bzcat -f ${INPUT_FILES}
|
|
23
|
+
SETTINGS_JSON = { "prefixes-external": [""], "ascii-prefixes-only": false, "parallel-parsing": true, "num-triples-per-batch": 5000000 }
|
|
24
|
+
|
|
25
|
+
[server]
|
|
26
|
+
PORT = 7037
|
|
27
|
+
ACCESS_TOKEN = ${data:NAME}_32673264324
|
|
28
|
+
MEMORY_FOR_QUERIES = 10G
|
|
29
|
+
CACHE_MAX_SIZE = 5G
|
|
30
|
+
WARMUP_CMD = curl -s http://localhost:${PORT} -H "Accept: application/qlever-results+json" --data-urlencode "query=PREFIX geo: <http://www.opengis.net/ont/geosparql#> SELECT ?subject ?geometry WHERE { ?subject geo:hasGeometry ?m . ?m geo:asWKT ?geometry } INTERNAL SORT BY ?subject" --data-urlencode "access-token=${server:ACCESS_TOKEN}" --data-urlencode "pinresult=true" --data-urlencode "send=0" | jq .resultsize | xargs printf "Result size: %'d\n"
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
[runtime]
|
|
34
|
+
SYSTEM = native
|
|
35
|
+
|
|
36
|
+
[ui]
|
|
37
|
+
CONFIG = ohm-planet
|
qlever/commands/get_data.py
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
import shlex
|
|
4
|
-
import subprocess
|
|
5
4
|
|
|
6
5
|
from qlever.command import QleverCommand
|
|
7
6
|
from qlever.log import log
|
|
8
|
-
from qlever.util import get_total_file_size
|
|
7
|
+
from qlever.util import get_total_file_size, run_command
|
|
9
8
|
|
|
10
9
|
|
|
11
10
|
class GetDataCommand(QleverCommand):
|
|
@@ -36,8 +35,7 @@ class GetDataCommand(QleverCommand):
|
|
|
36
35
|
|
|
37
36
|
# Execute the command line.
|
|
38
37
|
try:
|
|
39
|
-
|
|
40
|
-
stdin=subprocess.DEVNULL, stdout=subprocess.DEVNULL)
|
|
38
|
+
run_command(args.get_data_cmd, show_output=True)
|
|
41
39
|
except Exception as e:
|
|
42
40
|
log.error(f"Problem executing \"{args.get_data_cmd}\": {e}")
|
|
43
41
|
return False
|
qlever/config.py
CHANGED
|
@@ -3,10 +3,11 @@ from __future__ import annotations
|
|
|
3
3
|
import argparse
|
|
4
4
|
import os
|
|
5
5
|
import traceback
|
|
6
|
-
from pathlib import Path
|
|
7
6
|
from importlib.metadata import version
|
|
7
|
+
from pathlib import Path
|
|
8
8
|
|
|
9
9
|
import argcomplete
|
|
10
|
+
from termcolor import colored
|
|
10
11
|
|
|
11
12
|
from qlever import command_objects, script_name
|
|
12
13
|
from qlever.log import log, log_levels
|
|
@@ -115,17 +116,11 @@ class QleverConfig:
|
|
|
115
116
|
argcomplete_enabled = os.environ.get("QLEVER_ARGCOMPLETE_ENABLED")
|
|
116
117
|
if not argcomplete_enabled and not argcomplete_check_off:
|
|
117
118
|
log.info("")
|
|
118
|
-
log.warn(f"
|
|
119
|
-
f"
|
|
120
|
-
f"`.bashrc` or `.zshrc`:"
|
|
119
|
+
log.warn(f"To enable autocompletion, run the following command, "
|
|
120
|
+
f"and consider adding it to your `.bashrc` or `.zshrc`:"
|
|
121
121
|
f"\n\n"
|
|
122
122
|
f"eval \"$(register-python-argcomplete {script_name})\""
|
|
123
|
-
f" && export QLEVER_ARGCOMPLETE_ENABLED=1"
|
|
124
|
-
f"\n\n"
|
|
125
|
-
f"If autocompletion does not work for you or you don't "
|
|
126
|
-
f"want to use it, disable this warning as follows:"
|
|
127
|
-
f"\n\n"
|
|
128
|
-
f"export QLEVER_ARGCOMPLETE_CHECK_OFF")
|
|
123
|
+
f" && export QLEVER_ARGCOMPLETE_ENABLED=1")
|
|
129
124
|
log.info("")
|
|
130
125
|
|
|
131
126
|
# Create a temporary parser only to parse the `--qleverfile` option, in
|
|
@@ -180,7 +175,10 @@ class QleverConfig:
|
|
|
180
175
|
# command. We have a dedicated class for each command. These classes
|
|
181
176
|
# are defined in the modules in `qlever/commands`. In `__init__.py`
|
|
182
177
|
# an object of each class is created and stored in `command_objects`.
|
|
183
|
-
parser = argparse.ArgumentParser(
|
|
178
|
+
parser = argparse.ArgumentParser(
|
|
179
|
+
description=colored("This is the qlever command line tool, "
|
|
180
|
+
"it's all you need to work with QLever",
|
|
181
|
+
attrs=["bold"]))
|
|
184
182
|
parser.add_argument("--version", action="version",
|
|
185
183
|
version=f"%(prog)s {version('qlever')}")
|
|
186
184
|
add_qleverfile_option(parser)
|
|
@@ -198,6 +196,11 @@ class QleverConfig:
|
|
|
198
196
|
# because it is executed whenever the user triggers the autocompletion.
|
|
199
197
|
argcomplete.autocomplete(parser, always_complete_options="long")
|
|
200
198
|
|
|
199
|
+
# If called without arguments, show the help message.
|
|
200
|
+
if len(os.sys.argv) == 1:
|
|
201
|
+
parser.print_help()
|
|
202
|
+
exit(0)
|
|
203
|
+
|
|
201
204
|
# Parse the command line arguments.
|
|
202
205
|
args = parser.parse_args()
|
|
203
206
|
|
qlever/qlever_old.py
CHANGED
|
@@ -5,14 +5,11 @@
|
|
|
5
5
|
# convenient command-line tool for all things QLever. See the `README.md` file
|
|
6
6
|
# for how to use it.
|
|
7
7
|
|
|
8
|
-
from configparser import ConfigParser, ExtendedInterpolation
|
|
9
|
-
from datetime import datetime, date
|
|
10
|
-
import os
|
|
11
8
|
import glob
|
|
12
9
|
import inspect
|
|
13
10
|
import json
|
|
14
11
|
import logging
|
|
15
|
-
import
|
|
12
|
+
import os
|
|
16
13
|
import re
|
|
17
14
|
import shlex
|
|
18
15
|
import shutil
|
|
@@ -20,16 +17,20 @@ import socket
|
|
|
20
17
|
import subprocess
|
|
21
18
|
import sys
|
|
22
19
|
import time
|
|
23
|
-
import pkg_resources
|
|
24
|
-
from termcolor import colored
|
|
25
20
|
import traceback
|
|
21
|
+
from configparser import ConfigParser, ExtendedInterpolation
|
|
22
|
+
from datetime import date, datetime
|
|
23
|
+
|
|
24
|
+
import pkg_resources
|
|
25
|
+
import psutil
|
|
26
|
+
|
|
27
|
+
from qlever.log import log
|
|
26
28
|
|
|
27
29
|
BLUE = "\033[34m"
|
|
28
30
|
RED = "\033[31m"
|
|
29
31
|
BOLD = "\033[1m"
|
|
30
32
|
NORMAL = "\033[0m"
|
|
31
33
|
|
|
32
|
-
from qlever.log import log
|
|
33
34
|
# # Custom formatter for log messages.
|
|
34
35
|
# class CustomFormatter(logging.Formatter):
|
|
35
36
|
# def format(self, record):
|
|
@@ -42,8 +43,8 @@ from qlever.log import log
|
|
|
42
43
|
# return colored(message, "red")
|
|
43
44
|
# else:
|
|
44
45
|
# return message
|
|
45
|
-
#
|
|
46
|
-
#
|
|
46
|
+
#
|
|
47
|
+
#
|
|
47
48
|
# # Custom logger.
|
|
48
49
|
# log = logging.getLogger("qlever")
|
|
49
50
|
# log.setLevel(logging.INFO)
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
qlever/__init__.py,sha256=7VKA8tp5iHZQyTXhDOcxUbloZ7WyxDnkruq0iJOzQcE,1403
|
|
2
2
|
qlever/__main__.py,sha256=MqM37bEzQeJEGUXZvuLcilIvnObZiG2eTGIkfKGpdnw,62016
|
|
3
3
|
qlever/command.py,sha256=yOr0Uc8D8-AM7EjwDsVzbc3KNYjPH-FVOZhIHkqO588,2749
|
|
4
|
-
qlever/config.py,sha256
|
|
4
|
+
qlever/config.py,sha256=qYPy-MQ7BwGrvKSazQWhs0lnlOFqm-d47mpZhc3fptc,10254
|
|
5
5
|
qlever/containerize.py,sha256=p8g3O3G8a_0XLzSTzl_e5t9dqjbCQ-ippoA8vI2Z9pI,4193
|
|
6
6
|
qlever/log.py,sha256=and5prQcLW_5nM8AAZNeNbVqJxLtJmX3EjHFhtHCR28,1279
|
|
7
7
|
qlever/qlever_main.py,sha256=tA_xqOs_FjvqlDIvKTprwuysfTwzsUjE7at26gRhCVA,2336
|
|
8
|
-
qlever/qlever_old.py,sha256=
|
|
8
|
+
qlever/qlever_old.py,sha256=6sHosOfJzkURpdK4wXLdGl4SUtPnlsNEUwAqUeJiRYA,62026
|
|
9
9
|
qlever/qleverfile.py,sha256=6Ll81xkzel_s2Ju9ZfBXUGlRfikaAzZM6Do-dTrdo3k,12934
|
|
10
10
|
qlever/util.py,sha256=eepj0SY9JJOUQq5kvtoPnWfoLLV9fbw_sTEWKHet66E,7147
|
|
11
11
|
qlever/Qleverfiles/Qleverfile.dblp,sha256=SFjBD20aOSWod4mEQnxHSDWdInoE_EFp2nyMw7ev7ZA,1167
|
|
@@ -15,6 +15,7 @@ qlever/Qleverfiles/Qleverfile.dnb,sha256=yw4MmLsDPP3P5JWPgJwgPJh66TqwkyUXbQR5lSf
|
|
|
15
15
|
qlever/Qleverfiles/Qleverfile.fbeasy,sha256=jeztW4gFpWL_w1nCH5qGHeZyZv2lz_kG6f1G3r3DkJ4,974
|
|
16
16
|
qlever/Qleverfiles/Qleverfile.freebase,sha256=k6PqYrtHTBr0EydObm1Hg9QWyAAM9fXkdcjhReDg0fM,1035
|
|
17
17
|
qlever/Qleverfiles/Qleverfile.imdb,sha256=uL5XlPwX01AmH-j6_Bc-PRm2fuPxGSIu8NaDflY525U,1623
|
|
18
|
+
qlever/Qleverfiles/Qleverfile.ohm-planet,sha256=PVf9xf11KoPfKBAwYVrOAjibUZ2EG5giCSmllFqcmmQ,2493
|
|
18
19
|
qlever/Qleverfiles/Qleverfile.olympics,sha256=5w9BOFwEBhdSzPz-0LRxwhv-7Gj6xbF539HOXr3cqD0,1088
|
|
19
20
|
qlever/Qleverfiles/Qleverfile.osm-country,sha256=UnlkckSXJDrknZORlU-Hdj_J82U4kStl1aRctCc5n6M,1953
|
|
20
21
|
qlever/Qleverfiles/Qleverfile.osm-planet,sha256=2RilNix0fplN3GsNNyOu3GzmUss1Pq7586WKOFAQnSs,1400
|
|
@@ -30,7 +31,7 @@ qlever/commands/add_text_index.py,sha256=dkqYtwgOhgnXiei_eyhBWYCtdAiQUEmjWoa3JMl
|
|
|
30
31
|
qlever/commands/cache_stats.py,sha256=6JjueQstAqc8dNfgY8TP2EitFMxdUvCwrcyd7KUEb2o,4157
|
|
31
32
|
qlever/commands/clear_cache.py,sha256=AnE1MOoj1ZexxrRT8FGeBLlv8rtQIVV4DP8VBn5-X-s,2843
|
|
32
33
|
qlever/commands/example_queries.py,sha256=2rYTd35t0r7et0i-IBBcCpmVlYZya9kvwSI-gdTpNdE,12326
|
|
33
|
-
qlever/commands/get_data.py,sha256=
|
|
34
|
+
qlever/commands/get_data.py,sha256=f9kjZI3TKad6JHSuXWNkeoajmW8h0Sx8ShvjauDCtNo,1412
|
|
34
35
|
qlever/commands/index.py,sha256=lJhDnweknFZQm1czqPzNyz33EvbjIvOrS4j0wDaJ98o,5663
|
|
35
36
|
qlever/commands/index_stats.py,sha256=_BiUNBhmbYd9RPxrlm4HF0oENO6JmqnRiAkwkyOdN4U,11722
|
|
36
37
|
qlever/commands/log.py,sha256=8Krt3MsTUDapYqVw1zUu5X15SF8mV97Uj0qKOWK8jXk,1861
|
|
@@ -40,9 +41,9 @@ qlever/commands/status.py,sha256=5S6EdapZEwFKV9cQZtNYcZhMbAXAY-FP6ggjIhfX8ek,163
|
|
|
40
41
|
qlever/commands/stop.py,sha256=TZs4bxKHvujlZAU8BZmFjA5eXSZNAa6EeNzvPpEZsuI,4139
|
|
41
42
|
qlever/commands/ui.py,sha256=rV8u017WLbfz0zVT_c9GC4d9v1WWwrTM3kfGONbeCvQ,2499
|
|
42
43
|
qlever/commands/warmup.py,sha256=WOZSxeV8U_F6pEEnAb6YybXLQMxZFTRJXs4BPHUhsmc,1030
|
|
43
|
-
qlever-0.
|
|
44
|
-
qlever-0.
|
|
45
|
-
qlever-0.
|
|
46
|
-
qlever-0.
|
|
47
|
-
qlever-0.
|
|
48
|
-
qlever-0.
|
|
44
|
+
qlever-0.5.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
45
|
+
qlever-0.5.0.dist-info/METADATA,sha256=GtQdaBBOd5WYb2_UrqpTawHjJsKkEbEI6qyyaVi4rwY,4146
|
|
46
|
+
qlever-0.5.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
47
|
+
qlever-0.5.0.dist-info/entry_points.txt,sha256=U_gbYYi0wwdsn884eb0XoOXfvhACOsxhlO330dZ9bi0,87
|
|
48
|
+
qlever-0.5.0.dist-info/top_level.txt,sha256=kd3zsYqiFd0--Czh5XTVkfEq6XR-XgRFW35X0v0GT-c,7
|
|
49
|
+
qlever-0.5.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|