
sparql clear graph <http://demo.com/>;
sparql clear graph <http://temp/artist>;
sparql clear graph <http://temp/categories>;
sparql clear graph <http://temp/countries>;
sparql clear graph <http://temp/customers>;
sparql clear graph <http://temp/employees>;
sparql clear graph <http://temp/order_details>;
sparql clear graph <http://temp/orders>;
sparql clear graph <http://temp/products>;
sparql clear graph <http://temp/provinces>;
sparql clear graph <http://temp/shippers>;
sparql clear graph <http://temp/suppliers>;
sparql clear graph <http://temp/workofart>;
sparql clear graph <http://temp/workofarttype>;
sparql clear graph <http://temp/mix>;


DB.DBA.TTLP ('
@prefix rr: <http://www.w3.org/ns/r2rml#> .
@prefix exa: <http://demo.com/ns#> .
@prefix artist: <http://demo.com/artist#> .

<http://demo.com/ns#TriplesMap1>
    a rr:TriplesMap;

    rr:logicalTable 
    [ 
      rr:tableSchema "Demo"; 
      rr:tableOwner "demo"; 
      rr:tableName  "Artist" 
    ];

    rr:subjectMap 
    [ 
      rr:template "http://demo.com/artist/{ArtistID}";
      rr:class exa:Artist;
      rr:graph <http://demo.com/>
    ];

    rr:predicateObjectMap
    [
      rr:predicate artist:ArtistID;
      rr:objectMap [ rr:column "ArtistID"; ]
    ];
    
    rr:predicateObjectMap
    [
      rr:predicate artist:CountryCode;
      rr:objectMap [ rr:column "CountryCode"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate artist:Name;
      rr:objectMap [ rr:column "Name"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate artist:CountryCode_FK;
      rr:objectMap [ 
                     rr:parentTriplesMap <http://demo.com/ns#TriplesMap3>; 
                     rr:joinCondition 
                     [
                       rr:child "CountryCode";
                       rr:parent "Code";
                     ];
                   ];
    ];

.
', 'http://temp/artist', 'http://temp/artist', 4096 );



DB.DBA.TTLP ('
@prefix rr: <http://www.w3.org/ns/r2rml#> .
@prefix exa: <http://demo.com/ns#> .
@prefix categories: <http://demo.com/categories#> .

<http://demo.com/ns#TriplesMap2>
    a rr:TriplesMap;

    rr:logicalTable 
    [ 
      rr:tableSchema "Demo"; 
      rr:tableOwner "demo"; 
      rr:tableName  "Categories" 
    ];

    rr:subjectMap 
    [ 
      rr:template "http://demo.com/categories/{CategoryID}";
      rr:class exa:Categories;
      rr:graph <http://demo.com/>
    ];

    rr:predicateObjectMap
    [
      rr:predicate categories:CategoryID;
      rr:objectMap [ rr:column "CategoryID"; ]
    ];
    
    rr:predicateObjectMap
    [
      rr:predicate categories:CategoryName;
      rr:objectMap [ rr:column "CategoryName"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate categories:Description;
      rr:objectMap [ rr:column "Description"; ]
    ];
.
', 'http://temp/categories', 'http://temp/categories', 4096 );


DB.DBA.TTLP ('
@prefix rr: <http://www.w3.org/ns/r2rml#> .
@prefix exa: <http://demo.com/ns#> .
@prefix countries: <http://demo.com/countries#> .

<http://demo.com/ns#TriplesMap3>
    a rr:TriplesMap;

    rr:logicalTable 
    [ 
      rr:tableSchema "Demo"; 
      rr:tableOwner "demo"; 
      rr:tableName  "Countries" 
    ];

    rr:subjectMap 
    [ 
      rr:template "http://demo.com/countries/{Name}";
      rr:class exa:Countries;
      rr:graph <http://demo.com/>
    ];

    rr:predicateObjectMap
    [
      rr:predicate countries:Name;
      rr:objectMap [ rr:column "Name"; ]
    ];
    
    rr:predicateObjectMap
    [
      rr:predicate countries:Code;
      rr:objectMap [ rr:column "Code"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate countries:SmallFlagDAVResourceName;
      rr:objectMap [ rr:column "SmallFlagDAVResourceName"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate countries:LargeFlagDAVResourceName;
      rr:objectMap [ rr:column "LargeFlagDAVResourceName"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate countries:SmallFlagDAVResourceURI;
      rr:objectMap [ rr:column "SmallFlagDAVResourceURI"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate countries:LargeFlagDAVResourceURI;
      rr:objectMap [ rr:column "LargeFlagDAVResourceURI"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate countries:Lat;
      rr:objectMap [ rr:column "Lat"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate countries:Lng;
      rr:objectMap [ rr:column "Lng"; ]
    ];
.
', 'http://temp/countries', 'http://temp/countries', 4096 );



DB.DBA.TTLP ('
@prefix rr: <http://www.w3.org/ns/r2rml#> .
@prefix exa: <http://demo.com/ns#> .
@prefix customers: <http://demo.com/customers#> .

<http://demo.com/ns#TriplesMap4>
    a rr:TriplesMap;

    rr:logicalTable 
    [ 
      rr:tableSchema "Demo"; 
      rr:tableOwner "demo"; 
      rr:tableName  "Customers" 
    ];

    rr:subjectMap 
    [ 
      rr:template "http://demo.com/customers/{CustomerID}";
      rr:class exa:Customers;
      rr:graph <http://demo.com/>;
    ];

    rr:predicateObjectMap
    [
      rr:predicate customers:CustomerID;
      rr:objectMap [ rr:column "CustomerID"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate customers:CompanyName;
      rr:objectMap [ rr:column "CompanyName"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate customers:ContactName;
      rr:objectMap [ rr:column "ContactName"; ]
    ];
    
    rr:predicateObjectMap
    [
      rr:predicate customers:ContactTitle;
      rr:objectMap [ rr:column "ContactTitle"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate customers:Address;
      rr:objectMap [ rr:column "Address"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate customers:City;
      rr:objectMap [ rr:column "City"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate customers:Region;
      rr:objectMap [ rr:column "Region"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate customers:PostalCode;
      rr:objectMap [ rr:column "PostalCode"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate customers:Country;
      rr:objectMap [ rr:column "Country"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate customers:CountryCode;
      rr:objectMap [ rr:column "CountryCode"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate customers:Phone;
      rr:objectMap [ rr:column "Phone"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate customers:Fax;
      rr:objectMap [ rr:column "Fax"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate customers:CountryCode_FK;
      rr:objectMap [ 
                     rr:parentTriplesMap <http://demo.com/ns#TriplesMap3>; 
                     rr:joinCondition 
                     [
                       rr:child "CountryCode";
                       rr:parent "Code";
                     ];
                   ];
    ];
.
', 'http://temp/customers', 'http://temp/customers', 4096 );



DB.DBA.TTLP ('
@prefix rr: <http://www.w3.org/ns/r2rml#> .
@prefix exa: <http://demo.com/ns#> .
@prefix employees: <http://demo.com/employees#> .

<http://demo.com/ns#TriplesMap5>
    a rr:TriplesMap;

    rr:logicalTable 
    [ 
      rr:tableSchema "Demo"; 
      rr:tableOwner "demo"; 
      rr:tableName  "Employees" 
    ];

    rr:subjectMap 
    [ 
      rr:template "http://demo.com/employees/{EmployeeID}";
      rr:class exa:Employees;
      rr:graph <http://demo.com/>
    ];

    rr:predicateObjectMap
    [
      rr:predicate employees:EmployeeID;
      rr:objectMap [ rr:column "EmployeeID"; ]
    ];
    
    rr:predicateObjectMap
    [
      rr:predicate employees:LastName;
      rr:objectMap [ rr:column "LastName"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate employees:FirstName;
      rr:objectMap [ rr:column "FirstName"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate employees:Title;
      rr:objectMap [ rr:column "Title"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate employees:TitleOfCourtesy;
      rr:objectMap [ rr:column "TitleOfCourtesy"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate employees:BirthDate;
      rr:objectMap [ rr:column "BirthDate"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate employees:HireDate;
      rr:objectMap [ rr:column "HireDate"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate employees:Address;
      rr:objectMap [ rr:column "Address"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate employees:City;
      rr:objectMap [ rr:column "City"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate employees:Region;
      rr:objectMap [ rr:column "Region"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate employees:PostalCode;
      rr:objectMap [ rr:column "PostalCode"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate employees:Country;
      rr:objectMap [ rr:column "Country"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate employees:CountryCode;
      rr:objectMap [ rr:column "CountryCode"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate employees:HomePhone;
      rr:objectMap [ rr:column "HomePhone"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate employees:Extension;
      rr:objectMap [ rr:column "Extension"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate employees:Notes;
      rr:objectMap [ rr:column "Notes"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate employees:ReportsTo;
      rr:objectMap [ rr:column "ReportsTo"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate employees:CountryCode_FK;
      rr:objectMap [ 
                     rr:parentTriplesMap <http://demo.com/ns#TriplesMap3>; 
                     rr:joinCondition 
                     [
                       rr:child "CountryCode";
                       rr:parent "Code";
                     ];
                   ];
    ];

    rr:predicateObjectMap
    [
      rr:predicate employees:ReportsTo_FK;
      rr:objectMap [ 
                     rr:parentTriplesMap <http://demo.com/ns#TriplesMap5>; 
                     rr:joinCondition 
                     [
                       rr:child "ReportsTo";
                       rr:parent "EmployeeID";
                     ];
                   ];
    ];

.
', 'http://temp/employees', 'http://temp/employees', 4096 );


DB.DBA.TTLP ('
@prefix rr: <http://www.w3.org/ns/r2rml#> .
@prefix exa: <http://demo.com/ns#> .
@prefix order_details: <http://demo.com/order_details#> .

<http://demo.com/ns#TriplesMap6>
    a rr:TriplesMap;

    rr:logicalTable 
    [ 
      rr:tableSchema "Demo"; 
      rr:tableOwner "demo"; 
      rr:tableName  "Order_Details" 
    ];

    rr:subjectMap 
    [ 
      rr:template "http://demo.com/order_details/{OrderID}_{ProductID}";
      rr:class exa:Order_Details;
      rr:graph <http://demo.com/>
    ];

    rr:predicateObjectMap
    [
      rr:predicate order_details:OrderID;
      rr:objectMap [ rr:column "OrderID"; ]
    ];
    
    rr:predicateObjectMap
    [
      rr:predicate order_details:ProductID;
      rr:objectMap [ rr:column "ProductID"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate order_details:ProductID_FK;
      rr:objectMap [ 
                     rr:parentTriplesMap <http://demo.com/ns#TriplesMap8>; 
                     rr:joinCondition 
                     [
                       rr:child "ProductID";
                       rr:parent "ProductID";
                     ];
                   ];
    ];

    rr:predicateObjectMap
    [
      rr:predicate order_details:UnitPrice;
      rr:objectMap [ rr:column "UnitPrice"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate order_details:Quantity;
      rr:objectMap [ rr:column "Quantity"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate order_details:Discount;
      rr:objectMap [ rr:column "Discount"; ]
    ];
.
', 'http://temp/order_details', 'http://temp/order_details', 4096 );


DB.DBA.TTLP ('
@prefix rr: <http://www.w3.org/ns/r2rml#> .
@prefix exa: <http://demo.com/ns#> .
@prefix orders: <http://demo.com/orders#> .

<http://demo.com/ns#TriplesMap7>
    a rr:TriplesMap;

    rr:logicalTable 
    [ 
      rr:tableSchema "Demo"; 
      rr:tableOwner "demo"; 
      rr:tableName  "Orders" 
    ];

    rr:subjectMap 
    [ 
      rr:template "http://demo.com/orders/{OrderID}";
      rr:class exa:Orders;
      rr:graph <http://demo.com/>
    ];

    rr:predicateObjectMap
    [
      rr:predicate orders:OrderID;
      rr:objectMap [ rr:column "OrderID"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate orders:Customer;
      rr:objectMap [ rr:column "CustomerID"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate orders:Customer_FK;
      rr:objectMap [ 
                     rr:parentTriplesMap <http://demo.com/ns#TriplesMap4>; 
                     rr:joinCondition 
                     [
                       rr:child "CustomerID";
                       rr:parent "CustomerID";
                     ];
                   ];
    ];

    rr:predicateObjectMap
    [
      rr:predicate orders:EmployeeID;
      rr:objectMap [ rr:column "EmployeeID"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate orders:Employee_FK;
      rr:objectMap [ 
                     rr:parentTriplesMap <http://demo.com/ns#TriplesMap5>; 
                     rr:joinCondition 
                     [
                       rr:child "EmployeeID";
                       rr:parent "EmployeeID";
                     ];
                   ];
    ];

    rr:predicateObjectMap
    [
      rr:predicate orders:OrderDate;
      rr:objectMap [ rr:column "OrderDate"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate orders:RequiredDate;
      rr:objectMap [ rr:column "RequiredDate"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate orders:ShippedDate;
      rr:objectMap [ rr:column "ShippedDate"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate orders:ShipVia;
      rr:objectMap [ rr:column "ShipVia"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate orders:Freight;
      rr:objectMap [ rr:column "Freight"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate orders:ShipName;
      rr:objectMap [ rr:column "ShipName"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate orders:ShipAddress;
      rr:objectMap [ rr:column "ShipAddress"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate orders:ShipRegion;
      rr:objectMap [ rr:column "ShipRegion"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate orders:ShipPostalCode;
      rr:objectMap [ rr:column "ShipPostalCode"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate orders:ShipCountry;
      rr:objectMap [ rr:column "ShipCountry"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate orders:ShipCountryCode;
      rr:objectMap [ rr:column "ShipCountryCode"; ]
    ];
.
', 'http://temp/orders', 'http://temp/orders', 4096 );



DB.DBA.TTLP ('
@prefix rr: <http://www.w3.org/ns/r2rml#> .
@prefix exa: <http://demo.com/ns#> .
@prefix products: <http://demo.com/products#> .

<http://demo.com/ns#TriplesMap8>
    a rr:TriplesMap;

    rr:logicalTable 
    [ 
      rr:tableSchema "Demo"; 
      rr:tableOwner "demo"; 
      rr:tableName  "Products" 
    ];

    rr:subjectMap 
    [ 
      rr:template "http://demo.com/products/{ProductID}";
      rr:class exa:Products;
      rr:graph <http://demo.com/>
    ];

    rr:predicateObjectMap
    [
      rr:predicate products:ProductID;
      rr:objectMap [ rr:column "ProductID"; ]
    ];
    
    rr:predicateObjectMap
    [
      rr:predicate products:ProductName;
      rr:objectMap [ rr:column "ProductName"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate products:SupplierID;
      rr:objectMap [ rr:column "SupplierID"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate products:SupplierID_FK;
      rr:objectMap [ 
                     rr:parentTriplesMap <http://demo.com/ns#TriplesMap11>; 
                     rr:joinCondition 
                     [
                       rr:child "SupplierID";
                       rr:parent "SupplierID";
                     ];
                   ];
    ];

    rr:predicateObjectMap
    [
      rr:predicate products:CategoryID;
      rr:objectMap [ rr:column "CategoryID"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate products:CategoryID_FK;
      rr:objectMap [ 
                     rr:parentTriplesMap <http://demo.com/ns#TriplesMap2>; 
                     rr:joinCondition 
                     [
                       rr:child "CategoryID";
                       rr:parent "CategoryID";
                     ];
                   ];
    ];

    rr:predicateObjectMap
    [
      rr:predicate products:QuantityPerUnit;
      rr:objectMap [ rr:column "QuantityPerUnit"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate products:UnitPrice;
      rr:objectMap [ rr:column "UnitPrice"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate products:UnitsInStock;
      rr:objectMap [ rr:column "UnitsInStock"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate products:UnitsOnOrder;
      rr:objectMap [ rr:column "UnitsOnOrder"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate products:ReorderLevel;
      rr:objectMap [ rr:column "ReorderLevel"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate products:Discontinued;
      rr:objectMap [ rr:column "Discontinued"; ]
    ];
.
', 'http://temp/products', 'http://temp/products', 4096 );


DB.DBA.TTLP ('
@prefix rr: <http://www.w3.org/ns/r2rml#> .
@prefix exa: <http://demo.com/ns#> .
@prefix provinces: <http://demo.com/provinces#> .

<http://demo.com/ns#TriplesMap9>
    a rr:TriplesMap;

    rr:logicalTable 
    [ 
      rr:tableSchema "Demo"; 
      rr:tableOwner "demo"; 
      rr:tableName  "Provinces" 
    ];

    rr:subjectMap 
    [ 
      rr:template "http://demo.com/provinces/{CountryCode}_{Province}";
      rr:class exa:Provinces;
      rr:graph <http://demo.com/>
    ];

    rr:predicateObjectMap
    [
      rr:predicate provinces:CountryCode;
      rr:objectMap [ rr:column "CountryCode"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate provinces:CountryCode_FK;
      rr:objectMap [ 
                     rr:parentTriplesMap <http://demo.com/ns#TriplesMap3>; 
                     rr:joinCondition 
                     [
                       rr:child "CountryCode";
                       rr:parent "Code";
                     ];
                   ];
    ];
    
    rr:predicateObjectMap
    [
      rr:predicate provinces:Province;
      rr:objectMap [ rr:column "Province"; ]
    ];
.
', 'http://temp/provinces', 'http://temp/provinces', 4096 );


DB.DBA.TTLP ('
@prefix rr: <http://www.w3.org/ns/r2rml#> .
@prefix exa: <http://demo.com/ns#> .
@prefix shippers: <http://demo.com/shippers#> .

<http://demo.com/ns#TriplesMap10>
    a rr:TriplesMap;

    rr:logicalTable 
    [ 
      rr:tableSchema "Demo"; 
      rr:tableOwner "demo"; 
      rr:tableName  "Shippers" 
    ];

    rr:subjectMap 
    [ 
      rr:template "http://demo.com/shippers/{ShipperID}";
      rr:class exa:Shippers;
      rr:graph <http://demo.com/>
    ];

    rr:predicateObjectMap
    [
      rr:predicate shippers:ShipperID;
      rr:objectMap [ rr:column "ShipperID"; ]
    ];
    
    rr:predicateObjectMap
    [
      rr:predicate shippers:CompanyName;
      rr:objectMap [ rr:column "CompanyName"; ]
    ];
    
    rr:predicateObjectMap
    [
      rr:predicate shippers:Phone;
      rr:objectMap [ rr:column "Phone"; ]
    ];
.
', 'http://temp/shippers', 'http://temp/shippers', 4096 );


DB.DBA.TTLP ('
@prefix rr: <http://www.w3.org/ns/r2rml#> .
@prefix exa: <http://demo.com/ns#> .
@prefix suppliers: <http://demo.com/suppliers#> .

<http://demo.com/ns#TriplesMap11>
    a rr:TriplesMap;

    rr:logicalTable 
    [ 
      rr:tableSchema "Demo"; 
      rr:tableOwner "demo"; 
      rr:tableName  "Suppliers" 
    ];

    rr:subjectMap 
    [ 
      rr:template "http://demo.com/suppliers/{SupplierID}";
      rr:class exa:Suppliers;
      rr:graph <http://demo.com/>
    ];

    rr:predicateObjectMap
    [
      rr:predicate suppliers:SupplierID;
      rr:objectMap [ rr:column "SupplierID"; ]
    ];
    
    rr:predicateObjectMap
    [
      rr:predicate suppliers:CompanyName;
      rr:objectMap [ rr:column "CompanyName"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate suppliers:ContactName;
      rr:objectMap [ rr:column "ContactName"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate suppliers:ContactTitle;
      rr:objectMap [ rr:column "ContactTitle"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate suppliers:Address;
      rr:objectMap [ rr:column "Address"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate suppliers:City;
      rr:objectMap [ rr:column "City"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate suppliers:Region;
      rr:objectMap [ rr:column "Region"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate suppliers:PostalCode;
      rr:objectMap [ rr:column "PostalCode"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate suppliers:Country;
      rr:objectMap [ rr:column "Country"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate suppliers:CountryCode;
      rr:objectMap [ rr:column "CountryCode"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate suppliers:CountryCode_FK;
      rr:objectMap [ 
                     rr:parentTriplesMap <http://demo.com/ns#TriplesMap3>; 
                     rr:joinCondition 
                     [
                       rr:child "CountryCode";
                       rr:parent "Code";
                     ];
                   ];
    ];

    rr:predicateObjectMap
    [
      rr:predicate suppliers:Phone;
      rr:objectMap [ rr:column "Phone"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate suppliers:Fax;
      rr:objectMap [ rr:column "Fax"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate suppliers:HomePage;
      rr:objectMap [ rr:column "HomePage"; ]
    ];
.
', 'http://temp/suppliers', 'http://temp/suppliers', 4096 );


DB.DBA.TTLP ('
@prefix rr: <http://www.w3.org/ns/r2rml#> .
@prefix exa: <http://demo.com/ns#> .
@prefix workofart: <http://demo.com/workofart#> .

<http://demo.com/ns#TriplesMap12>
    a rr:TriplesMap;

    rr:logicalTable 
    [ 
      rr:tableSchema "Demo"; 
      rr:tableOwner "demo"; 
      rr:tableName  "WorkOfArt" 
    ];

    rr:subjectMap 
    [ 
      rr:template "http://demo.com/workofart/{WorkArtID}";
      rr:class exa:WorkOfArt;
      rr:graph <http://demo.com/>
    ];

    rr:predicateObjectMap
    [
      rr:predicate workofart:WorkArtID;
      rr:objectMap [ rr:column "WorkArtID"; ]
    ];
    
    rr:predicateObjectMap
    [
      rr:predicate workofart:CountryCode;
      rr:objectMap [ rr:column "CountryCode"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate workofart:CountryCode_FK;
      rr:objectMap [ 
                     rr:parentTriplesMap <http://demo.com/ns#TriplesMap3>; 
                     rr:joinCondition 
                     [
                       rr:child "CountryCode";
                       rr:parent "Code";
                     ];
                   ];
    ];

    rr:predicateObjectMap
    [
      rr:predicate workofart:WorkArtType;
      rr:objectMap [ rr:column "WorkArtType"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate workofart:WorkArtType_FK;
      rr:objectMap [ 
                     rr:parentTriplesMap <http://demo.com/ns#TriplesMap13>; 
                     rr:joinCondition 
                     [
                       rr:child "WorkArtType";
                       rr:parent "WorkArtTypeID";
                     ];
                   ];
    ];

    rr:predicateObjectMap
    [
      rr:predicate workofart:ArtistID;
      rr:objectMap [ rr:column "ArtistID"; ]
    ];

    rr:predicateObjectMap
    [
      rr:predicate workofart:ArtistID_FK;
      rr:objectMap [ 
                     rr:parentTriplesMap <http://demo.com/ns#TriplesMap1>; 
                     rr:joinCondition 
                     [
                       rr:child "ArtistID";
                       rr:parent "ArtistID";
                     ];
                   ];
    ];

    rr:predicateObjectMap
    [
      rr:predicate workofart:PhotoDAVResourceName;
      rr:objectMap [ rr:column "PhotoDAVResourceName"; ]
    ];
    rr:predicateObjectMap
    [
      rr:predicate workofart:PhotoDAVResourceURI;
      rr:objectMap [ rr:column "PhotoDAVResourceURI"; ]
    ];
    rr:predicateObjectMap
    [
      rr:predicate workofart:Description;
      rr:objectMap [ rr:column "Description"; ]
    ];
.
', 'http://temp/workofart', 'http://temp/workofart', 4096 );


DB.DBA.TTLP ('
@prefix rr: <http://www.w3.org/ns/r2rml#> .
@prefix exa: <http://demo.com/ns#> .
@prefix workofarttype: <http://demo.com/workofarttype#> .

<http://demo.com/ns#TriplesMap13>
    a rr:TriplesMap;

    rr:logicalTable 
    [ 
      rr:tableSchema "Demo"; 
      rr:tableOwner "demo"; 
      rr:tableName  "WorkOfArtType" 
    ];

    rr:subjectMap 
    [ 
      rr:template "http://demo.com/workofarttype/{WorkArtTypeID}";
      rr:class exa:WorkOfArtType;
      rr:graph <http://demo.com/>
    ];

    rr:predicateObjectMap
    [
      rr:predicate workofarttype:WorkArtTypeID;
      rr:objectMap [ rr:column "WorkArtTypeID"; ]
    ];
    
    rr:predicateObjectMap
    [
      rr:predicate workofarttype:Description;
      rr:objectMap [ rr:column "Description"; ]
    ];
.
', 'http://temp/workofarttype', 'http://temp/workofarttype', 4096 );


sparql insert in graph <http://temp/mix> { ?s ?p ?o } from <http://temp/artist> where { ?s ?p ?o };
sparql insert in graph <http://temp/mix> { ?s ?p ?o } from <http://temp/categories> where { ?s ?p ?o };
sparql insert in graph <http://temp/mix> { ?s ?p ?o } from <http://temp/countries> where { ?s ?p ?o };
sparql insert in graph <http://temp/mix> { ?s ?p ?o } from <http://temp/customers> where { ?s ?p ?o };
sparql insert in graph <http://temp/mix> { ?s ?p ?o } from <http://temp/employees> where { ?s ?p ?o };
sparql insert in graph <http://temp/mix> { ?s ?p ?o } from <http://temp/order_details> where { ?s ?p ?o };
sparql insert in graph <http://temp/mix> { ?s ?p ?o } from <http://temp/orders> where { ?s ?p ?o };
sparql insert in graph <http://temp/mix> { ?s ?p ?o } from <http://temp/products> where { ?s ?p ?o };
sparql insert in graph <http://temp/mix> { ?s ?p ?o } from <http://temp/provinces> where { ?s ?p ?o };
sparql insert in graph <http://temp/mix> { ?s ?p ?o } from <http://temp/shippers> where { ?s ?p ?o };
sparql insert in graph <http://temp/mix> { ?s ?p ?o } from <http://temp/suppliers> where { ?s ?p ?o };
sparql insert in graph <http://temp/mix> { ?s ?p ?o } from <http://temp/workofart> where { ?s ?p ?o };
sparql insert in graph <http://temp/mix> { ?s ?p ?o } from <http://temp/workofarttype> where { ?s ?p ?o };

DB.DBA.OVL_VALIDATE ('http://temp/artist', 'http://www.w3.org/ns/r2rml#OVL');
DB.DBA.OVL_VALIDATE ('http://temp/categories', 'http://www.w3.org/ns/r2rml#OVL');
DB.DBA.OVL_VALIDATE ('http://temp/countries', 'http://www.w3.org/ns/r2rml#OVL');
DB.DBA.OVL_VALIDATE ('http://temp/customers', 'http://www.w3.org/ns/r2rml#OVL');
DB.DBA.OVL_VALIDATE ('http://temp/employees', 'http://www.w3.org/ns/r2rml#OVL');
DB.DBA.OVL_VALIDATE ('http://temp/order_details', 'http://www.w3.org/ns/r2rml#OVL');
DB.DBA.OVL_VALIDATE ('http://temp/orders', 'http://www.w3.org/ns/r2rml#OVL');
DB.DBA.OVL_VALIDATE ('http://temp/products', 'http://www.w3.org/ns/r2rml#OVL');
DB.DBA.OVL_VALIDATE ('http://temp/provinces', 'http://www.w3.org/ns/r2rml#OVL');
DB.DBA.OVL_VALIDATE ('http://temp/shippers', 'http://www.w3.org/ns/r2rml#OVL');
DB.DBA.OVL_VALIDATE ('http://temp/suppliers', 'http://www.w3.org/ns/r2rml#OVL');
DB.DBA.OVL_VALIDATE ('http://temp/workofart', 'http://www.w3.org/ns/r2rml#OVL');
DB.DBA.OVL_VALIDATE ('http://temp/workofarttype', 'http://www.w3.org/ns/r2rml#OVL');
DB.DBA.OVL_VALIDATE ('http://temp/mix', 'http://www.w3.org/ns/r2rml#OVL');

select DB.DBA.R2RML_TEST ('http://temp/artist');
select DB.DBA.R2RML_TEST ('http://temp/categories');
select DB.DBA.R2RML_TEST ('http://temp/countries');
select DB.DBA.R2RML_TEST ('http://temp/customers');
select DB.DBA.R2RML_TEST ('http://temp/employees');
select DB.DBA.R2RML_TEST ('http://temp/order_details');
select DB.DBA.R2RML_TEST ('http://temp/orders');
select DB.DBA.R2RML_TEST ('http://temp/products');
select DB.DBA.R2RML_TEST ('http://temp/provinces');
select DB.DBA.R2RML_TEST ('http://temp/shippers');
select DB.DBA.R2RML_TEST ('http://temp/suppliers');
select DB.DBA.R2RML_TEST ('http://temp/workofart');
select DB.DBA.R2RML_TEST ('http://temp/workofarttype');
select DB.DBA.R2RML_TEST ('http://temp/mix');

exec ('sparql ' || DB.DBA.R2RML_MAKE_QM_FROM_G ('http://temp/mix'));

sparql select distinct ?g where { graph ?g { ?s a ?t }};

sparql
select * from <http://demo.com/>
where {?s a <http://demo.com/ns#Artist> .}
limit 10;

sparql
select * from <http://demo.com/>
where {<http://demo.com/artist/1> ?p ?o .};

sparql
select * from <http://demo.com/>
where {?s a <http://demo.com/ns#Categories> .}
limit 10;

sparql
select * from <http://demo.com/>
where {<http://demo.com/categories/1> ?p ?o .};

sparql
select * from <http://demo.com/>
where {?s a <http://demo.com/ns#Countries> .}
limit 10;

sparql
select * from <http://demo.com/>
where {<http://demo.com/countries/Aruba> ?p ?o .};

sparql
select * from <http://demo.com/>
where {?s a <http://demo.com/ns#Customers> .}
limit 10;

sparql
select * from <http://demo.com/>
where {<http://demo.com/customers/ALFKI> ?p ?o .};

sparql
select * from <http://demo.com/>
where {?s a <http://demo.com/ns#Employees> .}
limit 10;

sparql
select * from <http://demo.com/>
where {<http://demo.com/employees/3> ?p ?o .};

sparql
select * from <http://demo.com/>
where {?s a <http://demo.com/ns#Order_Details> .}
limit 10;

sparql
select * from <http://demo.com/>
where {<http://demo.com/order_details/10285_1> ?p ?o .};

sparql
select * from <http://demo.com/>
where {?s a <http://demo.com/ns#Orders> .}
limit 10;

sparql
select * from <http://demo.com/>
where {<http://demo.com/orders/10258> ?p ?o .};

sparql
select * from <http://demo.com/>
where {?s a <http://demo.com/ns#Products> .}
limit 10;

sparql
select * from <http://demo.com/>
where {<http://demo.com/products/1> ?p ?o .};

sparql
select * from <http://demo.com/>
where {?s a <http://demo.com/ns#Provinces> .}
limit 10;

sparql
select * from <http://demo.com/>
where {<http://demo.com/provinces/ac_Barbuda> ?p ?o .};

sparql
select * from <http://demo.com/>
where {?s a <http://demo.com/ns#Shippers> .}
limit 10;

sparql
select * from <http://demo.com/>
where {<http://demo.com/shippers/1> ?p ?o .};

sparql
select * from <http://demo.com/>
where {?s a <http://demo.com/ns#Suppliers> .}
limit 10;

sparql
select * from <http://demo.com/>
where {<http://demo.com/suppliers/1> ?p ?o .};

sparql
select * from <http://demo.com/>
where {?s a <http://demo.com/ns#WorkOfArt> .}
limit 10;

sparql
select * from <http://demo.com/>
where {<http://demo.com/workofart/1> ?p ?o .};

sparql
select * from <http://demo.com/>
where {?s a <http://demo.com/ns#WorkOfArtType> .}
limit 10;

sparql
select * from <http://demo.com/>
where {<http://demo.com/workofarttype/1> ?p ?o .};


