title: SPARQL query to get all connected nodes
body: <p>I'm building a sort of rhyming dictionary using a triple store. The triplet data could look like:</p>
  
  <pre><code>cat rhymesWith hat
  hat rhymesWith bat
  sat rhymesWith bat
  </code></pre>
  
  <p>Given some word, I need a SPARQL query that gets all words that rhyme. In other words, given any single node, I need to retrieve ALL nodes that are connected via the rhymesWith predicate, any levels deep and in both directions.</p>
  
  <p>So for any one of the words above, it should retrieve all of the words and de-dupe them.</p>
  
  <p>How can I achieve this? </p>