Method and apparatus for semantic information query of multi-version unstructured data
By extending the Cypher query language and abstract syntax tree, and combining it with an artificial intelligence model, semantic information querying of multi-version unstructured data was achieved, solving the problem of version querying in existing technologies and improving the accuracy and efficiency of the query.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-22
- Publication Date
- 2026-03-06
AI Technical Summary
Existing technologies cannot effectively support version queries of unstructured data objects and semantic information. Graph data query languages cannot achieve semantic information queries of multi-version unstructured data at the syntactic level.
By extending the Cypher query language, modifying the parsing of query statements and optimizing query plans, and using abstract syntax trees to represent multi-version unstructured data, and combining artificial intelligence models to obtain semantic information version numbers, semantic information querying of multi-version unstructured data is achieved.
It supports semantic information querying of multi-version unstructured data, and can represent data versions at the syntactic level and obtain the semantic information of the corresponding version, thereby improving the accuracy and efficiency of the query.
Smart Images

Figure CN115357682B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of unstructured data, artificial intelligence, query languages, and databases, and aims to provide a method and apparatus for semantic information querying of multi-version unstructured data. Background Technology
[0002] Unstructured data refers to long texts, images, videos, audio, and other unstructured data. Unstructured data is typically stored in computer systems as a string of binary code. A common characteristic of this type of data is its large size and incomprehensibility by computers. User queries regarding unstructured data primarily focus on retrieving information from within the data—information that is semantic and understandable; this is called semantic information. Traditional data query techniques cannot target the semantic information of unstructured data. However, advancements in artificial intelligence (AI) have opened up new directions for the analysis and querying of unstructured data. Currently, AI technology can achieve high accuracy in tasks such as facial recognition, object recognition, speech recognition, and sentiment analysis. Therefore, AI technology can be used to extract information from unstructured data, thereby driving the development of unstructured data querying techniques.
[0003] Semantic information querying of unstructured data is essentially a query for a certain state of an object under certain rules. Unstructured data is essentially a description of a certain state of an object; when the object's state changes, the content of the unstructured data also changes, which can be considered a version change of the unstructured data object. Simultaneously, changes in semantic information extraction rules also cause version changes in semantic information. Existing technologies can only query one or a few semantic information items of a single unstructured data object, and cannot achieve querying of specific versions of unstructured data objects and their semantic information.
[0004] Furthermore, relationships are prevalent between entities in the natural world, and graph models model data based on these relationships, effectively highlighting the connections between entities. Therefore, graph models are also widely used in the management and querying of unstructured data. However, existing graph data query languages do not support version queries for unstructured data objects and semantic information at the syntactic level. Summary of the Invention
[0005] To address the aforementioned issues, this invention, based on existing graph data query languages, expands the syntax representation, modifies the parsing of query statements, and optimizes and executes the query plan to realize a semantic information query method and apparatus for multi-version unstructured data, capable of supporting the query of semantic information for multi-version unstructured data.
[0006] The technical content of this invention includes:
[0007] A method for semantic information querying of multi-version unstructured data, the method comprising:
[0008] Obtain the query statement; wherein the query statement includes: a node lookup operator and unstructured data objects connected by a first connector, and semantic information names;
[0009] The query statement is parsed into an abstract syntax tree; wherein the abstract syntax tree includes: node lookup node, version extraction node, object attribute calculation node, and semantic information calculation node;
[0010] Run the node lookup operator at the node lookup node to obtain the specified object attribute calculation node;
[0011] Based on the query statement, the version number of the unstructured data object and semantic information name is obtained at the version extraction node;
[0012] At the specified object attribute calculation node, the attribute value of the unstructured data object is calculated based on the version number of the unstructured data object and the unstructured data object.
[0013] The semantic information calculation node obtains the semantic information query results based on the attribute values of the unstructured data object, the semantic information name, and the version number of the semantic information name.
[0014] Further, the step of obtaining the version number of the unstructured data object and semantic information name based on the query statement at the version extraction node includes:
[0015] Read the query statement;
[0016] When reading an unstructured data object or semantic information name, determine whether it is immediately followed by a second connector;
[0017] If the second connector is immediately followed, all characters between the specified symbols are read to obtain the version number of the unstructured data object or semantic information name;
[0018] If there is no second connector immediately following it, the version number of the latest version of the unstructured data object or the latest version of the semantic information name is used as the version number of the unstructured data object or the semantic information name.
[0019] Furthermore, the designated symbols include angle brackets.
[0020] Furthermore, the query statement is derived by extending the Cypher query language.
[0021] Furthermore, the unstructured data objects include nodes and relationships.
[0022] Further, the version number of the semantic information name is generated through the following steps:
[0023] Obtain the semantic information corresponding to the semantic information name;
[0024] Obtain the version number of the AI model that extracted the semantic information;
[0025] The version number of the artificial intelligence model is regarded as the version number of the semantic information name.
[0026] A semantic information query device for multi-version unstructured data includes:
[0027] The query statement acquisition module is used to acquire query statements; wherein, the query statement includes: a node lookup operator and unstructured data objects connected by a first connector, and semantic information names;
[0028] The query statement parsing module is used to parse the query statement into an abstract syntax tree; wherein the abstract syntax tree includes: a node lookup node, a version extraction node, an object attribute calculation node, and a semantic information calculation node; the node lookup operator is run at the node lookup node to obtain the specified object attribute calculation node; the version extraction node obtains the version number of the unstructured data object and the semantic information name based on the query statement; the specified object attribute calculation node calculates the attribute value of the unstructured data object based on the version number of the unstructured data object and the unstructured data object; the semantic information calculation node obtains the semantic information query result based on the attribute value of the unstructured data object, the semantic information name, and the version number of the semantic information name.
[0029] A storage medium storing a computer program, wherein the computer program is configured to execute the above-described semantic information query method for multi-version unstructured data at runtime.
[0030] A computer device includes a memory and a processor, the memory storing a computer program, and the processor being configured to run the computer program to perform the above-described semantic information query method for multi-version unstructured data.
[0031] A computer program product, when run on a computer device, causes the computer device to execute the aforementioned semantic information query method for multi-version unstructured data.
[0032] Compared with the prior art, the method proposed in this invention has the following advantages and effects:
[0033] 1. The query language proposed in this invention supports the representation of versions of unstructured data and versions of semantic information in unstructured data at the syntactic level.
[0034] 2. Based on this query language, the present invention can obtain the semantic information of the corresponding version of unstructured data objects from the semantic information of multi-version unstructured data. Attached Figure Description
[0035] Figure 1 The method flowchart of the present invention.
[0036] Figure 2 A schematic diagram of the AST when only the version of the unstructured data object is specified.
[0037] Figure 3 A schematic diagram of the AST when only the semantic information version is specified.
[0038] Figure 4 A schematic diagram of the AST when both the unstructured data object and the semantic information version are specified. Detailed Implementation
[0039] The technical solutions in the embodiments of the present invention will now be clearly and completely described with reference to the accompanying drawings. Obviously, the described embodiments are merely specific embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0040] The semantic information query method for multi-version unstructured data of the present invention, such as... Figure 1 The above includes the following steps:
[0041] Step 1: Obtain the query statement.
[0042] The query statement of this invention is an extension of the Cypher query language, including a node lookup operator and unstructured data objects and semantic information names connected by a first connector, enabling the query statement to perform versioned queries on the semantic information of unstructured data.
[0043] In addition to the conventional node lookup operators, the query statements of this invention also use the -> symbol to represent the semantic information of unstructured data objects. The -> symbol is a binary connector, with the unstructured data object on the left and the name of the semantic information on the right.
[0044] In one example, when querying semantic information for a specific version, the @ symbol is used to represent the version information of an object. The @ symbol is a binary connector, with a "versionable" object on the left and the version number of that object on the right. "Versionable" objects include: nodes, relationships, attributes (including structured and unstructured data), and semantic information.
[0045] The version number is represented as `<$version>`, and it must be enclosed in angle brackets. The version number can be a string or a number.
[0046] In another example, when querying the latest version of the semantic information using an AI model, the @ symbol can be omitted, i.e., the version number is not indicated.
[0047] Furthermore, the process of obtaining the semantic information version number of this invention includes:
[0048] This invention uses artificial intelligence models to obtain semantic information content of unstructured data. One type of semantic information corresponds to one type of artificial intelligence model. For example, the semantic information "face" corresponds to a face feature extraction model (face feature extraction models are well-known technologies).
[0049] Regarding the definition of semantic information extraction model versions: A series of models used to extract certain semantic information are considered as different versions of the model. For example, the model initially used to extract face semantic information in the system is considered version v-m1. Later, due to model upgrades, a more accurate model was used, and this model is considered version v-m2.
[0050] The definition of semantic information versioning: A one-to-one correspondence is established between the AI model and the version number of the semantic information. That is, for the same unstructured data object, the semantic information extracted by different versions of the AI model is considered as different versions of semantic information. For example, if the system has two face feature extraction models, with version numbers v-m1 and v-m2 respectively, and both models are used to extract the semantic information of "face", then the face extracted by model v-m1 is considered version v1, and the face extracted by model v-m2 is considered version v2.
[0051] Step 2: Parse the query statement into an abstract syntax tree.
[0052] This invention parses the entire query statement into an Abstract Semantic Tree (AST, opencypher / front-end: Parsing, AST and semantic analysis for the Cypher QueryLanguage (github.com)), thus representing the entire query statement as a tree. Data operations in the query statement correspond to one or more nodes on the tree. This AST includes at least node lookup nodes, version extraction nodes, object attribute calculation nodes, and semantic information calculation nodes.
[0053] Step 3: Run the node lookup operator on the node to obtain the specified object attribute calculation node.
[0054] This invention first runs the node lookup operator MATCH(n)WHERE id(n) in the query statement to obtain the specified object attribute calculation node for subsequent calculations.
[0055] Step 4: Based on the query statement, the version number of the unstructured data object and semantic information name is obtained at the version extraction node.
[0056] The version extraction node can be represented as PPTVersionNumber(plainNum), used to represent the version number in the AbstractSemantic Tree. The plainNum value is the value of <$version> in the query statement.
[0057] When the "@" symbol is encountered, it checks if the first character following it is "<". If not, it defaults to retrieving the latest version from the current system. If it is, it reads all characters from this point to the first ">" character and uses these characters as the version number, which is the value of plainNum in PPTVersionNumber(plainNum).
[0058] In one example, when the parser reads a specified unstructured attribute, it checks if it is immediately followed by an "@" symbol. If not, it defaults to the latest version of that unstructured attribute in the current system. If it is, it calls PPTVersionNumber(plainNum) to parse and obtain the object's version number $p-versionNumbe.
[0059] When the parser reads the semantic information of a specified unstructured data, it checks whether it is immediately followed by an "@" symbol. If not, it defaults to retrieving the latest version of the AI model corresponding to that semantic information in the current system. If it is, it calls PPTVersionNumber(plainNum) to parse and obtain the version number $s-versionNumbe of the semantic information.
[0060] Step 5: At the specified object attribute calculation node, calculate the attribute value of the unstructured data object based on the version number of the unstructured data object and the unstructured data object.
[0061] A computed property node can be represented as PPTPropertyAtVersion($property, $p-versionNumber), which retrieves a specific version of a property. Its return value is the value of that property in the specified version. Here, `property` is an object with properties, such as nodes and relationships; `p-versionNumber` is the value of `PPTVersionNumber` obtained from parsing the query statement.
[0062] Step 6: At the semantic information calculation node, based on the attribute value of the unstructured data object, the semantic information name, and the version number of the semantic information name, the semantic information query result is obtained.
[0063] The semantic information computation node can be represented as PPTCustomPropertyAtVersion($hproperty,$sub-property,$s-versionNumber), which retrieves the semantic information of a specific version of an attribute (unstructured data). Its return value is the value of the semantic information for a given version of an attribute (unstructured data). Here, $hproperty is the return value of PPTPropertyAtVersion($property,$p-versionNumber), $sub-property is the name of the semantic information, and $s-versionNumber is the value of PPTVersionNumber obtained from parsing the query statement.
[0064] The following are some specific embodiments of the present invention: Specific Implementation Example 1:
[0066] Suppose a user needs to query the face semantic information of the blob attribute of a node with id 1 and version number v-b4. That is, the face semantic information of unstructured data with version number v-b4 in Figure 1. The query statement would be: Match(n) Where id(n)=1 Return n.Blob@ <v-b4>->face;
[0067] After receiving such a query request, the system parses the query statement according to the method defined in Invention Content 1. First, it parses MATCH(n)WHERE id(n)=1 into FindNodeById(1), which means finding the node with id=1. Then, it parses the remaining query statement, as described in Invention Contents 1-11) and 12). When the parser encounters the @ symbol, it begins reading the content within the <> symbols that follow it, and uses v-b4 as the version number of the Blob. The Abstract Semantic Tree obtained by parsing this query statement is as follows: Figure 1 As shown. Since the user did not specify a version for semantic information, the latest version is used by default. Specific Implementation Example 2:
[0069] Suppose a user needs to detect the face semantic information of the Blob attribute of a node with id=1, and requires the face information version number to be v-sp4. The query would be: "MATCH(n)WHERE id(n)=1RETURN n.Blob->face@ <v-sp4>The Abstract Semantic Tree obtained by parsing the query statement is as follows: Figure 2 As shown. Since the user did not specify a Blob version, the latest version is used by default. Specific Implementation Example 3:
[0071] Suppose a user needs to detect the face semantic information of the Blob attribute of a node with id=1, and the Blob version number is required to be v-b4, and the face version number is required to be v-sp4. Then the query statement would be: "MATCH(n)WHERE id(n)=1
[0072] RETURN n.Blob@ <v-b4>->face@ <v-sp4>The query statement parsed to obtain the AbstractSemantic Tree is as follows: Figure 3 As shown. When executing PPTCustomPropertyAtVersion(n.blob@ <v-b4>When processing the model with version v-m4 (face, v-sp4), the model with version v-m4 is called to process the return result of PPTPropertyAtVersion (i.e., the unstructured data object with version v-b4) to obtain the final result.
[0073] In summary, this invention first parses the query statement and reorganizes and sorts the query conditions within it. It obtains a PPTVersionNumber for a certain unstructured attribute, assuming its value is v-p1, where v-p1 represents the unstructured data object specifying the version the user wants to retrieve. Based on the query statement, it obtains a PPTVersionNumber for a certain semantic information, assuming its value is v-sp1, where v-sp1 represents the semantic information specifying the version the user wants to retrieve. Next, v-p1 is used as input to PPTPropertyAtVersion(), and combined with other filtering conditions (such as attribute values), unstructured attributes matching the filtering conditions are retrieved from the database and denoted as b1. Finally, b1, the semantic information name, and v-sp1 are used as input to PPTCustomPropertyAtVersion, calling the AI model corresponding to the semantic information name and whose version number corresponds to v-sp1 to extract the corresponding version's semantic information from the unstructured data b1.
[0074] The above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit them. Those skilled in the art can modify or make equivalent substitutions to the technical solutions of the present invention without departing from the spirit and scope of the present invention. The scope of protection of the present invention should be determined by the claims.
Claims
1. A method for querying semantic information of multi-version unstructured data, the method comprising: obtaining a query statement; wherein the query statement comprises a node search operator and an unstructured data object and a semantic information name connected by a first connector; parsing the query statement into an abstract syntax tree; wherein the abstract syntax tree comprises a node search node, a version extraction node, an object attribute calculation node, and a semantic information calculation node; running the node search operator in the node search node to obtain a specified object attribute calculation node; in the version extraction node, obtaining a version number of the unstructured data object and a version number of the semantic information name based on the query statement; in the specified object attribute calculation node, calculating an attribute value of the unstructured data object according to the version number of the unstructured data object and the unstructured data object; in the semantic information calculation node, obtaining a semantic information query result based on the attribute value of the unstructured data object, the semantic information name, and the version number of the semantic information name; wherein the obtaining, in the version extraction node, the version number of the unstructured data object and the version number of the semantic information name based on the query statement comprises: reading the query statement; when reading the unstructured data object or the semantic information name, determining whether a second connector is followed; if the second connector is followed, reading all characters between specified symbols to obtain the version number of the unstructured data object or the semantic information name; if the second connector is not followed, taking a version number of a latest version unstructured data object or a latest version semantic information name as the version number of the unstructured data object or the version number of the semantic information name.
2. The method of claim 1, wherein, the specified symbols comprise angle brackets.
3. The method of claim 1, wherein, the query statement is obtained by extending a Cypher query language.
4. The method of claim 1, wherein, the unstructured data object comprises a node and a relationship.
5. The method of claim 1, wherein, the version number of the semantic information name is obtained by: obtaining semantic information corresponding to the semantic information name; obtaining a version number of an artificial intelligence model used to extract the semantic information; and taking the version number of the artificial intelligence model as the version number of the semantic information name. 6.A device for querying semantic information of multi-version unstructured data, comprising: a query statement obtaining module configured to obtain a query statement; wherein the query statement comprises a node search operator and an unstructured data object and a semantic information name connected by a first connector; The query statement parsing module is configured to parse the query statement into an abstract syntax tree, wherein the abstract syntax tree comprises a node search node, a version extraction node, an object attribute calculation node, and a semantic information calculation node; the node search node is configured to run the node search operator to obtain a specified object attribute calculation node; the version extraction node is configured to obtain a version number of an unstructured data object and a version number of a semantic information name based on the query statement; the specified object attribute calculation node is configured to calculate an attribute value of the unstructured data object according to the version number of the unstructured data object and the unstructured data object; and the semantic information calculation node is configured to obtain a semantic information query result based on the attribute value of the unstructured data object, the semantic information name, and the version number of the semantic information name. The version extraction node obtains the version number of the unstructured data object and the version number of the semantic information name based on the query statement, and comprises: reading the query statement; when an unstructured data object or a semantic information name is read, determining whether a second connector is followed; if the second connector is followed, reading all characters between specified symbols to obtain the version number of the unstructured data object or the version number of the semantic information name; if the second connector is not followed, taking a version number of a latest version unstructured data object or a latest version semantic information name as the version number of the unstructured data object or the version number of the semantic information name.
7. A storage medium having stored therein a computer program, wherein, The computer program is configured to execute any one of the methods in claims 1-5 when running. 8.A computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the computer program to perform any one of the methods in claims 1-5. 9.A computer program product, which, when executed on a computer device, causes the computer device to perform any one of the methods in claims 1-5.
Citation Information
Patent Citations
Personalized and synergistic integration network multimedia search and enquiry method
CN101334796A
Subject-specific data set for named entity resolution
US10896222B1