Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the technical solutions of the present application will be described in detail and completely with reference to the following specific embodiments of the present application and the accompanying drawings. It should be apparent that the described embodiments are only some of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Hereinafter, embodiments will be described in more detail with reference to the accompanying drawings. Like numbers refer to like elements throughout.
The data processing method provided by one or more embodiments of the present specification can be executed by a data processing device, and the data processing device can be any electronic device having computing and data processing functions and a storage function. In one or more embodiments of the present description, an electronic device may include, but is not limited to, any of the following devices having a display unit: personal Computers (PCs), mobile devices such as cellular phones, Personal Digital Assistants (PDAs), digital cameras, portable game consoles, MP3 players, portable/Personal Multimedia Players (PMPs), handheld electronic books, tablet PCs, portable laptop PCs, and Global Positioning System (GPS) navigators, smart TVs, and the like.
To more clearly describe one or more embodiments of the present specification, reference will now be made to the terms used.
JSON (JavaScript Object Notification) is a lightweight data interaction format that is based on a subset of ECMAScript. JSON employs a text format that is completely language independent, but also uses the conventions of the type C language family. These features make JSON an ideal data exchange language for human reading and writing, as well as for machine parsing and generation.
Editable forms: the form data can be submitted using the JSON format, and non-technical personnel (e.g., operators) can modify the front-end displayed information (e.g., store names, merchandise information, etc.) in the background through editable forms, without requiring either technical personnel to participate or the source code to be modified.
FIG. 1 is a logic diagram that illustrates an editable form in accordance with one or more embodiments of the present specification. It should be noted that the editable form in fig. 1 corresponds to a multi-layer data structure edited in a progressive expanding manner according to one or more embodiments of the present specification, and the multi-layer data structure will be described in detail below with reference to fig. 1.
As described in fig. 1, an editable form edited by a multi-layer data structure may be regarded as a tree structure, and each node in the editable form constitutes a main branch of the tree structure. The outermost node of the edit form is a root node, and the edit form includes three layers, that is, the corresponding data structure of the edit form is a three-layer data structure, but this is only exemplary and not limiting.
Alternatively, the editable form shown in FIG. 1 may be edited using a progressive expansion approach. Specifically, the step-by-step expansion mode includes: and only presenting the current node and not displaying the subordinate nodes of the current node, and displaying the subordinate nodes of the current node and hiding the superior nodes of the current node after the current node is triggered. For example, when the first-layer data structure is edited, only a single line of description information is edited for the child node, and if the user clicks to enter the child node, the data structure of the child node is expanded, and the data structure of the upper-layer node of the child node is completely folded. This is clearly distinguished from the editing of nodes in the prior art, where all nodes, regardless of their data type, can be edited to be displayed in their entirety in an editable form.
The data types in the data structure can comprise a basic type and a set type, and the data structures of different types correspond to different form input modes. Specifically, the basic types include Number, String, Color, URL, text, etc., and the collection types include Array, Object. The child nodes in the nodes of the set type may be either basic types or set types, and the set types may be nested with each other, that is, the child nodes in the nodes of the set type may be set types.
In the process of editing the multi-layer data structure corresponding to the plurality of nodes in a step-by-step expansion manner, in order to make the data description more concise, the data structure related to the nodes may be redefined in a syntax description manner, for example, the nodes may be defined in the following manner:
Object(person){
name(User Name)
}
it can be seen that the example contains only one level of data structure, with the root node being "person" and the nodes being "User Name".
In addition, when editing the data structure, a check type description may be added after a field describing the data type in the data structure, that is, a definition condition is added to the field in the data structure, for example, an association relationship between the fields in the data structure is added, as shown below:
Object(foo){
a(a):Number[max:10},min:0],
b(b):Array{c(c):String}
d(d):Color[if:“$.a>1”]
}
it can be seen that the association relationship between the fields is added after the fields a and d, i.e. the value range of the field a is 0 to 10, and d is displayed when a is greater than 1. It can be seen that by adding the association relationship between a and d, a conditional restriction is added to the display node d.
The resulting multi-level data structure may then be parsed into data that is directly usable by the program, i.e., each node accessed directly by the program is traversed.
The grammar analysis is realized by classical editing principle technology in the computer field. Specifically, the input character string is first analyzed sequentially to obtain some basic elements in the grammar description, for example, object, (, this becomes a token analysis process, then after obtaining tokens, these tokens are combined to obtain a grammar structure conforming to the predetermined description, if the combination is not within the range of the predetermined grammar structure, the description is illegal, and an error prompt can be presented on the screen.
The parsed multi-level data structure is then rendered into an editable form. The edit form is rendered in the rendering stage starting from the root node and then all nodes of the first level are rendered in turn, while all nodes in the first level have different rendering processing logic according to the respective data types (including base type and set type), e.g., for a node of a base type, number such as in the first node in fig. 1 can be rendered as a digital selector and string can be rendered as a standard input box.
While for a node of the collection type, it may be rendered as only a single button, the child elements in the collection are not displayed, and when the node is triggered (e.g., clicked on), the next level may be entered and rendered. For example, as described in FIG. 1, when object1 is triggered, the second level can be entered and rendered for various nodes of the second level, and likewise, when object2 is triggered, the third level can be entered and rendered for various nodes of the third level.
As is apparent from the above description, when editing a multi-layer data structure that expands stepwise, it is necessary to switch between levels, but in the multi-layer data structure, since the level of an edited node in the entire data structure cannot be accurately grasped, modification cannot be performed. In particular, when a child node in an editable form is modified, the child node cannot confirm its "position" in the multi-layer data structure, where the "position" refers to the position of the child node in the multi-layer data structure. For example, as shown in fig. 1, when the third level number 3 is modified, the user can only see the root node and the number 3 node on the interface, and cannot know the position of the number 3 node in the whole edit form. Whereas a modification to node number 3 must know the location from the root node to number 3. In this regard, the following will be described in detail with reference to fig. 3.
As described above, one or more embodiments of the present specification redefine the data structure using the syntax description, so that the description is concise, and in particular, for the multi-layer data structure, a step-by-step expansion manner is adopted, so that a user can focus on only the current node, thereby facilitating the display and processing. In addition, the data structure disclosed by one or more embodiments of the specification can be used for increasing the definition condition of the field in the programming process, so that the node can be displayed more optimally.
FIG. 2 is a diagram illustrating state management processing according to one or more embodiments of the present specification.
Specifically, the identifiers of the nodes may be sequentially stored in the state management unit according to the time sequence in which the nodes are triggered, wherein the identifiers of the nodes may be obtained from a data structure corresponding to the nodes.
For example, the available state management array represents a first level node, e.g., [ 'object1' ], and when the rendezvous node is triggered and enters the next level, the node of the next level can be added to the array, e.g., [ 'object1', 'object 2' ], and if returned to the previous level node, the corresponding state management array is [ 'object1' ].
Fig. 3 is a flow diagram illustrating a data processing method according to one or more embodiments of the present description.
In step S310, the multi-layer data structure corresponding to the plurality of nodes is edited in a step-by-step expansion manner, which has been described in detail above with reference to fig. 1 and will not be described again here.
In step S320, when a node receives a modification event, modification information and an identifier of the node are acquired. Specifically, a user (e.g., an operator) may modify a node on a visualization form, the modification including modifying the content of the node, deleting or replacing the node, and the like, and then, modification information may be obtained according to the modification, that is, modification content related to the modification this time, for example, modifying a node representing a shop name from "AA" to "BB", and the modification information is "BB". Further, the identity of the node is obtained from the data structure of the node.
In step S330, node information stored in the state management unit is determined. In particular, when a node receives a modification event, it may read node information stored in the state management unit, wherein the node information includes the location and identity of each node that was triggered before the node, which has been described in detail above with reference to fig. 2 and will not be described again here.
In step S340, a data modification path is determined according to the node identifier and the node information in the state management unit. The data modification path includes nodes that pass from the root node to the node, that is, the node can determine its position in the multi-layer structure through the data modification path.
Step S340 will now be explained in detail in connection with the example in fig. 4.
As shown in fig. 4, when node number 3 is modified, number 3 may transmit modification information and location information to the root node, where the location information may be represented by an array, i.e., [ 'number 3' ], and then read the arrays in the state management array, i.e., [ 'object1', 'object 2' ], thereby determining that the data modification path is [ 'object1', 'object 2', 'number 3' ].
In step S350, modifying the source data corresponding to the node according to the data modification path, specifically, determining the position of the node in the data modification path according to the data modification path; modifying, at the location of the node, source data corresponding to the node with modification information. As described in fig. 4, in the case where it is determined that the data modification path is [ 'object1', 'object 2', 'number 3', ] it may be determined that the node number 3 to be modified is located below the nodes 'object1', 'object 2', and then, starting from the root node, passes through 'object1', 'object 2' to reach 'number 3', and then, the source data at 'number 3' is modified using the modification information.
Compared with the prior art, the data processing method of one or more embodiments of the specification edits the multilayer data structure in a step-by-step expansion mode, so that the code segment of the multilayer data structure is short, easy to read and easy to display, and a user can only focus on the current node; and determining a data modification path by using the identifier of the node and the node information in the state management unit, and modifying the node according to the data modification path, so that the position of the node to be modified in the multilayer data structure is quickly and accurately positioned, and the modification of the multilayer node is completed. In addition, the data processing method according to one or more embodiments of the present disclosure has high compatibility, and can be applied to various systems. Furthermore, by redefining the data structure by using the grammatical description, the description is concise, and on the basis, the association relationship between the fields can be increased in the programming process, so that the limitation condition is increased. In this regard, the data processing method according to one or more embodiments of the present disclosure allows a technician to easily program with a defined data structure and allows a non-technician to visually edit and maintain data.
In order to more clearly understand the inventive concept of one or more embodiments of the present specification, a block diagram of a data processing apparatus according to one or more embodiments of the present specification will be described below with reference to fig. 5. Those of ordinary skill in the art will understand that: the data processing apparatus in fig. 5 shows only components related to the present exemplary embodiment, and general components other than those shown in fig. 5 are also included in the data processing apparatus 500.
FIG. 5 is a diagram of a data processing device according to one or more embodiments of the present description. As shown in fig. 5, the data processing apparatus 500 includes an editing unit 510, an acquisition unit 520, a state management unit 530, a modification path determination unit 540, and a modification unit 550.
The editing unit 510 edits a multi-layer data structure corresponding to a plurality of nodes in a stepwise expanding manner. Optionally, the step-by-step unfolding mode includes: and only presenting the current node and not displaying the subordinate nodes of the current node, and displaying the subordinate nodes of the current node and hiding the superior nodes of the current node after the current node is triggered.
The obtaining unit 520 obtains the modification information and the identifier of a certain node of the plurality of nodes when the node receives the modification event. Specifically, a user (e.g., an operator) may modify a node on a visualization form, the modification including modifying the content of the node, deleting or replacing the node, etc., and then may determine modification information based on the modification, that is, determine the modified content involved in the modification, for example, modifying a node representing a shop name from "AA" to "BB", the modification information being "BB", and determine the identity of the node based on the data structure of the node.
The state management unit 530 may store node information. Optionally, the node information includes a location and an identity of each node that was triggered before the node.
The modified path determining unit 540 determines a data modified path according to the node identifier and the node information in the state management unit. The data modification path includes nodes that pass from the root node to the node, that is, the node can determine its position in the multi-layer structure through the data modification path.
The modifying unit 550 modifies the source data corresponding to the node according to the data modification path, specifically, determines the position of the node in the data modification path according to the data modification path; modifying, at the location of the node, source data corresponding to the node with modification information.
Alternatively, the nodes may be represented based on data structures defined by JSON in a syntactically described manner.
Optionally, the data structure comprises: a check type description following a field in the data structure describing a data type.
Optionally, the step-by-step unfolding mode includes: and only presenting the current node and not displaying the subordinate nodes of the current node, and displaying the subordinate nodes of the current node and hiding the superior nodes of the current node after the current node is triggered.
As described above, the data processing apparatus according to one or more embodiments of the present specification may edit the multi-layered data structure in a stepwise expansion manner, so that code segments of the multi-layered data structure are short, easy to read, and easy to display, thereby allowing a user to focus on only a current node; and determining a data modification path by using the identifier of the node and the node information in the state management unit, and modifying the node according to the data modification path, so that the position of the node to be modified in the multilayer data structure is quickly and accurately positioned, and the modification of the multilayer node is completed. In addition, the data processing method according to one or more embodiments of the present disclosure has high compatibility, and can be applied to various systems. Furthermore, by redefining the data structure by using the grammatical description, the description is concise, and on the basis, the association relationship between the fields can be increased in the programming process, so that the limitation condition is increased. In this regard, the data processing method according to one or more embodiments of the present disclosure may allow a technician to conveniently program with a defined JSON data structure, and allow a non-technician to visually edit and maintain data.
Fig. 6 shows a block diagram of an electronic device that executes a data processing method according to one or more embodiments of the present specification. Referring to fig. 6, at the hardware level, the electronic device includes a processor, an internal bus, a network interface, a memory, and a non-volatile memory, but may also include hardware required for other services. The processor reads the corresponding computer program from the nonvolatile memory into the memory and then runs the computer program to form the data processing device on the logic level. Of course, besides software implementation, the one or more embodiments in this specification do not exclude other implementations, such as logic devices or combinations of software and hardware, and so on, that is, the execution subject of the following processing flow is not limited to each logic unit, and may also be hardware or logic devices.
In the 90 s of the 20 th century, improvements in a technology could clearly distinguish between improvements in hardware (e.g., improvements in circuit structures such as diodes, transistors, switches, etc.) and improvements in software (improvements in process flow). However, as technology advances, many of today's process flow improvements have been seen as direct improvements in hardware circuit architecture. Designers almost always obtain the corresponding hardware circuit structure by programming an improved method flow into the hardware circuit. Thus, it cannot be said that an improvement of the process flow cannot be realized with hardware physical units. For example, a Programmable Logic Device (PLD), such as a Field Programmable Gate Array (FPGA), is an integrated circuit whose Logic functions are determined by programming the Device by a user. A digital system is "integrated" on a PLD by the designer's own programming without requiring the chip manufacturer to design and fabricate application-specific integrated circuit chips. Furthermore, nowadays, instead of manually making an integrated Circuit chip, such Programming is often implemented by "logic compiler" software, which is similar to a software compiler used in program development and writing, but the original code before compiling is also written by a specific Programming Language, which is called Hardware Description Language (HDL), and HDL is not only one but many, such as abel (advanced Boolean Expression Language), ahdl (alternate Language Description Language), traffic, pl (core unified Programming Language), HDCal, JHDL (Java Hardware Description Language), langue, Lola, HDL, laspam, hardsradware (Hardware Description Language), vhjhd (Hardware Description Language), and vhigh-Language, which are currently used in most common. It will also be apparent to those skilled in the art that hardware circuitry that implements the logical method flows can be readily obtained by merely slightly programming the method flows into an integrated circuit using the hardware description languages described above.
The controller may be implemented in any suitable manner, for example, the controller may take the form of, for example, a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro) processor, logic gates, switches, an Application Specific Integrated Circuit (ASIC), a programmable logic controller, and an embedded microcontroller, examples of which include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320, the memory controller may also be implemented as part of the control logic for the memory. Those skilled in the art will also appreciate that, in addition to implementing the controller as pure computer readable program code, the same functionality can be implemented by logically programming method steps such that the controller is in the form of logic gates, switches, application specific integrated circuits, programmable logic controllers, embedded microcontrollers and the like. Such a controller may thus be considered a hardware component, and the means included therein for performing the various functions may also be considered as a structure within the hardware component. Or even means for performing the functions may be regarded as being both a software element for performing the method and a structure within a hardware component.
The systems, devices, units or units illustrated in the above embodiments may be specifically implemented by computer chips or entities, or implemented by products with certain functions. One typical implementation device is a computer. In particular, the computer may be, for example, a personal computer, a laptop computer, a cellular telephone, a camera phone, a smartphone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
For convenience of description, the above devices are described as being divided into various units by function, and are described separately. Of course, the functionality of the various elements may be implemented in the same one or more software and/or hardware implementations in implementing one or more embodiments of the present description.
One skilled in the art will recognize that one or more embodiments of the present description may be provided as a method, system, or computer program product. Accordingly, one or more embodiments of the present description may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, one or more embodiments of the present description may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
One or more embodiments of the present description are described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to one or more embodiments of the description. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. Information may be computer readable instructions, data structures, units of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
As will be appreciated by one skilled in the art, one or more embodiments of the present description may be provided as a method, system, or computer program product. Accordingly, one or more embodiments of the present description may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, one or more embodiments of the present description may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
One or more embodiments of the present description may be described in the general context of computer-executable instructions, such as program elements, being executed by a computer. Generally, program elements include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. One or more embodiments of the specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program elements may be located in both local and remote computer storage media including memory storage devices.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The above description is merely one or more embodiments of the present disclosure and is not intended to limit the present disclosure. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.