Fixed variable recognition when it is a concept

This commit is contained in:
2020-11-20 17:24:52 +01:00
parent 315f8ea09b
commit 0e945fe0fd
8 changed files with 79 additions and 36 deletions
+3
View File
@@ -691,6 +691,9 @@ class Sheerka(Concept):
return None
return new_instances(concept) if return_new else concept
def fast_get_by_name(self, name):
return self.cache_manager.get(self.CONCEPTS_BY_NAME_ENTRY, name)
def has_id(self, concept_id):
"""
Returns True if a concept with this id exists in cache
@@ -21,6 +21,7 @@ class SheerkaCreateNewConcept(BaseService):
def initialize(self):
self.sheerka.bind_service_method(self.create_new_concept, True)
self.sheerka.bind_service_method(self.not_is_variable, False, visible=False)
def create_new_concept(self, context, concept: Concept):
"""
@@ -108,3 +109,11 @@ class SheerkaCreateNewConcept(BaseService):
refs.add(concept.id)
return refs
def not_is_variable(self, name):
"""
Given a name tells if it refers to a variable name
:param name:
:return:
"""
return not self.sheerka.cache_manager.get(self.sheerka.CONCEPTS_BY_NAME_ENTRY, name)