Soprano  2.7.56
Public Member Functions
Soprano::Graph Class Reference

A simple collection of statements. More...

#include <Soprano/Graph>

List of all members.

Public Member Functions

 Graph ()
 Graph (const Graph &)
 Graph (const QList< Statement > &)
 ~Graph ()
void addStatement (const Statement &statement)
void addStatement (const Node &subject, const Node &predicate, const Node &object, const Node &context=Node())
void addStatements (const QList< Statement > &statements)
void removeStatement (const Statement &statement)
void removeStatement (const Node &subject, const Node &predicate, const Node &object, const Node &context=Node())
void removeAllStatements (const Statement &statement=Statement())
void removeAllStatements (const Node &subject, const Node &predicate, const Node &object, const Node &context=Node())
void removeStatements (const QList< Statement > &statements)
void removeContext (const Node &)
StatementIterator listStatements (const Statement &partial=Statement()) const
StatementIterator listStatements (const Node &subject, const Node &predicate, const Node &object, const Node &context=Node()) const
StatementIterator listStatementsInContext (const Node &context) const
NodeIterator listContexts () const
bool containsAnyStatement (const Statement &statement) const
bool containsAnyStatement (const Node &subject, const Node &predicate, const Node &object, const Node &context=Node()) const
bool containsStatement (const Statement &statement) const
bool containsStatement (const Node &subject, const Node &predicate, const Node &object, const Node &context=Node()) const
bool containsContext (const Node &context) const
bool isEmpty () const
int statementCount () const
QList< StatementtoList () const
QSet< StatementtoSet () const
Operators
Graphoperator= (const Graph &g)
Graphoperator= (const QList< Statement > &statements)
Graph operator+ (const Graph &g) const
Graph operator+ (const Statement &s) const
Graphoperator+= (const Graph &g)
Graphoperator+= (const Statement &s)
Graph operator- (const Graph &) const
Graph operator- (const Statement &s) const
Graphoperator-= (const Graph &g)
Graphoperator-= (const Statement &s)
Graphoperator<< (const Graph &)
Graphoperator<< (const Statement &)
bool operator== (const Graph &g) const
bool operator!= (const Graph &g) const

Detailed Description

A simple collection of statements.

A Graph is a simple in-memory collection of Statements. It is supposed to be used where one needs a quick way to exchange or store a small number of statements. It is basically a fancy QSet of statements.

In comparision to Model it does not support queries, it does not use a specific backend plugin, and it is not optimized in any way.

One graph does not represent one named graph, i.e. one context, it can contain Statements with different context nodes.

Author:
Sebastian Trueg trueg.nosp@m.@kde.nosp@m..org
Since:
2.3

Definition at line 60 of file graph.h.


Constructor & Destructor Documentation

Create an empty graph.

Copy constructor.

Create a graph from a list of statements.

See also:
operator=(const QList<Statement>&)

Destructor


Member Function Documentation

void Soprano::Graph::addStatement ( const Statement statement)

Add the Statement to the Graph.

Parameters:
statementThe Statement to add.
void Soprano::Graph::addStatement ( const Node subject,
const Node predicate,
const Node object,
const Node context = Node() 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

void Soprano::Graph::addStatements ( const QList< Statement > &  statements)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

void Soprano::Graph::removeStatement ( const Statement statement)

Remove one statement. For removing statements with wildward matching see removeAllStatements().

Parameters:
statementThe statement that should be removed. This has to be a valid statement.
Returns:
Error::ErrorNone on success and an error code if statement was invalid or an error occured.
void Soprano::Graph::removeStatement ( const Node subject,
const Node predicate,
const Node object,
const Node context = Node() 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

void Soprano::Graph::removeAllStatements ( const Statement statement = Statement())

Remove all statements that match the partial statement. For removing one specific statement see removeStatement().

Parameters:
statementA possible partially defined statement that serves as a filter for all statements that should be removed.
void Soprano::Graph::removeAllStatements ( const Node subject,
const Node predicate,
const Node object,
const Node context = Node() 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters:
subjectThe subject node to match. Can be empty as a wildcard.
predicateThe predicate node to match. Can be empty as a wildcard.
objectThe object node to match. Can be empty as a wildcard.
contextThe context node to match. Can be empty as a wildcard.
void Soprano::Graph::removeStatements ( const QList< Statement > &  statements)

Convenience method which removes all statements in statements.

void Soprano::Graph::removeContext ( const Node )

Convenience method that removes all statements in the context.

Return an iterator over Graph Statements that "partial" match the input Statement.

Parameters:
partialThe partial Statement to match.
Returns:
An iterator for all the matched Statements, on error an invalid iterator is returned.
StatementIterator Soprano::Graph::listStatements ( const Node subject,
const Node predicate,
const Node object,
const Node context = Node() 
) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters:
subjectThe subject node to match. Can be empty as a wildcard.
predicateThe predicate node to match. Can be empty as a wildcard.
objectThe object node to match. Can be empty as a wildcard.
contextThe context node to match. Can be empty as a wildcard.
Returns:
An iterator for all the matched Statements, on error an invalid iterator is returned.

Convenience method which lists all statements in context.

Returns:
An iterator for all the matched Statements, on error an invalid iterator is returned.

List all contexts in the graph, i.e. all named graphs.

Returns:
An iterator over context Nodes, on error an invalid iterator is returned.
bool Soprano::Graph::containsAnyStatement ( const Statement statement) const

Check if the graph contains certain statements.

Parameters:
statementA partially defined statement that serves as a pattern.
Returns:
true if the Graph contains a Statement matching the given statement pattern.
bool Soprano::Graph::containsAnyStatement ( const Node subject,
const Node predicate,
const Node object,
const Node context = Node() 
) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters:
subjectThe subject node to match. Can be empty as a wildcard.
predicateThe predicate node to match. Can be empty as a wildcard.
objectThe object node to match. Can be empty as a wildcard.
contextThe context node to match. Can be empty as a wildcard.
bool Soprano::Graph::containsStatement ( const Statement statement) const

Check if the graph contains a statements.

Parameters:
statementThe statement in question. This has to be a valid statement, i.e. subject, predicate, and object need to be defined. If the context node is empty the default graph is searched.
Returns:
true if the Graph contains the Statement, false otherwise or is statement is invalid.
bool Soprano::Graph::containsStatement ( const Node subject,
const Node predicate,
const Node object,
const Node context = Node() 
) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

bool Soprano::Graph::containsContext ( const Node context) const

Convenience method which is based on containsAnyStatement

bool Soprano::Graph::isEmpty ( ) const
Returns:
true if the Graph doesn't contains any Statement.

The number of statements stored in this Graph.

Returns:
The size of the Graph.

Convert the Graph into a list

Convert the Graph into a set

Graph& Soprano::Graph::operator= ( const Graph g)

Assings g to this graph and returns a refernce to this graph.

Graph& Soprano::Graph::operator= ( const QList< Statement > &  statements)

Assings statements to this graph and returns a refernce to this graph.

Graph Soprano::Graph::operator+ ( const Graph g) const

Returns a graph containing all statements from this graph and from g.

Graph Soprano::Graph::operator+ ( const Statement s) const

Returns a graph containing all statements from this graph and from s.

Graph& Soprano::Graph::operator+= ( const Graph g)

Inserts the statements in graph g into this graph and returns a reference to this graph.

Graph& Soprano::Graph::operator+= ( const Statement s)

Inserts the statement s into this graph and returns a reference to this graph.

Graph Soprano::Graph::operator- ( const Graph ) const

Substracts all statements in g from this graph and returns a reference to this graph.

Graph Soprano::Graph::operator- ( const Statement s) const

Substracts s from this graph and returns a reference to this graph.

Graph& Soprano::Graph::operator-= ( const Graph g)

Removes the statements in graph g from this graph and returns a reference to this graph.

Graph& Soprano::Graph::operator-= ( const Statement s)

Removes the statement s from this graph and returns a reference to this graph.

Graph& Soprano::Graph::operator<< ( const Graph )
See also:
operator+=
Graph& Soprano::Graph::operator<< ( const Statement )
See also:
operator+=
bool Soprano::Graph::operator== ( const Graph g) const

Comparision operator.

Returns:
true if this graph and g contain the same statements, false otherwise.
bool Soprano::Graph::operator!= ( const Graph g) const

Comparision operator.

Returns:
true if this graph contains a statement g does not contain or the other way around, false otherwise.

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