【发布时间】:2011-01-19 22:48:13
【问题描述】:
我在印度塔塔研究开发和设计中心担任研究员。我正在探索可用的数据库自然语言接口。在探索 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个join path-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 和 customer_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 和旧技术......这就是为什么没有人回答
标签: sql-server-2000