WIP
This commit is contained in:
parent
1c3b693ded
commit
a1d46d37d1
@ -5,8 +5,8 @@ The operators are: atom scan, semijoin, and natural join.
|
||||
|
||||
### Public API
|
||||
|
||||
| Item | Type | Description |
|
||||
|--------------------------------------------------|----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| Item | Kind | Description |
|
||||
|--------------------------------------------------|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `scan_atom(&Table, &AtomPattern) -> Relation` | function | Scans the table under the pattern and returns a binding relation with one column per distinct variable in first-occurrence order. Literal positions and repeated variables filter rows during the scan. |
|
||||
| `semijoin(&Relation, &Relation) -> Relation` | function | Returns the rows of `left` whose values on the columns shared with `right` also appear in `right`. The output column list is the same as `left.columns`. |
|
||||
| `natural_join(&Relation, &Relation) -> Relation` | function | Returns every pair of `left` and `right` rows that agree on shared columns. Each output row holds the columns of `left` followed by the non-shared columns of `right`. |
|
||||
@ -16,9 +16,11 @@ The operators are: atom scan, semijoin, and natural join.
|
||||
| `Relation` | struct | Holds rows over named columns and is the type produced by every operator. Construct it with `Relation::new(columns)` or `Relation::from_rows(columns, rows)`. Column names within a single relation must be unique. |
|
||||
| `Value` | enum | Represents a single cell value stored in a `Table` or `Relation`. A value is either `Int(i64)` or `Str(String)`. |
|
||||
|
||||
Data types and their relationships:
|
||||
|
||||
<div align="center">
|
||||
<picture>
|
||||
<img alt="Types" src="docs/diagrams/types.svg" height="50%" width="50%">
|
||||
<img alt="Types" src="docs/diagrams/types.svg" height="60%" width="60%">
|
||||
</picture>
|
||||
</div>
|
||||
|
||||
@ -30,7 +32,7 @@ It uses all three operators:
|
||||
- `semijoin` to keep only authors of bestsellers,
|
||||
- and `natural_join` to attach each book's price.
|
||||
|
||||
```text
|
||||
```prolog
|
||||
Q(name, book, dollars) :- author(name, book), bestseller(book), price(book, dollars).
|
||||
```
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user