Merge branch '62-new-iso-fields' into 63-extend-spatial-harvesters

This commit is contained in:
amercader 2014-03-12 17:53:01 +00:00
commit 3e1c338b7f
1 changed files with 218 additions and 60 deletions

View File

@ -158,49 +158,6 @@ class ISOElement(MappedXmlElement):
} }
class ISOResponsibleParty(ISOElement):
elements = [
ISOElement(
name="organisation-name",
search_paths=[
"gmd:organisationName/gco:CharacterString/text()",
],
multiplicity="0..1",
),
ISOElement(
name="position-name",
search_paths=[
"gmd:positionName/gco:CharacterString/text()",
],
multiplicity="0..1",
),
ISOElement(
name="contact-info",
search_paths=[
"gmd:contactInfo/gmd:CI_Contact",
],
multiplicity="0..1",
elements = [
ISOElement(
name="email",
search_paths=[
"gmd:address/gmd:CI_Address/gmd:electronicMailAddress/gco:CharacterString/text()",
],
multiplicity="0..1",
),
]
),
ISOElement(
name="role",
search_paths=[
"gmd:role/gmd:CI_RoleCode/@codeListValue",
],
multiplicity="0..1",
),
]
class ISOResourceLocator(ISOElement): class ISOResourceLocator(ISOElement):
elements = [ elements = [
@ -242,6 +199,57 @@ class ISOResourceLocator(ISOElement):
] ]
class ISOResponsibleParty(ISOElement):
elements = [
ISOElement(
name="organisation-name",
search_paths=[
"gmd:organisationName/gco:CharacterString/text()",
],
multiplicity="0..1",
),
ISOElement(
name="position-name",
search_paths=[
"gmd:positionName/gco:CharacterString/text()",
],
multiplicity="0..1",
),
ISOElement(
name="contact-info",
search_paths=[
"gmd:contactInfo/gmd:CI_Contact",
],
multiplicity="0..1",
elements = [
ISOElement(
name="email",
search_paths=[
"gmd:address/gmd:CI_Address/gmd:electronicMailAddress/gco:CharacterString/text()",
],
multiplicity="0..1",
),
ISOResourceLocator(
name="online-resource",
search_paths=[
"gmd:onlineResource/gmd:CI_OnlineResource",
],
multiplicity="0..1",
),
]
),
ISOElement(
name="role",
search_paths=[
"gmd:role/gmd:CI_RoleCode/@codeListValue",
],
multiplicity="0..1",
),
]
class ISODataFormat(ISOElement): class ISODataFormat(ISOElement):
elements = [ elements = [
@ -371,6 +379,86 @@ class ISOBrowseGraphic(ISOElement):
] ]
class ISOKeyword(ISOElement):
elements = [
ISOElement(
name="keyword",
search_paths=[
"gmd:keyword/gco:CharacterString/text()",
],
multiplicity="*",
),
ISOElement(
name="type",
search_paths=[
"gmd:type/gmd:MD_KeywordTypeCode/@codeListValue",
"gmd:type/gmd:MD_KeywordTypeCode/text()",
],
multiplicity="0..1",
),
# If Thesaurus information is needed at some point, this is the
# place to add it
]
class ISOUsage(ISOElement):
elements = [
ISOElement(
name="usage",
search_paths=[
"gmd:specificUsage/gco:CharacterString/text()",
],
multiplicity="1",
),
ISOResponsibleParty(
name="contact-info",
search_paths=[
"gmd:userContactInfo/gmd:CI_ResponsibleParty",
],
multiplicity="1",
),
]
class ISOAggregationInfo(ISOElement):
elements = [
ISOElement(
name="aggregate-dataset-name",
search_paths=[
"gmd:aggregateDatasetName/gmd:CI_Citation/gmd:title/gco:CharacterString/text()",
],
multiplicity="0..1",
),
ISOElement(
name="aggregate-dataset-identifier",
search_paths=[
"gmd:aggregateDatasetIdentifier/gmd:MD_Identifier/gmd:code/gco:CharacterString/text()",
],
multiplicity="0..1",
),
ISOElement(
name="association-type",
search_paths=[
"gmd:associationType/gmd:DS_AssociationTypeCode/@codeListValue",
"gmd:associationType/gmd:DS_AssociationTypeCode/text()",
],
multiplicity="0..1",
),
ISOElement(
name="initiative-type",
search_paths=[
"gmd:initiativeType/gmd:DS_InitiativeTypeCode/@codeListValue",
"gmd:initiativeType/gmd:DS_InitiativeTypeCode/text()",
],
multiplicity="0..1",
),
]
class ISODocument(MappedXmlDocument): class ISODocument(MappedXmlDocument):
# Attribute specifications from "XPaths for GEMINI" by Peter Parslow. # Attribute specifications from "XPaths for GEMINI" by Peter Parslow.
@ -389,6 +477,16 @@ class ISODocument(MappedXmlDocument):
], ],
multiplicity="0..1", multiplicity="0..1",
), ),
ISOElement(
name="metadata-standard-name",
search_paths="gmd:metadataStandardName/gco:CharacterString/text()",
multiplicity="0..1",
),
ISOElement(
name="metadata-standard-version",
search_paths="gmd:metadataStandardVersion/gco:CharacterString/text()",
multiplicity="0..1",
),
ISOElement( ISOElement(
name="resource-type", name="resource-type",
search_paths=[ search_paths=[
@ -444,15 +542,25 @@ class ISODocument(MappedXmlDocument):
], ],
multiplicity="1..*", multiplicity="1..*",
), ),
## Todo: Suggestion from PP not to bother pulling this into the package. ISOElement(
#ISOElement( name="unique-resource-identifier",
# name="unique-resource-identifier", search_paths=[
# search_paths=[ "gmd:identificationInfo/gmd:MD_DataIdentification/gmd:citation/gmd:CI_Citation/gmd:identifier/gmd:MD_Identifier/gmd:code/gco:CharacterString/text()",
# "gmd:identificationInfo/gmd:MD_DataIdentification/gmd:citation/gmd:CI_Citation/gmd:identifier/gmd:RS_Identifier", "gmd:identificationInfo/gmd:SV_ServiceIdentification/gmd:citation/gmd:CI_Citation/gmd:identifier/gmd:MD_Identifier/gmd:code/gco:CharacterString/text()",
# "gmd:identificationInfo/srv:SV_ServiceIdentification/gmd:citation/gmd:CI_Citation/gmd:identifier/gmd:RS_Identifier", ],
# ], multiplicity="0..1",
# multiplicity="1", ),
#), ISOElement(
name="presentation-form",
search_paths=[
"gmd:identificationInfo/gmd:MD_DataIdentification/gmd:citation/gmd:CI_Citation/gmd:presentationForm/gmd:CI_PresentationFormCode/text()",
"gmd:identificationInfo/gmd:MD_DataIdentification/gmd:citation/gmd:CI_Citation/gmd:presentationForm/gmd:CI_PresentationFormCode/@codeListValue",
"gmd:identificationInfo/srv:SV_ServiceIdentification/gmd:citation/gmd:CI_Citation/gmd:presentationForm/gmd:CI_PresentationFormCode/text()",
"gmd:identificationInfo/srv:SV_ServiceIdentification/gmd:citation/gmd:CI_Citation/gmd:presentationForm/gmd:CI_PresentationFormCode/@codeListValue",
],
multiplicity="*",
),
ISOElement( ISOElement(
name="abstract", name="abstract",
search_paths=[ search_paths=[
@ -461,6 +569,14 @@ class ISODocument(MappedXmlDocument):
], ],
multiplicity="1", multiplicity="1",
), ),
ISOElement(
name="purpose",
search_paths=[
"gmd:identificationInfo/gmd:MD_DataIdentification/gmd:purpose/gco:CharacterString/text()",
"gmd:identificationInfo/srv:SV_ServiceIdentification/gmd:purpose/gco:CharacterString/text()",
],
multiplicity="1",
),
ISOResponsibleParty( ISOResponsibleParty(
name="responsible-organisation", name="responsible-organisation",
search_paths=[ search_paths=[
@ -475,12 +591,19 @@ class ISODocument(MappedXmlDocument):
search_paths=[ search_paths=[
"gmd:identificationInfo/gmd:MD_DataIdentification/gmd:resourceMaintenance/gmd:MD_MaintenanceInformation/gmd:maintenanceAndUpdateFrequency/gmd:MD_MaintenanceFrequencyCode/@codeListValue", "gmd:identificationInfo/gmd:MD_DataIdentification/gmd:resourceMaintenance/gmd:MD_MaintenanceInformation/gmd:maintenanceAndUpdateFrequency/gmd:MD_MaintenanceFrequencyCode/@codeListValue",
"gmd:identificationInfo/srv:SV_ServiceIdentification/gmd:resourceMaintenance/gmd:MD_MaintenanceInformation/gmd:maintenanceAndUpdateFrequency/gmd:MD_MaintenanceFrequencyCode/@codeListValue", "gmd:identificationInfo/srv:SV_ServiceIdentification/gmd:resourceMaintenance/gmd:MD_MaintenanceInformation/gmd:maintenanceAndUpdateFrequency/gmd:MD_MaintenanceFrequencyCode/@codeListValue",
"gmd:identificationInfo/gmd:MD_DataIdentification/gmd:resourceMaintenance/gmd:MD_MaintenanceInformation/gmd:maintenanceAndUpdateFrequency/gmd:MD_MaintenanceFrequencyCode/text()", "gmd:identificationInfo/gmd:MD_DataIdentification/gmd:resourceMaintenance/gmd:MD_MaintenanceInformation/gmd:maintenanceAndUpdateFrequency/gmd:MD_MaintenanceFrequencyCode/text()",
"gmd:identificationInfo/srv:SV_ServiceIdentification/gmd:resourceMaintenance/gmd:MD_MaintenanceInformation/gmd:maintenanceAndUpdateFrequency/gmd:MD_MaintenanceFrequencyCode/text()", "gmd:identificationInfo/srv:SV_ServiceIdentification/gmd:resourceMaintenance/gmd:MD_MaintenanceInformation/gmd:maintenanceAndUpdateFrequency/gmd:MD_MaintenanceFrequencyCode/text()",
], ],
multiplicity="0..1", multiplicity="0..1",
), ),
ISOElement(
name="maintenance-note",
search_paths=[
"gmd:identificationInfo/gmd:MD_DataIdentification/gmd:resourceMaintenance/gmd:MD_MaintenanceInformation/gmd:maintenanceNote/gco:CharacterString/text()",
"gmd:identificationInfo/gmd:SV_ServiceIdentification/gmd:resourceMaintenance/gmd:MD_MaintenanceInformation/gmd:maintenanceNote/gco:CharacterString/text()",
],
multiplicity="0..1",
),
ISOElement( ISOElement(
name="progress", name="progress",
search_paths=[ search_paths=[
@ -491,6 +614,14 @@ class ISODocument(MappedXmlDocument):
], ],
multiplicity="*", multiplicity="*",
), ),
ISOKeyword(
name="keywords",
search_paths=[
"gmd:identificationInfo/gmd:MD_DataIdentification/gmd:descriptiveKeywords/gmd:MD_Keywords",
"gmd:identificationInfo/srv:SV_ServiceIdentification/gmd:descriptiveKeywords/gmd:MD_Keywords",
],
multiplicity="*"
),
ISOElement( ISOElement(
name="keyword-inspire-theme", name="keyword-inspire-theme",
search_paths=[ search_paths=[
@ -499,20 +630,21 @@ class ISODocument(MappedXmlDocument):
], ],
multiplicity="*", multiplicity="*",
), ),
# Deprecated: kept for backwards compatibilty
ISOElement( ISOElement(
name="keyword-controlled-other", name="keyword-controlled-other",
search_paths=[ search_paths=[
"gmd:identificationInfo/gmd:MD_DataIdentification/gmd:descriptiveKeywords/gmd:MD_Keywords/gmd:keyword/gco:CharacterString/text()",
"gmd:identificationInfo/srv:SV_ServiceIdentification/gmd:descriptiveKeywords/gmd:MD_Keywords/gmd:keyword/gco:CharacterString/text()",
"gmd:identificationInfo/srv:SV_ServiceIdentification/srv:keywords/gmd:MD_Keywords/gmd:keyword/gco:CharacterString/text()", "gmd:identificationInfo/srv:SV_ServiceIdentification/srv:keywords/gmd:MD_Keywords/gmd:keyword/gco:CharacterString/text()",
], ],
multiplicity="*", multiplicity="*",
), ),
ISOElement( ISOUsage(
name="keyword-free-text", name="usage",
search_paths=[ search_paths=[
"gmd:identificationInfo/gmd:MD_DataIdentification/gmd:resourceSpecificUsage/gmd:MD_Usage",
"gmd:identificationInfo/srv:SV_ServiceIdentification/gmd:resourceSpecificUsage/gmd:MD_Usage",
], ],
multiplicity="*", multiplicity="*"
), ),
ISOElement( ISOElement(
name="limitations-on-public-access", name="limitations-on-public-access",
@ -520,8 +652,19 @@ class ISODocument(MappedXmlDocument):
"gmd:identificationInfo/gmd:MD_DataIdentification/gmd:resourceConstraints/gmd:MD_LegalConstraints/gmd:otherConstraints/gco:CharacterString/text()", "gmd:identificationInfo/gmd:MD_DataIdentification/gmd:resourceConstraints/gmd:MD_LegalConstraints/gmd:otherConstraints/gco:CharacterString/text()",
"gmd:identificationInfo/srv:SV_ServiceIdentification/gmd:resourceConstraints/gmd:MD_LegalConstraints/gmd:otherConstraints/gco:CharacterString/text()", "gmd:identificationInfo/srv:SV_ServiceIdentification/gmd:resourceConstraints/gmd:MD_LegalConstraints/gmd:otherConstraints/gco:CharacterString/text()",
], ],
multiplicity="1..*", multiplicity="*",
), ),
ISOElement(
name="access-constraints",
search_paths=[
"gmd:identificationInfo/gmd:MD_DataIdentification/gmd:resourceConstraints/gmd:MD_LegalConstraints/gmd:accessConstraints/gmd:MD_RestrictionCode/@codeListValue",
"gmd:identificationInfo/srv:SV_ServiceIdentification/gmd:resourceConstraints/gmd:MD_LegalConstraints/gmd:accessConstraints/gmd:MD_RestrictionCode/@codeListValue",
"gmd:identificationInfo/gmd:MD_DataIdentification/gmd:resourceConstraints/gmd:MD_LegalConstraints/gmd:accessConstraints/gmd:MD_RestrictionCode/text()",
"gmd:identificationInfo/srv:SV_ServiceIdentification/gmd:resourceConstraints/gmd:MD_LegalConstraints/gmd:accessConstraints/gmd:MD_RestrictionCode/text()",
],
multiplicity="*",
),
ISOElement( ISOElement(
name="use-constraints", name="use-constraints",
search_paths=[ search_paths=[
@ -530,6 +673,14 @@ class ISODocument(MappedXmlDocument):
], ],
multiplicity="*", multiplicity="*",
), ),
ISOAggregationInfo(
name="aggregation-info",
search_paths=[
"gmd:identificationInfo/gmd:MD_DataIdentification/gmd:aggregationInfo/gmd:MD_AggregateInformation",
"gmd:identificationInfo/gmd:SV_ServiceIdentification/gmd:aggregationInfo/gmd:MD_AggregateInformation",
],
multiplicity="*"
),
ISOElement( ISOElement(
name="spatial-data-service-type", name="spatial-data-service-type",
search_paths=[ search_paths=[
@ -646,6 +797,13 @@ class ISODocument(MappedXmlDocument):
], ],
multiplicity="*", multiplicity="*",
), ),
ISOResponsibleParty(
name="distributor",
search_paths=[
"gmd:distributionInfo/gmd:MD_Distribution/gmd:distributor/gmd:MD_Distributor/gmd:distributorContact/gmd:CI_ResponsibleParty",
],
multiplicity="*",
),
ISOResourceLocator( ISOResourceLocator(
name="resource-locator", name="resource-locator",
search_paths=[ search_paths=[
@ -754,7 +912,7 @@ class ISODocument(MappedXmlDocument):
def infer_tags(self, values): def infer_tags(self, values):
tags = [] tags = []
for key in ['keyword-inspire-theme', 'keyword-controlled-other', 'keyword-free-text']: for key in ['keyword-inspire-theme', 'keyword-controlled-other']:
for item in values[key]: for item in values[key]:
if item not in tags: if item not in tags:
tags.append(item) tags.append(item)