Jeangil
Jeangil

Reputation: 1

Pydatalog, Can't print right side of rules

Following my last post with no answer, and because I'm stuck by this (by the way I have other question =I don't know if Pydatalog conceptor,Mr Carbonnelle, is still answerring on this site ??) So it would be nice if someone can help, and I will try to be more clear:

See part of my code below:

from pyDatalog import pyDatalog
pyDatalog.create_terms('condition, predicate, yes, X')

+condition('a')
+condition('b')
+condition('c')
+condition('d')

predicate('p1')<=yes('a') & yes('b')
predicate('p2')<= yes('c') & yes('d')

problem : If I Know conclusion 'p1', How can I get/print 'a' and 'b' ? I don't know how to do that ? (print('p1') doesn't work at all!!) Thanks for help

Jeangil

Upvotes: 0

Views: 85

Answers (1)

Ulrich
Ulrich

Reputation: 329

there is no connection between your dataset and your prediction (as I do not see any logic in your conditions - they are just true statements / strings). I slightly modified your code to show the logic of a working example (hope this answers your questions or gives you a hint for a solution):

from pyDatalog import pyDatalog
pyDatalog.create_terms('condition, predicate, yes, X')

+condition('a', 1)
+condition('a', 2)
+condition('c', 3)
+condition('d', 4)

print(condition(X,1))
print(condition('a',X))

Upvotes: 1

Related Questions