pymods.record Module

class pymods.Record[source]

Bases: lxml.etree.ElementBase

Base record class. Subclass of etree.ElementBase.

class pymods.MODSRecord[source]

Bases: pymods.record.Record

Class for retrieving information from documents using the MODSXML standard (http://www.loc.gov/standards/mods).

Most element structures are supported. Data is returned mostly as lists of strings or lists of named tuples. When possible data is parsed from element parts and returned in typical LOC ordered strings:

  • {family name}, {given name}, {dates} for names.
  • {non-sort character} {title}: {subtitle} for titles.
abstract

Pull information from mods:abstract element(s).

Returns:A list of Abstract elements with text, type, and displayLabel attributes.
classification

Pull information from mods:classification element(s).

Returns:A list of text from classification element(s).
collection

Retrieve archival collection metadata from mods:relatedItem[type=”host”].

Returns:A Collection element with location, title, and url attributes.
dates

Constructs dates from dateIssued, dateCreated, copyrightDate, and dateOther elements.

Returns:List of Date elements with text and type attributes.
digital_origin

Get text from mods:edition element.

Returns:String containing digital origin information.
doi
Returns:Item’s DOI or None.
edition

Accesses mods:edition element.

Returns:Edition element text or None.
extent

Accesses mods:extent element.

Returns:A list of mods:extent texts.
form

Accesses mods:physicalDescription/mods:form element.

Returns:A list of mods:form texts.
genre

Accesses mods:genre element.

Returns:A list containing Genre elements with term, uri, authority, and authorityURI attributes.
geographic_code

Accesses mods:geographicCode element.

Returns:A list of mods:geographicCode texts.
get_corp_names

Separates corporate names from other name types.

Returns:A list of corporate names.
get_creators

Separates creator names from other name roles.

Returns:A list of creator names.
get_names(**kwargs)[source]

A customizable name query service. Subsets of all record names can be identified by type (‘personal’, ‘corporate’, etc.), name authority, or role.

Parameters:kwargs – A key, value pair of type=”*”, authority=”*”, or role=”*”.
Returns:A list of names matching query.
get_notes(**kwargs)[source]

A customizable name query service. Subsets of all record notes can be identified by type or displayLabel.

Parameters:kwargs – A key, value pair of type=”*” or displayLabel=”*”.
Returns:A list of notes matching query.
get_pers_names

Separates personal names from other name types.

Returns:A list of personal names.
identifiers

Accesses mods:identifier elements.

Returns:A list of identifiers.
iid

A custom FSU identifier service.

Returns:Item’s IID or None.
internet_media_type

Accesses mods:physicalDescription/mods:internetMediaType element.

Returns:A list of mods:internetMediaType texts.
issuance

Accesses mods:issuance element.

Returns:List of mods:issuance texts.
language

Accesses mods:languageTerm elements.

Returns:A list of Language elements with text, code, and authority attributes.
name_parts

Not currently implemented.

Returns:
names

General mods:name service.

Returns:A list of Name elements with text, uri, authority, and authorityURI attributes.
note

Access mods:note elements.

Returns:A list containing Note elements with text, type, and displayLabel attributes.
physical_description_note

Access mods:physicalDescription/mods:note elements and return a list of text values.

Returns:A list of note text values.
physical_location

Access mods:mods/mods:location/mods:physicalLocation and return text values.

Returns:A list of element text values.
pid

Get fedora PID from MODS record.

Returns:Item’s fedora PID or None.
publication_place

Accesses mods:originInfo/mods:place elements.

Returns:A list of PublicationPlace elements with text and type attributes.
publisher

Accesses mods:publisher elements.

Returns:A list of element text values.
purl

Retrieves record’s Persistent URL from mods:mods/mods:location/mods:url.

Returns:List of strings.
rights

Access mods:accessCondition and return values.

Returns:A list containing Rights elements with text, type, and uri.
subject_parts

Not currently implemented.

Returns:
subjects

General subject retrieval service.

Returns:list of Subject elements with text, uri, authority and authorityURI values.
table_of_contents
title_parts

Not currently implemented.

Returns:
titles

General title retrieval service.

Returns:A list of title texts.
type_of_resource

Access mods:typeOfResource and return text value.

Returns:Text value or None.
class pymods.OAIRecord[source]

Bases: pymods.record.Record

Record class for records stored in the OAI-PMH format. OAI documents in either the OAI-PMH standard or repox export standard are supported.

This class allows access to OAI wrapper data, such as the OAI record URN. The OAIRecord.metadata property allows access to the metadata content of the record. Standard methods from the MODSRecord and DCRecord classes can be performed on OAIRecord objects through the metadata property. Internal tests will automatically select the correct parser and class to return.

metadata

Exposes the metadata content of an OAIRecord.

Returns:A reparsed root element either in the MODSRecord or DCRecord class, as appropriate.
oai_urn
Returns:The OAI ID as a string.
class pymods.DCRecord[source]

Bases: pymods.record.Record

Record class for Dublin Core and Qualified Dublin Core elements.

get_element(elem, delimiter=None)[source]
Parameters:
  • elem – An element. It can be named explicitly by namespace using Clark Notation, or using the form ‘{*}elem’ will match elem in any namespace.
  • delimiter – A character used to separate values within a single element.
Returns:

A list of element values.