Example #1
0
def get_rml_turnovers(rml):
    """ turnover -> turnovers """
    result = {}
    rml_turnovers = rml.findall(xmletree.prefixtag("rml", "turnover"))
    if rml_turnovers is not None:
        turnovers = []
        for rml_turnover in rml_turnovers:
            if rml_turnover is not None:
                turnover = {}

                turnover.update(xmletree.get_element_attribute_and_set_key(rml_turnover, "currency", "currency"))
                turnover.update(xmletree.get_element_attribute_and_set_key(rml_turnover, "year", "year"))
                turnover["value"] = xmletree.get_element_text(rml_turnover)

                if turnover:
                    turnovers.append(turnover)
        if turnovers:
            result["turnovers"] = turnovers
    return result
Example #2
0
def get_rml_money_and_set_key(rml, element, key):
    """ element -> key """
    result = {}
    rml_element = rml.find(xmletree.prefixtag("rml", element))
    if rml_element is not None:
        money = {}

        # currency -> currency
        money.update(xmletree.get_element_attribute_and_set_key(rml_element, "currency", "currency"))

        # text -> value
        money["value"] = xmletree.get_element_text(rml_element)

        if money:
            result[key] = money
    return result
Example #3
0
def rml_orgunit_to_metajson(rml_orgunit, source, rec_id_prefix):
    """ orgUnit -> orgunit """
    orgunit = Orgunit()

    # source
    if source:
        orgunit["rec_source"] = source

    # acronym -> acronym
    orgunit.update(get_rml_element_text_and_set_key(rml_orgunit, "acronym", "acronym"))

    # address -> addresses
    orgunit.update(get_rml_addresses(rml_orgunit))

    # affiliation -> affiliations
    orgunit.update(get_rml_affiliations(rml_orgunit))

    # award -> awards
    orgunit.update(get_rml_textlangs_and_set_key(rml_orgunit, "award", "awards"))

    # ckbData -> self_archiving_policy
    orgunit.update(get_rml_self_archiving_policy(rml_orgunit))

    # dateOfDissolution -> date_dissolution
    orgunit.update(get_rml_element_text_and_set_key(rml_orgunit, "dateOfDissolution", "date_dissolution"))

    # dateOfFoundation -> date_foundation
    orgunit.update(get_rml_element_text_and_set_key(rml_orgunit, "dateOfFoundation", "date_foundation"))

    # description -> descriptions
    orgunit.update(get_rml_textlangs_and_set_key(rml_orgunit, "description", "descriptions"))

    # email -> emails
    orgunit.update(get_rml_emails(rml_orgunit))

    # headcount -> headcounts
    orgunit.update(get_rml_headcounts(rml_orgunit))

    # identifier -> identifiers
    orgunit.update(get_rml_identifiers(rml_orgunit))

    # image -> resources[0]
    orgunit.update(get_rml_images(rml_orgunit, "logo"))

    # name -> name
    orgunit.update(get_rml_element_text_and_set_key(rml_orgunit, "name", "name"))

    # nameAlternative -> name_alternatives
    orgunit.update(get_rml_textlangs_and_set_key(rml_orgunit, "nameAlternative", "name_alternatives"))

    # nationality -> nationality
    orgunit.update(get_rml_element_text_and_set_key(rml_orgunit, "nationality", "nationality"))

    # note -> notes
    orgunit.update(get_rml_textlangs_and_set_key(rml_orgunit, "note", "notes"))

    # olDescription -> descriptions_short
    orgunit.update(get_rml_textlangs_and_set_key(rml_orgunit, "olDescription", "descriptions_short"))

    # ongoingResearch -> ongoing_researches
    orgunit.update(get_rml_ongoing_researches(rml_orgunit))

    # phone -> phones
    orgunit.update(get_rml_phones(rml_orgunit))

    # researchCoverage -> research_coverages
    orgunit.update(get_rml_research_coverages(rml_orgunit))

    # skill -> skills
    orgunit.update(get_rml_textlangs_and_set_key(rml_orgunit, "skill", "skills"))

    # turnover -> turnovers
    orgunit.update(get_rml_turnovers(rml_orgunit))

    # @type -> rec_type
    orgunit.update(xmletree.get_element_attribute_and_set_key(rml_orgunit, "type", "rec_type"))

    # uri -> urls
    orgunit.update(get_rml_uris(rml_orgunit))

    return orgunit