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

Add prismjs additional languages #42

Merged
merged 16 commits into from
Aug 31, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fix lang highlighting in conpects sec
  • Loading branch information
fdmmarshall committed Aug 30, 2021
commit 28a792482bce6d8615b5bdc2b2be85b688df7194
10 changes: 5 additions & 5 deletions website/docs/concepts/smart-functions/collection-spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ If we want to make `person/fullName` required, we need to first create a smart f

It might be tempting to think that, because this smart function pertains to one specific predicate, then we should use a predicate spec. However, we could be creating new people with the following transaction:

```all
```json
[{
"_id": "person",
"handle": "gWash"
Expand All @@ -36,7 +36,7 @@ Note, in our smart function, we first use our `?sid` to find the `person/fullNam

In the below transaction, we first attach the `_fn$fullNameReq` to the `person` collection, and write a `specDoc`. The `specDoc` is the custom error message that will display when this smart function returns false. In the second part of the transaction, we create the relevant smart function, `fullNameReq`.

```flureeql
```json
[{
"_id": ["_collection/name", "person"],
"spec": ["_fn$fullNameReq"],
Expand All @@ -49,7 +49,7 @@ In the below transaction, we first attach the `_fn$fullNameReq` to the `person`
}]
```

```curl
```bash
curl \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $FLUREE_TOKEN" \
Expand Down Expand Up @@ -82,14 +82,14 @@ Transactions not supported in SPARQL

After we add this `_collection/spec`, the following transaction should fail:

```flureeql
```json
[{
"_id": "person",
"handle": "noFullName"
}]
```

```curl
```bash
curl \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $FLUREE_TOKEN" \
Expand Down
8 changes: 4 additions & 4 deletions website/docs/concepts/smart-functions/fns-in-txs.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ To use smart functions directly in transactions, we need to put our code inside

For example, to add ", Sr." to the end of a person's full name, we can use two built-in smart functions, `str` and `?pO`. `str` concatenates strings, and `?pO` retrieves the previous object. In this case, we expect the final object of `person/fullName` to be `Jane Doe, Sr.`.

```flureeql
```json
[{
"_id": ["person/handle", "jdoe"],
"fullName": "#(str (?pO) \", Sr.\")"
}]
```

```curl
```bash
curl \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $FLUREE_TOKEN" \
Expand Down Expand Up @@ -44,7 +44,7 @@ An atomic compare and set function can protect the integrity of a transaction wh

Say you wanted to add a 'Dr.' in front of every medical doctor's name. You issue a query for all people whose title is doctor, and do some logic to filter all names that don't already start with 'Dr.'. It happens that Jane Doe and John Smith are missing the Dr. prefix. A `cas` use might look like:

```flureeql
```json
[{"_id": 1234
"fullName": "#(cas \"Jane Doe\" \"Dr. Jane Doe\")"},
"_id": 5678
Expand All @@ -58,7 +58,7 @@ If between your query and this transaction getting executed another transaction

In another example, say you had multiple microservices that required a synthetic lock on a value. `cas` can test that the lock still exists before updating a different value. In this example, each lock can have a unique `lock/id`, and if a lock is active then `isLocked` will be `true`.

```flureeql
```json
[{"_id": ["lock/id", 12345]
"isLocked": "#(cas true false)"},
{"_id": 5678
Expand Down
12 changes: 6 additions & 6 deletions website/docs/concepts/smart-functions/predicate-spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ If we want to make sure that `person/favNums` is always non-negative, we need to

Create a Non-Negative Function:

```flureeql
```json
[{
"_id": "_fn",
"name": "nonNegative?",
Expand All @@ -31,7 +31,7 @@ Create a Non-Negative Function:
}]
```

```curl
```bash
curl \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $FLUREE_TOKEN" \
Expand Down Expand Up @@ -60,14 +60,14 @@ Transactions not supported in SPARQL

Add function to the `_predicate/spec` for `person/favNums`:

```flureeql
```json
[{
"_id": ["_predicate/name", "person/favNums"],
"spec": [["_fn/name", "nonNegative?"]]
}]
```

```curl
```bash
curl \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $FLUREE_TOKEN" \
Expand All @@ -94,15 +94,15 @@ Transactions not supported in SPARQL

If you try to issue the following transaction, it will fail, because -4 is negative.

```flureeql
```json
[{
"_id": "person",
"handle": "aJay",
"favNums": [12, -4, 57]
}]
```

```curl
```bash
curl \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $FLUREE_TOKEN" \
Expand Down
42 changes: 21 additions & 21 deletions website/docs/concepts/smart-functions/rule-example.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ In this section, we will create two roles, level1User and level2User, and connec

First, we need to create a new predicate, which connects a `person` to a `_auth`.

```flureeql
```json
[{
"_id": "_predicate",
"name": "person/auth",
Expand All @@ -24,7 +24,7 @@ First, we need to create a new predicate, which connects a `person` to a `_auth`
}]
```

```curl
```bash
curl \
-H "Content-Type: application/json" \
-d '[{
Expand Down Expand Up @@ -67,7 +67,7 @@ The full function is: `(contains? (get-all (?s \"[{chat/person [{person/auth [_i
2. Then, we retrieve all (just one in this case) of the _auth_ids by again crawling the results from step 1. `(get-all [\"chat/person\" \"person/auth\" \"_id\"])`.
3. Finally, we ask, does the set (of one) _id contain the (?auth_id) who is currently making this update. `(contains? (get-all (?s \"[{chat/person [{person/auth [_id] }] }]\") [\"chat/person\" \"person/auth\" \"_id\"]) (?auth_id))`.

```flureeql
```json
[
{
"_id": "_role",
Expand Down Expand Up @@ -110,7 +110,7 @@ The full function is: `(contains? (get-all (?s \"[{chat/person [{person/auth [_i
]
```

```curl
```bash
curl \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $FLUREE_TOKEN" \
Expand Down Expand Up @@ -181,7 +181,7 @@ We've already created the rules, `viewAllChats` and `editOwnChats`, so we just n

We will need to create two new rules, `viewAllPeople` and `viewAllComments`.

```flureeql
```json
[
{
"_id": "_role",
Expand Down Expand Up @@ -210,7 +210,7 @@ We will need to create two new rules, `viewAllPeople` and `viewAllComments`.
]
```

```curl
```bash
curl \
-H "Content-Type: application/json" \
-d '[
Expand Down Expand Up @@ -282,7 +282,7 @@ Account id: TfFzb1tZDkGMBqWr8xMmRVvYmNYFKH9aNpi

Now, we'll create the auth records and connect them to both the relevant roles and people. `jdoe` will be a level 1 user, and `zsmith` will be level 2.

```flureeql
```json
[
{
"_id": ["person/handle", "jdoe"],
Expand All @@ -307,7 +307,7 @@ Now, we'll create the auth records and connect them to both the relevant roles a
]
```

```curl
```bash
curl \
-H "Content-Type: application/json" \
-d '[
Expand Down Expand Up @@ -361,7 +361,7 @@ When we sign queries as `jdoe`, with a private key of `1787cab58d5b146a049f220c9

Query All Chats

```all
```json
{
"select": ["*", {"chat/comments": ["*"]}],
"from": "chat"
Expand All @@ -370,7 +370,7 @@ Query All Chats

Results:

```all
```json
[
{
"chat/message": "This is a sample chat from Jane!",
Expand All @@ -392,7 +392,7 @@ When we query all people:

Query:

```all
```json
{
"select": ["*"],
"from": "person"
Expand All @@ -401,7 +401,7 @@ Query:

Results:

```all
```json
[
{
"person/handle": "zsmith",
Expand All @@ -420,7 +420,7 @@ Results:

`jdoe` can edit an old chat.

```all
```json
[{
"_id": 369435906932737,
"message": "I *can* change this"
Expand All @@ -429,7 +429,7 @@ Results:

`jdoe` can also create a new chat, as herself.

```all
```json
[{
"_id": "chat",
"message": "Hey there!",
Expand All @@ -439,7 +439,7 @@ Results:

`jdoe` cannot create a new chat as `zsmith`, or anyone else.

```all
```json
[{
"_id": "chat",
"message": "What's up?",
Expand All @@ -455,7 +455,7 @@ When we sign queries as `zsmith`, with a private key of `c0588115314065f7949f87f

Query All Chats

```all
```json
{
"select": ["*"],
"from": "chat"
Expand All @@ -464,7 +464,7 @@ Query All Chats

Results:

```all
```json
{
"chat/message": "Hey there!",
"chat/person": {
Expand Down Expand Up @@ -498,7 +498,7 @@ When we query all people:

Query:

```all
```json
{
"select": ["*"],
"from": "person"
Expand All @@ -507,7 +507,7 @@ Query:

Results:

```all
```json
[
{
"person/auth": {
Expand Down Expand Up @@ -570,7 +570,7 @@ Results:

`zsmith` can create a new chat, as himself.

```all
```json
[{
"_id": "chat",
"message": "Hi, I'm Zach!",
Expand All @@ -580,7 +580,7 @@ Results:

`zsmith` cannot create a new chat as `jdoe`, or anyone else.

```all
```json
[{
"_id": "chat",
"message": "I'm trying to impersonate jdoe",
Expand Down
2 changes: 1 addition & 1 deletion website/docs/concepts/what-is-fluree.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ These atomic updates are very specially formatted logs. Each update is a called

Below is an example of ledger block. We will go into detail about the contents of the transaction response in the [Block Metadata](#block-metadata) section. However, below you can see that, among other things, every block contains a hash, a timestamp, and the size of the block data (block-bytes). This block also contains an array of nine flakes. These flakes contain all the data that is added, updated, or deleted in block 5, as compared to block 4.

```all
```json
{
"tempids": {
"chat$1": 4299262263297
Expand Down