Map<BNode, BNode> bNodeMapping, int idx)
{
boolean result = false;
if (idx < model1.size()) {
Statement st1 = model1.get(idx);
List<Statement> matchingStats = findMatchingStatements(st1, model2, bNodeMapping);
for (Statement st2 : matchingStats) {
// Map bNodes in st1 to bNodes in st2
Map<BNode, BNode> newBNodeMapping = new HashMap<BNode, BNode>(bNodeMapping);
if (st1.getSubject() instanceof BNode && st2.getSubject() instanceof BNode) {
newBNodeMapping.put((BNode)st1.getSubject(), (BNode)st2.getSubject());
}
if (st1.getObject() instanceof BNode && st2.getObject() instanceof BNode) {
newBNodeMapping.put((BNode)st1.getObject(), (BNode)st2.getObject());
}
// FIXME: this recursive implementation has a high risk of
// triggering a stack overflow