soprano
Soprano::Graph Class Reference
A simple collection of statements. More...
#include <Soprano/Graph>
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.
- 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.
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 | ) |
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 |
| 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.
| NodeIterator Soprano::Graph::listContexts | ( | ) | const |
| 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.
| StatementIterator Soprano::Graph::listStatements | ( | const Statement & | partial = Statement() |
) | const |
| StatementIterator Soprano::Graph::listStatementsInContext | ( | const Node & | context | ) | const |
| bool Soprano::Graph::operator!= | ( | const Graph & | g | ) | const |
Comparision operator.
- Returns:
trueif this graph contains a statement g does not contain or the other way around,falseotherwise.
Returns a graph containing all statements from this graph and from s.
Returns a graph containing all statements from this graph and from g.
Inserts the statement s into this graph and returns a reference to this graph.
Inserts the statements in graph g into this graph and returns a reference to this graph.
Substracts s from this graph and returns a reference to this graph.
Substracts all statements in g from this graph and returns a reference to this graph.
Removes the statement s from this graph and returns a reference to this graph.
Removes the statements in graph g from this graph and returns a reference to this graph.
Assings statements to this graph and returns a refernce to this graph.
Assings g to this graph and returns a refernce to this graph.
| bool Soprano::Graph::operator== | ( | const Graph & | g | ) | const |
Comparision operator.
- Returns:
trueif this graph and g contain the same statements,falseotherwise.
| 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.
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.
Convenience method which removes all statements in statements.
| int Soprano::Graph::statementCount | ( | ) | const |
The documentation for this class was generated from the following file:
KDE 4.4 API Reference