Progress SQL-92 iSports Linked Data Views Script to set up your own instance
-- Setup script for Linked Data Views of Progress SQL-92 iSports Sample Database --
GRANT SELECT ON isports_rdf.prs10_isports_rdf.Customer TO "SPARQL", "SPARQL_UPDATE";
GRANT SELECT ON isports_rdf.prs10_isports_rdf."Order" TO "SPARQL", "SPARQL_UPDATE";
GRANT SELECT ON isports_rdf.prs10_isports_rdf.Item TO "SPARQL", "SPARQL_UPDATE";
GRANT SELECT ON isports_rdf.prs10_isports_rdf."Order-Line" TO "SPARQL", "SPARQL_UPDATE";
GRANT SELECT ON isports_rdf.prs10_isports_rdf.Invoice TO "SPARQL", "SPARQL_UPDATE";
GRANT SELECT ON isports_rdf.prs10_isports_rdf."Local-Default" TO "SPARQL", "SPARQL_UPDATE";
GRANT SELECT ON isports_rdf.prs10_isports_rdf."Ref-Call" TO "SPARQL", "SPARQL_UPDATE";
GRANT SELECT ON isports_rdf.prs10_isports_rdf.Salesrep TO "SPARQL", "SPARQL_UPDATE";
GRANT SELECT ON isports_rdf.prs10_isports_rdf.State TO "SPARQL", "SPARQL_UPDATE";
GRANT SPARQL_UPDATE to "SPARQL";
CREATE VIEW isports_rdf.prs10_isports_rdf.VCustomer AS SELECT "Cust-Num" AS Cust_Num, Name, Address, Address2, City, State, Country, Phone, Contact, "Sales-Rep" AS Sales_Rep, Comments, "Credit-Limit" AS Credit_Limit, Balance, Terms, Discount, "Postal-Code" AS Postal_Code FROM isports_rdf.prs10_isports_rdf.Customer;
CREATE VIEW isports_rdf.prs10_isports_rdf.VOrder AS SELECT "Order-num" AS Order_num, "Cust-Num" AS Cust_Num, "Order-Date" AS Order_Date, "Ship-Date" AS Ship_Date, "Promise-Date" AS Promise_Date, Carrier, Instructions, PO, Terms, "Sales-Rep" AS Sales_Rep FROM isports_rdf.prs10_isports_rdf."Order";
CREATE VIEW isports_rdf.prs10_isports_rdf.VItem AS SELECT "Item-num" AS Item_num, "Item-Name" AS Item_Name, "Cat-Page" AS Cat_Page, Price, "Cat-Description" AS Cat_Description, "On-hand" AS On_hand, Allocated, "Re-Order" AS Re_Order, "On-Order" AS On_Order FROM isports_rdf.prs10_isports_rdf.Item;
CREATE VIEW isports_rdf.prs10_isports_rdf.VOrder_Line AS SELECT "Order-num" AS Order_num, "Line-num" AS Line_num, "Item-num" AS Item_num, Price, Qty, Discount, "Extended-Price" AS Extended_Price, Backorder FROM isports_rdf.prs10_isports_rdf."Order-Line";
CREATE VIEW isports_rdf.prs10_isports_rdf.VInvoice AS SELECT "Invoice-Num" AS Invoice_Num, "Cust-Num" AS Cust_Num, "Invoice-Date" AS Invoice_Date, Amount, "Total-Paid" AS Total_Paid, Adjustment, "Order-Num" AS Order_Num, "Ship-Charge" AS Ship_Charge FROM isports_rdf.prs10_isports_rdf.Invoice;
CREATE VIEW isports_rdf.prs10_isports_rdf.VLocal_Default AS SELECT Country, "Region1-Label" AS Region1_Label, "Region2-Label" AS Region2_Label, "Postal-Label" AS Postal_Label, "Postal-Format" AS Postal_Format, "Tel-Format" AS Tel_Format, "Date-Format" AS Date_Format, "Currency-Symbol" AS Currency_Symbol FROM isports_rdf.prs10_isports_rdf."Local-Default";
CREATE VIEW isports_rdf.prs10_isports_rdf.VRef_Call AS SELECT "Call-Num" AS Call_Num, "Cust-Num" AS Cust_Num, "Call-Date" AS Call_Date, "Sales-Rep" AS Sales_Rep, Parent, Txt FROM isports_rdf.prs10_isports_rdf."Ref-Call";
CREATE VIEW isports_rdf.prs10_isports_rdf.VSalesrep AS SELECT "Rep-Name" AS Rep_Name, Region, "Sales-Rep" AS Sales_Rep, "Month-Quota" AS Month_Quota FROM isports_rdf.prs10_isports_rdf.Salesrep;
CREATE VIEW isports_rdf.prs10_isports_rdf.VState AS SELECT State, "State-Name" AS State_Name, Region FROM isports_rdf.prs10_isports_rdf.State;
GRANT SELECT ON isports_rdf.prs10_isports_rdf.VCustomer TO "SPARQL", "SPARQL_UPDATE";
GRANT SELECT ON isports_rdf.prs10_isports_rdf.VOrder TO "SPARQL", "SPARQL_UPDATE";
GRANT SELECT ON isports_rdf.prs10_isports_rdf.VItem TO "SPARQL", "SPARQL_UPDATE";
GRANT SELECT ON isports_rdf.prs10_isports_rdf.VOrder_Line TO "SPARQL", "SPARQL_UPDATE";
GRANT SELECT ON isports_rdf.prs10_isports_rdf.VInvoice TO "SPARQL", "SPARQL_UPDATE";
GRANT SELECT ON isports_rdf.prs10_isports_rdf.VLocal_Default TO "SPARQL", "SPARQL_UPDATE";
GRANT SELECT ON isports_rdf.prs10_isports_rdf.VRef_Call TO "SPARQL", "SPARQL_UPDATE";
GRANT SELECT ON isports_rdf.prs10_isports_rdf.VSalesrep TO "SPARQL", "SPARQL_UPDATE";
GRANT SELECT ON isports_rdf.prs10_isports_rdf.VState TO "SPARQL", "SPARQL_UPDATE";
-------- Create rdfs:Class definitions ----------------------------
ttlp (
'
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix customer: <http://localhost:8890/schemas/progress/isports/customer/> .
@prefix order: <http://localhost:8890/schemas/progress/isports/order/> .
@prefix item: <http://localhost:8890/schemas/progress/isports/item/> .
@prefix orderline: <http://localhost:8890/schemas/progress/isports/order_line/> .
@prefix invoice: <http://localhost:8890/schemas/progress/isports/invoice/> .
@prefix localdefault: <http://localhost:8890/schemas/progress/isports/local_default/> .
@prefix refcall: <http://localhost:8890/schemas/progress/isports/ref_call/> .
@prefix salesrep: <http://localhost:8890/schemas/progress/isports/salesrep/> .
@prefix state: <http://localhost:8890/schemas/progress/isports/state/> .
customer:Customer a rdfs:Class ;
rdfs:label "Customer" ;
rdfs:comment "Progress isports Customer table" .
customer:Cust-Num a rdf:Property ;
rdfs:domain customer:Customer ;
rdfs:range xsd:integer ;
rdfs:label "Cust-Num" .
customer:Name a rdf:Property ;
rdfs:domain customer:Customer ;
rdfs:range xsd:string ;
rdfs:label "Name" .
customer:Address a rdf:Property ;
rdfs:domain customer:Customer ;
rdfs:range xsd:string ;
rdfs:label "Address" .
customer:Address2 a rdf:Property ;
rdfs:domain customer:Customer ;
rdfs:range xsd:string ;
rdfs:label "Address2" .
customer:City a rdf:Property ;
rdfs:domain customer:Customer ;
rdfs:range xsd:string ;
rdfs:label "City" .
customer:State a rdf:Property ;
rdfs:domain customer:Customer ;
rdfs:range xsd:string ;
rdfs:label "State" .
customer:Country a rdf:Property ;
rdfs:domain customer:Customer ;
rdfs:range xsd:string ;
rdfs:label "Country" .
customer:Phone a rdf:Property ;
rdfs:domain customer:Customer ;
rdfs:range xsd:string ;
rdfs:label "Phone" .
customer:Contact a rdf:Property ;
rdfs:domain customer:Customer ;
rdfs:range xsd:string ;
rdfs:label "Contact" .
customer:Sales-Rep a rdf:Property ;
rdfs:domain customer:Customer ;
rdfs:range xsd:string ;
rdfs:label "Sales-Rep" .
customer:Comments a rdf:Property ;
rdfs:domain customer:Customer ;
rdfs:range xsd:string ;
rdfs:label "Comments" .
customer:Credit-Limit a rdf:Property ;
rdfs:domain customer:Customer ;
rdfs:range xsd:decimal ;
rdfs:label "Credit-Limit" .
customer:Balance a rdf:Property ;
rdfs:domain customer:Customer ;
rdfs:range xsd:decimal ;
rdfs:label "Balance" .
customer:Terms a rdf:Property ;
rdfs:domain customer:Customer ;
rdfs:range xsd:string ;
rdfs:label "Terms" .
customer:Discount a rdf:Property ;
rdfs:domain customer:Customer ;
rdfs:range xsd:integer ;
rdfs:label "Discount" .
customer:Postal-Code a rdf:Property ;
rdfs:domain customer:Customer ;
rdfs:range xsd:string ;
rdfs:label "Postal-Code" .
order:Order a rdfs:Class ;
rdfs:label "Order" ;
rdfs:comment "Progress isports Order table" .
order:Order-num a rdf:Property ;
rdfs:domain order:Order ;
rdfs:range xsd:integer ;
rdfs:label "Order-num" .
order:Cust-Num a rdf:Property ;
rdfs:domain order:Order ;
rdfs:range xsd:integer ;
rdfs:label "Cust-Num" .
order:Order-Date a rdf:Property ;
rdfs:domain order:Order ;
rdfs:range xsd:date ;
rdfs:label "Order-Date" .
order:Ship-Date a rdf:Property ;
rdfs:domain order:Order ;
rdfs:range xsd:date ;
rdfs:label "Ship-Date" .
order:Promise-Date a rdf:Property ;
rdfs:domain order:Order ;
rdfs:range xsd:date ;
rdfs:label "Promise-Date" .
order:Carrier a rdf:Property ;
rdfs:domain order:Order ;
rdfs:range xsd:string ;
rdfs:label "Carrier" .
order:Instructions a rdf:Property ;
rdfs:domain order:Order ;
rdfs:range xsd:string ;
rdfs:label "Instructions" .
order:PO a rdf:Property ;
rdfs:domain order:Order ;
rdfs:range xsd:string ;
rdfs:label "PO" .
order:Terms a rdf:Property ;
rdfs:domain order:Order ;
rdfs:range xsd:string ;
rdfs:label "Terms" .
order:Sales-Rep a rdf:Property ;
rdfs:domain order:Order ;
rdfs:range xsd:string ;
rdfs:label "Sales-Rep" .
item:Item a rdfs:Class ;
rdfs:label "Item" ;
rdfs:comment "Progress isports Item table" .
item:Item-num a rdf:Property ;
rdfs:domain item:Item ;
rdfs:range xsd:integer ;
rdfs:label "Item-num" .
item:Item-Name a rdf:Property ;
rdfs:domain item:Item ;
rdfs:range xsd:string ;
rdfs:label "Item-Name" .
item:Cat-Page a rdf:Property ;
rdfs:domain item:Item ;
rdfs:range xsd:integer ;
rdfs:label "Cat-Page" .
item:Price a rdf:Property ;
rdfs:domain item:Item ;
rdfs:range xsd:decimal ;
rdfs:label "Price" .
item:Cat-Description a rdf:Property ;
rdfs:domain item:Item ;
rdfs:range xsd:string ;
rdfs:label "Cat-Description" .
item:On-hand a rdf:Property ;
rdfs:domain item:Item ;
rdfs:range xsd:integer ;
rdfs:label "On-hand" .
item:Allocated a rdf:Property ;
rdfs:domain item:Item ;
rdfs:range xsd:integer ;
rdfs:label "Allocated" .
item:Re-Order a rdf:Property ;
rdfs:domain item:Item ;
rdfs:range xsd:integer ;
rdfs:label "Re-Order" .
item:On-Order a rdf:Property ;
rdfs:domain item:Item ;
rdfs:range xsd:integer ;
rdfs:label "On-Order" .
orderline:Order-Line a rdfs:Class ;
rdfs:label "Order-Line" ;
rdfs:comment "Progress isports Order-Line table" .
orderline:Order-num a rdf:Property ;
rdfs:domain orderline:Order-Line ;
rdfs:range xsd:integer ;
rdfs:label "Order-num" .
orderline:Line-num a rdf:Property ;
rdfs:domain orderline:Order-Line ;
rdfs:range xsd:integer ;
rdfs:label "Line-num" .
orderline:Item-num a rdf:Property ;
rdfs:domain orderline:Order-Line ;
rdfs:range xsd:integer ;
rdfs:label "Item-num" .
orderline:Price a rdf:Property ;
rdfs:domain orderline:Order-Line ;
rdfs:range xsd:decimal ;
rdfs:label "Price" .
orderline:Qty a rdf:Property ;
rdfs:domain orderline:Order-Line ;
rdfs:range xsd:integer ;
rdfs:label "Qty" .
orderline:Discount a rdf:Property ;
rdfs:domain orderline:Order-Line ;
rdfs:range xsd:integer ;
rdfs:label "Discount" .
orderline:Extended-Price a rdf:Property ;
rdfs:domain orderline:Order-Line ;
rdfs:range xsd:decimal ;
rdfs:label "Extended-Price" .
orderline:Backorder a rdf:Property ;
rdfs:domain orderline:Order-Line ;
rdfs:range xsd:byte ;
rdfs:label "Backorder" .
invoice:Invoice a rdfs:Class ;
rdfs:label "Invoice" ;
rdfs:comment "Progress isports Invoice table" .
invoice:Invoice-Num a rdf:Property ;
rdfs:domain invoice:Invoice ;
rdfs:range xsd:integer ;
rdfs:label "Invoice-Num" .
invoice:Cust-Num a rdf:Property ;
rdfs:domain invoice:Invoice ;
rdfs:range xsd:integer ;
rdfs:label "Cust-Num" .
invoice:Invoice-Date a rdf:Property ;
rdfs:domain invoice:Invoice ;
rdfs:range xsd:date ;
rdfs:label "Invoice-Date" .
invoice:Amount a rdf:Property ;
rdfs:domain invoice:Invoice ;
rdfs:range xsd:decimal ;
rdfs:label "Amount" .
invoice:Total-Paid a rdf:Property ;
rdfs:domain invoice:Invoice ;
rdfs:range xsd:decimal ;
rdfs:label "Total-Paid" .
invoice:Adjustment a rdf:Property ;
rdfs:domain invoice:Invoice ;
rdfs:range xsd:decimal ;
rdfs:label "Adjustmant" .
invoice:Order-Num a rdf:Property ;
rdfs:domain invoice:Invoice ;
rdfs:range xsd:integer ;
rdfs:label "Order-Num" .
invoice:Ship-Charge a rdf:Property ;
rdfs:domain invoice:Invoice ;
rdfs:range xsd:decimal ;
rdfs:label "Ship-Charge" .
localdefault:Local-Default a rdfs:Class ;
rdfs:label "Local-Default" ;
rdfs:comment "Progress isports Local-Default table" .
localdefault:Country a rdf:Property ;
rdfs:domain localdefault:Local-Default ;
rdfs:range xsd:string ;
rdfs:label "Country" .
localdefault:Region1-Label a rdf:Property ;
rdfs:domain localdefault:Local-Default ;
rdfs:range xsd:string ;
rdfs:label "Region1-Label" .
localdefault:Region2-Label a rdf:Property ;
rdfs:domain localdefault:Local-Default ;
rdfs:range xsd:string ;
rdfs:label "Region2-Label" .
localdefault:Postal-Label a rdf:Property ;
rdfs:domain localdefault:Local-Default ;
rdfs:range xsd:string ;
rdfs:label "Postal-Label" .
localdefault:Postal-Format a rdf:Property ;
rdfs:domain localdefault:Local-Default ;
rdfs:range xsd:string ;
rdfs:label "Postal-Format" .
localdefault:Tel-Format a rdf:Property ;
rdfs:domain localdefault:Local-Default ;
rdfs:range xsd:string ;
rdfs:label "Tel-Format" .
localdefault:Date-Format a rdf:Property ;
rdfs:domain localdefault:Local-Default ;
rdfs:range xsd:string ;
rdfs:label "Date-Format" .
localdefault:Currency-Symbol a rdf:Property ;
rdfs:domain localdefault:Local-Default ;
rdfs:range xsd:string ;
rdfs:label "Currency-Symbol" .
refcall:Ref-Call a rdfs:Class ;
rdfs:label "Ref-Call" ;
rdfs:comment "Progress isports Ref-Call table" .
refcall:Call-Num a rdf:Property ;
rdfs:domain refcall:Ref-Call ;
rdfs:range xsd:string ;
rdfs:label "Call-Num" .
refcall:Cust-Num a rdf:Property ;
rdfs:domain refcall:Ref-Call ;
rdfs:range xsd:integer ;
rdfs:label "Cust-Num" .
refcall:Call-Date a rdf:Property ;
rdfs:domain refcall:Ref-Call ;
rdfs:range xsd:date ;
rdfs:label "Call-Date" .
refcall:Sales-Rep a rdf:Property ;
rdfs:domain refcall:Ref-Call ;
rdfs:range xsd:string ;
rdfs:label "Sales-Rep" .
refcall:Parent a rdf:Property ;
rdfs:domain refcall:Ref-Call ;
rdfs:range xsd:string ;
rdfs:label "Parent" .
refcall:Txt a rdf:Property ;
rdfs:domain refcall:Ref-Call ;
rdfs:range xsd:string ;
rdfs:label "Txt" .
salesrep:Salesrep a rdfs:Class ;
rdfs:label "Salesrep" ;
rdfs:comment "Progress isports Salesrep table" .
salesrep:Sales-Rep a rdf:Property ;
rdfs:domain salesrep:Salesrep ;
rdfs:range xsd:string ;
rdfs:label "Sales-Rep" .
salesrep:Rep-Name a rdf:Property ;
rdfs:domain salesrep:Salesrep ;
rdfs:range xsd:string ;
rdfs:label "Rep-Name" .
salesrep:Region a rdf:Property ;
rdfs:domain salesrep:Salesrep ;
rdfs:range xsd:string ;
rdfs:label "Region" .
salesrep:Month-Quota a rdf:Property ;
rdfs:domain salesrep:Salesrep ;
rdfs:range xsd:string ;
rdfs:label "Month-Quota" .
state:State a rdfs:Class ;
rdfs:label "State" ;
rdfs:comment "Progress isports State table" .
state:State_ a rdf:Property ;
rdfs:domain state:State ;
rdfs:range xsd:string ;
rdfs:label "State" .
state:State-Name a rdf:Property ;
rdfs:domain state:State ;
rdfs:range xsd:string ;
rdfs:label "State-Name" .
state:Region a rdf:Property ;
rdfs:domain state:State ;
rdfs:range xsd:string ;
rdfs:label "Region" .
', '', 'http://localhost:8890/schemas/progress/isports', 0);
----------- Create IRI Classes -------------
sparql
prefix customer: <http://localhost:8890/schemas/progress/isports/customer/>
prefix order: <http://localhost:8890/schemas/progress/isports/order/>
prefix item: <http://localhost:8890/schemas/progress/isports/item/>
prefix orderline: <http://localhost:8890/schemas/progress/isports/order_line/>
prefix invoice: <http://localhost:8890/schemas/progress/isports/invoice/>
prefix localdefault: <http://localhost:8890/schemas/progress/isports/local_default/>
prefix refcall: <http://localhost:8890/schemas/progress/isports/ref_call/>
prefix salesrep: <http://localhost:8890/schemas/progress/isports/salesrep/>
prefix state: <http://localhost:8890/schemas/progress/isports/state/>
create iri class customer:customer_iri
"http://localhost:8890/progress/isports/customer/%d#this"
(in Cust_Num integer not null) .
create iri class order:order_iri
"http://localhost:8890/progress/isports/order/%d#this"
(in Order_Num integer not null) .
create iri class item:item_iri
"http://localhost:8890/progress/isports/item/%d#this"
(in Item_num integer not null) .
create iri class orderline:order-line_iri
"http://localhost:8890/progress/isports/order-line/%d_%d#this"
(in Order_num integer not null, in Line_num integer not null) .
create iri class invoice:invoice_iri
"http://localhost:8890/progress/isports/invoice/%d#this"
(in Invoice_Num integer not null) .
create iri class localdefault:local-default_iri
"http://localhost:8890/progress/isports/local-default/%U#this"
(in Country varchar not null) .
create iri class refcall:ref-call_iri
"http://localhost:8890/progress/isports/ref-call/%U#this"
(in Call_Num varchar not null) .
create iri class salesrep:salesrep_iri
"http://localhost:8890/progress/isports/salesrep/%U#this"
(in Sales_Rep varchar not null) .
create iri class state:state_iri
"http://localhost:8890/progress/isports/state/%U#this"
(in State varchar not null) .
;
------------- Create Quad Store ------------------------------------
sparql
prefix customer: <http://localhost:8890/schemas/progress/isports/customer/>
prefix order: <http://localhost:8890/schemas/progress/isports/order/>
prefix item: <http://localhost:8890/schemas/progress/isports/item/>
prefix orderline: <http://localhost:8890/schemas/progress/isports/order_line/>
prefix invoice: <http://localhost:8890/schemas/progress/isports/invoice/>
prefix localdefault: <http://localhost:8890/schemas/progress/isports/local_default/>
prefix refcall: <http://localhost:8890/schemas/progress/isports/ref_call/>
prefix salesrep: <http://localhost:8890/schemas/progress/isports/salesrep/>
prefix state: <http://localhost:8890/schemas/progress/isports/state/>
alter quad storage virtrdf:DefaultQuadStorage
from isports_rdf.prs10_isports_rdf.VCustomer as Customer_tbl
from isports_rdf.prs10_isports_rdf.VOrder as Order_tbl
from isports_rdf.prs10_isports_rdf.VItem as Item_tbl
from isports_rdf.prs10_isports_rdf.VOrder_Line as Order_Line_tbl
from isports_rdf.prs10_isports_rdf.VInvoice as Invoice_tbl
from isports_rdf.prs10_isports_rdf.VRef_Call as Ref_Call_tbl
from isports_rdf.prs10_isports_rdf.VRef_Call as Ref_Call_tbl_1 -- Additional Ref_Call_tbl_1 alias required to represent recursive FK relationship (refcall:has_parent) below.
from isports_rdf.prs10_isports_rdf.VLocal_Default as Local_Default_tbl
from isports_rdf.prs10_isports_rdf.VSalesrep as Salesrep_tbl
from isports_rdf.prs10_isports_rdf.VState as State_tbl
{
create virtrdf:progress_isports as graph <http://localhost:8890/progress/isports>
{
customer:customer_iri (Customer_tbl.Cust_Num) a customer:Customer as virtrdf:customer_pk ;
customer:Cust-Num Customer_tbl.Cust_Num as virtrdf:Customer_cust-num ;
customer:Name Customer_tbl.Name as virtrdf:Customer_name ;
customer:Address Customer_tbl.Address as virtrdf:Customer_address ;
customer:Address2 Customer_tbl.Address2 as virtrdf:Customer_address2 ;
customer:City Customer_tbl.City as virtrdf:Customer_city ;
customer:State Customer_tbl.State as virtrdf:Customer_state ;
customer:Country Customer_tbl.Country as virtrdf:Customer_country ;
customer:Phone Customer_tbl.Phone as virtrdf:Customer_phone ;
customer:Contact Customer_tbl.Contact as virtrdf:Customer_contact ;
customer:Sales-Rep Customer_tbl.Sales_Rep as virtrdf:Customer_sales_rep ;
customer:Comments Customer_tbl.Comments as virtrdf:Customer_comments ;
customer:Credit-Limit Customer_tbl.Credit_Limit as virtrdf:Customer_credit-limit ;
customer:Balance Customer_tbl.Balance as virtrdf:Customer_balance ;
customer:Terms Customer_tbl.Terms as virtrdf:Customer_terms ;
customer:Discount Customer_tbl.Discount as virtrdf:Customer_discount ;
customer:Postal-Code Customer_tbl.Postal_Code as virtrdf:Customer_postal-code ;
customer:from_state state:state_iri (State_tbl.State) where ( ^{Customer_tbl.}^.State = ^{State_tbl.}^.State ) as virtrdf:Customer_from_state ;
customer:has_sales_rep salesrep:salesrep_iri (Salesrep_tbl.Sales_Rep) where ( ^{Customer_tbl.}^.Sales_Rep = ^{Salesrep_tbl.}^.Sales_Rep ) as virtrdf:Customer_has_sales_rep ;
customer:has_local_default localdefault:local-default_iri (Local_Default_tbl.Country) where ( ^{Customer_tbl.}^.Country = ^{Local_Default_tbl.}^.Country ) as virtrdf:Customer_has_local_default ;
customer:placed_order order:order_iri (Order_tbl.Order_num) where ( ^{Customer_tbl.}^.Cust_Num = ^{Order_tbl.}^.Cust_Num ) as virtrdf:Customer_placed_order ;
customer:has_invoice invoice:invoice_iri (Invoice_tbl.Invoice_Num) where ( ^{Customer_tbl.}^.Cust_Num = ^{Invoice_tbl.}^.Cust_Num ) as virtrdf:Customer_has_invoice ;
customer:ref_call refcall:ref-call_iri (Ref_Call_tbl.Call_Num) where ( ^{Customer_tbl.}^.Cust_Num = ^{Ref_Call_tbl.}^.Cust_Num ) as virtrdf:Customer_ref-call .
order:order_iri (Order_tbl.Order_num) a order:Order as virtrdf:order_pk ;
order:Order-num Order_tbl.Order_num as virtrdf:Order_order-num ;
order:Cust-Num Order_tbl.Cust_Num as virtrdf:Order_cust_num ;
order:Order-Date Order_tbl.Order_Date as virtrdf:Order_order-date ;
order:Ship-Date Order_tbl.Ship_Date as virtrdf:Order_ship-date ;
order:Promise-Date Order_tbl.Promise_Date as virtrdf:Order_promise-date ;
order:Carrier Order_tbl.Carrier as virtrdf:Order_carrier ;
order:Instructions Order_tbl.Instructions as virtrdf:Order_instructions ;
order:PO Order_tbl.PO as virtrdf:Order_po ;
order:Terms Order_tbl.Terms as virtrdf:Order_terms ;
order:placed_by customer:customer_iri (Customer_tbl.Cust_Num) where ( ^{Order_tbl.}^.Cust_Num = ^{Customer_tbl.}^.Cust_Num ) as virtrdf:Order_placed_by ;
order:Sales-Rep salesrep:salesrep_iri (Salesrep_tbl.Sales_Rep) where ( ^{Order_tbl.}^.Sales_Rep = ^{Salesrep_tbl.}^.Sales_Rep ) as virtrdf:Order_sales_rep ;
order:invoiced_on invoice:invoice_iri (Invoice_tbl.Invoice_Num) where ( ^{Order_tbl.}^.Order_num = ^{Invoice_tbl.}^.Order_Num ) as virtrdf:Order_invoiced_on ;
order:has_lines orderline:order-line_iri (Order_Line_tbl.Order_num, Order_Line_tbl.Line_num) where ( ^{Order_tbl.}^.Order_num = ^{Order_Line_tbl.}^.Order_num ) as virtrdf:Order_has_lines .
item:item_iri (Item_tbl.Item_num) a item:Item as virtrdf:item_pk ;
item:Item-num Item_tbl.Item_num as virtrdf:item_item-num ;
item:Item-Name Item_tbl.Item_Name as virtrdf:Item_item-Name ;
item:Cat-Page Item_tbl.Cat_Page as virtrdf:Item_cat-page ;
item:Price Item_tbl.Price as virtrdf:Item_price ;
item:Cat-Description Item_tbl.Cat_Description as virtrdf:Item_cat-description ;
item:On-hand Item_tbl.On_hand as virtrdf:Item_on-hand ;
item:Allocated Item_tbl.Allocated as virtrdf:Item_allocated ;
item:Re-Order Item_tbl.Re_Order as virtrdf:Item_re-order ;
item:On-Order Item_tbl.On_Order as virtrdf:Item_on-order ;
item:order_line orderline:order-line_iri (Order_Line_tbl.Order_num, Order_Line_tbl.Line_num) where ( ^{Item_tbl.}^.Item_num = ^{Order_Line_tbl.}^.Item_num ) as virtrdf:Item_order_line .
orderline:order-line_iri (Order_Line_tbl.Order_num, Order_Line_tbl.Line_num) a orderline:Order-Line as virtrdf:order-line_pk ;
orderline:Line-num Order_Line_tbl.Line_num as virtrdf:Order-Line_line-num ;
orderline:Price Order_Line_tbl.Price as virtrdf:Order-Line_price ;
orderline:Qty Order_Line_tbl.Qty as virtrdf:Order-Line_qty ;
orderline:Discount Order_Line_tbl.Discount as virtrdf:Order-Line_discount ;
orderline:Extended-Price Order_Line_tbl.Extended_Price as virtrdf:Order-Line_extended-price ;
orderline:Backorder Order_Line_tbl.Backorder as virtrdf:Order-Line_backorder ;
orderline:Order-num order:order_iri (Order_tbl.Order_num) where ( ^{Order_Line_tbl.}^.Order_num = ^{Order_tbl.}^.Order_num ) as virtrdf:Order_Line_order_num ;
orderline:Item-num item:item_iri (Item_tbl.Item_num) where ( ^{Order_Line_tbl.}^.Item_num = ^{Item_tbl.}^.Item_num ) as virtrdf:Order_Line_item_num .
invoice:invoice_iri (Invoice_tbl.Invoice_Num) a invoice:Invoice as virtrdf:invoice_pk ;
invoice:Invoice-Num Invoice_tbl.Invoice_Num as virtrdf:Invoice_invoice-num ;
invoice:Cust-Num Invoice_tbl.Cust_Num as virtrdf:Invoice_cust_num ;
invoice:Invoice-Date Invoice_tbl.Invoice_Date as virtrdf:Invoice_invoice-date ;
invoice:Amount Invoice_tbl.Amount as virtrdf:Invoice_amount ;
invoice:Total-Paid Invoice_tbl.Total_Paid as virtrdf:Invoice_total-paid ;
invoice:Adjustment Invoice_tbl.Adjustment as virtrdf:Invoice_adjustment ;
invoice:Order-Num Invoice_tbl.Order_Num as virtrdf:Invoice_order-num ;
invoice:Ship-Charge Invoice_tbl.Ship_Charge as virtrdf:Invoice_ship-charge ;
invoice:invoiced_to customer:customer_iri (Customer_tbl.Cust_Num) where ( ^{Invoice_tbl.}^.Cust_Num = ^{Customer_tbl.}^.Cust_Num ) as virtrdf:Invoice_invoiced_to ;
invoice:Order-Num order:order_iri (Order_tbl.Order_num) where ( ^{Invoice_tbl.}^.Order_Num = ^{Order_tbl.}^.Order_num ) as virtrdf:Invoice_order_num .
localdefault:local-default_iri (Local_Default_tbl.Country) a localdefault:Local-Default as virtrdf:local-default_pk ;
localdefault:Country Local_Default_tbl.Country as virtrdf:local-default_country ;
localdefault:Region1-Label Local_Default_tbl.Region1_Label as virtrdf:Local-Default_region1-label ;
localdefault:Region2-Label Local_Default_tbl.Region2_Label as virtrdf:Local-Default_region2-label ;
localdefault:Postal-Label Local_Default_tbl.Postal_Label as virtrdf:Local-Default_postal-label ;
localdefault:Postal-Format Local_Default_tbl.Postal_Format as virtrdf:Local-Default_postal-format ;
localdefault:Tel-Format Local_Default_tbl.Tel_Format as virtrdf:Local-Default_tel-format ;
localdefault:Date-Format Local_Default_tbl.Date_Format as virtrdf:Local-Default_date-format ;
localdefault:Currency-Symbol Local_Default_tbl.Currency_Symbol as virtrdf:Local-Default_currency-symbol ;
localdefault:has_customer customer:customer_iri (Customer_tbl.Cust_Num) where ( ^{Local_Default_tbl.}^.Country = ^{Customer_tbl.}^.Country ) as virtrdf:Local-Default_has_customer .
refcall:ref-call_iri (Ref_Call_tbl.Call_Num) a refcall:Ref-Call as virtrdf:ref-call_pk ;
refcall:Call-Num Ref_Call_tbl.Call_Num as virtrdf:Ref-Call_call-num ;
refcall:Cust-Num Ref_Call_tbl.Cust_Num as virtrdf:Ref-Call_cust-num ;
refcall:Call-Date Ref_Call_tbl.Call_Date as virtrdf:Ref-Call_call-date ;
refcall:Sales-Rep Ref_Call_tbl.Sales_Rep as virtrdf:Ref-sales-rep ;
refcall:Parent Ref_Call_tbl.Parent as virtrdf:Ref-Call_parent ;
refcall:Txt Ref_Call_tbl.Txt as virtrdf:Ref-Call_txt ;
refcall:made_to customer:customer_iri (Customer_tbl.Cust_Num) where ( ^{Ref_Call_tbl.}^.Cust_Num = ^{Customer_tbl.}^.Cust_Num ) as virtrdf:Ref-Call_made_to ;
refcall:made_by salesrep:salesrep_iri (Salesrep_tbl.Sales_Rep) where ( ^{Ref_Call_tbl.}^.Sales_Rep = ^{Salesrep_tbl.}^.Sales_Rep ) as virtrdf:Ref-Call_made-by ;
refcall:has_parent refcall:ref-call_iri (Ref_Call_tbl_1.Call_Num) where ( ^{Ref_Call_tbl.}^.Parent = ^{Ref_Call_tbl_1.}^.Call_Num ) as virtrdf:Ref-Call_has_parent .
salesrep:salesrep_iri (Salesrep_tbl.Sales_Rep) a salesrep:Salesrep as virtrdf:salesrep_pk ;
salesrep:Sales-Rep Salesrep_tbl.Sales_Rep as virtrdf:Salesrep_sales-rep ;
salesrep:Region Salesrep_tbl.Region as virtrdf:Salesrep_region ;
salesrep:Rep-Name Salesrep_tbl.Rep_Name as virtrdf:Salesrep_rep-name ;
salesrep:Month-Quota Salesrep_tbl.Month_Quota as virtrdf:Salesrep_month-quota ;
salesrep:is_sales_rep_for customer:customer_iri (Customer_tbl.Cust_Num) where ( ^{Salesrep_tbl.}^.Sales_Rep = ^{Customer_tbl.}^.Sales_Rep ) as virtrdf:Salesrep_is_sales_rep_for ;
salesrep:has_order order:order_iri (Order_tbl.Order_num) where ( ^{Salesrep_tbl.}^.Sales_Rep = ^{Order_tbl.}^.Sales_Rep ) as virtrdf:Salesrep_has_order ;
salesrep:manages_region state:state_iri (State_tbl.State) where ( ^{Salesrep_tbl.}^.Region = ^{State_tbl.}^.Region ) as virtrdf:Salesrep_manages_region ;
salesrep:made_call refcall:ref-call_iri (Ref_Call_tbl.Call_Num) where ( ^{Salesrep_tbl.}^.Sales_Rep = ^{Ref_Call_tbl.}^.Sales_Rep ) as virtrdf:Ref-Call_made_call .
state:state_iri (State_tbl.State) a state:State as virtrdf:state_pk ;
state:State_ State_tbl.State as virtrdf:State_state ;
state:State-Name State_tbl.State_Name as virtrdf:State_state-name ;
state:Region State_tbl.Region as virtrdf:State_region ;
state:has_customer customer:customer_iri (Customer_tbl.Cust_Num) where ( ^{State_tbl.}^.State = ^{Customer_tbl.}^.State ) as virtrdf:State_has_customer ;
state:has_sales_rep salesrep:salesrep_iri (Salesrep_tbl.Sales_Rep) where ( ^{State_tbl.}^.Region = ^{Salesrep_tbl.}^.Region ) as virtrdf:State_has_sales_rep .
} .
} .
;
-- Setup re-write rules that enable de-referencing of RDF based descriptions of
-- iSports Entities
-- Cleanup old rules
delete from db.dba.url_rewrite_rule_list where urrl_list like 'progress_isports_rule%';
delete from db.dba.url_rewrite_rule where urr_rule like 'progress_isports_rule%';
-- Create rules for handling HTML representation of Entity (resource) description requests
DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
'progress_isports_rule1',
1,
'(/[^#]*)',
vector('path'),
1,
'/about/html/http://^{URIQADefaultHost}^%s',
vector('path'),
null,
'(text/html)|(\\*/\\*)',
0,
303
);
-- Create rules for handling RDF based representations (N3 or RDF/XML) of Entity (resource) descriptions
DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
'progress_isports_rule2',
1,
'(/[^#]*)',
vector('path'),
1,
'/sparql?query=DESCRIBE+%%3Chttp%%3A//localhost%%3A8890%U%%23this%%3E+%%3Chttp%%3A//localhost%%3A8890%U%%23this%%3E+FROM+%%3Chttp%%3A//localhost%%3A8890/progress/isports%%3E&format=%U',
vector('path', 'path', '*accept*'),
null,
'(text/rdf.n3)|(application/rdf.xml)',
0,
null
);
DB.DBA.URLREWRITE_CREATE_RULELIST (
'progress_isports_rule_list1',
1,
vector (
'progress_isports_rule1',
'progress_isports_rule2'
));
-- Setup OWL ontology data space that describes iSports entities
-- Create Virtual Directory access point
VHOST_REMOVE (lpath=>'/progress/isports');
VHOST_DEFINE (
lpath=>'/progress/isports',
ppath=>'/DAV/progress/isports/',
is_dav=>1,
vsp_user=>'dba',
is_brws=>0,
opts=>vector ('url_rewrite', 'progress_isports_rule_list1')
);
delete from db.dba.url_rewrite_rule_list where urrl_list like 'progress_isports_schemas_rule%';
delete from db.dba.url_rewrite_rule where urr_rule like 'progress_isports_schemas_rule%';
DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
'progress_isports_schemas_rule1',
1,
'(/[^#]*)',
vector('path'),
1,
'/about/html/http://^{URIQADefaultHost}^%s',
vector('path'),
null,
'(text/html)|(\\*/\\*)',
0,
303
);
DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
'progress_isports_schemas_rule2',
1,
'(/[^#]*)',
vector('path'),
1,
'/sparql?query=CONSTRUCT+{+%%3Chttp%%3A//localhost%%3A8890%U%%3E+%%3Fp+%%3Fo+}%%0D%%0AFROM+%%3Chttp%%3A//localhost%%3A8890/schemas/progress/isports%%3E+%%0D%%0AWHERE+{+%%3Chttp%%3A//localhost%%3A8890%U%%3E+%%3Fp+%%3Fo+}&format=%U',
vector('path','path','*accept*'),
null,
'(text/rdf.n3)|(application/rdf.xml)',
0,
null
);
DB.DBA.URLREWRITE_CREATE_RULELIST (
'progress_isports_schemas_rule_list1',
1,
vector (
'progress_isports_schemas_rule1',
'progress_isports_schemas_rule2'
));
-- ensure a VD for the IRIs which begins with /
VHOST_REMOVE (lpath=>'/schemas/progress/isports');
VHOST_DEFINE (
lpath=>'/schemas/progress/isports',
ppath=>'/DAV/schemas/progress/isports/',
is_dav=>1,
vsp_user=>'dba',
is_brws=>0,
opts=>vector ('url_rewrite', 'progress_isports_schemas_rule_list1')
);
DB.DBA.XML_SET_NS_DECL ('customer', 'http://^{URIQADefaultHost}^/schemas/progress/isports/customer/', 2);
DB.DBA.XML_SET_NS_DECL ('order', 'http://^{URIQADefaultHost}^/schemas/progress/isports/order/', 2);
DB.DBA.XML_SET_NS_DECL ('item', 'http://^{URIQADefaultHost}^/schemas/progress/isports/item/', 2);
DB.DBA.XML_SET_NS_DECL ('orderline', 'http://^{URIQADefaultHost}^/schemas/progress/isports/order_line/', 2);
DB.DBA.XML_SET_NS_DECL ('invoice', 'http://^{URIQADefaultHost}^/schemas/progress/isports/invoice/', 2);
DB.DBA.XML_SET_NS_DECL ('localdefault', 'http://^{URIQADefaultHost}^/schemas/progress/isports/local_default/', 2);
DB.DBA.XML_SET_NS_DECL ('refcall', 'http://^{URIQADefaultHost}^/schemas/progress/isports/ref_call/', 2);
DB.DBA.XML_SET_NS_DECL ('salesrep', 'http://^{URIQADefaultHost}^/schemas/progress/isports/salesrep/', 2);
DB.DBA.XML_SET_NS_DECL ('state', 'http://^{URIQADefaultHost}^/schemas/progress/isports/state/', 2);