Say I have a query like this:
WHERE {
<http://purl.uniprot.org/uniprot/Q8NAT1> up:classifiedWith ?annotation .
?protein up:classifiedWith ?annotation .
<http://purl.uniprot.org/uniprot/Q8NAT1> up:annotation ?O3OET.
?O3OET a up:Topological_Domain_Annotation;
rdfs:comment ?topology;
up:range ?Q02UJ .
?protein a up:Protein .
?protein up:annotation ?otherTop .
?otherTop a up:Topological_Domain_Annotation;
rdfs:comment ?topology;
up:range ?OTHERRANGE .
<http://purl.uniprot.org/uniprot/Q8NAT1> up:annotation ?S7IK0.
?S7IK0 a up:Pathway_Annotation ;
rdfs:seeAlso ?pathway .
?protein a up:Protein .
?protein up:annotation ?VAR2 .
?VAR2 a up:Pathway_Annotation ;
rdfs:seeAlso ?pathway .
<http://purl.uniprot.org/uniprot/Q8NAT1> up:citation ?citation .
?protein up:citation ?citation .
}
GROUP BY ?protein
Where I'm trying to query unique instances of each variable, without the full Cartesian Product that SPARQL typically does. I now want a list of all distinct variable matches for each queried variable.
ie., if there are 10 distinct proteins, and 2 distinct annotations, how do I get these results? Do I have to make separate queries?