com.bigdata.rdf.sparql.ast.eval.bsbm.bi.query4.rq Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bigdata-rdf-test Show documentation
Show all versions of bigdata-rdf-test Show documentation
Blazegraph(TM) RDF Test Suites
# BSBM BI Q4
#
# Query 4: Feature with the highest ratio between price with that feature and price without that feature.
#
# Use Case Motivation: A customer wants to inform herself which features have the most impact on the product price to get hints on how to restrict the following product search.
#
# Note: xsd:string => str(), but 2x faster if you just do sum(?price)!
#
# Last Changed Rev: 5682
# Last Changed Date: 2011-11-17 20:09:12 -0500 (Thu, 17 Nov 2011)
# solutions=100, chunks=1, elapsed=56500ms.
# solutions=100, chunks=1, elapsed=55114ms.
#
# The sub-selects are very similar, but ?feature is pulled out in the 2nd one.
prefix bsbm:
prefix bsbm-inst:
prefix xsd:
Select ?feature ((?sumF*(?countTotal-?countF))/(?countF*(?sumTotal-?sumF)) As ?priceRatio)
{
{ Select (count(?price) As ?countTotal) (sum(xsd:float(str(?price))) As ?sumTotal)
{
?product a .
?offer bsbm:product ?product ;
bsbm:price ?price .
}
}
{ Select ?feature (count(?price2) As ?countF) (sum(xsd:float(str(?price2))) As ?sumF)
{
?product2 a ;
bsbm:productFeature ?feature .
?offer2 bsbm:product ?product2 ;
bsbm:price ?price2 .
}
Group By ?feature
}
}
Order By desc(?priceRatio) ?feature
Limit 100
© 2015 - 2024 Weber Informatics LLC | Privacy Policy