Monday, March 16, 2009

Generalizing Graphs into SPARQL Queries

The new TopBraid Composer 3.0 beta 2 now includes a simple visual SPARQL query editor that has been suggested by my colleague Dean Allemang. This query editor is a feature of Composer's graph browser. Dean has discovered that he is using the Graph browser very frequently to explore complex relationships between RDF resources, and asked me: wouldn't it be cool if I could take a snapshot of this particular graph and generalize it so that I can find all sub-graphs of the model with similar structure? Take the example below:

Here, the user has started to explore the RDF graph at a specific instance of Person (Alina Mojica). Opening up the has gender relationship displays the link to the resource female. In the graph above, this link to female as well as the year of birth 1965 have been "fixed", while all other values remain variable. Pressing the star button above the graph now creates a SPARQL query:

Executing this SPARQL query (with another mouse click on the same button) gives us all female Persons that were also born in 1965. The same approach can be used to turn more complex graph patterns into templates - just fix those values that you want to keep and leave the rest as variables.

A very similar graphical SPARQL editor, executing in a rich internet application based on Flex, is now also part of the new TopBraid Ensemble.


Post a Comment

<< Home