{"id":31,"date":"2011-07-28T09:53:38","date_gmt":"2011-07-28T09:53:38","guid":{"rendered":"http:\/\/sixhills-software.com\/blog\/2011\/07\/28\/excel-sparql-ole-db-provider\/"},"modified":"2021-01-25T14:47:35","modified_gmt":"2021-01-25T14:47:35","slug":"excel-sparql-ole-db-provider","status":"publish","type":"page","link":"https:\/\/sixhills-software.com\/blog\/excel-sparql-ole-db-provider\/","title":{"rendered":"SPARQLProv"},"content":{"rendered":"<p><strong>Excel SPARQL OLE DB Provider<\/strong><\/p>\n<p>The SPARQL OLE DB Provider allows Excel users to query Semantic Web data using SPARQL. All four types of query are supported, and either SPARQL Results or triples are returned to the spreadsheet through standard OLE DB connection. Up to 16 columns of data may be returned, with up to 255 characters per column.<\/p>\n<p>Queries are entered either using the Data Connection Wizard, or by opening a pre-existing Office Data Connection (.ODC) file (see examples below). When you have opened the query and displayed the data, then you can edit the query by right clicking on the table produced, and selecting Table-&gt;Edit Query. If you edit the query, you will need to refresh the query afterwards.<\/p>\n<p>This query executed on the DBpedia SPARQL endpoint\u2026<\/p>\n<pre style=\"background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas, 'Courier New', courier, monospace; font-size: 12px;\">PREFIX owl: <span style=\"color: #0000ff;\">&lt;<\/span><span style=\"color: #c71585;\">http<\/span>:\/\/www.w3.org\/2002\/07\/owl#<span style=\"color: #0000ff;\">&gt;<\/span><\/pre>\n<pre style=\"background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas, 'Courier New', courier, monospace; font-size: 12px;\">PREFIX xsd: <span style=\"color: #0000ff;\">&lt;<\/span><span style=\"color: #c71585;\">http<\/span>:\/\/www.w3.org\/2001\/XMLSchema#<span style=\"color: #0000ff;\">&gt;<\/span><\/pre>\n<pre style=\"background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas, 'Courier New', courier, monospace; font-size: 12px;\">PREFIX rdfs: <span style=\"color: #0000ff;\">&lt;<\/span><span style=\"color: #c71585;\">http<\/span>:\/\/www.w3.org\/2000\/01\/rdf-schema#<span style=\"color: #0000ff;\">&gt;<\/span><\/pre>\n<pre style=\"background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas, 'Courier New', courier, monospace; font-size: 12px;\">PREFIX rdf: <span style=\"color: #0000ff;\">&lt;<\/span><span style=\"color: #c71585;\">http<\/span>:\/\/www.w3.org\/1999\/02\/22-rdf-syntax-ns#<span style=\"color: #0000ff;\">&gt;<\/span><\/pre>\n<pre style=\"background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas, 'Courier New', courier, monospace; font-size: 12px;\">PREFIX foaf: <span style=\"color: #0000ff;\">&lt;<\/span><span style=\"color: #c71585;\">http<\/span>:\/\/xmlns.com\/foaf\/0.1<span style=\"color: #0000ff;\">\/&gt;<\/span><\/pre>\n<pre style=\"background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas, 'Courier New', courier, monospace; font-size: 12px;\">PREFIX dc: <span style=\"color: #0000ff;\">&lt;<\/span><span style=\"color: #c71585;\">http<\/span>:\/\/purl.org\/dc\/elements\/1.1<span style=\"color: #0000ff;\">\/&gt;<\/span><\/pre>\n<pre style=\"background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas, 'Courier New', courier, monospace; font-size: 12px;\">PREFIX : <span style=\"color: #0000ff;\">&lt;<\/span><span style=\"color: #c71585;\">http<\/span>:\/\/dbpedia.org\/resource<span style=\"color: #0000ff;\">\/&gt;<\/span><\/pre>\n<pre style=\"background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas, 'Courier New', courier, monospace; font-size: 12px;\">PREFIX dbpedia2: <span style=\"color: #0000ff;\">&lt;<\/span><span style=\"color: #c71585;\">http<\/span>:\/\/dbpedia.org\/property<span style=\"color: #0000ff;\">\/&gt;<\/span><\/pre>\n<pre style=\"background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas, 'Courier New', courier, monospace; font-size: 12px;\">PREFIX dbpedia: <span style=\"color: #0000ff;\">&lt;<\/span><span style=\"color: #c71585;\">http<\/span>:\/\/dbpedia.org<span style=\"color: #0000ff;\">\/&gt;<\/span><\/pre>\n<pre style=\"background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas, 'Courier New', courier, monospace; font-size: 12px;\">PREFIX skos: <span style=\"color: #0000ff;\">&lt;<\/span><span style=\"color: #c71585;\">http<\/span>:\/\/www.w3.org\/2004\/02\/skos\/core#<span style=\"color: #0000ff;\">&gt;<\/span><\/pre>\n<pre style=\"background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas, 'Courier New', courier, monospace; font-size: 12px;\">SELECT DISTINCT ?co ?marketCap ?netIncome ?operatingIncome ?revenue<\/pre>\n<pre style=\"background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas, 'Courier New', courier, monospace; font-size: 12px;\">WHERE {<\/pre>\n<pre style=\"background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas, 'Courier New', courier, monospace; font-size: 12px;\">?co dbpedia2:marketCap ?marketCap;<\/pre>\n<pre style=\"background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas, 'Courier New', courier, monospace; font-size: 12px;\">dbpedia2:netIncome ?netIncome;<\/pre>\n<pre style=\"background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas, 'Courier New', courier, monospace; font-size: 12px;\">dbpedia2:operatingIncome ?operatingIncome;<\/pre>\n<pre style=\"background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas, 'Courier New', courier, monospace; font-size: 12px;\">dbpedia2:revenue ?revenue }<\/pre>\n<pre style=\"background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas, 'Courier New', courier, monospace; font-size: 12px;\">LIMIT 30<\/pre>\n<p>\u2026produces this table of results in Excel\u2026<\/p>\n<p><a href=\"https:\/\/sixhills-software.com\/blog\/wp-content\/uploads\/2011\/07\/clip_image002.jpg\"><img loading=\"lazy\" class=\"alignnone\" style=\"background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;\" title=\"clip_image002\" src=\"http:\/\/sixhills-software.com\/blog\/wp-content\/uploads\/2011\/07\/clip_image002_thumb.jpg\" alt=\"clip_image002\" width=\"576\" height=\"436\" border=\"0\" \/><\/a><\/p>\n<p><strong>Defining a query<\/strong><\/p>\n<p>The provider takes two parameters for query<\/p>\n<p>1. Data Source to be queried \u2013<\/p>\n<p>2. The SPARQL query text<\/p>\n<p><strong>Parameter: Data Source<\/strong><\/p>\n<p>Entered in the OLE DB Data Source name field<\/p>\n<p>General format is &lt;source type&gt;:&lt;source name&gt;<\/p>\n<p>Specifically\u2026<\/p>\n<p>For remote SPARQL queries<\/p>\n<pre style=\"background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas, 'Courier New', courier, monospace; font-size: 12px;\">sparql-http:<span style=\"color: #0000ff;\">&lt;<\/span><span style=\"color: #800000;\">URI<\/span> <span style=\"color: #ff0000;\">of<\/span> <span style=\"color: #ff0000;\">sparql<\/span> <span style=\"color: #ff0000;\">endpoint<\/span><span style=\"color: #0000ff;\">&gt;<\/span><\/pre>\n<p>For queries executed on RDF files located on the WWW<\/p>\n<pre style=\"background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas, 'Courier New', courier, monospace; font-size: 12px;\">url:<span style=\"color: #0000ff;\">&lt;<\/span><span style=\"color: #800000;\">URI<\/span> <span style=\"color: #ff0000;\">of<\/span> <span style=\"color: #ff0000;\">RDF<\/span> <span style=\"color: #ff0000;\">file<\/span><span style=\"color: #0000ff;\">&gt;<\/span><\/pre>\n<p>For queries executed on local files, in the specified format<\/p>\n<pre style=\"background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas, 'Courier New', courier, monospace; font-size: 12px;\">xml:<span style=\"color: #0000ff;\">&lt;<\/span><span style=\"color: #800000;\">local<\/span> <span style=\"color: #ff0000;\">filename<\/span><span style=\"color: #0000ff;\">&gt;<\/span><\/pre>\n<pre style=\"background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas, 'Courier New', courier, monospace; font-size: 12px;\">n3: <span style=\"color: #0000ff;\">&lt;<\/span><span style=\"color: #800000;\">local<\/span> <span style=\"color: #ff0000;\">filename<\/span><span style=\"color: #0000ff;\">&gt;<\/span><\/pre>\n<pre style=\"background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas, 'Courier New', courier, monospace; font-size: 12px;\">ntriples: <span style=\"color: #0000ff;\">&lt;<\/span><span style=\"color: #800000;\">local<\/span> <span style=\"color: #ff0000;\">filename<\/span><span style=\"color: #0000ff;\">&gt;<\/span><\/pre>\n<p>For queries executed on triples stored in<\/p>\n<pre style=\"background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas, 'Courier New', courier, monospace; font-size: 12px;\">sqlserver:<span style=\"color: #0000ff;\">&lt;<\/span><span style=\"color: #800000;\">table<\/span><span style=\"color: #0000ff;\">&gt;<\/span>:<span style=\"color: #0000ff;\">&lt;<\/span><span style=\"color: #800000;\">MySQL<\/span> <span style=\"color: #ff0000;\">database<\/span> <span style=\"color: #ff0000;\">connection<\/span> <span style=\"color: #ff0000;\">string<\/span><span style=\"color: #0000ff;\">&gt;<\/span><\/pre>\n<pre style=\"background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas, 'Courier New', courier, monospace; font-size: 12px;\">sqlite: <span style=\"color: #0000ff;\">&lt;<\/span><span style=\"color: #800000;\">table<\/span><span style=\"color: #0000ff;\">&gt;<\/span>:<span style=\"color: #0000ff;\">&lt;<\/span><span style=\"color: #800000;\">MySQL<\/span> <span style=\"color: #ff0000;\">database<\/span> <span style=\"color: #ff0000;\">connection<\/span> <span style=\"color: #ff0000;\">string<\/span><span style=\"color: #0000ff;\">&gt;<\/span><\/pre>\n<pre style=\"background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas, 'Courier New', courier, monospace; font-size: 12px;\">postgresql: <span style=\"color: #0000ff;\">&lt;<\/span><span style=\"color: #800000;\">table<\/span><span style=\"color: #0000ff;\">&gt;<\/span>:<span style=\"color: #0000ff;\">&lt;<\/span><span style=\"color: #800000;\">MySQL<\/span> <span style=\"color: #ff0000;\">database<\/span> <span style=\"color: #ff0000;\">connection<\/span> <span style=\"color: #ff0000;\">string<\/span><span style=\"color: #0000ff;\">&gt;<\/span><\/pre>\n<pre style=\"background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas, 'Courier New', courier, monospace; font-size: 12px;\">mysql: <span style=\"color: #0000ff;\">&lt;<\/span><span style=\"color: #800000;\">table<\/span><span style=\"color: #0000ff;\">&gt;<\/span>:<span style=\"color: #0000ff;\">&lt;<\/span><span style=\"color: #800000;\">MySQL<\/span> <span style=\"color: #ff0000;\">database<\/span> <span style=\"color: #ff0000;\">connection<\/span> <span style=\"color: #ff0000;\">string<\/span><span style=\"color: #0000ff;\">&gt;<\/span><\/pre>\n<p>Note: the SemWeb utility \u201crdfstorage.exe\u201d for loading SQL databases in the necessary format is provided in the application directory<\/p>\n<p><strong>Parameter: SPARQL query<\/strong><\/p>\n<p>Query text is entered into the OLE DB command field. ASK, CONSTRUCT, DESCRIBE, SELECT queries are all supported. The query is parsed locally to determine its type.<\/p>\n<p><strong>Query Examples<\/strong><\/p>\n<p>Here are some sample ODC files that query DBpedia<\/p>\n<p><a href=\"https:\/\/www.sixhills-software.com\/SPARQLProv\/SPARQL%20DBpedia%20Test.odc\">DBpedia 1<\/a><\/p>\n<p><a href=\"https:\/\/www.sixhills-software.com\/SPARQLProv\/SPARQL%20DBpedia%20Test%202.odc\">DBpedia 2<\/a><\/p>\n<p><a href=\"https:\/\/www.sixhills-software.com\/SPARQLProv\/SPARQL%20DBpedia%20Test%203.odc\">DBpedia 3<\/a><\/p>\n<p>This spreadsheet makes a number of queries on Linked Movie Database and my FOAF file<\/p>\n<p><a href=\"https:\/\/www.sixhills-software.com\/SPARQLProv\/SPARQL%20Test%201%20-%20LMDB%20&amp;%20FOAF.xlsx\">Spreadsheet Example<\/a><\/p>\n<p><strong>Download\/Install<\/strong><\/p>\n<p>You can download the installer here <a href=\"https:\/\/www.sixhills-software.com\/SPARQLProv\/SPARQL%20OLE%20Provider%20Install.msi\">Download<\/a><\/p>\n<p>The provider may require installation of .NET Framework 3.5 if not already installed on the target machine.<\/p>\n<p>If you find any problems, or have any other feedback then please drop me a line at <a href=\"mailto:software@sixhills-consulting.com\">software@sixhills-consulting.com<\/a><\/p>\n<p><strong>Notice<\/strong><\/p>\n<p>The provider is currently offered for test and evaluation purposes only, without warranty of any kind. The provider is implemented on top of the SemWeb .NET library by Joshua Tauberer ( <a href=\"http:\/\/razor.occams.info\/code\/semweb\/\">http:\/\/razor.occams.info\/code\/semweb\/<\/a>) and subject to the relevant licences of that library.<\/p>\n<p>\u00a9 2009 Sixhills Consulting Ltd<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Excel SPARQL OLE DB Provider<\/p>\n<p>The SPARQL OLE DB Provider allows Excel users to query Semantic Web data using SPARQL. All four types of query are supported, and either SPARQL Results or triples are returned to the spreadsheet through standard OLE DB connection. Up to 16 columns of data may be returned, with up to [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"","meta":[],"_links":{"self":[{"href":"https:\/\/sixhills-software.com\/blog\/wp-json\/wp\/v2\/pages\/31"}],"collection":[{"href":"https:\/\/sixhills-software.com\/blog\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/sixhills-software.com\/blog\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/sixhills-software.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sixhills-software.com\/blog\/wp-json\/wp\/v2\/comments?post=31"}],"version-history":[{"count":6,"href":"https:\/\/sixhills-software.com\/blog\/wp-json\/wp\/v2\/pages\/31\/revisions"}],"predecessor-version":[{"id":65,"href":"https:\/\/sixhills-software.com\/blog\/wp-json\/wp\/v2\/pages\/31\/revisions\/65"}],"wp:attachment":[{"href":"https:\/\/sixhills-software.com\/blog\/wp-json\/wp\/v2\/media?parent=31"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}