RelatedInstanceSpecification Interface

This sub-specification allows joining the primary node instance with any number of related instances and creating hierarchies based on a mix of those related instances.

The related instance property values can be accessed from multiple different places:

  • Instance filter
  • Customization rule value
  • Grouping rule

Example:

{
  "id": "related_instance_example",
  "rules": [{
    "ruleType": "LabelOverride",
    "condition": "ThisNode.IsInstanceNode ANDALSO this.IsOfClass(\"Model\", \"BisCore\")",
    "label": "modeledElement.UserLabel"
  }, {
    "ruleType": "Grouping",
    "condition": "ParentNode.IsNull",
    "class": {
      "schemaName": "BisCore",
      "className": "Element"
    },
    "groups": [{
      "specType": "Property",
      "propertyName": "CodeValue",
      "createGroupForSingleItem": true
    }]
  }, {
    "ruleType": "RootNodes",
    "specifications": [{
      "specType": "InstanceNodesOfSpecificClasses",
      "classes": { "schemaName": "BisCore", "classNames": ["GeometricModel"] },
      "arePolymorphic": true,
      "instanceFilter": "modeledElement.CodeNamespace = 1",
      "relatedInstances": [{
        "relationship": { "schemaName": "BisCore", "className": "ModelModelsElement" },
        "requiredDirection": "Forward",
        "class": { "schemaName": "BisCore", "className": "Element" },
        "alias": "modeledElement"
      }]
    }]
  }]
}

Here BisCore:GeometricModel instances are joined with BisCore:Element instances to create the hierarchy. This allows:

  • Related BisCore:Element properties to be accessed in InstanceFilter using modeledElement alias.
  • The LabelOverride rule to use modeledElement alias to access properties of the joined related instance.
  • The GroupingRule to be applied because it's grouping BisCore:Element which is now part of the generated nodes.

Properties

Name Type Description
alias string The alias to give for the joined related instance.  
class SingleSchemaClassSpecification Specification of the related instance class.  
isRequired undefined | boolean Is the related instance required to exist.  
relationship SingleSchemaClassSpecification Specification of the relationship to use for joining the related instance  
requiredDirection Forward | Backward Direction of the relationship  

Defined in

Last Updated: 20 September, 2019