Skip to main content

Records

Records are composite value types that group related attributes together. Unlike types, records are embedded directly within entities rather than being independent entities with their own runtime IDs.

List Records

Retrieve all records:

query getCkRecords($after: String, $first: Int, $ckModelIds: [String]) {
constructionKit {
records(after: $after, first: $first, ckModelIds: $ckModelIds) {
totalCount
items {
ckRecordId {
fullName
semanticVersionedFullName
}
}
}
}
}

Response

{
"data": {
"constructionKit": {
"records": {
"totalCount": 5,
"items": [
{
"ckRecordId": {
"fullName": "Basic-1.0.0/Contact-1",
"semanticVersionedFullName": "Basic/Contact"
}
},
{
"ckRecordId": {
"fullName": "Basic-1.0.0/Address-1",
"semanticVersionedFullName": "Basic/Address"
}
}
]
}
}
}
}

Filter by Model

Retrieve records from specific models:

query {
constructionKit {
records(ckModelIds: ["Basic-1"]) {
totalCount
items {
ckRecordId {
fullName
}
}
}
}
}

Record Details

Retrieve detailed information about a specific record including its attributes and inheritance:

query getCkRecordDetails($ckId: String) {
constructionKit {
records(ckId: $ckId) {
totalCount
items {
ckRecordId {
fullName
semanticVersionedFullName
}
description
isAbstract
isFinal
baseRecordTypes {
ckRecordId {
fullName
semanticVersionedFullName
}
isAbstract
isFinal
}
derivedRecordTypes {
pageInfo {
endCursor
hasNextPage
}
items {
ckRecordId {
fullName
}
isAbstract
isFinal
}
}
attributes {
pageInfo {
endCursor
hasNextPage
}
items {
attributeName
attributeValueType
ckAttributeId {
fullName
semanticVersionedFullName
}
isOptional
}
}
}
}
}
}

Variables:

{
"ckId": "Basic-1.0.0/Contact-1"
}

Response

{
"data": {
"constructionKit": {
"records": {
"totalCount": 1,
"items": [
{
"ckRecordId": {
"fullName": "Basic-1.0.0/Contact-1",
"semanticVersionedFullName": "Basic/Contact"
},
"description": "Contact information including name and address",
"isAbstract": false,
"isFinal": false,
"baseRecordTypes": [],
"derivedRecordTypes": {
"pageInfo": {
"endCursor": null,
"hasNextPage": false
},
"items": []
},
"attributes": {
"pageInfo": {
"endCursor": "YXJyYXljb25uZWN0aW9uOjU=",
"hasNextPage": false
},
"items": [
{
"attributeName": "firstName",
"attributeValueType": "STRING",
"ckAttributeId": {
"fullName": "Basic-1.0.0/FirstName-1",
"semanticVersionedFullName": "Basic/FirstName"
},
"isOptional": true
},
{
"attributeName": "lastName",
"attributeValueType": "STRING",
"ckAttributeId": {
"fullName": "Basic-1.0.0/LastName-1",
"semanticVersionedFullName": "Basic/LastName"
},
"isOptional": true
},
{
"attributeName": "companyName",
"attributeValueType": "STRING",
"ckAttributeId": {
"fullName": "Basic-1.0.0/CompanyName-1",
"semanticVersionedFullName": "Basic/CompanyName"
},
"isOptional": true
},
{
"attributeName": "address",
"attributeValueType": "RECORD",
"ckAttributeId": {
"fullName": "Basic-1.0.0/Address-1",
"semanticVersionedFullName": "Basic/Address"
},
"isOptional": true
}
]
}
}
]
}
}
}
}

Record Inheritance

Records support inheritance similar to types. A derived record inherits all attributes from its base record:

query {
constructionKit {
records(ckId: "Basic-1.0.0/ExtendedContact-1") {
items {
ckRecordId {
fullName
}
baseRecordTypes {
ckRecordId {
fullName
}
}
attributes {
items {
attributeName
attributeValueType
}
}
}
}
}
}

Response

{
"data": {
"constructionKit": {
"records": {
"items": [
{
"ckRecordId": {
"fullName": "Basic-1.0.0/ExtendedContact-1"
},
"baseRecordTypes": [
{
"ckRecordId": {
"fullName": "Basic-1.0.0/Contact-1"
}
}
],
"attributes": {
"items": [
{ "attributeName": "firstName", "attributeValueType": "STRING" },
{ "attributeName": "lastName", "attributeValueType": "STRING" },
{ "attributeName": "companyName", "attributeValueType": "STRING" },
{ "attributeName": "address", "attributeValueType": "RECORD" },
{ "attributeName": "email", "attributeValueType": "STRING" },
{ "attributeName": "phone", "attributeValueType": "STRING" }
]
}
}
]
}
}
}
}

Nested Records

Records can contain other records as attributes. In the example above, Contact contains an Address record:

query {
constructionKit {
records(ckId: "Basic-1.0.0/Address-1") {
items {
ckRecordId {
fullName
}
attributes {
items {
attributeName
attributeValueType
}
}
}
}
}
}

Response

{
"data": {
"constructionKit": {
"records": {
"items": [
{
"ckRecordId": {
"fullName": "Basic-1.0.0/Address-1"
},
"attributes": {
"items": [
{ "attributeName": "street", "attributeValueType": "STRING" },
{ "attributeName": "cityTown", "attributeValueType": "STRING" },
{ "attributeName": "zipcode", "attributeValueType": "INT32" },
{ "attributeName": "country", "attributeValueType": "STRING" }
]
}
}
]
}
}
}
}

Record Fields

CkRecord

FieldTypeDescription
ckRecordIdCkRecordIdThe record identifier
descriptionStringDescription of the record
isAbstractBooleanWhether the record is abstract
isFinalBooleanWhether the record can be extended
baseRecordTypes[CkRecord]Parent records (inheritance)
derivedRecordTypesCkRecordConnectionRecords that extend this record
attributesCkRecordAttributeConnectionAttributes defined on this record

CkRecordAttribute

FieldTypeDescription
attributeNameStringThe name of the attribute
attributeValueTypeStringThe data type
ckAttributeIdCkAttributeIdReference to the attribute definition
isOptionalBooleanWhether the attribute is optional

Using Records in Runtime Operations

Records are used as embedded structured data within entities. They appear in two forms:

Attribute TypeDescriptionUse Case
RecordSingle embedded recordContact information, primary specification
RecordArrayArray of embedded recordsList of specifications, multiple contacts

Defining Records in Construction Kit

Records are defined in YAML files within the Construction Kit:

# records/specification.yaml
$schema: https://schemas.meshmakers.cloud/construction-kit-elements.schema.json
records:
- recordId: Specification
attributes:
- id: ${this}/SpecificationName
name: Name
- id: ${this}/SpecificationValue
name: Value
- id: ${this}/SpecificationUnit
name: Unit
isOptional: true

Using Records in Type Definitions

# types/product.yaml
$schema: https://schemas.meshmakers.cloud/construction-kit-elements.schema.json
types:
- typeId: Product
derivedFromCkTypeId: ${System}/Entity
attributes:
- id: ${this}/ProductName
name: ProductName
# Record attribute (single)
- id: ${this}/MainSpecification
name: MainSpecification
isOptional: true
# RecordArray attribute (multiple)
- id: ${this}/TechnicalSpecifications
name: TechnicalSpecifications
isOptional: true

Attribute Definition for Record Types

# attributes/product.yaml
$schema: https://schemas.meshmakers.cloud/construction-kit-elements.schema.json
attributes:
# Single Record
- id: MainSpecification
valueType: Record
valueCkRecordId: ${this}/Specification
description: "Main specification of the product"

# Array of Records
- id: TechnicalSpecifications
valueType: RecordArray
valueCkRecordId: ${this}/Specification
description: "List of technical specifications"

GraphQL Schema Generation

For a type with Record attributes, OctoMesh generates:

Input Types (for mutations):

  • ProductInput - with mainSpecification: SpecificationInput
  • SpecificationInput - with name, value, unit fields

Output Types (for queries):

  • Product - with mainSpecification: Specification
  • Specification - with name, value, unit fields

Runtime Data Examples

For detailed examples of creating and updating entities with Record and RecordArray attributes, see: