Giter VIP home page Giter VIP logo

atomspace-restful's Introduction

AtomSpace RESTful Web API

Attention! This code is obsolete!

  1. It uses a number of deprecated Atomspace API's (the attention bank, for example)
  2. Has dependencies on technologies that are not available on Ubuntu (for example, "swagger").
  3. Will not compile on current versions (22.04) of Ubuntu.
  4. Older versions (18.04) allow it to compile, but it will generate python errors when you try to run it. Basically, it won't work.
  5. The JSON format it generates is an incorrect representation of of AtomSpace contents. It's not how the AtomSpce actually works.

The correct solution is to throw away this code, and port the visualizer to use the supported Atomese interfaces. See the AtomSpace Explorer Issue #8 for details on how to do this.

Overview

This module exposes a RESTful web interface to the AtomSpace.

The code here is needed by the AtomSpace Explorer.

See http://wiki.opencog.org/w/REST_API for old documentation.

Prerequisites

To build and run this module, the packages listed below are required. With a few exceptions, most Linux distributions will provide these packages. Users of Ubuntu may use the dependency installer from the /opencog/octool repository. Users of any version of Linux may use the Dockerfile to quickly build a container in which OpenCog will be built and run.

cogutil

Common OpenCog C++ utilities https://github.com/opencog/cogutil It uses exactly the same build procedure as this package. Be sure to sudo make install at the end.

atomspace

OpenCog Atomspace database and reasoning engine https://github.com/opencog/atomspace It uses exactly the same build procedure as this package. Be sure to sudo make install at the end.

cogserver

OpenCog CogServer Network Server. https://github.com/opencog/cogserver It uses exactly the same build procedure as this package. Be sure to sudo make install at the end.

Flask and Flask RESTful

Python micro web server Try sudo apt install python3-flask python3-flask-restful python3-flask-cors

CppREST

C++ HTTP RESTful interfaces (Optional) Used by the Pattern miner for distributed processing (this will be replaced by gearman in future releases). sudo apt-get install libcpprest-dev

Threading Building Blocks

C++ template library for parallel programming (Optional) Used to implement the optional REST API. (TODO: the REST API should be refactored to not use TBB) sudo apt-get install libtbb-dev

Building

Perform the following steps at the shell prompt:

    cd to project root dir
    mkdir build
    cd build
    cmake ..
    make

Libraries will be built into subdirectories within build, mirroring the structure of the source directory root.

Unit tests

To build and run the unit tests, from the ./build directory enter (after building opencog as above):

    make test

Running

To start the system, run one of the servers in the examples/restapi directory.

TODO

The current code assumes an obsolete API to the AtomSpace. In particular, it does not support Values in general, and assumes that all atoms have a TruthValue (they don't, in general) and have an Attention value (they don't when they are not in the attention bank). This needs to be fixed. Volunteers needed.

atomspace-restful's People

Contributors

alex-van-der-peet avatar amebel avatar chenesan avatar czhedu avatar edajade avatar eddiemonroe avatar ferrouswheel avatar githart avatar hedayat avatar huangdeheng avatar inflector avatar keyvan-m-sadeghi avatar kim135797531 avatar kizzobot avatar leungmanhin avatar linas avatar misgeatgit avatar ngeiswei avatar prateeksaxena2809 avatar rekino avatar roman-khimov avatar rtreutlein avatar sebastianruder avatar shujingke avatar themixed avatar tnick avatar tpsjr7 avatar williampma avatar xiaohui avatar yantrabuddhi avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

atomspace-restful's Issues

cmake can't find tbb on ubuntu 22.04

i've installed libtbb-dev

$ dpkg -L libtbb-dev
...
/usr/include/oneapi/tbb/version.h
/usr/include/oneapi/tbb.h
/usr/include/tbb
/usr/include/tbb/blocked_range.h
/usr/include/tbb/blocked_range2d.h
...

but cmake can't find it:

$ cmake ..
...
-- Python destination dir found: /usr/local/lib/python3.10/dist-packages
-- Python install dir: /usr/local/lib/python3.10/dist-packages/opencog
-- Using nosetests executable /usr/bin/nosetests3
-- Looked for Threading Building Blocks in /opt/intel/tbb;/usr/local/include;/usr/include
-- Intel TBB (Threaded Building Blocks) was not found; the AtomSpace Publisher module will not be built. Installation instructions: https://www.threadingbuildingblocks.org/download
-- Found ZeroMQ library: /usr/lib/x86_64-linux-gnu/libzmq.so
-- Detected ZeroMQ version number: 4.3.4
-- ZeroMQ was found.
-- AttentionBank found.

Building for Ubuntu 22.04 LTS

The following components will be built:
-----------------------------------------------
   Doxygen       - Code documentation.
   Python tests  - Python bindings nose tests.
   Unit tests    - Unit tests.

The following components WILL NOT be built:
-----------------------------------------------
   REST Events   - REST Atomspace Event Publisher module.

any ideas about how to fix?

ubuntu 22.04 make error

after changing CMakeLists.txt to point to directly to /usr/include/tbb, cmake is successful but hits an error in the tbb library (package version 2021.5.0-7ubuntu2)

In file included from /home/mozi/oc/atomspace-restful/opencog/events/AtomSpacePublisherModule.cc:48:
/home/mozi/oc/atomspace-restful/opencog/events/AtomSpacePublisherModule.h: At global scope:
/home/mozi/oc/atomspace-restful/opencog/events/AtomSpacePublisherModule.h:61:38: error: expected class-name before ‘{’ token
   61 | class lambda_task : public tbb::task {
      |                                      ^
/home/mozi/oc/atomspace-restful/opencog/events/AtomSpacePublisherModule.h:63:10: error: ‘task’ in namespace ‘tbb’ does not name a type
   63 |     tbb::task* execute() {
      |          ^~~~
In file included from /usr/include/tbb/task.h:17,
                 from /home/mozi/oc/atomspace-restful/opencog/events/AtomSpacePublisherModule.cc:31:
/usr/include/oneapi/tbb/task.h:26:11: note: ‘tbb::v1::task’ declared here
   26 | namespace task {
      |           ^~~~
In file included from /home/mozi/oc/atomspace-restful/opencog/events/AtomSpacePublisherModule.cc:48:
/home/mozi/oc/atomspace-restful/opencog/events/AtomSpacePublisherModule.h: In function ‘void tbb_enqueue_lambda(const F&)’:
/home/mozi/oc/atomspace-restful/opencog/events/AtomSpacePublisherModule.h:73:16: error: ‘enqueue’ is not a member of ‘tbb::v1::task’
   73 |     tbb::task::enqueue(*new(tbb::task::allocate_root()) lambda_task<F>(f));
      |                ^~~~~~~
/home/mozi/oc/atomspace-restful/opencog/events/AtomSpacePublisherModule.h:73:40: error: ‘allocate_root’ is not a member of ‘tbb::v1::task’
   73 |     tbb::task::enqueue(*new(tbb::task::allocate_root()) lambda_task<F>(f));
      |                                        ^~~~~~~~~~~~~
/home/mozi/oc/atomspace-restful/opencog/events/AtomSpacePublisherModule.cc: In member function ‘Json::Value opencog::AtomSpacePublisherModule::atomToJSON(opencog::Handle)’:
/home/mozi/oc/atomspace-restful/opencog/events/AtomSpacePublisherModule.cc:196:40: error: cannot convert ‘std::back_insert_iterator<std::vector<opencog::Handle> >’ to ‘const opencog::AtomSpace*’
  196 |         h->getIncomingSet(back_inserter(incomingHandles));
      |                           ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
      |                                        |
      |                                        std::back_insert_iterator<std::vector<opencog::Handle> >

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.