22: For two accession numbers (ACs) find the GO term labels and group them into GO process,function and component

 
1
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
2
PREFIX up: <http://purl.uniprot.org/core/>
3
PREFIX GO:<http://purl.obolibrary.org/obo/GO_>
4
SELECT 
5
    (CONCAT(SUBSTR(STR(?protein), 33)) AS ?uniprot)
6
    (GROUP_CONCAT(?celtype; separator=";") AS ?celtypes)
7
    (GROUP_CONCAT(?biotype; separator=";") AS ?biotypes)
8
    (GROUP_CONCAT(?moltype; separator=";") AS ?moltypes)
9
WHERE
10
{
11
    VALUES (?ac) {("Q6GZX4") ("Q96375")}
12
    BIND (IRI(CONCAT("http://purl.uniprot.org/uniprot/",?ac)) AS ?protein)
13
    ?protein a up:Protein .
14
    ?protein up:classifiedWith ?goTerm .
15
    #Determine if the type is biological_process
16
    OPTIONAL {
17
        ?goTerm rdfs:subClassOf GO:0008150 .
18
        ?goTerm rdfs:label ?biotype .
19
    }
20
    #Determine if the type is cellular_component
21
    OPTIONAL {
22
        ?goTerm rdfs:subClassOf GO:0005575 .
23
        ?goTerm rdfs:label ?celtype .
24
    }
25
    #Determine if the type is molecular_function
26
    OPTIONAL {
27
        ?goTerm rdfs:subClassOf GO:0003674 .
28
        ?goTerm rdfs:label ?moltype .
29
    }
30
    #Filter out the uniprot keywords
31
    FILTER(bound(?biotype) || bound(?celtype) || bound(?moltype))
32
} GROUP BY ?protein
Use