@@ -407,16 +407,24 @@ def __init__(self, namespaces, md=None):
407407 self .onlineresource = None
408408 self .role = None
409409 else :
410- val = md .find (util .nspath_eval ('cit:party/cit:CI_Organisation/cit:individual/cit:CI_Individual/cit:name/gco:CharacterString' , self .namespaces ))
410+ # Individual name
411+ val = md .find (util .nspath_eval ('cit:party/cit:CI_Individual/cit:name/gco:CharacterString' , self .namespaces ))
411412 self .name = util .testXMLValue (val )
412413
414+ # Individual within organisation name
415+ if self .name is None :
416+ val = md .find (util .nspath_eval ('cit:party/cit:CI_Organisation/cit:individual/cit:CI_Individual/cit:name/gco:CharacterString' , self .namespaces ))
417+ self .name = util .testXMLValue (val )
418+
419+ # Organisation name
413420 val = md .find (util .nspath_eval ('cit:party/cit:CI_Organisation/cit:name/gco:CharacterString' , self .namespaces ))
414421 self .organization = util .testXMLValue (val )
415422
423+ # Individual within organisation position
416424 val = md .find (util .nspath_eval ('cit:party/cit:CI_Organisation/cit:individual/cit:CI_Individual/cit:positionName/gco:CharacterString' , self .namespaces ))
417425 self .position = util .testXMLValue (val )
418426
419- # Telephone
427+ # Organisation telephone
420428 val_list = md .xpath ('cit:party/cit:CI_Organisation/cit:contactInfo/cit:CI_Contact/cit:phone/cit:CI_Telephone[cit:numberType/cit:CI_TelephoneTypeCode/@codeListValue="voice"]/cit:number/gco:CharacterString' , namespaces = self .namespaces )
421429 if len (val_list ) > 0 :
422430 self .phone = util .testXMLValue (val_list [0 ])
@@ -426,6 +434,7 @@ def __init__(self, namespaces, md=None):
426434 if len (val_list ) > 0 :
427435 self .fax = util .testXMLValue (val_list [0 ])
428436
437+ # Organisation address
429438 val = md .find (util .nspath_eval (
430439 'cit:party/cit:CI_Organisation/cit:contactInfo/cit:CI_Contact/cit:address/cit:CI_Address/cit:deliveryPoint/gco:CharacterString' ,
431440 self .namespaces ))
@@ -450,11 +459,13 @@ def __init__(self, namespaces, md=None):
450459 self .namespaces ))
451460 self .country = util .testXMLValue (val )
452461
462+ # Organisation email
453463 val = md .find (util .nspath_eval (
454464 'cit:party/cit:CI_Organisation/cit:contactInfo/cit:CI_Contact/cit:address/cit:CI_Address/cit:electronicMailAddress/gco:CharacterString' ,
455465 self .namespaces ))
456466 self .email = util .testXMLValue (val )
457467
468+ # Organisation online resources
458469 val = md .find (util .nspath_eval (
459470 'cit:party/cit:CI_Organisation/cit:contactInfo/cit:CI_Contact/cit:onlineResource/cit:CI_OnlineResource' , self .namespaces ))
460471 if val is not None :
@@ -586,6 +597,7 @@ def __init__(self, namespaces, md=None, identtype=None):
586597 self .supplementalinformation = None
587598 self .spatialrepresentationtype = []
588599 else :
600+ # Title
589601 self .identtype = identtype
590602 val = md .find (util .nspath_eval (
591603 'mri:citation/cit:CI_Citation/cit:title/gco:CharacterString' , self .namespaces ))
@@ -595,6 +607,7 @@ def __init__(self, namespaces, md=None, identtype=None):
595607 'mri:citation/cit:CI_Citation/cit:alternateTitle/gco:CharacterString' , self .namespaces ))
596608 self .alternatetitle = util .testXMLValue (val )
597609
610+ # Identifier
598611 self .uricode = []
599612 for end_tag in ['gco:CharacterString' , 'gcx:Anchor' ]:
600613 _values = md .findall (util .nspath_eval (
@@ -613,12 +626,14 @@ def __init__(self, namespaces, md=None, identtype=None):
613626 if val is not None :
614627 self .uricodespace .append (val )
615628
629+ # Date
616630 self .date = []
617631 self .datetype = []
618632
619633 for i in md .findall (util .nspath_eval ('mri:citation/cit:CI_Citation/cit:date/cit:CI_Date' , self .namespaces )):
620634 self .date .append (CI_Date (self .namespaces , i ))
621635
636+ # Use Limitation
622637 self .uselimitation = []
623638 self .uselimitation_url = []
624639 uselimit_values = md .findall (util .nspath_eval (
@@ -628,6 +643,7 @@ def __init__(self, namespaces, md=None, identtype=None):
628643 if val is not None :
629644 self .uselimitation .append (val )
630645
646+ # Access constraints
631647 self .accessconstraints = []
632648 for i in md .findall (util .nspath_eval (
633649 'mri:resourceConstraints/mco:MD_LegalConstraints/mco:accessConstraints/mco:MD_RestrictionCode' ,
@@ -636,8 +652,10 @@ def __init__(self, namespaces, md=None, identtype=None):
636652 if val is not None :
637653 self .accessconstraints .append (val )
638654
655+ # Classification
639656 self .classification = [] # Left empty - no legal classification equivalent
640657
658+ # Other constraints
641659 self .otherconstraints = []
642660 for end_tag in ['gco:CharacterString' , 'gcx:Anchor' ]:
643661 for i in md .findall (util .nspath_eval (
@@ -647,6 +665,7 @@ def __init__(self, namespaces, md=None, identtype=None):
647665 if val is not None :
648666 self .otherconstraints .append (val )
649667
668+ # Security constraints
650669 self .securityconstraints = []
651670 for i in md .findall (util .nspath_eval (
652671 'mri:resourceConstraints/mco:MD_SecurityConstraints/mco:classification/mco:MD_ClassificationCode' ,
@@ -655,6 +674,7 @@ def __init__(self, namespaces, md=None, identtype=None):
655674 if val is not None :
656675 self .securityconstraints .append (val )
657676
677+ # Use constraints
658678 self .useconstraints = []
659679 for i in md .findall (util .nspath_eval (
660680 'mri:resourceConstraints/mco:MD_LegalConstraints/mco:useConstraints/mco:MD_RestrictionCode' ,
@@ -663,6 +683,7 @@ def __init__(self, namespaces, md=None, identtype=None):
663683 if val is not None :
664684 self .useconstraints .append (val )
665685
686+ # Spatial resolution denominators
666687 self .denominators = []
667688 for i in md .findall (util .nspath_eval (
668689 'mri:spatialResolution/mri:MD_Resolution/mri:equivalentScale/mri:MD_RepresentativeFraction/mri:denominator/gco:Integer' ,
@@ -671,6 +692,7 @@ def __init__(self, namespaces, md=None, identtype=None):
671692 if val is not None :
672693 self .denominators .append (val )
673694
695+ # Spatial resolution distance and units of measure
674696 self .distance = []
675697 self .uom = []
676698 for i in md .findall (util .nspath_eval (
@@ -680,12 +702,14 @@ def __init__(self, namespaces, md=None, identtype=None):
680702 self .distance .append (val )
681703 self .uom .append (i .get ("uom" ))
682704
705+ # Language code
683706 self .resourcelanguagecode = []
684707 for i in md .findall (util .nspath_eval ('mri:defaultLocale/lan:PT_Locale/lan:language/lan:LanguageCode' , self .namespaces )):
685708 val = _testCodeListValue (i )
686709 if val is not None :
687710 self .resourcelanguagecode .append (val )
688711
712+ # Language
689713 self .resourcelanguage = []
690714 for i in md .findall (util .nspath_eval ('mri:defaultLocale/lan:PT_Locale/lan:language/gco:CharacterString' , self .namespaces )):
691715 val = util .testXMLValue (i )
@@ -696,23 +720,46 @@ def __init__(self, namespaces, md=None, identtype=None):
696720 self .publisher = []
697721 self .contributor = []
698722 self .funder = []
723+ # Extract roles from point of contact for resource
699724 for val in md .findall (util .nspath_eval ('mri:pointOfContact/cit:CI_Responsibility' , self .namespaces )):
700725 role = val .find (util .nspath_eval ('cit:role/cit:CI_RoleCode' , self .namespaces ))
701726 if role is not None :
702727 clv = _testCodeListValue (role )
703728 rp = CI_Responsibility (self .namespaces , val )
704- if clv == 'originator' :
729+ # Creator
730+ if clv in ['originator' , 'principalInvestigator' , 'author' ]:
705731 self .creator .append (rp )
732+ # Publisher
706733 elif clv == 'publisher' :
707734 self .publisher .append (rp )
708- elif clv == 'author' :
735+ # Contributor
736+ elif clv in ['collaborator' , 'coAuthor' , 'contributor' , 'editor' ]:
709737 self .contributor .append (rp )
710- elif clv == 'funder' :
711- self .funder .append (rp )
712738
739+ # Edition
713740 val = md .find (util .nspath_eval ('cit:CI_Citation/cit:edition/gco:CharacterString' , self .namespaces ))
714741 self .edition = util .testXMLValue (val )
715742
743+ # Extract roles from responsible party for resource
744+ for val in md .findall (util .nspath_eval ('mri:citation/cit:CI_Citation/cit:citedResponsibleParty/cit:CI_Responsibility' , self .namespaces )):
745+ role = val .find (util .nspath_eval ('cit:role/cit:CI_RoleCode' , self .namespaces ))
746+ if role is not None :
747+ clv = _testCodeListValue (role )
748+ rp = CI_Responsibility (self .namespaces , val )
749+ # Creator
750+ if clv in ['originator' , 'principalInvestigator' , 'author' ]:
751+ self .creator .append (rp )
752+ # Publisher
753+ elif clv == 'publisher' :
754+ self .publisher .append (rp )
755+ # Contributor
756+ elif clv in ['collaborator' , 'coAuthor' , 'contributor' , 'processor' , 'editor' ]:
757+ self .contributor .append (rp )
758+ # Funder
759+ elif clv == 'funder' :
760+ self .funder .append (rp )
761+
762+ # Abstract
716763 val = md .find (util .nspath_eval ('mri:abstract/gco:CharacterString' , self .namespaces ))
717764 self .abstract = util .testXMLValue (val )
718765
@@ -723,11 +770,14 @@ def __init__(self, namespaces, md=None, identtype=None):
723770 self .abstract = util .testXMLValue (val )
724771 self .abstract_url = val .attrib .get (util .nspath_eval ('xlink:href' , self .namespaces ))
725772
773+ # Purpose
726774 val = md .find (util .nspath_eval ('mri:purpose/gco:CharacterString' , self .namespaces ))
727775 self .purpose = util .testXMLValue (val )
728776
777+ # Status
729778 self .status = _testCodeListValue (md .find (util .nspath_eval ('mri:status/mri:MD_ProgressCode' , self .namespaces )))
730779
780+ # Graphic overview
731781 self .graphicoverview = []
732782 for val in md .findall (util .nspath_eval (
733783 'mri:graphicOverview/mcc:MD_BrowseGraphic/mcc:fileName/gco:CharacterString' , self .namespaces )):
@@ -736,28 +786,33 @@ def __init__(self, namespaces, md=None, identtype=None):
736786 if val2 is not None :
737787 self .graphicoverview .append (val2 )
738788
789+ # Point of Contact
739790 self .contact = []
740791 for i in md .findall (util .nspath_eval ('mri:pointOfContact/cit:CI_Responsibility' , self .namespaces )):
741792 o = CI_Responsibility (self .namespaces , i )
742793 self .contact .append (o )
743794
795+ # Spatial repreentation type
744796 self .spatialrepresentationtype = []
745797 for val in md .findall (util .nspath_eval (
746798 'mri:spatialRepresentationType/mcc:MD_SpatialRepresentationTypeCode' , self .namespaces )):
747799 val = util .testXMLAttribute (val , 'codeListValue' )
748800 if val :
749801 self .spatialrepresentationtype .append (val )
750802
803+ # Keywords
751804 self .keywords = []
752805 for mdkw in md .findall (util .nspath_eval ('mri:descriptiveKeywords/mri:MD_Keywords' , self .namespaces )):
753806 self .keywords .append (MD_Keywords (self .namespaces , mdkw ))
754807
808+ # Topic category
755809 self .topiccategory = []
756810 for i in md .findall (util .nspath_eval ('mri:topicCategory/mri:MD_TopicCategoryCode' , self .namespaces )):
757811 val = util .testXMLValue (i )
758812 if val is not None :
759813 self .topiccategory .append (val )
760814
815+ # Supplamental information
761816 val = md .find (util .nspath_eval ('mri:supplementalInformation/gco:CharacterString' , self .namespaces ))
762817 self .supplementalinformation = util .testXMLValue (val )
763818
0 commit comments