Skip to content

Commit 50f5eec

Browse files
committed
docs(modelql): fixed some of the review comments
1 parent e59b1cf commit 50f5eec

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

docs/global/modules/core/pages/explanation/modelql.adoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
When working with large models you will quickly run into performance issues
44
when you try to replicate the whole model into the client.
55

6-
While the data structure for model replication in Modelix supports partial loading of models
6+
While the data structure for model replication in Modelix supports partial loading of models,
77
you still need a way to describe which data you need on the client.
88
Loading data on demand while traversing the model also results in a poor performance,
99
because of the potentially large number of fine-grained request.
@@ -12,9 +12,9 @@ A first attempt to solve this problem was to disallow lazy loading
1212
and require the client to load all required data at the beginning,
1313
before working with the model.
1414
A special query language was used to filter the data and an attempt to access a node that is not included by that query
15-
results in an exception, forcing the developer to adjust the query.
16-
While this results in a more predictable performance it's hard to maintain and still not optimal for the performance.
17-
You have to download all the data at the beginning that you might eventually need.
15+
resulted in an exception, forcing the developer to adjust the query.
16+
While this results in a more predictable performance, it is also hard to maintain and still not optimal for the performance.
17+
You have to download all the data at the beginning that you might eventually need, potentially exceeding the available memory of the system.
1818

1919
The ModelQL query language provides a more dynamic way of loading parts of the model on demand,
2020
but still allows to reduce the number of request to a minimum.

docs/global/modules/core/pages/howto/modelql.adoc

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ val result: List<String?> = client.getRootNode()!!.query {
3131
== Type safe ModelQL API
3232

3333
You can use the `model-api-gen-gradle` plugin to generate type safe extensions from your meta-model.
34+
Specify the `modelqlKotlinDir` property to enable the generation.
3435

3536
[source,kotlin]
3637
--
@@ -45,7 +46,7 @@ val result: List<StaticMethodDeclaration> = client.query { root ->
4546

4647
== Run query on an INode
4748

48-
If a query returns a node you can execute a new query starting from that node.
49+
If a query returns a node, you can execute a new query starting from that node.
4950

5051
[source,kotlin]
5152
--
@@ -55,8 +56,8 @@ val cls: ClassConcept = client.query {
5556
val names = cls.query { it.member.ofConcept(C_StaticMethodDeclaration).name.toList() }
5657
--
5758

58-
Or you can just use the INode API to access further data of that node.
59-
This is not recommended though, because each access sends a new query to the server.
59+
For convenience, it's possible to access further data of that node using the INode API,
60+
but this is not recommended though, because each access sends a new query to the server.
6061

6162
[source,kotlin]
6263
--
@@ -68,9 +69,9 @@ val className = cls.name
6869

6970
== Complex query results
7071

71-
While returning a list of elements is simple
72+
While returning a list of elements is simple,
7273
the purpose of the query language is to reduce the number of request to a minimum.
73-
This requires to combine multiple values into more complex data structures.
74+
This requires combining multiple values into more complex data structures.
7475
The `zip` operation provides a simple way of doing that:
7576

7677
[source,kotlin]
@@ -97,7 +98,7 @@ This can be solved by defining custom data classes and using the `mapLocal` oper
9798
data class MyProduct(val id: Int, val title: String, val images: List<MyImage>)
9899
data class MyImage(val url: String)
99100

100-
val result: List<MyNonSerializableClass> = remoteProductDatabaseQuery { db ->
101+
val result: List<MyProduct> = remoteProductDatabaseQuery { db ->
101102
db.products.map {
102103
val id = it.id
103104
val title = it.title
@@ -125,13 +126,12 @@ which provides a different syntax for the `zip`-`mapLocal` chain.
125126
data class MyProduct(val id: Int, val title: String, val images: List<MyImage>)
126127
data class MyImage(val url: String)
127128

128-
val result: List<MyNonSerializableClass> = query { db ->
129-
db.products.mapLocal2 {
129+
val result: List<MyProduct> = query { db ->
130130
val id = it.id.request()
131131
val title = it.title.request()
132132
val images = it.images.mapLocal { MyImage(it) }.toList().request()
133133
onSuccess {
134-
MyNonSerializableClass(id.get(), title.get(), images.get())
134+
MyProduct(id.get(), title.get(), images.get())
135135
}
136136
}.toList()
137137
}

0 commit comments

Comments
 (0)