Skip to content

Latest commit

 

History

History
63 lines (52 loc) · 2.01 KB

9.md

File metadata and controls

63 lines (52 loc) · 2.01 KB

Give me recent reviews in English for a specific product

Description

The consumer wants to read the 20 most recent English language reviews about a specific product.

The corresponding query refers to a randomly selected product.

Sample

"For the product waterskiing sharpness horseshoes list the 20 more recent reviews in English".

Expected Outcome

Given the sample dataset bsbm-1000products, the user should obtain the details for the following reviews in the order they are listed:

"Review5481", "Review8494" and "Review2669".

SPARQL Query to Perform

SELECT ?title ?text ?reviewDate ?reviewer ?reviewerName
	?rating1 ?rating2 ?rating3 ?rating4
WHERE {
	?review bsbm:reviewFor %ProductXYZ% .
	?review dc:title ?title .
	?review rev:text ?text .
	FILTER langMatches( lang(?text), "EN" )
	?review bsbm:reviewDate ?reviewDate .
	?review rev:reviewer ?reviewer .
	?reviewer foaf:name ?reviewerName .
	OPTIONAL { ?review bsbm:rating1 ?rating1 . }
	OPTIONAL { ?review bsbm:rating2 ?rating2 . }
	OPTIONAL { ?review bsbm:rating3 ?rating3 . }
	OPTIONAL { ?review bsbm:rating4 ?rating4 . }
}
ORDER BY DESC(?reviewDate)
LIMIT 20

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/>
SELECT ?title ?text ?reviewDate ?reviewer ?reviewerName
	?rating1 ?rating2 ?rating3 ?rating4
WHERE {
	?review bsbm:reviewFor pr16:Product768 .
	?review dc:title ?title .
	?review rev:text ?text .
	FILTER langMatches( lang(?text), "EN" )
	?review bsbm:reviewDate ?reviewDate .
	?review rev:reviewer ?reviewer .
	?reviewer foaf:name ?reviewerName .
	OPTIONAL { ?review bsbm:rating1 ?rating1 . }
	OPTIONAL { ?review bsbm:rating2 ?rating2 . }
	OPTIONAL { ?review bsbm:rating3 ?rating3 . }
	OPTIONAL { ?review bsbm:rating4 ?rating4 . }
}
ORDER BY DESC(?reviewDate)
LIMIT 20