Zum Hauptinhalt springen

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​

FeldTypBeschreibung
ckTypeIdCkTypeIdDer Identifier des Typs
descriptionStringBeschreibung des Typs
isAbstractBooleanOb Instanzen erstellt werden können
isFinalBooleanOb der Typ erweitert werden kann
baseTypeCkTypeDer übergeordnete Typ (falls vorhanden)
derivedTypesCkTypeConnectionTypen, die diesen Typ erweitern
attributesCkTypeAttributeConnectionAuf diesem Typ definierte Attribute
availableQueryColumnsAvailableQueryColumnConnectionAlle abfragbaren Attributpfade
associationsCkTypeAssociationsAssoziationsdefinitionen für diesen Typ

CkTypeAttribute​

FeldTypBeschreibung
attributeNameStringDer Name des Attributs auf diesem Typ
attributeValueTypeStringDer Datentyp (STRING, INT32, DOUBLE usw.)
ckAttributeIdCkAttributeIdReferenz auf die Attributdefinition
isOptionalBooleanOb das Attribut optional ist
autoCompleteValues[String]Vordefinierte Werte für die Auto-Vervollständigung
autoIncrementReferenceStringReferenz auf die Auto-Increment-Konfiguration

Multiplicity​

WertBeschreibung
ZERO_OR_ONEOptionale einzelne Beziehung (0..1)
ONEErforderliche einzelne Beziehung (1)
NMehrfache Beziehungen (0..*)