CIM-oriented graph database construction method, system and equipment and storage medium
The Neo4j engine converts CIM model files into graph data structures, solving the complex relationship between classes, classes and attributes in the CIM model, and implementing automated graph database construction and standardized data structures, which facilitates data processing and application.
Patent Information
- Application Number
- CN202510290542.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-12
- Publication Date
- 2025-07-22
AI Technical Summary
In the CIM model, the relationship between classes and classes and attributes is complex, and manual processing is huge and conversion errors are prone to occur.
Using the Neo4j engine, the data of the CIM model file is structured into a graph database at a hierarchy, and the graph data structure is automatically constructed through the program to avoid manual processing.
It realizes automatic construction of graph database, reduces manual processing time and errors, ensures standardized data structures, and facilitates subsequent data processing and application modeling.
Smart Images

Figure CN120353970A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of circuit devices for power supply or distribution, and particularly relates to a method, system, device, and storage medium for constructing a graph database for CIM. Background Art
[0002] The distribution network has the most imagination space in brewing new business models due to its proximity to the market and wide coverage. As a very crucial part of the power system, the distribution network shoulders the heavy burden of power distribution, power transmission, and serving various users. Its management work and production operations are quite complex, involving multiple links such as development planning, dispatching operation, operation and maintenance, and marketing services. There are many management entities and levels, and the information is relatively scattered. With the large emergence of actively controllable resources such as distributed power sources, electric vehicles, and various forms of demand-side load responses, traditional passive distribution companies that only need to meet rigid loads are becoming active distribution companies that must actively manage and optimize the control of a large number of actively controllable resources. Distribution companies must assume the responsibility of comprehensively monitoring, managing, and optimizing the control of all controllable resources within the region to achieve comprehensive services for all energy resources within the region. The basis of distribution network operation analysis is the data problem. Distribution network data has characteristics such as complex interrelationships, fast generation speed, rapid growth rate, and diverse types. Distribution network business applications require real-time and efficient data service support.
[0003] CIM contains numerous classes and attributes, and the association relationships between classes and between classes and attributes are complex. The manual processing workload is extremely large, and conversion errors are prone to occur. Summary of the Invention
[0004] In order to solve the technical problems in the prior art that CIM contains numerous classes and attributes, and the association relationships between classes and between classes and attributes are complex, the manual processing workload is extremely large, and conversion errors are prone to occur, the present invention provides a method for constructing a graph database for CIM, including:
[0005] Using the Ne04j engine, creating the CIM model file corresponding to the distribution network project as the root node of the CIM graph database;
[0006] Based on the levels to which the data in the CIM model file belongs and the relationships between the levels, constructing each subordinate node of the root node;
[0007] Based on the root node and all subordinate nodes, constructing a Ne04j graph database;
[0008] Wherein, the data in the CIM model file is divided into multiple levels according to all the components of the distribution network project.
[0009] Preferably, the hierarchy from top to bottom includes: all components of the distribution network project, several parameters of each component, and the value range of each parameter.
[0010] Preferably, the data of the CIM model file includes tabular data with multiple rows and multiple columns;
[0011] The rows of the CIM model file include: the name of the distribution network project, all components involved in the distribution network project, and several parameters of each component;
[0012] The columns of the CIM model file include one or more of the following: package name, class name, data type, attribute name, attribute type, minimum number of attributes, maximum number of attributes, value, and annotation;
[0013] Among them, the package name corresponds to the name of the distribution network project; the class name corresponds to the component name; the data type is the base class or data type created for the component; the attribute name corresponds to the parameter; the attribute type corresponds to the parameter type.
[0014] Preferably, the root node and each subordinate node both include: a label and a key-value pair mapping pro; the key-value pair mapping pro includes the following three key-value pairs: name, type, and information note.
[0015] Preferably, using the Ne04j engine to create the root node of the CIM graph database for the obtained CIM model file corresponding to the distribution network project includes:
[0016] Obtain the label pre-constructed for the distribution network project and the information model type determined for the distribution network project;
[0017] Using the Ne04j engine to create a root node with the label as the name, the package as the type, and the information model type as the information note.
[0018] Preferably, constructing each subordinate node of the root node based on the hierarchy of each data in the CIM model file and the relationship between hierarchies includes:
[0019] Obtain the class corresponding to each component and the attribute corresponding to the parameter of each component in the CIM model file corresponding to the distribution network project;
[0020] Taking the class as a subordinate node of the package, determine the association relationship between the package and the class;
[0021] Taking the attribute as a subordinate node of the corresponding class, determine the relationship between each attribute and the class;
[0022] Based on the package, class, attribute, and the association relationship between the package and the class, and the relationship between the attribute and the class, construct subordinate nodes in sequence.
[0023] Preferably, the determination of the association relationship between packages and classes includes:
[0024] Traverse the CIM model file based on the Cypher statement of Ne04j, select all classes under the package, and establish an inclusion relationship between the package and the classes;
[0025] And use the class name, data type, and annotation corresponding to each class as the key-value pair mapping pro of the corresponding node of each class.
[0026] Preferably, the determination of the relationship between each attribute and the class includes:
[0027] Traverse the CIM model file based on the Cypher statement of Ne04j, select all attributes under the class, and establish an inclusion relationship between the attribute and the class;
[0028] And use the attribute name, attribute type, and annotation corresponding to each class as the key-value pair mapping pro of the corresponding node of each attribute.
[0029] Based on the same inventive concept, the present invention also provides a CIM-oriented graph database construction system, including: a CIM model file and a Neo4j engine;
[0030] The Neo4j engine is used to: create the obtained CIM model file corresponding to the distribution network project as the root node of the CIM graph database; construct each subordinate node of the root node based on the hierarchy of each data in the CIM model file and the relationship between hierarchies; construct the Ne04j graph database based on the root node and all subordinate nodes;
[0031] The data of the CIM model file is divided into multiple levels according to all components of the distribution network project.
[0032] Preferably, the data of the CIM model file includes tabular data with multiple rows and multiple columns;
[0033] The rows of the CIM model file include: the name of the distribution network project, all components involved in the distribution network project, and several parameters of each component;
[0034] The columns of the CIM model file include one or more of the following: package name, class name, data type, attribute name, attribute type, minimum number of attributes, maximum number of attributes, value, and annotation;
[0035] Among them, the package name corresponds to the name of the distribution network project; the class name corresponds to the component name; the data type is the base class or data type created for the component; the attribute name corresponds to the parameter; the attribute type corresponds to the parameter type.
[0036] Based on the same inventive concept, the present invention also provides a computer device, including: one or more processors;
[0037] The processor is used to store one or more programs;
[0038] When the one or more programs are executed by the one or more processors, a method for constructing a CIM-oriented graph database provided by the present invention is implemented.
[0039] Based on the same inventive concept, the present invention also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed, a method for constructing a CIM-oriented graph database provided by the present invention is implemented.
[0040] Compared with the prior art, the beneficial effects of the present invention are:
[0041] The present invention provides a method and system for constructing a CIM-oriented graph database, including: using the Ne04j engine to create the root node of the CIM graph database from the obtained CIM model file corresponding to the distribution network project; using the data in the CIM model file as the subordinate nodes, and constructing the Ne04j graph database according to the levels to which the data belongs and the relationships between the levels; wherein, the data in the CIM model file is divided into multiple levels according to all the components of the distribution network project; by using the Ne04j engine to convert CIM into a graph data structure, the present invention avoids the problems of extremely large manual processing workload, long time consumption and easy occurrence of conversion errors.
[0042] In the technical means provided by the present invention, the graph data can be directly constructed by the program by modifying the content of the CIM model file corresponding to the distribution network project without changing the structure, which is easy for data modeling. The graph database structure automatically generated by the program has a standardized format, which is convenient for data processing and subsequent program processing and application modeling. Description of the Drawings
[0043] Figure 1 It is a flowchart of a method for constructing a CIM-oriented graph database of the present invention;
[0044] Figure 2 It is a construction flowchart of Embodiment 2;
[0045] Figure 3 It is a block diagram of a system for constructing a CIM-oriented graph database of the present invention. Detailed Embodiments
[0046] The object of the present invention is to design a method and system for automatically constructing graph data for CIM, build a Neo4j graph database based on CIM, and further provide high-quality data services for distribution network business applications. To achieve the above object, the present invention provides the following technical solutions:
[0047] Embodiment 1:
[0048] As Figure 1 shown, the present invention provides a method for constructing a graph database for CIM, including:
[0049] S1. Using the Ne04j engine, create the CIM model file corresponding to the distribution network project as the root node of the CIM graph database;
[0050] S2. Based on the levels to which the data in the CIM model file belong and the relationships between the levels, construct each subordinate node of the root node;
[0051] S3. Based on the root node and all subordinate nodes, construct a Ne04j graph database;
[0052] Among them, the data in the CIM model file are divided into multiple levels according to all the components of the distribution network project. The levels in the present invention include, from top to bottom in sequence: all the components of the distribution network project, several parameters of each component, and the value range of each parameter.
[0053] The data in the CIM model file of the present invention include tabular data with multiple rows and multiple columns;
[0054] Rows include: distribution network project name, all components involved in the distribution network project, and several parameters of each component;
[0055] Columns include: package name, class name, data type, attribute name, attribute type, minimum number of attributes, maximum number of attributes, value, annotation, etc.;
[0056] Among them, the package name corresponds to the distribution network project name; the class name corresponds to the component name; the data type is the base class or data type created for the component; the attribute name corresponds to the parameter; the attribute type corresponds to the parameter type.
[0057] Here, the package name, class name, base class, and attribute name are in a tree structure from root to leaf; if the cells of the package name, class name, and base class are empty, the structure of the previous row continues to be effective.
[0058] Both the root node and each subordinate node in the present invention include: a label and a key-value pair mapping pro; the key-value pair mapping pro includes the following three key-value pairs: name, type, and information note.
[0059] In step S1, using the Neo4j engine, the obtained CIM model file corresponding to the distribution network project is created as the root node of the CIM graph database, including:
[0060] Obtain the tags pre-constructed for the distribution network project and the information model type determined for the distribution network project;
[0061] Using the Neo4j engine, create a root node with the tag as the name, the package as the type, and the information model type as the information annotation.
[0062] Exemplarily, for the CIM-oriented graph database construction method of the present invention, its program is based on the Java language and uses the Eclipse development environment and the Maven package management tool:
[0063] Initialize the Neo4j construction engine with the address uri of Neo4j (such as the default value bolt: / / localhost:7687), the username user (such as the default value neo4j), and the password password (such as the default value neo4j). The operation guide of Neo4j can refer to its official documentation and will not be elaborated here. Input the location of the CIM model file and initialize the xls file reader based on the Neo4j construction engine. Start the graph database in the cmd command line.
[0064] In this embodiment, use "CIM" as the tag pre-constructed for the distribution network project and "Common Information Model" as the information model type determined for the distribution network project;
[0065] Using the Neo4j engine, create a CIM root node: establish a key-value pair mapping pro and add three groups of key-value pairs <name, "CIM">, <type, "package">, and <annotation, "Common Information Model"> to it; create a root node with the tag nd = "CIM" and pro as parameters.
[0066] Use the file reader to read the CIM file and process its data in combination with the Neo4j construction engine.
[0067] In step S2, construct each subordinate node of the root node based on the hierarchy to which each data in the CIM model file belongs and the relationship between hierarchies, including:
[0068] Obtain the classes corresponding to each component and the attributes corresponding to the parameters of each component in the CIM model file corresponding to the distribution network project;
[0069] Regarding the class as a subordinate node of the package, determine the association relationship between the package and the class;
[0070] Regarding the attribute as a subordinate node of the corresponding class, determine the relationship between each attribute and the class;
[0071] Construct lower-level nodes in sequence based on packages, classes, attributes, the association relationships between packages and classes, and the relationships between attributes and classes.
[0072] The specific implementation process of step S2 includes:
[0073] In step S2-1, taking the distribution network project as a package, creating a CIM graph database for each package, and using the package as the root node to create a CIM graph database;
[0074] In step S2-2, taking the components in the distribution network project as classes and the parameters of each component as attributes;
[0075] In step S2-3, taking classes as lower-level nodes of packages and determining the association relationships between packages and classes;
[0076] Specifically, traversing the CIM model file based on the Cypher statement of Ne04j, selecting all classes under the package, and establishing an inclusion relationship between the package and the classes;
[0077] And taking the class name, data type, and annotation corresponding to each class as the key-value pair mapping pro of the corresponding node of each class.
[0078] In step S2-4, taking attributes as lower-level nodes of the corresponding classes and determining the relationships between each attribute and the class;
[0079] Traversing the CIM model file based on the Cypher statement of Ne04j, selecting all attributes under the class, and establishing an inclusion relationship between the attribute and the class;
[0080] And taking the attribute name, attribute type, and annotation corresponding to each class as the key-value pair mapping pro of the corresponding node of each attribute.
[0081] In step S2-5, constructing a Ne04j graph database based on packages, classes, attributes, the association relationships between packages and classes, and the relationships between attributes and classes.
[0082] In this application, labels and key-value pair mapping pro; the key-value pair mapping pro includes the following three key-value pairs: name, type, and information note.
[0083] Embodiment 2
[0084] As Figure 2 shown, this embodiment specifically introduces a method for constructing a CIM-oriented graph database of this application with a specific example:
[0085] First, perform the initialization process:
[0086] The first step, preprocessing: Import the neo4j, neo4j-bolt, and neo4j-java-driver packages.
[0087] Step 2: Declare and initialize the global variable to drive org.neo4j.driver.Driver driver = GraphDatabase.driver(uri, AuthTokens.basic(user, password)), and initialize the session org.neo4j.driver.Session session = driver.session().
[0088] Then, use a file reader to read the CIM file corresponding to the distribution network project, and based on this CIM file, use the Ne04j engine to build a Ne04j graph database, as follows:
[0089] U1: Initialize the file input stream with the CIM file location as a parameter and assign it to the file stream is;
[0090] U2: Use the poi package to process the xls file: Initialize the POIFS file system fs with is;
[0091] U3: Initialize the HSSF workbook set wb with fs as a parameter, and obtain the CIM data workbook in it, denoted as the HSSF sheet s;
[0092] U4: For the HSSF sheet s, create CIM graph database nodes based on the Neo4j construction engine;
[0093] U5: For the HSSF sheet s, create CIM graph database relationships based on the Neo4j construction engine;
[0094] U6: After the traversal, close the HSSF workbook wb and the file stream is.
[0095] The method for creating CIM graph database nodes specifically includes the following steps:
[0096] N1: Create a CIM root node: Establish a key-value pair mapping pro, and add three groups of key-value pairs <name, "CIM">, <type, "package">, <annotation (information), "Common Information Model"> to it; Use the label nd = "CIM" and pro as parameters to add a graph database node through the Neo4j construction engine;
[0097] N2: Create graph data nodes for packages;
[0098] N3: Create graph data nodes for classes.
[0099] The method for creating CIM graph database relationships specifically includes the following steps:
[0100] B1: Create the association relationship between packages and classes.
[0101] B2: Create the association relationship between classes and attributes.
[0102] The method for adding graph database nodes through the Neo4j construction engine specifically includes the following process: First, traverse the pro key-value pairs to create an attribute string ps in the form of {key1: "value1", key2: "value2",...}; then, construct a Cypher statement cs in string form in the form of MERGE(a:ndps); execute the operation of adding graph database nodes: session.run(cs).
[0103] The method for creating graph data nodes of packages specifically includes the following steps:
[0104] H1: Traverse the rows of the HSSF sheet s, obtain the cell value of the package column, which is the package name pn. If pn is not empty, then obtain the cell value of the annotation column, ann;
[0105] H2: Then establish a key-value pair mapping pro and add three groups of key-value pairs <name, pn>, <type, "package">, <annotation, ann> to it; use the label nd = pn and pro as parameters to add graph database nodes through the Neo4j construction engine.
[0106] The method for creating graph data nodes of classes specifically includes the following steps:
[0107] Y1: Traverse the rows of the HSSF sheet s, obtain the cell value of the class column, which is the class cn. If cn is not empty, then obtain the cell value of the annotation column, ann;
[0108] Y2: Establish a key-value pair mapping pro and add three groups of key-value pairs <name, cn>, <type, "class">, <annotation, ann> to it; use nd = cn and pro as parameters to add graph database nodes through the Neo4j construction engine.
[0109] The method for creating the association relationship between packages and classes specifically includes the following steps:
[0110] Q1: Create the package name pn and initialize it to be empty;
[0111] Q2: Traverse the rows of the HSSF sheet s, obtain the cell value of the package column and update pn; if pn is not empty, then obtain the cell value of the class column, which is the class cn;
[0112] Q3: Execute the Cypher statement through a session. Its form is: match(a:pn{type: "package"}) match(b:cn{type: "class"}) merge(a)-[rel:CONTAIN]->b.
[0113] The method for creating the association relationship between a class and a property specifically includes the following steps:
[0114] P1: Create the class name cn and initialize it to be empty, and create the property quantity num and initialize it to 0;
[0115] P2: Traverse the rows of the HSSF sheet s. The current row is denoted as r; obtain the cell value in the column of the r class and update cn.
[0116] P3: If cn is not empty and num = 0 is updated, then: First, obtain the cell value bn in the column of the r base class. If bn is not empty, execute the Cypher statement through the session. Its form is: match(a:cn{type: "class"}) match(b:bn{type: "class"}) merge(a)-[rel:EXTENDS]->b; Then, obtain the cell value en in the column of the r value. If en is not empty, obtain the cell value ann in its comment column. Execute the Cypher statement through the session. Its form is: match(a:cn{type: "class"}) set a.valuenum = ["en", "ann"], and then num is incremented by 1; Finally, process the regular properties through the Neo4j construction engine, and its parameters are the row r and the class name cn in sequence.
[0117] The method for processing regular properties through the Neo4j construction engine specifically includes the following steps:
[0118] E1: Obtain the cell value prop in the property column of the row r; if prop is not empty, then obtain the cell value pt in the property type column of r, the cell value pmin in the minimum property quantity column, the cell value pmax in the maximum property quantity column, and the cell value ann in the comment column.
[0119] E2: Determine whether pt is a basic data type (i.e., Boolean, Date, DateTime, Decimal, Duration, Float, Integer, MonthDay, String, or Time). If so, execute the Cypher statement match(a:cn{type: "class"}) set a.prop = ["pt", "ann"] through the session to add the property. Otherwise, go to step (3).
[0120] E3: If pmin is 0 and pmax is 1, execute the Cypher statement "match(a:cn{type:\"class\"}) match(b:pt{type:\"class\"}) merge(a)-[rr:pHasA{name:\"prop\",annotation:\"ann\"}]->(b);" through the session; if pmin is 0 and pmax is unbounded, execute the Cypher statement "match(a:cn{type:\"class\"}) match(b:pt{type:\"class\"}) merge(a)-[rr:pHas{name:\"prop\",annotation:\"ann\"}]->(b);" through the session; if pmin is 1 and pmax is 1, execute the Cypher statement "match(a:cn{type:\"class\"}) match(b:pt{type:\"class\"}) merge(a)-[rr:HasA{name:\"prop\",annotation:\"ann\"}]->(b);" through the session; if pmin is 1 and pmax is unbounded, execute the Cypher statement "match(a:cn{type:\"class\"}) match(b:pt{type:\"class\"}) merge(a)-[rr:Has{name:\"prop\",annotation:\"ann\"}]->(b);" through the session.
[0121] Finally, use the access address provided by the present invention, input the access in a browser (it is recommended to use Google Chrome), and combine with the Cypher query language to view and manage the CIM-oriented graph database.
[0122] Embodiment 3:
[0123] Based on the same inventive concept, the present application also provides a CIM-oriented graph database construction system, as Figure 3 shown, including: a CIM model file and a Neo4j engine;
[0124] The Neo4j engine is used to: create the CIM model file corresponding to the distribution network project as the root node of the CIM graph database; construct each subordinate node of the root node based on the levels to which the data in the CIM model file belongs and the relationships between the levels; construct the Neo4j graph database based on the root node and all subordinate nodes;
[0125] The data in the CIM model file is divided into multiple levels according to all the components of the distribution network project.
[0126] The data of the CIM model file includes tabular data with multiple rows and columns;
[0127] The rows of the CIM model file include: the name of the distribution network project, all components involved in the distribution network project, and several parameters of each component;
[0128] The columns of the CIM model file include one or more of the following: package name, class name, data type, attribute name, attribute type, minimum number of attributes, maximum number of attributes, value, and comment;
[0129] Among them, the package name corresponds to the name of the distribution network project; the class name corresponds to the component name; the data type is the base class or data type created for the component; the attribute name corresponds to the parameter; the attribute type corresponds to the parameter type.
[0130] The system provided in this embodiment is used to implement a method for constructing a graph database oriented to CIM in the above embodiment. For its functions, please refer to the above embodiment and will not be elaborated here.
[0131] Embodiment 4
[0132] Based on the same inventive concept, the present invention also provides a computer device, which includes a processor and a memory. The memory is used to store a computer program, the computer program includes program instructions, and the processor is used to execute the program instructions stored in the computer storage medium. The processor may be a Central Processing Unit (CPU), or may also be other general-purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field-Programmable Gate Arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. It is the computing core and control core of the terminal, and is suitable for implementing one or more instructions. Specifically, it is suitable for loading and executing one or more instructions in the computer storage medium to implement the corresponding method flow or corresponding function, so as to implement the steps of a method for constructing a graph database oriented to CIM in the above embodiment.
[0133] Embodiment 5
[0134] Based on the same inventive concept, the present invention also provides a storage medium, specifically a computer-readable storage medium (Memory). The computer-readable storage medium is a memory device in a computer device and is used to store programs and data. It can be understood that the computer-readable storage medium here can include both the built-in storage medium in the computer device and, of course, the extended storage medium supported by the computer device. The computer-readable storage medium provides a storage space, and the operating system of the terminal is stored in this storage space. Moreover, one or more instructions suitable for being loaded and executed by the processor are stored in this storage space, and these instructions can be one or more computer programs (including program codes). It should be noted that the computer-readable storage medium here can be a high-speed RAM memory or a non-volatile memory, such as at least one disk memory. One or more instructions stored in the computer-readable storage medium can be loaded and executed by the processor to implement the steps of a method for constructing a graph database for CIM in the above-mentioned embodiments.
[0135] Those skilled in the art should understand that the embodiments of the present invention can be provided as a method, a system, or a computer program product. Therefore, the present invention can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present invention can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk memories, CD-ROMs, optical memories, etc.) containing computer-usable program codes.
[0136] The present invention is described with reference to the flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each flow and / or block in the flowchart and / or block diagram can be implemented by computer program instructions, and the combination of the flows and / or blocks in the flowchart and / or block diagram can also be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing devices generate a device for implementing the functions specified in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.
[0137] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory generate a manufactured product including an instruction device, and the instruction device implements the functions in Figure 1 one flow or multiple flows and / or blocksFigure 1 The functions specified in one or more boxes.
[0138] These computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operation steps are executed on the computer or other programmable device to generate a computer-implemented process. Thus, the instructions executed on the computer or other programmable device provide for implementing the steps of the functions specified in Figure 1 one process or more processes and / or boxes Figure 1 the steps of the functions specified in one box or more boxes.
[0139] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit the scope of its protection. Although the present invention has been described in detail with reference to the above embodiments, those of ordinary skill in the art should understand that;
[0140] After reading the present invention, those skilled in the art can still make various changes, modifications or equivalent replacements to the specific implementation manners of the invention. However, these changes, modifications or equivalent replacements are all within the scope of protection of the pending claims of the invention.
Claims
1. A method for constructing a graph database for CIM, characterized in that, Including: Using the Ne04j engine, creating the obtained CIM model file corresponding to the distribution network project as the root node of the CIM graph database; Based on the levels to which the data in the CIM model file belong and the relationships between the levels, constructing each subordinate node of the root node; Based on the root node and all subordinate nodes, constructing the Ne04j graph database; Among them, the data in the CIM model file are divided into multiple levels according to all the components of the distribution network project.
2. The method according to claim 1, characterized in that The levels include, from top to bottom in turn: all the components of the distribution network project, several parameters of each component, and the value range of each parameter.
3. The method according to claim 2, characterized in that, The data in the CIM model file include tabular data with multiple rows and multiple columns; The rows of the CIM model file include: the name of the distribution network project, all the components involved in the distribution network project, and several parameters of each component; The columns of the CIM model file include one or more of the following: package name, class name, data type, attribute name, attribute type, minimum number of attributes, maximum number of attributes, value, and comment; Among them, the package name corresponds to the name of the distribution network project; the class name corresponds to the component name; the data type is the base class or data type created for the component; the attribute name corresponds to the parameter; the attribute type corresponds to the parameter type.
4. The method according to claim 3, wherein Both the root node and each subordinate node include: a label and a key-value pair mapping pro; the key-value pair mapping pro includes the following three key-value pairs: name, type, and information note.
5. The method according to claim 4, wherein The step of using the Ne04j engine to create the obtained CIM model file corresponding to the distribution network project as the root node of the CIM graph database includes: Obtaining the label pre-constructed for the distribution network project and the information model type determined for the distribution network project; Using the Ne04j engine to create a root node with the label as the name, the package as the type, and the information model type as the information note.
6. The method according to claim 4, wherein The step of constructing each subordinate node of the root node based on the levels to which the data in the CIM model file belong and the relationships between the levels includes: Obtaining the classes corresponding to each component and the attributes corresponding to the parameters of each component in the CIM model file corresponding to the distribution network project; Taking the class as a subordinate node of the package and determining the association relationship between the package and the class; Taking the attribute as a subordinate node of the corresponding class and determining the relationship between each attribute and the class; Based on the package, class, attribute, and the association relationship between the package and the class, and the relationship between the attribute and the class, constructing subordinate nodes in sequence.
7. The method according to claim 6, characterized in that The step of determining the association relationship between the package and the class includes: Traversing the CIM model file based on the Cypher statement of Ne04j, selecting all the classes under the package, and establishing an inclusion relationship between the package and the class; And taking the class name, data type, and comment corresponding to each class as the key-value pair mapping pro of the corresponding node of each class.
8. The method according to claim 6, wherein The step of determining the relationship between each attribute and the class includes: Traversing the CIM model file based on the Cypher statement of Ne04j, selecting all the attributes under the class, and establishing an inclusion relationship between the attribute and the class; And taking the attribute name, attribute type, and comment corresponding to each class as the key-value pair mapping pro of the corresponding node of each attribute.
9. A graph database construction system for CIM, characterized in that Including: CIM model file and Neo4j engine; The Neo4j engine is used to: create the obtained CIM model file corresponding to the distribution network project as the root node of the CIM graph database; construct each subordinate node of the root node based on the levels to which the data in the CIM model file belong and the relationships between the levels; construct the Ne04j graph database based on the root node and all subordinate nodes; The data in the CIM model file is divided into multiple levels according to all the components of the distribution network project.
10. The system according to claim 9, characterized in that, The data in the CIM model file includes tabular data with multiple rows and columns; The rows of the CIM model file include: the name of the distribution network project, all the components involved in the distribution network project, and several parameters of each component; The columns of the CIM model file include one or more of the following: package name, class name, data type, attribute name, attribute type, minimum number of attributes, maximum number of attributes, value, and comment; Among them, the package name corresponds to the name of the distribution network project; the class name corresponds to the component name; the data type is the base class or data type created for the component; the attribute name corresponds to the parameter; the attribute type corresponds to the parameter type.
11. A computer device, characterized in that, It includes: one or more processors; The processor is used to store one or more programs; When the one or more programs are executed by the one or more processors, the CIM-oriented graph database construction method described in any one of claims 1 to 8 is implemented.
12. A computer-readable storage medium, characterized in that, A computer program is stored thereon, and when the computer program is executed, the CIM-oriented graph database construction method described in any one of claims 1 to 8 is implemented.