-
Notifications
You must be signed in to change notification settings - Fork 139
[Java] Document references #2153
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's a supportive code review enhanced by AI assistance. These suggestions offer potential improvements and insights to consider, though they're recommendations rather than requirements. You have full control over which feedback to implement based on your project's specific needs and goals. The AI analysis is here to complement your expertise and help streamline your development process.
Model: claude-sonnet-4-20250514 | Prompt Tokens: 4467 | Completion Tokens: 2078
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's a supportive code review enhanced by AI assistance. These suggestions offer potential improvements and insights to consider, though they're recommendations rather than requirements. You have full control over which feedback to implement based on your project's needs and goals. The AI analysis is here to complement your expertise and help streamline your development process.
Model: claude-sonnet-4-20250514 | Prompt Tokens: 4495 | Completion Tokens: 2260
|
Hi @vmikhailenko , |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's a collaborative code review enhanced by AI assistance. These suggestions offer potential improvements and insights to consider, though they're recommendations rather than requirements. You have full creative control over your code—AI simply provides additional perspective to support your decision-making process. Use whatever feels valuable and aligns with your project goals.
Model: claude-sonnet-4-20250514 | Prompt Tokens: 4523 | Completion Tokens: 635
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's a supportive code review enhanced by AI assistance. These suggestions offer potential improvements and insights to consider, though they're recommendations rather than requirements. You have full control over which feedback to implement based on your project's specific needs and goals. The AI analysis is here to complement your expertise and help streamline your development process.
Model: claude-sonnet-4-20250514 | Prompt Tokens: 4261 | Completion Tokens: 587
java/working-with-cql/query-api.md
Outdated
| } | ||
| ``` | ||
|
|
||
| Below is an example how this can be used together to build an CQL statement: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Grammar error: Missing article 'a' before 'CQL statement'. The sentence should read: 'Below is an example of how this can be used together to build a CQL statement:'
java/working-with-cql/query-api.md
Outdated
| The references are not comparable between each other. They cannot be used as map keys or set values. | ||
| ::: | ||
|
|
||
| ### Elements References {#element-refs} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spelling error: 'Elements References' should be 'Element References' (singular form is more appropriate for a heading about the concept).
java/working-with-cql/query-api.md
Outdated
| StructuredTypeRef copy = builder.build(); // new reference is ready | ||
| ``` | ||
|
|
||
| Test this code thoroughly and ensure that you do not omit the filters or change the reference so that it becomes inconsistent. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clarity improvement: The phrase 'Test this code thoroughly and ensure that you do not omit the filters or change the reference so that it becomes inconsistent' is vague and unclear. Consider revising to: 'Ensure thorough testing when modifying references to avoid omitting filters or creating inconsistent reference states.'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Test this code thoroughly and ensure that you do not omit the filters or change the reference so that it becomes inconsistent. | |
| Ensure thorough testing when modifying references to avoid omitting filters or creating inconsistent reference states. |
Co-authored-by: René Jeglinsky <rene.jeglinsky@sap.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's a supportive code review enhanced with AI assistance. These suggestions offer potential improvements and insights to consider, though they're recommendations rather than requirements. You have full control over which feedback to implement based on your project's specific needs and goals. The AI analysis is here to complement your expertise and help streamline your development process.
Model: claude-sonnet-4-20250514 | Prompt Tokens: 4261 | Completion Tokens: 582
java/working-with-cql/query-api.md
Outdated
| } | ||
| ``` | ||
|
|
||
| Below is an example how this can be used together to build an CQL statement: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Grammar error: Missing article 'a' before 'CQL statement'. The sentence should read: 'Below is an example of how this can be used together to build a CQL statement:'
java/working-with-cql/query-api.md
Outdated
|
|
||
| Test this code thoroughly and ensure that you do not omit the filters or change the reference so that it becomes inconsistent. | ||
|
|
||
| References can be analyzed using the [`CqnAnalyzer`](/java/working-with-cql/query-introspection#cqnanalyzer) to bind it back to the model, for example, to find annotations or extract filter values. References an be introspected with [`CqnVisitor`](/java/working-with-cql/query-introspection#cqnvisitor). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spelling error: 'an be' should be 'can be'. The sentence should read: 'References can be introspected with CqnVisitor.'
java/working-with-cql/query-api.md
Outdated
| The references are not comparable between each other. They cannot be used as map keys or set values. | ||
| ::: | ||
|
|
||
| ### Elements References {#element-refs} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Grammar error: The heading should be 'Element References' (not 'Elements References') to maintain consistency with the singular form used elsewhere in the document.
java/working-with-cql/query-api.md
Outdated
| CqnStructuredTypeRef ref = CQL.entity(Books_.class).filter(b -> b.ID().eq("...")).asRef(); // [!code focus] | ||
| ``` | ||
|
|
||
| To navigate to the author of the book, use `CQL.entity(...)` to make it typed again and add one more segment to it. Note, that this does not check that the original reference is indeed the reference to the book. This only lets you use required model interface. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clarity improvement: The sentence 'Note, that this does not check that the original reference is indeed the reference to the book' contains an unnecessary comma after 'Note' and could be clearer. Consider: 'Note that this does not verify that the original reference actually points to a book.'
java/working-with-cql/query-api.md
Outdated
|
|
||
| This new reference might be used as the root of its own statement to read or change the author. | ||
|
|
||
| To navigate to the parent, you can strip segment from the end of the ref. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clarity improvement: The sentence 'To navigate to the parent, you can strip segment from the end of the ref' is missing an article. It should read: 'To navigate to the parent, you can strip a segment from the end of the ref.'
Co-authored-by: René Jeglinsky <rene.jeglinsky@sap.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's a supportive code review enhanced by AI assistance. These suggestions offer potential improvements and insights to consider, though they're recommendations rather than requirements. You have full control over which feedback to implement based on your project's specific needs and goals. The AI analysis is here to complement your expertise and help streamline your development process.
Model: claude-sonnet-4-20250514 | Prompt Tokens: 4261 | Completion Tokens: 623
java/working-with-cql/query-api.md
Outdated
| Entity references specify entity sets. They can be used to define the target entity set of a [CQL](../../cds/cql) statement. They can either be defined inline using lambda expressions in the Query Builder (see [Target Entity Sets](#target-entity-sets)) or via the `CQL.entity` method, which is available in an _untyped_ version as well as in a _typed_ version that uses the generated [model interfaces](../cqn-services/persistence-services#model-interfaces). The following example shows an entity reference describing the set of *authors* that have published books in the year 2020: | ||
| Entity references specify entity sets and can define the target entity set of a [CQL](../../cds/cql) statement or serve as an argument for event handlers. | ||
|
|
||
| A reference consists of _segments_ that define the path from the entity's root to a certain part of it. Each segment has the _identifier_ with the name of the entity or an element and an optional filter _predicate_. These predicates might include other references. The references are not bound to the particular model and are not checked against it while they are being built. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use active voice instead of passive voice. Change 'are not bound to the particular model and are not checked against it while they are being built' to 'The system does not bind references to a particular model and does not check them against it during construction.'
java/working-with-cql/query-api.md
Outdated
| } | ||
| ``` | ||
|
|
||
| Below is an example how this can be used together to build an CQL statement: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Improve clarity and conciseness. The sentence 'Below is an example how this can be used together to build an CQL statement:' has grammatical issues. Change to 'The following example shows how to use this to build a CQL statement:'
java/working-with-cql/query-api.md
Outdated
|
|
||
| This new reference might be used as the root of its own statement to read or change the author. | ||
|
|
||
| To navigate to the parent, you can strip segment from the end of the ref. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use active voice and improve clarity. Change 'To navigate to the parent, you can strip segment from the end of the ref' to 'To navigate to the parent, strip the segment from the end of the reference.' Also, 'segment' should be 'a segment' for proper grammar.
java/working-with-cql/query-api.md
Outdated
| StructuredTypeRef copy = builder.build(); // new reference is ready | ||
| ``` | ||
|
|
||
| Test this code thoroughly and ensure that you do not omit the filters or change the reference so that it becomes inconsistent. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Improve clarity and fix grammar. Change 'Test this code thoroughly and ensure that you do not omit the filters or change the reference so that it becomes inconsistent' to 'Test this code thoroughly to ensure you do not omit filters or make the reference inconsistent.'
java/working-with-cql/query-api.md
Outdated
|
|
||
| ### Elements References {#element-refs} | ||
|
|
||
| An element reference points to an element of the entity. Such references are usually _relative_, they do not have the name of the entity in their root. They can include filters in their segments except _in the last one_. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix grammar and improve clarity. Change 'Such references are usually relative, they do not have the name of the entity in their root' to 'Such references are usually relative; they do not include the entity name in their root.' Use a semicolon to properly connect the related clauses.
… into java-document-refs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's a supportive code review enhanced by AI assistance. These insights offer suggestions and observations that may help guide your development process. Please consider them as recommendations rather than definitive requirements. Your expertise and judgment remain the most important factors in making decisions about your code. The AI tools are simply here to provide additional perspective and support your work.
Model: claude-sonnet-4-20250514 | Prompt Tokens: 4255 | Completion Tokens: 640
java/working-with-cql/query-api.md
Outdated
|
|
||
| A reference consists of _segments_ that define the path from the entity's root to a certain part of it. Each segment has the _identifier_ with the name of the entity or an element and an optional filter _predicate_. These predicates might include other references. The references are not bound to the particular model and are not checked against it while they are being built. | ||
|
|
||
| References are either _absolute_ or _relative_. Absolute references always have the fully qualified name of the type in their first segment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use active voice instead of passive voice. Change 'References are either absolute or relative' to 'References can be either absolute or relative' to make it more active and direct.
java/working-with-cql/query-api.md
Outdated
| CqnElementRef dynamicTitle = CQL.get(Books.TITLE); // {"ref":["title"]} | ||
| ``` | ||
|
|
||
| New references are constructed with [model interfaces](../cqn-services/persistence-services#model-interfaces) or via API that is also used to build [CQL statements](/java/working-with-cql/query-api#concepts). For most of application code, the model interfaces are the recommended way to do this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Improve clarity by restructuring this sentence. Consider: 'New references are constructed using model interfaces or via the API that builds CQL statements. For most application code, model interfaces are the recommended approach.'
java/working-with-cql/query-api.md
Outdated
| } | ||
| ``` | ||
|
|
||
| Below is an example how this can be used together to build a CQL statement: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix grammatical error. Change 'Below is an example how this can be used together' to 'Below is an example of how this can be used together' - the preposition 'of' is needed after 'example'.
java/working-with-cql/query-api.md
Outdated
| CqnStructuredTypeRef ref = CQL.entity(Books_.class).filter(b -> b.ID().eq("...")).asRef(); // [!code focus] | ||
| ``` | ||
|
|
||
| To navigate to the author of the book, use `CQL.entity(...)` to make it typed again and add one more segment to it. Note, that this does not check that the original reference is indeed the reference to the book. This only lets you use required model interface. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Improve sentence structure for better clarity. Change 'Note, that this does not check that the original reference is indeed the reference to the book. This only lets you use required model interface.' to 'Note that this does not verify that the original reference points to the book. This only allows you to use the required model interface.' Also remove the comma after 'Note'.
java/working-with-cql/query-api.md
Outdated
| CqnElementRef nameOfAuthor = CQL.entity(Books_.class).filter(f -> f.ID().eq("...")).author().name(); | ||
| ``` | ||
|
|
||
| They also share the same features and limitations as the entity references and they cannot be used with [`CqnAnalyzer`](/java/working-with-cql/query-introspection#cqnanalyzer). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use active voice and improve clarity. Change 'They also share the same features and limitations as the entity references and they cannot be used with' to 'Element references share the same features and limitations as entity references and cannot be used with' to avoid repetition and make it more concise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's a supportive code review enhanced by AI assistance. These suggestions offer potential improvements and insights to consider, though they're recommendations rather than requirements. You have full control over which feedback to implement based on your project's specific needs and goals. The AI analysis is here to complement your expertise and help streamline your development process.
Model: claude-sonnet-4-20250514 | Prompt Tokens: 4223 | Completion Tokens: 584
java/working-with-cql/query-api.md
Outdated
|
|
||
| A reference consists of _segments_ that define the path from the entity's root to a certain part of it. Each segment has the _identifier_ with the name of the entity or an element and an optional filter _predicate_. These predicates might include other references. The references are not bound to the particular model and are not checked against it while they are being built. | ||
|
|
||
| References are either _absolute_ or _relative_. Absolute references always have the fully qualified name of the type in their first segment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use active voice instead of passive voice. Change "References are either absolute or relative" to "References can be either absolute or relative" to make the sentence more direct and engaging.
java/working-with-cql/query-api.md
Outdated
| CqnElementRef dynamicTitle = CQL.get(Books.TITLE); // {"ref":["title"]} | ||
| ``` | ||
|
|
||
| New references are constructed with [model interfaces](../cqn-services/persistence-services#model-interfaces) or via API that is also used to build [CQL statements](/java/working-with-cql/query-api#concepts). For most of application code, the model interfaces are the recommended way to do this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Improve clarity by restructuring this sentence. Consider: "For most application code, model interfaces are the recommended way to construct new references." This makes the recommendation clearer and more direct.
java/working-with-cql/query-api.md
Outdated
| CqnStructuredTypeRef toAuthor = CQL.to(ref.segments()).to("author").asRef(); // [!code focus] | ||
| ``` | ||
|
|
||
| This new reference might be used as the root of its own statement to read or change the author. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use active voice and improve clarity. Change "This new reference might be used as the root of its own statement" to "You can use this new reference as the root of its own statement" to be more direct and actionable.
java/working-with-cql/query-api.md
Outdated
|
|
||
| This new reference might be used as the root of its own statement to read or change the author. | ||
|
|
||
| To navigate to the parent, you can strip segment from the end of the ref. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Improve sentence structure for better readability. Change "To navigate to the parent, you can strip segment from the end of the ref" to "To navigate to the parent, you can strip a segment from the end of the reference." Note the addition of the article "a" and using "reference" instead of "ref" for consistency.
java/working-with-cql/query-api.md
Outdated
| CqnElementRef nameOfAuthor = CQL.entity(Books_.class).filter(f -> f.ID().eq("...")).author().name(); | ||
| ``` | ||
|
|
||
| Element references share the same features and limitations as entity references and cannot be used with [`CqnAnalyzer`](/java/working-with-cql/query-introspection#cqnanalyzer). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use active voice and improve clarity. Change "Element references share the same features and limitations as entity references and cannot be used with" to "Element references have the same features and limitations as entity references and you cannot use them with" to make it more direct and clear.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's a collaborative code review enhanced by AI assistance. These suggestions offer potential improvements and insights to consider, though they're recommendations rather than requirements. You have full control over which feedback to implement based on your project's specific needs and context. The AI analysis is here to support your decision-making process and provide additional perspective on your code.
Model: claude-sonnet-4-20250514 | Prompt Tokens: 4223 | Completion Tokens: 515
java/working-with-cql/query-api.md
Outdated
|
|
||
| A reference consists of _segments_ that define the path from the entity's root to a certain part of it. Each segment has the _identifier_ with the name of the entity or an element and an optional filter _predicate_. These predicates might include other references. The references are not bound to the particular model and are not checked against it while they are being built. | ||
|
|
||
| References are either _absolute_ or _relative_. Absolute references always have the fully qualified name of the type in their first segment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use active voice instead of passive voice. Change "References are either absolute or relative" to "References can be either absolute or relative" to make the sentence more direct and engaging.
java/working-with-cql/query-api.md
Outdated
| CqnElementRef dynamicTitle = CQL.get(Books.TITLE); // {"ref":["title"]} | ||
| ``` | ||
|
|
||
| New references are constructed with [model interfaces](../cqn-services/persistence-services#model-interfaces) or via API that is also used to build [CQL statements](/java/working-with-cql/query-api#concepts). For most of application code, the model interfaces are the recommended way to do this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Improve clarity by restructuring this sentence. Consider: "For most application code, model interfaces are the recommended way to construct new references." This makes the recommendation clearer and more direct.
java/working-with-cql/query-api.md
Outdated
| CqnStructuredTypeRef toAuthor = CQL.to(ref.segments()).to("author").asRef(); // [!code focus] | ||
| ``` | ||
|
|
||
| This new reference might be used as the root of its own statement to read or change the author. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use active voice and improve clarity. Change "This new reference might be used" to "You can use this new reference" to be more direct and actionable.
java/working-with-cql/query-api.md
Outdated
|
|
||
| This new reference might be used as the root of its own statement to read or change the author. | ||
|
|
||
| To navigate to the parent, you can strip segment from the end of the ref. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Grammar error: Add an article. Change "strip segment from the end" to "strip a segment from the end" for proper grammar.
java/working-with-cql/query-api.md
Outdated
| StructuredTypeRef copy = builder.build(); // new reference is ready | ||
| ``` | ||
|
|
||
| Test this code thoroughly and ensure that you do not omit the filters or change the reference so that it becomes inconsistent. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Improve sentence structure and clarity. Consider: "Test this code thoroughly and ensure that you do not omit filters or make the reference inconsistent." This removes redundancy and improves flow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's a supportive code review enhanced by AI assistance. These insights offer suggestions and observations that may help guide your development process. Please consider them as recommendations rather than definitive requirements. Your expertise and judgment remain the most important factors in making decisions about your code. The AI analysis is simply here to provide additional perspective and support your work.
Model: claude-sonnet-4-20250514 | Prompt Tokens: 4216 | Completion Tokens: 672
java/working-with-cql/query-api.md
Outdated
|
|
||
| A reference consists of _segments_ that define the path from the entity's root to a certain part of it. Each segment has the _identifier_ with the name of the entity or an element and an optional filter _predicate_. These predicates might include other references. The references are not bound to the particular model and are not checked against it while they are being built. | ||
|
|
||
| References are either _absolute_ or _relative_. Absolute references always have the fully qualified name of the type in their first segment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use active voice instead of passive voice. Change 'References are either absolute or relative' to 'References can be either absolute or relative' to make it more active and clear.
java/working-with-cql/query-api.md
Outdated
| CqnElementRef dynamicTitle = CQL.get(Books.TITLE); // {"ref":["title"]} | ||
| ``` | ||
|
|
||
| New references are constructed with [model interfaces](../cqn-services/persistence-services#model-interfaces) or via API that is also used to build [CQL statements](/java/working-with-cql/query-api#concepts). For most of application code, the model interfaces are the recommended way to do this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Improve clarity by restructuring this sentence. Consider: 'New references are constructed using model interfaces or via the API that builds CQL statements. For most application code, model interfaces are the recommended approach.'
java/working-with-cql/query-api.md
Outdated
| CqnStructuredTypeRef ref = CQL.entity(Books_.class).filter(b -> b.ID().eq("...")).chapters(c -> c.ID().eq("...")).pages(p -> p.ID().eq("...")).asRef(); | ||
| ``` | ||
|
|
||
| References can be represented as JSON following an [Expression](../../cds/cxn) notation. The following is the JSON representation of the reference above: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use active voice and improve clarity. Change 'References can be represented as JSON following an Expression notation' to 'You can represent references as JSON using Expression notation.'
java/working-with-cql/query-api.md
Outdated
| StructuredTypeRef copy = builder.build(); // new reference is ready | ||
| ``` | ||
|
|
||
| Test this code thoroughly and ensure that you do not omit filters or make the reference inconsistent. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use active voice and present tense. Change 'Test this code thoroughly and ensure that you do not omit filters or make the reference inconsistent' to 'Test this code thoroughly and ensure that you do not omit filters or create inconsistent references.'
java/working-with-cql/query-api.md
Outdated
| CqnElementRef nameOfAuthor = CQL.entity(Books_.class).filter(f -> f.ID().eq("...")).author().name(); | ||
| ``` | ||
|
|
||
| Element references share the same features and limitations as entity references and cannot be used with [`CqnAnalyzer`](/java/working-with-cql/query-introspection#cqnanalyzer). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use active voice and improve clarity. Change 'Element references share the same features and limitations as entity references and cannot be used with CqnAnalyzer' to 'Element references have the same features and limitations as entity references. You cannot use them with CqnAnalyzer.'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's a supportive code review enhanced by AI assistance. These suggestions offer potential improvements and insights to consider, though they're recommendations rather than requirements. You have full control over which feedback to implement based on your project's specific needs and goals. The AI analysis is here to complement your expertise and help streamline your development process.
Model: claude-sonnet-4-20250514 | Prompt Tokens: 4214 | Completion Tokens: 622
| Entity references specify entity sets. They can be used to define the target entity set of a [CQL](../../cds/cql) statement. They can either be defined inline using lambda expressions in the Query Builder (see [Target Entity Sets](#target-entity-sets)) or via the `CQL.entity` method, which is available in an _untyped_ version as well as in a _typed_ version that uses the generated [model interfaces](../cqn-services/persistence-services#model-interfaces). The following example shows an entity reference describing the set of *authors* that have published books in the year 2020: | ||
| Entity references specify entity sets and can define the target entity set of a [CQL](../../cds/cql) statement or serve as an argument for event handlers. | ||
|
|
||
| A reference consists of _segments_ that define the path from the entity's root to a certain part of it. Each segment has the _identifier_ with the name of the entity or an element and an optional filter _predicate_. These predicates might include other references. The references are not bound to the particular model and are not checked against it while they are being built. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use active voice instead of passive voice. Change 'References are not bound to the particular model and are not checked against it while they are being built' to 'The system does not bind references to a particular model and does not check them against it during construction.'
java/working-with-cql/query-api.md
Outdated
| CqnStructuredTypeRef ref = CQL.entity(Books_.class).filter(b -> b.ID().eq("...")).chapters(c -> c.ID().eq("...")).pages(p -> p.ID().eq("...")).asRef(); | ||
| ``` | ||
|
|
||
| References have JSON representation that follows an [Expression](../../cds/cxn) notation. Below is the example if it: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix grammatical error. Change 'Below is the example if it:' to 'Below is an example of it:' - 'if' should be 'of'.
java/working-with-cql/query-api.md
Outdated
| CqnStructuredTypeRef refToAuthor = CQL.entity(Books_.class, ref).author().asRef(); // [!code focus] | ||
| ``` | ||
|
|
||
| With `CQL.to(...)` the same is produced dynamically. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use active voice and improve clarity. Change 'With CQL.to(...) the same is produced dynamically' to 'Use CQL.to(...) to produce the same result dynamically.'
java/working-with-cql/query-api.md
Outdated
| An element reference points to an element of the entity. Such references are usually _relative_, they do not have the name of the entity in their root. They can include filters in their segments except _in the last one_. | ||
| Most of the time, they exist as members of the [select list](#projections) of a statement or part of the statement, for example, of an expand predicate. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use active voice instead of passive voice. Change 'Such references are usually relative, they do not have the name of the entity in their root. They can include filters in their segments except in the last one' to 'Such references are usually relative and do not have the entity name in their root. You can include filters in their segments except in the last one.'
java/working-with-cql/query-api.md
Outdated
| CqnElementRef nameOfAuthor = CQL.entity(Books_.class).filter(f -> f.ID().eq("...")).author().name(); | ||
| ``` | ||
|
|
||
| Element references share the same features and limitations as entity references and cannot be used with [`CqnAnalyzer`](/java/working-with-cql/query-introspection#cqnanalyzer). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use active voice instead of passive voice. Change 'Element references share the same features and limitations as entity references and cannot be used with [CqnAnalyzer]' to 'Element references share the same features and limitations as entity references, and you cannot use them with [CqnAnalyzer]'.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's a supportive code review enhanced by AI assistance. These insights offer suggestions and observations that may help guide your development process. Please consider them as recommendations rather than definitive requirements. Your expertise and judgment remain the most important factors in making decisions about your code. The AI analysis is simply here to provide additional perspective and support your work.
Model: claude-sonnet-4-20250514 | Prompt Tokens: 3683 | Completion Tokens: 806
java/working-with-cql/query-api.md
Outdated
| ### Entity References {#entity-refs} | ||
|
|
||
| Entity references specify entity sets. They can be used to define the target entity set of a [CQL](../../cds/cql) statement. They can either be defined inline using lambda expressions in the Query Builder (see [Target Entity Sets](#target-entity-sets)) or via the `CQL.entity` method, which is available in an _untyped_ version as well as in a _typed_ version that uses the generated [model interfaces](../cqn-services/persistence-services#model-interfaces). The following example shows an entity reference describing the set of *authors* that have published books in the year 2020: | ||
| Entity references specify entity sets and can define the target entity set of a [CQL](../../cds/cql) statement or serve as an argument for event handlers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use active voice instead of passive voice. Change "They can be used" to "You can use them" for better clarity and directness.
Suggested revision:
Entity references specify entity sets and you can use them to define the target entity set of a [CQL](../../cds/cql) statement or serve as an argument for event handlers.
| Entity references specify entity sets. They can be used to define the target entity set of a [CQL](../../cds/cql) statement. They can either be defined inline using lambda expressions in the Query Builder (see [Target Entity Sets](#target-entity-sets)) or via the `CQL.entity` method, which is available in an _untyped_ version as well as in a _typed_ version that uses the generated [model interfaces](../cqn-services/persistence-services#model-interfaces). The following example shows an entity reference describing the set of *authors* that have published books in the year 2020: | ||
| Entity references specify entity sets and can define the target entity set of a [CQL](../../cds/cql) statement or serve as an argument for event handlers. | ||
|
|
||
| A reference consists of _segments_ that define the path from the entity's root to a certain part of it. Each segment has the _identifier_ with the name of the entity or an element and an optional filter _predicate_. These predicates might include other references. The references are not bound to the particular model and are not checked against it while they are being built. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use present tense instead of future tense. The phrase "are not checked against it while they are being built" should be "are not checked against it during construction" to maintain present tense throughout.
Suggested revision:
The references are not bound to the particular model and are not checked against it during construction.
java/working-with-cql/query-api.md
Outdated
|
|
||
| Relative references do not specify the type in the first segment and are [element references](/java/working-with-cql/query-api#element-refs) most of the time. | ||
|
|
||
| New references are constructed with [model interfaces](../cqn-services/persistence-services#model-interfaces) or via API that is also used to build [CQL statements](/java/working-with-cql/query-api#concepts). Prefer model interfaces in the application code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use active voice and improve clarity. Change "New references are constructed" to "You construct new references" for better readability and active voice.
Suggested revision:
You construct new references with [model interfaces](../cqn-services/persistence-services#model-interfaces) or via API that is also used to build [CQL statements](/java/working-with-cql/query-api#concepts). Prefer model interfaces in the application code.
java/working-with-cql/query-api.md
Outdated
|
|
||
| ### Element References {#element-refs} | ||
|
|
||
| An element reference points to regular element of the entity. Such references are usually _relative_ and form select list for a CQL statement or an expand. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Improve clarity and fix grammatical error. "An element reference points to regular element" should be "An element reference points to a regular element" (missing article). Also, consider rephrasing for better flow.
Suggested revision:
An element reference points to a regular element of the entity. Such references are usually _relative_ and form the select list for a CQL statement or an expand.
java/working-with-cql/query-api.md
Outdated
| CqnElementRef nameOfAuthor = CQL.entity(Books_.class).filter(f -> f.ID().eq("...")).author().name(); | ||
| ``` | ||
|
|
||
| Element references share the same features and limitations as entity references and cannot be used with [`CqnAnalyzer`](/java/working-with-cql/query-introspection#cqnanalyzer). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Improve sentence structure and clarity. The sentence "Element references share the same features and limitations as entity references and cannot be used with [CqnAnalyzer]" could be clearer by separating the concepts.
Suggested revision:
Element references share the same features and limitations as entity references. However, you cannot use them with [`CqnAnalyzer`](/java/working-with-cql/query-introspection#cqnanalyzer).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's a supportive code review enhanced by AI assistance. These suggestions offer potential improvements and insights to consider, though they're recommendations rather than requirements. You have full control over which feedback to implement based on your project's needs and goals. The AI analysis is here to complement your expertise and help streamline your development process.
Model: claude-sonnet-4-20250514 | Prompt Tokens: 3687 | Completion Tokens: 572
java/working-with-cql/query-api.md
Outdated
| ### Entity References {#entity-refs} | ||
|
|
||
| Entity references specify entity sets. They can be used to define the target entity set of a [CQL](../../cds/cql) statement. They can either be defined inline using lambda expressions in the Query Builder (see [Target Entity Sets](#target-entity-sets)) or via the `CQL.entity` method, which is available in an _untyped_ version as well as in a _typed_ version that uses the generated [model interfaces](../cqn-services/persistence-services#model-interfaces). The following example shows an entity reference describing the set of *authors* that have published books in the year 2020: | ||
| Entity references specify entity sets and can define the target entity set of a [CQL](../../cds/cql) statement or serve as an argument for event handlers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The sentence structure is awkward and uses passive voice. Consider revising to:
"Entity references specify entity sets. You can use them to define the target entity set of a CQL statement or as arguments for event handlers."
| Entity references specify entity sets. They can be used to define the target entity set of a [CQL](../../cds/cql) statement. They can either be defined inline using lambda expressions in the Query Builder (see [Target Entity Sets](#target-entity-sets)) or via the `CQL.entity` method, which is available in an _untyped_ version as well as in a _typed_ version that uses the generated [model interfaces](../cqn-services/persistence-services#model-interfaces). The following example shows an entity reference describing the set of *authors* that have published books in the year 2020: | ||
| Entity references specify entity sets and can define the target entity set of a [CQL](../../cds/cql) statement or serve as an argument for event handlers. | ||
|
|
||
| A reference consists of _segments_ that define the path from the entity's root to a certain part of it. Each segment has the _identifier_ with the name of the entity or an element and an optional filter _predicate_. These predicates might include other references. The references are not bound to the particular model and are not checked against it while they are being built. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sentence uses passive voice and is unclear. Consider revising to:
"The system does not bind references to a particular model and does not check them against it while building them."
java/working-with-cql/query-api.md
Outdated
|
|
||
| Relative references do not specify the type in the first segment and are [element references](/java/working-with-cql/query-api#element-refs) most of the time. | ||
|
|
||
| New references are constructed with [model interfaces](../cqn-services/persistence-services#model-interfaces) or via API that is also used to build [CQL statements](/java/working-with-cql/query-api#concepts). Prefer model interfaces in the application code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The sentence structure is unclear and uses passive voice. Consider revising to:
"You construct new references with model interfaces or via the API that you also use to build CQL statements. Use model interfaces in application code."
|
|
||
| ### Element References {#element-refs} | ||
|
|
||
| An element reference points to a regular element of the entity. Such references are usually _relative_ and form select list for a CQL statement or an expand. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The sentence uses passive voice. Consider revising to:
"Such references are usually relative and form the select list for a CQL statement or an expand."
java/working-with-cql/query-api.md
Outdated
| CqnElementRef extendedRef = CQL.to(relativeRef.segments()).get("name"); // author/placeOfBirth/name | ||
| ``` | ||
|
|
||
| You can create _absolute_ element references, but they are rarely used. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The sentence uses passive voice. Consider revising to:
"You rarely use absolute element references."
renejeglinsky
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it's ok to simplify the links like that. Or have you had a certain reason not to do it?
java/working-with-cql/query-api.md
Outdated
|
|
||
| The method `asRef()` seals the reference and makes it immutable. | ||
|
|
||
| Relative references do not specify the type in the first segment and are [element references](/java/working-with-cql/query-api#element-refs) most of the time. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Relative references do not specify the type in the first segment and are [element references](/java/working-with-cql/query-api#element-refs) most of the time. | |
| Relative references do not specify the type in the first segment and are [element references](#element-refs) most of the time. |
java/working-with-cql/query-api.md
Outdated
|
|
||
| Relative references do not specify the type in the first segment and are [element references](/java/working-with-cql/query-api#element-refs) most of the time. | ||
|
|
||
| New references are constructed with [model interfaces](../cqn-services/persistence-services#model-interfaces) or via API that is also used to build [CQL statements](/java/working-with-cql/query-api#concepts). Prefer model interfaces in the application code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| New references are constructed with [model interfaces](../cqn-services/persistence-services#model-interfaces) or via API that is also used to build [CQL statements](/java/working-with-cql/query-api#concepts). Prefer model interfaces in the application code. | |
| New references are constructed with [model interfaces](../cqn-services/persistence-services#model-interfaces) or via API that is also used to build [CQL statements](#concepts). Prefer model interfaces in the application code. |
java/working-with-cql/query-api.md
Outdated
| CqnElementRef relativeRef = statement.items().getFirst().asRef(); // author/placeOfBirth | ||
| ``` | ||
|
|
||
| Element references can be extended with the same APIs as the entity references. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Element references can be extended with the same APIs as the entity references. | |
| Element references can be extended with the same APIs as the [entity references](#entity-refs). |
java/working-with-cql/query-api.md
Outdated
|
|
||
| // bookshop.Books[year = 2020].author // [!code focus] | ||
| Authors_ authors = CQL.entity(Books_.class).filter(b -> b.year().eq(2020)).author(); // [!code focus] | ||
| Given a simple reference pointing to the book created as follows. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Given a simple reference pointing to the book created as follows. | |
| For the upcoming examples, let's assume a simple reference pointing to the book created as follows: |
|
Go ahead. I am also OK with textual changes. |
java/working-with-cql/query-api.md
Outdated
|
|
||
| You can also get [entity references](query-execution#entity-refs) from the result of a CDS QL statement to address an entity via its key values in other statements. | ||
|
|
||
| Each reference has ordered sequence of _segments_ that define the path from the entity's root to the certain part of it. Segment has the _identifier_ with the name of the entity or an element and optional filter _predicate_. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Each reference has ordered sequence of _segments_ that define the path from the entity's root to the certain part of it. Segment has the _identifier_ with the name of the entity or an element and optional filter _predicate_. | |
| Each reference has ordered sequence of _segments_ that defines the path from the entity's root to the certain part of it. Segment has the _identifier_ with the name of the entity or an element and optional filter _predicate_. |
java/working-with-cql/query-api.md
Outdated
|
|
||
| Each reference has ordered sequence of _segments_ that define the path from the entity's root to the certain part of it. Segment has the _identifier_ with the name of the entity or an element and optional filter _predicate_. | ||
|
|
||
| Existing reference can be reused as an object or a variable, or a new reference can be built on top of it. References are not bound to the particular model and are not checked against it while they are being built. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Existing reference can be reused as an object or a variable, or a new reference can be built on top of it. References are not bound to the particular model and are not checked against it while they are being built. | |
| An existing reference can be reused as an object or a variable, or a new reference can be built on top of it. References are not bound to the particular model and are not checked against it while they are being built. |
java/working-with-cql/query-api.md
Outdated
|
|
||
| Existing reference can be reused as an object or a variable, or a new reference can be built on top of it. References are not bound to the particular model and are not checked against it while they are being built. | ||
|
|
||
| References can be _absolute_ or _relative_. Absolute reference has fully qualified entity name as the identifier in the first segment. They usually have associations as their segments. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| References can be _absolute_ or _relative_. Absolute reference has fully qualified entity name as the identifier in the first segment. They usually have associations as their segments. | |
| References can be _absolute_ or _relative_. An absolute reference has a fully qualified entity name as the identifier in the first segment. They usually have associations as their segments. |
java/working-with-cql/query-api.md
Outdated
|
|
||
| References can be _absolute_ or _relative_. Absolute reference has fully qualified entity name as the identifier in the first segment. They usually have associations as their segments. | ||
|
|
||
| You start with the reference pointing to a book with certain key. You build it using corresponding [model interfaces](../cqn-services/persistence-services#model-interfaces) providing you the methods that corresponds to the elements of the book. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| You start with the reference pointing to a book with certain key. You build it using corresponding [model interfaces](../cqn-services/persistence-services#model-interfaces) providing you the methods that corresponds to the elements of the book. | |
| You start with the reference pointing to a book with a certain key. You build it using corresponding [model interfaces](../cqn-services/persistence-services#model-interfaces) providing you the methods that corresponds to the elements of the book. |
java/working-with-cql/query-api.md
Outdated
| refToAuthor.segments().subList(0, refToAuthor.segments().size() - 1)).asRef(); // Books(ID=...) | ||
| ``` | ||
|
|
||
| You can also construct ref that starts from the first segment to navigate to different path of the same root. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| You can also construct ref that starts from the first segment to navigate to different path of the same root. | |
| You can also construct a ref that starts from the first segment to navigate to different path of the same root. |
The application developers are now exposed to the concept of references via arguments of custom handlers.
They should now what these are and how you supposed to work with them.
We can also improve the APIs a bit as some of these look rather ugly.