예제 #1
0
class TestTimeServer:
    def setUp(self):
        self._atomspace = AtomSpace()
        self._spaceserver = SpaceServer(self._atomspace)
        self._timeserver = TimeServer(self._atomspace, self._spaceserver)
        self._spaceserver.set_time_server(self._timeserver)

    def tearDown(self):
        del self._spaceserver
        del self._atomspace

    def test_addTimeInfo(self):
        objnode = self._atomspace.add_node(types.StructureNode, "object111")
        at_time_link = self._timeserver.add_time_info(objnode, 123456)
        assert objnode in self._atomspace.get_outgoing(at_time_link)
예제 #2
0
class TestTimeServer:
    def setUp(self):
        self._atomspace = AtomSpace()
        self._spaceserver = SpaceServer(self._atomspace)
        self._timeserver = TimeServer(self._atomspace, self._spaceserver)
        self._spaceserver.set_time_server(self._timeserver)

    def tearDown(self):
        del self._spaceserver
        del self._atomspace

    def test_addTimeInfo(self):
        objnode = self._atomspace.add_node(types.StructureNode, "object111")
        at_time_link = self._timeserver.add_time_info(objnode.h, 123456)
        assert objnode in self._atomspace.get_outgoing(at_time_link)
예제 #3
0
        print("\n----- [Output # {0}] -----".format(outputs_produced))
        for j in output:
            print("-- Output:\n{0}".format(j))
        print("-- using production rule: {0}".format(rule.name))
        print("\n-- based on this input:\n{0}".format(input))

        clear_atomspace()
        # visualization filtering
        for atom in atomspace.get_atoms_by_type(types.Atom):
            # links that shouldn't be visualized are skipped
            if atom.type in not_visualized_links:
                continue

            if atom not in [types.ConceptNode, types.PredicateNode]:
                out = [atom1 for atom1 in atomspace.get_outgoing(atom.h)]
                # links involving automatically generated VariableNodes are
                # skipped
                if out and "$pln_var_" in out[0].name:
                    continue
                # check if result is found
                if atom.is_a(types.EvaluationLink):
                    if out[0].is_a(types.PredicateNode)\
                        and "breathe" in out[0].name\
                        and out[1].is_a(types.ListLink)\
                        and "Socrates" in out[1].out[0].name\
                        and "air" in out[1].out[1].name:
                        result_found = True

            atomspace_string += str(atom)
        # the atom uuids are shortened for the visualization