Skip to content
This repository has been archived by the owner on Feb 16, 2024. It is now read-only.

Machine reasoning microservice using Flask and Docker

License

Notifications You must be signed in to change notification settings

inseri-swiss/microservice-reasoning-task

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

microservice-reasoning-task

This microservice is part of the microservice pipline in inseri. The service provides the possibility to conduct machine reasoning using the EYE reasoner.

The microservice accepts both a FileList object sent through an HTML form or JSON data of the file's names and contents.

There's an inseri app to select files locally and send them to the microservice but the service also provides its own HTML interface to select files for a reasoning session.

Run and Develop Locally

Dependencies

  1. Ubuntu 18.04
  2. Python 3
  3. packages: see requirements.txt
  4. Local installation of the EYE reasoner (located in /opt/eye/bin/eye.sh) and its dependencies
    • swipl
    • curl
    • carl
    • cturtle

Install and Run

  1. Clone the repository
  2. cd into the repository
  3. Run pip3 install -r requirements.txt to fetch the needed Python packages (you might want to do this within a virtual Python environment)
  4. Run python3 reasoning-task.py to start the service
  5. POST FileList object or JSON to http://localhost:50001 (see below)
  6. Or use the GUI to create the POST by opening:

Run with Docker

  1. Build the image: [sudo] docker build -t nieine/microservice-reasoning-task .
  2. Run the container: [sudo] docker run -p 50001:50001 nieine/microservice-reasoning-task
  3. POST FileList object or JSON to http://localhost:50001 (see below)
  4. Or use the GUI to create the POST by opening:

Call the Service in a RESTful Way

If the service is running, you can POST either a FileList object or JSON. Either way, you will receive a turtle file as a response.

FileList

Currently, please use the GUI interface and the developer tools to get an idea on how the FileList looks like.

JSON

Body, e.g.:

{
    "data": {
        "files": [
            {
                "file": "cindy.ttl",
                "content": "@prefix ppl: <http://example.org/people#>. @prefix foaf: <http://xmlns.com/foaf/0.1/>. ppl:Cindy foaf:knows ppl:John."
            }
        ],
        "urls": [
        ]
    },
    "rules": {
        "files": [
            {
                "file": "cindyRule.n3",
                "content": "@prefix ppl: <http://example.org/people#>. @prefix foaf: <http://xmlns.com/foaf/0.1/>. { ppl:Cindy foaf:knows ppl:John. } => { ppl:John foaf:knows ppl:Cindy. } ."
            }
        ],
        "urls": [
        ]
    },
    "queries": {
        "files": [
            {
                "file": "cindyQuery.n3",
                "content": "{ ?a ?b ?c. } => { ?a ?b ?c. }."
            }
        ],
        "urls": [
        ]
    }
}

Publish on Dockerhub

  1. Build the image: [sudo] docker build -t nieine/microservice-reasoning-task:YYYY-MM-DD .
  2. Push the image: [sudo] docker push nieine/microservice-reasoning-task:YYYY-MM-DD

About

Machine reasoning microservice using Flask and Docker

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 76.4%
  • Prolog 20.2%
  • HTML 1.1%
  • Python 0.9%
  • Lex 0.6%
  • Makefile 0.5%
  • Other 0.3%