6 #include <boost/python/suite/indexing/vector_indexing_suite.hpp> 
    7 #include "knowrob/semweb/GraphTerm.h" 
    8 #include "knowrob/integration/python/utils.h" 
    9 #include "knowrob/semweb/GraphSequence.h" 
   10 #include "knowrob/semweb/GraphUnion.h" 
   11 #include "knowrob/semweb/GraphPattern.h" 
   12 #include "knowrob/integration/python/converter/vector.h" 
   13 #include "knowrob/semweb/GraphBuiltin.h" 
   19         switch (
term->termType()) {
 
   21                 auto pattern = std::static_pointer_cast<GraphPattern>(
term);
 
   24                 if (orig != substituted) {
 
   25                     return std::make_shared<GraphPattern>(substituted);
 
   30                 auto builtin = std::static_pointer_cast<GraphBuiltin>(
term);
 
   31                 auto args = builtin->arguments();
 
   32                 std::vector<TermPtr> newArgs;
 
   33                 for (
const auto &arg: args) {
 
   36                 return std::make_shared<GraphBuiltin>(builtin->builtinType(),
 
   42                 auto sequence = std::static_pointer_cast<GraphSequence>(
term);
 
   43                 std::vector<std::shared_ptr<GraphTerm>> newTerms;
 
   44                 for (
const auto &subTerm: sequence->terms()) {
 
   47                 return std::make_shared<GraphSequence>(newTerms);
 
   50                 auto unionTerm = std::static_pointer_cast<GraphUnion>(
term);
 
   51                 std::vector<std::shared_ptr<GraphTerm>> newTerms;
 
   52                 for (
const auto &subTerm: unionTerm->terms()) {
 
   55                 return std::make_shared<GraphUnion>(newTerms);
 
   61     std::shared_ptr<GraphTerm> 
operator&(
const std::shared_ptr<GraphTerm> &a, 
const std::shared_ptr<GraphTerm> &b) {
 
   63             auto sequence = std::static_pointer_cast<GraphSequence>(a);
 
   64             auto terms = sequence->terms();
 
   66             return std::make_shared<GraphSequence>(terms);
 
   68             return std::make_shared<GraphSequence>(std::vector<std::shared_ptr<GraphTerm>>{a, b});
 
   72     std::shared_ptr<GraphTerm> 
operator|(
const std::shared_ptr<GraphTerm> &a, 
const std::shared_ptr<GraphTerm> &b) {
 
   74             auto unionTerm = std::static_pointer_cast<GraphUnion>(a);
 
   75             auto terms = unionTerm->terms();
 
   77             return std::make_shared<GraphUnion>(terms);
 
   79             return std::make_shared<GraphUnion>(std::vector<std::shared_ptr<GraphTerm>>{a, b});
 
   93         enum_<GraphTermType>(
"GraphTermType")
 
  100         class_<GraphTerm, std::shared_ptr<GraphTerm>, boost::noncopyable>
 
  101                 (
"GraphTerm", no_init)
 
  106         class_<GraphPattern, bases<GraphTerm>, std::shared_ptr<GraphPattern>, boost::noncopyable>
 
  107                 (
"GraphPattern", init<TriplePatternPtr>())
 
  108                 .def(init<const TermPtr &, const TermPtr &, const TermPtr &>())
 
  117         typedef std::vector<std::shared_ptr<GraphTerm>> GraphTermList;
 
  119         boost::python::class_<GraphTermList>(
"GraphTermList").def(
 
  120                 boost::python::vector_indexing_suite<GraphTermList, true>());
 
const auto & value() const
GraphTermRule & pattern()
void createType< GraphUnion >()
std::shared_ptr< GraphTerm > applyBindings_graph(const std::shared_ptr< GraphTerm > &term, const Bindings &bindings)
void createType< GraphTerm >()
void createType< GraphBuiltin >()
void createType< GraphSequence >()
FormulaPtr operator|(const FormulaPtr &phi, const FormulaPtr &psi)
FirstOrderLiteralPtr applyBindings(const FirstOrderLiteralPtr &lit, const Bindings &bindings)
FormulaPtr operator&(const FormulaPtr &phi, const FormulaPtr &psi)