CN116668536A - JSON transmission method and device between graph database and power grid service system - Google Patents

JSON transmission method and device between graph database and power grid service system Download PDF

Info

Publication number
CN116668536A
CN116668536A CN202310644117.2A CN202310644117A CN116668536A CN 116668536 A CN116668536 A CN 116668536A CN 202310644117 A CN202310644117 A CN 202310644117A CN 116668536 A CN116668536 A CN 116668536A
Authority
CN
China
Prior art keywords
attribute
json
transmission
names
schema
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310644117.2A
Other languages
Chinese (zh)
Inventor
刘思言
陈国宝
林剑超
乔贵邠
赵保华
柴博
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
State Grid Smart Grid Research Institute Co ltd
State Grid Corp of China SGCC
Original Assignee
State Grid Smart Grid Research Institute Co ltd
State Grid Corp of China SGCC
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by State Grid Smart Grid Research Institute Co ltd, State Grid Corp of China SGCC filed Critical State Grid Smart Grid Research Institute Co ltd
Priority to CN202310644117.2A priority Critical patent/CN116668536A/en
Publication of CN116668536A publication Critical patent/CN116668536A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/565Conversion or adaptation of application format or content
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/12Protocols specially adapted for proprietary or special-purpose networking environments, e.g. medical networks, sensor networks, networks in vehicles or remote metering networks
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/568Storing data temporarily at an intermediate stage, e.g. caching
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y04INFORMATION OR COMMUNICATION TECHNOLOGIES HAVING AN IMPACT ON OTHER TECHNOLOGY AREAS
    • Y04SSYSTEMS INTEGRATING TECHNOLOGIES RELATED TO POWER NETWORK OPERATION, COMMUNICATION OR INFORMATION TECHNOLOGIES FOR IMPROVING THE ELECTRICAL POWER GENERATION, TRANSMISSION, DISTRIBUTION, MANAGEMENT OR USAGE, i.e. SMART GRIDS
    • Y04S10/00Systems supporting electrical power generation, transmission or distribution
    • Y04S10/50Systems or methods supporting the power network operation or management, involving a certain degree of interaction with the load-side end user applications

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Health & Medical Sciences (AREA)
  • Computing Systems (AREA)
  • General Health & Medical Sciences (AREA)
  • Medical Informatics (AREA)
  • Cable Transmission Systems, Equalization Of Radio And Reduction Of Echo (AREA)

Abstract

The invention relates to the technical field of data transmission of a power grid graph database, in particular to a JSON transmission method and device between a graph database and a power grid business system. The method comprises the following steps: storing preset metadata information in JSON data; recoding the Schema names and the attribute names in the JSON data according to simplified codes corresponding to the Schema names and the attribute names in the preset metadata information to obtain recoded JSON data; and transmitting by using the recoded JSON data. The invention solves the problem of high network overhead when the graph database in the related technology uses the conventional JSON transmission method to transmit data.

Description

JSON transmission method and device between graph database and power grid service system
Technical Field
The invention relates to the technical field of data transmission of a power grid graph database, in particular to a JSON transmission method and device between a graph database and a power grid business system.
Background
The power grid special graph database is a specific domain graph database facing the power grid domain and facing the power grid business system. In the field of graph databases, metadata, which is data describing the structure and method of creation of data within the database, is often described by introducing "schemas" (schemas). Labels (Label) are often used in graph databases to represent Schema names, which are classified as "Schema" by classifying certain point, edge data as "labels". The JSON is data in the form of a pure character string, and is commonly used as a grid graph database query result return format because of flexible format and self-parsing, and a grid business system generally uses the JSON format as a data transmission mode.
When the conventional power grid service system based on the graph database performs response data transmission based on JSON, thousands or even more points and edges of elements need to be transmitted, each point edge also transmits an attribute name and an attribute value of each attribute, and huge data transmission quantity can cause the problems of high network overhead, low response speed of the power grid service system and the like. Therefore, the prior art has the problem that the network overhead is large when the graph database uses the conventional JSON transmission method to transmit data.
Disclosure of Invention
The invention provides a JSON transmission method and a JSON transmission device between a graph database and a power grid service system, which at least solve the problem of high network overhead when the graph database transmits data by using a conventional JSON transmission method in the related technology.
According to a first aspect of an embodiment of the present invention, there is provided a JSON transmission method between a graph database and a grid business system, the method including: storing preset metadata information in JSON data; recoding the Schema names and the attribute names in the JSON data according to simplified codes corresponding to the Schema names and the attribute names in the preset metadata information to obtain recoded JSON data; and transmitting by using the recoded JSON data.
Optionally, the preset metadata information includes a Schema name definition and an attribute definition list, and before recoding the Schema name and the attribute name in the JSON data according to the simplified codes corresponding to the Schema name and the attribute name in the preset metadata information to obtain recoded JSON data, the method further includes: acquiring a Schema name and an attribute name according to the Schema name definition and the attribute definition list, wherein the Schema name and the attribute name are encoded by English letters; and selecting English letters of the pre-preset bits corresponding to the Schema names or the attribute names as simplified codes corresponding to the Schema names or the attribute names, wherein the pre-preset bits corresponding to the Schema names or the attribute names are determined by the fact that the Schema names or the attribute names are not repeated and the number of the English letters is minimum.
Optionally, the preset metadata information further includes: the attribute value is equal to NULL or a default value corresponding to space time, and after recoding the Schema name and the attribute name in the JSON data according to the Schema name and the simplified code corresponding to the attribute name in the preset metadata information to obtain recoded JSON data, the method further comprises: and for the attribute with the attribute value equal to NULL, NULL or default value, the recoded JSON data is not used for transmission.
Optionally, after transmission using the recoded JSON data, the method further comprises: and acquiring an attribute value corresponding to the attribute which is transmitted by the JSON data after not using recoding according to the default value corresponding to NULL or space when the attribute value in the preset metadata information.
Optionally, the preset metadata information further includes: and the metadata time stamp corresponds to the current transmission.
Optionally, after transmission using the recoded JSON data, the method further comprises: storing a corresponding metadata time stamp in the transmission; when the next transmission is carried out, judging whether the stored metadata time stamp corresponding to the transmission is consistent with the metadata time stamp, wherein the metadata time stamp is used for storing the time stamp corresponding to any moment when the metadata of the graph database is changed at any moment; if the stored metadata time stamp corresponding to the transmission is consistent with the metadata time stamp, the JSON data used in the next transmission does not store preset metadata information; if the stored metadata time stamp corresponding to the current transmission is inconsistent with the metadata time stamp, generating new preset metadata information, and storing the new preset metadata information in JSON data used in the next transmission.
Optionally, the preset metadata information further includes: the data type of the attribute, whether the attribute can be NULL or NULL, and whether the attribute value is unique.
According to a second aspect of the embodiment of the present invention, there is also provided a JSON transmission device between a graph database and a grid business system, the device including: the first storage module is used for storing preset metadata information in JSON data; the recoding module is used for recoding the Schema names and the attribute names in the JSON data according to the simplified codes corresponding to the Schema names and the attribute names in the preset metadata information to obtain recoded JSON data; and the transmission module is used for transmitting the recoded JSON data.
Optionally, the preset metadata information includes a Schema name definition and an attribute definition list, and the apparatus further includes: the first acquisition module is used for acquiring the Schema name and the attribute name according to the Schema name definition and the attribute definition list, wherein the Schema name and the attribute name are encoded by English letters; the selection module is used for selecting English letters of the pre-preset bits corresponding to the Schema names or the attribute names as simplified codes corresponding to the Schema names or the attribute names, wherein the pre-preset bits corresponding to the Schema names or the attribute names are determined by the fact that the Schema names or the attribute names are not repeated and the number of the English letters is minimum.
Optionally, the preset metadata information further includes: the attribute value is equal to NULL or a default value corresponding to space time, and the device further comprises: and the transmission judging module is used for transmitting the attribute with the attribute value equal to NULL, NULL or default value without using the recoded JSON data.
Optionally, the apparatus further comprises: and the second acquisition module is used for acquiring the attribute value corresponding to the attribute of the JSON data which is not recoded for transmission according to the default value corresponding to NULL or space time when the attribute value in the preset metadata information.
Optionally, the preset metadata information further includes: and the metadata time stamp corresponds to the current transmission.
Optionally, the apparatus further comprises: the second storage module is used for storing the corresponding metadata time stamp in the transmission; the judging module is used for judging whether the stored metadata time stamp corresponding to the transmission is consistent with the metadata time stamp or not when the metadata of the graph database is changed at any time, and storing the time stamp corresponding to any time; the first data generation module is used for not storing preset metadata information when the stored metadata time stamp corresponding to the current transmission is consistent with the metadata time stamp, and the JSON data used in the next transmission is not stored; and the second data generation module is used for generating new preset metadata information if the stored metadata time stamp corresponding to the current transmission is inconsistent with the metadata time stamp, and storing the new preset metadata information in JSON data used in the next transmission.
Optionally, the preset metadata information further includes: the data type of the attribute, whether the attribute can be NULL or NULL, and whether the attribute value is unique.
According to a third aspect of the embodiment of the present invention, there is also provided an electronic device including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory complete communication with each other through the communication bus; wherein the memory is used for storing a computer program; and the processor is used for executing the JSON transmission method between the graph database and the power grid business system in any embodiment by running the computer program stored on the memory.
According to a fourth aspect of embodiments of the present invention, there is also provided a computer readable storage medium having a computer program stored therein, wherein the computer program is configured to perform, when run, the JSON transmission method between the graph database and the grid business system in any of the embodiments described above.
In the embodiment of the invention, the preset metadata information is stored in the JSON data; recoding the Schema names and the attribute names in the JSON data according to simplified codes corresponding to the Schema names and the attribute names in the preset metadata information to obtain recoded JSON data; and transmitting by using the recoded JSON data. Because the Schema names and the attribute names in the JSON data are recombined and recoded by using the simplified codes in the preset metadata information, the effects of reducing the network transmission cost, the transmission time and the message response length are achieved, and the problem of high network overhead when the conventional JSON transmission method is used for transmitting the data by the graph database in the related technology is solved.
In the embodiment of the invention, the transmission method of the power grid data containing sparse attribute values (the attribute values are NULL, NULL or default values) is improved by using the preset metadata information, namely the attributes and the attribute values are not transmitted, and the data can be obtained from the preset metadata information when needed. Therefore, the aim of avoiding transmission of NULL, NULL and default value attributes in a large number of point and side data is fulfilled, and the effect of reducing the attribute keys and the value transmission data size in JSON data when the data transmission quantity is large is achieved.
In the embodiment of the invention, the effect of reducing the data transmission cost while ensuring that the Schema names or the attribute names do not conflict and have readability is achieved by selecting the English letters with the preset bits with the least number of English letters as the simplified codes.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and together with the description, serve to explain the principles of the invention.
In order to more clearly illustrate the embodiments of the invention or the technical solutions of the prior art, the drawings which are used in the description of the embodiments or the prior art will be briefly described, and it will be obvious to a person skilled in the art that other drawings can be obtained from these drawings without inventive effort.
FIG. 1 is a schematic diagram of a hardware environment of an alternative JSON transmission method between a graph database and a grid business system according to an embodiment of the present invention;
FIG. 2 is a flow diagram of an alternative method of JSON transmission between a graph database and a grid business system in accordance with an embodiment of the present invention;
FIG. 3 is a schematic overall flow diagram of an alternative method of JSON transmission between a graph database and a grid business system in accordance with an embodiment of the present invention;
FIG. 4 is a block diagram of an alternative JSON transmission mechanism between a graph database and a grid business system in accordance with an embodiment of the present invention;
fig. 5 is a block diagram of an alternative electronic device in accordance with an embodiment of the present invention.
Detailed Description
In order that those skilled in the art will better understand the present invention, a technical solution in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are only some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present invention without making any inventive effort, shall fall within the scope of the present invention.
It should be noted that in the description of the present invention, the terms "first," "second," and the like are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the invention described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus. The terms "mounted," "connected," "coupled," and "connected" are to be construed broadly, and may be, for example, fixedly connected, detachably connected, or integrally connected; can be mechanically or electrically connected; the two components can be directly connected or indirectly connected through an intermediate medium, or can be communicated inside the two components, or can be connected wirelessly or in a wired way. The specific meaning of the above terms in the present invention will be understood in specific cases by those of ordinary skill in the art.
According to one aspect of the embodiment of the invention, a JSON transmission method between a graph database and a power grid business system is provided. Alternatively, in this embodiment, the JSON transmission method between the graph database and the grid business system may be applied to the hardware environment shown in fig. 1. As shown in fig. 1, the terminal 102 may include a memory 104, a processor 106, and a display 108 (optional components). The terminal 102 may be communicatively coupled to a server 112 via a network 110, the server 112 being operable to provide services (e.g., application services, etc.) to the terminal or to clients installed on the terminal, and a database 114 may be provided on the server 112 or independent of the server 112 for providing data storage services to the server 112. In addition, a processing engine 116 may be run in the server 112, which processing engine 116 may be used to perform the steps performed by the server 112.
Alternatively, the terminal 102 may be, but is not limited to, a terminal capable of calculating data, such as a mobile terminal (e.g., a mobile phone, a tablet computer), a notebook computer, a PC (Personal Computer ) or the like, which may include, but is not limited to, a wireless network or a wired network. Wherein the wireless network comprises: bluetooth, WIFI (Wireless Fidelity ) and other networks that enable wireless communications. The wired network may include, but is not limited to: wide area network, metropolitan area network, local area network. The server 112 may include, but is not limited to, any hardware device that can perform calculations.
In addition, in this embodiment, the JSON transmission method between the graph database and the grid business system may be applied, but not limited to, to an independent processing device with a relatively high processing capability, without data interaction. For example, the processing device may be, but not limited to, a terminal device with relatively high processing power, i.e. each operation in the JSON transmission method between the graph database and the grid business system may be integrated in a separate processing device. The above is merely an example, and is not limited in any way in the present embodiment.
Alternatively, in this embodiment, the JSON transmission method between the graph database and the grid service system may be performed by the server 112, or may be performed by the terminal 102, or may be performed by both the server 112 and the terminal 102. The JSON transmission method between the graph database and the grid business system, which is executed by the terminal 102 according to the embodiment of the present invention, may also be executed by the client installed thereon.
In the related art, JSON is often used as a query result return format of the grid graph database between the grid service system (the grid intelligent service application) and the graph database (the grid graph database), and the grid intelligent service application also often uses the JSON format as a data transmission mode when a service interface is displayed. Other data transmission formats (e.g., webSocket-based binary formats) are also supported by the grid map database, but JSON is one format that is very widely used. The reasons are as follows: the intelligent power grid business application generally has the requirement of client interface display, in many cases, the client is a rich client based on Javascript, and the required data is text data which is convenient for Javascript to process and developer to analyze, such as JSON, rather than binary data such as WebSocket; JSON is a more compact, lighter weight data exchange format than other text-based transmission formats such as XML.
Conventional graph database-based power grid intelligent service application, when performing JSON-based response data transmission, problems encountered include: (1) data network transmission performance problem under large data volume. In the scene that thousands, tens of thousands or even more points and edges are required to be transmitted, each point and each edge can transmit the attribute name and the attribute value of each attribute, wherein the attribute name is used as a Key (Key) of a JSON object, and the attribute names are identical for the same attribute of all points or edges of the same type (namely the same Schema), but the repeated attribute names can be repeatedly transmitted by using the traditional JSON data transmission method, and redundant attribute name transmission brings additional network overhead. (2) The metadata of the grid graph data is complex, and the number of attributes in the Schema can reach hundreds or more. Such magnitude of data can present significant performance problems when performing network transmission of the data and interface rendering. (3) The number of attribute values of points and edges in the power grid graph data is large, but many cases are a numerical mode similar to 'sparse': a large number of point, edge attribute values are either null (i.e. no set value) or a certain specific value is used, i.e. there is a large number of points, edges, some or some attribute values are null, typically only the values of the key few attributes are present for all points, edges; some attribute values of a large number of points and edges are the same, for example, in a power grid environment with good running state, the state attribute of most devices is normal.
In view of this, the embodiment of the invention provides a JSON transmission method between a graph database and a grid service system, which uses simplified codes in preset metadata information to reconstruct and recode Schema names and attribute names in JSON data, so as to achieve the effects of reducing network transmission cost, transmission time and shortening message response length, and further solve the problem of high network overhead when the graph database uses a conventional JSON transmission method to transmit data in the related art.
The embodiment of the invention provides a JSON transmission method between a graph database and a power grid service system, taking application of the method to a central processing unit as an example, fig. 2 is a schematic flow diagram of an alternative JSON transmission method between a graph database and a power grid service system according to an embodiment of the invention, and as shown in fig. 2, the flow of the method may include the following steps:
step S201, storing preset metadata information in JSON data. Optionally, the JSON data is data transmitted when the graph database responds to the power grid service system data request, and the preset metadata information may include conventional metadata and information for helping to reduce the data transmission amount, such as Schema names and attribute names, and simplified codes corresponding to the Schema names and attribute names.
Step S202, recoding the Schema names and the attribute names in the JSON data according to the simplified codes corresponding to the Schema names and the attribute names in the preset metadata information to obtain recoded JSON data. Optionally, the Schema names and attribute names contained in the JSON data (response) are recoded by using simplified codes corresponding to the Schema names and attribute names, thereby achieving the effect of reducing the data transmission amount.
And step S203, transmitting by using the recoded JSON data. Optionally, the response of the graph database to the power grid service system data request is implemented by using simplified (recoded) JSON data of the Schema name and the attribute name, and then JSON data transmission is performed.
In the embodiment of the invention, the preset metadata information is stored in the JSON data; recoding the Schema names and the attribute names in the JSON data according to simplified codes corresponding to the Schema names and the attribute names in the preset metadata information to obtain recoded JSON data; and transmitting by using the recoded JSON data. Because the Schema names and the attribute names in the JSON data are recombined and recoded by using the simplified codes in the preset metadata information, the effects of reducing the network transmission cost, the transmission time and the message response length are achieved, and the problem of high network overhead when the conventional JSON transmission method is used for transmitting the data by the graph database in the related technology is solved.
As an optional embodiment, the preset metadata information includes a Schema name definition and an attribute definition list, and before recoding the Schema name and the attribute name in the JSON data according to the simplified codes corresponding to the Schema name and the attribute name in the preset metadata information to obtain recoded JSON data, the method further includes: acquiring a Schema name and an attribute name according to the Schema name definition and the attribute definition list, wherein the Schema name and the attribute name are encoded by English letters; and selecting English letters of the pre-preset bits corresponding to the Schema names or the attribute names as simplified codes corresponding to the Schema names or the attribute names, wherein the pre-preset bits corresponding to the Schema names or the attribute names are determined by the fact that the Schema names or the attribute names are not repeated and the number of the English letters is minimum.
Optionally, on the premise of no duplicate name, the first n least characters (the pre-preset bits) of the Schema name or the attribute name are used for simplifying the Schema name or the attribute name, so as to reduce redundant fields in data transmission, reduce network transmission pressure and improve transmission speed. Wherein the Schema name or attribute name is encoded using english letters. The following is an example of a Schema name reduction process, similar to the attribute name reduction process: when any JSON response is used for data transmission, taking the initial letter of the Schema name as a simplified code, and if a plurality of Schema names conflict (name repetition), taking the first two letters of the Schema with the repeated initial letter name as the simplified code of the Schema; if there are more than one Schema's name reduction codes in conflict, the first three letters are taken. And the like, until all Schema simplified codes are not in conflict, or a certain (or a plurality of) Schema simplified codes are the same as the original names.
It should be noted that there are other ways to simply encode a character string in a manner that "avoids repetition," such as: the original names are replaced by the non-repeated numbers, namely, a number is sequentially generated for each name to be coded, namely, a Schema name or an attribute name, from 0 (or 1), and the obtained number sequence is unique for each name to be coded. However, the code generated by the coding mode has no readability, and is inconsistent with the concept of 'readable and text-oriented' advocated by the JSON format. The shortest and non-repeated simplified code corresponding to the Schema name or the attribute name is determined from the initial, namely, the pre-set bit corresponding to the original name is used as the corresponding simplified code on the premise of ensuring non-repetition, so that the readability is high, and the purpose that the simplified code corresponds to the original Schema name or the attribute name can be realized.
As an alternative embodiment, the preset metadata information further includes: the attribute value is equal to NULL or a default value corresponding to space time, and after recoding the Schema name and the attribute name in the JSON data according to the Schema name and the simplified code corresponding to the attribute name in the preset metadata information to obtain recoded JSON data, the method further comprises: and for the attribute with the attribute value equal to NULL, NULL or default value, the recoded JSON data is not used for transmission.
Alternatively, for point, edge attributes with values NULL or NULL, JSON strings (JSON data) do not transmit such attributes, i.e., neither key nor value of such attributes are transmitted, and such attributes are not saved in JSON data. For the attributes with the same default values of the Schema, the processing rules are the same.
As an alternative embodiment, after transmission using the recoded JSON data, the method further comprises: and acquiring an attribute value corresponding to the attribute which is transmitted by the JSON data after not using recoding according to the default value corresponding to NULL or space when the attribute value in the preset metadata information. Optionally, the grid service system may obtain the default value as the value of the untransmitted attribute according to the attribute value stored in the preset metadata being equal to the default value corresponding to NULL or space.
As an alternative embodiment, the preset metadata information further includes: and the metadata time stamp corresponds to the current transmission. After transmission using the recoded JSON data, the method further includes: storing a corresponding metadata time stamp in the transmission; when the next transmission is carried out, judging whether the stored metadata time stamp corresponding to the transmission is consistent with the metadata time stamp, wherein the metadata time stamp is used for storing the time stamp corresponding to any moment when the metadata of the graph database is changed at any moment; if the stored metadata time stamp corresponding to the transmission is consistent with the metadata time stamp, the JSON data used in the next transmission does not store preset metadata information; if the stored metadata time stamp corresponding to the current transmission is inconsistent with the metadata time stamp, generating new preset metadata information, and storing the new preset metadata information in JSON data used in the next transmission.
Optionally, the preset metadata information further includes: and the metadata time stamp corresponds to the current transmission. I.e. the corresponding metadata timestamp when the graph database responds to the grid business system (transmitting JSON data). On the grid-specific graph database side, the metadata timestamp is updated each time metadata is changed (e.g., added, modified or deleted). This timestamp may be used to inform the grid smart service application (grid service system) whether the metadata version is the latest version. Specifically, after receiving the responsive JSON data, the power grid service system stores the corresponding metadata timestamp in the JSON data during the transmission, and when the next data request is performed, whether the metadata in the graph database is changed or not can be judged according to the stored metadata timestamp, if not, the preset metadata information can not be stored in the JSON data used during the next transmission, and the repeated transmission of the metadata information can be avoided; if the change occurs, new preset metadata information is generated and stored in JSON data used in the next transmission. The method achieves the effect of ensuring the consistency of metadata of the intelligent application client and the database of the power grid special graph.
As an alternative embodiment, the preset metadata information further includes: the data type of the attribute, whether the attribute can be NULL or NULL, and whether the attribute value is unique. Optionally, the preset metadata information may be set according to specific requirements, and may include more information, such as information about a data type of an attribute, whether the attribute may be NULL or NULL, and whether an attribute value is unique.
As an alternative embodiment, fig. 3 is an overall flow diagram of an alternative JSON transmission method between a graph database and a grid business system according to an embodiment of the present invention. As shown in fig. 3, the flow of the method may include the steps of:
in step S301, metadata information is carried by an existing "non-metadata" response. Alternatively, for grid smart application metadata, when data transmission is performed through JSON, the metadata information is carried with a "non-metadata" response, i.e., metadata information (preset metadata information) is introduced in a response that conventionally does not contain metadata. In this step, in the JSON response of the first conventional non-metadata "such as the query data of a point, an edge, etc. or the operation result data of an algorithm, metadata information of the graph instance is simultaneously transmitted to the smart grid business client, including:
a. conventional metadata;
b. simplified coded Schema names and attribute names;
c. metadata timestamp introduced in this step.
Wherein the conventional metadata further comprises: point, edge Schema names (i.e., label) definitions; a list of attribute definitions of points and edges; the attribute defines characteristics and constraints, such as data type of the attribute, whether the attribute can be NULL (NULL), default value when the attribute value is NULL, whether the attribute value is unique, and the like.
In the response sent from the server side to the client side provided by the existing graph database product, only graph data information (namely point, side and attribute information) is carried, and metadata information is not carried. Through this step, the capability of metadata transmission to the intelligent service application client is introduced into the power grid private graph database. The power grid intelligent application client can acquire metadata information, and the power grid intelligent application client ensures that the acquired metadata is consistent with the metadata of the power grid special graph database. Such as: the metadata timestamp information of the client is contained in the request initiated by the subsequent intelligent power grid application client, if the metadata timestamp is not updated, the metadata information is not required to be carried in the response of the request to avoid repeated data transmission, otherwise, the updated metadata information is carried to inform the client of using the latest metadata.
Step S302, introducing simplified codes for Schema names and attribute names. Optionally, under the premise of no duplicate name, the Schema name and the attribute name use the first n least characters (English letters) to simplify the coding, so that the transmission size of keys in JSON transmission data when the power grid service Schema is more, the attributes are more or the transmission points and the edge data are more is reduced, the network transmission pressure is reduced, and the transmission speed is improved.
And step S303, recoding the Schema names and attribute names in the returned point and side JSON data. Optionally, the Schema name and the attribute name are simplified by using the simplified code obtained in step S302, that is, in the JSON return value, for the response returned by the grid private graph database server: simplified codes are used for the Schema names of the points and the edges and the attribute names so as to reduce transmission characters of the JSON keys corresponding to the attribute names. Through this step, for scenes with multiple Schema and attributes, the original longer name string in the Schema names and attribute names has been shortened to shorter coded "reduced version" Schema names and attribute names.
Step S304, a point and edge data transmission mode oriented to a NULL value and a default value in the JSON response is introduced. Alternatively, for the attribute with the value NULL, NULL or default value, no transmission is performed, the smart application client may acquire the default value as the value of the untransmitted attribute according to the metadata information transmitted in step S301. The method has the advantages that the effect of further reducing the size of attribute keys and value transmission data in JSON transmission data when the power grid service schemes are more, the attributes are more and the transmission point edge data are more is achieved.
By the scheme names and attribute names of the steps S301 to S304 simplified coding and the method for avoiding transmission of partial attribute values, the data volume transmitted by JSON can be greatly saved for scenes with hundreds or more schemes or attributes and thousands of point edge data in the returned response. Such as: for a grid graph database instance where there are 20 Schema and 20 attributes per Schema on average, when a response transmits 1000 points to a client, there will be 20×20×1000=400000 points of attribute names in JSON data using simplified attribute names. If the points have conditions which accord with NULL values, NULL values or default values, JSON fields corresponding to the attributes of the points are not transmitted, so that a large amount of JSON transmission data is reduced. The effect of reducing the data transmission data volume of the JSON data of the special graph database of the power grid is achieved, and therefore the purposes of reducing the network transmission cost, reducing the network transmission delay and improving the response speed of the system are achieved.
According to another aspect of the embodiment of the invention, a JSON transmission device between the graph database and the grid business system is also provided. Fig. 4 is a block diagram of an alternative JSON transmission device between a graph database and a grid business system, in accordance with an embodiment of the present invention, as shown in fig. 4, the device may include: a storage module 401, configured to store preset metadata information in JSON data; the recoding module 402 is configured to recode the Schema name and the attribute name in the JSON data according to the simplified codes corresponding to the Schema name and the attribute name in the preset metadata information, so as to obtain recoded JSON data; a transmission module 403, configured to transmit using the recoded JSON data.
It should be noted that, the storage module 401 in this embodiment may be used to perform the above step S201, the recoding module 402 in this embodiment may be used to perform the above step S202, and the transmission module 403 in this embodiment may be used to perform the above step S203.
Through the module, the Schema names and the attribute names in the JSON data are recombined and recoded by using the simplified codes in the preset metadata information, the effects of reducing the network transmission cost, the transmission time and the message response length are achieved, and the problem that the network overhead is high when the graph database in the related technology uses the conventional JSON transmission method to transmit the data is solved.
As an optional embodiment, the preset metadata information includes a Schema name definition and an attribute definition list, and the apparatus further includes: the first acquisition module is used for acquiring the Schema name and the attribute name according to the Schema name definition and the attribute definition list, wherein the Schema name and the attribute name are encoded by English letters; the selection module is used for selecting English letters of the pre-preset bits corresponding to the Schema names or the attribute names as simplified codes corresponding to the Schema names or the attribute names, wherein the pre-preset bits corresponding to the Schema names or the attribute names are determined by the fact that the Schema names or the attribute names are not repeated and the number of the English letters is minimum.
As an alternative embodiment, the preset metadata information further includes: the attribute value is equal to NULL or a default value corresponding to space time, and the device further comprises: and the transmission judging module is used for transmitting the attribute with the attribute value equal to NULL, NULL or default value without using the recoded JSON data.
As an alternative embodiment, the apparatus further comprises: and the second acquisition module is used for acquiring the attribute value corresponding to the attribute of the JSON data which is not recoded for transmission according to the default value corresponding to NULL or space time when the attribute value in the preset metadata information.
As an alternative embodiment, the preset metadata information further includes: and the metadata time stamp corresponds to the current transmission.
As an alternative embodiment, the apparatus further comprises: the second storage module is used for storing the corresponding metadata time stamp in the transmission; the judging module is used for judging whether the stored metadata time stamp corresponding to the transmission is consistent with the metadata time stamp or not when the metadata of the graph database is changed at any time, and storing the time stamp corresponding to any time; the first data generation module is used for not storing preset metadata information when the stored metadata time stamp corresponding to the current transmission is consistent with the metadata time stamp, and the JSON data used in the next transmission is not stored; and the second data generation module is used for generating new preset metadata information if the stored metadata time stamp corresponding to the current transmission is inconsistent with the metadata time stamp, and storing the new preset metadata information in JSON data used in the next transmission.
As an alternative embodiment, the preset metadata information further includes: the data type of the attribute, whether the attribute can be NULL or NULL, and whether the attribute value is unique.
It should be noted that the above modules are the same as examples and application scenarios implemented by the corresponding steps, but are not limited to what is disclosed in the above embodiments. It should be noted that the above modules may be implemented in software or in hardware as part of the apparatus shown in fig. 1, where the hardware environment includes a network environment.
According to still another aspect of the embodiment of the present invention, there is further provided an electronic device for implementing the JSON transmission method between the graph database and the grid business system, where the electronic device may be a server, a terminal, or a combination thereof.
Fig. 5 is a block diagram of an alternative electronic device according to an embodiment of the invention, as shown in fig. 5, comprising a processor 501, a communication interface 502, a memory 503 and a communication bus 504, wherein the processor 501, the communication interface 502 and the memory 503 perform communication with each other via the communication bus 504, wherein the memory 503 is adapted to store a computer program; the processor 501, when executing the computer program stored on the memory 503, performs the following steps:
Storing preset metadata information in JSON data; recoding the Schema names and the attribute names in the JSON data according to simplified codes corresponding to the Schema names and the attribute names in the preset metadata information to obtain recoded JSON data; and transmitting by using the recoded JSON data.
Alternatively, in the present embodiment, the above-described communication bus may be a PCI (Peripheral Component Interconnect, peripheral component interconnect standard) bus, or an EISA (Extended Industry Standard Architecture ) bus, or the like. The communication bus may be classified as an address bus, a data bus, a control bus, or the like. For ease of illustration, only one thick line is shown in fig. 5, but not only one bus or one type of bus.
The communication interface is used for communication between the electronic device and other devices.
The memory may include RAM or may include non-volatile memory (non-volatile memory), such as at least one disk memory. Optionally, the memory may also be at least one memory device located remotely from the aforementioned processor.
As an example, as shown in fig. 5, the memory 503 may include, but is not limited to, a storage module 401, a recoding module 402, and a transmission module 403 in the JSON transmission device between the graph database and the grid business system. In addition, other module units in the JSON transmission device between the graph database and the grid business system may be included, but are not limited to, and are not described in detail in this example.
The processor may be a general purpose processor and may include, but is not limited to: CPU (Central Processing Unit ), NP (Network Processor, network processor), etc.; but also DSP (Digital Signal Processing, digital signal processor), ASIC (Application Specific Integrated Circuit ), FPGA (Field-Programmable Gate Array, field programmable gate array) or other programmable logic device, discrete gate or transistor logic device, discrete hardware components.
In addition, the electronic device further includes: and the display is used for displaying the JSON transmission result between the graph database and the power grid service system.
Alternatively, specific examples in this embodiment may refer to examples described in the foregoing embodiments, and this embodiment is not described herein.
It will be understood by those skilled in the art that the structure shown in fig. 5 is only schematic, and the device implementing the JSON transmission method between the graph database and the power grid service system may be a terminal device, and the terminal device may be a smart phone (such as an Android mobile phone, an iOS mobile phone, etc.), a tablet computer, a palm computer, a mobile internet device (Mobile Internet Devices, MID), a PAD, etc. Fig. 5 does not limit the structure of the electronic device. For example, the terminal device may also include more or fewer components (e.g., network interfaces, display devices, etc.) than shown in fig. 5, or have a different configuration than shown in fig. 5.
Those of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be implemented by a program for instructing a terminal device to execute in association with hardware, the program may be stored in a computer readable storage medium, and the storage medium may include: flash disk, ROM, RAM, magnetic or optical disk, etc.
According to yet another aspect of an embodiment of the present invention, there is also provided a storage medium. Alternatively, in this embodiment, the storage medium may be used to execute the program code of the JSON transmission method between the graph database and the grid business system.
Alternatively, in this embodiment, the storage medium may be located on at least one network device of the plurality of network devices in the network shown in the above embodiment.
Alternatively, in the present embodiment, the storage medium is configured to store program code for performing the steps of:
storing preset metadata information in JSON data; recoding the Schema names and the attribute names in the JSON data according to simplified codes corresponding to the Schema names and the attribute names in the preset metadata information to obtain recoded JSON data; and transmitting by using the recoded JSON data.
Alternatively, specific examples in the present embodiment may refer to examples described in the above embodiments, which are not described in detail in the present embodiment.
Alternatively, in the present embodiment, the storage medium may include, but is not limited to: various media capable of storing program codes, such as a U disk, ROM, RAM, a mobile hard disk, a magnetic disk or an optical disk.
According to yet another aspect of embodiments of the present invention, there is also provided a computer program product or computer program comprising computer instructions stored in a computer readable storage medium; the processor of the computer device reads the computer instructions from the computer readable storage medium, and the processor executes the computer instructions, so that the computer device performs the JSON transmission method between the graph database and the grid business system in any of the above embodiments.
The foregoing embodiment numbers of the present invention are merely for the purpose of description, and do not represent the advantages or disadvantages of the embodiments.
The integrated units in the above embodiments may be stored in the above-described computer-readable storage medium if implemented in the form of software functional units and sold or used as separate products. Based on such understanding, the technical solution of the present invention may be embodied essentially or partly in the form of a software product, or all or part of the technical solution, which is stored in a storage medium, and includes several instructions for causing one or more computer devices (which may be personal computers, servers or network devices, etc.) to execute all or part of the steps of the JSON transmission method between the graph database and the grid business system of the various embodiments of the present invention.
In the foregoing embodiments of the present invention, the descriptions of the embodiments are emphasized, and for a portion of this disclosure that is not described in detail in this embodiment, reference is made to the related descriptions of other embodiments.
In several embodiments provided by the present invention, it should be understood that the disclosed client may be implemented in other manners. The above-described embodiments of the apparatus are merely exemplary, and are merely a logical functional division, and there may be other manners of dividing the apparatus in actual implementation, for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be through some interfaces, units or modules, or may be in electrical or other forms.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed over a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution provided in the present embodiment.
In addition, each functional unit in the embodiments of the present invention may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The foregoing is merely a preferred embodiment of the present invention and it should be noted that modifications and adaptations to those skilled in the art may be made without departing from the principles of the present invention, which are intended to be comprehended within the scope of the present invention.

Claims (10)

1. A JSON transmission method between a graph database and a grid business system, the method comprising:
storing preset metadata information in JSON data;
recoding the Schema names and the attribute names in the JSON data according to simplified codes corresponding to the Schema names and the attribute names in the preset metadata information to obtain recoded JSON data;
and transmitting by using the recoded JSON data.
2. The JSON transmission method between the graph database and the grid business system according to claim 1, wherein the preset metadata information includes a Schema name definition and an attribute definition list, and before recoding the Schema name and the attribute name in the JSON data according to the simplified codes corresponding to the Schema name and the attribute name in the preset metadata information, the method further includes:
Acquiring a Schema name and an attribute name according to a Schema name definition and an attribute definition list, wherein the Schema name and the attribute name are encoded by English letters;
and selecting English letters of the pre-preset bits corresponding to the Schema names or the attribute names as simplified codes corresponding to the Schema names or the attribute names, wherein the pre-preset bits corresponding to the Schema names or the attribute names are determined by the fact that the Schema names or the attribute names are not repeated and the number of the English letters is minimum.
3. The JSON transmission method between a graph database and a grid business system according to claim 1 or 2, characterized in that the preset metadata information further comprises: and the attribute value is equal to NULL or a default value corresponding to space time, and after recoding the Schema name and the attribute name in the JSON data according to the simplified codes corresponding to the Schema name and the attribute name in the preset metadata information to obtain recoded JSON data, the method further comprises:
and for the attribute with the attribute value equal to NULL, NULL or default value, the recoded JSON data is not used for transmission.
4. A JSON transmission method between a graph database and a grid business system as claimed in claim 3, in which, after the transmission using the recoded JSON data, the method further comprises:
And acquiring an attribute value corresponding to the attribute which is transmitted by the JSON data after not using recoding according to the default value corresponding to NULL or space when the attribute value in the preset metadata information.
5. The JSON transmission method between a graph database and a grid business system according to claim 1, wherein the preset metadata information further includes: and the metadata time stamp corresponds to the current transmission.
6. The JSON transmission method between a graph database and a grid business system of claim 5, in which after the transmission using the recoded JSON data, the method further comprises:
storing a corresponding metadata time stamp in the transmission;
when the next transmission is carried out, judging whether the stored metadata time stamp corresponding to the transmission is consistent with the metadata time stamp, wherein the metadata time stamp is used for storing the time stamp corresponding to any moment when the metadata of the graph database is changed at any moment;
if the stored metadata time stamp corresponding to the transmission is consistent with the metadata time stamp, the JSON data used in the next transmission does not store preset metadata information;
if the stored metadata time stamp corresponding to the current transmission is inconsistent with the metadata time stamp, generating new preset metadata information, and storing the new preset metadata information in JSON data used in the next transmission.
7. The JSON transmission method between a graph database and a grid business system according to claim 1, wherein the preset metadata information further includes: the data type of the attribute, whether the attribute can be NULL or NULL, and whether the attribute value is unique.
8. A JSON transmission device for a grid business system and a graph database, the device comprising:
the storage module is used for storing preset metadata information in the JSON data;
the recoding module is used for recoding the Schema names and the attribute names in the JSON data according to the simplified codes corresponding to the Schema names and the attribute names in the preset metadata information to obtain recoded JSON data;
and the transmission module is used for transmitting the recoded JSON data.
9. A computer device, comprising:
a memory and a processor, the memory and the processor being communicatively connected to each other, the memory having stored therein computer instructions, the processor executing the computer instructions to perform the JSON transmission method between the graph database and the grid business system of any one of claims 1 to 7.
10. A computer readable storage medium having stored thereon computer instructions for causing a computer to perform the JSON transmission method between a graph database and a grid business system as claimed in any one of claims 1 to 7.
CN202310644117.2A 2023-06-01 2023-06-01 JSON transmission method and device between graph database and power grid service system Pending CN116668536A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310644117.2A CN116668536A (en) 2023-06-01 2023-06-01 JSON transmission method and device between graph database and power grid service system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310644117.2A CN116668536A (en) 2023-06-01 2023-06-01 JSON transmission method and device between graph database and power grid service system

Publications (1)

Publication Number Publication Date
CN116668536A true CN116668536A (en) 2023-08-29

Family

ID=87713270

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310644117.2A Pending CN116668536A (en) 2023-06-01 2023-06-01 JSON transmission method and device between graph database and power grid service system

Country Status (1)

Country Link
CN (1) CN116668536A (en)

Similar Documents

Publication Publication Date Title
US9940744B2 (en) Remote font management
CN111580884B (en) Configuration updating method, device, server and electronic equipment
US8838550B1 (en) Readable text-based compression of resource identifiers
CN111061678B (en) Service data processing method, device, computer equipment and storage medium
CN108733317B (en) Data storage method and device
JP5753946B2 (en) Method and system for downloading font files
CN114500690B (en) Interface data processing method and device, electronic equipment and storage medium
CN108763546A (en) A kind of conversion method of data format, device, storage medium and terminal
US20080313291A1 (en) Method and apparatus for encoding data
CN115208414A (en) Data compression method, data compression device, computer device and storage medium
CN104978325B (en) A kind of web page processing method, device and user terminal
WO2023169215A1 (en) Page display method and apparatus, storage medium and electronic device
CN109614592B (en) Text processing method and device, storage medium and electronic equipment
CN116668536A (en) JSON transmission method and device between graph database and power grid service system
CN114039801B (en) Short link generation method, short link analysis system, short link analysis equipment and storage medium
CN114936227A (en) Data verification method, data verification system, electronic device and storage medium
CN110504973A (en) Compressing file, decompressing method and device
CN111382379B (en) Method and terminal for importing configuration data with pictures
CN111178008A (en) Digital character-oriented data encoding method, digital character-oriented data analyzing method and digital character-oriented data encoding system
CN112788077A (en) Data acquisition method and device, computer equipment and computer-readable storage medium
CN117082124B (en) Data transmission method, device, equipment, medium and product
CN114036233A (en) Remote data synchronization method, device, equipment and storage medium
CN114938293A (en) NGINX data tracing method, device, equipment and storage medium based on block chain
CN116846600A (en) File transmission method, apparatus, computer device, storage medium, and program product
CN114416744A (en) Identification data generation method and device, computer equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination