Hey,

> Now i could work with exporting to CSV & then import the data again, but i
> thought it would be cleaner to query the original database instead.

It's a lot better to use one of SMWs interfaces rather then directly accessing the datastore used. You can use one of SMWs export formats or it's ask API [1]. Or you can use one of several extensions that provide export or synchronization features. A last option is to write some PHP that talks directly to SMWs store, but there is no good documentation on this.

[0] http://semantic-mediawiki.org/wiki/Help:Export_related_result_formats
[1] http://semantic-mediawiki.org/wiki/Ask%20API

Cheers

--
Jeroen De Dauw
http://www.bn2vs.com
Don't panic. Don't be evil.
--