コード例 #1
0
ファイル: module.py プロジェクト: octool/semantic-vision
def tmp_atomspace(atomspace):
    parent_atomspace = atomspace
    atomspace = create_child_atomspace(parent_atomspace)
    initialize_opencog(atomspace)
    try:
        yield atomspace
    finally:
        atomspace.clear()
        finalize_opencog()
        initialize_opencog(parent_atomspace)
コード例 #2
0
 def tearDown(self):
     finalize_opencog()
     del self.space
コード例 #3
0
ファイル: bindlink.py プロジェクト: MarcosPividori/atomspace
result = bindlink(atomspace, bindlink_handle)
assert_true(result is not None and result.value() > 0)

# Check the ending atomspace size, it should have added one SetLink.
ending_size = atomspace.size()
assert_equals(ending_size, starting_size + 1)

# The SetLink should have three items in it.
atom = atomspace[result]
assert_equals(atom.arity, 3)
assert_equals(atom.type, types.SetLink)

result = execute_atom(atomspace, 
        ExecutionOutputLink( 
            GroundedSchemaNode("py: add_link"),
            ListLink(
                ConceptNode("one"),
                ConceptNode("two") 
            )
        )
    )
list_link = ListLink(
        ConceptNode("one"),
        ConceptNode("two")
    )
assert_equals(result, list_link)

finalize_opencog()
del atomspace

コード例 #4
0
ファイル: bindlink.py プロジェクト: zhangzhangzf/atomspace
assert_true(result is not None)

# Check the ending atomspace size, it should be the same.
ending_size = atomspace.size()
assert_equals(ending_size, starting_size)

# Remember the starting atomspace size.
starting_size = atomspace.size()

# Run bindlink.
result = bindlink(atomspace, bindlink_atom)
assert_true(result is not None)

# Check the ending atomspace size, it should have added one SetLink.
ending_size = atomspace.size()
assert_equals(ending_size, starting_size + 1)

# The SetLink should have three items in it.
assert_equals(result.arity, 3)
assert_equals(result.type, types.SetLink)

result = execute_atom(
    atomspace,
    ExecutionOutputLink(GroundedSchemaNode("py: add_link"),
                        ListLink(ConceptNode("one"), ConceptNode("two"))))
list_link = ListLink(ConceptNode("one"), ConceptNode("two"))
assert_equals(result, list_link)

finalize_opencog()
del atomspace
コード例 #5
0
ファイル: test_atomspace.py プロジェクト: nko5/atomspace
 def tearDown(self):
     finalize_opencog()
     del self.space
コード例 #6
0
 def test_initialize_finalize(self):
     initialize_opencog(self.atomspace)
     finalize_opencog()
コード例 #7
0
 def test_initialize_finalize(self):
     initialize_opencog(self.atomspace)
     finalize_opencog()
コード例 #8
0
 def remove(self):
     # make sure this is called by the time script exits
     finalize_opencog()
     del self.a
コード例 #9
0
ファイル: test_tensortv.py プロジェクト: vsbogd/atomspace
 def tearDown(self):
     finalize_opencog()
コード例 #10
0
 def tearDownClass(cls):
     finalize_opencog()
     global atomspace
     del atomspace
コード例 #11
0
ファイル: test.py プロジェクト: singnet/opencog
 def tearDown(self):
     self.atomspace = None
     finalize_opencog()
コード例 #12
0
def delete_child_atomspace():
    global child_atomspace
    child_atomspace.clear()
    finalize_opencog()
    initialize_opencog(atomspace)
コード例 #13
0
 def delete_child_atomspace(self):
     self.child_atomspace.clear()
     finalize_opencog()
     initialize_opencog(self.atomspace)