1 10 package com.hp.hpl.jena.reasoner.rulesys.impl; 11 12 import com.hp.hpl.jena.graph.*; 13 import com.hp.hpl.jena.reasoner.TriplePattern; 14 import com.hp.hpl.jena.util.iterator.ExtendedIterator; 15 16 21 public class TopLevelTripleMatchFrame extends GenericChoiceFrame { 22 23 24 protected Triple lastMatch; 25 26 27 ExtendedIterator matchIterator; 28 29 30 protected TriplePattern goal; 31 32 38 public TopLevelTripleMatchFrame(LPInterpreter interpreter, TriplePattern goal) { 39 init(interpreter); 40 this.matchIterator = interpreter.getEngine().getInfGraph().findDataMatches(goal); 41 this.goal = goal; 42 } 43 44 49 public boolean nextMatch(LPInterpreter interpreter) { 50 if (matchIterator.hasNext()) { 51 lastMatch = (Triple)matchIterator.next(); 52 return true; 53 } else { 54 return false; 55 } 56 } 57 58 61 public void close() { 62 if (matchIterator != null) matchIterator.close(); 63 } 64 65 } 66 67 68 | Popular Tags |