Attribute projection

Projection – Abstract

Purpose: Returns the values of all instances of a specific attribute type for a given or explicitly defined attribute owner (without an explicit Join).

images/download/attachments/162408869/image-2023-12-8_9-42-47-version-1-modificationdate-1702024969032-api-v2.png

An Attribute projection searches the attributes of the attribute owner defined by the context or an explicitly defined Attribute owner path for attributes of an attribute type selected via the Attribute parameter.

Depending on the optional selection for the Property to be evaluated, either the complete attribute value or the value in the selected Property appears in the return value of the Attribute projection.

The Attribute projection returns the attribute values of all instances of the selected attribute type, so that – in contrast to the Typed attribute projection – a multi-value return value can always be assumed.

The possible uses of the Attribute projection in the context of different attribute types are illustrated by the following case differentiation:

Carnality
of the attribute/subtype ↓

Attribute type is
non-typed

Attribute type is typed

more specific
subtype

all
subtypes

'singulär' (≤1)

Default access:
Singular attribute projection

(Attribute projection applicable but no added value)


Default access
Typed attribute projection

(Attribute projection not applicable due to lack of selection for the (sub)type)

Attribute projection evaluates instances for all singular and plural subtypes and returns a 'flat' list (depending on the selection for Property).

'plural' (≥1:)

Attribute projection is the default access

  • A non-typed singular attribute can be selected as an Attribute. Technically, this is offered by the Attribute projection. However, the Singular attribute projection provides the same result.

  • For a non-typed plural Attribute, e.g. the 'communication information' (AddressCommunicationInfo) for the entity type 'Address' (Address), an Attribute projection represents the default access.

  • If the Attribute selection refers to an attribute type from the typed attributes group (e.g. 'Text attribute' or 'Company and address attribute'), the Attribute projection provides the attribute values of all singular and plural subtypes as a 'flat list'.

    • The values of typed attributes with a plural subtype therefore do not appear 'grouped' or 'bundled' per attribute owner and subtype in the return value, but as individual values (with the same subtype but different index value).

NOTE◄ At database level, the Attribute projection implies an optional LEFT OUTER JOIN to the database table for the implementation of the attribute type selected in the Attribute parameter. If a search uses multiple instances of the Attribute projection for this attribute type, the same JOIN is used multiple times and is not executed redundantly. However, if an Attribute projection and a similarly equivalent Singular attribute projection access the same singular attribute, this results in two redundant JOINs.

Configuration

Parameter

Type

Description

Name

String

The optional Name parameter can be used to assign an (alias) name to the projection.

  • If no Name is specified, the name for the selected Property is used as the column name (if relevant).

Attribute owner path

Entity
(Projection)

An Attribute owner path only needs to be explicitly defined by configuring a projection if the entity in the context of the search is not the owner of the attributes that are to be evaluated.

This is relevant in the following cases, for example:

  • The attribute owner is an entity included in the search via Entity join.

  • The attribute owner is a position of an entity in the context of the search.

  • The attribute owner is an entity embedded in the entity data in the context of the search, e.g. the 'address' (address) of an account (see Users, Company accounts).

Attribute

Class
(attribute type)

In the Combobox element for the Attribute parameter, a selection must be made from the options for the attribute type offered via dropdown. Only the attribute types that the entity type of the applicable attribute owner supports per implementation are available for selection here.

NOTE◄ If no options are available for the Attribute or if options are missing, then the Attribute owner path may not have been set appropriately (e.g. the 'address' of an account for which no attributes are implemented)

Property

Property (of the attribute value)

The Combobox element for the Property allows an optional single selection for one of the fields of the attribute type selected by Attribute.

  • If no selection is made for the Property, the Attribute projection returns the complete attribute value (value).

For instances of plural attributes, access to the index property (index or orderIndex) in the attribute value can be useful.

  • There is no access to the fields of the parent attribute entity (such as the id), which contains the value field.

Examples

Typical use case: Evaluate plural attribute

A tuple search should evaluate all tangible instances of the entity type 'Address book entry' (AdressBookEntry, see Address book entries) that reference exactly one address (see Addresses) via the 'Address' (address) property and provide an overview of the data stored there via the 'Communication information' (CommunicationInfo) attribute type.

Specifically, exactly one tuple is output for each address book entry, which contains, among other things, a list (or collection) of all communication information.

Configuration:

The screenshot on the right shows the Projections configured for the tuple search:

  • First, a Property projection should name the addressBookId to identify the Address book that contains the 'found' address book entry. Without restrictions in the condition, the search considers entries from all (accessible) address books.

  • The second Property projection uniquely identifies the address book entry using its 'ID' (id).

  • The third Property projection returns the 'match code' from the address of the entry (address.accMatchCode), which is intended to enable the systems or users using the data to match the data found.

  • The Collection projection shown in the image performs the evaluation of the 'Communication information' described in the request under the (alias) name CCOMMUNICATION_INFOS. An Attribute projection with the following parameters is configured as a Property of collection:

    • The Attribute owner path refers to the address property via a Property projection, which the address book entry uses to refer to exactly one address.

    • The plural attribute type 'Communication information' is selected as the Attribute type.

    • Since no Property is selected, the Attribute projection lists complete 'Communication information' attribute values so that the recipient has access to all payload properties of this attribute type (Communication type, Context, Value, Index).

images/download/attachments/162408869/image-2023-12-8_9-39-27-version-1-modificationdate-1702024768416-api-v2.png

Runtime example:

<core:TupleSearchResult maxResults="100" count="33">
<columns>
<name>addressBookId</name>
<name>id</name>
<name>address.accMatchCode</name>
<name>COMMUNICATION_INFOS</name>
</columns>
<result>
...
<row>
<item xsi:type="xsd:long">1051</item>
<item xsi:type="xsd:long">953</item>
<item xsi:type="xsd:string">EDDH</item>
<item xsi:type="list">
<entry id="12956" ... orderIndex="0" communicationType="EMAIL" communicationContext="noreply" xsi:type="base:AddressCommunicationInfo">
<communicationValue>noreply@ema.il</communicationValue>
</entry>
<entry id="12955" ... orderIndex="1" communicationType="EMAIL" communicationContext="alternate" xsi:type="base:AddressCommunicationInfo">
<communicationValue>noreply2@doma.in</communicationValue>
</entry>
<entry id="12957" ... orderIndex="2" communicationType="PHONE" communicationContext="info" xsi:type="base:AddressCommunicationInfo">
<communicationValue>+49 (40) 50750</communicationValue>
</entry>
</item>
</row>
<row>
<item xsi:type="xsd:long">1051</item>
<item xsi:type="xsd:long">952</item>
<item xsi:type="xsd:string">EDDF</item>
<item xsi:type="list">
<entry id="12960" ... orderIndex="0" communicationType="PHONE" communicationContext="info" xsi:type="base:AddressCommunicationInfo">
<communicationValue>+49 (180) 6 3724636</communicationValue>
</entry>
</item>
</row>
<row>
<item xsi:type="xsd:long">1051</item>
<item xsi:type="xsd:long">951</item>
<item xsi:type="xsd:string">EDDL</item>
<item xsi:type="list">
<entry id="12961" ... orderIndex="0" communicationType="PHONE" communicationContext="info" xsi:type="base:AddressCommunicationInfo">
<communicationValue>+49 (211) 4210</communicationValue>
</entry>
</item>
</row>
...
</result>
</core:TupleSearchResult>
  • Each row element ('tuple') contains a list of 'Communication information' assigned to the address book entry as the fourth item.

  • The sample data shows attribute values with different Communication type (EMAIL, PHONE) and 'context' (info, alternate, noreply) for classifying the specific information specified as 'value' (communicationValue).

Variant: In order to 'serve' the 'Communication information' in a CSV search as direct readable text, a slightly different formatting of the return values from the Attribute projection is recommended:

  • Instead of a 'list column' (collection) in a tuple, the 'Communication information' is output on several lines with repetition of the header data of the address book entry.

  • The payload properties from the attribute should be distributed to individual columns.

Configuration:

Instead of the Collection projection in the previous example, the four instances of the Attribute projection shown in the screenshot (right) are used with a uniform parameterization except for the Property:

  • As the expanded instance shows, the Attribute owner path and the selection for Attribute (attribute type) remain unchanged.

  • A different Property is selected from the 'payload' of the attribute value for each instance:

    • orderIndex

    • communicationType

    • communicationContext

    • communicationValue

NOTE◄ These projections can be put together quite quickly by 'copying, pasting and adapting'. As described above in abstract terms, this does not result in four individual JOINS being generated internally and processed at runtime. Rather, all instances of the Attribute projection effectively refer automatically to the same join.

NOTE◄ As no Name is specified, the internal property names appear as labels for each output column.

images/download/attachments/162408869/image-2023-12-8_9-41-44-version-1-modificationdate-1702024905898-api-v2.png

Runtime example:

For the same section of the sample data, the CSV search returns the text shown below, in which address book entries (see second column, id) with multiple lines of 'Communication information'.

addressBookId,id,address.accMatchCode,orderIndex,communicationType,communicationContext,communicationValue
...
1051,953,EDDH,0,EMAIL,noreply,noreply@ema.il
1051,953,EDDH,2,PHONE,info,+49 (40) 50750
1051,953,EDDH,1,EMAIL,alternate,noreply2@doma.in
1051,952,EDDF,0,PHONE,info,+49 (180) 6 3724636
1051,951,EDDL,0,PHONE,info,+49 (211) 4210
...

Special use case: Evaluating typed attributes of a type

A CSV search should visualize the 'progress' in the life cycle of Shipments through a list column that names the Date types for each date attribute used.

Configuration:

The screenshot on the right shows the configuration for CSV search Projections:

  • The Property projection maps the 'ID' (id) property of the shipment to identify it.

  • The Collection projection (Name DATE_ATTRIBUTES) uses an Attribute projection with the following parameterization as the Property of collection:

    • An Attribute owner path is not required as the shipment is the direct attribute owner in the context.

    • The attribute type 'Date attribute' is selected as the Attribute.

    • The Property dateType should appear in the Collection, which names the subtype of the date attribute using a value from the dynamic enumeration Date types.

      NOTE◄ The internal name of the enumeration value appears in the CSV for the Date types and not an associated localization.

images/download/attachments/162408869/image-2023-12-8_9-36-47-version-1-modificationdate-1702024608947-api-v2.png

Runtime example:

id,DATE_ATTRIBUTES
...
4802,[DISPATCH_DATE_PLANNED]
4701,[ARRIVAL_PLANNED]
4651,[ARRIVAL_PLANNED]
4402,[]
4401,[]
4301,[ARRIVAL_PLANNED]
4253,[ARRIVAL_PLANNED]
4203,[]
4202,[ARRIVAL_PLANNED]
4201,[]
4151,[]
4101,&quot;[VESSEL_DEPART, WAYPOINT_ARRIVAL_DATE, WAYPOINT_ARRIVAL_DATE, VESSEL_ARRIVAL, LOADING_DATE]&quot;
4051,&quot;[TEST_DATETYPE, ARRIVAL_PLANNED]&quot;
4006,[]
...

NOTE

  • The example shows items with date attributes with subtypes that can be singular or plural.

  • Only the Date types WAYPOINT_ARRIVAL_DATE can be clearly recognized as plural, as it appears several times in the same Collection for one shipment.

  • Whether a Date types that only appears once is singular by definition would also not be clear from the complete attribute value. An index property with the value 0 also appears for singular attribute values.

IMPORTANT◄ The procedure demonstrated here for evaluating attribute subtypes is only really practical if the following restrictions are not a problem:

  1. The individual values in a Collection projection cannot be sorted. The Date types values also do not appear in a logical or chronological order (see LOADING_DATE).

  2. The Attribute projection takes into account all attributes of the selected type, including those that are not currently 'filled'.
    Digression;
    If an attribute value is deleted, not only the associated attribute entity is usually retained in the data of the attribute owner entity, but also the attribute value itself, as this continues to refer to the subtype:

          <shp:ShipmentDate id="1852" ... >
    <value dateType="TEST_DATETYPE"/>
    </shp:ShipmentDate>


    The search shown above therefore returns the Date types in this case, although the attribute value does not contain any further 'payload'. The Attribute projection also provides no option for a corresponding restriction. Only an Attribute join could do this.