Soprano  2.9.4
inferencerule.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_RULE_H_
23 #define _SOPRANO_INFERENCE_RULE_H_
24 
25 #include <QtCore/QSharedDataPointer>
26 #include <QtCore/QList>
27 
28 #include "statementpattern.h"
29 #include "statement.h"
30 #include "soprano_export.h"
31 
32 
33 namespace Soprano {
34 
35  class BindingSet;
36 
37  namespace Inference {
38 
50  {
51  public:
55  Rule();
56 
60  Rule( const Rule& other );
61 
65  ~Rule();
66 
70  Rule& operator=( const Rule& other );
71 
78  QList<StatementPattern> preconditions() const;
79 
83  void addPrecondition( const StatementPattern& );
84 
90  StatementPattern effect() const;
91 
95  void setEffect( const StatementPattern& );
96 
106  bool match( const Statement& statement ) const;
107 
118  void bindToStatement( const Statement& statement );
119 
124  Statement boundToStatement() const;
125 
138  QString createSparqlQuery( bool bindVariables = false ) const;
139 
150  Statement bindEffect( const BindingSet& bindings ) const;
151 
163  QList<Statement> bindPreconditions( const BindingSet& bindings ) const;
164 
173  bool isValid() const;
174 
175  private:
180  BindingSet mergeBindingStatement( const BindingSet& bindings ) const;
181  Statement bindStatementPattern( const StatementPattern& pattern, const BindingSet& bindings ) const;
182 
183  class Private;
185  };
186  }
187 }
188 
189 SOPRANO_EXPORT QDebug operator<<( QDebug s, const Soprano::Inference::Rule& );
190 
191 #endif
soprano_export.h
QSharedDataPointer< Private >
SOPRANO_EXPORT
#define SOPRANO_EXPORT
Definition: soprano_export.h:37
QList
Soprano::Inference::Rule
A rule used by the InferenceModel to generate inferenced statements.
Definition: inferencerule.h:49
Soprano::Node::operator<<
SOPRANO_EXPORT QDebug operator<<(QDebug s, const Soprano::Node &)
Soprano::Statement
A Statement instance represents one RDF quadruple.
Definition: statement.h:47
statement.h
Soprano
Definition: backend.h:35
Soprano::BindingSet
Represents one set of bindings in the result of a select query.
Definition: bindingset.h:48
statementpattern.h
Soprano::Inference::StatementPattern
Building block of an inference Rule.
Definition: statementpattern.h:52
QString