我在印度塔塔研究開發和設計中心擔任研究員。我正在探索可用的數據庫自然語言接口。在探索MS英文查詢時,我發現某種類型的關係沒有給出適當的答案。關於英語查詢 - 請求幫助
我們的模式看起來如下圖所示:
Schema:
Customer (customer_id , customer_name, customer_address)
Transaction (transaction_id , customer_id_1, customer_id_2, amount)
CUSTOMER
cuctomer_id customer_name customer_address
1 John abc
2 Rohit pqr
3 Mark xyz
TRANSACTION
transaction_id customer_id_1 customer_id_2 amount
1 1 2 200
2 1 3 300
3 2 1 300
這裏,customer_id_1和customer_id_2到Customer.customer_id引用。 表中的兩個以上屬性引用另一個表中的相同主鍵屬性。
查詢:「給我約翰和羅希特之間的所有交易」
我們所做的實體是客戶和交易;對於給定的英語查詢,下面的關係客戶之間做出和事務 -
Relationship Type : Noun Verb
Relationship: Transaction are
Preposition Clause: between Customer(customer_id_1)
Preposition Clause: and Customer_1(customer_id_2)
這裏我們定義客戶的兩個不同的角色(通過2加入路徑customer_id_1和customer_id_2)
我們預計產量爲交易與trasaction_id爲1和3,但它加入只customer_id_1又給導致作爲
Expected Output-
transaction_id customer_id_1 customer_id_2 amount
1 1 2 200
3 2 1 300
Actual Output-
transaction_id customer_id_1 customer_id_2 amount
1 1 2 200
2 1 3 300
這是因爲默認與和之間的模糊的發生,我們在介詞子句定義..
我們還試圖創建另一個關係
1)
Relationship Type : Noun Verb
Relationship: Transaction are
Preposition Clause: by Customer(customer_id_1)
Preposition Clause: to Customer_1(customer_id_2)
2)
Relationship Type : Noun Verb
Relationship: Transaction are
Preposition Clause: by Customer(customer_id_2)
Preposition Clause: to Customer_1(customer_id_1)
我們預計產量與trasaction_id交易爲1和3,在這裏花了加入兩個customer_id_1 andcustomer_id_2, 但只有關係1使用和不同時1和2,所以輸出如下
Expected Output-
transaction_id customer_id_1 customer_id_2 amount
1 1 2 200
3 2 1 300
Actual Output-
transaction_id customer_id_1 customer_id_2 amount
1 1 2 200
是否有解決方案可以使MSEQ可以理解上述查詢的關係? 希望有人通過建議一些適當的解決方案來幫助我們。
MSEQ是SQL Server 2000和舊技術...這就是爲什麼沒有人回答 – gbn 2011-01-22 08:28:48