You are here:
/ Dashboard / Main / NorthWindREF

NorthWind SPARQL Reference

Key Northwind Data Space to Northwind schema Mappings

Key Northwind Sample Value
Class Product ndw:Order
Property productName ndw:productName
Property unitPrice ndw:unitPrice
Attribute has_category ndw:has_category
Attribute has_supplier ndw:has_supplier

Dump of Orders with details for customers, company name, country, employee, etc.


prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix ndw:<http://demo.openlinksw.com/schemas/northwind#>
select ?cnt_name  ?cmp_name ?emp_lname ?o_date ?o_freight ?s_city ?s_code
from <http://demo.openlinksw.com/Northwind>
where 
  {
    ?ord a ndw:Order.
    ?ord ndw:has_customer ?ctr .
    ?ctr ndw:country ?cnt_name .
    ?ctr ndw:companyName ?cmp_name .
    ?ord ndw:has_employee ?hem .
    ?hem ndw:lastName ?emp_lname .
    ?ord ndw:orderDate ?o_date .
    ?ord ndw:freight ?o_freight .
    ?ord ndw:shipCity ?s_city .
    ?ord ndw:shipPostal_code ?s_code .
  }
limit 200
Sample Data (Live Query Results)
  • Click *Here* for a live SPARQL Query (via SPARQL Protocol) against a collection of Northwind Orders.

Dump of Products with details for product name; category; supplier; supplier company name and phone, for all categories with name containing "Sea".


prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix ndw:<http://demo.openlinksw.com/schemas/northwind#>
select distinct  ?p_name ?p_category ?s_company ?s_phone
from <http://demo.openlinksw.com/Northwind>
where
  { 
    ?prs rdf:type ndw:Product .
    ?prs ndw:productName ?p_name.
    ?prs ndw:has_category ?hcg.
    ?prs ndw:has_supplier ?hp.
    ?hp ndw:companyName ?s_company .
    ?hp ndw:phone ?s_phone .
    ?hcg ndw:categoryName ?p_category.
    FILTER REGEX(str(?p_category), "^Sea") .
  }
limit 2
Sample Data (Live Query Results)
  • Click *Here* for a live SPARQL Query (via SPARQL Protocol) against a collection of Northwind Products.

Dump all Suppliers with their details.


prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix ndw:<http://demo.openlinksw.com/schemas/northwind#>
select distinct  ?s_company ?s_contact ?s_title ?s_address ?s_city ?s_region ?pcode ?s_country ?s_phone ?s_fax ?s_hpage
from <http://demo.openlinksw.com/Northwind>
where
  { 
    ?sp rdf:type ndw:Supplier .
    ?sp ndw:companyName ?s_company.
    ?sp ndw:contactName ?s_contact.
    ?sp ndw:contactTitle ?s_title.
    ?sp ndw:address ?s_address .
    ?sp ndw:city ?s_city .
    ?sp ndw:region ?s_region .
    ?sp ndw:postalCode ?pcode .
    ?sp ndw:country ?s_country .
    ?sp ndw:phone ?s_phone .
    ?sp ndw:fax ?s_fax .
    ?sp ndw:homePage ?s_hpage .
  }
Sample Data (Live Query Results)
  • Click *Here* for a live SPARQL Query (via SPARQL Protocol) against a collection of Northwind Suppliers.

Dump all Categories containing in their description "reads"


prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix ndw:<http://demo.openlinksw.com/schemas/northwind#>
select ?name ?description
from <http://demo.openlinksw.com/Northwind>
where
  { 
    ?sp a ndw:Category.
    ?sp ndw:categoryName ?name.
    ?sp ndw:description ?description.
    FILTER REGEX(str(?description), 'reads') .
  }
Sample Data (Live Query Results)
  • Click *Here* for a live SPARQL Query (via SPARQL Protocol) against a collection of Northwind Categories.

Dump all People which are contacts of customers and show customer company details.


prefix ndw:<http://demo.openlinksw.com/schemas/northwind#>
prefix foaf: <http://xmlns.com/foaf/0.1/>
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
select ?name ?phone ?customer_company
from <http://demo.openlinksw.com/Northwind>
where
  { 
    ?st a foaf:Person .
    ?st rdf:type ndw:CustomerContact .
    ?st foaf:name ?name.
    ?st foaf:phone ?phone .
    ?st ndw:is_contact_at ?cnt.
    ?cnt ndw:companyName ?customer_company
  }
Sample Data (Live Query Results)
  • Click *Here* for a live SPARQL Query (via SPARQL Protocol) against a collection of Northwind People which are contacts of customers.

Dump all Employees including hire date timestamps accurate to the second (as opposed to millisecond)


prefix ndw:<http://demo.openlinksw.com/schemas/northwind#>
prefix foaf: <http://xmlns.com/foaf/0.1/>
select ?lname ?hdate ?notes
from <http://demo.openlinksw.com/Northwind>
where
  { 
    ?aa a foaf:Person.
    ?aa ndw:lastName ?lname .
    ?aa ndw:hireDate ?hdate .
     filter (xsd:dateTime (?hdate ) > xsd:dateTime ("1992-04-01T10:56:00Z"))
    ?aa ndw:notes ?notes.   
  }
Sample Data (Live Query Results)
  • Click *Here* for a live SPARQL Query (via SPARQL Protocol) against a collection of Northwind Employees.

Dump all Customers (subclass of Organizations)


prefix ndw:<http://demo.openlinksw.com/schemas/northwind#>
prefix foaf: <http://xmlns.com/foaf/0.1/>
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
select ?company ?contact ?address
from <http://demo.openlinksw.com/Northwind>
where
  { 
    ?aa rdf:type foaf:Organization.
    ?aa ndw:companyName ?company .
    ?aa ndw:contactName ?contact .
    ?aa ndw:address ?address .
  }
Sample Data (Live Query Results)
  • Click *Here* for a live SPARQL Query (via SPARQL Protocol) against a collection of Northwind Customers.

Dump all Provinces


prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix ndw:<http://demo.openlinksw.com/schemas/northwind#>
select ?name ?country
from <http://demo.openlinksw.com/Northwind>
where
  { 
    ?sp rdf:type ndw:Province.
    ?sp ndw:provinceName ?name.
    ?sp ndw:is_province_of ?ipo .
    ?ipo ndw:name ?country
  }
Sample Data (Live Query Results)
  • Click *Here* for a live SPARQL Query (via SPARQL Protocol) against a collection of Northwind Provinces.

Dump all OrderLines including order date timestamps accurate to the second (as opposed to millisecond) and quantity expression.


prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix ndw:<http://demo.openlinksw.com/schemas/northwind#>
prefix xsd: <http://www.w3.org/2001/XMLSchema#>
select ?o_date ?p_name ?o_uprice ?quantity ?discount
from <http://demo.openlinksw.com/Northwind>
where
  { 
    ?ol rdf:type ndw:OrderLine .
    ?ol ndw:has_order_id ?oid .
    ?oid rdf:type ndw:Order .
    ?oid ndw:orderDate ?o_date .
    ?ol ndw:has_product_id ?pid .
    ?pid rdf:type ndw:Product .
    ?pid ndw:productName ?p_name . 
    ?ol ndw:unitPrice ?o_uprice.
    ?ol ndw:quantity ?quantity.
    ?ol ndw:discount ?discount.
    filter (xsd:integer(?quantity) > xsd:integer("15")) .
    filter (xsd:dateTime (?o_date) > xsd:dateTime  ("1996-01-01T10:00:00Z")) .   
  }
Sample Data (Live Query Results)
  • Click *Here* for a live SPARQL Query (via SPARQL Protocol) against a collection of Northwind OrderLines.

Dump all Countries containing in their name "United".


prefix ndw:<http://demo.openlinksw.com/schemas/northwind#>
prefix wgs: <http://www.w3.org/2003/01/geo/wgs84_pos#>
select ?name ?code ?lat ?long
from <http://demo.openlinksw.com/Northwind>
where
  { 
    ?cnt a wgs:SpatialThing .
    ?cnt ndw:name ?name .
    ?cnt ndw:code ?code .
    ?cnt wgs:lat ?lat .
    ?cnt wgs:long ?long .
    FILTER REGEX(str(?name), "^United")   
  }
Sample Data (Live Query Results)
  • Click *Here* for a live SPARQL Query (via SPARQL Protocol) against a collection of Northwind Countries.

Learn More

Virtuoso and the Virtuoso Website are Copyright (C) OpenLink Software 2006-
SourceForge.net Logo