Identify group "concepts" on-flight.
This commit is contained in:
parent
2bfe676b2d
commit
cbeefcf76b
@ -113,6 +113,21 @@ def modifiable_element_for_existance_in_set(container, set_name, element):
|
|||||||
setter=setter,
|
setter=setter,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def modifiable_element_for_existance_in_group(container, element, backlink, set_name='groups'):
|
||||||
|
def getter():
|
||||||
|
nonlocal container, element, backlink, set_name
|
||||||
|
return (set_name in container) and (element in container[set_name])
|
||||||
|
|
||||||
|
def setter():
|
||||||
|
nonlocal container, set_name, element
|
||||||
|
backlink['groups'].add(set_name)
|
||||||
|
return container[set_name].add(element)
|
||||||
|
|
||||||
|
return ModifiableProperty(
|
||||||
|
getter=getter,
|
||||||
|
setter=setter,
|
||||||
|
)
|
||||||
|
|
||||||
def pertenence_to_group(knowledge_base, elements, subj, group):
|
def pertenence_to_group(knowledge_base, elements, subj, group):
|
||||||
subj = resolve(knowledge_base, elements, subj)
|
subj = resolve(knowledge_base, elements, subj)
|
||||||
group = resolve(knowledge_base, elements, group)
|
group = resolve(knowledge_base, elements, group)
|
||||||
|
Loading…
Reference in New Issue
Block a user