wLighter
wLighter is a Python library to annotate ShEx or RDF files containing Wikidata entities and properties.
Wikidata identifies properties witn an ID such as "PXXX" and entities with IDs such as "QXXX", where XXX is a number with no relation with the concept represented by the ID. This causes that text files containing many Wikidata IDs are quite hard to understand.
wLighter is a simple library built on top of the Wikidata API. It expect to receive RDF or ShEx content where some Wikidata URIs are used. It returns the same content with annotations (comments) in which each Wikidata ID is associated to its label.
You can specify in which language you prefer the labels. wLighter will try to get the label for your preferred language(s), or get the English one in case some ID has no label in your selected language.
When working with ShEx, you can also select if you prefer to generate inline comments using '# QXX --> Example' or rdfs inline annotation such as '// rdfs:comment "QXX --> Example"'.
You can also choose to provide your input or get your output via string or reading some file's content.
The input formats currently supported are ShExC and Turtle.
Please, contact the author or feel free to add an issue to this repository if you find a bug or have some feature request.
Instalation
You can install wLighter using pip. Execute the following command:
$ pip install wlighter
If you prefer to use wLighter by source with git clone, ensure you execute it in an enviroment with the dependencies listed in requirements.txt. You can install those dependencies by using the following command:
$ pip install -r requirements.txt
Example code
The following example code takes a ShEx file placed in wiki_test_file.shex and annotates it generating inline rdfs:comments. The result is returned as a string. The preferred language for the labels is Spanish. In case there is not a label in Spanish for a given element, then wLighter will use the French one. If French is missing too, then the English one.
from wlighter import WLighter, SHEXC_FORMAT
target_file = "wiki_test_file.shex"
wlig = WLighter(file_input=target_file,
format=SHEXC_FORMAT,
languages=["es", "fr"],
generate_rdfs_comments=True)
result = wlig.annotate_all(string_return=True)
print(result)
Metadata
Release files for wlighter 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| wlighter-1.0.2.tar.gz | 12.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| wlighter-1.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 23.4 kB
Release files / wlighter-1.0.2.tar.gz
| Download URL | wlighter-1.0.2.tar.gz |
|---|---|
| Size | 12.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b77b93e318306f15879baa6f453b13055518a6a3bd2e2bd9bfe48c5dd9312d3e
|
|
BLAKE2b-256 checksum How to use checksums |
373ed45c63e9bcc025e3ac78241e49250516d7456bf5802ff90b39b39ab2c749
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 16, 2026.
Transparency logRelease files / wlighter-1.0.2-py3-none-any.whl
| Download URL | wlighter-1.0.2-py3-none-any.whl |
|---|---|
| Size | 11.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
35fda155265100458127180093b06da9919724128111743dd1a80c3e58bd80f9
|
|
BLAKE2b-256 checksum How to use checksums |
15760aaf784fa7578b548a7062592aedb55c579388928b672f19ea6edaf5de27
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 16, 2026.
Transparency log