For my current project, I’ve been doing a lot of work related to the Semantic Web. This has meant figuring out how to write SPARQL queries in order to retrieve data we can use for testing our application. After figuring out how to do this manually (we used this SPARQL endpoint provided by OpenLink Software), it was time to automate the process. The Virtuoso product has a REST service interface, but the only example I found here for interacting with it used curl. Fortunately, some googling revealed a really nice resource in the Yahoo Developer Network with some great examples.
I’ve put together a small solution in Visual Studio 2008 with a console application (VirtuosoPost) which executes queries against http://dbpedia.org/fct/ and returns the query results as XML. It’s definitely not fancy, but it works. There’s plenty of room for improvement, and I’ll make updates available here. The solution does include all the source, so any of you out there who are interested in taking the code in an entirely different direction are welcome to do so.