Skip to content

Commit 6dd42a7

Browse files
Fix outputs of queries
1 parent 900ec78 commit 6dd42a7

File tree

3 files changed

+67
-67
lines changed

3 files changed

+67
-67
lines changed

new_home/modules/ROOT/pages/get_started/data.adoc

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,7 @@ Studio::
177177
In order to insert a friendship, we need to refer to users that will play the role of friends in the friendship.
178178
That's where variables come into play!
179179
180-
[Note]
181-
-----
182180
Recall that each friendship takes exactly two friends as specified in the schema; feel free to experiment though, and see what error messages TypeDB will give you when trying to insert triple friendships.
183-
-----
184181
185182
[,typeql]
186183
----
@@ -201,10 +198,7 @@ Console::
201198
In order to insert a friendship, we need to refer to users that will play the role of friends in the friendship.
202199
That's where variables come into play!
203200
204-
[Note]
205-
-----
206201
Recall that each friendship takes exactly two friends as specified in the schema; feel free to experiment though, and see what error messages TypeDB will give you when trying to insert triple friendships.
207-
-----
208202
209203
Using a new `write` transaction, run:
210204

new_home/modules/ROOT/pages/get_started/query-composition.adoc

Lines changed: 66 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -22,27 +22,27 @@ include::{page-version}@new_home::page$get_started/schema.adoc[tag=full_define]
2222
----
2323
====
2424
. xref:get_started/data.adoc[Loaded some data] using a insert and match-insert queries:
25-
+
25+
2626
[%collapsible]
2727
====
2828
[,typeql]
2929
----
3030
#!test[write]
3131
include::{page-version}@new_home::page$get_started/data.adoc[tag=insert2]
3232
----
33-
+
33+
3434
[,typeql]
3535
----
3636
#!test[write]
3737
include::{page-version}@new_home::page$get_started/data.adoc[tag=insert3]
3838
----
39-
+
39+
4040
[,typeql]
4141
----
4242
#!test[write]
4343
include::{page-version}@new_home::page$get_started/data.adoc[tag=insert5]
4444
----
45-
+
45+
4646
[,typeql]
4747
----
4848
#!test[write, count=1]
@@ -156,27 +156,28 @@ reduce $num-friends = count groupby $user, $username;
156156
# end::reduce2[]
157157
158158
tag::reduce2_result[]
159-
------------------------------
160-
$num-friends | 1
161-
$user | isa user, iid 0x1e00000000000000000004
162-
$username | isa username "echo"
163-
------------------
164-
$num-friends | 1
165-
$user | isa user, iid 0x1e00000000000000000000
166-
$username | isa username "alice"
167159
------------------
168160
$num-friends | 1
169161
$user | isa user, iid 0x1e00000000000000000005
170162
$username | isa username "fizzbuzz"
171163
------------------
164+
$num-friends | 1
165+
$user | isa user, iid 0x1e00000000000000000001
166+
$username | isa username "bob"
167+
------------------
172168
$num-friends | 2
173169
$user | isa user, iid 0x1e00000000000000000003
174170
$username | isa username "delta"
175171
------------------
176172
$num-friends | 1
177-
$user | isa user, iid 0x1e00000000000000000001
178-
$username | isa username "bob"
173+
$user | isa user, iid 0x1e00000000000000000000
174+
$username | isa username "alice"
175+
------------------
176+
$num-friends | 1
177+
$user | isa user, iid 0x1e00000000000000000004
178+
$username | isa username "echo"
179179
------------------
180+
180181
# end::reduce2_result[]
181182
----
182183
////
@@ -296,8 +297,8 @@ limit 1;
296297
# tag::pipeline1_result[]
297298
------------------
298299
$num-friends | 2
299-
$user | isa user, iid 0x1e00000000000000000006
300-
$username | isa username delta
300+
$user | isa user, iid 0x1e00000000000000000003
301+
$username | isa username "delta"
301302
------------------
302303
# end::pipeline1_result[]
303304
----
@@ -375,19 +376,19 @@ not { friendship ($user, $other-user); };
375376
376377
# tag::pipeline2_result[]
377378
---------------------
378-
$other-user | isa user, iid 0x1e00000000000000000001
379+
$other-user | isa user, iid 0x1e00000000000000000000
379380
$other-username | isa username "alice"
380-
$user | isa user, iid 0x1e00000000000000000006
381+
$user | isa user, iid 0x1e00000000000000000003
381382
$username | isa username "delta"
382383
---------------------
383-
$other-user | isa user, iid 0x1e00000000000000000002
384+
$other-user | isa user, iid 0x1e00000000000000000001
384385
$other-username | isa username "bob"
385-
$user | isa user, iid 0x1e00000000000000000006
386+
$user | isa user, iid 0x1e00000000000000000003
386387
$username | isa username "delta"
387388
---------------------
388-
$other-user | isa user, iid 0x1e00000000000000000003
389+
$other-user | isa user, iid 0x1e00000000000000000002
389390
$other-username | isa username "charlene"
390-
$user | isa user, iid 0x1e00000000000000000006
391+
$user | isa user, iid 0x1e00000000000000000003
391392
$username | isa username "delta"
392393
---------------------
393394
# end::pipeline2_result[]
@@ -570,37 +571,37 @@ Console::
570571
# tag::function_pipeline1[]
571572
match
572573
let $most-popular-user, $most-popular-username = most_popular_user();
573-
$other-user isa user, has username $username;
574+
$other-user isa user, has username $other-username;
574575
not { $most-popular-user is $other-user; };
575576
friendship ($other-user, $most-popular-user);
576577
# end::function_pipeline1[]
577578
578579
# tag::function_pipeline1_result[]
579580
----------------------------
580-
$most-popular-user | isa user, iid 0x1e00000000000000000006
581-
$most-popular-username | isa username "deltaonenine"
582-
$other-user | isa user, iid 0x1e00000000000000000007
583-
$username | isa username "ecclestone"
581+
$most-popular-user | isa user, iid 0x1e00000000000000000003
582+
$most-popular-username | isa username "delta"
583+
$other-user | isa user, iid 0x1e00000000000000000004
584+
$other-username | isa username "echo"
584585
----------------------------
585-
$most-popular-user | isa user, iid 0x1e00000000000000000006
586-
$most-popular-username | isa username "deltaonenine"
587-
$other-user | isa user, iid 0x1e00000000000000000008
588-
$username | isa username "fizzbuzz"
586+
$most-popular-user | isa user, iid 0x1e00000000000000000003
587+
$most-popular-username | isa username "delta"
588+
$other-user | isa user, iid 0x1e00000000000000000005
589+
$other-username | isa username "fizzbuzz"
589590
----------------------------
590-
$most-popular-user | isa user, iid 0x1e00000000000000000006
591-
$most-popular-username | isa username "deltaonenine"
591+
$most-popular-user | isa user, iid 0x1e00000000000000000003
592+
$most-popular-username | isa username "delta"
593+
$other-user | isa user, iid 0x1e00000000000000000000
594+
$other-username | isa username "alice"
595+
----------------------------
596+
$most-popular-user | isa user, iid 0x1e00000000000000000003
597+
$most-popular-username | isa username "delta"
592598
$other-user | isa user, iid 0x1e00000000000000000001
593-
$username | isa username "alice1925"
599+
$other-username | isa username "bob"
594600
----------------------------
595-
$most-popular-user | isa user, iid 0x1e00000000000000000006
596-
$most-popular-username | isa username "deltaonenine"
601+
$most-popular-user | isa user, iid 0x1e00000000000000000003
602+
$most-popular-username | isa username "delta"
597603
$other-user | isa user, iid 0x1e00000000000000000002
598-
$username | isa username "bob78"
599-
----------------------------
600-
$most-popular-user | isa user, iid 0x1e00000000000000000006
601-
$most-popular-username | isa username "deltaonenine"
602-
$other-user | isa user, iid 0x1e00000000000000000003
603-
$username | isa username "candice001"
604+
$other-username | isa username "charlene"
604605
----------------------------
605606
# end::function_pipeline1_result[]
606607
----
@@ -650,13 +651,11 @@ include::./query-composition.adoc[tag=fetch1]
650651
----
651652
652653
This query now returns a sequence of JSON documents:
653-
[source]
654+
[source, json]
654655
----
655-
include::./query-composition.adoc[tag=fetch_1_result]
656+
include::./query-composition.adoc[tag=fetch1_result]
656657
----
657658
658-
The fetch clause lets you lay out the exact JSON document you need for your application, making it easy to retrieve additional data such as optional attributes or answers from subqueries.
659-
660659
--
661660
Console::
662661
+
@@ -685,38 +684,38 @@ fetch {
685684
};
686685
# end::fetch1[]
687686
688-
# tag::fetch_1_result[]
687+
# tag::fetch1_result[]
689688
{
689+
"username": "alice",
690690
"friends": [
691691
{
692-
"friend": "bob78"
692+
"friend": "bob"
693693
},
694694
{
695-
"friend": "deltaonenine"
695+
"friend": "delta"
696696
}
697-
],
698-
"username": "alice1925"
697+
]
699698
}
700699
{
700+
"username": "bob",
701701
"friends": [
702702
{
703-
"friend": "alice1925"
703+
"friend": "alice"
704704
},
705705
{
706-
"friend": "deltaonenine"
706+
"friend": "delta"
707707
}
708-
],
709-
"username": "bob78"
708+
]
710709
}
711710
{
712-
"username": "candice001",
711+
"username": "charlene",
713712
"friends": [
714713
{
715-
"friend": "deltaonenine"
714+
"friend": "delta"
716715
}
717716
]
718717
}
719-
#end::fetch_1_result[]
718+
#end::fetch1_result[]
720719
----
721720
////
722721
[,typeql]
@@ -725,11 +724,19 @@ fetch {
725724
include::./query-composition.adoc[tag=fetch1]
726725
----
727726
728-
The fetch clause lets you lay out the exact JSON document you need for your application, making it easy to retrieve additional data such as optional attributes or answers from subqueries.
727+
This query now returns a sequence of JSON documents:
728+
729+
[source, json]
730+
----
731+
include::./query-composition.adoc[tag=fetch1_result]
732+
----
729733
730734
--
731735
====
732736

737+
The fetch clause lets you lay out the exact JSON document you need for your application, making it easy to retrieve additional data such as optional attributes or answers from subqueries.
738+
739+
733740
== What next?
734741
There is much more to explore in the world of TypeDB, including building custom query logic using disjunctions and negations, the deep exploration of data connection using functional recursion, and more.
735742

new_home/modules/ROOT/pages/get_started/schema.adoc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,8 +381,7 @@ Don't forget to commit the transaction by typing `commit` and pressing kbd[Enter
381381

382382
TypeDB's type system re-thinks data models from first principles: it modularizes schemas into their "atomic" components. For example, you can add or remove roles and ownerships at any point in time, or edit specific annotations.
383383
This makes it easy to migrate and combine data, and programmatically re-structure your database if necessary.
384-
There is much more to explore. You can check out the xref:{page-version}@new_core_concepts::typeql/index.adoc[TypeQL Concepts] section for specific details,
385-
but in the meantime let's summarize!
384+
There is much more to explore. You can check out the xref:{page-version}@new_core_concepts::typeql/index.adoc[TypeQL Concepts] section for specific details.
386385

387386
Here's your entire schema so you can see it in one go:
388387

0 commit comments

Comments
 (0)