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

/tmp/buildd/soprano-2.5.0.e5.20100903.1159897/soprano/graph.h

Go to the documentation of this file.
00001 /*
00002  * This file is part of Soprano Project.
00003  *
00004  * Copyright (C) 2009 Sebastian Trueg <trueg@kde.org>
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Library General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2 of the License, or (at your option) any later version.
00010  *
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Library General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Library General Public License
00017  * along with this library; see the file COPYING.LIB.  If not, write to
00018  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00019  * Boston, MA 02110-1301, USA.
00020  */
00021 
00022 #ifndef SOPRANO_GRAPH_H
00023 #define SOPRANO_GRAPH_H
00024 
00025 #include <QtCore/QList>
00026 #include <QtCore/QSharedDataPointer>
00027 
00028 #include "soprano_export.h"
00029 #include "error.h"
00030 #include "sopranotypes.h"
00031 #include "node.h"
00032 #include "statement.h"
00033 
00034 
00035 namespace Soprano
00036 {
00037     class StatementIterator;
00038     class NodeIterator;
00039 
00059     class SOPRANO_EXPORT Graph
00060     {
00061     public:
00065         Graph();
00066 
00070         Graph( const Graph& );
00071 
00077         Graph( const QList<Statement>& );
00078 
00082         ~Graph();
00083 
00085 
00090         void addStatement( const Statement& statement );
00091 
00095         void addStatement( const Node& subject, const Node& predicate, const Node& object, const Node& context = Node() );
00096 
00100         void addStatements( const QList<Statement>& statements );
00102 
00104 
00112         void removeStatement( const Statement& statement );
00113 
00117         void removeStatement( const Node& subject, const Node& predicate, const Node& object, const Node& context = Node() );
00118 
00126         void removeAllStatements( const Statement& statement = Statement() );
00127 
00136         void removeAllStatements( const Node& subject, const Node& predicate, const Node& object, const Node& context = Node() );
00137 
00141         void removeStatements( const QList<Statement>& statements );
00142 
00146         void removeContext( const Node& );
00148 
00149 
00151 
00159         StatementIterator listStatements( const Statement& partial = Statement() ) const;
00160 
00171         StatementIterator listStatements( const Node& subject, const Node& predicate, const Node& object, const Node& context = Node() ) const;
00172 
00178         StatementIterator listStatementsInContext( const Node& context ) const;
00179 
00185         NodeIterator listContexts() const;
00187 
00188 
00190 
00199         bool containsAnyStatement( const Statement& statement ) const;
00200 
00209         bool containsAnyStatement( const Node& subject, const Node& predicate, const Node& object, const Node& context = Node() ) const;
00210 
00221         bool containsStatement( const Statement& statement ) const;
00222 
00226         bool containsStatement( const Node& subject, const Node& predicate, const Node& object, const Node& context = Node() ) const;
00227 
00231         bool containsContext( const Node& context ) const;
00232 
00236         bool isEmpty() const;
00237 
00242         int statementCount() const;
00244 
00246 
00249         QList<Statement> toList() const;
00251 
00259         Graph& operator=( const Graph& g );
00260 
00264         Graph& operator=( const QList<Statement>& statements );
00265 
00269         Graph operator+( const Graph& g ) const;
00270 
00274         Graph operator+( const Statement& s ) const;
00275 
00280         Graph& operator+=( const Graph& g );
00281 
00286         Graph& operator+=( const Statement& s );
00287 
00292         Graph operator-( const Graph& ) const;
00293 
00298         Graph operator-( const Statement& s ) const;
00299 
00304         Graph& operator-=( const Graph& g );
00305 
00310         Graph& operator-=( const Statement& s );
00311 
00315         Graph& operator<<( const Graph& );
00316 
00320         Graph& operator<<( const Statement& );
00321 
00328         bool operator==( const Graph& g ) const;
00329 
00336         bool operator!=( const Graph& g ) const;
00338 
00339     private:
00340         class Private;
00341         QSharedDataPointer<Private> d;
00342     };
00343 }
00344 
00345 #endif

Generated on Fri Sep 3 2010 10:43:55 for Soprano by  doxygen 1.7.1