Exemple #1
0
class TestMemory(unittest.TestCase):
    """Tests Transformers"""
    def setUp(self):
        from pydsl.Memory.Memory import LocalMemory
        self.mem = LocalMemory()
        
    def testSaveLoadAndDelete(self):
        texto1 = Texto()
        texto2 = Texto()
        self.mem.save(texto1,"id1")
        self.mem.save(texto2, "id2")
        newdg = self.mem["id1"]
        self.assertTrue(newdg == texto1)
        del self.mem["id1"]
        del self.mem["id2"]

    def testSimpleSearch(self):
        return True
Exemple #2
0
 def testdicttoQuery(self):
     from pydsl.Memory.Search.Query import dict_to_query
     dict_to_query({"identifier":"id"})
     dict_to_query({"identifier":"id","description":"desc"})
     dict_to_query({"identifier":"id","description":{"$not":"desc"}})
     myquery = dict_to_query({"roledict":{"$part":{"subject":"human"}}})
     from pydsl.Memory.Memory import LocalMemory
     mymem = LocalMemory()
     from pydsl.Concept.Concept import Concept
     from pydsl.Concept.Relation import Relation, Rel
     concept1 = Concept("human")
     concept2 = Concept("animal")
     concept3 = Concept("dog")
     rel = Rel("ISA", ["subject","object"])
     rela = Relation(rel,{"subject":concept1,"object":concept2})
     relb = Relation(rel,{"subject":concept3,"object":concept2})
     mymem.save( concept1,"c1")
     mymem.save( concept2,"c2")
     mymem.save( concept3,"c3")
     #mymem.save(rel,"r1")
     mymem.save(rela,"r2")
     mymem.save(relb,"r3")
     mymem.search(myquery)
Exemple #3
0
 def setUp(self):
     from pydsl.Memory.Memory import LocalMemory
     self.mem = LocalMemory()