title: SPARQL query to find all sub classes and a super class of a given class
body: <p>I need to write a SPARQL query to find a superclass/subclasses of a given class.</p>
  
  <p>For example, given <a href="http://139.91.183.30:9090/RDF/VRP/Examples/Phenomenon.rdf" rel="noreferrer">http://139.91.183.30:9090/RDF/VRP/Examples/Phenomenon.rdf</a> RDFS vocabulary file, I want to find the superclass of 'AcousticWave' (which is 'Wave').</p>
  
  <p>Similarly if user enters 'Wave', I want to get all sub classes of 'Wave' (which are 'AcousticWave', 'GravityWave', 'InternalWave' and Tide').</p>
  
  <p><img src="https://i.stack.imgur.com/dNdlJ.png" alt="enter image description here"></p>
  
  <p>How would I write such SPARQL query?</p>