A relational algebra calculator
development
branchyarn install
to install all dependenciesyarn serve
to locally run the webapp on port 8088development
branchyarn install
to install all dependenciesyarn build
to create release build in the dist
folderdist
folder somewhere outside of the repositorygh-pages
dist
foldersrc/locales/languages.csv
as csv with e.g. libreoffice (use ',' as delimiter and '"' as string marker)writeLanguageFiles.py
which generates the json files based on the csvsrc/calc2/i18n.tsx
add an import for this file as well as initializing it in the i18n init function (see other languages for examples)src/calc2/calculator.entry.tsx
and src/calc2/calculator.entry.tsx
There are two ways to provide a group of tables:
In the group's description markdown code can be used but javascript code will be removed for security reasons.
Static groups are loaded from the file data/local_groups
.
In this file multiple groups can be declared in the following text format.
A group starts with the group header:
group:sample group
description:this is the <b>description</b>
Every keyword can be followed by either a colon and a single line of content terminated with a line break or the content is surrounded with '[[' and ']]' if the content spans multiple lines.
group:sample group
description[[this is the <b>description</b>
that spans multiple lines]]
Headers can also be provided for different languages e.g. description@de:...
.
After the group header the tables are defined using the variable assignment syntax. The name of the variable is used for the tables name and the assigned RA-expression defines its content. Every valid RA-expression can be used if the only relations used are defined in that group. The qualifier of each column is its tables name and is automatically added at runtime.
group:sample group
description:this is the <b>description</b>
A = {a, b
1, 2
3, 4
}
B = {a, c, d
1, 'test', 1970-01-01
3, 'test2', null
42, 'test3', null
}
C = A x B
It is also possible to define example queries in both relational algebra and SQL. These will be automatically loaded into the editor when the group is loaded for the first time.
group:sample group
description:this is the <b>description</b>
exampleSql - {
Select * from A where a = 1
}
exampleRelAlg - {
sigma R.a = 1 R
}
A = {a, b
1, 2
3, 4
}
B = {a, c, d
1, 'test', 1970-01-01
3, 'test2', null
42, 'test3', null
}
C = A x B
The program can load groups from a gist. This allows any user to use their own tables and share them with others.
The format to define a group in the gist ist the same format as for the static group definition.
The data can be loaded by adding the git's id to the query string.
If you call the application with the query string data=gist:ac267b9cc810ac5f20e2
,
it tries to load additional groups from the gits with the id ac267b9cc810ac5f20e2.
So a user could publish a url like http://example.com/?data=gist:ac267b9cc810ac5f20e2
to share
the group with other users.