Structure of Reference and Key#
Key/value is a string of up to 2048 characters (2000 in v3.0). A Reference is an identifier, not a locator: a URL used as a key value does not have to resolve to anything. An external reference may also be a concatenation of identifiers, for example an IRDI path.
| Attribute | Type | Card. | Meaning |
|---|---|---|---|
| Reference/type | ReferenceTypes | 1 | ExternalReference or ModelReference |
| Reference/keys | Key (ordered) | 1..* | The key chain that forms the reference path |
| Reference/referredSemanticId | Reference | 0..1 | Expected semanticId of the element a ModelReference points to |
| Key/type | KeyTypes | 1 | Kind of target (Submodel, Property, GlobalReference ...) |
| Key/value | Identifier | 1 | IRDI, IRI, idShort, list index ... |
ExternalReference: pointing outside the model#
An external reference points to something outside the AAS model, such as an ECLASS or IEC CDD entry, a standard or a web resource. The first key must have type GlobalReference (AASd-122) and the last key must be GlobalReference or FragmentReference (AASd-124). v3.2 added AASd-137, which forbids AAS element types such as Submodel or Property in the keys of an external reference.
Typical uses are semanticId, supplementalSemanticId, valueId and ConceptDescription/isCaseOf. SpecificAssetId/externalSubjectId must be an external reference (AASd-133). Below is the SerialNumber semanticId from the Digital Nameplate template.
Copy the code, or select it to copy manually.
{
"type": "ExternalReference",
"keys": [
{ "type": "GlobalReference", "value": "0112/2///61987#ABA951#009" }
]
}ModelReference: pointing to model elements#
A model reference points to an element in the same or another AAS. The first key is AssetAdministrationShell, Submodel, ConceptDescription or Identifiable (AASd-123), and every following key is an element type inside the submodel or a FragmentReference (AASd-125). Only one identifiable starts the chain; you do not chain a shell and then a submodel.
Metamodel relationships such as AAS/submodels and derivedFrom are model references. ReferenceElement and RelationshipElement accept both kinds. If you set referredSemanticId, a validator can warn when the target's semanticId does not match.
The ReferenceElement below points to one Property with a key chain that starts with the submodel id and ends with the idShort SerialNumber; referredSemanticId states the semanticId that this Property is expected to have.
{
"modelType": "ReferenceElement",
"idShort": "SerialNumberRef",
"value": {
"type": "ModelReference",
"referredSemanticId": { "type": "ExternalReference",
"keys": [ { "type": "GlobalReference", "value": "0112/2///61987#ABA951#009" } ] },
"keys": [
{ "type": "Submodel", "value": "https://example.com/ids/sm/pump-0001-nameplate" },
{ "type": "Property", "value": "SerialNumber" }
]
}
}Key chain rules and text notation#
When a Reference is turned into a single string, the grammar in the specification applies. Each key is written as (KeyType)value, keys are separated by a comma and a space, and the [ExternalRef] or [ModelRef] prefix is optional.
- After a SubmodelElementList key, the next key value is the zero-based integer position, not an idShort (AASd-128).
- FragmentReference may only follow a File or Blob key (AASd-127).
- KeyTypes also contains abstract types such as SubmodelElement and DataElement; the actual target may then be any subtype such as Property or File.
# valid
[ExternalRef](GlobalReference)0112/2///61987#ABA951#009
(GlobalReference)https://example.com/specification.html, (FragmentReference)Hints
[ModelRef](Submodel)https://example.com/ids/sm/pump-0001-nameplate, (Property)SerialNumber
(Submodel)https://example.com/ids/sm/pump-0001-demo, (SubmodelElementList)BearingTemperatures, (Property)0
(Submodel)https://example.com/ids/sm/docs, (File)Specification, (FragmentReference)Hints
# invalid
[ExternalRef](Submodel)https://example.com/ids/sm/docs
-> first key of an external reference must be GlobalReference (AASd-122)
(AssetAdministrationShell)https://example.com/ids/aas/1, (Submodel)https://example.com/ids/sm/1, (Property)Temp
-> only one identifiable at the start of a model reference (AASd-125)
(Submodel)https://example.com/ids/sm/1, (Property)Temp, (FragmentReference)x
-> FragmentReference only after File or Blob (AASd-127)Comparing references and passing them to the API#
The specification distinguishes exact matching (all attributes equal) from value matching (all key values equal). Value matching ignores Reference/type and referredSemanticId, so an external and a model reference match when all key values are equal. Strings are compared as they are, case-sensitive.
When the Part 2 API takes a Reference such as a semanticId as a query parameter, the Reference is serialized to JSON and then base64url-encoded (without = padding). Whitespace and line breaks change the encoded string; the specification requires servers to cope with this and work on the original content.
What changed from v2#
In the v3.0 release candidates the Reference/type value was called GlobalReference; the final v3.0 renamed it ExternalReference. AssetInformation/globalAssetId, still a Reference up to RC02, became an Identifier string in v3.0.
| Item | v2.0.1 | v3.x |
|---|---|---|
| Reference attributes | keys only | type (mandatory), keys, referredSemanticId |
| Key attributes | type, idType, value, local | type, value |
| idType values | Custom, IRDI, IRI, IdShort, FragmentId | none (identifiers are strings) |
| Identifiable id | identification {id, idType} | id (string) |
Key points#
- A Reference consists of type and keys, optionally with referredSemanticId.
- An ExternalReference starts with a GlobalReference key; a ModelReference starts with an identifiable followed by elements inside the submodel. List elements are addressed by integer index.
- v2's idType and local are gone; all identifiers are plain strings.
Questions and answers#
Should a semanticId be an ExternalReference or a ModelReference?
Both are allowed. Point directly to an external dictionary with an ExternalReference, or to a ConceptDescription in the Environment with a ModelReference whose first key is ConceptDescription. The recommendation to prefer external references was removed in v3.1. IDTA's Digital Nameplate 3.0.3 template uses ExternalReferences.
What is the difference between GlobalReference and ExternalReference?
ExternalReference is a value of Reference/type; GlobalReference is a value of Key/type. An external reference has Reference/type=ExternalReference and a first key of type GlobalReference.
Can I point to a list element by its idShort?
Not in a ModelReference. The key after a SubmodelElementList must be the integer position (AASd-128). Since v3.1 list children may carry an idShort, but references still use the index.
Is globalAssetId a Reference?
No. Since v3.0, AssetInformation/globalAssetId and Entity/globalAssetId are Identifier strings. They were References only up to v3.0 RC02.
