def get_PA(): pas = cf.find_all("POLITICALAFFILIATION") for x in pas: value = utilities.get_reg(x) orgName = get_org(x) if not value and orgName: for org in orgName: cf_list.append( CulturalForm(None, None, get_org_uri(org), other_attributes=utilities.NS_DICT["org"]. memberOf)) value = get_org_uri(org) elif orgName: for org in orgName: cf_list.append( CulturalForm(None, None, get_org_uri(org), other_attributes=utilities.NS_DICT["org"]. memberOf)) value = get_mapped_term("PoliticalAffiliation", utilities.get_value(x), id=person.id) else: value = get_mapped_term("PoliticalAffiliation", utilities.get_value(x), id=person.id) gender_issue = False if x.get("WOMAN-GENDERISSUE") == "GENDERYES": cf_list.append( CulturalForm("hasGenderedPoliticalActivity", get_reported(x), value)) gender_issue = True if x.get("ACTIVISM") == "ACTIVISTYES": cf_list.append( CulturalForm("hasActivistInvolvementIn", None, value)) elif x.get("MEMBERSHIP") == "MEMBERSHIPYES": cf_list.append( CulturalForm("hasPoliticalMembershipIn", None, value)) elif x.get("INVOLVEMENT") == "INVOLVEMENTYES": cf_list.append( CulturalForm("hasPoliticalInvolvementIn", None, value)) else: if not gender_issue: cf_list.append( CulturalForm("hasPoliticalAffiliation", get_reported(x), value))
def get_employer(self, tag): employer = tag.find("NAME") if employer: return utilities.get_name_uri(employer) employer = tag.find("ORGNAME") if employer: return get_org_uri(employer) return Literal(self.get_value(tag))
def get_denomination(): religions = cf.find_all("DENOMINATION") for x in religions: value = utilities.get_reg(x) orgName = get_org(x) if not value and orgName: for org in orgName: cf_list.append( CulturalForm(None, None, get_org_uri(org), other_attributes=utilities.NS_DICT["org"]. memberOf)) elif orgName: for org in orgName: cf_list.append( CulturalForm(None, None, get_org_uri(org), other_attributes=utilities.NS_DICT["org"]. memberOf)) value = get_mapped_term("Religion", utilities.get_value(x), True, id=person.id) # Checking if religion occurs as a PA if no result as a religion if type(value) is Literal: value = get_mapped_term("PoliticalAffiliation", utilities.get_value(x), True, id=person.id) # logger.warning("Mapping Religion to PA: " + value) if type(value) is Literal: value = get_mapped_term("Religion", utilities.get_value(x), id=person.id) religion = CulturalForm("hasReligion", get_reported(x), value) cf_list.append(religion)
def get_actors(tag): """ Returns actors within an event (any name/org/title mentioned)""" actors = [] for x in tag.find_all("NAME"): actors.append(utilities.make_standard_uri(x.get("STANDARD"))) for x in tag.find_all("ORGNAME"): actors.append(organizations.get_org_uri(x)) for x in tag.find_all("TITLE"): title = utilities.get_value(x) actors.append(utilities.make_standard_uri(title + " TITLE", ns="cwrc")) return actors
def identifying_motivation(tag): """ extracts the identifying components in a given tag to be used for the subjects of the annotation """ identified_subjects = [] identified_subjects += utilities.get_places(tag) identified_subjects += utilities.get_people(tag) identified_subjects += utilities.get_titles(tag) for x in tag.find_all("ORGNAME"): identified_subjects.append(organizations.get_org_uri(x)) return identified_subjects