> 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 . 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.
Jeroen De Dauw
Don't panic. Don't be evil.