pyirk.builtin_entities

Module Contents

Classes

ScopingCM

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

AbstractMathRelatedScopeCM

Context manager containing methods which are math-related

ConditionSubScopeCM

A scoping context manager to handle conditions

QuantifiedSubScopeCM

A scoping context manager for universally or existentially quantified statements.

_proposition__CM

Context manager tailored for mathematical theorems and definitions

_rule__CM

RulePremiseSubScopeCM

Context Manager for logical subscopes (like OR and AND) in premises

ImplicationStatement

Context manager to model conditional statements.

Functions

allows_instantiation

Check if itm is 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 subclasses

get_taxonomy_tree

Recursively iterate over super and parent classes and

is_subclass_of

Return True if itm1 is an (indirect) subclass (via) R3__is_subclass_of itm2

is_instance_of

Returns True if instance_itm.R4 is cls_itm or an (indirect) subclass (R3) of cls_itm.

instance_of

Create an instance (R4) of an item. Try to obtain the label by inspection of the calling context (if r1 is None).

_register_scope

Create a namespace-object (dict) and a Scope-Item :param name: the name of the scope :return:

add_relations_to_scope

Add relations defined by 3-tuples (sub, rel, obj) to the respective scope.

get_scopes

Return a list of all scope-items which are associated with this entity like [scope:setting, scope:premise, scope:assertion] for a proposition-item.

get_items_defined_in_scope

add_scope_to_defining_statement

:param ent: :param scope: :return: None

is_generic_instance

_proposition__scope

This function will be used as a method for proposition-Items. It will return a __proposition__CM instance. (see above). For details see examples

_rule__scope

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.

_get_subscopes

Convenience method for items which usually have scopes: allow easy access to subscopes

_get_subscope

_get_statements_for_scope

Convenience method for scope items to allow easy access to the statements made in that scope

_get_items_for_scope

Convenience method for scope items to allow easy access to the items created in that scope

get_ui_short_representation

This function returns a string which can be used as a replacement for the label :param self:

create_expression

get_arguments

Convenience function to simplify the access to the entities which are in itm.R36__has_argument_tuple.

create_evaluated_mapping

:param mapping: :param arg: :return:

new_equation

common special case of mathematical relation, also ensures backwards compatibility

new_mathematical_relation

get_proxy_item

new_tuple

Create a new tuple entity :param args: :return:

uq_instance_of

Shortcut to create an instance and set the relation R44[“is universally quantified”] to True in one step to allow compact notation.

is_relevant_item

get_direct_instances_of

get_all_instances_of

Return all direct and indirect instances of a class

get_all_subclasses_of

Recursively compile a list of all subclasses.

close_class_with_R51

Set R51__instances_are_from for all current instances of a class.

set_multiple_statements

For every element of subjects, create a statement with predicate and object

get_relation_properties_uris

get_relation_properties

return a sorted list of URIs, corresponding to the relation properties corresponding to rel_entity.

add_items

radd_items

sub_items

reflective_sub_items

mul_items

rmul_items

div_items

reflective_div_items

pow_items

reflective_pow_items

neg_item

unpack_tuple_item

This is just a convenience alias for .R39__has_element

label_compare_method

Condition function for rules. Returns True if label of item 1 is alphabetically smaller then that of item2

does_not_have_relation

Condition function for rules. Returns True if item does not have any statement where rel is the predicate

replacer_method

replace old_item with new_item in every statement, unlink the old item

copy_statements

For every statement like (i1, rel1, i2) create a new statement with rel2 as predicate.

reverse_statements

For every statement like (i1, rel1, i2) create a new statement (i2, rel, i1) (if it does not yet exist).

new_instance_as_object

Create a new instance of obj_type and then use this as the object in a new statement.

raise_contradiction

raise_reasoning_goal_reached

Data

__URI__

keymanager

R32

R1

R2

R22

R3

R4

R5

R6

R7

R8

R9

R10

R11

R12

R13

R14

R15

R16

R61

R17

R18

R19

I40

R68

R20

qff_has_defining_scope

R21

R23

R24

R25

I1

I2

I3

I4

I5

I6

I7

I8

I9

I10

I11

I12

I13

I14

I16

I15

I17

I51

I52

I53

I18

I19

I20

I21

R26

R27

I46

I22

I23

I24

I25

I26

I27

I28

I29

I30

I31

I32

R28

R29

R30

R31

R33

R34

proxy_item

R35

I33

R46

I42

I34

I35

I36

I37

I38

I39

R36

R37

R67

R38

R39

R40

has_index

R41

R42

R43

I41

I43

R44

univ_quant

R66

exis_quant

R45

R47

R48

R49

R50

R51

R52

R53

R54

R55

R56

R57

R58

R59

qff_has_rule_ptg_mode

R60

R62

R63

I44

R64

R65

qff_allows_alt_functional_value

R69

R70

R71

I45

R72

R73

I47

I48

R74

I49

R75

R76

I50

R77

R78

I54

R79

R80

R81

I60

I55

I61

I56

I62

I57

I63

I58

R82

I59

I000

R000

API

pyirk.builtin_entities.__URI__

None

pyirk.builtin_entities.keymanager

‘KeyManager(…)’

pyirk.builtin_entities.allows_instantiation(itm: pyirk.core.Item) bool

Check if itm is 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 subclasses

Possibilities:

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_entity has a defining scope and qualifiers is 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_of function 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.ScopingCM

Context 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.AbstractMathRelatedScopeCM

A 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.ConditionSubScopeCM

A 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.AbstractMathRelatedScopeCM

Context 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__CM

Context 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)