-
Notifications
You must be signed in to change notification settings - Fork 7
/
PolarisAIDB.sql
85 lines (62 loc) · 1.9 KB
/
PolarisAIDB.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
-- ****************** SqlDBM: Microsoft SQL Server ******************
-- ******************************************************************
-- ************************************** [Intent]
CREATE TABLE [Intent]
(
[intent-name] varchar(30) NOT NULL ,
CONSTRAINT [PK_Intent] PRIMARY KEY CLUSTERED ([intent-name] ASC)
);
GO
-- ************************************** [Request]
create table Request
(
[request-id] bigint identity
constraint PK_Request
primary key,
query varchar(255) not null,
[response-code] int not null,
response varchar(255),
[request-time] datetime default getdate() not null
)
go
-- ************************************** [Entity]
CREATE TABLE [Entity]
(
[request-id] bigint NOT NULL ,
[entity-content] varchar(50) NULL ,
[start-index] int NULL ,
[end-index] int NULL ,
[date] char(10) NULL ,
[time] char(8) NULL ,
[type] varchar(50) NULL ,
CONSTRAINT [PK_Entity] PRIMARY KEY CLUSTERED ([request-id] ASC),
CONSTRAINT [FK_31] FOREIGN KEY ([request-id]) REFERENCES [Request]([request-id])
);
GO
CREATE NONCLUSTERED INDEX [fkIdx_31] ON [Entity]
(
[request-id] ASC
)
GO
-- ************************************** [RequestIntent]
CREATE TABLE [RequestIntent]
(
[request-id] bigint NOT NULL ,
[intent-name] varchar(30) NOT NULL ,
[is-top-scoring] binary(1) NOT NULL ,
[intent-score] float NOT NULL ,
CONSTRAINT [PK_RequestIntent] PRIMARY KEY CLUSTERED ([request-id] ASC, [intent-name] ASC),
CONSTRAINT [FK_17] FOREIGN KEY ([request-id]) REFERENCES [Request]([request-id]),
CONSTRAINT [FK_21] FOREIGN KEY ([intent-name]) REFERENCES [Intent]([intent-name])
);
GO
CREATE NONCLUSTERED INDEX [fkIdx_17] ON [RequestIntent]
(
[request-id] ASC
)
GO
CREATE NONCLUSTERED INDEX [fkIdx_21] ON [RequestIntent]
(
[intent-name] ASC
)
GO