Regarding the English request - help request

I work as a researcher at Tata Research Development and Design Center, India. I am studying the available natural language interfaces for the database. In the course of studying MS English Query, I found that a certain type of relationship does not give an appropriate answer.

Our diagram looks like below:

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 

Here customer_id_1 and customer_id_2 refer to Customer.customer_id. More than two table attributes refer to the same primary key attribute in another table.

Request: "Give me all the transactions between John and Rohit"

The entities that we created were the Client and the transaction; For this English request, the following relationships between clients and transactions were made -

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, client_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? , - , .

+3
1

, . , , . , , .

SELECT [Transaction_Id]
      ,[Customer_Id_1]
      ,[Customer_Id_2]
      ,[Amount]
  FROM [TEST].[dbo].[Transaction] WHERE ((Customer_Id_1 = 1 AND Customer_Id_2 = 2)OR(Customer_Id_1 = 2 AND Customer_Id_2 = 1))
0

Source: https://habr.com/ru/post/1734009/


All Articles