CN110929100B - Method and device for acquiring value taking path, storage medium and electronic equipment - Google Patents

Method and device for acquiring value taking path, storage medium and electronic equipment Download PDF

Info

Publication number
CN110929100B
CN110929100B CN201911013440.XA CN201911013440A CN110929100B CN 110929100 B CN110929100 B CN 110929100B CN 201911013440 A CN201911013440 A CN 201911013440A CN 110929100 B CN110929100 B CN 110929100B
Authority
CN
China
Prior art keywords
value
target
attribute
data string
path
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.)
Active
Application number
CN201911013440.XA
Other languages
Chinese (zh)
Other versions
CN110929100A (en
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.)
Neusoft Corp
Original Assignee
Neusoft Corp
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 Neusoft Corp filed Critical Neusoft Corp
Priority to CN201911013440.XA priority Critical patent/CN110929100B/en
Publication of CN110929100A publication Critical patent/CN110929100A/en
Application granted granted Critical
Publication of CN110929100B publication Critical patent/CN110929100B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/80Information retrieval; Database structures therefor; File system structures therefor of semi-structured data, e.g. markup language structured data such as SGML, XML or HTML
    • G06F16/81Indexing, e.g. XML tags; Data structures therefor; Storage structures

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The disclosure relates to a method, a device, a storage medium and an electronic device for obtaining a value taking path, wherein the method comprises the following steps: acquiring a target attribute value selected by a user from a displayed data string with a target format; and acquiring a first value-taking path corresponding to the target attribute value according to the nested structure of the data string, wherein the first value-taking path is used for representing the nested relation of the target attribute value in the nested structure. The method can acquire the value taking path of the attribute value selected by the user in the displayed target markup language string according to the nested structure of the target markup language string, and can extract the markup language data without professional knowledge, thereby improving the readability and controllability of the markup language data extraction process and reducing the labor cost of the markup language data operation.

Description

Method and device for acquiring value taking path, storage medium and electronic equipment
Technical Field
The present disclosure relates to the field of information management, and in particular, to a method and an apparatus for obtaining a value taking path, a storage medium, and an electronic device.
Background
Currently, in the process of network data exchange, in order to ensure the integrity of data, it is usually necessary to transmit network data by using a structural Markup Language, for example, JSON (JavaScript Object Notation) statement or XML (Extensible Markup Language) and the like. The service data, the service attributes and various symbols contained in the JSON or XML data string transmitted in the network are all output in plain text without any visual format, and the readability and operability of the plain text form data string are poor, so that the service data and the service attributes with various types and complex subordination relations are difficult to distinguish, and therefore, a value taking path of each service data needs to be obtained in a certain mode.
In the related art, in the value taking process of the service data in the JSON or XML data string, an operator is usually required to traverse and search the service data and the service attributes in the JSON or XML data string according to professional knowledge, and sum up value taking paths required for extracting values of different service data, so as to complete extraction of the service data value according to the value taking paths. The obtaining process of the value taking path needs to be manually completed by an operator according to professional knowledge, the whole process is long in time consumption, the operation is complex, and the labor cost is high.
Disclosure of Invention
To overcome the problems in the related art, an object of the present disclosure is to provide a method, an apparatus, a storage medium, and an electronic device for obtaining a value taking path.
In order to achieve the above object, according to a first aspect of the embodiments of the present disclosure, there is provided a method for obtaining a value taking path, the method including:
acquiring a target attribute value selected by a user from a displayed data string with a target format;
and acquiring a first value-taking path corresponding to the target attribute value according to the nested structure of the data string, wherein the first value-taking path is used for representing the nested relation of the target attribute value in the nested structure.
Optionally, the obtaining, according to the nested structure of the data string, a first value taking path corresponding to the target attribute value includes:
determining a relation tree for characterizing the nested structure, wherein leaf nodes of the relation tree correspond to attribute values in the data string, and each node except leaf nodes in the relation tree corresponds to an attribute in the data string;
determining a target leaf node corresponding to the target attribute value in the relation tree;
acquiring a nested relation branch containing a root node of the relation tree and the target leaf node from the relation tree;
and acquiring attribute identification of attributes corresponding to each node except the target leaf node in the nested relation branch so as to acquire the first value taking path.
Optionally, after the first value-taking path corresponding to the target attribute value is obtained according to the nested structure of the data string, the method further includes:
establishing a first corresponding relation between a target attribute corresponding to the target attribute value and a target attribute name selected by a user from a plurality of preset attribute names;
and displaying the target attribute value and the target attribute corresponding to the target attribute value according to the first corresponding relationship and a preset second corresponding relationship, wherein the second corresponding relationship is used for recording the corresponding relationship between the attribute value and the displayed value.
Optionally, the displaying the target attribute value and the target attribute corresponding to the target attribute value according to the first corresponding relationship and a preset second corresponding relationship includes:
determining a target attribute name corresponding to the target attribute according to the first corresponding relation;
determining a target display value corresponding to the target attribute value according to the second corresponding relation;
and displaying the target attribute name and the target display value.
Optionally, the attribute value is included in an array or an object, and the method further includes:
and merging a plurality of value paths corresponding to different attribute values in the same target array from the plurality of displayed value paths into a second value path, wherein the second value path corresponds to the target array.
Optionally, the method further includes:
when a second value taking path input by a user through a path input interface is received, an attribute value corresponding to the second value taking path is identified in the data string.
Optionally, before the obtaining of the target attribute value selected by the user from the displayed data string having the target format, the method further includes:
and displaying the data string in a target format corresponding to a preset typesetting language according to the attribute and the nested structure of the attribute values in the data string.
According to a second aspect of the embodiments of the present disclosure, there is provided an apparatus for obtaining a value-taking path, the apparatus including:
the attribute value acquisition module is used for acquiring a target attribute value selected by a user from the displayed data string with the target format;
and the path acquisition module is used for acquiring a first value-taking path corresponding to the target attribute value according to the nested structure of the data string, wherein the first value-taking path is used for representing the nested relation of the target attribute value in the nested structure.
Optionally, the path obtaining module is configured to:
determining a relationship tree for characterizing the nested structure, wherein leaf nodes of the relationship tree correspond to attribute values in the data string, and each node in the relationship tree except leaf child nodes corresponds to an attribute in the data string;
determining a corresponding target leaf node of the target attribute value in the relation tree;
acquiring a nested relation branch containing a root node of the relation tree and the target leaf node from the relation tree;
and acquiring attribute identification of attributes corresponding to each node except the target leaf node in the nested relation branch so as to acquire the first value taking path.
Optionally, the apparatus further comprises:
the relation establishing module is used for establishing a first corresponding relation between a target attribute corresponding to the target attribute value and a target attribute name selected by a user from a plurality of preset attribute names;
and the attribute value display module is used for displaying the target attribute value and the target attribute corresponding to the target attribute value according to the first corresponding relationship and a preset second corresponding relationship, and the second corresponding relationship is used for recording the corresponding relationship between the attribute value and the display value.
Optionally, the attribute value presentation module is configured to:
determining a target attribute name corresponding to the target attribute according to the first corresponding relation;
determining a target display value corresponding to the target attribute value according to the second corresponding relation;
and displaying the target attribute name and the target display value.
Optionally, the attribute value is included in an array or an object, and the apparatus further includes:
and the path merging module is used for merging a plurality of value taking paths corresponding to different attribute values in the same target array from the plurality of displayed value taking paths into a second value taking path, and the second value taking path corresponds to the target array.
Optionally, the apparatus further comprises:
and the attribute value identification module is used for identifying the attribute value corresponding to the second value-taking path in the data string when the second value-taking path input by the user through the path input interface is received.
Optionally, the apparatus further comprises:
and the data string display module is used for displaying the data string in a target format corresponding to a preset typesetting language according to the attribute and the nested structure of the attribute value in the data string.
According to a third aspect of the embodiments of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored, and the computer program, when executed by a processor, implements the steps of the method for obtaining a value taking path provided in the first aspect of the embodiments of the present disclosure.
According to a fourth aspect of embodiments of the present disclosure, there is provided an electronic apparatus including:
a memory having a computer program stored thereon;
a processor, configured to execute the computer program in the memory, so as to implement the steps of the method for obtaining a value path provided in the first aspect of the embodiment of the present disclosure.
Through the technical scheme, the method can obtain the target attribute value selected by the user from the displayed data string with the target format, wherein the target format is a JavaScript object numbered notation JSON format or an extensible markup language XML format; and acquiring a first value path corresponding to the target attribute value according to the nested structure of the data string, wherein the first value path is used for representing the nested relation of the target attribute value in the nested structure. The method can acquire the value taking path of the attribute value selected by the user in the displayed target markup language string according to the nested structure of the target markup language string, and can extract the markup language data without professional knowledge, thereby improving the readability and controllability of the markup language data extraction process and reducing the labor cost of the markup language data operation.
Additional features and advantages of the disclosure will be set forth in the detailed description which follows.
Drawings
The accompanying drawings, which are included to provide a further understanding of the disclosure and are incorporated in and constitute a part of this specification, illustrate embodiments of the disclosure and together with the description serve to explain the disclosure, but do not constitute a limitation of the disclosure. In the drawings:
FIG. 1 is a flow diagram illustrating a method of obtaining a value taking path in accordance with an exemplary embodiment;
fig. 2 is a flowchart illustrating a value-taking path obtaining method according to the embodiment shown in fig. 1;
FIG. 3 is a flow diagram illustrating another method for obtaining a value-taking path according to the embodiment shown in FIG. 1;
FIG. 4 is a flowchart illustrating another method for obtaining a value taking path according to the embodiment shown in FIG. 3;
FIG. 5 is a flowchart illustrating another method for obtaining a value taking path according to the embodiment shown in FIG. 4;
FIG. 6 is a flow diagram illustrating another method for obtaining a value-taking path according to the embodiment shown in FIG. 5;
FIG. 7 is a block diagram illustrating an apparatus for obtaining a value taking path in accordance with an example embodiment;
FIG. 8 is a block diagram of another apparatus for obtaining a value taking path according to the embodiment shown in FIG. 7;
FIG. 9 is a block diagram of another apparatus for obtaining a value taking path according to the embodiment shown in FIG. 8;
FIG. 10 is a block diagram of another apparatus for obtaining a value taking path according to the embodiment shown in FIG. 9;
FIG. 11 is a block diagram of another apparatus for obtaining a value taking path according to the embodiment shown in FIG. 10;
FIG. 12 is a block diagram illustrating an electronic device in accordance with an example embodiment.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. The following description refers to the accompanying drawings in which the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the exemplary embodiments below do not represent all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the disclosure, as detailed in the appended claims.
Fig. 1 is a flowchart illustrating a method for obtaining a value taking path according to an exemplary embodiment, where as shown in fig. 1, the method includes:
step 101, obtaining a target attribute value selected by a user from a displayed data string with a target format.
The target format is a JSON (JavaScript Object Notation) format or an XML (Extensible Markup Language) format.
Illustratively, JSON is a syntax used to serialize objects, arrays, values, strings, boolean values, and null values (null). For two more specific and common data types, namely an object and an array, the JSON language has the following syntax rules: objects are represented as key-value pairs, data are separated by commas, curly brackets hold objects, square brackets hold arrays. Specifically, the JSON data string is a nested structure of objects (key value pairs), and the key value pair at the uppermost layer is also nested with an array, a numerical value, a character string, a boolean value, null, and other objects (key value pairs). In the disclosed embodiment, the numeric values, strings, boolean values, and null are referred to as attribute values (actually, the lowest-level values in a key-value pair nesting structure), while the arrays and objects are actually sets for defining a plurality of the above-described attribute values and the way the sets are composed. And the keys in the objects are attributes corresponding to the attribute values. The XML data string records attributes through tags formed by brackets in the non-tag set, and stores attribute values by using a set of tags (i.e. the content between a tag and an end tag matching the tag is an attribute value). It will be appreciated that in an XML data string, attributes and attribute values are actually bound in the same one-to-one correspondence as the key-value pairs described above.
Illustratively, the JSON or XML data string is a set of a plurality of service data having JSON or XML format acquired through a network interface of a third-party service website. When the service system is connected to a network interface of a third-party service website and receives JSON or XML data (i.e., a JSON or XML data string containing service data) which is returned by the network interface and conforms to the JSON or XML standard, the service data in the JSON or XML data string needs to be extracted and converted for other service applications associated with the service of the third-party website. As described above, the JSON or XML data string stores the service data and the service attribute of the service data in the form of a nested structure, but the service data, the service attribute, and various symbols included in the JSON or XML data string acquired through the network interface are all output in the form of plain text without any visualization format. Therefore, after the JSON data string is obtained, the JSON or XML data string needs to be accurately displayed in a format corresponding to HTML (Hyper Text Markup Language), so that the JSON or XML Language has stronger readability, and a user can select service data (that is, a target attribute value) in the displayed JSON or XML data string. It should be noted that, for the JSON data string, the JSON data string may be first displayed in a format corresponding to XML.
And 102, acquiring a first value taking path corresponding to the target attribute value according to the nested structure of the data string.
And the first value taking path is used for representing the nesting relation of the target attribute value in the nesting structure.
Illustratively, as described above, the JSON or XML data string can be viewed as a nested structure of objects in the form of key-value pairs, and the first value-taking path is a nested relationship from the uppermost key (attribute) to the target attribute value in the nested structure. After a user clicks or inputs a target attribute value through a display interface, a first value taking path corresponding to the target attribute value can be obtained and displayed. After the first value-taking path is obtained, the first value-taking path can be displayed, so that a user can obtain the value-taking path corresponding to the selected target attribute value; or, the first value-taking path may be used as a path for acquiring the target attribute value by a certain service website, application program, or database, so as to introduce the target attribute value into the service website, application program, or database.
To sum up, the method can obtain the target attribute value selected by the user from the displayed data string with the target format, wherein the target format is a JavaScript object notation JSON format or an extensible markup language XML format; and acquiring a first value-taking path corresponding to the target attribute value according to the nested structure of the data string, wherein the first value-taking path is used for representing the nested relation of the target attribute value in the nested structure. The method can acquire the value taking path of the attribute value selected by the user in the displayed target markup language string according to the nested structure of the target markup language string, and can extract the markup language data without professional knowledge, thereby improving the readability and controllability of the markup language data extraction process and reducing the labor cost of the markup language data operation.
Fig. 2 is a flowchart of a value-taking path obtaining method according to the embodiment shown in fig. 1, and as shown in fig. 2, the step 102 may include:
at step 1021, a relationship tree for characterizing the nested structure is determined.
Wherein the leaf nodes of the relational tree correspond to attribute values in the data string, and each node except leaf child nodes in the relational tree corresponds to an attribute in the data string.
Step 1022, determine the corresponding target leaf node of the target attribute value in the relationship tree.
Step 1023, the nested relation branch containing the root node of the relation tree and the target leaf node is obtained from the relation tree.
Step 1024, obtaining attribute identifications of attributes corresponding to each node except the target leaf node in the nested relation branch to obtain the first value taking path.
Illustratively, the nested structure is a tree structure, and when the first value taking path is obtained, a unique nested relation branch that simultaneously contains a root node of the relation tree and a target leaf node corresponding to a target attribute value in the relation tree can be directly obtained. The value-taking path is an attribute identifier of the attribute corresponding to each node in the nested relation branch, and the target leaf node corresponds to the attribute value rather than the attribute, so that the identifier is not required to be obtained. The attribute identifications are arranged according to the sequence from the root node to the parent node of the target leaf node and are connected by using a ". or"/"symbol, namely, the first value taking path is identified. It should be noted that, when the value corresponding to the attribute is an object, the attribute identifier is an attribute name of the attribute in the JSON or XML data string, and when the value corresponding to the attribute is an array, the attribute identifier is an attribute name of the attribute in the JSON or XML data string + an array subscript used for representing the position of the attribute value in the attribute in the array; when the value corresponding to the attribute is data (i.e., an attribute value), the attribute identifier of the attribute is arranged at the last end of the value-taking path.
Fig. 3 is a flowchart of another method for obtaining a value-taking path according to the embodiment shown in fig. 2, and as shown in fig. 3, after the step 102, the method may further include:
step 103, a first corresponding relation is established between the target attribute corresponding to the target attribute value and a target attribute name selected by the user from a plurality of preset attribute names.
And 104, displaying the target attribute value and the target attribute corresponding to the target attribute value according to the first corresponding relation and a preset second corresponding relation.
And the second corresponding relation is used for recording the corresponding relation between the attribute value and the display value.
For example, while the value taking path of the target attribute value is obtained, the target attribute value and the target attribute directly corresponding to the target attribute value may also be displayed. The JSON or XML data string is obtained from a third-party website, and the displayed names of the target attribute value and the target attribute in the JSON or XML data string are not necessarily suitable for the business system of the local side, so that the target attribute value or the target attribute can be converted according to the business requirements of the local side. Specifically, the business system may provide an area for displaying a plurality of attribute names set in advance. When the user clicks the target attribute value and then clicks the attribute name in the area, a corresponding relationship can be established between the target attribute corresponding to the target attribute value and the attribute name. For each target attribute value, the corresponding relationship between the attribute value and the display value may be set at the initialization stage of the business system.
Illustratively, this step 104 includes: determining a target attribute name corresponding to the target attribute according to the first corresponding relation; determining a target display value corresponding to the target attribute value according to the second corresponding relation; and displaying the target attribute name and the target display value. For example, the attribute of an attribute in JSON or XML data string is identified as G, and the attribute value is boolean data 0 or 1. In the initialization stage, the display value of 0 may be set as the character "woman", the display value of 0 may be set as the character "man", and then a corresponding relationship is established between the attribute "G" and the attribute name "gender" by a user click operation. As such, after the user clicks on the target attribute value, "gender" can be displayed directly: "female" or "gender": "men" rather than the original, unintelligible english abbreviations and numbers in JSON or XML data strings.
Fig. 4 is a flowchart of another method for obtaining a value-taking path according to the embodiment shown in fig. 3, and as shown in fig. 4, the method may further include:
and 105, combining a plurality of the displayed value paths corresponding to different attribute values in the same target array into a second value path, wherein the second value path corresponds to the target array.
For example, after the step 102 is performed for multiple times, multiple value paths are displayed in the service system interface, and the value paths include array indexes for the attribute values included in the array. Taking JSON data strings as an example, the plurality of value paths include: $. data.list [0]. provice, $. data.list [1]. provice, and $. data.list [2]. provice, where [0], [1], and [2] are array indices for identifying that the three value paths correspond to the first, second, and third array elements in the target array list, respectively. At this time, the user may click the three second value taking paths in sequence to select the three second value taking paths for merging. The merged third value path is $. In addition, the symbol "$" therein is an attribute identifier of an attribute corresponding to a root node of a relationship tree of a JSON data string, and when service data is serialized by using the JSON format, the attribute is not usually the top-level attribute (that is, the attribute corresponding to the root node) for performing the business processing, so the symbol "$" is usually used as the first attribute identifier in the value taking path in the embodiment of the present disclosure. For the XML data string, the plurality of value paths may include: and based on the same combination method, the value paths can be combined into/response/LINKS/LINK _ ID, wherein LINKS is an array identification used for representing the whole target array.
Fig. 5 is a flowchart of another method for obtaining a value-taking path according to the embodiment shown in fig. 4, and as shown in fig. 5, the method may further include:
and 106, when a second value taking path input by the user through the path input interface is received, identifying an attribute value corresponding to the second value taking path in the data string.
Illustratively, when the user determines that the first value-taking path displayed in the step 102 has an error, or the user knows that a value-taking path wants to find the attribute value corresponding to the value-taking path in JSON or XML data, the user may input the second value-taking path in a path input interface (e.g., an input box) provided in the service system interface. Then, the system can determine a corresponding CSS selector expression (i.e., an identifier separated by ". or"/"in the fetch path) according to the second fetch path input by the user, further generate a DOM structure according to the expression, find an attribute value corresponding to the second fetch path in a JSON or XML data transmission displayed in an HTML format according to the DOM structure, and identify the attribute value in the JSON or XML data displayed in the HTML format in a manner of highlighting a background, changing a font color, or the like.
Fig. 6 is a flowchart of another method for obtaining a value-taking path according to the embodiment shown in fig. 5, as shown in fig. 6, before the step 101, the method may further include:
and step 107, displaying the data string in a target format corresponding to a preset typesetting language according to the attribute and the nested structure of the attribute values in the data string.
Illustratively, the above steps 101-106 are all performed based on the visual display of the JSON or XML data string. Specifically, after the plain text JSON data string is obtained from the third-party website, a format tag in the HTML language can be added to each attribute and attribute value in the JSON data string according to the nested structure (i.e., tree structure) of the JSON or XML data string (actually, an empty line, an indentation, and a carriage return are added to the JSON or XML data string according to the nested structure), and then the nested structure of the JSON or XML data string is displayed more intuitively.
To sum up, the method can obtain the target attribute value selected by the user from the displayed data string with the target format, wherein the target format is a JavaScript object notation JSON format or an extensible markup language XML format; and acquiring a first value-taking path corresponding to the target attribute value according to the nested structure of the data string, wherein the first value-taking path is used for representing the nested relation of the target attribute value in the nested structure. The method can visually display the markup language data string, further obtain the value taking path of the attribute value selected by the user in the displayed markup language data string according to the nested structure of the markup language data string, provide a mechanism for visually converting the attribute value and simplifying the value taking path, realize the extraction and conversion of the markup language data without professional knowledge, improve the readability and controllability of the extraction and conversion process of the markup language data, and reduce the labor cost of the operation of the markup language data.
Fig. 7 is a block diagram illustrating an apparatus for obtaining a value taking path according to an exemplary embodiment, where, as shown in fig. 7, the apparatus 700 includes:
an attribute value obtaining module 710, configured to obtain a target attribute value selected by a user from a displayed data string having a target format, where the target format is a JavaScript object notation format or an extensible markup language XML format;
the path obtaining module 720 is configured to obtain a first value-taking path corresponding to the target attribute value according to the nested structure of the data string, where the first value-taking path is used to represent a nested relationship of the target attribute value in the nested structure.
Optionally, the path obtaining module 620 is configured to:
determining a relation tree for representing the nested structure, wherein leaf nodes of the relation tree correspond to attribute values in the data string, and each node except leaf child nodes in the relation tree corresponds to an attribute in the data string;
determining a corresponding target leaf node of the target attribute value in the relation tree;
acquiring a nested relation branch containing a root node of the relation tree and the target leaf node from the relation tree;
and acquiring attribute identifications of attributes corresponding to each node except the target leaf node in the nested relation branch so as to acquire the first value taking path.
Fig. 8 is a block diagram of another apparatus for obtaining a value-taking path according to the embodiment shown in fig. 7, as shown in fig. 8, the apparatus 700 further includes:
a relationship establishing module 730, configured to establish a first corresponding relationship between a target attribute corresponding to the target attribute value and a target attribute name selected by a user from a plurality of preset attribute names;
the attribute value display module 740 is configured to display the target attribute value and the target attribute corresponding to the target attribute value according to the first corresponding relationship and a preset second corresponding relationship, where the second corresponding relationship is used to record a corresponding relationship between the attribute value and the display value.
Optionally, the attribute value presentation module 740 is configured to:
determining a target attribute name corresponding to the target attribute according to the first corresponding relation;
determining a target display value corresponding to the target attribute value according to the second corresponding relation;
and displaying the target attribute name and the target display value.
Fig. 9 is a block diagram of another apparatus for obtaining a value taking path according to the embodiment shown in fig. 8, where as shown in fig. 9, the attribute value is included in an array or an object, and the apparatus 700 further includes:
a path merging module 750, configured to merge multiple value paths corresponding to different attribute values in the same target array from the multiple value paths shown into a second value path, where the second value path corresponds to the target array.
Fig. 10 is a block diagram of another apparatus for obtaining a value taking path according to the embodiment shown in fig. 9, as shown in fig. 10, the apparatus 700 further includes:
the attribute value identifying module 760 is configured to, when a second value-taking path input by the user through the path input interface is received, identify an attribute value corresponding to the second value-taking path in the data string.
Fig. 11 is a block diagram of another apparatus for obtaining a value taking path according to the embodiment shown in fig. 10, as shown in fig. 11, the apparatus 700 further includes:
a data string display module 770, configured to display the data string in a target format corresponding to a preset composition language according to the attribute and the nested structure of the attribute value in the data string.
To sum up, the method can obtain the target attribute value selected by the user from the displayed data string with the target format, wherein the target format is a JavaScript object notation JSON format or an extensible markup language XML format; and acquiring a first value path corresponding to the target attribute value according to the nested structure of the data string, wherein the first value path is used for representing the nested relation of the target attribute value in the nested structure. The method can visually display the markup language data string, further obtain the value taking path of the attribute value selected by the user in the displayed markup language data string according to the nested structure of the markup language data string, provide a mechanism for visually converting the attribute value and simplifying the value taking path, realize the extraction and conversion of the markup language data without professional knowledge, improve the readability and controllability of the extraction and conversion process of the markup language data, and reduce the labor cost of the operation of the markup language data.
With regard to the apparatus in the above embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be described in detail here.
Fig. 12 is a block diagram illustrating an electronic device 1200 in accordance with an example embodiment. As shown in fig. 12, the electronic device 1200 may include: a processor 1201, memory 1202, multimedia components 1203, input/output (I/O) interfaces 1204, and communication components 1205.
The processor 1201 is configured to control the overall operation of the electronic device 1200, so as to complete all or part of the steps in the above method for obtaining a value taking path. The memory 1202 is used to store various types of data to support operation of the electronic device 1200, such as instructions for any application or method operating on the electronic device 1200 and application-related data, such as contact data, messaging, pictures, audio, video, and so forth. The Memory 1202 may be implemented by any type or combination of volatile and non-volatile Memory devices, such as Static Random Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read-Only Memory (EPROM), Programmable Read-Only Memory (PROM), Read-Only Memory (ROM), magnetic Memory, flash Memory, magnetic or optical disk. The multimedia components 1203 may include screen and audio components. Wherein the screen may be, for example, a touch screen and the audio component is used for outputting and/or inputting audio signals. For example, the audio component may include a microphone for receiving external audio signals. The received audio signals may further be stored in the memory 1202 or transmitted over the communication component 1205. The audio assembly also includes at least one speaker for outputting audio signals. The I/O interface 1204 provides an interface between the processor 1201 and other interface modules, such as a keyboard, a mouse, buttons, and the like. These buttons may be virtual buttons or physical buttons. The communication component 1205 is used for wired or wireless communication between the electronic device 1200 and other devices. Wireless Communication, such as Wi-Fi, bluetooth, Near Field Communication (NFC), 2G, 3G, or 4G, or a combination of one or more of them, so that the corresponding Communication component 1205 can include: Wi-Fi module, bluetooth module, NFC module.
In an exemplary embodiment, the electronic Device 1200 may be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components for performing the above-described method for obtaining a path.
In another exemplary embodiment, a computer readable storage medium, such as the memory 1202, is also provided that includes program instructions executable by the processor 1201 of the electronic device 1200 to perform the above-described method of obtaining a value taking path.
Preferred embodiments of the present disclosure are described in detail above with reference to the accompanying drawings, however, the present disclosure is not limited to the specific details of the above embodiments, and other embodiments of the present disclosure may be easily conceived by those skilled in the art within the technical spirit of the present disclosure after considering the description and practicing the present disclosure, and all fall within the protection scope of the present disclosure.
It should be noted that the various features described in the foregoing embodiments may be combined in any suitable manner without contradiction. Meanwhile, any combination can be made between various different embodiments of the disclosure, and the disclosure should be regarded as the disclosure of the disclosure as long as the concept of the disclosure is not violated. The present disclosure is not limited to the precise structures that have been described above, and the scope of the present disclosure is limited only by the appended claims.

Claims (9)

1. A method for obtaining a value taking path is characterized by comprising the following steps:
acquiring a target attribute value selected by a user from a displayed data string with a target format;
acquiring a first value path corresponding to the target attribute value according to the nested structure of the data string, wherein the first value path is used for representing the nested relation of the target attribute value in the nested structure;
the acquiring a first value path corresponding to the target attribute value according to the nested structure of the data string includes:
determining a relationship tree for characterizing the nested structure, wherein leaf nodes of the relationship tree correspond to attribute values in the data string, and each node in the relationship tree except leaf child nodes corresponds to an attribute in the data string;
determining a corresponding target leaf node of the target attribute value in the relation tree;
acquiring a nested relation branch containing a root node of the relation tree and the target leaf node from the relation tree;
and acquiring attribute identification of attributes corresponding to each node except the target leaf node in the nested relation branch so as to acquire the first value taking path.
2. The method according to claim 1, wherein after the obtaining, according to the nested structure of the data string, the first value-taking path corresponding to the target attribute value, the method further includes:
establishing a first corresponding relation between a target attribute corresponding to the target attribute value and a target attribute name selected by a user from a plurality of preset attribute names;
and displaying the target attribute value and the target attribute corresponding to the target attribute value according to the first corresponding relationship and a preset second corresponding relationship, wherein the second corresponding relationship is used for recording the corresponding relationship between the attribute value and the displayed value.
3. The method according to claim 2, wherein the displaying the target attribute value and the target attribute corresponding to the target attribute value according to the first corresponding relationship and a preset second corresponding relationship comprises:
determining a target attribute name corresponding to the target attribute according to the first corresponding relation;
determining a target display value corresponding to the target attribute value according to the second corresponding relation;
and displaying the target attribute name and the target display value.
4. The method of claim 2, wherein the attribute values are contained in an array or object, the method further comprising:
and merging a plurality of value paths corresponding to different attribute values in the same target array from the plurality of displayed value paths into a second value path, wherein the second value path corresponds to the target array.
5. The method of claim 4, further comprising:
when a second value taking path input by a user through a path input interface is received, an attribute value corresponding to the second value taking path is identified in the data string.
6. The method of claim 5, wherein prior to said obtaining a user selected target attribute value from the presented data string in the target format, the method further comprises:
and displaying the data string with the target format in the target format corresponding to the preset typesetting language according to the attribute and the nested structure of the attribute value in the data string with the target format.
7. An apparatus for obtaining a value-taking path, the apparatus comprising:
the attribute value acquisition module is used for acquiring a target attribute value selected by a user from the displayed data string with the target format;
a path obtaining module, configured to obtain a first value-taking path corresponding to the target attribute value according to a nested structure of the data string, where the first value-taking path is used to represent a nested relationship of the target attribute value in the nested structure;
the path acquisition module is configured to:
determining a relation tree for characterizing the nested structure, wherein leaf nodes of the relation tree correspond to attribute values in the data string, and each node except leaf nodes in the relation tree corresponds to an attribute in the data string;
determining a target leaf node corresponding to the target attribute value in the relation tree;
acquiring a nested relation branch containing a root node of the relation tree and the target leaf node from the relation tree;
and acquiring attribute identification of attributes corresponding to each node except the target leaf node in the nested relation branch so as to acquire the first value taking path.
8. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 6.
9. An electronic device, comprising:
a memory having a computer program stored thereon;
a processor for executing the computer program in the memory to implement the steps of the method of any one of claims 1-6.
CN201911013440.XA 2019-10-23 2019-10-23 Method and device for acquiring value taking path, storage medium and electronic equipment Active CN110929100B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911013440.XA CN110929100B (en) 2019-10-23 2019-10-23 Method and device for acquiring value taking path, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911013440.XA CN110929100B (en) 2019-10-23 2019-10-23 Method and device for acquiring value taking path, storage medium and electronic equipment

Publications (2)

Publication Number Publication Date
CN110929100A CN110929100A (en) 2020-03-27
CN110929100B true CN110929100B (en) 2022-08-19

Family

ID=69849277

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911013440.XA Active CN110929100B (en) 2019-10-23 2019-10-23 Method and device for acquiring value taking path, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN110929100B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111538486B (en) * 2020-04-01 2024-02-13 北京小米松果电子有限公司 Layout file nesting layer number screening method and device and electronic equipment
CN113434152A (en) * 2021-08-24 2021-09-24 北京交研智慧科技有限公司 Software development method, system and readable storage medium

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1730652A4 (en) * 2004-04-02 2009-11-11 Samsung Electronics Co Ltd Xml processor having function for filtering tree path, method of filtering tree path and recording medium thereof
CN107016071B (en) * 2017-03-23 2019-06-18 中国科学院计算技术研究所 A kind of method and system using simple path characteristic optimization tree data
CN109062560B (en) * 2018-07-25 2022-05-20 北京百度网讯科技有限公司 Method and apparatus for generating information
CN109871519A (en) * 2019-02-18 2019-06-11 北京思特奇信息技术股份有限公司 A kind of the JSON unserializing method, apparatus and storage medium of no hierarchical structure

Also Published As

Publication number Publication date
CN110929100A (en) 2020-03-27

Similar Documents

Publication Publication Date Title
US11514033B2 (en) System for providing dynamic linked panels in user interface
US20210334250A1 (en) Construction of database schema models for database systems and rest api's
CN106708480B (en) Management platform implementation method and device
CN109033260B (en) Knowledge graph interactive visual query method based on RDF
KR102345007B1 (en) Patent document creating device, method, computer program, computer-readable recording medium, server and system
US8065267B2 (en) Information processing device, file data merging method, file naming method, and file data output method
US9817811B2 (en) Web server system, dictionary system, dictionary call method, screen control display method, and demonstration application generation method
US11301643B2 (en) String extraction and translation service
CN110928763A (en) Test method, test device, storage medium and computer equipment
KR101951719B1 (en) A web reporting design system with programming event handling by using graphic interface
KR20150085716A (en) Setup Method for Web Scraping Data Extraction
CN110929100B (en) Method and device for acquiring value taking path, storage medium and electronic equipment
JP2016048470A (en) Application test support apparatus, data processing method thereof, and program
US11392753B2 (en) Navigating unstructured documents using structured documents including information extracted from unstructured documents
US10372760B2 (en) Building queries directed to objects hosted on clouds
US20210004524A1 (en) Catalog file creation assistance device, catalog file creation assistance method, and catalog file creation assistance program
CN116610558A (en) Code detection method, device, electronic equipment and computer readable storage medium
CN110780970A (en) Data screening method, device, equipment and computer readable storage medium
US20090228678A1 (en) Mapping definition creation system and mapping definition creation program
CN112685678B (en) Page configuration method, page configuration device, computer equipment and storage medium
CN117608568B (en) Configuration interface generation method, device, equipment and storage medium
US8719245B2 (en) Query templates with functional template blocks
Bamfo An implementation of a web platform to support free recycling in Ghana
Ismay et al. Getting Used to r, RStudio, and r Markdown
WO2017057451A1 (en) Database interface provision program, database interface provision method, and database interface provision device

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
GR01 Patent grant
GR01 Patent grant