Source Resource
Container classes for the resulting DPLA MAPv4 JSON-LD document(s)
- class manatus.source_resource.Record
Generic object class. Provides some JSON-like methods
- property data
Property for raw access to record’s data at
self.__dict__
- dumps(indent=None)
Return object’s JSON representation. Useful for debugging
- Parameters
indent (integer or None) – padding for pretty printing
- Returns
record JSON
- Return type
str
- keys()
JSON key iterator
- write_json(fp, prefix=None, pretty_print=False)
Write record as JSON to fp, appending if fp exists
- Parameters
fp (str) –
prefix (str) –
pretty_print (bool) –
- Returns
- write_jsonl(fp, prefix=None)
Write record as JSONL to fp, appending if fp exists
- Parameters
fp (str) –
prefix (str) –
- Returns
- class manatus.source_resource.DPLARecord(record=None)
DPLA MAPv4 record class. Serves as the JSON-LD wrapper for
SourceResource. Includes some default attributes for convenience.- property data
Property for raw access to record’s data at
self.__dict__
- dumps(indent=None)
Return object’s JSON representation. Useful for debugging
- Parameters
indent (integer or None) – padding for pretty printing
- Returns
record JSON
- Return type
str
- keys()
JSON key iterator
- write_json(fp, prefix=None, pretty_print=False)
Write record as JSON to fp, appending if fp exists
- Parameters
fp (str) –
prefix (str) –
pretty_print (bool) –
- Returns
- write_jsonl(fp, prefix=None)
Write record as JSONL to fp, appending if fp exists
- Parameters
fp (str) –
prefix (str) –
- Returns
- class manatus.source_resource.SourceResource
DPLA MAPv4 sourceResource record class
- Raises
SourceResourceRequiredElementException – if either required elements ‘rights’ or ‘title’ are missing
- property data
Property for raw access to record’s data at
self.__dict__
- dumps(indent=None)
Return object’s JSON representation. Useful for debugging
- Parameters
indent (integer or None) – padding for pretty printing
- Returns
record JSON
- Return type
str
- keys()
JSON key iterator
- write_json(fp, prefix=None, pretty_print=False)
Write record as JSON to fp, appending if fp exists
- Parameters
fp (str) –
prefix (str) –
pretty_print (bool) –
- Returns
- write_jsonl(fp, prefix=None)
Write record as JSONL to fp, appending if fp exists
- Parameters
fp (str) –
prefix (str) –
- Returns
- class manatus.source_resource.RecordGroup(records=None)
List container for
scenarios.ManatusRecordrecords- Parameters
records (list) – List of
scenarios.ManatusRecordrecords or subclassed records
- append(record)
- load(fp)
Load record group from file
- Parameters
fp (str) – File path
- Returns
- Raises
RecordGroupFileExtensionError – if the file does not have a .json or .jsonl extension
FileNotFoundError – is the specified file doesn’t exist
- print(indent=None)
- write_json(fp, prefix=None, pretty_print=False)
- Parameters
fp (str) –
prefix (str) –
pretty_print (bool) –
- Returns
- write_jsonl(fp, prefix=None)
- Parameters
fp (str) –
prefix (str) –
- Returns