Hi Ernest,

From: Ernest Friedman-Hill <[EMAIL PROTECTED]>
> As usual, our friend Osvaldo is making me think in new
> directions. We've had some conversations lately about how Rete and

Well it works both ways!  :)  And to be exact, I am not interested in
metrics, it's a friend who's using my stuff, he wants to detects design
defects in my code models so he needs the usual tonelade of metrics.

I understood the part about implementation, so I think I will try to
implement it while it doesn't appear in a JESS release.  That should make
for some additional learning and I can do some experimentation.

Thanks again for the great support.  it's nice that this time (at least) the
feature may be useful for most users.

A+
Osvaldo

> RDBMS technology and concepts overlap. It seems to me that one very
> interesting way to answer this question is to make use of this
> parallelism and make it more explicit. In response to this question,
> I've been thinking about a new construct called "defquery", which
> looks something like this:
> (defquery my-query (Attribute (name ?aName)))
>
> A defquery is very much like a JDBC "PreparedStatement," and also like
> a Jess defrule (that has only one pattern on the LHS, and no RHS.) You
> use them by calling execute-query:
>
> (execute-query my-query ?aName Bob)
>
> The result of this might be a multifield
>
> (1 3 46 345 6456)
>
> containing fact-ids of facts that matched the query; or maybe it
> contains Fact objects as external-address objects; or perhaps there's
> no multifield at all, only a Java Enumeration. In any case, then the
> question below can be answered by defining the appropriate query,
> executing the query, counting the matches (therte might even be a
> function which does the couting for you.)
>
> The implementation of this is very simple. Basically a defquery is a
> variation of a defrule that doesn't get put on the agenda. If you're
> familiar with Jess' internals, instead of a NodeTerm, a defquery would
> have a NodeQuery or some such, but otherwise would be quite the
> same. The query execution would be handled by adding some patterns to
> the LHS and then asserting some magic query facts; this is similar to
> the kinds of tricks used to do backwards chaining.
>
> Anyway, this lets you use the Rete network and its indexing
> capabilities to do things a relational database is normally used
> for. I can think of plenty of ways to use this.
>
>
> I certainly won't include anything like this in the 5.0a6 release,
> which I want to send out this week. But I'll see about rigging it up
> for the one after that.
>
>
> I think Osvaldo Pinali Doederlein wrote:
> >
> > Hi,
> >
> > I'm working with metrics, so I want to know the _number_ of facts that
match
> > some given pattern.  Example:
> >
> > (Attribute (name ?aName))
> >
> > If there are 10 Attribute facts with the same value for the slot 'name',
> > e.g. "address", I want to assert a new fact
> >
> > (nameCount (name "address") (count 10))
> >
> > Is this possible?  :)  Sorry if I missed something obvious in the
docs... I
> > guess I can do a very dumb implementation where I match the pattern and
> > increment a global variable, but I'm going to do lots of metrics so I
hope
> > there's a cleaner and more efficient way to do this.
> >
> > A+
> > Osvaldo
> >
> > ----------------------------------------------------------------
> > *** The Free, Open and Pure Java Shell *** Current: Alpha7
> > http://www.geocities.com/ResearchTriangle/Node/2005/java_shell.htm
> > http://student.vub.ac.be/~opinalid/java_shell.htm
> > ----------------------------------------------------------------
> > Osvaldo Pinali Doederlein [EMAIL PROTECTED]
> > MSc student, Developer, Java & CORBA evangelist, Rainmaker, etc.
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
> > in the BODY of a message to [EMAIL PROTECTED], NOT to the
> > list (use your own address!) List problems? Notify
[EMAIL PROTECTED]
> > ---------------------------------------------------------------------
> >
> >
>
>
> ---------------------------------------------------------
> Ernest Friedman-Hill
> Distributed Systems Research        Phone: (925) 294-2154
> Sandia National Labs                FAX:   (925) 294-2234
> Org. 8920, MS 9214                  [EMAIL PROTECTED]
> PO Box 969                  http://herzberg.ca.sandia.gov
> Livermore, CA 94550
>
>

---------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the
list (use your own address!) List problems? Notify [EMAIL PROTECTED]
---------------------------------------------------------------------

Reply via email to