Skip to main content

flake8 Lint Test codecov PyPI version

acdh-cidoc-pyutils

Helper functions for the generation of CIDOC CRMish RDF

Usage

  • install via pip install acdh-cidoc-pyutils

date-like-string to casted rdflib.Literal

from acdh_cidoc_pyutils import date_to_literal
dates = [
    "1900",
    "1900-01",
    "1901-01-01",
    "foo",
]
for x in dates:
    date_literal = date_to_literal(x)
    print((date_literal.datatype))

# returns
# http://www.w3.org/2001/XMLSchema#gYear
# http://www.w3.org/2001/XMLSchema#gYearMonth
# http://www.w3.org/2001/XMLSchema#date
# http://www.w3.org/2001/XMLSchema#string

make some random URI

from acdh_cidoc_pyutils import make_uri

domain = "https://hansi4ever.com/"
version = "1"
prefix = "sumsi"
uri = make_uri(domain=domain, version=version, prefix=prefix)
print(uri)
# https://hansi4ever.com/1/sumsi/6ead32b8-9713-11ed-8065-65787314013c

uri = make_uri(domain=domain)
print(uri)
# https://hansi4ever.com/8b912e66-9713-11ed-8065-65787314013c

create an E52_Time-Span graph

from acdh_cidoc_pyutils import create_e52, make_uri
uri = make_uri()
e52 = create_e52(uri, begin_of_begin="1800-12-12", end_of_end="1900-01")
print(e52.serialize())

# returns
# @prefix ns1: <http://www.cidoc-crm.org/cidoc-crm/> .
# @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
# @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

# <https://hansi4ever.com/387fb457-971b-11ed-8065-65787314013c> a ns1:E52_Time-Span ;
#     rdfs:label "1800-12-12 - 1900-01"^^xsd:string ;
#     ns1:P82a_begin_of_the_begin "1800-12-12"^^xsd:date ;
#     ns1:P82b_end_of_the_end "1900-01"^^xsd:gYearMonth .

normalize_string

from acdh_cidoc_pyutils import normalize_string
string = """\n\nhallo
mein schatz ich liebe    dich
    du bist         die einzige für mich
        """
print(normalize_string(string))
# returns
# hallo mein schatz ich liebe dich du bist die einzige für mich

development

  • pip install -r requirements_dev.txt
  • flake8 -> linting
  • coveage run -m pytest -> runs tests and creates coverage stats

Download files

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

Source Distribution

acdh_cidoc_pyutils-0.3.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

acdh_cidoc_pyutils-0.3-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file acdh_cidoc_pyutils-0.3.tar.gz.

File metadata

  • Download URL: acdh_cidoc_pyutils-0.3.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.9

File hashes

Hashes for acdh_cidoc_pyutils-0.3.tar.gz
Algorithm Hash digest
SHA256 bd0045e8e3259009f7c8500ca23ef442e508d742ce5a565d3dc01c1d52d276b9
MD5 1d3357ded7a4093b3757317d8d47f11f
BLAKE2b-256 f321084e8872489ede49a195967a363ebddcf5f7cb955414536435e487643e3f

See more details on using hashes here.

File details

Details for the file acdh_cidoc_pyutils-0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for acdh_cidoc_pyutils-0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 cc8943388c2e6b8649087be83f2dd2123d3991e53aa7f107c8ce1cde5c9b15c1
MD5 27ed97abeb8edf3168a799101abeb36b
BLAKE2b-256 8d43c4422b02781a5b7eb103cf8fc430912f8b13ea0948237f9276e8a6107225

See more details on using hashes here.

Release history Release notifications | RSS feed

1.12.1

2 files

1.12

2 files

1.11

2 files

1.10

2 files

1.9

2 files

1.8.1

2 files

1.8

2 files

1.7

2 files

1.6.2

2 files

1.6.1

2 files

1.6

2 files

1.5

2 files

1.4

2 files

1.3

2 files

1.2

2 files

1.1

2 files

1.0

2 files

0.27

2 files

0.26

2 files

0.25

2 files

0.24

2 files

0.23

2 files

0.22

2 files

0.21

2 files

0.20

2 files

0.19

2 files

0.18

2 files

0.17

2 files

0.16.1

2 files

0.16

2 files

0.15

2 files

0.14

2 files

0.13

2 files

0.12

2 files

0.11

2 files

0.10

2 files

0.9

2 files

0.8

2 files

0.7

2 files

0.6

2 files

0.5

2 files

0.4

2 files

This release

0.3 This release

2 files

0.2

2 files

0.1.1

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page