<docbook><section><title>VirtTipsAndTricksSPARQLEscapeQuotesInEntity</title><para> </para>
<title>Example of Handling Double Quotes in SPARQL Query Entity Name Subject</title>Example of Handling Double Quotes in SPARQL Query Entity Name Subject
<bridgehead class="http://www.w3.org/1999/xhtml:h2">What?</bridgehead>
 Escape double quotes in entity name.<bridgehead class="http://www.w3.org/1999/xhtml:h2">Why?</bridgehead>
 If double quotes are not escaped properly, a syntax error will be presented.<bridgehead class="http://www.w3.org/1999/xhtml:h2">How?</bridgehead>
<para>Here is sample scenario:</para>
<orderedlist spacing="compact"><listitem>Load sample data: <programlisting>SQL&gt; SPARQL 
INSERT INTO GRAPH &lt;http://mygraph.com&gt; 
  {  
    `iri (bif:concat (&#39;http://dbpedia.org/resource/Raiders_of_the_&#39;, &#39;&quot;Lost&quot;&#39;,  &#39;_Car_Park&#39;))` a  `iri (&lt;http://dbpedia.org/class/yago/1994Novels&gt; )` .
    `iri (bif:concat (&#39;http://dbpedia.org/resource/Raiders_of_the_&#39;, &#39;&quot;Found&quot;&#39;, &#39;_Car_Park&#39;))` a  `iri (&lt;http://dbpedia.org/class/yago/1995Novels&gt; )` .    
  };

Done. -- 78 msec.
</programlisting></listitem>
<listitem>Find triple(s) with entity name <emphasis> &lt;http://dbpedia.org/resource/Raiders_of_the_&quot;Lost&quot;_Car_Park&gt; </emphasis> by using the iri function: <programlisting>SQL&gt; SPARQL 
SELECT *
FROM &lt;http://mygraph.com&gt;
WHERE
  {
    {`iri(&#39;http://dbpedia.org/resource/Raiders_of_the_&quot;Lost&quot;_Car_Park&#39;)` ?a ?b}
  };
  
a                                                     b
VARCHAR                                               VARCHAR
_______________________________________________________________________________

http://www.w3.org/1999/02/22-rdf-syntax-ns#type       http://dbpedia.org/class/yago/1994Novels

1 Rows. -- 47 msec.  
</programlisting> </listitem>
</orderedlist><bridgehead class="http://www.w3.org/1999/xhtml:h2">Related</bridgehead>
<itemizedlist mark="bullet" spacing="compact"><listitem><ulink url="VirtTipsAndTricksGuide">Virtuoso Tips and Tricks Collection</ulink> </listitem>
<listitem><ulink url="http://docs.openlinksw.com/virtuoso/rdfsparql.html">Virtuoso Documentation</ulink> </listitem>
</itemizedlist></section></docbook>