ML-KULeuven / problog

ProbLog is a Probabilistic Logic Programming Language for logic programs with probabilities.
https://dtai.cs.kuleuven.be/problog/
298 stars 34 forks source link

Question: how to define complex Python predicate #28

Closed XVilka closed 4 years ago

XVilka commented 4 years ago

So the predicate will have functors as the arguments? Something like

predicate1(functor1(Arg1, Arg2, Arg3), functor2(Arg4, Arg5, Arg6), Arg7, Out).

How it would look from the Python side with @problog_export decorator?

anton3s commented 4 years ago

They will be exposed in Python as Term objects. You can use the term specifier in the problog_export decorator.

@problog_export("+term", "+term", "+term", "-term")
def predicate1(a1, a2, a3):
    print(a1.functor, a1.args)
XVilka commented 4 years ago

Would be beneficial to add this in the documentation, I think.

VincentDerk commented 4 years ago

There is some documentation on this here: Calling Python From ProbLog

XVilka commented 4 years ago

Ok. Thanks! I think can be closed then.