USE [SemanticResults]
GO
/****** Object:  Table [dbo].[MatrixPropoerties]    Script Date: 12/04/2011 22:29:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MatrixPropoerties](
	[id] [int] IDENTITY(1,1) NOT NULL,
	[id_matrix] [int] NOT NULL,
	[id_type] [int] NOT NULL,
	[value] [sql_variant] NOT NULL,
 CONSTRAINT [PK_MatrixPropoerties] PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Biclusters]    Script Date: 12/04/2011 22:29:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Biclusters](
	[id] [int] IDENTITY(1,1) NOT NULL,
	[id_matrix] [int] NOT NULL,
	[x] [int] NOT NULL,
	[y] [int] NOT NULL,
	[dim1] [int] NOT NULL,
	[dim2] [int] NOT NULL,
	[num] [int] NOT NULL,
 CONSTRAINT [PK_Biclusters] PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Matrices]    Script Date: 12/04/2011 22:29:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Matrices](
	[id] [int] IDENTITY(1,1) NOT NULL,
	[type] [int] NOT NULL,
	[id_result] [int] NULL,
	[name] [nchar](100) NOT NULL,
	[dim1] [int] NOT NULL,
	[dim2] [int] NOT NULL,
	[group] [nchar](100) NOT NULL,
	[data] [varbinary](max) NOT NULL,
 CONSTRAINT [PK_Matrices] PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Labels]    Script Date: 12/04/2011 22:29:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Labels](
	[id] [int] NOT NULL,
	[id_result] [int] NOT NULL,
	[type] [int] NOT NULL,
	[index] [int] NOT NULL,
	[value] [sql_variant] NOT NULL,
 CONSTRAINT [PK_Labels] PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Features]    Script Date: 12/04/2011 22:29:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Features](
	[id] [int] IDENTITY(1,1) NOT NULL,
	[id_result] [int] NOT NULL,
	[type] [int] NOT NULL,
	[index] [int] NOT NULL DEFAULT 0,
	[value] [real] NOT NULL,
 CONSTRAINT [PK_Features] PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Results]    Script Date: 12/04/2011 22:29:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Results](
	[id] [int] IDENTITY(1,1) NOT NULL,
	[method] [int] NOT NULL,
	[diff] [real] NOT NULL,
	[steps] [int] NOT NULL,
	[time] [bigint] NOT NULL,
	[n] [int] NOT NULL,
	[p] [int] NOT NULL,
	[k] [int] NOT NULL,
	[desc] [nchar](1000) NOT NULL,
	[Vmatrix] [int] NOT NULL,
 CONSTRAINT [PK_Results] PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[PropoertiesTypes]    Script Date: 12/04/2011 22:29:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[PropoertiesTypes](
	[id] [int] IDENTITY(1,1) NOT NULL,
	[name] [nchar](100) NOT NULL,
 CONSTRAINT [PK_PropoertiesTypes] PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MatrixType]    Script Date: 12/04/2011 22:29:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MatrixType](
	[id] [int] IDENTITY(1,1) NOT NULL,
	[type] [int] NOT NULL,
 CONSTRAINT [PK_MatrixType] PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  ForeignKey [FK_Biclusters_Matrices]    Script Date: 12/04/2011 22:29:26 ******/
ALTER TABLE [dbo].[Biclusters]  WITH NOCHECK ADD  CONSTRAINT [FK_Biclusters_Matrices] FOREIGN KEY([id_matrix])
REFERENCES [dbo].[Matrices] ([id])
GO
ALTER TABLE [dbo].[Biclusters] CHECK CONSTRAINT [FK_Biclusters_Matrices]
GO
/****** Object:  ForeignKey [FK_Features_Results]    Script Date: 12/04/2011 22:29:26 ******/
ALTER TABLE [dbo].[Features]  WITH CHECK ADD  CONSTRAINT [FK_Features_Results] FOREIGN KEY([id_result])
REFERENCES [dbo].[Results] ([id])
GO
ALTER TABLE [dbo].[Features] CHECK CONSTRAINT [FK_Features_Results]
GO
/****** Object:  ForeignKey [FK_Labels_Results]    Script Date: 12/04/2011 22:29:26 ******/
ALTER TABLE [dbo].[Labels]  WITH CHECK ADD  CONSTRAINT [FK_Labels_Results] FOREIGN KEY([id_result])
REFERENCES [dbo].[Results] ([id])
GO
ALTER TABLE [dbo].[Labels] CHECK CONSTRAINT [FK_Labels_Results]
GO
/****** Object:  ForeignKey [FK_Matrices_Results]    Script Date: 12/04/2011 22:29:26 ******/
ALTER TABLE [dbo].[Matrices]  WITH CHECK ADD  CONSTRAINT [FK_Matrices_Results] FOREIGN KEY([id_result])
REFERENCES [dbo].[Results] ([id])
GO
ALTER TABLE [dbo].[Matrices] CHECK CONSTRAINT [FK_Matrices_Results]
GO
/****** Object:  ForeignKey [FK_MatrixPropoerties_Matrices]    Script Date: 12/04/2011 22:29:26 ******/
ALTER TABLE [dbo].[MatrixPropoerties]  WITH NOCHECK ADD  CONSTRAINT [FK_MatrixPropoerties_Matrices] FOREIGN KEY([id_matrix])
REFERENCES [dbo].[Matrices] ([id])
GO
ALTER TABLE [dbo].[MatrixPropoerties] CHECK CONSTRAINT [FK_MatrixPropoerties_Matrices]
GO
/****** Object:  ForeignKey [FK_Results_Matrices]    Script Date: 12/04/2011 22:29:26 ******/
ALTER TABLE [dbo].[Results]  WITH CHECK ADD  CONSTRAINT [FK_Results_Matrices] FOREIGN KEY([Vmatrix])
REFERENCES [dbo].[Matrices] ([id])
GO
ALTER TABLE [dbo].[Results] CHECK CONSTRAINT [FK_Results_Matrices]
GO
ALTER TABLE Features ADD percentage float null
GO