Method and system for realizing attribute inheritance, electronic equipment and storage medium

By displaying and editing the inheritance tree in the visual interactive page and updating element records based on the conceptual model, the limitations of single-inheritance and multi-inheritance models are solved, flexible and efficient attribute inheritance are achieved, and the needs of complex data models are met.

CN120371174APending Publication Date: 2025-07-25BEIJING JINGWEI HIRAIN TECH CO INC
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510488250.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-17
Publication Date
2025-07-25

AI Technical Summary

Technical Problem

The existing single inheritance model and multi-inheritance model cannot meet the increasingly complex data model needs, cannot selectively inherit some attributes of the parent element, and the multi-inheritance model has attribute conflicts and difficulties in maintaining.

Method used

The inheritance tree is displayed in the visual interactive page, and generated based on the preset concept model. Users can edit the attributes and inheritance relationships of elements, update the records of elements and their children elements through the path counting method, realizing multi-inheritance and partial inheritance.

Benefits of technology

It realizes flexible and controllable adjustment of attributes and inheritance relationships, solves the problems of attribute conflicts and complex inheritance relationships, improves the computing and processing efficiency, and meets the needs of complex data models.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120371174A_ABST
    Figure CN120371174A_ABST
Patent Text Reader

Abstract

The invention provides a method and system for achieving attribute inheritance, electronic equipment and a storage medium, the method comprises the steps that an inheritance tree is displayed in a visual interaction page, the inheritance tree is generated based on definition information of a preset conceptual model, and nodes of the inheritance tree correspond to elements; in response to an editing operation for a first target element in the inheritance tree, adjusting the attribute and / or inheritance relationship of the first target element; according to the adjusted attribute and / or inheritance relation of the first target element, records of the first target element and a second target element are updated, and the second target element is a sub-element of the first target element. The attribute and the inheritance relation are selectively adjusted, and the requirement of a complex data model is met.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data processing, and particularly relates to a method, a system, an electronic device, and a storage medium for implementing attribute inheritance. Background Art

[0002] In fields such as product design and development and data modeling and analysis, attribute inheritance between elements is a core concept. Currently, a single inheritance model or a multiple inheritance model is usually adopted to implement attribute inheritance between elements. The single inheritance model allows an element to inherit all attributes and methods from one parent element, and the multiple inheritance model allows an element to inherit attributes and methods from multiple parent elements.

[0003] In some scenarios, users do not want the child element to inherit all the attributes of the parent element, but rather selectively inherit some of the attributes of the parent element according to actual needs. However, the single inheritance model and the multiple inheritance model cannot selectively inherit some of the attributes of the parent element, and it is difficult to meet the increasingly complex data model requirements. Summary of the Invention

[0004] In view of this, embodiments of the present invention provide a method, a system, an electronic device, and a storage medium for implementing attribute inheritance to solve problems such as the existing single inheritance model and multiple inheritance model being unable to meet the increasingly complex data model requirements.

[0005] To achieve the above object, embodiments of the present invention provide the following technical solutions:

[0006] A first aspect of an embodiment of the present invention discloses a method for implementing attribute inheritance, the method including:

[0007] Display an inheritance tree on a visual interaction page, the inheritance tree being generated based on definition information of a preset conceptual model, and nodes of the inheritance tree corresponding to elements;

[0008] In response to an editing operation on a first target element in the inheritance tree, adjust attributes and / or inheritance relationships of the first target element, the first target element being any element in the inheritance tree;

[0009] Update records of the first target element and a second target element according to the adjusted attributes and / or inheritance relationships of the first target element, the second target element being a child element of the first target element.

[0010] Preferably, in response to an editing operation on a first target element in the inheritance tree, adjusting attributes and / or inheritance relationships of the first target element includes:

[0011] When a click operation on the first target element in the inheritance tree is detected on the visual interaction page, switch to the editing page, where the editing page displays at least: the attributes and inheritance relationships of the first target element;

[0012] In response to an editing operation triggered on the editing page, adjust the attributes and / or inheritance relationships of the first target element.

[0013] Preferably, according to the adjusted attributes and / or inheritance relationships of the first target element, update the records of the first target element and the second target element, including:

[0014] Update the record of the first target element according to the adjusted attributes and / or inheritance relationships of the first target element;

[0015] Use the updated record of the first target element to update the record of the second target element.

[0016] Preferably, the records of the first target element and the second target element at least include: the total number of inheritance paths and the actual number of inheritance paths;

[0017] Using the updated record of the first target element to update the record of the second target element includes:

[0018] Using the updated record of the first target element, calculate the change in the total number of inheritance paths and the change in the actual number of inheritance paths of the first target element, and calculate the total number of inheritance paths and the actual number of inheritance paths from the first target element to the second target element;

[0019] Use the change in the total number of inheritance paths of the first target element and the total number of inheritance paths from the first target element to the second target element to update the total number of inheritance paths in the record of the second target element;

[0020] Use the change in the actual number of inheritance paths of the first target element and the actual number of inheritance paths from the first target element to the second target element to update the actual number of inheritance paths in the record of the second target element.

[0021] Preferably, after updating the record of the first target element, it further includes:

[0022] If the total number of inheritance paths in any record of the updated first target element is 0, delete the record of the first target element with a total number of inheritance paths of 0.

[0023] Preferably, after updating the total number of inheritance paths in the record of the second target element, it further includes:

[0024] If the total number of inheritance paths in any record of the updated second target is 0, delete the record of the second target element with the total number of inheritance paths being 0.

[0025] In a second aspect of the embodiments of the present invention, a system for implementing attribute inheritance is disclosed. The system includes:

[0026] A display unit, configured to display an inheritance tree in a visual interaction page. The inheritance tree is generated based on definition information of a preset concept model, and nodes of the inheritance tree correspond to elements.

[0027] An adjustment unit, configured to adjust attributes and / or inheritance relationships of a first target element in response to an editing operation on the first target element in the inheritance tree. The first target element is any element in the inheritance tree.

[0028] An update unit, configured to update records of the first target element and a second target element according to the adjusted attributes and / or inheritance relationships of the first target element. The second target element is a sub-element of the first target element.

[0029] Preferably, the adjustment unit includes:

[0030] A switching sub-unit, configured to switch to an editing page when a click operation on the first target element in the inheritance tree is detected to be triggered in the visual interaction page. The editing page at least displays: attributes and inheritance relationships of the first target element.

[0031] An adjustment sub-unit, configured to adjust attributes and / or inheritance relationships of the first target element in response to an editing operation triggered in the editing page.

[0032] In a third aspect of the embodiments of the present invention, an electronic device is disclosed, including: a processor and a memory. The processor and the memory are connected through a communication bus. Wherein, the processor is configured to call and execute a program stored in the memory, and the memory is configured to store a program, and the program is used to implement the method for implementing attribute inheritance disclosed in the first aspect of the embodiments of the present invention.

[0033] In a fourth aspect of the embodiments of the present invention, a computer-readable storage medium is disclosed. A computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the method for implementing attribute inheritance disclosed in the first aspect of the embodiments of the present invention is implemented.

[0034] Based on the method, system, electronic device, and storage medium for implementing attribute inheritance provided in the embodiments of the present invention, the method is as follows: display an inheritance tree on a visual interaction page, where the inheritance tree is generated based on the definition information of a preset concept model, and the nodes of the inheritance tree correspond to elements; in response to an editing operation on a first target element in the inheritance tree, adjust the attributes and / or inheritance relationships of the first target element; according to the adjusted attributes and / or inheritance relationships of the first target element, update the records of the first target element and a second target element, where the second target element is a sub-element of the first target element. In this solution, an inheritance tree generated by a concept model is displayed on a visual interaction page. Users can edit the inheritance tree to adjust the attributes and inheritance relationships of elements, and then update the records of the elements and their sub-elements according to the adjusted attributes and inheritance relationships, so as to selectively adjust the attributes and inheritance relationships and meet the requirements of complex data models. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the drawings in the following description are only the embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained according to the provided drawings without creative efforts.

[0036] Figure 1 It is a flowchart of a method for implementing attribute inheritance provided by an embodiment of the present invention;

[0037] Figure 2 It is a flowchart of updating the records of the first target element and the second target element provided by an embodiment of the present invention;

[0038] Figure 3 It is an example diagram of multiple inheritance and partial inheritance provided by an embodiment of the present invention;

[0039] Figure 4 It is an example diagram of the state changes of inheritance relationships and attributes provided by an embodiment of the present invention;

[0040] Figure 5 It is an example diagram of the initial state of the records of each attribute provided by an embodiment of the present invention;

[0041] Figure 6 It is an example diagram of the record changes after adding attribute b to class D and class F provided by an embodiment of the present invention;

[0042] Figure 7 It is an example diagram of the record changes after class C inherits class A provided by an embodiment of the present invention;

[0043] Figure 8 It is an example diagram of the record changes after class E inherits class C provided by an embodiment of the present invention;

[0044] Figure 9 This is an example diagram of record changes after removing attribute b from class E provided by the embodiments of the present invention;

[0045] Figure 10 This is an example diagram of record changes after class B cancels inheriting from class A provided by the embodiments of the present invention;

[0046] Figure 11 This is a structural block diagram of a system for implementing attribute inheritance provided by the embodiments of the present invention. Detailed implementation manners

[0047] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.

[0048] In this application, the term "including", "comprising" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements but also includes other elements not expressly listed, or further includes elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "including one..." does not exclude the existence of additional identical elements in the process, method, article or device including the said element.

[0049] In fields such as product design and research and development, data modeling and analysis, and object-oriented programming, attribute inheritance between elements (such as concepts like classes, objects, entities, etc.) is a core concept. The traditional single inheritance model allows an element to inherit all attributes and methods from one parent element. However, with the development of information technology, data models have become increasingly complex, and the traditional single-parent-class, all-inheritance model cannot meet the requirements.

[0050] To cope with complex scenarios, the multiple inheritance model emerged. The multiple inheritance model allows an element to inherit attributes and methods from multiple parent elements, thus providing higher flexibility and expressiveness. For example, multiple inheritance of classes in the C++ language and multiple implementation of interfaces in the Java language. However, the multiple inheritance model still has problems such as attribute conflicts, unclear inheritance sources, complex inheritance relationships, and difficult maintenance. Especially when multiple parent elements have the same attributes, this often troubles users.

[0051] In some scenarios, users do not want child elements to inherit all the attributes of parent elements, but rather selectively inherit some of the parent elements' attributes according to actual needs. Although it can be achieved by overriding parent class methods, etc., it is impossible to completely remove the inherited attributes.

[0052] When multiple inheritance and partial inheritance are combined, the problem becomes very complex, and there is currently no good solution. However, scenarios of multiple inheritance and partial inheritance are ubiquitous in the real world.

[0053] Generally speaking, through research, it is found that the existing traditional methods of attribute inheritance have the following defects:

[0054] 1. The traditional single inheritance model lacks flexibility. It can only inherit all attributes from a single parent element, cannot inherit from multiple parent elements, nor can it selectively inherit some of the parent elements' attributes, making it difficult to meet the increasingly complex requirements of data models.

[0055] 2. In the traditional single inheritance model, child elements lack controllability. They can only inherit all the attributes of the parent element and cannot remove the inherited attributes.

[0056] 3. The traditional multiple inheritance model is difficult to understand and use. When multiple parent elements have the same-named attributes, or when a child element and a parent element have the same-named attributes, conflicts will occur, making it difficult to distinguish the attribution of attribute inheritance and causing difficulties in use and maintenance.

[0057] 4. Due to the need to record complex attribute inheritance relationships, the existing models and solutions are inefficient in calculating and processing a large number of attributes and inheritance relationships.

[0058] Therefore, this solution proposes a method, system, electronic device, and storage medium for implementing attribute inheritance. An inheritance tree generated from a conceptual model is displayed on a visual interaction page. Users can edit the inheritance tree to adjust the attributes and inheritance relationships of elements, and then update the records of elements and their child elements according to the adjusted attributes and inheritance relationships, realizing multiple inheritance and partial inheritance of attributes, and solving problems such as attribute conflicts, complex inheritance relationships, and maintenance difficulties.

[0059] Here, it should be noted that this solution is based on a preset conceptual model to implement multiple inheritance and partial inheritance. First, the conceptual model that can simultaneously implement multiple inheritance and partial inheritance will be explained below.

[0060] The conceptual model provided by this solution allows child elements to inherit from multiple parent elements and inherit the attributes of the parent elements, and allows child elements to decide not to inherit certain attributes of the parent elements, thus meeting the flexibility requirements for attribute inheritance in fields such as product design and research and development, data modeling and analysis, and object-oriented programming. The conceptual model has at least the following 10 pieces of definition information:

[0061] Article 1: Definition Information: An element refers to the smallest unit of a thing within the scope of a specific model and should be understood as a general expression of similar concepts. In different fields, an element may be expressed as a class, object, entity, etc.

[0062] Article 2: Definition Information: An attribute is information that describes the above-mentioned smallest unit and should be understood as a general expression of similar concepts. In different fields, an attribute may be expressed as a characteristic, field, member variable, etc. It has a unique identifier, which may be an attribute name, ID, or Key, etc. in different fields.

[0063] Article 3: Definition Information: The root element is a special element that is the parent element of all other elements. The root element has no parent element; except for the root element, other elements inherit from at least one parent element and may also inherit from multiple parent elements.

[0064] Article 4: Definition Information: The inheritance relationship between elements is a top-down tree structure, and it is not allowed for an element to inherit from its child elements (including the child elements of child elements, etc.), that is, a circular inheritance structure will not occur.

[0065] Article 5: Definition Information: Each element can have zero or more attributes, but there will be only one attribute with the same unique identifier, that is, there will be no two duplicate attributes.

[0066] Article 6: Definition Information: When an element adds an attribute, all its child elements (including the child elements of child elements, etc.) will default to inherit this attribute, that is, all child elements will also have this attribute.

[0067] Article 7: Definition Information: Each element can independently remove an attribute, regardless of whether the attribute is inherited or added by itself. For the child elements of this element (including the child elements of child elements, etc.), the child elements will simultaneously remove the aforementioned "independently removed attribute", unless the child element itself defines this attribute (i.e., the aforementioned "independently removed attribute"), or inherits this attribute from other parent elements.

[0068] Article 8: Definition Information: When two elements establish an inheritance relationship, the child elements (including the child elements of child elements, etc.) will default to inherit all attributes from the parent element, and the effect is the same as the definition information in Article 6.

[0069] Article 9: Definition Information: When two elements disconnect the inheritance relationship, for the attributes that the child elements (including the child elements of child elements, etc.) inherit from the parent element, these attributes will be simultaneously removed, unless the child element itself defines this attribute, or inherits this attribute from other parent elements.

[0070] Article 10 Definition Information: Regardless of whether the attributes of an element are inherited from a parent element, and regardless of how many parent elements they are inherited from, each attribute has one and only one determined value, which belongs only to the element itself. The value of the attribute is not inherited from the parent element and is not passed to the child element.

[0071] Among them, Article 1 Definition Information and Article 2 Definition Information are definitions of nouns in the conceptual model and should be understood as general representations.

[0072] Article 3 Definition Information allows an element to inherit from multiple parent elements, which means that the attributes of the element can come from multiple parent elements, achieving the purpose of multiple inheritance and improving flexibility compared to the single inheritance model.

[0073] Article 4 Definition Information restricts that the inheritance structure cannot form a loop to avoid complex problems and scenarios such as circular dependencies.

[0074] Article 5 Definition Information actually merges the attributes inherited by an element from different channels to avoid problems such as attribute conflicts and priorities, eliminates ambiguity and confusion in understanding, and solves problems such as complex relationship and difficult maintenance in the traditional multiple inheritance model.

[0075] Article 6 Definition Information and Article 8 Definition Information mean that inheritance is the default behavior. Without additional intervention, child elements will inherit all the attributes of the parent element, following the most original convenience feature of the inheritance mechanism and avoiding operation redundancy.

[0076] Article 7 Definition Information and Article 9 Definition Information allow child elements to independently remove the attributes inherited from the parent element, achieving the purpose of partial inheritance. At the same time, it also ensures that when a child element inherits the same attribute from multiple parent elements, or the child element also defines the attribute itself, if some of the parent elements remove the attribute, the child element will still retain the attribute because other parent elements provide the attribute, or it defines its own attribute, which further improves the flexibility of the model and ensures controllability.

[0077] Article 10 Definition Information stipulates that for a definite element, each attribute has a uniquely determined value and there will not be multiple copies of the attribute value because the attribute is inherited from multiple parent elements. This further reduces the complexity of the model and is clear, easy to understand, and easy to maintain in use.

[0078] The above is the relevant description of the conceptual model provided by this solution. By implementing the method of attribute inheritance to maintain the inheritance relationship data of elements and attributes in the conceptual model, the multiple inheritance and partial inheritance mechanisms are realized, and the calculation and processing efficiency are improved. The following will respectively elaborate on the method of implementing attribute inheritance through each embodiment.

[0079] See Figure 1, which shows a flowchart of a method for implementing attribute inheritance provided by an embodiment of the present invention. The method for implementing attribute inheritance includes the following steps:

[0080] Step S101: Display an inheritance tree on a visual interaction page.

[0081] In the process of specifically implementing step S101, an inheritance tree is generated in advance based on the definition information of the concept model (such as the 10 pieces of definition information mentioned above). The inheritance tree uses the "root element" as the top node, and the nodes of the inheritance tree correspond to elements, that is, each node of the inheritance tree is an element.

[0082] When the inheritance tree is displayed on the visual interaction page, the user can configure the inheritance relationship of elements, the attributes of elements, and the values of attributes on the visual interaction page.

[0083] Step S102: In response to an edit operation on a first target element in the inheritance tree, adjust the attributes and / or inheritance relationship of the first target element.

[0084] It should be noted that the first target element is any element in the inheritance tree.

[0085] In the process of specifically implementing step S102, when a click operation on the first target element in the inheritance tree triggered on the visual interaction page is detected, switch to an edit page, and the edit page displays at least: the attributes and inheritance relationship of the first target element.

[0086] In response to an edit operation triggered on the edit page, adjust the attributes and / or inheritance relationship of the first target element. The edit operation includes but is not limited to any of the following items: an operation to add an attribute, an operation to remove an attribute, an operation to determine to inherit a certain attribute from a parent element, etc.

[0087] That is to say, when the inheritance tree is displayed on the visual interaction page, when it is detected that the user clicks on the first target element, information such as the attributes and inheritance relationship of the first target element is displayed on the edit page, and the user adjusts the attributes and / or inheritance relationship of the first target element through an "edit operation" on this edit page.

[0088] It should be noted that the forms of the "edit operation" used by the user to adjust the attributes and / or inheritance relationship include but are not limited to visual interaction operations and code editing, etc.

[0089] For example: on the visual interaction page, when the user clicks on the first target element of the inheritance tree, switch to the edit page; on the edit page, the user creates an inheritance relationship between the first target element and another element by connecting lines with the mouse, and can also add or remove attributes from the first target element by clicking with the mouse, or can also decide whether to inherit a certain attribute from the parent element by selecting a switch.

[0090] For another example, the user can declare the unique identifier of the parent element in the code file to indicate which parent elements the first target element inherits from (in the way of code editing), or can declare the unique identifier of the attribute to indicate that the first target element has the attribute or inherits it from its parent element.

[0091] Step S103: Update the records of the first target element and the second target element according to the adjusted attributes and / or inheritance relationships of the first target element.

[0092] It should be noted that the second target element is the child element of the first target element (including the child elements of the child elements, etc.). In this solution, "records" are used to record the attributes and inheritance relationships of the elements.

[0093] In the process of specifically implementing step S103, after adjusting the attributes and / or inheritance relationships of the first target element, it means that the user's configuration has changed. At this time, based on the adjusted attributes and / or inheritance relationships of the first target element, combined with the path counting method, the records of the first target element and the second target element are updated.

[0094] It is worth noting that each attribute of each element will have one or more corresponding records. Each record includes the following information: the unique identifier of the record (abbreviated as record ID), the unique identifier of the element (abbreviated as element ID), the unique identifier of the attribute (abbreviated as attribute ID), the source record ID (abbreviated as source ID), the total inheritance path number (denoted as TOTAL), and the actual inheritance path number (denoted as COUNT).

[0095] Among them, for the source record ID in a certain record, the source record ID is used to identify from which record the attribute of the element in this record is inherited. If the attribute of the element is not inherited, the source record ID is empty or the same as the record ID of this record.

[0096] For the total inheritance path number (TOTAL) in a certain record, TOTAL identifies the total number of inheritance paths from the element corresponding to the source record to the element corresponding to this record.

[0097] For the actual inheritance path number (COUNT) in a certain record, COUNT identifies the number of effective paths for actually inheriting attributes from the source record to this record. The "number of effective paths for actually inheriting attributes" is also the "number of paths for actually inheriting attributes".

[0098] It should be noted that the specific explanation of the "number of effective inheritance paths for actual inherited attributes" mentioned above is as follows: When a child element inherits an attribute from an ancestor element, there may be multiple inheritance paths. However, some elements on these inheritance paths may not inherit the attribute. Then, for this attribute, the inheritance paths where the attribute is "not inherited" are "non - penetrating", and conversely, the inheritance paths where the attribute is "inherited" are "penetrating" (the inheritance paths in this case are the penetrating paths).

[0099] For example: Element A has child elements B and C, and child elements B and C have the same child element D, that is, ABCD forms a "diamond - shaped" inheritance state. The total number of inheritance paths TOTAL from D to A is 2 (A -> B -> D, A -> C -> D). If element A has an attribute a, and child element B inherits attribute a while child element C does not inherit attribute a, then the attribute a of child element D is actually inherited from element A through only one path (A -> B -> D), that is, the number COUNT of the "actual inheritance path of the inherited attribute" is 1.

[0100] As can be seen from the above - mentioned related description of "recording of elements", when an attribute of an element inherits the same attribute from multiple parent elements, or the element itself also defines the attribute, the element will have multiple records. That is, if a certain attribute of an element is inherited from multiple parent elements, then there will be multiple records for this attribute.

[0101] When the inheritance relationship and / or attributes between elements change, it is necessary to adjust the corresponding records to maintain the counting of the total inheritance path number (TOTAL) and the actual inheritance path number (COUNT) in the records.

[0102] Therefore, after adjusting the attributes and / or inheritance relationship of the first target element, it is necessary to update the records of the first target element and the second target element.

[0103] In the embodiments of the present invention, an inheritance tree generated by a conceptual model is displayed on a visual interaction page. Users can edit the inheritance tree to adjust the attributes and inheritance relationships of elements, and then update the records of elements and their child elements according to the adjusted attributes and inheritance relationships, so as to selectively adjust the attributes and inheritance relationships to meet the requirements of complex data models.

[0104] Regarding the above - mentioned embodiments of the present invention Figure 1 For the update of the records of the first target element and the second target element involved in step S103, refer to Figure 2 , which shows the flowchart of updating the records of the first target element and the second target element provided by the embodiments of the present invention, Figure 2 including the following steps:

[0105] Step S201: Update the record of the first target element according to the adjusted attributes and / or inheritance relationships of the first target element.

[0106] It should be noted that when the inheritance relationship or attributes change, it will directly affect the change of the total inheritance path number (TOTAL) and the actual inheritance path number (COUNT) in the record of a certain (some) element. The "element" mentioned in "directly affecting the record of a certain (some) element" here is called the "direct element". At the same time, it will also cause the change of TOTAL and COUNT in the records with the same source record ID of the child elements (including the child elements of the child elements, etc.) of the direct element. The change numbers of TOTAL and COUNT actually follow certain objective laws.

[0107] In the specific process of implementing step S201, after adjusting the attributes and / or inheritance relationships of the first target element, use the adjusted attributes and / or inheritance relationships of the first target element to update the total inheritance path number (TOTAL) and the actual inheritance path number (COUNT) in the record of the first target element.

[0108] Among them, after adjusting the attributes and / or inheritance relationships of the first target element, the first target element is equivalent to the "direct element" mentioned above.

[0109] Step S202: Update the record of the second target element by using the updated record of the first target element.

[0110] In the specific process of implementing step S202, use the updated record of the first target element to calculate the change number of the total inheritance path number and the change number of the actual inheritance path number of the first target element, and calculate the total inheritance path number and the actual inheritance path number from the first target element to the second target element.

[0111] Use the change number of the total inheritance path number of the first target element and the total inheritance path number from the first target element to the second target element to update the total inheritance path number in the record of the second target element.

[0112] Use the change number of the actual inheritance path number of the first target element and the actual inheritance path number from the first target element to the second target element to update the actual inheritance path number in the record of the second target element.

[0113] It is worth noting that when the TOTAL and COUNT in the records with the same source record ID of the child elements (including the child elements of the child elements, etc.) of the direct element change, the change numbers of TOTAL and COUNT actually follow certain objective laws, and the change numbers of TOTAL and COUNT can be calculated and updated through the following formula (referred to as the change number calculation formula):

[0114] The change count of the COUNT of the records of the child elements (including the child elements of the child elements, etc.) = the change count of the COUNT of the records of the direct element × the actual inheritance path count from the direct element to the child element;

[0115] The change count of the TOTAL of the records of the child elements (including the child elements of the child elements, etc.) = the change count of the TOTAL of the records of the direct element × the total inheritance path count from the direct element to the child element.

[0116] Update the total inheritance path count and the actual inheritance path count in the records of the second target element through the above change count calculation formula, where the second target element is a child element of the first target element (including the child elements of the child elements, etc.).

[0117] It should be noted that for a certain record of a certain attribute, when the count of the actual inheritance path count (COUNT) in this record is reduced to 0, it means that this attribute is not inherited from the source of this record.

[0118] For a certain record of a certain attribute, when the count of the total inheritance path count (TOTAL) in this record is reduced to 0, it means that there is no inheritance relationship between the element of this record and the element of the source record, and then this record can be completely deleted.

[0119] In some embodiments, after updating the records of the first target element, if the total inheritance path count in any record of the updated first target element is 0, delete the records of the first target element with the total inheritance path count of 0, that is, delete the records of the first target element whose total inheritance path count (TOTAL) is reduced to 0.

[0120] Similarly, after updating the total inheritance path count in the records of the second target element, if the total inheritance path count in any record of the updated second target is 0, delete the records of the second target element with the total inheritance path count of 0.

[0121] The above embodiments of the present invention Figure 2 , are related descriptions about updating the records of the first target element and the second target element.

[0122] Through the above embodiments of the present invention Figure 1 and Figure 2 the content shown, multiple inheritance and partial inheritance of attributes can be achieved. For example Figure 3 as shown in the example diagrams of multiple inheritance and partial inheritance, element A has attributes a, b, and c, element B has attributes d, e, and f. After using this solution to adjust the attributes and inheritance relationship of element C, element C inherits from both element A and element B at the same time. Element C inherits most of the attributes of element A and element B, but element C does not inherit attributes c and f.

[0123] To further help understand this solution, two examples, namely "Example 1" and "Example 2", are used to illustrate this solution from the perspective of practical applications.

[0124] Example 1. Application of this solution in product design and research and development:

[0125] In the product design and research and development system of an automotive design company, it is necessary to model different components of the vehicle. Each component (i.e., element) may inherit from multiple parent components, and certain attributes of the parent components need to be selectively inherited according to actual requirements.

[0126] First, create elements and adjust their inheritance relationships and attributes. Specifically, create an element named "General Engine" (element ID: E001) and add an attribute named "Weight" (attribute ID: A001); create an element named "High-efficiency Engine" (element ID: E002) and add an attribute named "Power" (attribute ID: A002); create an element named "New Engine" (element ID: E003) and set "New Engine" to inherit from "General Engine" and "High-efficiency Engine".

[0127] Calculate the inheritance relationships of the above elements and store records of the attributes of these elements; as Figure 4 visible in the left part of the example diagram showing the state changes of the inheritance relationships and attributes (initial state), "New Engine" will default to inherit the "Weight" attribute of "General Engine" and the "Power" attribute of "High-efficiency Engine".

[0128] When the designer decides that "New Engine" does not need to inherit the "Weight" attribute of "General Engine", the "Weight" attribute of "New Engine" can be removed. After calculating the inheritance relationship, the record of "New Engine" is as Figure 4 shown in the right part (the state after removing the "Weight" attribute of "New Engine"), and "New Engine" only has the "Power" attribute left.

[0129] The content of Example 1 above demonstrates the basic concept and implementation process of this solution. Example 1 initially reflects the characteristics of multiple inheritance and partial inheritance. To understand the implementation details of this solution more deeply, the following more complex Example 2 is used to illustrate the application of this solution in more scenarios.

[0130] Example 2. Application of this solution in object-oriented programming:

[0131] It should be noted that in Example 2, the "class" in Example 2 is the "element" in this solution.

[0132] In the process of object-oriented software development, it is necessary to design the inheritance of different classes (i.e., elements), and the inheritance relationships of the attributes of these classes are also relatively complex.

[0133] For example, there is the following initial scenario: Class B is a subclass (equivalent to a child element) of Class A. Class B has subclasses D and E, and subclasses D and E have a common subclass F. Class A has an attribute a, and classes B, D, E, and F all inherit the attribute a from Class A by default. Class C has no inheritance relationship with other classes for the time being, and Class C has an attribute b. Then, the records of the attributes of each class in the aforementioned initial scenario are as Figure 5 shown.

[0134] The first step: When a class adds an attribute, the subclasses of that class will also have that attribute, add the corresponding record or increase the COUNT count according to this solution.

[0135] For example: After adding the attribute b to Class D, the subclass F of Class D will also have the attribute b. At this time, the record changes of Class D and Class F after adding the attribute b are as Figure 6 shown.

[0136] The second step: When two classes establish an inheritance relationship, the subclass will inherit the attributes from the parent class by default, add the corresponding record or increase the counts of "TOTAL and COUNT".

[0137] For example: When Class C inherits Class A, Class C will inherit the attribute a from Class A by default. The record changes of Class C after inheriting Class A and adding the attribute a are as Figure 7 shown, and at this time Class C has the attribute a.

[0138] Furthermore, when Class E inherits Class C, the record changes of Class E after inheriting Class C are as Figure 8 shown. The count in the record of the attribute a of Class E changes and the attribute b is added. The counts of the attribute a and the attribute b of Class F change, and a record of the attribute b of Class F is added.

[0139] The third step: When a class removes an attribute, the COUNT numbers of the corresponding records of that class and its subclasses will decrease according to the change number calculation formula.

[0140] For example: When Class E removes the attribute b, the record changes of Class E and its corresponding subclass (Class F) are as Figure 9 shown. The counts of the attribute b of Class E and Class F change. The COUNT number in the record of the attribute b of Class E decreases to 0 and there is no longer the attribute b, and Class F retains the attribute b because it still inherits from Class D.

[0141] The fourth step: When two classes cancel the inheritance relationship, the COUNT and TOTAL numbers of the corresponding records of the subclass will decrease according to the change number calculation formula.

[0142] For example: When Class B cancels inheriting Class A, the record changes are as Figure 10As shown, the attribute a records of class B and class D are removed (that is, class B and class D no longer have attribute a), and the counts in the attribute a records of class E and class F are reduced, but class E and class F retain attribute a because they are also inherited from class C.

[0143] The above-mentioned Example 2 demonstrates the application of this solution in complex scenarios, and specifically demonstrates the operation process of this solution when creating inheritance relationships, removing inheritance relationships, adding attributes, or removing attributes, which fully reflects the characteristics of multiple inheritance and partial inheritance. Based on the demonstration of the above-mentioned Examples 1 and 2, this solution can provide a more efficient, flexible, and easy-to-implement attribute inheritance solution for product design and development, data modeling analysis, object-oriented programming, and other fields.

[0144] In summary, through this solution, researchers in related fields can handle multiple inheritance and partial inheritance issues more flexibly, controllably, explicitly, clearly and efficiently, and achieve the following beneficial effects:

[0145] Improve flexibility: Allow child elements to inherit attributes from multiple parent elements, and allow child elements to selectively not inherit certain parent element attributes, thereby greatly improving the flexibility of attribute inheritance, ensuring the controllability of child elements, and meeting the needs of complex data models.

[0146] Resolving attribute conflicts: Through clear rule definitions and the implementation of path counting methods, the problem of attribute conflicts in the traditional multiple inheritance model is effectively resolved, making the attribute inheritance relationship clearer and more explicit.

[0147] Simplify inheritance relationships: By merging the attributes inherited by elements from different channels, problems such as attribute conflicts and priorities are avoided, ambiguity and confusion in understanding are eliminated, inheritance relationships are simplified, and the complexity of the model is reduced.

[0148] Improve computing and processing efficiency: Through the implementation of the path counting method, the inheritance relationship between elements and attributes can be efficiently calculated and determined when data changes, and stored, thereby improving computing and processing efficiency.

[0149] Wide range of application areas: It is widely used in product design and development, data modeling and analysis, object-oriented programming and other fields, providing a more efficient, flexible and easy-to-implement attribute inheritance solution for these fields.

[0150] Corresponding to the method for implementing attribute inheritance provided by the above embodiment of the present invention, see Figure 11 The embodiment of the present invention also provides a structural block diagram of a system for implementing attribute inheritance, the system comprising: a display unit 100, an adjustment unit 200 and an update unit 300.

[0151] A display unit 100 is configured to display an inheritance tree in a visual interaction page. The inheritance tree is generated based on definition information of a preset concept model, and nodes of the inheritance tree correspond to elements.

[0152] An adjustment unit 200 is configured to adjust attributes and / or inheritance relationships of a first target element in response to an editing operation on the first target element in the inheritance tree, where the first target element is any element in the inheritance tree.

[0153] An update unit 300 is configured to update records of the first target element and a second target element according to the adjusted attributes and / or inheritance relationships of the first target element, where the second target element is a child element of the first target element.

[0154] In an embodiment of the present invention, an inheritance tree generated from a concept model is displayed in a visual interaction page. A user can edit the inheritance tree to adjust attributes and inheritance relationships of elements, and then update records of the elements and their child elements according to the adjusted attributes and inheritance relationships, so as to selectively adjust attributes and inheritance relationships to meet the requirements of a complex data model.

[0155] Preferably, in combination with Figure 11 the content shown, the adjustment unit 200 includes a switching subunit and an adjustment subunit, and the execution principles of each subunit are as follows:

[0156] The switching subunit is configured to switch to an editing page when a click operation on the first target element in the inheritance tree triggered in the visual interaction page is detected. The editing page displays at least: attributes and inheritance relationships of the first target element.

[0157] The adjustment subunit is configured to adjust attributes and / or inheritance relationships of the first target element in response to an editing operation triggered in the editing page.

[0158] Preferably, in combination with Figure 11 the content shown, the update unit 300 includes a first update subunit and a second update subunit, and the execution principles of each subunit are as follows:

[0159] The first update subunit is configured to update a record of the first target element according to the adjusted attributes and / or inheritance relationships of the first target element.

[0160] The second update subunit is configured to update a record of the second target element by using the updated record of the first target element.

[0161] In a specific implementation, records of the first target element and the second target element at least include: the total number of inheritance paths and the actual number of inheritance paths.

[0162] The second update subunit is specifically configured to: calculate the change number of the total inheritance path number and the change number of the actual inheritance path number of the first target element by using the record of the updated first target element, and calculate the total inheritance path number and the actual inheritance path number from the first target element to the second target element;

[0163] Update the total inheritance path number in the record of the second target element by using the change number of the total inheritance path number of the first target element and the total inheritance path number from the first target element to the second target element;

[0164] Update the actual inheritance path number in the record of the second target element by using the change number of the actual inheritance path number of the first target element and the actual inheritance path number from the first target element to the second target element.

[0165] Preferably, the first update subunit is further configured to: if the total inheritance path number in any record of the updated first target element is 0, delete the record of the first target element with the total inheritance path number being 0.

[0166] The second update subunit is further configured to: if the total inheritance path number in any record of the updated second target is 0, delete the record of the second target element with the total inheritance path number being 0.

[0167] Preferably, an embodiment of the present invention further provides an electronic device, including: a processor and a memory, the processor and the memory are connected through a communication bus; wherein, the processor is configured to call and execute a program stored in the memory; the memory is configured to store a program, and the program is used to implement the method for implementing attribute inheritance provided in the above method embodiment.

[0168] Preferably, an embodiment of the present invention further provides a computer-readable storage medium, in which a computer program is stored, and when the computer program is executed by a processor, it implements the method for implementing attribute inheritance provided in the above method embodiment.

[0169] In summary, an embodiment of the present invention provides a method, a system, an electronic device and a storage medium for implementing attribute inheritance, which display an inheritance tree generated by a concept model on a visual interaction page. A user can edit the inheritance tree to adjust the attributes and inheritance relationships of elements, and then update the records of the elements and their child elements according to the adjusted attributes and inheritance relationships, so as to selectively adjust the attributes and inheritance relationships to meet the requirements of complex data models.

[0170] Each embodiment in this specification is described in a progressive manner. For the same or similar parts among the embodiments, reference can be made to each other, and the key point of each embodiment is to illustrate the differences from other embodiments. In particular, for a system or system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and for the relevant parts, reference can be made to the description of the method embodiment. The systems and system embodiments described above are merely illustrative. The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. A person of ordinary skill in the art can understand and implement it without creative efforts.

[0171] Those skilled in the art can further realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described according to functions in the above description. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Skilled professionals can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present invention.

[0172] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present invention. Various modifications to these embodiments will be obvious to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but will be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for implementing attribute inheritance, characterized in that The method includes: displaying an inheritance tree in a visual interaction page, the inheritance tree being generated based on definition information of a preset concept model, and nodes of the inheritance tree corresponding to elements; responding to an editing operation on a first target element in the inheritance tree, and adjusting attributes and / or inheritance relationships of the first target element, where the first target element is any element in the inheritance tree; updating records of the first target element and a second target element according to the adjusted attributes and / or inheritance relationships of the first target element, where the second target element is a child element of the first target element.

2. The method according to claim 1, wherein Responding to an editing operation on a first target element in the inheritance tree and adjusting the attributes and / or inheritance relationships of the first target element includes: when a click operation on the first target element in the inheritance tree triggered in the visual interaction page is detected, switching to an editing page, where the editing page at least displays: attributes and inheritance relationships of the first target element; responding to an editing operation triggered in the editing page and adjusting the attributes and / or inheritance relationships of the first target element.

3. The method according to claim 1 or 2, characterized in that, Updating records of the first target element and the second target element according to the adjusted attributes and / or inheritance relationships of the first target element includes: updating the record of the first target element according to the adjusted attributes and / or inheritance relationships of the first target element; using the updated record of the first target element to update the record of the second target element.

4. The method according to claim 3, characterized in that, Records of the first target element and the second target element at least include: total inheritance path number and actual inheritance path number; Using the updated record of the first target element to update the record of the second target element includes: using the updated record of the first target element to calculate the change number of the total inheritance path number and the change number of the actual inheritance path number of the first target element, and calculating the total inheritance path number and the actual inheritance path number from the first target element to the second target element; using the change number of the total inheritance path number of the first target element and the total inheritance path number from the first target element to the second target element to update the total inheritance path number in the record of the second target element; using the change number of the actual inheritance path number of the first target element and the actual inheritance path number from the first target element to the second target element to update the actual inheritance path number in the record of the second target element.

5. The method according to claim 4, characterized in that After updating the record of the first target element, it further includes: if the total inheritance path number in any record of the updated first target element is 0, deleting the record of the first target element with the total inheritance path number of 0.

6. The method according to claim 4, wherein After updating the total inheritance path number in the record of the second target element, it further includes: if the total inheritance path number in any record of the updated second target is 0, deleting the record of the second target element with the total inheritance path number of 0.

7. A system for implementing attribute inheritance, characterized in that, The system includes: a display unit, configured to display an inheritance tree in a visual interaction page, the inheritance tree being generated based on definition information of a preset concept model, and nodes of the inheritance tree corresponding to elements; An adjustment unit, configured to adjust the attributes and / or inheritance relationships of a first target element in response to an editing operation on the first target element in the inheritance tree, where the first target element is any element in the inheritance tree; An update unit, configured to update the records of the first target element and a second target element according to the adjusted attributes and / or inheritance relationships of the first target element, where the second target element is a child element of the first target element.

8. The system according to claim 7, wherein The adjustment unit includes: A switching subunit, configured to switch to an editing page when a click operation on the first target element in the inheritance tree triggered in the visual interaction page is detected, where the editing page at least displays: the attributes and inheritance relationships of the first target element; An adjustment subunit, configured to adjust the attributes and / or inheritance relationships of the first target element in response to an editing operation triggered in the editing page.

9. An electronic device, characterized in that, It includes: A processor and a memory, where the processor and the memory are connected through a communication bus; wherein, the processor is configured to call and execute a program stored in the memory; The memory is configured to store a program, and the program is used to implement the method for implementing attribute inheritance as described in any one of claims 1-6.

10. A computer-readable storage medium, characterized in that, A computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the method for implementing attribute inheritance as described in any one of claims 1-6 is implemented.