@Override public <U> ExtendedIterator<U> mapWith(Map1<T,U> map1) { lazy(); return it.mapWith(map1); }
/** * <p>Answer an iterator of the elements of this list, to each of which * the given map function has been applied.</p> * @param fn A Map function * @return The iterator of the elements of this list mapped with the given map function. */ @Override public <T> ExtendedIterator<T> mapWith( Map1<RDFNode, T> fn ) { return iterator().mapWith( fn ); }
protected ExtendedIterator<Triple> objectFiller(final Node s, final Node p, final Iterator<ATermAppl> objects) { Map1<ATermAppl, Triple> map = new Map1<ATermAppl, Triple>() { public Triple map1( ATermAppl o ) { return Triple.create( s, p, JenaUtils.makeGraphNode( o ) ); } }; return WrappedIterator.create( objects ).mapWith( map ); }
protected ExtendedIterator<Triple> propertyFiller(final Node s, final Iterator<ATermAppl> properties, final Node o) { Map1<ATermAppl, Triple> map = new Map1<ATermAppl, Triple>() { public Triple map1( ATermAppl p ) { return Triple.create( s, JenaUtils.makeGraphNode( p ), o ); } }; return WrappedIterator.create( properties ).mapWith( map ); }
protected ExtendedIterator<Triple> subjectFiller(final Iterator<ATermAppl> subjects, final Node p, final Node o) { Map1<ATermAppl, Triple> map = new Map1<ATermAppl, Triple>() { public Triple map1( ATermAppl s ) { return Triple.create( JenaUtils.makeGraphNode( s ), p, o ); } }; return WrappedIterator.create( subjects ).mapWith( map ); }
/** Answer an iterator over the names of graphs in the FileGraphMaker. This is all the names of freshly-created graphs, plus the names of any files in the fileBase that might be RDF files. "Might" is weaker than we'd like for now. @see com.hp.hpl.jena.graph.GraphMaker#listGraphs() */ @Override public ExtendedIterator<String> listGraphs() { String [] fileNames = new File( fileBase ).list( graphName() ); Set<String> allNames = CollectionFactory.createHashedSet( Arrays.asList( fileNames ) ); Iterator<File> it = created.keySet().iterator(); while (it.hasNext()) allNames.add( it.next().getName() ); return WrappedIterator.create( allNames.iterator() ) .mapWith( unconvert ); } }
/** * */ static public StmtIterator asStmtIterator( Iterator<Triple> i, final ModelCom m ) { Map1<Triple, Statement> asStatement = new Map1<Triple, Statement>() { @Override public Statement map1( Triple t ) { return m.asStatement( t ); }}; return new StmtIteratorImpl( WrappedIterator.create( i ).mapWith( asStatement ) ); }
/** * */ static public ResIterator asResIterator( Iterator<Node> i, final ModelCom m) { Map1<Node, Resource> asResource = new Map1<Node, Resource>() { @Override public Resource map1( Node o) { return (Resource) m.asRDFNode( o ); }}; return new ResIteratorImpl( WrappedIterator.create( i ).mapWith( asResource ), null ); }
/** * */ static public NodeIterator asRDFNodeIterator( Iterator<Node> i, final ModelCom m) { Map1<Node, RDFNode> asRDFNode = new Map1<Node, RDFNode>() { @Override public RDFNode map1( Node o) { return m.asRDFNode( o ); }}; return new NodeIteratorImpl( WrappedIterator.create( i ).mapWith( asRDFNode ), null ); }
/** Return an iterator over the unique predicate between s and o. * s and o can be wildcards (Node.ANY) * @param g Graph * @param s Subject - may be Node.ANY * @param o Object - may be Node.ANY * @return ExtendedIterator */ public static ExtendedIterator<Node> listPredicates(Graph g, Node s, Node o) { ExtendedIterator<Triple> iter = g.find(s,Node.ANY, o) ; Set<Node> nodes = iter.mapWith(mapPredicate).toSet() ; return WrappedIterator.createNoRemove(nodes.iterator()) ; }
/** Return an iterator over the unique objects with a given subject and object. * s and p can be wildcards (Node.ANY) * @param g Graph * @param s Subject - may be Node.ANY * @param p Predicate - may be Node.ANY * @return ExtendedIterator */ public static ExtendedIterator<Node> listObjects(Graph g, Node s, Node p) { ExtendedIterator<Triple> iter = g.find(s, p, Node.ANY) ; Set<Node> nodes = iter.mapWith(mapObject).toSet() ; return WrappedIterator.createNoRemove(nodes.iterator()) ; }
/** * <p>Answer an iterator over all of the literals that are declared to be the permissible values for * this class. Each element of the iterator will be an {@link Literal}.</p> * @return An iterator over the literals that are the permissible values * @exception OntProfileException If the {@link Profile#ONE_OF()} property is not supported in the current language profile. */ @Override public ExtendedIterator<Literal> listOneOf() { return getOneOf().iterator().mapWith( new AsMapper<Literal>( Literal.class ) ); }
/** * <p>Answer an iterator over all of the classes that are the operands of this * Boolean class expression. Each element of the iterator will be an {@link OntClass}.</p> * @return An iterator over the operands of the expression. * @exception OntProfileException If the operand property is not supported in the current language profile. */ @Override public ExtendedIterator<? extends OntClass> listOperands() { return getOperands().iterator().mapWith( new AsMapper<OntClass>( OntClass.class ) ); }
/** * <p>Answer an iterator over all of the individuals that are declared to be the class extension for * this class. Each element of the iterator will be an {@link OntResource}.</p> * @return An iterator over the individuals in the class extension * @exception OntProfileException If the {@link Profile#ONE_OF()} property is not supported in the current language profile. */ @Override public ExtendedIterator<? extends OntResource> listOneOf() { return getOneOf().iterator().mapWith( new AsMapper<OntResource>( OntResource.class ) ); }
/** Answer an iterator for the given property, whose values are .as() some class */ protected <T extends RDFNode> ExtendedIterator<T> listAs( Property p, String name, Class<T> cls ) { checkProfile( p, name ); return WrappedIterator.create( listProperties( p ) ).mapWith( new ObjectAsMapper<T>( cls ) ); }
/** * <p>Answer an iterator over all of the resources that are declared to define * this resource. </p> * @return An iterator over the resources defining this resource. * @exception OntProfileException If the {@link Profile#IS_DEFINED_BY()} property is not supported in the current language profile. */ @Override public ExtendedIterator<RDFNode> listIsDefinedBy() { checkProfile( getProfile().IS_DEFINED_BY(), "IS_DEFINED_BY" ); return WrappedIterator.create( listProperties( getProfile().IS_DEFINED_BY() ) ) .mapWith( new ObjectAsOntResourceMapper() ); }
/** * <p>Answer an iterator over all of the resources that are declared to provide addition * information about this resource.</p> * @return An iterator over the resources providing additional definition on this resource. * @exception OntProfileException If the {@link Profile#SEE_ALSO()} property is not supported in the current language profile. */ @Override public ExtendedIterator<RDFNode> listSeeAlso() { checkProfile( getProfile().SEE_ALSO(), "SEE_ALSO" ); return WrappedIterator.create( listProperties( getProfile().SEE_ALSO() ) ) .mapWith( new ObjectAsOntResourceMapper() ); }
/** * <p>Answer an iterator over all of the version info strings for this resource.</p> * @return An iterator over the version info strings for this resource. * @exception OntProfileException If the {@link Profile#VERSION_INFO()} property is not supported in the current language profile. */ @Override public ExtendedIterator<String> listVersionInfo() { checkProfile( getProfile().VERSION_INFO(), "VERSION_INFO" ); return WrappedIterator.create( listProperties( getProfile().VERSION_INFO() ) ) .mapWith( new ObjectAsStringMapper() ); }
/** * <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() ); }