Skip to main content

Library for building RO-Crates using rdflib

Project description

RdfCrate

RO-Crate builder that uses RDF concepts.

Detailed documentation available here.

Advantages

  • Simple API that doesn’t require understanding JSON-LD
  • Library of types and properties to speed up development and ensure correctness
  • Valid JSON-LD guaranteed
  • Type checker friendly

Installation

pip install rdfcrate

Example

Let’s say you have a directory with one file in it, which you want to document. Here’s how you could make an RO-Crate using RdfCrate:

from rdfcrate import AttachedCrate, uris
from rdflib import Literal

crate = AttachedCrate("/path/to/crate")
crate.register_file("salvatore.jpg", [
    (uris.name, Literal("Salvatore the Seal"))
])
print(crate.compile())
{
  "@context": "https://w3id.org/ro/crate/1.1/context",
  "@graph": [
    {
      "@id": "./",
      "@type": "Dataset",
      "datePublished": "2025-01-17T15:58:23.852731"
    },
    {
      "@id": "salvatore.jpg",
      "@type": "File",
      "encodingFormat": "image/jpeg",
      "name": "Salvatore the Seal"
    },
    {
      "@id": "ro-crate-metadata.json",
      "@type": "CreativeWork",
      "about": {
        "@id": "./"
      },
      "conformsTo": {
        "@id": "https://w3id.org/ro/crate/1.1"
      }
    }
  ]
}

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

rdfcrate-0.2.0.tar.gz (3.7 MB view details)

Uploaded Source

Built Distribution

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

rdfcrate-0.2.0-py3-none-any.whl (32.6 kB view details)

Uploaded Python 3

File details

Details for the file rdfcrate-0.2.0.tar.gz.

File metadata

  • Download URL: rdfcrate-0.2.0.tar.gz
  • Upload date:
  • Size: 3.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.4.20

File hashes

Hashes for rdfcrate-0.2.0.tar.gz
Algorithm Hash digest
SHA256 43efd7d8aad72a1f260547224f0fb0a71c06698a73e3791385ccc4b52cbbb1be
MD5 20470433dc0c1c3e51a7cb40f3997640
BLAKE2b-256 a5d47b7cf4abd07cc55d598f57748e68d5801887d02ef697c348ba8df156173c

See more details on using hashes here.

File details

Details for the file rdfcrate-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: rdfcrate-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 32.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.4.20

File hashes

Hashes for rdfcrate-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c1bb7f61b51f6e5de88fe9751bdcd9168839aa0eaecf9cd465c5e8166fa45231
MD5 5c33f13525f88f7c687d592d3056ac87
BLAKE2b-256 72532228fcbcfc7da26f2460d2c295bd98e5a2bbef01563435a8313ca92f8d80

See more details on using hashes here.

Supported by

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