I've notice there is a exhibit_sparql contribution module. I am assuming it's supposed to work with the SPARQL module. Could you please tell me how to make it work?

Comments

tugis’s picture

I have the same question as you... I would like to use a Sparql query as the data feed for my Exhibit and I don't understand how to do it.

B747’s picture

Does creating a sparql node and then adding it as a RDF/XML feed to EXHIBIT work?

stephenlivermore’s picture

I have made some progress trying to get the Exhibit Sparql module working, but think I have reached an impasse with the Exhibit JSON data format.

I have been able to define a Sparql query, an Exhibit JSON data feed from this query and an Exhibit using the feed. But the data will not display. There seems to be an incompatibility between the JSON data format generated by the data feed and the format required by the Exhibit.

I wondered if anyone had any ideas how to resolve this so that the excellent data presentation facilities offered by the Exhibit module can be extended to display the results of Sparql queries?

Otherwise should I be looking instead at RDF developments in Drupal 7?

Here are the details:

I am using
----------

Drupal 6.17
Resource Description Framework (RDF) 6.x-1.0-alpha7
SPARQL 6.x-1.x-dev (2009-Mar-08)
Exhibit 6.x-1.0-beta1

The Sparql query
----------------

# Landlocked countries, from http://www.cambridgesemantics.com/2008/09/sparql-by-example/#(22)
PREFIX type:
PREFIX prop:
SELECT ?label ?population
WHERE {
?country a type:LandlockedCountries ;
rdfs:label ?label ;
prop:populationEstimate ?population .
FILTER (?population > 15000000 && langMatches(lang(?label), "EN")) .
} ORDER BY DESC(?population)
LIMIT 2

using endpoint URL http://dbpedia.org/sparql

You can view this at http://exhibits.stephenlivermore.info/node/1

The Exhibit Sparql JSON data feed
---------------------------------
The Exhibit Sparql module does not appear to be documented but taking a lead from the Exhibit Drupal module http://drupal.org/node/267482 documentation and looking at the module code I was able generate a feed as http://exhibits.stephenlivermore.info/node/1/exhibit-json
This gives JSON data as follows:

{ “items”: [ { "label": { "value": "Ethiopia", "language": "en", "datatype": null },
"population": { "value": "79221000", "language": null, "datatype": { "uri":
"http://www.w3.org/2001/XMLSchema#int" } } }, { "label": { "value": "Uganda",
"language": "en", "datatype": null }, "population": { "value": "32369558",
"language": null, "datatype": { "uri": "http://www.w3.org/2001/XMLSchema#int" } } } ]
}

Compare this with the Exhibit JSON data format http://simile.mit.edu/wiki/Exhibit/Creating%2C_Importing%2C_and_Managing...

The Exhibit definition
----------------------

<div ex:role="viewPanel">
	<div ex:role="exhibit-view"
		ex:viewClass="Exhibit.TabularView"
		ex:columns=".label.value"
		ex:columnLabels="Country"
		ex:columnFormats="list"
		ex:sortColumn="1"
		ex:sortAscending="false">
	</div>       
</div>

Observations
------------

1. The Sparql query selects ?label rather than ?country_name as in the Cambridge Semantics original. Without this the exhibit will give an error "Item entry has no label and no id".

2. The Exhibit definition includes ex:columns. According to the documentation this is a list of Exhibit expressions http://simile.mit.edu/wiki/Exhibit/Expressions. I wondered whether I could use an expression such as .label.value to read the country name in the Sparql JSON feed, but it does not appear to work.

Anonymous’s picture

I am about to contribute SPARQL Views which can be used to create simple SPARQL Queries (only using WHERE clauses) with Views.

I have created an Exhibit JSON plugin for it. Right now Exhibit only allows the exhibit_json style plugin to be used, but I am going to roll and commit a patch that allows any plugin that extends exhibit_json to be used.

Anonymous’s picture

I have posted SPARQL Views alpha. As stated above, it currently only handles very simple WHERE clauses, but there is Exhibit integration for it.

If anyone is interested in trying it, please check out the video showing how to install and configure it.

Anonymous’s picture

Actually, I just realized that there is a small bug in the Exhibit integration that will keep it from working, but will be taking care of this shortly.

Anonymous’s picture

This will now work with the version on git. Be sure to apply the patch in the README

http://github.com/linclark/sparql_views