--
--

-- Started on 2013-06-25 16:58:37

SET escape_string_warning = off;

--
-- TOC entry 6 (class 2615 OID 38716)
-- Name: ic; Type: SCHEMA; Schema: -; Owner: -
--

CREATE SCHEMA ic;



--
-- TOC entry 192 (class 1255 OID 38717)
-- Dependencies: 6
-- Name: renew_cloud_db(); Type: FUNCTION; Schema: ic; Owner: -
--

CREATE FUNCTION renew_cloud_db() RETURNS void
    LANGUAGE sql
    AS $$ALTER SEQUENCE ic.cluster_keyword_id_seq RESTART 1;
ALTER SEQUENCE ic.cluster_keyword_id_seq RESTART 1;
ALTER SEQUENCE ic.cluster_id_seq RESTART 1;
ALTER SEQUENCE ic.cluster_resource_id_seq RESTART 1;
ALTER SEQUENCE ic.cluster_type_id_seq RESTART 1;
ALTER SEQUENCE ic.link_id_seq RESTART 1;
ALTER SEQUENCE ic.web_data_cloud_id_seq RESTART 1;
ALTER SEQUENCE ic.cluster_property_id_seq RESTART 1;
ALTER SEQUENCE ic.property_id_seq RESTART 1;

DELETE FROM ic.cluster_property;
DELETE FROM ic.property;
DELETE FROM ic.link;
DELETE FROM ic.cluster_keyword;
DELETE FROM ic.cluster_type;
DELETE FROM ic.cluster_resource;
DELETE FROM ic.cluster;
DELETE FROM ic.web_data_cloud;$$;




--
-- TOC entry 150 (class 1259 OID 38718)
-- Dependencies: 6
-- Name: cluster; Type: TABLE; Schema: ic; Owner: -; Tablespace: 
--

CREATE TABLE cluster (
    id integer NOT NULL,
    prominence double precision,
    incloud integer,
    similarity double precision,
    confidence double precision
);


--
-- TOC entry 151 (class 1259 OID 38721)
-- Dependencies: 150 6
-- Name: cluster_id_seq; Type: SEQUENCE; Schema: ic; Owner: -
--

CREATE SEQUENCE cluster_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


--
-- TOC entry 1925 (class 0 OID 0)
-- Dependencies: 151
-- Name: cluster_id_seq; Type: SEQUENCE OWNED BY; Schema: ic; Owner: -
--

ALTER SEQUENCE cluster_id_seq OWNED BY cluster.id;


--
-- TOC entry 152 (class 1259 OID 38723)
-- Dependencies: 6
-- Name: cluster_keyword; Type: TABLE; Schema: ic; Owner: -; Tablespace: 
--

CREATE TABLE cluster_keyword (
    cluster integer NOT NULL,
    keyword_id integer NOT NULL,
    term character varying(45),
    relevance double precision,
    id integer NOT NULL
);


--
-- TOC entry 153 (class 1259 OID 38726)
-- Dependencies: 152 6
-- Name: cluster_keyword_id_seq; Type: SEQUENCE; Schema: ic; Owner: -
--

CREATE SEQUENCE cluster_keyword_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


--
-- TOC entry 1926 (class 0 OID 0)
-- Dependencies: 153
-- Name: cluster_keyword_id_seq; Type: SEQUENCE OWNED BY; Schema: ic; Owner: -
--

ALTER SEQUENCE cluster_keyword_id_seq OWNED BY cluster_keyword.id;


--
-- TOC entry 177 (class 1259 OID 39017)
-- Dependencies: 6
-- Name: cluster_property; Type: TABLE; Schema: ic; Owner: -; Tablespace: 
--

CREATE TABLE cluster_property (
    id integer NOT NULL,
    cluster integer,
    property integer
);


--
-- TOC entry 178 (class 1259 OID 39046)
-- Dependencies: 6 177
-- Name: cluster_property_id_seq; Type: SEQUENCE; Schema: ic; Owner: -
--

CREATE SEQUENCE cluster_property_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


--
-- TOC entry 1927 (class 0 OID 0)
-- Dependencies: 178
-- Name: cluster_property_id_seq; Type: SEQUENCE OWNED BY; Schema: ic; Owner: -
--

ALTER SEQUENCE cluster_property_id_seq OWNED BY cluster_property.id;


--
-- TOC entry 154 (class 1259 OID 38728)
-- Dependencies: 6
-- Name: cluster_resource; Type: TABLE; Schema: ic; Owner: -; Tablespace: 
--

CREATE TABLE cluster_resource (
    resource character varying(255) NOT NULL,
    relevance double precision,
    cluster integer NOT NULL,
    id integer NOT NULL
);


--
-- TOC entry 155 (class 1259 OID 38731)
-- Dependencies: 154 6
-- Name: cluster_resource_id_seq; Type: SEQUENCE; Schema: ic; Owner: -
--

CREATE SEQUENCE cluster_resource_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


--
-- TOC entry 1928 (class 0 OID 0)
-- Dependencies: 155
-- Name: cluster_resource_id_seq; Type: SEQUENCE OWNED BY; Schema: ic; Owner: -
--

ALTER SEQUENCE cluster_resource_id_seq OWNED BY cluster_resource.id;


--
-- TOC entry 156 (class 1259 OID 38733)
-- Dependencies: 6
-- Name: cluster_type; Type: TABLE; Schema: ic; Owner: -; Tablespace: 
--

CREATE TABLE cluster_type (
    class character varying(255) NOT NULL,
    cluster integer NOT NULL,
    relevance double precision,
    id integer NOT NULL
);


--
-- TOC entry 157 (class 1259 OID 38736)
-- Dependencies: 6 156
-- Name: cluster_type_id_seq; Type: SEQUENCE; Schema: ic; Owner: -
--

CREATE SEQUENCE cluster_type_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


--
-- TOC entry 1929 (class 0 OID 0)
-- Dependencies: 157
-- Name: cluster_type_id_seq; Type: SEQUENCE OWNED BY; Schema: ic; Owner: -
--

ALTER SEQUENCE cluster_type_id_seq OWNED BY cluster_type.id;


--
-- TOC entry 158 (class 1259 OID 38738)
-- Dependencies: 6
-- Name: link; Type: TABLE; Schema: ic; Owner: -; Tablespace: 
--

CREATE TABLE link (
    source integer NOT NULL,
    target integer NOT NULL,
    proximity double precision,
    id integer NOT NULL,
    incloud integer
);


--
-- TOC entry 159 (class 1259 OID 38741)
-- Dependencies: 158 6
-- Name: link_id_seq; Type: SEQUENCE; Schema: ic; Owner: -
--

CREATE SEQUENCE link_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


--
-- TOC entry 1930 (class 0 OID 0)
-- Dependencies: 159
-- Name: link_id_seq; Type: SEQUENCE OWNED BY; Schema: ic; Owner: -
--

ALTER SEQUENCE link_id_seq OWNED BY link.id;


--
-- TOC entry 176 (class 1259 OID 39010)
-- Dependencies: 6
-- Name: property; Type: TABLE; Schema: ic; Owner: -; Tablespace: 
--

CREATE TABLE property (
    id integer NOT NULL,
    rdf_id character varying,
    value character varying
);


--
-- TOC entry 175 (class 1259 OID 39008)
-- Dependencies: 6 176
-- Name: property_id_seq; Type: SEQUENCE; Schema: ic; Owner: -
--

CREATE SEQUENCE property_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


--
-- TOC entry 1931 (class 0 OID 0)
-- Dependencies: 175
-- Name: property_id_seq; Type: SEQUENCE OWNED BY; Schema: ic; Owner: -
--

ALTER SEQUENCE property_id_seq OWNED BY property.id;


--
-- TOC entry 160 (class 1259 OID 38743)
-- Dependencies: 6
-- Name: web_data_cloud; Type: TABLE; Schema: ic; Owner: -; Tablespace: 
--

CREATE TABLE web_data_cloud (
    id integer NOT NULL,
    target_entity character varying(255),
    direct boolean
);


--
-- TOC entry 161 (class 1259 OID 38746)
-- Dependencies: 6 160
-- Name: web_data_cloud_id_seq; Type: SEQUENCE; Schema: ic; Owner: -
--

CREATE SEQUENCE web_data_cloud_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


--
-- TOC entry 1932 (class 0 OID 0)
-- Dependencies: 161
-- Name: web_data_cloud_id_seq; Type: SEQUENCE OWNED BY; Schema: ic; Owner: -
--

ALTER SEQUENCE web_data_cloud_id_seq OWNED BY web_data_cloud.id;


--
-- TOC entry 1880 (class 2604 OID 38748)
-- Dependencies: 151 150
-- Name: id; Type: DEFAULT; Schema: ic; Owner: -
--

ALTER TABLE cluster ALTER COLUMN id SET DEFAULT nextval('cluster_id_seq'::regclass);


--
-- TOC entry 1881 (class 2604 OID 38749)
-- Dependencies: 153 152
-- Name: id; Type: DEFAULT; Schema: ic; Owner: -
--

ALTER TABLE cluster_keyword ALTER COLUMN id SET DEFAULT nextval('cluster_keyword_id_seq'::regclass);


--
-- TOC entry 1887 (class 2604 OID 39048)
-- Dependencies: 178 177
-- Name: id; Type: DEFAULT; Schema: ic; Owner: -
--

ALTER TABLE cluster_property ALTER COLUMN id SET DEFAULT nextval('cluster_property_id_seq'::regclass);


--
-- TOC entry 1882 (class 2604 OID 38750)
-- Dependencies: 155 154
-- Name: id; Type: DEFAULT; Schema: ic; Owner: -
--

ALTER TABLE cluster_resource ALTER COLUMN id SET DEFAULT nextval('cluster_resource_id_seq'::regclass);


--
-- TOC entry 1883 (class 2604 OID 38751)
-- Dependencies: 157 156
-- Name: id; Type: DEFAULT; Schema: ic; Owner: -
--

ALTER TABLE cluster_type ALTER COLUMN id SET DEFAULT nextval('cluster_type_id_seq'::regclass);


--
-- TOC entry 1884 (class 2604 OID 38752)
-- Dependencies: 159 158
-- Name: id; Type: DEFAULT; Schema: ic; Owner: -
--

ALTER TABLE link ALTER COLUMN id SET DEFAULT nextval('link_id_seq'::regclass);


--
-- TOC entry 1886 (class 2604 OID 39013)
-- Dependencies: 176 175 176
-- Name: id; Type: DEFAULT; Schema: ic; Owner: -
--

ALTER TABLE property ALTER COLUMN id SET DEFAULT nextval('property_id_seq'::regclass);


--
-- TOC entry 1885 (class 2604 OID 38753)
-- Dependencies: 161 160
-- Name: id; Type: DEFAULT; Schema: ic; Owner: -
--

ALTER TABLE web_data_cloud ALTER COLUMN id SET DEFAULT nextval('web_data_cloud_id_seq'::regclass);


--
-- TOC entry 1891 (class 2606 OID 38755)
-- Dependencies: 152 152
-- Name: cl_ess_pkey; Type: CONSTRAINT; Schema: ic; Owner: -; Tablespace: 
--

ALTER TABLE ONLY cluster_keyword
    ADD CONSTRAINT cl_ess_pkey PRIMARY KEY (id);


--
-- TOC entry 1893 (class 2606 OID 38757)
-- Dependencies: 152 152 152
-- Name: cl_ess_unique; Type: CONSTRAINT; Schema: ic; Owner: -; Tablespace: 
--

ALTER TABLE ONLY cluster_keyword
    ADD CONSTRAINT cl_ess_unique UNIQUE (cluster, keyword_id);


--
-- TOC entry 1889 (class 2606 OID 38759)
-- Dependencies: 150 150
-- Name: cluster_pkey; Type: CONSTRAINT; Schema: ic; Owner: -; Tablespace: 
--

ALTER TABLE ONLY cluster
    ADD CONSTRAINT cluster_pkey PRIMARY KEY (id);


--
-- TOC entry 1895 (class 2606 OID 38761)
-- Dependencies: 154 154
-- Name: cr_pkey; Type: CONSTRAINT; Schema: ic; Owner: -; Tablespace: 
--

ALTER TABLE ONLY cluster_resource
    ADD CONSTRAINT cr_pkey PRIMARY KEY (id);


--
-- TOC entry 1897 (class 2606 OID 38763)
-- Dependencies: 154 154 154
-- Name: cr_unique; Type: CONSTRAINT; Schema: ic; Owner: -; Tablespace: 
--

ALTER TABLE ONLY cluster_resource
    ADD CONSTRAINT cr_unique UNIQUE (resource, cluster);


--
-- TOC entry 1899 (class 2606 OID 38765)
-- Dependencies: 156 156
-- Name: ctype_pkey; Type: CONSTRAINT; Schema: ic; Owner: -; Tablespace: 
--

ALTER TABLE ONLY cluster_type
    ADD CONSTRAINT ctype_pkey PRIMARY KEY (id);


--
-- TOC entry 1901 (class 2606 OID 38767)
-- Dependencies: 156 156 156
-- Name: ctype_unique_cluster_class; Type: CONSTRAINT; Schema: ic; Owner: -; Tablespace: 
--

ALTER TABLE ONLY cluster_type
    ADD CONSTRAINT ctype_unique_cluster_class UNIQUE (cluster, class);


--
-- TOC entry 1913 (class 2606 OID 39053)
-- Dependencies: 177 177
-- Name: id_cluster_property_pkey; Type: CONSTRAINT; Schema: ic; Owner: -; Tablespace: 
--

ALTER TABLE ONLY cluster_property
    ADD CONSTRAINT id_cluster_property_pkey PRIMARY KEY (id);


--
-- TOC entry 1909 (class 2606 OID 39060)
-- Dependencies: 176 176
-- Name: property_id_pkey; Type: CONSTRAINT; Schema: ic; Owner: -; Tablespace: 
--

ALTER TABLE ONLY property
    ADD CONSTRAINT property_id_pkey PRIMARY KEY (id);


--
-- TOC entry 1903 (class 2606 OID 38769)
-- Dependencies: 158 158
-- Name: proximity_pkey; Type: CONSTRAINT; Schema: ic; Owner: -; Tablespace: 
--

ALTER TABLE ONLY link
    ADD CONSTRAINT proximity_pkey PRIMARY KEY (id);


--
-- TOC entry 1911 (class 2606 OID 39117)
-- Dependencies: 176 176 176
-- Name: rdf_id_value_property_unique; Type: CONSTRAINT; Schema: ic; Owner: -; Tablespace: 
--

ALTER TABLE ONLY property
    ADD CONSTRAINT rdf_id_value_property_unique UNIQUE (rdf_id, value);


--
-- TOC entry 1905 (class 2606 OID 38771)
-- Dependencies: 158 158 158
-- Name: source_target_unique; Type: CONSTRAINT; Schema: ic; Owner: -; Tablespace: 
--

ALTER TABLE ONLY link
    ADD CONSTRAINT source_target_unique UNIQUE (source, target);


--
-- TOC entry 1907 (class 2606 OID 38773)
-- Dependencies: 160 160
-- Name: wdc_primary_key; Type: CONSTRAINT; Schema: ic; Owner: -; Tablespace: 
--

ALTER TABLE ONLY web_data_cloud
    ADD CONSTRAINT wdc_primary_key PRIMARY KEY (id);


--
-- TOC entry 1914 (class 2606 OID 38774)
-- Dependencies: 160 150 1906
-- Name: cluster_cloud_fkey; Type: FK CONSTRAINT; Schema: ic; Owner: -
--

ALTER TABLE ONLY cluster
    ADD CONSTRAINT cluster_cloud_fkey FOREIGN KEY (incloud) REFERENCES web_data_cloud(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- TOC entry 1922 (class 2606 OID 39066)
-- Dependencies: 1888 150 177
-- Name: cluster_cluster_property_fkey; Type: FK CONSTRAINT; Schema: ic; Owner: -
--

ALTER TABLE ONLY cluster_property
    ADD CONSTRAINT cluster_cluster_property_fkey FOREIGN KEY (cluster) REFERENCES cluster(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- TOC entry 1916 (class 2606 OID 38779)
-- Dependencies: 154 150 1888
-- Name: cluster_fkey; Type: FK CONSTRAINT; Schema: ic; Owner: -
--

ALTER TABLE ONLY cluster_resource
    ADD CONSTRAINT cluster_fkey FOREIGN KEY (cluster) REFERENCES cluster(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- TOC entry 1915 (class 2606 OID 38784)
-- Dependencies: 150 152 1888
-- Name: cluster_fkey; Type: FK CONSTRAINT; Schema: ic; Owner: -
--

ALTER TABLE ONLY cluster_keyword
    ADD CONSTRAINT cluster_fkey FOREIGN KEY (cluster) REFERENCES cluster(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- TOC entry 1917 (class 2606 OID 38789)
-- Dependencies: 150 156 1888
-- Name: ctype_cluster_fkey; Type: FK CONSTRAINT; Schema: ic; Owner: -
--

ALTER TABLE ONLY cluster_type
    ADD CONSTRAINT ctype_cluster_fkey FOREIGN KEY (cluster) REFERENCES cluster(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- TOC entry 1918 (class 2606 OID 38794)
-- Dependencies: 160 1906 158
-- Name: incloud_fk; Type: FK CONSTRAINT; Schema: ic; Owner: -
--

ALTER TABLE ONLY link
    ADD CONSTRAINT incloud_fk FOREIGN KEY (incloud) REFERENCES web_data_cloud(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- TOC entry 1919 (class 2606 OID 38799)
-- Dependencies: 158 1888 150
-- Name: p_source_fkey; Type: FK CONSTRAINT; Schema: ic; Owner: -
--

ALTER TABLE ONLY link
    ADD CONSTRAINT p_source_fkey FOREIGN KEY (source) REFERENCES cluster(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- TOC entry 1921 (class 2606 OID 39061)
-- Dependencies: 176 1908 177
-- Name: property_cluster_property_fkey; Type: FK CONSTRAINT; Schema: ic; Owner: -
--

ALTER TABLE ONLY cluster_property
    ADD CONSTRAINT property_cluster_property_fkey FOREIGN KEY (property) REFERENCES property(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- TOC entry 1920 (class 2606 OID 38804)
-- Dependencies: 150 158 1888
-- Name: prox_target_fkey; Type: FK CONSTRAINT; Schema: ic; Owner: -
--

ALTER TABLE ONLY link
    ADD CONSTRAINT prox_target_fkey FOREIGN KEY (target) REFERENCES cluster(id);


-- Completed on 2013-06-25 16:58:38

--
--

