From bca1f5bb6a73f1a67ec9605361d9c4ce2e81d1ba Mon Sep 17 00:00:00 2001 From: David Rajaratnam Date: Mon, 22 Jul 2019 11:35:49 +1000 Subject: [PATCH] Documentation update --- docs/clorm/background.rst | 44 +++++++++++---------------------------- 1 file changed, 12 insertions(+), 32 deletions(-) diff --git a/docs/clorm/background.rst b/docs/clorm/background.rst index e1bfade..c4f22d9 100644 --- a/docs/clorm/background.rst +++ b/docs/clorm/background.rst @@ -5,39 +5,18 @@ Object Relational Mapping (ORM) ------------------------------- `ORM `_ interfaces are -a common way of interacting with relational databases and there are some -well-known Python ORMs (e.g., SQLAlchemy and Peewee). Fundamentally all ORMs -provide a way of matching rows in a database table (or database view) to Python -objects whose member variables correspond to the fields of the database table. +a common way (especially in Python) of interacting with relational databases and +there are some well-known Python ORMs (e.g., SQLAlchemy and +Peewee). Fundamentally all ORMs provide a way of matching rows in a database +table (or database view) to Python objects whose member variables correspond to +the fields of the database table. As well as mapping table rows to program objects, ORMs also provide facilities for building SQL queries using high-level primitives; rather than dealing with raw SQL strings. -Answer Set Programming (ASP) and Clingo ---------------------------------------- - -`Answer Set Programming (ASP) -`_, not to be confused -with Microsoft Active Server Pages or ASP.NET, is an AI/logic based language for -modelling and solving combinatorial optimisation problems. ASP has a -Prolog-style language for specifying problems in terms of predicates and the -relations between them. The solver then generates solutions (called *models* or -*answer sets*) consisting of a sets of ground facts that are (minimally) -consistent with these definitions. - -`Clingo `_ is the leading open-source ASP solver. It can -be run as a stand-alone executable or integrated as a library into other -languages. It has very good support for Python with an extensive API for -interacting with the solver. - -Clingo supports Python in two ways: - -* running Clingo from within a Python application. -* calling Python functions from within an ASP program, - -An ORM Interface to Clingo --------------------------- +An ORM Interface for Clingo +--------------------------- While the Clingo Python API is both extensive and flexible it is also fairly low-level when it comes to getting data into, and out of, the solver. As a @@ -55,8 +34,9 @@ that are difficult to detect. An ORM interface can help to alleviate these problems. The ORM definitions that map ASP predicates to Python objects are defined in a single location and the -ASP to Python translation is made clear; since it is not written directly by -the developer but instead is generated from the ORM class definitions. +ASP to Python translations are all generated automatically from the ORM class +definitions. -Hence a Clingo ORM interface can make it easier to integrate Clingo and Python -and to write Python code that is more readable and easier to maintain. +Hence, we would argue that a Clingo ORM interface can make it easier to +integrate Clingo and Python and to write Python code that is more readable and +easier to maintain.