Soprano  2.9.4
Public Member Functions | List of all members
Soprano::StatementIterator Class Reference

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

#include <Soprano/StatementIterator>

+ Inheritance diagram for Soprano::StatementIterator:

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
 
- Public Member Functions inherited from Soprano::Iterator< Statement >
 Iterator ()
 
 Iterator (IteratorBackend< Statement > *sti)
 
 Iterator (const Iterator &sti)
 
virtual ~Iterator ()
 
Iteratoroperator= (const Iterator &)
 
void close ()
 
bool next ()
 
Statement current () const
 
Statement operator* () const
 
bool isValid () const
 
QList< StatementallElements ()
 
- Public Member Functions inherited from Soprano::Error::ErrorCache
virtual ~ErrorCache ()
 
virtual Error lastError () const
 

Additional Inherited Members

- Protected Member Functions inherited from Soprano::Iterator< Statement >
void setBackend (IteratorBackend< Statement > *b)
 
IteratorBackend< Statement > * backend () const
 
- Protected Member Functions inherited from Soprano::Error::ErrorCache
 ErrorCache ()
 
void clearError () const
 
void setError (const Error &) const
 
void setError (const QString &errorMessage, int code=ErrorUnknown) 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:

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.

Author
Daniele Galdi danie.nosp@m.le.g.nosp@m.aldi@.nosp@m.gmai.nosp@m.l.com
Sebastian Trueg trueg.nosp@m.@kde.nosp@m..org

Definition at line 75 of file statementiterator.h.

Constructor & Destructor Documentation

◆ StatementIterator() [1/3]

Soprano::StatementIterator::StatementIterator ( )

Creates and empty, invalid iterator.

◆ StatementIterator() [2/3]

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

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

◆ StatementIterator() [3/3]

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

◆ ~StatementIterator()

virtual Soprano::StatementIterator::~StatementIterator ( )
virtual

Member Function Documentation

◆ operator=()

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

◆ allStatements()

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 104 of file statementiterator.h.

◆ iterateSubjects()

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.

◆ iteratePredicates()

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.

◆ iterateObjects()

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.

◆ iterateContexts()

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:
QList
Soprano::Statement
A Statement instance represents one RDF quadruple.
Definition: statement.h:47
Soprano::StatementIterator
An iterator that provides a stream of Statements.
Definition: statementiterator.h:75
Soprano::Iterator::allElements
QList< T > allElements()
Soprano::StatementIterator::allStatements
QList< Statement > allStatements()
Definition: statementiterator.h:104
Soprano::Model::listStatements
virtual StatementIterator listStatements(const Statement &partial) const =0