<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Wolfgang Laun wrote:
<blockquote
 cite="mid:17de7ee80911100320n23c8ffaek75d9b9e64f1ca373@mail.gmail.com"
 type="cite">
  <pre wrap="">Leo's reply reads:
"In this scenario, aren't we moving logic that would be better
expressed in a declarative form (drl) to facts that are coded in
java?"

I don't think this is an issue. Extracting a fact's property derived
from one or more constraints being true as an additional fact isn't
doing what Leo is afraid of at all. The CEs resulting in the assertion
of this inferred relation are still there in the DRL.

I'd be more worried about the consequences of using this approach
heavily, in large scale Fact DBs. Adding, to N basic entity facts O(N)
additional facts that just express the truth value of a simple or
compound constraint is bound to have some impact on resource
requirements.

-*-

It is, however, very desirable to be able to write LHS in a more
structured way, not being forced to either repeat CEs or create
additional facts establishing secondary properties (such as isAdult).

However, the abstraction technique for expressions (and this includes
the Boolean expressions in LHS) has been invented a long time ago:
functions! If we were able to define a CE function (I'll use
"property" to distinguish this from plain DRL functions) like this

   &lt;result-type&gt; property &lt;name&gt;( &lt;fact-type&gt; &lt;name&gt; ){ &lt;expression&gt; }

and use this in LHS the way we are used to, e.g.

  boolean property adult(  Person p){ p.age &gt;= 18}

  rule x
  when
      Person( ..., adult == true )
  then ... end

It should also be possible to define property functions with multiple
fact arguments, or functions with additional parameters that aren't
fact types, e.g.

  double property weight( Thing t, double rho ){ t.volume*rho }

  rule y
     $m : Material( $rho : density )
    Thing( material == m, weight( $rho ) &gt; 1000 )

-W
  </pre>
</blockquote>
What you just described there is prolog "like" in nature, we have some
ideas around that. My BRF talk last week showed some ideas on how we
can integrate POSL. The are upsides and downsides to fact inferrence
and query based inferrence - hopefully we can provide both worlds :)<br>
<br>
Mark<br>
<blockquote
 cite="mid:17de7ee80911100320n23c8ffaek75d9b9e64f1ca373@mail.gmail.com"
 type="cite">
  <pre wrap="">

On Tue, Nov 10, 2009 at 11:13 AM, Leonardo Gomes
<a class="moz-txt-link-rfc2396E" href="mailto:leonardo.f.gomes@gmail.com">&lt;leonardo.f.gomes@gmail.com&gt;</a> wrote:
  </pre>
  <blockquote type="cite">
    <pre wrap="">I think I missed something on that post. Just posted a reply.

Cheers,
Leo.

On Tue, Nov 10, 2009 at 3:05 AM, Mark Proctor <a class="moz-txt-link-rfc2396E" href="mailto:mproctor@codehaus.org">&lt;mproctor@codehaus.org&gt;</a> wrote:
    </pre>
    <blockquote type="cite">
      <pre wrap="">Just published this, where I'm trying to explain good rule design in
terms more familiar to software developers.
<a class="moz-txt-link-freetext" href="http://blog.athico.com/2009/11/what-is-inference-and-how-does-it.html">http://blog.athico.com/2009/11/what-is-inference-and-how-does-it.html</a>

Let me know what you think, and hopefully people have other ideas they
can add back in.

Mark

_______________________________________________
rules-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a>

      </pre>
    </blockquote>
    <pre wrap="">_______________________________________________
rules-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a>

    </pre>
  </blockquote>
  <pre wrap=""><!---->_______________________________________________
rules-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a>


  </pre>
</blockquote>
<br>
</body>
</html>