private DataSource buildDataSource() {
List<DataSource> sources = new ArrayList<DataSource>(datasets.size());
for (Dataset dataset: datasets) {
sources.add(dataset.getDataSource());
}
DataSource result = new MergeDataSource(sources, prefixes);
// If we don't have an indexResource, and there is no resource
// at the home URL in any of the datasets, then add an
// index builder. It will be responsible for handling the
// homepage/index resource.
// TODO: Shouldn't we make the index data source available even if there
// is an indexResource?
String indexIRI = webBase + getWebResourcePrefix();
if (!hasProperty(CONF.indexResource) &&
result.describeResource(indexIRI).isEmpty()) {
result = new IndexDataSource(indexIRI, result);
}
return result;
}