Package org.drools.io

Examples of org.drools.io.RuleSetReader


        // Build the RuleSets.
        verbose( "Building RuleBase with " + numberOfRules + " rules..." );
        RuleBaseBuilder builder = new RuleBaseBuilder( );
        builder.addRuleSet( ruleSet );
        builder.addRuleSet( new RuleSetReader( ).read( PrimeFactors.class.getResource( DRL_FILE ) ) );
        RuleBase ruleBase = builder.build( );
        verbose( "Built RuleBase with " + numberOfRules + " rules"
                 + stopwatch( 0 ) );

        // Determine random set of Facts to assert
View Full Code Here


    {
        // Prepare the DOM source
        Source source = new DOMSource( ruleExecutionSetElement );

        // Create a reader to handle the SAX events
        RuleSetReader reader;
        try
        {
            reader =
                new RuleSetReader( DefaultSemanticsRepository.getInstance( ) );
        }
        catch ( SemanticsReaderException e )
        {
            throw new RuleExecutionSetCreateException(
                "Couldn't get an instance of the DefaultSemanticsRepository: "
                + e );
        }
        catch ( IOException e )
        {
            throw new RuleExecutionSetCreateException(
                "Couldn't get an instance of the DefaultSemanticsRepository: "
                + e );
        }

        try
        {
            // Prepare the result
            SAXResult result = new SAXResult( reader );

            // Create a transformer
            Transformer xformer =
                TransformerFactory.newInstance( ).newTransformer( );

            // Traverse the DOM tree
            xformer.transform( source, result );
        }
        catch ( TransformerException e )
        {
            throw new RuleExecutionSetCreateException(
                "could not create RuleExecutionSet: " + e );
        }

        RuleSet ruleSet = reader.getRuleSet( );
        LocalRuleExecutionSetProviderImpl localRuleExecutionSetProvider =
            new LocalRuleExecutionSetProviderImpl( );
        return localRuleExecutionSetProvider.createRuleExecutionSet(
            ruleSet, properties );
    }
View Full Code Here

        try
        {
            resourceAsStream =
                RuleEngineTestBase.class.getResourceAsStream( bindUri );
            Reader reader = new InputStreamReader( resourceAsStream );
            RuleSetReader ruleSetReader = new RuleSetReader( );
            this.ruleSet = ruleSetReader.read( reader );
        }
        catch ( IOException e )
        {
            throw new ExceptionInInitializerError(
                "setUp() could not init the " +
View Full Code Here

            InputStream ruleExecutionSetStream, Map properties )
        throws RuleExecutionSetCreateException
    {
        try
        {
            RuleSetReader setReader = new RuleSetReader( );
            RuleSet ruleSet = setReader.read( ruleExecutionSetStream );
            return this.createRuleExecutionSet( ruleSet, properties );
        }
        catch ( SAXException e )
        {
            throw new RuleExecutionSetCreateException(
View Full Code Here

            Reader ruleExecutionSetReader, Map properties )
        throws RuleExecutionSetCreateException
    {
        try
        {
            RuleSetReader setReader = new RuleSetReader( );
            RuleSet ruleSet = setReader.read( ruleExecutionSetReader );
            return this.createRuleExecutionSet( ruleSet, properties );
        }
        catch ( SAXException e )
        {
            throw new RuleExecutionSetCreateException(
View Full Code Here

        try
        {
            inputStream =
                RuleEngineTestBase.class.getResourceAsStream( bindUri );
            Reader in = new InputStreamReader( inputStream );
            RuleSet ruleSet = new RuleSetReader( ).read( in );
            RuleExecutionSet ruleExecutionSet =
                ruleSetProvider.createRuleExecutionSet( ruleSet, null );
            assertEquals( "rule set name", "Sisters Rules",
                          ruleExecutionSet.getName( ) );
            assertEquals(
View Full Code Here

TOP

Related Classes of org.drools.io.RuleSetReader

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.