Soprano  2.9.3
Related Functions | List of all members
Soprano::Statement Class Reference

A Statement instance represents one RDF quadruple. More...

#include <Soprano/Statement>

Public Member Functions

 Statement ()
 
 Statement (const Node &subject, const Node &predicate, const Node &object, const Node &context=Node())
 
 Statement (const Statement &other)
 
virtual ~Statement ()
 
Statementoperator= (const Statement &other)
 
bool operator== (const Statement &other) const
 
bool operator!= (const Statement &other) const
 
bool matches (const Statement &other) const
 
bool isValid () const
 
Node subject () const
 
Node predicate () const
 
Node object () const
 
Node context () const
 
void setSubject (const Node &subject)
 
void setPredicate (const Node &predicate)
 
void setObject (const Node &object)
 
void setContext (const Node &context)
 

Related Functions

(Note that these are not member functions.)

SOPRANO_EXPORT uint qHash (const Statement &s)
 
SOPRANO_EXPORT QDebug operator<< (QDebug s, const Soprano::Statement &)
 
SOPRANO_EXPORT QTextStreamoperator<< (QTextStream &s, const Soprano::Statement &)
 

Detailed Description

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 danie.nosp@m.le.g.nosp@m.aldi@.nosp@m.gmai.nosp@m.l.com
Sebastian Trueg trueg.nosp@m.@kde.nosp@m..org

Definition at line 47 of file statement.h.

Constructor & Destructor Documentation

Soprano::Statement::Statement ( )

Default Constructor, build an empty (invalid) Statement.

Soprano::Statement::Statement ( const Node subject,
const Node predicate,
const Node object,
const Node context = Node() 
)

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

Parameters
subjectThe subject (cannot be of type Node::LiteralNode)
predicateThe predicate (has to be of type Node::ResourceNode or Node::EmptyNode)
objectThe object can be of either Node type.
contextThe context node (has to be of type Node::ResourceNode or Node::EmptyNode)
Soprano::Statement::Statement ( const Statement other)

Default Constructor, build an empty (invalid) Statement.

virtual Soprano::Statement::~Statement ( )
virtual

Default Constructor, build an empty (invalid) Statement.

Member Function Documentation

Statement& Soprano::Statement::operator= ( const Statement other)

Default Constructor, build an empty (invalid) Statement.

bool Soprano::Statement::operator== ( const Statement other) const

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

Be aware that the following is NOT always true since only other is treated a a wildcard:

// NOT always true:
a.matches(b) == b.matches(a)
Returns
true if this statement matches other, false if not.
See Also
Node::matches()
bool Soprano::Statement::operator!= ( const Statement other) const

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

Be aware that the following is NOT always true since only other is treated a a wildcard:

// NOT always true:
a.matches(b) == b.matches(a)
Returns
true if this statement matches other, false if not.
See Also
Node::matches()
bool Soprano::Statement::matches ( const Statement other) const

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

Be aware that the following is NOT always true since only other is treated a a wildcard:

// NOT always true:
a.matches(b) == b.matches(a)
Returns
true if this statement matches other, false if not.
See Also
Node::matches()
bool Soprano::Statement::isValid ( ) const

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
Node Soprano::Statement::subject ( ) const
Returns
The subject.
Node Soprano::Statement::predicate ( ) const
Returns
The predicate.
Node Soprano::Statement::object ( ) const
Returns
The object.
Node Soprano::Statement::context ( ) const
Returns
The Context node.
void Soprano::Statement::setSubject ( const Node subject)

Change the Statement subject.

Parameters
subjectThe new subject.
void Soprano::Statement::setPredicate ( const Node predicate)

Change the Statement predicate.

Parameters
predicateThe new predicate.
void Soprano::Statement::setObject ( const Node object)

Change the Statement object.

Parameters
objectThe new object.
void Soprano::Statement::setContext ( const Node context)

Change the Statement context.

Parameters
contextThe new Context.

Friends And Related Function Documentation

SOPRANO_EXPORT uint qHash ( const Statement s)
related
SOPRANO_EXPORT QDebug operator<< ( QDebug  s,
const Soprano::Statement  
)
related
SOPRANO_EXPORT QTextStream & operator<< ( QTextStream s,
const Soprano::Statement  
)
related

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