1 10 package com.hp.hpl.jena.reasoner; 11 12 import com.hp.hpl.jena.graph.Graph; 13 import com.hp.hpl.jena.util.iterator.*; 14 15 22 public class FGraph implements Finder { 23 24 25 protected Graph graph; 26 27 30 public FGraph(Graph graph) { 31 this.graph = graph; 32 } 33 34 40 public ExtendedIterator find(TriplePattern pattern) { 41 if (graph == null) return WrappedIterator.create(new NullIterator()); 42 return graph.find(pattern.asTripleMatch()); 43 } 44 45 56 public ExtendedIterator findWithContinuation(TriplePattern pattern, Finder continuation) { 57 if (graph == null) return WrappedIterator.create(new NullIterator()); 58 if (continuation == null) { 59 return graph.find(pattern.asTripleMatch()); 60 } else { 61 return graph.find(pattern.asTripleMatch()).andThen(continuation.find(pattern)); 62 } 63 } 64 65 69 public Graph getGraph() { 70 return graph; 71 } 72 73 76 public boolean contains(TriplePattern pattern) { 77 return graph.contains(pattern.getSubject(), pattern.getPredicate(), pattern.getObject()); 78 } 79 80 } 81 82 111 112 | Popular Tags |