Skip to content

Commit

Permalink
Merge pull request #1 from AlgebraicJulia/package_cleanup
Browse files Browse the repository at this point in the history
Some cleanup before making public
  • Loading branch information
jpfairbanks authored Jul 5, 2020
2 parents f870d57 + aba7081 commit 8acbb37
Show file tree
Hide file tree
Showing 9 changed files with 78 additions and 10 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/TagBot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: TagBot
on:
schedule:
- cron: 0 0 * * *
jobs:
TagBot:
runs-on: ubuntu-latest
steps:
- uses: JuliaRegistries/TagBot@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
21 changes: 21 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Tests

on: [push, pull_request]

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
julia-version: ['1.3', '1.4']
os: [ubuntu-latest]

steps:
- uses: actions/checkout@v2
- name: "Set up Julia"
uses: julia-actions/setup-julia@latest
with:
version: ${{ matrix.julia-version }}
- name: "Run tests"
uses: julia-actions/julia-runtest@master
24 changes: 24 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Files generated by invoking Julia with --code-coverage
*.jl.cov
*.jl.*.cov

# Files generated by invoking Julia with --track-allocation
*.jl.mem

# System-specific files and directories generated by the BinaryProvider and BinDeps packages
# They contain absolute paths specific to the host computer, and so should not be committed
deps/deps.jl
deps/build.log
deps/downloads/
deps/usr/
deps/src/

# Build artifacts for creating documentation generated by the Documenter package
docs/build/
docs/site/

# File generated by Pkg, the package manager, based on a corresponding Project.toml
# It records a fixed state of all packages used by the project. As such, it should not be
# committed for packages, but should be committed for applications that require a static
# environment.
Manifest.toml
14 changes: 12 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@ AutoHashEquals = "15f4f7f2-30c1-5605-9d31-71845cf9641f"
Catlab = "134e5e36-593f-5add-ad60-77f754baafbe"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
LibPQ = "194296ae-ab2e-5f79-8cd4-7183a0a5a0d1"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c"

[compat]
AutoHashEquals = "0.2.0"
Catlab = "0.7.0"
DataFrames = "0.21.0"
LibPQ = "1.4.0"
julia = "1.0"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Test"]
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Algebraic Relations
# AlgebraicRelations.jl

![Tests](https://github.com/AlgebraicJulia/AlgebraicRelations.jl/workflows/Tests/badge.svg)

AlgebraicRelations.jl is a Julia library built to provide an intuitive and elegant method for generating SQL queries. This package provides tooling for defining database schemas, generating query visualizations, and connecting directly up to a PostgreSQL server. This package is built on top of [Catlab.jl](https://github.com/epatters/Catlab.jl) which is the powerhouse behind its functions.

Expand All @@ -8,7 +10,7 @@ The functions of this library may be best explained by showing various examples

### Defining a Schema

The definition of a schema requires two parts, the syntax and the semantics.
The definition of a schema requires two parts, the syntax and the semantics.

#### Syntax
Defining syntax involves defining variable names for the different datatypes and defining the relationships between these datatypes (tables). This is done in the `Catlab.jl` framework, so these definitions look like:
Expand All @@ -27,9 +29,9 @@ manager = Hom(:manager, person, person);
salary = Hom(:salary, person, F);
relation = Hom(:relation, personperson, F)
```
The above section of code defines some relationships that may be seen in the typical business.
The above section of code defines some relationships that may be seen in the typical business.

The types are defined as objects of a [Free Bicategory of Relations](#theory) and given a `symbol` representation.
The types are defined as objects of a [Free Bicategory of Relations](#theory) and given a `symbol` representation.

The tables are defined as relationships between these types with a `symbol` representation. The second and third arguments to the `Hom` functions are respectively the domain and codomain of the relationships. While which type is in which section is irrelevant for SQL tables, it is important when defining queries. One last thing to note is the symbol `` (monoidal product) in the last `Hom` statement. This symbol joins two types, allowing for multiple types in the domain and codomain. To the database, this means nothing more than that, for the table `relation` there are two columns of type `person` and one of type `F`.

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion demo_nb/demo.jl → examples/company_demo/demo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ using Markdown
begin
using Pkg
Pkg.activate(".")
using AlgebraicRelations.QueryLib, AlgebraicRelations.SQL,
using AlgebraicRelations.QueryLib, AlgebraicRelations.SQL,
AlgebraicRelations.Interface;
using Markdown
end
Expand Down
4 changes: 2 additions & 2 deletions src/Query.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ export Ports, Query, make_query,
to_presentation, draw_query
#, plus, zero, coplus, cozero, join, bottom

using Catlab, Catlab.Doctrines, Catlab.Present,
using Catlab, Catlab.Theories, Catlab.Present,
Catlab.WiringDiagrams, Catlab.Graphics,
Catlab.Graphics.Graphviz
import Catlab.Doctrines:
import Catlab.Theories:
Ob, Hom, dom, codom, compose, , , id, otimes, , munit, braid, σ,
dagger, dunit, dcounit, mcopy, Δ, delete, ◊, mmerge, ∇, create, □,
plus, zero, coplus, cozero, meet, top, join, bottom, distribute_dagger,
Expand Down
2 changes: 1 addition & 1 deletion src/SQL.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module SQL
export sql, present_sql, to_sql
using Catlab.Doctrines, Catlab.Present, Catlab.WiringDiagrams
using Catlab.Theories, Catlab.Present, Catlab.WiringDiagrams
using AlgebraicRelations.QueryLib, AlgebraicRelations.SchemaLib
import AlgebraicRelations.SchemaLib: Schema

Expand Down

0 comments on commit 8acbb37

Please sign in to comment.