CN113467777A - Path identification method, device and system - Google Patents

Path identification method, device and system Download PDF

Info

Publication number
CN113467777A
CN113467777A CN202010237992.5A CN202010237992A CN113467777A CN 113467777 A CN113467777 A CN 113467777A CN 202010237992 A CN202010237992 A CN 202010237992A CN 113467777 A CN113467777 A CN 113467777A
Authority
CN
China
Prior art keywords
path
recognized
operator
grammar
format
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
CN202010237992.5A
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.)
Alibaba Group Holding Ltd
Original Assignee
Alibaba Group Holding Ltd
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 Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Priority to CN202010237992.5A priority Critical patent/CN113467777A/en
Priority to PCT/CN2021/082902 priority patent/WO2021197183A1/en
Publication of CN113467777A publication Critical patent/CN113467777A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/42Syntactic analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Character Discrimination (AREA)
  • Document Processing Apparatus (AREA)

Abstract

The application discloses a path identification method, a device and a system. Wherein, the method comprises the following steps: acquiring a path to be identified; according to the comparison result of the initial character of the path to be recognized and the preset character type, when the path to be recognized accords with the target path grammar format, recognizing the path to be recognized by adopting the target path grammar, or when the path to be recognized does not accord with the target path grammar format, converting the grammar format of the path to be recognized, and recognizing the converted path by adopting the target path grammar. The method and the device solve the technical problem that the application range of the memory database is narrow due to the fact that only a specified character recognition path is adopted in the prior art.

Description

Path identification method, device and system
Technical Field
The present application relates to the field of computers, and in particular, to a method, an apparatus, and a system for path identification.
Background
Redis is a key-value storage system, which is a popular memory database, and can perform structuring processing on some commonly used data structures, for example, converting data into a list (i.e., a doubly linked list) structure, a set (i.e., an unordered set) structure, a hash (hash) structure, and the like, and providing a rich API (Application Programming Interface) for a user.
The prior art achieves the purpose of extending Redis through Redis JSON, wherein a Path syntax in Redis JSON adopts a JSONPath method to extract partial contents in a given JOSN document, and limits that only letters, numbers, $ and _ and the like can be adopted for Path, namely, the prior art can only adopt specified characters to identify paths. In addition, RedisJSON does not support the conversion of JSON format, for example, RedisJSON cannot convert JSON format to another format, thereby limiting the use of the memory database.
In view of the above problems, no effective solution has been proposed.
Disclosure of Invention
The embodiment of the application provides a path recognition method, a path recognition device and a path recognition system, which are used for at least solving the technical problem of narrow use range of a memory database caused by only adopting a specified character recognition path in the prior art.
According to an aspect of an embodiment of the present application, there is provided a path identification method, including: acquiring a path to be identified; according to the comparison result of the initial character of the path to be recognized and the preset character type, when the path to be recognized accords with the target path grammar format, recognizing the path to be recognized by adopting the target path grammar, or when the path to be recognized does not accord with the target path grammar format, converting the grammar format of the path to be recognized, and recognizing the converted path by adopting the target path grammar.
According to another aspect of the embodiments of the present application, there is also provided a path identifying apparatus, including: the acquisition module is used for acquiring a path to be identified; and the recognition module is used for recognizing the path to be recognized by adopting the target path grammar when the path to be recognized accords with the target path grammar format or converting the grammar format of the path to be recognized when the path to be recognized does not accord with the target path grammar format according to the comparison result of the initial character of the path to be recognized and the preset character type, and recognizing the converted path by adopting the target path grammar.
According to another aspect of the embodiments of the present application, there is also provided a storage medium including a stored program, wherein when the program runs, a device in which the storage medium is located is controlled to execute the above-mentioned path recognition method.
According to another aspect of the embodiments of the present application, there is also provided a processor for executing a program, where the program executes the above-mentioned path identification method.
According to another aspect of the embodiments of the present application, there is also provided a path recognition system, including: a processor; and a memory coupled to the processor for providing instructions to the processor for processing the following processing steps: acquiring a path to be identified; according to the comparison result of the initial character of the path to be recognized and the preset character type, when the path to be recognized accords with the target path grammar format, recognizing the path to be recognized by adopting the target path grammar, or when the path to be recognized does not accord with the target path grammar format, converting the grammar format of the path to be recognized, and recognizing the converted path by adopting the target path grammar.
In the embodiment of the application, a way of identifying the path to be identified by adopting different identification schemes according to different types of initial characters is adopted, after the path to be identified is obtained, the identification scheme is determined according to the comparison result of the initial characters of the path to be identified and the preset character type, wherein when the path to be identified accords with the target path grammar format, the target path grammar is adopted to identify the path to be identified; and when the path to be recognized does not accord with the target path grammar format, carrying out grammar format conversion on the path to be recognized, and recognizing the converted path by adopting the target path grammar.
According to the content, when the path to be recognized accords with the target path grammar format, the target path is directly adopted to recognize the path to be recognized; compared with the prior art, the method and the device have the advantages that the grammar format conversion of the path to be recognized is realized, and the problem that the grammar format conversion of the path to be recognized cannot be carried out in the prior art is solved. On the basis, the scheme provided by the application can realize effective recognition of the path to be recognized containing all characters, so that the range of path recognition is expanded.
Therefore, the scheme provided by the application achieves the purpose of identifying paths containing all characters, so that the technical effect of expanding the path identification range is achieved, and the technical problem that the use range of the memory database is narrow due to the fact that only the specified character identification path is adopted in the prior art is solved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the application and together with the description serve to explain the application and not to limit the application. In the drawings:
fig. 1 is a block diagram of a hardware structure of an alternative computing device for implementing a path identification method according to an embodiment of the present application;
FIG. 2 is a flow chart of a method of path identification according to an embodiment of the present application;
FIG. 3 is a schematic view of an alternative path identification method-based scenario according to an embodiment of the present application;
FIG. 4 is a schematic view of an alternative path identification method-based scenario according to an embodiment of the present application;
FIG. 5 is a schematic view of an alternative path identification method-based scenario according to an embodiment of the present application;
FIG. 6 is a schematic diagram of an alternative path identification method according to an embodiment of the present application;
FIG. 7 is a flow diagram of an alternative data format conversion according to an embodiment of the present application;
FIG. 8 is a schematic diagram of a path identification device according to an embodiment of the present application; and
FIG. 9 is a block diagram of an alternative computing device according to embodiments of the present application.
Detailed Description
In order to make the technical solutions better understood by those skilled in the art, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only partial embodiments of the present application, but not all 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.
It should be noted that the terms "first," "second," and the like in the description and claims of this application and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the application described herein are capable of operation in sequences other than those illustrated or 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.
Example 1
There is also provided, in accordance with an embodiment of the present application, an embodiment of a path identification method, to note that the steps illustrated in the flowchart of the figure may be performed in a computer system, such as a set of computer-executable instructions, and that, although a logical order is illustrated in the flowchart, in some cases, the steps illustrated or described may be performed in an order different than here.
The method provided by the first embodiment of the present application may be executed in a mobile terminal, a computer terminal, or a similar computing device. Fig. 1 shows a hardware configuration block diagram of a computing device (or mobile device) for implementing the path recognition method. As shown in fig. 1, computing device 10 (or mobile device 10) may include one or more (shown as 102a, 102b, … …, 102 n) processors 102 (processor 102 may include, but is not limited to, a processing device such as a microprocessor MCU or a programmable logic device FPGA, etc.), memory 104 for storing data, and transmission device 106 for communication functions. Besides, the method can also comprise the following steps: a display, an input/output interface (I/O interface), a universal serial BUS (BUS) port (which may be included as one of the ports of the BUS), a network interface, a power source, and/or a camera. It will be understood by those skilled in the art that the structure shown in fig. 1 is only an illustration and is not intended to limit the structure of the electronic device. For example, computing device 10 may also include more or fewer components than shown in FIG. 1, or have a different configuration than shown in FIG. 1.
It should be noted that the one or more processors 102 and/or other data processing circuitry described above may be referred to generally herein as "data processing circuitry". The data processing circuitry may be embodied in whole or in part in software, hardware, firmware, or any combination thereof. Further, the data processing circuitry may be a single, stand-alone processing module, or incorporated in whole or in part into any of the other elements in the computing device 10 (or mobile device). As referred to in the embodiments of the application, the data processing circuit acts as a processor control (e.g. selection of a variable resistance termination path connected to the interface).
The memory 104 may be used to store software programs and modules of application software, such as program instructions/data storage devices corresponding to the path identification method in the embodiment of the present application, and the processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, so as to implement the path identification method described above. The memory 104 may include high speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, memory 104 may further include memory located remotely from processor 102, which may be connected to computing device 10 via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The transmission device 106 is used for receiving or transmitting data via a network. Specific examples of such networks may include wireless networks provided by a communications provider of computing device 10. In one example, the transmission device 106 includes a Network adapter (NIC) that can be connected to other Network devices through a base station to communicate with the internet. In one example, the transmission device 106 can be a Radio Frequency (RF) module, which is used to communicate with the internet in a wireless manner.
The display may be, for example, a touch screen type Liquid Crystal Display (LCD) that may enable a user to interact with a user interface of the computing device 10 (or mobile device).
It should be noted here that in some alternative embodiments, the computer device (or mobile device) shown in fig. 1 described above may include hardware elements (including circuitry), software elements (including computer code stored on a computer-readable medium), or a combination of both hardware and software elements. It should be noted that fig. 1 is only one example of a particular specific example and is intended to illustrate the types of components that may be present in the computer device (or mobile device) described above.
In the foregoing operating environment, the present application provides the path identification method as shown in fig. 2, where fig. 3 shows a scene schematic diagram based on the path identification method, and the computing device in fig. 3 may serve as an execution subject of this embodiment, and optionally, the computing device is a terminal device capable of running Redis, for example, a computer, a tablet, and the like. As can be seen from fig. 2, the path identification method provided in the present application includes the following steps:
step S202, a path to be identified is obtained.
In step S202, the path to be recognized may be a path input by a user through an input device (e.g., a mouse, a keyboard, a touch screen, a voice input device, an image capture device), or may also be a path acquired by a computing device through a network (e.g., a path acquired from the internet through a crawler). The path to be identified may be a path in a local storage area of the computing device, or may be an access path when the user accesses the internet or other devices. It is not particularly limited in this application.
And step S204, according to the comparison result of the initial character of the path to be recognized and the preset character type, when the path to be recognized accords with the target path grammar format, recognizing the path to be recognized by adopting the target path grammar, or when the path to be recognized does not accord with the target path grammar format, converting the grammar format of the path to be recognized, and recognizing the converted path by adopting the target path grammar.
In step S204, the preset character type may be a character that JSON can recognize, for example, a letter, a number, $ and _ etc.
Optionally, as shown in fig. 3, the computing device includes a comparing module, a first recognition module, and a second recognition module, where the comparing module is configured to compare the starting character of the path to be recognized with a preset character type, and obtain a comparison result. If the comparison result indicates that the path to be recognized conforms to the target path grammar format, the first recognition module recognizes the path to be recognized by adopting the target path grammar to obtain a recognition result and outputs the recognition result; and if the comparison result indicates that the path to be recognized does not conform to the target path grammar format, the second recognition module firstly converts the grammar format of the path to be recognized, then recognizes the converted path to be recognized by adopting the target path grammar to obtain a recognition result, and outputs the recognition result. And finally, displaying the identification result by a display of the computing equipment.
In an optional scenario, the path to be identified may be a path of a user accessing a network. After the path to be identified is obtained, the computing device identifies the path to be identified by adopting the scheme provided by the embodiment to obtain an identification result, and then determines whether the path to be identified is an illegal path according to the identification result. In this scenario, the display of the computing device displays whether the path to be identified is an illegal path, or the display displays a prompt message for prompting whether the path to be identified is an illegal path.
In another alternative embodiment, after obtaining the recognition result, the computing device may further store the recognized path in a Redis database, so that the user may perform relevant data operations on the path to be recognized. Optionally, when the engine of the computing device supports the Document structure of JSON, the scene diagram shown in fig. 4 may be used to store the JSON character string; when the Document structure of JSON is not supported by the engine of the computing device, the scene diagram shown in fig. 5 can be used to implement the storage of JSON character strings.
For example, in FIG. 4, the JSON string is { "config": ip: xxx, port: xxx "}. Because the engine of the computing device shown in fig. 4 supports the Document structure of JSON, the JSON character string can be stored in the Redis database after being installed on the client of the computing device and directly operating the JSON character string through the application program interface of the JSON, and meanwhile, the Redis database returns a confirmation message to the client. The client can realize the operation of the JSON character string through a preset syntax JSON.
In FIG. 5, the JSON string is { "config": ip: xxx, and port: xxx }. Because the engine of the computing device shown in fig. 4 does not support the Document structure of JSON, before storing a JSON character string, a user first requests a key value from the Redis database, the Redis database returns the key value to the client, then the user serializes the key value into a character string and stores the character string into the Redis database, and meanwhile, the Redis database returns a confirmation message to the client. In addition, when a user needs to modify the JSON character string, the character string is firstly read, the modification is completed after the deserialization, and the modified character string is stored in the Redis database again.
Based on the schemes defined in the above steps S202 to S204, it can be known that, a manner of identifying a path to be identified by using different identification schemes according to different types of start characters is adopted, and after the path to be identified is obtained, an identification scheme is determined according to a comparison result between the start characters of the path to be identified and preset character types, wherein when the path to be identified conforms to a target path grammar format, the path to be identified is identified by using a target path grammar; and when the path to be recognized does not accord with the target path grammar format, carrying out grammar format conversion on the path to be recognized, and recognizing the converted path by adopting the target path grammar.
It is easy to notice that when the path to be recognized conforms to the grammar format of the target path, the target path is directly adopted to recognize the path to be recognized; compared with the prior art, the method and the device have the advantages that the grammar format conversion of the path to be recognized is realized, and the problem that the grammar format conversion of the path to be recognized cannot be carried out in the prior art is solved. On the basis, the scheme provided by the application can realize effective recognition of the path to be recognized containing all characters, so that the range of path recognition is expanded.
Therefore, the scheme provided by the application achieves the purpose of identifying paths containing all characters, so that the technical effect of expanding the path identification range is achieved, and the technical problem that the use range of the memory database is narrow due to the fact that only the specified character identification path is adopted in the prior art is solved.
In an alternative embodiment, as shown in fig. 3, when the path to be recognized conforms to the target path syntax format, the first recognition module in the computing device recognizes the path to be recognized using the target path syntax. Specifically, the first recognition module compares the start character with a preset character type to obtain a comparison result, determines the pointer path grammar as the target path grammar if the start character is determined to be a reverse slope operator or a double quotation mark operator based on the comparison result, and recognizes the path to be recognized by using the pointer path grammar. Wherein the preset character type comprises one of the following types: the method comprises a reverse slash operator and a double-quotation mark operator, wherein a pointer path grammar defines a character string expression in a pointer mode to acquire a value corresponding to a path to be recognized in a preset type document.
Optionally, fig. 6 shows a schematic diagram of an alternative Path recognition method, after a user inputs a Path to be recognized to a computing device, a comparison module in the computing device first compares whether a start character Path [0] of the input Path to be recognized is "or" and, if so, recognizes the Path to be recognized using a pointer Path syntax (i.e., JSONPointer). Set stores JSON strings into an arr array, for example, the computing device first uses json.set in the syntax format: set doc { "arr": 1,2,3 }, wherein doc is the name of a JSON object. If the path to be identified is: and JSON, GET doc/arr/2, and if the starting character is "/", identifying the path to be identified by adopting pointer path grammar.
In another optional embodiment, when the path to be recognized does not conform to the target path grammar format, a second recognition module in the computing device performs grammar format conversion on the path to be recognized. Specifically, the second recognition module compares the start character with a preset character type to obtain a comparison result, and if the start character is determined to be a left middle bracket operator or a point operator based on the comparison result, performs syntax format conversion on the path to be recognized. Wherein the preset character type comprises one of the following types: left bracket operator, point operator.
Still taking fig. 6 as an example for explanation, the paths to be identified are: JSON. GET doc. arr [2 ]. And because the initial character is 'the', carrying out grammar format conversion on the path to be recognized, and then recognizing the converted path by adopting a target path grammar, wherein the target path grammar is JSONPath, and the JSONPath is a method for extracting partial content from a given JSON document.
Optionally, when the path to be recognized does not conform to the syntax format of the target path, the second recognition module may perform syntax format conversion on the path to be recognized by the following steps:
an obtaining step, obtaining a current character to be processed;
a processing step, if the current character to be processed is a left brace operator, searching a right brace operator matched with the left brace operator, and adding the character between the left brace operator and the right brace operator to the converted path; if the current character to be processed is the point operator, replacing the point operator by a reverse slope operator and adding the point operator to the converted path; if the current character to be processed is the rest characters except the left brace operator and the point operator, adding the current character to the converted path;
and a judging step, namely judging whether the current character to be processed is an end character of the path to be identified, if so, obtaining the converted path, and if not, returning to the acquiring step.
Still taking fig. 6 as an example for explanation, if the path to be recognized is json. get doc. arr [2], since the starting character is ".", the second recognition module modifies ".", to "/". And as the ' is not the end character of the path to be recognized, the next character ' a ' in the path to be recognized is continuously recognized. When the [ "characters are recognized, the second recognition module detects whether the" ] "exists in the path to be recognized, if so, the element" 2 "between the" [ "]" is directly extracted, and the process is repeated until all the characters in the path to be recognized are detected.
Further, as can be seen from fig. 6, after the computing device compares the start character with the preset character type and obtains a comparison result, if it is determined that the start character is not any one of the slash operator, the double quotation mark operator, the left brace operator and the dot operator based on the comparison result, it is determined that the path to be identified is an error path, where the preset character type includes one of: a reverse slash operator, a double quote operator, a left brace operator, a point operator. That is, when it is detected that the initial character of the path to be recognized does not belong to any one of the preset character types, the path to be recognized is determined to be an error path.
It should be noted that since the XML-formatted character string includes an XML statement, a root element, a child element, and the like, the JSON-formatted character string itself cannot be directly converted into the XML-formatted character string.
In an alternative embodiment, the method for identifying a path provided by the present application may implement converting a character string in an XML format into a character string in an XML format.
Specifically, the computing device converts the language format adopted by the path to be recognized from a first format into a second format, wherein the first format is a lightweight data exchange format (e.g., JSON format), and the second format is a markup language format (e.g., XML format) or a data serialization format (e.g., YAML format).
Optionally, the computing device obtains a currently specified root element name and a child element name, outputs an array type element if the array type element exists in the path to be identified, and adds a document statement and outputs the child element name when the level of the document objectification model tree structure is one level; if the object type element exists in the path to be identified, outputting the object type element, and adding a document statement and outputting a root element name when the level of the document objectification model tree structure is one level; and if the other type elements except the group type element and the object type element exist in the path to be identified, outputting the other type elements until all the elements existing in the path to be identified are processed.
Fig. 7 shows a flow chart of an alternative data format conversion. Firstly, a user inputs a root element name rootname and a child element name arnname to a computing device, and at this time, the computing device enters an output value flow, which is known from fig. 7 and is a recursive function. In addition, as can be seen from fig. 7, different types of elements in the path to be recognized use different output modes. Optionally, the element types in the path to be recognized may include, but are not limited to, an array type, an object type, and other types except the array type and the object type, where the array type and the object type need to be added with a document declaration in XML when the level of the tree structure is one level (i.e., L ═ 1 in fig. 7).
Specifically, in fig. 7, when an array type element exists in the path to be recognized, the array type element is output, and when L is equal to 1, the child element name arnname is output; when an object type element exists in the path to be identified, outputting the object type element, and when L is equal to 1, outputting a root element name rootname; when the remaining type elements (e.g., a BOOL type element, a numeric type element, a character string type element) other than the group type element and the object type element exist in the path to be recognized, it is sufficient to directly output the type elements.
Alternatively, the following is a description of ABNF (extended bacause paradigm) on syntax:
command="exjget"
key=1*VCHAR;one or more char
path=1*VCHAR
format="FORMAT"
formattype=YAML/XML
rootname="ROOTNAME"
root=1*VCHAR
arrname="ARRNAME"
arr=1*VCHAR
SYNTAX=command key path format formattype rootname root arrname arr
based on the scheme provided by the application, the JSONPointer is compatible with the JSONPath on the basis of supporting the JSONPointer, so that two path grammars can be used, wherein the JSONPointer is a standard defined by RFC (Request For Comments) and supports all characters. . Compared with the prior art, the method and the device can identify the paths of all characters, so that the problem that the prior art can only identify the paths containing the specified characters is solved. In addition, the self device also provides the conversion function from JSON to YAML and XML, which is convenient for users to use, wherein the conversion provided by the application is standard.
It should be noted that, for simplicity of description, the above-mentioned method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the present application is not limited by the order of acts described, as some steps may occur in other orders or concurrently depending on the application. Further, those skilled in the art should also appreciate that the embodiments described in the specification are preferred embodiments and that the acts and modules referred to are not necessarily required in this application.
Through the above description of the embodiments, those skilled in the art can clearly understand that the path identification method according to the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but the former is a better implementation mode in many cases. Based on such understanding, the technical solutions of the present application may be embodied in the form of a software product, which is stored in a storage medium (e.g., ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal device (e.g., a mobile phone, a computer, a server, or a network device) to execute the method according to the embodiments of the present application.
Example 2
According to an embodiment of the present application, there is also provided a path recognition apparatus for implementing the path recognition method, as shown in fig. 8, the apparatus 80 includes: an acquisition module 801 and an identification module 803.
The acquiring module 801 is configured to acquire a path to be identified; the identifying module 803 is configured to identify, according to a comparison result between an initial character of the path to be identified and a preset character type, the path to be identified by using the target path grammar when the path to be identified conforms to the target path grammar format, or perform grammar format conversion on the path to be identified when the path to be identified does not conform to the target path grammar format, and identify the converted path by using the target path grammar.
It should be noted here that the acquiring module 801 and the identifying module 803 correspond to steps S202 to S204 in embodiment 1, and the two modules are the same as the corresponding steps in the implementation example and application scenario, but are not limited to the disclosure of the first embodiment. It should be noted that the modules described above as part of the apparatus may be run in the computing device 10 provided in the first embodiment.
In an alternative embodiment, the identification module comprises: the device comprises a first comparison module, a first determination module and a first identification module. The first comparison module is used for comparing the initial character with a preset character type to obtain a comparison result, wherein the preset character type comprises one of the following types: a reverse slash operator and a double quotation mark operator; the first determining module is used for determining the pointer path grammar as the target path grammar if the initial character is determined to be a reverse slash operator or a double-quotation mark operator based on the comparison result, wherein the pointer path grammar defines a character string expression in a pointer mode to acquire a value corresponding to a path to be recognized in a preset type document; and the first identification module is used for identifying the path to be identified by adopting the pointer path grammar.
In an alternative embodiment, the identification module comprises: the second comparison module and the first conversion module. The second comparison module is used for comparing the initial character with a preset character type to obtain a comparison result, wherein the preset character type comprises one of the following types: a left bracket operator, a point operator; and the first conversion module is used for carrying out grammar format conversion on the path to be recognized if the starting character is determined to be a left middle bracket operator or a point operator based on the comparison result.
In an alternative embodiment, the conversion module comprises: an obtaining step, obtaining a current character to be processed; a processing step, if the current character to be processed is a left brace operator, searching a right brace operator matched with the left brace operator, and adding the character between the left brace operator and the right brace operator to the converted path; if the current character to be processed is the point operator, replacing the point operator by a reverse slope operator and adding the point operator to the converted path; if the current character to be processed is the rest characters except the left brace operator and the point operator, adding the current character to the converted path; and a judging step, namely judging whether the current character to be processed is an end character of the path to be identified, if so, obtaining the converted path, and if not, returning to the acquiring step.
In an alternative embodiment, the identification module comprises: a third comparing module and a second determining module. The third comparing module is configured to compare the initial character with a preset character type to obtain a comparison result, where the preset character type includes one of: a reverse slash operator, a double quotation mark operator, a left middle bracket operator and a point operator; and a second determination module for determining the path to be identified as an error path if it is determined based on the comparison that the start character is not any of a reverse-slash operator, a double-quote operator, a left-middle-bracket operator, and a point operator.
In an optional embodiment, the path identifying apparatus further comprises: and the second conversion module is used for converting the language format adopted by the path to be identified from the first format into a second format, wherein the first format is a lightweight data exchange format, and the second format is a markup language format or a data serialization format.
In an alternative embodiment, the second conversion module comprises: the device comprises a first acquisition module and a processing module. The first obtaining module is used for obtaining the currently specified root element name and the child element name; the processing module is used for outputting the array type elements if the array type elements exist in the path to be identified, and adding the document statement and outputting the name of the sub-element when the level of the document objectification model tree structure is one level; if the object type element exists in the path to be identified, outputting the object type element, and adding a document statement and outputting a root element name when the level of the document objectification model tree structure is one level; and if the other type elements except the group type element and the object type element exist in the path to be identified, outputting the other type elements until all the elements existing in the path to be identified are processed.
Example 3
According to an embodiment of the present application, there is also provided a path recognition system for implementing the above path recognition method, the system including: a processor and a memory.
Wherein the memory is connected with the processor and is used for providing the processor with instructions for processing the following processing steps: acquiring a path to be identified; according to the comparison result of the initial character of the path to be recognized and the preset character type, when the path to be recognized accords with the target path grammar format, recognizing the path to be recognized by adopting the target path grammar, or when the path to be recognized does not accord with the target path grammar format, converting the grammar format of the path to be recognized, and recognizing the converted path by adopting the target path grammar.
As can be seen from the above, a way of recognizing a path to be recognized by using different recognition schemes according to different types of initial characters is adopted, after the path to be recognized is obtained, the recognition scheme is determined according to a comparison result of the initial characters of the path to be recognized and a preset character type, wherein when the path to be recognized conforms to a target path grammar format, the path to be recognized is recognized by using a target path grammar; and when the path to be recognized does not accord with the target path grammar format, carrying out grammar format conversion on the path to be recognized, and recognizing the converted path by adopting the target path grammar.
It is easy to notice that when the path to be recognized conforms to the grammar format of the target path, the target path is directly adopted to recognize the path to be recognized; compared with the prior art, the method and the device have the advantages that the grammar format conversion of the path to be recognized is realized, and the problem that the grammar format conversion of the path to be recognized cannot be carried out in the prior art is solved. On the basis, the scheme provided by the application can realize effective recognition of the path to be recognized containing all characters, so that the range of path recognition is expanded.
Therefore, the scheme provided by the application achieves the purpose of identifying paths containing all characters, so that the technical effect of expanding the path identification range is achieved, and the technical problem that the use range of the memory database is narrow due to the fact that only the specified character identification path is adopted in the prior art is solved.
Example 4
Embodiments of the present application may provide a computing device that may be any one of a group of computing devices. Optionally, in this embodiment, the computing device may also be replaced with a terminal device such as a mobile terminal.
Optionally, in this embodiment, the computing device may be located in at least one network device of a plurality of network devices of a computer network.
In this embodiment, the above-mentioned computing device may execute the program code of the following steps in the path identification method: acquiring a path to be identified; according to the comparison result of the initial character of the path to be recognized and the preset character type, when the path to be recognized accords with the target path grammar format, recognizing the path to be recognized by adopting the target path grammar, or when the path to be recognized does not accord with the target path grammar format, converting the grammar format of the path to be recognized, and recognizing the converted path by adopting the target path grammar.
Optionally, fig. 9 is a block diagram of a computing device according to an embodiment of the present application. As shown in fig. 9, the computing device 10 may include: one or more processors 902 (only one of which is shown), memory 904, and a peripherals interface 906.
The memory may be configured to store software programs and modules, such as program instructions/modules corresponding to the path identification method and apparatus in the embodiments of the present application, and the processor executes various functional applications and data processing by running the software programs and modules stored in the memory, so as to implement the path identification method. The memory may include high speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memories may further include a memory located remotely from the processor, which may be connected to computing device 10 via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The processor can call the information and application program stored in the memory through the transmission device to execute the following steps: acquiring a path to be identified; according to the comparison result of the initial character of the path to be recognized and the preset character type, when the path to be recognized accords with the target path grammar format, recognizing the path to be recognized by adopting the target path grammar, or when the path to be recognized does not accord with the target path grammar format, converting the grammar format of the path to be recognized, and recognizing the converted path by adopting the target path grammar.
Optionally, the processor may further execute the program code of the following steps: comparing the initial character with a preset character type to obtain a comparison result, wherein the preset character type comprises one of the following types: a reverse slash operator and a double quotation mark operator; if the initial character is determined to be a reverse slash operator or a double-quotation mark operator based on the comparison result, determining the pointer path grammar as a target path grammar, wherein the pointer path grammar defines a character string expression in a pointer mode to acquire a value corresponding to a path to be recognized in a preset type document; and identifying the path to be identified by adopting pointer path grammar.
Optionally, the processor may further execute the program code of the following steps: comparing the initial character with a preset character type to obtain a comparison result, wherein the preset character type comprises one of the following types: a left bracket operator, a point operator; if the start character is determined to be a left middle bracket operator or a point operator based on the comparison result, syntax format conversion is performed on the path to be recognized.
Optionally, the processor may further execute the program code of the following steps: an obtaining step, obtaining a current character to be processed; a processing step, if the current character to be processed is a left brace operator, searching a right brace operator matched with the left brace operator, and adding the character between the left brace operator and the right brace operator to the converted path; if the current character to be processed is the point operator, replacing the point operator by a reverse slope operator and adding the point operator to the converted path; if the current character to be processed is the rest characters except the left brace operator and the point operator, adding the current character to the converted path; and a judging step, namely judging whether the current character to be processed is an end character of the path to be identified, if so, obtaining the converted path, and if not, returning to the acquiring step.
Optionally, the processor may further execute the program code of the following steps: comparing the initial character with a preset character type to obtain a comparison result, wherein the preset character type comprises one of the following types: a reverse slash operator, a double quotation mark operator, a left middle bracket operator and a point operator; if it is determined based on the comparison that the start character is not any of the slash operator, the double prime operator, the left brace operator, and the dot operator, the path to be identified is determined to be an error path.
Optionally, the processor may further execute the program code of the following steps: and converting the language format adopted by the path to be identified from a first format into a second format, wherein the first format is a lightweight data exchange format, and the second format is a markup language format or a data serialization format.
Optionally, the processor may further execute the program code of the following steps: acquiring a currently specified root element name and a sub-element name; if the path to be identified has the array type element, outputting the array type element, and adding the document statement and outputting the name of the sub-element when the level of the document objectification model tree structure is one level; if the object type element exists in the path to be identified, outputting the object type element, and adding a document statement and outputting a root element name when the level of the document objectification model tree structure is one level; and if the other type elements except the group type element and the object type element exist in the path to be identified, outputting the other type elements until all the elements existing in the path to be identified are processed.
It can be understood by those skilled in the art that the structure shown in fig. 9 is only an illustration, and the computing device may also be a terminal device such as a smart phone (e.g., an Android phone, an iOS phone, etc.), a tablet computer, a palmtop computer, a Mobile Internet Device (MID), a PAD, and the like. Fig. 9 is a diagram illustrating a structure of the electronic device. For example, computing device 10 may also include more or fewer components (e.g., network interfaces, display devices, etc.) than shown in FIG. 9, or have a different configuration than shown in FIG. 9.
Those skilled in the art will appreciate that all or part of the steps in the methods of the above embodiments may be implemented by a program instructing hardware associated with the terminal device, where the program may be stored in a computer-readable storage medium, and the storage medium may include: flash disks, Read-Only memories (ROMs), Random Access Memories (RAMs), magnetic or optical disks, and the like.
Example 5
Embodiments of the present application also provide a storage medium. Optionally, in this embodiment, the storage medium may be configured to store a program code executed by the path identification method provided in the first embodiment.
Optionally, in this embodiment, the storage medium may be located in any one of computing devices in a computing device group in a computer network, or in any one of mobile terminals in a mobile terminal group.
Optionally, in this embodiment, the storage medium is configured to store program code for performing the following steps: acquiring a path to be identified; according to the comparison result of the initial character of the path to be recognized and the preset character type, when the path to be recognized accords with the target path grammar format, recognizing the path to be recognized by adopting the target path grammar, or when the path to be recognized does not accord with the target path grammar format, converting the grammar format of the path to be recognized, and recognizing the converted path by adopting the target path grammar.
Optionally, in this embodiment, the storage medium is configured to store program code for performing the following steps: comparing the initial character with a preset character type to obtain a comparison result, wherein the preset character type comprises one of the following types: a reverse slash operator and a double quotation mark operator; if the initial character is determined to be a reverse slash operator or a double-quotation mark operator based on the comparison result, determining the pointer path grammar as a target path grammar, wherein the pointer path grammar defines a character string expression in a pointer mode to acquire a value corresponding to a path to be recognized in a preset type document; and identifying the path to be identified by adopting pointer path grammar.
Optionally, in this embodiment, the storage medium is configured to store program code for performing the following steps: comparing the initial character with a preset character type to obtain a comparison result, wherein the preset character type comprises one of the following types: a left bracket operator, a point operator; if the start character is determined to be a left middle bracket operator or a point operator based on the comparison result, syntax format conversion is performed on the path to be recognized.
Optionally, in this embodiment, the storage medium is configured to store program code for performing the following steps: an obtaining step, obtaining a current character to be processed; a processing step, if the current character to be processed is a left brace operator, searching a right brace operator matched with the left brace operator, and adding the character between the left brace operator and the right brace operator to the converted path; if the current character to be processed is the point operator, replacing the point operator by a reverse slope operator and adding the point operator to the converted path; if the current character to be processed is the rest characters except the left brace operator and the point operator, adding the current character to the converted path; and a judging step, namely judging whether the current character to be processed is an end character of the path to be identified, if so, obtaining the converted path, and if not, returning to the acquiring step.
Optionally, in this embodiment, the storage medium is configured to store program code for performing the following steps: comparing the initial character with a preset character type to obtain a comparison result, wherein the preset character type comprises one of the following types: a reverse slash operator, a double quotation mark operator, a left middle bracket operator and a point operator; if it is determined based on the comparison that the start character is not any of the slash operator, the double prime operator, the left brace operator, and the dot operator, the path to be identified is determined to be an error path.
Optionally, in this embodiment, the storage medium is configured to store program code for performing the following steps: and converting the language format adopted by the path to be identified from a first format into a second format, wherein the first format is a lightweight data exchange format, and the second format is a markup language format or a data serialization format.
Optionally, in this embodiment, the storage medium is configured to store program code for performing the following steps: acquiring a currently specified root element name and a sub-element name; if the path to be identified has the array type element, outputting the array type element, and adding the document statement and outputting the name of the sub-element when the level of the document objectification model tree structure is one level; if the object type element exists in the path to be identified, outputting the object type element, and adding a document statement and outputting a root element name when the level of the document objectification model tree structure is one level; and if the other type elements except the group type element and the object type element exist in the path to be identified, outputting the other type elements until all the elements existing in the path to be identified are processed.
The above-mentioned serial numbers of the embodiments of the present application are merely for description and do not represent the merits of the embodiments.
In the above embodiments of the present application, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
In the embodiments provided in the present application, it should be understood that the disclosed technology can be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one type of division of logical functions, and there may be other divisions when actually implemented, for example, a plurality of units or components may be combined or may be integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, units or modules, and may be in an electrical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be substantially implemented or contributed to by the prior art, or all or part of the technical solution may be embodied in a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic or optical disk, and other various media capable of storing program codes.
The foregoing is only a preferred embodiment of the present application and it should be noted that those skilled in the art can make several improvements and modifications without departing from the principle of the present application, and these improvements and modifications should also be considered as the protection scope of the present application.

Claims (11)

1. A method for path identification, comprising:
acquiring a path to be identified;
according to the comparison result of the initial character of the path to be recognized and the preset character type, when the path to be recognized conforms to a target path grammar format, recognizing the path to be recognized by adopting a target path grammar, or when the path to be recognized does not conform to the target path grammar format, performing grammar format conversion on the path to be recognized, and recognizing the converted path by adopting the target path grammar.
2. The method of claim 1, wherein according to the comparison result between the starting character and the preset character type, when the path to be recognized conforms to the target path grammar format, recognizing the path to be recognized by using the target path grammar comprises:
comparing the initial character with the preset character type to obtain a comparison result, wherein the preset character type comprises one of the following types: a reverse slash operator and a double quotation mark operator;
if the initial character is determined to be a reverse slash operator or a double-quotation mark operator based on the comparison result, determining a pointer path grammar as the target path grammar, wherein the pointer path grammar defines a character string expression in a pointer mode to acquire a value corresponding to the path to be recognized in a preset type document;
and identifying the path to be identified by adopting the pointer path grammar.
3. The method of claim 1, wherein, according to the comparison result between the starting character and the preset character type, when the path to be recognized does not conform to the target path grammar format, performing grammar format conversion on the path to be recognized comprises:
comparing the starting character with the preset character type to obtain the comparison result, wherein the preset character type comprises one of the following types: a left bracket operator, a point operator;
and if the starting character is determined to be a left middle bracket operator or a point operator based on the comparison result, carrying out syntax format conversion on the path to be recognized.
4. The method of claim 3, wherein the syntax format converting the path to be recognized comprises:
an obtaining step, obtaining a current character to be processed;
a processing step, if the current character to be processed is a left brace operator, searching a right brace operator matched with the left brace operator, and adding characters between the left brace operator and the right brace operator to the converted path; if the current character to be processed is a point operator, replacing the point operator by a reverse slope operator and adding the reverse slope operator to the converted path; if the current character to be processed is the rest characters except the left brackets operator and the point operator, adding the current character to the converted path;
and a judging step, namely judging whether the current character to be processed is an end character of the path to be recognized, if so, obtaining the converted path, and if not, returning to the acquiring step.
5. The method of claim 1, wherein according to the comparison result between the starting character and the preset character type, when the path to be recognized conforms to the target path grammar format, recognizing the path to be recognized by using the target path grammar comprises:
comparing the starting character with the preset character type to obtain the comparison result, wherein the preset character type comprises one of the following types: a reverse slash operator, a double quotation mark operator, a left middle bracket operator and a point operator;
determining the path to be identified as an erroneous path if it is determined based on the comparison that the start character is not any of a slash operator, a double prime operator, a left brace operator, and a point operator.
6. The method of claim 1, further comprising:
and converting the language format adopted by the path to be identified from a first format into a second format, wherein the first format is a lightweight data exchange format, and the second format is a markup language format or a data serialization format.
7. The method of claim 6, wherein converting the language format used by the path to be identified from the first format to the second format comprises:
acquiring a currently specified root element name and a sub-element name;
if the path to be identified has an array type element, outputting the array type element, and adding a document statement and outputting the sub-element name when the level of the document objectification model tree structure is one level; if the path to be identified has an object type element, outputting the object type element, and adding the document statement and outputting the root element name when the level of the document objectification model tree structure is one level; and if the path to be recognized has other type elements except the array type element and the object type element, outputting the other type elements until all the elements in the path to be recognized are processed.
8. A path identifying device, comprising:
the acquisition module is used for acquiring a path to be identified;
and the recognition module is used for recognizing the path to be recognized by adopting a target path grammar when the path to be recognized accords with a target path grammar format according to a comparison result of the initial character of the path to be recognized and a preset character type, or converting the grammar format of the path to be recognized when the path to be recognized does not accord with the target path grammar format, and recognizing the converted path by adopting the target path grammar.
9. A storage medium, characterized in that the storage medium includes a stored program, wherein when the program runs, a device in which the storage medium is located is controlled to execute the path recognition method according to any one of claims 1 to 7.
10. A processor configured to run a program, wherein the program when running performs the path recognition method of any one of claims 1 to 7.
11. A path identification system, comprising:
a processor; and
a memory coupled to the processor for providing instructions to the processor for processing the following processing steps:
acquiring a path to be identified;
according to the comparison result of the initial character of the path to be recognized and the preset character type, when the path to be recognized conforms to a target path grammar format, recognizing the path to be recognized by adopting a target path grammar, or when the path to be recognized does not conform to the target path grammar format, performing grammar format conversion on the path to be recognized, and recognizing the converted path by adopting the target path grammar.
CN202010237992.5A 2020-03-30 2020-03-30 Path identification method, device and system Pending CN113467777A (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202010237992.5A CN113467777A (en) 2020-03-30 2020-03-30 Path identification method, device and system
PCT/CN2021/082902 WO2021197183A1 (en) 2020-03-30 2021-03-25 Path recognition method, device and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010237992.5A CN113467777A (en) 2020-03-30 2020-03-30 Path identification method, device and system

Publications (1)

Publication Number Publication Date
CN113467777A true CN113467777A (en) 2021-10-01

Family

ID=77864934

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010237992.5A Pending CN113467777A (en) 2020-03-30 2020-03-30 Path identification method, device and system

Country Status (2)

Country Link
CN (1) CN113467777A (en)
WO (1) WO2021197183A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2023092437A1 (en) * 2021-11-26 2023-06-01 京东方科技集团股份有限公司 Intelligent calculation method and intelligent interactive tablet

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114697390B (en) * 2022-03-31 2023-12-08 中国工商银行股份有限公司 XML message processing method and device, storage medium and electronic equipment

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10061805B2 (en) * 2015-02-25 2018-08-28 Sumo Logic, Inc. Non-homogenous storage of events in event data store
CN107168971B (en) * 2016-03-07 2020-10-27 阿里巴巴集团控股有限公司 Data processing method and device for webpage application
US11481383B2 (en) * 2017-11-15 2022-10-25 Sumo Logic, Inc. Key name synthesis
CN108446313B (en) * 2018-02-06 2021-06-04 北京极智感科技有限公司 Data format conversion method and device
CN110149339A (en) * 2019-05-27 2019-08-20 浪潮云信息技术有限公司 A kind of method and system for realizing AWS API based on RESTful API

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2023092437A1 (en) * 2021-11-26 2023-06-01 京东方科技集团股份有限公司 Intelligent calculation method and intelligent interactive tablet

Also Published As

Publication number Publication date
WO2021197183A1 (en) 2021-10-07

Similar Documents

Publication Publication Date Title
CN107861713B (en) Data calling method and device and computer readable storage medium
CN107809383B (en) MVC-based path mapping method and device
CN106407201B (en) Data processing method and device and computer readable storage medium
CN107168971B (en) Data processing method and device for webpage application
CN111683066B (en) Heterogeneous system integration method, heterogeneous system integration device, computer equipment and storage medium
CN106649446B (en) Information pushing method and device
CN113467777A (en) Path identification method, device and system
CN104714942A (en) Method and system for usablility of content to natural language processing tasks.
CN110895481A (en) Rendering method, device and system of desktop application
CN108933968A (en) A kind of conversion method of message format, device, storage medium and android terminal
WO2014177033A1 (en) Input method invoking method and invoking device, and terminal
CN112887451A (en) Domain name resolution method and device and computer equipment
CN105278928A (en) IVR external interface configuration method and IVR external interface configuration device
US20110093525A1 (en) System and method for profiling remote user interface
CN114253441B (en) Method and device for enabling target function, storage medium and electronic device
CN114721640A (en) Code completion method and device, storage medium, processor and terminal
CN114489603A (en) Code generation method, apparatus, electronic device, medium, and product
CN110471708B (en) Method and device for acquiring configuration items based on reusable components
CN112306591B (en) Remote debugging method and device based on page
CN113268232A (en) Page skin generation method and device and computer readable storage medium
CN111078215A (en) Software product application method and device, storage medium and electronic equipment
CN114679504B (en) UDP message parsing method and device and computer equipment
CN116483483B (en) Data query method and device and electronic equipment
CN113825166B (en) Base station testing method and device, electronic equipment and storage medium
CN113296827A (en) Method and device for converting different languages and terminal equipment

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
REG Reference to a national code

Ref country code: HK

Ref legal event code: DE

Ref document number: 40063930

Country of ref document: HK