title: Retrieve objects from RDF triples
body: <p>With the following snippet from the pizza ontology:</p>
  <pre><code>&lt;owl:Class rdf:about=&quot;http://www.co-ode.org/ontologies/pizza/pizza.owl#Pizza&quot;&gt;
     &lt;rdfs:subClassOf rdf:resource=&quot;http://www.co-ode.org/ontologies/pizza/pizza.owl#Food&quot;/&gt;
          &lt;rdfs:subClassOf&gt;
              &lt;owl:Restriction&gt;
                  &lt;owl:onProperty rdf:resource=&quot;http://www.co-ode.org/ontologies/pizza/pizza.owl#hasBase&quot;/&gt;
                  &lt;owl:someValuesFrom rdf:resource=&quot;http://www.co-ode.org/ontologies/pizza/pizza.owl#PizzaBase&quot;/&gt;
              &lt;/owl:Restriction&gt;
          &lt;/rdfs:subClassOf&gt;
          &lt;rdfs:label xml:lang=&quot;en&quot;&gt;Pizza&lt;/rdfs:label&gt;
          &lt;rdfs:seeAlso rdf:resource=&quot;https://en.wikipedia.org/wiki/Pizza&quot;/&gt;
          &lt;skos:prefLabel xml:lang=&quot;en&quot;&gt;Pizza&lt;/skos:prefLabel&gt;
      &lt;/owl:Class&gt;
  </code></pre>
  <p>I see from this that the following triple exists:
  &lt;Pizza, hasBase, PizzaBase&gt; representing &lt;subject, predicate, object&gt;</p>
  <p>How do I write SPARQL to extract the the PizzaBase object or any object from a triplet when the entity and relation are known?</p>
  <p>Note: I am equating subject as entity and predicate as relation</p>
  <p>Update:
  Let me simplify my question.
  Based on the given RDF above and the following RDF graph:</p>
  <p><a href="https://i.stack.imgur.com/vEUp3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vEUp3.png" alt="enter image description here" /></a></p>
  <p>What would be the SPARQL to extract the PizzaBase entity given the Pizza entity and the hasBase relation?</p>