Building a sample (micro) service in Prolog
2014-09-07 | #microservice #prolog
Sometimes ago I read that some components of IBM Watson were implemented in prolog . So I decided to look at it again after many years… I like Prolog, I studied prolog at Computer Science University of Milan and for my thesis I wrote code in Prolog (and Lisp). proloGraph is a simple example of howto exposing a prolog graph database to other applications, building a REST web service. I used swi-prolog and its http library Install the prolog language (I used the fantastic Linux Debian distribution) withapt-get install swi-prologclone my git repositorygit clone https://github.com/matteoredaelli/proloGraph cd proloGraphRun it withswipl -s webserver.pl -g 'server(8765).'Open the following url with your browserhttp://localhost:8765/vertex?name=user(matteo)and you will get:```
{
“prev”: [ {“from”:“user(gabriele)”, “to”:“user(matteo)”, “rel”:“follow”} ],
“next”: [
{“from”:“user(matteo)”, “to”:“user(ele)”, “rel”:“follow”},
{“from”:“user(matteo)”, “to”:“user(gabriele)”, “rel”:“follow”},
{“from”:“user(matteo)”, “to”:“user(4)”, “rel”:“follow”},
{“from”:“user(matteo)”, “to”:“country(italy)”, “rel”:“lives”},
{“from”:“user(matteo)”, “to”:“hobby(running)”, “rel”:“likes”}
]
}
In these days I’m playing with 
“The microservice architectural style is an approach to developing a single application as a suite of small services, each running in its own process and communicating with lightweight mechanisms, often an HTTP resource API. These services are built around business capabilities and independently deployable by fully automated deployment machinery.” Read the full
This is my first sample microservices written in
An Online demo for the Opensource tool (
