question: In which department is Ms. Brant?

sparql:
PREFIX pv: <http://ld.company.org/prod-vocab/>
SELECT DISTINCT ?result
WHERE
{
  <http://ld.company.org/prod-instances/empl-Karen.Brant%40company.org> pv:memberOf ?result .
  ?result a pv:Department .
}


question: What is the telephone of Baldwin Dirksen?

sparql:
PREFIX pv: <http://ld.company.org/prod-vocab/>
SELECT DISTINCT ?result
WHERE
{
  <http://ld.company.org/prod-instances/empl-Baldwin.Dirksen%40company.org> pv:phone ?result .
}


question: Who is the manager of Heinrich Hoch?

sparql:
PREFIX pv: <http://ld.company.org/prod-vocab/>
SELECT DISTINCT ?result
WHERE
{
  <http://ld.company.org/prod-instances/empl-Heinrich.Hoch%40company.org> pv:hasManager ?result .
}


question: What is the email of Sabrina from Marketing?

sparql:
PREFIX pv: <http://ld.company.org/prod-vocab/>
SELECT DISTINCT ?result
WHERE
{
  ?department pv:name "Marketing" .
  ?person pv:memberOf ?department .
  ?person pv:email ?result .
  ?person pv:name ?name .
  FILTER (CONTAINS(?name, "Sabrina"))
}


question: Who has expertise in Transistors?

sparql:
PREFIX pv: <http://ld.company.org/prod-vocab/>
SELECT DISTINCT ?result
WHERE
{
  ?result pv:areaOfExpertise <http://ld.company.org/prod-instances/prod-cat-Transistor> .
}


question: Who is our Sensor expert?

sparql:
PREFIX pv: <http://ld.company.org/prod-vocab/>
SELECT DISTINCT ?result
WHERE
{
  ?result pv:areaOfExpertise <http://ld.company.org/prod-instances/prod-cat-Sensor> .
}


question: Who is the manager of the Data Services department?

sparql:
PREFIX pv: <http://ld.company.org/prod-vocab/>
SELECT DISTINCT ?result
WHERE
{
  ?person pv:memberOf <http://ld.company.org/prod-instances/dept-41622> .
  ?person pv:hasManager ?result .
}


question: Which department is responsible for the Sensor Switch M558-2275045?

sparql:
PREFIX pv: <http://ld.company.org/prod-vocab/>
SELECT DISTINCT ?result
WHERE
{
  ?result pv:responsibleFor <http://ld.company.org/prod-instances/hw-M558-2275045> .
}


question: How many Sensor Switches do we offer?

sparql:
PREFIX pv: <http://ld.company.org/prod-vocab/>
SELECT DISTINCT (COUNT(?resultR) as ?result)
WHERE
{
  ?resultR pv:hasCategory <http://ld.company.org/prod-instances/prod-cat-Sensor> .
  ?resultR pv:hasCategory <http://ld.company.org/prod-instances/prod-cat-Switch> .
}


question: What is the name of the Network expert from the Marketing Department?

sparql:
PREFIX pv: <http://ld.company.org/prod-vocab/>
SELECT DISTINCT ?result
WHERE
{
  ?employee pv:memberOf <http://ld.company.org/prod-instances/dept-85880> .
  ?employee pv:areaOfExpertise <http://ld.company.org/prod-instances/prod-cat-Network> .
  ?employee pv:name ?result .
}


question: Which departments have Transducer Experts?

sparql:
PREFIX pv: <http://ld.company.org/prod-vocab/>
SELECT DISTINCT ?result
WHERE
{
  ?employee pv:memberOf ?result .
  ?employee pv:areaOfExpertise <http://ld.company.org/prod-instances/prod-cat-Transducer> .
}


question: Which supplier are available to deliver Compensators?

sparql:
PREFIX pv: <http://ld.company.org/prod-vocab/>
SELECT DISTINCT ?result
WHERE
{
  ?hardware pv:hasSupplier ?result .
  ?hardware pv:hasCategory <http://ld.company.org/prod-instances/prod-cat-Compensator> .
}


question: How many suppliers do we have in France?

sparql:
PREFIX pv: <http://ld.company.org/prod-vocab/>
SELECT (COUNT(DISTINCT ?supplier) as ?result)
WHERE
{
  ?product pv:hasSupplier ?supplier .
  ?supplier pv:addressCountry "France" .
}


question: Which supplier in France delivers Compensators?

sparql:
PREFIX pv: <http://ld.company.org/prod-vocab/>
SELECT DISTINCT ?result
WHERE
{
  ?product pv:hasSupplier ?result .
  ?product pv:hasCategory <http://ld.company.org/prod-instances/prod-cat-Compensator> .
  ?result pv:addressCountry "France" .
}


question: What is the cheapest Encoder we can get from a french or german supplier?

sparql:
PREFIX pv: <http://ld.company.org/prod-vocab/>
SELECT DISTINCT ?result
WHERE
{
  ?result pv:hasCategory <http://ld.company.org/prod-instances/prod-cat-Encoder> .
  ?result pv:price ?priceR .
  ?priceR pv:amount ?price .
  ?result pv:hasSupplier ?supplier .
  ?supplier pv:addressCountry ?country .
  FILTER ( (?country = "France") ||  (?country = "Germany") )
}
ORDER BY ASC(?price)
LIMIT 1


question: Do we have suppliers in Toulouse?

sparql:
PREFIX pv: <http://ld.company.org/prod-vocab/>
ASK
WHERE
{
  ?product pv:hasSupplier ?supplier .
  ?supplier pv:addressLocality "Toulouse" .
}


question: Which suppliers do we have in Toulouse?

sparql:
PREFIX pv: <http://ld.company.org/prod-vocab/>
SELECT DISTINCT ?result
WHERE
{
  ?product pv:hasSupplier ?result .
  ?result pv:addressLocality "Toulouse" .
}


question: What is the cheapest Oscillator we have?

sparql:
PREFIX pv: <http://ld.company.org/prod-vocab/>
SELECT DISTINCT ?result
WHERE
{
  ?result pv:hasCategory <http://ld.company.org/prod-instances/prod-cat-Oscillator> .
  ?result pv:price ?priceR .
  ?priceR pv:amount ?price .
}
ORDER BY ASC(?price)
LIMIT 1


question: What is the most expensive service we offer?

sparql:
PREFIX pv: <http://ld.company.org/prod-vocab/>
SELECT DISTINCT ?result
WHERE
{
  ?result a pv:Service .
  ?result pv:price ?priceR .
  ?priceR pv:amount ?price .
}
ORDER BY DESC(?price)
LIMIT 1


question: Who is responsible for the most expensive service we offer?

sparql:
PREFIX pv: <http://ld.company.org/prod-vocab/>
SELECT DISTINCT ?result
WHERE
{
  ?service a pv:Service .
  ?service pv:hasProductManager ?result .
  ?service pv:price ?priceR .
  ?priceR pv:amount ?price .
}
ORDER BY DESC(?price)
LIMIT 1


question: What is the heaviest coil that does not exceed a base area of 15x15 milimeter?

sparql:
PREFIX pv: <http://ld.company.org/prod-vocab/>
SELECT DISTINCT ?result
WHERE
{
  ?result pv:hasCategory <http://ld.company.org/prod-instances/prod-cat-Coil> .
  ?result pv:weight_g ?weight_g .
  ?result pv:width_mm ?width_mm .
  ?result pv:depth_mm ?depth_mm .
  FILTER (?width_mm <= 15)
  FILTER (?depth_mm <= 15)
}
ORDER BY DESC(?weight_g)
LIMIT 1


question: What products are compatible with the U990 LCD Inductor?

sparql:
PREFIX pv: <http://ld.company.org/prod-vocab/>
SELECT DISTINCT ?result
WHERE
{
  <http://ld.company.org/prod-instances/hw-U990-5234138> pv:compatibleProduct ?result .
}


question: What products can I get from US suppliers that are compatible with the U990 LCD Inductor?

sparql:
PREFIX pv: <http://ld.company.org/prod-vocab/>
SELECT DISTINCT ?result
WHERE
{
  <http://ld.company.org/prod-instances/hw-U990-5234138> pv:compatibleProduct ?result .
  ?result pv:hasSupplier ?supplier .
  ?supplier pv:country <http://dbpedia.org/resource/United_States> .
}


question: What is the pontiometer with the smallest volume?

sparql:
PREFIX pv: <http://ld.company.org/prod-vocab/>
SELECT DISTINCT ?result
WHERE
{
  ?result pv:hasCategory <http://ld.company.org/prod-instances/prod-cat-Potentiometer> .
  ?result pv:width_mm ?width_mm .
  ?result pv:depth_mm ?depth_mm .
  ?result pv:height_mm ?height_mm .
  BIND(?width_mm * ?depth_mm * ?height_mm as ?volume)
}
ORDER BY ASC(?volume)
LIMIT 1


question: Which coil has the highest density?

sparql:
PREFIX pv: <http://ld.company.org/prod-vocab/>
SELECT DISTINCT ?result
WHERE
{
  ?result pv:hasCategory <http://ld.company.org/prod-instances/prod-cat-Coil> .
  ?result pv:width_mm ?width_mm .
  ?result pv:depth_mm ?depth_mm .
  ?result pv:height_mm ?height_mm .
  ?result pv:weight_g ?weight_g .
  BIND(?width_mm * ?depth_mm * ?height_mm / 1000000000 AS ?volume_m3)
  BIND(?weight_g / 1000 AS ?weight_kg)
  BIND(?weight_kg / ?volume_m3 AS ?density)
}
ORDER BY DESC(?density)
LIMIT 1


question: In which cities are our US suppliers for LCDs?

sparql:
PREFIX pv: <http://ld.company.org/prod-vocab/>
SELECT DISTINCT ?result
WHERE
{
  ?product pv:hasCategory <http://ld.company.org/prod-instances/prod-cat-LCD> .
  ?product pv:hasSupplier ?supplier .
  ?supplier pv:country <http://dbpedia.org/resource/United_States> .
  ?supplier pv:addressLocality ?result .
}


question: Give me a phone directory of everyone on staff who does not manage anyone, I need name, email, and phone, sorted by name?

sparql:
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX prodi: <http://ld.company.org/prod-instances/>
PREFIX pv: <http://ld.company.org/prod-vocab/>

SELECT ?empl ?name ?email ?phone
WHERE {
  ?emplClass rdfs:subClassOf* pv:Employee .
  ?empl a ?emplClass ;
      pv:name ?name ;
      pv:email ?email .
  OPTIONAL { ?empl pv:phone ?phone }
  FILTER NOT EXISTS { [] pv:hasManager ?empl . }
}
ORDER BY ?name


question: Do we have any service that does apply to a BOM where parts are sourced from Russia?

sparql:
PREFIX prodi: <http://ld.company.org/prod-instances/>
PREFIX pv: <http://ld.company.org/prod-vocab/>

ASK
WHERE {
  { # all BOMs with parts from russia
    SELECT ?bom
    WHERE {
      ?bom pv:hasBomPart ?bomPart .
      ?bomPart pv:hasPart ?hw .
      ?hw pv:hasSupplier ?suppl .
      ?suppl pv:addressCountry ?country .
      FILTER (CONTAINS(LCASE(?country), LCASE("Russia")))
    }
  }

  # services eligible for parts associated with these BOMs?
  ?s a pv:Service .
  ?s pv:eligibleFor ?hw .
  ?bom pv:hasBomPart ?bomPart .
  ?bomPart pv:hasPart ?hw .
}


question: What suppliers - I need name, country and price - deliver the 6th to 10th most expensive hardware items.

sparql:
PREFIX prodi: <http://ld.company.org/prod-instances/>
PREFIX pv: <http://ld.company.org/prod-vocab/>

SELECT ?name ?country ?price
WHERE {
  ?sup a pv:Supplier ;
    pv:addressCountry ?country ;
  pv:name ?name .
  ?hw a pv:Hardware ;
  pv:price/pv:amount ?price ;
    pv:price/pv:currency "EUR" ;
    pv:hasSupplier ?sup .
}
ORDER BY DESC(?price)
LIMIT 5 OFFSET 10


question: Which department have more than 5 employees? I need their names and the number of employees.

sparql:
PREFIX prodi: <http://ld.company.org/prod-instances/>
PREFIX pv: <http://ld.company.org/prod-vocab/>

SELECT ?name (COUNT(?emp) AS ?numEmployees)
WHERE {
  ?dept a pv:Department ;
    pv:name ?name .
  ?emp a pv:Employee ;
    pv:memberOf ?dept .
}
GROUP BY ?depty ?name
HAVING (COUNT(?emp) > 5)


question: Per product category, what's our lightest and heaviest hardware item?

sparql:
PREFIX prodi: <http://ld.company.org/prod-instances/>
PREFIX pv: <http://ld.company.org/prod-vocab/>

SELECT ?cat (MIN(?w) AS ?minWeight) (MAX(?w) AS ?maxWeight)
WHERE {
  ?catItem a pv:ProductCategory ;
    pv:name ?cat .
  ?hw a pv:Hardware ;
    pv:hasCategory ?catItem ;
    pv:weight_g ?w .
}
GROUP BY ?cat


question: For each supplier, what's the average price (in EUR) of what they sell, round reasonably?

sparql:
PREFIX prodi: <http://ld.company.org/prod-instances/>
PREFIX pv: <http://ld.company.org/prod-vocab/>

SELECT ?name (ROUND(AVG(?amt) * 100) / 100 AS ?avgEur) WHERE {
  ?sup a pv:Supplier ;
    pv:name ?name .
  ?hw pv:hasSupplier ?sup ;
    pv:price/pv:amount ?amt ;
    pv:price/pv:currency "EUR" .
}
GROUP BY ?sup ?name


question: Are there departments with no manager assigned?

sparql:
PREFIX prodi: <http://ld.company.org/prod-instances/>
PREFIX pv: <http://ld.company.org/prod-vocab/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

ASK
WHERE {
  ?dept a pv:Department .
  FILTER NOT EXISTS {
    ?m pv:memberOf ?dept .
    ?m a pv:Manager .
  }
}


question: I need to update my supplier rolodex, give me every supplier's name and all address details.

sparql:
PREFIX prodi: <http://ld.company.org/prod-instances/>
PREFIX pv: <http://ld.company.org/prod-vocab/>

SELECT ?name ?locality ?ccode ?country
WHERE {
  ?sup a pv:Supplier ;
    pv:name ?name .
  OPTIONAL { ?sup pv:addressLocality ?locality . }
  OPTIONAL { ?sup pv:addressCountryCode ?ccode . }
  OPTIONAL { ?sup pv:addressCountry ?country . }
}


question: For every product, list what other products it is compatible with and the price differences between both.

sparql:
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX prodi: <http://ld.company.org/prod-instances/>
PREFIX pv:    <http://ld.company.org/prod-vocab/>

SELECT ?prod ?compatible (?prodAmount - ?compatibleAmount AS ?priceDiff)
WHERE {
  ?prodClass rdfs:subClassOf* pv:Product .
  ?prod a ?prodClass ;
    pv:compatibleProduct ?compatible .
  ?prod pv:price/pv:amount ?prodAmount ;
    pv:price/pv:currency "EUR" .
  ?compatible pv:price/pv:amount ?compatibleAmount ;
    pv:price/pv:currency "EUR" .
}


question: Which area of expertise is most relevant among our products, what are the top three skills?

sparql:
PREFIX prodi: <http://ld.company.org/prod-instances/>
PREFIX pv: <http://ld.company.org/prod-vocab/>

SELECT ?cat ?name
WHERE {
  ?hw a pv:Hardware ;
    pv:hasCategory ?cat .
  ?cat pv:name ?name .
}
GROUP BY ?cat ?name
ORDER BY DESC(COUNT(*))
LIMIT 3


question: For each Bill of Material, how many parts does it contain and what is the total material quantity — show me only those BOMs exceeding 600 total items and order them descending.

sparql:
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX prodi: <http://ld.company.org/prod-instances/>
PREFIX pv: <http://ld.company.org/prod-vocab/>

SELECT ?bom (COUNT(?part) AS ?partCount) (SUM(?qty) AS ?totalQty)
WHERE {
  ?bom a pv:BillOfMaterial ;
    pv:hasBomPart ?part .
  ?part pv:quantity ?qty_ .
  BIND(xsd:int(?qty_) AS ?qty)
}
GROUP BY ?bom
HAVING (SUM(?qty) > 600)
ORDER BY DESC(SUM(?qty))


question: I want to update my contact list, for each Employee give me name, email, phone number and the department they belong to as well as their direct report.

sparql:
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX prodi: <http://ld.company.org/prod-instances/>
PREFIX pv: <http://ld.company.org/prod-vocab/>

SELECT ?name ?email ?phone ?dept ?manager
WHERE {
  ?agentClass rdfs:subClassOf* pv:Agent .
  ?empl a ?agentClass ;
    pv:name ?name .
  OPTIONAL { ?empl pv:email ?email . }
  OPTIONAL { ?empl pv:phone ?phone . }
  OPTIONAL { ?empl pv:memberOf/pv:name ?dept . }
  OPTIONAL { ?empl pv:hasManager/pv:name ?manager . }
}


question: Which hardware items are wider than they are tall, and have a depth under 50 mm? List their dimensions.

sparql:
PREFIX prodi: <http://ld.company.org/prod-instances/>
PREFIX pv: <http://ld.company.org/prod-vocab/>

SELECT ?hw ?width ?height ?depth
WHERE {
  ?hw a pv:Hardware ;
    pv:width_mm ?width ;
    pv:height_mm ?height ;
    pv:depth_mm ?depth .
  FILTER (?width > ?height && ?depth < 50)
}


question: Which hardware items - list id and name - have no active product manager?

sparql:
PREFIX prodi: <http://ld.company.org/prod-instances/>
PREFIX pv: <http://ld.company.org/prod-vocab/>

SELECT ?hw ?id ?name
WHERE {
  ?hw a pv:Hardware ;
    pv:id ?id ;
    pv:name ?name .
  FILTER NOT EXISTS { ?hw pv:hasProductManager/pv:name [] . }
}


question: For each manager, what percentage of their entire team work in the same department as the manager?

sparql:
PREFIX prodi: <http://ld.company.org/prod-instances/>
PREFIX pv: <http://ld.company.org/prod-vocab/>

SELECT ?m ?name (?deptTeam / ?fullteam * 100 AS ?pct)
WHERE {

  ?m pv:name ?name .

  { # full team
    SELECT ?m (COUNT(*) AS ?fullteam) WHERE {
      ?e pv:hasManager ?m .
    } GROUP BY ?m
  }

  { # team in same dept
    SELECT ?m (COUNT(*) AS ?deptTeam) WHERE {
      ?m pv:memberOf ?dept .
      ?e pv:hasManager ?m .
      ?e pv:memberOf ?dept .
    } GROUP BY ?m
  }
}


question: Which Bill-of-Material has the highest average unit cost of its hardware parts, and what is that average?

sparql:
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX prodi: <http://ld.company.org/prod-instances/>
PREFIX pv: <http://ld.company.org/prod-vocab/>

SELECT ?bom (ROUND(AVG(?spst / ?sq) * 100) / 100 AS ?avgUnitCost)
WHERE {
  {
    SELECT ?bom (SUM(?partSubTotal) AS ?spst) (SUM(xsd:int(?quant)) AS ?sq)
    WHERE {
      ?bom a pv:BillOfMaterial ;
        pv:hasBomPart ?part .
      ?part pv:quantity ?quant .
      ?part pv:hasPart/pv:price/pv:amount ?amount .
      ?part pv:hasPart/pv:price/pv:currency "EUR" .
      BIND(xsd:int(?quant) * ?amount AS ?partSubTotal)
    }
    GROUP BY ?bom
  }
}
GROUP BY ?bom
ORDER BY DESC(?avgUnitCost)
LIMIT 1


question: Show me any cycles of product compatibility — i.e. product A says it's compatible with B, and B says it's compatible with A (mutual pairs).

sparql:
PREFIX pv: <http://ld.company.org/prod-vocab/>

SELECT ?a ?b
WHERE {
  ?a pv:compatibleProduct ?b .
  FILTER (STR(?a) < STR(?b))
}


question: Which hardware items have dimensions in the top 10 % of all widths, and what are their IDs, names and widths?

sparql:
PREFIX pv: <http://ld.company.org/prod-vocab/>

SELECT ?id ?name ?width
WHERE {
  { # get min-max range
    SELECT (MIN(?width) AS ?minW) (MAX(?width) AS ?maxW)
    WHERE {
      ?hw a pv:Hardware ;
        pv:width_mm ?width .
    }
  }

  # get 90. percentile
  BIND(?minW + (0.9 * (?maxW - ?minW)) AS ?pct90)

  ?hw a pv:Hardware ;
    pv:id ?id ;
    pv:name ?name ;
    pv:width_mm ?width .

  FILTER(?width >= ?pct90)
}
ORDER BY DESC(?width)


question: Which supplier delivers the most reliable Inductor?

sparql:
PREFIX pv: <http://ld.company.org/prod-vocab/>
SELECT DISTINCT ?result
WHERE
{
  ?hardware pv:hasCategory <http://ld.company.org/prod-instances/prod-cat-Inductor> .
  ?hardware pv:reliabilityIndex ?reliabilityIndex .
  ?hardware pv:hasSupplier ?result .
}
ORDER BY DESC(?reliabilityIndex)
LIMIT 1


question: What are the top 5 suppliers with best average reliability over their products.

sparql:
PREFIX pv: <http://ld.company.org/prod-vocab/>
SELECT DISTINCT ?result (AVG(?reliabilityIndex) AS ?averageReliabilityIndex)
WHERE
{
  ?hardware pv:reliabilityIndex ?reliabilityIndex .
  ?hardware pv:hasSupplier ?result .
}
GROUP BY ?result
ORDER BY DESC(?averageReliabilityIndex)
LIMIT 5


question: From which countries are the BOM parts of our SkySync MechWave delivered?

sparql:
PREFIX pv: <http://ld.company.org/prod-vocab/>
SELECT DISTINCT ?result
WHERE
{
  <http://ld.company.org/prod-instances/bom-17> pv:hasBomPart ?bomPart .
  ?bomPart pv:hasPart ?product .
  ?product pv:hasSupplier ?supplier .
  ?supplier pv:country ?result
}


question: Show me all BOMs which have at least on part from a polish supplier.

sparql:
PREFIX pv: <http://ld.company.org/prod-vocab/>
SELECT DISTINCT ?result
WHERE
{
  ?result a pv:BillOfMaterial .
  ?result pv:hasBomPart ?bomPart .
  ?bomPart pv:hasPart ?product .
  ?product pv:hasSupplier ?supplier .
  ?supplier pv:country <http://dbpedia.org/resource/Poland> .
}


question: How many suppliers can deliver alternative compatible products for the K367 Strain Encoder?

sparql:
PREFIX pv: <http://ld.company.org/prod-vocab/>
SELECT DISTINCT (COUNT(?supplier) AS ?result)
WHERE
{
  <http://ld.company.org/prod-instances/hw-K367-1320550> pv:compatibleProduct ?alternative .
  ?alternative pv:hasSupplier ?supplier .
}


question: Which department is resposible for the most product and how many product are this?

sparql:
PREFIX pv: <http://ld.company.org/prod-vocab/>
SELECT DISTINCT ?result (COUNT(?result) AS ?count)
WHERE
{
  ?result pv:responsibleFor ?product .
}
GROUP BY ?result
ORDER BY DESC(?count)
LIMIT 1