You are here:
/ Dashboard / Main / VirtRDFViews / VirtRDFViewOplweb2Schema

RDF View


-- Setup script for RDF view 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";
  


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:DbmsFamily .
drop iri class opl:DbmsEngine .
drop iri class opl:DownloadLocation .
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: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:ProductRelease .
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: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 literal class opl:lit_homepage .
drop literal class opl:lit_opsys_icon .
drop literal 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 .
;

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 .

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 .

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 .
				
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 .

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 .

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 .

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 .

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 .

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 .

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 .

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 .

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 .

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 .

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 .

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 .

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 .

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 .

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 .

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 .

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 .

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 .

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 .


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 .

create iri class opl:PriceUnitType "http://data.openlinksw.com/oplweb/price_unit_type/%s#this"
    (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 literal class opl:lit_product_release_label using 
	function oplweb2.oplweb.LIT_PRODUCT_RELEASE_LABEL(
		in _product_id varchar, in _id integer, 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 literal class opl:lit_openlink_logo using 
  function oplweb2.oplweb.LITRDF_openlink_logo(
    in _code varchar
  )
  returns varchar .	

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

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

create literal 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 .

;



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


sparql
prefix opl: <http://www.openlinksw.com/schemas/oplweb#>
prefix dc: <http://purl.org/metadata/dublin_core#>
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#>

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_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
    where (
      ^{product_release_tbl.}^.supported = 'Y'
      )
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.oplweb.product_price_unit_type as put
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/>
	  option (exclusive)
	{
  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: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 ;
	  opl:ProductFamilyLongDescription product_family_tbl.long_description
	    as virtrdf:OplProductFamilyLongDescription .
	    	  
	  opl:ProductCategory(product_category_with_code.product_cat_code) 
	    a opl:ProductCategory
	    as virtrdf:OplProductCategory ;
	  rdfs:label product_category_with_code.product_category_description
	    as virtrdf:rdfsOplProductCategoryDescription ;
	  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 ;
	  opl:ProductCategoryLongDescription product_category_with_code.long_description
	    as virtrdf:OplProductCategoryLongDescription .
	
	  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 ;
	  opl:ProductFormatDescription product_format_with_code.product_format_description
	    as virtrdf:OplProductFormatDescription .
	
	  opl:ProductFormatCategory(product_formats_categories.product_format_code, product_formats_categories.product_cat_code) 
	    a opl:ProductFormatCategory
	    as virtrdf:OplProductFormatCategory ;
	  opl:ProductFormatCode product_formats_categories.product_format_code
	    as virtrdf:OplProductFormatCategoryFormatCode ;
	  opl:ProductCategoryCode product_formats_categories.product_cat_code
	    as virtrdf:OplProductFormatCategoryCategoryCode ;
	  rdfs:label opl:lit_format_cat_label(product_formats_categories.product_format_id, product_formats_categories.product_cat_id)
	    as virtrdf:rdfsOplProductFormatCategoryDescription .
	
	
	  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: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 ;
	  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 .
	  
	  opl:Vendor(vendors_tbl.vendor_id)
	    a opl:Vendor
	    as virtrdf:OplVendor ;
	  rdfs:label vendors_tbl.vendor_name 
	    as virtrdf:rdfsOplVendorsName ;
	  opl:VendorName vendors_tbl.vendor_name 
	    as virtrdf:OplVendorsName ;
	  opl:WikipediaUrl vendors_tbl.wikipedia_url 
	    as virtrdf:OplVendorsWikipediaUrl ;
	  foaf:homepage vendors_tbl.vendor_homepage
	    as virtrdf:OplFoafVendorHomepage ;
	  opl:isOfVendorCategory opl:VendorCategory(vendors_tbl.vendor_category_id)
	    as virtrdf:OplVendorIsOfVendorCategory .
	  
	  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 opsys_family_tbl.wikipedia_url
	  as virtrdf:FoafHomepageOpsysFamilyWikipediaUrl ;
	opl:WikipediaUrl opsys_family_tbl.wikipedia_url
	  as virtrdf:OplOpsysFamilyWikipediaUrl .
  	
	  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 dbms_family_tbl.wikipedia_url
 	  as virtrdf:FoafHomepageDbmsFamilyWikipediaUrl ;
	opl:WikipediaUrl dbms_family_tbl.wikipedia_url
	  as virtrdf:OplDbmsFamilyWikipediaUrl ;
	  opl:DbmsFamilyRating dbms_family_tbl.rating
  	  as virtrdf:OplDbmsFamilyRating .
  	
	  opl:DbmsEngine(dbms_engine_tbl.dbms_name)
  	  a opl:DbmsEngine
	    as virtrdf:OplDbmsEngine ;
	  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 .
  	
	  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 .
  	
	  
	  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 .
  	
	  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 processor_family_tbl.wikipedia_url
	 	  as virtrdf:FoafHomepageProcessorFamilyWikipediaUrl ;
		opl:WikipediaUrl 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 .
  	  	
	  opl:Opsys(opsys_tbl.opsys_name)
  	  a opl:Opsys
	    as virtrdf:OplOpsys ;
	  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 .
  	
	
	  opl:Product(product_with_code.product_id) 
	    a opl:Product
	    as virtrdf:OplProduct ;
	  rdfs:label product_with_code.poduct_description
	    as virtrdf:rdfsOplProductDescription ;
	  opl:ProductDescription product_with_code.poduct_description
	    as virtrdf:OplProductDescription ;
	  opl:ProductLongDescription 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 .
	
	
	  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 ;
	  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 ;
  	  opl:Supported product_release_tbl.supported
	    as virtrdf:OplProductReleaseSupported .
	    		    
	  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 .  

    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 .
	    
	  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 .
	    
	  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 ;
	  opl:ComponentCategoryLongDescription component_category_tbl.component_category_long_description 
	    as virtrdf:OplComponentCategoryLongDescription .
	    
	  opl:ComponentArchive(component_archive_tbl.component_archive_name)
	    a opl:ComponentArchive
	    as virtrdf:OplComponentArchive ;
	  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 .

	  
	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 .
	  

	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 .

	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 .
	  
    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 .

	  	
#
# 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 .
	  
	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 .
	  
	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 .
	  
	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 ;
	opl:Details 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 .

    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 ;
	opl:Details 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 .

    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 ;
	opl:Details 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 .

    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 ;
	opl:Details 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 .
	  
    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 ;
	opl:Details 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 .
	 
#
# 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;
	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
	.


	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_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) 
	opl:hasBasePriceUnitType
	opl:PriceUnitType(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;
	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
	.

	  
	

	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;
	opl:PriceTypeLongDescription 
	  pt.product_price_type_long_description 
	  as virtrdf:shop_product_price_type_long_description
	.
	
	opl:PriceUnitType(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 ;
	opl:unit_type_description 
	  put.product_price_unit_description 
	  as virtrdf:unit_type_description
	.

	
      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