Analysis of a data structure
The method determines comparison keys for data structures based on structure definitions, enabling efficient ordering and comparison, thereby facilitating the detection of changes and supporting quality assurance in control devices.
Patent Information
- Application Number
- DE102017217663
- Authority / Receiving Office
- DE · DE
- Patent Type
- Patents
- Current Assignee / Owner
- Filing Date
- 2017-10-05
- Publication Date
- 2024-11-14
- Estimated Expiration
- 2037-10-05
AI Technical Summary
Existing methods for determining comparison keys for objects in data structures are inefficient, particularly when objects lack comparison keys, leading to difficulties in ordering and comparing data structures, especially in the context of changes in control devices within motor vehicles.
A method and device for transforming data structures by determining comparison keys based on structure definitions, assigning unique keys to objects, and serializing them in a reproducible order, allowing for efficient comparison and identification of changes.
Enables effective comparison and serialization of data structures, facilitating the detection of logical changes and supporting quality assurance in control devices, particularly in motor vehicles, by ensuring objects are ordered and differences are easily identifiable.
Smart Images

Figure 00000000_0000_ABST
Abstract
Description
[0001] The invention relates to a method and a device for analyzing a data structure. The data structure can, in particular, represent or model functional components of a control unit.
[0002] A motor vehicle includes a control unit comprising several components that are interconnected and capable of exchanging messages with each other. The control unit can influence a physical aspect of the motor vehicle, for example, by influencing a longitudinal or lateral movement of the vehicle or by controlling a physical device on board the vehicle, such as a heater, an adjustable exterior mirror, or an adjustable seat. A malfunction of the control unit can result in property damage or personal injury.
[0003] If a component of the control unit is modified, for example by replacing one of its electronic components with another, a change to another component may also be necessary to ensure the desired functionality of the control unit.
[0004] The way in which the components interact can be specified as a data structure containing objects that represent the objects. A change to the control unit can correspond to a transformation of the data structure. To be able to trace all changes individually, differences between the data structures must be determined.
[0005] One way to do this involves serializing and then comparing the data structures. This requires that the objects of the data structure be placed in a predetermined order during serialization. However, some objects cannot include a comparison key that defines an order.
[0006] DE 100 64 526 A1 concerns the generation of object identifications, which can be done either using natural keys or alternatively using artificial keys.
[0007] DE 600 02 876 T2 relates to a method for generating an information container whose information includes attributes.
[0008] DE 10 2004 047 877 A1 concerns an exchange of objects between two tools in object-oriented data structures.
[0009] One object underlying the invention is to provide an improved technique for determining comparison keys for objects of a data structure. The invention achieves this object by means of the subject matter of the independent claims. Subclaims specify preferred embodiments.
[0010] The method according to the invention serves to transform a data structure according to a change in a control unit on board the motor vehicle and comprises - a change in a control device on board a motor vehicle used to control at least one physical function of the motor vehicle and - transforming a data structure reflecting the control unit or its architecture, wherein the transformation of the data structure (comprising multiple objects) comprises steps of determining a comparison key for at least one of the objects; and assigning the determined comparison key to the object, so that different comparison keys are assigned to the objects. The comparison key of the at least one object is determined based on a structure definition assigned to the object. The transformation of the data structure reflects the change to the control unit or its architecture.
[0011] The structure definition specifies how the object is structured so that the comparison key for each object can be determined appropriately. In particular, the comparison key can take into account a characteristic of the object, so that the sequence can be not only reproducible but also meaningful with respect to the object. For example, a comparison key for an object assigned to an ECU can be determined based on the ECU's name, whereby different parts of the name can be treated differently.
[0012] Preferably, at least two objects of the data structure are assigned different structure definitions, and comparison keys for the two objects are determined in different ways. Objects with identical or similar structures can thus be compared with each other, while objects with different structures do not necessarily have to be comparable with each other. Comparison keys of different objects can, for example, have different lengths to reflect possible object diversity and reduce storage space for the comparison key. For an object consisting of only one digit, a short comparison key can be determined that can assume at least 10 different values, while for an object comprising a table with multiple entries, a longer comparison key can be determined that can assume more different values.
[0013] The structure definition of the at least one object can describe a relationship between two objects of the data structure, with the comparison key being determined based on both objects. The relationship can exist between other objects or between the object and one or more other objects. This allows a meaningful comparison key to be determined even if the object contains few or no attributes of its own, on the basis of which a comparison key is usually determined.
[0014] The structure definition can describe a relationship to an optional object, whereby the comparison key is only determined depending on the optional object if it exists in the data structure. This allows the structure definition to be specified flexibly. Determining which optional objects are actually related to the object being processed, how this relationship is structured, and what type of optional objects they are can be improved by only determining them at runtime.
[0015] A comparison key can only be assigned to an object of the data structure if the object does not yet contain a comparison key.
[0016] This allows existing comparison keys to be used, and a new key is only determined for objects that do not contain a comparison key or to which no comparison key is assigned. This can reduce processing overhead, and existing comparison keys can be used to enable meaningful sorting of the objects.
[0017] The at least one object can encompass or reference one or more further objects, and the comparison key for the object can be determined based on the encompassed or referenced objects. Typically, the comparison key of the object is determined based on all encompassed or referenced objects, in particular their comparison keys. In a further embodiment, however, those encompassed or referenced objects used to form the comparison key for the parent object can also be actively selected, in particular based on a structure definition of the object or one of the encompassed or referenced objects.
[0018] The comparison key for the object can, in particular, be determined recursively based on one or more encompassed or referenced objects. In particular, a comparison key of a encompassed or referenced object can be used to form the comparison key for the parent object. A encompassed object that is not characteristic of the parent object, for example, because it is encompassed by a large number of other objects, cannot be taken into account when forming the comparison key.
[0019] For recursive processing, a processing depth can be predetermined to which encompassed or referenced objects are followed. This can prevent excessively long or even infinite recursion. In one embodiment, the comparison key is first determined using a predetermined recursion depth. If a collision then occurs between comparison keys, i.e., if identical comparison keys were determined for different objects, the determination can be repeated using an increased recursion depth until no more collisions occur. The repeated determination can affect one or more of the objects whose comparison keys collide, or even other or all objects in the data structure.
[0020] Alternatively, the recursion can also be aborted if a cycle is detected in a chain of object dependencies. For example, if a first object includes a second, and this object includes the first, a cycle exists that cannot be resolved by recursion. In another embodiment, objects (or references to the objects) already visited during a recursion are saved, and subsequent processing of these objects is skipped.
[0021] The data structure can be serialized in a monotonic order of the comparison keys. The objects contained in the data structure can be concatenated in ascending or descending order of their comparison keys. The order of the serialized objects in the concatenation is preferably as invariant as possible with respect to a change in one of the objects in the data structure.
[0022] The serialized data structure can be compared with another serialized data structure. A data structure that reflects, for example, the architecture of an ECU, can easily comprise several tens of MB in serialized form. By determining comparison keys for objects contained in the data structure as described, the comparison with the other serialized data structures can be carried out more easily, since sequences of serialized objects belonging to sections of the data structures that correspond to one another or are identical can also be identical. Differences between the serialized data structures can therefore be more easily detected and, for example, output or highlighted in the serialization. A person who reviews changes or differences between the data structures and is possibly responsible for them can thus be specifically informed of deviations.This makes it easier to control logical changes that are automatically made in response to an initial change.
[0023] The further serialized data structure can be determined based on a transformation of the other data structure. In particular, one of the data structures can have resulted from a transformation from the other. The method can comprise the transformation. The transformation can reflect a change to the thing reflected by the data structures. If the data structure relates, for example, to a control unit or its architecture, the transformation can reflect a change to the control unit or to the architecture. The control unit can be configured, in particular, for use on board a motor vehicle. For example, for a design of a control unit or planning the series production of control units, monitoring changes can support quality assurance. In a further embodiment, the data structure can also reflect a system of multiple control units, in particular on board a motor vehicle.
[0024] The data structure can include a tree-like structure of objects. This allows for improved processing of many practical structures, including linear or hierarchical ones.
[0025] The system according to the invention comprises - a motor vehicle with a control unit on board the motor vehicle for controlling at least one physical function of the motor vehicle, wherein the control unit and / or its architecture is changeable, and - a device for transforming a data structure according to a change in a control unit and / or its architecture, the system being intended for carrying out the method according to the invention.
[0026] The device comprises a storage device for storing a data structure with multiple objects; and a processing device. The processing device is configured to determine a comparison key for at least one of the objects based on a structure definition assigned to the object; and to assign the determined comparison key to the object, so that different comparison keys are assigned to the objects. The transformation of the data structure reflects the change to the control unit or its architecture.
[0027] The processing device is preferably configured to fully or partially carry out a method described herein and may, in particular, comprise a programmable microcomputer or microcontroller. The method may, for this purpose, be in the form of a computer program product with program code means, executed on the processing device, or stored on a computer-readable data carrier. Features or advantages of the method may be related to the device, and vice versa.
[0028] The invention will now be described in more detail with reference to the accompanying drawings, in which: Fig. 1 an exemplary motor vehicle with a control unit; Fig. 2 exemplary, schematic representations of a control unit and a modified control unit; and Fig. 3 illustrates a flow chart of a process.
[0029] Fig. 1 shows an exemplary system 100, which is implemented as a motor vehicle and includes at least one control unit 105. The control unit 105 can be configured, in particular, to control a physical function of the system 100, in the present example, for example, a braking system for influencing a longitudinal movement or an electronic stability program (ESP) for influencing a lateral movement of the motor vehicle 100.
[0030] The control unit 105 typically comprises several components 110, of which in the exemplary illustration of Fig. 1 shows, by way of example, several input components 115, a processing component 120, and an output component 125. Other or further components 110-120 may also be included. The control unit 105 can be connected, in particular, to another control unit, a sensor, or an actuator by means of an input component 115 and / or an output component 125. Communication between the control unit and other devices on board the motor vehicle 100 can take place via a control bus (not shown).
[0031] A function, structure, or architecture of the control unit 105 based on the components 110 can be represented in the form of a data structure. For the analysis or manipulation of such a data structure, which is described below with reference to Fig. 2, a device 130 may be provided, which preferably comprises an input device 135 for capturing the data structure and a processing device 140. Preferably, a storage device 145 is also provided, which is configured to store the data structure in whole or in part, as well as optionally further information such as a structure definition of an object encompassed by the data structure.
[0032] Fig. 2 shows a first data structure 205, which, for example, reflects a control unit 105, and a second data structure 210, which reflects the control unit 105 after a change 215. With reference to the data structures 205, 210, the change 215 can also be referred to as a transformation. In the representation of Fig. 2, the change consists, for example, in the addition of an input component 115, which is reflected in a change of a part of the second data structure 210 compared to the first data structure 205. The added input component 115 in Fig. 1 and the corresponding object in Fig. 2 are dark colored for better understanding.
[0033] The first data structure 205, for example, has the basic form of a tree and comprises a plurality of objects 220. Relationships 225 can exist between objects 220. An object 220 can comprise one or more attributes 230, wherein an attribute 230 can comprise, for example, a value or a tuple or a collection of multiple values. Further embodiments are also possible, and an attribute 230 can also be very complex, for example, in the form of a data object. The exact structure of an attribute 230 can be unknown (BLOB = "binary large object").
[0034] An object 220 can be assigned a comparison key 235, which allows objects 220 of a common organizational level to be uniquely ordered by placing the objects 220 in ascending or descending order of their assigned comparison keys 235. For example, all objects 220 that are subordinate to a common object 220 can be sorted in this way.
[0035] Some objects 220 may already include comparison keys 235 or may already have comparison keys 235 assigned to them. The presence of a comparison key 235 may depend on the type of the respective objects 220 and their specific implementation. In particular, a unique identifier for the object 220, also known as a UID ("unique identifier"), may be used as the comparison key 235. It may be unknown how the UID was determined, as long as it is unique, i.e., there are no two objects 220 with the same UID. However, the resulting order between two objects 220 may be arbitrary.
[0036] However, it is assumed that at least one of the objects 220 has not initially been assigned a comparison key 235. A structure of this object 220 is specified in the form of a structure definition 240. The structure definition 240 can, in particular, specify which attributes 230 the object 220 has and with which objects 220 it has which relationship 225. It is proposed that a comparison key 235 for such an object be determined on the basis of its structure definition 240. Optionally, the actual structure of the object 220 can also be taken into account, for example, if the structure definition 240 includes alternatives or an optional element. In addition, elements of the object 220 and / or elements of an object 220 related 225 to the object 220 can be used to determine the comparison key 235.
[0037] For example, the comparison keys 205, 210 can be used to serialize the data structures 205, 210. Serialized versions of the data structures 205, 210 are shown in the lower part of Fig. 2. The data structures 205, 210 serialized in this way can, in particular, facilitate a comparison or determination of differences in the data structures 205, 210.
[0038] Numerous variants are conceivable for the concrete determination of a comparison key 235. - The comparison key 235 of an object 220 can be determined by means of a function f or a combination of functions f1 ... fn. - The functions can be determined by values of attributes 230, comparison keys 235 of a related 225 further object 220 or of the further object 220 itself, in particular in its representation in a memory of a processing system. - A function f1 may, for example, be based on a specific attribute 230 or a reference or relationship 225 that represents a unique identifier, where the function may determine the identifier as a comparison key 235. - A type-specific function f2(t) may, for example, be based on a combination of attributes 230 and / or relationships 225 that together represent a unique identifier, where the function f2 may determine the identifier as a comparison key 235. - A function f3 can be based on the values of attributes 230 and / or the comparison keys of objects 220 that are in relationship 225 and, for example, determine a concatenation of these values as the comparison key 235. - A fallback function f4 can, for example, be defined such that a non-empty value is always determined as the comparison key 235; this can, for example, be realized by a function which returns a representation of the object in a memory to a processing system. - Multiple functions can be executed in a predetermined order, for example, first f1, then f2, then f3, etc. The first return value of a function f can be determined as a comparison key 235 that is not empty. - The comparison key 235 of an object 220 can be determined recursively, in particular if it is based on the comparison key 235 of a related object 220.
[0039] Numerous variants and options are also conceivable for the implementation of the function: The functions should have a low collision probability, which means that different arguments should lead to different outputs if possible. - A number of arguments to a function is preferably irrelevant. - If the order of the arguments is relevant, they can be used in a predetermined order, for example alphabetically. - If the order of the arguments is relevant, relationships 225 with multiple objects 220 can be omitted or preprocessed, for example by sorting. - One of the functions may include a hash function (hash function) or a combination with a hash function. - An exemplary function f determines an existing unique identifier of an object 220 can be used as a comparison key 235. - An exemplary function f2(t1) concatenates a path, a name and a type of an object 220 as a comparison key 235, provided the combination is unique within the data structure 205. - An exemplary function f3 determines a concatenation of character strings of attributes 230 of the object 220 and comparison keys 235 of objects 220 in relationship 225 as comparison key 235; the components can be sorted, for example, with respect to the names of the attributes 230 or the names of the relationships 225. - An example function f3 comprises a predetermined hash function of a programming language used for implementation, for example, C++ or C#. The determined hash value can be converted into a character string. - In the case of loop-like relationships 225, already processed parts of a memory in which objects 220 are stored can be marked in order to subsequently omit further processing. - Attributes 230 that are not characteristic of an object 220 can be omitted when determining a comparison key 235. This can, for example, affect attributes 230 of one of the types "not changeable," "transient," "volatile," or "derived." - Relationships 225 that are not characteristic of an object 220 can be omitted when determining a comparison key 235. This can, for example, affect relationships 225 of one of the types "not changeable," "transient," "volatile," "derived," or "container." - If the comparison key 235 is determined recursively across multiple objects 220, a processing depth can be predetermined. It is possible to determine a partial key in a first run. If this partial key is insufficient because another object 220 exists with the same partial key, the processing depth can be gradually increased until all objects 220 are included in the determination. - Comparison keys 235 of objects 220 can be kept in a fast cache to accelerate further determinations of comparison keys 235. - Additional functions can be used to accommodate differences that should not be taken into account, for example, case-insensitive handling of strings.
[0040] The method can be used with any type of object 220, such as collections, models, or tables, to: - to sort objects 220, - to determine differences between objects 220, or - Merge objects 220.
[0041] Depending on the system that performs the determination of the comparison keys 235, further optimizations can be applied. For example, if the order of the objects needs to be changed, especially in the case of sorting, objects 220 can be skipped. - whose order cannot be changed (for example because their current order is important); - which already have a desired order; or - whose order does not need to be changed, for example objects 220 of one of the types “not changeable”, “transient”, “volatile” or “derived”.
[0042] In the context of this invention: - “not changeable”: it is not possible to assign a value to an element marked with this symbol; - “transient”: an element marked with this will not be serialized; - “volatile”: an element marked with this symbol has no allocated storage space; - “derived”: an element marked with this symbol is determined on the basis of other elements; - “container”: an element marked with this symbol contains a backward reference to an element that is its parent.
[0043] Fig. 3 shows a flowchart of an exemplary method 300, which in particular is implemented in whole or in part on the device 130 of the system 100 of Fig. 1 can be executed.
[0044] In an optional step 305, a first data structure 205 is acquired and can be stored, for example, in the storage device 145. Subsequently, the objects 220 comprised by the data structure 205 are to be provided with comparison keys 235. For this purpose, the objects 220 can be checked in any order. In one embodiment, a recursive check is performed, which can particularly begin at a root object if the data structure 205 has a hierarchical form, such as a tree.
[0045] In a step 310, an object 220 of the data structure 205 can be determined that is to be checked. Preferably, in a step 315, it is determined whether an assigned or encompassed comparison key 235 is present. If this is the case, the process can continue with the next object 220 in step 310. Otherwise, a structure definition 240 of the object 220 is preferably determined in a step 320. The structure definition 240 explains a structure of the object 220 from elements such as attributes 230 or relationships 225. The comparison key 235 can be determined in a step 325, preferably taking into account the structure definition 240 and / or elements encompassed by the object 220. For the precise determination of the comparison key, the steps described above with reference to Fig.2 shows possible embodiments and variants. The determined comparison key 235 can be assigned to the object 220 in a step 330. Subsequently, in step 310, the process can continue with a subsequent object 220. Steps 310 to 330 can be performed recursively if a comparison key 235 of a contained or related object 220 is required to determine a comparison key 235.
[0046] After the comparison keys 235 of all objects 220 have been determined, the data structure 205 can be serialized in a step 335 by sequencing the objects 220 it encompasses and preferably expressing each of them as character strings. The order of the objects 220 is determined by the comparison keys 235. Alternatively, the objects 220 can also be sorted, for example, within the data structure 205 or otherwise manipulated with respect to their comparison keys 235.
[0047] In its serialized form, the data structure 205 can be compared with a serialized second data structure 210 (step 340). Differences between the data structures 205, 210 can be determined in a step 345 and highlighted in one of the representations or output separately. Reference symbol 100 System (Motor Vehicle) 105 Control unit 110 Component 115 Input component 120 processing components 125 Output component 130 Device 135 Input device 140 processing facility 145 Storage device 205 first data structure 210 second data structure 215 Change / Transformation 220 objects 225 Relationship 230 Attribute 235 comparison key 240 Structure definition 205 first data structure 210 second data structure 215 Amendment 300 procedures 305 Capture data structure 310 Determine Object 315 keys available? 320 Determine structure definition 325 Determine comparison key 330 Assign comparison key 335 Serialization data structure 340 Comparison with another serialized data structure Determine / output 345 differences
Claims
[1] Method (300) for transforming a data structure (205) according to a change in a control unit (105) on board the motor vehicle (100), the method (300) comprising: - Changing a control device (105) on board the motor vehicle (100) used to control at least one physical function of the motor vehicle (100) and - Transforming a data structure (205) reflecting the control unit (105) or its architecture, comprising the following steps: - capturing (305) a data structure (205) with multiple objects (220); - determining (325) a comparison key (235) for at least one of the objects (220); - Assigning (330) the determined comparison key (235) to the object (220), - so that different comparison keys (235) are assigned to the objects (220); - the comparison key (235) of the at least one object (220) is determined (325) on the basis of a structure definition (240) assigned to the object (220) and - wherein the transformation of the data structure (205) reflects the change in the control unit (105) or in its architecture. [2] The method (300) of claim 1, wherein at least two objects (220) of the data structure (205) are assigned different structure definitions (240) and comparison keys (235) for the two objects (220) are determined in different ways. [3] Method (300) according to claim 1 or 2, wherein the structure definition (240) of the at least one object (220) describes a relationship between two objects (220) of the data structure (205) and the comparison key (235) is determined on the basis of both objects (220). [4] Method (300) according to claim 3, wherein the structure definition (240) describes a relationship to an optional object (220) and the comparison key (235) is determined depending on the optional object (220) only if it is present in the data structure (205). [5] Method (300) according to one of the preceding claims, wherein a comparison key (235) is assigned to an object (220) of the data structure (205) only if the object (220) does not yet comprise a comparison key (235). [6] Method (300) according to one of the preceding claims, wherein the at least one object (220) comprises or references one or more further objects (220) and wherein the comparison key (235) is determined on the basis of the comprised or referenced objects (220). [7] Method (300) according to one of the preceding claims, wherein the at least one object (220) comprises one or more further objects (220) and the comparison key (235) is determined on the basis of comparison keys (235) of the comprised or referenced objects (220). [8] The method (300) of claim 7, wherein the comparison key (235) for the object (220) is determined recursively. [9] The method (300) of any preceding claim, further comprising serializing the data structure (205) in monotonic order of the comparison keys (235). [10] The method (300) of claim 9, further comprising comparing the serialized data structure (205) with another serialized data structure (205). [11] The method (300) of claim 9, wherein the further serialized data structure (205) was determined based on a transformation of the other data structure (205). [12] Method (300) according to one of the preceding claims, wherein the data structure (205) comprises a tree-like structure of the objects (220). [13] Method (300) according to one of the preceding claims, wherein the data structure (205) describes a control unit. [14] System, comprehensive - a motor vehicle (100) with a control unit (105) on board the motor vehicle (100) for controlling at least one physical function of the motor vehicle (100), wherein the control unit (105) and / or its architecture is changeable, and - a device (130) for transforming a data structure (205) according to a change in a control device (105) and / or its architecture, wherein the system is intended for carrying out a method according to one of the preceding claims and further comprises: - a storage device (145) for storing a data structure (205) with a plurality of objects (220); - a processing device (140) which is arranged to - to determine a comparison key (235) for at least one of the objects (220); and - to assign the specific comparison key (235) to the object (220), - so that different comparison keys (235) are assigned to the objects (220); - the processing device (140) is configured to determine the comparison key (235) of the at least one object (220) on the basis of a structure definition (240) associated with the object (220), and - wherein the transformation of the data structure (205) reflects the change in the control unit (105) or in its architecture.
Citation Information
Patent Citations
method for generating object identifications, especially in databases
DE10064526A1
system and method for structure-decoupled exchange of object-oriented data structures
DE102004047877A1
PRESENTATION, MANAGEMENT AND SYNTHESIS OF TECHNICAL CONTENT
DE60002876T2
