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

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

There is a newer version: 2.1.4
Show newest version
prefix bsbm: 
prefix bsbm-inst: 
prefix rev: 
prefix xsd: 
Select ?country ?product ?nrOfReviews ?avgPrice
{
#hint:Query hint:mergeJoin "false" .
#hint:Query hint:analytic "true" .
  { Select ?country (max(?nrOfReviews) As ?maxReviews)
    {
      { Select ?country ?product (count(?review) As ?nrOfReviews)
        {
          ?product a bsbm-inst:ProductType1 .
          ?review bsbm:reviewFor ?product ;
                  rev:reviewer ?reviewer .
          ?reviewer bsbm:country ?country .
        }
        Group By ?country ?product
      }
    }
    Group By ?country
  }
  { Select ?product (avg(xsd:float(str(?price))) As ?avgPrice)
    {
      ?product a bsbm-inst:ProductType1 .
      ?offer bsbm:product ?product .
      ?offer bsbm:price ?price .
    }
    Group By ?product
  }
  { Select ?country ?product (count(?review) As ?nrOfReviews)
    {
      ?product a bsbm-inst:ProductType1 .
      ?review bsbm:reviewFor ?product .
      ?review rev:reviewer ?reviewer .
      ?reviewer bsbm:country ?country .
    }
    Group By ?country ?product
  }
  FILTER(?nrOfReviews=?maxReviews)
}
Order By desc(?nrOfReviews) ?country ?product




© 2015 - 2024 Weber Informatics LLC | Privacy Policy