Skip to content

Commit 187685e

Browse files
Merge pull request #10311 from ako/howto-ags
Add Altair Graph Studio integration how-to documentation
2 parents 44501f3 + 2d91659 commit 187685e

28 files changed

Lines changed: 239 additions & 0 deletions

content/en/docs/refguide/modeling/integration/_index.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,8 @@ The following services require you to download an external module from the Mendi
3333
* [External Database Connector](https://marketplace.mendix.com/link/component/219862)
3434
* [Business Event services](https://marketplace.mendix.com/link/component/202649)
3535

36+
## Integrating Altair Graph Studio
37+
38+
In addition to the integration capabilities available in the Studio Pro, Mendix also supports integration with external systems through Altair Graph Studio. Altair Graph Studio provides a scalable environment for connecting, managing, and analyzing graph-based data. For more information, see [Integrating Mendix with Altair Graph Studio](/refguide/altair-graph-studio/).
39+
3640
## Documents in This Category
Lines changed: 232 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,232 @@
1+
---
2+
title: "Integrating Mendix with Altair Graph Studio"
3+
linktitle: "Altair Graph Studio"
4+
url: /refguide/altair-graph-studio
5+
weight: 90
6+
description: "Describes how to use graph data from Altair Graph Studio in your Mendix application."
7+
---
8+
9+
## Introduction
10+
11+
Altair Graph Studio (AGS) provides a highly scalable graph database suitable for analytical queries, offering access to data from different backend systems. It is an extremely powerful tool to unify data from multiple backend systems and link it from different sources into one unified data model. Graph Studio provides both virtualized and replicated access to data, with powerful data ingestion facilities to ingest, transform, clean, and correlate data from different sources.
12+
13+
This guide helps you understand the process of creating a graphmart in the Altair Graph Studio, loading data, and querying that data from a Mendix application using OData REST endpoints and SPARQL queries.
14+
15+
## Prerequisites
16+
17+
Before you begin, make sure you have:
18+
19+
* Access to an Altair Graph Studio instance
20+
* A Mendix Studio Pro development environment (Mx9 or Mx10 recommended)
21+
* Sample JSON data to import (or use the example data provided)
22+
* Basic understanding of REST APIs and microflows in Mendix
23+
* Graph Studio credentials (username and password for API authentication)
24+
25+
## Setting Up Graph Studio with an Ontology and Data
26+
27+
### Creating a New Graphmart
28+
29+
A graphmart in Altair Graph Studio is a logical container for your data and ontologies. It provides a unified view of data from one or more sources.
30+
31+
### Adding a Source Layer
32+
33+
A source layer allows you to import data from various sources or start from a JSON document. Source layers can:
34+
35+
* Import data from databases, APIs, or files
36+
* Transform and map data to your ontology
37+
* Keep data synchronized with source systems
38+
39+
{{< figure src="/attachments/refguide/modeling/integration/altair/add-layer.png" >}}
40+
41+
### Uploading and Validating JSON Data
42+
43+
You can start by uploading an example test dataset in JSON format. You can ask an LLM (for example, ChatGPT) to generate some sample data. This document uses a test set with PLM (Product Lifecycle Management) and BOM (Bill of Materials) data.
44+
45+
Upload the JSON source data into the source layer.
46+
47+
You can review the JSON structure and the data in the file you just uploaded in Graph Studio. It will show you a tree structure of your JSON file, data types, and sample values.
48+
49+
{{< figure src="/attachments/refguide/modeling/integration/altair/sample-data-plm.png" class="no-border" >}}
50+
51+
### Reviewing the Generated Ontology
52+
53+
When you save the source layer, an ontology will be automatically generated based on the JSON structure. You can review it in:
54+
55+
* The **Graph** tab for visual representation
56+
* The **Ontology Models** section provides detailed class and property definitions
57+
58+
{{% alert color="info" %}}
59+
You can customize the generated ontology by adding descriptions, constraints, and relationships between classes to better model your domain.
60+
{{% /alert %}}
61+
62+
The **Ontology Models** section contains a definition based on the graph of the uploaded JSON data. The ontology defines the structure and main concepts of your data model.
63+
64+
### Creating and Testing a SPARQL Query
65+
66+
Now that you have data and an ontology in Graph Studio, create a SPARQL query to retrieve data from the graph. While Graph Studio also provides OData and SQL access, SPARQL is the most flexible way to work with graph data.
67+
68+
Create a new query in the Query Playground. Enter the SPARQL query and test the result.
69+
70+
{{< figure src="/attachments/refguide/modeling/integration/altair/sparql.png" >}}
71+
72+
The following is an example SPARQL query for customers:
73+
74+
```sparql
75+
PREFIX dt: <http://cambridgesemantics.com/SourceLayer/YOUR_SOURCE_ID/Model#>
76+
77+
SELECT ?customerId ?customerName ?email ?phone ?city ?country
78+
FROM <http://cambridgesemantics.com/SourceLayer/YOUR_SOURCE_ID/Model>
79+
WHERE {
80+
?customer a dt:Customer ;
81+
dt:customerId ?customerId ;
82+
dt:customerName ?customerName .
83+
OPTIONAL { ?customer dt:email ?email }
84+
OPTIONAL { ?customer dt:phone ?phone }
85+
OPTIONAL { ?customer dt:address ?address .
86+
?address dt:city ?city ;
87+
dt:country ?country }
88+
}
89+
ORDER BY ?customerName
90+
```
91+
92+
Replace `YOUR_SOURCE_ID` with your actual source layer ID. You can find this ID in Graph Studio by navigating to your source layer and copying the ID from the URL or source layer details.
93+
94+
You now have a graph ontology in Altair Graph Studio with data and a SPARQL query that returns customers.
95+
96+
Altair Graph Studio allows you to do much more, such as ingesting data from data lakes or APIs and linking siloed data into one unified ontology, but for now, you can focus on this basic graph.
97+
98+
## Exposing Graph Data in the Mendix Application
99+
100+
Altair Graph Studio allows you to store and retrieve graph data structures. Using either OData REST endpoints or SPARQL queries via the SPARQL API endpoint, you can retrieve this data into your Mendix application.
101+
102+
The [OData](#odata-rest-endpoint) approach provides the easiest integration with automatic entity mapping and association handling, while the [SPARQL](#query-sparql) approach offers more control for complex graph queries. Both methods enable you to build powerful applications that leverage the scalability and flexibility of graph databases.
103+
104+
### Exposing the Data via an OData REST Endpoint {#odata-rest-endpoint}
105+
106+
The simplest way to use graph data in a Mendix application is by using an OData endpoint. In Altair Graph Studio, you can export an entire graph via OData. This will create an OData endpoint allowing flexible OData queries on the data in your graph database.
107+
108+
#### Creating an OData API in Graph Studio
109+
110+
Create a new OData API in your graphmart. To do this, follow the steps below.
111+
112+
1. Go **Graphmarts** > **Exports** and select **Create OData REST Endpoint**.
113+
114+
{{< figure src="/attachments/refguide/modeling/integration/altair/create-odata-rest.png" >}}
115+
116+
2. Choose **Auto generated Endpoint**. This is a one-click method to expose your entire graph through an OData API.
117+
118+
{{< figure src="/attachments/refguide/modeling/integration/altair/auto-generated-endpoint.png" >}}
119+
120+
3. Provide a name and a description for the endpoint.
121+
122+
{{< figure src="/attachments/refguide/modeling/integration/altair/endpoint-title.png" >}}
123+
124+
The **ODBC (SQL)** endpoint listed on this page can be used to access the endpoint. You should now be able to open this endpoint in a browser and see the OData response.
125+
126+
{{< figure src="/attachments/refguide/modeling/integration/altair/odbc-endpoint.png" >}}
127+
128+
4. To see the contract of the endpoint, use the endpoint URL displayed in the endpoint configuration page under **ODBC (SQL)** and append `/$metadata` to this URL. You will need it when using the endpoint in Studio Pro.
129+
130+
#### Using the OData Endpoint in a Mendix Project
131+
132+
Add a [consumed OData service](/refguide/consumed-odata-service/) in your project by opening Studio Pro and right-clicking your module > **Add other** > **Consumed OData service**. In the **Add Consumed OData Service** dialog, provide the location of the endpoint `$metadata` contract, as well as your username and password credentials. Studio Pro will read the contract to determine all the entities and actions provided by this endpoint.
133+
134+
{{< figure src="/attachments/refguide/modeling/integration/altair/add-consumed-odata.png" >}}
135+
136+
In the consumed OData service document, you can provide configuration for the endpoint location and credentials. The **Location** is the root endpoint URL you copied from Graph Studio (without the `$metadata` suffix).
137+
138+
{{< figure src="/attachments/refguide/modeling/integration/altair/endpoint-location.png" >}}
139+
140+
#### Creating External Entities for Datasets from the OData Endpoint
141+
142+
The [Integration pane](/refguide/integration-pane/) in the right column displays all the graph classes exposed via the OData REST API. You can see the attributes (properties) of these classes and the associations. The Integration pane also shows the capabilities of the data provided by the endpoint. In this example, all the data is read-only, as the Altair Graph Database only provides read-only access to the data.
143+
144+
Select which classes you need for your application and drag and drop them into a domain model. Here, they will be displayed as purple external entities. This indicates that the data is available to your application but is retrieved from an external service (in this case, the Altair Graph Database).
145+
146+
{{< figure src="/attachments/refguide/modeling/integration/altair/create-external-entities.png" >}}
147+
148+
#### Building Pages Using External Entities
149+
150+
You can use these external entities in your pages and microflows similarly to persistent entities. For this example, create your overview pages by right-clicking the entity and selecting **Generate overview pages**.
151+
152+
{{< figure src="/attachments/refguide/modeling/integration/altair/building-pages.png" >}}
153+
154+
#### Running the Application and Test
155+
156+
You can now start the application and test the results. Whenever you open a page using external entities from the Integration pane, the data will automatically be retrieved from Altair Graph Studio via an OData REST call.
157+
158+
{{< figure src="/attachments/refguide/modeling/integration/altair/testing.png" >}}
159+
160+
Filtering, sorting, and pagination are automatically done server-side by your graph database. This is essential for large datasets to avoid overloading the front-end with too many objects.
161+
162+
#### Lazy-Loaded Tree Widget
163+
164+
Altair Graph Studio automatically provides associations for linked entities in your graph. These graph associations are part of the OData endpoint and part of your external entities. When you drag your OData datasets into your domain model, the resulting external entities will show associations from the OData endpoint.
165+
166+
{{< figure src="/attachments/refguide/modeling/integration/altair/tree-widget.png" >}}
167+
168+
This example page shows a tree that retrieves BOMs from the graph database. It will only load required data: first, the top-level BOMs, then, when you open one, its components will be retrieved over the association. Only when you open a component will it load the subcomponents.
169+
170+
This is done automatically when you set the external entities as the data source for the widgets in your tree.
171+
172+
{{< figure src="/attachments/refguide/modeling/integration/altair/data-source.png" >}}
173+
174+
### Query SPARQL in Mendix {#query-sparql}
175+
176+
If you need full control over your graph queries, you can use [consumed REST services](/refguide/consumed-rest-service/) to execute SPARQL queries in your graph database.
177+
178+
#### Configuring the REST Call
179+
180+
Run SPARQL queries from Mendix by using the SPARQL API in Altair Graph Studio. To do this, follow the steps below.
181+
182+
1. Create a new consumed REST service document and paste the query in the request body.
183+
184+
{{< figure src="/attachments/refguide/modeling/integration/altair/paste-query.png" >}}
185+
186+
The endpoint contains two main parts: the endpoint of the SPARQL API, and the graphmart you want to work with. You can define these in the endpoint.
187+
188+
2. Define the content types of the request and response:
189+
190+
* Set **Accept** to `application/sparql-results+json`
191+
* Set **Content-Type** to `application/sparql-query`
192+
193+
{{< figure src="/attachments/refguide/modeling/integration/altair/content-type.png" >}}
194+
195+
3. Run the API call and validate the resulting response message. The **Response** table will show the response JSON payload provided by your graph database.
196+
197+
{{< figure src="/attachments/refguide/modeling/integration/altair/response.png" >}}
198+
199+
4. View the resulting entities in the **Response structure** tab. Here, you can rename and generate entities to capture the data in Studio Pro.
200+
201+
{{< figure src="/attachments/refguide/modeling/integration/altair/response-structure.png" >}}
202+
203+
The resulting domain model should look like this:
204+
205+
{{< figure src="/attachments/refguide/modeling/integration/altair/domain-model.png" >}}
206+
207+
#### Microflow to Execute the SPARQL Query
208+
209+
Define a microflow that will execute the API call with the SPARQL query and return the resulting data as an entity list. In this example, the endpoint is defined using two constants:
210+
211+
* One for the graph database API
212+
* One for the graphmart
213+
214+
By using constants, you can override these on deployment to match the environment you are deploying to.
215+
216+
{{< figure src="/attachments/refguide/modeling/integration/altair/microflow-sparql.png" >}}
217+
218+
#### Customers Overview Page
219+
220+
Create a page that will show the retrieved data. This example uses a [Data Grid 2](/appstore/modules/data-grid-2/) with a microflow data source. The microflow data source is configured to use the microflow that was created in the previous step.
221+
222+
{{< figure src="/attachments/refguide/modeling/integration/altair/overview-page.png" >}}
223+
224+
#### Testing the Result
225+
226+
You can now run your application to validate the result. It should have a data grid showing all objects and a detail form showing the details of one specific object, as seen below:
227+
228+
{{< figure src="/attachments/refguide/modeling/integration/altair/result.png" >}}
229+
230+
You should also see the detail pages that show data from a single concept in your graph database:
231+
232+
{{< figure src="/attachments/refguide/modeling/integration/altair/detail-page.png" >}}

content/en/docs/refguide/modeling/integration/share-data-sources/_index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ title: Share Data Sources
33
url: /refguide/share-data-sources/
44
aliases:
55
- /howto/integration/share-data-sources/
6+
weight: 60
67
#If moving or renaming this doc file, implement a temporary redirect and let the respective team know they should update the URL in the product. See Mapping to Products for more details.
78
---
89

content/en/docs/refguide/modeling/integration/use-excel-documents/_index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
title: Use Excel Documents
33
url: /refguide/use-excel-documents/
44
aliases: /howto/integration/use-excel-documents/
5+
weight: 70
56
#If moving or renaming this doc file, implement a temporary redirect and let the respective team know they should update the URL in the product. See Mapping to Products for more details.
67
---
78

content/en/docs/refguide/modeling/integration/use-platform-supported-content/_index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ url: /refguide/use-platform-supported-content/
44
aliases:
55
- /howto/integration/use-extensions/
66
- /refguide/use-extensions/
7+
weight: 80
78
#If moving or renaming this doc file, implement a temporary redirect and let the respective team (buildpack) know they should update the URL in the product. See Mapping to Products for more details.
89
---
910

82.3 KB
Loading
743 KB
Loading
394 KB
Loading
600 KB
Loading
320 KB
Loading

0 commit comments

Comments
 (0)