Soprano  2.9.4
inferencemodel.h
Go to the documentation of this file.
1 /*
2  * This file is part of Soprano Project.
3  *
4  * Copyright (C) 2007 Sebastian Trueg <trueg@kde.org>
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public License
17  * along with this library; see the file COPYING.LIB. If not, write to
18  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  * Boston, MA 02110-1301, USA.
20  */
21 
22 #ifndef _SOPRANO_INFERENCE_MODEL_H_
23 #define _SOPRANO_INFERENCE_MODEL_H_
24 
25 #include "filtermodel.h"
26 #include "soprano_export.h"
27 
28 class QUrl;
29 
30 namespace Soprano {
31 
32  class Statement;
33 
34  namespace Inference {
35 
36  class Rule;
37 
72  {
73  Q_OBJECT
74 
75  public:
76  InferenceModel( Model* parent );
77  ~InferenceModel();
78 
83  Error::ErrorCode addStatement( const Statement& );
84 
88  Error::ErrorCode removeStatement( const Statement& );
89 
93  Error::ErrorCode removeAllStatements( const Statement& );
94 
100  void addRule( const Rule& );
101 
107  void setRules( const QList<Rule>& rules );
108 
112 
113  public Q_SLOTS:
123  void performInference();
124 
130  void clearInference();
131 
146  void setCompressedSourceStatements( bool b );
147 
160  void setOptimizedQueriesEnabled( bool b );
161 
162  private:
171  int inferStatement( const Statement& statement, bool recurse = false );
172 
181  int inferRule( const Rule& rule, bool recurse );
182 
187  QList<Node> inferedGraphsForStatement( const Statement& statement ) const;
188 
193  QUrl storeUncompressedSourceStatement( const Statement& sourceStatement );
194 
195  class Private;
196  Private* const d;
197  };
198  }
199 }
200 
201 #endif
The Soprano Inference Model provides a simple forward chaining inference engine which uses the underl...
virtual Error::ErrorCode addStatement(const Statement &statement)
SOPRANO_EXPORT QUrl rule()
A Statement instance represents one RDF quadruple.
Definition: statement.h:47
virtual Error::ErrorCode removeStatement(const Statement &statement)
Error::ErrorCode removeAllStatements()
A FilterModel is a virtual model that wraps another Model.
Definition: filtermodel.h:48
A rule used by the InferenceModel to generate inferenced statements.
Definition: inferencerule.h:49
SOPRANO_EXPORT QUrl sourceStatement()
SOPRANO_EXPORT QUrl Statement()
#define SOPRANO_EXPORT
A Model is the central class in Soprano. It is a queryable collection of RDF quadruples, i.e statements.
Definition: model.h:94