Soprano::StatementIterator Class Reference

An iterator that provides a stream of Statements. More...

#include <Soprano/StatementIterator>

Inheritance diagram for Soprano::StatementIterator:
[legend]

List of all members.

Public Member Functions

 StatementIterator ()
 StatementIterator (IteratorBackend< Statement > *sti)
 StatementIterator (const StatementIterator &sti)
virtual ~StatementIterator ()
StatementIteratoroperator= (const StatementIterator &)
QList< StatementallStatements ()
NodeIterator iterateSubjects () const
NodeIterator iteratePredicates () const
NodeIterator iterateObjects () const
NodeIterator iterateContexts () const


Detailed Description

An iterator that provides a stream of Statements.

The most common use of StatementIterator is through Model::listStatements().

Many backends do lock the underlying Model during iteration. Thus, it is always a good idea to cache the results if they are to be used to modify the model to prevent a deadlock:

 Soprano::StatementIterator it = model->listStatements();
 QList<Statement> allStatements = it.allElements();
 Q_FOREACH( Soprano::Statement s, allStatements ) {
    modifyTheModel( model, s );
 }

For further details on Soprano iterators see Iterator.

Warning:
Be aware that iterators in Soprano are shared objects which means that copies of one iterator object work on the same data.
Author:
Daniele Galdi <daniele.galdi@gmail.com>
Sebastian Trueg <trueg@kde.org>

Definition at line 66 of file statementiterator.h.


Constructor & Destructor Documentation

Soprano::StatementIterator::StatementIterator (  ) 

Creates and empty, invalid iterator.

Soprano::StatementIterator::StatementIterator ( IteratorBackend< Statement > *  sti  ) 

Create a new StatementIterator instance that uses sti as backend. StatementIterator will take ownership of the backend.

Soprano::StatementIterator::StatementIterator ( const StatementIterator sti  ) 

virtual Soprano::StatementIterator::~StatementIterator (  )  [virtual]


Member Function Documentation

StatementIterator& Soprano::StatementIterator::operator= ( const StatementIterator  ) 

QList<Statement> Soprano::StatementIterator::allStatements (  )  [inline]

Convenience method which extracts all statements (this does not include the statements that have already been read from the iterator) from the iterator and returns them in a list.

Be aware that after calling this method the iterator will be invalid.

Returns:
A list of all statements that rest in the iterator.

Definition at line 95 of file statementiterator.h.

NodeIterator Soprano::StatementIterator::iterateSubjects (  )  const

Convenience method that creates an iterator over the subject nodes of the statements in this iterator.

Warning:
The new iterator is just a wrapper around this one. Thus, changing it will also change this one.
Returns:
A wrapper iterator over the subject nodes.

NodeIterator Soprano::StatementIterator::iteratePredicates (  )  const

Convenience method that creates an iterator over the predicate nodes of the statements in this iterator.

Warning:
The new iterator is just a wrapper around this one. Thus, changing it will also change this one.
Returns:
A wrapper iterator over the predicate nodes.

NodeIterator Soprano::StatementIterator::iterateObjects (  )  const

Convenience method that creates an iterator over the object nodes of the statements in this iterator.

Warning:
The new iterator is just a wrapper around this one. Thus, changing it will also change this one.
Returns:
A wrapper iterator over the object nodes.

NodeIterator Soprano::StatementIterator::iterateContexts (  )  const

Convenience method that creates an iterator over the context nodes of the statements in this iterator.

Warning:
The new iterator is just a wrapper around this one. Thus, changing it will also change this one.
Returns:
A wrapper iterator over the context nodes.


The documentation for this class was generated from the following file:

Generated on Wed Mar 5 20:45:27 2008 for Soprano by  doxygen 1.5.5