-
Notifications
You must be signed in to change notification settings - Fork 4
/
0180_mulGrpAg.sparql
60 lines (51 loc) · 1.41 KB
/
0180_mulGrpAg.sparql
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# [aggregation] Multiple subqueries having aggregations
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bk: <http://knetminer.org/data/rdf/terms/biokno/>
PREFIX bkr: <http://knetminer.org/data/rdf/resources/>
PREFIX bka: <http://knetminer.org/data/rdf/terms/biokno/attributes/>
PREFIX bkg: <http://knetminer.org/data/rdf/resources/graphs/>
SELECT DISTINCT ?pwName ?type ?n
# DEBUG FROM bkg:poaceae
{
{
# Two ways to transport
SELECT ?pw ( COUNT ( DISTINCT ?prot ) AS ?n ) ( "enz" AS ?type )
{
?prot a bk:Protein.
?prot bk:is_a|^bk:ac_by ?enz.
?enz a bk:Enzyme.
{
# enz/cmp/trn branch
?enz bk:ac_by|bk:in_by ?cmp.
?cmp a bk:Comp.
?cmp bk:cs_by|bk:pd_by ?trn.
}
UNION {
# enz/trn branch
?trn bk:ca_by ?enz.
}
# From either transport to pathway
?trn a bk:Transport.
?trn bk:part_of ?pw.
?pw a bk:Path
}
GROUP BY ?pw
}
UNION
{
# To pathway, via protein and reaction
SELECT ?pw ( COUNT ( DISTINCT ?prot ) AS ?n ) ( "react" AS ?type )
{
# react branch
?prot a bk:Protein.
?prot bk:pd_by|bk:cs_by ?react.
?react a bk:Reaction.
?react bk:part_of ?pw.
?pw a bk:Path
}
GROUP BY ?pw
}
OPTIONAL { ?pw bk:prefName ?pwName }
}
LIMIT 100