forked from opencog/opencog
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restore some of the older code, python needs it
- Loading branch information
Showing
4 changed files
with
44 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,10 +5,13 @@ | |
* Copyright (c) 2008, 2014 Linas Vepstas <[email protected]> | ||
*/ | ||
|
||
#include <opencog/util/foreach.h> | ||
#include <opencog/atomspace/AtomSpace.h> | ||
#include <opencog/guile/SchemePrimitive.h> | ||
#include <opencog/guile/SchemeSmob.h> | ||
|
||
#include "BindLink.h" | ||
#include "PatternMatch.h" | ||
#include "PatternSCM.h" | ||
|
||
using namespace opencog; | ||
|
@@ -30,3 +33,30 @@ Handle PatternWrap::wrapper(Handle h) | |
return Handle::UNDEFINED; | ||
#endif | ||
} | ||
|
||
// ======================================================== | ||
|
||
PatternSCM::PatternSCM(void) | ||
{ | ||
// Run implication, assuming that the argument is a handle to | ||
// an BindLink containing variables and an ImplicationLink. | ||
_binders.push_back(new PatternWrap(bindlink, "cog-bind")); | ||
|
||
// Identical to do_bindlink above, except that it only returns the | ||
// first match. | ||
_binders.push_back(new PatternWrap(single_bindlink, "cog-bind-single")); | ||
|
||
// Run implication, assuming that the argument is a handle to | ||
// an BindLink containing variables and an ImplicationLink | ||
_binders.push_back(new PatternWrap(crisp_logic_bindlink, "cog-bind-crisp")); | ||
|
||
// Mystery function | ||
_binders.push_back(new PatternWrap(pln_bindlink, "cog-bind-pln")); | ||
} | ||
|
||
PatternSCM::~PatternSCM() | ||
{ | ||
foreach (PatternWrap* pw, _binders) | ||
delete pw; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,39 +5,23 @@ | |
* Copyright (c) 2008 Linas Vepstas <[email protected]> | ||
*/ | ||
|
||
#include "BindLink.h" | ||
#include "PatternMatch.h" | ||
#include "PatternSCM.h" | ||
#include "QueryModule.h" | ||
|
||
using namespace opencog; | ||
|
||
DECLARE_MODULE(QueryModule); | ||
|
||
QueryModule::QueryModule(CogServer& cs) : Module(cs) | ||
QueryModule::QueryModule(CogServer& cs) : Module(cs), _pat(NULL) | ||
{ | ||
} | ||
|
||
QueryModule::~QueryModule() | ||
{ | ||
foreach(PatternWrap *pw: _binders) | ||
delete pw; | ||
delete _pat; | ||
} | ||
|
||
void QueryModule::init(void) | ||
{ | ||
// Run implication, assuming that the argument is a handle to | ||
// an BindLink containing variables and an ImplicationLink. | ||
_binders.push_back(new PatternWrap(bindlink, "cog-bind")); | ||
|
||
// Identical to do_bindlink above, except that it only returns the | ||
// first match. | ||
_binders.push_back(new PatternWrap(single_bindlink, "cog-bind-single")); | ||
|
||
// Run implication, assuming that the argument is a handle to | ||
// an BindLink containing variables and an ImplicationLink | ||
_binders.push_back(new PatternWrap(crisp_logic_bindlink, "cog-bind-crisp")); | ||
|
||
// Mystery function | ||
_binders.push_back(new PatternWrap(pln_bindlink, "cog-bind-pln")); | ||
_pat = new PatternSCM(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters