grant select on "postgres"."demo"."Artist" to SPARQL_SELECT;
grant select on "postgres"."demo"."Countries" to SPARQL_SELECT;
grant select on "postgres"."demo"."Customers" to SPARQL_SELECT;
grant select on "postgres"."demo"."Order_Details" to SPARQL_SELECT;
grant select on "postgres"."demo"."Orders" to SPARQL_SELECT;
grant select on "postgres"."demo"."OrdersPeriods" to SPARQL_SELECT;
grant select on "postgres"."demo"."Products" to SPARQL_SELECT;
grant select on "postgres"."demo"."Provinces" to SPARQL_SELECT;
grant select on "postgres"."demo"."Shippers" to SPARQL_SELECT;
grant select on "postgres"."demo"."Suppliers" to SPARQL_SELECT;
grant select on "postgres"."demo"."WorkOfArtType" to SPARQL_SELECT;


SPARQL
prefix postgres: <http://demo.openlinksw.com:8890/schemas/postgres/> 
create iri class postgres:artist "http://^{URIQADefaultHost}^/postgres/artist/ArtistID/%d#this" (in _ArtistID integer not null) . ;
SPARQL
prefix postgres: <http://demo.openlinksw.com:8890/schemas/postgres/> 
create iri class postgres:countries "http://^{URIQADefaultHost}^/postgres/countries/Code/%U#this" (in _Code varchar not null) . ;
SPARQL
prefix postgres: <http://demo.openlinksw.com:8890/schemas/postgres/> 
create iri class postgres:customers "http://^{URIQADefaultHost}^/postgres/customers/CustomerID/%U#this" (in _CustomerID varchar not null) . ;
SPARQL
prefix postgres: <http://demo.openlinksw.com:8890/schemas/postgres/> 
create iri class postgres:order_details "http://^{URIQADefaultHost}^/postgres/order_details/OrderID/%d#this" (in _OrderID integer not null) . ;
SPARQL
prefix postgres: <http://demo.openlinksw.com:8890/schemas/postgres/> 
create iri class postgres:orders "http://^{URIQADefaultHost}^/postgres/orders/OrderID/%d/CustomerID/%U/EmployeeID/%d#this" (in _OrderID integer not null,in _CustomerID varchar not null,in _EmployeeID integer not null) . ;
SPARQL
prefix postgres: <http://demo.openlinksw.com:8890/schemas/postgres/> 
create iri class postgres:ordersperiods "http://^{URIQADefaultHost}^/postgres/ordersperiods/year/%d/month/%d/yearmonth/%U#this" (in _year integer not null,in _month integer not null,in _yearmonth varchar not null) . ;
SPARQL
prefix postgres: <http://demo.openlinksw.com:8890/schemas/postgres/> 
create iri class postgres:products "http://^{URIQADefaultHost}^/postgres/products/ProductID/%d/SupplierID/%d/CategoryID/%d#this" (in _ProductID integer not null,in _SupplierID integer not null,in _CategoryID integer not null) . ;
SPARQL
prefix postgres: <http://demo.openlinksw.com:8890/schemas/postgres/> 
create iri class postgres:provinces "http://^{URIQADefaultHost}^/postgres/provinces/Province/%U#this" (in _Province varchar not null) . ;
SPARQL
prefix postgres: <http://demo.openlinksw.com:8890/schemas/postgres/> 
create iri class postgres:shippers "http://^{URIQADefaultHost}^/postgres/shippers/ShipperID/%d#this" (in _ShipperID integer not null) . ;
SPARQL
prefix postgres: <http://demo.openlinksw.com:8890/schemas/postgres/> 
create iri class postgres:suppliers "http://^{URIQADefaultHost}^/postgres/suppliers/SupplierID/%d#this" (in _SupplierID integer not null) . ;
SPARQL
prefix postgres: <http://demo.openlinksw.com:8890/schemas/postgres/> 
create iri class postgres:workofarttype "http://^{URIQADefaultHost}^/postgres/workofarttype/WorkArtTypeID/%d#this" (in _WorkArtTypeID integer not null) . ;


create view "postgres"."demo"."ArtistCount" as select count (*) as cnt from "postgres"."demo"."Artist"; 
grant select on "postgres"."demo"."ArtistCount" to SPARQL_SELECT; 
create view "postgres"."demo"."CountriesCount" as select count (*) as cnt from "postgres"."demo"."Countries"; 
grant select on "postgres"."demo"."CountriesCount" to SPARQL_SELECT; 
create view "postgres"."demo"."CustomersCount" as select count (*) as cnt from "postgres"."demo"."Customers"; 
grant select on "postgres"."demo"."CustomersCount" to SPARQL_SELECT; 
create view "postgres"."demo"."Order_DetailsCount" as select count (*) as cnt from "postgres"."demo"."Order_Details"; 
grant select on "postgres"."demo"."Order_DetailsCount" to SPARQL_SELECT; 
create view "postgres"."demo"."OrdersCount" as select count (*) as cnt from "postgres"."demo"."Orders"; 
grant select on "postgres"."demo"."OrdersCount" to SPARQL_SELECT; 
create view "postgres"."demo"."OrdersPeriodsCount" as select count (*) as cnt from "postgres"."demo"."OrdersPeriods"; 
grant select on "postgres"."demo"."OrdersPeriodsCount" to SPARQL_SELECT; 
create view "postgres"."demo"."ProductsCount" as select count (*) as cnt from "postgres"."demo"."Products"; 
grant select on "postgres"."demo"."ProductsCount" to SPARQL_SELECT; 
create view "postgres"."demo"."ProvincesCount" as select count (*) as cnt from "postgres"."demo"."Provinces"; 
grant select on "postgres"."demo"."ProvincesCount" to SPARQL_SELECT; 
create view "postgres"."demo"."ShippersCount" as select count (*) as cnt from "postgres"."demo"."Shippers"; 
grant select on "postgres"."demo"."ShippersCount" to SPARQL_SELECT; 
create view "postgres"."demo"."SuppliersCount" as select count (*) as cnt from "postgres"."demo"."Suppliers"; 
grant select on "postgres"."demo"."SuppliersCount" to SPARQL_SELECT; 
create view "postgres"."demo"."WorkOfArtTypeCount" as select count (*) as cnt from "postgres"."demo"."WorkOfArtType"; 
grant select on "postgres"."demo"."WorkOfArtTypeCount" to SPARQL_SELECT; 
drop view "postgres"."demo"."postgres__Total"; 
create view "postgres"."demo"."postgres__Total" as select (cnt0*cnt1)+(cnt2*cnt3)+(cnt4*cnt5)+(cnt6*cnt7)+(cnt8*cnt9)+(cnt10*cnt11)+(cnt12*cnt13)+(cnt14*cnt15)+(cnt16*cnt17)+(cnt18*cnt19)+(cnt20*cnt21) AS cnt from 
 (select count(*) cnt0 from "postgres"."demo"."Artist") tb0, 
 (select count(*)+1 as cnt1 from DB.DBA.TABLE_COLS where "TABLE" = 'postgres.demo.Artist'  and "COLUMN" <> '_IDN') tb1,
 (select count(*) cnt2 from "postgres"."demo"."Countries") tb2, 
 (select count(*)+1 as cnt3 from DB.DBA.TABLE_COLS where "TABLE" = 'postgres.demo.Countries'  and "COLUMN" <> '_IDN') tb3,
 (select count(*) cnt4 from "postgres"."demo"."Customers") tb4, 
 (select count(*)+1 as cnt5 from DB.DBA.TABLE_COLS where "TABLE" = 'postgres.demo.Customers'  and "COLUMN" <> '_IDN') tb5,
 (select count(*) cnt6 from "postgres"."demo"."Order_Details") tb6, 
 (select count(*)+1 as cnt7 from DB.DBA.TABLE_COLS where "TABLE" = 'postgres.demo.Order_Details'  and "COLUMN" <> '_IDN') tb7,
 (select count(*) cnt8 from "postgres"."demo"."Orders") tb8, 
 (select count(*)+1 as cnt9 from DB.DBA.TABLE_COLS where "TABLE" = 'postgres.demo.Orders'  and "COLUMN" <> '_IDN') tb9,
 (select count(*) cnt10 from "postgres"."demo"."OrdersPeriods") tb10, 
 (select count(*)+1 as cnt11 from DB.DBA.TABLE_COLS where "TABLE" = 'postgres.demo.OrdersPeriods'  and "COLUMN" <> '_IDN') tb11,
 (select count(*) cnt12 from "postgres"."demo"."Products") tb12, 
 (select count(*)+1 as cnt13 from DB.DBA.TABLE_COLS where "TABLE" = 'postgres.demo.Products'  and "COLUMN" <> '_IDN') tb13,
 (select count(*) cnt14 from "postgres"."demo"."Provinces") tb14, 
 (select count(*)+1 as cnt15 from DB.DBA.TABLE_COLS where "TABLE" = 'postgres.demo.Provinces'  and "COLUMN" <> '_IDN') tb15,
 (select count(*) cnt16 from "postgres"."demo"."Shippers") tb16, 
 (select count(*)+1 as cnt17 from DB.DBA.TABLE_COLS where "TABLE" = 'postgres.demo.Shippers'  and "COLUMN" <> '_IDN') tb17,
 (select count(*) cnt18 from "postgres"."demo"."Suppliers") tb18, 
 (select count(*)+1 as cnt19 from DB.DBA.TABLE_COLS where "TABLE" = 'postgres.demo.Suppliers'  and "COLUMN" <> '_IDN') tb19,
 (select count(*) cnt20 from "postgres"."demo"."WorkOfArtType") tb20, 
 (select count(*)+1 as cnt21 from DB.DBA.TABLE_COLS where "TABLE" = 'postgres.demo.WorkOfArtType'  and "COLUMN" <> '_IDN') tb21
; 
grant select on "postgres"."demo"."postgres__Total" to SPARQL_SELECT; 


SPARQL
prefix postgres: <http://demo.openlinksw.com:8890/schemas/postgres/> 
prefix postgres-stat: <http://demo.openlinksw.com:8890/postgres/stat#> 
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
prefix void: <http://rdfs.org/ns/void#> 
prefix scovo: <http://purl.org/NET/scovo#> 
prefix aowl: <http://bblfish.net/work/atom-owl/2006-06-06/> 
alter quad storage virtrdf:DefaultQuadStorage 
 from "postgres"."demo"."Artist" as artist_s
 { 
   create postgres:qm-artist as graph iri ("http://^{URIQADefaultHost}^/postgres#")  
    { 
      # Maps from columns of "postgres.demo.Artist"
      postgres:artist (artist_s."ArtistID")  a postgres:Artist ;
      postgres:artistid artist_s."ArtistID" as postgres:demo-artist-artistid ;
      postgres:countrycode artist_s."CountryCode" as postgres:demo-artist-countrycode ;
      postgres:name artist_s."Name" as postgres:demo-artist-name .

    }
 }

;

SPARQL
prefix postgres: <http://demo.openlinksw.com:8890/schemas/postgres/> 
prefix postgres-stat: <http://demo.openlinksw.com:8890/postgres/stat#> 
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
prefix void: <http://rdfs.org/ns/void#> 
prefix scovo: <http://purl.org/NET/scovo#> 
prefix aowl: <http://bblfish.net/work/atom-owl/2006-06-06/> 
alter quad storage virtrdf:DefaultQuadStorage 
 from "postgres"."demo"."Countries" as countries_s
 { 
   create postgres:qm-countries as graph iri ("http://^{URIQADefaultHost}^/postgres#")  
    { 
      # Maps from columns of "postgres.demo.Countries"
      postgres:countries (countries_s."Code")  a postgres:Countries ;
      postgres:name countries_s."Name" as postgres:demo-countries-name ;
      postgres:code countries_s."Code" as postgres:demo-countries-code ;
      postgres:smallflagdavresourcename countries_s."SmallFlagDAVResourceName" as postgres:demo-countries-smallflagdavresourcename ;
      postgres:largeflagdavresourcename countries_s."LargeFlagDAVResourceName" as postgres:demo-countries-largeflagdavresourcename ;
      postgres:smallflagdavresourceuri countries_s."SmallFlagDAVResourceURI" as postgres:demo-countries-smallflagdavresourceuri ;
      postgres:largeflagdavresourceuri countries_s."LargeFlagDAVResourceURI" as postgres:demo-countries-largeflagdavresourceuri ;
      postgres:lat countries_s."Lat" as postgres:demo-countries-lat ;
      postgres:lng countries_s."Lng" as postgres:demo-countries-lng .

    }
 }

;

SPARQL
prefix postgres: <http://demo.openlinksw.com:8890/schemas/postgres/> 
prefix postgres-stat: <http://demo.openlinksw.com:8890/postgres/stat#> 
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
prefix void: <http://rdfs.org/ns/void#> 
prefix scovo: <http://purl.org/NET/scovo#> 
prefix aowl: <http://bblfish.net/work/atom-owl/2006-06-06/> 
alter quad storage virtrdf:DefaultQuadStorage 
 from "postgres"."demo"."Customers" as customers_s
 { 
   create postgres:qm-customers as graph iri ("http://^{URIQADefaultHost}^/postgres#")  
    { 
      # Maps from columns of "postgres.demo.Customers"
      postgres:customers (customers_s."CustomerID")  a postgres:Customers ;
      postgres:customerid customers_s."CustomerID" as postgres:demo-customers-customerid ;
      postgres:companyname customers_s."CompanyName" as postgres:demo-customers-companyname ;
      postgres:contactname customers_s."ContactName" as postgres:demo-customers-contactname ;
      postgres:contacttitle customers_s."ContactTitle" as postgres:demo-customers-contacttitle ;
      postgres:address customers_s."Address" as postgres:demo-customers-address ;
      postgres:city customers_s."City" as postgres:demo-customers-city ;
      postgres:region customers_s."Region" as postgres:demo-customers-region ;
      postgres:postalcode customers_s."PostalCode" as postgres:demo-customers-postalcode ;
      postgres:country customers_s."Country" as postgres:demo-customers-country ;
      postgres:countrycode customers_s."CountryCode" as postgres:demo-customers-countrycode ;
      postgres:phone customers_s."Phone" as postgres:demo-customers-phone ;
      postgres:fax customers_s."Fax" as postgres:demo-customers-fax .

    }
 }

;

SPARQL
prefix postgres: <http://demo.openlinksw.com:8890/schemas/postgres/> 
prefix postgres-stat: <http://demo.openlinksw.com:8890/postgres/stat#> 
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
prefix void: <http://rdfs.org/ns/void#> 
prefix scovo: <http://purl.org/NET/scovo#> 
prefix aowl: <http://bblfish.net/work/atom-owl/2006-06-06/> 
alter quad storage virtrdf:DefaultQuadStorage 
 from "postgres"."demo"."Order_Details" as order_details_s
 { 
   create postgres:qm-order_details as graph iri ("http://^{URIQADefaultHost}^/postgres#")  
    { 
      # Maps from columns of "postgres.demo.Order_Details"
      postgres:order_details (order_details_s."OrderID")  a postgres:Order_Details ;
      postgres:orderid order_details_s."OrderID" as postgres:demo-order_details-orderid ;
      postgres:productid order_details_s."ProductID" as postgres:demo-order_details-productid ;
      postgres:unitprice order_details_s."UnitPrice" as postgres:demo-order_details-unitprice ;
      postgres:quantity order_details_s."Quantity" as postgres:demo-order_details-quantity ;
      postgres:discount order_details_s."Discount" as postgres:demo-order_details-discount .

    }
 }

;

SPARQL
prefix postgres: <http://demo.openlinksw.com:8890/schemas/postgres/> 
prefix postgres-stat: <http://demo.openlinksw.com:8890/postgres/stat#> 
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
prefix void: <http://rdfs.org/ns/void#> 
prefix scovo: <http://purl.org/NET/scovo#> 
prefix aowl: <http://bblfish.net/work/atom-owl/2006-06-06/> 
alter quad storage virtrdf:DefaultQuadStorage 
 from "postgres"."demo"."Orders" as orders_s
 { 
   create postgres:qm-orders as graph iri ("http://^{URIQADefaultHost}^/postgres#")  
    { 
      # Maps from columns of "postgres.demo.Orders"
      postgres:orders (orders_s."OrderID",orders_s."CustomerID",orders_s."EmployeeID")  a postgres:Orders ;
      postgres:orderid orders_s."OrderID" as postgres:demo-orders-orderid ;
      postgres:customerid orders_s."CustomerID" as postgres:demo-orders-customerid ;
      postgres:employeeid orders_s."EmployeeID" as postgres:demo-orders-employeeid ;
      postgres:orderdate orders_s."OrderDate" as postgres:demo-orders-orderdate ;
      postgres:requireddate orders_s."RequiredDate" as postgres:demo-orders-requireddate ;
      postgres:shippeddate orders_s."ShippedDate" as postgres:demo-orders-shippeddate ;
      postgres:shipvia orders_s."ShipVia" as postgres:demo-orders-shipvia ;
      postgres:freight orders_s."Freight" as postgres:demo-orders-freight ;
      postgres:shipname orders_s."ShipName" as postgres:demo-orders-shipname ;
      postgres:shipaddress orders_s."ShipAddress" as postgres:demo-orders-shipaddress ;
      postgres:shipcity orders_s."ShipCity" as postgres:demo-orders-shipcity ;
      postgres:shipregion orders_s."ShipRegion" as postgres:demo-orders-shipregion ;
      postgres:shippostalcode orders_s."ShipPostalCode" as postgres:demo-orders-shippostalcode ;
      postgres:shipcountry orders_s."ShipCountry" as postgres:demo-orders-shipcountry ;
      postgres:shipcountrycode orders_s."ShipCountryCode" as postgres:demo-orders-shipcountrycode .

    }
 }

;

SPARQL
prefix postgres: <http://demo.openlinksw.com:8890/schemas/postgres/> 
prefix postgres-stat: <http://demo.openlinksw.com:8890/postgres/stat#> 
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
prefix void: <http://rdfs.org/ns/void#> 
prefix scovo: <http://purl.org/NET/scovo#> 
prefix aowl: <http://bblfish.net/work/atom-owl/2006-06-06/> 
alter quad storage virtrdf:DefaultQuadStorage 
 from "postgres"."demo"."OrdersPeriods" as ordersperiods_s
 { 
   create postgres:qm-ordersperiods as graph iri ("http://^{URIQADefaultHost}^/postgres#")  
    { 
      # Maps from columns of "postgres.demo.OrdersPeriods"
      postgres:ordersperiods (ordersperiods_s."year",ordersperiods_s."month",ordersperiods_s."yearmonth")  a postgres:OrdersPeriods ;
      postgres:year ordersperiods_s."year" as postgres:demo-ordersperiods-year ;
      postgres:month ordersperiods_s."month" as postgres:demo-ordersperiods-month ;
      postgres:yearmonth ordersperiods_s."yearmonth" as postgres:demo-ordersperiods-yearmonth .

    }
 }

;

SPARQL
prefix postgres: <http://demo.openlinksw.com:8890/schemas/postgres/> 
prefix postgres-stat: <http://demo.openlinksw.com:8890/postgres/stat#> 
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
prefix void: <http://rdfs.org/ns/void#> 
prefix scovo: <http://purl.org/NET/scovo#> 
prefix aowl: <http://bblfish.net/work/atom-owl/2006-06-06/> 
alter quad storage virtrdf:DefaultQuadStorage 
 from "postgres"."demo"."Products" as products_s
 { 
   create postgres:qm-products as graph iri ("http://^{URIQADefaultHost}^/postgres#")  
    { 
      # Maps from columns of "postgres.demo.Products"
      postgres:products (products_s."ProductID",products_s."SupplierID",products_s."CategoryID")  a postgres:Products ;
      postgres:productid products_s."ProductID" as postgres:demo-products-productid ;
      postgres:productname products_s."ProductName" as postgres:demo-products-productname ;
      postgres:supplierid products_s."SupplierID" as postgres:demo-products-supplierid ;
      postgres:categoryid products_s."CategoryID" as postgres:demo-products-categoryid ;
      postgres:quantityperunit products_s."QuantityPerUnit" as postgres:demo-products-quantityperunit ;
      postgres:unitprice products_s."UnitPrice" as postgres:demo-products-unitprice ;
      postgres:unitsinstock products_s."UnitsInStock" as postgres:demo-products-unitsinstock ;
      postgres:unitsonorder products_s."UnitsOnOrder" as postgres:demo-products-unitsonorder ;
      postgres:reorderlevel products_s."ReorderLevel" as postgres:demo-products-reorderlevel ;
      postgres:discontinued products_s."Discontinued" as postgres:demo-products-discontinued .

    }
 }

;

SPARQL
prefix postgres: <http://demo.openlinksw.com:8890/schemas/postgres/> 
prefix postgres-stat: <http://demo.openlinksw.com:8890/postgres/stat#> 
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
prefix void: <http://rdfs.org/ns/void#> 
prefix scovo: <http://purl.org/NET/scovo#> 
prefix aowl: <http://bblfish.net/work/atom-owl/2006-06-06/> 
alter quad storage virtrdf:DefaultQuadStorage 
 from "postgres"."demo"."Provinces" as provinces_s
 { 
   create postgres:qm-provinces as graph iri ("http://^{URIQADefaultHost}^/postgres#")  
    { 
      # Maps from columns of "postgres.demo.Provinces"
      postgres:provinces (provinces_s."Province")  a postgres:Provinces ;
      postgres:countrycode provinces_s."CountryCode" as postgres:demo-provinces-countrycode ;
      postgres:province provinces_s."Province" as postgres:demo-provinces-province .

    }
 }

;

SPARQL
prefix postgres: <http://demo.openlinksw.com:8890/schemas/postgres/> 
prefix postgres-stat: <http://demo.openlinksw.com:8890/postgres/stat#> 
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
prefix void: <http://rdfs.org/ns/void#> 
prefix scovo: <http://purl.org/NET/scovo#> 
prefix aowl: <http://bblfish.net/work/atom-owl/2006-06-06/> 
alter quad storage virtrdf:DefaultQuadStorage 
 from "postgres"."demo"."Shippers" as shippers_s
 { 
   create postgres:qm-shippers as graph iri ("http://^{URIQADefaultHost}^/postgres#")  
    { 
      # Maps from columns of "postgres.demo.Shippers"
      postgres:shippers (shippers_s."ShipperID")  a postgres:Shippers ;
      postgres:shipperid shippers_s."ShipperID" as postgres:demo-shippers-shipperid ;
      postgres:companyname shippers_s."CompanyName" as postgres:demo-shippers-companyname ;
      postgres:phone shippers_s."Phone" as postgres:demo-shippers-phone .

    }
 }

;

SPARQL
prefix postgres: <http://demo.openlinksw.com:8890/schemas/postgres/> 
prefix postgres-stat: <http://demo.openlinksw.com:8890/postgres/stat#> 
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
prefix void: <http://rdfs.org/ns/void#> 
prefix scovo: <http://purl.org/NET/scovo#> 
prefix aowl: <http://bblfish.net/work/atom-owl/2006-06-06/> 
alter quad storage virtrdf:DefaultQuadStorage 
 from "postgres"."demo"."Suppliers" as suppliers_s
 { 
   create postgres:qm-suppliers as graph iri ("http://^{URIQADefaultHost}^/postgres#")  
    { 
      # Maps from columns of "postgres.demo.Suppliers"
      postgres:suppliers (suppliers_s."SupplierID")  a postgres:Suppliers ;
      postgres:supplierid suppliers_s."SupplierID" as postgres:demo-suppliers-supplierid ;
      postgres:companyname suppliers_s."CompanyName" as postgres:demo-suppliers-companyname ;
      postgres:contactname suppliers_s."ContactName" as postgres:demo-suppliers-contactname ;
      postgres:contacttitle suppliers_s."ContactTitle" as postgres:demo-suppliers-contacttitle ;
      postgres:address suppliers_s."Address" as postgres:demo-suppliers-address ;
      postgres:city suppliers_s."City" as postgres:demo-suppliers-city ;
      postgres:region suppliers_s."Region" as postgres:demo-suppliers-region ;
      postgres:postalcode suppliers_s."PostalCode" as postgres:demo-suppliers-postalcode ;
      postgres:country suppliers_s."Country" as postgres:demo-suppliers-country ;
      postgres:countrycode suppliers_s."CountryCode" as postgres:demo-suppliers-countrycode ;
      postgres:phone suppliers_s."Phone" as postgres:demo-suppliers-phone ;
      postgres:fax suppliers_s."Fax" as postgres:demo-suppliers-fax ;
      postgres:homepage suppliers_s."HomePage" as postgres:demo-suppliers-homepage .

    }
 }

;

SPARQL
prefix postgres: <http://demo.openlinksw.com:8890/schemas/postgres/> 
prefix postgres-stat: <http://demo.openlinksw.com:8890/postgres/stat#> 
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
prefix void: <http://rdfs.org/ns/void#> 
prefix scovo: <http://purl.org/NET/scovo#> 
prefix aowl: <http://bblfish.net/work/atom-owl/2006-06-06/> 
alter quad storage virtrdf:DefaultQuadStorage 
 from "postgres"."demo"."WorkOfArtType" as workofarttype_s
 { 
   create postgres:qm-workofarttype as graph iri ("http://^{URIQADefaultHost}^/postgres#")  
    { 
      # Maps from columns of "postgres.demo.WorkOfArtType"
      postgres:workofarttype (workofarttype_s."WorkArtTypeID")  a postgres:WorkOfArtType ;
      postgres:workarttypeid workofarttype_s."WorkArtTypeID" as postgres:demo-workofarttype-workarttypeid ;
      postgres:description workofarttype_s."Description" as postgres:demo-workofarttype-description .

    }
 }

;

SPARQL
prefix postgres: <http://demo.openlinksw.com:8890/schemas/postgres/> 
prefix postgres-stat: <http://demo.openlinksw.com:8890/postgres/stat#> 
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
prefix void: <http://rdfs.org/ns/void#> 
prefix scovo: <http://purl.org/NET/scovo#> 
prefix aowl: <http://bblfish.net/work/atom-owl/2006-06-06/> 
alter quad storage virtrdf:DefaultQuadStorage 
 from "postgres"."demo"."ArtistCount" as artistcount_s
 from "postgres"."demo"."CountriesCount" as countriescount_s
 from "postgres"."demo"."CustomersCount" as customerscount_s
 from "postgres"."demo"."Order_DetailsCount" as order_detailscount_s
 from "postgres"."demo"."OrdersCount" as orderscount_s
 from "postgres"."demo"."OrdersPeriodsCount" as ordersperiodscount_s
 from "postgres"."demo"."ProductsCount" as productscount_s
 from "postgres"."demo"."ProvincesCount" as provincescount_s
 from "postgres"."demo"."ShippersCount" as shipperscount_s
 from "postgres"."demo"."SuppliersCount" as supplierscount_s
 from "postgres"."demo"."WorkOfArtTypeCount" as workofarttypecount_s
 from "postgres"."demo"."postgres__Total" as postgres__total_s
 { 
   create postgres:qm-VoidStatistics as graph iri ("http://^{URIQADefaultHost}^/postgres#") option (exclusive) 
    { 
      # voID Statistics 
      postgres-stat: a void:Dataset as postgres:dataset-postgres ; 
       void:sparqlEndpoint <http://demo.openlinksw.com:8890/sparql> as postgres:dataset-sparql-postgres ; 
      void:statItem postgres-stat:Stat . 
      postgres-stat:Stat a scovo:Item ; 
       rdf:value postgres__total_s.cnt as postgres:stat-decl-postgres ; 
       scovo:dimension void:numOfTriples . 

      postgres-stat: void:statItem postgres-stat:ArtistStat as postgres:statitem-postgres-artist . 
      postgres-stat:ArtistStat a scovo:Item as postgres:statitem-decl-postgres-artist ; 
      rdf:value artistcount_s.cnt as postgres:statitem-cnt-postgres-artist ; 
      scovo:dimension void:numberOfResources as postgres:statitem-type-1-postgres-artist ; 
      scovo:dimension postgres:Artist as postgres:statitem-type-2-postgres-artist .

      postgres-stat: void:statItem postgres-stat:CountriesStat as postgres:statitem-postgres-countries . 
      postgres-stat:CountriesStat a scovo:Item as postgres:statitem-decl-postgres-countries ; 
      rdf:value countriescount_s.cnt as postgres:statitem-cnt-postgres-countries ; 
      scovo:dimension void:numberOfResources as postgres:statitem-type-1-postgres-countries ; 
      scovo:dimension postgres:Countries as postgres:statitem-type-2-postgres-countries .

      postgres-stat: void:statItem postgres-stat:CustomersStat as postgres:statitem-postgres-customers . 
      postgres-stat:CustomersStat a scovo:Item as postgres:statitem-decl-postgres-customers ; 
      rdf:value customerscount_s.cnt as postgres:statitem-cnt-postgres-customers ; 
      scovo:dimension void:numberOfResources as postgres:statitem-type-1-postgres-customers ; 
      scovo:dimension postgres:Customers as postgres:statitem-type-2-postgres-customers .

      postgres-stat: void:statItem postgres-stat:Order_DetailsStat as postgres:statitem-postgres-order_details . 
      postgres-stat:Order_DetailsStat a scovo:Item as postgres:statitem-decl-postgres-order_details ; 
      rdf:value order_detailscount_s.cnt as postgres:statitem-cnt-postgres-order_details ; 
      scovo:dimension void:numberOfResources as postgres:statitem-type-1-postgres-order_details ; 
      scovo:dimension postgres:Order_Details as postgres:statitem-type-2-postgres-order_details .

      postgres-stat: void:statItem postgres-stat:OrdersStat as postgres:statitem-postgres-orders . 
      postgres-stat:OrdersStat a scovo:Item as postgres:statitem-decl-postgres-orders ; 
      rdf:value orderscount_s.cnt as postgres:statitem-cnt-postgres-orders ; 
      scovo:dimension void:numberOfResources as postgres:statitem-type-1-postgres-orders ; 
      scovo:dimension postgres:Orders as postgres:statitem-type-2-postgres-orders .

      postgres-stat: void:statItem postgres-stat:OrdersPeriodsStat as postgres:statitem-postgres-ordersperiods . 
      postgres-stat:OrdersPeriodsStat a scovo:Item as postgres:statitem-decl-postgres-ordersperiods ; 
      rdf:value ordersperiodscount_s.cnt as postgres:statitem-cnt-postgres-ordersperiods ; 
      scovo:dimension void:numberOfResources as postgres:statitem-type-1-postgres-ordersperiods ; 
      scovo:dimension postgres:OrdersPeriods as postgres:statitem-type-2-postgres-ordersperiods .

      postgres-stat: void:statItem postgres-stat:ProductsStat as postgres:statitem-postgres-products . 
      postgres-stat:ProductsStat a scovo:Item as postgres:statitem-decl-postgres-products ; 
      rdf:value productscount_s.cnt as postgres:statitem-cnt-postgres-products ; 
      scovo:dimension void:numberOfResources as postgres:statitem-type-1-postgres-products ; 
      scovo:dimension postgres:Products as postgres:statitem-type-2-postgres-products .

      postgres-stat: void:statItem postgres-stat:ProvincesStat as postgres:statitem-postgres-provinces . 
      postgres-stat:ProvincesStat a scovo:Item as postgres:statitem-decl-postgres-provinces ; 
      rdf:value provincescount_s.cnt as postgres:statitem-cnt-postgres-provinces ; 
      scovo:dimension void:numberOfResources as postgres:statitem-type-1-postgres-provinces ; 
      scovo:dimension postgres:Provinces as postgres:statitem-type-2-postgres-provinces .

      postgres-stat: void:statItem postgres-stat:ShippersStat as postgres:statitem-postgres-shippers . 
      postgres-stat:ShippersStat a scovo:Item as postgres:statitem-decl-postgres-shippers ; 
      rdf:value shipperscount_s.cnt as postgres:statitem-cnt-postgres-shippers ; 
      scovo:dimension void:numberOfResources as postgres:statitem-type-1-postgres-shippers ; 
      scovo:dimension postgres:Shippers as postgres:statitem-type-2-postgres-shippers .

      postgres-stat: void:statItem postgres-stat:SuppliersStat as postgres:statitem-postgres-suppliers . 
      postgres-stat:SuppliersStat a scovo:Item as postgres:statitem-decl-postgres-suppliers ; 
      rdf:value supplierscount_s.cnt as postgres:statitem-cnt-postgres-suppliers ; 
      scovo:dimension void:numberOfResources as postgres:statitem-type-1-postgres-suppliers ; 
      scovo:dimension postgres:Suppliers as postgres:statitem-type-2-postgres-suppliers .

      postgres-stat: void:statItem postgres-stat:WorkOfArtTypeStat as postgres:statitem-postgres-workofarttype . 
      postgres-stat:WorkOfArtTypeStat a scovo:Item as postgres:statitem-decl-postgres-workofarttype ; 
      rdf:value workofarttypecount_s.cnt as postgres:statitem-cnt-postgres-workofarttype ; 
      scovo:dimension void:numberOfResources as postgres:statitem-type-1-postgres-workofarttype ; 
      scovo:dimension postgres:WorkOfArtType as postgres:statitem-type-2-postgres-workofarttype .

    }
 }
;



-- Virtual directories for instance data
DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
'postgres_rule2',
1,
'(/[^#]*)',
vector('path'),
1,
'/sparql?query=DESCRIBE+%%3Chttp%%3A//^{URIQADefaultHost}^%U%%23this%%3E+FROM+%%3Chttp%%3A//^{URIQADefaultHost}^/postgres%%23%%3E&format=%U',
vector('path', '*accept*'),
null,
'(text/rdf.n3)|(application/rdf.xml)|(text/n3)|(application/json)',
2,
null
);
DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
'postgres_rule4',
1,
'/postgres/stat([^#]*)',
vector('path'),
1,
'/sparql?query=DESCRIBE+%%3Chttp%%3A//^{URIQADefaultHost}^/postgres/stat%%23%%3E+%%3Fo+FROM+%%3Chttp%%3A//^{URIQADefaultHost}^/postgres%%23%%3E+WHERE+{+%%3Chttp%%3A//^{URIQADefaultHost}^/postgres/stat%%23%%3E+%%3Fp+%%3Fo+}&format=%U',
vector('*accept*'),
null,
'(text/rdf.n3)|(application/rdf.xml)|(text/n3)|(application/json)',
2,
null
);
DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
'postgres_rule6',
1,
'/postgres/objects/([^#]*)',
vector('path'),
1,
'/sparql?query=DESCRIBE+%%3Chttp%%3A//^{URIQADefaultHost}^/postgres/objects/%U%%3E+FROM+%%3Chttp%%3A//^{URIQADefaultHost}^/postgres%%23%%3E&format=%U',
vector('path', '*accept*'),
null,
'(text/rdf.n3)|(application/rdf.xml)|(text/n3)|(application/json)',
2,
null
);
DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
'postgres_rule1',
1,
'([^#]*)',
vector('path'),
1,
'/describe/?url=http%%3A//^{URIQADefaultHost}^%U%%23this&graph=http%%3A//^{URIQADefaultHost}^/postgres%%23&distinct=0',
vector('path'),
null,
null,
2,
303
);
DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
'postgres_rule7',
1,
'/postgres/stat([^#]*)',
vector('path'),
1,
'/describe/?url=http%%3A//^{URIQADefaultHost}^/postgres/stat%%23&graph=http%%3A//^{URIQADefaultHost}^/postgres%%23',
vector('path'),
null,
null,
2,
303
);
DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
'postgres_rule5',
1,
'/postgres/objects/(.*)',
vector('path'),
1,
'/services/rdf/object.binary?path=%%2Fpostgres%%2Fobjects%%2F%U&accept=%U',
vector('path', '*accept*'),
null,
null,
2,
null
);
DB.DBA.URLREWRITE_CREATE_RULELIST ( 'postgres_rule_list1', 1, vector ( 'postgres_rule1', 'postgres_rule7', 'postgres_rule5', 'postgres_rule2', 'postgres_rule4', 'postgres_rule6'));
DB.DBA.VHOST_REMOVE (lpath=>'/postgres');
DB.DBA.VHOST_DEFINE (lpath=>'/postgres', ppath=>'/', vsp_user=>'dba', is_dav=>0,
is_brws=>0, opts=>vector ('url_rewrite', 'postgres_rule_list1')
);

-- Virtual directories for ontology
DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
'postgres_owl_rule2',
1,
'(/[^#]*)',
vector('path'),
1,
'/sparql?query=DESCRIBE+%%3Chttp%%3A//^{URIQADefaultHost}^%U%%3E+FROM+%%3Chttp%%3A//^{URIQADefaultHost}^/schemas/postgres%%23%%3E&format=%U',
vector('path', '*accept*'),
null,
'(text/rdf.n3)|(application/rdf.xml)|(text/n3)|(application/json)',
2,
null
);
DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
'postgres_owl_rule1',
1,
'([^#]*)',
vector('path'),
1,
'/describe/?url=http://^{URIQADefaultHost}^%U',
vector('path'),
null,
null,
2,
303
);
DB.DBA.URLREWRITE_CREATE_RULELIST ( 'postgres_owl_rule_list1', 1, vector ( 'postgres_owl_rule1', 'postgres_owl_rule2'));
DB.DBA.VHOST_REMOVE (lpath=>'/schemas/postgres');
DB.DBA.VHOST_DEFINE (lpath=>'/schemas/postgres', ppath=>'/', vsp_user=>'dba', is_dav=>0,
is_brws=>0, opts=>vector ('url_rewrite', 'postgres_owl_rule_list1')
);