diff --git a/pom.xml b/pom.xml
index 02bedfe..db2528b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -135,6 +135,12 @@
slf4j-simple
1.7.10
+
+ junit
+ junit
+ 4.11
+ test
+
diff --git a/src/main/java/org/linkeddatafragments/datasource/index/IndexRequestProcessorForTPFs.java b/src/main/java/org/linkeddatafragments/datasource/index/IndexRequestProcessorForTPFs.java
index 263e781..d39e471 100644
--- a/src/main/java/org/linkeddatafragments/datasource/index/IndexRequestProcessorForTPFs.java
+++ b/src/main/java/org/linkeddatafragments/datasource/index/IndexRequestProcessorForTPFs.java
@@ -55,7 +55,7 @@ public IndexRequestProcessorForTPFs(
Resource datasourceUrl = new ResourceImpl(baseUrl + "/" + datasourceName);
- model.add(datasourceUrl, new PropertyImpl(RDF + "type"), VOID + "Dataset");
+ model.add(datasourceUrl, new PropertyImpl(RDF + "type"), new ResourceImpl(VOID + "Dataset"));
model.add(datasourceUrl, new PropertyImpl(RDFS + "label"), datasource.getTitle());
model.add(datasourceUrl, new PropertyImpl(DC + "title"), datasource.getTitle());
model.add(datasourceUrl, new PropertyImpl(DC + "description"), datasource.getDescription());
diff --git a/src/test/java/org/linkeddatafragments/test/datasource/IndexRequestProcessorForTPFsTest.java b/src/test/java/org/linkeddatafragments/test/datasource/IndexRequestProcessorForTPFsTest.java
new file mode 100644
index 0000000..edc8b5b
--- /dev/null
+++ b/src/test/java/org/linkeddatafragments/test/datasource/IndexRequestProcessorForTPFsTest.java
@@ -0,0 +1,114 @@
+package org.linkeddatafragments.datasource;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+
+import org.apache.jena.rdf.model.Property;
+import org.apache.jena.rdf.model.RDFNode;
+import org.apache.jena.rdf.model.Resource;
+import org.apache.jena.rdf.model.ResourceFactory;
+import org.apache.jena.rdf.model.Statement;
+import org.apache.jena.rdf.model.StmtIterator;
+import org.junit.Assert;
+import org.junit.Test;
+import org.linkeddatafragments.datasource.IDataSource;
+import org.linkeddatafragments.datasource.IFragmentRequestProcessor;
+import org.linkeddatafragments.datasource.index.IndexRequestProcessorForTPFs;
+import org.linkeddatafragments.fragments.IFragmentRequestParser;
+import org.linkeddatafragments.fragments.ILinkedDataFragment;
+import org.linkeddatafragments.fragments.tpf.ITriplePatternFragmentRequest;
+import org.linkeddatafragments.fragments.tpf.TriplePatternElementFactory;
+import org.linkeddatafragments.fragments.tpf.TriplePatternFragmentRequestImpl;
+
+/**
+ * Test cases for the IndexRequestProcessorForTPFs
+ *
+ * @author Lars G. Svensson
+ */
+public class IndexRequestProcessorForTPFsTest {
+
+ static class TestIndexRequestProcessor extends IndexRequestProcessorForTPFs {
+ TestIndexRequestProcessor(final String baseUrl,
+ final HashMap datasources) {
+ super(baseUrl, datasources);
+ }
+
+ @Override
+ protected TestWorker getTPFSpecificWorker(
+ final ITriplePatternFragmentRequest request)
+ throws IllegalArgumentException {
+ return new TestWorker(request);
+ }
+
+ class TestWorker extends IndexRequestProcessorForTPFs.Worker {
+ public TestWorker(
+ final ITriplePatternFragmentRequest req) {
+ super(req);
+ }
+ }
+ }
+
+ /**
+ * Check that the type void:Dataset is returned as a URI and not as a
+ * literal
+ */
+ @Test
+ public void shouldGiveVoidDatasetAsAURI() {
+ final IDataSource datasource = new IDataSource() {
+ @Override
+ public String getDescription() {
+ return "This is a dummy datasource";
+ };
+
+ @Override
+ public IFragmentRequestParser getRequestParser() {
+ return null;
+ }
+
+ @Override
+ public IFragmentRequestProcessor getRequestProcessor() {
+ return null;
+ }
+
+ @Override
+ public String getTitle() {
+ return "Dummy Dataource";
+ }
+
+ @Override
+ public void close() {
+ // does nothing
+ }
+ };
+ final HashMap datasources = new HashMap();
+ datasources.put("dummy", datasource);
+ final String baseUrl = "dummy";
+ final TestIndexRequestProcessor processor = new TestIndexRequestProcessor(
+ baseUrl, datasources);
+ final TriplePatternElementFactory factory = new TriplePatternElementFactory();
+ final ITriplePatternFragmentRequest request = new TriplePatternFragmentRequestImpl(
+ null, "dummy", false, 1, factory.createUnspecifiedVariable(),
+ factory.createUnspecifiedVariable(),
+ factory.createUnspecifiedVariable());
+ final TestIndexRequestProcessor.TestWorker worker = processor
+ .getTPFSpecificWorker(request);
+ final ILinkedDataFragment fragment = worker.createRequestedFragment();
+ final StmtIterator iterator = fragment.getTriples();
+ final Collection statements = new ArrayList();
+ while (iterator.hasNext()) {
+ statements.add(iterator.next());
+ }
+
+ final Resource subject = ResourceFactory.createResource("dummy/dummy");
+ final Property predicate = ResourceFactory
+ .createProperty("http://www.w3.org/1999/02/22-rdf-syntax-ns#type");
+ final Resource object = ResourceFactory
+ .createResource("http://rdfs.org/ns/void#Dataset");
+ final Statement expected = ResourceFactory.createStatement(subject,
+ predicate, object);
+ Assert.assertTrue("triple not contained in model",
+ statements.contains(expected));
+ processor.close();
+ }
+}