# class Statement

###

Module | soprano
Namespace | Soprano
Class | Statement
Inherits |

\class Statement statement.h Soprano/Statement

A Statement instance represents one RDF quadruple.

In %Soprano statements are quadruples, i.e. in addition to the subject, predicate, and object nodes, they have a fourth node, the context. The context represents the named graph in which the statement is stored. If the context is an empty node the statement is stored in the default graph.

A Statement is valid if subject, predicate, and object are valid. Invalid statements can, however, be used in many methods such as Model.listStatements as wildwards.

See also Node

Author Daniele Galdi <daniele.galdi@gmail.com>
Sebastian Trueg <trueg@kde.org>

### methods

- Statement ( )

  returns ctor

  Default Constructor, build an empty (invalid) Statement.

- Statement (subject, predicate, object, context)

  returns ctor

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

  Build a Statement with the given subject, predicate and object.

  subject - The subject (cannot be of type Node.LiteralNode)

  predicate - The predicate (has to be of type Node.ResourceNode or Node.EmptyNode)

  object - The object can be of either Node type.

  context - The context node (has to be of type Node.ResourceNode or Node.EmptyNode)

- Statement (other)

  returns ctor

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

- context ( )

  returns Soprano.Node

  Returns The Context node.

- isValid ( )

  returns bool

  A Statement is valid if the subject is a resource or blank node, the predicate is a resource node, and the object is a valid node.

  Returns true if the Statement is valid, false otherwise

- matches (other)

  returns bool

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

  Match this statement against other. The only difference to operator== is that empty nodes are matched as wildcards, i.e. they match any other node.

  See also Node.matches()

  Returns true if this statement matches other, false if not.

- object ( )

  returns Soprano.Node

  Returns The object.

- operator != (other)

  returns bool

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

- operator == (other)

  returns bool

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

- predicate ( )

  returns Soprano.Node

  Returns The predicate.

- setContext (context)

  returns Nothing

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

  Change the Statement context.

  context - The new Context.

- setObject (object)

  returns Nothing

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

  Change the Statement object.

  object - The new object.

- setPredicate (predicate)

  returns Nothing

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

  Change the Statement predicate.

  predicate - The new predicate.

- setSubject (subject)

  returns Nothing

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

  Change the Statement subject.

  subject - The new subject.

- subject ( )

  returns Soprano.Node

  Returns The subject.