CogServer WebSocket Demo
You can interact with a running CogServer with this web page.
Be sure to start a cogserver first! Try running it either from
the command line:
$ /usr/local/bin/cogserver
or from guile:
$ guile
> (use-modules (opencog) (opencog cogserver))
> (start-cogserver)
or from python:
$ python3
> import opencog, opencog.cogserver
> opencog.cogserver.startCogserver()
Take a moment to visit the stats page at
http://localhost:18080/ .
Interact
Changes do not take effect until the current connection
is disconnected and a new connection is made.
CogServer:
Endpoint:
Connected to server: false
Connection Type:
CogServer URL:
Command:
CogServer Reply:
Suggested Mesages
Try sending these messages:
JSON
See the JSON README
for full documentation.
JSON API Version:
AtomSpace.version()
Create a ConceptNode:
AtomSpace.makeAtom({"type": "Concept", "name": "foo"})
Fetch all Atoms:
AtomSpace.getAtoms("Atom", true)
Fetch all Atom Types:
AtomSpace.getSubTypes("TopType", true)
Scheme
See the OpenCog Wiki
for full documentation.
Sanity check:
(+ 2 2)
Hello, World!
(display "Hello, World!\n")
Create a ConceptNode:
(Concept "bar")
Fetch all Atoms:
(cog-get-atoms 'Atom #t)
Print a Summary report:
(cog-report-counts)
S-Expressions
The S-Expressions are similar to the Scheme API, except that
only 15 commands are supported. However, these run extremely fast;
the API is designed for high-throughput. Syntax errors fail
silently, and many successful commands do not return anything!
See the Sexpr README
for full documentation.
AtomSpace Version:
(cog-version)
Create a ConceptNode:
(cog-set-tv! (Concept "zinger") (stv 1 0))
Fetch all Atoms:
(cog-get-atoms 'Atom #t)
Set a value on an Atom:
(cog-set-value! (Concept "foo") (Predicate "key") (FloatValue 1 2 3))
Get a value on an Atom:
(cog-value (Concept "foo") (Predicate "key"))
Python
See the OpenCog Wiki
for full documentation.
Hello, World!
print("Hello, World!\n")
Create a ConceptNode:
Concept("foo")
Fetch all Atoms:
atomspace.get_atoms_by_type(types.Atom, true)
The End