@Override public ExtendedIterator<T> filterKeep(Filter<T> f) { lazy(); return it.filterKeep(f); }
@Override protected ExtendedIterator<Triple> _graphBaseFind( TripleMatch s ) { return L.find( s ) .filterKeep( ifIn( R ) ); } }
/** Answer an iterator over all the reification triples that this Reifier exposes (ie all if Standard, none otherwise) that match m. */ public static ExtendedIterator<Triple> findExposed(Graph graph, TripleMatch match) { ExtendedIterator<Triple> it = graph.find(match) ; it = it.filterKeep(filterReif) ; return WrappedIterator.create(it) ; }
/** * <p> * Answer an iterator that ranges over the resources in this model that are * instances of the given class. * </p> * * @return An iterator over individual resources whose <code>rdf:type</code> * is <code>cls</code>. */ @Override public ExtendedIterator<Individual> listIndividuals( Resource cls ) { return findByTypeAs( cls, Individual.class ) .filterKeep( new UniqueFilter<Individual>()); }
@Override public ExtendedIterator<Triple> graphBaseFind( TripleMatch m ) { Iterator<Triple> iter = triples.iterator() ; return SimpleEventManager.notifyingRemove( this, iter ) .filterKeep ( new TripleMatchFilterEquality( m.asTriple() ) ); }
@Override protected ExtendedIterator<Triple> graphBaseFind(TripleMatch m) { Iterator<Triple> iter = triples.iterator() ; return SimpleEventManager.notifyingRemove( this, iter ) .filterKeep ( new TripleMatchFilterEquality( m.asTriple() ) ); }
@Override protected ExtendedIterator<Triple> graphBaseFind( final TripleMatch m ) { ExtendedIterator<Triple> iter =null; if (iteratorDeleteAllowed) { iter = SimpleEventManager.notifyingRemove( this, triples.iterator() ); } else { iter = WrappedIterator.createNoRemove( triples.iterator() ); } return iter .filterKeep ( new TripleMatchFilterEquality( m.asTriple() ) ); }
/** * <p>Answer an iterator over all of the classes that are declared to be equivalent classes to * this class. Each element of the iterator will be an {@link OntClass}.</p> * @return An iterator over the classes equivalent to this class. * @exception OntProfileException If the {@link Profile#EQUIVALENT_CLASS()} property is not supported in the current language profile. */ @Override public ExtendedIterator<OntClass> listEquivalentClasses() { return listAs( getProfile().EQUIVALENT_CLASS(), "EQUIVALENT_CLASS", OntClass.class ).filterKeep( new UniqueFilter<OntClass>()); }
/** * <p>Answer an iterator over all of the classes that this class is declared to be disjoint with. * Each element of the iterator will be an {@link OntClass}.</p> * @return An iterator over the classes disjoint with this class. * @exception OntProfileException If the {@link Profile#DISJOINT_WITH()} property is not supported in the current language profile. */ @Override public ExtendedIterator<OntClass> listDisjointWith() { return listAs( getProfile().DISJOINT_WITH(), "DISJOINT_WITH", OntClass.class ).filterKeep( new UniqueFilter<OntClass>() ) ; }
/** * Internal variant of find which omits the filters which block illegal RDF data. * @param pattern a TriplePattern to be matched against the data */ public ExtendedIterator<Triple> findFull(TriplePattern pattern) { checkOpen(); this.requirePrepared(); return bEngine.find(pattern).filterKeep( new UniqueFilter<Triple>()); }
/** * <p> * Answer an iterator over the RDF classes to which this resource belongs. * </p> * * @param direct If true, only answer those resources that are direct types * of this resource, not the super-classes of the class etc. * @return An iterator over the set of this resource's classes, each of which * will be a {@link Resource}. */ @Override public ExtendedIterator<Resource> listRDFTypes( boolean direct ) { ExtendedIterator<Resource> i = listDirectPropertyValues( RDF.type, "rdf:type", Resource.class, getProfile().SUB_CLASS_OF(), direct, false ); // we only want each result once return i.filterKeep( new UniqueFilter<Resource>()); }
/** * <p> * Answer an iterator that ranges over all of the various forms of class description resource * in this model. Class descriptions include {@link #listEnumeratedClasses enumerated} * classes, {@link #listUnionClasses union} classes, {@link #listComplementClasses complement} * classes, {@link #listIntersectionClasses intersection} classes, {@link #listClasses named} * classes and {@link #listRestrictions property restrictions}. * </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 class description resources. */ @Override public ExtendedIterator<OntClass> listClasses() { return findByTypeAs( getProfile().getClassDescriptionTypes(), OntClass.class ) .filterKeep( new UniqueFilter<OntClass>()); }
/** * <p>Answer an iterator over the DataRange objects in this ontology, if there * are any.</p> * @return An iterator, whose values are {@link DataRange} objects. */ @Override public ExtendedIterator<DataRange> listDataRanges() { checkProfileEntry( getProfile().DATARANGE(), "DATARANGE" ); return findByTypeAs( getProfile().DATARANGE(), DataRange.class ) .filterKeep( new UniqueFilter<DataRange>()); }
/** * 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(); Finder cascade = transitiveEngine.getFinder(pattern, FinderUtil.cascade(tbox, continuation)); return cascade.find(pattern).filterKeep( new UniqueFilter<Triple>()); }
/** * <p> * Answer an iterator that ranges over the symmetric property resources in this model, i.e. * the resources with <code>rdf:type SymmetricProperty</code> or equivalent. * </p> * <p> * Specifically, the resources in this iterator will those whose type corresponds * to the value given in the ontology vocabulary associated with this model: see * {@link Profile#SYMMETRIC_PROPERTY}. * </p> * * @return An iterator over symmetric property resources. */ @Override public ExtendedIterator<SymmetricProperty> listSymmetricProperties() { checkProfileEntry( getProfile().SYMMETRIC_PROPERTY(), "SYMMETRIC_PROPERTY" ); return findByTypeAs( getProfile().SYMMETRIC_PROPERTY(), SymmetricProperty.class ) .filterKeep( new UniqueFilter<SymmetricProperty>()); }
/** * <p> * Answer an iterator that ranges over the transitive property resources in this model, i.e. * the resources with <code>rdf:type TransitiveProperty</code> or equivalent. * </p> * <p> * Specifically, the resources in this iterator will those whose type corresponds * to the value given in the ontology vocabulary associated with this model: see * {@link Profile#TRANSITIVE_PROPERTY}. * </p> * * @return An iterator over transitive property resources. */ @Override public ExtendedIterator<TransitiveProperty> listTransitiveProperties() { checkProfileEntry( getProfile().TRANSITIVE_PROPERTY(), "TRANSITIVE_PROPERTY" ); return findByTypeAs( getProfile().TRANSITIVE_PROPERTY(), TransitiveProperty.class ) .filterKeep( new UniqueFilter<TransitiveProperty>()); }
/** * <p> * Answer an iterator that ranges over the inverse functional property resources in this model, i.e. * the resources with <code>rdf:type InverseFunctionalProperty</code> or equivalent. * </p> * <p> * Specifically, the resources in this iterator will those whose type corresponds * to the value given in the ontology vocabulary associated with this model: see * {@link Profile#INVERSE_FUNCTIONAL_PROPERTY}. * </p> * * @return An iterator over inverse functional property resources. */ @Override public ExtendedIterator<InverseFunctionalProperty> listInverseFunctionalProperties() { checkProfileEntry( getProfile().INVERSE_FUNCTIONAL_PROPERTY(), "INVERSE_FUNCTIONAL_PROPERTY" ); return findByTypeAs( getProfile().INVERSE_FUNCTIONAL_PROPERTY(), InverseFunctionalProperty.class ) .filterKeep( new UniqueFilter<InverseFunctionalProperty>()); }
/** * <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>()); }
/** * <p>Answer an iterator over all of the comment literals for this resource.</p> * @return An iterator over RDF {@link Literal}'s. * @exception OntProfileException If the {@link Profile#COMMENT()} property is not supported in the current language profile. */ @Override public ExtendedIterator<RDFNode> listComments( String lang ) { checkProfile( getProfile().COMMENT(), "COMMENT" ); return WrappedIterator.create( listProperties( getProfile().COMMENT() ) ) .filterKeep( new LangTagFilter( lang ) ) .mapWith( new ObjectMapper() ); }
/** * <p>Answer an iterator over all of the label literals for this resource.</p> * @param lang The language to restrict any label values to, or null to select all languages * @return An iterator over RDF {@link Literal}'s. * @exception OntProfileException If the {@link Profile#LABEL()} property is not supported in the current language profile. */ @Override public ExtendedIterator<RDFNode> listLabels( String lang ) { checkProfile( getProfile().LABEL(), "LABEL" ); return WrappedIterator.create( listProperties( getProfile().LABEL() ) ) .filterKeep( new LangTagFilter( lang ) ) .mapWith( new ObjectMapper() ); }