Device data management method and system
By calling the standard database to parse the device data source and combining the device data tree and prototype mode, it solves the problems of complexity of device management and heavy workload of repetitive work in the existing technology, realizes flexible access and efficient maintenance of device data, and improves the efficiency of the device. Management efficiency and visualization.
Patent Information
- Application Number
- CN202011640499.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-31
- Publication Date
- 2024-09-13
- Estimated Expiration
- 2040-12-31
AI Technical Summary
Existing device management technology has problems such as heavy workload duplication and complex metadata maintenance when faced with multiple device types. Especially when there are many and increasing device types, it is difficult to efficiently access and maintain device data. .
By calling a standard database that is updated in real time, it performs data analysis on device data sources in different formats, generates metadata of devices to be accessed, and combines the device data tree and prototype mode to achieve flexible access and maintenance of device data and reduce repetitive workload.
It achieves flexible access and efficient maintenance of multiple device types, reduces user operations, improves data processing efficiency and visualization effects, and reduces the workload of device management.
Smart Images

Figure CN112800119B
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of Internet of Things, and in particular relates to a device data management method and system. Background Art
[0002] With the development of the Internet, computers, and the Internet of Things, device management has become the foundation and an important module of the system. With the rapid growth of device types and numbers, the cost of the system itself and manual operation is getting higher and higher. There are currently two main technical solutions for device management:
[0003] One is to define each type of device separately, including the name, basic description, and the attributes it contains. When storing, each device uses an independent data table, and daily business logic such as addition, deletion, modification, and query are implemented separately. Under this solution, when adding a certain type of device entity, fill in the required information of this type of device on the add page of this type of device; when adding a type of device, it is necessary to redefine the data table and operation of the device. The advantage of this solution is that the business between different types of devices is isolated (no mutual contamination), and the business can be customized for a certain type of device. The disadvantage is that there is a lot of duplication of work in implementation and use, especially when there are many types of devices.
[0004] The second is to define general equipment and use the union of the attributes of all equipment as the columns of the database table. The business code knows which attributes a certain type of equipment uses. One option for the business code is to store the correspondence between the attributes and columns of each device as the original data elsewhere. Under this solution, the basic addition, deletion, modification and query of equipment are all completed in one table, and with the assistance of sufficiently rich metadata, it can even be completed by a set of business codes; when adding a type of equipment, it may be necessary to adjust the table structure (add columns) and add metadata. The advantage of this solution is better code reuse, and the disadvantage is that metadata maintenance is complicated, and there is still a lot of repetitive work when adding equipment. Summary of the invention
[0005] The purpose of the present invention is to provide a device data management method and system, which can flexibly access a wide variety of devices by calling a real-time updated standard database to parse data sources of different formats; by creating a device data tree and combining the prototype model to manage device entities, the workload of device data access and device data maintenance is greatly reduced.
[0006] The technical solution provided by the present invention to solve the technical problem is as follows:
[0007] The present invention provides a device data management method, which specifically includes:
[0008] First, the device data source of the device data access request is obtained, and the pre-created device standard database is called to perform data analysis on the device data source to generate metadata of the device to be accessed.
[0009] The equipment standard database includes a list of equipment components and a list of component standard attributes. The equipment standard database can realize the rapid extraction and reuse of standard data to improve the efficiency of data processing.
[0010] Among them, calling the equipment standard database and parsing the equipment data source to generate the metadata of the equipment to be connected specifically includes: calling the parsing function according to the format of the equipment data source; the parsing function reads the data content of the equipment data source, matches the equipment standard database, and parses to obtain the metadata of the equipment to be connected, including equipment component information, equipment standard attribute data table and equipment custom attribute data table. Metadata is the extraction and standardized management of external data, which can ensure data quality and support changes in system requirements.
[0011] Furthermore, the metadata of the device to be connected is matched with the pre-created device data tree, and the matching elements in the located device data tree are set as the prototype elements of the device to be connected. Specifically, it includes: extracting the device component information of the metadata of the device to be connected, traversing the first-level child node names of the root node of the device data tree, and setting the matching child nodes as device component elements; extracting the device standard attribute data table of the metadata of the device to be connected, traversing the child nodes of the device component elements, and setting the child nodes that match the attributes and values in the device standard data table as device prototype elements. The tree-shaped data structure is convenient for retrieval, storage and reading, and has high efficiency, and has good visualization effect for multi-dimensional data display.
[0012] The device data tree can be automatically created, and the steps of automatically creating the device data tree include: after receiving the first device data access request and parsing the data to generate the metadata of the device to be accessed, establishing the root node of the device data tree, extracting the device component information in the metadata of the device to be accessed as the name of the root node; deep cloning the root node to create a child node, that is, completing the creation of the initial device data tree. Automatically creating the device data tree for device access is efficient and simple to operate.
[0013] The device data tree can also be created manually. Manually creating a device data tree includes: after receiving the first device data access request and performing data parsing to generate device metadata, sending the creation device directory name information; receiving the device directory name information, creating a root node, setting the device directory name information as the root node name; creating a child node of the root node, obtaining the device component information in the metadata of the device to be accessed and setting it as the child node name, and completing the creation of the initial device data tree. Manually creating a device tree for device access can better standardize and display the device directory.
[0014] Furthermore, the prototype element of the device to be connected is deeply cloned to create a device entity element, a child node is created for the device entity element and set as the device entity child element, and the metadata of the device to be connected is extracted to fill the device entity child element. Specifically, it includes: deeply cloning a brother node for the prototype element node of the device to be connected and setting it as the device entity element, and cloning all the attributes and values of the device prototype element node to the device entity element; creating a child node for the device entity element node and setting it as the device entity child element, extracting the attributes and values of the device custom attribute data table in the metadata of the device to be connected and filling them into the device entity child element. When using the prototype mode to clone objects, there are two ways: shallow cloning and deep cloning. Shallow cloning is to clone the referenced object without cloning the attributes contained in the object and other objects contained in the object. Deep cloning includes the referenced object, all attributes contained in the object and other objects contained in the object. The deep cloning technology can be reused with one click. At the same time, after the cloning is executed, the original object and the cloned object can be operated independently. After completing this step, the device data access success message is sent to realize the device data access.
[0015] Furthermore, the device data management method also includes a device data maintenance step, which specifically includes: obtaining the device data source of the device data update request for parsing, and modifying the corresponding information in the data structure tree according to the device update metadata content generated by the data analysis; obtaining the device data deletion request, deleting the device entity element of the requested device, and deleting the device entity sub-elements of the requested device at the same time.
[0016] Furthermore, when performing data parsing, if the information in the equipment standard database is not matched, the following steps are performed: if the equipment component name consistent with the equipment standard database is not matched, the first two attribute values in the data source are extracted and merged to generate the equipment component name of the equipment metadata, and the generated equipment component name is added to the equipment standard database; if the equipment standard attributes consistent with the equipment standard database are not matched, the first n attributes and values in the data source are extracted to generate an equipment standard attribute data table, and all attributes and values from the n+1th attribute onwards are extracted to generate an equipment custom attribute data table, and the attributes and values of the generated equipment standard data table are added to the equipment standard database; the value of n is an integer greater than 1 and can be set in advance.
[0017] The present invention also provides an equipment data management system, comprising:
[0018] A data access unit is used to receive a device data access request, obtain a device data source of the device data access request, call a pre-created device standard database, perform data analysis on the device data source to generate metadata of the device to be accessed;
[0019] The prototype positioning unit is used to match the metadata of the device to be connected with the pre-created device data tree, and set the matching element in the positioning device data tree as the prototype element of the device to be connected;
[0020] The entity generation unit deeply clones the prototype element of the device to be connected to create a device entity element, creates a child node for the device entity element and sets it as a device entity child element, extracts metadata of the device to be connected and fills the device entity child element;
[0021] The terminal is used to send data management requests, submit uplink data and receive downlink data. Specifically, the data management request includes a device data access request, a device data update request and a device data deletion request.
[0022] Furthermore, the equipment data management system also includes: a data maintenance module, which is used to obtain the equipment data source of the equipment data update request for analysis, and modify the corresponding information in the data structure tree according to the equipment update metadata content generated by the data analysis; and is also used to obtain the equipment data deletion request, delete the equipment entity element of the requested equipment, and delete the equipment entity sub-elements of the requested equipment at the same time.
[0023] The beneficial effects of the present invention include:
[0024] 1. The present invention provides a method for calling a real-time updated device standard database and a parsing function compatible with different data formats to parse the device data source to generate device metadata, which can flexibly and conveniently access different types of devices;
[0025] 2. The present invention provides a method for device data access and device maintenance by combining a device data tree and prototype elements. The method reduces user operations through data reuse, and can conveniently access device data and automatically update and maintain data, greatly reducing the workload of device management. At the same time, the device data tree can intuitively display the device status with good visualization effect. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] The present invention will be further described below in conjunction with the accompanying drawings.
[0027] Figure 1 It is a flow chart of the device data management method provided by an embodiment of the present invention.
[0028] Figure 2 It is a flow chart of the data analysis method provided by an embodiment of the present invention.
[0029] Figure 3 It is a flow chart of prototype elements of a positioning device provided by an embodiment of the present invention.
[0030] Figure 4 It is a single-layer traversal schematic diagram and a logic process diagram provided by an embodiment of the present invention.
[0031] Figure 5 This is a flow chart of automatically creating a device data tree provided by an embodiment of the present invention.
[0032] Figure 6 This is a flow chart of manually creating a device data tree provided by an embodiment of the present invention.
[0033] Figure 7 It is a flow chart for generating device entity elements and device entity sub-elements provided by an embodiment of the present invention.
[0034] Figure 8 It is a data table structure diagram for creating a device entity provided by an embodiment of the present invention.
[0035] Fig. 9 It is a data table relationship diagram for creating a device entity provided by an embodiment of the present invention.
[0036] Fig.10 It is a device information diagram for creating a device entity provided by an embodiment of the present invention.
[0037] Fig.11 It is a structural diagram of a device data management system provided by an embodiment of the present invention.
[0038] Fig.12 The device data management system structure provided by the embodiment of the present invention is Figure 2 . DETAILED DESCRIPTION
[0039] The technical solution of the present invention will be clearly and completely described below in conjunction with the accompanying drawings of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0040] The present invention provides a method for managing device data. Figure 1 The flow chart of the device data management method includes the following steps:
[0041] S1, obtaining the device data source of the device data access request, calling the pre-created device standard database, and performing data analysis on the device data source to generate metadata of the device to be accessed.
[0042] Specifically, the acquired device data source can be in multiple formats, including JSON format, XML format or other formats; the function called for data parsing includes a JSON parsing function corresponding to a JSON format data source, an XML parsing function corresponding to an XML format data source, or other parsing functions corresponding to data sources in other formats.
[0043] Specifically, in order to facilitate data reuse and flexible and convenient device data access and management, a device standard database is created in advance to standardize and define device component types, common properties and values of various devices, improve the efficiency of data reading and parsing, and quickly extract and reuse standard data to improve data processing efficiency.
[0044] S2, matching the metadata of the device to be connected with the pre-created device data tree, and locating the matching element in the device data tree and setting it as the prototype element of the device to be connected.
[0045] Specifically, the device data tree is a tree data structure that describes the device configuration. It is composed of a series of named nodes and attributes. There is only one root node named as the general directory name of the device management. The child nodes of the root node are device component elements, and the remaining leaf nodes are device entity elements. When accessing the device data source for device data management, the matched existing device component information is reused as the device component prototype, and the matched existing device entity elements are reused as the prototype of the device entity to be accessed, which reduces the device entry process and improves work efficiency.
[0046] S3, deeply clone the prototype element of the device to be connected to create a device entity element, create a child node for the device entity element and set it as the device entity sub-element, extract the metadata of the device to be connected to fill the device entity sub-element, that is, complete the device data access, and send a device data access success message at the same time.
[0047] Specifically, this embodiment adopts the prototype mode in the design mode to create repeated objects while ensuring performance. This type of design mode belongs to the creation mode, which provides an optimal way to create objects. This mode implements a prototype interface, which is used to create a clone of the current object. There are many types of device access and the creation workload is large, so this mode is particularly suitable.
[0048] Further, in step S1, the device standard database includes a list of device components and a list of component standard attributes. The device standard database is called to parse the device data source to generate metadata for the device to be connected. Please refer to Figure 2 , specifically including the following steps:
[0049] S11, calling a parsing function according to the format of the device data source;
[0050] Specifically, different parsing functions are called for data sources of different formats. Among them, JSON is a lightweight data storage format that is not constrained by language, and most programming languages can parse it. The JSON format is often used when communicating / interacting with data. When storing data, the JSON format is stored as a line of data. In order to facilitate reading, some methods are needed to format the JSON data. In various programming languages, there are some corresponding libraries to parse JSON data, such as cjson in C language, json.tool in Python, and jq on Linux platform. Taking jq as an example, jq is a tool for processing JSON data under the command line. It can accept JSON data in standard input, command pipeline or file, and form the required data structure after a series of filters and expression conversions and output the results to standard output.
[0051] Specifically, another common type is XML format data. XML is a universal data exchange format. Its platform independence, language independence, and system independence bring great convenience to data integration and interaction. The parsing method of XML is the same in different language environments, but the implementation syntax is different. There are four types of XML parsing methods: DOM parsing, SAX parsing, JDOM parsing, and DOM4J parsing. The DOM-based XML parser converts an XML document into a set of object models. The application operates on this object model to implement the operation of XML document data. Through the DOM interface, the application can access any part of the data in the XML document at any time. Therefore, this mechanism using the DOM interface is also called a random access mechanism. The access mode provided by the SAX-based XML parser is a sequential mode, which is a fast way to read and write XML data. When the SAX parser is used to analyze the XML document, a series of events will be triggered and the corresponding event processing functions will be activated. The application implements access to the XML document through these event processing functions, so the SAX interface is also called an event-driven interface. The JDOM-based XML parser is a set of components written in Java language for reading and writing XML. JDOM has both the advantages of DOM's ability to modify files and SAX's fast reading speed. Common JDOM operation classes include: Document is used to access the root element and the related information of the processing command file hierarchy, DOMBuilder is used to build a JDOM structure tree, Element is used to obtain the text content, attribute values and child nodes of the element, Attribute represents the various operations of the attributes in the XML file element, and XMLOutputter will format a JDOM structure tree into an XML file and output it in the form of an output stream. The XML parser based on DOM4J is an intelligent branch of JDOM. It incorporates many functions beyond the basic XML document representation, uses interfaces and abstract basic class methods, and has the characteristics of excellent performance, good flexibility, powerful functions and extreme ease of use.
[0052] S12, the parsing function reads the data content of the device data source, matches the device standard database, and parses to obtain metadata of the device to be connected, including device component information, device standard attribute data table, and device custom attribute data table.
[0053] Specifically, data comes from different sources, has different names, and uses different values, which is not conducive to direct use by the system. Using metadata to describe resources can do many things, such as identifying resources, providing retrieval points for resources, and exchanging data between different systems. Metadata is data about data, generally structured data (such as data stored in a database, which specifies the length and type of the field). Metadata is structured data extracted from information resources to describe their characteristics and content, and is used to organize, describe, retrieve, save, and manage information and knowledge resources. In this embodiment, the device metadata converted based on the data source is applied to the system, the data quality is good, and it is very fast and efficient to use.
[0054] For further information, please refer to Figure 3 , step S2 specifically includes the following steps:
[0055] S211, extracting device component information of the metadata of the device to be accessed, traversing the first-level child node names of the root node of the device data tree, and setting the matching child nodes as device component elements.
[0056] Specifically, the device tree structure in this embodiment is a multi-branch tree. The traversal of the multi-branch tree structure generally includes level-first traversal and depth-first traversal. In this embodiment, a modified level-first traversal is used for traversing the device component information, that is, a single-layer traversal, which only traverses the first-layer child node elements under the root node of the device data tree structure to achieve device component information matching. Please refer to Figure 4 , the single-layer traversal process is as follows:
[0057] Apply for a queue and add the root node A to the queue;
[0058] A
[0059] The head element is removed from the queue, A is output, and the next layer of the root node, i.e., the child nodes, are added to the queue;
[0060] B C D E F
[0061] The head element is removed from the queue and output B;
[0062] C D E F
[0063] The head element is removed from the queue and output C;
[0064] D E F
[0065] The head element is removed from the queue and output D;
[0066] E F
[0067] The head element is removed from the queue and output E;
[0068] F
[0069] The head element is removed from the queue and F is output. There are no other sibling nodes after F, and the queue is empty.
[0070]
[0071] The queue is empty and the single-layer traversal ends.
[0072] S212, extracting the device standard attribute data table of the device metadata to be accessed, traversing the child nodes of the device component element, and setting the child nodes that match the attributes and values in the device standard data table as the device prototype element.
[0073] Specifically, in this embodiment, the traversal of the device component element sub-nodes adopts a level-first traversal, and only all leaf nodes under the matched device component element are traversed.
[0074] Furthermore, the device data tree can be automatically created. Automatically creating a database is easy to operate. Please refer to Figure 5 , the steps to automatically create a device data tree include:
[0075] S221, after receiving the first device data access request and executing step S1, a root node of the device data tree is established, and device component information in the metadata of the device to be accessed is extracted as the name of the root node.
[0076] S222, deep cloning the root node to create a child node, that is, completing the creation of the initial device data tree.
[0077] Specifically, the child nodes of the created root node also clone the name of the root node, and the automatically created device data tree can authorize the role to modify the name of the root node and the child nodes.
[0078] Furthermore, the device data tree may be manually created. The manually created data tree has the characteristics of standardized directory names and conforming to business reality. The steps of manually creating the device data tree include:
[0079] S231, after receiving the first device data access request and executing step S1, send information on creating a device general directory name;
[0080] S232, receiving the device general directory name information, creating a root node, and setting the device general directory name information as the root node name;
[0081] S233, creating a child node of the root node, obtaining device component information in the metadata of the device to be connected and setting it as the child node name, thus completing the creation of the initial device data tree.
[0082] For further information, please refer to Figure 7 , step S3 specifically includes the following steps:
[0083] S31, deeply clone a brother node of the device prototype element node to be connected and set it as the device entity element, and clone all attributes and values of the device prototype element node to the device entity element;
[0084] S32, creating a child node for the device entity element node and setting it as a device entity child element, extracting attributes and values from the device custom attribute data table in the metadata of the device to be connected and filling them into the device entity child element.
[0085] Furthermore, the device data management method of this embodiment further includes the following steps:
[0086] S4, receiving a device data maintenance request, including:
[0087] Obtain the device data source of the device data update request for parsing, and modify the corresponding information in the data structure tree according to the device update metadata content generated by the data parsing;
[0088] Get device data deletion request, delete the device entity element of the requested device, and delete the device entity sub-elements of the requested device.
[0089] Furthermore, when performing the data analysis, if no information in the equipment standard database is matched, the following steps are performed:
[0090] S41, if the device component name consistent with the device standard database is not matched, extract the first two attribute values in the data source and merge them to generate the device component name of the device metadata, and at the same time add the generated device component name to the device standard database;
[0091] Specifically, the device component name generated by the attribute value of the extracted data source can be authorized to modify the generated device component name for the role, and the generated device component name is automatically added to the device standard database for updating while being modified.
[0092] S42, if the device standard attributes consistent with the device standard database are not matched, the first n attributes and values in the data source are extracted to generate a device standard attribute data table, and all attributes and values from the n+1th attribute onwards are extracted to generate a device custom attribute data table, and at the same time, the attributes and values of the generated device standard data table are added to the device standard database; the value of n is an integer greater than 1 and can be set in advance.
[0093] Specifically, the value of n may be set to 2, 3 or other integers greater than 1 by default, and the default value of n may also be modified for role authorization.
[0094] The following is a specific implementation example of creating a device entity. Figure 8 , Fig. 9 and Fig.10 , the specific steps are as follows:
[0095] Step 1, please refer to Figure 8 This embodiment provides a data table structure diagram for creating a device entity.
[0096] (1a) Create a DevicePrototype table with id as the integer primary key, name (string), and type (integer).
[0097] (1b) Create a DevicePrototypeAttribute table, with id as the integer primary key, device_prototype_id as the integer foreign key, referencing the primary key id of the DevicePrototype table, name as the name of the attribute (string), description as the description of the attribute (string), data_type as the data type of the attribute (integer), and value as the default value of the attribute (string).
[0098] (1c) Create a Device table with id as the integer primary key and device_prototype_id as the integer foreign key, referencing the primary key id of the DevicePrototype table. name, type, and status are common attributes of all devices, and type is the same as the corresponding field of the same name in the DevicePrototype table.
[0099] (1d) Create a DeviceAttribute table, where id is an integer primary key, device_id is an integer foreign key that references the primary key id of the Device table, device_prototype_attribute_id is an integer foreign key that references the primary key id of the DevicePrototypeAttribute table, and value is the value of the attribute (string).
[0100] (1e) All the above foreign keys can use either database foreign key constraints or program logic associations.
[0101] Step 2: Implement business logic. Please refer to the following when creating device prototypes and device entities. Fig. 9 The embodiment of the present invention provides a method of inserting data by creating a data table relationship diagram of a device entity.
[0102] (2a) Create a device prototype, insert a record into the DevicePrototype table to indicate the name of the prototype and necessary parameters, and insert a record into the DevicePrototypeAttribute table to indicate the unique attribute set of the device prototype (there are 3 unique attributes in this embodiment) and their default values.
[0103] (2b) Create a device entity, insert records into the Device table to indicate the common attributes of the device (in this example, two devices are created), and insert only the corresponding records whose attribute values need to be modified (relative to the default attribute values in the prototype) into the DeviceAttribute table (in this example, the values of two attributes of the two devices are modified respectively). There is no need to insert records if the attribute values are not to be modified.
[0104] Step 3: When obtaining the entire device data entity in the business logic, the following table is obtained through the association relationship: Fig.10 This embodiment provides a device information graph for creating a device entity.
[0105] Step 4: When the default property value of the device prototype is modified, it will take effect on all devices that have not set property values (i.e., reference prototype property values).
[0106] The effect of this embodiment can achieve savings in storage space, development workload, and operation workload, and bring great convenience.
[0107] The present invention also provides a device data management system, please refer to Fig.11 ,include:
[0108] A data access module is used to receive a device data access request, obtain the device data source of the device data access request, call a pre-created device standard database, and perform data analysis on the device data source to generate metadata of the device to be accessed;
[0109] The prototype positioning module is used to match the metadata of the device to be connected with the pre-created device data tree, and set the matching elements in the positioning device data tree as the prototype elements of the device to be connected;
[0110] An entity generation module is used to deeply clone the prototype element of the device to be connected to create a device entity element, create a child node for the device entity element and set it as a device entity sub-element, extract the metadata of the device to be connected and fill in the device entity sub-element;
[0111] Terminal, used to send data management requests, submit uplink data and receive downlink data. Specifically, data management requests include device data access requests, device data update requests and device data deletion requests. Uplink data includes request information and source data sent by the terminal device to the device management platform. Downlink data includes request completion information, device operation instructions, etc. sent by the device management platform to the terminal device.
[0112] For further information, please refer to Fig.12 , the equipment data management system also includes:
[0113] Data maintenance module: used to obtain the device data source of the device data update request for parsing, and modify the corresponding information in the data structure tree according to the device update metadata content generated by the data parsing; also used to obtain the device data deletion request, delete the device entity element of the requested device, and delete the device entity sub-elements of the requested device.
[0114] A person skilled in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by hardware related to program instructions, and the program can be stored in a computer-readable storage medium, which may include: a flash drive, a read-only memory, a random access memory, a magnetic disk or an optical disk, etc.
[0115] The device data management method and system provided in the embodiments of the present invention are introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. For general technicians in this field, according to the idea of the present invention, there will be changes in the specific implementation method and application scope. This specification should not be understood as a limitation of the present invention.
Claims
1. A device data management method, It is characterized in that The device data management method comprises the following steps: S1, obtaining a device data source for a device data access request, calling a pre-created device standard database to perform data analysis on the device data source to generate metadata for the device to be accessed; the pre-created device standard database is used to standardize and define device component types, common attributes and values of various devices; S2, matching the metadata of the device to be connected with the pre-created device data tree, locating the matching element in the device data tree and setting it as the prototype element of the device to be connected; the pre-created device data tree is a tree data structure that describes the device configuration, and is composed of a series of named nodes and attributes, with only one root node named as the general directory name of the device management, the child nodes of the root node are the device component elements, and the remaining leaf nodes are the device entity elements; During the data parsing and matching process, the existing device component information in the matched device standard database is reused as the device component prototype, and the existing device entity elements are reused as the prototype of the device entity to be connected; if the device component information and / or device entity elements in the device standard database are not matched, the following operations are performed to regenerate the metadata of the device to be connected and automatically update the device standard database: If the device component name consistent with the device standard database is not matched, the first two attribute values in the data source are extracted and merged to generate the device component name of the device metadata, and the generated device component name is added to the device standard database at the same time; when the first two attribute values of the data source are extracted and merged to generate the device component name, the role can be authorized to modify the generated device component name, and the generated device component name is automatically added to the device standard database for update when the modification is made; If no device standard attribute consistent with the device standard database is matched, the first n attributes and values in the data source are extracted to generate a device standard attribute data table, and all attributes and values starting from the n+1th attribute are extracted to generate a device custom attribute data table, and the attributes and values of the generated device standard data table are added to the device standard database; the value of n is an integer greater than 1 and can be preset; S3, deeply clone the prototype element of the device to be connected to create an entity element of the device to be connected, create a child node for the entity element of the device to be connected to set it as the entity sub-element of the device to be connected, extract the metadata of the device to be connected to fill the entity sub-element of the device to be connected.
2. The device data management method according to claim 1, It is characterized in that The equipment standard database includes an equipment component list and a component standard attribute list. In step S1, calling the equipment standard database to perform data analysis on the equipment data source to generate metadata of the equipment to be connected includes the following steps: S11, calling a parsing function according to the format of the device data source; S12, the parsing function reads the data content of the device data source, matches the device standard database, and parses to obtain metadata of the device to be connected, including device component information, device standard attribute data table, and device custom attribute data table.
3. The device data management method according to claim 1, It is characterized in that The S2 step specifically includes the following steps: S211, extracting device component information of the metadata of the device to be accessed, traversing the first-level child node names of the root node of the device data tree, and setting the matching child nodes as device component elements; S212, extracting the device standard attribute data table of the device metadata to be accessed, traversing the child nodes of the device component element, and setting the child nodes that match the attributes and values in the device standard data table as the device prototype element.
4. The device data management method according to claim 1 or 3, It is characterized in that The device data tree is automatically created, and the steps of automatically creating the device data tree include: S221, after receiving the first device data access request and executing step S1, establishing a root node of the device data tree, extracting device component information in the metadata of the device to be accessed as the name of the root node; S222, deep cloning the root node to create a child node, that is, completing the creation of the initial device data tree.
5. The device data management method according to claim 1 or 3, It is characterized in that The device data tree is manually created, and the steps of manually creating the device data tree include: S231, after receiving the first device data access request and executing step S1, send information on creating a device general directory name; S232, receiving the device general directory name information, creating a root node, and setting the device general directory name information as the root node name; S233, creating a child node of the root node, obtaining device component information in the metadata of the device to be connected and setting it as the child node name, thus completing the creation of the initial device data tree.
6. The device data management method according to claim 1, It is characterized in that The S3 step specifically includes the following steps: S31, deeply clone a brother node of the device prototype element node to be connected and set it as the device entity element, and clone all attributes and values of the device prototype element node to the device entity element; S32, creating a child node for the device entity element node and setting it as a device entity child element, extracting attributes and values from the device custom attribute data table in the metadata of the device to be connected and filling them into the device entity child element.
7. The device data management method according to claim 1, It is characterized in that After step S3, the following steps are also included: S4, receiving a device data maintenance request, including: Obtain the device data source of the device data update request for parsing, and modify the corresponding information in the data structure tree according to the device update metadata content generated by the data parsing; Get device data deletion request, delete the device entity element of the requested device, and delete the device entity sub-elements of the requested device.
8. A device data management system, It is characterized in that include: A data access module is used to receive a device data access request, obtain a device data source of the device data access request, and call a pre-created device standard database to perform data analysis on the device data source to generate metadata of the device to be accessed; the pre-created device standard database is used to standardize and define device component types, common attributes and values of multiple devices; A prototype positioning module is used to match the metadata of the device to be connected with the pre-created device data tree, and set the matched elements in the positioning device data tree as the prototype elements of the device to be connected; the pre-created device data tree is a tree data structure that describes the device configuration, which is composed of a series of named nodes and attributes, and has only one root node named as the general directory name of the device management, the child nodes of the root node are the device component elements, and the remaining leaf nodes are the device entity elements; During the data parsing and matching process, the existing device component information in the matched device standard database is reused as the device component prototype, and the existing device entity elements are reused as the prototype of the device entity to be connected; if the device component information and / or device entity elements in the device standard database are not matched, the following operations are performed to regenerate the metadata of the device to be connected and automatically update the device standard database: If the device component name consistent with the device standard database is not matched, the first two attribute values in the data source are extracted and merged to generate the device component name of the device metadata, and the generated device component name is added to the device standard database at the same time; when the first two attribute values of the data source are extracted and merged to generate the device component name, the role can be authorized to modify the generated device component name, and the generated device component name is automatically added to the device standard database for update when the modification is made; If no device standard attribute consistent with the device standard database is matched, the first n attributes and values in the data source are extracted to generate a device standard attribute data table, and all attributes and values starting from the n+1th attribute are extracted to generate a device custom attribute data table, and the attributes and values of the generated device standard data table are added to the device standard database; the value of n is an integer greater than 1 and can be preset; An entity generation module is used for deep cloning the prototype element of the device to be connected to create an entity element of the device to be connected, creating a child node for the entity element of the device to be connected and setting it as a child element of the entity of the device to be connected, and extracting metadata of the device to be connected to fill the child element of the entity of the device to be connected; Terminal, used to send data management requests, submit uplink data and receive downlink data.
9. The device data management system according to claim 8, It is characterized in that Also includes: Data maintenance module: used to obtain the device data source of the device data update request for parsing, and modify the corresponding information in the data structure tree according to the device update metadata content generated by the data parsing; It is also used to obtain a device data deletion request, delete the device entity element of the requested device, and delete the device entity sub-elements of the requested device.
