Thanks, I will try that... 2010/11/18 Anderson Rocha <[email protected]>
> You can also use the CHANGE_SET. > > > http://downloads.jboss.com/drools/docs/5.1.1.34858.FINAL/drools-expert/html/ch02.html#d0e890 > > A change_set example, where "rules" and "ruleflows" are folders that must > contain just .drl and .drf files respectively: > > <?xml version="1.0" encoding="UTF-8"?> > > <change-set xmlns='http://drools.org/drools-5.0/change-set' > xmlns:xs='http://www.w3.org/2001/XMLSchema-instance' > xs:schemaLocation=' > http://drools.org/drools-5.0/change-set.xsd' > > > <add> > <resource source='classpath:rules' type='DRL' /> > <resource source='classpath:ruleflows' type='DRF' /> > </add> > </change-set> > > Also take a look at the Knowledge Agent session. > > > http://downloads.jboss.com/drools/docs/5.1.1.34858.FINAL/drools-expert/html/ch02.html#d0e918 > > Regards, > Anderson > > 2010/11/18 Wolfgang Laun <[email protected]> > > // Yesterday: serialize a KP collection >> OutputStream os = new FileOutputStream( pkgPath ); >> ObjectOutputStream oos = new ObjectOutputStream( os ); >> oos.writeObject( kBuilder.getKnowledgePackages() ); >> oos.close(); >> >> // Today: load serialized packages >> KnowledgeBase kBase = KnowledgeBaseFactory.newKnowledgeBase(); >> InputStream is = new FileInputStream( pkgPath ); >> ObjectInputStream ois = new ObjectInputStream( is ); >> @SuppressWarnings("unchecked") >> Collection<KnowledgePackage> kpkgs = (Collection<KnowledgePackage>) >> ois.readObject(); >> ois.close(); >> kBase.addKnowledgePackages( kpkgs ); >> >> You may, of course, add more packages, compiled now. >> -W >> >> 2010/11/18 Yaniv Itzhaki <[email protected]> >> >>> Hi, >>> >>> >>> I wanted to know if it is possible to precompile rules/flows and load them >>> on demand? >>> >>> >>> Currently i am using the following code: >>> >>> >>> *KnowledgeBuilder kbuilder = >>> KnowledgeBuilderFactory.newKnowledgeBuilder(); >>> >>> for (String file : files) { >>> //(missing code) get files from directory and add them >>> to KnowledgeBuilder (source files - rules and flows) >>> >>> kbuilder.add(ResourceFactory.newFileResource(file), >>> type); >>> } >>> * >>> >>> * private KnowledgeBase kb = >>> KnowledgeBaseFactory.newKnowledgeBase(); >>> kb.addKnowledgePackages(kbuilder.getKnowledgePackages());* >>> >>> * >>> * >>> >>> Is there an option to add already precompiled files into KnowledgeBase and >>> not compile them only during the initialization phase? >>> >>> >>> Thanks >>> >>> >>> _______________________________________________ >>> rules-users mailing list >>> [email protected] >>> https://lists.jboss.org/mailman/listinfo/rules-users >>> >>> >> >> _______________________________________________ >> rules-users mailing list >> [email protected] >> https://lists.jboss.org/mailman/listinfo/rules-users >> >> > > _______________________________________________ > rules-users mailing list > [email protected] > https://lists.jboss.org/mailman/listinfo/rules-users > >
_______________________________________________ rules-users mailing list [email protected] https://lists.jboss.org/mailman/listinfo/rules-users
