/** Answer an iterator over the elements of <code>i</code> that are not in the graph <code>seen</code>. */ public static ExtendedIterator<Triple> rejecting( final ExtendedIterator<Triple> i, final Graph seen ) { Filter<Triple> seenFilter = new Filter<Triple>() { @Override public boolean accept( Triple x ) { return seen.contains( x ); } }; return i.filterDrop( seenFilter ); }
/** * <p> * Answer an iterator over the elements of iterator i that are not in the set <code>seen</code>. * </p> * * @param i An extended iterator * @param seen A set of objects * @return An iterator over the elements of i that are not in the set <code>seen</code>. */ public static ExtendedIterator<Triple> rejecting( final ExtendedIterator<Triple> i, final Set<Triple> seen ) { Filter<Triple> seenFilter = new Filter<Triple>() { @Override public boolean accept( Triple x ) { return seen.contains( x ); } }; return i.filterDrop( seenFilter ); }
@Override public ExtendedIterator<T> filterDrop(Filter<T> f) { lazy(); return it.filterDrop(f); }
/** * <p> * Answer an iterator that ranges over the named class-descriptions * in this model, i.e. resources with <code>rdf:type * Class</code> (or equivalent) and a node URI. * </p> * <p> * <strong>Note:</strong> the number of nodes returned by this iterator will vary according to * the completeness of the deductive extension of the underlying graph. See class * overview for more details. * </p> * * @return An iterator over named class resources. */ @Override public ExtendedIterator<OntClass> listNamedClasses() { return listClasses().filterDrop( new Filter<OntClass>() { @Override public boolean accept( OntClass x ) { return x.isAnon(); } } ); }
@Override public ExtendedIterator<Triple> find( Node s, Node p, Node o ) { return SimpleEventManager.notifyingRemove( this, base.find( s, p, o ).filterDrop( new Filter<Triple>() { @Override public boolean accept(Triple t) { if (t.getSubject().isLiteral()) return true; if (t.getPredicate().isBlank() || t.getPredicate().isLiteral()) return true; return false; } } ) ); }
@Override public ExtendedIterator<Triple> _graphBaseFind( TripleMatch t ) { return L.find( t ). filterDrop ( ifIn( R ) ); } }
.filterDrop( new Filter<OntClass>() { @Override public boolean accept( OntClass c ) {
/** * Find all the base triples matching tm, exclude the ones that are deleted, * add the ones that have been added. */ @Override protected ExtendedIterator<Triple> _graphBaseFind(TripleMatch tm) { return base.find(tm).filterDrop(ifIn(GraphUtil.findAll(R))).andThen(L.find(tm)) ; }
/** * <p>Answer an iterator over all of the properties that are declared to be super-properties of * this property. Each element of the iterator will be an {@link OntProperty}.</p> * @param direct If true, only answer the directly adjacent properties in the * property hierarchy: i.e. eliminate any property for which there is a longer route * to reach that child under the super-property relation. * @return An iterator over the super-properties of this property. * @exception OntProfileException If the {@link Profile#SUB_PROPERTY_OF()} property is not supported in the current language profile. */ @Override public ExtendedIterator<OntProperty> listSuperProperties( boolean direct ) { return listDirectPropertyValues( getProfile().SUB_PROPERTY_OF(), "SUB_PROPERTY_OF", OntProperty.class, getProfile().SUB_PROPERTY_OF(), direct, false ) .filterDrop( new SingleEqualityFilter<OntProperty>( this ) ); }
/** * Internals of findWithContinuation implementation which allows control * over functor filtering. */ private ExtendedIterator<Triple> findWithContinuation(TriplePattern pattern, Finder continuation, boolean filter) { checkOpen(); this.requirePrepared(); ExtendedIterator<Triple> result = null; if (fdata == null) { result = fdeductions.findWithContinuation(pattern, continuation); } else { if (continuation == null) { result = fdata.findWithContinuation(pattern, fdeductions); } else { result = fdata.findWithContinuation(pattern, FinderUtil.cascade(fdeductions, continuation) ); } } if (filter && filterFunctors) { return result.filterDrop(Functor.acceptFilter); } else { return result; } }
/** * Extended find interface used in situations where the implementator * may or may not be able to answer the complete query. It will * attempt to answer the pattern but if its answers are not known * to be complete then it will also pass the request on to the nested * Finder to append more results. * @param pattern a TriplePattern to be matched against the data * @param continuation either a Finder or a normal Graph which * will be asked for additional match results if the implementor * may not have completely satisfied the query. */ @Override public synchronized ExtendedIterator<Triple> findWithContinuation(TriplePattern pattern, Finder continuation) { checkOpen(); this.requirePrepared(); ExtendedIterator<Triple> result = engine.find(pattern).filterKeep( new UniqueFilter<Triple>()); if (continuation != null) { result = result.andThen(continuation.find(pattern)); } return result.filterDrop(Functor.acceptFilter); }
/** * <p>Answer an iterator over all of the classes that are declared to be super-classes of * this class. Each element of the iterator will be an {@link OntClass}. * See {@link #listSubClasses( boolean )} for a full explanation of the <em>direct</em> * parameter. * </p> * * @param direct If true, only answer the direcly adjacent classes in the * super-class relation: i.e. eliminate any class for which there is a longer route * to reach that child under the super-class relation. * @return an iterator over the resources representing this class's sub-classes. * @exception OntProfileException If the {@link Profile#SUB_CLASS_OF()} property is not supported in the current language profile. */ @Override public ExtendedIterator<OntClass> listSuperClasses( boolean direct ) { return listDirectPropertyValues( getProfile().SUB_CLASS_OF(), "SUB_CLASS_OF", OntClass.class, getProfile().SUB_CLASS_OF(), direct, false ) .filterDrop( new SingleEqualityFilter<OntClass>( this ) ).filterKeep( new UniqueFilter<OntClass>()); }
/** * Extended find interface used in situations where the implementator * may or may not be able to answer the complete query. It will * attempt to answer the pattern but if its answers are not known * to be complete then it will also pass the request on to the nested * Finder to append more results. * @param pattern a TriplePattern to be matched against the data * @param continuation either a Finder or a normal Graph which * will be asked for additional match results if the implementor * may not have completely satisfied the query. */ @Override public ExtendedIterator<Triple> findWithContinuation(TriplePattern pattern, Finder continuation) { checkOpen(); this.requirePrepared(); ExtendedIterator<Triple> result =bEngine.find(pattern).filterKeep( new UniqueFilter<Triple>()); if (continuation != null) { result = result.andThen(continuation.find(pattern)); } if (filterFunctors) { // return result.filterDrop(Functor.acceptFilter); return result.filterDrop( new Filter<Triple>() { @Override public boolean accept( Triple o ) { return FBRuleInfGraph.this.accept( o ); }} ); } else { return result; } }
public ExtendedIterator<OntClass> listSubClasses( boolean direct ) { return listDirectPropertyValues( getProfile().SUB_CLASS_OF(), "SUB_CLASS_OF", OntClass.class, getProfile().SUB_CLASS_OF(), direct, true ) .filterDrop( new SingleEqualityFilter<OntClass>( this ) ).filterKeep( new UniqueFilter<OntClass>());
.filterDrop( new Filter<OntClass>() { @Override public boolean accept( OntClass o ) {