Research Object Libraries and Tooling
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

ro-python library

Build Status

This repository is a partial fork of ro-manager in order to


#!/usr/bin/env python3
from rolib.bundle import *
from rolib.manifest import *
import datetime

with Bundle("",mode='w') as ro:

    ro.manifest.createdOn =
    # Stian created the reserarch object (this collection)
    stian = Agent(name="Stian Soiland-Reyes", orcid="")
    ro.manifest.createdBy = stian

    ro.writestr("hello.txt", "To be, or not to be, that is the question")
    hello = ro.manifest.get_aggregate("hello.txt")

    # Stian created the hello.txt resource
    hello.createdBy = stian
    hello.createdOn =
    ## but someone else authored its content:
    shakespeare = Agent(name="William Shakespeare", uri="")
    hello.authoredBy = shakespeare
    hello.authoredOn = datetime.datetime(1604,1,1).isoformat()

    # Aggregate an external resource, also different author
    quote = ro.manifest.add_aggregate("")
    quote.authoredBy = shakespeare
    # Folger Shakespeare Library made the digital representation
    folger = Agent(name="Folger Shakespeare Library", uri="")
    quote.createdBy = folger

    # This wikipage (which we didn't need to aggregate) is somewhat about this quote
    ro.manifest.add_annotation(about=quote.uri, content=",_or_not_to_be")
    # And also about our hello.txt - even if it doesn't mention it by URL
    ro.manifest.add_annotation(about="hello.txt", content=",_or_not_to_be")