views:

192

answers:

1

I am using a tool called TopQuadrant to create a Symantic Web (RDF/OWL) Ontology. This tool allows for import of data from MS Excel. My spreadsheet is basically a two-column sheet with the first column being an XPATH expression and the second column being a description of that XPATH.

Once I import my spreadsheet, I would like to use SPARQL to iterate through the data to create an Ontology based on the values in my first column. For instance, if I had a sheet that looked as follows:

XPATH                              Description
Food
Food/Fruit
Food/Fruit/Apple
Food/Vegetables
Food/Vegetables/Turnips

I would like SPARQL to create my Ontology with a root class (under "Thing" of course) of 'Food', and under 'Food', 2 subclasses called 'Fruit' and 'Vegetables', and under 'Fruit' a subclass of 'Apple', and under 'Vegetables' a sublcass of Turnips... going on down the line.

Is this something that SPARQL can do?

Thanks in advance.

+1  A: 

No I don't think it is, SPARQL is designed as a query language so this is beyond it's scope. While you have implied from the question title you wish to use a CONSTRUCT query to do this it's not something that is doable under SPARQL 1.0 because of the format of your data.

Your question requires processing of the values in your first column in a way that's not possible with SPARQL without defining your own custom extensions to it - I am unsure if TopQuadrant has any kind of support for this.

Based on the data in your spreadsheet alone this is not possible, BUT it may be possible depending on how TopQuadrant imports your spreadsheet. As a Semantic Web tool I would assume that TopQuadrant is converting your spreadsheet input into some kind of RDF. If this is the case and you can edit your question to add that RDF representation I could give you a more definitive answer.

I would expect that even in an RDF form you probably can't achieve your aim with a single query

RobV
Thanks for your response. I was able to work with the TQ developers to get a solution to my problem. It took a bit of script-writing, but it works perfectly. I can't post their code, here, but wanted to let anyone who is interested know that it is possible. Your response to my query is spot on, however, thanks!!!!!
El Guapo