# class Model

### abstract

Module | soprano
Namespace | Soprano
Class | Model
Inherits | QObject,Soprano::Error::ErrorCache

### methods

- Model ( )

  returns ctor

- Model (a0)

  returns ctor
  Not implemented

  Argument | Type | Default
  --- | --- | ---
  a0 | Soprano.Model |

  Model instances are not meant to be copied.

- addStatement (statement)

  returns Soprano.Error.ErrorCode
  pure virtual

  Argument | Type | Default
  --- | --- | ---
  statement | Soprano.Statement |

  Add the Statement to the Model.

  statement - The Statement to add.

- addStatement (subject, predicate, object, context)

  returns Soprano.Error.ErrorCode

  Argument | Type | Default
  --- | --- | ---
  subject | Soprano.Node |
  predicate | Soprano.Node |
  object | Soprano.Node |
  context | Soprano.Node | Soprano.Node()

- addStatements (statements)

  returns Soprano.Error.ErrorCode

  Argument | Type | Default
  --- | --- | ---
  statements | QList<Soprano::Statement> |

- containsAnyStatement (statement)

  returns bool
  pure virtual

  Argument | Type | Default
  --- | --- | ---
  statement | Soprano.Statement |

  Check if the model contains certain statements.

  statement - A partially defined statement that serves as a pattern.

  Returns true if the Model contains a Statement matching the given statement pattern.

- containsAnyStatement (subject, predicate, object, context)

  returns bool

  Argument | Type | Default
  --- | --- | ---
  subject | Soprano.Node |
  predicate | Soprano.Node |
  object | Soprano.Node |
  context | Soprano.Node | Soprano.Node()

  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.

- containsContext (context)

  returns bool

  Argument | Type | Default
  --- | --- | ---
  context | Soprano.Node |

  Convenience method which is based on containsAnyStatement

- containsStatement (statement)

  returns bool
  pure virtual

  Argument | Type | Default
  --- | --- | ---
  statement | Soprano.Statement |

  Check if the model contains a statements.

  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 Model contains the Statement, false otherwise or is statement is invalid.

- containsStatement (subject, predicate, object, context)

  returns bool

  Argument | Type | Default
  --- | --- | ---
  subject | Soprano.Node |
  predicate | Soprano.Node |
  object | Soprano.Node |
  context | Soprano.Node | Soprano.Node()

- createBlankNode ( )

  returns Soprano.Node
  pure virtual

  Creates a new blank node with a unique identifier.

  Returns A blank node that can be used to create new statements.

- executeQuery (query, language, userQueryLanguage)

  returns Soprano.QueryResultIterator
  pure virtual

  Argument | Type | Default
  --- | --- | ---
  query | QString |
  language | Soprano.Query.QueryLanguage |
  userQueryLanguage | QString | QString()

  Execute the given query over the Model.

  This is a const read-only method. As such Model implementations should not support SPARQL extensions such as INSERT or UPDATE through this method. A future version of %Soprano will provide an additional API for queries that change the Model.

  query - The query to evaluate.

  language - The %query language used to encode query.

  userQueryLanguage - If language equals Query.QueryLanguageUser userQueryLanguage defines the language to use.

  Returns An iterator over all results matching the query, on error an invalid iterator is returned.

- isEmpty ( )

  returns bool
  pure virtual

  Returns true if the Model doesn't contains any Statement.

- listContexts ( )

  returns Soprano.NodeIterator
  pure virtual

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

  Returns An iterator over context Nodes, on error an invalid iterator is returned.

- listStatements (partial)

  returns Soprano.StatementIterator
  pure virtual

  Argument | Type | Default
  --- | --- | ---
  partial | Soprano.Statement |

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

  partial - The partial Statement to match.

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

- listStatements (subject, predicate, object, context)

  returns Soprano.StatementIterator

  Argument | Type | Default
  --- | --- | ---
  subject | Soprano.Node |
  predicate | Soprano.Node |
  object | Soprano.Node |
  context | Soprano.Node | Soprano.Node()

  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.

- listStatements ( )

  returns Soprano.StatementIterator

  Returns An iterator for all statements in the model, on error an invalid iterator is returned.

- listStatementsInContext (context)

  returns Soprano.StatementIterator

  Argument | Type | Default
  --- | --- | ---
  context | Soprano.Node |

  Convenience method which lists all statements in context.

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

- removeAllStatements (statement)

  returns Soprano.Error.ErrorCode
  pure virtual

  Argument | Type | Default
  --- | --- | ---
  statement | Soprano.Statement |

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

  statement - A possible partially defined statement that serves as a filter for all statements that should be removed.

- removeAllStatements (subject, predicate, object, context)

  returns Soprano.Error.ErrorCode

  Argument | Type | Default
  --- | --- | ---
  subject | Soprano.Node |
  predicate | Soprano.Node |
  object | Soprano.Node |
  context | Soprano.Node | Soprano.Node()

  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.

- removeAllStatements ( )

  returns Soprano.Error.ErrorCode

  Convenience method that clear the Model of all statements

- removeContext (a0)

  returns Soprano.Error.ErrorCode

  Argument | Type | Default
  --- | --- | ---
  a0 | Soprano.Node |

  Convenience method that removes all statements in the context.

- removeStatement (statement)

  returns Soprano.Error.ErrorCode
  pure virtual

  Argument | Type | Default
  --- | --- | ---
  statement | Soprano.Statement |

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

  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.

- removeStatement (subject, predicate, object, context)

  returns Soprano.Error.ErrorCode

  Argument | Type | Default
  --- | --- | ---
  subject | Soprano.Node |
  predicate | Soprano.Node |
  object | Soprano.Node |
  context | Soprano.Node | Soprano.Node()

- removeStatements (statements)

  returns Soprano.Error.ErrorCode

  Argument | Type | Default
  --- | --- | ---
  statements | QList<Soprano::Statement> |

  Convenience method which removes all %statements in statements.

- statementAdded (statement)

  returns Nothing
  SIGNAL ("statementAdded (const Statement&)")

  Argument | Type | Default
  --- | --- | ---
  statement | Soprano.Statement |

  Notification signal for new statements. Model implementations should emit this signal for each newly added statement.

- statementCount ( )

  returns int
  pure virtual

  The number of statements stored in this Model. Returns The size of the Model, or -1 on error.

- statementRemoved (statement)

  returns Nothing
  SIGNAL ("statementRemoved (const Statement&)")

  Argument | Type | Default
  --- | --- | ---
  statement | Soprano.Statement |

  Notification signal for removed statements. Model implementations should emit this signal for each removed statement.

  Backends may choose not to emit this signal for each removed statement but only for a statement pattern (i.e. an invalid statement as used in removeAllStatements()) to prevent massive performance loss.

- statementsAdded ( )

  returns Nothing
  SIGNAL ("statementsAdded ()")

  Emitted when new statements have been added to the model.

  Implementations of this interface have to emit this signal.

- statementsRemoved ( )

  returns Nothing
  SIGNAL ("statementsRemoved ()")

  Emitted when statements have been removed from the model.

  Implementations of this interface have to emit this signal.

- write (os)

  returns Soprano.Error.ErrorCode

  Argument | Type | Default
  --- | --- | ---
  os | QTextStream |

  Write all statements in this Model to os.

  Default implementation is based on Model.listStatements