コード例 #1
0
ファイル: pyDatalog.py プロジェクト: jean/pydatalog
 def _getattr(self, attribute):
     """ responds to instance.method by asking datalog engine """
     if not attribute == "__iter__" and not attribute.startswith("_sa_"):
         predicate_name = "%s.%s[1]==" % (self.__class__.__name__, attribute)
         literal = Literal.make(predicate_name, (self, Symbol("X")))
         result = literal.lua.ask(False)
         return result[0][-1] if result else None
     raise AttributeError
コード例 #2
0
ファイル: pyDatalog.py プロジェクト: colinsongf/pydatalog
 def _getattr(self, attribute):
     """ responds to instance.method by asking datalog engine """
     if not attribute == '__iter__' and not attribute.startswith(
             '_sa_'):
         predicate_name = "%s.%s[1]==" % (self.__class__.__name__,
                                          attribute)
         literal = Literal.make(predicate_name, (self, Symbol("X")))
         result = literal.lua.ask(False)
         return result[0][-1] if result else None
     raise AttributeError
コード例 #3
0
ファイル: pyDatalog.py プロジェクト: jean/pydatalog
def assert_fact(predicate_name, *args):
    """ assert predicate_name(args) """
    literal = Literal.make(predicate_name, [pyParser.Expression._for(arg) for arg in args])
    _assert_fact(literal)
コード例 #4
0
ファイル: pyDatalog.py プロジェクト: jean/pydatalog
def retract_fact(predicate_name, *args):
    """ retracts predicate_name(args) """
    literal = Literal.make(predicate_name, [pyParser.Expression._for(arg) for arg in args])
    _retract_fact(literal)
コード例 #5
0
ファイル: pyDatalog.py プロジェクト: colinsongf/pydatalog
def assert_fact(predicate_name, *args):
    """ assert predicate_name(args) """
    literal = Literal.make(predicate_name,
                           [pyParser.Expression._for(arg) for arg in args])
    _assert_fact(literal)
コード例 #6
0
ファイル: pyDatalog.py プロジェクト: colinsongf/pydatalog
def retract_fact(predicate_name, *args):
    """ retracts predicate_name(args) """
    literal = Literal.make(predicate_name,
                           [pyParser.Expression._for(arg) for arg in args])
    _retract_fact(literal)