qlever 0.5.6__py3-none-any.whl → 0.5.7__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 +14 -14
- qlever/Qleverfiles/Qleverfile.osm-country +27 -21
- qlever/commands/index.py +8 -5
- qlever/containerize.py +12 -0
- qlever/util.py +2 -16
- {qlever-0.5.6.dist-info → qlever-0.5.7.dist-info}/METADATA +1 -1
- {qlever-0.5.6.dist-info → qlever-0.5.7.dist-info}/RECORD +11 -11
- {qlever-0.5.6.dist-info → qlever-0.5.7.dist-info}/WHEEL +1 -1
- {qlever-0.5.6.dist-info → qlever-0.5.7.dist-info}/LICENSE +0 -0
- {qlever-0.5.6.dist-info → qlever-0.5.7.dist-info}/entry_points.txt +0 -0
- {qlever-0.5.6.dist-info → qlever-0.5.7.dist-info}/top_level.txt +0 -0
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
# Qleverfile for OHM Planet, use with https://github.com/ad-freiburg/qlever-control
|
|
2
2
|
#
|
|
3
3
|
# qlever get-data # ~20 mins (download PBF, convert to TTL, add GeoSPARQL triples)
|
|
4
|
-
# qlever index # ~
|
|
4
|
+
# qlever index # ~20 mins and ~5 GB RAM (on an AMD Ryzen 9 5900X)
|
|
5
5
|
# qlever start # ~1 sec
|
|
6
6
|
#
|
|
7
|
-
# For `qlever get-data` to work, `osm2rdf`
|
|
8
|
-
# and included in the `PATH`.
|
|
7
|
+
# For `qlever get-data` to work, `osm2rdf` must be installed and in the `PATH`.
|
|
9
8
|
|
|
10
9
|
[data]
|
|
11
10
|
NAME = ohm-planet
|
|
12
11
|
GET_DATA_URL = https://planet.openhistoricalmap.org/planet
|
|
12
|
+
CHECK_BINARIES = osm2rdf -h > /dev/null || (echo "osm2rdf not found, make sure that it's installed and in your PATH" && exit 1)
|
|
13
13
|
GET_DATA_CMD_1 = curl -LRfC - -o ${NAME}.pbf $$(curl -s ${GET_DATA_URL}/state.txt) 2>&1 | tee ${NAME}.download-log.txt
|
|
14
|
-
GET_DATA_CMD_2 = osm2rdf ${NAME}.pbf -o ${NAME}.ttl --source-dataset OHM --
|
|
15
|
-
|
|
16
|
-
GET_DATA_CMD = set -o pipefail && ${GET_DATA_CMD_1} && echo && ${GET_DATA_CMD_2} && echo && ${GET_DATA_CMD_3} && head -100 <(bzcat ${NAME}.ttl.bz2) | sed '/^@prefix/!d' > ${NAME}.prefix-definitions
|
|
14
|
+
GET_DATA_CMD_2 = osm2rdf ${NAME}.pbf -o ${NAME}.ttl --source-dataset OHM --cache . --add-hascentroid 2>&1 | tee ${NAME}.osm2rdf-log.txt
|
|
15
|
+
GET_DATA_CMD = set -o pipefail && ${CHECK_BINARIES} && ${GET_DATA_CMD_1} && echo && ${GET_DATA_CMD_2}
|
|
17
16
|
VERSION = $$(date -r ${NAME}.pbf +%d.%m.%Y || echo "NO_DATE")
|
|
18
17
|
DESCRIPTION = OHM Planet, data from ${GET_DATA_URL} version ${VERSION} (with GeoSPARQL predicates ogc:sfContains and ogc:sfIntersects)
|
|
19
18
|
|
|
20
19
|
[index]
|
|
21
|
-
INPUT_FILES = ${data:NAME}.
|
|
20
|
+
INPUT_FILES = ${data:NAME}.ttl.bz2
|
|
22
21
|
CAT_INPUT_FILES = bzcat -f ${INPUT_FILES}
|
|
23
22
|
SETTINGS_JSON = { "prefixes-external": [""], "ascii-prefixes-only": false, "parallel-parsing": true, "num-triples-per-batch": 5000000 }
|
|
24
23
|
|
|
25
24
|
[server]
|
|
26
|
-
PORT
|
|
27
|
-
ACCESS_TOKEN
|
|
28
|
-
MEMORY_FOR_QUERIES
|
|
29
|
-
CACHE_MAX_SIZE
|
|
30
|
-
|
|
31
|
-
|
|
25
|
+
PORT = 7037
|
|
26
|
+
ACCESS_TOKEN = ${data:NAME}
|
|
27
|
+
MEMORY_FOR_QUERIES = 10G
|
|
28
|
+
CACHE_MAX_SIZE = 5G
|
|
29
|
+
CACHE_MAX_SIZE_SINGLE_ENTRY = 4G
|
|
30
|
+
WARMUP_CMD = curl -s https://qlever.cs.uni-freiburg.de/mapui-petri/query --data-urlencode "query=PREFIX geo: <http://www.opengis.net/ont/geosparql#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX osm: <https://www.openstreetmap.org/> SELECT ?osm_id ?geometry WHERE { ?osm_id geo:hasGeometry/geo:asWKT ?geometry . ?osm_id rdf:type osm:node } LIMIT 1" --data-urlencode "backend=https://qlever.cs.uni-freiburg.de/api/${data:NAME}" > /dev/null
|
|
32
31
|
|
|
33
32
|
[runtime]
|
|
34
|
-
SYSTEM =
|
|
33
|
+
SYSTEM = docker
|
|
34
|
+
IMAGE = adfreiburg/qlever:latest
|
|
35
35
|
|
|
36
36
|
[ui]
|
|
37
37
|
CONFIG = ohm-planet
|
|
@@ -8,35 +8,41 @@
|
|
|
8
8
|
# the link under GET_DATA_CMD exists (the names are usually the canonical
|
|
9
9
|
# names). The time for osm2rdf is around the same as that for "qlever index".
|
|
10
10
|
|
|
11
|
-
#
|
|
11
|
+
# Dataset settings
|
|
12
|
+
[data]
|
|
12
13
|
CONTINENT = europe
|
|
13
14
|
COUNTRY = switzerland
|
|
14
|
-
|
|
15
|
-
PBF = ${
|
|
16
|
-
RDF_FILES = "${DB}.ttl.bz2"
|
|
17
|
-
CAT_FILES = "bzcat ${RDF_FILES}"
|
|
15
|
+
NAME = osm-${COUNTRY}
|
|
16
|
+
PBF = ${NAME}.pbf
|
|
18
17
|
WITH_TEXT = false
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
VERSION = $$(ls -l --time-style=+%d.%m.%Y ${PBF} 2> /dev/null | cut -d' ' -f6)
|
|
19
|
+
GET_DATA_CMD = wget -nc -O ${PBF} https://download.geofabrik.de/${CONTINENT}/${COUNTRY}-latest.osm.pbf; rm -f ${NAME}.*.bz2; ( time osm2rdf ${PBF} -o ${NAME}.ttl --cache . ) 2>&1 | tee ${NAME}.osm2rdf-log.txt; rm -f spatial-*
|
|
20
|
+
DESCRIPTION = OSM ${COUNTRY}, dump from ${VERSION} with ogc:sfContains
|
|
21
|
+
|
|
22
|
+
# Indexer settings
|
|
23
|
+
[index]
|
|
24
|
+
INPUT_FILES = ${data:NAME}.ttl.bz2
|
|
25
|
+
CAT_INPUT_FILES = bzcat ${data:NAME}.ttl.bz2
|
|
26
|
+
STXXL_MEMORY = 10G
|
|
27
|
+
SETTINGS_JSON = { "prefixes-external": [ "\"LINESTRING(", "\"MULTIPOLYGON(", "\"POLYGON(" ], "ascii-prefixes-only": false, "num-triples-per-batch": 1000000 }
|
|
23
28
|
|
|
24
29
|
# Server settings
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
30
|
+
[server]
|
|
31
|
+
HOSTNAME = localhost
|
|
32
|
+
PORT = 7025
|
|
33
|
+
ACCESS_TOKEN = ${data:NAME}_%RANDOM%
|
|
28
34
|
MEMORY_FOR_QUERIES = 20G
|
|
29
35
|
CACHE_MAX_SIZE = 10G
|
|
30
36
|
CACHE_MAX_SIZE_SINGLE_ENTRY = 5G
|
|
31
37
|
CACHE_MAX_NUM_ENTRIES = 100
|
|
38
|
+
TIMEOUT = 100s
|
|
32
39
|
|
|
33
|
-
#
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
QLEVER_DOCKER_CONTAINER = qlever.${DB}
|
|
40
|
+
# Runtime to use
|
|
41
|
+
[runtime]
|
|
42
|
+
SYSTEM = docker
|
|
43
|
+
IMAGE = docker.io/adfreiburg/qlever:latest
|
|
38
44
|
|
|
39
|
-
#
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
45
|
+
# Qlever UI
|
|
46
|
+
[ui]
|
|
47
|
+
UI_PORT = 7000
|
|
48
|
+
UI_CONFIG = osm
|
qlever/commands/index.py
CHANGED
|
@@ -119,11 +119,14 @@ class IndexCommand(QleverCommand):
|
|
|
119
119
|
# Remove already existing container.
|
|
120
120
|
if args.system in Containerize.supported_systems() \
|
|
121
121
|
and args.overwrite_existing:
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
122
|
+
if Containerize.is_running(args.system, args.index_container):
|
|
123
|
+
log.info("Another index process is running, trying to stop it ...")
|
|
124
|
+
log.info("")
|
|
125
|
+
try:
|
|
126
|
+
run_command(f"{args.system} rm -f {args.index_container}")
|
|
127
|
+
except Exception as e:
|
|
128
|
+
log.error(f"Removing existing container failed: {e}")
|
|
129
|
+
return False
|
|
127
130
|
|
|
128
131
|
# Write settings.json file.
|
|
129
132
|
try:
|
qlever/containerize.py
CHANGED
|
@@ -9,6 +9,7 @@ import subprocess
|
|
|
9
9
|
from typing import Optional
|
|
10
10
|
|
|
11
11
|
from qlever.log import log
|
|
12
|
+
from qlever.util import run_command
|
|
12
13
|
|
|
13
14
|
|
|
14
15
|
class ContainerizeException(Exception):
|
|
@@ -78,6 +79,17 @@ class Containerize:
|
|
|
78
79
|
f" -c {shlex.quote(cmd)}")
|
|
79
80
|
return containerized_cmd
|
|
80
81
|
|
|
82
|
+
@staticmethod
|
|
83
|
+
def is_running(container_system: str, container_name: str) -> bool:
|
|
84
|
+
# Note: the `{{{{` and `}}}}` result in `{{` and `}}`, respectively.
|
|
85
|
+
containers = (
|
|
86
|
+
run_command(f"{container_system} ps --format=\"{{{{.Names}}}}\"",
|
|
87
|
+
return_output=True)
|
|
88
|
+
.strip()
|
|
89
|
+
.splitlines()
|
|
90
|
+
)
|
|
91
|
+
return container_name in containers
|
|
92
|
+
|
|
81
93
|
@staticmethod
|
|
82
94
|
def stop_and_remove_container(container_system: str,
|
|
83
95
|
container_name: str) -> bool:
|
qlever/util.py
CHANGED
|
@@ -186,9 +186,8 @@ def get_random_string(length: int) -> str:
|
|
|
186
186
|
|
|
187
187
|
def is_port_used(port: int) -> bool:
|
|
188
188
|
"""
|
|
189
|
-
Try to bind to the port on all interfaces to check if the port is already
|
|
190
|
-
|
|
191
|
-
`OSError` with errno EADDRINUSE.
|
|
189
|
+
Try to bind to the port on all interfaces to check if the port is already in use.
|
|
190
|
+
If the port is already in use, `socket.bind` will raise an `OSError` with errno EADDRINUSE.
|
|
192
191
|
"""
|
|
193
192
|
try:
|
|
194
193
|
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
@@ -201,16 +200,3 @@ def is_port_used(port: int) -> bool:
|
|
|
201
200
|
if err.errno != errno.EADDRINUSE:
|
|
202
201
|
log.warning(f"Failed to determine if port is used: {err}")
|
|
203
202
|
return True
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
def check_if_installed(name: str, check_cmd: str) -> bool:
|
|
207
|
-
"""
|
|
208
|
-
Helper function that checks if a given program is installed by running
|
|
209
|
-
the given command.
|
|
210
|
-
"""
|
|
211
|
-
try:
|
|
212
|
-
run_command(check_cmd)
|
|
213
|
-
return True
|
|
214
|
-
except Exception as e:
|
|
215
|
-
log.error(f"{name} is not installed: {e}")
|
|
216
|
-
return False
|
|
@@ -2,12 +2,12 @@ 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
4
|
qlever/config.py,sha256=qYPy-MQ7BwGrvKSazQWhs0lnlOFqm-d47mpZhc3fptc,10254
|
|
5
|
-
qlever/containerize.py,sha256=
|
|
5
|
+
qlever/containerize.py,sha256=HRtC5jrRRpcBmdrXK2LsEAKiGVq2dWH1Oa2Ps2nvAsE,4643
|
|
6
6
|
qlever/log.py,sha256=2O_RvFymnu_dB10ErBTAOsI8bgjORfdD0tE3USH-siM,1315
|
|
7
7
|
qlever/qlever_main.py,sha256=tA_xqOs_FjvqlDIvKTprwuysfTwzsUjE7at26gRhCVA,2336
|
|
8
8
|
qlever/qlever_old.py,sha256=X-JxmepFKYeFgSLLp0TRDNqXSxDwIbc8_0Xstiems8c,62026
|
|
9
9
|
qlever/qleverfile.py,sha256=D321zDnWi-ScCefbFGBydKKI7lzzr1CkohHW6KuwVw0,13106
|
|
10
|
-
qlever/util.py,sha256=
|
|
10
|
+
qlever/util.py,sha256=20NQJquSk_mSqvlK4k0OrSBqWrxKs5SgVshm5ucus5o,7847
|
|
11
11
|
qlever/Qleverfiles/Qleverfile.dblp,sha256=Y6BqAG1GZg-OmEs0HM00yAQuY2TGnSzsOO1LLmGVn2Y,994
|
|
12
12
|
qlever/Qleverfiles/Qleverfile.dblp-plus,sha256=Dwd9pK1vPcelKfw6sA-IuyhbZ6yIxOh6_84JgPYnB9Q,1332
|
|
13
13
|
qlever/Qleverfiles/Qleverfile.dbpedia,sha256=aaNZZayE-zVePGSwPzXemkX__Ns8-kP_E7DNNKZPnqg,1160
|
|
@@ -16,9 +16,9 @@ qlever/Qleverfiles/Qleverfile.dnb,sha256=43w_CVi00yf7FHdDvBtHHQR3yU1d-JCNnD_uxYZ
|
|
|
16
16
|
qlever/Qleverfiles/Qleverfile.fbeasy,sha256=jeztW4gFpWL_w1nCH5qGHeZyZv2lz_kG6f1G3r3DkJ4,974
|
|
17
17
|
qlever/Qleverfiles/Qleverfile.freebase,sha256=k6PqYrtHTBr0EydObm1Hg9QWyAAM9fXkdcjhReDg0fM,1035
|
|
18
18
|
qlever/Qleverfiles/Qleverfile.imdb,sha256=8F6tpEi0uXsMm6lofwjNkLq1X9IEUSoHK8YK_5YCf_g,1638
|
|
19
|
-
qlever/Qleverfiles/Qleverfile.ohm-planet,sha256=
|
|
19
|
+
qlever/Qleverfiles/Qleverfile.ohm-planet,sha256=yG6NgW6x6sGTzmCi1wEAkQ-i9goTj2u3PQxvCUwjExs,2122
|
|
20
20
|
qlever/Qleverfiles/Qleverfile.olympics,sha256=5w9BOFwEBhdSzPz-0LRxwhv-7Gj6xbF539HOXr3cqD0,1088
|
|
21
|
-
qlever/Qleverfiles/Qleverfile.osm-country,sha256=
|
|
21
|
+
qlever/Qleverfiles/Qleverfile.osm-country,sha256=Pb9o5H3b7wVlVRgdiPHWCvrnkIRS1YUhxOazbUmoKZE,1897
|
|
22
22
|
qlever/Qleverfiles/Qleverfile.osm-planet,sha256=2RilNix0fplN3GsNNyOu3GzmUss1Pq7586WKOFAQnSs,1400
|
|
23
23
|
qlever/Qleverfiles/Qleverfile.pubchem,sha256=YuDzWQmukSvL1opu7cf1KX9407_P21lmecYZ9cdbuvA,5611
|
|
24
24
|
qlever/Qleverfiles/Qleverfile.scientists,sha256=9eZ2c6P9a3E3VHa3RR7LdOQbF4k3oyyrn56Z3u4LZYs,1164
|
|
@@ -34,7 +34,7 @@ qlever/commands/cache_stats.py,sha256=6JjueQstAqc8dNfgY8TP2EitFMxdUvCwrcyd7KUEb2
|
|
|
34
34
|
qlever/commands/clear_cache.py,sha256=AnE1MOoj1ZexxrRT8FGeBLlv8rtQIVV4DP8VBn5-X-s,2843
|
|
35
35
|
qlever/commands/example_queries.py,sha256=5-0ln5EkuDcQYPqKKAOcLaTIStMzFhkAogaNedfRc_I,15271
|
|
36
36
|
qlever/commands/get_data.py,sha256=f9kjZI3TKad6JHSuXWNkeoajmW8h0Sx8ShvjauDCtNo,1412
|
|
37
|
-
qlever/commands/index.py,sha256=
|
|
37
|
+
qlever/commands/index.py,sha256=TwL6o16KZON1hbD8UnXMw_tduLXWcy7D4o6tbsLt1OE,5888
|
|
38
38
|
qlever/commands/index_stats.py,sha256=_BiUNBhmbYd9RPxrlm4HF0oENO6JmqnRiAkwkyOdN4U,11722
|
|
39
39
|
qlever/commands/log.py,sha256=8Krt3MsTUDapYqVw1zUu5X15SF8mV97Uj0qKOWK8jXk,1861
|
|
40
40
|
qlever/commands/query.py,sha256=_IDH-M8gKL_f1i5wzu0X452pZSUD0_qXl6bPXC85wX0,2750
|
|
@@ -44,9 +44,9 @@ qlever/commands/status.py,sha256=5S6EdapZEwFKV9cQZtNYcZhMbAXAY-FP6ggjIhfX8ek,163
|
|
|
44
44
|
qlever/commands/stop.py,sha256=TZs4bxKHvujlZAU8BZmFjA5eXSZNAa6EeNzvPpEZsuI,4139
|
|
45
45
|
qlever/commands/ui.py,sha256=b7g7Mp6ZWevn8f1kwFr-WR4ZWMq42KEV4cGl2QS7M1E,2828
|
|
46
46
|
qlever/commands/warmup.py,sha256=WOZSxeV8U_F6pEEnAb6YybXLQMxZFTRJXs4BPHUhsmc,1030
|
|
47
|
-
qlever-0.5.
|
|
48
|
-
qlever-0.5.
|
|
49
|
-
qlever-0.5.
|
|
50
|
-
qlever-0.5.
|
|
51
|
-
qlever-0.5.
|
|
52
|
-
qlever-0.5.
|
|
47
|
+
qlever-0.5.7.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
48
|
+
qlever-0.5.7.dist-info/METADATA,sha256=4g8Lf7NVarNL99xbtFGOCRTPky--pHznE7WtwYgYjfk,4582
|
|
49
|
+
qlever-0.5.7.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
|
|
50
|
+
qlever-0.5.7.dist-info/entry_points.txt,sha256=U_gbYYi0wwdsn884eb0XoOXfvhACOsxhlO330dZ9bi0,87
|
|
51
|
+
qlever-0.5.7.dist-info/top_level.txt,sha256=kd3zsYqiFd0--Czh5XTVkfEq6XR-XgRFW35X0v0GT-c,7
|
|
52
|
+
qlever-0.5.7.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|