public static void build ( final RuleBuildContext context ) { RuleDescr ruleDescr = context . getRuleDescr ( ) ; final RuleConditionBuilder builder = ( RuleConditionBuilder ) context . getDialect ( ) . getBuilder ( ruleDescr . getLhs ( ) . getClass ( ) ) ; if ( builder != null ) { Pattern prefixPattern = context . getPrefixPattern ( ) ; // this is established during pre-processing, if it's query final GroupElement ce = ( GroupElement ) builder . build ( context , getLhsForRuleUnit ( context . getRule ( ) , ruleDescr . getLhs ( ) ) , prefixPattern ) ; context . getRule ( ) . setLhs ( ce ) ; } else { throw new RuntimeException ( "BUG: builder not found for descriptor class " + ruleDescr . getLhs ( ) . getClass ( ) ) ; } // build all the rule's attributes // must be after building LHS because some attributes require bindings from the LHS buildAttributes ( context ) ; // Build the consequence and generate it's invoker/s // generate the main rule from the previously generated s. if ( ! ( ruleDescr instanceof QueryDescr ) ) { // do not build the consequence if we have a query ConsequenceBuilder consequenceBuilder = context . getDialect ( ) . getConsequenceBuilder ( ) ; consequenceBuilder . build ( context , RuleImpl . DEFAULT_CONSEQUENCE_NAME ) ; for ( String name : ruleDescr . getNamedConsequences ( ) . keySet ( ) ) { consequenceBuilder . build ( context , name ) ; } } }
Build the give rule into the