This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
magik-demo:developer:class:core:schema [2013/07/19 14:32] alex [Schema] |
magik-demo:developer:class:core:schema [2017/07/06 15:24] (current) |
||
---|---|---|---|
Line 6: | Line 6: | ||
Schema describes an SQL schema determined with s set of relations over which attributes finite domain and foreign key constraints can be defined. | Schema describes an SQL schema determined with s set of relations over which attributes finite domain and foreign key constraints can be defined. | ||
+ | {{ :magik-demo:developer:class:core:schema_and_relations.png?nolink&950 |}} | ||
===== Class Attributes ===== | ===== Class Attributes ===== | ||
Line 22: | Line 23: | ||
</code> | </code> | ||
- | ===== Class Constructor ===== | + | ===== Class Constructors ===== |
==== Schema ==== | ==== Schema ==== | ||
<code java> | <code java> | ||
Line 33: | Line 34: | ||
==== Schema ==== | ==== Schema ==== | ||
<code java> | <code java> | ||
- | public Schema (String name, | + | public Schema (java.lang.String name, |
- | java.util.ArrayList<Relation> relations, | + | java.util.ArrayList<Relation> relations, |
- | java.util.ArrayList<ForeignKey> foreignKeys, | + | java.util.ArrayList<ForeignKey> foreignKeys, |
- | java.util.ArrayList<FiniteDomainConstraint> finiteDomainConstraints, | + | java.util.ArrayList<FiniteDomainConstraint> finiteDomainConstraints, |
- | java.util.ArrayList<Query> conjuctiveQueries, | + | java.util.ArrayList<Query> conjuctiveQueries, |
- | java.util.ArrayList<TCStatement> tcStatements) | + | java.util.ArrayList<TCStatement> tcStatements) |
</code> | </code> | ||
| | ||
Line 61: | Line 62: | ||
**Parameters:** | **Parameters:** | ||
- | * relation | + | * relation - list of relation that are in the schema |
- | * foreignKeys | + | * foreignKeys - list of foreign keys related to the relations inside the schema |
- | * finiteDomainConstraints | + | * finiteDomainConstraints - list of finite domain constraints defined for the schema |
- | * conjuctiveQueries | + | * conjuctiveQueries - list of the queries defined for the schema |
- | * tcStatements | + | * tcStatements - list of table completeness statements defined for the schema |
---- | ---- | ||
Line 71: | Line 72: | ||
==== Schema ==== | ==== Schema ==== | ||
<code java> | <code java> | ||
- | public Schema (String name, | + | public Schema (java.lang.String name, |
- | java.util.ArrayList<Relation> relations, | + | java.util.ArrayList<Relation> relations, |
- | java.util.ArrayList<ForeignKey> foreignKeys, | + | java.util.ArrayList<ForeignKey> foreignKeys, |
- | java.util.ArrayList<FiniteDomainConstraint> finiteDomainConstraints, | + | java.util.ArrayList<FiniteDomainConstraint> finiteDomainConstraints) |
- | java.util.ArrayList<Query> conjuctiveQueries, | + | |
- | java.util.ArrayList<TCStatement> tcStatements) | + | |
</code> | </code> | ||
| | ||
- | Constructor for creating a a database schema.\\ | + | Constructor for creating a database schema with only relations, foreign keys and finite domain constraints defined.\\ |
//Called by:// | //Called by:// | ||
- | * it.unibz.inf.magik.test.TestQueryClass | + | * it.unibz.inf.magik.test.TestHardCaseFDCandFK |
- | * it.unibz.inf.magik.test.TestQueryToSQL | + | * it.unibz.inf.magik.test.TestSimpleComparison |
- | * it.unibz.inf.magik.test.TestFK | + | * it.unibz.inf.magik.test.TestValQueryProblem |
- | * it.unibz.inf.magik.test.TestFK2 | + | |
- | * it.unibz.inf.magik.test.TestTCQCReasonerBlackWhiteExample | + | |
- | * it.unibz.inf.magik.test.TestTCQCReasonerPlainCompanyEx | + | |
- | * it.unibz.inf.magik.test.TestQueryGeneralization | + | |
- | * it.unibz.inf.magik.test.TestTCQCReasonerFKandFD | + | |
- | * it.unibz.inf.magik.test.TestTCQCReasonerTCSuggestions | + | |
* it.unibz.inf.magik.test.TestTCQCReasonerUnderFDC | * it.unibz.inf.magik.test.TestTCQCReasonerUnderFDC | ||
- | * it.unibz.inf.magik.test.TestQueryGeneralization | + | * it.unibz.inf.magik.test.TestPrimaryKeyViolation |
- | * it.unibz.inf.magik.test.TestTCQCReasonerPlainSchoolEx | + | |
- | * it.unibz.inf.magik.test.TestDatabaseConnectorClass | + | |
+ | **Parameters:** | ||
+ | * relation - list of relation that are in the schema | ||
+ | * foreignKeys - list of foreign keys related to the relations inside the schema | ||
+ | * finiteDomainConstraints - list of finite domain constraints defined for the schema | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ==== Schema ==== | ||
+ | <code java> | ||
+ | public Schema (java.lang.String name, | ||
+ | boolean localschema, | ||
+ | java.util.ArrayList<Relation> relations, | ||
+ | java.util.ArrayList<ForeignKey> foreignKeys, | ||
+ | java.util.ArrayList<FiniteDomainConstraint> finiteDomainConstraints, | ||
+ | java.util.ArrayList<Query> conjuctiveQueries, | ||
+ | java.util.ArrayList<TCStatement> tcStatements) | ||
+ | </code> | ||
+ | |||
+ | Constructor that instantiates all the parts of the schema | ||
+ | |||
+ | //Called by:// | ||
+ | |||
+ | * it.unibz.inf.magik.web.SessionControl | ||
+ | * it.unibz.inf.magik.web.SessionSchema | ||
**Parameters:** | **Parameters:** | ||
- | * relation | + | * name - name of the schema |
- | * foreignKeys | + | * localschema - //true// if the schema is local, //false// otherwise |
- | * finiteDomainConstraints | + | * relation - list of relation that are in the schema |
- | * conjuctiveQueries | + | * foreignKeys - list of foreign keys related to the relations inside the schema |
- | * tcStatements | + | * finiteDomainConstraints - list of finite domain constraints defined for the schema |
+ | * conjunctiveQueries - list of the query defined for the schema | ||
+ | * tcStatements - list of the table completeness statements for the schema | ||
===== Class Methods ===== | ===== Class Methods ===== | ||
- | ==== applyCondition ==== | + | ==== findRelationByName ==== |
<code java> | <code java> | ||
- | private void applyCondition (java.lang.String termOld, | + | public Relation findRelationByName (java.lang.String relName) |
- | java.lang.String termNew, | + | |
- | java.util.HashMap<java.lang.String, java.lang.String> termEquality) | + | |
- | throws ParseSQLQueryException | + | |
</code> | </code> | ||
- | Apply one or more conditions to a query | + | |
+ | Given a relation name, if exists, it will answer with the relation structure. | ||
**Parameters:** | **Parameters:** | ||
- | * termOld - original term | + | * relName - relation name |
- | * termNew - new term | + | **Returns:** |
- | * termEquality - map for knowing which term are equal | + | * Relation structure if exists, //null// otherwise |
- | **Throws:** | + | |
- | * ParseSQLQueryException | + | |
---- | ---- | ||
+ | |||
+ | ==== getters and setters methods ==== | ||
+ | <code java> | ||
+ | public java.util.ArrayList<ForeignKey> getForeignKeys() | ||
+ | public void setForeignKeys(java.util.ArrayList<ForeignKey> foreignKeys) | ||
+ | |||
+ | public java.util.ArrayList<Query> getConjuctiveQueries() | ||
+ | public void setConjuctiveQueries(java.util.ArrayList<Query> conjuctiveQueries) | ||
+ | |||
+ | public java.util.ArrayList<TCStatement> getTcStatements() | ||
+ | public void setTcStatements(java.util.ArrayList<TCStatement> tcStatements) | ||
+ | |||
+ | public java.lang.String getName() | ||
+ | public void setName(java.lang.String name) | ||
+ | |||
+ | public java.util.ArrayList<Relation> getRelations() | ||
+ | public void setRelations(java.util.ArrayList<Relation> relations) | ||
+ | |||
+ | public java.util.ArrayList<FiniteDomainConstraint> getFiniteDomainConstraints() | ||
+ | public void setFiniteDomainConstraints(java.util.ArrayList<FiniteDomainConstraint> finiteDomainConstraints) | ||
+ | |||
+ | public boolean isLocalSchema() | ||
+ | public void setLocalSchema(boolean localSchema) | ||
+ | |||
+ | public java.lang.String getDbUrl() | ||
+ | public void setDbUrl(java.lang.String dbUrl) | ||
+ | |||
+ | public java.lang.String getDbUser() | ||
+ | public void setDbUser(java.lang.String dbUser) | ||
+ | |||
+ | public java.lang.String getDbPassword() | ||
+ | public void setDbPassword(java.lang.String dbPassword) | ||
+ | |||
+ | public long getId() | ||
+ | public void setId(long id) | ||
+ | |||
+ | </code> | ||
+ | |||
+ | [[magik-demo:developer:class:core:schema|Back to Top]] | [[magik-demo:start|Back to Home Page]] |