Ejemplo n.º 1
0
 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
Ejemplo n.º 2
0
 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
Ejemplo n.º 3
0
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)
Ejemplo n.º 4
0
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)
Ejemplo n.º 5
0
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)
Ejemplo n.º 6
0
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)