Skip to content

Commit 93ab7c3

Browse files
akoclaude
andcommitted
docs: add all MDL statement reference pages (Part VI)
Fill in all 78 reference pages with PostgreSQL-style format: Synopsis, Description, Parameters, Examples, See Also. Covers all statement categories: - Connection (OPEN/CLOSE PROJECT) - Query (11 SHOW + 5 DESCRIBE + SEARCH) - Domain Model (CREATE/ALTER/DROP ENTITY, ENUMERATION, ASSOCIATION, CONSTANT) - Microflow (CREATE MICROFLOW/NANOFLOW, DROP, CREATE JAVA ACTION) - Page (CREATE/ALTER/DROP PAGE/SNIPPET, CREATE LAYOUT) - Security (CREATE MODULE/USER ROLE, GRANT, REVOKE, CREATE DEMO USER) - Navigation (ALTER/SHOW NAVIGATION) - Workflow (CREATE/DROP WORKFLOW) - Business Events (CREATE/DROP BUSINESS EVENT SERVICE) - Catalog (REFRESH, SELECT, SHOW CALLERS/CALLEES/REFERENCES/IMPACT) - External SQL (CONNECT, DISCONNECT, query, GENERATE CONNECTOR, IMPORT) - Settings (SHOW/ALTER SETTINGS) - Organization (CREATE MODULE/FOLDER, MOVE) - Session (SET, SHOW STATUS) Note: files were force-added due to root .gitignore "reference/" rule. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 35056af commit 93ab7c3

78 files changed

Lines changed: 5201 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Business Event Statements
2+
3+
Statements for managing business event services.
4+
5+
Business event services enable asynchronous, event-driven communication between Mendix applications (and external systems) using the Mendix Business Events platform. A service defines named messages with typed attributes and specifies whether the application publishes or subscribes to each message.
6+
7+
## Statements
8+
9+
| Statement | Description |
10+
|-----------|-------------|
11+
| [CREATE BUSINESS EVENT SERVICE](create-business-event-service.md) | Define a business event service with messages |
12+
| [DROP BUSINESS EVENT SERVICE](drop-business-event-service.md) | Remove a business event service |
13+
14+
## Related Statements
15+
16+
| Statement | Syntax |
17+
|-----------|--------|
18+
| Show business events | `SHOW BUSINESS EVENTS [IN module]` |
19+
| Describe service | `DESCRIBE BUSINESS EVENT SERVICE module.Name` |
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
# CREATE BUSINESS EVENT SERVICE
2+
3+
## Synopsis
4+
5+
```sql
6+
CREATE [ OR REPLACE ] BUSINESS EVENT SERVICE module.Name
7+
(
8+
ServiceName: 'service_name',
9+
EventNamePrefix: 'prefix'
10+
)
11+
{
12+
MESSAGE MessageName ( attr: Type [, ...] ) PUBLISH | SUBSCRIBE
13+
[ ENTITY module.Entity ] ;
14+
[ ... ]
15+
}
16+
```
17+
18+
## Description
19+
20+
Creates a business event service that defines one or more messages for event-driven communication between applications.
21+
22+
Each message has a name, a set of typed attributes, and an operation mode (PUBLISH or SUBSCRIBE). A publishing message means this application sends events of that type. A subscribing message means this application receives and handles events of that type.
23+
24+
The `OR REPLACE` option drops any existing service with the same name before creating the new one.
25+
26+
### Service Properties
27+
28+
The service declaration includes two required properties:
29+
30+
- **ServiceName** -- The logical service name used for event routing on the Mendix Business Events broker.
31+
- **EventNamePrefix** -- A prefix prepended to message names to form the fully qualified event name. Can be empty (`''`).
32+
33+
### Message Attributes
34+
35+
Each message defines zero or more attributes with the following supported types:
36+
37+
| Type | Description |
38+
|------|-------------|
39+
| `String` | Text value |
40+
| `Integer` | 32-bit integer |
41+
| `Long` | 64-bit integer |
42+
| `Boolean` | True/false |
43+
| `DateTime` | Date and time |
44+
| `Decimal` | Arbitrary-precision decimal |
45+
46+
### Entity Mapping
47+
48+
The optional `ENTITY` clause on a message links the message to a Mendix entity. For SUBSCRIBE messages, incoming events are mapped to instances of this entity. For PUBLISH messages, entity instances are serialized into outgoing events.
49+
50+
## Parameters
51+
52+
`module.Name`
53+
: Qualified name of the business event service (`Module.ServiceName`).
54+
55+
`ServiceName: 'service_name'`
56+
: The logical service identifier used by the Business Events broker.
57+
58+
`EventNamePrefix: 'prefix'`
59+
: A prefix for event names. Use an empty string (`''`) for no prefix.
60+
61+
`MESSAGE MessageName`
62+
: The name of a message within the service.
63+
64+
`attr: Type`
65+
: An attribute definition within a message. Multiple attributes are comma-separated.
66+
67+
`PUBLISH`
68+
: This application publishes (sends) this message type.
69+
70+
`SUBSCRIBE`
71+
: This application subscribes to (receives) this message type.
72+
73+
`ENTITY module.Entity`
74+
: Optional entity linked to the message for data mapping.
75+
76+
## Examples
77+
78+
Create a service that publishes order events:
79+
80+
```sql
81+
CREATE BUSINESS EVENT SERVICE Shop.OrderEvents
82+
(
83+
ServiceName: 'com.example.shop.orders',
84+
EventNamePrefix: 'shop'
85+
)
86+
{
87+
MESSAGE OrderCreated (OrderId: Long, CustomerName: String, Total: Decimal) PUBLISH
88+
ENTITY Shop.Order;
89+
MESSAGE OrderShipped (OrderId: Long, TrackingNumber: String) PUBLISH
90+
ENTITY Shop.Shipment;
91+
};
92+
```
93+
94+
Create a service that subscribes to external events:
95+
96+
```sql
97+
CREATE BUSINESS EVENT SERVICE Inventory.StockUpdates
98+
(
99+
ServiceName: 'com.example.warehouse.stock',
100+
EventNamePrefix: ''
101+
)
102+
{
103+
MESSAGE StockChanged (ProductId: Long, NewQuantity: Integer) SUBSCRIBE
104+
ENTITY Inventory.StockLevel;
105+
};
106+
```
107+
108+
Replace an existing service:
109+
110+
```sql
111+
CREATE OR REPLACE BUSINESS EVENT SERVICE Shop.OrderEvents
112+
(
113+
ServiceName: 'com.example.shop.orders',
114+
EventNamePrefix: 'shop'
115+
)
116+
{
117+
MESSAGE OrderCreated (OrderId: Long, CustomerName: String, Total: Decimal) PUBLISH;
118+
MESSAGE OrderCancelled (OrderId: Long, Reason: String) PUBLISH;
119+
};
120+
```
121+
122+
## See Also
123+
124+
[DROP BUSINESS EVENT SERVICE](drop-business-event-service.md)
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# DROP BUSINESS EVENT SERVICE
2+
3+
## Synopsis
4+
5+
```sql
6+
DROP BUSINESS EVENT SERVICE module.Name
7+
```
8+
9+
## Description
10+
11+
Removes a business event service from the project. The service is identified by its qualified name. If the service does not exist, an error is returned.
12+
13+
Dropping a service removes all its message definitions and operation implementations. Any microflows that reference the dropped service's messages will need to be updated.
14+
15+
## Parameters
16+
17+
`module.Name`
18+
: The qualified name of the business event service to drop (`Module.ServiceName`).
19+
20+
## Examples
21+
22+
```sql
23+
DROP BUSINESS EVENT SERVICE Shop.OrderEvents;
24+
```
25+
26+
## See Also
27+
28+
[CREATE BUSINESS EVENT SERVICE](create-business-event-service.md)
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Catalog Statements
2+
3+
The catalog is a SQLite database that caches project metadata for fast querying and cross-reference navigation. It is stored in `.mxcli/catalog.db` next to the MPR file.
4+
5+
A basic `REFRESH CATALOG` populates tables for modules, entities, attributes, associations, microflows, nanoflows, pages, snippets, enumerations, and workflows. A `REFRESH CATALOG FULL` additionally populates cross-references (REFS), widgets, strings, source text, and permissions -- enabling callers/callees analysis, impact analysis, and full-text search.
6+
7+
| Statement | Description |
8+
|-----------|-------------|
9+
| [REFRESH CATALOG](refresh-catalog.md) | Rebuild the catalog from the current project state |
10+
| [SELECT FROM CATALOG](select-from-catalog.md) | Query catalog tables with SQL syntax |
11+
| [SHOW CATALOG TABLES](show-catalog-tables.md) | List available catalog tables and their columns |
12+
| [SHOW CALLERS / CALLEES](show-callers-callees.md) | Find what calls an element or what it calls |
13+
| [SHOW REFERENCES / IMPACT / CONTEXT](show-references-impact.md) | Cross-reference navigation and impact analysis |
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# REFRESH CATALOG
2+
3+
## Synopsis
4+
5+
REFRESH CATALOG [ FULL ] [ FORCE ]
6+
7+
## Description
8+
9+
Rebuilds the project metadata catalog from the current state of the open project. The catalog is a SQLite database (`.mxcli/catalog.db`) that enables fast SQL querying and cross-reference navigation over project elements.
10+
11+
Without any options, `REFRESH CATALOG` performs a basic rebuild that populates the core metadata tables: MODULES, ENTITIES, ATTRIBUTES, ASSOCIATIONS, MICROFLOWS, NANOFLOWS, PAGES, SNIPPETS, ENUMERATIONS, and WORKFLOWS.
12+
13+
With the `FULL` option, the rebuild additionally populates cross-reference tables (REFS), widget inventories (WIDGETS), string tables (STRINGS), source text (SOURCE), activity tables (ACTIVITIES), and permission tables (PERMISSIONS). The FULL rebuild is required before using `SHOW CALLERS`, `SHOW CALLEES`, `SHOW REFERENCES`, `SHOW IMPACT`, `SHOW CONTEXT`, or `SEARCH`.
14+
15+
The catalog is cached between sessions. If the project has not changed, repeated `REFRESH CATALOG` calls reuse the cached data. Use `FORCE` to bypass the cache and rebuild unconditionally -- useful after external changes to the MPR file.
16+
17+
## Parameters
18+
19+
**FULL**
20+
: Include cross-references, widgets, strings, source text, and permissions in the catalog. Required for callers/callees analysis and full-text search.
21+
22+
**FORCE**
23+
: Bypass the catalog cache and force a complete rebuild regardless of whether the project appears unchanged.
24+
25+
## Examples
26+
27+
### Basic catalog refresh
28+
29+
```sql
30+
REFRESH CATALOG;
31+
```
32+
33+
### Full rebuild with cross-references
34+
35+
```sql
36+
REFRESH CATALOG FULL;
37+
```
38+
39+
### Force a complete rebuild
40+
41+
```sql
42+
REFRESH CATALOG FULL FORCE;
43+
```
44+
45+
### Refresh from the command line
46+
47+
```sql
48+
-- Shell commands:
49+
-- mxcli -p app.mpr -c "REFRESH CATALOG"
50+
-- mxcli -p app.mpr -c "REFRESH CATALOG FULL"
51+
-- mxcli -p app.mpr -c "REFRESH CATALOG FULL FORCE"
52+
```
53+
54+
## See Also
55+
56+
[SELECT FROM CATALOG](select-from-catalog.md), [SHOW CATALOG TABLES](show-catalog-tables.md), [SHOW CALLERS / CALLEES](show-callers-callees.md)
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
# SELECT FROM CATALOG
2+
3+
## Synopsis
4+
5+
SELECT columns FROM CATALOG.table [ WHERE condition ] [ ORDER BY column [ ASC | DESC ] ] [ LIMIT n ]
6+
7+
## Description
8+
9+
Executes a SQL query against the project metadata catalog. The catalog tables are populated by `REFRESH CATALOG` and can be queried using standard SQL syntax including joins, aggregations, subqueries, and filtering.
10+
11+
All catalog table names are prefixed with `CATALOG.` (e.g., `CATALOG.ENTITIES`, `CATALOG.MICROFLOWS`). The query engine is SQLite, so standard SQLite SQL syntax applies.
12+
13+
The following tables are available after a basic `REFRESH CATALOG`:
14+
15+
| Table | Description |
16+
|-------|-------------|
17+
| `CATALOG.MODULES` | Project modules |
18+
| `CATALOG.ENTITIES` | Entities across all modules |
19+
| `CATALOG.ATTRIBUTES` | Entity attributes |
20+
| `CATALOG.ASSOCIATIONS` | Associations between entities |
21+
| `CATALOG.MICROFLOWS` | Microflows |
22+
| `CATALOG.NANOFLOWS` | Nanoflows |
23+
| `CATALOG.PAGES` | Pages |
24+
| `CATALOG.SNIPPETS` | Snippets |
25+
| `CATALOG.ENUMERATIONS` | Enumerations |
26+
| `CATALOG.WORKFLOWS` | Workflows |
27+
28+
The following tables require `REFRESH CATALOG FULL`:
29+
30+
| Table | Description |
31+
|-------|-------------|
32+
| `CATALOG.ACTIVITIES` | Individual microflow/nanoflow activities |
33+
| `CATALOG.WIDGETS` | Widget instances across pages and snippets |
34+
| `CATALOG.REFS` | Cross-references between elements |
35+
| `CATALOG.PERMISSIONS` | Access rules and role permissions |
36+
| `CATALOG.STRINGS` | All string values in the project |
37+
| `CATALOG.SOURCE` | Source text of microflows, pages, etc. |
38+
39+
## Parameters
40+
41+
**columns**
42+
: Column names or expressions to select. Use `*` for all columns, or specify individual column names. Supports SQL functions like `COUNT()`, `SUM()`, `GROUP_CONCAT()`.
43+
44+
**table**
45+
: A catalog table name (e.g., `ENTITIES`, `MICROFLOWS`). Must be prefixed with `CATALOG.`.
46+
47+
**condition**
48+
: A SQL WHERE clause for filtering rows. Supports standard operators (`=`, `LIKE`, `IN`, `AND`, `OR`) and subqueries.
49+
50+
**column**
51+
: Column to sort by. Append `ASC` (default) or `DESC` for sort direction.
52+
53+
**n**
54+
: Maximum number of rows to return.
55+
56+
## Examples
57+
58+
### List all entities
59+
60+
```sql
61+
SELECT Name, Module FROM CATALOG.ENTITIES;
62+
```
63+
64+
### Find microflows in a specific module
65+
66+
```sql
67+
SELECT Name FROM CATALOG.MICROFLOWS WHERE Module = 'Sales' ORDER BY Name;
68+
```
69+
70+
### Count entities per module
71+
72+
```sql
73+
SELECT Module, COUNT(*) AS EntityCount
74+
FROM CATALOG.ENTITIES
75+
GROUP BY Module
76+
ORDER BY EntityCount DESC;
77+
```
78+
79+
### Find entities with many attributes
80+
81+
```sql
82+
SELECT e.Module, e.Name, COUNT(a.Name) AS AttrCount
83+
FROM CATALOG.ENTITIES e
84+
JOIN CATALOG.ATTRIBUTES a ON e.Id = a.EntityId
85+
GROUP BY e.Module, e.Name
86+
HAVING COUNT(a.Name) > 10
87+
ORDER BY AttrCount DESC;
88+
```
89+
90+
### Find many-to-many associations
91+
92+
```sql
93+
SELECT Name, ParentEntity, ChildEntity
94+
FROM CATALOG.ASSOCIATIONS
95+
WHERE Type = 'ReferenceSet';
96+
```
97+
98+
### Find pages with no microflow references
99+
100+
```sql
101+
SELECT p.Module, p.Name
102+
FROM CATALOG.PAGES p
103+
WHERE p.Id NOT IN (
104+
SELECT DISTINCT TargetId FROM CATALOG.REFS WHERE RefKind = 'page'
105+
);
106+
```
107+
108+
### Limit results
109+
110+
```sql
111+
SELECT Name FROM CATALOG.MICROFLOWS LIMIT 10;
112+
```
113+
114+
## See Also
115+
116+
[REFRESH CATALOG](refresh-catalog.md), [SHOW CATALOG TABLES](show-catalog-tables.md), [SEARCH](show-references-impact.md)

0 commit comments

Comments
 (0)