Virtuoso Open-Source Edition

  • Topic
  • Discussion
  • VOS.VirtTipsAndTricksSPARQLEscapeQuotesInEntity(Last) -- DAVWikiAdmin? , 2017-06-13 05:48:41 Edit WebDAV System Administrator 2017-06-13 05:48:41

    Example of Handling Double Quotes in SPARQL Query Entity Name Subject

    What?

    Escape double quotes in entity name.

    Why?

    If double quotes are not escaped properly, a syntax error will be presented.

    How?

    Here is sample scenario:

    1. Load sample data:

      SQL> SPARQL INSERT INTO GRAPH <http://mygraph.com> { `iri (bif:concat ('http://dbpedia.org/resource/Raiders_of_the_', '"Lost"', '_Car_Park'))` a `iri (<http://dbpedia.org/class/yago/1994Novels> )` . `iri (bif:concat ('http://dbpedia.org/resource/Raiders_of_the_', '"Found"', '_Car_Park'))` a `iri (<http://dbpedia.org/class/yago/1995Novels> )` . }; Done. -- 78 msec.

    2. Find triple(s) with entity name <http://dbpedia.org/resource/Raiders_of_the_"Lost"_Car_Park> by using the iri function:

      SQL> SPARQL SELECT * FROM <http://mygraph.com> WHERE { {`iri('http://dbpedia.org/resource/Raiders_of_the_"Lost"_Car_Park')` ?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.

    Related