void SelectSome(Statement template, StatementSink sink) { // Get a cursor over the first non-null component of template. int[] stmts; if (template.Subject != null) { stmts = GetStatements(template.Subject, 0); } else if (template.Predicate != null) { stmts = GetStatements(template.Predicate, 1); } else if (template.Object != null) { stmts = GetStatements(template.Object, 2); } else if (template.Meta != null) { stmts = GetStatements(template.Meta, 3); } else { throw new InvalidOperationException(); } if (stmts == null) { return; } Hashtable createdResources = new Hashtable(); for (int i = 0; i < stmts[0]; i++) { Quad q = Quad.Deserialize(stmts, 1 + i * 4); Statement s = QuadToStatement(q, createdResources); if (template.Matches(s)) { if (!sink.Add(s)) { return; } } } }