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

soprano

Soprano::Node

Soprano::Node Class Reference

#include <Soprano/Node>

List of all members.


Detailed Description

A Node represents one RDF resource.

Nodes are the cornerstone of RDF data in Soprano. Four Nodes form one Statement and a Model is essentially a set of Statements.

A Node can have one of four types: EmptyNode, ResourceNode, LiteralNode, and BlankNode. Resource nodes are identified through their URI (uri()), literal nodes have a LiteralValue (literal()) and an optional language string (language()), and blank nodes have a string identifier.

Empty nodes can be used as wildcards in methods such as Model::listStatements.

Warning:
Be aware that string literals in Soprano always have type xsd:string. There is no direct support for rdfs:Literal. Backend implementations should honour this restriction.
Author:
Daniele Galdi <daniele.galdi@gmail.com>
Sebastian Trueg <trueg@kde.org>

Definition at line 55 of file node.h.


Public Types

enum  Type { EmptyNode = 0, ResourceNode = 1, LiteralNode = 2, BlankNode = 3 }

Public Member Functions

Literal nodes
QUrl dataType () const
QString language () const
LiteralValue literal () const
Blank nodes
QString identifier () const
Type information
bool isBlank () const
bool isEmpty () const
bool isLiteral () const
bool isResource () const
bool isValid () const
Type type () const
Operators
bool matches (const Node &other) const
bool operator!= (const Node &other) const
Node & operator= (const LiteralValue &literal)
Node & operator= (const QUrl &resource)
Node & operator= (const Node &other)
bool operator== (const LiteralValue &other) const
bool operator== (const QUrl &other) const
bool operator== (const Node &other) const
Constructors
 Node (const Node &other)
 Node (const LiteralValue &value, const QString &language=QString())
 Node (const QString &id)
 Node (const QUrl &uri)
 Node ()
 ~Node ()
QString toString () const
Resource nodes
QUrl uri () const

Static Public Member Functions

static Node createBlankNode (const QString &id)
static Node createEmptyNode ()
static Node createLiteralNode (const LiteralValue &value, const QString &language)
static Node createResourceNode (const QUrl &uri)

Member Enumeration Documentation

enum Soprano::Node::Type

Enumerator:
EmptyNode  An empty node, can be used as a placeholder in commands like Model::listStatements.

ResourceNode  A resource node has a URI which can be accessed via uri().
LiteralNode  A literal node has a literal value and an optional language.

BlankNode  blank node has an identifier string

Definition at line 58 of file node.h.


Constructor & Destructor Documentation

Soprano::Node::Node (  ) 

Default costructor.

Creates an empty node.

See also:
createEmptyNode()

Soprano::Node::Node ( const QUrl &  uri  ) 

Creates a resource node.

Parameters:
uri The URI of the node. If empty the type will be ignored and an empty node will be created.
See also:
createResourceNode()

Soprano::Node::Node ( const QString &  id  )  [explicit]

Creates a blank node.

Parameters:
id An identifier for the blank node.
See also:
createBlankNode()

Soprano::Node::Node ( const LiteralValue &  value,
const QString &  language = QString() 
)

Creates a literal node.

Parameters:
value The value of a node. If empty the node will become an empty node.
language The language of the literal value.
See also:
createLiteralNode()

Soprano::Node::Node ( const Node &  other  ) 

Soprano::Node::~Node (  ) 


Member Function Documentation

static Node Soprano::Node::createBlankNode ( const QString &  id  )  [static]

Convenience method to create a blank node.

Using this method instead of the constructor may result in better readable code.

If you need to create a new blank node which is not used in the model yet and, thus, has a unique identifier see Model::createBlankNode().

Parameters:
id An identifier for the blank node.
Returns:
A blank node or an empty Node if the specified identifier was empty.

static Node Soprano::Node::createEmptyNode (  )  [static]

Convenience method to create an empty node.

Using this method instead of the default constructor may result in better readable code.

Returns:
An empty Node.

static Node Soprano::Node::createLiteralNode ( const LiteralValue &  value,
const QString &  language 
) [static]

Convenience method to create a literal node.

Using this method instead of the constructor may result in better readable code.

Parameters:
value The value of a node. If empty the node will become an empty node.
language The language of the literal value.
Returns:
A literal node or an empty node if the specified value was empty.

static Node Soprano::Node::createResourceNode ( const QUrl &  uri  )  [static]

Convenience method to create a resource node.

Using this method instead of the constructor may result in better readable code.

Parameters:
uri The URI of the node. If empty the type will be ignored and an empty node will be created.
Returns:
A resource Node or an empty Node if the specified URI is empty.

QUrl Soprano::Node::dataType (  )  const

Returns:
The datatype URI of a literal node, i.e.

the XML schema type or an empty value if the node is not a literal.

See also:
LiteralValue::dataTypeUri

QString Soprano::Node::identifier (  )  const

Retrieve a blank node's identifier.

Returns:
The node's identifier if it is a blank node, a null string otherwise.

bool Soprano::Node::isBlank (  )  const

Returns:
true if the Node is a Blank node (anonymous).

bool Soprano::Node::isEmpty (  )  const

Returns:
true if the Node is empty.

bool Soprano::Node::isLiteral (  )  const

Returns:
true if the Node is a Literal.

bool Soprano::Node::isResource (  )  const

Returns:
true if the Node is a Resource.

bool Soprano::Node::isValid (  )  const

Returns:
true if the Node is a Resource,Literal or Blank.

QString Soprano::Node::language (  )  const

Each literal value can have an associated language, thus each property can be stored for different languages.

An empty language refers to the default language.

Returns:
A string representing the language of the literal value or an empty string if the node is not a literal.

LiteralValue Soprano::Node::literal (  )  const

Returns:
The Literal value if the node is a Literal node.

An null QString otherwise.

bool Soprano::Node::matches ( const Node &  other  )  const

Match this node against other.

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

Returns:
true if this node matches other, false if not.

bool Soprano::Node::operator!= ( const Node &  other  )  const

Node& Soprano::Node::operator= ( const LiteralValue &  literal  ) 

Node& Soprano::Node::operator= ( const QUrl &  resource  ) 

Assigns resource to this node and makes it a ResourceNode.

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

bool Soprano::Node::operator== ( const LiteralValue &  other  )  const

bool Soprano::Node::operator== ( const QUrl &  other  )  const

bool Soprano::Node::operator== ( const Node &  other  )  const

QString Soprano::Node::toString (  )  const

Converts the Node to a string.

Returns:
A String representation of the Node.
See also:
LiteralValue::toString(), QUrl::toString()

Type Soprano::Node::type (  )  const

Returns:
The Node type.

QUrl Soprano::Node::uri (  )  const

Returns:
The URI if the node is a Resource node.

An null QUrl otherwise.


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

soprano

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

API Reference

Skip menu "API Reference"
  • akonadi
  • Decibel
  • eigen
  • Eigen2
  • kdewin32
  • Phonon
  •     Backend
  • qca
  • qimageblitz
  • soprano
  • strigi
  •     searchclient
  •     streamanalyzer
  •     streams
Generated for API Reference by doxygen 1.5.4
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