Browse Source

Cleaned up some structure, added compat entries, removed unnecessary dependencies, and added a gitignore and github actions

pull/1/head
Micah Halter 6 months ago
parent
commit
60bc3c8b06
Signed by: mehalter GPG Key ID: 4224A6EA9A8CAAA8
9 changed files with 76 additions and 10 deletions
  1. +11
    -0
      .github/workflows/TagBot.yml
  2. +21
    -0
      .github/workflows/test.yml
  3. +24
    -0
      .gitignore
  4. +12
    -2
      Project.toml
  5. +4
    -4
      README.md
  6. +0
    -0
      examples/company_demo/Project.toml
  7. +1
    -1
      examples/company_demo/demo.jl
  8. +2
    -2
      src/Query.jl
  9. +1
    -1
      src/SQL.jl

+ 11
- 0
.github/workflows/TagBot.yml View File

@ -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
- 0
.github/workflows/test.yml View File

@ -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
- 0
.gitignore View File

@ -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

+ 12
- 2
Project.toml View File

@ -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"]

+ 4
- 4
README.md View File

@ -1,4 +1,4 @@
# Algebraic Relations
# AlgebraicRelations.jl
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.
@ -8,7 +8,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:
@ -27,9 +27,9 @@ manager = Hom(:manager, person, person);
salary = Hom(:salary, person, F);
relation = Hom(:relation, person⊗person, 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`.


demo_nb/Project.toml → examples/company_demo/Project.toml View File


demo_nb/demo.jl → examples/company_demo/demo.jl View File

@ -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

+ 2
- 2
src/Query.jl View File

@ -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,


+ 1
- 1
src/SQL.jl View File

@ -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


Loading…
Cancel
Save