soprano
Soprano::StatementIterator Class Reference
An iterator that provides a stream of Statements. More...
#include <Soprano/StatementIterator>

Public Member Functions | |
| StatementIterator (const StatementIterator &sti) | |
| StatementIterator (IteratorBackend< Statement > *sti) | |
| StatementIterator () | |
| virtual | ~StatementIterator () |
| QList< Statement > | allStatements () |
| NodeIterator | iterateContexts () const |
| NodeIterator | iterateObjects () const |
| NodeIterator | iteratePredicates () const |
| NodeIterator | iterateSubjects () const |
| StatementIterator & | operator= (const StatementIterator &) |
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 ); }
Iterators have to be closed. This can either be achieved by deleting the iterator, finishing it (next() does return false), or calling close(). Before that other operations on the Model may block.
Iterators are not thread-safe. Two threads using the same iterator may result in undefined behaviour and even crashes. An iterator needs to be closed by the same thread that opened it (except if the iterator contains special code to handle such a situation.)
- Warning:
- Be aware that iterators in Soprano are shared objects which means that copies of one iterator object work on the same data.
For further details on Soprano iterators see Iterator.
Definition at line 75 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
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 104 of file statementiterator.h.
| NodeIterator Soprano::StatementIterator::iterateContexts | ( | ) | const |
| NodeIterator Soprano::StatementIterator::iterateObjects | ( | ) | const |
| NodeIterator Soprano::StatementIterator::iteratePredicates | ( | ) | const |
| NodeIterator Soprano::StatementIterator::iterateSubjects | ( | ) | const |
| StatementIterator& Soprano::StatementIterator::operator= | ( | const StatementIterator & | ) |
Reimplemented in Soprano::Util::SimpleStatementIterator.
The documentation for this class was generated from the following file:
KDE 4.4 API Reference