def _create_statement(self, entity: wdi_core.WDItemEngine, predicate: TripleElement, objct: TripleElement) -> wdi_core.WDItemEngine: statement = objct.to_wdi_datatype(prop_nr=predicate.id) data = [statement] entity.update(data=data, append_value=[predicate.id]) return entity
def _remove_statement(self, entity: wdi_core.WDItemEngine, predicate: TripleElement, _) -> wdi_core.WDItemEngine: statement_to_remove = wdi_core.WDBaseDataType.delete_statement( predicate.id) data = [statement_to_remove] entity.update(data=data) return entity
def _add_related_link_to_entity(self, entity: wdi_core.WDItemEngine, uri: str): """ adds related link which is the original URI to the entity :param entity: wikibase item :param uri: item's URI :return: update the item with the related link prop """ rel_link = wdi_core.WDUrl(value=uri, prop_nr=self._related_link_prop) entity.update([rel_link], append_value=[self._related_link_prop])
def _add_mappings_to_entity(self, entity: wdi_core.WDItemEngine, uri: str): same_as = wdi_core.WDUrl(value=uri, prop_nr=self._mappings_prop) entity.update([same_as], append_value=[self._mappings_prop])