Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

[r13]: trunk / bibm / tpch / sparql / query11.txt Maximize Restore History

Download this file

query11.txt    40 lines (38 with data), 1.2 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
define sql:signal-void-variables 1
prefix tpcd: <http://www.openlinksw.com/schemas/tpcd#>
prefix oplsioc: <http://www.openlinksw.com/schemas/oplsioc#>
prefix sioc: <http://rdfs.org/sioc/ns#>
prefix foaf: <http://xmlns.com/foaf/0.1/>
select
?bpartkey,
?bigpsvalue
from <http://example.com/tpcd>
where {
{ select
(sum(?t_supplycost * ?t_availqty) * %FRACTION%) as ?threshold
where {
?thr_ps a tpcd:partsupp ;
tpcd:ps_has_supplier ?t_supplier ;
tpcd:ps_supplycost ?t_supplycost ;
tpcd:ps_availqty ?t_availqty .
?t_supplier tpcd:s_has_nation ?t_nation .
?t_nation tpcd:n_name "%NATION%" .
}
}
{ select
?bpartkey,
sum(?b_supplycost * ?b_availqty) as ?bigpsvalue
where {
?bigps a tpcd:partsupp ;
tpcd:ps_has_ps_partkey ?bpartkey ;
tpcd:ps_has_supplier ?b_supplier ;
tpcd:ps_supplycost ?b_supplycost ;
tpcd:ps_availqty ?b_availqty .
?b_supplier tpcd:s_has_nation ?b_nation .
?b_nation tpcd:n_name "%NATION%" .
}
}
filter (?bigpsvalue > ?threshold)
}
order by
desc (?bigpsvalue)