CREATE DATABASE  IF NOT EXISTS ndbc;
use ndbc;

--
-- To store trend clusters discovered by SUMATRA and used by TRECI
--

drop table if exists trendCluster;
create table trendCluster (clusterId bigint(20), windowid varchar(10),  streamId bigint(20));
drop table if exists clusterNode;
create table clusterNode (nodeId bigint(20), clusterId bigint(20), streamId bigint(20));
drop table if exists sampledClusterNode;
create table sampledClusterNode (nodeId bigint(20), clusterId bigint(20), streamId bigint(20));
drop table if exists polyline;
create table polyline( clusterId bigint(20), timepoint integer, value double, streamId bigint(20));
commit;



DROP TABLE IF EXISTS `stream`;

CREATE TABLE `stream` (
  `id` bigint(20) NOT NULL DEFAULT '0',
  `theme` varchar(30) DEFAULT NULL,
  `startingPoint` int(11) DEFAULT NULL,
  `period` bigint(20) NOT NULL,
  `windowSize` int(11) DEFAULT NULL,
  `network` varchar(50) DEFAULT NULL,
  `label` varchar(200) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;


--
-- To represent the network structure
--


--
-- Table structure for table `node`
--

DROP TABLE IF EXISTS `node`;
CREATE TABLE `node` (
  `id` bigint(20) NOT NULL,
  `x` float NOT NULL,
  `y` float NOT NULL,
  `active` tinyint(1) NOT NULL,
  `network` varchar(30) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;


--
-- Dumping data for table `edge`
--



DROP TABLE IF EXISTS `edge`;

CREATE TABLE `edge` (
  `id` int(11) NOT NULL,
  `orig` bigint(20) NOT NULL,
  `dest` bigint(20) NOT NULL,
  `network` varchar(30) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;



--
-- Dumping data for table `network`
--



DROP TABLE IF EXISTS `network`;

CREATE TABLE `network` (
  `id` varchar(30) NOT NULL,
  `description` varchar(50) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

INSERT INTO `network` VALUES ('ndbc','ndbc');
