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 
79 
84 
91 
95  void setEffect( const StatementPattern& );
96 
106  bool match( const Statement& statement ) const;
107 
118  void bindToStatement( const Statement& statement );
119 
125 
138  QString createSparqlQuery( bool bindVariables = false ) const;
139 
150  Statement bindEffect( const BindingSet& bindings ) const;
151 
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 
190 
191 #endif
Represents one set of bindings in the result of a select query.
Definition: bindingset.h:49
A rule used by the InferenceModel to generate inferenced statements.
Definition: inferencerule.h:50
QList< Statement > bindPreconditions(const BindingSet &bindings) const
QString createSparqlQuery(bool bindVariables=false) const
QList< StatementPattern > preconditions() const
void setEffect(const StatementPattern &)
bool match(const Statement &statement) const
void addPrecondition(const StatementPattern &)
Statement bindEffect(const BindingSet &bindings) const
Rule & operator=(const Rule &other)
Rule(const Rule &other)
void bindToStatement(const Statement &statement)
StatementPattern effect() const
Statement boundToStatement() const
Building block of an inference Rule.
SOPRANO_EXPORT QDebug operator<<(QDebug s, const Soprano::Node &)
A Statement instance represents one RDF quadruple.
Definition: statement.h:48
#define SOPRANO_EXPORT