Attribute Field/Value
Summary
Attribute Values are generic reference data held within SyncHive. These are for modelling reference data that don't have an explicit model in SyncHive. As Attribute Values are separate documents, these documents may also hold external identities for mappings.
Attribute Fields are a key to zero-to-many mapping, used for referencing attribute values. These have been modelled to be similar to Extension Fields.
Data Definitions
AttributeField
Data Type | Field Name | Description |
---|---|---|
AttributeValue | attributeValue | The attribute values to reference. |
string | key | The key for this mapping. |
AttributeValue
Data Type | Field Name | Description |
---|---|---|
string | code | A code to reference the attribute value by. Forms an alternate key with the discriminant. |
string | description | A description of the attribute value. |
string | discriminant | A discriminant to categorize/group attribute values. Forms an alternate key with the discriminant. |
Sample JSON
Product Example
Say we want to store the possible Product colors as reference data in SyncHive; Attribute Values can be a suitable candidate for holding such data. We would first setup the possible colors as a AttributeValue. The discriminant could be set as ProductColor
to distinguish the type of attribute value, and codes would hold a unique value for each ProductColor
.
[
{
"@type": "AttributeValue",
"code": "Red",
"discriminant": "ProductColor",
"uniqueText": "c32b6bd0-11bc-4d0b-bcd1-546f839c0ffd"
},
{
"@type": "AttributeValue",
"code": "Blue",
"discriminant": "ProductColor",
"uniqueText": "d0fd17bc-1905-4bdf-a4a3-edbf7df88571"
}
]
After the attribute value is setup, attributes can be referenced via an IRI (or another ID resolution mechanism). Note the value for key
in the AttributeField
below does not need to match the discriminant.
{
"@type": "Product",
"attributeField": [
{
"@type": "AttributeField",
"key": "color",
"attributeValue": [
{
"@type": "DataReference",
"schemaName": "limber",
"shapeName": "AttributeValue",
"iri": "https://schema.limbergraph.com/limber/AttributeValue#d0fd17bc-1905-4bdf-a4a3-edbf7df88571"
}
]
}
]
}