mex.extractors.wikidata package¶
Submodules¶
mex.extractors.wikidata.extract module¶
- mex.extractors.wikidata.extract.get_merged_organization_id_by_query_with_transform_and_load(wikidata_organizations_by_query: dict[str, WikidataOrganization], wikidata_primary_source: ExtractedPrimarySource) dict[str, MergedOrganizationIdentifier] ¶
Return a mapping from organizations to their stable target ID.
WikidataOrganizations are transformed into ExtractedOrganizations and loaded into the configured sink.
- Parameters:
wikidata_organizations_by_query – dict of Extracted organizations by query string
wikidata_primary_source – Primary source item for wikidata
- Returns:
Dict with organization label keys and stable target ID values
mex.extractors.wikidata.helpers module¶
- mex.extractors.wikidata.helpers.get_wikidata_extracted_organization_id_by_name(name: str) MergedOrganizationIdentifier | None ¶
Use helper function to look up an organization and return its stableTargetId.
An organization searched by its name on Wikidata and loaded into the configured sink. Also it’s stable target id is returned.
- Returns:
ExtractedOrganization stableTargetId if one matching organization is found. None if multiple matches / no match is found
mex.extractors.wikidata.transform module¶
- mex.extractors.wikidata.transform.transform_wikidata_organizations_to_extracted_organizations_with_query(wikidata_organizations_by_query: dict[str, WikidataOrganization], extracted_primary_source_wikidata: ExtractedPrimarySource) dict[str, ExtractedOrganization] ¶
Return a mapping from the search query to the Extracted Organizations.
- Parameters:
wikidata_organizations_by_query – dictionary with string keys and WikidataOrganization values
extracted_primary_source_wikidata – ExtractedPrimarySource for Wikidata
- Returns:
search query and values: Extracted Organization.
- Return type:
Dict with keys