Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Adding topic() to the context for RdfStream
  • Loading branch information
ajs6f authored and Andrew Woods committed Nov 26, 2013
1 parent c8cee87 commit 436ff13
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
Expand Up @@ -130,7 +130,7 @@ public RdfStream() {
* @return
*/
public <Tr extends Triple, T extends Iterator<Tr>> RdfStream withThisContext(final T stream) {
return new RdfStream(stream).namespaces(namespaces());
return new RdfStream(stream).namespaces(namespaces()).topic(topic());
}

/**
Expand All @@ -140,7 +140,7 @@ public <Tr extends Triple, T extends Iterator<Tr>> RdfStream withThisContext(fin
* @return
*/
public <Tr extends Triple, T extends Iterable<Tr>> RdfStream withThisContext(final T stream) {
return new RdfStream(stream).namespaces(namespaces());
return new RdfStream(stream).namespaces(namespaces()).topic(topic());
}

/**
Expand Down
Expand Up @@ -45,6 +45,7 @@
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.hp.hpl.jena.graph.Node;
import com.hp.hpl.jena.graph.NodeFactory;
import com.hp.hpl.jena.graph.Triple;
import com.hp.hpl.jena.rdf.model.Model;

Expand Down Expand Up @@ -134,17 +135,21 @@ public void testVarargsConstructor() {
@Test
public void testWithThisContextIterator() {
testStream.namespace(prefix1, uri1);
testStream.topic(NodeFactory.createAnon());
final RdfStream testStream2 =
testStream.withThisContext((Iterator<Triple>) testStream);
testStream.withThisContext((Iterator<Triple>) new RdfStream());
assertEquals(testStream.namespaces(), testStream2.namespaces());
assertEquals(testStream.topic(), testStream2.topic());
}

@Test
public void testWithThisContextIterable() {
testStream.namespace(prefix1, uri1);
testStream.topic(NodeFactory.createAnon());
final RdfStream testStream2 =
testStream.withThisContext((Iterable<Triple>) testStream);
testStream.withThisContext((Iterable<Triple>) new RdfStream());
assertEquals(testStream.namespaces(), testStream2.namespaces());
assertEquals(testStream.topic(), testStream2.topic());
}

@Test
Expand Down

0 comments on commit 436ff13

Please sign in to comment.