deduCtiOn and abduCtiOn (COCO) reasoner.
Use the provided new_coco_project.py script to create a new project.
python3 scripts/new_coco_project.py <project_name>Implement a database class that inherits from a coco::coco_db implementation. The coco::mongo_db implementation is provided as an example.
#include "mongo_db.h"
class my_db : public coco::mongo_db
{
public:
my_db(const std::string &root = COCO_NAME, const std::string &mongodb_uri = MONGODB_URI(MONGODB_HOST, MONGODB_PORT)) : mongo_db(root, mongodb_uri) {}
};Implement your application class that inherits from coco::coco_core and pass the database to the base class constructor.
#include "coco_core.h"
class my_app : public coco::coco_core
{
public:
my_app(my_db &db) : coco_core(db) {}
};The application can be used to extend the COCO reasoner with your own functionality, defining your own User Defined Functions (UDFs) and User Defined Types (UDTs).
Implement a listener class that inherits from coco::coco_listener and pass the application to the base class constructor.
#include "coco_listener.h"
class my_listener : public coco::coco_listener
{
public:
my_listener(my_app& app) : coco_listener(app) {}
};COCO relies on CLIPS for reacting to the dynamic changes which happen into the urban environment.
- Download CLIPS v6.4.1 and unzip the zip file into the
clips_core_source_641folder. - Reach the
clips_core_source_641/corefolder and compile CLIPS throughmake release_cpp. - Copy all the header files into the
/usr/local/include/clipsfolder throughsudo cp *.h /usr/local/include/clips/. - Copy the library into the
/usr/local/libfolder throughsudo cp libclips.a /usr/local/lib/.
COCO relies on MongoDB for storing the data which is collected from the sensors and the participatory data. It is required, in particular, to install the cxx drivers for connecting COCO to a MongoDB database.
Installig OpenSSL
sudo apt-get install libssl-devInstalling MongoDB cxx drivers
Download and configure the mongoc driver.
git clone https://github.com/mongodb/mongo-c-driver.git
cd mongo-c-driver
python build/calc_release_version.py > VERSION_CURRENT
mkdir cmake-build
cd cmake-build
cmake -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF ..Compile and install it.
cmake --build .
sudo cmake --build . --target installDownload the mongocxx driver.
curl -OL https://github.com/mongodb/mongo-cxx-driver/releases/download/r3.9.0/mongo-cxx-driver-r3.9.0.tar.gz
tar -xzf mongo-cxx-driver-r3.9.0.tar.gz
cd mongo-cxx-driver-r3.9.0/buildConfigure the driver.
cmake .. -DCMAKE_BUILD_TYPE=Release -DMONGOCXX_OVERRIDE_DEFAULT_INSTALL_PREFIX=OFFBuild and install il.
cmake --build .
sudo cmake --build . --target installInstalling MongoDB (optional)
For installation of MongoDB refer to the official documentation.