qlever 0.4.1__py3-none-any.whl → 0.4.3__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/util.py CHANGED
@@ -1,7 +1,7 @@
1
1
  from __future__ import annotations
2
2
 
3
- import secrets
4
3
  import re
4
+ import secrets
5
5
  import shlex
6
6
  import shutil
7
7
  import string
@@ -31,7 +31,7 @@ def run_command(cmd: str, return_output: bool = False,
31
31
  show_output: bool = False) -> Optional[str]:
32
32
  """
33
33
  Run the given command and throw an exception if the exit code is non-zero.
34
- If `get_output` is `True`, return what the command wrote to `stdout`.
34
+ If `return_output` is `True`, return what the command wrote to `stdout`.
35
35
 
36
36
  NOTE: The `set -o pipefail` ensures that the exit code of the command is
37
37
  non-zero if any part of the pipeline fails (not just the last part).
@@ -68,6 +68,45 @@ def run_command(cmd: str, return_output: bool = False,
68
68
  return result.stdout
69
69
 
70
70
 
71
+ def run_curl_command(url: str,
72
+ headers: dict[str, str] = {},
73
+ params: dict[str, str] = {},
74
+ result_file: Optional[str] = None) -> str:
75
+ """
76
+ Run `curl` with the given `url`, `headers`, and `params`. If `result_file`
77
+ is `None`, return the output, otherwise, write the output to the given file
78
+ and return the HTTP code. If the `curl` command fails, throw an exception.
79
+
80
+ """
81
+ # Construct and run the `curl` command.
82
+ default_result_file = "/tmp/qlever.curl.result"
83
+ actual_result_file = result_file if result_file else default_result_file
84
+ curl_cmd = (f"curl -s -o \"{actual_result_file}\""
85
+ f" -w \"%{{http_code}}\n\" {url}"
86
+ + "".join([f" -H \"{key}: {value}\""
87
+ for key, value in headers.items()])
88
+ + "".join([f" --data-urlencode {key}={shlex.quote(value)}"
89
+ for key, value in params.items()]))
90
+ result = subprocess.run(curl_cmd, shell=True, text=True,
91
+ stdout=subprocess.PIPE,
92
+ stderr=subprocess.PIPE)
93
+ # Case 1: An error occurred, raise an exception.
94
+ if result.returncode != 0:
95
+ if len(result.stderr) > 0:
96
+ raise Exception(result.stderr)
97
+ else:
98
+ raise Exception(f"curl command failed with exit code "
99
+ f"{result.returncode}, stderr is empty")
100
+ # Case 2: Return output (read from `default_result_file`).
101
+ if result_file is None:
102
+ result_file_path = Path(default_result_file)
103
+ result = result_file_path.read_text()
104
+ result_file_path.unlink()
105
+ return result
106
+ # Case 3: Return HTTP code.
107
+ return result.stdout
108
+
109
+
71
110
  def is_qlever_server_alive(port: str) -> bool:
72
111
  """
73
112
  Helper function that checks if a QLever server is running on the given
@@ -82,30 +121,6 @@ def is_qlever_server_alive(port: str) -> bool:
82
121
  return exit_code == 0
83
122
 
84
123
 
85
- def get_curl_cmd_for_sparql_query(
86
- query: str, port: int,
87
- host: str = "localhost",
88
- media_type: str = "application/sparql-results+qlever",
89
- verbose: bool = False,
90
- pinresult: bool = False,
91
- access_token: Optional[str] = None,
92
- send: Optional[int] = None) -> str:
93
- """
94
- Get curl command for given SPARQL query.
95
- """
96
- curl_cmd = (f"curl -s http://{host}:{port}"
97
- f" -H \"Accept: {media_type}\" "
98
- f" --data-urlencode query={shlex.quote(query)}")
99
- if pinresult and access_token is not None:
100
- curl_cmd += " --data-urlencode pinresult=true"
101
- curl_cmd += f" --data-urlencode access_token={access_token}"
102
- if send is not None:
103
- curl_cmd += f" --data-urlencode send={send}"
104
- if verbose:
105
- curl_cmd += " --verbose"
106
- return curl_cmd
107
-
108
-
109
124
  def get_existing_index_files(basename: str) -> list[str]:
110
125
  """
111
126
  Helper function that returns a list of all index files for `basename` in
@@ -0,0 +1,100 @@
1
+ Metadata-Version: 2.1
2
+ Name: qlever
3
+ Version: 0.4.3
4
+ Summary: Script for using the QLever SPARQL engine.
5
+ Author-email: Hannah Bast <bast@cs.uni-freiburg.de>
6
+ License: Apache-2.0
7
+ Project-URL: Github, https://github.com/ad-freiburg/qlever
8
+ Keywords: SPARQL,RDF,Knowledge Graphs,Triple Store
9
+ Classifier: Topic :: Database :: Database Engines/Servers
10
+ Classifier: Topic :: Database :: Front-Ends
11
+ Requires-Python: >=3.8
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Requires-Dist: psutil
15
+ Requires-Dist: termcolor
16
+ Requires-Dist: argcomplete
17
+
18
+ # QLever
19
+
20
+ QLever is a very fast SPARQL engine, much faster than most existing engines. It
21
+ can handle graphs with more than hundred billion triples on a single machine
22
+ with moderate resources. See https://qlever.cs.uni-freiburg.de for more
23
+ information and many public SPARQL endpoints that use QLever
24
+
25
+ This project provides a Python script that can control everything that QLever
26
+ does, in particular, creating SPARQL endpoints for arbitrary RDF datasets. It
27
+ is supposed to be very easy to use and self-explanatory as you use it. In
28
+ particular, the tool provides context-sensitive autocompletion of all its
29
+ commands and options. If you use a container system (like Docker or Podman),
30
+ you don't even have to download any QLever code, but the script will download
31
+ the required image for you.
32
+
33
+ NOTE: There has been a major update on 24.03.2024, which changed some of the
34
+ Qleverfile variables and command-line options (all for the better, of course).
35
+ If you encounter any problems, please contact us by opening an issue on
36
+ https://github.com/ad-freiburg/qlever-control/issues.
37
+
38
+ # Installation
39
+
40
+ Simply do `pip install qlever` and make sure that the directory where pip
41
+ installs the package is in your `PATH`. Typically, `pip` will warn you when
42
+ that is not the case and tell you what to do.
43
+
44
+ # Usage
45
+
46
+ Create an empty directory, with a name corresponding to the dataset you want to
47
+ work with. For the following example, take `olympics`. Go to that directory
48
+ and do the following. After the first call, `qlever` will tell you how to
49
+ activate autocompletion for all its commands and options (it's very easy, but
50
+ `pip` cannot do that automatically).
51
+
52
+ ```
53
+ qlever setup-config olympics # Get Qleverfile (config file) for this dataset
54
+ qlever get-data # Download the dataset
55
+ qlever index # Build index data structures for this dataset
56
+ qlever start # Start a QLever server using that index
57
+ qlever example-queries # Launch some example queries
58
+ qlever ui # Launch the QLever UI
59
+ ```
60
+
61
+ This will create a SPARQL endpoint for the [120 Years of
62
+ Olympics](https://github.com/wallscope/olympics-rdf) dataset. It is a great
63
+ dataset for getting started because it is small, but not trivial (around 2
64
+ million triples), and the downloading and indexing should only take a few
65
+ seconds.
66
+
67
+ Each command will also show you the command line it uses. That way you can
68
+ learn, on the side, how QLever works internally. If you just want to know the
69
+ command line for a particular command, without executing it, you can append
70
+ `--show` like this:
71
+
72
+ ```
73
+ qlever index --show
74
+ ```
75
+
76
+ There are many more commands and options, see `qlever --help` for general help,
77
+ `qlever <command> --help` for help on a specific command, or just the
78
+ autocompletion.
79
+
80
+ # For developers
81
+
82
+ The (Python) code for the script is in the `*.py` files in `src/qlever`. The
83
+ preconfigured Qleverfiles are in `src/qlever/Qleverfiles`.
84
+
85
+ If you want to make changes to the script, or add new commands, do as follows:
86
+
87
+ ```
88
+ git clone https://github.com/ad-freiburg/qlever-control
89
+ cd qlever-control
90
+ pip install -e .
91
+ ```
92
+
93
+ Then you can use `qlever` just as if you had installed it via `pip install
94
+ qlever`. Note that you don't have to rerun `pip install -e .` when you modify
95
+ any of the `*.py` files and not even when you add new commands in
96
+ `src/qlever/commands`. The exceutable created by `pip` simply links and refers
97
+ to the files in your working copy.
98
+
99
+ If you have bug fixes or new useful features or commands, please open a pull
100
+ request. If you have questions or suggestions, please open an issue.
@@ -1,12 +1,13 @@
1
- qlever/__init__.py,sha256=IyfS1OhlVE7-rjtv6FPlL0R56VxcNsS6KS7NJQhTDIM,1367
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
4
  qlever/config.py,sha256=-jjHAL8jdp25v53SqXKP4gWip6Qw9OdlDvFN6X7uk_4,10184
5
5
  qlever/containerize.py,sha256=p8g3O3G8a_0XLzSTzl_e5t9dqjbCQ-ippoA8vI2Z9pI,4193
6
- qlever/log.py,sha256=k9Mq4hxQ_d2k0e-5ZVgcB2XIRhOsGMO9I3rIR7YQyDA,1376
7
- qlever/qlever_main.py,sha256=k8vIQYK7zqObFNet11iLf--nrLdPooL5amprmlySi4k,2300
6
+ qlever/log.py,sha256=and5prQcLW_5nM8AAZNeNbVqJxLtJmX3EjHFhtHCR28,1279
7
+ qlever/qlever_main.py,sha256=tA_xqOs_FjvqlDIvKTprwuysfTwzsUjE7at26gRhCVA,2336
8
+ qlever/qlever_old.py,sha256=br9ryMpr2E5iV0eX-2cm7IinA4y5h4vGiJomJLVcKDM,62056
8
9
  qlever/qleverfile.py,sha256=6Ll81xkzel_s2Ju9ZfBXUGlRfikaAzZM6Do-dTrdo3k,12934
9
- qlever/util.py,sha256=dwqtpY14P3ds_PYx5bgqus_nsx_BhPQzUSa0Z86ONdo,6236
10
+ qlever/util.py,sha256=eepj0SY9JJOUQq5kvtoPnWfoLLV9fbw_sTEWKHet66E,7147
10
11
  qlever/Qleverfiles/Qleverfile.dblp,sha256=SFjBD20aOSWod4mEQnxHSDWdInoE_EFp2nyMw7ev7ZA,1167
11
12
  qlever/Qleverfiles/Qleverfile.dblp-plus,sha256=Dwd9pK1vPcelKfw6sA-IuyhbZ6yIxOh6_84JgPYnB9Q,1332
12
13
  qlever/Qleverfiles/Qleverfile.default,sha256=mljl6I1RCkpIWOqMQwjzPZIsarYQx1R0mIlc583KuqU,1869
@@ -28,20 +29,20 @@ qlever/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
28
29
  qlever/commands/add_text_index.py,sha256=dkqYtwgOhgnXiei_eyhBWYCtdAiQUEmjWoa3JMlMb4c,3641
29
30
  qlever/commands/cache_stats.py,sha256=6JjueQstAqc8dNfgY8TP2EitFMxdUvCwrcyd7KUEb2o,4157
30
31
  qlever/commands/clear_cache.py,sha256=AnE1MOoj1ZexxrRT8FGeBLlv8rtQIVV4DP8VBn5-X-s,2843
31
- qlever/commands/example_queries.py,sha256=3jlfHyL7pw1OSTuu3fY-23XaRAPIuEdNGW8QnIY2Va8,8644
32
- qlever/commands/get_data.py,sha256=0fGuRLDB7YofHtpqk0ctq9_de_xeuliSmSZafGXAo1A,1470
32
+ qlever/commands/example_queries.py,sha256=2rYTd35t0r7et0i-IBBcCpmVlYZya9kvwSI-gdTpNdE,12326
33
+ qlever/commands/get_data.py,sha256=Ua1OuqfTwTcDUXD4TWTYg7dJIFkzl_e6SB73oZhUVQA,1506
33
34
  qlever/commands/index.py,sha256=lJhDnweknFZQm1czqPzNyz33EvbjIvOrS4j0wDaJ98o,5663
34
- qlever/commands/index_stats.py,sha256=ao7_ySyz8MAjUvCbEp3Kj30PsR5x3MBM3ohgEUWdALM,11083
35
+ qlever/commands/index_stats.py,sha256=_BiUNBhmbYd9RPxrlm4HF0oENO6JmqnRiAkwkyOdN4U,11722
35
36
  qlever/commands/log.py,sha256=8Krt3MsTUDapYqVw1zUu5X15SF8mV97Uj0qKOWK8jXk,1861
36
- qlever/commands/setup_config.py,sha256=mFkEtCPZ6oeVfehjVLrcLttYcPDgtwXHrNIWWzvHOfo,2928
37
+ qlever/commands/setup_config.py,sha256=6T0rXrIdejKMKhDbOMEMBKyMF_hAqO5nJaRFb57QPQU,2964
37
38
  qlever/commands/start.py,sha256=2rOtk3NmhEs28D5csL_a1BdjSWU9VkcH6AqYT0vdww0,9285
38
39
  qlever/commands/status.py,sha256=5S6EdapZEwFKV9cQZtNYcZhMbAXAY-FP6ggjIhfX8ek,1631
39
40
  qlever/commands/stop.py,sha256=TZs4bxKHvujlZAU8BZmFjA5eXSZNAa6EeNzvPpEZsuI,4139
40
41
  qlever/commands/ui.py,sha256=rV8u017WLbfz0zVT_c9GC4d9v1WWwrTM3kfGONbeCvQ,2499
41
42
  qlever/commands/warmup.py,sha256=WOZSxeV8U_F6pEEnAb6YybXLQMxZFTRJXs4BPHUhsmc,1030
42
- qlever-0.4.1.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
43
- qlever-0.4.1.dist-info/METADATA,sha256=GkXf_oneu0Oe02UOPR8OvqVzxDNA-ljS6yPGLi2x_Bk,17076
44
- qlever-0.4.1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
45
- qlever-0.4.1.dist-info/entry_points.txt,sha256=s0iWBHKRUzsJ7B6nVGiyMdOJtiOS84IJMSSxgbNU6LU,85
46
- qlever-0.4.1.dist-info/top_level.txt,sha256=kd3zsYqiFd0--Czh5XTVkfEq6XR-XgRFW35X0v0GT-c,7
47
- qlever-0.4.1.dist-info/RECORD,,
43
+ qlever-0.4.3.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
44
+ qlever-0.4.3.dist-info/METADATA,sha256=TCf4w7h5mrkWyhiwSie43PGKRUvx-6FUTcKYd8ksCxs,4146
45
+ qlever-0.4.3.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
46
+ qlever-0.4.3.dist-info/entry_points.txt,sha256=U_gbYYi0wwdsn884eb0XoOXfvhACOsxhlO330dZ9bi0,87
47
+ qlever-0.4.3.dist-info/top_level.txt,sha256=kd3zsYqiFd0--Czh5XTVkfEq6XR-XgRFW35X0v0GT-c,7
48
+ qlever-0.4.3.dist-info/RECORD,,
@@ -1,3 +1,3 @@
1
1
  [console_scripts]
2
2
  qlever = qlever.qlever_main:main
3
- qlever-old = qlever.__main__:main
3
+ qlever-old = qlever.qlever_old:main
@@ -1,301 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: qlever
3
- Version: 0.4.1
4
- Summary: Script for using the QLever SPARQL engine.
5
- Author-email: Hannah Bast <bast@cs.uni-freiburg.de>
6
- License: Apache License
7
- Version 2.0, January 2004
8
- http://www.apache.org/licenses/
9
-
10
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
11
-
12
- 1. Definitions.
13
-
14
- "License" shall mean the terms and conditions for use, reproduction,
15
- and distribution as defined by Sections 1 through 9 of this document.
16
-
17
- "Licensor" shall mean the copyright owner or entity authorized by
18
- the copyright owner that is granting the License.
19
-
20
- "Legal Entity" shall mean the union of the acting entity and all
21
- other entities that control, are controlled by, or are under common
22
- control with that entity. For the purposes of this definition,
23
- "control" means (i) the power, direct or indirect, to cause the
24
- direction or management of such entity, whether by contract or
25
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
26
- outstanding shares, or (iii) beneficial ownership of such entity.
27
-
28
- "You" (or "Your") shall mean an individual or Legal Entity
29
- exercising permissions granted by this License.
30
-
31
- "Source" form shall mean the preferred form for making modifications,
32
- including but not limited to software source code, documentation
33
- source, and configuration files.
34
-
35
- "Object" form shall mean any form resulting from mechanical
36
- transformation or translation of a Source form, including but
37
- not limited to compiled object code, generated documentation,
38
- and conversions to other media types.
39
-
40
- "Work" shall mean the work of authorship, whether in Source or
41
- Object form, made available under the License, as indicated by a
42
- copyright notice that is included in or attached to the work
43
- (an example is provided in the Appendix below).
44
-
45
- "Derivative Works" shall mean any work, whether in Source or Object
46
- form, that is based on (or derived from) the Work and for which the
47
- editorial revisions, annotations, elaborations, or other modifications
48
- represent, as a whole, an original work of authorship. For the purposes
49
- of this License, Derivative Works shall not include works that remain
50
- separable from, or merely link (or bind by name) to the interfaces of,
51
- the Work and Derivative Works thereof.
52
-
53
- "Contribution" shall mean any work of authorship, including
54
- the original version of the Work and any modifications or additions
55
- to that Work or Derivative Works thereof, that is intentionally
56
- submitted to Licensor for inclusion in the Work by the copyright owner
57
- or by an individual or Legal Entity authorized to submit on behalf of
58
- the copyright owner. For the purposes of this definition, "submitted"
59
- means any form of electronic, verbal, or written communication sent
60
- to the Licensor or its representatives, including but not limited to
61
- communication on electronic mailing lists, source code control systems,
62
- and issue tracking systems that are managed by, or on behalf of, the
63
- Licensor for the purpose of discussing and improving the Work, but
64
- excluding communication that is conspicuously marked or otherwise
65
- designated in writing by the copyright owner as "Not a Contribution."
66
-
67
- "Contributor" shall mean Licensor and any individual or Legal Entity
68
- on behalf of whom a Contribution has been received by Licensor and
69
- subsequently incorporated within the Work.
70
-
71
- 2. Grant of Copyright License. Subject to the terms and conditions of
72
- this License, each Contributor hereby grants to You a perpetual,
73
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
74
- copyright license to reproduce, prepare Derivative Works of,
75
- publicly display, publicly perform, sublicense, and distribute the
76
- Work and such Derivative Works in Source or Object form.
77
-
78
- 3. Grant of Patent License. Subject to the terms and conditions of
79
- this License, each Contributor hereby grants to You a perpetual,
80
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
81
- (except as stated in this section) patent license to make, have made,
82
- use, offer to sell, sell, import, and otherwise transfer the Work,
83
- where such license applies only to those patent claims licensable
84
- by such Contributor that are necessarily infringed by their
85
- Contribution(s) alone or by combination of their Contribution(s)
86
- with the Work to which such Contribution(s) was submitted. If You
87
- institute patent litigation against any entity (including a
88
- cross-claim or counterclaim in a lawsuit) alleging that the Work
89
- or a Contribution incorporated within the Work constitutes direct
90
- or contributory patent infringement, then any patent licenses
91
- granted to You under this License for that Work shall terminate
92
- as of the date such litigation is filed.
93
-
94
- 4. Redistribution. You may reproduce and distribute copies of the
95
- Work or Derivative Works thereof in any medium, with or without
96
- modifications, and in Source or Object form, provided that You
97
- meet the following conditions:
98
-
99
- (a) You must give any other recipients of the Work or
100
- Derivative Works a copy of this License; and
101
-
102
- (b) You must cause any modified files to carry prominent notices
103
- stating that You changed the files; and
104
-
105
- (c) You must retain, in the Source form of any Derivative Works
106
- that You distribute, all copyright, patent, trademark, and
107
- attribution notices from the Source form of the Work,
108
- excluding those notices that do not pertain to any part of
109
- the Derivative Works; and
110
-
111
- (d) If the Work includes a "NOTICE" text file as part of its
112
- distribution, then any Derivative Works that You distribute must
113
- include a readable copy of the attribution notices contained
114
- within such NOTICE file, excluding those notices that do not
115
- pertain to any part of the Derivative Works, in at least one
116
- of the following places: within a NOTICE text file distributed
117
- as part of the Derivative Works; within the Source form or
118
- documentation, if provided along with the Derivative Works; or,
119
- within a display generated by the Derivative Works, if and
120
- wherever such third-party notices normally appear. The contents
121
- of the NOTICE file are for informational purposes only and
122
- do not modify the License. You may add Your own attribution
123
- notices within Derivative Works that You distribute, alongside
124
- or as an addendum to the NOTICE text from the Work, provided
125
- that such additional attribution notices cannot be construed
126
- as modifying the License.
127
-
128
- You may add Your own copyright statement to Your modifications and
129
- may provide additional or different license terms and conditions
130
- for use, reproduction, or distribution of Your modifications, or
131
- for any such Derivative Works as a whole, provided Your use,
132
- reproduction, and distribution of the Work otherwise complies with
133
- the conditions stated in this License.
134
-
135
- 5. Submission of Contributions. Unless You explicitly state otherwise,
136
- any Contribution intentionally submitted for inclusion in the Work
137
- by You to the Licensor shall be under the terms and conditions of
138
- this License, without any additional terms or conditions.
139
- Notwithstanding the above, nothing herein shall supersede or modify
140
- the terms of any separate license agreement you may have executed
141
- with Licensor regarding such Contributions.
142
-
143
- 6. Trademarks. This License does not grant permission to use the trade
144
- names, trademarks, service marks, or product names of the Licensor,
145
- except as required for reasonable and customary use in describing the
146
- origin of the Work and reproducing the content of the NOTICE file.
147
-
148
- 7. Disclaimer of Warranty. Unless required by applicable law or
149
- agreed to in writing, Licensor provides the Work (and each
150
- Contributor provides its Contributions) on an "AS IS" BASIS,
151
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
152
- implied, including, without limitation, any warranties or conditions
153
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
154
- PARTICULAR PURPOSE. You are solely responsible for determining the
155
- appropriateness of using or redistributing the Work and assume any
156
- risks associated with Your exercise of permissions under this License.
157
-
158
- 8. Limitation of Liability. In no event and under no legal theory,
159
- whether in tort (including negligence), contract, or otherwise,
160
- unless required by applicable law (such as deliberate and grossly
161
- negligent acts) or agreed to in writing, shall any Contributor be
162
- liable to You for damages, including any direct, indirect, special,
163
- incidental, or consequential damages of any character arising as a
164
- result of this License or out of the use or inability to use the
165
- Work (including but not limited to damages for loss of goodwill,
166
- work stoppage, computer failure or malfunction, or any and all
167
- other commercial damages or losses), even if such Contributor
168
- has been advised of the possibility of such damages.
169
-
170
- 9. Accepting Warranty or Additional Liability. While redistributing
171
- the Work or Derivative Works thereof, You may choose to offer,
172
- and charge a fee for, acceptance of support, warranty, indemnity,
173
- or other liability obligations and/or rights consistent with this
174
- License. However, in accepting such obligations, You may act only
175
- on Your own behalf and on Your sole responsibility, not on behalf
176
- of any other Contributor, and only if You agree to indemnify,
177
- defend, and hold each Contributor harmless for any liability
178
- incurred by, or claims asserted against, such Contributor by reason
179
- of your accepting any such warranty or additional liability.
180
-
181
- END OF TERMS AND CONDITIONS
182
-
183
- APPENDIX: How to apply the Apache License to your work.
184
-
185
- To apply the Apache License to your work, attach the following
186
- boilerplate notice, with the fields enclosed by brackets "[]"
187
- replaced with your own identifying information. (Don't include
188
- the brackets!) The text should be enclosed in the appropriate
189
- comment syntax for the file format. We also recommend that a
190
- file or class name and description of purpose be included on the
191
- same "printed page" as the copyright notice for easier
192
- identification within third-party archives.
193
-
194
- Copyright [yyyy] [name of copyright owner]
195
-
196
- Licensed under the Apache License, Version 2.0 (the "License");
197
- you may not use this file except in compliance with the License.
198
- You may obtain a copy of the License at
199
-
200
- http://www.apache.org/licenses/LICENSE-2.0
201
-
202
- Unless required by applicable law or agreed to in writing, software
203
- distributed under the License is distributed on an "AS IS" BASIS,
204
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
205
- See the License for the specific language governing permissions and
206
- limitations under the License.
207
-
208
- Project-URL: Github, https://github.com/ad-freiburg/qlever-control
209
- Keywords: SPARQL,RDF,knowledge graphs,triple store
210
- Classifier: Topic :: Database :: Database Engines/Servers
211
- Classifier: Topic :: Database :: Front-Ends
212
- Requires-Python: >=3.8
213
- Description-Content-Type: text/markdown
214
- License-File: LICENSE
215
- Requires-Dist: psutil
216
- Requires-Dist: termcolor
217
- Requires-Dist: argcomplete
218
-
219
- # QLever
220
-
221
- QLever is a very fast SPARQL engine, much faster than most existing engines. It
222
- can handle graphs with more than hundred billion triples on a single machine
223
- with moderate resources. See https://qlever.cs.uni-freiburg.de for more
224
- information and many public SPARQL endpoints that use QLever
225
-
226
- This project provides a Python script that can control everything that QLever
227
- does, in particular, creating SPARQL endpoints for arbitrary RDF datasets. It
228
- is supposed to be very easy to use and self-explanatory as you use it. In
229
- particular, the tool provides context-sensitive autocompletion of all its
230
- commands and options. If you use a container system (like Docker or Podman),
231
- you don't even have to download any QLever code, but the script will download
232
- the required image for you.
233
-
234
- NOTE: There has been a major update on 24.03.2024, which changed some of the
235
- Qleverfile variables and command-line options (all for the better, of course).
236
- If you encounter any problems, please contact us by opening an issue on
237
- https://github.com/ad-freiburg/qlever-control/issues.
238
-
239
- # Installation
240
-
241
- Simply do `pip install qlever` and make sure that the directory where pip
242
- installs the package is in your `PATH`. Typically, `pip` will warn you when
243
- that is not the case and tell you what to do.
244
-
245
- # Usage
246
-
247
- Create an empty directory, with a name corresponding to the dataset you want to
248
- work with. For the following example, take `olympics`. Go to that directory
249
- and do the following. After the first call, `qlever` will tell you how to
250
- activate autocompletion for all its commands and options (it's very easy, but
251
- `pip` cannot do that automatically).
252
-
253
- ```
254
- qlever setup-config olympics # Get Qleverfile (config file) for this dataset
255
- qlever get-data # Download the dataset
256
- qlever index # Build index data structures for this dataset
257
- qlever start # Start a QLever server using that index
258
- qlever example-queries # Launch some example queries
259
- qlever ui # Launch the QLever UI
260
- ```
261
-
262
- This will create a SPARQL endpoint for the [120 Years of
263
- Olympics](https://github.com/wallscope/olympics-rdf) dataset. It is a great
264
- dataset for getting started because it is small, but not trivial (around 2
265
- million triples), and the downloading and indexing should only take a few
266
- seconds.
267
-
268
- Each command will also show you the command line it uses. That way you can
269
- learn, on the side, how QLever works internally. If you just want to know the
270
- command line for a particular command, without executing it, you can append
271
- `--show` like this:
272
-
273
- ```
274
- qlever index --show
275
- ```
276
-
277
- There are many more commands and options, see `qlever --help` for general help,
278
- `qlever <command> --help` for help on a specific command, or just the
279
- autocompletion.
280
-
281
- # For developers
282
-
283
- The (Python) code for the script is in the `*.py` files in `src/qlever`. The
284
- preconfigured Qleverfiles are in `src/qlever/Qleverfiles`.
285
-
286
- If you want to make changes to the script, or add new commands, do as follows:
287
-
288
- ```
289
- git clone https://github.com/ad-freiburg/qlever-control
290
- cd qlever-control
291
- pip install -e .
292
- ```
293
-
294
- Then you can use `qlever` just as if you had installed it via `pip install
295
- qlever`. Note that you don't have to rerun `pip install -e .` when you modify
296
- any of the `*.py` files and not even when you add new commands in
297
- `src/qlever/commands`. The exceutable created by `pip` simply links and refers
298
- to the files in your working copy.
299
-
300
- If you have bug fixes or new useful features or commands, please open a pull
301
- request. If you have questions or suggestions, please open an issue.
File without changes