-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #347 from singnet/senna-hotfix-4
[HOTFIX] Create empty implementation of pattern_matcher package
- Loading branch information
Showing
2 changed files
with
117 additions
and
0 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
from .pattern_matcher import * # noqa |
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 |
---|---|---|
@@ -0,0 +1,116 @@ | ||
from abc import ABC, abstractmethod | ||
from typing import Any, Dict, List, Optional | ||
|
||
from hyperon_das_atomdb import AtomDB | ||
|
||
|
||
class PatternMatchingAnswer: | ||
def __init__(self): | ||
pass | ||
|
||
|
||
class LogicalExpression(ABC): | ||
@abstractmethod | ||
def matched( | ||
self, | ||
db: AtomDB, | ||
answer: PatternMatchingAnswer, | ||
extra_parameters: Optional[Dict[str, Any]] = None, | ||
) -> bool: | ||
pass | ||
|
||
|
||
class Atom(LogicalExpression, ABC): | ||
def __init__(self, atom_type: str): | ||
pass | ||
|
||
@abstractmethod | ||
def get_handle(self, db: AtomDB) -> str: | ||
pass | ||
|
||
|
||
class Node(Atom): | ||
def __init__(self, node_type: str, node_name: str): | ||
pass | ||
|
||
def get_handle(self, db: AtomDB) -> str: | ||
return "" | ||
|
||
def matched( | ||
self, | ||
db: AtomDB, | ||
answer: PatternMatchingAnswer, | ||
extra_parameters: Optional[Dict[str, Any]] = None, | ||
) -> bool: | ||
return True | ||
|
||
|
||
class Link(Atom): | ||
def __init__(self, link_type: str, targets: List[Atom], ordered: bool): | ||
pass | ||
|
||
def get_handle(self, db: AtomDB) -> str: | ||
return "" | ||
|
||
def matched( | ||
self, | ||
db: AtomDB, | ||
answer: PatternMatchingAnswer, | ||
extra_parameters: Optional[Dict[str, Any]] = None, | ||
) -> bool: | ||
return True | ||
|
||
|
||
class Variable(Atom): | ||
def __init__(self, variable_name: str): | ||
pass | ||
|
||
def get_handle(self, db: AtomDB) -> str: | ||
return "" | ||
|
||
def matched( | ||
self, | ||
db: AtomDB, | ||
answer: PatternMatchingAnswer, | ||
extra_parameters: Optional[Dict[str, Any]] = None, | ||
) -> bool: | ||
return True | ||
|
||
|
||
class Not(LogicalExpression): | ||
def __init__(self, term: LogicalExpression): | ||
pass | ||
|
||
def matched( | ||
self, | ||
db: AtomDB, | ||
answer: PatternMatchingAnswer, | ||
extra_parameters: Optional[Dict[str, Any]] = None, | ||
) -> bool: | ||
return True | ||
|
||
|
||
class Or(LogicalExpression): | ||
def __init__(self, terms: List[LogicalExpression]): | ||
pass | ||
|
||
def matched( | ||
self, | ||
db: AtomDB, | ||
answer: PatternMatchingAnswer, | ||
extra_parameters: Optional[Dict[str, Any]] = None, | ||
) -> bool: | ||
return True | ||
|
||
|
||
class And(LogicalExpression): | ||
def __init__(self, terms: List[LogicalExpression]): | ||
pass | ||
|
||
def matched( | ||
self, | ||
db: AtomDB, | ||
answer: PatternMatchingAnswer, | ||
extra_parameters: Optional[Dict[str, Any]] = None, | ||
) -> bool: | ||
return True |