Skip to content

Latest commit

 

History

History
59 lines (48 loc) · 2.04 KB

11.md

File metadata and controls

59 lines (48 loc) · 2.04 KB

Get offers for a given product which fulfill specific requirements

Description

The consumer wants to buy from a vendor in the United States that is able to deliver within 3 days and is looking for the cheapest offer that fulfills these requirements.

The corresponding query refers to a randomly selected product and defines a current date within the "valid from" and "valid to" range of the offers.

Sample

"Look for the cheapest and still valid by 2008-06-15 offer for the product waterskiing sharpness horseshoes by a US vendor that is able to deliver within 3 days".

Expected Outcome

Given the sample dataset bsbm-1000products, the user interface should get as a response the following offers starting from cheapest:

"Offer11865" and "Offer15103".

SPARQL Query to Perform

SELECT DISTINCT ?offer ?price
WHERE {
	?offer bsbm:product %ProductXYZ% .
	?offer bsbm:vendor ?vendor .
	?offer dc:publisher ?vendor .
	?vendor bsbm:country <http://downlode.org/rdf/iso-3166/countries#US> .
	?offer bsbm:deliveryDays ?deliveryDays .
	FILTER (?deliveryDays <= 3)
	?offer bsbm:price ?price .
	?offer bsbm:validTo ?date .
	FILTER (?date > %currentDate% )
}
ORDER BY xsd:double(str(?price))
LIMIT 10

SPARQL Query for the Sample Query

PREFIX bsbm: <http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX pr16: <http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/dataFromProducer16/>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
SELECT DISTINCT ?offer ?price
WHERE {
	?offer bsbm:product pr16:Product768 .
	?offer bsbm:vendor ?vendor .
	?offer dc:publisher ?vendor .
	?vendor bsbm:country <http://downlode.org/rdf/iso-3166/countries#US> .
	?offer bsbm:deliveryDays ?deliveryDays .
	FILTER (?deliveryDays <= 3)
	?offer bsbm:price ?price .
	?offer bsbm:validTo ?date .
	FILTER (?date > "2008-06-15"^^xsd:date )
}
ORDER BY xsd:double(str(?price))
LIMIT 10