Show Table of Contents
3.3. Defining Kie Base
You can create a Kie Base either using the API or in the
kmodule.xml project descriptor file of your project via the Project Editor.
Defining Kie Base in the Project Editor
To define a Kie Base in the web environment, which is stored in the
kmodule.xml file, do the following:
- To open Project Explorer, click and select or navigate to your project.
- Open your project properties in Project Editor: in the perspective menu, click → .
- In the drop-down menu on the Project Screen view, click Knowledge bases and sessions.

Figure 3.3. Project properties selection
- In the Knowledge Bases area on the updated Project Screen, define and select the Knowledge (Kie) Base definition.

Figure 3.4. New Knowledge Base created
Defining Kie Base using API
To define Kie Base using API, use the following code:
import org.kie.api.KieServices;
import org.kie.api.builder.KieRepository;
import org.kie.api.builder.KieFileSystem;
import org.kie.api.builder.KieBuilder;
import org.kie.api.runtime.KieContainer;
import org.kie.api.KieBase;
...
KieServices kServices = KieServices.Factory.get();
KieRepository kRepository = kServices.getRepository();
KieFileSystem kFileSystem = kServices.newKieFileSystem();
kFileSystem.write(ResourceFactory.newClassPathResource("MyProcess.bpmn"));
KieBuilder kBuilder = kServices.newKieBuilder(kFileSystem);
kBuilder.buildAll();
KieContainer kContainer = kServices.newKieContainer(kRepository.getDefaultReleaseId());
KieBase kBase = kContainer.getKieBase();
Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.