• Skip to content
  • Skip to link menu
KDE 4.4 API Reference
  • KDE API Reference
  • KDE Support
  • Sitemap
  • Contact Us
 

soprano

Soprano::Graph

Soprano::Graph Class Reference

A simple collection of statements. More...

#include <Soprano/Graph>

List of all members.

Public Member Functions

 Graph (const QList< Statement > &)
 Graph (const Graph &)
 Graph ()
 ~Graph ()



void addStatement (const Node &subject, const Node &predicate, const Node &object, const Node &context=Node())
void addStatement (const Statement &statement)
void addStatements (const QList< Statement > &statements)
bool containsAnyStatement (const Node &subject, const Node &predicate, const Node &object, const Node &context=Node()) const
bool containsAnyStatement (const Statement &statement) const
bool containsContext (const Node &context) const
bool containsStatement (const Node &subject, const Node &predicate, const Node &object, const Node &context=Node()) const
bool containsStatement (const Statement &statement) const
bool isEmpty () const
NodeIterator listContexts () const
StatementIterator listStatements (const Node &subject, const Node &predicate, const Node &object, const Node &context=Node()) const
StatementIterator listStatements (const Statement &partial=Statement()) const
StatementIterator listStatementsInContext (const Node &context) const
void removeAllStatements (const Node &subject, const Node &predicate, const Node &object, const Node &context=Node())
void removeAllStatements (const Statement &statement=Statement())
void removeContext (const Node &)
void removeStatement (const Node &subject, const Node &predicate, const Node &object, const Node &context=Node())
void removeStatement (const Statement &statement)
void removeStatements (const QList< Statement > &statements)
int statementCount () const
QList< Statement > toList () const
Operators



bool operator!= (const Graph &g) const
Graph operator+ (const Statement &s) const
Graph operator+ (const Graph &g) const
Graph & operator+= (const Statement &s)
Graph & operator+= (const Graph &g)
Graph operator- (const Statement &s) const
Graph operator- (const Graph &) const
Graph & operator-= (const Statement &s)
Graph & operator-= (const Graph &g)
Graph & operator<< (const Statement &)
Graph & operator<< (const Graph &)
Graph & operator= (const QList< Statement > &statements)
Graph & operator= (const Graph &g)
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@kde.org>
Since:
2.3

Definition at line 59 of file graph.h.


Constructor & Destructor Documentation

Soprano::Graph::Graph (  ) 

Create an empty graph.

Soprano::Graph::Graph ( const Graph &   ) 

Copy constructor.

Soprano::Graph::Graph ( const QList< Statement > &   ) 

Create a graph from a list of statements.

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

Destructor.


Member Function Documentation

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::addStatement ( const Statement &  statement  ) 

Add the Statement to the Graph.

Parameters:
statement The Statement to add.
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.

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:
subject The subject node to match. Can be empty as a wildcard.
predicate The predicate node to match. Can be empty as a wildcard.
object The object node to match. Can be empty as a wildcard.
context The context node to match. Can be empty as a wildcard.
bool Soprano::Graph::containsAnyStatement ( const Statement &  statement  )  const

Check if the graph contains certain statements.

Parameters:
statement A partially defined statement that serves as a pattern.
Returns:
true if the Graph contains a Statement matching the given statement pattern.
bool Soprano::Graph::containsContext ( const Node &  context  )  const

Convenience method which is based on containsAnyStatement.

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::containsStatement ( const Statement &  statement  )  const

Check if the graph contains a statements.

Parameters:
statement The 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::isEmpty (  )  const
Returns:
true if the Graph doesn't contains any Statement.
NodeIterator Soprano::Graph::listContexts (  )  const

List all contexts in the graph, i.e.

all named graphs.

Returns:
An iterator over context Nodes, 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:
subject The subject node to match. Can be empty as a wildcard.
predicate The predicate node to match. Can be empty as a wildcard.
object The object node to match. Can be empty as a wildcard.
context The 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.
StatementIterator Soprano::Graph::listStatements ( const Statement &  partial = Statement()  )  const

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

Parameters:
partial The partial Statement to match.
Returns:
An iterator for all the matched Statements, on error an invalid iterator is returned.
StatementIterator Soprano::Graph::listStatementsInContext ( const Node &  context  )  const

Convenience method which lists all statements in context.

Returns:
An iterator for all the matched Statements, on error an invalid iterator is returned.
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.
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  )  const

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

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 &  g  ) 

Inserts the statements in graph g into 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 &   )  const

Substracts all statements in 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 &  g  ) 

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

Graph& Soprano::Graph::operator<< ( const Statement &   ) 
See also:
operator+=
Graph& Soprano::Graph::operator<< ( const Graph &   ) 
See also:
operator+=
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  ) 

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

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

Comparision operator.

Returns:
true if this graph and g contain the same statements, false otherwise.
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:
subject The subject node to match. Can be empty as a wildcard.
predicate The predicate node to match. Can be empty as a wildcard.
object The object node to match. Can be empty as a wildcard.
context The context node to match. Can be empty as a wildcard.
void Soprano::Graph::removeAllStatements ( const Statement &  statement = Statement()  ) 

Remove all statements that match the partial statement.

For removing one specific statement see removeStatement().

Parameters:
statement A possible partially defined statement that serves as a filter for all statements that should be removed.
void Soprano::Graph::removeContext ( const Node &   ) 

Convenience method that removes all statements in the context.

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::removeStatement ( const Statement &  statement  ) 

Remove one statement.

For removing statements with wildward matching see removeAllStatements().

Parameters:
statement The 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::removeStatements ( const QList< Statement > &  statements  ) 

Convenience method which removes all statements in statements.

int Soprano::Graph::statementCount (  )  const

The number of statements stored in this Graph.

Returns:
The size of the Graph.
QList<Statement> Soprano::Graph::toList (  )  const

Convert the Graph into a list.


The documentation for this class was generated from the following file:
  • graph.h

soprano

Skip menu "soprano"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

KDE Support

Skip menu "KDE Support"
  • akonadi
  • Decibel
  • grantlee
  • kdewin
  • phonon
  •     Backend
  • polkit-qt
  • qca
  • qimageblitz
  • soprano
  • strigi
  •     searchclient
  •     streamanalyzer
  •     streams
Generated for KDE Support by doxygen 1.5.9-20090814
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal