{"id":2141,"date":"2005-08-03T23:17:35","date_gmt":"2005-08-03T23:17:35","guid":{"rendered":"http:\/\/www.leobard.net\/blog\/?p=2141"},"modified":"2017-11-04T15:48:25","modified_gmt":"2017-11-04T15:48:25","slug":"sparql-fast-as-hell","status":"publish","type":"post","link":"https:\/\/www.leobard.net\/blog\/2005\/08\/03\/sparql-fast-as-hell\/","title":{"rendered":"sparql fast as hell"},"content":{"rendered":"<p>In the last two months we shifted the gnowsis search services to SPARQL. Our problem was, that the common ARQ implementation is slow and does not work in a named graph scenario.<\/p>\n<p>A fine twist in history brought Richard Cyganiak to work at HP Labs for a while and he hacked <a href=\"http:\/\/cvs.sourceforge.net\/viewcvs.py\/jena\/sparql2sql\/src\/sparql2sql\/\">sparql2sql <\/a>there, a mapping of sparql to the jena database scheme with support for named graphs.<\/p>\n<p>I asked him if I can use it in gnowsis and he was quite happy to have this as a test-case. Result is, that Richard added a special framework for fulltext search and I hacked some stuff regarding MySQL&#8217;s fine FULLTEXT index functions (if you don&#8217;t know it: its similiar to lucene, can do relevance and query expansion and so on)<\/p>\n<p>outcome: an hour ago I transformed the SQL index to the new fulltext format and got hit in the face with the new answer times:<\/p>\n<p>SPARQL of this kind works practically instantly (10-20msec):<br \/>\n<cite>PREFIX rdf: &lt;http:\/\/www.w3.org\/1999\/02\/22-rdf-syntax-ns#&gt;<br \/>\nPREFIX rdfs: &lt;http:\/\/www.w3.org\/2000\/01\/rdf-schema#&gt;<br \/>\nSELECT ?x ?label WHERE<br \/>\n{ GRAPH ?source {<br \/>\n?x rdfs:label ?label.<br \/>\nFILTER REGEX(?label, &#8220;test&#8221;, &#8220;i&#8221;)}}<\/cite><\/p>\n<p>But the real astonishing thing is that SPARQL  of this kind is also fast as hell (10-500ms):<br \/>\n<cite>PREFIX rdf: &lt;http:\/\/www.w3.org\/1999\/02\/22-rdf-syntax-ns#&gt;<br \/>\nPREFIX rdfs: &lt;http:\/\/www.w3.org\/2000\/01\/rdf-schema#&gt;<br \/>\nSELECT ?x ?p ?label WHERE<br \/>\n{ GRAPH ?source {<br \/>\n?x ?p ?label.<br \/>\nFILTER REGEX(?label, &#8220;test&#8221;, &#8220;i&#8221;)}}<\/cite><\/p>\n<p>In simple words: this is a fulltext scan over all properties of all statements. don&#8217;t get bothered by the warmup time, the thing will need about 10-20 sec warmup, but then its great.<\/p>\n<p>triplecount:<br \/>\n371994<\/p>\n<p>for the freaks we will probably pack a little executable jar that packs all into a nice demo. for the real freaks:<br \/>\n<a href=\"http:\/\/gnowsis.opendfki.de\/repos\/gnowsis\/trunk\/sparql2sql\/\">http:\/\/gnowsis.opendfki.de\/repos\/gnowsis\/trunk\/sparql2sql\/<\/a><\/p>\n<p><a href=\"https:\/\/gnowsis.opendfki.de\/cgi-bin\/trac.cgi\/file\/trunk\/sparql2sql\/src\/sparql2sql\/VisualTest.java \">demo app <\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In the last two months we shifted the gnowsis search services to SPARQL. Our problem was, that the common ARQ implementation is slow and does not work in a named graph scenario. A fine twist in history brought Richard Cyganiak to work at HP Labs for a while and he hacked sparql2sql there, a mapping &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.leobard.net\/blog\/2005\/08\/03\/sparql-fast-as-hell\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;sparql fast as hell&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_bluesky_dont_syndicate":"","_bluesky_syndication_accounts":"","_bluesky_syndication_text":"","activitypub_content_warning":"","activitypub_content_visibility":"","activitypub_max_image_attachments":3,"activitypub_interaction_policy_quote":"anyone","activitypub_status":"","footnotes":""},"categories":[5],"tags":[],"class_list":["post-2141","post","type-post","status-publish","format-standard","hentry","category-semweb"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>sparql fast as hell - Leobard&#039;s blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.leobard.net\/blog\/2005\/08\/03\/sparql-fast-as-hell\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"sparql fast as hell - Leobard&#039;s blog\" \/>\n<meta property=\"og:description\" content=\"In the last two months we shifted the gnowsis search services to SPARQL. Our problem was, that the common ARQ implementation is slow and does not work in a named graph scenario. A fine twist in history brought Richard Cyganiak to work at HP Labs for a while and he hacked sparql2sql there, a mapping &hellip; Continue reading &quot;sparql fast as hell&quot;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.leobard.net\/blog\/2005\/08\/03\/sparql-fast-as-hell\/\" \/>\n<meta property=\"og:site_name\" content=\"Leobard&#039;s blog\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/leobard\" \/>\n<meta property=\"article:published_time\" content=\"2005-08-03T23:17:35+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2017-11-04T15:48:25+00:00\" \/>\n<meta name=\"author\" content=\"leobard\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"leobard\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.leobard.net\\\/blog\\\/2005\\\/08\\\/03\\\/sparql-fast-as-hell\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.leobard.net\\\/blog\\\/2005\\\/08\\\/03\\\/sparql-fast-as-hell\\\/\"},\"author\":{\"name\":\"leobard\",\"@id\":\"https:\\\/\\\/www.leobard.net\\\/blog\\\/#\\\/schema\\\/person\\\/23f718c5d3bd8d343befaa1b11bdc609\"},\"headline\":\"sparql fast as hell\",\"datePublished\":\"2005-08-03T23:17:35+00:00\",\"dateModified\":\"2017-11-04T15:48:25+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.leobard.net\\\/blog\\\/2005\\\/08\\\/03\\\/sparql-fast-as-hell\\\/\"},\"wordCount\":321,\"commentCount\":0,\"articleSection\":[\"SemWeb\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.leobard.net\\\/blog\\\/2005\\\/08\\\/03\\\/sparql-fast-as-hell\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.leobard.net\\\/blog\\\/2005\\\/08\\\/03\\\/sparql-fast-as-hell\\\/\",\"url\":\"https:\\\/\\\/www.leobard.net\\\/blog\\\/2005\\\/08\\\/03\\\/sparql-fast-as-hell\\\/\",\"name\":\"sparql fast as hell - Leobard&#039;s blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.leobard.net\\\/blog\\\/#website\"},\"datePublished\":\"2005-08-03T23:17:35+00:00\",\"dateModified\":\"2017-11-04T15:48:25+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.leobard.net\\\/blog\\\/#\\\/schema\\\/person\\\/23f718c5d3bd8d343befaa1b11bdc609\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.leobard.net\\\/blog\\\/2005\\\/08\\\/03\\\/sparql-fast-as-hell\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.leobard.net\\\/blog\\\/2005\\\/08\\\/03\\\/sparql-fast-as-hell\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.leobard.net\\\/blog\\\/2005\\\/08\\\/03\\\/sparql-fast-as-hell\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.leobard.net\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"sparql fast as hell\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.leobard.net\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.leobard.net\\\/blog\\\/\",\"name\":\"Leobard&#039;s blog\",\"description\":\"personal weblog of Leo Sauermann\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.leobard.net\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.leobard.net\\\/blog\\\/#\\\/schema\\\/person\\\/23f718c5d3bd8d343befaa1b11bdc609\",\"name\":\"leobard\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4f15ee76fffcb732371d121c4713809a3f075186c6223630d4fe6c82ae88166d?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4f15ee76fffcb732371d121c4713809a3f075186c6223630d4fe6c82ae88166d?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4f15ee76fffcb732371d121c4713809a3f075186c6223630d4fe6c82ae88166d?s=96&d=mm&r=g\",\"caption\":\"leobard\"},\"description\":\"https:\\\/\\\/www.leobard.net\\\/blog\\\/about-leo-sauermann\\\/\",\"sameAs\":[\"https:\\\/\\\/www.leobard.net\\\/\",\"https:\\\/\\\/www.facebook.com\\\/leobard\",\"https:\\\/\\\/www.instagram.com\\\/leobarder\\\/\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/leosauermann\\\/\"],\"url\":\"https:\\\/\\\/www.leobard.net\\\/blog\\\/author\\\/leobard\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"sparql fast as hell - Leobard&#039;s blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.leobard.net\/blog\/2005\/08\/03\/sparql-fast-as-hell\/","og_locale":"en_US","og_type":"article","og_title":"sparql fast as hell - Leobard&#039;s blog","og_description":"In the last two months we shifted the gnowsis search services to SPARQL. Our problem was, that the common ARQ implementation is slow and does not work in a named graph scenario. A fine twist in history brought Richard Cyganiak to work at HP Labs for a while and he hacked sparql2sql there, a mapping &hellip; Continue reading \"sparql fast as hell\"","og_url":"https:\/\/www.leobard.net\/blog\/2005\/08\/03\/sparql-fast-as-hell\/","og_site_name":"Leobard&#039;s blog","article_author":"https:\/\/www.facebook.com\/leobard","article_published_time":"2005-08-03T23:17:35+00:00","article_modified_time":"2017-11-04T15:48:25+00:00","author":"leobard","twitter_card":"summary_large_image","twitter_misc":{"Written by":"leobard","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.leobard.net\/blog\/2005\/08\/03\/sparql-fast-as-hell\/#article","isPartOf":{"@id":"https:\/\/www.leobard.net\/blog\/2005\/08\/03\/sparql-fast-as-hell\/"},"author":{"name":"leobard","@id":"https:\/\/www.leobard.net\/blog\/#\/schema\/person\/23f718c5d3bd8d343befaa1b11bdc609"},"headline":"sparql fast as hell","datePublished":"2005-08-03T23:17:35+00:00","dateModified":"2017-11-04T15:48:25+00:00","mainEntityOfPage":{"@id":"https:\/\/www.leobard.net\/blog\/2005\/08\/03\/sparql-fast-as-hell\/"},"wordCount":321,"commentCount":0,"articleSection":["SemWeb"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.leobard.net\/blog\/2005\/08\/03\/sparql-fast-as-hell\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.leobard.net\/blog\/2005\/08\/03\/sparql-fast-as-hell\/","url":"https:\/\/www.leobard.net\/blog\/2005\/08\/03\/sparql-fast-as-hell\/","name":"sparql fast as hell - Leobard&#039;s blog","isPartOf":{"@id":"https:\/\/www.leobard.net\/blog\/#website"},"datePublished":"2005-08-03T23:17:35+00:00","dateModified":"2017-11-04T15:48:25+00:00","author":{"@id":"https:\/\/www.leobard.net\/blog\/#\/schema\/person\/23f718c5d3bd8d343befaa1b11bdc609"},"breadcrumb":{"@id":"https:\/\/www.leobard.net\/blog\/2005\/08\/03\/sparql-fast-as-hell\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.leobard.net\/blog\/2005\/08\/03\/sparql-fast-as-hell\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.leobard.net\/blog\/2005\/08\/03\/sparql-fast-as-hell\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.leobard.net\/blog\/"},{"@type":"ListItem","position":2,"name":"sparql fast as hell"}]},{"@type":"WebSite","@id":"https:\/\/www.leobard.net\/blog\/#website","url":"https:\/\/www.leobard.net\/blog\/","name":"Leobard&#039;s blog","description":"personal weblog of Leo Sauermann","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.leobard.net\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.leobard.net\/blog\/#\/schema\/person\/23f718c5d3bd8d343befaa1b11bdc609","name":"leobard","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4f15ee76fffcb732371d121c4713809a3f075186c6223630d4fe6c82ae88166d?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4f15ee76fffcb732371d121c4713809a3f075186c6223630d4fe6c82ae88166d?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4f15ee76fffcb732371d121c4713809a3f075186c6223630d4fe6c82ae88166d?s=96&d=mm&r=g","caption":"leobard"},"description":"https:\/\/www.leobard.net\/blog\/about-leo-sauermann\/","sameAs":["https:\/\/www.leobard.net\/","https:\/\/www.facebook.com\/leobard","https:\/\/www.instagram.com\/leobarder\/","https:\/\/www.linkedin.com\/in\/leosauermann\/"],"url":"https:\/\/www.leobard.net\/blog\/author\/leobard\/"}]}},"_links":{"self":[{"href":"https:\/\/www.leobard.net\/blog\/wp-json\/wp\/v2\/posts\/2141","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.leobard.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.leobard.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.leobard.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.leobard.net\/blog\/wp-json\/wp\/v2\/comments?post=2141"}],"version-history":[{"count":1,"href":"https:\/\/www.leobard.net\/blog\/wp-json\/wp\/v2\/posts\/2141\/revisions"}],"predecessor-version":[{"id":2927,"href":"https:\/\/www.leobard.net\/blog\/wp-json\/wp\/v2\/posts\/2141\/revisions\/2927"}],"wp:attachment":[{"href":"https:\/\/www.leobard.net\/blog\/wp-json\/wp\/v2\/media?parent=2141"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.leobard.net\/blog\/wp-json\/wp\/v2\/categories?post=2141"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.leobard.net\/blog\/wp-json\/wp\/v2\/tags?post=2141"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}