DROP TABLE IF EXISTS jyu_ccc_media;
CREATE TABLE jyu_ccc_media (
	database varchar(40)  not null default '',
	mid text not null default '',
	r double precision not null default 0,
	y double precision not null default 0,
	g double precision not null default 0,
	b double precision not null default 0,
	p double precision not null default 0,
	w double precision not null default 0,
	k double precision not null default 0
);

DROP TABLE IF EXISTS jyu_ccc_keyword;
CREATE TABLE jyu_ccc_keyword (
	color_map varchar(40)  not null default '',
	word text not null default '',
	r double precision not null default 0,
	y double precision not null default 0,
	g double precision not null default 0,
	b double precision not null default 0,
	p double precision not null default 0,
	w double precision not null default 0,
	k double precision not null default 0
);

--INSERT INTO keywordj (word, r, y, g, b, p, w, k)
--VALUES ('happy', 0.8, 0.4, 0.0, 0.0, 0.2, 0.0, 0.0);

INSERT INTO jyu_ccc_keyword (color_map, word, r, y, g, b, p, w, k)
VALUES ('japan', 'happy', 0.8, 0.4, 0.0, 0.0, 0.2, 0.0, 0.0);


INSERT INTO jyu_ccc_keyword (word, r, g, b)
VALUES ('hot', 0.8, 0.1, 0.1);
INSERT INTO jyu_ccc_keyword (word, r, g, b)
VALUES ('cool', 0.1, 0.1, 0.8);
INSERT INTO jyu_ccc_keyword (word, r, g, b)
VALUES ('natural', 0.1, 0.8, 0.1);
INSERT INTO jyu_ccc_keyword (word, r, g, b)
VALUES ('dark', 0.3, 0.3, 0.4);

INSERT INTO jyu_ccc_keyword (word, r, g, b)
VALUES ('fresh', 0.0, 0.5, 0.5);

INSERT INTO jyu_ccc_media (mid, r, g, b)
VALUES ('http://cross.sfc.keio.ac.jp/~mdbl/lecture/images/sarthou1.gif', 0.1, 0.2, 0.7);
INSERT INTO jyu_ccc_media (mid, r, g, b)
VALUES ('http://cross.sfc.keio.ac.jp/~mdbl/lecture/images/hokusai4.gif', 0.4, 0.4, 0.2);
INSERT INTO jyu_ccc_media (mid, r, g, b)
VALUES ('http://cross.sfc.keio.ac.jp/~mdbl/lecture/images/gogh2.gif', 0.2, 0.5, 0.3);
INSERT INTO jyu_ccc_media (mid, r, g, b)
VALUES ('http://cross.sfc.keio.ac.jp/~mdbl/lecture/images/renoir2.gif', 0.1, 0.5, 0.4);
INSERT INTO jyu_ccc_media (mid, r, g, b)
VALUES ('http://cross.sfc.keio.ac.jp/~mdbl/lecture/images/renoir1.gif', 0.4, 0.4, 0.2);

-- DROP FUNCTION IF EXISTS inner_product(float, float, float, float, float, float);
-- CREATE FUNCTION inner_product(float, float, float, float, float, float)
-- RETURNS float AS
--   'SELECT $1 * $4 + $2 * $5 + $3 * $6 AS inner_product;'
-- LANGUAGE 'sql';

