/** * Search the combination of data and deductions graphs for the given triple pattern. * This may different from the normal find operation in the base of hybrid reasoners * where we are side-stepping the backward deduction step. */ @Override public ExtendedIterator<Triple> findDataMatches(Node subject, Node predicate, Node object) { return dataFind.find(new TriplePattern(subject, predicate, object)); }
/** * Returns an iterator over Triples. * This implementation assumes that the underlying findWithContinuation * will have also consulted the raw data. */ @Override public ExtendedIterator<Triple> graphBaseFind(Node subject, Node property, Node object) { return findWithContinuation(new TriplePattern(subject, property, object), null); }
/** * Returns an iterator over Triples. * This implementation assumes that the underlying findWithContinuation * will have also consulted the raw data. */ @Override protected ExtendedIterator<Triple> graphBaseFind(Node subject, Node property, Node object) { return findWithContinuation(new TriplePattern(subject, property, object), fdata); }
/** * Returns an iterator over Triples. */ @Override public ExtendedIterator<Triple> graphBaseFind(Node subject, Node property, Node object) { return findWithContinuation(new TriplePattern(subject, property, object), fdata); }
/** * Returns an iterator over Triples. */ @Override public ExtendedIterator<Triple> graphBaseFind(Node subject, Node property, Node object) { return findWithContinuation(new TriplePattern(subject, property, object), fdata); }
/** * Returns an iterator over Triples. * This implementation assumes that the underlying findWithContinuation * will have also consulted the raw data. */ @Override public ExtendedIterator<Triple> graphBaseFind(Node subject, Node property, Node object) { return findWithContinuation(new TriplePattern(subject, property, object), null); }
/** * Returns an iterator over Triples. * This implementation assumes that the underlying findWithContinuation * will have also consulted the raw data. */ @Override protected ExtendedIterator<Triple> graphBaseFind(Node subject, Node property, Node object) { return findWithContinuation(new TriplePattern(subject, property, object), fdata); }
/** * @see org.apache.jena.reasoner.rulesys.RuleContext#find(org.apache.jena.graph.Node, org.apache.jena.graph.Node, org.apache.jena.graph.Node) */ @Override public ClosableIterator<Triple> find(Node s, Node p, Node o) { return graph.findDataMatches(new TriplePattern(s, p, o)); // return searchpath.find(new TriplePattern(s, p, o)); }
/** * Returns an iterator over Triples. * This implementation assumes that the underlying findWithContinuation * will have also consulted the raw data. */ @Override public ExtendedIterator<Triple> graphBaseFind(Node subject, Node property, Node object) { return findWithContinuation(new TriplePattern(subject, property, object), null); }
/** * Returns an iterator over Triples. * This implementation assumes that the underlying findWithContinuation * will have also consulted the raw data. */ @Override public ExtendedIterator<Triple> graphBaseFind(Node subject, Node property, Node object) { return findWithContinuation(new TriplePattern(subject, property, object), null); }
/** * Search the combination of data and deductions graphs for the given triple pattern. * This may different from the normal find operation in the base of hybrid reasoners * where we are side-stepping the backward deduction step. */ @Override public ExtendedIterator<Triple> findDataMatches(Node subject, Node predicate, Node object) { return findWithContinuation(new TriplePattern(subject, predicate, object), null, false); }
/** * Returns an iterator over Triples. * This implementation assumes that the underlying findWithContinuation * will have also consulted the raw data. */ @Override protected ExtendedIterator<Triple> graphBaseFind(Node subject, Node property, Node object) { return findWithContinuation(new TriplePattern(subject, property, object), null); }
/** * Search the combination of data and deductions graphs for the given triple pattern. * This may different from the normal find operation in the base of hybrid reasoners * where we are side-stepping the backward deduction step. */ @Override public ExtendedIterator<Triple> findDataMatches(Node subject, Node predicate, Node object) { return findWithContinuation(new TriplePattern(subject, predicate, object), null, false); }
/** * @see org.apache.jena.reasoner.rulesys.RuleContext#find(org.apache.jena.graph.Node, org.apache.jena.graph.Node, org.apache.jena.graph.Node) */ @Override public ClosableIterator<Triple> find(Node s, Node p, Node o) { return graph.findDataMatches(new TriplePattern(s, p, o)); // return searchpath.find(new TriplePattern(s, p, o)); }
/** * Helper - returns the (singleton) value for the given property on the given * root node in the data graph. */ public static Node getPropValue(Node root, Node prop, Finder context) { return doGetPropValue(context.find(new TriplePattern(root, prop, null))); }
/** * Helper - returns the (singleton) value for the given property on the given * root node in the data graph. */ public static Node getPropValue(Node root, Node prop, Finder context) { return doGetPropValue(context.find(new TriplePattern(root, prop, null))); }
/** * Create a deep copy of the cache contents. * Works by creating a completely new cache and just adding in the * direct links. */ public TransitiveGraphCache deepCopy() { TransitiveGraphCache copy = new TransitiveGraphCache(directPredicate, closedPredicate); Iterator<Triple> i = find(new TriplePattern(null, directPredicate, null)); while (i.hasNext()) { Triple t = i.next(); copy.addRelation(t.getSubject(), t.getObject()); } return copy; }
/** * Bind the variables in a goal pattern using the binding environment, to * generate a more specialized goal * @param goal the TriplePattern to be instantiated * @return a TriplePattern obtained from the goal by substituting current bindings */ public TriplePattern partInstantiate(TriplePattern goal) { return new TriplePattern( getGroundVersion(goal.getSubject()), getGroundVersion(goal.getPredicate()), getGroundVersion(goal.getObject()) ); }
/** * Convert a triple into a triple pattern by converting var resources into * wildcard variables. */ public static TriplePattern tripleToPattern(Triple t) { return new TriplePattern( nodeToPattern(t.getSubject()), nodeToPattern(t.getPredicate()), nodeToPattern(t.getObject())); }
/** * Test equivalences case */ public void testEquivalences() { TransitiveGraphCache cache = new TransitiveGraphCache(directP, closedP); cache.addRelation(new Triple(a, closedP, b)); cache.addRelation(new Triple(b, closedP, a)); cache.addRelation(new Triple(c, closedP, d)); cache.addRelation(new Triple(d, closedP, c)); cache.addRelation(new Triple(b, closedP, d)); cache.addRelation(new Triple(d, closedP, b)); assertTrue("Test eq", cache.contains(new TriplePattern(a, closedP, d))); }