Fixed #100 : SheerkaAdmin: Add builtins() command

Fixed #99 : SheerkaQueryManager: I can manage contains predicate when filtering objects
Fixed #97 : ERROR: list indices must be integers or slices, not Concept
Fixed #96 : SequenceNodeParser: SequenceNodeParser must correctly handle concept definition
Fixed #95 : ResolveAmbiguity must not remove concepts that do not require evaluation
Fixed #94 : Concepts with the same key are lost when new ontology
Fixed #93 : Introduce BuiltinConcepts.EVAL_GLOBAL_TRUTH_REQUESTED
Fixed #92 : ExpressionParser: Implement compile_disjunctions()
Fixed #91 : Implement get_concepts_complexity(context, concepts, concept_parts)
Fixed #90 : ResolveAmbiguity : where predicate is not used to resolve ambiguity
Fixed #89 : ResolveAmbiguityEvaluator: Concepts embedded in ConceptNode are not resolved
Fixed #88: SyaNodeParser: Parse multiple parameters when some of the are not recognized
Fixed #87: SyaNodeParser : Parse the multiple parameters
This commit is contained in:
2021-07-31 08:52:00 +02:00
parent 7dcaa9c111
commit e69745adc8
70 changed files with 1561 additions and 455 deletions
+28 -16
View File
@@ -842,11 +842,9 @@ class TestSheerkaOntology(TestUsingMemoryBasedSheerka):
sheerka, context, foo = self.init_concepts("foo", cache_only=False)
manager = SheerkaOntologyManager(sheerka, sheerka.root_folder, sheerka.cache_only)
cache = Cache(default=lambda sdp, key: sdp.get("by_id", key),
extend_exists=lambda sdp, key: sdp.get("by_id", key))
cache = Cache().auto_configure("by_id")
manager.register_concept_cache("by_id", cache, lambda obj: obj.id, use_ref=True)
cache = ListIfNeededCache(default=lambda sdp, key: sdp.get("by_key", key),
extend_exists=lambda sdp, key: sdp.get("by_key", key))
cache = ListIfNeededCache().auto_configure("by_key")
manager.register_concept_cache("by_key", cache, lambda obj: obj.key, use_ref=True)
manager.freeze()
@@ -863,11 +861,9 @@ class TestSheerkaOntology(TestUsingMemoryBasedSheerka):
sheerka, context, foo = self.init_concepts("foo", cache_only=False)
manager = SheerkaOntologyManager(sheerka, sheerka.root_folder, sheerka.cache_only)
cache = Cache(default=lambda sdp, key: sdp.get("by_id", key),
extend_exists=lambda sdp, key: sdp.get("by_id", key))
cache = Cache().auto_configure("by_id")
manager.register_concept_cache("by_id", cache, lambda obj: obj.id, use_ref=True)
cache = ListIfNeededCache(default=lambda sdp, key: sdp.get("by_key", key),
extend_exists=lambda sdp, key: sdp.get("by_key", key))
cache = ListIfNeededCache().auto_configure("by_key")
manager.register_concept_cache("by_key", cache, lambda obj: obj.key, use_ref=True)
manager.freeze()
@@ -887,15 +883,33 @@ class TestSheerkaOntology(TestUsingMemoryBasedSheerka):
assert list(manager.ontologies[0].cache_manager.sdp.state.data.keys()) == ['by_id', 'by_key']
assert manager.ontologies[1].cache_manager.sdp.state.data == {}
def test_i_can_add_the_concepts_with_the_same_key_from_different_layers(self):
sheerka, context, foo_1, foo_2 = self.init_concepts(
Concept("foo x", body="x + 1").def_var("x"),
Concept("foo x", body="x + 2").def_var("x"),
cache_only=False)
manager = SheerkaOntologyManager(sheerka, sheerka.root_folder, sheerka.cache_only)
cache = ListIfNeededCache().auto_configure("by_key")
manager.register_concept_cache("by_key", cache, lambda obj: obj.key, use_ref=True)
manager.freeze()
manager.add_concept(foo_1)
manager.commit(context)
manager.push_ontology("new ontology")
manager.add_concept(foo_2)
manager.commit(context)
assert manager.current_sdp().get("by_key", foo_1.key) == [foo_1, foo_2]
def test_i_can_update_concept_in_default_layer(self):
sheerka, context, foo = self.init_concepts("foo", cache_only=False)
manager = SheerkaOntologyManager(sheerka, sheerka.root_folder, sheerka.cache_only)
cache = Cache(default=lambda sdp, key: sdp.get("by_id", key),
extend_exists=lambda sdp, key: sdp.get("by_id", key))
cache = Cache().auto_configure("by_id")
manager.register_concept_cache("by_id", cache, lambda obj: obj.id, use_ref=True)
cache = ListIfNeededCache(default=lambda sdp, key: sdp.get("by_key", key),
extend_exists=lambda sdp, key: sdp.get("by_key", key))
cache = ListIfNeededCache().auto_configure("by_key")
manager.register_concept_cache("by_key", cache, lambda obj: obj.key, use_ref=True)
manager.freeze()
@@ -953,11 +967,9 @@ class TestSheerkaOntology(TestUsingMemoryBasedSheerka):
sheerka, context, foo = self.init_concepts("foo", cache_only=False)
manager = SheerkaOntologyManager(sheerka, sheerka.root_folder, sheerka.cache_only)
cache = Cache(default=lambda sdp, key: sdp.get("by_id", key),
extend_exists=lambda sdp, key: sdp.get("by_id", key))
cache = Cache().auto_configure("by_id")
manager.register_concept_cache("by_id", cache, lambda obj: obj.id, use_ref=True)
cache = ListIfNeededCache(default=lambda sdp, key: sdp.get("by_key", key),
extend_exists=lambda sdp, key: sdp.get("by_key", key))
cache = ListIfNeededCache().auto_configure("by_key")
manager.register_concept_cache("by_key", cache, lambda obj: obj.key, use_ref=True)
manager.freeze()