pyirk.builtin_entities
Module Contents
Classes
Context manager to for creating (“atomic”) statements in the scope of other (bigger statements). E.g. establishing a relationship between two items as part of the assertions of a theorem-item |
|
Context manager containing methods which are math-related |
|
A scoping context manager to handle conditions |
|
A scoping context manager for universally or existentially quantified statements. |
|
Context manager tailored for mathematical theorems and definitions |
|
Context Manager for logical subscopes (like OR and AND) in premises |
|
Context manager to model conditional statements. |
Functions
Check if |
|
Recursively iterate over super and parent classes and |
|
Return True if itm1 is an (indirect) subclass (via) R3__is_subclass_of itm2 |
|
Returns True if instance_itm.R4 is cls_itm or an (indirect) subclass (R3) of cls_itm. |
|
Create an instance (R4) of an item. Try to obtain the label by inspection of the calling context (if r1 is None). |
|
Create a namespace-object (dict) and a Scope-Item :param name: the name of the scope :return: |
|
Add relations defined by 3-tuples (sub, rel, obj) to the respective scope. |
|
Return a list of all scope-items which are associated with this entity like [scope:setting, scope:premise, scope:assertion] for a proposition-item. |
|
:param ent: :param scope: :return: None |
|
This function will be used as a method for proposition-Items. It will return a __proposition__CM instance. (see above). For details see examples |
|
This function will be used as a method for semantic-rule-Items. It will return a __rule__CM instance. (see above). For details see examples and tests. |
|
Convenience method for items which usually have scopes: allow easy access to subscopes |
|
Convenience method for scope items to allow easy access to the statements made in that scope |
|
Convenience method for scope items to allow easy access to the items created in that scope |
|
This function returns a string which can be used as a replacement for the label :param self: |
|
Convenience function to simplify the access to the entities which are in itm.R36__has_argument_tuple. |
|
:param mapping: :param arg: :return: |
|
common special case of mathematical relation, also ensures backwards compatibility |
|
Create a new tuple entity :param args: :return: |
|
Shortcut to create an instance and set the relation R44[“is universally quantified”] to True in one step to allow compact notation. |
|
Return all direct and indirect instances of a class |
|
Recursively compile a list of all subclasses. |
|
Set R51__instances_are_from for all current instances of a class. |
|
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 |
|
This is just a convenience alias for .R39__has_element |
|
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_entities.__URI__
None
- pyirk.builtin_entities.keymanager
‘KeyManager(…)’
- pyirk.builtin_entities.allows_instantiation(itm: pyirk.core.Item) bool
Check if
itmis an instance of metaclass or a subclass of it. If true, this entity is considered a class by itself and is thus allowed to have instances and subclassesPossibilities:
I2 = itm -> True (by our definition) I2 -R4-> itm -> True (trivial, itm is an ordinary class) I2 -R4-> I100 -R4-> itm -> False (I100 is ordinary class → itm is ordinary instance) I2 -R3-> itm -> True (subclasses of I2 are also metaclasses) I2 -R3-> I100 -R4-> itm -> True (I100 is subclass of metaclass → itm is metaclass instance) I2 -R3-> I100 -R3-> I101 -R3-> I102 -R4-> itm -> True (same) # multiple times R4: false I2 -R4-> I100 -R3-> I101 -R3-> I102 -R4-> itm -> False (I100 is ordinary class → itm is ordinary instance of its sub-sub-class) I2 -R3-> I100 -R4-> I101 -R3-> I102 -R4-> itm -> False (same) I2 -R3-> I100 -R3-> I101 -R3-> I102 -R4-> itm -> True (same) I2 -R4-> I100 -R3-> I101 -R3-> I102 -R3-> itm -> True (itm is an ordinary sub-sub-sub-subclass) I2 -R3-> I100 -R4-> I101 -R3-> I102 -R3-> itm -> True (itm is an sub-sub-subclass of I101 which is an instance of a subclass of I2):param itm: item to test :return: bool
- pyirk.builtin_entities.get_taxonomy_tree(itm, add_self=True) list
Recursively iterate over super and parent classes and
:param itm: an item :raises NotImplementedError: DESCRIPTION
:return: list of 2-tuples like [(None, I456), (“R3”, I123), (“R4”, I2)] :rtype: dict
- pyirk.builtin_entities.is_subclass_of(itm1: pyirk.core.Item, itm2: pyirk.core.Item, allow_id=False, strict=True) bool
Return True if itm1 is an (indirect) subclass (via) R3__is_subclass_of itm2
:param allow_id: bool, indicate that itm1 == itm2 is also considered as valid. default: False
- pyirk.builtin_entities.is_instance_of(inst_itm: pyirk.core.Item, cls_itm: pyirk.core.Item, allow_R30_secondary: bool = False, strict=True) bool
Returns True if instance_itm.R4 is cls_itm or an (indirect) subclass (R3) of cls_itm.
:param inst_itm: Item representing the instance :param cls_itm: Item representing the class :param allow_R30_secondary: bool, accept also relations via R30__is_secondary_instance_of :param strict: bool; if true we raise an exception if there is no parent class
- pyirk.builtin_entities.instance_of(cls_entity, r1: str = None, r2: str = None, qualifiers: List[pyirk.core.Item] = None, force_key: str = None) pyirk.core.Item
Create an instance (R4) of an item. Try to obtain the label by inspection of the calling context (if r1 is None).
:param cls_entity: the type of which an instance is created :param r1: the label; if None use inspection to fetch it from the left hand side of the assignment :param r2: the description (optional) :param qualifiers: list of RawQualifiers (optional); will be passed to the R4__is_instance_of relation
if
cls_entityhas a defining scope andqualifiersis None, then an appropriate R20__has_defining_scope- qualifier will be added to the R4__is_instance_of-relation of the new item.:return: new item
- pyirk.builtin_entities.R32
‘create_builtin_relation(…)’
- pyirk.builtin_entities.R1
‘create_builtin_relation(…)’
- pyirk.builtin_entities.R2
‘create_builtin_relation(…)’
- pyirk.builtin_entities.R22
‘create_builtin_relation(…)’
- pyirk.builtin_entities.R3
‘create_builtin_relation(…)’
- pyirk.builtin_entities.R4
‘create_builtin_relation(…)’
- pyirk.builtin_entities.R5
‘create_builtin_relation(…)’
- pyirk.builtin_entities.R6
‘create_builtin_relation(…)’
- pyirk.builtin_entities.R7
‘create_builtin_relation(…)’
- pyirk.builtin_entities.R8
‘create_builtin_relation(…)’
- pyirk.builtin_entities.R9
‘create_builtin_relation(…)’
- pyirk.builtin_entities.R10
‘create_builtin_relation(…)’
- pyirk.builtin_entities.R11
‘create_builtin_relation(…)’
- pyirk.builtin_entities.R12
‘create_builtin_relation(…)’
- pyirk.builtin_entities.R13
‘create_builtin_relation(…)’
- pyirk.builtin_entities.R14
‘create_builtin_relation(…)’
- pyirk.builtin_entities.R15
‘create_builtin_relation(…)’
- pyirk.builtin_entities.R16
‘create_builtin_relation(…)’
- pyirk.builtin_entities.R61
‘create_builtin_relation(…)’
- pyirk.builtin_entities.R17
‘create_builtin_relation(…)’
- pyirk.builtin_entities.R18
‘create_builtin_relation(…)’
- pyirk.builtin_entities.R19
‘create_builtin_relation(…)’
- pyirk.builtin_entities.I40
‘create_builtin_item(…)’
- pyirk.builtin_entities.R68
‘create_builtin_relation(…)’
- pyirk.builtin_entities.R20
‘create_builtin_relation(…)’
- pyirk.builtin_entities.qff_has_defining_scope
‘QualifierFactory(…)’
- pyirk.builtin_entities.R21
‘create_builtin_relation(…)’
- pyirk.builtin_entities.R23
‘create_builtin_relation(…)’
- pyirk.builtin_entities.R24
‘create_builtin_relation(…)’
- pyirk.builtin_entities.R25
‘create_builtin_relation(…)’
- pyirk.builtin_entities.I1
‘create_builtin_item(…)’
- pyirk.builtin_entities.I2
‘create_builtin_item(…)’
- pyirk.builtin_entities.I3
‘create_builtin_item(…)’
- pyirk.builtin_entities.I4
‘create_builtin_item(…)’
- pyirk.builtin_entities.I5
‘create_builtin_item(…)’
- pyirk.builtin_entities.I6
‘create_builtin_item(…)’
- pyirk.builtin_entities.I7
‘create_builtin_item(…)’
- pyirk.builtin_entities.I8
‘create_builtin_item(…)’
- pyirk.builtin_entities.I9
‘create_builtin_item(…)’
- pyirk.builtin_entities.I10
‘create_builtin_item(…)’
- pyirk.builtin_entities.I11
‘create_builtin_item(…)’
- pyirk.builtin_entities.I12
‘create_builtin_item(…)’
- pyirk.builtin_entities.I13
‘create_builtin_item(…)’
- pyirk.builtin_entities.I14
‘create_builtin_item(…)’
- pyirk.builtin_entities.I16
‘create_builtin_item(…)’
- pyirk.builtin_entities._register_scope(self, name: str, scope_type: str = None) tuple[dict, pyirk.core.Item]
Create a namespace-object (dict) and a Scope-Item :param name: the name of the scope :return:
- pyirk.builtin_entities.add_relations_to_scope(relation_tuples: Union[list, tuple], scope: pyirk.core.Entity)
Add relations defined by 3-tuples (sub, rel, obj) to the respective scope.
:param relation_tuples: :param scope: :return:
- pyirk.builtin_entities.get_scopes(entity: pyirk.core.Entity) List[pyirk.core.Item]
Return a list of all scope-items which are associated with this entity like [scope:setting, scope:premise, scope:assertion] for a proposition-item.
:param entity: :return:
- pyirk.builtin_entities.get_items_defined_in_scope(scope: pyirk.core.Item) List[pyirk.core.Entity]
- pyirk.builtin_entities.add_scope_to_defining_statement(ent: pyirk.core.Entity, scope: pyirk.core.Item) None
:param ent: :param scope: :return: None
The motivation for this function is a usage pattern like:
with I3007.scope("setting") as cm: cm.new_var(sys=p.instance_of(I5948["dynamical system"])) )
ideally the
instance_offunction would notice that it was called from within a python-context which defines a scope item. But this seems hardly achievable in a clean way. Thus, this function is called after p.instance_of, inside cm.new_var(…).
- class pyirk.builtin_entities.ScopingCM(itm: pyirk.core.Item, namespace: dict, scope: pyirk.core.Item, parent_scope_cm=None)
Context manager to for creating (“atomic”) statements in the scope of other (bigger statements). E.g. establishing a relationship between two items as part of the assertions of a theorem-item
Initialization
- _all_instances
[]
- _instances
‘defaultdict(…)’
- valid_subscope_types
None
- __enter__()
implicitly called in the head of the with statement :return:
- __exit__(exc_type, exc_val, exc_tb)
- __getattr__(name: str)
This function allows to use `cm.
instead of I2345. where I2345 is the parent object of the scope. :param name: :return:
- new_var(**kwargs) pyirk.core.Entity
create and register a new variable to the respective scope
:param kwargs: dict of len == 1 (to allow (almost) arbitrary variable names)
:return:
- _new_var(variable_name: str, variable_object: pyirk.core.Entity) pyirk.core.Entity
- new_rel(sub: pyirk.core.Entity, pred: pyirk.core.Relation, obj: pyirk.core.Entity, qualifiers=None, overwrite=False) pyirk.core.Statement
Create a new statement (“relation edge”) in the current scope
:param sub: subject :param pred: predicate (Relation-Instance) :param obj: object :param qualifiers: List of RawQualifiers :param overwrite: boolean flag that the new statement should replace the old one
:return: the newly created Statement
- _check_scope()
- _create_subscope_cm(scope_type: str, cls: type)
:param scope_type: a str like “AND”, “OR”, “NOT” :param cls: the class to instantiate, e.g. RulePremiseSubScopeCM
- copy_from(other_obj: pyirk.core.Item, scope_name: str = None)
- _get_new_var_from_old(old_var: pyirk.core.Item, strict=False) pyirk.core.Item
- _copy_mapping(mapping_item: pyirk.core.Item) pyirk.core.Item
- _get_premise_vars() dict
return a dict of all items that were defined in the associated setting scope.
key: variable names (via R23__has_name_in_scope) value: item objects
- pyirk.builtin_entities.is_generic_instance(itm: pyirk.core.Item) bool
- class pyirk.builtin_entities.AbstractMathRelatedScopeCM(itm: pyirk.core.Item, namespace: dict, scope: pyirk.core.Item, parent_scope_cm=None)
Bases:
pyirk.builtin_entities.ScopingCMContext manager containing methods which are math-related
Initialization
- new_equation(lhs: pyirk.core.Item, rhs: pyirk.core.Item, force_key: str = None) pyirk.core.Item
convenience method to create a equation-related Statement
:param lhs: :param rhs: :return:
- new_math_relation(lhs: pyirk.core.Item, rsgn: str, rhs: pyirk.core.Item, force_key: str = None) pyirk.core.Item
convenience method to create a math_relation-related StatementObject (aka “Statement”)
:param lhs: left hand side :param rsgn: relation sign :param rhs: right hand sign
:return: new instance of
- AND() pyirk.builtin_entities.ConditionSubScopeCM
Create a new subscope of type “AND”, which can hold arbitrary statements. These statements are considered to be AND-related in a boolean sense.
- OR() pyirk.builtin_entities.ConditionSubScopeCM
Create a new subscope of type “OR”, which can hold arbitrary statements. These statements are considered to be OR-related in a boolean sense.
- NOT() pyirk.builtin_entities.ConditionSubScopeCM
Create a new subscope of type “NOT”, which can hold arbitrary statements. These statements are considered to be negated in a boolean sense.
- check_scope_type(*args, **kwargs)
This method might raise an exception in subclasses
- class pyirk.builtin_entities.ConditionSubScopeCM(*args, **kwargs)
Bases:
pyirk.builtin_entities.AbstractMathRelatedScopeCMA scoping context manager to handle conditions
Initialization
- valid_subscope_types
None
- add_condition_statement(subj, pred, obj, qualifiers=None)
- add_condition_math_relation(*args, **kwargs)
- new_condition_var(**kwargs)
- check_scope_type(forbidden)
- class pyirk.builtin_entities.QuantifiedSubScopeCM(*args, **kwargs)
Bases:
pyirk.builtin_entities.ConditionSubScopeCMA scoping context manager for universally or existentially quantified statements.
Created by methods universally_quantified() and existentially_quantified() of _proposition__CM
Initialization
- class pyirk.builtin_entities._proposition__CM(itm: pyirk.core.Item, namespace: dict, scope: pyirk.core.Item, parent_scope_cm=None)
Bases:
pyirk.builtin_entities.AbstractMathRelatedScopeCMContext manager tailored for mathematical theorems and definitions
Initialization
- valid_subscope_types
None
- universally_quantified() pyirk.builtin_entities.ScopingCM
Create a new subscope of type “UNIV_QUANT”, which can hold arbitrary statements. That subscope will contain another subscope (“CONDITION”) whose statements are considered as universally quantified condition-statements.
- existentially_quantified() pyirk.builtin_entities.ScopingCM
Create a new subscope of type “EXIS_QUANT”, which can hold arbitrary statements. That subscope will contain another subscope (“CONDITION”) whose statements are considered as existentially quantified condition-statements.
- pyirk.builtin_entities._proposition__scope(self: pyirk.core.Item, scope_name: str)
This function will be used as a method for proposition-Items. It will return a __proposition__CM instance. (see above). For details see examples
:param self: :param scope_name: :return:
- class pyirk.builtin_entities._rule__CM(*args, **kwargs)
Bases:
pyirk.builtin_entities.AbstractMathRelatedScopeCM- valid_subscope_types
None
- property anchor_item_counter
For subscopes we want to use the counter of the parent scope
- uses_external_entities(*args)
Specifies that some external entities will be used inside the rule (to which this scope belongs)
- set_sparql(sparql_src: str)
Define the
WHERE-part of a sparql SELECT-query
- new_variable_literal(name)
Create an instance of I44[“variable literal”] to represent a literal.inside a rule. Variable means that the literal can have a different value for each match. Because this item takes a special role it is marked with a qualifier.
- new_rel_var(name)
Create an instance of I40[“general relation”] to represent a relation inside a rule. Because this item takes a special role it is marked with a qualifier.
- new_rel(sub: pyirk.core.Entity, pred: pyirk.core.Entity, obj: pyirk.core.Entity, qualifiers=None, overwrite=False) pyirk.core.Statement
- _get_new_anchor_item(name)
- new_condition_func(func: callable, *args, anchor_item=None)
Add an existing function that will be called to a graph-match. Only if it evaluates True, the premise is considered to be fulfilled. This helps to model conditions on literals
- new_consequent_func(func: callable, *args, anchor_item=None)
Add an existing function that should be called in the assertion-part of a semantic rule
- NOT()
- OR()
Register a subscope for OR-connected statements
- AND()
- class pyirk.builtin_entities.RulePremiseSubScopeCM(*args, **kwargs)
Bases:
pyirk.builtin_entities._rule__CMContext Manager for logical subscopes (like OR and AND) in premises
Initialization
- AND()
Register a subscope for AND-connected statements
- pyirk.builtin_entities._rule__scope(self: pyirk.core.Item, scope_name: str)
This function will be used as a method for semantic-rule-Items. It will return a __rule__CM instance. (see above). For details see examples and tests.
:param self: :param scope_name: :return:
- pyirk.builtin_entities._get_subscopes(self)
Convenience method for items which usually have scopes: allow easy access to subscopes
- pyirk.builtin_entities._get_subscope(self, name: str)
- pyirk.builtin_entities._get_statements_for_scope(self)
Convenience method for scope items to allow easy access to the statements made in that scope
- pyirk.builtin_entities._get_items_for_scope(self)
Convenience method for scope items to allow easy access to the items created in that scope
- pyirk.builtin_entities.I15
‘create_builtin_item(…)’
- pyirk.builtin_entities.I17
‘create_builtin_item(…)’
- pyirk.builtin_entities.I51
‘create_builtin_item(…)’
- pyirk.builtin_entities.I52
‘create_builtin_item(…)’
- pyirk.builtin_entities.I53
‘create_builtin_item(…)’
- pyirk.builtin_entities.I18
‘create_builtin_item(…)’
- pyirk.builtin_entities.get_ui_short_representation(self) str
This function returns a string which can be used as a replacement for the label :param self:
:return: mathjax-ready LaTeX source code
- pyirk.builtin_entities.create_expression(latex_src: str, r1: str = None, r2: str = None) pyirk.core.Item
- pyirk.builtin_entities.I19
‘create_builtin_item(…)’
- pyirk.builtin_entities.I20
‘create_builtin_item(…)’
- pyirk.builtin_entities.I21
‘create_builtin_item(…)’
- pyirk.builtin_entities.R26
‘create_builtin_relation(…)’
- pyirk.builtin_entities.R27
‘create_builtin_relation(…)’
- pyirk.builtin_entities.I46
‘create_builtin_item(…)’
- pyirk.builtin_entities.I22
‘create_builtin_item(…)’
- pyirk.builtin_entities.I23
‘create_builtin_item(…)’
- pyirk.builtin_entities.I24
‘create_builtin_item(…)’
- pyirk.builtin_entities.I25
‘create_builtin_item(…)’
- pyirk.builtin_entities.I26
‘create_builtin_item(…)’
- pyirk.builtin_entities.I27
‘create_builtin_item(…)’
- pyirk.builtin_entities.I28
‘create_builtin_item(…)’
- pyirk.builtin_entities.I29
‘create_builtin_item(…)’
- pyirk.builtin_entities.I30
‘create_builtin_item(…)’
- pyirk.builtin_entities.I31
‘create_builtin_item(…)’
- pyirk.builtin_entities.I32
‘create_builtin_item(…)’
- pyirk.builtin_entities.R28
‘create_builtin_relation(…)’
- pyirk.builtin_entities.R29
‘create_builtin_relation(…)’
- pyirk.builtin_entities.get_arguments(self: pyirk.core.Item) Tuple[pyirk.core.Item]
Convenience function to simplify the access to the entities which are in itm.R36__has_argument_tuple.
- pyirk.builtin_entities.create_evaluated_mapping(mapping: pyirk.core.Item, *args) pyirk.core.Item
:param mapping: :param arg: :return:
- pyirk.builtin_entities.R30
‘create_builtin_relation(…)’
- pyirk.builtin_entities.R31
‘create_builtin_relation(…)’
- pyirk.builtin_entities.new_equation(lhs: pyirk.core.Item, rhs: pyirk.core.Item, doc=None, scope: Optional[pyirk.core.Item] = None, force_key: str = None) pyirk.core.Item
common special case of mathematical relation, also ensures backwards compatibility
- pyirk.builtin_entities.new_mathematical_relation(lhs: pyirk.core.Item, rsgn: str, rhs: pyirk.core.Item, doc=None, scope: Optional[pyirk.core.Item] = None, force_key: str = None) pyirk.core.Item
- pyirk.builtin_entities.R33
‘create_builtin_relation(…)’
- pyirk.builtin_entities.R34
‘create_builtin_relation(…)’
- pyirk.builtin_entities.proxy_item
‘QualifierFactory(…)’
- pyirk.builtin_entities.get_proxy_item(stm: pyirk.core.Statement, strict=True) pyirk.core.Item
- pyirk.builtin_entities.R35
‘create_builtin_relation(…)’
- pyirk.builtin_entities.I33
‘create_builtin_item(…)’
- pyirk.builtin_entities.new_tuple(*args, **kwargs) pyirk.core.Item
Create a new tuple entity :param args: :return:
- pyirk.builtin_entities.R46
‘create_builtin_relation(…)’
- pyirk.builtin_entities.I42
‘create_builtin_item(…)’
- pyirk.builtin_entities.I34
‘create_builtin_item(…)’
- pyirk.builtin_entities.I35
‘create_builtin_item(…)’
- pyirk.builtin_entities.I36
‘create_builtin_item(…)’
- pyirk.builtin_entities.I37
‘create_builtin_item(…)’
- pyirk.builtin_entities.I38
‘create_builtin_item(…)’
- pyirk.builtin_entities.I39
‘create_builtin_item(…)’
- pyirk.builtin_entities.R36
‘create_builtin_relation(…)’
- pyirk.builtin_entities.R37
‘create_builtin_relation(…)’
- pyirk.builtin_entities.R67
‘create_builtin_relation(…)’
- pyirk.builtin_entities.R38
‘create_builtin_relation(…)’
- pyirk.builtin_entities.R39
‘create_builtin_relation(…)’
- pyirk.builtin_entities.R40
‘create_builtin_relation(…)’
- pyirk.builtin_entities.has_index
‘QualifierFactory(…)’
- pyirk.builtin_entities.R41
‘create_builtin_relation(…)’
- pyirk.builtin_entities.R42
‘create_builtin_relation(…)’
- pyirk.builtin_entities.R43
‘create_builtin_relation(…)’
- pyirk.builtin_entities.I41
‘create_builtin_item(…)’
- pyirk.builtin_entities.I43
‘create_builtin_item(…)’
- pyirk.builtin_entities.R44
‘create_builtin_relation(…)’
- pyirk.builtin_entities.univ_quant
‘QualifierFactory(…)’
- pyirk.builtin_entities.uq_instance_of(type_entity: pyirk.core.Item, r1: str = None, r2: str = None) pyirk.core.Item
Shortcut to create an instance and set the relation R44[“is universally quantified”] to True in one step to allow compact notation.
:param type_entity: the type of which an instance is created :param r1: the label (tried to extract from calling context) :param r2: optional description
:return: new item
- pyirk.builtin_entities.R66
‘create_builtin_relation(…)’
- pyirk.builtin_entities.exis_quant
‘QualifierFactory(…)’
- pyirk.builtin_entities.R45
‘create_builtin_relation(…)’
- class pyirk.builtin_entities.ImplicationStatement
Context manager to model conditional statements.
Example from irk:/math/0.2#I7169[“definition of identity matrix”]
with p.ImplicationStatement() as imp1: imp1.antecedent_relation(lhs=cm.i, rsgn="!=", rhs=cm.j) imp1.consequent_relation(lhs=M_ij, rhs=I5000["scalar zero"])
Initialization
- __enter__()
implicitly called in the head of the with-statement
- __exit__(exc_type, exc_val, exc_tb)
- antecedent_relation(**kwargs)
- consequent_relation(**kwargs)
- pyirk.builtin_entities.R47
‘create_builtin_relation(…)’
- pyirk.builtin_entities.R48
‘create_builtin_relation(…)’
- pyirk.builtin_entities.R49
‘create_builtin_relation(…)’
- pyirk.builtin_entities.R50
‘create_builtin_relation(…)’
- pyirk.builtin_entities.R51
‘create_builtin_relation(…)’
- pyirk.builtin_entities.is_relevant_item(itm)
- pyirk.builtin_entities.get_direct_instances_of(cls_item: pyirk.core.Item, filter=None) List[pyirk.core.Item]
- pyirk.builtin_entities.get_all_instances_of(cls_item: pyirk.core.Item, filter=None) List[pyirk.core.Item]
Return all direct and indirect instances of a class
- pyirk.builtin_entities.get_all_subclasses_of(cls_item: pyirk.core.Item, strict=True) List[pyirk.core.Item]
Recursively compile a list of all subclasses.
- pyirk.builtin_entities.close_class_with_R51(cls_item: pyirk.core.Item)
Set R51__instances_are_from for all current instances of a class.
Note: this does not prevent the creation of further instances (because they can be related via R47__is_same_as to the existing instances).
:returns: tuple-item containing all instances
- pyirk.builtin_entities.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_entities.R52
‘create_builtin_relation(…)’
- pyirk.builtin_entities.R53
‘create_builtin_relation(…)’
- pyirk.builtin_entities.R54
‘create_builtin_relation(…)’
- pyirk.builtin_entities.R55
‘create_builtin_relation(…)’
- pyirk.builtin_entities.R56
‘create_builtin_relation(…)’
- pyirk.builtin_entities.R57
‘create_builtin_relation(…)’
- pyirk.builtin_entities.R58
‘create_builtin_relation(…)’
- pyirk.builtin_entities.R59
‘create_builtin_relation(…)’
- pyirk.builtin_entities.qff_has_rule_ptg_mode
‘QualifierFactory(…)’
- pyirk.builtin_entities.R60
‘create_builtin_relation(…)’
- pyirk.builtin_entities.R62
‘create_builtin_relation(…)’
- pyirk.builtin_entities.get_relation_properties_uris()
- pyirk.builtin_entities.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_entities.R63
‘create_builtin_relation(…)’
- pyirk.builtin_entities.I44
‘create_builtin_item(…)’
- pyirk.builtin_entities.R64
‘create_builtin_relation(…)’
- pyirk.builtin_entities.R65
‘create_builtin_relation(…)’
- pyirk.builtin_entities.qff_allows_alt_functional_value
‘QualifierFactory(…)’
- pyirk.builtin_entities.R69
‘create_builtin_relation(…)’
- pyirk.builtin_entities.R70
‘create_builtin_relation(…)’
- pyirk.builtin_entities.R71
‘create_builtin_relation(…)’
- pyirk.builtin_entities.I45
‘create_builtin_item(…)’
- pyirk.builtin_entities.R72
‘create_builtin_relation(…)’
- pyirk.builtin_entities.R73
‘create_builtin_relation(…)’
- pyirk.builtin_entities.I47
‘create_builtin_item(…)’
- pyirk.builtin_entities.I48
‘create_builtin_item(…)’
- pyirk.builtin_entities.R74
‘create_builtin_relation(…)’
- pyirk.builtin_entities.I49
‘create_builtin_item(…)’
- pyirk.builtin_entities.R75
‘create_builtin_relation(…)’
- pyirk.builtin_entities.R76
‘create_builtin_relation(…)’
- pyirk.builtin_entities.I50
‘create_builtin_item(…)’
- pyirk.builtin_entities.R77
‘create_builtin_relation(…)’
- pyirk.builtin_entities.R78
‘create_builtin_relation(…)’
- pyirk.builtin_entities.I54
‘create_builtin_item(…)’
- pyirk.builtin_entities.R79
‘create_builtin_relation(…)’
- pyirk.builtin_entities.R80
‘create_builtin_relation(…)’
- pyirk.builtin_entities.R81
‘create_builtin_relation(…)’
- pyirk.builtin_entities.I60
‘create_builtin_item(…)’
- pyirk.builtin_entities.I55
‘create_builtin_item(…)’
- pyirk.builtin_entities.I61
‘create_builtin_item(…)’
- pyirk.builtin_entities.I56
‘create_builtin_item(…)’
- pyirk.builtin_entities.I62
‘create_builtin_item(…)’
- pyirk.builtin_entities.I57
‘create_builtin_item(…)’
- pyirk.builtin_entities.I63
‘create_builtin_item(…)’
- pyirk.builtin_entities.I58
‘create_builtin_item(…)’
- pyirk.builtin_entities.R82
‘create_builtin_relation(…)’
- pyirk.builtin_entities.add_items(*args)
- pyirk.builtin_entities.radd_items(a, b)
- pyirk.builtin_entities.sub_items(a, b)
- pyirk.builtin_entities.reflective_sub_items(a, b)
- pyirk.builtin_entities.mul_items(*args)
- pyirk.builtin_entities.rmul_items(a, b)
- pyirk.builtin_entities.div_items(a, b)
- pyirk.builtin_entities.reflective_div_items(a, b)
- pyirk.builtin_entities.pow_items(a, b)
- pyirk.builtin_entities.reflective_pow_items(a, b)
- pyirk.builtin_entities.neg_item(a)
- pyirk.builtin_entities.unpack_tuple_item(tuple_item)
This is just a convenience alias for .R39__has_element
- pyirk.builtin_entities.I59
‘create_builtin_item(…)’
- pyirk.builtin_entities.I000
‘create_builtin_item(…)’
- pyirk.builtin_entities.R000
‘create_builtin_relation(…)’
- pyirk.builtin_entities.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_entities.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_entities.replacer_method(self, old_item, new_item)
replace old_item with new_item in every statement, unlink the old item
- pyirk.builtin_entities.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_entities.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_entities.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_entities.raise_contradiction(self, msg_template, *args)
- pyirk.builtin_entities.raise_reasoning_goal_reached(self, msg_template, *args)