-- Cleanup SPARQL CLEAR GRAPH ; SPARQL DROP QUAD MAP ; SPARQL CLEAR GRAPH ; SPARQL PREFIX rr: PREFIX Demo: PREFIX demo-stat: PREFIX rdf: PREFIX void: PREFIX scovo: PREFIX aowl: PREFIX foaf: INSERT { GRAPH { <#TriplesMapCategories> a rr:TriplesMap; rr:logicalTable [ rr:sqlQuery """ SELECT "CategoryID", "CategoryName", "Description", "Picture" FROM "Demo"."demo"."categories" """ ]; rr:subjectMap [ rr:termType rr:IRI ; rr:template "http://demo.openlinksw.com:8890/Demo/categories/CategoryID={CategoryID}"; rr:class Demo:Categories; rr:graph ]; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:categoryid ] ; rr:objectMap [ rr:column "CategoryID" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:categoryname ] ; rr:objectMap [ rr:column "CategoryName" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:description ] ; rr:objectMap [ rr:column "Description" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:picture ] ; rr:objectMap [ rr:column "Picture" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:categories_of_products ] ; rr:objectMap [ rr:parentTriplesMap <#TriplesMapProducts>; rr:joinCondition [ rr:child "CategoryID" ; rr:parent "CategoryID" ] ; ]; ] . <#TriplesMapCountries> a rr:TriplesMap; rr:logicalTable [ rr:sqlQuery """ SELECT "Name", "Code", "Lat", "Lng", "SmallFlagDAVResourceName", "LargeFlagDAVResourceName", "SmallFlagDAVResourceURI", "LargeFlagDAVResourceURI" FROM "Demo"."demo"."countries" """ ]; rr:subjectMap [ rr:termType rr:IRI ; rr:template "http://demo.openlinksw.com:8890/Demo/countries/Name={Name}"; rr:class Demo:Countries; rr:graph ]; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:name ] ; rr:objectMap [ rr:column "Name" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:code ] ; rr:objectMap [ rr:column "Code" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:smallflagdavresourcename ] ; rr:objectMap [ rr:column "SmallFlagDAVResourceName" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:largeflagdavresourcename ] ; rr:objectMap [ rr:column "LargeFlagDAVResourceName" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:smallflagdavresourceuri ] ; rr:objectMap [ rr:column "SmallFlagDAVResourceURI" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:largeflagdavresourceuri ] ; rr:objectMap [ rr:column "LargeFlagDAVResourceURI" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:lat ] ; rr:objectMap [ rr:column "Lat" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:lng ] ; rr:objectMap [ rr:column "Lng" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:countries_of_provinces ] ; rr:objectMap [ rr:parentTriplesMap <#TriplesMapProvinces>; rr:joinCondition [ rr:child "Code" ; rr:parent "CountryCode" ] ; ]; ] . <#TriplesMapCustomers> a rr:TriplesMap; rr:logicalTable [ rr:sqlQuery """ SELECT "CustomerID", "CompanyName", "ContactName", "ContactTitle", "Address", "City", "Region", "PostalCode", "Country", "CountryCode", "Phone", "Fax" FROM "Demo"."demo"."customers" """ ]; rr:subjectMap [ rr:termType rr:IRI ; rr:template "http://demo.openlinksw.com:8890/Demo/customers/CustomerID={CustomerID}"; rr:class Demo:Customers, foaf:Agent, foaf:Organization ; rr:graph ]; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:customerid ] ; rr:objectMap [ rr:column "CustomerID" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:companyname ] ; rr:objectMap [ rr:column "CompanyName" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:contactname ] ; rr:objectMap [ rr:column "ContactName" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:contacttitle ] ; rr:objectMap [ rr:column "ContactTitle" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:address ] ; rr:objectMap [ rr:column "Address" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:city ] ; rr:objectMap [ rr:column "City" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:region ] ; rr:objectMap [ rr:column "Region" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:postalcode ] ; rr:objectMap [ rr:column "PostalCode" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:country ] ; rr:objectMap [ rr:column "Country" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:countrycode ] ; rr:objectMap [ rr:column "CountryCode" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:phone ] ; rr:objectMap [ rr:column "Phone" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:fax ] ; rr:objectMap [ rr:column "Fax" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:customers_of_orders ] ; rr:objectMap [ rr:parentTriplesMap <#TriplesMapOrders>; rr:joinCondition [ rr:child "CustomerID" ; rr:parent "CustomerID" ] ; ]; ] . <#TriplesMapEmployees> a rr:TriplesMap; rr:logicalTable [ rr:sqlQuery """ SELECT "EmployeeID", "LastName", "FirstName", "Title", "TitleOfCourtesy", "HireDate", "BirthDate", "Address", "City", "Region", "PostalCode", "Country", "CountryCode", "HomePhone", "Extension", "Photo", "Notes", "ReportsTo" FROM "Demo"."demo"."employees" """ ]; rr:subjectMap [ rr:termType rr:IRI ; rr:template "http://demo.openlinksw.com:8890/Demo/employees/EmployeeID={EmployeeID}"; rr:class Demo:Employees, foaf:Agent, foaf:Person ; rr:graph ]; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:employeeid ] ; rr:objectMap [ rr:column "EmployeeID" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:lastname ] ; rr:objectMap [ rr:column "LastName" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:firstname ] ; rr:objectMap [ rr:column "FirstName" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:title ] ; rr:objectMap [ rr:column "Title" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:titleofcourtesy ] ; rr:objectMap [ rr:column "TitleOfCourtesy" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:birthdate ] ; rr:objectMap [ rr:column "BirthDate" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:hiredate ] ; rr:objectMap [ rr:column "HireDate" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:address ] ; rr:objectMap [ rr:column "Address" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:city ] ; rr:objectMap [ rr:column "City" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:region ] ; rr:objectMap [ rr:column "Region" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:postalcode ] ; rr:objectMap [ rr:column "PostalCode" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:country ] ; rr:objectMap [ rr:column "Country" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:countrycode ] ; rr:objectMap [ rr:column "CountryCode" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:homephone ] ; rr:objectMap [ rr:column "HomePhone" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:extension ] ; rr:objectMap [ rr:column "Extension" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:photo ] ; rr:objectMap [ rr:column "Photo" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:notes ] ; rr:objectMap [ rr:column "Notes" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:reportsto ] ; rr:objectMap [ rr:column "ReportsTo" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:employees_of_orders ] ; rr:objectMap [ rr:parentTriplesMap <#TriplesMapOrders>; rr:joinCondition [ rr:child "EmployeeID" ; rr:parent "EmployeeID" ] ; ]; ] . <#TriplesMapOrder_Details> a rr:TriplesMap; rr:logicalTable [ rr:sqlQuery """ SELECT "OrderID", "ProductID", "UnitPrice", "Quantity", "Discount" FROM "Demo"."demo"."order_details" """ ]; rr:subjectMap [ rr:termType rr:IRI ; rr:template "http://demo.openlinksw.com:8890/Demo/order_details/OrderID={OrderID}/ProductID={ProductID}"; rr:class Demo:Order_Details; rr:graph ]; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:unitprice ] ; rr:objectMap [ rr:column "UnitPrice" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:quantity ] ; rr:objectMap [ rr:column "Quantity" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:discount ] ; rr:objectMap [ rr:column "Discount" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:order_details_has_orders ] ; rr:objectMap [ rr:termType rr:IRI ; rr:template "http://demo.openlinksw.com:8890/Demo/orders/OrderID={OrderID}" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:order_details_has_products ] ; rr:objectMap [ rr:termType rr:IRI ; rr:template "http://demo.openlinksw.com:8890/Demo/products/ProductID={ProductID}" ]; ] . <#TriplesMapOrders> a rr:TriplesMap; rr:logicalTable [ rr:sqlQuery """ SELECT "OrderID", "EmployeeID", "CustomerID", "ShipVia", "OrderDate", "RequiredDate", "ShippedDate", "ShipAddress", "Freight", "ShipName", "ShipCity", "ShipRegion", "ShipPostalCode", "ShipCountry", "ShipCountryCode" FROM "Demo"."demo"."orders" """ ]; rr:subjectMap [ rr:termType rr:IRI ; rr:template "http://demo.openlinksw.com:8890/Demo/orders/OrderID={OrderID}"; rr:class Demo:Orders; rr:graph ]; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:orderid ] ; rr:objectMap [ rr:column "OrderID" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:orderdate ] ; rr:objectMap [ rr:column "OrderDate" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:requireddate ] ; rr:objectMap [ rr:column "RequiredDate" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:shippeddate ] ; rr:objectMap [ rr:column "ShippedDate" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:freight ] ; rr:objectMap [ rr:column "Freight" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:shipname ] ; rr:objectMap [ rr:column "ShipName" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:shipaddress ] ; rr:objectMap [ rr:column "ShipAddress" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:shipcity ] ; rr:objectMap [ rr:column "ShipCity" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:shipregion ] ; rr:objectMap [ rr:column "ShipRegion" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:shippostalcode ] ; rr:objectMap [ rr:column "ShipPostalCode" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:shipcountry ] ; rr:objectMap [ rr:column "ShipCountry" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:shipcountrycode ] ; rr:objectMap [ rr:column "ShipCountryCode" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:orders_has_customers ] ; rr:objectMap [ rr:termType rr:IRI ; rr:template "http://demo.openlinksw.com:8890/Demo/customers/CustomerID={CustomerID}" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:orders_has_employees ] ; rr:objectMap [ rr:termType rr:IRI ; rr:template "http://demo.openlinksw.com:8890/Demo/employees/EmployeeID={EmployeeID}" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:orders_has_shippers ] ; rr:objectMap [ rr:termType rr:IRI ; rr:template "http://demo.openlinksw.com:8890/Demo/shippers/ShipVia={ShipVia}" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:orders_of_order_details ] ; rr:objectMap [ rr:parentTriplesMap <#TriplesMapOrder_Details>; rr:joinCondition [ rr:child "OrderID" ; rr:parent "OrderID" ] ; ]; ] . <#TriplesMapProducts> a rr:TriplesMap; rr:logicalTable [ rr:sqlQuery """ SELECT "ProductID", "CategoryID", "SupplierID", "ProductName", "QuantityPerUnit", "UnitPrice", "UnitsInStock", "UnitsOnOrder","ReorderLevel", "Discontinued" FROM "Demo"."demo"."products" """ ]; rr:subjectMap [ rr:termType rr:IRI ; rr:template "http://demo.openlinksw.com:8890/Demo/products/ProductID={ProductID}"; rr:class Demo:Products; rr:graph ]; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:productid ] ; rr:objectMap [ rr:column "ProductID" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:productname ] ; rr:objectMap [ rr:column "ProductName" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:quantityperunit ] ; rr:objectMap [ rr:column "QuantityPerUnit" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:unitprice ] ; rr:objectMap [ rr:column "UnitPrice" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:unitsinstock ] ; rr:objectMap [ rr:column "UnitsInStock" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:unitsonorder ] ; rr:objectMap [ rr:column "UnitsOnOrder" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:reorderlevel ] ; rr:objectMap [ rr:column "ReorderLevel" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:discontinued ] ; rr:objectMap [ rr:column "Discontinued" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:products_has_categories ] ; rr:objectMap [ rr:termType rr:IRI ; rr:template "http://demo.openlinksw.com:8890/Demo/categories/CategoryID={CategoryID}" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:products_has_suppliers ] ; rr:objectMap [ rr:termType rr:IRI ; rr:template "http://demo.openlinksw.com:8890/Demo/suppliers/SupplierID={SupplierID}" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:products_of_order_details ] ; rr:objectMap [ rr:parentTriplesMap <#TriplesMapOrder_Details>; rr:joinCondition [ rr:child "ProductID" ; rr:parent "ProductID" ] ; ]; ] . <#TriplesMapProvinces> a rr:TriplesMap; rr:logicalTable [ rr:sqlQuery """ SELECT "Province", "CountryCode" FROM "Demo"."demo"."provinces" """ ]; rr:subjectMap [ rr:termType rr:IRI ; rr:template "http://demo.openlinksw.com:8890/Demo/provinces/CountryCode={CountryCode}/Province={Province}"; rr:class Demo:Provinces; rr:graph ]; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:province ] ; rr:objectMap [ rr:column "Province" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:provinces_has_countries ] ; rr:objectMap [ rr:termType rr:IRI ; rr:template "http://demo.openlinksw.com:8890/Demo/countries/CountryCode={CountryCode}" ]; ] . <#TriplesMapShippers> a rr:TriplesMap; rr:logicalTable [ rr:sqlQuery """ SELECT "ShipperID", "CompanyName", "Phone" FROM "Demo"."demo"."shippers" """ ]; rr:subjectMap [ rr:termType rr:IRI ; rr:template "http://demo.openlinksw.com:8890/Demo/shippers/ShipperID={ShipperID}"; rr:class Demo:Shippers, foaf:Agent, foaf:Organization ; rr:graph ]; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:shipperid ] ; rr:objectMap [ rr:column "ShipperID" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:companyname ] ; rr:objectMap [ rr:column "CompanyName" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:phone ] ; rr:objectMap [ rr:column "Phone" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:shippers_of_orders ] ; rr:objectMap [ rr:parentTriplesMap <#TriplesMapOrders>; rr:joinCondition [ rr:child "ShipperID" ; rr:parent "ShipVia" ] ; ]; ] . <#TriplesMapSuppliers> a rr:TriplesMap; rr:logicalTable [ rr:sqlQuery """ SELECT "SupplierID", "CompanyName", "ContactName", "ContactTitle", "Address", "City", "Region","PostalCode", "Country", "CountryCode", "Phone", "Fax", "HomePage" FROM "Demo"."demo"."suppliers" """ ]; rr:subjectMap [ rr:termType rr:IRI ; rr:template "http://demo.openlinksw.com:8890/Demo/suppliers/SupplierID={SupplierID}"; rr:class Demo:Suppliers, foaf:Agent, foaf:Organization ; rr:graph ]; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:supplierid ] ; rr:objectMap [ rr:column "SupplierID" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:companyname ] ; rr:objectMap [ rr:column "CompanyName" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:contactname ] ; rr:objectMap [ rr:column "ContactName" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:contacttitle ] ; rr:objectMap [ rr:column "ContactTitle" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:address ] ; rr:objectMap [ rr:column "Address" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:city ] ; rr:objectMap [ rr:column "City" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:region ] ; rr:objectMap [ rr:column "Region" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:postalcode ] ; rr:objectMap [ rr:column "PostalCode" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:country ] ; rr:objectMap [ rr:column "Country" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:countrycode ] ; rr:objectMap [ rr:column "CountryCode" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:phone ] ; rr:objectMap [ rr:column "Phone" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:fax ] ; rr:objectMap [ rr:column "Fax" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:homepage ] ; rr:objectMap [ rr:column "HomePage" ]; ] ; rr:predicateObjectMap [ rr:predicateMap [ rr:constant Demo:suppliers_of_products ] ; rr:objectMap [ rr:parentTriplesMap <#TriplesMapProducts>; rr:joinCondition [ rr:child "SupplierID" ; rr:parent "SupplierID" ] ; ]; ] . } } ; -- Generate & Execute Virtual RDF Views Script, hence the use of EXEC() EXEC ('SPARQL ' || DB.DBA.R2RML_MAKE_QM_FROM_G ('urn:northwind:8890:sql:r2rml:mappings')) ; -- Test RDF generated Virtual RDF Views -- Test 1 SPARQL SELECT SAMPLE(?s) AS ?sample COUNT(1) AS ?count ?o FROM WHERE {?s a ?o} GROUP BY ?o ORDER BY DESC(?count) LIMIT 50 ; -- Test 2 (workaround) SPARQL SELECT ?o IRI(max(str(?s))) AS ?sample COUNT(1) AS ?count FROM WHERE {?s a ?o} GROUP BY ?o ORDER BY DESC(?count) LIMIT 50 ; -- Sync Triples from Virtual RDF Views Graph to Physical RDF Views Graph -- Disabled because this feature is not allowed with this kind of RDF View -- -- Sync Triples from Virtual RDF Views Graph to Physical RDF Views Graph -- RDF_VIEW_SYNC_TO_PHYSICAL ('http://opllinux5.usnet.private:8708/NorthwindDemo#', 1, 'urn:opllinux5.usnet.private:8708:NorthwindDemo'); -- Test Phyical RDF Views sync'd from Virtual RDF Views Graph