From 648bd490e8ecab33a8f69a71ca0ee4bf755e9f4a Mon Sep 17 00:00:00 2001 From: Johannes Vogt Date: Wed, 4 Feb 2026 12:04:14 +0100 Subject: [PATCH 01/10] initial select syntax diagram --- cds/assets/cql/select.drawio.svg | 472 +++++++++++++++++++++++++++++++ 1 file changed, 472 insertions(+) create mode 100644 cds/assets/cql/select.drawio.svg diff --git a/cds/assets/cql/select.drawio.svg b/cds/assets/cql/select.drawio.svg new file mode 100644 index 000000000..5270f63eb --- /dev/null +++ b/cds/assets/cql/select.drawio.svg @@ -0,0 +1,472 @@ + + + + + + + + + + + + + + + cap-style + + + + + + + + + + sql-style + + + + + + + + + + + + + + + + + literal value + + + + + + + + + + + } + + + + + + + + + + + query source + + + + + + + + + + + SELECT + + + + + + + + + + FROM + + + + + + + + + + WHERE + + + + + + + + + + { + + + + + + + + + + , + + + + + + + + + + + select item + + + + + + + + + + + + query source + + + + + + + + + + + SELECT + + + + + + + + + + FROM + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + GROUP BY + + + + + + + + + + HAVING + + + + + + + + + + + + + + DISTINCT + + + + + + + + + + + + + + , + + + + + + + + + + + expr + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + , + + + + + + + + + + + expr + + + + + + + + + + + + + + + + + + + , + + + + + + + + + + + expr + + + + + + + + + + + + + + + + + + + + + + + + + + + ORDER BY + + + + + + + + + + , + + + + + + + + + + + expr + + + + + + + + + + + + + + + + + + + LIMIT + + + + + + + + + + OFFSET + + + + + + + + + + + + + + + + + + + + + + , + + + + + + + + + + + select item + + + + + + + + + + + + + + + + + + \ No newline at end of file From cb72a741dec0144443b50c009b4f7905c2098ad7 Mon Sep 17 00:00:00 2001 From: Johannes Vogt Date: Mon, 9 Feb 2026 17:52:28 +0100 Subject: [PATCH 02/10] select item and projection diagrams --- cds/assets/cql/nested-expand.drawio.svg | 347 ++++++++++++++ cds/assets/cql/nested-inline.drawio.svg | 320 +++++++++++++ cds/assets/cql/postfix-projection.drawio.svg | 272 +++++++++++ cds/assets/cql/select-item.drawio.svg | 365 ++++++++++++++ cds/assets/cql/select.drawio.svg | 470 +++++++++++++------ cds/cql.md | 22 + 6 files changed, 1640 insertions(+), 156 deletions(-) create mode 100644 cds/assets/cql/nested-expand.drawio.svg create mode 100644 cds/assets/cql/nested-inline.drawio.svg create mode 100644 cds/assets/cql/postfix-projection.drawio.svg create mode 100644 cds/assets/cql/select-item.drawio.svg diff --git a/cds/assets/cql/nested-expand.drawio.svg b/cds/assets/cql/nested-expand.drawio.svg new file mode 100644 index 000000000..d5a130ce0 --- /dev/null +++ b/cds/assets/cql/nested-expand.drawio.svg @@ -0,0 +1,347 @@ + + + + + + + + + + +
+
+
+ + { + +
+
+
+
+ + { + +
+
+
+ + + + + + + + + + + + + + + + + + + +
+
+
+ + } + +
+
+
+
+ + } + +
+
+
+ + + + + + + +
+
+
+ select item +
+
+
+
+ + select item + +
+
+
+ + + + + + + +
+
+
+ + , + +
+
+
+
+ + , + +
+
+
+ + + + + + + + + + + +
+
+
+ EXCLUDING +
+
+
+
+ + EXCLUDING + +
+
+
+ + + + + + + +
+
+
+ + } + +
+
+
+
+ + } + +
+
+
+ + + + + + + +
+
+
+ + { + +
+
+
+
+ + { + +
+
+
+ + + + + + + +
+
+
+ identifier +
+
+
+
+ + identifier + +
+
+
+ + + + + + + +
+
+
+ + , + +
+
+
+
+ + , + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ path expression +
+
+
+
+ + path expression + +
+
+
+ + + + + + + + + + + +
+
+
+ AS +
+
+
+
+ + AS + +
+
+
+ + + + + + + +
+
+
+ alias +
+
+
+
+ + alias + +
+
+
+ + + + + + + + + + + + + + + + +
+ + + + + Text is not SVG - cannot display + + + +
\ No newline at end of file diff --git a/cds/assets/cql/nested-inline.drawio.svg b/cds/assets/cql/nested-inline.drawio.svg new file mode 100644 index 000000000..d559daf9b --- /dev/null +++ b/cds/assets/cql/nested-inline.drawio.svg @@ -0,0 +1,320 @@ + + + + + + + + + + +
+
+
+ + { + +
+
+
+
+ + { + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + } + +
+
+
+
+ + } + +
+
+
+ + + + + + + +
+
+
+ select item +
+
+
+
+ + select item + +
+
+
+ + + + + + + +
+
+
+ + , + +
+
+
+
+ + , + +
+
+
+ + + + + + + + + + + +
+
+
+ EXCLUDING +
+
+
+
+ + EXCLUDING + +
+
+
+ + + + + + + +
+
+
+ + } + +
+
+
+
+ + } + +
+
+
+ + + + + + + +
+
+
+ + { + +
+
+
+
+ + { + +
+
+
+ + + + + + + +
+
+
+ identifier +
+
+
+
+ + identifier + +
+
+
+ + + + + + + +
+
+
+ + , + +
+
+
+
+ + , + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + . + +
+
+
+
+ + . + +
+
+
+ + + + + + + +
+
+
+ path expression +
+
+
+
+ + path expression + +
+
+
+ + + + + + + + +
+ + + + + Text is not SVG - cannot display + + + +
\ No newline at end of file diff --git a/cds/assets/cql/postfix-projection.drawio.svg b/cds/assets/cql/postfix-projection.drawio.svg new file mode 100644 index 000000000..ee228ee4e --- /dev/null +++ b/cds/assets/cql/postfix-projection.drawio.svg @@ -0,0 +1,272 @@ + + + + + + + + + + +
+
+
+ + { + +
+
+
+
+ + { + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + } + +
+
+
+
+ + } + +
+
+
+ + + + + + + +
+
+
+ select item +
+
+
+
+ + select item + +
+
+
+ + + + + + + +
+
+
+ + , + +
+
+
+
+ + , + +
+
+
+ + + + + + + + + + + +
+
+
+ EXCLUDING +
+
+
+
+ + EXCLUDING + +
+
+
+ + + + + + + +
+
+
+ + } + +
+
+
+
+ + } + +
+
+
+ + + + + + + +
+
+
+ + { + +
+
+
+
+ + { + +
+
+
+ + + + + + + +
+
+
+ identifier +
+
+
+
+ + identifier + +
+
+
+ + + + + + + +
+
+
+ + , + +
+
+
+
+ + , + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + Text is not SVG - cannot display + + + +
\ No newline at end of file diff --git a/cds/assets/cql/select-item.drawio.svg b/cds/assets/cql/select-item.drawio.svg new file mode 100644 index 000000000..8ce4e8320 --- /dev/null +++ b/cds/assets/cql/select-item.drawio.svg @@ -0,0 +1,365 @@ + + + + + + + + + + nested inline + + + + + + + + + + nested expand + + + + + + + + + + +
+
+
+ AS +
+
+
+
+ + AS + +
+
+
+ + + + + + + +
+
+
+ expr +
+
+
+
+ + expr + +
+
+
+ + + + + + + + + + + + + + + + + + + + + +
+
+
+ alias +
+
+
+
+ + alias + +
+
+
+ + + + + + + + + + + + + + + + + + + +
+
+
+ path expression +
+
+
+
+ + path expression + +
+
+
+ + + + + + + +
+
+
+ + : + +
+
+
+
+ + : + +
+
+
+ + + + + + + +
+
+
+ type +
+
+
+
+ + type + +
+
+
+ + + + + + + + + + + + + + + + + + + +
+
+
+ postfix projection +
+
+
+
+ + postfix projection + +
+
+
+ + + + + + + + + + + +
+
+
+ AS +
+
+
+
+ + AS + +
+
+
+ + + + + + + +
+
+
+ alias +
+
+
+
+ + alias + +
+
+
+ + + + + + + + + + + + + + + + + + + +
+
+
+ + . + +
+
+
+
+ + . + +
+
+
+ + + + + + + +
+
+
+ + postfix projection + +
+
+
+
+ + postfix projection + +
+
+
+ + + + + + + +
+
+
+ path expression +
+
+
+
+ + path expression + +
+
+
+ + + + + + + + + + + + + + + + + + + + +
+ + + + + Text is not SVG - cannot display + + + +
\ No newline at end of file diff --git a/cds/assets/cql/select.drawio.svg b/cds/assets/cql/select.drawio.svg index 5270f63eb..24c0bd56a 100644 --- a/cds/assets/cql/select.drawio.svg +++ b/cds/assets/cql/select.drawio.svg @@ -1,134 +1,111 @@ - - - - - - - + + - + - + cap-style - + - + sql-style - + - + - - - - - - - - literal value - - - - - + - + } - + - + query source - + - + SELECT - + - + FROM - + - + WHERE - + - + { - + - + , - + - + select item @@ -136,337 +113,518 @@ - + - + query source - + - + SELECT - + - + FROM - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - - - - + - + GROUP BY - + - + HAVING - - - - - + - + DISTINCT - - + + - + - + , - + - + expr - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - + , - + - + expr - - + + - - + + - + - + , - + - + expr - - + + - - + + - - + + - - + + - + - + ORDER BY - + - + , - + - - expr + + ordering-term - - + + - - + + - + - + LIMIT - + - + OFFSET - - + + - - + + - - + + - + - + , - + - + select item - - + + + + + + + + + + - - + + - - + + + + + + + + + + ALL? + + + + + + + + + + + expr + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ EXCLUDING +
+
+
+
+ + EXCLUDING + +
+
+
+ + + + + + + +
+
+
+ + } + +
+
+
+
+ + } + +
+
+
+ + + + + + + +
+
+
+ + { + +
+
+
+
+ + { + +
+
+
+ + + + + + + +
+
+
+ identifier +
+
+
+
+ + identifier + +
+
+
+ + + + + + + +
+
+
+ + , + +
+
+
+
+ + , + +
+
+
+ + + + + + + + + + + + + + + + + + +
+ + + + + Text is not SVG - cannot display + + +
\ No newline at end of file diff --git a/cds/cql.md b/cds/cql.md index 3e2abae87..3c8c4e5fa 100644 --- a/cds/cql.md +++ b/cds/cql.md @@ -14,9 +14,25 @@ CDS Query Language (CQL) is based on standard SQL, which it enhances by... [[toc]] + +## SELECT + +![](./assets/cql/select.drawio.svg) + +> Using: Query Source, Select Item, Expressions, Ordering Term + + + +## Select Item + +![](./assets/cql/select-item.drawio.svg) + + ## Postfix Projections {#postfix-projections} +![](./assets/cql/postfix-projection.drawio.svg) + CQL allows to put projections, that means, the `SELECT` clause, behind the `FROM` clause enclosed in curly braces. For example, the following are equivalent: ```sql @@ -29,6 +45,10 @@ SELECT from Authors { name, address.street } ### Nested Expands {#nested-expands} + +![](./assets/cql/nested-expand.drawio.svg) + + Postfix projections can be appended to any column referring to a struct element or an association and hence be nested. This allows **expand** results along associations and hence read deeply structured documents: @@ -125,6 +145,8 @@ results = [ ### Nested Inlines {#nested-inlines} +![](./assets/cql/nested-inline.drawio.svg) + Put a **`"."`** before the opening brace to **inline** the target elements and avoid writing lengthy lists of paths to read several elements from the same target. For example: ```sql From 571917b94497f9366099e7f0cd2642a00f836564 Mon Sep 17 00:00:00 2001 From: Johannes Vogt Date: Tue, 10 Feb 2026 12:37:22 +0100 Subject: [PATCH 03/10] new diagram style --- cds/assets/cql/select.drawio.svg | 875 ++++++++++++++++++------------- 1 file changed, 517 insertions(+), 358 deletions(-) diff --git a/cds/assets/cql/select.drawio.svg b/cds/assets/cql/select.drawio.svg index 24c0bd56a..11dcfa78c 100644 --- a/cds/assets/cql/select.drawio.svg +++ b/cds/assets/cql/select.drawio.svg @@ -1,622 +1,781 @@ - + - + - - - cap-style + + + postfix projection - + - - - sql-style - + + + +
+
+
+ SELECT +
+
+
+
+ + SELECT + +
- + - + + + +
+
+
+ FROM +
+
+
+
+ + FROM + +
+
- + - - - } - - - - - - - - - - + + + +
+
+
+ query source +
+
+
+
+ query source -
+
-
- - - - - SELECT - - + - + + + +
+
+
+ + { + +
+
+
+
+ + { + +
+
- - - FROM - - + + - + + - - - WHERE - - + + - + - - - { - + + + +
+
+
+ + } + +
+
+
+
+ + } + +
- + - - - , - - - - - - - - - - + + + +
+
+
+ select item +
+
+
+
+ select item -
-
-
- - - - - - - - query source - - - - - - - - - - - SELECT - + - + - - - FROM - + + + +
+
+
+ + , + +
+
+
+
+ + , + +
- - - - - - + + - - + - - - - - - - - - - + + + +
+
+
+ EXCLUDING +
+
+
+
+ + EXCLUDING + +
+
- - + - - + + + +
+
+
+ + } + +
+
+
+
+ + } + +
+
- + - - - GROUP BY - + + + +
+
+
+ + { + +
+
+
+
+ + { + +
- + - - - HAVING - + + + +
+
+
+ identifier +
+
+
+
+ + identifier + +
- + - - - DISTINCT - + + + +
+
+
+ + , + +
+
+
+
+ + , + +
- - + + - + + - - - , - - + + - - - - - - - - expr - - - - - - + + - - + + - - + + - - + + - - + + - - + + - - + - - + + - + - - - , - - - - - - - - - - - expr + + + +
+
+
+ WHERE +
+
+
+
+ + WHERE -
+
-
- - - - - - - + - + - - - , - - - - - - - - - - + + + +
+
+
+ expr +
+
+
+
+ expr -
+
-
- - - - - + - - + + + +
+
+
+ + , + +
+
+
+
+ + , + +
+
- - + + - + + - - - ORDER BY - - + + - + + - - - , - - + - - - - - - - - ordering-term + + + + +
+
+
+ GROUP BY +
+
+
+
+ + GROUP BY -
+
-
- - - + - - + - - - - - - LIMIT - + + + +
+
+
+ expr +
+
+
+
+ + expr + +
- + - - - OFFSET - + + + +
+
+
+ + , + +
+
+
+
+ + , + +
- - + + - - + + - - + + - + - - - , - - - - - - - - - - - select item + + + +
+
+
+ HAVING +
+
+
+
+ + HAVING -
+
-
- - - + - - + - - + + + +
+
+
+ expr +
+
+
+
+ + expr + +
+
- - + - - + + + +
+
+
+ + , + +
+
+
+
+ + , + +
+
- + + - - - ALL? - - + + - - - - - - - - expr - - - - - - + + - - + + - - + + - - + - - + + + +
+
+
+ ORDER BY +
+
+
+
+ + ORDER BY + +
+
+ - + -
+
-
- EXCLUDING +
+ ordering term
- - EXCLUDING + + ordering term - + -
+
- } + ,
- - } + + , - + + + + + + + + + + + + + + + + + -
+
-
- - { - +
+ LIMIT
- - { + + LIMIT - + -
+
- identifier + expr
- - identifier + + expr - + -
+
+
+
+ OFFSET +
+
+
+ + + OFFSET + + + + + + + + + + + +
- - , - + expr
- - , + + expr
- - + + + + + + + + + + + + + - - + + - - + + - - + + - - + + From 4a19e3950b9c29db1811fd77f1234cdc8ef5247e Mon Sep 17 00:00:00 2001 From: Johannes Vogt Date: Tue, 10 Feb 2026 13:10:10 +0100 Subject: [PATCH 04/10] adjustments --- cds/assets/cql/select.drawio.svg | 36 ++++++++++++++++---------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/cds/assets/cql/select.drawio.svg b/cds/assets/cql/select.drawio.svg index 11dcfa78c..4efc70782 100644 --- a/cds/assets/cql/select.drawio.svg +++ b/cds/assets/cql/select.drawio.svg @@ -1,8 +1,8 @@ - + - + @@ -292,7 +292,7 @@ - + @@ -300,7 +300,7 @@ - + @@ -324,7 +324,7 @@ - + @@ -413,8 +413,8 @@ - - + + @@ -577,8 +577,8 @@ - - + + @@ -659,7 +659,7 @@ - + @@ -759,23 +759,23 @@ - + - - + + - + - - + + - - + + From 1525ad306a842dbdbd1474519aa049bc4ad94443 Mon Sep 17 00:00:00 2001 From: Johannes Vogt Date: Tue, 10 Feb 2026 13:31:53 +0100 Subject: [PATCH 05/10] inline svg --- cds/assets/cql/select.drawio.svg | 642 ++++++++----------------------- cds/cql.md | 18 +- 2 files changed, 181 insertions(+), 479 deletions(-) diff --git a/cds/assets/cql/select.drawio.svg b/cds/assets/cql/select.drawio.svg index 4efc70782..d00701873 100644 --- a/cds/assets/cql/select.drawio.svg +++ b/cds/assets/cql/select.drawio.svg @@ -1,100 +1,58 @@ - + - - - - - - - postfix projection - + + + - + + + + postfix projection + + + + - - - -
-
-
- SELECT -
-
-
-
- - SELECT - -
+ + + SELECT +
- - - -
-
-
- FROM -
-
-
-
- - FROM - -
+ + + FROM +
- - - - - - - -
-
-
- query source -
-
-
-
- + + + + + + + query source -
+
-
+ - - - -
-
-
- - { - -
-
-
-
- - { - -
+ + + { +
@@ -113,67 +71,32 @@ - - - -
-
-
- - } - -
-
-
-
- - } - -
+ + + } +
- - - - - - - -
-
-
- select item -
-
-
-
- + + + + + + + select item -
+
-
+ - - - -
-
-
- - , - -
-
-
-
- - , - -
+ + + , +
@@ -184,111 +107,50 @@ - - - -
-
-
- EXCLUDING -
-
-
-
- - EXCLUDING - -
+ + + EXCLUDING +
- - - -
-
-
- - } - -
-
-
-
- - } - -
+ + + } +
- - - -
-
-
- - { - -
-
-
-
- - { - -
+ + + { +
- - - -
-
-
- identifier -
-
-
-
- - identifier - -
+ + + identifier +
- - - -
-
-
- - , - -
-
-
-
- - , - -
+ + + , +
@@ -338,66 +200,35 @@ - - - -
-
-
- WHERE -
-
-
-
- - WHERE - -
+ + + WHERE +
- - + - - - - -
-
-
- expr -
-
-
-
- + + + + + + + expr -
+
-
+ - - - -
-
-
- - , - -
-
-
-
- - , - -
+ + + , +
@@ -420,66 +251,35 @@ - - - -
-
-
- GROUP BY -
-
-
-
- - GROUP BY - -
+ + + GROUP BY +
- - + - - - - -
-
-
- expr -
-
-
-
- + + + + + + + expr -
+
-
+ - - - -
-
-
- - , - -
-
-
-
- - , - -
+ + + , +
@@ -498,66 +298,35 @@ - - - -
-
-
- HAVING -
-
-
-
- - HAVING - -
+ + + HAVING +
- - + - - - - -
-
-
- expr -
-
-
-
- + + + + + + + expr -
+
-
+ - - - -
-
-
- - , - -
-
-
-
- - , - -
+ + + , +
@@ -584,66 +353,33 @@ - - - -
-
-
- ORDER BY -
-
-
-
- - ORDER BY - -
+ + + ORDER BY +
- + + + - - - -
-
-
- ordering term -
-
-
-
- - ordering term - -
+ + + ordering term +
- - - -
-
-
- - , - -
-
-
-
- - , - -
+ + + , +
@@ -666,86 +402,46 @@ - - - -
-
-
- LIMIT -
-
-
-
- - LIMIT - -
+ + + LIMIT +
- - - - - - - -
-
-
- expr -
-
-
-
- + + + + + + + expr -
+
-
+ - - - -
-
-
- OFFSET -
-
-
-
- - OFFSET - -
+ + + OFFSET +
- - - - - - - -
-
-
- expr -
-
-
-
- + + + + + + + expr -
+
-
+ @@ -778,12 +474,4 @@
- - - - - Text is not SVG - cannot display - - -
\ No newline at end of file diff --git a/cds/cql.md b/cds/cql.md index 3c8c4e5fa..84dbde6d2 100644 --- a/cds/cql.md +++ b/cds/cql.md @@ -13,15 +13,22 @@ CDS Query Language (CQL) is based on standard SQL, which it enhances by... [[toc]] + ## SELECT -![](./assets/cql/select.drawio.svg) +
+
+
-> Using: Query Source, Select Item, Expressions, Ordering Term +> Using: [Query Source](#query-source), [Select Item](#select-item), [Expressions](./cxl#expr), Ordering Term +## Query Source + ## Select Item @@ -488,3 +495,10 @@ extend BookReviews with columns { book : Association to Books on book.ID = bookID }; ``` + From 7b6b0d13dc411a82ecc83ff94689d2eb8372e9b1 Mon Sep 17 00:00:00 2001 From: Johannes Vogt Date: Tue, 10 Feb 2026 13:54:57 +0100 Subject: [PATCH 06/10] query source --- cds/assets/cql/query-source.drawio.svg | 255 +++++++++++++++++++++++++ cds/cql.md | 15 ++ 2 files changed, 270 insertions(+) create mode 100644 cds/assets/cql/query-source.drawio.svg diff --git a/cds/assets/cql/query-source.drawio.svg b/cds/assets/cql/query-source.drawio.svg new file mode 100644 index 000000000..e19f785b0 --- /dev/null +++ b/cds/assets/cql/query-source.drawio.svg @@ -0,0 +1,255 @@ + + + + + + + + + + + FQN + + + + + + + + + + + + + + +
+
+
+ path expression +
+
+
+
+ + path expression + +
+
+
+ + + + + + + +
+
+
+ identifier +
+
+
+
+ + identifier + +
+
+
+ + + + + + + +
+
+
+ + : + +
+
+
+
+ + : + +
+
+
+ + + + + + + +
+
+
+ AS +
+
+
+
+ + AS + +
+
+
+ + + + + + + +
+
+
+ alias +
+
+
+
+ + alias + +
+
+
+ + + + + + + +
+
+
+ namespace +
+
+
+
+ + namespace + +
+
+
+ + + + + + + +
+
+
+ infix filter +
+
+
+
+ + infix filter + +
+
+
+ + + + + + + +
+
+
+ + . + +
+
+
+
+ + . + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + Text is not SVG - cannot display + + + +
\ No newline at end of file diff --git a/cds/cql.md b/cds/cql.md index 84dbde6d2..9937d9c10 100644 --- a/cds/cql.md +++ b/cds/cql.md @@ -15,6 +15,7 @@ CDS Query Language (CQL) is based on standard SQL, which it enhances by... @@ -29,6 +30,9 @@ import select from './assets/cql/select.drawio.svg?raw' ## Query Source +
+
+
## Select Item @@ -499,6 +503,17 @@ extend BookReviews with columns { .diagram { all: initial; + max-width: 100%; +} + +.diagram > div > svg { + max-width: 100%; + height: auto; +} + +.diagram > svg { + max-width: 100%; + height: auto; } From ccfb388b28afa1d50a926a2ab3f0fd6b9b1987c3 Mon Sep 17 00:00:00 2001 From: Johannes Vogt Date: Tue, 10 Feb 2026 14:34:53 +0100 Subject: [PATCH 07/10] adjustments --- cds/assets/cql/query-source.drawio.svg | 126 ++++++++++++++----------- 1 file changed, 71 insertions(+), 55 deletions(-) diff --git a/cds/assets/cql/query-source.drawio.svg b/cds/assets/cql/query-source.drawio.svg index e19f785b0..5e2043a7d 100644 --- a/cds/assets/cql/query-source.drawio.svg +++ b/cds/assets/cql/query-source.drawio.svg @@ -1,4 +1,4 @@ - + @@ -6,7 +6,7 @@ - + FQN @@ -14,16 +14,16 @@ - + - + - + - -
+ +
path expression @@ -31,7 +31,7 @@
- + path expression @@ -41,9 +41,9 @@ - + - +
@@ -59,13 +59,13 @@ - + - + - -
+ +
@@ -75,20 +75,20 @@
- + : - + - + - -
+ +
AS @@ -96,20 +96,20 @@
- + AS - + - + - -
+ +
alias @@ -117,7 +117,7 @@
- + alias @@ -127,9 +127,9 @@ - + - +
@@ -145,13 +145,13 @@ - + - + - -
+ +
infix filter @@ -159,7 +159,7 @@
- + infix filter @@ -169,9 +169,9 @@ - + - +
@@ -201,47 +201,63 @@ - - + + - - + + - - + + - - + + - - + + - - + - + + - - + + - - + + - - + + - - + + + + + + + + + + + + + + + + + + From 5ae6b569df658e27d9fff255a419562cd7695183 Mon Sep 17 00:00:00 2001 From: Johannes Vogt Date: Tue, 10 Feb 2026 14:35:04 +0100 Subject: [PATCH 08/10] ordering term --- cds/assets/cql/ordering-term.drawio.svg | 201 ++++++++++++++++++++++++ cds/cql.md | 10 ++ 2 files changed, 211 insertions(+) create mode 100644 cds/assets/cql/ordering-term.drawio.svg diff --git a/cds/assets/cql/ordering-term.drawio.svg b/cds/assets/cql/ordering-term.drawio.svg new file mode 100644 index 000000000..a3ad2b3ac --- /dev/null +++ b/cds/assets/cql/ordering-term.drawio.svg @@ -0,0 +1,201 @@ + + + + + + + + + + + + + + + + + expr + + + + + + + + + + + +
+
+
+ ASC +
+
+
+
+ + ASC + +
+
+
+ + + + + + + +
+
+
+ DESC +
+
+
+
+ + DESC + +
+
+
+ + + + + + + +
+
+
+ NULLS +
+
+
+
+ + NULLS + +
+
+
+ + + + + + + +
+
+
+ FIRST +
+
+
+
+ + FIRST + +
+
+
+ + + + + + + +
+
+
+ NULLS +
+
+
+
+ + NULLS + +
+
+
+ + + + + + + +
+
+
+ LAST +
+
+
+
+ + LAST + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + Text is not SVG - cannot display + + + +
\ No newline at end of file diff --git a/cds/cql.md b/cds/cql.md index 9937d9c10..5cf898ad2 100644 --- a/cds/cql.md +++ b/cds/cql.md @@ -16,6 +16,7 @@ CDS Query Language (CQL) is based on standard SQL, which it enhances by... @@ -499,6 +500,15 @@ extend BookReviews with columns { book : Association to Books on book.ID = bookID }; ``` + + +## Ordering Term + +
+
+
+ + From bcd02b1586ecf5db24229841748b22a3feedcbe5 Mon Sep 17 00:00:00 2001 From: Johannes Vogt Date: Tue, 10 Feb 2026 19:59:15 +0100 Subject: [PATCH 10/10] md plugin for raw svg import --- .vitepress/config.js | 2 ++ .vitepress/lib/md-diagram-svg.ts | 22 ++++++++++++++++++ .vitepress/theme/styles.scss | 12 ++++++++++ cds/cql.md | 39 ++++++-------------------------- 4 files changed, 43 insertions(+), 32 deletions(-) create mode 100644 .vitepress/lib/md-diagram-svg.ts diff --git a/.vitepress/config.js b/.vitepress/config.js index 0bfab873f..4b10f941f 100644 --- a/.vitepress/config.js +++ b/.vitepress/config.js @@ -194,10 +194,12 @@ if (process.env.VITE_CAPIRE_EXTRA_ASSETS) { import { dl } from '@mdit/plugin-dl' import * as MdAttrsPropagate from './lib/md-attrs-propagate' import * as MdTypedModels from './lib/md-typed-models' +import * as MdDiagramSvg from './lib/md-diagram-svg' config.markdown.config = md => { MdAttrsPropagate.install(md) MdTypedModels.install(md) + MdDiagramSvg.install(md) md.use(dl) } diff --git a/.vitepress/lib/md-diagram-svg.ts b/.vitepress/lib/md-diagram-svg.ts new file mode 100644 index 000000000..fdcfccccd --- /dev/null +++ b/.vitepress/lib/md-diagram-svg.ts @@ -0,0 +1,22 @@ +import { MarkdownEnv, MarkdownRenderer } from 'vitepress' +import { readFileSync } from 'node:fs'; +import { dirname, join } from 'node:path'; + +export function install(md: MarkdownRenderer) { + const defaultImage = + md.renderer.rules.image || + ((tokens, idx, options, env, self) => self.renderToken(tokens, idx, options)) + + md.renderer.rules.image = (tokens, idx, options, env: MarkdownEnv, self) => { + const token = tokens[idx] + const src = token.attrGet('src') || '' + + if (!/\.svg\?raw$/.test(src)) { + return defaultImage(tokens, idx, options, env, self) + } + const mdDir = dirname(env.realPath ?? env.path) + const filePath = join(mdDir, src.replace('?raw', '')) + const content = readFileSync(filePath, 'utf-8') + return `${content}` + } +} diff --git a/.vitepress/theme/styles.scss b/.vitepress/theme/styles.scss index 2989dbbbd..78846f49b 100644 --- a/.vitepress/theme/styles.scss +++ b/.vitepress/theme/styles.scss @@ -312,6 +312,18 @@ img, video.bright { } } +// Raw svg diagrams +.diagram { + all: initial; // preserve original svg formatting + .dark & { // recolor in dark mode + filter: brightness(.884) invert(1) hue-rotate(177deg); + } + svg { + max-width: 100%; + height: auto; + margin: 30px auto; + } +} .VPBadge { diff --git a/cds/cql.md b/cds/cql.md index 4270a88ea..7c7d2f989 100644 --- a/cds/cql.md +++ b/cds/cql.md @@ -13,33 +13,27 @@ CDS Query Language (CQL) is based on standard SQL, which it enhances by... [[toc]] - - ## SELECT -
+![](./assets/cql/select.drawio.svg?raw) > Using: [Query Source](#query-source), [Select Item](#select-item), [Expressions](./cxl#expr), Ordering Term ## Query Source -
+![](./assets/cql/query-source.drawio.svg?raw) ## Select Item -![](./assets/cql/select-item.drawio.svg) +![](./assets/cql/select-item.drawio.svg?raw) ## Postfix Projections {#postfix-projections} -![](./assets/cql/postfix-projection.drawio.svg) +![](./assets/cql/postfix-projection.drawio.svg?raw) CQL allows to put projections, that means, the `SELECT` clause, behind the `FROM` clause enclosed in curly braces. For example, the following are equivalent: @@ -54,7 +48,7 @@ SELECT from Authors { name, address.street } {#nested-expands} -![](./assets/cql/nested-expand.drawio.svg) +![](./assets/cql/nested-expand.drawio.svg?raw) Postfix projections can be appended to any column referring to a struct element or an association and hence be nested. @@ -153,7 +147,7 @@ results = [ ### Nested Inlines {#nested-inlines} -![](./assets/cql/nested-inline.drawio.svg) +![](./assets/cql/nested-inline.drawio.svg?raw) Put a **`"."`** before the opening brace to **inline** the target elements and avoid writing lengthy lists of paths to read several elements from the same target. For example: @@ -500,23 +494,4 @@ extend BookReviews with columns { ## Ordering Term -
- - - +![](./assets/cql/ordering-term.drawio.svg?raw)