-- REMEMBER TO UPDATE THE CLEANING RULE AND THE FOLLOWING VOCABULARIES:
--   aecdb60c-e1ed-40bd-a6c1-edc9993f07cb_Vm9jYWJ1bGFyeURTUmVzb3VyY2VzL1ZvY2FidWxhcnlEU1Jlc291cmNlVHlwZQ==
--   ecdd1e73-cf16-4a8b-8842-d0a7c780ab6e_Vm9jYWJ1bGFyeURTUmVzb3VyY2VzL1ZvY2FidWxhcnlEU1Jlc291cmNlVHlwZQ==
-- AND TO REGISTER:
--   3470afb2-d15f-4046-988e-7a7a2f7c993b_Vm9jYWJ1bGFyeURTUmVzb3VyY2VzL1ZvY2FidWxhcnlEU1Jlc291cmNlVHlwZQ==
--   5d11b639-51c3-4dc3-a2aa-da0ad168e768_Vm9jYWJ1bGFyeURTUmVzb3VyY2VzL1ZvY2FidWxhcnlEU1Jlc291cmNlVHlwZQ==
--	 ec216410-9ebc-4547-bb4a-190acb0985ef_Vm9jYWJ1bGFyeURTUmVzb3VyY2VzL1ZvY2FidWxhcnlEU1Jlc291cmNlVHlwZQ==

-- THEN RUN THE CLASS/SCHEME UPDATE FROM THE IS TO THE DB

--FCT ENTITY REGISTRY
INSERT INTO organizations (_dnet_resource_identifier_, id, legalshortname, legalname, websiteurl, logourl, countryclass, provenanceactionclass) VALUES
	('fct_________::FCT', 'fct_________::FCT', 'FCT', 'Fundação para a Ciência e a Tecnologia, I.P.', 'http://www.fct.pt',
	 'http://www.fct.pt/images/FCT_H_color_v2011_b.png', 'PT', 'sysimport:crosswalk:entityregistry');
INSERT INTO datasources (_dnet_resource_identifier_, id, officialname, englishname, websiteurl, logourl, contactemail, latitude, longitude, timezone, namespaceprefix, collectedfrom, datasourceclass)
VALUES
	('openaire____::fct', 'openaire____::fct', 'FCT - Fundação para a Ciência e a Tecnologia', 'FCT - Foundation for Science and Technology', 'http://www.fct.pt',
	                      'http://www.fct.pt/images/FCT_H_color_v2011_b.png', 'projectos@fct.pt', 38.71, -9.14, 0.0, 'fct_________', 'infrastruct_::openaire',
	 'entityregistry');
INSERT INTO api (_dnet_resource_identifier_, id, protocolclass, datasource, typologyclass, compatibilityclass)
VALUES ('api_________::fct::0', 'api_________::fct::0', 'filesystem', 'openaire____::fct', 'entityregistry', 'native');
INSERT INTO apicollections (param, original, api) VALUES ('baseUrl', 'file:///var/lib/dnet/fct', 'api_________::fct::0');
INSERT INTO apicollections (param, original, api) VALUES ('extensions', '*.xml', 'api_________::fct::0');
INSERT INTO apicollections (param, original, api, accessparam) VALUES ('metadata_identifier_path', '/project/id', 'api_________::fct::0', FALSE);
UPDATE apicollections
SET _dnet_resource_identifier_ = api || '@@' || param;
INSERT INTO datasource_organization (_dnet_resource_identifier_, datasource, organization)
VALUES ('fct_________::fct@@fct_________::FCT', 'openaire____::fct', 'fct_________::FCT');

 