pyirk._builtin.statement_utils
Statement-/relation-utility functions extracted from
:mod:pyirk.builtin_entities.
Like the sibling modules :mod:pyirk._builtin.taxonomy,
:mod:pyirk._builtin.scopes, :mod:pyirk._builtin.math_expressions and
:mod:pyirk._builtin.operators, this module only binds the (partially loaded)
builtin_entities module object as _be. All accesses to its
module-globals (items like I40, I41, relations like R20, R57,
R62 and already migrated helpers like instance_of) happen
module-qualified and exclusively at call time inside the function bodies —
never at import time. core/Entity/Relation/Item/Statement/
ds/RuleResult are imported directly from :mod:pyirk.core.
Module Contents
Functions
For every element of subjects, create a statement with predicate and object |
|
return a sorted list of URIs, corresponding to the relation properties corresponding to |
|
Condition function for rules. Returns True if label of item 1 is alphabetically smaller then that of item2 |
|
Condition function for rules. Returns True if item does not have any statement where rel is the predicate |
|
replace old_item with new_item in every statement, unlink the old item |
|
For every statement like (i1, rel1, i2) create a new statement with rel2 as predicate. |
|
For every statement like (i1, rel1, i2) create a new statement (i2, rel, i1) (if it does not yet exist). |
|
Create a new instance of obj_type and then use this as the object in a new statement. |
|
Data
API
- pyirk._builtin.statement_utils.__all__
[‘set_multiple_statements’, ‘get_relation_properties_uris’, ‘get_relation_properties’, ‘label_compar…
- pyirk._builtin.statement_utils.set_multiple_statements(subjects: Union[list, tuple], predicate: pyirk.core.Relation, object: Any, qualifiers=None)
For every element of subjects, create a statement with predicate and object
- pyirk._builtin.statement_utils.get_relation_properties_uris()
- pyirk._builtin.statement_utils.get_relation_properties(rel_entity: pyirk.core.Entity) List[str]
return a sorted list of URIs, corresponding to the relation properties corresponding to
rel_entity.
- pyirk._builtin.statement_utils.label_compare_method(self, item1, item2) bool
Condition function for rules. Returns True if label of item 1 is alphabetically smaller then that of item2
- pyirk._builtin.statement_utils.does_not_have_relation(self, item: pyirk.core.Item, rel: pyirk.core.Relation) bool
Condition function for rules. Returns True if item does not have any statement where rel is the predicate
- pyirk._builtin.statement_utils.replacer_method(self, old_item, new_item)
replace old_item with new_item in every statement, unlink the old item
- pyirk._builtin.statement_utils.copy_statements(self, rel1: pyirk.core.Relation, rel2: pyirk.core.Relation)
For every statement like (i1, rel1, i2) create a new statement with rel2 as predicate.
- pyirk._builtin.statement_utils.reverse_statements(self, rel: pyirk.core.Relation)
For every statement like (i1, rel1, i2) create a new statement (i2, rel, i1) (if it does not yet exist).
- pyirk._builtin.statement_utils.new_instance_as_object(self, subj, pred, obj_type, placeholder=False, name_prefix=None)
Create a new instance of obj_type and then use this as the object in a new statement.
- pyirk._builtin.statement_utils.raise_contradiction(self, msg_template, *args)
- pyirk._builtin.statement_utils.raise_reasoning_goal_reached(self, msg_template, *args)