/** * Return an iterator over all registered subject nodes */ public ExtendedIterator<Node> listAllSubjects() { return WrappedIterator.create(nodeMap.keySet().iterator()); }
public static Iterator<String> nodesToURIs(Iterator<Node> iter) { MapFilter<Node, String> mapper = new MapFilter<Node, String>(){ public String accept(Node x) { return x.getURI() ; }} ; ExtendedIterator<Node> eIter = WrappedIterator.create(iter) ; Iterator<String> conv = new MapFilterIterator<Node, String>(mapper, eIter) ; return conv ; }
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 ); }
/** * <p>Answer an iterator over all of the properties that are declared to be inverse properties of * this property, ensuring that each presents the objectProperty facet.</p> * @return An iterator over the properties inverse to this property. * @exception OntProfileException If the {@link Profile#INVERSE_OF()} property is not supported in the current language profile. */ @Override public ExtendedIterator<? extends OntProperty> listInverseOf() { List<OntProperty> objPs = new ArrayList<OntProperty>(); for (Iterator<? extends OntProperty> i = super.listInverseOf(); i.hasNext(); ) { objPs.add( i.next().as( ObjectProperty.class ) ); } return WrappedIterator.create( objPs.iterator() ); }
/** 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 ); } }
public ExtendedIterator<Triple> findExposed(TripleMatch match) { Iterator<Triple> it = graph.find(match) ; it = Iter.filter(it, filterReif) ; return WrappedIterator.create(it) ; }
/** * */ 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 ); }
@Override protected ExtendedIterator<Triple> graphBaseFind(TripleMatch m) { List<Triple> results = new ArrayList<Triple>() ; for ( Triple t : triples ) if ( t.matches(m.getMatchSubject(), m.getMatchPredicate(), m.getMatchObject()) ) results.add(t) ; return WrappedIterator.create(results.iterator()) ; } }
/** * */ 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 ); }
/** 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) ; }
@Override protected ExtendedIterator<Triple> graphBaseFind(TripleMatch m) { List<Triple> results = new ArrayList<Triple>() ; Iterator<Quad> iter = findNG(graphName, m.getMatchSubject(), m.getMatchPredicate(), m.getMatchObject()) ; for ( ; iter.hasNext() ; ) results.add(iter.next().asTriple()) ; return WrappedIterator.create(results.iterator()) ; } }
/** 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() ); }