opencog / atomspace-restful

RESTful web server for the AtomSpace Graph Database
http://wiki.opencog.org/w/REST_API
Other
1 stars 3 forks source link

FIX for python restapi and WIP for publisher #1

Closed manisabri closed 4 years ago

manisabri commented 4 years ago

Test are not passing. In python TruthValue expects an opencog.atomspace.PtrHolder but we call it with two numbers like (0.1, 0.1) Is this a known issue?

linas commented 4 years ago

Thanks! post-merge comments to follow ...

linas commented 4 years ago

TruthValue

The 6 different kinds of TruthValues are all special cases of Values, in general. The RESTapi was created when there were only two or 3 different kinds of TruthValues, so, sure it probably has an inconsistent API. It should be updated to handle Values in general. Here's a quick recap:

There are three generic kinds of Values: those that hold a vector of floats, a vector of strings, and a vector of Values. (Note that Atoms are a special case of Values) Both Atoms and Values are tracked with smart pointers; the smart-pointer for Atoms is called "Handle" and has some extra Atom-specific methods on it.

Most of the TruthValues are special cases of FloatValue, and hold 2 or more floats. Some of the TruthValues hold more complex structures (upper and lower bounds, a distribution, some other stats).

AttentionValues are special cases of FloatValue. The AttentionValues are loaded only when the AttentionBank is loaded.

Values can encapsulate rapidly time-varying data, e.g. video audio streams, or more likely: 3D position, orientation, distances, angles, etc. and provide the latest values when queried. The spacetime values are loaded only when SpaceTime is loaded...

In other words, the collection of Values, just like the collection of Atoms, depends on which modules have been loaded. ...

event publisher

The original even publisher is a horrible design. It uses callbacks to be notified of truth-value changes .. the problem is the callback craters performance, slowing down the system by 2x or 4x or something like that. and so is basically unusable/untenable in a running system. Some other kind of system is required. Maybe some system that penalizes only those people who want this data, instead of penalizing everyone. Some kind of special custom server that sits on top of the AtomSpace, instead of inside of it ....

manisabri commented 4 years ago

So the next pull request gonna be for AtomSpace to fix the values I guess (in python bindings)