Soprano  2.8.0
/home/trueg/soprano/releases/test/soprano-2.8.0/client/sparql/sparqlmodel.h
Go to the documentation of this file.
00001 /*
00002  * This file is part of Soprano Project.
00003  *
00004  * Copyright (C) 2007 Rajeev J Sebastian <rajeev.sebastian@gmail.com>
00005  * Copyright (C) 2008-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_SPARQL_MODEL_H_
00024 #define _SOPRANO_SPARQL_MODEL_H_
00025 
00026 #include "model.h"
00027 #include "soprano_export.h"
00028 #include "asyncresult.h"
00029 
00030 
00031 namespace Soprano {
00032     namespace Client {
00050         class SOPRANO_CLIENT_EXPORT SparqlModel : public Soprano::Model
00051         {
00052             Q_OBJECT
00053 
00054         public:
00066             SparqlModel( const QString& host = QString(),
00067                          quint16 port = 80,
00068                          const QString& user = QString(),
00069                          const QString& password = QString() );
00070 
00074             ~SparqlModel();
00075 
00077 
00084             void setHost( const QString& host, quint16 port = 80 );
00085 
00093             void setUser( const QString& user, const QString& password = QString() );
00094 
00102             void setPath( const QString& path );
00104 
00106 
00117             Error::ErrorCode addStatement( const Statement& statement );
00118 
00130             Error::ErrorCode removeStatement( const Statement& statement );
00131 
00145             Error::ErrorCode removeAllStatements( const Statement& statement );
00147 
00149 
00152             Soprano::StatementIterator listStatements( const Statement& partial ) const;
00153 
00164             Soprano::Util::AsyncResult* listStatementsAsync( const Statement& statement ) const;
00165 
00177             Soprano::QueryResultIterator executeQuery( const QString& query,
00178                                                        Query::QueryLanguage language = Query::QueryLanguageSparql,
00179                                                        const QString& userQueryLanguage = QString() ) const;
00180 
00181 
00182 
00196             Soprano::Util::AsyncResult* executeQueryAsync( const QString& query,
00197                                                            Query::QueryLanguage language = Query::QueryLanguageSparql,
00198                                                            const QString& userQueryLanguage = QString() ) const;
00199 
00203             NodeIterator listContexts() const;
00204 
00215             Soprano::Util::AsyncResult* listContextsAsync() const;
00216 
00220             bool containsStatement( const Statement& statement ) const;
00221 
00225             bool containsAnyStatement( const Statement& statement ) const;
00227 
00229 
00234             int statementCount() const;
00235 
00241             bool isEmpty() const;
00243 
00249             Node createBlankNode();
00250 
00251             using Model::addStatement;
00252             using Model::removeStatement;
00253             using Model::removeAllStatements;
00254             using Model::listStatements;
00255             using Model::containsStatement;
00256             using Model::containsAnyStatement;
00257 
00258         private Q_SLOTS:
00259             void slotRequestFinished( int id, bool error, const QByteArray& data );
00260 
00261         private:
00262             class Private;
00263             Private* const d;
00264         };
00265     }
00266 }
00267 
00268 #endif