title: Is there a WITH clause in SPARQL?
body: <p>Is there any analog of view creation or WITH clause from SQL in SPARQL?</p>
  <p>I want to:</p>
  <ol>
  <li>Select some data from table;</li>
  <li>Select data which is not in the first selection (by subject) from the same table.</li>
  </ol>
  <p>This seems to work without &quot;WITH&quot; but i do two similar SELECT query:</p>
  <pre class="lang-sql prettyprint-override"><code>SELECT * 
  FROM NAMED &lt;http://...&gt;
  {
    {
      SELECT DISTINCT ?s ?p ?o
      WHERE {
        BIND (&lt;http://www.w3.org/2004/02/skos/core#prefLabel&gt; AS ?p)
        { ?s &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#type&gt; &lt;http://www.w3.org/2004/02/skos/core#Concept&gt; . }
        FILTER(LANGMATCHES(LANG(?o), &quot;ru&quot;))
        
      }
      ORDER BY ?o
    }
  
    UNION
    
    {
      SELECT DISTINCT ?s ?p ?o
      WHERE {
        BIND (&lt;http://www.w3.org/2004/02/skos/core#prefLabel&gt; AS ?p)
        { ?s &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#type&gt; &lt;http://www.w3.org/2004/02/skos/core#Concept&gt; . }
        FILTER(LANGMATCHES(LANG(?o), &quot;en&quot;))
  
  
        MINUS {  
          SELECT DISTINCT ?s 
          WHERE {
            BIND (&lt;http://www.w3.org/2004/02/skos/core#prefLabel&gt; AS ?p)
            { ?s &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#type&gt; &lt;http://www.w3.org/2004/02/skos/core#Concept&gt; . }
            FILTER(LANGMATCHES(LANG(?o), &quot;ru&quot;))
  
          }
        }
      }
  
      ORDER BY ?o
    }
  }
  </code></pre>