Skip to content

Commit

Permalink
add LICENSE
Browse files Browse the repository at this point in the history
  • Loading branch information
dimitri-yatsenko committed Aug 15, 2024
1 parent b31b729 commit 1228855
Show file tree
Hide file tree
Showing 6 changed files with 88 additions and 21 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ jobs:
run: npm install -g mystmd
- name: Build HTML Assets
run: |
cd book
cd book
myst build --html
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: './book/_build/html'
path: './chapters/_build/html'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
22 changes: 20 additions & 2 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
© 2024 DataJoint Inc. All Rights Reserved.
© [Your Name or Your Organization Name] [Year]. All rights reserved.

Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License

By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions.

1. License
You are free to:
- **Share** — copy and redistribute the material in any medium or format

Under the following terms:
- **Attribution** — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
- **NonCommercial** — You may not use the material for commercial purposes.
- **NoDerivatives** — If you remix, transform, or build upon the material, you may not distribute the modified material.

No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits.

2. Notices:
- You do not have to comply with the license for elements of the material in the public domain or where your use is permitted by an applicable exception or limitation.
- No warranties are given. The license may not give you all of the permissions necessary for your intended use. For example, other rights such as publicity, privacy, or moral rights may limit how you use the material.

This repository is for private use only. No part of this work may be reproduced, distributed, or transmitted in any form or by any means without the prior written permission of the author.
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# The DataJoint Textbook
[![License: CC BY-NC-ND 4.0](https://img.shields.io/badge/License-CC%20BY--NC--ND%204.0-lightgrey.svg)](https://creativecommons.org/licenses/by-nc-nd/4.0/)

© 2024 DataJoint Inc. All Rights Reserved.
# Datajoint Workbook

This repository is for private use only. No part of this work may be reproduced, distributed, or transmitted in any form or by any means without the prior written permission of the author.
This is a companion book to the [DataJoint Book](https://dimitri-yatsenko.datajoint.io/datajoint-book).
It contains exercises and assignments for a semester-long course for Database Systems programming.
The course covers the basic concepts for designing, populating, and querying relational databases.

# License

© DataJoint Inc., 2024. All rights reserved.

This work is licensed under the [Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License](LICENSE.md).
You may share the content as long as you give appropriate credit, do not use it for commercial purposes, and do share any modifications.
50 changes: 37 additions & 13 deletions book/02-concepts/03-relational.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ authors:
- name: Dimitri Yatsenko
---

# Definition of Relations
# Originals of Relational Theory

Relations are a key concept in mathematics, representing how different elements from one set are connected to elements of another set. Imagine you have two groups: one group representing clinics and another representing animal species. A relation between these two groups would show which clinics treat which species.
Relations are a key concept in mathematics, representing how different elements from one set are connected to elements of another set of elements.
Imagine you have two set: one set representing clinics and another representing animal species.
A relation between these two sets would indicate, for example, which clinics treat which species.

```{figure} ../images/relations.png
---
Expand All @@ -16,45 +18,67 @@ Relations are a key concept in mathematics, representing how different elements
```

This diagram illustrates two different relations between "Clinics" and "Species." On the left side, the relation shows Clinic 1 is connected to "Dog," Clinic 2 is connected to "Horse," and Clinic 3 is connected to both "Goat" and "Cow." On the right side, the relation changes: Clinic 1 is now connected to "Dog," "Cat," and "Goat," Clinic 2 is connected to "Dog" and "Horse," and Clinic 3 is connected to "Goat."
Each line connecting elements of the two sets is called a *tuple* and represents an ordered pairing of values from the corresponding domains.
Then a relation can be thought of as a set of tuples.
The number of tuples in a relation is called its *cardinality* and the number of domains participating in the relation is its *order*.
This diagram shows binary relations.
Relations can be binary, ternary, or of higher orders.

Mathematically, a relation between two sets \( A \) (e.g., clinics) and \( B \) (e.g., species) is a subset of their Cartesian product \( A $\times$ B \). This means the relation is a collection of ordered pairs \((a, b)\), where each \( a \) is an element from set \( A \), and each \( b \) is an element from set \( B \). In the context of the diagram, each pair represents a specific connection, such as (Clinic 1, Dog) or (Clinic 3, Cow).

These relations are not fixed and can change depending on the context or criteria, as shown by the two different values in the diagram. The flexibility and simplicity of relations make them a powerful tool for representing and analyzing connections in various domains.

# The History of Relational theory

The concept of relations has a rich history that dates back to the mid-19th century. The groundwork for relational theory was first laid by Augustus De Morgan, an English mathematician and logician, who introduced early ideas related to relations in his work on logic and algebra. De Morgan's contributions were instrumental in setting the stage for the formalization of relations in mathematics.

The development of relational theory as a formal mathematical framework is largely credited to Georg Cantor, a German mathematician, in the late 19th century. Cantor is known as the father of set theory, which is the broader mathematical context in which relations are defined. His work provided a rigorous foundation for understanding how sets (collections of objects) interact with each other through relations.

Cantor's set theory introduced the idea that relations could be seen as subsets of Cartesian products, where the Cartesian product of two sets \( A \) and \( B \) is the set of all possible ordered pairs \((a, b)\) where \( a \) is from \( A \) and \( b \) is from \( B \). This formalization allowed for the systematic study of relations and their properties, leading to the development of modern mathematical logic, database theory, and many other fields.

# The Mathematical Power of Relational Theory
### Exercise
Extend these example to a higher order, e.g. ternary relations.


# Mathematical Power
Relational theory is not just a mathematical curiosity; it is a powerful tool that underpins many important concepts in mathematics and computer science. The ability to describe and analyze how different objects are connected is fundamental to many areas of study.

One of the most important applications of relational theory is in the concept of **functions**. A function is a specific type of relation where each element in the domain (the first set) is associated with exactly one element in the codomain (the second set). Functions are essential in nearly every area of mathematics, from calculus to linear algebra.

Relational theory is also crucial in **graph theory**, where relations between objects can be visualized as graphs. In a graph, the objects are represented as vertices, and the relations between them are represented as edges. This visualization helps in understanding complex networks, such as social networks, computer networks, and even biological networks.
Relational theory is a superset of **graph theory**, where relationships between objects can be visualized as graphs.
A directed graph can be thought of as a binary relation between a set of vertices and the same set of vertices again.
Each tuple in such relation represents an edge in the graph.
Graph theory helps in understanding complex networks, such as social networks, computer networks, and even biological networks.
Thus theorems discovered or proven in relational theory also apply to graphs.

Moreover, relational theory is the foundation of **database systems**. The relational model of databases, developed by Edgar F. Codd in the 1970s, uses relations (tables) to organize and query data efficiently. The power of relational databases lies in their ability to handle large amounts of data while maintaining the integrity and accessibility of the information through well-defined relations.

Relational theory also extends to concepts like **equivalence relations** and **order relations**. Equivalence relations partition a set into disjoint subsets called equivalence classes, while order relations arrange elements in a sequence. These concepts are fundamental in areas such as algebra, topology, and analysis.

# Relational Algebra
Relational theory has been shown to deeply interconnected to **first-order logic** and **predicate calculus** at the foundations of mathematics and logic.
Relational theory, which focuses on the study of relations between elements of sets, forms the basis for the predicates used in first-order logic and predicate calculus.
In first-order logic, predicates represent relations, and the logical statements describe how these relations interact.
The equivalence between relational theory and first-order logic was notably formalized by Alfred Tarski in the 1930s.
Tarski demonstrated that every relation can be described by a formula in first-order logic, establishing a profound connection between these mathematical frameworks that has since underpinned much of modern theoretical computer science and logic.

# Relational Algebra and Calculus

Relational algebra is a set of operations that can be used to manipulate and query relations in a formal way. It provides the foundation for querying relational databases, allowing us to combine, modify, and retrieve data stored in tables (relations).

The basic operations in relational algebra include:
Examples of relational operators:

- **Selection (σ):** Selects rows from a relation that satisfy a given condition.
- **Projection (π):** Selects specific columns from a relation.
- **Selection (σ):** Selects tuples from a relation that satisfy a given condition.
- **Projection (π):** Selects specific attributes from a relation.
- **Union (∪):** Combines the tuples from two relations into a single relation.
- **Set Difference (−):** Returns the tuples that are in one relation but not in another.
- **Cartesian Product (×):** Combines every tuple from one relation with every tuple from another.
- **Rename (ρ):** Renames the attributes of a relation.
- **Join (⨝):** Combines related tuples from two relations based on a common attribute.

Such operators together represent an algebra: ways to transform relations into other relations.
Some operators are binary, i.e. they accept two relations as inputs to produce another relation as output.
The operators are *algebraically closed*, i.e. the operators take relations as inputs and produce relations as outputs.
This means elementary operators can be combined in sophisticated ways to compose complex expressions.
**Algebraic closure** is an important concept behind the expressive power of relational operators.

To illustrate a relational operator, let’s consider the **union operator (∪)** using the two relational values from the diagram. The union of these two relations would combine all the connections from both diagrams into a single relation.

In the first value (left side of the diagram), we have the following connections:
Expand Down Expand Up @@ -86,7 +110,7 @@ Relational algebra, with its powerful operators, allows us to query and manipula
|:--|:--|:--|
| **Relation** | **Table** | A set of tuples that share the same attributes from each of the domains in the relation. |
| **Domain** | **Data Type** | The set of permissible values that an attribute can take in any tuple of a relation. |
| **Attribute** | **Column** | A specific property or characteristic of a relation, representing a data type for each value. |
| **Attribute value** | **Field** | The value of an attribute in a specific tuple.
| **Tuple** | **Record** or **Row** | A single entry in a relation, consisting of a set of attribute values. |
| **Attribute** | **Column** | The positional values in the tuples of relation drawn from their corresponding domain. |
| **Attribute value** | **Field** | The positional value in a specific tuple. |
| **Tuple** | **Record** or **Row** | A single element of a relation, containing a value for each attribute. |
:::
18 changes: 17 additions & 1 deletion book/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
---
title: The DataJoint Book
date: 2024-08-12
date: 2024-08-15
authors:
- name: Dimitri Yatsenko
---

[![License: CC BY-NC-ND 4.0](https://img.shields.io/badge/License-CC%20BY--NC--ND%204.0-lightgrey.svg)](https://creativecommons.org/licenses/by-nc-nd/4.0/)

# Welcome

Welcome to **The DataJoint Book**. It book provides a complete introduction to database programming for scientific data and computations.
Expand All @@ -15,3 +17,17 @@ Welcome to **The DataJoint Book**. It book provides a complete introduction to d
:width: 400px
:align: center
```

# License

© DataJoint Inc., 2024. All rights reserved.

This work is licensed under the [Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License](LICENSE.md).
You may share the content as long as you give appropriate credit, do not use it for commercial purposes, and do not share any modifications.

# Contributions

We welcome and appreciate your contributions to this book, whether as a reviewer or as a contributor.
All contributions will be gratefully acknowledged.
You may suggest modifications by submitting an issue in the main [GitHub repository](https://github.com/dimitri-yatsenko/datajoint-book) for this book.
For more substrantial contributions and collaborations, including co-authorship and publications, please contact Dimitri Yatsenko.
Binary file modified book/images/relations.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 1228855

Please sign in to comment.