00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef SOPRANO_NODE_H
00024 #define SOPRANO_NODE_H
00025
00026 #include <QtCore/QUrl>
00027 #include <QtCore/QSharedDataPointer>
00028 #include <QtCore/QTextStream>
00029
00030 #include "soprano_export.h"
00031 #include "literalvalue.h"
00032
00033 namespace Soprano
00034 {
00042 class SOPRANO_EXPORT Node
00043 {
00044 public:
00045 enum Type {
00046 EmptyNode = 0,
00047 ResourceNode = 1,
00048 LiteralNode = 2,
00049 BlankNode = 3
00050 };
00051
00062 Node();
00063
00064
00065
00074 Node( const QUrl &uri );
00075
00083 explicit Node( const QString& id );
00084
00094 Node( const LiteralValue& value,
00095 const QString& language = QString() );
00096
00097 Node( const Node &other );
00098
00099 ~Node();
00101
00106 Node& operator=( const Node& other );
00107
00111 Node& operator=( const QUrl& resource );
00112
00113 Node& operator=( const LiteralValue& literal );
00114
00115 bool operator==( const Node& other ) const;
00116 bool operator!=( const Node& other ) const;
00117
00118 bool operator==( const QUrl& other ) const;
00119 bool operator==( const LiteralValue& other ) const;
00120
00128 bool matches( const Node& other ) const;
00130
00138 Type type() const;
00139
00143 bool isEmpty() const;
00144
00148 bool isValid() const ;
00149
00153 bool isLiteral() const;
00154
00158 bool isResource() const;
00159
00163 bool isBlank() const;
00165
00174 QUrl uri() const;
00176
00186 QString identifier() const;
00188
00197 LiteralValue literal() const;
00198
00204 QUrl dataType() const;
00205
00214 QString language() const;
00216
00218
00221 QString toString() const;
00223
00231 static Node createEmptyNode();
00232
00243 static Node createResourceNode( const QUrl& uri );
00244
00259 static Node createBlankNode( const QString& id );
00260
00273 static Node createLiteralNode( const LiteralValue& value, const QString& language );
00274
00275 private:
00276 class NodeData;
00277 class ResourceNodeData;
00278 class BNodeData;
00279 class LiteralNodeData;
00280 QSharedDataPointer<NodeData> d;
00281 };
00282 }
00283
00284 SOPRANO_EXPORT QDebug operator<<( QDebug s, const Soprano::Node& );
00285
00290 SOPRANO_EXPORT QTextStream& operator<<( QTextStream& s, const Soprano::Node& );
00291
00292 #endif // SOPRANO_NODE_H