Categories

A sample text widget

Etiam pulvinar consectetur dolor sed malesuada. Ut convallis euismod dolor nec pretium. Nunc ut tristique massa.

Nam sodales mi vitae dolor ullamcorper et vulputate enim accumsan. Morbi orci magna, tincidunt vitae molestie nec, molestie at mi. Nulla nulla lorem, suscipit in posuere in, interdum non magna.

SPARQLProv

Excel SPARQL OLE DB Provider

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.

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->Edit Query. If you edit the query, you will need to refresh the query afterwards.

This query executed on the DBpedia SPARQL endpoint…

PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX : <http://dbpedia.org/resource/>
PREFIX dbpedia2: <http://dbpedia.org/property/>
PREFIX dbpedia: <http://dbpedia.org/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
SELECT DISTINCT ?co ?marketCap ?netIncome ?operatingIncome ?revenue
WHERE {
?co dbpedia2:marketCap ?marketCap;
dbpedia2:netIncome ?netIncome;
dbpedia2:operatingIncome ?operatingIncome;
dbpedia2:revenue ?revenue }
LIMIT 30

…produces this table of results in Excel…

clip_image002

Defining a query

The provider takes two parameters for query

1. Data Source to be queried –

2. The SPARQL query text

Parameter: Data Source

Entered in the OLE DB Data Source name field

General format is <source type>:<source name>

Specifically…

For remote SPARQL queries

sparql-http:<URI of sparql endpoint>

For queries executed on RDF files located on the WWW

url:<URI of RDF file>

For queries executed on local files, in the specified format

xml:<local filename>
n3: <local filename>
ntriples: <local filename>

For queries executed on triples stored in

sqlserver:<table>:<MySQL database connection string>
sqlite: <table>:<MySQL database connection string>
postgresql: <table>:<MySQL database connection string>
mysql: <table>:<MySQL database connection string>

Note: the SemWeb utility “rdfstorage.exe” for loading SQL databases in the necessary format is provided in the application directory

Parameter: SPARQL query

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.

Query Examples

Here are some sample ODC files that query DBpedia

DBpedia 1

DBpedia 2

DBpedia 3

This spreadsheet makes a number of queries on Linked Movie Database and my FOAF file

Spreadsheet Example

Download/Install

You can download the installer here Download

The provider may require installation of .NET Framework 3.5 if not already installed on the target machine.

If you find any problems, or have any other feedback then please drop me a line at software@sixhills-consulting.com

Notice

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 ( http://razor.occams.info/code/semweb/) and subject to the relevant licences of that library.

© 2009 Sixhills Consulting Ltd