Categorical Databaseslogo

Home | Download | Getting Started | Manual | Wiki | Papers | Screen Shots | Github | Google Group | YouTube | Conexus | Contact

Path Equations

Many data integration tasks require constructing many tables connected by foreign keys which satisfy business rules (data integrity constraints). For example, a business rule about employees may require that every employ work in the same department as their manager. Rules such as this are expressed in CQL schemas using path equations. Every instance on a schema is guaranteed to respect its path equations, and all CQL constructions respect path equations.

This example (built in to the IDE with name Employees) defines a schema about employees and departments, with foreign keys taking each employee to the department they work in, each department to the department's secretary, and each employee to their manager. Two path equations enforce that every secretary works in the department they are the secretary for, and that every employee works in the same department as their manager.

The schema is defined as:

typeside Ty = literal { 
		String = "java.lang.String"
		String = "return input[0]"

schema S = literal : Ty {
		manager   : Employee -> Employee
		worksIn   : Employee -> Department
		secretary : Department -> Employee
		manager.worksIn = worksIn
  		secretary.worksIn = Department
		first last	: Employee -> String
		name 		: Department -> String

Every instance on this schema is guaranteed to satisfy the path equations. One way to write instances is as a set of equations, with missing information inferred by CQL:

instance I = literal : S {
		a b c : Employee
		m s : Department
		first(a) = Al
		first(b) = Bob  last(b) = Bo
		first(c) = Carl 
		name(m)  = Math name(s) = CS
		manager(a) = b manager(b) = b manager(c) = c
		worksIn(a) = m worksIn(b) = m worksIn(c) = s
		secretary(s) = c secretary(m) = b 
		secretary(worksIn(a)) = manager(a)
		worksIn(a) = worksIn(manager(a))


A screen shot of the entire development is shown below: