All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.bigdata.rdf.sparql.ast.eval.bsbm.bi.query6.rq Maven / Gradle / Ivy

There is a newer version: 2.1.4
Show newest version
# BSBM BI Q6. Very fast.
#
# Query 5: Show the most popular products of a specific product type for each country - by review count
#
# Use Case Motivation: For advertisement reasons the owners of the e-commerce platform want to generate profiles for the two dimensions product type and the country of a customer.
#
# This is very fast (127ms) as long as the sub-select is extracted and run as 
# a named subquery.

prefix bsbm: 
prefix bsbm-inst: 
prefix rev: 
prefix xsd: 

Select ?reviewer (avg(xsd:float(?score)) As ?reviewerAvgScore)
{
  { Select (avg(xsd:float(?score)) As ?avgScore)
    {
      ?product bsbm:producer  .
      ?review bsbm:reviewFor ?product .
      { ?review bsbm:rating1 ?score . } UNION
      { ?review bsbm:rating2 ?score . } UNION
      { ?review bsbm:rating3 ?score . } UNION
      { ?review bsbm:rating4 ?score . }
    }
  }
  ?product bsbm:producer  .
  ?review bsbm:reviewFor ?product .
  ?review rev:reviewer ?reviewer .
  { ?review bsbm:rating1 ?score . } UNION
  { ?review bsbm:rating2 ?score . } UNION
  { ?review bsbm:rating3 ?score . } UNION
  { ?review bsbm:rating4 ?score . }
}
Group By ?reviewer
Having (avg(xsd:float(?score)) > min(?avgScore) * 1.5)




© 2015 - 2024 Weber Informatics LLC | Privacy Policy