• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

/tmp/buildd/soprano-2.4.64.e5.20100805.1159441/soprano/node.h

Go to the documentation of this file.
00001 /*
00002  * This file is part of Soprano Project.
00003  *
00004  * Copyright (C) 2006-2007 Daniele Galdi <daniele.galdi@gmail.com>
00005  * Copyright (C) 2007-2009 Sebastian Trueg <trueg@kde.org>
00006  *
00007  * This library is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Library General Public
00009  * License as published by the Free Software Foundation; either
00010  * version 2 of the License, or (at your option) any later version.
00011  *
00012  * This library is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Library General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Library General Public License
00018  * along with this library; see the file COPYING.LIB.  If not, write to
00019  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00020  * Boston, MA 02110-1301, USA.
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 #include "languagetag.h"
00033 #include "sopranomacros.h"
00034 
00035 namespace Soprano
00036 {
00053     class SOPRANO_EXPORT Node
00054     {
00055     public:
00056         enum Type {
00057             EmptyNode    = 0, 
00058             ResourceNode = 1, 
00059             LiteralNode  = 2, 
00060             BlankNode    = 3  
00061         };
00062 
00073         Node();
00074 
00075         // This constructor is non-explicit for a reason: it makes creating
00076         // Statements much much easier and more readable
00085         Node( const QUrl &uri );
00086 
00094         explicit Node( const QString& id );
00095 
00106         Node( const LiteralValue& value );
00107 
00120         SOPRANO_CONSTRUCTOR_DEPRECATED Node( const LiteralValue& value,
00121                                              const QString& language );
00122 
00126         Node( const Node &other );
00127 
00128         ~Node();
00130 
00135         Node& operator=( const Node& other );
00136 
00140         Node& operator=( const QUrl& resource );
00141 
00145         Node& operator=( const LiteralValue& literal );
00146 
00151         bool operator==( const Node& other ) const;
00152 
00157         bool operator!=( const Node& other ) const;
00158 
00164         bool operator==( const QUrl& uri ) const;
00165 
00171         bool operator==( const LiteralValue& other ) const;
00172 
00190         bool matches( const Node& other ) const;
00192 
00200         Type type() const;
00201 
00205         bool isEmpty() const;
00206 
00210         bool isValid() const ;
00211 
00215         bool isLiteral() const;
00216 
00220         bool isResource() const;
00221 
00225         bool isBlank() const;
00227 
00236         QUrl uri() const;
00238 
00248         QString identifier() const;
00250 
00259         LiteralValue literal() const;
00260 
00266         QUrl dataType() const;
00267 
00279         QString language() const;
00281 
00294         QString toString() const;
00295 
00314         QString toN3() const;
00316 
00324         static Node createEmptyNode();
00325 
00336         static Node createResourceNode( const QUrl& uri );
00337 
00352         static Node createBlankNode( const QString& id );
00353 
00367         static Node createLiteralNode( const LiteralValue& value );
00368 
00384         static SOPRANO_DEPRECATED Node createLiteralNode( const LiteralValue& value, const QString& language );
00385 
00401         static QString resourceToN3( const QUrl& resource );
00402 
00418         static QString blankToN3( const QString& blank );
00419 
00436         static QString literalToN3( const LiteralValue& literal );
00437 
00438     private:
00439         class NodeData;
00440         class ResourceNodeData;
00441         class BNodeData;
00442         class LiteralNodeData;
00443         QSharedDataPointer<NodeData> d;
00444     };
00445 
00449     SOPRANO_EXPORT uint qHash( const Node& node );
00450 }
00451 
00455 SOPRANO_EXPORT QDebug operator<<( QDebug s, const Soprano::Node& );
00456 
00465 SOPRANO_EXPORT QTextStream& operator<<( QTextStream& s, const Soprano::Node& );
00466 
00467 #if QT_VERSION < 0x040700
00468 SOPRANO_EXPORT uint qHash( const QUrl& url );
00469 #endif
00470 
00471 #endif // SOPRANO_NODE_H

Generated on Mon Aug 9 2010 08:31:09 for Soprano by  doxygen 1.7.1