Abstract Syntax Tree Query Similarity Detection

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing methods for detecting similarity between structured query statements require database execution, leading to high detection costs.

Innovation Solution

A method and apparatus for detecting similarity between structured query statements by constructing abstract syntax trees and traversing nodes to determine matching results without the need for database execution.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Measurement precision

If structured query statements are executed with database to determine similarity, then measurement precision is improved, but loss of energy and loss of time increase due to high detection cost

Engineering Contradiction:
Improvesimilarity detection accuracyVSAvoiddetection cost
Core Design Contradiction:
Measurement precisionVSLoss of energy

Solution Approach 1:

The patent segments the structured query statement into an abstract syntax tree with hierarchical nodes, where each node represents a semantic component. This segmentation enables partial matching and comparison without executing the entire query against a database, reducing detection cost while maintaining precision through structured semantic analysis.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent introduces an abstract syntax tree as an intermediary representation between the structured query statement and the database. This intermediary allows similarity detection to be performed on the syntactic structure alone, eliminating the need for actual database execution while preserving semantic meaning for accurate comparison.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Measurement precision

If structured query statements are executed with database to determine similarity, then measurement precision is improved, but productivity decreases due to high detection cost

Engineering Contradiction:
Improvesimilarity detection accuracyVSAvoiddetection efficiency
Core Design Contradiction:
Measurement precisionVSProductivity

Solution Approach 1:

The patent segments the structured query statement into an abstract syntax tree with hierarchical nodes, where each node represents a semantic component. This segmentation enables partial matching and comparison without executing the entire query against a database, reducing detection cost while maintaining precision through structured semantic analysis.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent introduces an abstract syntax tree as an intermediary representation between the structured query statement and the database. This intermediary allows similarity detection to be performed on the syntactic structure alone, eliminating the need for actual database execution while preserving semantic meaning for accurate comparison.

Inventive Principle:
Principle #24Intermediary (Mediator)

Data Source

PatentUS20250181594A1Structured query statement similarity detection method and apparatus, and device
Publication Date: 2025.06.05 BEIJING VOLCANO ENGINE TECH CO LTD
  • US20250181594A1 patent drawing
  • US20250181594A1 patent drawing
  • US20250181594A1 patent drawing

AI summary

A structured query statement similarity detection method, a device and a medium are provided. The method includes: acquiring first and second structured query statements, and constructing corresponding first and second abstract syntax trees, a correlation degree between the root node in the abstract syntax tree and the query result of the statement being higher than a correlation degree between other nodes and the query result of the statement; traversing a node in the first abstract syntax tree, matching the traversed node with a node at a same level in the second abstract syntax tree, and obtaining a matching result of the node; and determining a statement similarity between the first structured query statement and the second structured query statement based on a matching result of a root node in the first abstract syntax tree, a matching result of a child node of the root node, and their corresponding weights.