qlever 0.3.0__py3-none-any.whl → 0.3.1__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.yago-4 +25 -29
- qlever/__init__.py +83 -11
- {qlever-0.3.0.dist-info → qlever-0.3.1.dist-info}/METADATA +1 -1
- {qlever-0.3.0.dist-info → qlever-0.3.1.dist-info}/RECORD +8 -9
- qlever/Qleverfiles/Qleverfile.gnd +0 -31
- {qlever-0.3.0.dist-info → qlever-0.3.1.dist-info}/LICENSE +0 -0
- {qlever-0.3.0.dist-info → qlever-0.3.1.dist-info}/WHEEL +0 -0
- {qlever-0.3.0.dist-info → qlever-0.3.1.dist-info}/entry_points.txt +0 -0
- {qlever-0.3.0.dist-info → qlever-0.3.1.dist-info}/top_level.txt +0 -0
|
@@ -1,41 +1,37 @@
|
|
|
1
1
|
# Qleverfile for YAGO 4, use with https://github.com/ad-freiburg/qlever-control
|
|
2
2
|
#
|
|
3
|
-
# qlever get-data # downloads
|
|
4
|
-
# qlever index # takes ~4
|
|
5
|
-
# qlever start # starts the server
|
|
3
|
+
# qlever get-data # downloads 8 nt.gz file of size ~60 GB (as of 12.03.2020)
|
|
4
|
+
# qlever index # takes ~4 hours and ~10 GB RAM (on an AMD Ryzen 9 5900X)
|
|
5
|
+
# qlever start # starts the server
|
|
6
6
|
|
|
7
|
-
#
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
WITH_TEXT_INDEX = false
|
|
12
|
-
STXXL_MEMORY = 10G
|
|
13
|
-
SETTINGS_JSON = '{ "languages-internal": ["en"], "locale": { "language": "en", "country": "US", "ignore-punctuation": true }, "ascii-prefixes-only": true, "num-triples-per-batch": 5000000 }'
|
|
7
|
+
# NOTE concerning GET_DATA_CMD: The triples from wd-annotated-facts are
|
|
8
|
+
# contained in wd-facts. The "full types" are the YAGO types, the "simple
|
|
9
|
+
# types" are the schema.org types. They don't interfere with each other because
|
|
10
|
+
# they have distinct prefixes.
|
|
14
11
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
# "full types" are the YAGO types, the "simple types" are the schema.org types.
|
|
19
|
-
# They don't interfere with each other because they have distinct prefixes.
|
|
20
|
-
GET_DATA_CMD = "wget -nc https://yago-knowledge.org/data/yago4/full/2020-02-24/yago-wd-class.nt.gz https://yago-knowledge.org/data/yago4/full/2020-02-24/yago-wd-facts.nt.gz https://yago-knowledge.org/data/yago4/full/2020-02-24/yago-wd-full-types.nt.gz https://yago-knowledge.org/data/yago4/full/2020-02-24/yago-wd-labels.nt.gz https://yago-knowledge.org/data/yago4/full/2020-02-24/yago-wd-sameAs.nt.gz https://yago-knowledge.org/data/yago4/full/2020-02-24/yago-wd-schema.nt.gz https://yago-knowledge.org/data/yago4/full/2020-02-24/yago-wd-shapes.nt.gz https://yago-knowledge.org/data/yago4/full/2020-02-24/yago-wd-simple-types.nt.gz"
|
|
12
|
+
[data]
|
|
13
|
+
NAME = yago-4
|
|
14
|
+
GET_DATA_CMD = curl --location --continue-at - --remote-name-all https://yago-knowledge.org/data/yago4/full/2020-02-24/yago-wd-class.nt.gz https://yago-knowledge.org/data/yago4/full/2020-02-24/yago-wd-facts.nt.gz https://yago-knowledge.org/data/yago4/full/2020-02-24/yago-wd-full-types.nt.gz https://yago-knowledge.org/data/yago4/full/2020-02-24/yago-wd-labels.nt.gz https://yago-knowledge.org/data/yago4/full/2020-02-24/yago-wd-sameAs.nt.gz https://yago-knowledge.org/data/yago4/full/2020-02-24/yago-wd-schema.nt.gz https://yago-knowledge.org/data/yago4/full/2020-02-24/yago-wd-shapes.nt.gz https://yago-knowledge.org/data/yago4/full/2020-02-24/yago-wd-simple-types.nt.gz
|
|
21
15
|
INDEX_DESCRIPTION = "Full dump from https://yago-knowledge.org/downloads/yago-4, version 12.03.2020"
|
|
22
16
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
17
|
+
[index]
|
|
18
|
+
FILE_NAMES = yago-wd-*.nt.gz
|
|
19
|
+
CAT_FILES = zcat ${FILE_NAMES}
|
|
20
|
+
WITH_TEXT_INDEX = false
|
|
21
|
+
STXXL_MEMORY = 10G
|
|
22
|
+
SETTINGS_JSON = { "languages-internal": ["en"], "locale": { "language": "en", "country": "US", "ignore-punctuation": true }, "ascii-prefixes-only": false, "num-triples-per-batch": 5000000 }
|
|
23
|
+
|
|
24
|
+
[server]
|
|
25
|
+
PORT = 9004
|
|
26
26
|
ACCESS_TOKEN = ${DB}_2347348732
|
|
27
27
|
MEMORY_FOR_QUERIES = 30G
|
|
28
28
|
CACHE_MAX_SIZE = 20G
|
|
29
29
|
CACHE_MAX_SIZE_SINGLE_ENTRY = 5G
|
|
30
|
-
CACHE_MAX_NUM_ENTRIES = 100
|
|
31
30
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
QLEVER_DOCKER_IMAGE = adfreiburg/qlever
|
|
36
|
-
QLEVER_DOCKER_CONTAINER = qlever.${DB}
|
|
31
|
+
[docker]
|
|
32
|
+
USE_DOCKER = true
|
|
33
|
+
IMAGE = adfreiburg/qlever
|
|
37
34
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
QLEVERUI_CONFIG = yago-4
|
|
35
|
+
[ui]
|
|
36
|
+
PORT = 7000
|
|
37
|
+
CONFIG = yago-4
|
qlever/__init__.py
CHANGED
|
@@ -146,6 +146,11 @@ class Actions:
|
|
|
146
146
|
"general": {
|
|
147
147
|
"log_level": "info",
|
|
148
148
|
"pid": "0",
|
|
149
|
+
"example_queries_url": (f"https://qlever.cs.uni-freiburg.de/"
|
|
150
|
+
f"api/examples/"
|
|
151
|
+
f"{self.config['ui']['config']}"),
|
|
152
|
+
"example_queries_limit": "10",
|
|
153
|
+
"example_queries_send": "0",
|
|
149
154
|
},
|
|
150
155
|
"index": {
|
|
151
156
|
"binary": "IndexBuilderMain",
|
|
@@ -1016,6 +1021,59 @@ class Actions:
|
|
|
1016
1021
|
raise ActionException(f"Failed to get cache stats and settings: "
|
|
1017
1022
|
f"{e}")
|
|
1018
1023
|
|
|
1024
|
+
@track_action_rank
|
|
1025
|
+
def action_clear_cache(self, only_show=False):
|
|
1026
|
+
"""
|
|
1027
|
+
Action that clears the cache (unpinned entries only).
|
|
1028
|
+
"""
|
|
1029
|
+
|
|
1030
|
+
# Construct the curl command.
|
|
1031
|
+
clear_cache_cmd = (f"curl -s {self.config['server']['url']} "
|
|
1032
|
+
f"--data-urlencode \"cmd=clear-cache\"")
|
|
1033
|
+
|
|
1034
|
+
# Show it.
|
|
1035
|
+
self.show(clear_cache_cmd, only_show)
|
|
1036
|
+
if only_show:
|
|
1037
|
+
return
|
|
1038
|
+
|
|
1039
|
+
# Execute it.
|
|
1040
|
+
try:
|
|
1041
|
+
subprocess.run(clear_cache_cmd, shell=True,
|
|
1042
|
+
stdout=subprocess.DEVNULL)
|
|
1043
|
+
print("Cache cleared (only unpinned entries)")
|
|
1044
|
+
print()
|
|
1045
|
+
self.action_cache_stats_and_settings(only_show)
|
|
1046
|
+
except Exception as e:
|
|
1047
|
+
raise ActionException(f"Failed to clear the cache: {e}")
|
|
1048
|
+
|
|
1049
|
+
@track_action_rank
|
|
1050
|
+
def action_clear_cache_complete(self, only_show=False):
|
|
1051
|
+
"""
|
|
1052
|
+
Action that clears the cache completely (both pinned and unpinned
|
|
1053
|
+
entries).
|
|
1054
|
+
"""
|
|
1055
|
+
|
|
1056
|
+
# Construct the curl command.
|
|
1057
|
+
access_token = self.config['server']['access_token']
|
|
1058
|
+
clear_cache_cmd = (f"curl -s {self.config['server']['url']} "
|
|
1059
|
+
f"--data-urlencode \"cmd=clear-cache-complete\" "
|
|
1060
|
+
f"--data-urlencode \"access-token={access_token}\"")
|
|
1061
|
+
|
|
1062
|
+
# Show it.
|
|
1063
|
+
self.show(clear_cache_cmd, only_show)
|
|
1064
|
+
if only_show:
|
|
1065
|
+
return
|
|
1066
|
+
|
|
1067
|
+
# Execute it.
|
|
1068
|
+
try:
|
|
1069
|
+
subprocess.run(clear_cache_cmd, shell=True,
|
|
1070
|
+
stdout=subprocess.DEVNULL)
|
|
1071
|
+
print("Cache cleared (both pinned and unpinned entries)")
|
|
1072
|
+
print()
|
|
1073
|
+
self.action_cache_stats_and_settings(only_show)
|
|
1074
|
+
except Exception as e:
|
|
1075
|
+
raise ActionException(f"Failed to clear the cache: {e}")
|
|
1076
|
+
|
|
1019
1077
|
@track_action_rank
|
|
1020
1078
|
def action_autocompletion_warmup(self, only_show=False):
|
|
1021
1079
|
"""
|
|
@@ -1064,6 +1122,8 @@ class Actions:
|
|
|
1064
1122
|
f"--data-urlencode access-token={access_token} "
|
|
1065
1123
|
f"--data-urlencode pinresult=true "
|
|
1066
1124
|
f"--data-urlencode send=0")
|
|
1125
|
+
clear_cache_cmd = (f"curl -s {self.config['server']['url']} "
|
|
1126
|
+
f"--data-urlencode \"cmd=clear-cache\"")
|
|
1067
1127
|
log.info(pin_cmd)
|
|
1068
1128
|
# Launch query and show the `resultsize` of the JSON response.
|
|
1069
1129
|
try:
|
|
@@ -1073,6 +1133,9 @@ class Actions:
|
|
|
1073
1133
|
if "exception" in json_result:
|
|
1074
1134
|
raise Exception(json_result["exception"])
|
|
1075
1135
|
log.info(f"Result size: {json_result['resultsize']:,}")
|
|
1136
|
+
log.info(clear_cache_cmd)
|
|
1137
|
+
subprocess.check_output(clear_cache_cmd, shell=True,
|
|
1138
|
+
stderr=subprocess.DEVNULL)
|
|
1076
1139
|
except Exception as e:
|
|
1077
1140
|
log.error(f"Query failed: {e}")
|
|
1078
1141
|
|
|
@@ -1083,14 +1146,18 @@ class Actions:
|
|
|
1083
1146
|
"""
|
|
1084
1147
|
|
|
1085
1148
|
# Construct curl command to obtain the example queries.
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1149
|
+
config_general = self.config["general"]
|
|
1150
|
+
example_queries_url = config_general["example_queries_url"]
|
|
1151
|
+
example_queries_limit = int(config_general["example_queries_limit"])
|
|
1152
|
+
example_queries_send = int(config_general["example_queries_send"])
|
|
1153
|
+
curl_cmd = f"curl -s {example_queries_url}"
|
|
1089
1154
|
|
|
1090
1155
|
# Show what the action does.
|
|
1091
1156
|
self.show(f"Launch example queries obtained via: {curl_cmd}\n"
|
|
1092
1157
|
f"SPARQL endpoint: {self.config['server']['url']}\n"
|
|
1093
|
-
f"Clearing the cache before each query
|
|
1158
|
+
f"Clearing the cache before each query\n"
|
|
1159
|
+
f"Using send={example_queries_send} and limit="
|
|
1160
|
+
f"{example_queries_limit}",
|
|
1094
1161
|
only_show)
|
|
1095
1162
|
if only_show:
|
|
1096
1163
|
return
|
|
@@ -1114,7 +1181,7 @@ class Actions:
|
|
|
1114
1181
|
query_cmd = (f"curl -s {self.config['server']['url']} "
|
|
1115
1182
|
f"-H \"Accept: application/qlever-results+json\" "
|
|
1116
1183
|
f"--data-urlencode query={shlex.quote(query)} "
|
|
1117
|
-
f"--data-urlencode send=
|
|
1184
|
+
f"--data-urlencode send={example_queries_send}")
|
|
1118
1185
|
try:
|
|
1119
1186
|
subprocess.run(clear_cache_cmd, shell=True,
|
|
1120
1187
|
stdout=subprocess.DEVNULL,
|
|
@@ -1126,28 +1193,33 @@ class Actions:
|
|
|
1126
1193
|
if "exception" in json_result:
|
|
1127
1194
|
raise Exception(json_result["exception"])
|
|
1128
1195
|
result_size = int(json_result["resultsize"])
|
|
1129
|
-
result_string = "{
|
|
1196
|
+
result_string = f"{result_size:>14,}"
|
|
1130
1197
|
except Exception as e:
|
|
1131
1198
|
time_seconds = 0.0
|
|
1132
1199
|
result_size = 0
|
|
1133
|
-
result_string = f"{RED}{
|
|
1200
|
+
result_string = (f"{RED} FAILED{NORMAL}"
|
|
1201
|
+
f" {RED}({e}){NORMAL}")
|
|
1134
1202
|
|
|
1135
1203
|
# Print description, time, result in tabular form.
|
|
1136
1204
|
log.debug(query)
|
|
1137
1205
|
log.info(f"{description:<60} {time_seconds:6.2f} s "
|
|
1138
|
-
f"{result_string
|
|
1206
|
+
f"{result_string}")
|
|
1139
1207
|
count += 1
|
|
1140
1208
|
total_time_seconds += time_seconds
|
|
1141
1209
|
total_result_size += result_size
|
|
1142
|
-
if count ==
|
|
1210
|
+
if count == example_queries_limit:
|
|
1143
1211
|
break
|
|
1144
1212
|
|
|
1145
1213
|
# Print total time.
|
|
1146
1214
|
log.info("")
|
|
1147
|
-
description = (f"TOTAL
|
|
1215
|
+
description = (f"TOTAL for {count} "
|
|
1148
1216
|
f"{'query' if count == 1 else 'queries'}")
|
|
1149
1217
|
log.info(f"{description:<60} {total_time_seconds:6.2f} s "
|
|
1150
|
-
f"{total_result_size:>
|
|
1218
|
+
f"{total_result_size:>14,}")
|
|
1219
|
+
description = (f"AVERAGE for {count} "
|
|
1220
|
+
f"{'query' if count == 1 else 'queries'}")
|
|
1221
|
+
log.info(f"{description:<60} {total_time_seconds / count:6.2f} s "
|
|
1222
|
+
f"{round(total_result_size / count):>14,}")
|
|
1151
1223
|
|
|
1152
1224
|
@track_action_rank
|
|
1153
1225
|
def action_memory_profile(self, only_show=False):
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
qlever/__init__.py,sha256=
|
|
1
|
+
qlever/__init__.py,sha256=55Dxjww9I-7XCHrjvzku79lPSdg6brRxvwwZUZg2c3Q,61344
|
|
2
2
|
qlever/__main__.py,sha256=mmp__u0a-Dztg3BUlJ4LL98OVo_j1MLiDCKewKlwfMM,38
|
|
3
3
|
qlever/Qleverfiles/Qleverfile.dblp,sha256=yuSDOhC3ypsXt2rAd4yjSzz0OQsZ2i6Pcq0Qh-stlBM,1199
|
|
4
4
|
qlever/Qleverfiles/Qleverfile.dblp-plus,sha256=E9bW49ztinBlW7azcT51QPW2jQWBPk29SDZ31RuIOO4,1389
|
|
@@ -6,7 +6,6 @@ qlever/Qleverfiles/Qleverfile.default,sha256=1roS4FHGiSA7iXBcX2DH3zwE5Ozht6-A551
|
|
|
6
6
|
qlever/Qleverfiles/Qleverfile.dnb,sha256=TNyLFuN_VJeNPlbHKAqLbSw1dgqUTBS5HbYJOJohRsI,1547
|
|
7
7
|
qlever/Qleverfiles/Qleverfile.fbeasy,sha256=N_ctx6Ae7ISbrOtBthOso_5_SCZuMz7TxsaiTzFd-mc,1032
|
|
8
8
|
qlever/Qleverfiles/Qleverfile.freebase,sha256=JbjW5JTpiCvaGVqjCq2CawPVNWStwwH5sptdK85Y2KM,1150
|
|
9
|
-
qlever/Qleverfiles/Qleverfile.gnd,sha256=9TtYaaztetZ-V0xDE7FejkTFaH466WWmfI-R-IJkWE4,1049
|
|
10
9
|
qlever/Qleverfiles/Qleverfile.imdb,sha256=o5LfmZZKZH7Ycu0qaxQF1L_4KVLhd5R2DIYw3bCJ7BM,1654
|
|
11
10
|
qlever/Qleverfiles/Qleverfile.olympics,sha256=09yDlhbrr0kqImLQKqIe2NkS35aWGSJJUHyI1ollQBE,1055
|
|
12
11
|
qlever/Qleverfiles/Qleverfile.osm-country,sha256=zYu4734aGeqwL2xBc9A4qHchYdyHyv6L5ny1XL7bA-A,1959
|
|
@@ -14,10 +13,10 @@ qlever/Qleverfiles/Qleverfile.pubchem,sha256=Wk5adgo4tIHbCg57cWwoOqIBBSN878wqjEW
|
|
|
14
13
|
qlever/Qleverfiles/Qleverfile.scientists,sha256=oFhzURcRFciA27GZ-ux_hsDe0esBLobWHC6h_Vf2xy8,1735
|
|
15
14
|
qlever/Qleverfiles/Qleverfile.uniprot,sha256=q5Nkr3diZ5oXdT0N72ONBEHBFZQCKYmEChAsjO4hnwE,2249
|
|
16
15
|
qlever/Qleverfiles/Qleverfile.wikidata,sha256=qTb9UjiAIZVIxCIXVEvaNNMacN0c0x2cPWXChPQcgmw,1346
|
|
17
|
-
qlever/Qleverfiles/Qleverfile.yago-4,sha256=
|
|
18
|
-
qlever-0.3.
|
|
19
|
-
qlever-0.3.
|
|
20
|
-
qlever-0.3.
|
|
21
|
-
qlever-0.3.
|
|
22
|
-
qlever-0.3.
|
|
23
|
-
qlever-0.3.
|
|
16
|
+
qlever/Qleverfiles/Qleverfile.yago-4,sha256=ghAJRf6VhJfTOh8grdIekeFgmroaCVMTdRhKr7vYVes,1944
|
|
17
|
+
qlever-0.3.1.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
18
|
+
qlever-0.3.1.dist-info/METADATA,sha256=diUXBn4bdAvOX3k3QEQYXfxQ748hdSM1FNCvB3l6JWg,16151
|
|
19
|
+
qlever-0.3.1.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
|
20
|
+
qlever-0.3.1.dist-info/entry_points.txt,sha256=pWFGQafjVuvwADcae4_8QVFeqPbTynj5RabMsod5VOY,39
|
|
21
|
+
qlever-0.3.1.dist-info/top_level.txt,sha256=kd3zsYqiFd0--Czh5XTVkfEq6XR-XgRFW35X0v0GT-c,7
|
|
22
|
+
qlever-0.3.1.dist-info/RECORD,,
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
# Qleverfile for Olympics, use with https://github.com/ad-freiburg/qlever-control
|
|
2
|
-
#
|
|
3
|
-
# qlever get-data # downloads .zip file of size 13 MB, uncompressed to 323 MB
|
|
4
|
-
# qlever index # takes ~10 seconds and ~1 GB RAM (on an AMD Ryzen 9 5900X)
|
|
5
|
-
# qlever start # starts the server (instant)
|
|
6
|
-
|
|
7
|
-
[data]
|
|
8
|
-
NAME = gnd
|
|
9
|
-
BASE_URL = https://github.com/wallscope/olympics-rdf
|
|
10
|
-
GET_DATA_CMD = curl -O https://data.dnb.de/opendata/authorities-gnd_lds.nt.gz
|
|
11
|
-
INDEX_DESCRIPTION = GND authority data from https://data.dnb.de/opendata/authorities-gnd_lds.nt.gz
|
|
12
|
-
# TEXT_DESCRIPTION = All literals, search with FILTER CONTAINS(?var, "...")
|
|
13
|
-
|
|
14
|
-
[index]
|
|
15
|
-
FILE_NAMES = authorities-gnd_lds.nt.gz
|
|
16
|
-
CAT_FILES = zcat ${FILE_NAMES}
|
|
17
|
-
SETTINGS_JSON = { "ascii-prefixes-only": true, "num-triples-per-batch": 1000000 }
|
|
18
|
-
|
|
19
|
-
[server]
|
|
20
|
-
PORT = 7035
|
|
21
|
-
ACCESS_TOKEN = ${data:NAME}_7643543846
|
|
22
|
-
MEMORY_FOR_QUERIES_GB = 5
|
|
23
|
-
CACHE_MAX_SIZE_GB = 2
|
|
24
|
-
|
|
25
|
-
[docker]
|
|
26
|
-
USE_DOCKER = true
|
|
27
|
-
IMAGE = adfreiburg/qlever
|
|
28
|
-
|
|
29
|
-
[ui]
|
|
30
|
-
PORT = 7000
|
|
31
|
-
CONFIG = olympics
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|