Zum Hauptinhalt springen

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:

FeldBeschreibung
totalCountGesamtzahl der übereinstimmenden Elemente
pageInfoPaginierungs-Cursor und -Flags
itemsArray der Ergebniselemente

PageInfo​

FeldTypBeschreibung
endCursorStringCursor des letzten Elements im Ergebnis
hasNextPageBooleanOb nach dieser Seite weitere Elemente existieren
hasPreviousPageBooleanOb vor dieser Seite Elemente existieren
startCursorStringCursor des ersten Elements im Ergebnis

Komponenten-Abfragen​

Ausführliche Dokumentation zum Abfragen bestimmter Komponenten:

KomponenteDokumentation
ModelsModels
TypesTypes
AttributesAttributes
EnumsEnums
RecordsRecords
Association RolesAssociation Roles