Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doc/query doc example updates #1189

Open
wants to merge 10 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 2 additions & 12 deletions documentation/sdql/QUERYENGINE.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,24 +31,14 @@ Processing a blockchain query begins with the detection, by an instance of [`Blo
[CID](https://proto.school/anatomy-of-a-cid/01/) pointing to a [SDQL](/documentation/sdql/README.md) JSON file pinned to the IPFS network containing the query to be executed.
The query CID is then passed into the Query Service via a call to `approveQuery`.

The call to `approveQuery` then creates one abstract syntax tree (AST) for each and every **logic expression** in the [`logic`](/documentation/sdql#logic) block of given query file. <br>The following logic block results in 3 AST roots.

logic: {
ads: ["if$q1>30then$a1"],
compensations: [
"if$q2then$c1",
"if$a1then$c2",
],
},
The call to `approveQuery` then creates one abstract syntax tree (AST) for each and every **logic expression** for **ads, queries, insights, and compensations** of given query file.


These logic expressions can reference one or more
- [`queries`](/documentation/sdql#queries),
- [`ads`](/documentation/sdql#ads),
- [`compensations`](/documentation/sdql#compensations)
- and [`returns`](/documentation/sdql#returns).
- and [`insights`](/documentation/sdql#returns).

Given example references $q1, $q2 as queries, $a1 as an ad, and $c1, $c2 as compensations.

Resulting ASTs are ultimately evaluated against data wallet's [persistence layer](/packages/persistence/README.md), in consistence with user-specified permissions (i.e. if a `query` specification requires access to the `location` attribute of a user, the user must have consented to this access by indicating their acceptance in the consent contract associated with the query.)

Expand Down
245 changes: 114 additions & 131 deletions documentation/sdql/README.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion documentation/sdql/adding-new-queries.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Steps to add a new query support to the core:

1. Update the name section of [README.md](./README.md) file with new query name.
2. Update the [EXAMPLES.md](./EXAMPLES.md) file with new query schema examples and optionally define the new structures in [sdql-v0.0.1.schema](./sdql-v0.0.1.schema.json) if required.
2. Update the [EXAMPLES.md](./EXAMPLES.md) file with new query schema examples and optionally define the new structures in [sdql-latest.schema](./sdql-latest.schema.json) if required and publish the new schema with updated version number.

## 1. Parsing the query
First step in the implementation is parsing the query and building the AST (Abstract Syntax Tree). This is done by the **Query Parser package**.
Expand Down
77 changes: 0 additions & 77 deletions documentation/sdql/examples/avalanche_transfer_15+.json

This file was deleted.

193 changes: 0 additions & 193 deletions documentation/sdql/examples/avalanche_transfer_15+_balance.json

This file was deleted.

Loading
Loading