Skip to content

Latest commit

 

History

History
214 lines (153 loc) · 2.5 KB

API.md

File metadata and controls

214 lines (153 loc) · 2.5 KB

Clingo server API

Creating a solver

Method: GET

curl http://localhost:8000/create

Responses:

Status: 200 OK

Created clingo solver.
{
    "type": "InternalError",
    "msg": "Solver::create failed! Solver still running!"
}

Register a (DL) theory

Method: GET

curl http://localhost:8000/register_dl_theory

Responses:

Status: 200 OK

Difference logic theory registered.
{
    "type": "InternalError",
    "msg": "Solver::register_dl_theory failed! DLTheory already registered."
}
{
    "type": "InternalError",
    "msg": "Solver::register_dl_theory failed! Solver has been already started."
}

Add a logic program

Method: POST

curl -i -XPOST http://localhost:8000/add --header 'content-type:text/plain' --data 'p:-not q. q :- not p.'

Responses:

Status: 200 OK

Added data to Solver.
{
    "type": "InternalError",
    "msg": "Solver::add failed! No control object."
}
{
    "type": "InternalError",
    "msg": "Solver::add failed! Solver has been already started."
}
{
    "type": "ClingoError",
    "msg": "InternalError: Call to clingo_control_add() failed, code: Runtime, last: too many messages."
}

Grounding

Method: GET

curl http://localhost:8000/ground

Responses:

Status: 200 OK

Grounding.
{
    "type": "InternalError",
    "msg": "Solver::ground failed! Solver has been already started."
}

Solving

Method: GET

curl http://localhost:8000/solve

Responses:

Status: 200 OK

Solving.
{
    "type": "InternalError",
    "msg": "Solver::solve failed! Solving has already started."
}

Poll models

Method: GET

curl http://localhost:8000/model

Responses:

Status: 200 OK

Running.
{"Model":[113,10]}
Done
{
    "type": "InternalError",
    "msg": "Solver::model failed! Solving has not yet started."
}

Resume solving

Method: GET

curl http://localhost:8000/resume

Responses:

Status: 200 OK

Search is resumed.
{
    "type": "InternalError",
    "msg": "Solver::solve failed! Solving has already started."
}

Finish search

Method: GET

curl http://localhost:8000/close

Responses:

Status: 200 OK

Solve handle closed.
{
    "type": "InternalError",
    "msg": "Solver::close failed! Solving has not yet started."
}