Skip to main content

No project description provided

Project description

CLiSN <:books:>:sparkles:

License: GPL v3 PyPI version

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" .

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

clisn-0.1.4.tar.gz (14.6 kB view details)

Uploaded Source

Built Distribution

clisn-0.1.4-py3-none-any.whl (15.3 kB view details)

Uploaded Python 3

File details

Details for the file clisn-0.1.4.tar.gz.

File metadata

  • Download URL: clisn-0.1.4.tar.gz
  • Upload date:
  • Size: 14.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.11.8 Linux/6.8.2-arch2-1

File hashes

Hashes for clisn-0.1.4.tar.gz
Algorithm Hash digest
SHA256 0920a21dd1a618e2ee22f65c0186c3e299a2d3067c5b374f6e6b4237448c0e40
MD5 499c7c90d44f41b5f740e3361e00fd69
BLAKE2b-256 03ae5016e32a9a34caabf19f6f39ce0ab75294612a5abc107641829ff76839c7

See more details on using hashes here.

File details

Details for the file clisn-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: clisn-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 15.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.11.8 Linux/6.8.2-arch2-1

File hashes

Hashes for clisn-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 ddc3166ccb104a57d996c883a5f5b6756c1c73f3063ec28ef23748c6483f5109
MD5 b5e2e32c5b5f7f41356a5d8f49067332
BLAKE2b-256 e2dc39c383e40eb3c04a17b68093dfd6892d208521ff48aeae469fb5f91b3c55

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page