skolemizer
A library with utils for performing Skolemization on blank nodes (RDF)
W3C has a short intro to skolemization here: https://www.w3.org/2011/rdf-wg/wiki/Skolemisation
Development
Requirements
- pyenv (recommended)
- pipx (recommended)
- poetry
- nox
- nox-poetry
% pipx install poetry==1.1.6
% pipx install nox==2020.12.31
% pipx inject nox nox-poetry
Install
% git clone https://github.com/Informasjonsforvaltning/skolemizer.git
% cd skolemizer
% pyenv install 3.9.4
% pyenv local 3.9.4
% poetry install
Getting started
Remember before starting to always set the baseurl for skolemization, according to your organization url. This can be done by setting the environment variable skolemizer_baseurl on your operating system. It can also e.g. be done run time through Python's os package:
os.environ[Skolemizer.baseurl_key] = "https://www.someorganiztion.somedomain/"
If not set Skolemizer will use "http://example.com/" as base url. In order to invoke the skolemizer for ensuring identifier of rdf-nodes simply add
from skolemizer import Skolemizer
and then before rdf-serialization of a class:
if not getattr(self, "identifier", None):
self.identifier = Skolemizer.add_skolemization()
There should also be a skolemization check performed when serializing object properties. When creating unit tests of skolemized rdf nodes an uuid will be applied as a substring of the complete skolemization. Therefore, in order to create stable unit tests one can use the tests utils in order to mock a stable skolemization.
E.g. pytest-mocks MockFixture permits mocking of the skolemizer:
from pytest_mock import MockFixture
from skolemizer.testutils import skolemization
catalog = Catalog()
mocker.patch(
"skolemizer.Skolemizer.add_skolemization",
return_value=skolemization
)
which outputs e.g:
@prefix dct: <http://purl.org/dc/terms/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix dcat: <http://www.w3.org/ns/dcat#> .
<http://wwww.digdir.no/.well-known/skolem/284db4d2-80c2-11eb-82c3-83e80baa2f94>
a dcat:Catalog .
Run all sessions
% nox
Run all tests with coverage reporting
% nox -rs tests
Debugging
You can enter into Pdb by passing --pdb to pytest:
nox -rs tests -- --pdb
You can set breakpoints directly in code by using the function breakpoint().
Metadata
Release files for skolemizer 2.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| skolemizer-2.1.3.tar.gz | 7.5 kB | Without provenance | Details for skolemizer-2.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| skolemizer-2.1.3-py3-none-any.whl | Python 3 | none | any | Details for skolemizer-2.1.3-py3-none-any.whl |
Total release size: 16.0 kB
Release files / skolemizer-2.1.3.tar.gz
| Download URL | skolemizer-2.1.3.tar.gz |
|---|---|
| Size | 7.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bbebcc442383c40c9652424a1048de3b4733e009f5d5ce15c9d5561c0ca01b52
|
|
BLAKE2b-256 checksum How to use checksums |
13b23b65e69ce8c1c2340a3d67956c16936aa0e69b61bdfa7ddc223b7c244f31
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.4.1 CPython/3.12.13 Linux/6.17.0-1018-azure
|
Release files / skolemizer-2.1.3-py3-none-any.whl
| Download URL | skolemizer-2.1.3-py3-none-any.whl |
|---|---|
| Size | 8.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e863de3132453207627a423284e79cc8d0b8a1f12730c6cc34e203e68cc2e7fa
|
|
BLAKE2b-256 checksum How to use checksums |
4c4b1cc385904baff34f20ad4fe0ce9fda9908596447a4e9ae67564fbea23a7c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.4.1 CPython/3.12.13 Linux/6.17.0-1018-azure
|
Security for skolemizer 2.1.3
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.