cobalt
¶
Acts¶
-
class
cobalt.act.
Act
(xml=None)¶ An act is a lightweight wrapper around an Akoma Ntoso 2.0 XML act document. It provides methods to help access and manipulate the underlying XML directly, in particular the metadata for the document.
The Act object provides quick access to certain sections of the document:
Variables: - root –
lxml.objectify.ObjectifiedElement
root of the XML document - meta –
lxml.objectify.ObjectifiedElement
meta element - body –
lxml.objectify.ObjectifiedElement
body element
See also
http://www.akomantoso.org/docs/akoma-ntoso-user-documentation/metadata-describes-the-content
-
__init__
(xml=None)¶ Setup a new instance with the string in xml.
-
body_xml
¶ The raw XML string of the body element of the document. When setting this property, XML must be rooted at a body element.
-
components
()¶ Get an OrderedDict of component name to
lxml.objectify.ObjectifiedElement
objects.
-
expression_date
¶ Date from the FRBRExpression element
-
expression_frbr_uri
()¶ The FRBR Expression URI as a
FrbrUri
instance that uniquely identifies this document universally.
-
frbr_uri
¶ The FRBR Work URI as a
FrbrUri
instance that uniquely identifies this document universally.
-
language
¶ The 3-letter ISO-639-2 language code of this document
-
manifestation_date
¶ Date from the FRBRManifestation element
-
publication_date
¶ Date of the publication
-
publication_name
¶ Name of the publication in which this act was published
-
publication_number
¶ Sequence number of the publication
-
title
¶ Short title
-
work_date
¶ Date from the FRBRWork element
- root –
FRBR URIs¶
-
class
cobalt.uri.
FrbrUri
(country, locality, doctype, subtype, actor, date, number, work_component=None, language=None, expression_date=None, expression_component=None, expression_subcomponent=None, format=None)¶ An FRBR URI parser which understands Akoma Ntoso 3.0 FRBR URIs (IRIs) for works and expressions.
URIs can be parsed from a plain string using
parse()
or they can be constructed directly. URIs can be manipulated in-place once constructed, which is useful for turning a work-level URI into an expression or manifestation URI.URIs can be transformed back to the string form of work, expression and manifestation URIs using the
work_uri()
,expression_uri()
andmanifestation_uri()
methods.Example:
>>> uri = FrbrUri.parse('/za-jhb/act/by-law/2003/public-health/eng:2015-01-01/main/part/A.xml') >>> uri.country 'za' >>> uri.locality 'jhb' >>> uri.doctype 'act' >>> uri.subtype 'by-law' >>> uri.date '2003' >>> uri.number 'public-health' >>> uri.language 'eng' >>> uri.expression_date ':2015-01-01' >>> uri.expression_component 'main' >>> uri.expression_subcomponent 'part/A' >>> uri.format 'xml' >>> uri.work_uri() '/za-jhb/act/by-law/2003/public-health' >>> uri.expression_uri() '/za-jhb/act/by-law/2003/public-health/eng:2015-01-01/main/part/A' >>> uri.manifestation_uri() '/za-jhb/act/by-law/2003/public-health/eng:2015-01-01/main/part/A.xml'
Variables: - country – two letter country code
- locality – locality within the country, may be None
- doctype – type of document (eg.
act
) - subtype – document subtype, may be None
- actor – emenating actor, may be None
- date – document data (str), YYYY[-MM[-DD]]
- number – document number (str)
- work_component – name of the work component, may be None
- language – three-letter expression language code, may be None
- expression_date – expression date (str), [@:]YYYY[-MM[-DD]], may be None
- expression_component – name of the expression component, may be None
- expression_subcomponent – name of the expression subcomponent, may be None
- format – format extension, may be None
See also
http://akresolver.cs.unibo.it/admin/documentation.html http://www.akomantoso.org/release-notes/akoma-ntoso-3.0-schema/naming-conventions-1/bungenihelpcenterreferencemanualpage.2008-01-09.1484954524
-
__init__
(country, locality, doctype, subtype, actor, date, number, work_component=None, language=None, expression_date=None, expression_component=None, expression_subcomponent=None, format=None)¶ Initialize self. See help(type(self)) for accurate signature.
-
expression_uri
(work_component=True)¶ String form of the expression URI.
-
manifestation_uri
(work_component=True)¶ String form of the manifestation URI.
-
uri
()¶ String form of the work URI, excluding the work component, if any.
-
work_uri
(work_component=True)¶ String form of the work URI.