コード例 #1
0
    def __init__(self, md=None):
        super(CI_ResponsibleParty, self).__init__(md)
        if md is None:
            self.email = []
            self.fax = []
            self.onlineresource = None
            self.phone = []
            self.role = None
            self.role_pt = None
        else:
            self.phone = []
            for val in md.findall(
                    util.nspath_eval(
                        'gmd:contactInfo/gmd:CI_Contact/gmd:phone/gmd:CI_Telephone/gmd:voice/gco'
                        ':CharacterString', namespaces)):
                self.phone.append(util.testXMLValue(val))

            self.fax = []
            for val in md.findall(
                    util.nspath_eval(
                        'gmd:contactInfo/gmd:CI_Contact/gmd:phone/gmd:CI_Telephone/gmd:facsimile'
                        '/gco:CharacterString', namespaces)):
                self.fax.append(util.testXMLValue(val))

            self.email = []
            for val in md.findall(
                    util.nspath_eval(
                        'gmd:contactInfo/gmd:CI_Contact/gmd:address/gmd:CI_Address/gmd'
                        ':electronicMailAddress/gco:CharacterString',
                        namespaces)):
                self.email.append(util.testXMLValue(val))
コード例 #2
0
    def __init__(self, md=None):
        super(MD_Distribution, self).__init__(md)
        if md is None:
            self.format = []
            self.version = []
            self.size = None
            self.distributor = []
        else:
            self.format = []
            self.version = []
            for val in md.findall(
                    util.nspath_eval('gmd:distributionFormat/gmd:MD_Format',
                                     namespaces)):
                format1 = val.find(
                    util.nspath_eval('gmd:name/gco:CharacterString',
                                     namespaces))
                version = val.find(
                    util.nspath_eval('gmd:version/gco:CharacterString',
                                     namespaces))
                self.format.append(util.testXMLValue(format1))
                self.version.append(util.testXMLValue(version))

            val = md.find(
                util.nspath_eval(
                    'gmd:transferOptions/gmd:MD_DigitalTransferOptions/gmd:transferSize/gco:Real',
                    namespaces))
            self.size = util.testXMLValue(val)

            self.distributor = []
            for val in md.findall(
                    util.nspath_eval(
                        'gmd:distributor/gmd:MD_Distributor/gmd:distributorContact/gmd'
                        ':CI_ResponsibleParty', namespaces)):
                o = CI_ResponsibleParty(val)
                self.distributor.append(o)
コード例 #3
0
 def __init__(self, md=None):
     super(EX_Extent, self).__init__(md)
     if md is None:
         self.hasresource = True
     else:
         val = md.find(
             util.nspath_eval(
                 'gmd:EX_GeographicBoundingBox/gmd:extentTypeCode/gco:Boolean',
                 namespaces))
         val1 = util.testXMLValue(val)
         if val1 is None:
             val = md.find(
                 util.nspath_eval(
                     'gmd:EX_GeographicDescription/gmd:extentTypeCode/gco:Boolean',
                     namespaces))
             val1 = util.testXMLValue(val)
         if val1 is None:
             self.hasresource = 'true'
         else:
             self.hasresource = val1
コード例 #4
0
    def __init__(self, md=None):
        super(DQ_DataQuality, self).__init__(md)
        if md is None:
            self.conformanceexplanation = None
            self.lineageEN = None
            self.sources = []
            self.process_steps_description = []
            self.process_steps_date = []
            self.process_steps_rationale = []
        else:
            val = md.find(
                util.nspath_eval(
                    'gmd:report/gmd:DQ_DomainConsistency/gmd:result/gmd:DQ_ConformanceResult/gmd'
                    ':explanation/gco:CharacterString', namespaces))
            val = util.testXMLValue(val)
            self.conformanceexplanation = val

            val = md.find(
                util.nspath_eval(
                    'gmd:lineage/gmd:LI_Lineage/gmd:statement/gmd:PT_FreeText/gmd:textGroup/gmd'
                    ':LocalisedCharacterString', namespaces))
            val = util.testXMLValue(val)
            self.lineageEN = val

            self.sources = []
            for val in md.findall(
                    util.nspath_eval(
                        'gmd:lineage/gmd:LI_Lineage/gmd:source/gmd:LI_Source/gmd:description/gco'
                        ':CharacterString', namespaces)):
                val = util.testXMLValue(val)
                self.sources.append(val)

            self.process_steps_description = []
            self.process_steps_date = []
            self.process_steps_rationale = []

            for val in md.findall(
                    util.nspath_eval(
                        'gmd:lineage/gmd:LI_Lineage/gmd:processStep/gmd:LI_ProcessStep',
                        namespaces)):
                description = val.find(
                    util.nspath_eval('gmd:description/gco:CharacterString',
                                     namespaces))
                description = util.testXMLValue(description)
                self.process_steps_description.append(description)

                date = val.find(
                    util.nspath_eval('gmd:dateTime/gco:DateTime', namespaces))
                date = util.testXMLValue(date)
                self.process_steps_date.append(date)

                rationale = val.find(
                    util.nspath_eval('gmd:rationale/gco:CharacterString',
                                     namespaces))
                rationale = util.testXMLValue(rationale)
                self.process_steps_rationale.append(rationale)
コード例 #5
0
    def __init__(self, md=None, id=None, beginposition=None, endposition=None):
        if md is None:
            self.beginposition = beginposition
            self.endposition = endposition
            self.id = id
        else:
            val = md.find(
                util.nspath_eval(
                    'gmd:temporalElement/gmd:EX_TemporalExtent/gmd:extent/gml:TimePeriod',
                    namespaces))
            self.id = util.testXMLAttribute(val, 'id')

            val = md.find(
                util.nspath_eval(
                    'gmd:temporalElement/gmd:EX_TemporalExtent/gmd:extent/gml:TimePeriod/gml'
                    ':beginPosition', namespaces))
            self.beginposition = util.testXMLValue(val)

            val = md.find(
                util.nspath_eval(
                    'gmd:temporalElement/gmd:EX_TemporalExtent/gmd:extent/gml:TimePeriod/gml'
                    ':endPosition', namespaces))
            self.endposition = util.testXMLValue(val)
コード例 #6
0
    def __init__(self, md=None):
        if md is None:
            self.min = None
            self.max = None
            self.crs = None
        else:
            val = md.find(
                util.nspath_eval(
                    'gmd:EX_VerticalExtent/gmd:minimumValue/gco:Real',
                    namespaces))
            self.min = util.testXMLValue(val)

            val = md.find(
                util.nspath_eval(
                    'gmd:EX_VerticalExtent/gmd:maximumValue/gco:Real',
                    namespaces))
            self.max = util.testXMLValue(val)

            val = md.find(
                util.nspath_eval('gmd:EX_VerticalExtent/gmd:verticalCRS',
                                 namespaces))
            self.crs = util.testXMLAttribute(
                val, util.nspath_eval('xlink:href', namespaces))
コード例 #7
0
    def __init__(self, md=None, uuid=None, kid=None):
        if md is None:
            self.keywords = []
            self.type = None
            self.thesaurus = None
            self.cc_uuid = None
            self.cc_id = None
            self.kwdtype_codeList = 'http://standards.iso.org/ittf/PubliclyAvailableStandards' \
                                    '/ISO_19139_Schemas/resourcesFolder/codelist/gmxCodelists.xml' \
                                    '#MD_KeywordTypeCode'
        else:
            self.cc_uuid = uuid
            self.cc_id = kid
            self.keywords = []
            val = md.findall(
                util.nspath_eval('gmd:keyword/gco:CharacterString',
                                 namespaces))
            for word in val:
                self.keywords.append(util.testXMLValue(word))

            self.type = None
            val = md.find(
                util.nspath_eval('gmd:type/gmd:MD_KeywordTypeCode',
                                 namespaces))
            self.type = util.testXMLAttribute(val, 'codeListValue')

            self.thesaurus = None
            val = md.find(
                util.nspath_eval('gmd:thesaurusName/gmd:CI_Citation',
                                 namespaces))
            if val is not None:
                self.thesaurus = {}

                thesaurus = val.find(
                    util.nspath_eval('gmd:title/gco:CharacterString',
                                     namespaces))
                self.thesaurus['title'] = util.testXMLValue(thesaurus)

                thesaurus = val.find(
                    util.nspath_eval('gmd:date/gmd:CI_Date/gmd:date/gco:Date',
                                     namespaces))
                self.thesaurus['date'] = util.testXMLValue(thesaurus)

                thesaurus = val.find(
                    util.nspath_eval(
                        'gmd:date/gmd:CI_Date/gmd:dateType/gmd:CI_DateTypeCode',
                        namespaces))
                self.thesaurus['datetype'] = util.testXMLAttribute(
                    thesaurus, 'codeListValue')
コード例 #8
0
    def __init__(self, md=None, scope=None):
        super(MD_Metadata, self).__init__(md)
        self.scope = SCOPES.get_string_representation(scope)
        if md is None:
            self.identification = None
            self.serviceidentification = None
            self.referencesystem = []
            self.contact = []
        else:
            if hasattr(md, 'getroot'):
                root = md.getroot()
                global namespaces
                if hasattr(root, 'nsmap'):
                    namespaces.update(root.nsmap)
            val = md.find(
                util.nspath_eval(
                    'gmd:identificationInfo/gmd:MD_DataIdentification',
                    namespaces))
            if val is not None:
                self.identification = MD_DataIdentification(
                    val, self.hierarchy)
                self.serviceidentification = None
            else:
                val = md.find(
                    util.nspath_eval(
                        'gmd:identificationInfo/srv:SV_ServiceIdentification',
                        namespaces))
                if val is not None:
                    self.serviceidentification = SV_ServiceIdentification(
                        val, self.hierarchy)
                    self.identification = None
                else:
                    self.identification = None
                    self.serviceidentification = None
            if self.language is None:
                val = md.find(
                    util.nspath_eval('gmd:language/gmd:LanguageCode',
                                     namespaces))
                self.language = util.testXMLAttribute(val, 'codeListValue')

            val = md.find(
                util.nspath_eval('gmd:dataQualityInfo/gmd:DQ_DataQuality',
                                 namespaces))
            if val is not None:
                self.dataquality = DQ_DataQuality(val)
            else:
                self.dataquality = None
            self.referencesystem = []
            for val in md.findall(
                    util.nspath_eval(
                        'gmd:referenceSystemInfo/gmd:MD_ReferenceSystem',
                        namespaces)):
                referencesystem = iso.MD_ReferenceSystem(val)
                if referencesystem is not None:
                    self.referencesystem.append(referencesystem)

            val = md.find(
                util.nspath_eval('gmd:distributionInfo/gmd:MD_Distribution',
                                 namespaces))
            if val is not None:
                self.distribution = MD_Distribution(val)
            else:
                self.distribution = None
            self.contact = []
            for i in md.findall(
                    util.nspath_eval('gmd:contact/gmd:CI_ResponsibleParty',
                                     namespaces)):
                o = CI_ResponsibleParty(i)
                self.contact.append(o)
コード例 #9
0
    def __init__(self, md=None, identtype=None):
        super(SV_ServiceIdentification, self).__init__(md)
        self.uricode = []
        self.uricodespace = []
        if md is None:
            self.titleEN = None
            self.abstractEN = None
            self.alternatetitle = None
            self.extent = []
            self.credits = []
            self.uselimitation = []
            self.accessconstraints = []
            self.classification = []
            self.otherconstraints = []
            self.securityconstraints = []
            self.useconstraints = []
            self.graphicoverview = None
            self.temporalextent_start = []
            self.temporalextent_end = []
            self.temporalextent_id = []
            self.legalconstraints = []
            self.securityconstraints = []
            self.contact = []
            self.keywords = []
            self.status = []
            self.purpose = None
            self.date = []
            self.datetype = []
        else:

            self.couplingtype = iso._testCodeListValue(
                md.find(
                    util.nspath_eval('srv:couplingType/srv:SV_CouplingType',
                                     namespaces)))

            self.uselimitation = []
            for i in md.findall(
                    util.nspath_eval(
                        'gmd:resourceConstraints/gmd:MD_LegalConstraints/gmd:useLimitation/gco'
                        ':CharacterString', namespaces)):
                val = util.testXMLValue(i)
                if val is not None:
                    self.uselimitation.append(val)

            self.accessconstraints = []
            for val in md.findall(
                    util.nspath_eval(
                        'gmd:resourceConstraints/gmd:MD_LegalConstraints/gmd:accessConstraints'
                        '/gmd:MD_RestrictionCode', namespaces)):
                if val is not None:
                    uu = util.testXMLAttribute(val, 'codeListValue')
                    self.accessconstraints.append(uu)

            self.otherconstraints = []
            for i in md.findall(
                    util.nspath_eval(
                        'gmd:resourceConstraints/gmd:MD_LegalConstraints/gmd:otherConstraints/gco'
                        ':CharacterString', namespaces)):
                val = util.testXMLValue(i)
                if val is not None:

                    self.otherconstraints.append(val)

            self.useconstraints = []
            for val in md.findall(
                    util.nspath_eval(
                        'gmd:resourceConstraints/gmd:MD_LegalConstraints/gmd:useConstraints/gmd'
                        ':MD_RestrictionCode', namespaces)):
                if val is not None:
                    uu = util.testXMLAttribute(val, 'codeListValue')
                    self.useconstraints.append(uu)

            self.securityconstraints = []
            for val in md.findall(
                    util.nspath_eval(
                        'gmd:resourceConstraints/gmd:MD_SecurityConstraints/gmd:classification'
                        '/gmd:MD_ClassificationCode', namespaces)):
                if val is not None:
                    uu = util.testXMLAttribute(val, 'codeListValue')
                    self.securityconstraints.append(uu)
            self.date = []
            self.datetype = []

            for i in md.findall(
                    util.nspath_eval(
                        'gmd:citation/gmd:CI_Citation/gmd:date/gmd:CI_Date',
                        namespaces)):
                self.date.append(iso.CI_Date(i))

            val = md.find(
                util.nspath_eval('gmd:purpose/gco:CharacterString',
                                 namespaces))
            self.purpose = util.testXMLValue(val)

            self.status = []
            for val in md.findall(
                    util.nspath_eval('gmd:status/gmd:MD_ProgressCode',
                                     namespaces)):
                self.status.append(util.testXMLAttribute(val, 'codeListValue'))

            val = md.find(
                util.nspath_eval(
                    'gmd:citation/gmd:CI_Citation/gmd:title/gmd:PT_FreeText/gmd:textGroup/gmd'
                    ':LocalisedCharacterString', namespaces))
            self.titleEN = util.testXMLValue(val)

            val = md.find(
                util.nspath_eval(
                    'gmd:abstract/gmd:PT_FreeText/gmd:textGroup/gmd:LocalisedCharacterString',
                    namespaces))
            self.abstractEN = util.testXMLValue(val)

            val = md.find(
                util.nspath_eval(
                    'gmd:citation/gmd:CI_Citation/gmd:alternateTitle/gco:CharacterString',
                    namespaces))
            self.alternatetitle = util.testXMLValue(val)

            val = md.find(
                util.nspath_eval(
                    'gmd:graphicOverview/gmd:MD_BrowseGraphic/gmd:fileName/gco:CharacterString',
                    namespaces))
            self.graphicoverview = util.testXMLValue(val)

            self.credits = []
            for val in md.findall(
                    util.nspath_eval('gmd:credit/gco:CharacterString',
                                     namespaces)):
                self.credits.append(util.testXMLValue(val))

            self.resourcemaintenance = []
            for val in md.findall(
                    util.nspath_eval(
                        'gmd:resourceMaintenance/gmd:MD_MaintenanceInformation/gmd'
                        ':maintenanceAndUpdateFrequency/gmd:MD_MaintenanceFrequencyCode',
                        namespaces)):
                self.resourcemaintenance.append(
                    util.testXMLAttribute(val, 'codeListValue'))

            self.keywords = []
            for val in md.findall(
                    util.nspath_eval('gmd:descriptiveKeywords/gmd:MD_Keywords',
                                     namespaces)):
                uu = util.testXMLAttribute(val, 'uuid')
                kid = util.testXMLAttribute(val, 'id')
                self.keywords.append(MD_Keywords(val, uuid=uu, kid=kid))

            self.contact = []
            for i in md.findall(
                    util.nspath_eval(
                        'gmd:pointOfContact/gmd:CI_ResponsibleParty',
                        namespaces)):
                o = CI_ResponsibleParty(i)
                self.contact.append(o)

            # Find the MD_Identifiers in the MD_DataIdentification
            for val in md.findall(
                    util.nspath_eval(
                        'gmd:citation/gmd:CI_Citation/gmd:identifier/gmd:MD_Identifier/gmd:code'
                        '/gco:CharacterString', namespaces)):
                val = util.testXMLValue(val)
                if val is not None:
                    self.uricode.append(val)
                    self.uricodespace.append(None)

            codes = md.findall(
                util.nspath_eval(
                    'gmd:citation/gmd:CI_Citation/gmd:identifier/gmd:RS_Identifier/gmd:code/gco'
                    ':CharacterString', namespaces))
            codespaces = md.findall(
                util.nspath_eval(
                    'gmd:citation/gmd:CI_Citation/gmd:identifier/gmd:RS_Identifier/gmd:codeSpace'
                    '/gco:CharacterString', namespaces))
            if len(codes) == len(codespaces):
                for i in range(0, len(codes), 1):
                    val = util.testXMLValue(codes[i])
                    if val is not None and val.strip() != "":
                        self.uricode.append(val)
                        val = util.testXMLValue(codespaces[i])
                        if val is not None and val.strip() != "":
                            self.uricodespace.append(val)
                        else:
                            self.uricodespace.append(None)

            # Process the extents
            self.temporalextent_id = []
            self.temporalextent_end = []
            self.temporalextent_start = []
            self.extent = []
            extents = md.findall(util.nspath_eval('srv:extent', namespaces))
            for extent in extents:
                val = None
                for e in extent.findall(
                        util.nspath_eval('gmd:EX_Extent/gmd:geographicElement',
                                         namespaces)):
                    if e.find(
                            util.nspath_eval(
                                'gmd:EX_GeographicBoundingBox',
                                namespaces)) is not None or e.find(
                                    util.nspath_eval(
                                        'gmd:EX_GeographicDescription',
                                        namespaces)) is not None:
                        val = e
                        self.extent.append(EX_Extent(val))

                for e in extent.findall(
                        util.nspath_eval('gmd:EX_Extent/gmd:temporalElement',
                                         namespaces)):
                    valBP = e.find(
                        util.nspath_eval(
                            'gmd:EX_TemporalExtent/gmd:extent/gml:TimePeriod/gml:beginPosition',
                            namespaces))
                    if valBP is None:
                        namespaces['gml'] = namespaces['gml-old']
                        valBP = e.find(
                            util.nspath_eval(
                                'gmd:EX_TemporalExtent/gmd:extent/gml:TimePeriod/gml:beginPosition',
                                namespaces))
                    valEP = e.find(
                        util.nspath_eval(
                            'gmd:EX_TemporalExtent/gmd:extent/gml:TimePeriod/gml:endPosition',
                            namespaces))
                    valID = e.find(
                        util.nspath_eval(
                            'gmd:EX_TemporalExtent/gmd:extent/gml:TimePeriod',
                            namespaces))
                    self.extent.append(
                        EX_TemporalExtent(
                            id=None,
                            beginposition=util.testXMLValue(valBP),
                            endposition=util.testXMLValue(valEP)))

                for e in extent.findall(
                        util.nspath_eval('gmd:EX_Extent/gmd:verticalElement',
                                         namespaces)):
                    if e.find(
                            util.nspath_eval('gmd:EX_VerticalExtent',
                                             namespaces)) is not None:
                        self.extent.append(EX_VerticalExtent(e))