-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheqs.html
102 lines (90 loc) · 4.01 KB
/
eqs.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<!DOCTYPE HTML>
<html lang="en">
<head>
<script async src="https://www.googletagmanager.com/gtag/js?id=G-CD4ENCFV58"></script>
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-64DRFX06T1"></script>
<script >
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-64DRFX06T1');
</script>
<title>CQL</title>
<link rel="shortcut icon" href="../favicon.ico" >
<link rel="StyleSheet" href="css/nstyle.css" type="text/css" media="all" >
<meta charset="utf-8">
<meta name="keywords" content="CQL,SQL,Data Integration, Data Migration, Category Theory, ETL" >
<meta name="description" content="Conexus CQL" >
<meta name="keywords" content="CQL, functorial, category theory, data integration, data migration, categorical databases, SQL, categorical query language" >
</head>
<body>
<div id="content">
<h1>Categorical Databases<img src="logo.png" height="32" style="float: right;" alt="logo" ></h1>
<a href="https://categoricaldata.net">Home</a> |
<a href="download.html">Download</a> |
<a href="examples.html">Getting Started</a> |
<a href="help/index.html" target="_blank">Manual</a> |
<a href="https://github.com/CategoricalData/CQL/wiki" target="_blank">Wiki</a> |
<a href="papers.html">Papers</a> |
<a href="screens.html">Screen Shots</a> |
<a href="https://github.com/categoricalData" target="_blank">Github</a> |
<a href="https://groups.google.com/forum/#!forum/categoricaldata" target="_blank">Google Group</a> |
<a href="https://conexus.com" target="_blank">Conexus</a> |
<a href="mailto:[email protected]">Contact</a>
<br><br>
<hr>
<h2>Path Equations</h2>
<p>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.
</p>
<p>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.
</p>
<p>The schema is defined as:
</p>
<pre>typeside Ty = literal {
java_types
String = "java.lang.String"
java_constants
String = "return input[0]"
}
schema S = literal : Ty {
entities
Employee
Department
foreign_keys
manager : Employee -> Employee
worksIn : Employee -> Department
secretary : Department -> Employee
path_equations
manager.worksIn = worksIn
secretary.worksIn = Department
attributes
first last : Employee -> String
name : Department -> String
}
</pre>
<br>
<p>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:
</p>
<pre>instance I = literal : S {
generators
a b c : Employee
m s : Department
equations
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))
}</pre>
<img src="images/examples/eqs1.png" alt="eqs1" width="700" >
<br>
<p>A screen shot of the entire development is shown below:</p>
<img src="images/examples/eqs2.png" alt="eqs2" width="700" >
</div><!--close main-->
</body>
</html>