%%capture
import opencog as opencog
server = opencog.Server()
#server.start()

opencog.clear_atomspace()
opencog.load_scheme_files(["python/pln/examples/tuffy/smokes/smokes.scm"])

print("The atomspace contains {0} atoms.".format(len(opencog.atomspace())))

atomspace = opencog.atomspace()
for handle, atom in atomspace.iteritems():
    if atom['type'] == 'ConceptNode':
        print("ConceptNode #{0} is '{1}'".
              format(handle, atom['name']))
    if atom['type'] == 'EvaluationLink':
        print("EvaluationLink #{0} refers to a predicate '{1}'".
              format(handle, atomspace[atom['outgoing'][0]]['name']))


print("This atom is of type {0}".
      format(opencog.scheme('(cog-type (ConceptNode "Bob"))')))

import graphics
graphics.render_image(opencog.dump_atomspace_dot(), 1)

from IPython.core.display import Image
Image(filename='images/00001.png', width=500)