wikibaseintegrator.wbi_fastrun
- class wikibaseintegrator.wbi_fastrun.FastRunContainer(base_data_type, mediawiki_api_url=None, sparql_endpoint_url=None, wikibase_url=None, base_filter=None, use_refs=False, case_insensitive=False)[source]
Bases:
object
- Parameters:
base_data_type (type[BaseDataType])
mediawiki_api_url (str | None)
sparql_endpoint_url (str | None)
wikibase_url (str | None)
base_filter (list[BaseDataType | list[BaseDataType]] | None)
use_refs (bool)
case_insensitive (bool)
- __init__(base_data_type, mediawiki_api_url=None, sparql_endpoint_url=None, wikibase_url=None, base_filter=None, use_refs=False, case_insensitive=False)[source]
- Parameters:
base_data_type (type[BaseDataType])
mediawiki_api_url (str | None)
sparql_endpoint_url (str | None)
wikibase_url (str | None)
base_filter (list[BaseDataType | list[BaseDataType]] | None)
use_refs (bool)
case_insensitive (bool)
- check_language_data(qid, lang_data, lang, lang_data_type, action_if_exists=ActionIfExists.APPEND_OR_REPLACE)[source]
Method to check if certain language data exists as a label, description or aliases :type qid:
str
:param qid: Wikibase item id :type lang_data:list
:param lang_data: list of string values to check :type lang:str
:param lang: language code :type lang_data_type:str
:param lang_data_type: What kind of data is it? ‘label’, ‘description’ or ‘aliases’? :type action_if_exists:ActionIfExists
:param action_if_exists: If aliases already exist, APPEND_OR_REPLACE or REPLACE_ALL :rtype:bool
:return: boolean- Parameters:
qid (str)
lang_data (list)
lang (str)
lang_data_type (str)
action_if_exists (ActionIfExists)
- Return type:
bool
- format_query_results(r, prop_nr)[source]
r is the results of the sparql query in _query_data and is modified in place prop_nr is needed to get the property datatype to determine how to format the value
- Return type:
None
- Parameters:
r (list)
prop_nr (str)
- r is a list of dicts. The keys are:
sid: statement ID item: the subject. the item this statement is on v: the object. The value for this statement unit: property unit pq: qualifier property qval: qualifier value qunit: qualifier unit ref: reference ID pr: reference property rval: reference value
- get_language_data(qid, lang, lang_data_type)[source]
get language data for specified qid
- Parameters:
qid (
str
) – Wikibase item idlang (
str
) – language codelang_data_type (
str
) – ‘label’, ‘description’ or ‘aliases’
- Return type:
list
[str
]- Returns:
list of strings
- If nothing is found:
If lang_data_type == label: returns [‘’] If lang_data_type == description: returns [‘’] If lang_data_type == aliases: returns []
- init_language_data(lang, lang_data_type)[source]
Initialize language data store
- Parameters:
lang (
str
) – language codelang_data_type (
str
) – ‘label’, ‘description’ or ‘aliases’
- Return type:
None
- Returns:
None
- reconstruct_statements(qid)[source]
- Return type:
list
[BaseDataType
]- Parameters:
qid (str)
- write_required(data, action_if_exists=ActionIfExists.REPLACE_ALL, cqid=None)[source]
Check if a write is required
- Parameters:
data (
list
[Claim
])action_if_exists (
ActionIfExists
)cqid (
str
|None
)
- Return type:
bool
- Returns:
Return True if the write is required
- wikibaseintegrator.wbi_fastrun.get_fastrun_container(base_filter=None, use_refs=False, case_insensitive=False)[source]
- Return type:
- Parameters:
base_filter (list[BaseDataType | list[BaseDataType]] | None)
use_refs (bool)
case_insensitive (bool)