Types
Types definieren die Struktur von Entitäten im Runtime-Modell. Jeder Typ besitzt Attribute, kann von einem Basistyp erben und kann an Assoziationen mit anderen Typen teilnehmen.
Types auflisten
Alle Typen abrufen:
query getCkTypes($after: String, $first: Int, $ckModelIds: [String]) {
constructionKit {
types(after: $after, first: $first, ckModelIds: $ckModelIds) {
totalCount
items {
ckTypeId {
fullName
semanticVersionedFullName
}
isAbstract
isFinal
baseType {
ckTypeId {
fullName
}
isAbstract
isFinal
}
}
}
}
}
Antwort
{
"data": {
"constructionKit": {
"types": {
"totalCount": 15,
"items": [
{
"ckTypeId": {
"fullName": "Industry.Energy-1.0.0/EnergyMeter-1",
"semanticVersionedFullName": "Industry.Energy/EnergyMeter"
},
"isAbstract": false,
"isFinal": false,
"baseType": {
"ckTypeId": {
"fullName": "System-1.0.3/Entity-1"
},
"isAbstract": true,
"isFinal": false
}
}
]
}
}
}
}
Details eines Typs
Detaillierte Informationen zu einem bestimmten Typ abrufen:
query getCkTypeDetails($ckId: String) {
constructionKit {
types(ckId: $ckId) {
items {
ckTypeId {
fullName
semanticVersionedFullName
}
description
isAbstract
isFinal
baseType {
ckTypeId {
fullName
semanticVersionedFullName
}
isAbstract
isFinal
}
derivedTypes {
pageInfo {
endCursor
hasNextPage
}
items {
ckTypeId {
fullName
}
description
isAbstract
isFinal
}
}
availableQueryColumns {
pageInfo {
endCursor
hasNextPage
}
items {
attributePath
attributeValueType
}
}
}
}
}
}
Variablen:
{
"ckId": "Industry.Energy-1.0.0/EnergyMeter-1"
}
Antwort
{
"data": {
"constructionKit": {
"types": {
"items": [
{
"ckTypeId": {
"fullName": "Industry.Energy-1.0.0/EnergyMeter-1",
"semanticVersionedFullName": "Industry.Energy/EnergyMeter"
},
"description": "An energy meter device",
"isAbstract": false,
"isFinal": false,
"baseType": {
"ckTypeId": {
"fullName": "System-1.0.3/Entity-1",
"semanticVersionedFullName": "System/Entity"
},
"isAbstract": true,
"isFinal": false
},
"derivedTypes": {
"pageInfo": {
"endCursor": null,
"hasNextPage": false
},
"items": [
{
"ckTypeId": {
"fullName": "Industry.Energy-1.0.0/SmartMeter-1"
},
"description": "A smart energy meter with remote reading capabilities",
"isAbstract": false,
"isFinal": false
}
]
},
"availableQueryColumns": {
"pageInfo": {
"endCursor": "YXJyYXljb25uZWN0aW9uOjk=",
"hasNextPage": true
},
"items": [
{ "attributePath": "rtId", "attributeValueType": "STRING" },
{ "attributePath": "name", "attributeValueType": "STRING" },
{ "attributePath": "voltage", "attributeValueType": "DOUBLE" },
{ "attributePath": "state", "attributeValueType": "ENUM" }
]
}
}
]
}
}
}
}
Attribute eines Typs
Die auf einem Typ definierten Attribute abrufen:
query getCkTypeAttributes($after: String, $first: Int, $ckTypeId: String!) {
constructionKit {
types(ckId: $ckTypeId) {
items {
ckTypeId {
fullName
}
attributes(after: $after, first: $first) {
totalCount
pageInfo {
hasNextPage
endCursor
}
items {
attributeName
attributeValueType
autoCompleteValues
autoIncrementReference
ckAttributeId {
fullName
semanticVersionedFullName
}
isOptional
}
}
}
}
}
}
Variablen:
{
"ckTypeId": "Industry.Energy-1.0.0/EnergyMeter-1"
}
Antwort
{
"data": {
"constructionKit": {
"types": {
"items": [
{
"ckTypeId": {
"fullName": "Industry.Energy-1.0.0/EnergyMeter-1"
},
"attributes": {
"totalCount": 5,
"pageInfo": {
"hasNextPage": false,
"endCursor": "YXJyYXljb25uZWN0aW9uOjQ="
},
"items": [
{
"attributeName": "name",
"attributeValueType": "STRING",
"autoCompleteValues": null,
"autoIncrementReference": null,
"ckAttributeId": {
"fullName": "Industry.Energy-1.0.0/Name-1",
"semanticVersionedFullName": "Industry.Energy/Name"
},
"isOptional": false
},
{
"attributeName": "voltage",
"attributeValueType": "DOUBLE",
"autoCompleteValues": null,
"autoIncrementReference": null,
"ckAttributeId": {
"fullName": "Industry.Energy-1.0.0/Voltage-1",
"semanticVersionedFullName": "Industry.Energy/Voltage"
},
"isOptional": true
}
]
}
}
]
}
}
}
}
Verfügbare Query-Spalten
Alle abfragbaren Attributpfade für einen Typ abrufen (einschließlich vererbter und verschachtelter Attribute):
query getCkTypeAvailableQueryColumns($ckId: String!, $filter: String, $first: Int, $after: String) {
constructionKit {
types(ckId: $ckId) {
items {
ckTypeId {
fullName
}
availableQueryColumns(
after: $after
first: $first
attributePathContains: $filter
) {
totalCount
pageInfo {
hasNextPage
endCursor
}
items {
attributePath
attributeValueType
}
}
}
}
}
}
Variablen:
{
"ckId": "EnergyCommunity-1.0.0/Customer-1",
"filter": "contact",
"first": 10
}
Antwort
{
"data": {
"constructionKit": {
"types": {
"items": [
{
"ckTypeId": {
"fullName": "EnergyCommunity-1.0.0/Customer-1"
},
"availableQueryColumns": {
"totalCount": 8,
"pageInfo": {
"hasNextPage": false,
"endCursor": "YXJyYXljb25uZWN0aW9uOjc="
},
"items": [
{ "attributePath": "contact.firstName", "attributeValueType": "STRING" },
{ "attributePath": "contact.lastName", "attributeValueType": "STRING" },
{ "attributePath": "contact.companyName", "attributeValueType": "STRING" },
{ "attributePath": "contact.address.street", "attributeValueType": "STRING" },
{ "attributePath": "contact.address.cityTown", "attributeValueType": "STRING" },
{ "attributePath": "contact.address.zipcode", "attributeValueType": "INT32" }
]
}
}
]
}
}
}
}
Typ-Assoziationen
Typen können Assoziationen zu anderen Typen haben. Assoziationen sind nach Richtung (inbound/outbound) und Ownership (owned/inherited) organisiert:
query getCkTypeAssociations($ckId: String) {
constructionKit {
types(ckId: $ckId) {
items {
ckTypeId {
fullName
}
associations {
out {
owned {
roleId {
fullName
}
navigationPropertyName
multiplicity
originCkTypeId {
fullName
}
targetCkTypeId {
fullName
}
}
inherited {
roleId {
fullName
}
navigationPropertyName
multiplicity
originCkTypeId {
fullName
}
targetCkTypeId {
fullName
}
}
}
in {
owned {
roleId {
fullName
}
navigationPropertyName
multiplicity
originCkTypeId {
fullName
}
targetCkTypeId {
fullName
}
}
inherited {
roleId {
fullName
}
navigationPropertyName
multiplicity
originCkTypeId {
fullName
}
targetCkTypeId {
fullName
}
}
}
}
}
}
}
}
Antwort
{
"data": {
"constructionKit": {
"types": {
"items": [
{
"ckTypeId": {
"fullName": "EnergyCommunity-1.0.0/Customer-1"
},
"associations": {
"out": {
"owned": [
{
"roleId": {
"fullName": "EnergyCommunity-1.0.0/AssociatedCustomer-1"
},
"navigationPropertyName": "facilities",
"multiplicity": "N",
"originCkTypeId": {
"fullName": "EnergyCommunity-1.0.0/Customer-1"
},
"targetCkTypeId": {
"fullName": "EnergyCommunity-1.0.0/OperatingFacility-1"
}
}
],
"inherited": []
},
"in": {
"owned": [],
"inherited": []
}
}
}
]
}
}
}
}
Felder eines Typs
CkType
| Feld | Typ | Beschreibung |
|---|---|---|
ckTypeId | CkTypeId | Der Identifier des Typs |
description | String | Beschreibung des Typs |
isAbstract | Boolean | Ob Instanzen erstellt werden können |
isFinal | Boolean | Ob der Typ erweitert werden kann |
baseType | CkType | Der übergeordnete Typ (falls vorhanden) |
derivedTypes | CkTypeConnection | Typen, die diesen Typ erweitern |
attributes | CkTypeAttributeConnection | Auf diesem Typ definierte Attribute |
availableQueryColumns | AvailableQueryColumnConnection | Alle abfragbaren Attributpfade |
associations | CkTypeAssociations | Assoziationsdefinitionen für diesen Typ |
CkTypeAttribute
| Feld | Typ | Beschreibung |
|---|---|---|
attributeName | String | Der Name des Attributs auf diesem Typ |
attributeValueType | String | Der Datentyp (STRING, INT32, DOUBLE usw.) |
ckAttributeId | CkAttributeId | Referenz auf die Attributdefinition |
isOptional | Boolean | Ob das Attribut optional ist |
autoCompleteValues | [String] | Vordefinierte Werte für die Auto-Vervollständigung |
autoIncrementReference | String | Referenz auf die Auto-Increment-Konfiguration |
Multiplicity
| Wert | Beschreibung |
|---|---|
ZERO_OR_ONE | Optionale einzelne Beziehung (0..1) |
ONE | Erforderliche einzelne Beziehung (1) |
N | Mehrfache Beziehungen (0..*) |