title: SPARQL parameterized queries
body: <p>Good day! I apply rdflib for python. I have a question. How can I put variable into SPARQL's query ?
  Instead of 'OSPF' in course:OSPF!</p>
  
  <pre><code>qres = g.query(
      """SELECT ?x ?z ?y
          WHERE {
             course:OSPF course:termName ?x.
             course:OSPF ?s ?t.
             ?s ?d ?z.
             ?t course:termName ?y.
             FILTER (regex(?z,"[^a-z]","i") &amp;&amp; isLiteral(?z) )
          }"""
          ,initNs=dict(course=Namespace.....
  </code></pre>
  
  <p>@<strong>msalvadores</strong>
  I want enter my Variable by console. --->python parse.py OSPF A value of variable(OSPF) may be another one. How can I initialize it into query(WHERE)? I have resolved my question by interpolation of variable several days ago. Like this: </p>
  
  <pre><code>    qtest = "OSPF","OSPF"
      q =( """SELECT ?x ?z ?y\
              WHERE {\
                 course:%s course:termName ?x.\
                 course:%s ?s ?t.\
                 ?s ?d ?z.\
                 ?t course:termName ?y.\
                 FILTER (regex(?z,'[^a-z0-9]','i') &amp;&amp; isLiteral(?z) )\
              }ORDER BY ASC(?s)\
              """)% qtest
     qres = g.query(q, initNs=dict(course=Namespace
  </code></pre>
  
  <p>But I suppose it could be done another way. Because on my opinion the solution is not quite right presented by me.</p>