title: Query separate lists of distinct variables in SPARQL?
body: <p>Say I have a query like this:</p>
  
  <pre><code>WHERE {
  &lt;http://purl.uniprot.org/uniprot/Q8NAT1&gt; up:classifiedWith ?annotation .
  ?protein up:classifiedWith ?annotation .
      &lt;http://purl.uniprot.org/uniprot/Q8NAT1&gt; 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 .
      &lt;http://purl.uniprot.org/uniprot/Q8NAT1&gt; 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 .
  &lt;http://purl.uniprot.org/uniprot/Q8NAT1&gt; up:citation ?citation .
  ?protein up:citation ?citation .
  }
  GROUP BY ?protein
  </code></pre>
  
  <p>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 <em>all</em> distinct variable matches for each queried variable.</p>
  
  <p>ie., if there are 10 distinct proteins, and 2 distinct annotations, how do I get these results? Do I have to make separate queries?</p>