Beispiel #1
0
class Report(xmlmap.XmlObject):
    """ Windows Error Report
    """
    ROOT_NAME = 'WERREPORT'
    machine = xmlmap.NodeField('MACHINEINFO', MachineInfo)
    """ Machine informations :type :class:`wer.schema.MachineInfo` """
    user = xmlmap.StringField('USERINFO/@username')
    """ User informations :type :class:`wer.schema.UserInfo` """
    application = xmlmap.NodeField('APPLICATIONINFO',
                                   ApplicationInfo,
                                   required=False)
    """ Application informations :type :class:`wer.schema.ApplicationInfo` """
    event = xmlmap.NodeField('EVENTINFO', EventInfo)
    """ Event informations :type :class:`wer.schema.EventInfo` """
    parameters = xmlmap.NodeListField('SIGNATURE/PARAMETER', Parameter)
    """ Event parameters :type list of :class:`wer.schema.Parameter` """
    secondary_parameters = xmlmap.NodeListField('SIGNATURE/SECONDARYPARAMETER',
                                                SecondaryParameter)
    """ Event secondary parameters :type list of :class:`wer.schema.SecondaryParameter` """
    files = xmlmap.NodeListField('FILES/FILE', File)
    """ Event attached files :type list of :class:`wer.schema.File` """
    @classmethod
    def from_file(cls, file_path):
        """ Creates a Report from a XML file """
        return xmlmap.load_xmlobject_from_file(file_path, xmlclass=cls)

    @classmethod
    def from_string(cls, xml_string):
        """ Creates a Report from a XML string """
        return xmlmap.load_xmlobject_from_string(xml_string, xmlclass=cls)
Beispiel #2
0
class _BaseBody(_BaseCerp):
    '''Common email header elements'''
    content_type_list = xmlmap.StringListField('xm:ContentType')
    charset_list = xmlmap.StringListField('xm:Charset')
    content_name_list = xmlmap.StringListField('xm:ContentName')
    content_type_comments_list = xmlmap.StringListField(
        'xm:ContentTypeComments')
    content_type_param_list = xmlmap.NodeListField('xm:ContentTypeParam',
                                                   Parameter)
    transfer_encoding_list = xmlmap.StringListField('xm:TransferEncoding')
    transfer_encoding_comments_list = xmlmap.StringListField(
        'xm:TransferEncodingComments')
    content_id_list = xmlmap.StringListField('xm:ContentId')
    content_id_comments_list = xmlmap.StringListField('xm:ContentIdComments')
    description_list = xmlmap.StringListField('xm:Description')
    description_comments_list = xmlmap.StringListField(
        'xm:DescriptionComments')
    disposition_list = xmlmap.StringListField('xm:Disposition')
    disposition_file_name_list = xmlmap.StringListField(
        'xm:DispositionFileName')
    disposition_comments_list = xmlmap.StringListField(
        'xm:DispositionComments')

    disposition_params = xmlmap.NodeListField('xm:DispositionParams',
                                              Parameter)
    other_mime_headers = xmlmap.NodeListField('xm:OtherMimeHeader', Header)
Beispiel #3
0
class BaseMods(Common):
    ''':class:`~eulxml.xmlmap.XmlObject` with common field declarations for all
    top-level MODS elements; base class for :class:`MODS` and :class:`RelatedItem`.'''
    schema_validate = True

    id = xmlmap.StringField("@ID")
    title = xmlmap.StringField("mods:titleInfo/mods:title")
    title_info = xmlmap.NodeField('mods:titleInfo', TitleInfo)
    title_info_list = xmlmap.NodeListField('mods:titleInfo', TitleInfo)
    resource_type = xmlmap.SchemaField("mods:typeOfResource",
                                       "resourceTypeDefinition")
    name = xmlmap.NodeField('mods:name', Name)  # DEPRECATED: use names instead
    names = xmlmap.NodeListField('mods:name', Name)
    note = xmlmap.NodeField('mods:note', Note)
    notes = xmlmap.NodeListField('mods:note', Note)
    origin_info = xmlmap.NodeField('mods:originInfo', OriginInfo)
    record_info = xmlmap.NodeField('mods:recordInfo', RecordInfo)
    identifiers = xmlmap.NodeListField('mods:identifier', Identifier)
    access_conditions = xmlmap.NodeListField('mods:accessCondition',
                                             AccessCondition)
    genres = xmlmap.NodeListField('mods:genre', Genre)
    languages = xmlmap.NodeListField('mods:language', Language)
    location = xmlmap.StringField('mods:location/mods:physicalLocation',
                                  required=False)
    locations = xmlmap.NodeListField('mods:location', Location)
    subjects = xmlmap.NodeListField('mods:subject', Subject)
    physical_description = xmlmap.NodeField('mods:physicalDescription',
                                            PhysicalDescription)
    abstract = xmlmap.NodeField('mods:abstract', Abstract)
    parts = xmlmap.NodeListField('mods:part', Part)
Beispiel #4
0
class Publisher(xmlmap.XmlObject):
    '''A journal publisher'''
    id = xmlmap.StringField('@id')
    # numeric id for romeo records; 'DOAJ' for doaj records with no romeo data
    name = xmlmap.StringField('name')
    alias = xmlmap.StringField('alias')
    url = xmlmap.StringField('homeurl')
    # archiving values: can, cannot, restricted, unclear, unknown.
    # restrictions present only if restricted.
    preprint_archiving = xmlmap.StringField('preprints/prearchiving')
    preprint_restrictions = xmlmap.StringListField('preprints/prerestrictions/prerestriction')
    postprint_archiving = xmlmap.StringField('postprints/postarchiving')
    postprint_restrictions = xmlmap.StringListField('postprints/postrestrictions/postrestriction')
    pdf_archiving = xmlmap.StringField('pdfversion/pdfarchiving')
    pdf_restrictions = xmlmap.StringListField('pdfversion/pdfrestrictions/pdfrestriction')
    conditions = xmlmap.StringListField('conditions/condition')
    mandates = xmlmap.NodeListField('mandates/mandate', Mandate)
    paid_access_url = xmlmap.StringField('paidaccess/paidaccessurl')
    paid_access_name = xmlmap.StringField('paidaccess/paidaccessname')
    paid_access_notes = xmlmap.StringField('paidaccess/paidaccessnotes')
    copyright_links = xmlmap.NodeListField('copyrightlinks/copyrightlink', Copyright)
    romeo_colour = xmlmap.StringField('romeocolour')
    '''`Colour values <http://www.sherpa.ac.uk/romeoinfo.html#colours>`_
    used by RoMEO to describe archiving rights'''
    date_added = xmlmap.DateTimeField('dateadded', format='%Y-%m-%d %H:%M:%S')
    date_updated = xmlmap.DateTimeField('dateupdated', format='%Y-%m-%d %H:%M:%S')

    def __repr__(self):
        return u'<%s:%s %s>' % (self.__class__.__name__, self.id, self.name)
Beispiel #5
0
class ArchivalDescription(_EadBase):
    """Archival description, contains the bulk of the information in an EAD document.

      Expected node element passed to constructor: `ead/archdesc`.
      """
    ROOT_NAME = 'archdesc'
    did = xmlmap.NodeField("e:did", DescriptiveIdentification)
    'descriptive identification :class:`DescriptiveIdentification` - `did`'
    origination = xmlmap.StringField("e:did/e:origination", normalize=True)
    "origination - `did/origination`"
    unitid = xmlmap.NodeField("e:did/e:unitid", Unitid)
    ":class:`Unitid` - `did/unitid`"
    extent = xmlmap.StringListField("e:did/e:physdesc/e:extent")
    "extent from the physical description - `did/physdesc/extent`"
    langmaterial = xmlmap.StringField("e:did/e:langmaterial")
    "language of the materials - `did/langmaterial`"
    location = xmlmap.StringField("e:did/e:physloc")
    "physical location - `did/physloc`"
    access_restriction = xmlmap.NodeField("e:accessrestrict", Section)
    "access restrictions :class:`Section` - `accessrestrict`"
    use_restriction = xmlmap.NodeField("e:userestrict", Section)
    "use restrictions :class:`Section` - `userestrict`"
    alternate_form = xmlmap.NodeField("e:altformavail", Section)
    "alternative form available :class:`Section` - `altformavail`"
    originals_location = xmlmap.NodeField("e:originalsloc", Section)
    "location of originals :class:`Section` - `originalsloc`"
    related_material = xmlmap.NodeField("e:relatedmaterial", Section)
    "related material :class:`Section` - `relatedmaterial`"
    separated_material = xmlmap.NodeField("e:separatedmaterial", Section)
    "separated material :class:`Section` - `separatedmaterial`"
    acquisition_info = xmlmap.NodeField("e:acqinfo", Section)
    "acquistion info :class:`Section` - `acqinfo`"
    custodial_history = xmlmap.NodeField("e:custodhist", Section)
    "custodial history :class:`Section` - `custodhist`"
    preferred_citation = xmlmap.NodeField("e:prefercite", Section)
    "preferred citation :class:`Section` - `prefercite`"
    biography_history = xmlmap.NodeField("e:bioghist", Section)
    "biography or history :class:`Section` - `bioghist`"
    bibliography = xmlmap.NodeField("e:bibliography", Section)
    "bibliography :class:`Section` - `bibliograhy`"
    scope_content = xmlmap.NodeField("e:scopecontent", Section)
    "scope and content :class:`Section` - `scopecontent`"
    process_info = xmlmap.NodeField("e:archdesc/e:processinfo", Section)
    "processing information :class:`Section` - `processinfo`"
    arrangement = xmlmap.NodeField("e:arrangement", Section)
    "arrangement :class:`Section` - `arrangement`"
    other = xmlmap.NodeField("e:otherfindaid", Section)
    "other finding aid :class:`Section` - `otherfindaid`"
    controlaccess = xmlmap.NodeField("e:controlaccess",
                                     ControlledAccessHeadings)
    ":class:`ControlledAccessHeadings` - `controlaccess`; subject terms, names, etc."
    index = xmlmap.NodeListField("e:index", Index)
    "list of :class:`Index` - `index`; e.g., index of selected correspondents"
    dao_list = xmlmap.NodeListField("e:dao", DigitalArchivalObject)
    "list of digital archival object references as :class:`DigitalArchivalObject`"
Beispiel #6
0
class Folder(_BaseCerp):
    """A single email folder in an :class:`Account`, composed of multiple
    :class:`Message` objects and associated metadata."""

    ROOT_NAME = 'Folder'

    name = xmlmap.StringField('xm:Name')
    messages = xmlmap.NodeListField('xm:Message', Message)
    subfolders = xmlmap.NodeListField('xm:Folder', 'self')
    mboxes = xmlmap.NodeListField('xm:Mbox', Mbox)

    def __repr__(self):
        return '<%s %s>' % (self.__class__.__name__, self.name)
Beispiel #7
0
class ReportMetadata(LoaderMixin, XmlObject):
    ROOT_NAME = 'WERReportMetadata'
    XSD_SCHEMA = path.join(path.dirname(__file__), 'wer-metadata.xsd')
    os = xmlmap.NodeField('OSVersionInformation', OSVersionInformation)
    process = xmlmap.NodeField('ProcessInformation', ProcessInformation)
    system = xmlmap.NodeField('SystemInformation', SystemInformation)
    secure_boot = xmlmap.NodeField('SecureBootState',
                                   SecureBootState,
                                   required=False)
    parameters = xmlmap.NodeListField(
        'ProblemSignatures/*[starts-with(name(), "Parameter")]', MetaParameter)
    dynamic_parameters = xmlmap.NodeListField(
        'DynamicSignatures/*[starts-with(name(), "Parameter")]', MetaParameter)
    id = xmlmap.StringField('ReportInformation/Guid')
    created_on = xmlmap.StringField('ReportInformation/CreationTime')
Beispiel #8
0
class TeiHeader(_TeiBase):
    '''xmlmap object for a TEI (Text Encoding Initiative) header'''
    title = xmlmap.StringField('tei:fileDesc/tei:titleStmt/tei:title')
    author_list = xmlmap.NodeListField(
        'tei:fileDesc/tei:titleStmt/tei:author/tei:name', TeiName)
    editor_list = xmlmap.NodeListField(
        'tei:fileDesc/tei:titleStmt/tei:editor/tei:name', TeiName)
    publisher = xmlmap.StringField(
        'tei:fileDesc/tei:publicationStmt/tei:publisher')
    publication_date = xmlmap.StringField(
        'tei:fileDesc/tei:publicationStmt/tei:date')
    availability = xmlmap.StringField(
        'tei:fileDesc/tei:publicationStmt/tei:availability')
    source_description = xmlmap.StringField('tei:fileDesc/tei:sourceDesc')
    series_statement = xmlmap.StringField('tei:fileDesc/tei:seriesStmt')
Beispiel #9
0
class Account(_BaseCerp):
    """A single email account associated with a single email address and
    composed of multiple :class:`Folder` objects and additional metadata."""

    ROOT_NAME = 'Account'
    XSD_SCHEMA = 'http://www.history.ncdcr.gov/SHRAB/ar/emailpreservation/mail-account/mail-account.xsd'

    email_address = xmlmap.StringField('xm:EmailAddress')
    global_id = xmlmap.StringField('xm:GlobalId')
    references_accounts = xmlmap.NodeListField('xm:ReferencesAccount',
            ReferencesAccount)
    folders = xmlmap.NodeListField('xm:Folder', Folder)

    def __repr__(self):
        return '<%s %s>' % (self.__class__.__name__,
                self.global_id or self.email_address or '(no id)')
Beispiel #10
0
class SubSeries(SubSeries_Base):
    """
      c02 level subseries
    """
    subseries = xmlmap.NodeListField('child::e:c03[@level="subseries"]',
                                     SubSeries_Base)
    ":class:`keep.common.eadmap.SubSeries_Base` access to c03 subseries."
Beispiel #11
0
class _BaseMessage(_BaseCerp):
    '''Common message elements'''
    local_id = xmlmap.IntegerField('xm:LocalId')
    message_id = xmlmap.StringField('xm:MessageId')
    message_id_supplied = xmlmap.SimpleBooleanField('xm:MessageId/@Supplied',
            true='1', false=None)
    mime_version = xmlmap.StringField('xm:MimeVersion')
    orig_date_list = xmlmap.StringListField('xm:OrigDate') # FIXME: really datetime
    # NOTE: eulxml.xmlmap.DateTimeField supports specifying format,
    # but we might need additional work since %z only works with
    # strftime, not strptime
    from_list = xmlmap.StringListField('xm:From')
    sender_list = xmlmap.StringListField('xm:Sender')
    to_list = xmlmap.StringListField('xm:To')
    cc_list = xmlmap.StringListField('xm:Cc')
    bcc_list = xmlmap.StringListField('xm:Bcc')
    in_reply_to_list = xmlmap.StringListField('xm:InReplyTo')
    references_list = xmlmap.StringListField('xm:References')
    subject_list = xmlmap.StringListField('xm:Subject')
    comments_list = xmlmap.StringListField('xm:Comments')
    keywords_list = xmlmap.StringListField('xm:Keywords')
    headers = xmlmap.NodeListField('xm:Header', Header)

    single_body = xmlmap.NodeField('xm:SingleBody', SingleBody)
    multi_body = xmlmap.NodeField('xm:MultiBody', MultiBody)
    @property
    def body(self):
        return self.single_body or self.multi_body

    incomplete_list = xmlmap.NodeField('xm:Incomplete', Incomplete)

    def __repr__(self):
        return '<%s %s>' % (self.__class__.__name__,
                self.message_id or self.local_id or '(no id)')
Beispiel #12
0
class MODS(BaseMods):
    '''Top-level :class:`~eulxml.xmlmap.XmlObject` for a MODS metadata record.
    Inherits all standard top-level MODS fields from :class:`BaseMods` and adds
    a mapping for :class:`RelatedItem`.
    '''
    ROOT_NAME = 'mods'
    related_items = xmlmap.NodeListField('mods:relatedItem', RelatedItem)
Beispiel #13
0
class FoxmlDatastream(_FedoraBase):
    'Foxml datastream in full foxml, e.g. object export'
    #: datastream id
    id = xmlmap.StringField('@ID')
    #: list of versions
    versions = xmlmap.NodeListField('foxml:datastreamVersion',
                                    FoxmlDatastreamVersion)
Beispiel #14
0
class ArrangementPremis(premis.Premis):
    # adapdet from diskimage premis
    XSD_SCHEMA = premis.PREMIS_SCHEMA

    object = xmlmap.NodeField('p:object', PremisObject)

    events = xmlmap.NodeListField('p:event', PremisEvent)
Beispiel #15
0
class SubordinateComponents(Section):
    """Description of Subordinate Components (dsc element); container lists and series.

       Expected node element passed to constructor: `ead/archdesc/dsc`.
    """
    ROOT_NAME = 'dsc'

    type = xmlmap.StringField("@type")
    "type of component - `@type`"
    c = xmlmap.NodeListField("e:c01", Component)
    "list of :class:`Component` - `c01`; list of c01 elements directly under this section"

    def hasSeries(self):
        """Check if this finding aid has series/subseries.

           Determined based on level of first component (series) or if first
           component has subcomponents present.

           :rtype: boolean
        """
        if len(self.c) and (self.c[0].level == 'series' or
                            (self.c[0].c and self.c[0].c[0])):
            return True
        else:
            return False
Beispiel #16
0
class Catalog(xmlmap.XmlObject):
    """:class:`xmlmap.XmlObject` class to for generating XML Catalogs"""
    ROOT_NAME = 'catalog'
    ROOT_NS = "urn:oasis:names:tc:entity:xmlns:xml:catalog"
    ROOT_NAMESPACES = {'c': ROOT_NS}
    #: list of uris, as instance of :class:`Uri`
    uri_list = xmlmap.NodeListField('c:uri', Uri)
Beispiel #17
0
class Facsimile(TeiBase):
    '''Extension of :class:`eulxml.xmlmap.teimap.TEI` to provide access
    to TEI facsimile elements'''
    #: local xsd schema
    XSD_SCHEMA = 'file://%s' % os.path.join(
        os.path.abspath(os.path.dirname(__file__)), 'schema',
        'TEIPageView.xsd')
    # NOTE: using absolute path for schema to avoid path issues when
    # building documentation on readthedocs.org

    ROOT_NAME = 'TEI'
    xmlschema = etree.XMLSchema(etree.parse(XSD_SCHEMA))
    # NOTE: not using xmlmap.loadSchema because it doesn't correctly load
    # referenced files in the same directory

    #: surface with type page, as :class:`Zone`
    page = xmlmap.NodeField('tei:facsimile/tei:surface[@type="page"]', Zone)
    #: list of pages (surface with type page)
    page_list = xmlmap.NodeListField('tei:facsimile/tei:surface[@type="page"]',
                                     Zone)
    # NOTE: tei facsimile could include illustrations, but ignoring those for now

    #: list of zones with type textLine or line as :class:`Zone`
    lines = xmlmap.NodeListField(
        'tei:facsimile//tei:zone[@type="textLine" or @type="line"]', Zone)
    #: list of word zones (type string) as :class:`Zone`
    word_zones = xmlmap.NodeListField(
        'tei:facsimile//tei:zone[@type="string"]', Zone)

    #: publication statment distributor
    distributor = xmlmap.StringField(
        'tei:teiHeader/tei:fileDesc/tei:publicationStmt/tei:distributor')
    #: publication statmnt as :class:`PublicationStatement`
    pubstmt = xmlmap.NodeField(
        'tei:teiHeader/tei:fileDesc/tei:publicationStmt', PublicationStatement)
    #: encoding description
    encoding_desc = xmlmap.NodeField('tei:teiHeader/tei:encodingDesc',
                                     xmlmap.XmlObject)

    #: source description for the original volume
    original_source = xmlmap.NodeField(
        'tei:teiHeader/tei:fileDesc/tei:sourceDesc/tei:bibl[@type="original"]',
        Bibl)
    #: source description for the readux digital edition
    digital_source = xmlmap.NodeField(
        'tei:teiHeader/tei:fileDesc/tei:sourceDesc/tei:bibl[@type="digital"]',
        Bibl)
Beispiel #18
0
class DiskImagePremis(premis.Premis):
    XSD_SCHEMA = premis.PREMIS_SCHEMA

    object = xmlmap.NodeField('p:object', PremisObject)

    fixity_checks = xmlmap.NodeListField('p:event[p:eventType="fixity check"]',
                                         premis.Event)
    '''list of PREMIS fixity check events (where event type is "fixity check"),
Beispiel #19
0
class Items(xmlmap.XmlObject):
    ''':class:`~eulxml.xmlmap.XmlObject` for the response returned by getItems.
    Has a count of the number of items found, and a list of :class:`Item`
    objects with details about each item.'''
    count = xmlmap.IntegerField('@count')
    'number of items in the result'
    items = xmlmap.NodeListField('item', Item)
    'List of items as instances of :class:`~readux.books.digwf.Item`'
Beispiel #20
0
class PointerGroup(_EadBase):
    """Group of pointer or reference elements in an index entry

    Expected node element passed to constructor: `ptrgrp`.
    """
    ROOT_NAME = 'ptrgrp'
    ref = xmlmap.NodeListField("e:ref", Reference)
    "list of :class:`Reference` - references"
Beispiel #21
0
class PremisEvent(premis.Event):
    # extend premis event in order to accurately describe migration events
    linked_objects = xmlmap.NodeListField('p:linkingObjectIdentifier',
                                          PremisLinkingObject)
    #: outcome of the event (`eventOutcomeInformation/eventOutcomeDetail/eventOutcomeDetailNote`)
    outcome_detail = xmlmap.StringField(
        'p:eventOutcomeInformation/p:eventOutcomeDetail/p:eventOutcomeDetailNote',
        required=False)
Beispiel #22
0
class AnnotatedFacsimile(Facsimile):
    '''Annotated Tei facsimile, with mappings needed to generate
    TEI with annotations.
    '''
    #: main tei title
    main_title = xmlmap.StringField(
        'tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:title[@type="full"]/tei:title[@type="main"]'
    )
    #: tei subtitle (e.g., annotated edition)
    subtitle = xmlmap.StringField(
        'tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:title[@type="full"]/tei:title[@type="sub"]'
    )

    #: responsibility statement text
    responsibility = xmlmap.StringField(
        'tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:respStmt/tei:resp')
    #: responsibility statement names
    responsible_names = xmlmap.NodeListField(
        'tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:respStmt/tei:name', Name)

    # additional mappings for annotation data

    #: list of annotations at body/div[@type="annotations"]/note[@type="annotation"], as :class:`Note`
    annotations = xmlmap.NodeListField(
        'tei:text/tei:body/tei:div[@type="annotations"]/tei:note[@type="annotation"]',
        Note)

    #: list of bibliographic citations/works cited
    citations = xmlmap.NodeListField(
        'tei:text/tei:body/tei:div[@type="works-cited"]/tei:listBibl/tei:biblStruct',
        BiblStruct)
    #: list of bibliographic citation ids

    citation_ids = xmlmap.StringListField(
        'tei:text/tei:body/tei:div[@type="works-cited"]/tei:listBibl/tei:biblStruct/@xml:id'
    )

    #: annotation tags, as :class:`~eulxml.xmlmap.teimap.TeiInterpGroup`
    tags = xmlmap.NodeField('tei:text/tei:back/tei:interpGrp[@type="tags"]',
                            InterpGroup)

    def page_id_by_xlink(self, link):
        results = self.node.xpath('//tei:surface[@type="page"][@xlink:href="%s"]/@xml:id' \
            % link, namespaces=self.ROOT_NAMESPACES)
        if results:
            return results[0]
Beispiel #23
0
class ObjectDatastreams(_FedoraBase):
    """:class:`~eulxml.xmlmap.XmlObject` for the list of a single object's
        datastreams, as returned by  :meth:`REST_API.listDatastreams`"""
    # listDatastreams result default namespace is fedora access
    ROOT_NAME = 'objectDatastreams'
    pid = xmlmap.StringField('@pid')
    "object pid - `@pid`"
    datastreams = xmlmap.NodeListField('a:datastream', ObjectDatastream)
    "list of :class:`ObjectDatastream`"
Beispiel #24
0
class Section(_EadBase):
    """Generic EAD section.  Currently only has mappings for head, paragraph, and note."""
    head = xmlmap.NodeField("e:head", xmlmap.XmlObject)
    "heading - `head`"
    content = xmlmap.NodeListField(
        "e:p", xmlmap.XmlObject)  # ?? (to allow formatting)
    "list of paragraphs - `p`"
    note = xmlmap.NodeField("e:note", Note)
    ":class:`Note`"
Beispiel #25
0
class FoxmlDatastreamVersion(_FedoraBase):
    'Foxml datastream version in full foxml, e.g. object export'
    #: datastream version id
    id = xmlmap.StringField('@ID')
    #: mimetype
    mimetype = xmlmap.StringField('@MIMETYPE')
    #: content digest
    content_digest = xmlmap.NodeListField('foxml:contentDigest',
                                          FoxmlContentDigest)
Beispiel #26
0
class Page(Base):
    '''A single page of a :class:`Document`.'''
    ROOT_NAME = 'page'
    width = xmlmap.IntegerField('@width')
    'integer width'
    height = xmlmap.IntegerField('@height')
    'integer height'
    resolution = xmlmap.IntegerField('@resolution')
    'integer resolution'
    blocks = xmlmap.NodeListField(frns('block'), Block)
    'list of :class:`Block` elements in this page'
    text_blocks = xmlmap.NodeListField(frns('block[@blockType="Text"]'), Block)
    'text :class:`Block` elements (where type is "Text")'
    picture_blocks = xmlmap.NodeListField(frns('block[@blockType="Picture"]'),
                                          Block)
    'picture :class:`Block` elements (where type is "Picture")'
    # block position info possibly redundant? map paragraphs directly
    paragraphs = xmlmap.NodeListField(frns('block/text/par'), Paragraph)
    'list of :class:`Paragraph` elements in any of the blocks on this page'
Beispiel #27
0
class FoxmlDigitalObject(_FedoraBase):
    '''Minimal :class:`~eulxml.xmlmap.XmlObject` for Foxml
    DigitalObject as returned by :meth:`REST_API.getObjectXML`, to
    provide access to the Fedora audit trail.
    '''
    audit_trail = xmlmap.NodeField(
        'foxml:datastream[@ID="AUDIT"]/foxml:datastreamVersion/foxml:xmlContent/audit:auditTrail',
        AuditTrail)
    'Fedora audit trail, as instance of :class:`AuditTrail`'
    datastreams = xmlmap.NodeListField('foxml:datastream', FoxmlDatastream)
Beispiel #28
0
class TeiFigure(_TeiBase):
    #entity      = xmlmap.StringField("@entity") #not used in P5
    # TODO: ana should be a more generic attribute, common to many elements...
    ana = xmlmap.StringField(
        "@ana")  # FIXME: how to split on spaces? should be a list...
    head = xmlmap.StringField("tei:head")
    description = xmlmap.StringField("tei:figDesc")
    entity = xmlmap.StringField(
        "tei:graphic/@url")  #graphic replaces entity in p5.
    floatingText = xmlmap.NodeListField('tei:floatingText', TeiFloatingText)
Beispiel #29
0
class Series(XmlModel, eadmap.Component):
    """
      Top-level (c01) series.

      Customized version of :class:`eulcore.xmlmap.eadmap.Component`
    """

    ROOT_NAMESPACES = {
        'e': eadmap.EAD_NAMESPACE,
        'exist': 'http://exist.sourceforge.net/NS/exist'
    }

    eadid = xmlmap.NodeField('ancestor::e:ead/e:eadheader/e:eadid',
                             eadmap.EadId)

    objects = Manager('//e:c01[@level="series"]')
    """:class:`eulcore.django.existdb.manager.Manager` - similar to an object manager
        for django db objects, used for finding and retrieving series objects
        in eXist.

        Configured to use *//c01[@level='series']* as base search path.
    """

    subseries = xmlmap.NodeListField('child::e:c02[@level="subseries"]',
                                     SubSeries)

    _short_id = None

    @property
    def short_id(self):
        "Short-form id (without eadid prefix) for use in external urls."
        if self._short_id is None:
            # get eadid, if available
            if hasattr(self, 'eadid') and self.eadid.value:
                eadid = self.eadid.value
            else:
                eadid = None
            self._short_id = shortform_id(self.id, eadid)
        return self._short_id

    _title = None

    @property
    def title(self):
        "Title of series without the date."
        if self._title is None:
            if hasattr(self, 'did') and hasattr(self.did, 'unittitle'):
                self._title = unicode(self.did.unittitle)
                comma_pos = self._title.rfind(", ")
                if (comma_pos != -1):
                    self._title = self._title[:comma_pos]
            else:
                self._title = None
        return self._title
Beispiel #30
0
class DatastreamHistory(_FedoraBase):
    """:class:`~eulxml.xmlmap.XmlObject` for datastream history
    information returned by :meth:`REST_API.getDatastreamHistory`."""
    # default namespace is fedora manage
    ROOT_NAME = 'datastreamHistory'
    pid = xmlmap.StringField('@pid')
    "pid"
    dsid = xmlmap.StringField('@dsID')
    "datastream id"
    versions = xmlmap.NodeListField('m:datastreamProfile', DatastreamProfile)
    'list of :class:`DatastreamProfile` objects for each version'