I am interested in creating rules for Drools Planner. I want that a user can create his own rules in a java app before starting the Drools Planner. Maybe a Drools-rule-file could be generated after the user has added his rules. Would this be possible or do I have to create the rule-file while developing the whole java application?
Many thanks...
Yes it's possible.
The trick is to build your own RuleBase and set it in the Planner config.
See section "5.3.4.2.2. A RuleBase (possibly defined by Guvnor)" in the manual.
You can construct a RuleBase by several, depending on how you want your user to edit his/her rules:
From a DRL file. This presumes the user knows DRL. See Drools Expert manual.
From a DSL file. This allows you to use natural language.
From the guvnor webapp. This allows you to use the tooling Guvnor, such as a guided rule editor, a decision tables spreadsheet, ... You can even use a changeset.
From guvnor in eclipse or a standalone app (under development and experimental). There's some work being in this area, but it's still young.
Related
I am looking for an easy-to-implement solution for form-based ontology editing and I wonder if there are any active projects and which of them is the right path to follow.
I need to create instances of an ontology (lets call it ontology A) using forms (either web or desktop) and store them in a triple store (e.g. Virtuoso). I would like to hide as much details as possible regarding the ontological relationships between the entities defined in ontology A and provide a plain simple user interface for CRUD (Create-Retrieve-Update-Delete) operations based on the entity schema defined in ontology A.
For example, I have found two possible solutions in the protege ecosystem:
PropertyFormPortlet It is not a live feature in the current webprotege version.
facsimile project
As described in the respective paper this is a solution that has been implemented for a specific context. Therefore, adapting it to another domain would not be as straightforward as I would like.
I wonder, is there another solution (even out of the protege ecosystem) that could facilitate such a form-based ontology editing. Could somebody provide some guidance?
Just in case someone lands in this question, I write down my conclusions. Practically, none of which I tried worked, but still I found out some interesting things.
OpenLink Structured Data Editor:
OSDE is a browser plugin which aims at populating RDF graphs in the form of files, based on Linked Vocabularies. In my case it didn't work as my locally hosted ontology cannot play the role of a "Linked Vocabulary". However, OpenLink team said they will work on it.
OData2SPARQL:
In our test, the WebIDE did not manage to create the forms out of the box as suggested by the respective video tutorial. However, we managed to use OpenUI library as a client of the OData services automatically created by OData2SPARQL, providing a web service interface for our ontology.
Ontowiki:
In our test environment, OntoWiki partially worked. We could save data but there were some bugs when trying to add properties etc. OntoWiki developers said that they plan to refactor in order to actively support it in newer hosting settings, but this is not the case right now.
There is UI already there to control rules. and perform operation like CRUD using drl file or even using dsl for easing making drl rules for nontech person for such operation. So, Is there any other way to create our own webpage to control such rules for even easy usability?
Is any way to edit source codes for available workbench UI?
Drools is open source and you can modify the UI if you want. You can also treat Drools like a component in your architecture by wrapping it in a service and calling it through your own simplified API. You can then call your API from your own web front end.
We are planning to use Drools/JBoss BRMS 6 for business rules management. Our plan is to write rules using the workbench, deploy the rules package in multiple Execution Servers and allow applications to access the Rules package by making calls to the REST API. We do not have any Java wrappers or custom classes in between the calling applications and the rules package.
I am trying to incorporate some logging into the rules engine. I understand that there are EventListener interfaces that can be implemented.
Please would you provide some information/guidance on how to implement Listeners in our kind of set up? Where will I create and store the Java classes/methods that would implement Event Listeners?
How can a calling application insert an Event Listener into the session? Will it be part of the xml/json payload?
Thanks
1. Where to implement the listeners?
The listeners must be obviously implemented in Java. One simple place I found to put those implementation is in a separate maven project. After all, a project in the kie-workbench is a maven project itself. So you can create a separate project (outside the kie-workbench) implement the listeners you want to and then add this new project as a dependency in your kie-workbench's project (check the documentation on how to do that).
The only problem I found with this approach is that once you defined the dependency between your projects, the kie-workbench will scan every single class of it and of any other dependency it has. Check this link for more information.
So, if your listener project doesn't have too many dependencies, you should be good to go. Please note that, in theory, you could add any kie/drools dependency you have in your listener project as <scope>provided</scope>.
2. How can I configure these listeners?
A trick that I always use is to have what I call a "configuration" rule to do this kind of job.
A "Configuration" rule is a rule without LHS (and, if you are distrustful, a high salience). This kind of rules are guaranteed to be executed only once. Just make sure that you call a fireAllRules() before the first interaction with the kie-server, or that the first interaction always starts with a fireAllRules command.
Your configuration rule could look like this:
/**
Configures the session's listeners.
**/
rule "[SUB-CONFIG] Listeners Configuration"
salience 1000
when
then
((org.drools.impl.StatefulKnowledgeSessionImpl)kcontext.getKnowledgeRuntime()).addEventListener(new MyWorkingMemoryEventListener());
((org.drools.impl.StatefulKnowledgeSessionImpl)kcontext.getKnowledgeRuntime()).addEventListener(new MyAgendaEventListener());
end
You can place this rule in your kie-server project.
Hope it helps,
We are evaluating Activiti as a process engine to replace our existing home grown work flow engine. We are quite impressed by the capabilities of Activiti especially related to multi tenancy and REST WS.
However, one of the biggest challenge (and probably blocker) to adopt Activiti would be - How we can run or migrate our existing work flow definitions.
As I mentioned earlier, our work flow solution is a home grown one and doesn't adheres to BPMN specifications. There are thousands of templates out there. We can't simply ask our customers to redefine their templates using Activiti. These definitions are stored in proprietary XML format.
Looking at the level of customization in the templates, it would be very difficult to migrate these definitions to BPMN format.
So, does Activiti provides any hooks to run such custom templates. Alternatively, please share your thoughts about migrating the templates from proprietary format to BPMN format.
I suppose such scenario would be common and other people would have faced the same.
I know I am being very vague with this query but at this stage I don't have specific problems that I can discuss.
One option is implement your own proprietary XML parser and parser handlers. Look at org.activiti.engine.impl.bpmn.parser.BpmnParse and org.activiti.engine.impl.bpmn.parser.handler.AbstractBpmnParseHandler and its descendants.
We did it and worked fine.
How can I manipulate other modules without editing them ? very the same thing that wordpress modules do .
They add functionality to core system without changing the core code and they work together like a charm.
I always wanted to know how to implement this in my own modular application
A long time ago I wrote the blog post "Use 3rd party modules in Zend Framework 2" specifically about extending Zend Framework 2 modules. The answer from Bez is technically correct, it could be a bit more specific about the framework.
Read the full post at https://juriansluiman.nl/article/117/use-3rd-party-modules-in-zend-framework-2, but it gives you a clue about:
Changing a route from a module (say, you want to have the url /account/login instead of /user/login)
Overriding a view script, so you can completely modify the page's rendering
Changing a form object, so you could add new form fields or mark some required field as not required anymore.
This is a long topic, but here is a short gist.
Extensibility in Zend Framework 2 heavily relies on the premise that components can be interchanged, added, and/or substituted.
Read up on SOLID principles: http://en.wikipedia.org/wiki/SOLID_(object-oriented_design)
Modules typically consists of objects working together as a well-oiled machinery, designed to accomplish one thing or a bunch of related things, whatever that may be. These objects are called services, and managed by the service locator/service manager.
A big part of making your module truly extensible is to expect your developers to extend a class or implement a certain interface, which the developer register as services. You should provide a mode of definition wherein the developers can specify which things he wants to substitute, and/or add their own services to -- and this is where the application configuration comes in.
Given the application configuration, you should construct your machinery a.k.a. module services according to options the developer has specified i.e., use the developer defined Foo\Bar\UserService service as the YourModule\UserServiceInterface within your module, etc. (This is usually delegated to service factories, which has the opportunity to read the application configuration, and constructs the appropriate object given a particular set of configuration values.)
EDIT:
To add, a lot can be accomplished by leveraging Zend's Zend\EventManager component. This allows you to give developers the freedom to hook and listen to certain operations of your module and act accordingly (See: http://en.wikipedia.org/wiki/Observer_pattern)