User Tools

Site Tools


magik-demo:developer:magik-architecture

MAGIK Architecture

Overall Architecture

Interface

  • Web interface: JavaServer Pages (JSP) that allow users to interact with the system. Related package: WebContent.
  • JavaBeans: the Model component in Model-View-Controller (MVC) architecture, that connects View component (JSP) with Controller component (Java). Related package: it.unibz.inf.magik.beans.

Reasoning

  • MAGIK business logic: the Controller component that process users input, run the reasoner (DLV engine), run the Prolog code using TuProlog, read/write to/from data layer (database), and return an output to users. Related package: it.unibz.inf.magik.web.
  • Core: module which contains all related classes to encode TC-QC Java objects that is needed by DLV engine, and analyzes the returned answer set program by DLV engine. Also contains all related classes to encode schema, query and TC-statements for generating input file for the Prolog code that return the possible specializations of the query. Related packages: it.unibz.inf.magik.core, it.unibz.inf.magik.additional.

Data

  • Database connector: module to manage database connection, including read/write database schema & relation and evaluate SQL queries. Related package: it.unibz.inf.magik.db.
  • Hibernate: module to accomodate Hibernate that provides the storage and retrieval of Java objects via Object/Relational Mapping. Related package: it.unibz.inf.magik.hibernate.

Other

  • DLV Wrapper: a Java library that wraps the DLV system inside an external application, allowing to embed disjunctive logic programs inside Object-Oriented source code.
  • PostgreSQL JDBC Driver: a Java library that allows Java programs to connect to a PostgreSQL database using standard, database independent Java code.
  • Exception handler: module to handle exceptions that may occur within the system. Related package: it.unibz.inf.magik.exception.
  • Test: JUnit testing module to verify/validate the core classes. Related package: it.unibz.inf.magik.test.

Back to Top | Back to Home Page

Interface Layer

WebContent
it.unibz.inf.magik.beans

Each JavaBeans class corresponds with the HTML form in the JavaServlet Pages.

Back to Top | Back to Home Page

Reasoning Layer

it.unibz.inf.magik.web
it.unibz.inf.magik.core
  • Term → Class for term (variable or constant)
  • Atom → Class for atom (array of terms)
  • Query → Class for query that can be logically seen as a conjunction of relations.
  • TC-Statement → Class for table completeness statement as it is defined by Razniewski&Nutt(VLDB2011).
  • Schema → Class for SQL schema with a set of relations, over which over finite domain and foreign key constraints can be defined.
  • Relation → Class for SQL relation defined with name, arity, and primary key definition.
  • Foreign Key → Class for foreign key dependency between two relations from the common schema (sourceRelation[sourceAttr] → targetRelation[targetKey]).
  • Finite Domain Constraints → Class for finite domain constraint defined over a single attribute in a relation.
  • QueryGeneralization → Class for generating (if exists) the least specific specialization query of the given query. How it works
  • QuerySpecialization → Class for generating (if exists) the most specific generalization query(ies) of the given query.
  • ProgramGenerator → Class for translating the schema, constraints and query into DLV format
  • <fc blue>ConjunctiveQuery</fc> → Class for traslating query into a conjunctive query.
  • <fc blue>TCSuggestions</fc> → Class for suggested table completeness statements over a query so that the query will be complete.
  • <fc blue>AuxiliaryFunctions</fc> → Class for auxiliary functions used by some java classes.
  • <fc blue>CycleDetector</fc> → Class for detecting cycle inside foreign keys.
  • <fc blue>DLV_Engine</fc> → Class for setting and running the DLV library.
  • <fc blue>Preprocessor</fc> → Class for preprocessing the query in order to find (possibly) error or violations
  • QueryMinimizer

Back to Top | Back to Home Page

Data Layer

it.unibz.inf.magik.db
it.unibz.inf.magik.hibernate
  • <fc blue>HibernateConnector</fc> → Class for Hibernate connection.
  • <fc blue>MagikNamingStrategy</fc> → Class for custom naming strategy for table name in the database (in the format of <username_schemaName_tableName>), with provided username and schemaName, which is used to store objects.
  • Configuration files:
    • FiniteDomainConstraint.hbm.xml → configuration file for storing finite domain constraints
    • ForeignKey.hbm.xml → configuration file for storing foreign keys
    • Query.hbm.xml → configuration file for storing queries
    • TCStatement.hbm.xml → configuration file for storing table completeness statements
    • hibernate.cfg.xml → configuration file for Hibernate connection

Back to Top | Back to Home Page

Misc

it.unibz.inf.magik.exception
  • <fc blue>ContextException</fc> → Class for exception handler for adding/updating relation, foreign key, finite domain constraint, and table completeness statement.
  • <fc blue>ParseSQLQueryException</fc> → Class for exception handler for SQL query parsing.
  • <fc blue>CycleException</fc> → Class for exception handler for cycle detection.
  • <fc blue>PrimaryKeyViolationException</fc> → Class for exception handler for primary key violation detection.
it.unibz.inf.magik.test
  • <fc blue>AllTests</fc>
  • <fc blue>CycleDetectionTest</fc>
  • <fc blue>TestAtomClass</fc>
  • <fc blue>TestDatabaseConnectorClass</fc>
  • <fc blue>TestFK</fc>
  • <fc blue>TestFK2</fc>
  • <fc blue>TestHardCaseFDCandFK</fc>
  • <fc blue>TestPreprocessor</fc>
  • <fc blue>TestPrimaryViolation</fc>
  • <fc blue>TestQueryClass</fc>
  • <fc blue>TestQueryGeneralization</fc>
  • <fc blue>TestQueryToSQL</fc>
  • <fc blue>TestSimpleComparison</fc>
  • <fc blue>TestTCQCReasonerBlackWhiteExample</fc>
  • <fc blue>TestTCQCReasonerFKandFD</fc>
  • <fc blue>TestTCQCReasonerPlainCompanyEx</fc>
  • <fc blue>TestTCQCReasonerPlainSchoolEx</fc>
  • <fc blue>TestTCQCReasonerTCSuggestions</fc>
  • <fc blue>TestTCQCReasonerUnderFDC</fc>
  • <fc blue>TestTermClass</fc>
  • <fc blue>TestValQueryProblem.</fc>
  • <fc blue>UnificationTest</fc>

Back to Top | Back to Home Page

magik-demo/developer/magik-architecture.txt · Last modified: 2017/07/06 15:24 (external edit)