/** * An iterator over no elements. * @return A class singleton which doesn't iterate. */ static public <T> ExtendedIterator<T> emptyIterator() { return NullIterator.instance() ; }
@Override protected ExtendedIterator<Triple> graphBaseFind(TripleMatch m) { return NullIterator.instance(); } };
@Override protected ExtendedIterator<Triple> graphBaseFind( TripleMatch m ) { return NullIterator.instance(); } };
@Override protected ExtendedIterator<Triple> graphBaseFind(TripleMatch m) { return NullIterator.instance() ; }
@Override protected ExtendedIterator<Triple> graphBaseFind(TripleMatch m) { return NullIterator.instance() ; }
/** Answer an iterator over the reification triples of this Reifier, or an empty iterator - if showHidden is false, only the exposed triples, otherwise only the concealed ones. */ public static ExtendedIterator<Triple> findEither(Graph graph, TripleMatch match, boolean showHidden) { if ( showHidden ) return NullIterator.instance() ; else return graph.find(match) ; }
public ExtendedIterator<Triple> findEither(TripleMatch match, boolean showHidden) { if ( showHidden ) return NullIterator.instance() ; else return graph.find(match) ; }
/** Given an Iterator that returns Iterator's, this creates an * Iterator over the next level values. * Similar to list splicing in lisp. */ public static <T> ExtendedIterator<T> createIteratorIterator( Iterator<Iterator<T>> it ) { ExtendedIterator<T> retval = NullIterator.instance(); while (it.hasNext()) { retval = retval.andThen(it.next()); } return retval; }
@Override public ExtendedIterator<Triple> iterator( Object o, HashCommon.NotifyEmpty container ) { TripleBunch b = bunchMap.get( o ); return b == null ? NullIterator.<Triple>instance() : b.iterator(); }
/** * {@inheritDoc} */ @Override protected ExtendedIterator<Triple> graphBaseFind(TripleMatch m) { ExtendedIterator<Triple> result = NullIterator.instance(); for (final Graph g : m_subGraphs) { result = result.andThen(g.find(m)); } return result; }
/** Answer an iterator over all the triples in this NTM which have index node <code>o</code>. */ @Override public Iterator<Triple> iterator( Object o, HashCommon.NotifyEmpty container ) { // System.err.println( ">> BOINK" ); // if (true) throw new JenaException( "BOINK" ); TripleBunch s = bunchMap.get( o ); return s == null ? NullIterator.<Triple>instance() : s.iterator( container ); }
public static ExtendedIterator<Triple> findTriple(KnowledgeBase kb, PelletInfGraph pellet, Node subj, Node pred, Node obj) { Node s = normalize( subj ); Node p = normalize( pred ); Node o = normalize( obj ); if( p == VAR && o != VAR && o != CONST ) { pred = p = RDF.type.asNode(); } TripleQueryHandler qh = QUERY_HANDLERS.get( Triple.create( s, p, o ) ); if( qh == null ) { if( log.isLoggable( Level.WARNING ) ) log.warning( "No query handler found for " + subj + " " + pred + " " + obj ); } return qh == null ? NullIterator.<Triple>instance() : qh.find( kb, pellet, subj, pred, obj ); }
return new NiceIterator<Triple>() private Iterator<Triple> current = NullIterator.instance(); private NotifyMe emptier = new NotifyMe();
/** * Answer the concatenation of all the iterators from a-subGraph.find( t ). */ private ExtendedIterator<Triple> multiGraphFind(final TripleMatch t) { Set<Triple> seen = CollectionFactory.createHashedSet() ; ExtendedIterator<Triple> result = NullIterator.instance() ; boolean finished = false ; try { for (Iterator<Graph> graphs = m_subGraphs.iterator(); graphs.hasNext();) { ExtendedIterator<Triple> newTriples = recording(rejecting(graphs.next().find(t), seen), seen) ; result = result.andThen(newTriples) ; } finished = true ; return result ; } finally { // Throwable happened. if (!finished) result.close() ; } }
@Override public ExtendedIterator<Triple> find(KnowledgeBase kb, PelletInfGraph pellet, Node subj, Node pred, Node obj) { return contains( kb, pellet.getLoader(), subj, pred, obj ) ? new SingletonIterator<Triple>( Triple.create( subj, pred, obj ) ) : NullIterator.<Triple>instance(); } }
@Override public ExtendedIterator<Triple> iterator( Node index, Node n2, Node n3 ) { TripleBunch s = bunchMap.get( index.getIndexingValue() ); return s == null ? NullIterator.<Triple>instance() : f2.filterOn( n2 ).and( f3.filterOn( n3 ) ) .filterKeep( s.iterator() ) ; }
@Override public ExtendedIterator<Triple> find(final KnowledgeBase kb, final PelletInfGraph pellet, final Node s, final Node p, final Node o) { ExtendedIterator<Triple> builtinPredicates = NullIterator.instance(); if( !pellet.isSkipBuiltinPredicates() ) { for( Node pred : BUILTIN_PREDICATES ) { builtinPredicates = builtinPredicates.andThen( findTriple( kb, pellet, s, pred, o ) ); } } ExtendedIterator<Triple> propertyAssertions = WrappedIterator.create( new NestedIterator<ATermAppl,Triple>( kb.getProperties() ) { @Override public Iterator<Triple> getInnerIterator(ATermAppl prop) { Node p = JenaUtils.makeGraphNode( prop ); return findTriple( kb, pellet, s, p, o ); } } ); return builtinPredicates.andThen( propertyAssertions ); } }
@Override public ExtendedIterator<Triple> find(final KnowledgeBase kb, final PelletInfGraph pellet, final Node s, final Node p, final Node o) { ExtendedIterator<Triple> builtinPredicates = NullIterator.instance(); if( !o.isLiteral() && !pellet.isSkipBuiltinPredicates() ) { for( Node pred : BUILTIN_PREDICATES ) { builtinPredicates = builtinPredicates.andThen( findTriple( kb, pellet, s, pred, o ) ); } } ExtendedIterator<Triple> propertyAssertions = WrappedIterator.create( new NestedIterator<ATermAppl,Triple>( kb.getProperties() ) { @Override public Iterator<Triple> getInnerIterator(ATermAppl prop) { Node p = JenaUtils.makeGraphNode( prop ); return findTriple( kb, pellet, s, p, o ); } } ); return builtinPredicates.andThen( propertyAssertions ); } }
/** Answer an iterator over all the triples in this NTM which match <code>pattern</code>. The index field of this NTM is guaranteed concrete in the pattern. */ @Override public ExtendedIterator<Triple> iterator( Node index, Node n2, Node n3 ) { Object indexValue = index.getIndexingValue(); TripleBunch s = bunchMap.get( indexValue ); // System.err.println( ">> ntmf::iterator: " + (s == null ? (Object) "None" : s.getClass()) ); return s == null ? NullIterator.<Triple>instance() : f2.filterOn( n2 ).and( f3.filterOn( n3 ) ) .filterKeep( s.iterator( new NotifyMe( indexValue ) ) ) ; }
@Override public ExtendedIterator<Triple> find(KnowledgeBase kb, PelletInfGraph pellet, final Node s, final Node p, Node o) { ExtendedIterator<Triple> result = NullIterator.instance(); ATermAppl subj = pellet.getLoader().node2term( s ); ATermAppl obj = pellet.getLoader().node2term( o ); if( kb.isIndividual( subj ) || kb.isIndividual( obj ) ) { if( kb.isIndividual( subj )) { List<ATermAppl> properties = kb.getProperties( pellet.getLoader().node2term( s ), pellet.getLoader().node2term( o ) ); result = propertyFiller( s, properties, o ); if(kb.isIndividual( obj ) ) { if( kb.isSameAs( subj, obj ) ) result = result.andThen( new SingletonIterator<Triple>( Triple.create( s, OWL.sameAs.asNode(), o ) ) ); if( kb.isDifferentFrom( subj, obj ) ) result = result.andThen( new SingletonIterator<Triple>( Triple.create( s, OWL.differentFrom.asNode(), o ) ) ); } } } else if( !pellet.isSkipBuiltinPredicates() ) { for( Node pred : BUILTIN_PREDICATES ) { result = result.andThen( findTriple( kb, pellet, s, pred, o ) ); } } return result; } }