Soprano  2.9.2
sparqlmodel.h
Go to the documentation of this file.
1 /*
2  * This file is part of Soprano Project.
3  *
4  * Copyright (C) 2007 Rajeev J Sebastian <rajeev.sebastian@gmail.com>
5  * Copyright (C) 2008-2009 Sebastian Trueg <trueg@kde.org>
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Library General Public
9  * License as published by the Free Software Foundation; either
10  * version 2 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Library General Public License for more details.
16  *
17  * You should have received a copy of the GNU Library General Public License
18  * along with this library; see the file COPYING.LIB. If not, write to
19  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20  * Boston, MA 02110-1301, USA.
21  */
22 
23 #ifndef _SOPRANO_SPARQL_MODEL_H_
24 #define _SOPRANO_SPARQL_MODEL_H_
25 
26 #include "model.h"
27 #include "soprano_export.h"
28 #include "asyncresult.h"
29 
30 
31 namespace Soprano {
32  namespace Client {
51  {
52  Q_OBJECT
53 
54  public:
66  SparqlModel( const QString& host = QString(),
67  quint16 port = 80,
68  const QString& user = QString(),
69  const QString& password = QString() );
70 
74  ~SparqlModel();
75 
77 
84  void setHost( const QString& host, quint16 port = 80 );
85 
93  void setUser( const QString& user, const QString& password = QString() );
94 
102  void setPath( const QString& path );
104 
106 
117  Error::ErrorCode addStatement( const Statement& statement );
118 
130  Error::ErrorCode removeStatement( const Statement& statement );
131 
145  Error::ErrorCode removeAllStatements( const Statement& statement );
147 
149 
152  Soprano::StatementIterator listStatements( const Statement& partial ) const;
153 
164  Soprano::Util::AsyncResult* listStatementsAsync( const Statement& statement ) const;
165 
177  Soprano::QueryResultIterator executeQuery( const QString& query,
179  const QString& userQueryLanguage = QString() ) const;
180 
181 
182 
196  Soprano::Util::AsyncResult* executeQueryAsync( const QString& query,
198  const QString& userQueryLanguage = QString() ) const;
199 
203  NodeIterator listContexts() const;
204 
215  Soprano::Util::AsyncResult* listContextsAsync() const;
216 
220  bool containsStatement( const Statement& statement ) const;
221 
225  bool containsAnyStatement( const Statement& statement ) const;
227 
229 
234  int statementCount() const;
235 
241  bool isEmpty() const;
243 
249  Node createBlankNode();
250 
251  using Model::addStatement;
254  using Model::listStatements;
257 
258  private Q_SLOTS:
259  void slotRequestFinished( int id, bool error, const QByteArray& data );
260 
261  private:
262  class Private;
263  Private* const d;
264  };
265  }
266 }
267 
268 #endif