Retrieve
Dieses Kapitel beschreibt gängige Query-Muster zum Abrufen von Construction-Kit-Metadaten. Die Construction-Kit-API ist ausschließlich lesend – Sie fragen die Modellstruktur ab, können sie aber nicht über GraphQL verändern.
Query-Struktur
Alle Construction-Kit-Abfragen verwenden das Wurzelfeld constructionKit:
query {
constructionKit {
models { ... }
types { ... }
attributes { ... }
enums { ... }
records { ... }
associationRoles { ... }
}
}
Allgemeine Query-Parameter
Alle Construction-Kit-Abfragen unterstützen diese Parameter:
Paginierung
Verwenden Sie first und after für die cursorbasierte Paginierung:
query {
constructionKit {
types(first: 10, after: "YXJyYXljb25uZWN0aW9uOjk=") {
totalCount
pageInfo {
endCursor
hasNextPage
hasPreviousPage
startCursor
}
items {
ckTypeId {
fullName
}
}
}
}
}
Nach ID filtern
Verwenden Sie ckId, um ein bestimmtes Element abzurufen:
query {
constructionKit {
types(ckId: "Industry.Energy-1.0.0/EnergyMeter-1") {
items {
ckTypeId {
fullName
semanticVersionedFullName
}
description
isAbstract
isFinal
}
}
}
}
Nach Modell filtern
Verwenden Sie ckModelIds, um nach einem oder mehreren Modellen zu filtern:
query {
constructionKit {
types(ckModelIds: ["Industry.Energy-1", "Basic-1"]) {
totalCount
items {
ckTypeId {
fullName
}
}
}
}
}
Feld-Filter
Verwenden Sie fieldFilter für attributbasiertes Filtern:
query {
constructionKit {
models(
fieldFilter: [
{ attributePath: "modelState", operator: EQUALS, comparisonValue: "AVAILABLE" }
]
) {
items {
id {
fullName
}
modelState
}
}
}
}
Such-Filter
Verwenden Sie searchFilter für die Textsuche:
query {
constructionKit {
types(
searchFilter: {
searchTerm: "Energy"
type: ATTRIBUTE_FILTER
attributePaths: ["ckTypeId"]
}
) {
items {
ckTypeId {
fullName
}
}
}
}
}
Sortierreihenfolge
Verwenden Sie sortOrder, um die Reihenfolge der Ergebnisse festzulegen:
query {
constructionKit {
types(
sortOrder: [
{ attributePath: "ckTypeId", sortOrder: ASCENDING }
]
) {
items {
ckTypeId {
fullName
}
}
}
}
}
Antwortstruktur
Alle Abfragen geben einen Connection-Typ zurück mit:
| Feld | Beschreibung |
|---|---|
totalCount | Gesamtzahl der übereinstimmenden Elemente |
pageInfo | Paginierungs-Cursor und -Flags |
items | Array der Ergebniselemente |
PageInfo
| Feld | Typ | Beschreibung |
|---|---|---|
endCursor | String | Cursor des letzten Elements im Ergebnis |
hasNextPage | Boolean | Ob nach dieser Seite weitere Elemente existieren |
hasPreviousPage | Boolean | Ob vor dieser Seite Elemente existieren |
startCursor | String | Cursor des ersten Elements im Ergebnis |
Komponenten-Abfragen
Ausführliche Dokumentation zum Abfragen bestimmter Komponenten:
| Komponente | Dokumentation |
|---|---|
| Models | Models |
| Types | Types |
| Attributes | Attributes |
| Enums | Enums |
| Records | Records |
| Association Roles | Association Roles |