Skip to main content

alea-dublincore

PyPI version License: MIT Python Versions

Description

alea-dublincore is a Python library for working with Dublin Core metadata. It provides a DublinCoreDocument class that allows you to create, manipulate, and serialize Dublin Core metadata in various formats, including JSON, JSON-LD, XML, and RDF.

In addition to DC metadata, the DublinCoreDocument class also supports:

  • generating UUIDv4 IDs
  • storing and serializing the full text content of a document, including its size, BLAKE2b hash, and raw bytes.
  • base64 encoding and zlib/lzma serialization of the content for efficient storage and transmission

Installation

pip install alea-dublincore

Examples

Creating a Dublin Core Document

from alea_dublincore import DublinCoreDocument
import datetime

doc = DublinCoreDocument(
    title="Sample Document",
    creator=["John Doe", "Jane Smith"],
    date=datetime.datetime(2023, 5, 1, 12, 0, 0),
    subject=["Metadata", "Dublin Core"],
    description="A sample document demonstrating the use of alea-dublincore",
    language="en"
)

Storing and Loading From JSON, JSON-LD, XML, and RDF

# To JSON
json_str = doc.to_json()
print(json_str)

# To JSON-LD
json_ld_str = doc.to_json_ld()
print(json_ld_str)

# To XML
xml_str = doc.to_xml()
print(xml_str)

# To RDF
rdf_str = doc.to_rdf()
print(rdf_str)

# From JSON
doc_from_json = DublinCoreDocument.from_json(json_str)

# From JSON-LD
doc_from_json_ld = DublinCoreDocument.from_json_ld(json_ld_str)

# From XML
doc_from_xml = DublinCoreDocument.from_xml(xml_str)

# From RDF
doc_from_rdf = DublinCoreDocument.from_rdf(rdf_str)

# Check if the deserialized documents are equal to the original document
doc.content = b"This is the full text content of the document."
encoded_doc = doc.to_json()  # Content will be base64 encoded and compressed

# Later, when deserializing
decoded_doc = DublinCoreDocument.from_json(encoded_doc)
print(decoded_doc.content.decode())  # Prints the original content

License

This ALEA project is released under the MIT License. See the LICENSE file for details.

Support

If you encounter any issues or have questions about using this ALEA project, please open an issue on GitHub.

Learn More

To learn more about ALEA and its software and research projects, visit the ALEA website.

Metadata

Release files for alea-dublincore 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for alea-dublincore 0.1.0
File Size Uploaded
alea_dublincore-0.1.0.tar.gz 6.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for alea-dublincore 0.1.0
File Interpreter ABI Platform
alea_dublincore-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 14.0 kB

Release files / alea_dublincore-0.1.0.tar.gz

Download URL alea_dublincore-0.1.0.tar.gz
Size 6.8 kB
Tags Source
SHA-256 checksum
How to use checksums
cfe732ab33297fad1310f92df79d55f197e7cc6869835387364fd9578c1c8104
BLAKE2b-256 checksum
How to use checksums
f921523e5af6cc367d6635f8eb594672a13af372027d68df7552d33006203c5d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.12.3 Linux/6.8.0-44-generic

Release files / alea_dublincore-0.1.0-py3-none-any.whl

Download URL alea_dublincore-0.1.0-py3-none-any.whl
Size 7.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
55a7b20bfd7e13329f45bd0b379181e16ee416bf8d359fa75536be0cef9da634
BLAKE2b-256 checksum
How to use checksums
5a90a3ebcfc078d37ecbb88cd2d2901ef3521a22f75d318a66e135c00e49704e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.12.3 Linux/6.8.0-44-generic

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release 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