Prolog as a Querying Language for MongoDB
Today's database systems have shown to be capable of supporting AI applications that demand a lot of data processing. To this end, these systems incorporate powerful querying languages that go far beyond the mere retrieval of data, and provide sophisticated facilities for data processing as well. In the case of SQL, the language has been even demonstrated to be Turing-complete in some implementations of the language. In the area of NoSQL databases, a widely adopted one nowadays is the MongoDB database. Queries in MongoDB databases are represented as sequential stages within an aggregation pipeline where each stage defines a transformation of the input data, and passes the transformed data to the next stage. But aggregation queries tend to become rather large for more complex computational problems, lack organization into re-usable pieces, and are thus hard to debug and maintain. We propose a new database querying language called Mongolog which is syntactically a subset of the Prolog language, and we define its operational semantics through translations into aggregation pipelines. To this end, we make use of and extend the formal framework of the MQuery language which characterizes the aggregation framework set-theoretically.
READ FULL TEXT