title: RDF query as string
body: <p>I am new to RDF and SPARQL. Recently I tried to query the data from turtle file, and want to put it in a list. But what I've got are bunch of 'rdflib.term.Literal'. How can I convert it to string that can be append into list?</p>
  <pre><code>query =f&quot;&quot;&quot;
      SELECT (STR(?goal) AS ?label)
      WHERE {{
          {sub} {predi} {obj} .
      }}&quot;&quot;&quot;
  
      g.query(query)
  
      try:
          return g.query(query).goal
  
      except:
          result = []
          for item in g.query(query):
              result.append(item.label)
              print(type(item.label))
          return result
  </code></pre>
  <blockquote>
  <p><code>Here is the code I made but it does not work.</code></p>
  </blockquote>
  <p>]<a href="https://i.stack.imgur.com/Hx3US.png" rel="nofollow noreferrer">1</a></p>