<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="/isparql/xslt/dynamic-page.xsl"?><iSPARQL xmlns="urn:schemas-openlink-com:isparql"><ISparqlDynamicPage><proxy>true</proxy><query><![CDATA[#service:/sparql
#should-sponge:soft

define sql:signal-void-variables 1
prefix tpch: <http://www.openlinksw.com/schemas/tpch#>
prefix oplsioc: <http://www.openlinksw.com/schemas/oplsioc#>
prefix sioc: <http://rdfs.org/sioc/ns#>
prefix foaf: <http://xmlns.com/foaf/0.1/>
select ?cust+>foaf:name ?cust ?ord ?ord+>tpch:orderdate ?ord+>tpch:ordertotalprice sum(?li+>tpch:linequantity)
from <http://demo.openlinksw.com/tpch>
where
  {
    ?cust a tpch:customer ; foaf:name ?c_name .
    ?ord a tpch:order ; tpch:has_customer ?cust .
    ?li a tpch:lineitem ; tpch:has_order ?ord .
      {
        select ?sum_order sum (?li2+>tpch:linequantity) as ?sum_q
        where
          {
            ?li2 a tpch:lineitem ; tpch:has_order ?sum_order .
          }
      } .
    filter (?sum_order = ?ord and ?sum_q > 250)
  }
order by desc (?ord+>tpch:ordertotalprice) ?ord+>tpch:orderdate
]]></query><graph>http://demo.openlinksw.com/tpch</graph></ISparqlDynamicPage><should_sponge>soft</should_sponge><service>/sparql</service></iSPARQL>