This shows you the differences between two versions of the page.
magik-demo:developer:magik-architecture [2013/07/23 11:51] alex [MAGIK Architecture] |
magik-demo:developer:magik-architecture [2017/07/06 15:24] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | {{:magik-demo:magik-logo.jpg?900|}} | ||
- | |||
- | ====== MAGIK Architecture ====== | ||
- | |||
- | Content: | ||
- | * [[#Overall Architecture|Overall Architecture]] | ||
- | * 3 Layers | ||
- | * [[#Interface Layer|Interface Layer]] | ||
- | * [[#Reasoning Layer|Reasoning Layer]] | ||
- | * [[#Data Layer|Data Layer]] | ||
- | * [[#Misc|Misc]] | ||
- | |||
- | [[magik-demo:user:query approximation:generalization|Query Approximation]] | ||
- | ===== Overall Architecture ===== | ||
- | {{ :magik-demo:developer:magik.png?nolink&700 }} | ||
- | |||
- | === Interface === | ||
- | * **Web interface**: JavaServer Pages (JSP) that allow users to interact with the system. Related package: ''[[#WebContent|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|it.unibz.inf.magik.beans]]''. | ||
- | |||
- | === Reasoning === | ||
- | * **MAGIK business logic**: the //Controller// component that process users input, run the reasoner (DLV engine), read/write to/from data layer (database), and return an output to users. Related package: ''[[#it.unibz.inf.magik.web|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. Related packages: ''[[#it.unibz.inf.magik.core|it.unibz.inf.magik.core]]'', ''[[#it.unibz.inf.magik.additional|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|it.unibz.inf.magik.db]]''. | ||
- | * **Hibernate**: module to accomodate [[http://www.hibernate.org/|Hibernate]] that provides the storage and retrieval of Java objects via Object/Relational Mapping. Related package: ''[[#it.unibz.inf.magik.hibernate|it.unibz.inf.magik.hibernate]]''. | ||
- | |||
- | === Other === | ||
- | * **[[http://www.dlvsystem.com/dlvsystem/index.php/DLV_WRAPPER|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. | ||
- | * **[[http://jdbc.postgresql.org/|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|it.unibz.inf.magik.exception]]''. | ||
- | * **Test**: JUnit testing module to verify/validate the core classes. Related package: ''[[#it.unibz.inf.magik.test|it.unibz.inf.magik.test]]''. | ||
- | |||
- | |||
- | |||
- | [[magik-demo:developer:magik-architecture|Back to Top]] | [[magik-demo:start|Back to Home Page]] | ||
- | ===== Interface Layer ===== | ||
- | == WebContent == | ||
- | * ''[[magik-demo:developer:magik-business-logic#index.jsp|index.jsp]]'' | ||
- | * ''schema/'' | ||
- | * ''[[magik-demo:developer:magik-business-logic#schema/index.jsp|index.jsp]]'' that includes: | ||
- | * ''viewRelation.jsp'' | ||
- | * ''[[magik-demo:developer:magik-business-logic#schema/edit.jsp|edit.jsp]]'' that includes: | ||
- | * ''showRelations.jsp'' | ||
- | * ''[[magik-demo:developer:magik-business-logic#schema/editConnection.jsp|editConnection.jsp]]'' | ||
- | * ''[[magik-demo:developer:magik-business-logic#schema/editRelation.jsp|editRelation.jsp]]'' | ||
- | * ''constraints/'' | ||
- | * ''[[magik-demo:developer:magik-business-logic#constraints/index.jsp|index.jsp]]'' that includes: | ||
- | * ''showFDC.jsp'' | ||
- | * ''showFK.jsp'' | ||
- | * ''showQuery.jsp '' | ||
- | * ''showTC.jsp'' | ||
- | * ''showQuerySuggestion.jsp'' | ||
- | * ''showTCSuggestion.jsp'' | ||
- | * ''[[magik-demo:developer:magik-business-logic#constraints/editFK.jsp|editFK.jsp]]'' | ||
- | * ''[[magik-demo:developer:magik-business-logic#constraints/editFDC.jsp|editFDC.jsp]]'' | ||
- | * ''[[magik-demo:developer:magik-business-logic#constraints/editTC.jsp|editTC.jsp]]'' | ||
- | * ''[[magik-demo:developer:magik-business-logic#constraints/editQuery.jsp|editQuery.jsp]]'' | ||
- | |||
- | == it.unibz.inf.magik.beans == | ||
- | Each JavaBeans class corresponds with the HTML form in the JavaServlet Pages. | ||
- | * <fc blue>''ShowSchemaBean''</fc>, to get the selected schema to be processed (''[[magik-demo:developer:magik-business-logic#schema/index.jsp|schema/index.jsp]]'') | ||
- | * <fc blue>''EditSchemaBean''</fc>, to get the schema name (''[[magik-demo:developer:magik-business-logic#schema/edit.jsp|schema/edit.jsp]]'') | ||
- | * <fc blue>''EditRelationBean''</fc>, to get the attributes of relation (''[[magik-demo:developer:magik-business-logic#schema/editRelation.jsp|schema/editRelation.jsp]]'') | ||
- | * <fc blue>''EditConnectionBean''</fc>, to get the information of database connection details (''[[magik-demo:developer:magik-business-logic#schema/editConnection.jsp|schema/editConnection.jsp]]'') | ||
- | * <fc blue>''ShowContraintsBean''</fc>, to get the selected constraints and query to be processed (''[[magik-demo:developer:magik-business-logic#constraints/index.jsp|constraints/index.jsp]]'') | ||
- | * <fc blue>''EditForeignKeyBean''</fc>, to get the attributes of foreign key (''[[magik-demo:developer:magik-business-logic#constraints/editFK.jsp|constraints/editFK.jsp]]'') | ||
- | * <fc blue>''EditFiniteDomainBean''</fc>, to get the attributes of finite domain constraint (''[[magik-demo:developer:magik-business-logic#constraints/editFDC.jsp|constraints/editFDC.jsp]]'') | ||
- | * <fc blue>''EditTCStatementBean''</fc>, to get the attributes of TC statement (''[[magik-demo:developer:magik-business-logic#constraints/editTC.jsp|constraints/editTC.jsp]]'') | ||
- | * <fc blue>''EditQueryBean''</fc>, to get the attributes of query (''[[magik-demo:developer:magik-business-logic#constraints/editQuery.jsp|constraints/editQuery.jsp]]'') | ||
- | |||
- | [[magik-demo:developer:magik-architecture|Back to Top]] | [[magik-demo:start|Back to Home Page]] | ||
- | ===== Reasoning Layer ===== | ||
- | == it.unibz.inf.magik.web == | ||
- | * ''[[magik-demo:developer:class:sessioncontrol|SessionControl]]'' → Class for controlling the active session of the application, including process users input, run the reasoner (DLV engine), read/write to/from data layer (database), and return an output to users. | ||
- | * Read/write schemas from/to database : ''[[magik-demo:developer:class:sessioncontrol#readDBSchemas|readDBSchemas]]'', ''[[magik-demo:developer:class:sessioncontrol#addDbConnection|addDbConnection]]'', ''[[magik-demo:developer:class:sessioncontrol#addDbSchema|addDbSchema]]'' | ||
- | * Write objects to database (via Hibernate) : ''[[magik-demo:developer:class:sessioncontrol#hibernateSaveObject|hibernateSaveObject]]'' | ||
- | * Add/edit/delete schema : ''[[magik-demo:developer:class:sessioncontrol#addSchema|addSchema]]'', ''[[magik-demo:developer:class:sessioncontrol#updateSchema|updateSchema]]'', ''[[magik-demo:developer:class:sessioncontrol#deleteSchema|deleteSchema]]'' | ||
- | * Add/edit/delete relation of the schema : ''[[magik-demo:developer:class:sessioncontrol#addRelation|addRelation]]'', ''[[magik-demo:developer:class:sessioncontrol#updateRelation|updateRelation]]'', ''[[magik-demo:developer:class:sessioncontrol#deleteRelation|deleteRelation]]'' | ||
- | * Add/edit/delete foreign key of the schema : ''[[magik-demo:developer:class:sessioncontrol#addForeignKey|addForeignKey]]'', ''[[magik-demo:developer:class:sessioncontrol#updateForeignKey|updateForeignKey]]'', ''[[magik-demo:developer:class:sessioncontrol#deleteForeignKey|deleteForeignKey]]'' | ||
- | * Add/edit/delete finite domain constraint : ''[[magik-demo:developer:class:sessioncontrol#addFDC|addFDC]]'', ''[[magik-demo:developer:class:sessioncontrol#updateFDC|updateFDC]]'', ''[[magik-demo:developer:class:sessioncontrol#deleteFDC|deleteFDC]]'' | ||
- | * Add/edit/delete TC statement : ''[[magik-demo:developer:class:sessioncontrol#addTCStatement|addTCStatement]]'', ''[[magik-demo:developer:class:sessioncontrol#updateTCStatement|updateTCStatement]]'', ''[[magik-demo:developer:class:sessioncontrol#deleteTCStatement|deleteTCStatement]]'' | ||
- | * Add/edit/delete query : ''[[magik-demo:developer:class:sessioncontrol#addSQLQuery|addSQLQuery]]'', ''[[magik-demo:developer:class:sessioncontrol#updateSQLQuery|updateSQLQuery]]'', ''[[magik-demo:developer:class:sessioncontrol#deleteQuery|deleteQuery]]'' | ||
- | * Displaying information of query reasoning result : ''[[magik-demo:developer:class:sessioncontrol#encodingProgram|encodingProgram]]'', ''[[magik-demo:developer:class:sessioncontrol#printQueryResultHTML|printQueryResultHTML]]'', ''[[magik-demo:developer:class:sessioncontrol#isQueryComplete|isQueryComplete]]'', ''[[magik-demo:developer:class:sessioncontrol#approximateQuery|approximateQuery]]'' | ||
- | * Import pre-defined sample schema : ''[[magik-demo:developer:class:sessioncontrol#importSampleSchema|importSampleSchema]]'' | ||
- | * <fc blue>''SessionSchema''</fc> extends <fc blue>''Schema''</fc>, with the information of selected foreign keys, finite domain constraints, and table completeness statements in the active session, also the information of database connection details (only for remote schema). | ||
- | |||
- | == it.unibz.inf.magik.core == | ||
- | * ''[[magik-demo:developer:class:core:term|Term]]'' → Class for term (variable or constant) | ||
- | * ''[[magik-demo:developer:class:core:atom|Atom]]'' → Class for atom (array of terms) | ||
- | * ''[[magik-demo:developer:class:core:query|Query]]'' → Class for query that can be logically seen as a conjunction of relations. | ||
- | * ''[[magik-demo:developer:class:core:tcstatement|TC-Statement]]'' → Class for table completeness statement as it is defined by Razniewski&Nutt(VLDB2011). | ||
- | * ''[[magik-demo:developer:class:core:schema|Schema]]'' → Class for SQL schema with a set of relations, over which over finite domain and foreign key constraints can be defined. | ||
- | * ''[[magik-demo:developer:class:core:relation|Relation]]'' → Class for SQL relation defined with name, arity, and primary key definition. | ||
- | * ''[[magik-demo:developer:class:core:foreignkey|Foreign Key]]'' → Class for foreign key dependency between two relations from the common schema (sourceRelation[sourceAttr] → targetRelation[targetKey]). | ||
- | * ''[[magik-demo:developer:class:core:finitedomainconstraints|Finite Domain Constraints]]'' → Class for finite domain constraint defined over a single attribute in a relation. | ||
- | * ''[[magik-demo:developer:class:core:querygeneralization|QueryGeneralization]]'' → Class for generating (if exists) the least specific specialization query of the given query.[[magik-demo:developer:generalization-howitworks|How it works]] | ||
- | * <fc blue>''QuerySpecialization''</fc> → Class for generating (if exists) the most specific generalization query(ies) of the given query. | ||
- | * <fc blue>''ProgramGenerator''</fc> → 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'' | ||
- | |||
- | |||
- | [[magik-demo:developer:magik-architecture|Back to Top]] | [[magik-demo:start|Back to Home Page]] | ||
- | ===== Data Layer ===== | ||
- | == it.unibz.inf.magik.db == | ||
- | * ''[[magik-demo:developer:class:databaseconnector|DatabaseConnector]]'' → Class for database connection. Database connection is established with PostgreSQL JDBC Driver, a Java library that allows Java programs to connect to a PostgreSQL database. | ||
- | * Read schemas relations, and foreign keys from database : ''[[magik-demo:developer:class:databaseconnector#getSchemaType|getSchemaType]]'', ''[[magik-demo:developer:class:databaseconnector#getSchemas|getSchemas]]'', ''[[magik-demo:developer:class:databaseconnector#getDbSchemas|getDbSchemas]]'', ''[[magik-demo:developer:class:databaseconnector#getSchema|getSchema]]'', ''[[magik-demo:developer:class:databaseconnector#readRelation|readRelation]]'', ''[[magik-demo:developer:class:databaseconnector#readForeignKeys|readForeignKeys]]'' | ||
- | * Add/Edit/Delete schema (and relation) : ''[[magik-demo:developer:class:databaseconnector#addRelation|addRelation]]'', ''[[magik-demo:developer:class:databaseconnector#addSchema|addSchema]]'', ''[[magik-demo:developer:class:databaseconnector#deleteSchema|deleteSchema]]'', ''[[magik-demo:developer:class:databaseconnector#updateSchema|updateSchema]]'' | ||
- | * Get and add remote database connection information (only for remote database schema) : ''[[magik-demo:developer:class:databaseconnector#getDbUrl|getDbUrl]]'', ''[[magik-demo:developer:class:databaseconnector#getDbUser|getDbUser]]'', ''[[magik-demo:developer:class:databaseconnector#getDbPassword|getDbPassword]]'', ''[[magik-demo:developer:class:databaseconnector#addDbConnection|addDbConnection]]'' | ||
- | * Evaluate SQL query (only for remote database schema) : ''[[magik-demo:developer:class:databaseconnector#evaluateQuery|evaluateQuery]]'' | ||
- | * Validate and add user : ''[[magik-demo:developer:class:databaseconnector#validateUser|validateUser]]'', ''[[magik-demo:developer:class:databaseconnector#addUser|addUser]]'' | ||
- | * Initialize required tables in installation process (for localhost application version) : ''[[magik-demo:developer:class:databaseconnector#installation|installation]]'' | ||
- | |||
- | == 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 | ||
- | |||
- | |||
- | [[magik-demo:developer:magik-architecture|Back to Top]] | [[magik-demo:start|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> | ||
- | |||
- | [[magik-demo:developer:magik-architecture|Back to Top]] | [[magik-demo:start|Back to Home Page]] | ||
- |