Drools the Business Logic Integration Platform provides an knowledge centric api, where rules and processes are first class citizens.

The most common interfaces you will use are:

- `org.drools.builder.KnowledgeBuilder`
- `org.drools.KnowledgeBase`
- `org.drools.agent.KnowledgeAgent`
- `org.drools.runtime.StatefulKnowledgeSession`
- `org.drools.runtime.StatelessKnowledgeSession`

Factory classes, with static methods, provide instances of the above interfaces. A pluggable provider approach is used to allow provider implementations to be wired up to the factories at runtime. The Factories you will most commonly used are:

- `org.drools.builder.KnowledgeBuilderFactory`
- `org.drools.io.ResourceFactory`
- `org.drools.KnowledgeBaseFactory`
- `org.drools.agent.KnowledgeAgentFactory`

A Typical example to load a rule resource.

    KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
    kbuilder.add( ResourceFactory.newUrlResource( url ),
                          ResourceType.DRL );
    if ( kbuilder.hasErrors() ) {
        System.err.println( builder.getErrors().toString() );
    }

    KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
    kbase.addKnowledgePackages( builder.getKnowledgePackages() );

    StatefulKnowledgeSession ksession = knowledgeBase.newStatefulKnowledgeSession();
    ksession.insert( new Fibonacci( 10 ) );
    ksession.fireAllRules();

    ksession.dispose();

A Typical example to load a process resource. Notice the ResourceType is changed, in accordance with the Resource type.

    KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
    kbuilder.add( ResourceFactory.newUrlResource( url ),
                  ResourceType.DRF );
    if ( kbuilder.hasErrors() ) {
        System.err.println( builder.getErrors().toString() );
    }

    KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
    kbase.addKnowledgePackages( builder.getKnowledgePackages() );

    StatefulKnowledgeSession ksession = knowledgeBase.newStatefulKnowledgeSession();
    ksession.startProcess( "Buy Order Process" );

    ksession.dispose();

'kbuilder', 'kbase', 'ksession' are the variable identifiers often used, the k prefix is for 'knowledge'.

It is also possible to configure a KnowledgeBase using configuration, via a xml change set, instead of programmatically. Here is a simple change set:

    <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 change-set-5.0.xsd' >
        <add>
    	    <resource source='classpath:org/domain/someRules.drl' type='DRL' />
    	    <resource source='classpath:org/domain/aFlow.drf' type='DRF' />
        </add>
    </change-set>

And it is added just like any other ResourceType

    KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
    kbuilder.add( ResourceFactory.newUrlResource( url ),
                  ResourceType.ChangeSet );

The majority of Drools API is considered stable and should not change, experimental classes and apis will be marked as such.