Linked Data Views


-- Setup script for Linked Data Views of OpenLink Product Portfolio version 2
--

/*
 * This view is currently designed to SPECIFICALLY load on data.openlinksw.com.  We recommend you
 * search for 'openlinksw.com'  (as `http://' is sometimes encoded) and replace with either the default 
 * URIQA macro or your own hostname as appropriate.
 */

-- views to get the codes out instead of the id's
---- in hindsight these should ALL have been handled with 
---- proper IRI functions like the rest, oh well, no harm AFAIK
---- will know for next time or might even replace this later.
DROP VIEW oplweb2.oplweb.product_formats_categories;

CREATE VIEW oplweb2.oplweb.product_formats_categories (
    product_cat_code, product_cat_id, product_format_code, product_format_id, product_family_id
  ) as
select distinct
  pc.product_cat_code, 
  pc.product_cat_id,
  pf.product_format_code,
  pf.product_format_id,
  pc.product_family_id
from
  oplweb2.oplweb.product_category pc,
  oplweb2.oplweb.product_format pf,
  oplweb2.oplweb.product p
where
  p.product_cat_id = pc.product_cat_id and
  p.product_format_id = pf.product_format_id 
  and exists (
	select 1 from oplweb2.oplweb.component_archive ca 
	where ca.product_id = p.product_id
	)
;


DROP VIEW oplweb2.oplweb.product_with_code;

CREATE VIEW oplweb2.oplweb.product_with_code as
  select p.*, pc.product_cat_code, pf.product_format_code
  from 
  oplweb2.oplweb.product_category pc,
  oplweb2.oplweb.product_format pf,
  oplweb2.oplweb.product p
where
  p.product_cat_id = pc.product_cat_id and
  p.product_format_id = pf.product_format_id ;


DROP VIEW oplweb2.oplweb.product_category_with_code;

CREATE VIEW oplweb2.oplweb.product_category_with_code as
  select pc.*, pf.product_family_code
  from 
  oplweb2.oplweb.product_category pc,
  oplweb2.oplweb.product_family pf
where
  pc.product_family_id = pf.product_family_id ;
  
  
DROP VIEW oplweb2.oplweb.product_family_features_with_code;

CREATE VIEW oplweb2.oplweb.product_family_features_with_code as
  select a.*, b.product_family_code 
  from 
  oplweb2.oplweb.product_family_features a,
  oplweb2.oplweb.product_family b
where
  a.product_family_id = b.product_family_id
;    
    
DROP VIEW oplweb2.oplweb.product_format_features_with_code;

CREATE VIEW oplweb2.oplweb.product_format_features_with_code as
  select a.*, b.product_format_code 
  from 
  oplweb2.oplweb.product_format_features a,
  oplweb2.oplweb.product_format b
where
  a.product_format_id = b.product_format_id
;    
    
DROP VIEW oplweb2.oplweb.product_category_features_with_code;

CREATE VIEW oplweb2.oplweb.product_category_features_with_code as
  select a.*, b.product_cat_code 
  from 
  oplweb2.oplweb.product_category_features a,
  oplweb2.oplweb.product_category b
where
  a.product_cat_id = b.product_cat_id
;    

DROP VIEW oplweb2.oplweb.components_for_rdfs;

CREATE VIEW oplweb2.oplweb.components_for_rdfs as
  select *, cast(filesize as varchar) as str_filesize 
  from 
  oplweb2.oplweb.components
;    

    
DROP VIEW oplweb2.oplweb.product_release_with_family;

CREATE VIEW oplweb2.oplweb.product_release_with_family as
  select a.*, b.opsys_family_id, c.dbms_family_id 
  from 
  oplweb2.oplweb.product_release a,
  oplweb2.oplweb.opsys b,
  oplweb2.oplweb.dbms_engine c
where
  a.opsys_name = b.opsys_name and 
  a.dbms_name = c.dbms_name
;    

drop view oplweb2.oplweb.archive_coverage_osdb;

create view oplweb2.oplweb.archive_coverage_osdb as
	select distinct 
	  pfam.product_family_id, pfam.product_family_code,
	  p.product_format_id, pf.product_format_code, 
	  p.product_cat_id, pc.product_cat_code, 
	  p.product_id, 
	  ca.opsys_name, 
	  os.opsys_family_id, 
	  ca.dbms_name, 
	  db.dbms_family_id,
	  pr.processor_name, 
	  pr.processor_mode_id, 
	  pr.processor_family_id
	from 
	   oplweb2.oplweb.product p
  join oplweb2.oplweb.product_category pc on (p.product_cat_id = pc.product_cat_id)
  join oplweb2.oplweb.product_format pf on (p.product_format_id = pf.product_format_id)
  join oplweb2.oplweb.product_family pfam on (pc.product_family_id = pfam.product_family_id)
  join oplweb2.oplweb.component_archive ca on (ca.product_id = p.product_id)
  join oplweb2.oplweb.opsys os on (os.opsys_name = ca.opsys_name)
  join oplweb2.oplweb.dbms_engine db on (db.dbms_name = ca.dbms_name)
  join oplweb2.oplweb.processors pr on (pr.processor_name = os.processor_name and pr.processor_mode_id = os.processor_mode_id)
;

GRANT SELECT ON oplweb2.oplweb.component_archive TO "SPARQL", "SPARQL_UPDATE";
GRANT SELECT ON oplweb2.oplweb.component_archive_type TO "SPARQL", "SPARQL_UPDATE";
GRANT SELECT ON oplweb2.oplweb.component_category TO "SPARQL", "SPARQL_UPDATE";
GRANT SELECT ON oplweb2.oplweb.component_mode TO "SPARQL", "SPARQL_UPDATE";
GRANT SELECT ON oplweb2.oplweb.component_type TO "SPARQL", "SPARQL_UPDATE";
GRANT SELECT ON oplweb2.oplweb.components TO "SPARQL", "SPARQL_UPDATE";
GRANT SELECT ON oplweb2.oplweb.components_for_rdfs TO "SPARQL", "SPARQL_UPDATE";
GRANT SELECT ON oplweb2.oplweb.dbms_engine TO "SPARQL", "SPARQL_UPDATE";
GRANT SELECT ON oplweb2.oplweb.dbms_family TO "SPARQL", "SPARQL_UPDATE";
GRANT SELECT ON oplweb2.oplweb.download_location TO "SPARQL", "SPARQL_UPDATE";
GRANT SELECT ON oplweb2.oplweb.download_protocol TO "SPARQL", "SPARQL_UPDATE";
GRANT SELECT ON oplweb2.oplweb.download_partner TO "SPARQL", "SPARQL_UPDATE";
GRANT SELECT ON oplweb2.oplweb.opsys TO "SPARQL", "SPARQL_UPDATE";
GRANT SELECT ON oplweb2.oplweb.opsys_family TO "SPARQL", "SPARQL_UPDATE";
GRANT SELECT ON oplweb2.oplweb.opsys_type TO "SPARQL", "SPARQL_UPDATE";
GRANT SELECT ON oplweb2.oplweb.processor_family TO "SPARQL", "SPARQL_UPDATE";
GRANT SELECT ON oplweb2.oplweb.processor_mode TO "SPARQL", "SPARQL_UPDATE";
GRANT SELECT ON oplweb2.oplweb.processors TO "SPARQL", "SPARQL_UPDATE";
GRANT SELECT ON oplweb2.oplweb.product TO "SPARQL", "SPARQL_UPDATE";
GRANT SELECT ON oplweb2.oplweb.product_benefits TO "SPARQL", "SPARQL_UPDATE";
GRANT SELECT ON oplweb2.oplweb.product_benefits_category TO "SPARQL", "SPARQL_UPDATE";
GRANT SELECT ON oplweb2.oplweb.product_category TO "SPARQL", "SPARQL_UPDATE";
GRANT SELECT ON oplweb2.oplweb.product_category_with_code TO "SPARQL", "SPARQL_UPDATE";
GRANT SELECT ON oplweb2.oplweb.product_category_features TO "SPARQL", "SPARQL_UPDATE";
GRANT SELECT ON oplweb2.oplweb.product_family TO "SPARQL", "SPARQL_UPDATE";
GRANT SELECT ON oplweb2.oplweb.product_family_features TO "SPARQL", "SPARQL_UPDATE";
GRANT SELECT ON oplweb2.oplweb.product_features TO "SPARQL", "SPARQL_UPDATE";
GRANT SELECT ON oplweb2.oplweb.product_format TO "SPARQL", "SPARQL_UPDATE";
GRANT SELECT ON oplweb2.oplweb.product_format_features TO "SPARQL", "SPARQL_UPDATE";
GRANT SELECT ON oplweb2.oplweb.product_feature_category TO "SPARQL", "SPARQL_UPDATE";
GRANT SELECT ON oplweb2.oplweb.product_release TO "SPARQL", "SPARQL_UPDATE";
GRANT SELECT ON oplweb2.oplweb.product_release_features TO "SPARQL", "SPARQL_UPDATE";
GRANT SELECT ON oplweb2.oplweb.vendor_category TO "SPARQL", "SPARQL_UPDATE";
GRANT SELECT ON oplweb2.oplweb.vendor_category_family TO "SPARQL", "SPARQL_UPDATE";
GRANT SELECT ON oplweb2.oplweb.vendors TO "SPARQL", "SPARQL_UPDATE";
GRANT SELECT ON oplweb2.oplweb.product_formats_categories TO "SPARQL", "SPARQL_UPDATE";
GRANT SELECT ON oplweb2.oplweb.product_with_code TO "SPARQL", "SPARQL_UPDATE";
GRANT SELECT ON oplweb2.oplweb.product_family_features_with_code TO "SPARQL", "SPARQL_UPDATE";
GRANT SELECT ON oplweb2.oplweb.product_format_features_with_code TO "SPARQL", "SPARQL_UPDATE";
GRANT SELECT ON oplweb2.oplweb.product_category_features_with_code TO "SPARQL", "SPARQL_UPDATE";
GRANT SELECT ON oplweb2.oplweb.product_release_with_family TO "SPARQL", "SPARQL_UPDATE";
GRANT SELECT ON oplweb2.oplweb.archive_coverage_osdb TO "SPARQL", "SPARQL_UPDATE";


drop index oplweb2_product_price_format_cat;

create index oplweb2_product_price_format_cat on oplweb2.oplweb.product_price(product_cat_id, product_format_id, product_price_type_id);

drop index oplweb2_product_discount_format_cat;

create index oplweb2_product_discount_format_cat on oplweb2.oplweb.product_general_discount(product_cat_id, product_format_id, product_price_type_id);

	
drop view oplweb2.DBA.license_model_type;

create view oplweb2.DBA.license_model_type (
	product_release_id, product_cat_id, product_format_id, product_id, product_price_type_id
	)
	as 
	select distinct 
	product_release_id, 
	pp.product_cat_id, pp.product_format_id, product_id,
	product_price_type_id
	from 
	  oplweb2.oplweb.product_price pp, 
	  oplweb2.oplweb.product p
	where p.product_cat_id = pp.product_cat_id and 
	p.product_format_id = pp.product_format_id
	;

grant select on oplweb2.DBA.license_model_type to "SPARQL", "SPARQL_UPDATE";--, rdf;
	


drop view oplweb2.DBA.license_model;

create view oplweb2.DBA.license_model as 
  select  distinct
      product_release_id, 
      pc.product_cat_id, 
      pc.product_format_id, 
      pc.product_cat_code, 
      pc.product_format_code, 
      pc.product_id, 
      pp.opsys_family_id, pp.dbms_family_id,
      replace(oo.opsys_family_name, ' ', '') as opsys_family_name, 
      replace(dd.dbms_family_name,  ' ', '') as dbms_family_name,
      pp.opsys_type_id,
      pp.product_price_type_id,
	  pp.product_price_unit_type_id
    from 
      oplweb2.oplweb.product_price pp,
      oplweb2.oplweb.product_with_code pc, --category pc,
      --oplweb2.oplweb.product_format pf,
      oplweb2.oplweb.opsys os,
      oplweb2.oplweb.dbms_engine dbe,
      oplweb2.oplweb.dbms_family dd, 
      oplweb2.oplweb.opsys_family oo
      --oplweb2.oplweb.product p
    where 
      pp.product_format_id = pc.product_format_id and
      pp.product_cat_id = pc.product_cat_id and
      pp.opsys_family_id = oo.opsys_family_id and 
      pp.dbms_family_id = dd.dbms_family_id 
      --p.product_cat_id = pc.product_cat_id and 
      --p.product_format_id = pf.product_format_id and
  ;

grant select on oplweb2.DBA.license_model to "SPARQL", "SPARQL_UPDATE";--, rdf;


drop view oplweb2.DBA.license_model_units;

create view oplweb2.DBA.license_model_units as 
  select distinct 
      lm1.product_release_id, 
	  lm1.product_id,
	  lm1.opsys_family_
      pp.opsys_family_id, pp.dbms_family_id,
      replace(oo.opsys_family_name, ' ', '') as opsys_family_name, 
      replace(dd.dbms_family_name,  ' ', '') as dbms_family_name,
      pp.opsys_type_id, ot.short_description as opsys_type_code
    from 
      oplweb2.oplweb.product_price pp,
      oplweb2.oplweb.opsys_type ot,
      oplweb2.oplweb.dbms_family dd, 
      oplweb2.oplweb.opsys_family oo
    where 
      pp.opsys_type_id = ot.opsys_type_id and
      pp.opsys_family_id = oo.opsys_family_id and 
      pp.dbms_family_id = dd.dbms_family_id 
      and 
      pp.product_release_id = '6.1'
  ;

grant select on oplweb2.DBA.license_model_units to "SPARQL", "SPARQL_UPDATE";--, rdf;



drop view oplweb2.DBA.product_general_discount_vc;

create view oplweb2.DBA.product_general_discount_vc as 
  select  distinct
      product_release_id, 
      pgd.product_cat_id, pc.product_cat_code, 
      pgd.product_format_id, pc.product_format_code,
	  pc.product_id,
      pgd.opsys_family_id, pgd.dbms_family_id,
      pgd.opsys_type_id,
      product_discount_description,
      product_price_type_id,
      cast(unit_discount as varchar) as unit_discount, 
      discount_start,
      discount_end, 
      discount_token
    from 
      oplweb2.oplweb.product_general_discount pgd,
      oplweb2.oplweb.product_with_code pc
    where 
      pgd.product_format_id = pc.product_format_id and
      pgd.product_cat_id = pc.product_cat_id 
  ;

drop view oplweb2.DBA.product_price_varchar;

create view oplweb2.DBA.product_price_varchar as 
  select 
      pp.product_price_id,
      pp.product_release_id, 
      pp.product_cat_id, pc.product_cat_code, 
      pp.product_format_id, pf.product_format_code,
      pp.opsys_family_id, pp.dbms_family_id,
      replace(oo.opsys_family_name, ' ', '') as opsys_family_name, 
      replace(dd.dbms_family_name,  ' ', '') as dbms_family_name,
      pp.opsys_type_id, ot.short_description as opsys_type_code,
			pp.product_price_type_id, 
      pp.product_price_unit_type_id, cast(pp.unit_price as varchar) as unit_price, 
      pp.component_archive_available
    from 
      oplweb2.oplweb.product_price pp,
      oplweb2.oplweb.product_category pc,
      oplweb2.oplweb.product_format pf,
      oplweb2.oplweb.opsys_type ot,
      oplweb2.oplweb.dbms_family dd, 
      oplweb2.oplweb.opsys_family oo
    where 
      pp.product_format_id = pf.product_format_id and
      pp.product_cat_id = pc.product_cat_id and
      pp.opsys_type_id = ot.opsys_type_id and 
      pp.opsys_family_id = oo.opsys_family_id and 
      pp.dbms_family_id = dd.dbms_family_id 
      --and
      --pp.product_release_id = '6.1'
  ;

grant select on oplweb2.oplweb.product_price to "SPARQL", "SPARQL_UPDATE";--, rdf;
grant select on oplweb2.oplweb.product_price_type to "SPARQL", "SPARQL_UPDATE";--, rdf;
grant select on oplweb2.oplweb.product_price_unit_type to "SPARQL", "SPARQL_UPDATE";--, rdf;
grant select on oplweb2.DBA.product_general_discount_vc to "SPARQL", "SPARQL_UPDATE";--, rdf;
grant select on oplweb2.DBA.product_price_varchar to "SPARQL", "SPARQL_UPDATE";--, rdf;
grant select on oplweb2.DBA.license_model_type to "SPARQL", "SPARQL_UPDATE";--, rdf;



DB.DBA.RDF_AUDIT_METADATA (1, '*');
--DB.DBA.RDF_AUDIT_METADATA (2, '*');

--sparql drop graph <http://www.openlinksw.com/dataspace/organization/openlink/ProductPortfolioOntology/1.0/>;

--possible previous graph now merging with this oplweb graph
sparql drop graph <http://data.openlinksw.com/shop_pricing/>;

--others that have a dependency on this graph that may need kicking first
--sparql drop graph <http://data.openlinksw.com/customer/>;
--sparql drop graph <http://data.openlinksw.com/support/>;
--sparql drop graph <http://data.openlinksw.com/shop_pricing/>;

sparql drop graph <http://www.openlinksw.com/schemas/oplweb#> ;

sparql drop graph <http://www.openlinksw.com/dataspace/organization/openlink/oplweb#> ;
sparql drop graph <http://www.openlinksw.com/dataspace/organization/openlink/oplweb/> ;


-- should now use <http://www.openlinksw.com/dataspace/organization/openlink#this>

sparql drop quad map virtrdf:product_portfolio ;

--only use this if you really really mean it, it will totally nuke your RDF data, useful on 
--test boxes in a bit of jam (hasn't happened to me for a while now)
--rdf_global_reset();

--utility for stripping url killing stuff from friendly strings used as ids
create function oplweb2.oplweb.FIXUP4URI (in _string varchar) 
	returns varchar
	{
	  declare _s varchar;
      _s := replace (_string, ' ', '');
      _s := replace (_s, '&', '_');
      _s := replace (_s, '/', '');
      return _s;
	}
	;
	
--URI-IRI mapping functions	
create function oplweb2.oplweb.DOWNLOAD_LOCATION_URI (in uri varchar)
returns varchar
{
  return sprintf('http://data.openlinksw.com/oplweb/download_location/%s#this', 
  	replace(uri, 'http://', ''));
};

create function oplweb2.oplweb.DOWNLOAD_LOCATION_URI_INVERSE (in dl_iri varchar)
returns varchar
{
  declare parts any;

  parts := sprintf_inverse(dl_iri,
  	'http://data.openlinksw.com/oplweb/download_location/%s#this', 1);
  if (parts is not null)
    {
      return sprintf('http://%s', parts[0]);
    }
  return NULL;
};

GRANT EXECUTE ON oplweb2.oplweb.DOWNLOAD_LOCATION_URI TO "SPARQL", "SPARQL_UPDATE";
GRANT EXECUTE ON oplweb2.oplweb.DOWNLOAD_LOCATION_URI_INVERSE TO "SPARQL", "SPARQL_UPDATE";


create function oplweb2.oplweb.DBMS_FAMILY_URI (in _family_id integer)
returns varchar
{
  declare _family_string varchar;
  select dbms_family_name into _family_string 
    from oplweb2.oplweb.dbms_family 
    where dbms_family_id = _family_id ;

  return sprintf('http://data.openlinksw.com/oplweb/dbms_family/%s#this', 
  	oplweb2.oplweb.FIXUP4URI(_family_string));
};

create function oplweb2.oplweb.DBMS_FAMILY_URI_INVERSE (in _iri varchar)
returns integer
{
  declare parts any;
  declare _family_id integer;

  parts := sprintf_inverse(_iri,
  	'http://data.openlinksw.com/oplweb/dbms_family/%s#this', 1);
  if (parts is not null)
    {
      declare exit handler for not found return null;
      select top 1 dbms_family_id into _family_id from oplweb2.oplweb.dbms_family 
        where lower(oplweb2.oplweb.FIXUP4URI(dbms_family_name)) = lower(parts[0]);
      return _family_id;
    }
  return NULL;
};

GRANT EXECUTE ON oplweb2.oplweb.DBMS_FAMILY_URI TO "SPARQL", "SPARQL_UPDATE";
GRANT EXECUTE ON oplweb2.oplweb.DBMS_FAMILY_URI_INVERSE TO "SPARQL", "SPARQL_UPDATE";


create function oplweb2.oplweb.COMPONENT_CATEGORY_URI (in _id integer)
returns varchar
{
  declare _string varchar;
  select short_description into _string 
    from oplweb2.oplweb.component_category 
    where component_category_id = _id ;

  return sprintf('http://data.openlinksw.com/oplweb/component_category/%s#this', 
  	oplweb2.oplweb.FIXUP4URI(_string));
};

create function oplweb2.oplweb.COMPONENT_CATEGORY_URI_INVERSE (in _iri varchar)
returns integer
{
  declare parts any;
  declare _id integer;

  parts := sprintf_inverse(_iri,
  	'http://data.openlinksw.com/oplweb/component_category/%s#this', 1);
  if (parts is not null)
    {
      declare exit handler for not found return null;
      select top 1 component_category_id into _id from oplweb2.oplweb.component_category 
        where lower(oplweb2.oplweb.FIXUP4URI(short_description)) = lower(parts[0]);
      return _id;
    }
  return NULL;
};

GRANT EXECUTE ON oplweb2.oplweb.COMPONENT_CATEGORY_URI TO "SPARQL", "SPARQL_UPDATE";
GRANT EXECUTE ON oplweb2.oplweb.COMPONENT_CATEGORY_URI_INVERSE TO "SPARQL", "SPARQL_UPDATE";


create function oplweb2.oplweb.COMPONENT_MODE_URI (in _id integer)
returns varchar
{
  declare _string varchar;
  select short_description into _string 
    from oplweb2.oplweb.component_mode 
    where component_mode_id = _id ;

  return sprintf('http://data.openlinksw.com/oplweb/component_mode/%s#this', 
  	oplweb2.oplweb.FIXUP4URI(_string));
};

create function oplweb2.oplweb.COMPONENT_MODE_URI_INVERSE (in _iri varchar)
returns integer
{
  declare parts any;
  declare _id integer;

  parts := sprintf_inverse(_iri,
  	'http://data.openlinksw.com/oplweb/component_mode/%s#this', 1);
  if (parts is not null)
    {
      declare exit handler for not found return null;
      select top 1 component_mode_id into _id from oplweb2.oplweb.component_mode 
        where lower(oplweb2.oplweb.FIXUP4URI(short_description)) = lower(parts[0]);
      return _id;
    }
  return NULL;
};

GRANT EXECUTE ON oplweb2.oplweb.COMPONENT_MODE_URI TO "SPARQL", "SPARQL_UPDATE";
GRANT EXECUTE ON oplweb2.oplweb.COMPONENT_MODE_URI_INVERSE TO "SPARQL", "SPARQL_UPDATE";


create function oplweb2.oplweb.COMPONENT_TYPE_URI (in _id integer)
returns varchar
{
  declare _string varchar;
  select short_description into _string 
    from oplweb2.oplweb.component_type 
    where component_type_id = _id ;

  return sprintf('http://data.openlinksw.com/oplweb/component_type/%s#this', 
  	oplweb2.oplweb.FIXUP4URI(_string));
};

create function oplweb2.oplweb.COMPONENT_TYPE_URI_INVERSE (in _iri varchar)
returns integer
{
  declare parts any;
  declare _id integer;

  parts := sprintf_inverse(_iri,
  	'http://data.openlinksw.com/oplweb/component_type/%s#this', 1);
  if (parts is not null)
    {
      declare exit handler for not found return null;
      select top 1 component_type_id into _id from oplweb2.oplweb.component_type 
        where lower(oplweb2.oplweb.FIXUP4URI(short_description)) = lower(parts[0]);
      return _id;
    }
  return NULL;
};

GRANT EXECUTE ON oplweb2.oplweb.COMPONENT_TYPE_URI TO "SPARQL", "SPARQL_UPDATE";
GRANT EXECUTE ON oplweb2.oplweb.COMPONENT_TYPE_URI_INVERSE TO "SPARQL", "SPARQL_UPDATE";



create function oplweb2.oplweb.COMPONENT_ARCHIVE_TYPE_URI (in _id integer)
returns varchar
{
  declare _string varchar;
  select component_archive_short_name into _string 
    from oplweb2.oplweb.component_archive_type 
    where component_archive_type_id = _id ;

  return sprintf('http://data.openlinksw.com/oplweb/component_archive_type/%s#this', 
  	oplweb2.oplweb.FIXUP4URI(_string));
};

create function oplweb2.oplweb.COMPONENT_ARCHIVE_TYPE_URI_INVERSE (in _iri varchar)
returns integer
{
  declare parts any;
  declare _id integer;

  parts := sprintf_inverse(_iri,
  	'http://data.openlinksw.com/oplweb/component_archive_type/%s#this', 1);
  if (parts is not null)
    {
      declare exit handler for not found return null;
      select top 1 component_archive_type_id into _id from oplweb2.oplweb.component_archive_type 
        where lower(oplweb2.oplweb.FIXUP4URI(component_archive_short_name)) = lower(parts[0]);
      return _id;
    }
  return NULL;
};

GRANT EXECUTE ON oplweb2.oplweb.COMPONENT_ARCHIVE_TYPE_URI TO "SPARQL", "SPARQL_UPDATE";
GRANT EXECUTE ON oplweb2.oplweb.COMPONENT_ARCHIVE_TYPE_URI_INVERSE TO "SPARQL", "SPARQL_UPDATE";



create function oplweb2.oplweb.FEATURE_BENEFIT_URI (in _id integer)
returns varchar
{
  declare _string varchar;
  select product_benefit_desc into _string 
    from oplweb2.oplweb.product_benefits 
    where product_benefit_id = _id ;

  return sprintf('http://data.openlinksw.com/oplweb/feature_benefit/%s#this', 
  	oplweb2.oplweb.FIXUP4URI(_string));
};

create function oplweb2.oplweb.FEATURE_BENEFIT_URI_INVERSE (in _iri varchar)
returns integer
{
  declare parts any;
  declare _id integer;

  parts := sprintf_inverse(_iri,
  	'http://data.openlinksw.com/oplweb/feature_benefit/%s#this', 1);
  if (parts is not null)
    {
      declare exit handler for not found return null;
      select top 1 product_benefit_id into _id from oplweb2.oplweb.product_benefits 
        where lower(oplweb2.oplweb.FIXUP4URI(product_benefit_desc)) = lower(parts[0]);
      return _id;
    }
  return NULL;
};

GRANT EXECUTE ON oplweb2.oplweb.FEATURE_BENEFIT_URI TO "SPARQL", "SPARQL_UPDATE";
GRANT EXECUTE ON oplweb2.oplweb.FEATURE_BENEFIT_URI_INVERSE TO "SPARQL", "SPARQL_UPDATE";



create function oplweb2.oplweb.OPSYS_FAMILY_URI (in _id integer)
returns varchar
{
  declare _string varchar;
  select opsys_family_name into _string 
    from oplweb2.oplweb.opsys_family
    where opsys_family_id = _id ;

  return sprintf('http://data.openlinksw.com/oplweb/opsys_family/%s#this', 
  	oplweb2.oplweb.FIXUP4URI(_string));
};

create function oplweb2.oplweb.OPSYS_FAMILY_URI_INVERSE (in _iri varchar)
returns integer
{
  declare parts any;
  declare _id integer;

  parts := sprintf_inverse(_iri,
  	'http://data.openlinksw.com/oplweb/opsys_family/%s#this', 1);
  if (parts is not null)
    {
      declare exit handler for not found return null;
      select top 1 opsys_family_id into _id from oplweb2.oplweb.opsys_family
        where lower(oplweb2.oplweb.FIXUP4URI(opsys_family_name)) = lower(parts[0]);
      return _id;
    }
  return NULL;
};

GRANT EXECUTE ON oplweb2.oplweb.OPSYS_FAMILY_URI TO "SPARQL", "SPARQL_UPDATE";
GRANT EXECUTE ON oplweb2.oplweb.OPSYS_FAMILY_URI_INVERSE TO "SPARQL", "SPARQL_UPDATE";



create function oplweb2.oplweb.OPSYS_TYPE_URI (in _id integer)
returns varchar
{
  declare _string varchar;
  select short_description into _string 
    from oplweb2.oplweb.opsys_type
    where opsys_type_id = _id ;

  return sprintf('http://data.openlinksw.com/oplweb/opsys_type/%s#this', 
  	oplweb2.oplweb.FIXUP4URI(_string));
};

create function oplweb2.oplweb.OPSYS_TYPE_URI_INVERSE (in _iri varchar)
returns integer
{
  declare parts any;
  declare _id integer;

  parts := sprintf_inverse(_iri,
  	'http://data.openlinksw.com/oplweb/opsys_type/%s#this', 1);
  if (parts is not null)
    {
      declare exit handler for not found return null;
      select top 1 opsys_type_id into _id from oplweb2.oplweb.opsys_type 
        where lower(oplweb2.oplweb.FIXUP4URI(short_description)) = lower(parts[0]);
      return _id;
    }
  return NULL;
};

GRANT EXECUTE ON oplweb2.oplweb.OPSYS_TYPE_URI TO "SPARQL", "SPARQL_UPDATE";
GRANT EXECUTE ON oplweb2.oplweb.OPSYS_TYPE_URI_INVERSE TO "SPARQL", "SPARQL_UPDATE";


create function oplweb2.oplweb.PROCESSOR_FAMILY_URI (in _id integer)
returns varchar
{
  declare _string varchar;
  select processor_family_name into _string 
    from oplweb2.oplweb.processor_family
    where processor_family_id = _id ;

  return sprintf('http://data.openlinksw.com/oplweb/processor_family/%s#this', 
  	oplweb2.oplweb.FIXUP4URI(_string));
};

create function oplweb2.oplweb.PROCESSOR_FAMILY_URI_INVERSE (in _iri varchar)
returns integer
{
  declare parts any;
  declare _id integer;

  parts := sprintf_inverse(_iri,
  	'http://data.openlinksw.com/oplweb/processor_family/%s#this', 1);
  if (parts is not null)
    {
      declare exit handler for not found return null;
      select top 1 processor_family_id into _id from oplweb2.oplweb.processor_family 
        where lower(oplweb2.oplweb.FIXUP4URI(processor_family_name)) = lower(parts[0]);
      return _id;
    }
  return NULL;
};

GRANT EXECUTE ON oplweb2.oplweb.PROCESSOR_FAMILY_URI TO "SPARQL", "SPARQL_UPDATE";
GRANT EXECUTE ON oplweb2.oplweb.PROCESSOR_FAMILY_URI_INVERSE TO "SPARQL", "SPARQL_UPDATE";

--FIXME might have to do something with possible & symbols
create function oplweb2.oplweb.PROCESSOR_MODE_URI (in _id integer)
returns varchar
{
  declare _string varchar;
  select processor_mode_name into _string 
    from oplweb2.oplweb.processor_mode
    where processor_mode_id = _id ;

  return sprintf('http://data.openlinksw.com/oplweb/processor_mode/%s#this', 
  	oplweb2.oplweb.FIXUP4URI(_string));
};

create function oplweb2.oplweb.PROCESSOR_MODE_URI_INVERSE (in _iri varchar)
returns integer
{
  declare parts any;
  declare _id integer;

  parts := sprintf_inverse(_iri,
  	'http://data.openlinksw.com/oplweb/processor_mode/%s#this', 1);
  if (parts is not null)
    {
      declare exit handler for not found return null;
      select top 1 processor_mode_id into _id from oplweb2.oplweb.processor_mode 
        where lower(oplweb2.oplweb.FIXUP4URI(processor_mode_name)) = lower(parts[0]);
      return _id;
    }
  return NULL;
};

GRANT EXECUTE ON oplweb2.oplweb.PROCESSOR_MODE_URI TO "SPARQL", "SPARQL_UPDATE";
GRANT EXECUTE ON oplweb2.oplweb.PROCESSOR_MODE_URI_INVERSE TO "SPARQL", "SPARQL_UPDATE";


create function oplweb2.oplweb.PRODUCT_CATEGORY_FEATURE_URI (in _id integer)
returns varchar
{
  declare _string varchar;
  select short_description into _string 
    from oplweb2.oplweb.product_category_features 
    where product_category_feature_id = _id ;

  return sprintf('http://data.openlinksw.com/oplweb/product_category_feature/%s#this', 
  	oplweb2.oplweb.FIXUP4URI(_string));
};

create function oplweb2.oplweb.PRODUCT_CATEGORY_FEATURE_URI_INVERSE (in _iri varchar)
returns integer
{
  declare parts any;
  declare _id integer;

  parts := sprintf_inverse(_iri,
  	'http://data.openlinksw.com/oplweb/product_category_feature/%s#this', 1);
  if (parts is not null)
    {
      declare exit handler for not found return null;
      select top 1 product_category_feature_id into _id from oplweb2.oplweb.product_category_features 
        where lower(oplweb2.oplweb.FIXUP4URI(short_description)) = lower(parts[0]);
      return _id;
    }
  return NULL;
};

GRANT EXECUTE ON oplweb2.oplweb.PRODUCT_CATEGORY_FEATURE_URI TO "SPARQL", "SPARQL_UPDATE";
GRANT EXECUTE ON oplweb2.oplweb.PRODUCT_CATEGORY_FEATURE_URI_INVERSE TO "SPARQL", "SPARQL_UPDATE";


create function oplweb2.oplweb.PRODUCT_FAMILY_FEATURE_URI (in _id integer)
returns varchar
{
  declare _string varchar;
  select short_description into _string 
    from oplweb2.oplweb.product_family_features 
    where product_family_feature_id = _id ;

  return sprintf('http://data.openlinksw.com/oplweb/product_family_feature/%s#this', 
  	oplweb2.oplweb.FIXUP4URI(_string));
};

create function oplweb2.oplweb.PRODUCT_FAMILY_FEATURE_URI_INVERSE (in _iri varchar)
returns integer
{
  declare parts any;
  declare _id integer;

  parts := sprintf_inverse(_iri,
  	'http://data.openlinksw.com/oplweb/product_family_feature/%s#this', 1);
  if (parts is not null)
    {
      declare exit handler for not found return null;
      select top 1 product_family_feature_id into _id from oplweb2.oplweb.product_family_features 
        where lower(oplweb2.oplweb.FIXUP4URI(short_description)) = lower(parts[0]);
      return _id;
    }
  return NULL;
};

GRANT EXECUTE ON oplweb2.oplweb.PRODUCT_FAMILY_FEATURE_URI TO "SPARQL", "SPARQL_UPDATE";
GRANT EXECUTE ON oplweb2.oplweb.PRODUCT_FAMILY_FEATURE_URI_INVERSE TO "SPARQL", "SPARQL_UPDATE";


create function oplweb2.oplweb.PRODUCT_FEATURE_CATEGORY_URI (in _id integer)
returns varchar
{
  declare _string varchar;
  select short_desc into _string 
    from oplweb2.oplweb.product_feature_category 
    where product_feature_category_id = _id ;

  return sprintf('http://data.openlinksw.com/oplweb/product_feature_category/%s#this', 
  	oplweb2.oplweb.FIXUP4URI(_string));
};

create function oplweb2.oplweb.PRODUCT_FEATURE_CATEGORY_URI_INVERSE (in _iri varchar)
returns integer
{
  declare parts any;
  declare _id integer;

  parts := sprintf_inverse(_iri,
  	'http://data.openlinksw.com/oplweb/product_feature_category/%s#this', 1);
  if (parts is not null)
    {
      declare exit handler for not found return null;
      select top 1 product_feature_category_id into _id from oplweb2.oplweb.product_feature_category 
        where lower(oplweb2.oplweb.FIXUP4URI(short_desc)) = lower(parts[0]);
      return _id;
    }
  return NULL;
};

GRANT EXECUTE ON oplweb2.oplweb.PRODUCT_FEATURE_CATEGORY_URI TO "SPARQL", "SPARQL_UPDATE";
GRANT EXECUTE ON oplweb2.oplweb.PRODUCT_FEATURE_CATEGORY_URI_INVERSE TO "SPARQL", "SPARQL_UPDATE";


create function oplweb2.oplweb.PRODUCT_FEATURE_URI (in _id integer)
returns varchar
{
  declare _string varchar;
  select short_description into _string 
    from oplweb2.oplweb.product_features 
    where product_feature_id = _id ;

  return sprintf('http://data.openlinksw.com/oplweb/product_feature/%s#this', 
  	oplweb2.oplweb.FIXUP4URI(_string));
};

create function oplweb2.oplweb.PRODUCT_FEATURE_URI_INVERSE (in _iri varchar)
returns integer
{
  declare parts any;
  declare _id integer;

  parts := sprintf_inverse(_iri,
  	'http://data.openlinksw.com/oplweb/product_feature/%s#this', 1);
  if (parts is not null)
    {
      declare exit handler for not found return null;
      select top 1 product_feature_id into _id from oplweb2.oplweb.product_features 
        where lower(oplweb2.oplweb.FIXUP4URI(short_description)) = lower(parts[0]);
      return _id;
    }
  return NULL;
};

GRANT EXECUTE ON oplweb2.oplweb.PRODUCT_FEATURE_URI TO "SPARQL", "SPARQL_UPDATE";
GRANT EXECUTE ON oplweb2.oplweb.PRODUCT_FEATURE_URI_INVERSE TO "SPARQL", "SPARQL_UPDATE";


create function oplweb2.oplweb.PRODUCT_FORMAT_FEATURE_URI (in _id integer)
returns varchar
{
  declare _string varchar;
  select short_description into _string 
    from oplweb2.oplweb.product_format_features 
    where product_format_feature_id = _id ;

  return sprintf('http://data.openlinksw.com/oplweb/product_format_feature/%s#this', 
  	oplweb2.oplweb.FIXUP4URI(_string));
};

create function oplweb2.oplweb.PRODUCT_FORMAT_FEATURE_URI_INVERSE (in _iri varchar)
returns integer
{
  declare parts any;
  declare _id integer;

  parts := sprintf_inverse(_iri,
  	'http://data.openlinksw.com/oplweb/product_format_feature/%s#this', 1);
  if (parts is not null)
    {
      declare exit handler for not found return null;
      select top 1 product_format_feature_id into _id from oplweb2.oplweb.product_format_features 
        where lower(oplweb2.oplweb.FIXUP4URI(short_description)) = lower(parts[0]);
      return _id;
    }
  return NULL;
};

GRANT EXECUTE ON oplweb2.oplweb.PRODUCT_FORMAT_FEATURE_URI TO "SPARQL", "SPARQL_UPDATE";
GRANT EXECUTE ON oplweb2.oplweb.PRODUCT_FORMAT_FEATURE_URI_INVERSE TO "SPARQL", "SPARQL_UPDATE";


create function oplweb2.oplweb.PRODUCT_RELEASE_FEATURE_URI (in _id integer)
returns varchar
{
  declare _string varchar;
  select short_description into _string 
    from oplweb2.oplweb.product_release_features 
    where product_release_feature_id = _id ;

  return sprintf('http://data.openlinksw.com/oplweb/product_release_feature/%s#this', 
  	oplweb2.oplweb.FIXUP4URI(_string));
};

create function oplweb2.oplweb.PRODUCT_RELEASE_FEATURE_URI_INVERSE (in _iri varchar)
returns integer
{
  declare parts any;
  declare _id integer;

  parts := sprintf_inverse(_iri,
  	'http://data.openlinksw.com/oplweb/product_release_feature/%s#this', 1);
  if (parts is not null)
    {
      declare exit handler for not found return null;
      select top 1 product_release_feature_id into _id from oplweb2.oplweb.product_release_features 
        where lower(oplweb2.oplweb.FIXUP4URI(short_description)) = lower(parts[0]);
      return _id;
    }
  return NULL;
};

GRANT EXECUTE ON oplweb2.oplweb.PRODUCT_RELEASE_FEATURE_URI TO "SPARQL", "SPARQL_UPDATE";
GRANT EXECUTE ON oplweb2.oplweb.PRODUCT_RELEASE_FEATURE_URI_INVERSE TO "SPARQL", "SPARQL_UPDATE";


create function oplweb2.oplweb.PRODUCT_BENEFIT_URI (in _id integer)
returns varchar
{
  declare _string varchar;
  select product_benefit_desc into _string 
    from oplweb2.oplweb.product_benefits 
    where product_benefit_id = _id ;

  return sprintf('http://data.openlinksw.com/oplweb/product_benefit/%s#this', 
  	oplweb2.oplweb.FIXUP4URI(_string));
};

create function oplweb2.oplweb.PRODUCT_BENEFIT_URI_INVERSE (in _iri varchar)
returns integer
{
  declare parts any;
  declare _id integer;

  parts := sprintf_inverse(_iri,
  	'http://data.openlinksw.com/oplweb/product_benefit/%s#this', 1);
  if (parts is not null)
    {
      declare exit handler for not found return null;
      select top 1 product_benefit_id into _id from oplweb2.oplweb.product_benefits 
        where lower(oplweb2.oplweb.FIXUP4URI(product_benefit_desc)) = lower(parts[0]);
      return _id;
    }
  return NULL;
};

GRANT EXECUTE ON oplweb2.oplweb.PRODUCT_BENEFIT_URI TO "SPARQL", "SPARQL_UPDATE";
GRANT EXECUTE ON oplweb2.oplweb.PRODUCT_BENEFIT_URI_INVERSE TO "SPARQL", "SPARQL_UPDATE";


create function oplweb2.oplweb.PRODUCT_BENEFIT_CATEGORY_URI (in _id integer)
returns varchar
{
  declare _string varchar;
  select description into _string 
    from oplweb2.oplweb.product_benefits_category 
    where product_benefit_category_id = _id ;

  return sprintf('http://data.openlinksw.com/oplweb/product_benefit_category/%s#this', 
  	oplweb2.oplweb.FIXUP4URI(_string));
};

create function oplweb2.oplweb.PRODUCT_BENEFIT_CATEGORY_URI_INVERSE (in _iri varchar)
returns integer
{
  declare parts any;
  declare _id integer;

  parts := sprintf_inverse(_iri,
  	'http://data.openlinksw.com/oplweb/product_benefit_category/%s#this', 1);
  if (parts is not null)
    {
      declare exit handler for not found return null;
      select top 1 product_benefit_category_id into _id from oplweb2.oplweb.product_benefits_category 
        where lower(oplweb2.oplweb.FIXUP4URI(description)) = lower(parts[0]);
      return _id;
    }
  return NULL;
};

GRANT EXECUTE ON oplweb2.oplweb.PRODUCT_BENEFIT_CATEGORY_URI TO "SPARQL", "SPARQL_UPDATE";
GRANT EXECUTE ON oplweb2.oplweb.PRODUCT_BENEFIT_CATEGORY_URI_INVERSE TO "SPARQL", "SPARQL_UPDATE";


create function oplweb2.oplweb.VENDOR_URI (in _id integer)
returns varchar
{
  declare _string varchar;
  select vendor_name into _string 
    from oplweb2.oplweb.vendors 
    where vendor_id = _id ;

  return sprintf('http://data.openlinksw.com/oplweb/vendor/%s#this', 
  	oplweb2.oplweb.FIXUP4URI(_string));
};

create function oplweb2.oplweb.VENDOR_URI_INVERSE (in _iri varchar)
returns integer
{
  declare parts any;
  declare _id integer;

  parts := sprintf_inverse(_iri,
  	'http://data.openlinksw.com/oplweb/vendor/%s#this', 1);
  if (parts is not null)
    {
      declare exit handler for not found return null;
      select top 1 vendor_id into _id from oplweb2.oplweb.vendors 
        where lower(oplweb2.oplweb.FIXUP4URI(vendor_name)) = lower(parts[0]);
      return _id;
    }
  return NULL;
};

GRANT EXECUTE ON oplweb2.oplweb.VENDOR_URI TO "SPARQL", "SPARQL_UPDATE";
GRANT EXECUTE ON oplweb2.oplweb.VENDOR_URI_INVERSE TO "SPARQL", "SPARQL_UPDATE";


create function oplweb2.oplweb.VENDOR_CATEGORY_URI (in _id integer)
returns varchar
{
  declare _string varchar;
  select vendor_category_description into _string 
    from oplweb2.oplweb.vendor_category 
    where vendor_category_id = _id ;

  return sprintf('http://data.openlinksw.com/oplweb/vendor_category/%s#this', 
  	oplweb2.oplweb.FIXUP4URI(_string));
};

create function oplweb2.oplweb.VENDOR_CATEGORY_URI_INVERSE (in _iri varchar)
returns integer
{
  declare parts any;
  declare _id integer;

  parts := sprintf_inverse(_iri,
  	'http://data.openlinksw.com/oplweb/vendor_category/%s#this', 1);
  if (parts is not null)
    {
      declare exit handler for not found return null;
      select top 1 vendor_category_id into _id from oplweb2.oplweb.vendor_category 
        where lower(oplweb2.oplweb.FIXUP4URI(vendor_category_description)) = lower(parts[0]);
      return _id;
    }
  return NULL;
};

GRANT EXECUTE ON oplweb2.oplweb.VENDOR_CATEGORY_URI TO "SPARQL", "SPARQL_UPDATE";
GRANT EXECUTE ON oplweb2.oplweb.VENDOR_CATEGORY_URI_INVERSE TO "SPARQL", "SPARQL_UPDATE";


create function oplweb2.oplweb.VENDOR_CATEGORY_FAMILY_URI (in _id integer)
returns varchar
{
  declare _string varchar;
  select vendor_category_family_desc into _string 
    from oplweb2.oplweb.vendor_category_family 
    where vendor_category_family_id = _id ;

  return sprintf('http://data.openlinksw.com/oplweb/vendor_category_family/%s#this', 
  	oplweb2.oplweb.FIXUP4URI(_string));
};

create function oplweb2.oplweb.VENDOR_CATEGORY_FAMILY_URI_INVERSE (in _iri varchar)
returns integer
{
  declare parts any;
  declare _id integer;

  parts := sprintf_inverse(_iri,
  	'http://data.openlinksw.com/oplweb/vendor_category_family/%s#this', 1);
  if (parts is not null)
    {
      declare exit handler for not found return null;
      select top 1 vendor_category_family_id into _id from oplweb2.oplweb.vendor_category_family 
        where lower(oplweb2.oplweb.FIXUP4URI(vendor_category_family_desc)) = lower(parts[0]);
      return _id;
    }
  return NULL;
};

GRANT EXECUTE ON oplweb2.oplweb.VENDOR_CATEGORY_FAMILY_URI TO "SPARQL", "SPARQL_UPDATE";
GRANT EXECUTE ON oplweb2.oplweb.VENDOR_CATEGORY_FAMILY_URI_INVERSE TO "SPARQL", "SPARQL_UPDATE";





create function oplweb2.oplweb.LIT_PRODUCT_RELEASE_LABEL (
	in _product_id varchar, in _id integer, in _opsys_name varchar, in _dbms_name varchar
	)
returns varchar
{
  declare _string varchar;
  select 'OpenLink ' || poduct_description || ' (Release ' || product_release_id || ') on ' || commercial_name into _string 
    from oplweb2.oplweb.product_release pr,
      oplweb2.oplweb.product p,
      oplweb2.oplweb.opsys o  
    where 
      p.product_id = pr.product_id and 
      o.opsys_name = pr.opsys_name and
      pr.product_release_id = _id and
      pr.product_id = _product_id and 
      pr.opsys_name = _opsys_name and 
      pr.dbms_name = _dbms_name ;

  return _string;
};

GRANT EXECUTE ON oplweb2.oplweb.LIT_PRODUCT_RELEASE_LABEL TO "SPARQL", "SPARQL_UPDATE";


create function oplweb2.oplweb.LIT_FORMAT_CAT_LABEL (
	in _format integer, in _cat integer
	)
returns varchar
{
  declare _string varchar;
  select top 1 'OpenLink ' || cast(product_format_description as varchar) || ' ' || cast(product_category_description as varchar) into _string 
    from 
      oplweb2.oplweb.product_formats_categories fc,
      oplweb2.oplweb.product_format f,
      oplweb2.oplweb.product_category c
    where 
fc.product_format_id = f.product_format_id and 
fc.product_cat_id = c.product_cat_id and
    fc.product_format_id = _format and 
    fc.product_cat_id = _cat;

  return _string;
};

GRANT EXECUTE ON oplweb2.oplweb.LIT_FORMAT_CAT_LABEL TO "SPARQL", "SPARQL_UPDATE";


create function oplweb2.oplweb.LITRDF_openlink_logo (in _code varchar)
returns varchar
{
  declare _string varchar;
  select top 1 product_family_logo_url into _string 
    from oplweb2.oplweb.product_family
    where product_family_code = _code;

  return _string;
};

GRANT EXECUTE ON oplweb2.oplweb.LITRDF_openlink_logo TO "SPARQL", "SPARQL_UPDATE";


create function oplweb2.oplweb.LITRDF_homepage (in _code varchar)
returns varchar
{
  declare _string varchar;
  select top 1 product_family_homepage into _string 
    from oplweb2.oplweb.product_family
    where product_family_code = _code;

  return _string;
};

GRANT EXECUTE ON oplweb2.oplweb.LITRDF_homepage TO "SPARQL", "SPARQL_UPDATE";


create function oplweb2.oplweb.LITRDF_opsys_icon (in _id integer)
returns varchar
{
  declare _string varchar; _string := '';
  select top 1 opsys_icon_name into _string 
    from oplweb2.oplweb.opsys_family
    where opsys_family_id = _id;

  _string := 'http://download.openlinksw.com/download/images/'||_string;

  return _string;
};

GRANT EXECUTE ON oplweb2.oplweb.LITRDF_opsys_icon TO "SPARQL", "SPARQL_UPDATE";


create function oplweb2.oplweb.LITRDF_to_shop (
	in release_id varchar,
	in product_id varchar,
	in opsys varchar, 
	in dbms varchar
	)
returns varchar
{
  declare _string varchar; _string := '';
  declare _cat, _format, _prod varchar;

  _prod := product_id;

  select top 1 cast(product_cat_id as varchar), cast(product_format_id as varchar)
      into _cat, _format
    from oplweb2.oplweb.product p
    where p.product_id = _prod;

  _string := sprintf(
	'https://shop.openlinksw.com/?product_release_id=%s&product=%s&product_cat=%V&product_format=%V&os=%s&db=%s&buyme=yes',
	release_id, product_id, _cat, _format, opsys, dbms
	);
  
  return _string;
};

GRANT EXECUTE ON oplweb2.oplweb.LITRDF_to_shop TO "SPARQL", "SPARQL_UPDATE";
  

create function oplweb2.oplweb.LITRDF_license_model_type (
		in _product_price_type_id integer
	)
returns varchar
{
  declare _string varchar; _string := '';

  select top 1 product_price_type_description into _string from oplweb2.oplweb.product_price_type 
    where product_price_type_id = _product_price_type_id;

  return _string || ' License';
};

GRANT EXECUTE ON oplweb2.oplweb.LITRDF_license_model_type TO "SPARQL", "SPARQL_UPDATE";
  

create function oplweb2.oplweb.LITRDF_license_model_explain (
		in _product_price_type_id integer
	)
returns varchar
{
  declare _string varchar; _string := '';

  select top 1 product_price_type_long_description into _string from oplweb2.oplweb.product_price_type 
    where product_price_type_id = _product_price_type_id;

  return _string;
};

GRANT EXECUTE ON oplweb2.oplweb.LITRDF_license_model_explain TO "SPARQL", "SPARQL_UPDATE";


create function oplweb2.oplweb.LITRDF_shop_sample (
	in release_id varchar,
	in product_id varchar,
	in opsys varchar, 
	in dbms varchar
	)
returns varchar
{
  declare _string varchar; _string := '';
  declare _cat, _format, _prod, _pricetype varchar;

  _prod := product_id;

  select top 1 cast(product_cat_id as varchar), cast(product_format_id as varchar), cast(product_price_type_id as varchar)
      into _cat, _format, _pricetype
    from oplweb2.DBA.license_model p, oplweb2.oplweb.opsys o, oplweb2.oplweb.dbms_engine e
    where p.product_id = _prod and product_release_id = release_id and o.opsys_name = opsys and e.dbms_name = dbms
      and p.dbms_family_id = e.dbms_family_id and o.opsys_family_id = p.opsys_family_id;

  _string := sprintf(
	'https://shop.openlinksw.com/price_calc.vsp?release=%s&cat=%V&format=%V&os=%s&db=%s&lictype=%V',
	release_id, _cat, _format, opsys, dbms, _pricetype
	);
  
  return http_client(_string);
};

GRANT EXECUTE ON oplweb2.oplweb.LITRDF_shop_sample TO "SPARQL", "SPARQL_UPDATE";


-- $Id: oplweb_rdf_view_def.sql,v 1.2 2008/10/31 10:44:42 oplmis Exp $
-- Setup script for Linked Data View of OpenLink Product Portfolio version 2
--

--
-- This view is currently designed to SPECIFICALLY load on data.openlinksw.com.  The default URI macro has NOT 
-- been used here because it makes no sense on the target box which is actually my.usnet.private:8891 or 
-- something similar.  If you want to use this view on another box, a simple search-replace should do the trick,
-- but search-replace just`data.openlinksw.com' because http:// is sometimes encoded and you would miss it.
-- 
-- 

  
  

sparql drop quad map virtrdf:product_portfolio2 ;
sparql drop quad map virtrdf:product_portfolio ;

sparql

prefix opl: <http://www.openlinksw.com/schemas/oplweb#>

drop iri class opl:DownloadLocation .
drop iri class opl:ComponentCategory .
drop iri class opl:Component .
drop iri class opl:ComponentArchive .
drop iri class opl:ComponentArchiveType .
drop iri class opl:ComponentCategory .
drop iri class opl:ComponentMode .
drop iri class opl:ComponentType .
drop iri class opl:DbmsEngine .
drop iri class opl:DbmsFamily .
drop iri class opl:DownloadProtocol .
drop iri class opl:DownloadPartner .
drop iri class opl:FeatureBenefit .
drop iri class opl:Opsys .
drop iri class opl:OpsysFamily .
drop iri class opl:OpsysType .
drop iri class opl:Processor .
drop iri class opl:ProcessorFamily .
drop iri class opl:ProcessorMode .
drop iri class opl:ProductRelease .
drop iri class opl:Product .
drop iri class opl:ProductCategory .
drop iri class opl:ProductCategoryFeature .
drop iri class opl:ProductPortfolio .
drop iri class opl:ProductFamily .
drop iri class opl:ProductFamilyFeature .
drop iri class opl:ProductFeatureCategory .
drop iri class opl:ProductFeature .
drop iri class opl:ProductFormat .
drop iri class opl:ProductFormatCategory .
drop iri class opl:ProductFormatFeature .
drop iri class opl:ProductReleaseFeature .
drop iri class opl:ProductBenefit .
drop iri class opl:ProductBenefitCategory .
drop iri class opl:Vendor .
drop iri class opl:VendorCategory .
drop iri class opl:VendorCategoryFamily .
drop iri class opl:PriceType .
drop iri class opl:PriceUnitType .
drop iri class opl:PriceUnitIncrementalDiscount .
drop iri class opl:ProductPrice .
drop iri class opl:LicenseType .
drop iri class opl:LicenseModel .
drop iri class opl:LicenseClass .
drop iri class opl:Discount .
drop literal class opl:lit_product_release_label .
drop literal class opl:lit_format_cat_label .
drop literal class opl:lit_openlink_logo .
drop iri class opl:lit_openlink_logo .
drop literal class opl:lit_homepage .
drop iri class opl:lit_homepage .
drop literal class opl:lit_opsys_icon .
drop iri class opl:lit_opsys_icon .
drop literal class opl:lit_to_shop .
drop iri class opl:lit_to_shop .
drop literal class opl:lit_license_model_type .
drop literal class opl:lit_license_model_explain .
drop literal class opl:lit_shop_sample .
drop literal class opl:lit_wikipedia_to_dbpedia .
drop iri class opl:lit_wikipedia_to_dbpedia .
drop literal class opl:lit_to_string .
drop iri class opl:wwwsitefamily .
drop iri class opl:wwwsiteformat .
drop iri class opl:wwwsitecategory .
drop iri class opl:wwwsiteproduct .
;

DB.DBA.RDF_AUDIT_METADATA (1, '*');


sparql

prefix opl: <http://www.openlinksw.com/schemas/oplweb#>

create iri class opl:Component "http://data.openlinksw.com/oplweb/component/%s#this"
	(in component_name varchar not null) .

create iri class opl:ComponentArchive "http://data.openlinksw.com/oplweb/component_archive/%s#this"
	(in component_archive_name varchar not null) .

create iri class opl:ComponentArchiveType using
	function oplweb2.oplweb.COMPONENT_CATEGORY_URI (in _id integer not null)
		returns varchar,
	function oplweb2.oplweb.COMPONENT_CATEGORY_URI_INVERSE (in _iri varchar)
		returns integer 
	option (bijection, returns 'http://data.openlinksw.com/oplweb/component_archive_type/%s#this' ).
		

create iri class opl:ComponentCategory using
	function oplweb2.oplweb.COMPONENT_CATEGORY_URI (in _id integer not null)
		returns varchar,
	function oplweb2.oplweb.COMPONENT_CATEGORY_URI_INVERSE (in _iri varchar)
		returns integer 
	option (bijection, returns 'http://data.openlinksw.com/oplweb/component_category/%s#this' ).

create iri class opl:ComponentMode using
	function oplweb2.oplweb.COMPONENT_MODE_URI (in _id integer not null)
		returns varchar,
	function oplweb2.oplweb.COMPONENT_MODE_URI_INVERSE (in _iri varchar)
		returns integer 
	option (bijection, returns 'http://data.openlinksw.com/oplweb/component_mode/%s#this' ).
				
create iri class opl:ComponentType using
	function oplweb2.oplweb.COMPONENT_TYPE_URI (in _id integer not null)
		returns varchar,
	function oplweb2.oplweb.COMPONENT_TYPE_URI_INVERSE (in _iri varchar)
		returns integer 
	option (bijection, returns 'http://data.openlinksw.com/oplweb/component_type/%s#this' ).

create iri class opl:DbmsFamily using
	function oplweb2.oplweb.DBMS_FAMILY_URI (in _family_id integer not null)
		returns varchar,
	function oplweb2.oplweb.DBMS_FAMILY_URI_INVERSE (in _iri varchar)
		returns integer 
	option (bijection, returns 'http://data.openlinksw.com/oplweb/dbms_family/%s#this' ).

create iri class opl:DbmsEngine "http://data.openlinksw.com/oplweb/dbms_engine/%s#this"
	(in dbms_name varchar not null) .

create iri class opl:DownloadLocation using
	function oplweb2.oplweb.DOWNLOAD_LOCATION_URI (in uri varchar not null)
		returns varchar,
	function oplweb2.oplweb.DOWNLOAD_LOCATION_URI_INVERSE (in dl_iri varchar)
		returns varchar 
	option (bijection, returns 'http://data.openlinksw.com/oplweb/download_location/%s#this' ).

create iri class opl:DownloadProtocol "http://data.openlinksw.com/oplweb/download_protocol/%s#this"
	(in protocol_name varchar not null) .

create iri class opl:DownloadPartner "http://data.openlinksw.com/oplweb/download_partner/%s/%s#this"
	(
	  in host_name varchar not null, 
	  in domain_name varchar not null
	) .

create iri class opl:FeatureBenefit using
  function oplweb2.oplweb.FEATURE_BENEFIT_URI (in _id integer not null) returns varchar,
  function oplweb2.oplweb.FEATURE_BENEFIT_URI_INVERSE (in _iri varchar) returns integer 
	option (bijection, returns 'http://data.openlinksw.com/oplweb/feature_benefit/%s#this' ).

create iri class opl:Opsys "http://data.openlinksw.com/oplweb/opsys/%s#this"
	(in opsys_name varchar not null) .

create iri class opl:OpsysFamily 	using
  function oplweb2.oplweb.OPSYS_FAMILY_URI (in _id integer not null) returns varchar,
  function oplweb2.oplweb.OPSYS_FAMILY_URI_INVERSE (in _iri varchar) returns integer 
	option (bijection, returns 'http://data.openlinksw.com/oplweb/opsys_family/%s#this' ).

create iri class opl:OpsysType 			using
  function oplweb2.oplweb.OPSYS_TYPE_URI (in _id integer not null) returns varchar,
  function oplweb2.oplweb.OPSYS_TYPE_URI_INVERSE (in _iri varchar) returns integer 
	option (bijection, returns 'http://data.openlinksw.com/oplweb/opsys_type/%s#this' ).

create iri class opl:Processor "http://data.openlinksw.com/oplweb/processor/%s/%d#this"
	(in processor_name varchar not null, in processor_mode_id integer not null) .

create iri class opl:ProcessorFamily 	using
  function oplweb2.oplweb.PROCESSOR_FAMILY_URI (in _id integer not null) returns varchar,
  function oplweb2.oplweb.PROCESSOR_FAMILY_URI_INVERSE (in _iri varchar) returns integer 
	option (bijection, returns 'http://data.openlinksw.com/oplweb/processor_family/%s#this' ).

create iri class opl:ProcessorMode 			using
  function oplweb2.oplweb.PROCESSOR_MODE_URI (in _id integer not null) returns varchar,
  function oplweb2.oplweb.PROCESSOR_MODE_URI_INVERSE (in _iri varchar) returns integer 
	option (bijection, returns 'http://data.openlinksw.com/oplweb/processor_mode/%s#this' ).

create iri class opl:Product "http://data.openlinksw.com/oplweb/product/%s#this"
	(in product_id varchar not null) .

create iri class opl:ProductCategory "http://data.openlinksw.com/oplweb/product_category/%s#this"
	(in product_cat_code varchar not null) .

create iri class opl:ProductCategoryFeature 	using
  function oplweb2.oplweb.PRODUCT_CATEGORY_FEATURE_URI (in _id integer not null) returns varchar,
		function oplweb2.oplweb.PRODUCT_CATEGORY_FEATURE_URI_INVERSE (in _iri varchar) returns integer 
	option (bijection, returns 'http://data.openlinksw.com/oplweb/product_category_feature/%s#this' ).

create iri class opl:ProductPortfolio "http://data.openlinksw.com/oplweb/portfolio/%s#this"
	(in x varchar not null) .

create iri class opl:ProductFamily "http://data.openlinksw.com/oplweb/product_family/%s#this"
	(in product_family_code varchar not null) .

create iri class opl:ProductFamilyFeature 	using
  function oplweb2.oplweb.PRODUCT_FAMILY_FEATURE_URI (in _id integer not null) returns varchar,
  function oplweb2.oplweb.PRODUCT_FAMILY_FEATURE_URI_INVERSE (in _iri varchar) returns integer 
	option (bijection, returns 'http://data.openlinksw.com/oplweb/product_family_feature/%s#this' ).

create iri class opl:ProductFeatureCategory 			using
  function oplweb2.oplweb.PRODUCT_FEATURE_CATEGORY_URI (in _id integer not null) returns varchar,
  function oplweb2.oplweb.PRODUCT_FEATURE_CATEGORY_URI_INVERSE (in _iri varchar) returns integer 
	option (bijection, returns 'http://data.openlinksw.com/oplweb/product_feature_category/%s#this' ).

create iri class opl:ProductFeature 					using
  function oplweb2.oplweb.PRODUCT_FEATURE_URI (in _id integer not null) returns varchar,
  function oplweb2.oplweb.PRODUCT_FEATURE_URI_INVERSE (in _iri varchar) returns integer 
	option (bijection, returns 'http://data.openlinksw.com/oplweb/product_feature/%s#this' ).

create iri class opl:ProductFormat "http://data.openlinksw.com/oplweb/product_format/%s#this"
	(in product_format_code varchar not null) .

create iri class opl:ProductFormatCategory "http://data.openlinksw.com/oplweb/product_format_category/%s/%s#this"
	(in product_format_code varchar not null, in product_cat_code varchar not null) .
		
create iri class opl:ProductFormatFeature 	using
  function oplweb2.oplweb.PRODUCT_FORMAT_FEATURE_URI (in _id integer not null) returns varchar,
  function oplweb2.oplweb.PRODUCT_FORMAT_FEATURE_URI_INVERSE (in _iri varchar) returns integer 
	option (bijection, returns 'http://data.openlinksw.com/oplweb/product_format_feature/%s#this' ).

create iri class opl:ProductReleaseFeature 			using
  function oplweb2.oplweb.PRODUCT_RELEASE_FEATURE_URI (in _id integer not null) returns varchar,
  function oplweb2.oplweb.PRODUCT_RELEASE_FEATURE_URI_INVERSE (in _iri varchar) returns integer 
	option (bijection, returns 'http://data.openlinksw.com/oplweb/product_release_feature/%s#this' ).

create iri class opl:ProductBenefit 					using
  function oplweb2.oplweb.PRODUCT_BENEFIT_URI (in _id integer not null) returns varchar,
  function oplweb2.oplweb.PRODUCT_BENEFIT_URI_INVERSE (in _iri varchar) returns integer 
	option (bijection, returns 'http://data.openlinksw.com/oplweb/product_benefit/%s#this' ).

create iri class opl:ProductBenefitCategory 							using
  function oplweb2.oplweb.PRODUCT_BENEFIT_CATEGORY_URI (in _id integer not null) returns varchar,
  function oplweb2.oplweb.PRODUCT_BENEFIT_CATEGORY_URI_INVERSE (in _iri varchar) returns integer 
	option (bijection, returns 'http://data.openlinksw.com/oplweb/product_benefit_category/%s#this' ).

create iri class opl:ProductRelease "http://data.openlinksw.com/oplweb/product_release/%s/%s/%s/%s#this"
	(
	 in product_id varchar not null,
	 in product_release_id varchar not null,
	 in opsys_name varchar not null,
	 in dbms_name varchar not null
	) .

create iri class opl:Vendor 	using
  function oplweb2.oplweb.VENDOR_URI (in _id integer not null) returns varchar,
  function oplweb2.oplweb.VENDOR_URI_INVERSE (in _iri varchar) returns integer 
	option (bijection, returns 'http://data.openlinksw.com/oplweb/vendor/%s#this' ).

create iri class opl:VendorCategory 			using
  function oplweb2.oplweb.VENDOR_CATEGORY_URI (in _id integer not null) returns varchar,
  function oplweb2.oplweb.VENDOR_CATEGORY_URI_INVERSE (in _iri varchar) returns integer 
	option (bijection, returns 'http://data.openlinksw.com/oplweb/vendor_category/%s#this' ).

create iri class opl:VendorCategoryFamily 					using
  function oplweb2.oplweb.VENDOR_CATEGORY_FAMILY_URI (in _id integer not null) returns varchar,
  function oplweb2.oplweb.VENDOR_CATEGORY_FAMILY_URI_INVERSE (in _iri varchar) returns integer 
	option (bijection, returns 'http://data.openlinksw.com/oplweb/vendor_category_family/%s#this' ).

create iri class opl:PriceType "http://data.openlinksw.com/oplweb/price_type/%d#this"
    (in product_price_type_id integer not null) .

create iri class opl:LicenseType using 
  function oplweb2.oplweb.LICENSE_MODEL_TYPE_URI (in _id integer not null) returns varchar,
  function oplweb2.oplweb.LICENSE_MODEL_TYPE_URI_INVERSE (in _iri varchar) returns integer 
	option (bijection, returns 'http://data.openlinksw.com/oplweb/license_type/%s#this' ).

create iri class opl:PriceUnitType "http://data.openlinksw.com/oplweb/price_unit_type/%s_%s_%d_%d_%d_%s#this"
    (
    in product_release_id varchar not null, 
    in product_id varchar not null,
    in opsys_family_id integer not null,
    in dbms_family_id integer not null,
    in product_price_type_id integer not null,
	in product_price_unit_type_id varchar not null) .

create iri class opl:PriceUnitIncrementalDiscount "http://data.openlinksw.com/oplweb/price_unit_discount/%s_%s_%d_%d_%d_%s#this"
    (
    in product_release_id varchar not null, 
    in product_id varchar not null,
    in opsys_family_id integer not null,
    in dbms_family_id integer not null,
    in product_price_type_id integer not null,
	in product_price_unit_type_id varchar not null) .

create iri class opl:ProductPrice "http://data.openlinksw.com/oplweb/product_price/%d#this"
    (in product_price_id integer not null) .


create iri class opl:LicenseModel "http://data.openlinksw.com/oplweb/license_model/%s_%s_%d_%d_%d#this"
    (
      in product_release_id varchar not null, 
      in product_id varchar not null,
      in opsys_family_id integer not null,
      in dbms_family_id integer not null,
	  in product_price_type_id integer not null
    ) .

create iri class opl:Discount "http://data.openlinksw.com/oplweb/discount/%s/%d/%s/%d/%d/%d#this"
    (
      in product_release_id varchar not null, 
      in opsys_type_id integer not null, 
      in product_id varchar not null,
      in opsys_family_id integer not null,
      in dbms_family_id integer not null,
      in product_price_type_id integer not null
    ) .

create iri class opl:wwwsitefamily "http://%s.openlinksw.com/"
    (
      in product_family_code varchar not null
    ) .

create iri class opl:wwwsitecategory "http://%s.openlinksw.com/%s/"
    (
      in product_family_code varchar not null,
      in product_category_code varchar not null
    ) .

create iri class opl:wwwsiteformat using 
    function oplweb2.oplweb.wwwsiteformat_URI (
      in product_category_code varchar,
      in product_format_code varchar
    ) 
	  returns varchar .

create iri class opl:Uri "%s"
    ( in uri varchar not null
		) .
		
create literal class opl:lit_product_release_label using 
	function oplweb2.oplweb.LIT_PRODUCT_RELEASE_LABEL(
		in _product_id varchar, in _id varchar, in _opsys_name varchar, in _dbms_name varchar
		)
	returns varchar .

create literal class opl:lit_format_cat_label using 
	function oplweb2.oplweb.LIT_FORMAT_CAT_LABEL(
		in _format integer, in _cat integer
		)
	returns varchar .
	
create iri class opl:lit_openlink_logo using 
  function oplweb2.oplweb.LITRDF_openlink_logo(
    in _code varchar
  )
	returns varchar .

create iri class opl:lit_homepage using 
  function oplweb2.oplweb.LITRDF_homepage(
    in _code varchar
  )
	returns varchar .

create iri class opl:lit_opsys_icon using 
  function oplweb2.oplweb.LITRDF_opsys_icon(
    in _id integer
  )
	returns varchar .

create iri class opl:lit_to_shop using 
  function oplweb2.oplweb.LITRDF_to_shop(
	in release_id varchar,
	in product_id varchar,
	in opsys varchar, 
	in dbms varchar
  )
  returns varchar .	

create literal class opl:lit_license_model_type using 
	function oplweb2.oplweb.LITRDF_license_model_type (
		in _product_price_type_id integer
	)
	returns varchar .

create literal class opl:lit_license_model_explain using 
	function oplweb2.oplweb.LITRDF_license_model_explain (
		in _product_price_type_id integer
	)
	returns varchar .

create literal class opl:lit_shop_sample using 
	function oplweb2.oplweb.LITRDF_shop_sample (
	  in release_id varchar,
	  in product_id varchar,
	  in opsys varchar, 
  	  in dbms varchar
	)
	returns varchar .

create iri class opl:lit_wikipedia_to_dbpedia using 
	function oplweb2.oplweb.LITRDF_wikipedia_to_dbpedia (
	  in wikipedia_url varchar
	)
	returns varchar .

create literal class opl:lit_to_string using 
	function oplweb2.oplweb.LITRDF_to_string (
	  in _s varchar
	)
	returns varchar .

create iri class opl:wwwsiteproduct using
  function oplweb2.oplweb.wwwsiteproduct_URI (in _id varchar not null) returns varchar,
  function oplweb2.oplweb.wwwsiteproduct_URI_INVERSE (in _iri varchar) returns varchar 
  .


make opl:ProductCategory 	subclass of opl:ProductFamily .
make opl:Product 			subclass of opl:ProductCategory .
make opl:Product 			subclass of opl:ProductFormat .
make opl:ProductRelease		subclass of opl:Product .
make opl:Opsys		 		subclass of opl:OpsysFamily .
make opl:DbmsEngine		 	subclass of opl:DbmsFamily .

;



DB.DBA.RDF_AUDIT_METADATA (1, '*');


sparql
prefix opl: <http://www.openlinksw.com/schemas/oplweb#>
prefix dc: <http://purl.org/dc/terms#>
prefix oplsioc: <http://www.openlinksw.com/schemas/oplsioc#>
prefix sioc: <http://rdfs.org/sioc/ns#>
prefix foaf: <http://xmlns.com/foaf/0.1/>
prefix wgs: <http://www.w3.org/2003/01/geo/wgs84_pos#>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix oplds: <http://www.openlinksw.com/dataspace/organization/openlink#>
prefix owl: <http://www.w3.org/2002/07/owl#>
prefix umbel: <http://umbel.org/umbel/sc/>
prefix gr: <http://purl.org/goodrelations/v1#> 
prefix ore: <http://www.openarchives.org/ore/terms/>

alter quad storage virtrdf:DefaultQuadStorage
from oplweb2.oplweb.component_archive as component_archive_tbl
from oplweb2.oplweb.component_archive_type as component_archive_type_tbl
from oplweb2.oplweb.component_category as component_category_tbl text literal component_category_long_description
from oplweb2.oplweb.component_mode as component_mode_tbl
from oplweb2.oplweb.component_type as component_type_tbl
from oplweb2.oplweb.components_for_rdfs as components_tbl
from oplweb2.oplweb.dbms_engine as dbms_engine_tbl
from oplweb2.oplweb.dbms_family as dbms_family_tbl
from oplweb2.oplweb.download_location as download_location_tbl
from oplweb2.oplweb.download_protocol as download_protocol_tbl
from oplweb2.oplweb.download_partner as download_partner_tbl
from oplweb2.oplweb.opsys as opsys_tbl
from oplweb2.oplweb.opsys_family as opsys_family_tbl
from oplweb2.oplweb.opsys_type as opsys_type_tbl
from oplweb2.oplweb.processor_family as processor_family_tbl
from oplweb2.oplweb.processor_mode as processor_mode_tbl
from oplweb2.oplweb.processors as processors_tbl
from oplweb2.oplweb.product as product_tbl text literal long_description
from oplweb2.oplweb.product_benefits as product_benefits_tbl text literal product_benefit_explanation
from oplweb2.oplweb.product_benefits_category as product_benefits_category_tbl 
from oplweb2.oplweb.product_category as product_category_tbl
from oplweb2.oplweb.product_category_features_with_code as product_category_features_tbl text literal long_description
from oplweb2.oplweb.product_family as product_family_tbl
from oplweb2.oplweb.product_family as product_family_tbl_2
from oplweb2.oplweb.product_family_features_with_code as product_family_features_tbl text literal long_description
from oplweb2.oplweb.product_features as product_features_tbl text literal long_description
from oplweb2.oplweb.product_feature_category as product_feature_category_tbl text literal description
from oplweb2.oplweb.product_format_features_with_code as product_format_features_tbl text literal long_description
from oplweb2.oplweb.product_release_features as product_release_features_tbl text literal long_description
from oplweb2.oplweb.product_release_with_family as product_release_tbl
from oplweb2.oplweb.vendor_category as vendor_category_tbl
from oplweb2.oplweb.vendor_category_family as vendor_category_family_tbl
from oplweb2.oplweb.vendors as vendors_tbl
from oplweb2.oplweb.product_formats_categories as product_formats_categories
from oplweb2.oplweb.product_with_code as product_with_code
from oplweb2.oplweb.product_category_with_code as product_category_with_code
from oplweb2.oplweb.product_format as product_format_with_code
from oplweb2.oplweb.product_price as pp
from oplweb2.oplweb.product_price_type as pt
from oplweb2.DBA.license_model_unit_type as put
from oplweb2.DBA.license_model_unit_type as put2
from oplweb2.DBA.license_model as lm
from oplweb2.DBA.license_model as lm2
from oplweb2.DBA.license_model_type as license_model_type_tbl
from oplweb2.DBA.product_price_varchar as ppv
from oplweb2.DBA.product_general_discount_vc as gd
from oplweb2.oplweb.archive_coverage_osdb as ac1
{
	create virtrdf:product_portfolio as
		graph <http://www.openlinksw.com/dataspace/organization/openlink/oplweb/>
	{
  opl:ProductPortfolio(product_family_tbl.product_family_code)
    a opl:ProductPortfolio
    as virtrdf:OplProductPortfolio .
 
  opl:ProductPortfolio(product_family_tbl.product_family_code) opl:hasProductFamilies
    opl:ProductFamily(product_family_tbl.product_family_code)
	as virtrdf:OplProductPortfolioProductFamily .

	  opl:ProductFamily(product_family_tbl.product_family_code) 
	    a opl:ProductFamily
	    as virtrdf:OplProductFamily ;
	  rdfs:label product_family_tbl.product_family_description
	    as virtrdf:rdfsOplProductFamilyDescription ;
	  foaf:name 	product_family_tbl.product_family_description
		    as virtrdf:nameOplProductFamilyDescription ;
	  foaf:logo  opl:lit_openlink_logo(product_family_tbl.product_family_code)
	        as virtrdf:logoOpenLinkSoftware ;
	  foaf:homepage opl:lit_homepage(product_family_tbl.product_family_code)
	        as virtrdf:homepageProductFamily ;
	  foaf:homepage opl:wwwsitefamily(product_family_tbl.product_family_code)
#	    where (
#			^{product_family_tbl.}^.product_family_code = 'uda'
#		)
	        as virtrdf:homepageProductFamilyUda ;
	  foaf:maker oplds:this
	        as virtrdf:OplDataspaceOpenLinkUri ;
  	  owl:sameAs product_family_tbl.dbpedia_uri
        as virtrdf:OplFamilyOwlSameAsDBPediaUri ;
	  opl:ProductFamilyCode product_family_tbl.product_family_code
	    as virtrdf:OplProductFamilyCode ;
	  opl:ProductFamilyDescription product_family_tbl.product_family_description
	    as virtrdf:OplProductFamilyDescription ;
	  dc:description opl:lit_to_string(product_family_tbl.long_description)
	    as virtrdf:OplProductFamilyLongDescription 		;
	    ore:isDescribedBy opl: ;
	    ore:isDescribedBy foaf: ;
	    ore:isDescribedBy dc: ;
	    ore:isDescribedBy owl: ;
	    ore:isDescribedBy rdfs: ;
      rdfs:isDefinedBy opl: ;
      rdfs:isDefinedBy foaf: ;
      rdfs:isDefinedBy dc: ;
      rdfs:isDefinedBy owl: ;
      rdfs:isDefinedBy rdfs: 
		.
	    	  
	  opl:ProductCategory(product_category_with_code.product_cat_code) 
	    a opl:ProductCategory
	    as virtrdf:OplProductCategory ;
	    a opl:ProductFamily
	    as virtrdf:OplProductCategorySubClassOfProductFamily ;
	  rdfs:label product_category_with_code.product_category_description
	    as virtrdf:rdfsOplProductCategoryDescription ;
	  foaf:homepage opl:wwwsitecategory(product_category_with_code.product_family_code, product_category_with_code.product_cat_code)
#	    where (
#			^{product_category_with_code.}^.product_family_code = 'uda'
#		)
	        as virtrdf:homepageProductFamilyCategoryUda ;
	  opl:ProductCategoryCode product_category_with_code.product_cat_code
	    as virtrdf:OplProductCategoryCode ;
  	  owl:sameAs product_category_with_code.dbpedia_uri
        as virtrdf:OplCategoryOwlSameAsDBPediaUri ;
	  opl:hasFamily opl:ProductFamily(product_category_with_code.product_family_code)
	    as virtrdf:OplProductCategoryIsOfFamily ; 
	  opl:ProductCategoryDescription product_category_with_code.product_category_description
	    as virtrdf:OplProductCategoryDescription ;
	  dc:description opl:lit_to_string(product_category_with_code.long_description)
	    as virtrdf:OplProductCategoryLongDescription ;
      ore:isDescribedBy opl: ;
      ore:isDescribedBy rdfs: ;
      ore:isDescribedBy foaf: ;
      ore:isDescribedBy dc: ;
      ore:isDescribedBy owl: ;
      rdfs:isDefinedBy opl: ;
      rdfs:isDefinedBy rdfs: ;
      rdfs:isDefinedBy foaf: ;
      rdfs:isDefinedBy dc: ;
      rdfs:isDefinedBy owl: 
		.
	
	  opl:ProductFormat(product_format_with_code.product_format_code) 
	    a opl:ProductFormat
	    as virtrdf:OplProductFormat ;
	  opl:ProductFormatCode product_format_with_code.product_format_code
	    as virtrdf:OplProductFormatCode ;
	  rdfs:label product_format_with_code.product_format_description
	    as virtrdf:rdfsOplProductFormatDescription ;
	  dc:description product_format_with_code.product_format_description
	    as virtrdf:OplProductFormatDescription ;
      ore:isDescribedBy opl: ;
      ore:isDescribedBy rdfs: ;
      ore:isDescribedBy dc: ;
      rdfs:isDefinedBy opl: ;
      rdfs:isDefinedBy rdfs: ;
      rdfs:isDefinedBy dc: 
		.
	
	  opl:ProductFormatCategory(product_formats_categories.product_format_code, product_formats_categories.product_cat_code) 
	    a opl:ProductFormatCategory
	    as virtrdf:OplProductFormatCategory ;
	    a opl:ProductFormat
	    as virtrdf:OplProductFormatCategoryProductFormat ;
	    a opl:ProductCategory
	    as virtrdf:OplProductFormatCategoryProductCategory ;
	  foaf:homepage opl:wwwsiteformat(product_formats_categories.product_cat_code, product_formats_categories.product_format_code)
#	    where (
#			^{product_category_with_code.}^.product_cat_code = ^{product_formats_categories.}^.product_cat_code
#			and
#			^{product_category_with_code.}^.product_family_code = 'uda'
#		)
	        as virtrdf:homepageProductFamilyCategoryFormatUda ;
	  opl:ProductFormatCode product_formats_categories.product_format_code
	    as virtrdf:OplProductFormatCategoryFormatCode ;
	  opl:ProductCategoryCode product_formats_categories.product_cat_code
	    as virtrdf:OplProductFormatCategoryCategoryCode ;
      opl:isProductCategory opl:ProductCategory(product_formats_categories.product_cat_code)
        as virtrdf:OplProductFormatCategoryisCategory ;
      opl:isProductFormat opl:ProductFormat(product_formats_categories.product_format_code)
        as virtrdf:OplProductFormatCategoryisFormat ;
	  rdfs:label opl:lit_format_cat_label(product_formats_categories.product_format_id, product_formats_categories.product_cat_id)
	    as virtrdf:rdfsOplProductFormatCategoryDescription ;
      ore:isDescribedBy opl: ;
      ore:isDescribedBy foaf: ;
      ore:isDescribedBy rdfs: ;
      rdfs:isDefinedBy opl: ;
      rdfs:isDefinedBy foaf: ;
      rdfs:isDefinedBy rdfs: 
		.
	
	
	  opl:ProductCategory(product_category_with_code.product_cat_code) opl:hasProduct
	    opl:Product(product_with_code.product_id)
	      where (^{product_with_code.}^.product_cat_id = ^{product_category_with_code.}^.product_cat_id)
	    as virtrdf:OplProductCategoryIsCategoryOfProduct .
	
	  opl:ProductFormat(product_format_with_code.product_format_code) opl:hasProduct
	    opl:Product(product_with_code.product_id)
	      where (^{product_with_code.}^.product_format_id = ^{product_format_with_code.}^.product_format_id)
	    as virtrdf:OplProductFormatIsFormatOfProduct .
	
	  opl:ProductFamily(product_family_tbl.product_family_code) opl:hasCategory
	    opl:ProductCategory(product_category_with_code.product_cat_code)
	      where (^{product_family_tbl.}^.product_family_id = ^{product_category_with_code.}^.product_family_id)
	    as virtrdf:OplProductFamilyIsFamilyOfProductCategory .
	
	  opl:ProductFamily(product_family_tbl.product_family_code) opl:hasFormat
	    opl:ProductFormat(product_formats_categories.product_format_code)
	      where (
		    ^{product_family_tbl.}^.product_family_id = ^{product_formats_categories.}^.product_family_id
		  )
	    as virtrdf:OplProductFamilyIsFamilyOfProductFormats .

	  opl:ProductFamily(product_family_tbl.product_family_code) opl:otherProductFamilies
	    opl:ProductFamily(product_family_tbl_2.product_family_code)
	      where (
		    ^{product_family_tbl.}^.product_family_id <> ^{product_family_tbl_2.}^.product_family_id
		  )
	    as virtrdf:OplProductFamilyHasOtherProductFamilies .
	
	  opl:ProductFormat(product_format_with_code.product_format_code) opl:hasCategory
	    opl:ProductFormatCategory(product_formats_categories.product_format_code, product_formats_categories.product_cat_code)
	      where (^{product_formats_categories.}^.product_format_id = ^{product_format_with_code.}^.product_format_id)
	    as virtrdf:OplProductFormatIsFormatOfProductFormatCategories .

	  opl:ProductFormatCategory(product_formats_categories.product_format_code, product_formats_categories.product_cat_code) 
	    opl:hasProduct
	    opl:Product(product_with_code.product_id)
	      where (
		    ^{product_with_code.}^.product_cat_id = ^{product_formats_categories.}^.product_cat_id
		    and 
		    ^{product_with_code.}^.product_format_id = ^{product_formats_categories.}^.product_format_id
		  )
	    as virtrdf:OplProductFormatCategoryIsFormatCategoryOfProduct .
	
	
	
	  opl:VendorCategoryFamily(vendor_category_family_tbl.vendor_category_family_id)
	    a opl:VendorCategoryFamily
	    as virtrdf:OplVendorCategoryFamily ;
	  opl:VendorCategoryFamilyDescription vendor_category_family_tbl.vendor_category_family_desc
	    as virtrdf:OplVendorCategoryFamilyDesc .	    
	    
	    
	  opl:VendorCategory(vendor_category_tbl.vendor_category_id)
	    a opl:VendorCategory
	    as virtrdf:OplVendorCategory ;
	    a opl:VendorCategoryFamily
	    as virtrdf:OplVendorCategorySubClassOfVendorCategoryFamily ;
	  rdfs:label vendor_category_tbl.vendor_category_description
	    as virtrdf:rdfsOplVendorCategoryDescription ;
	  opl:VendorCategoryDescription vendor_category_tbl.vendor_category_description
	    as virtrdf:OplVendorCategoryDescription ;
	  opl:isVendorCategoryOf opl:VendorCategoryFamily(vendor_category_tbl.vendor_category_family_id)
	    as virtrdf:OplVendorCategoryIsOfCategoryFamily ;
      ore:isDescribedBy opl: ;
      ore:isDescribedBy rdfs:;
      rdfs:isDefinedBy opl: ;
      rdfs:isDefinedBy rdfs: 
		.
	  
	  opl:Vendor(vendors_tbl.vendor_id)
	    a opl:Vendor
	    as virtrdf:OplVendor ;
	    a opl:VendorCategory
	    as virtrdf:OplVendorSubClassOfVendorCategory ;
	  rdfs:label vendors_tbl.vendor_name 
	    as virtrdf:rdfsOplVendorsName ;
	  opl:VendorName vendors_tbl.vendor_name 
	    as virtrdf:OplVendorsName ;
	  opl:WikipediaPage opl:Uri(vendors_tbl.wikipedia_url) 
	    as virtrdf:OplVendorsWikipediaUrl ;
	  owl:sameAs opl:lit_wikipedia_to_dbpedia(vendors_tbl.wikipedia_url) 
	    as virtrdf:OplVendorsWikipediaUrlOwlSameAs ;
	  foaf:homepage opl:Uri(vendors_tbl.vendor_homepage)
	    as virtrdf:OplFoafVendorHomepage ;
	  opl:isOfVendorCategory opl:VendorCategory(vendors_tbl.vendor_category_id)
	    as virtrdf:OplVendorIsOfVendorCategory ;
      ore:isDescribedBy opl: ;
      ore:isDescribedBy rdfs: ;
      ore:isDescribedBy foaf: ;
      ore:isDescribedBy owl: ;
      rdfs:isDefinedBy opl: ;
      rdfs:isDefinedBy rdfs: ;
      rdfs:isDefinedBy foaf: ;
      rdfs:isDefinedBy owl: 
		.
	  
	  opl:VendorCategoryFamily(vendor_category_family_tbl.vendor_category_family_id)
	    opl:hasVendorCategory
	    opl:VendorCategory(vendor_category_tbl.vendor_category_id)
	      where (
		    ^{vendor_category_family_tbl.}^.vendor_category_family_id = ^{vendor_category_tbl.}^.vendor_category_family_id
		  )
	    as virtrdf:OplVendorCategoryFamilyHasVendorCategory .

      opl:VendorCategory(vendor_category_tbl.vendor_category_id)
	    opl:hasVendorCategory
  	    opl:Vendor(vendors_tbl.vendor_id)
	      where (
		    ^{vendor_category_tbl.}^.vendor_category_id = ^{vendors_tbl.}^.vendor_category_id
		  )
	    as virtrdf:OplVendorCategoryHasVendors .
	
  	opl:OpsysFamily(opsys_family_tbl.opsys_family_id)
	    a opl:OpsysFamily
	    as virtrdf:OplOpsysFamily ;
	  rdfs:label opsys_family_tbl.opsys_family_name
  	  as virtrdf:rdfsOplOpsysFamilyName ;
	  opl:OpsysFamilyName opsys_family_tbl.opsys_family_name
  	  as virtrdf:OplOpsysFamilyName ;
  	opl:OpsysFamilyLicenseCode opsys_family_tbl.opsys_license_code
	    as virtrdf:OplOpsysFamilyLicenseCode ;
	  opl:OpsysFamilyVendor opl:Vendor(opsys_family_tbl.vendor_id)
  	  as virtrdf:OplOpsysFamilyVendor ;
  	opl:OpsysFamilyRating opsys_family_tbl.rating
	    as virtrdf:OplOpsysFamilyRating ;
	foaf:logo opl:lit_opsys_icon(opsys_family_tbl.opsys_family_id)
	  as virtrdf:OplLogoOpsysFamily ;
	foaf:homepage opl:Uri(opsys_family_tbl.wikipedia_url)
	  as virtrdf:FoafHomepageOpsysFamilyWikipediaUrl ;
	owl:sameAs opl:lit_wikipedia_to_dbpedia(opsys_family_tbl.wikipedia_url)
	  as virtrdf:FoafHomepageOpsysFamilyPediaUrlOwlSameAs ;
	opl:WikipediaPage opl:Uri(opsys_family_tbl.wikipedia_url)
	  as virtrdf:OplOpsysFamilyWikipediaUrl ;
      ore:isDescribedBy opl: ;
      ore:isDescribedBy rdfs: ;
      ore:isDescribedBy foaf: ;
      ore:isDescribedBy owl: ;
      rdfs:isDefinedBy opl: ;
      rdfs:isDefinedBy rdfs: ;
      rdfs:isDefinedBy foaf: ;
      rdfs:isDefinedBy owl: 
		.
  	
	  opl:OpsysFamily(opsys_family_tbl.opsys_family_id) opl:hasOpsys
	    opl:Opsys(opsys_tbl.opsys_name)
	    where (^{opsys_tbl.}^.opsys_family_id = ^{opsys_family_tbl.}^.opsys_family_id)
	    as virtrdf:OplOpsysFamilyIsOpsysFamilyOfOpsys .
  	
  	
	  opl:DbmsFamily(dbms_family_tbl.dbms_family_id)
  	  a opl:DbmsFamily
	    as virtrdf:OplDbmsFamily ;
	  rdfs:label dbms_family_tbl.dbms_family_name
  	  as virtrdf:rdfsOplDbmsFamilyName ;
	  opl:DbmsFamilyName dbms_family_tbl.dbms_family_name
  	  as virtrdf:OplDbmsFamilyName ;
  	opl:DbmsFamilyVendor opl:Vendor(dbms_family_tbl.vendor_id)
      as virtrdf:OplDbmsFamilyVendor ;
	foaf:homepage opl:Uri(dbms_family_tbl.wikipedia_url)
 	  as virtrdf:FoafHomepageDbmsFamilyWikipediaUrl ;
	owl:sameAs opl:lit_wikipedia_to_dbpedia(dbms_family_tbl.wikipedia_url)
 	  as virtrdf:OwnSameAsDbmsFamilyPediaUrl ;
	opl:WikipediaPage opl:Uri(dbms_family_tbl.wikipedia_url)
	  as virtrdf:OplDbmsFamilyWikipediaUrl ;
	  opl:DbmsFamilyRating dbms_family_tbl.rating
  	  as virtrdf:OplDbmsFamilyRating ;
      ore:isDescribedBy opl: ;
      ore:isDescribedBy rdfs: ;
      ore:isDescribedBy foaf: ;
      ore:isDescribedBy owl: ;
      rdfs:isDefinedBy opl: ;
      rdfs:isDefinedBy rdfs: ;
      rdfs:isDefinedBy foaf: ;
      rdfs:isDefinedBy owl: 
		.
  	
	  opl:DbmsEngine(dbms_engine_tbl.dbms_name)
  	  a opl:DbmsEngine
	    as virtrdf:OplDbmsEngine ;
  	  a opl:DbmsFamily
	    as virtrdf:DbmsEngineSubClassOfDbmsFamily ;
	    a umbel:RelationalDatabaseServerProgram
	    as virtrdf:DbmEngineSubClassOfUmbel ;
	  opl:isOfDbmsFamily opl:DbmsFamily(dbms_engine_tbl.dbms_family_id)
  	  as virtrdf:OplDbmsEngineisOfDbmsFamily ;
	  rdfs:label dbms_engine_tbl.dbms_name
  	  as virtrdf:rdfsOplLabelDbmsName ;
  	opl:DbmsEngineVersion dbms_engine_tbl.dbms_version
	    as virtrdf:OplDbmsEngineVersion ;
	  opl:DbmsEngineUpwardCompatible dbms_engine_tbl.upward_compatible
  	  as virtrdf:OplDbmsEngineUpwardCompatible ;
  	opl:DbmsEngineDownwardCompatible dbms_engine_tbl.downward_compatible
	    as virtrdf:OplDbmsEngineDownwardCompatible ;
	  opl:DbmsEngineRating dbms_engine_tbl.rating
  	  as virtrdf:OplDbmsEngineRating ;
  	opl:DbmsEngineOldArchiveCode dbms_engine_tbl.old_archive_code
	    as virtrdf:OplDbmsEngineOldArchiveCode ;
      ore:isDescribedBy opl: ;
      ore:isDescribedBy rdfs: ;
      rdfs:isDefinedBy opl: ;
      rdfs:isDefinedBy rdfs: 
		.


  opl:DbmsFamily(dbms_family_tbl.dbms_family_id)
    opl:hasDatabaseVersions
    opl:DbmsEngine(dbms_engine_tbl.dbms_name)
    where (
        ^{dbms_family_tbl.}^.dbms_family_id = ^{dbms_engine_tbl.}^.dbms_family_id
    )
    as virtrdf:OplDbmsFamilyToDbms .


	  opl:OpsysType(opsys_type_tbl.opsys_type_id)
   	  a opl:OpsysType
	    as virtrdf:OplOpsysType ;
	  rdfs:label opsys_type_tbl.opsys_type_description
  	  as virtrdf:rdfsOplOpsysTypeDescription ;
	  opl:OpsysTypeDescription opsys_type_tbl.opsys_type_description
  	  as virtrdf:OplOpsysTypeDescription ;
  	opl:OpsysTypeShortDescription opsys_type_tbl.short_description 
	    as virtrdf:OplOpsysTypeShortDescription ;
      ore:isDescribedBy opl: ;
      ore:isDescribedBy rdfs: ; 
      rdfs:isDefinedBy opl: ;
      rdfs:isDefinedBy rdfs: 
		.
  	
	  
	  opl:OpsysType(opsys_type_tbl.opsys_type_id) opl:hasOpsys
	    opl:Opsys(opsys_tbl.opsys_name)
	    where (^{opsys_tbl.}^.opsys_type_id = ^{opsys_type_tbl.}^.opsys_type_id)
	    as virtrdf:OplOpsysTypeIsOpsysTypeOfOpsys .
  	
  	
	  opl:ProcessorMode(processor_mode_tbl.processor_mode_id)
  	  a opl:ProcessorMode
	    as virtrdf:OplProcessorMode ;
	  opl:ProcessorModeName processor_mode_tbl.processor_mode_name
  	  as virtrdf:OplProcessorModeName .
	
  	opl:Processor(processors_tbl.processor_name, processors_tbl.processor_mode_id)
	    a opl:Processor
	    as virtrdf:OplProcessor ;
	  opl:ProcessorName processors_tbl.processor_name
  	  as virtrdf:OplProcessorName ;
  	opl:ProcessorVersion processors_tbl.processor_version
	    as virtrdf:OplProcessorVersion ;
	  rdfs:label processors_tbl.processor_description
  	  as virtrdf:rdfsOplProcessorDescription ;
	  opl:ProcessorDescription processors_tbl.processor_description
  	  as virtrdf:OplProcessorDescription ;
  	opl:ProcessorMode opl:ProcessorMode(processors_tbl.processor_mode_id)
	    as virtrdf:OplProcessorProcessorMode ;
	  opl:isOfProcessorFamily opl:ProcessorFamily(processors_tbl.processor_family_id)
  	  as virtrdf:OplProcessorIsOfProcessorFamily ;
      ore:isDescribedBy opl: ;
      ore:isDescribedBy rdfs: ;
      rdfs:isDefinedBy opl: ;
      rdfs:isDefinedBy rdfs: 
		.
  	
	opl:ProcessorFamily(processor_family_tbl.processor_family_id)
  	  a opl:ProcessorFamily
	    as virtrdf:OplProcessorFamily ;
    opl:ProcessorFamilyName processor_family_tbl.processor_family_name
  	  as virtrdf:OplProcessorFamilyName ;
    opl:ProcessorFamilyVendor opl:Vendor(processor_family_tbl.vendor_id)
	  as virtrdf:OplProcessorFamilyVendor ;
	foaf:homepage opl:Uri(processor_family_tbl.wikipedia_url)
	  as virtrdf:FoafHomepageProcessorFamilyWikipediaUrl ;
	owl:sameAs opl:lit_wikipedia_to_dbpedia(processor_family_tbl.wikipedia_url)
	  as virtrdf:OwlSameAsProcessorFamilyPediaUrl ;
    opl:WikipediaPage opl:Uri(processor_family_tbl.wikipedia_url)
	  as virtrdf:OplProcessorFamilyWikipediaUrl ;
	rdfs:label processor_family_tbl.processor_family_description
  	  as virtrdf:rdfsOplProcessorFamilyDescription ;
	opl:ProcessorFamilyDescription processor_family_tbl.processor_family_description
  	  as virtrdf:OplProcessorFamilyDescription ;
      ore:isDescribedBy opl: ;
      ore:isDescribedBy foaf: ;
      ore:isDescribedBy owl: ;
      ore:isDescribedBy rdfs: ;
      rdfs:isDefinedBy opl: ;
      rdfs:isDefinedBy foaf: ;
      rdfs:isDefinedBy owl: ;
      rdfs:isDefinedBy rdfs: 
		.
  	  	
	  opl:Opsys(opsys_tbl.opsys_name)
  	  a opl:Opsys
	    as virtrdf:OplOpsys ;
  	  a opl:OpsysFamily
	    as virtrdf:OpsysSubClassOfOplOpsysFamily ;
  	  a umbel:OperatingSystem
	    as virtrdf:OpsysSubClassOfUmbelOpsys ;
	  opl:OpsysVersion opsys_tbl.opsys_version
  	  as virtrdf:OplOpsysVersion ;
  	opl:OpsysUpwardCompatible opsys_tbl.upward_compatible
	    as virtrdf:OplOpsysUpwardCompatible ;
	  opl:OpsysDownwardCompatible opsys_tbl.downward_compatible
  	  as virtrdf:OplOpsysDownwardCompatible ;
  	opl:OpsysSupported opsys_tbl.supported
	    as virtrdf:OplOpsysSupported ;
	  opl:OpsysLicenseCode opsys_tbl.opsys_license_code
  	  as virtrdf:OplOpsysLicenseCode ;
  	rdfs:label opsys_tbl.commercial_name
	    as virtrdf:rdfsOplOpsysCommercialName ;
  	opl:OpsysCommercialName opsys_tbl.commercial_name
	    as virtrdf:OplOpsysCommercialName ;
	  opl:OpsysEmulationMode opl:ProcessorMode(opsys_tbl.emulation_mode_id)
  	  as virtrdf:OplOpsysEmulationMode ;
  	opl:OpsysProcessor opl:Processor(opsys_tbl.processor_name, opsys_tbl.processor_mode_id)
	    as virtrdf:OplOpsysProcessor ;
	  opl:isOfOpsysFamily opl:OpsysFamily(opsys_tbl.opsys_family_id)
  	  as virtrdf:OplOpsysIsOfOpsysFamily ;
  	opl:isOfOpsysType opl:OpsysType(opsys_tbl.opsys_type_id)
	    as virtrdf:OplOpsysIsOfOpsysType ;
      ore:isDescribedBy opl: ;
      ore:isDescribedBy rdfs: ;
      rdfs:isDefinedBy opl: ;
      rdfs:isDefinedBy rdfs: 
		.
  	
	
	  opl:Product(product_with_code.product_id) 
	    a opl:Product
	    as virtrdf:OplProduct ;
	    a opl:ProductFormat
	    as virtrdf:ProductSubClassOfProductFormat ;
	    a opl:ProductCategory
	    as virtrdf:ProductSubClassOfProductCategory ;
	    a opl:ProductFormatCategory
	    as virtrdf:OplProductProductFormatCategory ;
	  rdfs:label product_with_code.poduct_description
	    as virtrdf:rdfsOplProductDescription ;
	  foaf:homepage opl:wwwsiteproduct(product_with_code.product_id)
        as virtrdf:homepageProductFamilyCategoryFormatProductUda ;
	  opl:ProductDescription product_with_code.poduct_description
	    as virtrdf:OplProductDescription ;
	  dc:description opl:lit_to_string(product_with_code.long_description)
	    as virtrdf:OplProductLongDescription ;
	  opl:isOfCategory opl:ProductCategory(product_with_code.product_cat_code)
	    as virtrdf:OplProductIsOfCategory ; 
	  opl:isOfFormat opl:ProductFormat(product_with_code.product_format_code)
	    as virtrdf:OplProductIsOfFormat ;
      ore:isDescribedBy opl: ;
      ore:isDescribedBy foaf: ;
      ore:isDescribedBy dc: ;
      ore:isDescribedBy rdfs: ;
      rdfs:isDefinedBy opl: ;
      rdfs:isDefinedBy foaf: ;
      rdfs:isDefinedBy dc: ;
      rdfs:isDefinedBy rdfs: 
		.
	
	
	  opl:Product(product_with_code.product_id) opl:hasProductRelease
	    opl:ProductRelease(
	      product_release_tbl.product_id, 
	      product_release_tbl.product_release_id,
	      product_release_tbl.opsys_name, 
	      product_release_tbl.dbms_name
	      )
	      where (^{product_with_code.}^.product_id = ^{product_release_tbl.}^.product_id)
	    as virtrdf:OplProductIsProductOfProductRelease .
	
	
	
	  opl:ProductRelease(
	      product_release_tbl.product_id, 
	      product_release_tbl.product_release_id,
	      product_release_tbl.opsys_name, 
	      product_release_tbl.dbms_name
	      )
	    a opl:ProductRelease
	    as virtrdf:OplProductRelease ;
	    a opl:Product
	    as virtrdf:OplProductReleaseSubClassProduct ;
		a gr:ProductOrService
		as virtrdf:OplProductReleaseAgrProductOrService ;
	  rdfs:label opl:lit_product_release_label(
	      product_release_tbl.product_id, 
	      product_release_tbl.product_release_id,
	      product_release_tbl.opsys_name, 
	      product_release_tbl.dbms_name
	  )
	    as virtrdf:rdfsOplProductReleaseProductReleaseId ;
	  opl:ProductReleaseProductReleaseId product_release_tbl.product_release_id
	    as virtrdf:OplProductReleaseProductReleaseId ;
	  opl:isOfProduct opl:Product(product_release_tbl.product_id)
	    as virtrdf:OplProductReleaseIsOfProduct ;
	  opl:isForOpsys opl:Opsys(product_release_tbl.opsys_name)
	    as virtrdf:OplProductReleaseIsForOpsys ;
	  opl:isForDbmsEngine opl:DbmsEngine(product_release_tbl.dbms_name)
	    as virtrdf:OplProductReleaseIsForDbmsEngine ;
  	  opl:UpwardCompatible product_release_tbl.upward_compatible
	    as virtrdf:OplProductReleaseUpwardCompatible ;
	  opl:DownwardCompatible product_release_tbl.downward_compatible
  	    as virtrdf:OplProductReleaseDownwardCompatible ;
      opl:PurchaseInShop opl:lit_to_shop (
	      product_release_tbl.product_release_id,
	      product_release_tbl.product_id, 
	      product_release_tbl.opsys_name, 
	      product_release_tbl.dbms_name
	 	)
   		as virtrdf:OplProductReleaseToShop ;
	  gr:hasBusinessFunction gr:Sell as virtrdf:grbusinessfunctionsell;
  	  opl:Supported product_release_tbl.supported
	    as virtrdf:OplProductReleaseSupported ;
      ore:isDescribedBy opl: ; 
      ore:isDescribedBy gr: ;
      rdfs:isDefinedBy opl: ; 
      rdfs:isDefinedBy gr: 
		.
	    		    
	  opl:ProductRelease(
	      product_release_tbl.product_id, 
	      product_release_tbl.product_release_id,
	      product_release_tbl.opsys_name, 
	      product_release_tbl.dbms_name
	      ) opl:hasComponentArchive
	  opl:ComponentArchive(component_archive_tbl.component_archive_name)
			where (
					^{product_release_tbl.}^.product_id = ^{component_archive_tbl.}^.product_id and 
					^{product_release_tbl.}^.product_release_id = ^{component_archive_tbl.}^.product_release_id and 
					^{product_release_tbl.}^.opsys_name = ^{component_archive_tbl.}^.opsys_name and
					^{product_release_tbl.}^.dbms_name = ^{component_archive_tbl.}^.dbms_name
			)
	    as virtrdf:OplProductReleaseIsProductReleaseOfComponentArchive .
	    
	
	  opl:Component(components_tbl.component_name)
	    a opl:Component
	    as virtrdf:OplComponent ;
	  opl:isOfComponentCategory opl:ComponentCategory(components_tbl.component_category_id)
	    as virtrdf:OplComponentIsOfComponentCategory ;
	  opl:isOfComponentType opl:ComponentType(components_tbl.component_type_id)
	    as virtrdf:OplComponentIsOfComponentType ;
	  opl:isOfComponentMode opl:ComponentMode(components_tbl.component_mode_id)
	    as virtrdf:OplComponentIsOfComponentMode ;
	  opl:isForOpsys opl:Opsys(components_tbl.opsys_name)
	    as virtrdf:OplComponentIsForOpsys ;
	  opl:isForDbmsEngine opl:DbmsEngine(components_tbl.dbms_name)
	    as virtrdf:OplComponentIsForDbmsEngine ;
	  opl:ComponentCvsid components_tbl.component_cvsid
	    as virtrdf:OplComponentComponentCvsId ;
	  opl:ComponentBuildDate components_tbl.component_build_date
	    as virtrdf:OplComponentComponentBuildDate ;
	  opl:Notes components_tbl.notes 
	    as virtrdf:OplComponentNotes ;
	  opl:BuildComments components_tbl.build_comments
	    as virtrdf:OplComponentBuildComments ;
	  opl:Filesize components_tbl.str_filesize
	    as virtrdf:OplComponentFilesize ;
      rdfs:isDefinedBy opl: ;
      ore:isDescribedBy opl:
		.  

    opl:DbmsEngine (dbms_engine_tbl.dbms_name) opl:hasComponents
      opl:Component(components_tbl.component_name)
      where (^{components_tbl.}^.dbms_name = ^{dbms_engine_tbl.}^.dbms_name)
      as virtrdf:OplDbmsEngineForComponents .

    opl:Opsys (opsys_tbl.opsys_name) opl:hasComponents
      opl:Component(components_tbl.component_name)
      where (^{components_tbl.}^.opsys_name = ^{opsys_tbl.}^.opsys_name)
      as virtrdf:OplOpsysForComponents .

	    
	  opl:ComponentMode(component_mode_tbl.component_mode_id)
	    a opl:ComponentMode
	    as virtrdf:OplComponentMode ;
	  rdfs:label component_mode_tbl.component_mode_description
	    as virtrdf:rdfsOplComponentModeDescription ; 
	  opl:ComponentModeDescription component_mode_tbl.component_mode_description
	    as virtrdf:OplComponentModeDescription ; 
	  opl:ComponentModeShortDescription component_mode_tbl.short_description 
	    as virtrdf:OplComponentModeShortDescription ;
      ore:isDescribedBy opl: ;
      ore:isDescribedBy rdfs: ;
      rdfs:isDefinedBy opl: ;
      rdfs:isDefinedBy rdfs: 
		.
	    
	  opl:ComponentType(component_type_tbl.component_type_id)
	    a opl:ComponentType
	    as virtrdf:OplComponentType ;
	  rdfs:label component_type_tbl.component_type_description
	    as virtrdf:rdfsOplComponentTypeDescription ;
	  opl:ComponentTypeDescription component_type_tbl.component_type_description
	    as virtrdf:OplComponentTypeDescription ;
	  opl:ComponentTypeShortDescription component_type_tbl.short_description 
	    as virtrdf:OplComponentTypeShortDescription ;
      ore:isDescribedBy opl: ;
      ore:isDescribedBy rdfs: ;
      rdfs:isDefinedBy opl: ;
      rdfs:isDefinedBy rdfs: 
		.
	    
	  opl:ComponentCategory(component_category_tbl.component_category_id)
	    a opl:ComponentCategory
	    as virtrdf:OplComponentCategory ;
	  rdfs:label component_category_tbl.component_category_description
	    as virtrdf:rdfsOplComponentCategoryDescription ;
	  opl:ComponentCategoryDescription component_category_tbl.component_category_description
	    as virtrdf:OplComponentCategoryDescription ;
	  opl:ComponentCategoryShortDescription component_category_tbl.short_description
	    as virtrdf:OplComponentCateegoryShortDescription ;
	  dc:description opl:lit_to_string(component_category_tbl.component_category_long_description) 
	    as virtrdf:OplComponentCategoryLongDescription ;
      ore:isDescribedBy opl: ;
      ore:isDescribedBy rdfs: ;
      rdfs:isDefinedBy opl: ;
      rdfs:isDefinedBy rdfs: 
		.
	    
	  opl:ComponentArchive(component_archive_tbl.component_archive_name)
	    a opl:ComponentArchive
	    as virtrdf:OplComponentArchive ;
	    a opl:Component
	    as virtrdf:ComponentArchiveSubClassOfComponent ;
	  opl:ComponentArchiveName component_archive_tbl.component_archive_name
	    as virtrdf:OplComponentArchiveComponentArchiveName ;
	  rdfs:label component_archive_tbl.component_archive_name
	    as virtrdf:rdfsComponentArchiveComponentArchiveName ;
  	opl:ComponentArchiveType opl:ComponentArchiveType(component_archive_tbl.component_archive_type_id)
	  	as virtrdf:ComponentArchiveComponentArchiveType ;
	  opl:isOfComponent opl:Component(component_archive_tbl.component_name)
	    as virtrdf:OplComponentArchiveIsOfComponent ;
	  opl:isOfProductRelease opl:ProductRelease(
	      component_archive_tbl.product_id,
	      component_archive_tbl.product_release_id,
	      component_archive_tbl.opsys_name,
	      component_archive_tbl.dbms_name
	      )
	    as virtrdf:OplComponentArchiveIsOfProductRelease ;
  	opl:AssemblyDate component_archive_tbl.assembly_date
	  	as virtrdf:OplComponentArchiveAssemblyDate ;
	  opl:FileUri component_archive_tbl.file_uri
  		as virtrdf:OplComponentArchiveFileUri ;
  	opl:LicenseCode component_archive_tbl.license_code
		  as virtrdf:OplComponentArchiveLicenseCode ;
	  opl:ResFullPath component_archive_tbl.res_full_path
  		as virtrdf:OplComponentArchiveResFullPath ;
  	opl:ResName component_archive_tbl.res_name
		  as virtrdf:OplComponentArchiveResName ;
      ore:isDescribedBy opl: ;
      ore:isDescribedBy rdfs: ;
      rdfs:isDefinedBy opl: ;
      rdfs:isDefinedBy rdfs: 
		.

	  
	opl:ComponentArchiveType(component_archive_type_tbl.component_archive_type_id) 
	  a opl:ComponentArchiveType
		as virtrdf:OplComponentArchiveType ;
	opl:ComponentArchiveShortName component_archive_type_tbl.component_archive_short_name
		as virtrdf:OplComponentArchiveTypeComponentArchiveShortName ;
	rdfs:label component_archive_type_tbl.component_archive_type_name
		as virtrdf:rdfsOplComponentArchiveTypeComponentArchiveTypeName ;
	opl:ComponentArchiveTypeName component_archive_type_tbl.component_archive_type_name
		as virtrdf:OplComponentArchiveTypeComponentArchiveTypeName ;
	opl:Extension component_archive_type_tbl.extension
		as virtrdf:OplComponentArchiveTypeExtension ;
      ore:isDescribedBy opl: ;
      ore:isDescribedBy rdfs: ;
      rdfs:isDefinedBy opl: ;
      rdfs:isDefinedBy rdfs: 
		.
	  

	opl:DownloadLocation(download_location_tbl.uri) 
	  a opl:DownloadLocation
		as virtrdf:OplDownloadLocation ;
	opl:isOfComponentArchive opl:ComponentArchive(download_location_tbl.component_archive_name)
		as virtrdf:OplDownloadLocationIsOfComponentArchive ;
	opl:hasDownloadProtocol opl:DownloadProtocol(download_location_tbl.protocol_name)
		as virtrdf:DownloadLocationHasProtocolName ;
	rdfs:label download_location_tbl.uri_old
		as virtrdf:rdfsOplDownloadLocationLabel ;
	opl:isOfProductRelease opl:ProductRelease(
		download_location_tbl.product_id,
		download_location_tbl.product_release_id,
		download_location_tbl.opsys_name,
		download_location_tbl.dbms_name
		)
		as virtrdf:OplDownloadLocationIsOfProductRelease ;
	opl:Uri download_location_tbl.uri
		as virtrdf:OplDownloadLocationUri ;
	opl:UriOld download_location_tbl.uri_old
		as virtrdf:OplDownloadLocationUriOld ;
    opl:hasDownloadPartner opl:DownloadPartner(
        download_location_tbl.host_name,
        download_location_tbl.domain_name
      ) 
        as virtrdf:OplDownloadLocationHasDownloadPartner ;
	opl:DomainName download_location_tbl.domain_name
		as virtrdf:OplDownloadLocationDomainName ;
	opl:HostName download_location_tbl.host_name
		as virtrdf:OplDownloadLocationHostName ;
	opl:ResName download_location_tbl.res_name
		as virtrdf:OplDownloadLocationResName ;
      ore:isDescribedBy opl: ;
      ore:isDescribedBy rdfs: ;
      rdfs:isDefinedBy opl: ;
      rdfs:isDefinedBy rdfs: 
		.

	opl:DownloadProtocol(download_protocol_tbl.protocol_name) 
	  a opl:DownloadProtocol
		as virtrdf:OplDownloadProtocolProtocolName ;
	opl:ProtocolDescription download_protocol_tbl.protocol_description
		as virtrdf:OplDownloadProtocolProtocolDescription .

	opl:DownloadPartner(
	  download_partner_tbl.host_name, 
	  download_partner_tbl.domain_name 
	  )
	  a opl:DownloadPartner
	  as virtrdf:OplDownloadPartner;
	rdfs:label download_partner_tbl.partner_name
	  as virtrdf:rdfsOplDownloadPartnerPartnerNamelabel ;
	opl:DownloadPartner download_partner_tbl.partner_name
	  as virtrdf:OplDownloadPartnerPartnerName ;
	opl:PortNumber download_partner_tbl.port_number
	  as virtrdf:OplDownloadPartnerPortNumber ;
      ore:isDescribedBy opl: ;
      ore:isDescribedBy rdfs: ;
      rdfs:isDefinedBy opl: ;
      rdfs:isDefinedBy rdfs: 
		.
	  
    opl:ComponentArchive(component_archive_tbl.component_archive_name)
      opl:hasDownloadLocation 
      opl:DownloadLocation(download_location_tbl.uri)
		where (
				^{component_archive_tbl.}^.component_archive_name = ^{download_location_tbl.}^.component_archive_name
		)
      as virtrdf:OplComponentArchiveIsComponentArchiveOfDownloadLocation .

    opl:DownloadLocation(download_location_tbl.uri)
      opl:isDownloadLocationOf
      opl:ComponentArchive(component_archive_tbl.component_archive_name)
		where (
				 ^{download_location_tbl.}^.component_archive_name = ^{component_archive_tbl.}^.component_archive_name
		)
      as virtrdf:OplDownloadLocationIsDowloadLocationOfComponentArchive .


#
# Extra Peripheral family/cat/format/etc... to/from... dbfamily/opsysfamily/....
# ==================================================================================


# ---------------------> product_family

#  opl:ProductFamily(product_family_tbl.product_family_code)
#    opl:OperatingSystems
#    opl:Opsys(ac1.opsys_name)
#    where (
#        ^{product_family_tbl.}^.product_family_code = ^{ac1.}^.product_family_code
#    )
#    as virtrdf:OplProductFamilyToOpsys .

  opl:ProductFamily(product_family_tbl.product_family_code)
    opl:OperatingSystemsFamilies
    opl:OpsysFamily(ac1.opsys_family_id)
    where (
        ^{product_family_tbl.}^.product_family_code = ^{ac1.}^.product_family_code
    )
    as virtrdf:OplProductFamilyToOpsysFamily .

#  opl:ProductFamily(product_family_tbl.product_family_code)
#    opl:Databases
#    opl:DbmsEngine(ac1.dbms_name)
#    where (
#        ^{product_family_tbl.}^.product_family_code = ^{ac1.}^.product_family_code
#    )
#    as virtrdf:OplProductFamilyToDbms .

  opl:ProductFamily(product_family_tbl.product_family_code)
    opl:DatabaseFamilies
    opl:DbmsFamily(ac1.dbms_family_id)
    where (
        ^{product_family_tbl.}^.product_family_code = ^{ac1.}^.product_family_code
    )
    as virtrdf:OplProductFamilyToDbmsFamily .

#  opl:ProductFamily(product_family_tbl.product_family_code)
#    opl:Processors
#  	opl:Processor(ac1.processor_name, ac1.processor_mode_id)
#    where (
#        ^{product_family_tbl.}^.product_family_code = ^{ac1.}^.product_family_code
#    )
#    as virtrdf:OplProductFamilyToProcessor .

  opl:ProductFamily(product_family_tbl.product_family_code)
    opl:ProcessorFamilies
	opl:ProcessorFamily(ac1.processor_family_id)
    where (
        ^{product_family_tbl.}^.product_family_code = ^{ac1.}^.product_family_code
    )
    as virtrdf:OplProductFamilyToProcessorFamily .



# ---------------------> product_format

#  opl:ProductFormat(product_format_with_code.product_format_code)
#    opl:OperatingSystems
#    opl:Opsys(ac1.opsys_name)
#    where (
#        ^{product_format_with_code.}^.product_format_code = ^{ac1.}^.product_format_code
#    )
#    as virtrdf:OplProductFormatToOpsys .

  opl:ProductFormat(product_format_with_code.product_format_code)
    opl:OperatingSystemsFamilies
    opl:OpsysFamily(ac1.opsys_family_id)
    where (
        ^{product_format_with_code.}^.product_format_code = ^{ac1.}^.product_format_code
    )
    as virtrdf:OplProductFormatToOpsysFamily .

#  opl:ProductFormat(product_format_with_code.product_format_code)
#    opl:Databases
#    opl:DbmsEngine(ac1.dbms_name)
#    where (
#        ^{product_format_with_code.}^.product_format_code = ^{ac1.}^.product_format_code
#    )
#    as virtrdf:OplProductFormatToDbms .

  opl:ProductFormat(product_format_with_code.product_format_code)
    opl:DatabaseFamilies
    opl:DbmsFamily(ac1.dbms_family_id)
    where (
        ^{product_format_with_code.}^.product_format_code = ^{ac1.}^.product_format_code
    )
    as virtrdf:OplProductFormatToDbmsFamily .

  opl:ProductFormat(product_format_with_code.product_format_code)
    opl:Processors
  	opl:Processor(ac1.processor_name, ac1.processor_mode_id)
    where (
        ^{product_format_with_code.}^.product_format_code = ^{ac1.}^.product_format_code
    )
    as virtrdf:OplProductFormatToProcessor .

  opl:ProductFormat(product_format_with_code.product_format_code)
    opl:ProcessorFamilies
	opl:ProcessorFamily(ac1.processor_family_id)
    where (
        ^{product_format_with_code.}^.product_format_code = ^{ac1.}^.product_format_code
    )
    as virtrdf:OplProductFormatToProcessorFamily .

	  

# ---------------------> product_category

#  opl:ProductCategory(product_category_with_code.product_cat_code)
#    opl:OperatingSystems
#    opl:Opsys(ac1.opsys_name)
#    where (
#        ^{product_category_with_code.}^.product_cat_code = ^{ac1.}^.product_cat_code
#    )
#    as virtrdf:OplProductCatToOpsys .

  opl:ProductCategory(product_category_with_code.product_cat_code)
    opl:OperatingSystemsFamilies
    opl:OpsysFamily(ac1.opsys_family_id)
    where (
        ^{product_category_with_code.}^.product_cat_code = ^{ac1.}^.product_cat_code
    )
    as virtrdf:OplProductCatToOpsysFamily .

#  opl:ProductCategory(product_category_with_code.product_cat_code)
#    opl:Databases
#    opl:DbmsEngine(ac1.dbms_name)
#    where (
#        ^{product_category_with_code.}^.product_cat_code = ^{ac1.}^.product_cat_code
#    )
#    as virtrdf:OplProductCatToDbms .

  opl:ProductCategory(product_category_with_code.product_cat_code)
    opl:DatabaseFamilies
    opl:DbmsFamily(ac1.dbms_family_id)
    where (
        ^{product_category_with_code.}^.product_cat_code = ^{ac1.}^.product_cat_code
    )
    as virtrdf:OplProductCatToDbmsFamily .

#  opl:ProductCategory(product_category_with_code.product_cat_code)
#    opl:Processors
#  	opl:Processor(ac1.processor_name, ac1.processor_mode_id)
#    where (
#        ^{product_category_with_code.}^.product_cat_code = ^{ac1.}^.product_cat_code
#    )
#    as virtrdf:OplProductCatToProcessor .

  opl:ProductCategory(product_category_with_code.product_cat_code)
    opl:ProcessorFamilies
	opl:ProcessorFamily(ac1.processor_family_id)
    where (
        ^{product_category_with_code.}^.product_cat_code = ^{ac1.}^.product_cat_code
    )
    as virtrdf:OplProductCatToProcessorFamily .


	  

# ---------------------> product

  opl:Product(product_with_code.product_id)
    opl:OperatingSystems
    opl:Opsys(ac1.opsys_name)
    where (
        ^{product_with_code.}^.product_id = ^{ac1.}^.product_id
    )
    as virtrdf:OplProductToOpsys .

  opl:Product(product_with_code.product_id)
    opl:OperatingSystemsFamilies
    opl:OpsysFamily(ac1.opsys_family_id)
    where (
        ^{product_with_code.}^.product_id = ^{ac1.}^.product_id
    )
    as virtrdf:OplProductToOpsysFamily .

  opl:Product(product_with_code.product_id)
    opl:Databases
    opl:DbmsEngine(ac1.dbms_name)
    where (
        ^{product_with_code.}^.product_id = ^{ac1.}^.product_id
    )
    as virtrdf:OplProductToDbms .

  opl:Product(product_with_code.product_id)
    opl:DatabaseFamilies
    opl:DbmsFamily(ac1.dbms_family_id)
    where (
        ^{product_with_code.}^.product_id = ^{ac1.}^.product_id
    )
    as virtrdf:OplProductToDbmsFamily .

  opl:Product(product_with_code.product_id)
    opl:Processors
  	opl:Processor(ac1.processor_name, ac1.processor_mode_id)
    where (
        ^{product_with_code.}^.product_id = ^{ac1.}^.product_id
    )
    as virtrdf:OplProductToProcessor .

  opl:Product(product_with_code.product_id)
    opl:ProcessorFamilies
	opl:ProcessorFamily(ac1.processor_family_id)
    where (
        ^{product_with_code.}^.product_id = ^{ac1.}^.product_id
    )
    as virtrdf:OplProductToProcessorFamily .




# ---------------------> to product

  opl:Opsys(opsys_tbl.opsys_name)
    opl:hasProducts
    opl:Product(ac1.product_id)
    where (
        ^{opsys_tbl.}^.opsys_name = ^{ac1.}^.opsys_name
    )
    as virtrdf:OplOpsysToProduct .

  opl:OpsysFamily(opsys_family_tbl.opsys_family_id)
    opl:hasProducts
    opl:Product(ac1.product_id)
    where (
        ^{opsys_family_tbl.}^.opsys_family_id = ^{ac1.}^.opsys_family_id
    )
    as virtrdf:OplOpsysFamilyToProduct .

  opl:DbmsEngine(dbms_engine_tbl.dbms_name)
    opl:hasProducts
    opl:Product(ac1.product_id)
    where (
        ^{dbms_engine_tbl.}^.dbms_name = ^{ac1.}^.dbms_name
    )
    as virtrdf:OplDbmsToProduct .

  opl:DbmsFamily(dbms_family_tbl.dbms_family_id)
    opl:hasProducts
    opl:Product(ac1.product_id)
    where (
        ^{dbms_family_tbl.}^.dbms_family_id = ^{ac1.}^.dbms_family_id
    )
    as virtrdf:OplDbmsFamilyToProduct .

  opl:Processor(processors_tbl.processor_name, processors_tbl.processor_mode_id)
    opl:hasProducts
    opl:Product(ac1.product_id)
    where (
        ^{processors_tbl.}^.processor_name = ^{ac1.}^.processor_name
        and
        ^{processors_tbl.}^.processor_mode_id = ^{ac1.}^.processor_mode_id
    )
    as virtrdf:OplProcessorToProduct .

  opl:ProcessorFamily(processor_family_tbl.processor_family_id)
    opl:hasProducts
    opl:Product(ac1.product_id)
    where (
        ^{processor_family_tbl.}^.processor_family_id = ^{ac1.}^.processor_family_id
    )
    as virtrdf:OplProcessorFamilyProduct .




# ---------------------> to product_cat

#  opl:Opsys(opsys_tbl.opsys_name)
#    opl:hasProductCategory
#    opl:ProductCategory(ac1.product_cat_code)
#    where (
#        ^{opsys_tbl.}^.opsys_name = ^{ac1.}^.opsys_name
#    )
#    as virtrdf:OplOpsysToProductCategory .

  opl:OpsysFamily(opsys_family_tbl.opsys_family_id)
    opl:hasProductCategory
    opl:ProductCategory(ac1.product_cat_code)
    where (
        ^{opsys_family_tbl.}^.opsys_family_id = ^{ac1.}^.opsys_family_id
    )
    as virtrdf:OplOpsysFamilyToProductCategory .

#  opl:DbmsEngine(dbms_engine_tbl.dbms_name)
#    opl:hasProductCategory
#    opl:ProductCategory(ac1.product_cat_code)
#    where (
#        ^{dbms_engine_tbl.}^.dbms_name = ^{ac1.}^.dbms_name
#    )
#    as virtrdf:OplDbmsToProductCategory .

  opl:DbmsFamily(dbms_family_tbl.dbms_family_id)
    opl:hasProductCategory
    opl:ProductCategory(ac1.product_cat_code)
    where (
        ^{dbms_family_tbl.}^.dbms_family_id = ^{ac1.}^.dbms_family_id
    )
    as virtrdf:OplDbmsFamilyToProductCategory .

#  opl:Processor(processors_tbl.processor_name, processors_tbl.processor_mode_id)
#    opl:hasProductCategory
#    opl:ProductCategory(ac1.product_cat_code)
#    where (
#        ^{processors_tbl.}^.processor_name = ^{ac1.}^.processor_name
#        and
#        ^{processors_tbl.}^.processor_mode_id = ^{ac1.}^.processor_mode_id
#    )
#    as virtrdf:OplProcessorToProductCategory .

  opl:ProcessorFamily(processor_family_tbl.processor_family_id)
    opl:hasProductCategory
    opl:ProductCategory(ac1.product_cat_code)
    where (
        ^{processor_family_tbl.}^.processor_family_id = ^{ac1.}^.processor_family_id
    )
    as virtrdf:OplProcessorFamilyProductCategory .




# ---------------------> to product_format

#  opl:Opsys(opsys_tbl.opsys_name)
#    opl:hasProductFormat
#    opl:ProductFormat(ac1.product_format_code)
#    where (
#        ^{opsys_tbl.}^.opsys_name = ^{ac1.}^.opsys_name
#    )
#    as virtrdf:OplOpsysToProductFormat .

  opl:OpsysFamily(opsys_family_tbl.opsys_family_id)
    opl:hasProductFormat
    opl:ProductFormat(ac1.product_format_code)
    where (
        ^{opsys_family_tbl.}^.opsys_family_id = ^{ac1.}^.opsys_family_id
    )
    as virtrdf:OplOpsysFamilyToProductFormat .

#  opl:DbmsEngine(dbms_engine_tbl.dbms_name)
#    opl:hasProductFormat
#    opl:ProductFormat(ac1.product_format_code)
#    where (
#        ^{dbms_engine_tbl.}^.dbms_name = ^{ac1.}^.dbms_name
#    )
#    as virtrdf:OplDbmsToProductFormat .

  opl:DbmsFamily(dbms_family_tbl.dbms_family_id)
    opl:hasProductFormat
    opl:ProductFormat(ac1.product_format_code)
    where (
        ^{dbms_family_tbl.}^.dbms_family_id = ^{ac1.}^.dbms_family_id
    )
    as virtrdf:OplDbmsFamilyToProductFormat .

#  opl:Processor(processors_tbl.processor_name, processors_tbl.processor_mode_id)
#    opl:hasProductFormat
#    opl:ProductFormat(ac1.product_format_code)
#    where (
#        ^{processors_tbl.}^.processor_name = ^{ac1.}^.processor_name
#        and
#        ^{processors_tbl.}^.processor_mode_id = ^{ac1.}^.processor_mode_id
#    )
#    as virtrdf:OplProcessorToProductFormat .

  opl:ProcessorFamily(processor_family_tbl.processor_family_id)
    opl:hasProductFormat
    opl:ProductFormat(ac1.product_format_code)
    where (
        ^{processor_family_tbl.}^.processor_family_id = ^{ac1.}^.processor_family_id
    )
    as virtrdf:OplProcessorFamilyProductFormat .




# ---------------------> to product_family

#  opl:Opsys(opsys_tbl.opsys_name)
#    opl:hasProductFamily
#    opl:ProductFamily(ac1.product_family_code)
#    where (
#        ^{opsys_tbl.}^.opsys_name = ^{ac1.}^.opsys_name
#    )
#    as virtrdf:OplOpsysToProductFamily .

  opl:OpsysFamily(opsys_family_tbl.opsys_family_id)
    opl:hasProductFamily
    opl:ProductFamily(ac1.product_family_code)
    where (
        ^{opsys_family_tbl.}^.opsys_family_id = ^{ac1.}^.opsys_family_id
    )
    as virtrdf:OplOpsysFamilyToProductFamily .

#  opl:DbmsEngine(dbms_engine_tbl.dbms_name)
#    opl:hasProductFamily
#    opl:ProductFamily(ac1.product_family_code)
#    where (
#        ^{dbms_engine_tbl.}^.dbms_name = ^{ac1.}^.dbms_name
#    )
#    as virtrdf:OplDbmsToProductFamily .

  opl:DbmsFamily(dbms_family_tbl.dbms_family_id)
    opl:hasProductFamily
    opl:ProductFamily(ac1.product_family_code)
    where (
        ^{dbms_family_tbl.}^.dbms_family_id = ^{ac1.}^.dbms_family_id
    )
    as virtrdf:OplDbmsFamilyToProductFamily .

#  opl:Processor(processors_tbl.processor_name, processors_tbl.processor_mode_id)
#    opl:hasProductFamily
#    opl:ProductFamily(ac1.product_family_code)
#    where (
#        ^{processors_tbl.}^.processor_name = ^{ac1.}^.processor_name
#        and
#        ^{processors_tbl.}^.processor_mode_id = ^{ac1.}^.processor_mode_id
#    )
#    as virtrdf:OplProcessorToProductFamily .

  opl:ProcessorFamily(processor_family_tbl.processor_family_id)
    opl:hasProductFamily
    opl:ProductFamily(ac1.product_family_code)
    where (
        ^{processor_family_tbl.}^.processor_family_id = ^{ac1.}^.processor_family_id
    )
    as virtrdf:OplProcessorFamilyProductFamily .

		
	} .
} .
;




DB.DBA.RDF_AUDIT_METADATA (1, '*');


sparql
prefix opl: <http://www.openlinksw.com/schemas/oplweb#>
prefix dc: <http://purl.org/dc/terms#>
prefix oplsioc: <http://www.openlinksw.com/schemas/oplsioc#>
prefix sioc: <http://rdfs.org/sioc/ns#>
prefix foaf: <http://xmlns.com/foaf/0.1/>
prefix wgs: <http://www.w3.org/2003/01/geo/wgs84_pos#>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix oplds: <http://www.openlinksw.com/dataspace/organization/openlink#>
prefix owl: <http://www.w3.org/2002/07/owl#>
prefix umbel: <http://umbel.org/umbel/sc/>
prefix gr: <http://purl.org/goodrelations/v1#> 
prefix ore: <http://www.openarchives.org/ore/terms/>

alter quad storage virtrdf:DefaultQuadStorage
from oplweb2.oplweb.component_archive as component_archive_tbl
from oplweb2.oplweb.component_archive_type as component_archive_type_tbl
from oplweb2.oplweb.component_category as component_category_tbl text literal component_category_long_description
from oplweb2.oplweb.component_mode as component_mode_tbl
from oplweb2.oplweb.component_type as component_type_tbl
from oplweb2.oplweb.components_for_rdfs as components_tbl
from oplweb2.oplweb.dbms_engine as dbms_engine_tbl
from oplweb2.oplweb.dbms_family as dbms_family_tbl
from oplweb2.oplweb.download_location as download_location_tbl
from oplweb2.oplweb.download_protocol as download_protocol_tbl
from oplweb2.oplweb.download_partner as download_partner_tbl
from oplweb2.oplweb.opsys as opsys_tbl
from oplweb2.oplweb.opsys_family as opsys_family_tbl
from oplweb2.oplweb.opsys_type as opsys_type_tbl
from oplweb2.oplweb.processor_family as processor_family_tbl
from oplweb2.oplweb.processor_mode as processor_mode_tbl
from oplweb2.oplweb.processors as processors_tbl
from oplweb2.oplweb.product as product_tbl text literal long_description
from oplweb2.oplweb.product_benefits as product_benefits_tbl text literal product_benefit_explanation
from oplweb2.oplweb.product_benefits_category as product_benefits_category_tbl 
from oplweb2.oplweb.product_category as product_category_tbl
from oplweb2.oplweb.product_category_features_with_code as product_category_features_tbl text literal long_description
from oplweb2.oplweb.product_family as product_family_tbl
from oplweb2.oplweb.product_family as product_family_tbl_2
from oplweb2.oplweb.product_family_features_with_code as product_family_features_tbl text literal long_description
from oplweb2.oplweb.product_features as product_features_tbl text literal long_description
from oplweb2.oplweb.product_feature_category as product_feature_category_tbl text literal description
from oplweb2.oplweb.product_format_features_with_code as product_format_features_tbl text literal long_description
from oplweb2.oplweb.product_release_features as product_release_features_tbl text literal long_description
from oplweb2.oplweb.product_release_with_family as product_release_tbl
from oplweb2.oplweb.vendor_category as vendor_category_tbl
from oplweb2.oplweb.vendor_category_family as vendor_category_family_tbl
from oplweb2.oplweb.vendors as vendors_tbl
from oplweb2.oplweb.product_formats_categories as product_formats_categories
from oplweb2.oplweb.product_with_code as product_with_code
from oplweb2.oplweb.product_category_with_code as product_category_with_code
from oplweb2.oplweb.product_format as product_format_with_code
from oplweb2.oplweb.product_price as pp
from oplweb2.oplweb.product_price_type as pt
from oplweb2.DBA.license_model_unit_type as put
from oplweb2.DBA.license_model_unit_type as put2
from oplweb2.DBA.license_model as lm
from oplweb2.DBA.license_model as lm2
from oplweb2.DBA.license_model_type as license_model_type_tbl
from oplweb2.DBA.product_price_varchar as ppv
from oplweb2.DBA.product_general_discount_vc as gd
from oplweb2.oplweb.archive_coverage_osdb as ac1
{
	create virtrdf:product_portfolio2 as
		graph <http://www.openlinksw.com/dataspace/organization/openlink/oplweb/>
	  option (exclusive)
	{

#
# Product Benefits and things
# =========================================	
	
	opl:ProductBenefit(product_benefits_tbl.product_benefit_id) 
	  a opl:ProductBenefit
	  as virtrdf:OplProductBenefit ;
	rdfs:label product_benefits_tbl.product_benefit_desc
	  as virtrdf:rdfsLabelProductBenefitDescription ;
	opl:isOfProductBenefitCategory opl:ProductBenefitCategory(product_benefits_tbl.product_benefit_category_id) 
	  as virtrdf:OplProductBenefitIsOfProductBenefitCategory ;
	opl:Description product_benefits_tbl.product_benefit_desc
	  as virtrdf:OplProductBenefitDescription ;
	opl:Acronym product_benefits_tbl.product_benefit_acronym
	  as virtrdf:OplProductBenefitAcronym ;
  opl:Explanation product_benefits_tbl.product_benefit_explanation
    as virtrdf:OplProductBenefitExplanation ;
      ore:isDescribedBy opl: ;
      ore:isDescribedBy rdfs: ;
      rdfs:isDefinedBy opl: ;
      rdfs:isDefinedBy rdfs: 
		.
	  
	opl:ProductBenefitCategory(product_benefits_category_tbl.product_benefit_category_id) 
	  a opl:ProductBenefitCategory
	  as virtrdf:OplProductBenefitCategory ;
	rdfs:label product_benefits_category_tbl.description
	  as virtrdf:rdfsLabelProductBenefitCategoryDescription ;
	opl:Description product_benefits_category_tbl.description
	  as virtrdf:OplProductBenefitCategoryDescription ;
      ore:isDescribedBy opl: ;
      ore:isDescribedBy rdfs: ;
      rdfs:isDefinedBy opl: ;
      rdfs:isDefinedBy rdfs: 
		.
	  
	opl:ProductFeatureCategory(product_feature_category_tbl.product_feature_category_id) 
	  a opl:ProductFeatureCategory
	  as virtrdf:OplProductFeatureCategory ;
	rdfs:label product_feature_category_tbl.short_desc
	  as virtrdf:rdfsLabelProductFeatureCategoryShortDescription ;
	opl:ShortDescription product_feature_category_tbl.short_desc
	  as virtrdf:OplProductFeatureCategoryShortDescription ;
	opl:Description product_feature_category_tbl.description
	  as virtrdf:OplProductFeatureCategoryDescription ;
	opl:StandardsId product_feature_category_tbl.standards_id
	  as virtrdf:OplProductFeatureCategoryStandardsId ;
      ore:isDescribedBy opl: ;
      ore:isDescribedBy rdfs: ;
      rdfs:isDefinedBy opl: ;
      rdfs:isDefinedBy rdfs: 
		.
	  
	opl:ProductFeature(product_features_tbl.product_feature_id) 
	  a opl:ProductFeature
	  as virtrdf:OplProductFeature ;
	rdfs:label product_features_tbl.short_description
		as virtrdf:rdfsLabelProductFeaturesShortDescription ;
	opl:Description product_features_tbl.short_description
		as virtrdf:OplProductFeaturesShortDescription ;
	dc:description opl:lit_to_string(product_features_tbl.long_description)
		as virtrdf:OplProductFeaturesLongDescription ;
	opl:isOfProductBenefit opl:ProductBenefit(product_features_tbl.product_feature_benefit_id)
		as virtrdf:ProductFeaturesIsOfProductBenefit ;
	opl:isOfProductFeatureCategory opl:ProductFeatureCategory(product_features_tbl.product_feature_category_id)
		as virtrdf:ProductFeaturesIsOfProductFeatureCategory ;
	opl:isOfProduct opl:Product(product_features_tbl.product_id)
		as virtrdf:ProductFeaturesIsOfProduct ;
      ore:isDescribedBy opl: ;
      ore:isDescribedBy rdfs: ;
      ore:isDescribedBy dc: ;
      rdfs:isDefinedBy opl: ;
      rdfs:isDefinedBy dc: ;
      rdfs:isDefinedBy rdfs: 
		.

    opl:Product(product_with_code.product_id)
      opl:hasFeature
      opl:ProductFeature(product_features_tbl.product_feature_id)
      where (
	    ^{product_with_code.}^.product_id = ^{product_features_tbl.}^.product_id
	)
	as virtrdf:OplProductHasProductFeaturesProductFeatures .

    opl:ProductFeature(product_features_tbl.product_feature_id)
      opl:isFeatureOf
      opl:Product(product_with_code.product_id)
      where (
        ^{product_with_code.}^.product_id = ^{product_features_tbl.}^.product_id
    )
    as virtrdf:OplProductFeaturesAreProductFeaturesProduct .

	  
	opl:ProductFamilyFeature(product_family_features_tbl.product_family_feature_id) 
	  a opl:ProductFamilyFeature
		as virtrdf:OplProductFamilyFeature ;
	rdfs:label product_family_features_tbl.short_description
		as virtrdf:rdfsLabelProductFamilyFeaturesShortDescription ;
	opl:Description product_family_features_tbl.short_description
		as virtrdf:OplProductFamilyFeaturesShortDescription ;
	dc:description opl:lit_to_string(product_family_features_tbl.long_description)
		as virtrdf:OplProductFamilyFeaturesLongDescription ;
	opl:isOfProductBenefit opl:ProductBenefit(product_family_features_tbl.product_family_feature_benefit_id)
		as virtrdf:ProductFamilyFeaturesIsOfProductBenefit ;
	opl:isOfProductFeatureCategory opl:ProductFeatureCategory(product_family_features_tbl.product_family_feature_cat_id)
		as virtrdf:ProductFamilyFeaturesIsOfProductFeatureCategory ;
	opl:isOfProductFamily opl:ProductFamily(product_family_features_tbl.product_family_code)
		as virtrdf:ProductFamilyFeaturesIsOfProductFamily ;
      ore:isDescribedBy opl: ;
      ore:isDescribedBy dc: ;
      ore:isDescribedBy rdfs: ;
      rdfs:isDefinedBy opl: ;
      rdfs:isDefinedBy dc: ;
      rdfs:isDefinedBy rdfs: 
		.

    opl:ProductFamily(product_family_tbl.product_family_code)
      opl:hasFeature
      opl:ProductFamilyFeature(product_family_features_tbl.product_family_feature_id)
      where (
	    ^{product_family_tbl.}^.product_family_id = ^{product_family_features_tbl.}^.product_family_id
	)
	as virtrdf:OplProductFamilyHasProductFamilyFeaturesProductFamilyFeatures .

    opl:ProductFamilyFeature(product_family_features_tbl.product_family_feature_id)
      opl:isFeatureOf
      opl:Product(product_family_tbl.product_family_code)
      where (
        ^{product_family_tbl.}^.product_family_id = ^{product_family_features_tbl.}^.product_family_id
    )
    as virtrdf:OplProductFamilyFeaturesAreProductFamilyFeaturesProductFamily .

	
	opl:ProductFormatFeature(product_format_features_tbl.product_format_feature_id) 
	  a opl:ProductFormatFeature
	  as virtrdf:OplProductFormatFeature ;
	rdfs:label product_format_features_tbl.short_description
		as virtrdf:rdfsLabelProductFormatFeaturesShortDescription ;
	opl:Description product_format_features_tbl.short_description
		as virtrdf:OplProductFormatFeaturesShortDescription ;
	dc:description opl:lit_to_string(product_format_features_tbl.long_description)
		as virtrdf:OplProductFormatFeaturesLongDescription ;
	opl:isOfProductBenefit opl:ProductBenefit(product_format_features_tbl.product_format_feature_benefit_id)
		as virtrdf:ProductFormatFeaturesIsOfProductBenefit ;
	opl:isOfProductFeatureCategory opl:ProductFeatureCategory(product_format_features_tbl.product_format_feature_cat_id)
		as virtrdf:ProductFormatFeaturesIsOfProductFeatureCategory ;
	opl:isOfProductFormat opl:ProductFormat(product_format_features_tbl.product_format_code)
		as virtrdf:ProductFormatFeaturesIsOfProductFormat ;
      ore:isDescribedBy opl: ;
      ore:isDescribedBy dc: ;
      ore:isDescribedBy rdfs: ;
      rdfs:isDefinedBy opl: ;
      rdfs:isDefinedBy dc: ;
      rdfs:isDefinedBy rdfs: 
		.

    opl:ProductFormat(product_format_with_code.product_format_code)
      opl:hasFeature
      opl:ProductFormatFeature(product_format_features_tbl.product_format_feature_id)
      where (
	    ^{product_format_with_code.}^.product_format_id = ^{product_format_features_tbl.}^.product_format_id
	)
	as virtrdf:OplProductFormatHasProductFormatFeaturesProductFormatFeatures .

    opl:ProductFormatFeature(product_format_features_tbl.product_format_feature_id)
      opl:isFeatureOf
      opl:ProductFormat(product_format_with_code.product_format_code)
      where (
        ^{product_format_with_code.}^.product_format_id = ^{product_format_features_tbl.}^.product_format_id
    )
    as virtrdf:OplProductFormatFeaturesAreProductFormatFeaturesProductFormat .


	  
	opl:ProductCategoryFeature(product_category_features_tbl.product_category_feature_id) 
	  a opl:ProductCategoryFeature
	  as virtrdf:OplProductCategoryFeature ;
	rdfs:label product_category_features_tbl.short_description
		as virtrdf:rdfsLabelProductCategoryFeaturesShortDescription ;
	opl:Description product_category_features_tbl.short_description
		as virtrdf:OplProductCategoryFeaturesShortDescription ;
	dc:description opl:lit_to_string(product_category_features_tbl.long_description)
		as virtrdf:OplProductCategoryFeaturesLongDescription ;
	opl:isOfProductBenefit opl:ProductBenefit(product_category_features_tbl.product_category_feature_benefit_id)
		as virtrdf:ProductCategoryFeaturesIsOfProductBenefit ;
	opl:isOfProductFeatureCategory opl:ProductFeatureCategory(product_category_features_tbl.product_category_feature_category_id)
		as virtrdf:ProductCategoryFeaturesIsOfProductFeatureCategory ;
	opl:isOfProductCategory opl:ProductCategory(product_category_features_tbl.product_cat_code)
		as virtrdf:ProductCategoryFeaturesIsOfProductCategory ;
      ore:isDescribedBy opl: ;
      ore:isDescribedBy dc: ;
      ore:isDescribedBy rdfs: ;
      rdfs:isDefinedBy opl: ;
      rdfs:isDefinedBy dc: ;
      rdfs:isDefinedBy rdfs: 
		.
	  
    opl:ProductCategory(product_category_with_code.product_cat_code)
      opl:hasFeature
      opl:ProductCategoryFeature(product_category_features_tbl.product_category_feature_id)
      where (
	    ^{product_category_with_code.}^.product_cat_id = ^{product_category_features_tbl.}^.product_cat_id
	)
	as virtrdf:OplProductCategoryHasProductCategoryFeaturesProductCategoryFeatures .

    opl:ProductCategoryFeature(product_category_features_tbl.product_category_feature_id)
      opl:isFeatureOf
      opl:ProductCategory(product_category_with_code.product_cat_code)
      where (
        ^{product_category_with_code.}^.product_cat_id = ^{product_category_features_tbl.}^.product_cat_id
    )
    as virtrdf:OplProductCategoryFeaturesAreProductCategoryFeaturesProductCategory .

	
	opl:ProductReleaseFeature(product_release_features_tbl.product_release_feature_id) 
	  a opl:ProductReleaseFeature
	  as virtrdf:OplProductReleaseFeature ;
	rdfs:label product_release_features_tbl.short_description
		as virtrdf:rdfsLabelProductReleaseFeaturesShortDescription ;
	opl:Description product_release_features_tbl.short_description
		as virtrdf:OplProductReleaseFeaturesShortDescription ;
	dc:description opl:lit_to_string(product_release_features_tbl.long_description)
		as virtrdf:OplProductReleaseFeaturesLongDescription ;
	opl:isOfProductBenefit opl:ProductBenefit(product_release_features_tbl.product_release_feature_benefit_id)
		as virtrdf:ProductReleaseFeaturesIsOfProductBenefit ;
	opl:isOfProductFeatureCategory opl:ProductFeatureCategory(product_release_features_tbl.product_release_feature_cat_id)
		as virtrdf:ProductReleaseFeaturesIsOfProductFeatureCategory ;
	opl:isOfProduct opl:Product(product_release_features_tbl.product_id)
		as virtrdf:ProductReleaseFeaturesIsOfProduct ;
	opl:ProductReleaseId product_release_features_tbl.product_release_id
		as virtrdf:ProductReleaseFeaturesProductRelease ;
      ore:isDescribedBy opl: ;
      ore:isDescribedBy dc: ;
      ore:isDescribedBy rdfs: ;
      rdfs:isDefinedBy opl: ;
      rdfs:isDefinedBy dc: ;
      rdfs:isDefinedBy rdfs: 
	.



  opl:ProcessorFamily(processor_family_tbl.processor_family_id)
    opl:hasProcessors
    opl:Processor(processors_tbl.processor_name, processors_tbl.processor_mode_id)
    where (
        ^{processor_family_tbl.}^.processor_family_id = ^{processors_tbl.}^.processor_family_id
    )
    as virtrdf:OplProcessorFamilyHasProcessors .


  opl:Processor(processors_tbl.processor_name, processors_tbl.processor_mode_id)
    opl:hasProductFamily
    opl:ProductFamily(ac1.product_family_code)
    where (
        ^{processors_tbl.}^.processor_name = ^{ac1.}^.processor_name
        and
        ^{processors_tbl.}^.processor_mode_id = ^{ac1.}^.processor_mode_id
    )
    as virtrdf:OplProcessorToProductFamily .
    
    

#
# Product Licensing and Shop stuff
# =========================================	


	  opl:ProductRelease(
	      product_release_tbl.product_id, 
	      product_release_tbl.product_release_id,
	      product_release_tbl.opsys_name, 
	      product_release_tbl.dbms_name
	      )
      opl:hasLicenseModel
      opl:LicenseModel(
        lm.product_release_id, 
        lm.product_id,
        lm.opsys_family_id,
        lm.dbms_family_id,
        lm.product_price_type_id
	  )
      where (
        ^{lm.}^.product_id = ^{product_release_tbl.}^.product_id and
        ^{lm.}^.product_release_id = ^{product_release_tbl.}^.product_release_id and
        ^{lm.}^.opsys_family_id = ^{product_release_tbl.}^.opsys_family_id and
        ^{lm.}^.dbms_family_id = ^{product_release_tbl.}^.dbms_family_id
    )
    as virtrdf:OplProductReleaseHasLicenseModel .

	  opl:ProductRelease(
	      product_release_tbl.product_id, 
	      product_release_tbl.product_release_id,
	      product_release_tbl.opsys_name, 
	      product_release_tbl.dbms_name
	      )
      opl:hasPriceSample
	  opl:lit_shop_sample (
	      product_release_tbl.product_release_id,
	      product_release_tbl.product_id, 
	      product_release_tbl.opsys_name, 
	      product_release_tbl.dbms_name
      	)
      as virtrdf:OplPriceSamples .
	  
	  
	opl:LicenseModel(
	    lm.product_release_id, 
        lm.product_id,
        lm.opsys_family_id,
        lm.dbms_family_id,
		lm.product_price_type_id) 
	a opl:LicenseModel
	as virtrdf:OplLicenseModel;
	a gr:Sell
	as virtrdf:OplLicenseModelAgrSell ;
	a gr:ActualProductOrServiceInstance
	as virtrdf:OplLicenseModelAgrProductOrServiceInstance ;
	rdfs:label opl:lit_license_model_type(
		lm.product_price_type_id
	) as virtrdf:OplLabelLicenseModel ;
	rdfs:description opl:lit_license_model_explain (
		lm.product_price_type_id
	) as virtrdf:OplLicenseModelExplain ;
	opl:ProductReleaseId
	  lm.product_release_id 
	  as virtrdf:lm_shop_price_product_release;
	opl:isOfFormat 
	  opl:ProductFormat(lm.product_format_code)
	  as virtrdf:lm_shop_price_product_format;
	opl:isOfCategory 
	  opl:ProductCategory(lm.product_cat_code)
	  as virtrdf:lm_shop_price_product_cat;
	opl:OpsysFamily 
	  opl:OpsysFamily(lm.opsys_family_id)
	  as virtrdf:lm_shop_price_opsys_family_oplweb;
	opl:OpsysType 
	  opl:OpsysType(lm.opsys_type_id)
	  as virtrdf:lm_shop_price_opsys_type;
	opl:DbmsFamily 
	  opl:DbmsFamily(lm.dbms_family_id)
	  as virtrdf:lm_shop_price_dbms_family	;
      ore:isDescribedBy opl: ;
      ore:isDescribedBy gr: ;
      ore:isDescribedBy rdfs: ;
      rdfs:isDefinedBy opl: ;
      rdfs:isDefinedBy rdfs: ;
      rdfs:isDefinedBy gr: 
		.


	opl:LicenseModel(
	    lm.product_release_id, 
        lm.product_id,
        lm.opsys_family_id,
        lm.dbms_family_id,
		lm.product_price_type_id) 
	opl:hasPriceUnitType
	opl:PriceUnitType(
	    lm2.product_release_id, 
        lm2.product_id,
        lm2.opsys_family_id,
        lm2.dbms_family_id,
		lm2.product_price_type_id,
		lm2.product_price_unit_type_id)
      where (
        ^{lm.}^.product_release_id = ^{lm2.}^.product_release_id AND 
        ^{lm.}^.product_id = ^{lm2.}^.product_id AND 
        ^{lm.}^.opsys_family_id = ^{lm2.}^.opsys_family_id AND 
        ^{lm.}^.opsys_type_id = ^{lm2.}^.opsys_type_id AND 
        ^{lm.}^.product_price_type_id = ^{lm2.}^.product_price_type_id AND
		^{lm2.}^.product_price_unit_type_id <> 'db_sessions'
        and
        (
          ^{lm.}^.dbms_family_id = ^{lm2.}^.dbms_family_id 
    	  OR
          ^{lm2.}^.dbms_family_id = 15
        )
    )
    as virtrdf:OplLicenseModelPriceUnitTypes .
	


	opl:LicenseModel(
	    lm.product_release_id, 
        lm.product_id,
        lm.opsys_family_id,
        lm.dbms_family_id,
		lm.product_price_type_id) 
	gr:hasPriceSpecification
	opl:PriceUnitType(
	    lm2.product_release_id, 
        lm2.product_id,
        lm2.opsys_family_id,
        lm2.dbms_family_id,
		lm2.product_price_type_id,
		lm2.product_price_unit_type_id)
      where (
        ^{lm.}^.product_release_id = ^{lm2.}^.product_release_id AND 
        ^{lm.}^.product_id = ^{lm2.}^.product_id AND 
        ^{lm.}^.opsys_family_id = ^{lm2.}^.opsys_family_id AND 
        ^{lm.}^.opsys_type_id = ^{lm2.}^.opsys_type_id AND 
        ^{lm.}^.product_price_type_id = ^{lm2.}^.product_price_type_id AND
		^{lm2.}^.product_price_unit_type_id = 'db_sessions'
        and
        (
          ^{lm.}^.dbms_family_id = ^{lm2.}^.dbms_family_id 
    	  OR
          ^{lm2.}^.dbms_family_id = 15
        )
    )
    as virtrdf:OplLicenseModelBasePriceUnitTypes .

	
	opl:Discount(
	    gd.product_release_id,
	    gd.opsys_type_id, 
	    gd.product_id, 
	    gd.opsys_family_id, 
	    gd.dbms_family_id, 
	    gd.product_price_type_id) 
	a opl:Discount
	as virtrdf:product_discount;
	rdfs:label gd.product_discount_description as virtrdf:OplLabelDiscount ;
	rdfs:description gd.product_discount_description as virtrdf:OplDiscountExplain ;
	opl:discount_description 
	  gd.product_discount_description 
	  as virtrdf:gd_discount_description;
	opl:discount_start
	  gd.discount_start
	  as virtrdf:gd_discount_start;
	opl:discount_end
	  gd.discount_end
	  as virtrdf:gd_discount_end;
	opl:ProductPriceType 
	  opl:PriceType(gd.product_price_type_id) 
	  as virtrdf:gd_shop_price_type;
	gr:hasUnitOfMeasurement 
	  opl:PriceType(gd.product_price_type_id) 
	  as virtrdf:gd_shop_price_type_grUnitOfMeasurement;
	opl:ProductReleaseId 
	  gd.product_release_id 
	  as virtrdf:gd_shop_price_product_release;
	opl:ProductFormat 
	  opl:ProductFormat(gd.product_format_code)
	  as virtrdf:gd_shop_price_product_format;
	opl:ProductCategory 
	  opl:ProductCategory(gd.product_cat_code)
	  as virtrdf:gd_shop_price_product_cat;
	opl:OpsysFamily 
	  opl:OpsysFamily(gd.opsys_family_id)
	  as virtrdf:gd_shop_price_opsys_family_oplweb;
	opl:OpsysType 
	  opl:OpsysType(gd.opsys_type_id)
	  as virtrdf:gd_shop_price_opsys_type;
	opl:DbmsFamily 
	  opl:DbmsFamily(gd.dbms_family_id)
	  as virtrdf:gd_shop_price_dbms_family;
	opl:discount_token
	  gd.discount_token
	  as virtrdf:gd_discount_token ;
      ore:isDescribedBy opl: ;
      ore:isDescribedBy rdfs: ;
      rdfs:isDefinedBy opl: ;
      rdfs:isDefinedBy rdfs: 
		.

	  
	

	opl:PriceType(pt.product_price_type_id)
	  a opl:PriceType 
	  as virtrdf:shop_product_price_type;
	rdfs:label pt.product_price_type_description as virtrdf:OplLabelPriceType ;
	rdfs:description pt.product_price_type_description as virtrdf:OplPriceTypeExplain ;
	opl:PriceTypeDescription 
	  pt.product_price_type_description 
	  as virtrdf:shop_product_price_type_description;
	dc:description 
	  pt.product_price_type_long_description 
	  as virtrdf:shop_product_price_type_long_description ;
      ore:isDescribedBy opl: ;
      ore:isDescribedBy dc: ;
      ore:isDescribedBy rdfs: ;
      rdfs:isDefinedBy opl: ;
      rdfs:isDefinedBy dc: ;
      rdfs:isDefinedBy rdfs: 
		.
	
	opl:PriceUnitType(
		put.product_release_id, 
        put.product_id,
        put.opsys_family_id,
        put.dbms_family_id,
		put.product_price_type_id,
		put.product_price_unit_type_id)
	  a opl:PriceUnitType 
	  as virtrdf:shop_product_price_unit_type;
	rdfs:label put.product_price_unit_description as virtrdf:OplLabelproductpriceunitdescription ;
	rdfs:description put.product_price_unit_description as virtrdf:OplproductpriceunitdescriptionExplain ;
	gr:hasUnitOfMeasurement 
	  opl:PriceType(put.product_price_type_id) 
	  as virtrdf:put_shop_price_type_grUnitOfMeasurement;
	opl:unitValue 
	  put.unit_price 
	  as virtrdf:unit_type_unit_price;
	gr:hasValue 
	  put.unit_price 
	  as virtrdf:unit_type_unit_price_grHasValue;
	opl:graceUnits 
	  put.unit_grace 
	  as virtrdf:unit_type_unit_grace;
	opl:minUnits 
	  put.unit_low 
	  as virtrdf:unit_type_unit_low;
	opl:maxUnits 
	  put.unit_cap 
	  as virtrdf:unit_type_unit_cap;
	opl:unit_type_description 
	  put.product_price_unit_description 
	  as virtrdf:unit_type_description ;
      ore:isDescribedBy opl: ;
      ore:isDescribedBy rdfs: ;
      rdfs:isDefinedBy opl: ;
      rdfs:isDefinedBy rdfs: 
		.


    opl:PriceUnitType(
		put.product_release_id, 
        put.product_id,
        put.opsys_family_id,
        put.dbms_family_id,
		put.product_price_type_id,
		put.product_price_unit_type_id
	  )
      opl:hasIncrementalDiscount
      opl:PriceUnitIncrementalDiscount(
		put2.product_release_id, 
        put2.product_id,
        put2.opsys_family_id,
        put2.dbms_family_id,
		put2.product_price_type_id,
		put2.product_price_unit_type_id
	  ) 
      where (
		^{put.}^.product_release_id = ^{put2.}^.product_release_id and 
        ^{put.}^.product_id = ^{put2.}^.product_id and
        ^{put.}^.opsys_family_id = ^{put2.}^.opsys_family_id and
        ^{put.}^.dbms_family_id = ^{put2.}^.dbms_family_id and  
		^{put.}^.product_price_type_id = ^{put2.}^.product_price_type_id and  
		^{put.}^.product_price_unit_type_id = ^{put2.}^.product_price_unit_type_id
    )
    as virtrdf:OplLicenseModelUnitsIncrementalDiscounts .


	opl:PriceUnitIncrementalDiscount(
		put.product_release_id, 
        put.product_id,
        put.opsys_family_id,
        put.dbms_family_id,
		put.product_price_type_id,
		put.product_price_unit_type_id)
	  a opl:PriceUnitIncrementalDiscount 
	  as virtrdf:shop_product_price_unit_type_incremental_discount;
	rdfs:label put.product_price_unit_description as virtrdf:OplLabelproductpriceunitIncDisdescription ;
	rdfs:description put.product_price_unit_description as virtrdf:OplproductpriceunitIncDisdescriptionExplain ;
	opl:percentageOfBase 
	  put.unit_discount 
	  as virtrdf:unit_type_unit_discount;
	opl:triggerPoint 
	  put.quantity 
	  as virtrdf:unit_type_unit_discount_quantity
	.

	
      opl:LicenseModel(
        lm.product_release_id, 
        lm.product_id,
        lm.opsys_family_id,
        lm.dbms_family_id,
        lm.product_price_type_id
	  )
      opl:hasGeneralDiscounts
      opl:Discount(
	    gd.product_release_id,
	    gd.opsys_type_id, 
	    gd.product_id, 
	    gd.opsys_family_id, 
	    gd.dbms_family_id, 
	    gd.product_price_type_id
	  ) 
      where (
        ^{lm.}^.product_release_id = ^{gd.}^.product_release_id AND 
        ^{lm.}^.product_id = ^{gd.}^.product_id AND 
        ^{lm.}^.opsys_family_id = ^{gd.}^.opsys_family_id AND 
        ^{lm.}^.dbms_family_id = ^{gd.}^.dbms_family_id AND 
        ^{lm.}^.opsys_type_id = ^{gd.}^.opsys_type_id AND 
        ^{lm.}^.product_price_type_id = ^{gd.}^.product_price_type_id 
    )
    as virtrdf:OplLicenseModelGeneralDiscounts .

    
		
	} .
} .
;


DB.DBA.XML_SET_NS_DECL ('OpenLink', 'http://www.openlinksw.com/schemas/oplweb#', 2);
DB.DBA.XML_SET_NS_DECL ('OplProductCategory', 'http://data.openlinksw.com/oplweb/product_category/', 2);
DB.DBA.XML_SET_NS_DECL ('OplProductFamily', 'http://data.openlinksw.com/oplweb/product_family/', 2);
DB.DBA.XML_SET_NS_DECL ('OplProductFormat', 'http://data.openlinksw.com/oplweb/product_format/', 2);
DB.DBA.XML_SET_NS_DECL ('OplProduct', 'http://data.openlinksw.com/oplweb/product/', 2);
DB.DBA.XML_SET_NS_DECL ('OplProductRelease', 'http://data.openlinksw.com/oplweb/product_release/', 2);

DB.DBA.XML_SET_NS_DECL ('ore', 'http://www.openarchives.org/ore/terms/', 2);

DB.DBA.RDF_AUDIT_METADATA (1, '*');


commit work;
-- Clear the 'cache' for immediate effects
select hs_local_iri, exec ('sparql clear graph <'||hs_local_iri||'>') 
  from sys_http_sponge
  where hs_local_iri like '%oplweb%';

select id_to_iri(G), exec ('sparql clear graph <'||id_to_iri(G)||'>')  
  from rdf_quad
  where id_to_iri(G) like '%oplweb%';

sparql clear graph <http://www.openlinksw.com/dataspace/organization/openlink/oplweb/>;
commit work;


sparql CONSTRUCT { <http://data.openlinksw.com/oplweb/product_family/uda#this> ?p ?o } 
  FROM <http://www.openlinksw.com/dataspace/organization/openlink/oplweb/> 
  WHERE { <http://data.openlinksw.com/oplweb/product_family/uda#this> ?p ?o }
;

sparql select * 
  FROM <http://www.openlinksw.com/dataspace/organization/openlink/oplweb/> 
  WHERE { <http://data.openlinksw.com/oplweb/product_category/odbc#this> ?p ?o }
  limit 100
;

sparql define get:soft "soft" select * 
  FROM <http://www.openlinksw.com/dataspace/organization/openlink/oplweb/> 
  WHERE { <http://data.openlinksw.com/oplweb/product_category/odbc#this> ?p ?o }
  limit 100
;

sparql CONSTRUCT { <http://data.openlinksw.com/oplweb/product_category/jdbc#this> ?p ?o } 
  FROM <http://www.openlinksw.com/dataspace/organization/openlink/oplweb/> 
  WHERE { <http://data.openlinksw.com/oplweb/product_category/jdbc#this> ?p ?o }
  limit 100
;

sparql CONSTRUCT { <http://data.openlinksw.com/oplweb/product_format/mt#this> ?p ?o } 
  FROM <http://www.openlinksw.com/dataspace/organization/openlink/oplweb/> 
  WHERE { <http://data.openlinksw.com/oplweb/product_format/mt#this> ?p ?o }
  limit 1
;


sparql select  ?p ?o  
  FROM <http://www.openlinksw.com/dataspace/organization/openlink/oplweb/> 
  WHERE { <http://data.openlinksw.com/oplweb/product_family/uda#this> ?p ?o }
  limit 1
;

sparql 
prefix opl: <http://www.openlinksw.com/schemas/oplweb#>
select  ?s ?o  
  FROM <http://www.openlinksw.com/dataspace/organization/openlink/oplweb/> 
  WHERE { ?s opl:hasProcessors ?o }
  limit 1
;

sparql 
prefix opl: <http://www.openlinksw.com/schemas/oplweb#>
select distinct ?o  
  FROM <http://www.openlinksw.com/dataspace/organization/openlink/oplweb/> 
  WHERE { <http://data.openlinksw.com/oplweb/processor/i686_1#this> opl:hasProductFamily ?o }
  limit 10
;

-- curl -H "Accept: application/rdf+xml" "http://data.openlinksw.com/oplweb/price_unit_type/6.1_odbc-sqlserver-st_1_2_1_db_sessions#this"
-- curl -H "Accept: application/rdf+xml" "http://data.openlinksw.com/oplweb/price_unit_type/6.1_odbc-sqlserver-st_1_2_1_cpu#this"

--select top 10 * from oplweb2.DBA.license_model_unit_type where product_release_id = '6.1' and product_id = 'odbc-sqlserver-st' 
--  and opsys_family_id = 1 and dbms_family_id = 15 and product_price_type_id = 1 and product_price_unit_type_id = 'cpu';

-- curl -H "Accept: application/rdf+xml" "http://data.openlinksw.com/rdfbrowser/index.html?uri=http%3A//data.openlinksw.com/oplweb/component_archive/6.1-odbc-oracle-st-i686-generic-win-32-ora10-odbclt-clnt-only_mv.msi"
-- curl -H "Accept: application/rdf+xml" "http://data.openlinksw.com/oplweb/product_family/uda"
-- curl -H "Accept: application/rdf+xml" "http://data.openlinksw.com/oplweb/product_category/odbc"
-- curl -H "Accept: application/rdf+xml" "http://data.openlinksw.com/oplweb/dbms_family/MySQL"
-- curl -H "Accept: application/rdf+xml" "http://data.openlinksw.com/oplweb/product_release/odbc-oracle-mt_6.1_i686-generic-win-32_ora9"
-- curl -H "Accept: application/rdf+xml" "http://data.openlinksw.com/oplweb/license_model/6.1_odbc-sqlserver-st_1_2_1"





curl -H "Accept: application/rdf+xml" "http://data.openlinksw.com/rdfbrowser/index.html?uri=http%3A//data.openlinksw.com/oplweb/component_archive/6.1-odbc-oracle-st-i686-generic-win-32-ora10-odbclt-clnt-only_mv.msi"
curl -H "Accept: application/rdf+xml" "http://data.openlinksw.com/oplweb/product_family/uda"
curl -H "Accept: application/rdf+xml" "http://data.openlinksw.com/oplweb/product_release/odbc-oracle-mt_6.1_i686-generic-win-32_ora9"
curl -H "Accept: application/rdf+xml" "http://data.openlinksw.com/oplweb/license_model/6.1_odbc-sqlserver-st_1_2_1"

--
-- XXX: note , the below would work only if www.openlinksw.com has the GRAPH <http://data.openlinksw.com/oplweb/>
-- if experimenting on other box, then www.openlinksw.com should be replaced with [URIQA] DefaultHost INI value
--



DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
    'oplweb2_rule2',
    1,
    '/oplweb(/[^#]*)',
    vector('path'),
    1,
    '/sparql?query=CONSTRUCT+{+%%3Chttp%%3A//data.openlinksw.com/oplweb%U%%23this%%3E+%%3Fp+%%3Fo+}+FROM+%%3Chttp%%3A//www.openlinksw.com/dataspace/organization/openlink/oplweb/%%3E+WHERE+{+%%3Chttp%%3A//data.openlinksw.com/oplweb%U%%23this%%3E+%%3Fp+%%3Fo+}&format=%U',
    vector('path', 'path', '*accept*'),
    null,
    '(text/rdf.n3)|(application/rdf.xml)',
    0,
    null
    );

DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
    'oplweb2_rule1',
    1,
    '(/oplweb/[^#]*)',
    vector('path'),
    1,
    '/rdfbrowser/index.html?uri=http%%3A//data.openlinksw.com%U%',
--    '/DAV/RDF/rdfqry.vsp?uri=http%%3A//data.openlinksw.com%U%%23this',
    vector('path'),
    null,
    '(text/html)|(\\*/\\*)',
    0,
    303
    );

DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
    'oplweb2_rule3',
    1,
    '(/[^#]*)/\x24',
    vector('path'),
    1,
    '%s',
    vector('path'),
    null,
    null,
    0,
    null
    );



create procedure DB.DBA.REDO_OPLWEB2_RDF_DET()
{
  declare colid int;
  colid := DAV_SEARCH_ID('/DAV/RDF/oplweb2/', 'C');
  if (colid < 0)
    return;
  update WS.WS.SYS_DAV_COL set COL_DET=null where COL_ID = colid;
}
;

DB.DBA.REDO_OPLWEB2_RDF_DET();

drop procedure DB.DBA.REDO_OPLWEB2_RDF_DET;

DB.DBA."RDFData_MAKE_DET_COL" ('/DAV/RDF/oplweb2/', 'http://data.openlinksw.com/oplweb', NULL);
VHOST_REMOVE (lpath=>'/oplweb/data/rdf');
DB.DBA.VHOST_DEFINE (lpath=>'/oplweb/data/rdf', ppath=>'/DAV/RDF/oplweb2/All/', is_dav=>1, vsp_user=>'dba');

-- procedure to convert path to DET resource name
create procedure DB.DBA.OPLWEB2_DET_REF (in par varchar, in fmt varchar, in val varchar)
{
  declare res, iri any;
  iri := 'http://data.openlinksw.com/oplweb' || val;
  res := sprintf ('iid (%d).rdf', iri_id_num (iri_to_id (iri)));
  return sprintf (fmt, res);
}
;

DB.DBA.URLREWRITE_CREATE_REGEX_RULE ('oplweb2_rdf', 1,
    '/oplweb/(.*)', vector('path'), 1, 
    '/oplweb/data/rdf/%U', vector('path'),
    'DB.DBA.OPLWEB2_DET_REF',
    'application/rdf.xml',
    2,  
    303);


DB.DBA.URLREWRITE_CREATE_RULELIST (
    'oplweb2_rule_list1',
    1,
    vector (
                'oplweb2_rule1',
                'oplweb2_rule2',
                'oplweb2_rule3',
                'oplweb2_rdf'
          ));


VHOST_REMOVE (vhost=>'data.openlinksw.com:80', lpath=>'/oplweb');
DB.DBA.VHOST_DEFINE (vhost=>'data.openlinksw.com:80', lpath=>'/oplweb', ppath=>'/DAV/RDF/oplweb2/', 
  vsp_user=>'dba', is_dav=>1, def_page=>'sfront.vspx', is_brws=>0, opts=>vector ('url_rewrite', 'oplweb2_rule_list1'));


/*

DB.DBA.VHOST_DEFINE (vhost=>'data.openlinksw.com:80', lhost=>':80', lpath=>'/rdf_net', ppath=>'/rdf_net');
DB.DBA.VHOST_DEFINE (vhost=>'data.openlinksw.com:80', lhost=>':80', lpath=>'/sparql/', 
  ppath => '/!sparql/', is_dav => 1, vsp_user => 'dba', opts => vector('noinherit', 1));

VHOST_REMOVE (vhost=>'data.openlinksw.com', lpath=>'/proxy');
DB.DBA.VHOST_DEFINE (vhost=>'data.openlinksw.com', lhost=>':80', lpath=>'/proxy', 
  ppath=>'/SOAP/Http/ext_http_proxy', soap_user=>'PROXY');

DB.DBA.VHOST_DEFINE (vhost=>'data.openlinksw.com:80', lhost=>':80', lpath=>'/xml_a', 
  ppath=>'/SOAP/',soap_user=>'XML_A');
DB.DBA.VHOST_DEFINE (vhost=>'data.openlinksw.com:80', lhost=>':80', lpath=>'/XMLA', 
  ppath=>'/SOAP/', soap_user=>'XMLA', soap_opts => vector ('ServiceName', 'XMLAnalysis', 'elementFormDefault', 'qualified'))

GRANT EXECUTE ON DB.DBA.RDF_SPONGE_UP TO "SPARQL", "SPARQL_UPDATE";
GRANT EXECUTE ON DB.DBA.TTLP_EV_NEW_GRAPH TO "SPARQL", "SPARQL_UPDATE";
grant SPARQL_UPDATE to "SPARQL";

curl -H "Accept: application/rdf+xml" "http://data.openlinksw.com/oplweb/product_family/uda#this"

select hs_local_iri, exec ('sparql clear graph <'||hs_local_iri||'>') from sys_http_sponge;

*/


OWL based Ontology


--sparql construct { ?x ?y ?z } from --<http://www.openlinksw.com/dataspace/organization/openlink#this> 
--	where { ?x ?y ?z }
	
DB.DBA.RDF_LOAD_RDFXML_MT (
'<?xml version="1.0"?>
<rdf:RDF
    xmlns="http://www.openlinksw.com/dataspace/organization/openlink/oplweb#"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
    xmlns:owl="http://www.w3.org/2002/07/owl#"
    xmlns:foaf="http://xmlns.com/foaf/0.1/"
    xmlns:virtrdf="http://www.openlinksw.com/schemas/virtrdf#"
    xml:base="http://www.openlinksw.com/schemas/oplweb#">
  <owl:Ontology rdf:about="http://www.openlinksw.com/schemas/oplweb#">
        <rdfs:label>ProductPortfolio</rdfs:label>
        <rdfs:comment>OpenLink Product Portfolio</rdfs:comment>
        <virtrdf:catName>oplweb</virtrdf:catName>
        <virtrdf:version>1.00</virtrdf:version>
  </owl:Ontology>
  
	<!-- Family / Category / Format -->
	
	<rdfs:Class rdf:ID="ProductFamily">
		<rdfs:label>Product Family</rdfs:label>
    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
			Product Family
		</rdfs:comment>
	</rdfs:Class>

	<rdfs:Class rdf:ID="ProductCategory">
		<rdfs:label>Product Category</rdfs:label>
    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
			Product Category
		</rdfs:comment>
    <rdfs:subPropertyOf rdf:resource="#ProductFamily"/>
	</rdfs:Class>

	<rdfs:Class rdf:ID="ProductFormat">
		<rdfs:label>Product Format</rdfs:label>
    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
			Product Format
		</rdfs:comment>
	</rdfs:Class>

	<rdfs:Class rdf:ID="ProductFormatCategory">
		<rdfs:label>Product Format Category</rdfs:label>
    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
			Product Format Category
		</rdfs:comment>
	</rdfs:Class>
	
	<rdf:Property rdf:ID="ProductFamilyDescription">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#ProductFamily"/>
    <rdfs:label>Product Family Description</rdfs:label>
  </rdf:Property>
  
	<rdf:Property rdf:ID="ProductFamilyLongDescription">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#ProductFamily"/>
    <rdfs:label>Product Family Long Description</rdfs:label>
  </rdf:Property>
	
	<rdf:Property rdf:ID="ProductFamilyCode">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#ProductFamily"/>
    <rdfs:label>Product Family Long Description</rdfs:label>
  </rdf:Property>
	
	<rdf:Property rdf:ID="ProductFormatDescription">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#ProductFormat"/>
    <rdfs:label>Product Format Description</rdfs:label>
  </rdf:Property>
  
	<rdf:Property rdf:ID="ProductFormatLongDescription">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#ProductFormat"/>
    <rdfs:label>Product Format Long Description</rdfs:label>
  </rdf:Property>
	
	<rdf:Property rdf:ID="ProductFormatCode">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#ProductFormat"/>
    <rdfs:domain rdf:resource="#ProductFormatCategory"/>
    <rdfs:label>Product Format Long Description</rdfs:label>
  </rdf:Property>
	
	<rdf:Property rdf:ID="ProductCategoryDescription">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#ProductCategory"/>
    <rdfs:label>Product Category Description</rdfs:label>
  </rdf:Property>
  
	<rdf:Property rdf:ID="ProductCategoryLongDescription">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#ProductCategory"/>
    <rdfs:label>Product Category Long Description</rdfs:label>
  </rdf:Property>
	
	<rdf:Property rdf:ID="ProductCategoryCode">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#ProductCategory"/>
    <rdfs:domain rdf:resource="#ProductFormatCategory"/>
    <rdfs:label>Product Category Long Description</rdfs:label>
  </rdf:Property>

  <rdf:Property rdf:ID="hasProduct">
    <rdfs:range rdf:resource="#Product"/>
    <rdfs:domain rdf:resource="#ProductCategory"/>
    <rdfs:domain rdf:resource="#ProductFormat"/>
    <rdfs:domain rdf:resource="#ProductFormatCategory"/>
    <rdfs:label>Product</rdfs:label>
  </rdf:Property>

  <rdf:Property rdf:ID="hasCategory">
    <rdfs:range rdf:resource="#ProductCategory"/>
    <rdfs:domain rdf:resource="#ProductFamily"/>
    <rdfs:domain rdf:resource="#Product"/>
    <rdfs:label>Product</rdfs:label>
  </rdf:Property>

  <rdf:Property rdf:ID="hasFormat">
    <rdfs:range rdf:resource="#ProductFormat"/>
    <rdfs:domain rdf:resource="#ProductFamily"/>
    <rdfs:domain rdf:resource="#ProductFormat"/>
    <rdfs:label>Product</rdfs:label>
  </rdf:Property>

	
	<!-- Vendor -->
	
	<rdfs:Class rdf:ID="VendorCategoryFamily">
		<rdfs:label>vendor_category_family</rdfs:label>
    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
			vendor_category_family
		</rdfs:comment>
	</rdfs:Class>
	
	<rdfs:Class rdf:ID="VendorCategory">
		<rdfs:label>vendor_category</rdfs:label>
    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
			vendor_category
		</rdfs:comment>
    <rdfs:subClassOf rdf:resource="VendorCategoryFamily"/>
	</rdfs:Class>
	
	<rdfs:Class rdf:ID="Vendors">
		<rdfs:label>vendors</rdfs:label>
    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
			vendors
		</rdfs:comment>
    <rdfs:subClassOf rdf:resource="VendorCategory"/>
	</rdfs:Class>
	
	<rdf:Property rdf:ID="VendorName">
    <rdfs:subPropertyOf rdf:resource="http://xmlns.com/foaf/0.1/name"/>
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#Vendors"/>
    <rdfs:label>vendor name</rdfs:label>
  </rdf:Property>
	
	<rdf:Property rdf:ID="VendorCategoryFamilyDescription">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#VendorCategoryFamily"/>
    <rdfs:label>vendor_category_family_description</rdfs:label>
  </rdf:Property>
	
	<rdf:Property rdf:ID="VendorCategoryDescription">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#VendorCategory"/>
    <rdfs:label>vendor_category_description</rdfs:label>
  </rdf:Property>

	<rdf:Property rdf:ID="isOfVendorCategory">
    <rdfs:range rdf:resource="#VendorCategory"/>
    <rdfs:domain rdf:resource="#Vendors"/>
    <rdfs:label>vendor_category_description</rdfs:label>
  </rdf:Property>
	
	<!-- Opsys / DBMS -->
	
	<rdfs:Class rdf:ID="OpsysFamily">
		<rdfs:label>Opsys Family</rdfs:label>
    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
			Opsys Family
		</rdfs:comment>
	</rdfs:Class>
	
	<rdfs:Class rdf:ID="DbmsFamily">
		<rdfs:label>Dbms Family</rdfs:label>
    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
			Dbms Family
		</rdfs:comment>
	</rdfs:Class>
		
	<rdfs:Class rdf:ID="DbmsEngine">
		<rdfs:label>Dbms Engine</rdfs:label>
    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
			Dbms Engine
		</rdfs:comment>
    <rdfs:subClassOf rdf:resource="DbmsFamily"/>
	</rdfs:Class>
	
	<rdfs:Class rdf:ID="OpsysType">
		<rdfs:label>Opsys Type</rdfs:label>
    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
			Opsys Type
		</rdfs:comment>
	</rdfs:Class>
	
	<rdfs:Class rdf:ID="ProcessorMode">
		<rdfs:label>Processor Mode</rdfs:label>
    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
			Processor Mode
		</rdfs:comment>
	</rdfs:Class>
	
	<rdfs:Class rdf:ID="Processor">
		<rdfs:label>Processor</rdfs:label>
    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
			Processor
		</rdfs:comment>
    <rdfs:subClassOf rdf:resource="ProcessorFamily"/>
	</rdfs:Class>
	
	<rdfs:Class rdf:ID="ProcessorFamily">
		<rdfs:label>Processor Family</rdfs:label>
    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
			Processor Family
		</rdfs:comment>
	</rdfs:Class>
	
	<rdfs:Class rdf:ID="Opsys">
		<rdfs:label>Dbms Engine</rdfs:label>
    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
			opsys
		</rdfs:comment>
    <rdfs:subClassOf rdf:resource="OpsysFamily"/>
    <rdfs:subClassOf rdf:resource="OpsysType"/>
	</rdfs:Class>
	
	<rdf:Property rdf:ID="OpsysFamilyName">
    <rdfs:subPropertyOf rdf:resource="http://xmlns.com/foaf/0.1/name"/>
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#OpsysFamily"/>
    <rdfs:label>Opsys Family Name</rdfs:label>
  </rdf:Property>

	<rdf:Property rdf:ID="OpsysFamilyRating">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#OpsysFamily"/>
    <rdfs:label>Opsys Family Rating</rdfs:label>
  </rdf:Property>
	
	<rdf:Property rdf:ID="OpsysFamilyLicenseCode">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#OpsysFamily"/>
    <rdfs:label>Opsys Family License Code</rdfs:label>
  </rdf:Property>
	
	<rdf:Property rdf:ID="OpsysFamilyVendor">
    <rdfs:range rdf:resource="#Vendors"/>
    <rdfs:domain rdf:resource="#OpsysFamily"/>
    <rdfs:label>Opsys Family Vendor</rdfs:label>
  </rdf:Property>
	
	<rdf:Property rdf:ID="DbmsFamilyName">
    <rdfs:subPropertyOf rdf:resource="http://xmlns.com/foaf/0.1/name"/>
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#DbmsFamily"/>
    <rdfs:label>DBMS Family Name</rdfs:label>
  </rdf:Property>
	
	<rdf:Property rdf:ID="DbmsFamilyVendor">
    <rdfs:range rdf:resource="#Vendors"/>
    <rdfs:domain rdf:resource="#DbmsFamily"/>
    <rdfs:label>DBMS Family Vendor</rdfs:label>
  </rdf:Property>
	
	<rdf:Property rdf:ID="DbmsName">
    <rdfs:subPropertyOf rdf:resource="http://xmlns.com/foaf/0.1/name"/>
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#DbmsEngine"/>
    <rdfs:label>DBMS Name</rdfs:label>
  </rdf:Property>
	
	<rdf:Property rdf:ID="DbmsVersion">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#DbmsEngine"/>
    <rdfs:label>DBMS Version</rdfs:label>
  </rdf:Property>

	<rdf:Property rdf:ID="DbmsEngineRating">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#DbmsEngine"/>
    <rdfs:label>DBMS Engine Rating</rdfs:label>
  </rdf:Property>

	<rdf:Property rdf:ID="DbmsEngineOldArchiveCode">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#DbmsEngine"/>
    <rdfs:label>DBMS Engine old Archive Code</rdfs:label>
  </rdf:Property>
	
	<rdf:Property rdf:ID="DbmsUpwardCompatible">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#DbmsEngine"/>
    <rdfs:label>DBMS Upward Compatible</rdfs:label>
  </rdf:Property>
	
	<rdf:Property rdf:ID="DbmsDownwardCompatible">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#DbmsEngine"/>
    <rdfs:label>DBMS Downward Compatible</rdfs:label>
  </rdf:Property>
	
	<rdf:Property rdf:ID="OpsysTypeDescription">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#OpsysType"/>
    <rdfs:label>Opsys Type Description</rdfs:label>
  </rdf:Property>

	<rdf:Property rdf:ID="OpsysTypeShortDescription">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#OpsysType"/>
    <rdfs:label>Opsys Type Short Description</rdfs:label>
  </rdf:Property>

	<rdf:Property rdf:ID="OpsysName">
    <rdfs:subPropertyOf rdf:resource="http://xmlns.com/foaf/0.1/name"/>
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#Opsys"/>
    <rdfs:label>Opsys Name</rdfs:label>
  </rdf:Property>
	
	<rdf:Property rdf:ID="OpsysVersion">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#Opsys"/>
    <rdfs:label>Opsys Version</rdfs:label>
  </rdf:Property>
	
	<rdf:Property rdf:ID="OpsysUpwardCompatible">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#Opsys"/>
    <rdfs:label>Opsys Compatible</rdfs:label>
  </rdf:Property>
	
	<rdf:Property rdf:ID="OpsysDownwardCompatible">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#Opsys"/>
    <rdfs:label>Opsys Downward Compatible</rdfs:label>
  </rdf:Property>
	
	<rdf:Property rdf:ID="OpsysLicenseCode">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#Opsys"/>
    <rdfs:label>Opsys License Code</rdfs:label>
  </rdf:Property>
	
	<rdf:Property rdf:ID="OpsysCommercialName">
    <rdfs:subPropertyOf rdf:resource="http://xmlns.com/foaf/0.1/name"/>
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#Opsys"/>
    <rdfs:label>Opsys Commercial Name</rdfs:label>
  </rdf:Property>
	
	<rdf:Property rdf:ID="OpsysProcessor">
    <rdfs:range rdf:resource="#Processor"/>
    <rdfs:domain rdf:resource="#Opsys"/>
    <rdfs:label>Opsys Processor</rdfs:label>
  </rdf:Property>
	
	<rdf:Property rdf:ID="OpsysEmulation">
    <rdfs:range rdf:resource="#ProcessorMode"/>
    <rdfs:domain rdf:resource="#Opsys"/>
    <rdfs:label>Opsys Emulation Mode</rdfs:label>
  </rdf:Property>
	
	<rdf:Property rdf:ID="ProcessorModeName">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#ProcessorMode"/>
    <rdfs:label>Processor Mode Name</rdfs:label>
  </rdf:Property>
	
	<rdf:Property rdf:ID="ProcessorName">
    <rdfs:subPropertyOf rdf:resource="http://xmlns.com/foaf/0.1/name"/>
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#Processor"/>
    <rdfs:label>Processor Name</rdfs:label>
  </rdf:Property>
	
	<rdf:Property rdf:ID="ProcessorProcessorMode">
    <rdfs:range rdf:resource="#ProcessorMode"/>
    <rdfs:domain rdf:resource="#Processor"/>
    <rdfs:label>Processor Mode</rdfs:label>
  </rdf:Property>
	
	<rdf:Property rdf:ID="ProcessorDescription">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#Processor"/>
    <rdfs:label>Processor Description</rdfs:label>
  </rdf:Property>
	
	<rdf:Property rdf:ID="ProcessorFamilyName">
    <rdfs:subPropertyOf rdf:resource="http://xmlns.com/foaf/0.1/name"/>
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#ProcessorFamily"/>
    <rdfs:label>Processor Family Name</rdfs:label>
  </rdf:Property>
	
	<rdf:Property rdf:ID="ProcessorFamilyDescription">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#ProcessorFamily"/>
    <rdfs:label>Processor Family Description</rdfs:label>
  </rdf:Property>
	
	<rdf:Property rdf:ID="ProcessorFamilyVendor">
    <rdfs:range rdf:resource="#Vendors"/>
    <rdfs:domain rdf:resource="#ProcessorFamily"/>
    <rdfs:label>Processor Family Vendor</rdfs:label>
  </rdf:Property>
	
	
	<!-- Product / Product Release -->
	
	<rdfs:Class rdf:ID="Product">
		<rdfs:label>Product</rdfs:label>
    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
			Product
		</rdfs:comment>
    <rdfs:subPropertyOf rdf:resource="#ProductFormat"/>
    <rdfs:subPropertyOf rdf:resource="#ProductCategory"/>
	</rdfs:Class>

	<rdfs:Class rdf:ID="ProductRelease">
		<rdfs:label>Product Release</rdfs:label>
    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
			Product Release
		</rdfs:comment>
    <rdfs:subClassOf rdf:resource="#Product"/>
	</rdfs:Class>

	<rdf:Property rdf:ID="ProductId">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#Product"/>
    <rdfs:label>Product ID</rdfs:label>
  </rdf:Property>
	
	<rdf:Property rdf:ID="isOfCategory">
    <rdfs:range rdf:resource="#ProductCategory"/>
    <rdfs:domain rdf:resource="#Product"/>
    <rdfs:label>Product Category</rdfs:label>
  </rdf:Property>

	<rdf:Property rdf:ID="isOfFormat">
    <rdfs:range rdf:resource="#ProductFormat"/>
    <rdfs:domain rdf:resource="#Product"/>
    <rdfs:label>Product Category</rdfs:label>
  </rdf:Property>

	<rdf:Property rdf:ID="ProductDescription">
    <rdfs:subPropertyOf rdf:resource="http://xmlns.com/foaf/0.1/name"/>
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#Product"/>
    <rdfs:label>Product Description</rdfs:label>
  </rdf:Property>
	
	<rdf:Property rdf:ID="ProductLongDescription">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#Product"/>
    <rdfs:label>Product Long Description</rdfs:label>
  </rdf:Property>

	<rdf:Property rdf:ID="ProductReleaseId">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#ProductRelease"/>
    <rdfs:label>Product Release ID</rdfs:label>
  </rdf:Property>
	
	<rdf:Property rdf:ID="ProductReleaseOpsys">
    <rdfs:range rdf:resource="#Opsys"/>
    <rdfs:domain rdf:resource="#ProductRelease"/>
    <rdfs:label>Product Release Opsys</rdfs:label>
  </rdf:Property>
	
	<rdf:Property rdf:ID="ProductReleaseDbms">
    <rdfs:range rdf:resource="#DbmsEngine"/>
    <rdfs:domain rdf:resource="#ProductRelease"/>
    <rdfs:label>Product Release DBMS</rdfs:label>
  </rdf:Property>
	
	<rdf:Property rdf:ID="ProductReleaseUpwardCompatible">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#ProductRelease"/>
    <rdfs:label>Product Release upward compatible</rdfs:label>
  </rdf:Property>
	
	<rdf:Property rdf:ID="ProductReleaseDownwardCompatible">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#ProductRelease"/>
    <rdfs:label>Product Release downward compatible</rdfs:label>
  </rdf:Property>

	<rdf:Property rdf:ID="ProductReleaseSupported">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#ProductRelease"/>
    <rdfs:label>Product Release Supported</rdfs:label>
  </rdf:Property>

	<!-- Components -->
	
	<rdfs:Class rdf:ID="Component">
		<rdfs:label>Components</rdfs:label>
    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
			Components
		</rdfs:comment>
	</rdfs:Class>

	<rdfs:Class rdf:ID="ComponentMode">
		<rdfs:label>Component Mode</rdfs:label>
    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
			Component
		</rdfs:comment>
	</rdfs:Class>

	<rdfs:Class rdf:ID="ComponentType">
		<rdfs:label>Component</rdfs:label>
    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
			Component Type
		</rdfs:comment>
	</rdfs:Class>

	<rdfs:Class rdf:ID="ComponentCategory">
		<rdfs:label>Component Category</rdfs:label>
    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
			Component
		</rdfs:comment>
	</rdfs:Class>

	<rdf:Property rdf:ID="ComponentModeDescription">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#ComponentMode"/>
    <rdfs:label>Component Mode Description</rdfs:label>
  </rdf:Property>

	<rdf:Property rdf:ID="ComponentModeShortDescription">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#ComponentMode"/>
    <rdfs:label>Component Mode Short Description</rdfs:label>
  </rdf:Property>

	<rdf:Property rdf:ID="ComponentTypeDescription">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#ComponentType"/>
    <rdfs:label>Component Type Description</rdfs:label>
  </rdf:Property>

	<rdf:Property rdf:ID="ComponentTypeShortDescription">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#ComponentType"/>
    <rdfs:label>Component Type Short Description</rdfs:label>
  </rdf:Property>

	<rdf:Property rdf:ID="ComponentCategoryDescription">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#ComponentCategory"/>
    <rdfs:label>Component Category Description</rdfs:label>
  </rdf:Property>

	<rdf:Property rdf:ID="ComponentCategoryLongDescription">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#ComponentCategory"/>
    <rdfs:label>Component Category Long Description</rdfs:label>
  </rdf:Property>

  <rdf:Property rdf:ID="ComponentCategoryShortDescription">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#ComponentCategory"/>
    <rdfs:label>Component Category Short Description</rdfs:label>
  </rdf:Property>

  <rdf:Property rdf:ID="ComponentName">
    <rdfs:subPropertyOf rdf:resource="http://xmlns.com/foaf/0.1/name"/>
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#Component"/>
    <rdfs:label>Components Name</rdfs:label>
  </rdf:Property>

  <rdf:Property rdf:ID="ComponentCvsid">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#Component"/>
    <rdfs:label>Components CVSID</rdfs:label>
  </rdf:Property>
  
  <rdf:Property rdf:ID="ComponentBuildDate">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#Component"/>
    <rdfs:label>Components Build Date</rdfs:label>
  </rdf:Property>
  
  <rdf:Property rdf:ID="Notes">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#Component"/>
    <rdfs:label>Components Notes</rdfs:label>
  </rdf:Property>
  
  <rdf:Property rdf:ID="BuildComments">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#Component"/>
    <rdfs:label>Components Build Comments</rdfs:label>
  </rdf:Property>
  
  <rdf:Property rdf:ID="Filesize">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#Component"/>
    <rdfs:label>Components Name</rdfs:label>
  </rdf:Property>
    
	<rdf:Property rdf:ID="ComponentComponentCategory">
    <rdfs:range rdf:resource="#ComponentCategory"/>
    <rdfs:domain rdf:resource="#Component"/>
    <rdfs:label>Components Component Category</rdfs:label>
  </rdf:Property>

  <rdf:Property rdf:ID="ComponentComponentType">
    <rdfs:range rdf:resource="#ComponentType"/>
    <rdfs:domain rdf:resource="#Component"/>
    <rdfs:label>Components Component Type</rdfs:label>
  </rdf:Property>

  <rdf:Property rdf:ID="ComponentComponentMode">
    <rdfs:range rdf:resource="#ComponentMode"/>
    <rdfs:domain rdf:resource="#Component"/>
    <rdfs:label>Components Component Mode</rdfs:label>
  </rdf:Property>

  <rdf:Property rdf:ID="ComponentOpsys">
    <rdfs:range rdf:resource="#Opsys"/>
    <rdfs:domain rdf:resource="#Component"/>
    <rdfs:label>Components Opsys</rdfs:label>
  </rdf:Property>

  <rdf:Property rdf:ID="ComponentDbmsEngine">
    <rdfs:range rdf:resource="#DbmsEngine"/>
    <rdfs:domain rdf:resource="#Component"/>
    <rdfs:label>Components DBMS</rdfs:label>
  </rdf:Property>

	<!-- Component Archives -->
	
	<rdfs:Class rdf:ID="ComponentArchive">
		<rdfs:label>Component Archive</rdfs:label>
    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
			Component Archives
		</rdfs:comment>
    <rdfs:subClassOf rdf:resource="#ProductRelease"/>
    <rdfs:subClassOf rdf:resource="#Component"/>
	</rdfs:Class>
	
	<rdfs:Class rdf:ID="ComponentArchiveType">
		<rdfs:label>Component Archive Type</rdfs:label>
    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
			Component Archives Type
		</rdfs:comment>
	</rdfs:Class>
	
  <rdf:Property rdf:ID="ComponentArchiveTypeName">
    <rdfs:subPropertyOf rdf:resource="http://xmlns.com/foaf/0.1/name"/>
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#ComponentArchiveType"/>
    <rdfs:label>Component Archive Type Name</rdfs:label>
  </rdf:Property>
    	
  <rdf:Property rdf:ID="ComponentArchiveTypeShortName">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#ComponentArchiveType"/>
    <rdfs:label>Component Archive Type Name</rdfs:label>
  </rdf:Property>
    
  <rdf:Property rdf:ID="ComponentArchiveTypeExtension">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#ComponentArchiveType"/>
    <rdfs:label>Component Archive Type Extension</rdfs:label>
  </rdf:Property>
    
	<rdf:Property rdf:ID="ComponentArchiveComponentArchiveType">
    <rdfs:range rdf:resource="#ComponentArchiveType"/>
    <rdfs:domain rdf:resource="#ComponentArchive"/>
    <rdfs:label>Component Archive Component Archive Type</rdfs:label>
  </rdf:Property>

  <rdf:Property rdf:ID="ComponentArchiveName">
    <rdfs:subPropertyOf rdf:resource="http://xmlns.com/foaf/0.1/name"/>
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#ComponentArchive"/>
    <rdfs:label>Component Archive Name</rdfs:label>
  </rdf:Property>
    
  <rdf:Property rdf:ID="ComponentArchiveAssemblyDate">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#ComponentArchive"/>
    <rdfs:label>Component Archive Assembly Date</rdfs:label>
  </rdf:Property>
    
  <rdf:Property rdf:ID="ComponentArchiveFileUri">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#ComponentArchive"/>
    <rdfs:label>Component Archive File URI</rdfs:label>
  </rdf:Property>
    
  <rdf:Property rdf:ID="ComponentArchiveLicenseCode">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#ComponentArchive"/>
    <rdfs:label>Component Archive License Code</rdfs:label>
  </rdf:Property>
    
  <rdf:Property rdf:ID="ComponentArchiveResName">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#ComponentArchive"/>
    <rdfs:label>Component Archive DAV Resource Name</rdfs:label>
  </rdf:Property>
    
  <rdf:Property rdf:ID="ComponentArchiveResFullPath">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#ComponentArchive"/>
    <rdfs:label>Component Archive DAV Full Path</rdfs:label>
  </rdf:Property>
    
  <rdf:Property rdf:ID="ComponentArchiveResFileSize">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#ComponentArchive"/>
    <rdfs:label>Component Archive File Size in DAV</rdfs:label>
  </rdf:Property>
	
	<!-- Download locations -->
	
	<rdfs:Class rdf:ID="DownloadLocation">
		<rdfs:label>Download Location</rdfs:label>
    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
			Download Location
		</rdfs:comment>
    <rdfs:subClassOf rdf:resource="#ComponentArchive"/>
    <rdfs:subClassOf rdf:resource="#DownloadPartner"/>
    <rdfs:subClassOf rdf:resource="#DownloadProtocol"/>
	</rdfs:Class>
	
	<rdfs:Class rdf:ID="DownloadProtocol">
		<rdfs:label>Download Protocol</rdfs:label>
    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
			Download Protocol
		</rdfs:comment>
	</rdfs:Class>
	
	<rdfs:Class rdf:ID="DownloadPartner">
		<rdfs:label>Download Partner</rdfs:label>
    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
			Download Partner
		</rdfs:comment>
	</rdfs:Class>
		
  <rdf:Property rdf:ID="ProtocolName">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#DownloadProtocol"/>
    <rdfs:label>Protocol Name</rdfs:label>
  </rdf:Property>
	
  <rdf:Property rdf:ID="ProtocolDescription">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#DownloadProtocol"/>
    <rdfs:label>Protocol Description</rdfs:label>
  </rdf:Property>
	
  <rdf:Property rdf:ID="ProtocolActive">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#DownloadProtocol"/>
    <rdfs:label>Protocol Active</rdfs:label>
  </rdf:Property>
	
  <rdf:Property rdf:ID="PartnerName">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#DownloadPartner"/>
    <rdfs:label>Download Partner Partner Name</rdfs:label>
  </rdf:Property>
	
  <rdf:Property rdf:ID="HostName">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#DownloadPartner"/>
    <rdfs:label>Download Partner Hostname</rdfs:label>
  </rdf:Property>
	
  <rdf:Property rdf:ID="DomainName">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#DownloadPartner"/>
    <rdfs:label>Download Partner Domain Name</rdfs:label>
  </rdf:Property>
	
  <rdf:Property rdf:ID="PortNumber">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#DownloadPartner"/>
    <rdfs:label>Download Partner Port Number</rdfs:label>
  </rdf:Property>
		
  <rdf:Property rdf:ID="Uri">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#DownloadLocation"/>
    <rdfs:label>Download Location URI</rdfs:label>
  </rdf:Property>
	
  <rdf:Property rdf:ID="UriOld">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#DownloadLocation"/>
    <rdfs:label>Download Location URI Old</rdfs:label>
  </rdf:Property>
	
	<!-- Features and Benefits -->
	
	<rdfs:Class rdf:ID="ProductBenefit">
		<rdfs:label>Product Benefit</rdfs:label>
    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
			Product Benefit
		</rdfs:comment>
    <rdfs:subClassOf rdf:resource="#ProductBenefitCategory"/>
	</rdfs:Class>
	
	<rdfs:Class rdf:ID="ProductBenefitCategory">
		<rdfs:label>Product Benefit</rdfs:label>
    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
			Product Benefit
		</rdfs:comment>
	</rdfs:Class>
	
	<rdfs:Class rdf:ID="ProductFeatureCategory">
		<rdfs:label>Product Feature Category</rdfs:label>
    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
			Product Feature Category
		</rdfs:comment>
	</rdfs:Class>
  	
	<rdfs:Class rdf:ID="ProductFeature">
		<rdfs:label>Product Features</rdfs:label>
    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
			Product Features
		</rdfs:comment>
    <rdfs:subClassOf rdf:resource="#ProductFeatureCategory"/>
    <rdfs:subClassOf rdf:resource="#ProductBenefit"/>
    <rdfs:subClassOf rdf:resource="#Product"/>
	</rdfs:Class>
    
	<rdfs:Class rdf:ID="ProductFamilyFeature">
		<rdfs:label>Product Family Features</rdfs:label>
    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
			Product Family Features
		</rdfs:comment>
    <rdfs:subClassOf rdf:resource="#ProductFeatureCategory"/>
    <rdfs:subClassOf rdf:resource="#ProductBenefit"/>
    <rdfs:subClassOf rdf:resource="#ProductFamily"/>
	</rdfs:Class>
	
	<rdfs:Class rdf:ID="ProductFormatFeature">
		<rdfs:label>Product Format Features</rdfs:label>
    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
			Product Format Features
		</rdfs:comment>
    <rdfs:subClassOf rdf:resource="#ProductFeatureCategory"/>
    <rdfs:subClassOf rdf:resource="#ProductBenefit"/>
    <rdfs:subClassOf rdf:resource="#ProductFormat"/>
	</rdfs:Class>
	
	<rdfs:Class rdf:ID="ProductCategoryFeature">
		<rdfs:label>Product Category Features</rdfs:label>
    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
			Product Category Features
		</rdfs:comment>
    <rdfs:subClassOf rdf:resource="#ProductFeatureCategory"/>
    <rdfs:subClassOf rdf:resource="#ProductBenefit"/>
    <rdfs:subClassOf rdf:resource="#ProductCategory"/>
	</rdfs:Class>

	<rdfs:Class rdf:ID="ProductReleaseFeature">
		<rdfs:label>Product Benefit</rdfs:label>
    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
			Product Benefit
		</rdfs:comment>
    <rdfs:subClassOf rdf:resource="#ProductFeatureCategory"/>
    <rdfs:subClassOf rdf:resource="#ProductBenefit"/>
    <rdfs:subClassOf rdf:resource="#ProductRelease"/>
	</rdfs:Class>

  <rdf:Property rdf:ID="ProductBenefitsCategoryDescription">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#ProductBenefitsCategory"/>
    <rdfs:label>product Benefits Category</rdfs:label>
  </rdf:Property>

  <rdf:Property rdf:ID="Description">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#ProductBenefit"/>
    <rdfs:domain rdf:resource="#ProductBenefitCategory"/>
    <rdfs:domain rdf:resource="#ProductFeatureCategory"/>
    <rdfs:domain rdf:resource="#ProductFeature"/>
    <rdfs:domain rdf:resource="#ProductFamilyFeature"/>
    <rdfs:domain rdf:resource="#ProductFormatFeature"/>
    <rdfs:domain rdf:resource="#ProductCategoryFeature"/>
    <rdfs:domain rdf:resource="#ProductReleaseFeature"/>
    <rdfs:label>Product Benefits Description</rdfs:label>
  </rdf:Property>

  <rdf:Property rdf:ID="Details">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#ProductFeature"/>
    <rdfs:domain rdf:resource="#ProductFamilyFeature"/>
    <rdfs:domain rdf:resource="#ProductFormatFeature"/>
    <rdfs:domain rdf:resource="#ProductCategoryFeature"/>
    <rdfs:domain rdf:resource="#ProductReleaseFeature"/>
    <rdfs:label>Product Benefits Description Details</rdfs:label>
  </rdf:Property>

  <rdf:Property rdf:ID="ProductBenefitsAcronym">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#ProductBenefit"/>
    <rdfs:label>Product Benefits Acronym</rdfs:label>
  </rdf:Property>

  <rdf:Property rdf:ID="ProductBenefitsExplanation">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#ProductBenefit"/>
    <rdfs:label>Product Benefits Explanation</rdfs:label>
  </rdf:Property>

  <rdf:Property rdf:ID="DemoUrl">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#ProductCategoryFeature"/>
    <rdfs:domain rdf:resource="#ProductFormatFeature"/>
    <rdfs:domain rdf:resource="#ProductFamilyFeature"/>
    <rdfs:domain rdf:resource="#ProductReleaseFeature"/>
    <rdfs:label>The Features Demo URL</rdfs:label>
  </rdf:Property>

  <rdf:Property rdf:ID="HypesPerSecond">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#integer"/>
    <rdfs:domain rdf:resource="#ProductCategoryFeature"/>
    <rdfs:domain rdf:resource="#ProductFormatFeature"/>
    <rdfs:domain rdf:resource="#ProductFamilyFeature"/>
    <rdfs:domain rdf:resource="#ProductreleaseFeature"/>
    <rdfs:label>The Features Number of Hypes per second</rdfs:label>
  </rdf:Property>

  <rdf:Property rdf:ID="Implemented">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#ProductCategoryFeature"/>
    <rdfs:domain rdf:resource="#ProductFormatFeature"/>
    <rdfs:domain rdf:resource="#ProductFamilyFeature"/>
    <rdfs:domain rdf:resource="#ProductReleaseFeature"/>
    <rdfs:label>The Features Short Description</rdfs:label>
  </rdf:Property>

<!-- shop / pricing stuff -->

	<rdfs:Class rdf:ID="LicenseType">
		<rdfs:label>License Type</rdfs:label>
    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
			License Type
		</rdfs:comment>
	</rdfs:Class>

	<rdfs:Class rdf:ID="UnitType">
		<rdfs:label>Unit Type</rdfs:label>
    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
			Unit Type
		</rdfs:comment>
	</rdfs:Class>

	<rdfs:Class rdf:ID="GeneralDiscount">
		<rdfs:label>General Discount</rdfs:label>
    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
			General Discount
		</rdfs:comment>
	</rdfs:Class>

	<rdfs:Class rdf:ID="IncrementalDiscount">
		<rdfs:label>Incremental Discount</rdfs:label>
    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
			Incremental Discount
		</rdfs:comment>
	</rdfs:Class>

	<rdfs:Class rdf:ID="License">
		<rdfs:label>License</rdfs:label>
    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
			License
		</rdfs:comment>
    <rdfs:subClassOf rdf:resource="#LicenseType"/>
    <rdfs:subClassOf rdf:resource="#ProductRelease"/>
	</rdfs:Class>

  <rdf:Property rdf:ID="BaseCostUnit">
    <rdfs:range rdf:resource="#UnitType"/>
    <rdfs:domain rdf:resource="#License"/>
    <rdfs:label>Base Unit Cost</rdfs:label>
  </rdf:Property>

  <rdf:Property rdf:ID="PriceUnit">
    <rdfs:range rdf:resource="#UnitType"/>
    <rdfs:domain rdf:resource="#License"/>
    <rdfs:label>Price Unit Cost</rdfs:label>
  </rdf:Property>

  <rdf:Property rdf:ID="hasDiscount">
    <rdfs:range rdf:resource="#IncrementalDiscount"/>
    <rdfs:domain rdf:resource="#UnitType"/>
    <rdfs:label>Base Unit Cost</rdfs:label>
  </rdf:Property>

  <rdf:Property rdf:ID="hasGeneralDiscount">
    <rdfs:range rdf:resource="#GeneralDiscount"/>
    <rdfs:domain rdf:resource="#License"/>
    <rdfs:label>General Discount</rdfs:label>
  </rdf:Property>

  <rdf:Property rdf:ID="unitValue">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#UnitType"/>
    <rdfs:label>Unit Value</rdfs:label>
  </rdf:Property>

  <rdf:Property rdf:ID="graceUnit">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#UnitType"/>
    <rdfs:label>Grace Unit</rdfs:label>
  </rdf:Property>

  <rdf:Property rdf:ID="minUnits">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#UnitType"/>
    <rdfs:label>Minimum Units</rdfs:label>
  </rdf:Property>

  <rdf:Property rdf:ID="maxUnits">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#UnitType"/>
    <rdfs:label>Maximum Units</rdfs:label>
  </rdf:Property>

  <rdf:Property rdf:ID="codeWord">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#GeneralDiscount"/>
    <rdfs:label>Code Word needed to activate this discount</rdfs:label>
  </rdf:Property>

  <rdf:Property rdf:ID="startDate">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#GeneralDiscount"/>
    <rdfs:label>Discount Start Date</rdfs:label>
  </rdf:Property>

  <rdf:Property rdf:ID="endDate">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#GeneralDiscount"/>
    <rdfs:label>Discount End Date</rdfs:label>
  </rdf:Property>

  <rdf:Property rdf:ID="percentageOfCost">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#GeneralDiscount"/>
    <rdfs:label>Percentage of cost attributing as discount</rdfs:label>
  </rdf:Property>

  <rdf:Property rdf:ID="triggerPoint">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#IncrementalDiscount"/>
    <rdfs:label>Discount Trigger Point</rdfs:label>
  </rdf:Property>

  <rdf:Property rdf:ID="percentageOfBase">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#IncrementalDiscount"/>
    <rdfs:label>Percentage of base cost attributing as discount</rdfs:label>
  </rdf:Property>

<!-- common properties -->

  <rdf:Property rdf:ID="label">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:subPropertyOf rdf:resource="http://www.w3.org/2001/XMLSchema#label"/>
    <rdfs:domain rdf:resource="#ProductCategory"/>
    <rdfs:domain rdf:resource="#ProductFormat"/>
    <rdfs:domain rdf:resource="#ProductFamily"/>
    <rdfs:domain rdf:resource="#ProductRelease"/>
    <rdfs:domain rdf:resource="#VendorCategory"/>
    <rdfs:domain rdf:resource="#Vendor"/>
    <rdfs:domain rdf:resource="#OpsysFamily"/>
    <rdfs:domain rdf:resource="#DbmsFamily"/>
    <rdfs:domain rdf:resource="#DbmsEngine"/>
    <rdfs:domain rdf:resource="#OpsysType"/>
    <rdfs:domain rdf:resource="#Processor"/>
    <rdfs:domain rdf:resource="#ProcessorFamily"/>
    <rdfs:domain rdf:resource="#Opsys"/>
    <rdfs:domain rdf:resource="#Product"/>
    <rdfs:domain rdf:resource="#ComponentMode"/>
    <rdfs:domain rdf:resource="#ComponentType"/>
    <rdfs:domain rdf:resource="#ComponentCategory"/>
    <rdfs:domain rdf:resource="#ComponentArchive"/>
    <rdfs:domain rdf:resource="#ComponentArchiveType"/>
    <rdfs:domain rdf:resource="#DownloadLocation"/>
    <rdfs:domain rdf:resource="#ProductBenefit"/>
    <rdfs:domain rdf:resource="#ProductBenefitCategory"/>
    <rdfs:domain rdf:resource="#ProductFeatureCategory"/>
    <rdfs:domain rdf:resource="#ProductFeature"/>
    <rdfs:domain rdf:resource="#ProductFamilyFeature"/>
    <rdfs:domain rdf:resource="#ProductFormatFeature"/>
    <rdfs:domain rdf:resource="#ProductCategoryFeature"/>
    <rdfs:domain rdf:resource="#ProductReleaseFeature"/>
    <rdfs:domain rdf:resource="#LicenseModel"/>
    <rdfs:domain rdf:resource="#Discount"/>
    <rdfs:domain rdf:resource="#PriceType"/>
    <rdfs:domain rdf:resource="#PriceUnitType"/>
    <rdfs:label>Label</rdfs:label>
  </rdf:Property>

  <rdf:Property rdf:ID="name">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:subPropertyOf rdf:resource="http://xmlns.com/foaf/0.1/name"/>
    <rdfs:domain rdf:resource="#ProductCategory"/>
    <rdfs:domain rdf:resource="#ProductFormat"/>
    <rdfs:domain rdf:resource="#ProductFamily"/>
    <rdfs:domain rdf:resource="#ProductRelease"/>
    <rdfs:label>Name</rdfs:label>
  </rdf:Property>

  <rdf:Property rdf:ID="logo">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:subPropertyOf rdf:resource="http://xmlns.com/foaf/0.1/logo"/>
    <rdfs:domain rdf:resource="#ProductFamily"/>
    <rdfs:label>logo</rdfs:label>
  </rdf:Property>

  <rdf:Property rdf:ID="homepage">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:subPropertyOf rdf:resource="http://xmlns.com/foaf/0.1/homepage"/>
    <rdfs:domain rdf:resource="#ProductFamily"/>
    <rdfs:domain rdf:resource="#ProcessorFamily"/>
    <rdfs:domain rdf:resource="#OpsysFamily"/>
    <rdfs:domain rdf:resource="#DbmsFamily"/>
    <rdfs:label>homepage</rdfs:label>
  </rdf:Property>

  <rdf:Property rdf:ID="maker">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:subPropertyOf rdf:resource="http://xmlns.com/foaf/0.1/maker"/>
    <rdfs:domain rdf:resource="#ProductCategory"/>
    <rdfs:domain rdf:resource="#ProductFormat"/>
    <rdfs:domain rdf:resource="#ProductFamily"/>
    <rdfs:domain rdf:resource="#ProductRelease"/>
    <rdfs:label>Maker</rdfs:label>
  </rdf:Property>

  <rdf:Property rdf:ID="sameAs">
    <rdfs:range rdf:resource="owl#sameAs"/>
    <rdfs:domain rdf:resource="#ProductCategory"/>
    <rdfs:domain rdf:resource="#ProductFormat"/>
    <rdfs:domain rdf:resource="#ProductFamily"/>
    <rdfs:domain rdf:resource="#ProductRelease"/>
    <rdfs:domain rdf:resource="#ProductFormatCategory"/>
    <rdfs:label>Name</rdfs:label>
  </rdf:Property>

</rdf:RDF>

', 
'http://www.openlinksw.com/schemas/oplweb#', 
'http://www.openlinksw.com/schemas/oplweb#')		
--'http://www.openlinksw.com/dataspace/organization/openlink/ProductPortfolioOntology/1.0/')
;

rdfs_rule_set ('oplweb2_owlset', 'http://www.openlinksw.com/schemas/oplweb#', 1);

DB.DBA.XML_SET_NS_DECL ('opl', 'http://www.openlinksw.com/schemas/oplweb#', 2);