• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

rules and querys

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello,
I'm new in jess and I would like to know if there is another way to introduce rules and jess querys in a java aplication instead of using the engine.executeCommand("(defrule rule ....)");. If someone has an example how to declare a rule and a query in java using the jess classes I would appreciate. Thanks
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Welcome to JavaRanch!

You can use the Rete.batch() method, which can read from a file in the filesystem or from a resource on the classpath. Or you can use the Jesp (Jess Parser) class directly, and parse rules and queries (and all other Jess code) from any java.io.Reader you provide.

You're probably asking, though, about somehow saying something like

Defrule rule = new Defule("rule-name", "comment");
rule.addPattern(...)
...

This is actually now possible in Jess 7 but the code to create a rule is long. Really, really long. And currently undocumented. So I wouldn't try it if I were you.
 
Francisco Mejia
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Mr. Friedman-Hill,

Thanks for your answer. Yes, I have solve my problem embedding jess in my java application using Rete.batch() class. Following your advice I did not try to use the last way. Have a good day.
 
reply
    Bookmark Topic Watch Topic
  • New Topic