@Before public void createGraph() { graph = new SimpleMGraph(); graph.add(TripleUtil.uriTriple("S1", "P1", "01")); graph.add(TripleUtil.uriTriple("S1", "P1", "02")); graph.add(TripleUtil.uriTriple("S2", "P1", "01")); graph.add(TripleUtil.uriTriple("S2", "P1", "02")); graph.add(TripleUtil.uriTriple("S3", "P1", "01")); graph.add(TripleUtil.uriTriple("S4", "P1", "02")); }
@Test public void basicTest() throws Exception { final TripleMatcherGroupImpl group = new TripleMatcherGroupImpl(true, "no description"); assertEquals( "Empty matcher group should find nothing", 0, group.getMatchingSubjects(graph.getGraph()).size()); // Add two matchers, only S1 and S2 match all of them group.addMatcher(new TripleMatcherImpl("P1 URI 01")); group.addMatcher(new TripleMatcherImpl("P1 URI 02")); final Set<UriRef> actual = group.getMatchingSubjects(graph.getGraph()); final Set<UriRef> expected = TripleUtil.uriRefSet("S1", "S2"); assertEquals( "Size of results " + actual + " matches " + expected, expected.size(), actual.size()); assertTrue( "Content of results " + actual + " matches " + expected, expected.containsAll(actual)); }