<div dir="ltr">Sorry, send the same mail again, please comments at here, the other mail lack title.</div><div class="gmail_extra"><br><div class="gmail_quote">2015-08-14 11:03 GMT+08:00 Rui Chen <span dir="ltr"><<a href="mailto:chenrui.momo@gmail.com" target="_blank">chenrui.momo@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><span style="font-size:14px">Hi folks:</span><div style="font-size:14px"><br></div><div style="font-size:14px"> I face a problem when I insert a rule into Congress. I want to find out all of the volumes that are not available status, so I draft a rule like this:</div><div style="font-size:14px"><br></div><div style="font-size:14px"> error(id) :- cinder:volumes(id=id), not cinder:volumes(id=id, status="available")</div><div style="font-size:14px"><br></div><div style="font-size:14px"> But when I create the rule, a error is raised:</div><div style="font-size:14px"><br></div><div style="font-size:14px"><div>(openstack) congress policy rule create chenrui_p "error(id) :- cinder:volumes(id=id),not cinder:volumes(id=id, status=\"available\")"</div><div>ERROR: openstack Syntax error for rule::Errors: Could not reorder rule error(id) :- cinder:volumes(id, _x_0_1, _x_0_2, _x_0_3, _x_0_4, _x_0_5, _x_0_6, _x_0_7, _x_0_8), not cinder:volumes(id, _x_1_1, _x_1_2, "available", _x_1_4, _x_1_5, _x_1_6, _x_1_7, _x_1_8). Unsafe lits: not cinder:volumes(id, _x_1_1, _x_1_2, "available", _x_1_4, _x_1_5, _x_1_6, _x_1_7, _x_1_8) (vars set(['_x_1_2', '_x_1_1', '_x_1_6', '_x_1_7', '_x_1_4', '_x_1_5', '_x_1_8'])) (HTTP 400) (Request-ID: req-1f4432d6-f869-472b-aa7d-4cf78dd96fa1)</div></div><div style="font-size:14px"><br></div><div style="font-size:14px"> I check the Congress policy docs [1], looks like that the rule don't break any syntax restrictions.</div><div style="font-size:14px"><br></div><div style="font-size:14px"> If I modify the rule like this, it works:</div><div style="font-size:14px"><br></div><div style="font-size:14px"><div>(openstack) congress policy rule create chenrui_p "error(x) :- cinder:volumes(x, _x_0_1, _x_0_2, _x_0_3, _x_0_4, _x_0_5, _x_0_6, _x_0_7, _x_0_8),not cinder:volumes(x, _x_0_1, _x_0_2, \"available\",_x_0_4, _x_0_5, _x_0_6, _x_0_7, _x_0_8)"</div><div>+---------+------------------------------------------------------------------------------------------------+</div><div>| Field | Value |</div><div>+---------+------------------------------------------------------------------------------------------------+</div><div>| comment | None |</div><div>| id | ad121e09-ba0a-45d6-bd18-487d975d5bf5 |</div><div>| name | None |</div><div>| rule | error(x) :- |</div><div>| | cinder:volumes(x, _x_0_1, _x_0_2, _x_0_3, _x_0_4, _x_0_5, _x_0_6, _x_0_7, _x_0_8), |</div><div>| | not cinder:volumes(x, _x_0_1, _x_0_2, "available", _x_0_4, _x_0_5, _x_0_6, _x_0_7, _x_0_8) |</div><div>+---------+------------------------------------------------------------------------------------------------+</div></div><div style="font-size:14px"><br></div><div style="font-size:14px"> I'm not sure this is a bug or I miss something from docs, so I need some feedback from mail list.</div><div style="font-size:14px">Feel free to discuss about it.</div><div style="font-size:14px"><br></div><div style="font-size:14px"><br></div><div style="font-size:14px">[1]: <a href="http://congress.readthedocs.org/en/latest/policy.html#datalog-syntax-restrictions" target="_blank">http://congress.readthedocs.org/en/latest/policy.html#datalog-syntax-restrictions</a></div><div style="font-size:14px"><br></div><div style="font-size:14px"><br></div><div style="font-size:14px">Best Regards.</div></div>
</blockquote></div><br></div>