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 {
00055 class SOPRANO_EXPORT Node
00056 {
00057 public:
00058 enum Type {
00059 EmptyNode = 0,
00060 ResourceNode = 1,
00061 LiteralNode = 2,
00062 BlankNode = 3
00063 };
00064
00075 Node();
00076
00077
00078
00087 Node( const QUrl &uri );
00088
00096 explicit Node( const QString& id );
00097
00107 Node( const LiteralValue& value,
00108 const QString& language = QString() );
00109
00110 Node( const Node &other );
00111
00112 ~Node();
00114
00119 Node& operator=( const Node& other );
00120
00124 Node& operator=( const QUrl& resource );
00125
00126 Node& operator=( const LiteralValue& literal );
00127
00128 bool operator==( const Node& other ) const;
00129 bool operator!=( const Node& other ) const;
00130
00131 bool operator==( const QUrl& other ) const;
00132 bool operator==( const LiteralValue& other ) const;
00133
00141 bool matches( const Node& other ) const;
00143
00151 Type type() const;
00152
00156 bool isEmpty() const;
00157
00161 bool isValid() const ;
00162
00166 bool isLiteral() const;
00167
00171 bool isResource() const;
00172
00176 bool isBlank() const;
00178
00187 QUrl uri() const;
00189
00199 QString identifier() const;
00201
00210 LiteralValue literal() const;
00211
00217 QUrl dataType() const;
00218
00227 QString language() const;
00229
00231
00238 QString toString() const;
00240
00248 static Node createEmptyNode();
00249
00260 static Node createResourceNode( const QUrl& uri );
00261
00276 static Node createBlankNode( const QString& id );
00277
00290 static Node createLiteralNode( const LiteralValue& value, const QString& language );
00291
00292 private:
00293 class NodeData;
00294 class ResourceNodeData;
00295 class BNodeData;
00296 class LiteralNodeData;
00297 QSharedDataPointer<NodeData> d;
00298 };
00299 }
00300
00301 SOPRANO_EXPORT QDebug operator<<( QDebug s, const Soprano::Node& );
00302
00307 SOPRANO_EXPORT QTextStream& operator<<( QTextStream& s, const Soprano::Node& );
00308
00309 #endif // SOPRANO_NODE_H