Google has unveiled the open source Logica programming language, a logic programming language designed to “solve problems of SQL” by using syntax of mathematical propositional logic rather than natural language.
Introduced on April 12 as a successor to Google’s Yedalog language, Logica is a Datalogic-like logic language. Meant for engineers, data scientists, and other specialists, it compiles code to SQL and runs on the Google BiqQuery cloud-based data warehouse, with experimental support for PostgreSQL and SQLite. But Logica is more concise and supports reusable abstractions unlike SQL. It also supports modules and imports, can be used from an interactive Python notebook, and makes testing queries easy and natural, Google developers wrote in a blog post.
Logica solves problems of SQL by using syntax of mathematical logic rather than natural English language. Google cited issues with SQL such as the verbosity of constructing statements from English words and limited support for abstraction. Logica extends classical logic programming syntax, notably with aggregation. It is billed as a declarative language for data manipulation.
The Google developers behind the Logica open source project encourage its use in the following scenarios:
- Where logic programming is already being used but a user needs more computational power
- Where SQL is being used but the user is not satisfied with its readability
- Where developers want to learn logic programming and apply it to big data processing
Google has set up a tutorial to help developers learn Logica. To run logic programs on Google Cloud BigQuery, developers will need to open a Google Cloud Project. Once a project is established, developers can run Logica programs in Colab by providing a project ID. To run Logica locally, developers need Python 3.