CLiSN <:books:>:sparkles:
A collection of RDFLib namespaces for the Computational Literary Studies Infrastructure project.
Requirements
- Python >=3.11
Installation
pip install clisn
Usage
Namespaces
CLiSN provides rdflib.Namespaces for the CLSInfra project.
from rdflib import Graph
from rdflib.namespace import RDF
from clisn import crm, crmcls, corpus_base
base_ns = corpus_base("SweDraCor")
attrassign_uri = base_ns["attrassign/1"]
triples = [
(
attrassign_uri,
RDF.type,
crm["E13_Attribute_Assignment"]
),
(
attrassign_uri,
crm["P140_assigned_attribute_to"],
base_ns["corpus"]
),
(
attrassign_uri,
crm["P177_assigned_property_of_type"],
crmcls["Z8_corpus_has_corpus_type"]
)
]
graph = Graph()
for triple in triples:
graph.add(triple)
print(graph.serialize())
Output:
@prefix ns1: <http://www.cidoc-crm.org/cidoc-crm/> .
<https://swedracor.clscor.io/entity/attrassign/1> a ns1:E13_Attribute_Assignment ;
ns1:P140_assigned_attribute_to <https://swedracor.clscor.io/entity/corpus> ;
ns1:P177_assigned_property_of_type <https://clscor.io/ontologies/CRMcls/Z8_corpus_has_corpus_type> .
NamespaceManager
clisn features a custom NamespaceManager for CLSInfra namespaces.
This e.g. allows to easily generate a namespaced rdflib.Graph like so:
from rdflib import Graph, URIRef, Literal
from clisn import CLSInfraNamespaceManager, crm
graph = Graph()
CLSInfraNamespaceManager(graph)
graph.add(
(
URIRef("https://subject.xyz/example/"),
crm["p90_has_value"],
Literal("some value")
)
)
print(graph.serialize())
Output:
@prefix crm: <http://www.cidoc-crm.org/cidoc-crm/> .
<https://subject.xyz/example/> crm:p90_has_value "some value" .
Metadata
Release files for clisn 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| clisn-0.1.4.tar.gz | 14.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| clisn-0.1.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 29.9 kB
Release files / clisn-0.1.4.tar.gz
| Download URL | clisn-0.1.4.tar.gz |
|---|---|
| Size | 14.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0920a21dd1a618e2ee22f65c0186c3e299a2d3067c5b374f6e6b4237448c0e40
|
|
BLAKE2b-256 checksum How to use checksums |
03ae5016e32a9a34caabf19f6f39ce0ab75294612a5abc107641829ff76839c7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.6.1 CPython/3.11.8 Linux/6.8.2-arch2-1
|
Release files / clisn-0.1.4-py3-none-any.whl
| Download URL | clisn-0.1.4-py3-none-any.whl |
|---|---|
| Size | 15.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ddc3166ccb104a57d996c883a5f5b6756c1c73f3063ec28ef23748c6483f5109
|
|
BLAKE2b-256 checksum How to use checksums |
e2dc39c383e40eb3c04a17b68093dfd6892d208521ff48aeae469fb5f91b3c55
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.6.1 CPython/3.11.8 Linux/6.8.2-arch2-1
|