}
@Test
public void testFilterByObject() throws Exception {
MGraph graph = getEmptyMGraph();
final Triple tripleAlice= createTriple(
"http://example.org/ontology/Person",
"http://example.org/ontology/hasName",
"http://example.org/people/alice");
final Triple tripleBob= createTriple(
"http://example.org/ontology/Person",
"http://example.org/ontology/hasName",
"http://example.org/people/bob");
Assert.assertTrue(graph.add(tripleAlice));
Assert.assertTrue(graph.add(tripleBob));
Iterator<Triple> iterator;
Collection<Triple> resultSet;
// Find bob
iterator = graph.filter(null, null,
new UriRef("http://example.org/people/bob"));
resultSet= toCollection(iterator);
Assert.assertEquals(1, resultSet.size());
Assert.assertTrue(resultSet.contains(tripleBob));
// Find alice
iterator = graph.filter(null, null,
new UriRef("http://example.org/people/alice"));
resultSet= toCollection(iterator);
Assert.assertEquals(1, resultSet.size());
Assert.assertTrue(resultSet.contains(tripleAlice));
// Find both
iterator = graph.filter(null, null, null);
resultSet= toCollection(iterator);
Assert.assertEquals(2, resultSet.size());
Assert.assertTrue(resultSet.contains(tripleAlice));
Assert.assertTrue(resultSet.contains(tripleBob));
}