Implemented a first and basic version of a Rete rule engine
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
from conftest import SHEERKA_TEST_FOLDER
|
||||
from core.global_symbols import EVENT_ONTOLOGY_CREATED
|
||||
from core.sheerka.Sheerka import Sheerka
|
||||
from core.sheerka.SheerkaOntologyManager import SheerkaOntologyManager
|
||||
|
||||
@@ -10,19 +11,28 @@ class TestUsingFileBasedSheerka(BaseTest):
|
||||
context = None
|
||||
root_ontology_name = SheerkaOntologyManager.ROOT_ONTOLOGY_NAME
|
||||
|
||||
ontologies_created = set()
|
||||
|
||||
def teardown_method(self, method):
|
||||
# to do after the test
|
||||
if TestUsingFileBasedSheerka.sheerka:
|
||||
while TestUsingFileBasedSheerka.sheerka.om.current_ontology().name != self.root_ontology_name:
|
||||
ontology = TestUsingFileBasedSheerka.sheerka.pop_ontology().body.body
|
||||
ontology = TestUsingFileBasedSheerka.sheerka.pop_ontology(self.context).body.body
|
||||
ontology.cache_manager.sdp.test_only_destroy_refs()
|
||||
|
||||
# remove other created ontologies
|
||||
for ontology in TestUsingFileBasedSheerka.ontologies_created:
|
||||
TestUsingFileBasedSheerka.sheerka.om.current_sdp().test_only_destroy_refs(ontology)
|
||||
TestUsingFileBasedSheerka.ontologies_created.clear()
|
||||
|
||||
@staticmethod
|
||||
def new_sheerka_instance(cache_only):
|
||||
sheerka = Sheerka(cache_only=cache_only)
|
||||
sheerka.initialize(SHEERKA_TEST_FOLDER,
|
||||
save_execution_context=False,
|
||||
enable_process_return_values=False)
|
||||
enable_process_return_values=False,
|
||||
enable_process_rules=False)
|
||||
sheerka.subscribe(EVENT_ONTOLOGY_CREATED, lambda c, o: TestUsingFileBasedSheerka.ontologies_created.add(o))
|
||||
return sheerka
|
||||
|
||||
def get_sheerka(self, **kwargs) -> Sheerka:
|
||||
|
||||
Reference in New Issue
Block a user