public BRLActionColumn getBRLColumn(BRLActionVariableColumn col) { for ( ActionCol52 ac : actionCols ) { if ( ac instanceof BRLActionColumn ) { BRLActionColumn brl = (BRLActionColumn) ac; if ( brl.getChildColumns().contains( col ) ) { return brl; } } } throw new IllegalStateException( "col is not a child of any of the defined BRLColumns." ); }
/** * Check is the model uses DSLSentences and hence requires expansion * * @return true if any BRLColumn's contain DSLSentence's */ public boolean hasDSLSentences() { for ( CompositeColumn< ? extends BaseColumn> column : this.conditionPatterns ) { if ( column instanceof BRLConditionColumn ) { BRLConditionColumn brlColumn = (BRLConditionColumn) column; for ( IPattern pattern : brlColumn.getDefinition() ) { if ( pattern instanceof DSLSentence ) { return true; } } } } for ( ActionCol52 column : this.actionCols ) { if ( column instanceof BRLActionColumn ) { BRLActionColumn brlColumn = (BRLActionColumn) column; for ( IAction action : brlColumn.getDefinition() ) { if ( action instanceof DSLSentence ) { return true; } } } } return false; }
BRLActionColumn brl1 = new BRLActionColumn(); brl1Definition.add( brl1DefinitionAction1 ); brl1.setDefinition( brl1Definition ); brl1.getChildColumns().add( brl1Variable1 );
final BRLActionVariableColumn variableColumn = column.getChildColumns().get( 0 ); final int index = allColumns.indexOf( variableColumn ); final DTCellValue52 dcv = row.get( index ); if ( dcv.getBooleanValue() ) { for ( IAction action : column.getDefinition() ) { addAction( action, actions ); for ( IAction action : column.getDefinition() ) {
dt.getActionCols().add( ins ); BRLActionColumn brlAction = new BRLActionColumn(); ActionInsertFact aif = new ActionInsertFact( "Person" ); aif.setBoundName( "$aif" ); aif.fieldValues[0].nature = BaseSingleFieldConstraint.TYPE_LITERAL; brlAction.getDefinition().add( aif ); dt.getActionCols().add( brlAction );
BRLActionColumn brl1 = new BRLActionColumn(); brl1Definition.add( brl1DefinitionAction2 ); brl1.setDefinition( brl1Definition ); "Person", "name" ); brl1.getChildColumns().add( brl1Variable1 ); BRLActionVariableColumn brl1Variable2 = new BRLActionVariableColumn( "$age", SuggestionCompletionEngine.TYPE_NUMERIC_INTEGER, "Person", "age" ); brl1.getChildColumns().add( brl1Variable2 );
final BRLActionVariableColumn variableColumn = column.getChildColumns().get( 0 ); final int index = allColumns.indexOf( variableColumn ); final DTCellValue52 dcv = row.get( index ); if ( dcv.getBooleanValue() ) { for ( IAction action : column.getDefinition() ) { addAction( action, actions ); for ( IAction action : column.getDefinition() ) {
dt.getActionCols().add( ins ); BRLActionColumn brlAction = new BRLActionColumn(); ActionInsertFact aif1 = new ActionInsertFact( "Person" ); aif1.setBoundName( "$aif" ); aif1.fieldValues[0].nature = BaseSingleFieldConstraint.TYPE_LITERAL; brlAction.getDefinition().add( aif1 ); dt.getActionCols().add( brlAction );
/** * Check is the model uses DSLSentences and hence requires expansion * * @return true if any BRLColumn's contain DSLSentence's */ public boolean hasDSLSentences() { for ( CompositeColumn< ? extends BaseColumn> column : this.conditionPatterns ) { if ( column instanceof BRLConditionColumn ) { BRLConditionColumn brlColumn = (BRLConditionColumn) column; for ( IPattern pattern : brlColumn.getDefinition() ) { if ( pattern instanceof DSLSentence ) { return true; } } } } for ( ActionCol52 column : this.actionCols ) { if ( column instanceof BRLActionColumn ) { BRLActionColumn brlColumn = (BRLActionColumn) column; for ( IAction action : brlColumn.getDefinition() ) { if ( action instanceof DSLSentence ) { return true; } } } } return false; }
BRLActionColumn brl1 = new BRLActionColumn(); brl1DefinitionAction1.addFieldValue( brl1DefinitionAction1FieldValue2 ); brl1Definition.add( brl1DefinitionAction1 ); brl1.setDefinition( brl1Definition ); "Person", "name" ); brl1.getChildColumns().add( brl1Variable1 ); BRLActionVariableColumn brl1Variable2 = new BRLActionVariableColumn( "$age", SuggestionCompletionEngine.TYPE_NUMERIC_INTEGER, "Person", "age" ); brl1.getChildColumns().add( brl1Variable2 );
public BRLActionColumn getBRLColumn(BRLActionVariableColumn col) { for ( ActionCol52 ac : actionCols ) { if ( ac instanceof BRLActionColumn ) { BRLActionColumn brl = (BRLActionColumn) ac; if ( brl.getChildColumns().contains( col ) ) { return brl; } } } throw new IllegalStateException( "col is not a child of any of the defined BRLColumns." ); }
dt.getActionCols().add( ins2 ); BRLActionColumn brlAction = new BRLActionColumn(); ActionInsertFact aif = new ActionInsertFact( "Person" ); aif.setBoundName( "$aif" ); aif.fieldValues[0].nature = BaseSingleFieldConstraint.TYPE_LITERAL; brlAction.getDefinition().add( aif ); dt.getActionCols().add( brlAction );
private boolean hasVariables(BRLActionColumn column) { Map<InterpolationVariable, Integer> ivs = new HashMap<InterpolationVariable, Integer>(); RuleModel rm = new RuleModel(); for ( IAction action : column.getDefinition() ) { rm.addRhsItem( action ); } RuleModelVisitor rmv = new RuleModelVisitor( ivs ); rmv.visit( rm ); return ivs.size() > 0; }
BRLActionColumn brl1 = new BRLActionColumn(); brl1DefinitionAction1.addFieldValue( brl1DefinitionAction1FieldValue2 ); brl1Definition.add( brl1DefinitionAction1 ); brl1.setDefinition( brl1Definition ); "Person", "name" ); brl1.getChildColumns().add( brl1Variable1 ); BRLActionVariableColumn brl1Variable2 = new BRLActionVariableColumn( "$age", SuggestionCompletionEngine.TYPE_NUMERIC_INTEGER, "Person", "age" ); brl1.getChildColumns().add( brl1Variable2 );
public BRLColumn< ? , ? > getBRLColumn(BRLVariableColumn col) { for ( CompositeColumn< ? > cc : conditionPatterns ) { if ( cc instanceof BRLConditionColumn ) { BRLConditionColumn brl = (BRLConditionColumn) cc; if ( brl.getChildColumns().contains( col ) ) { return brl; } } } for ( ActionCol52 ac : actionCols ) { if ( ac instanceof BRLActionColumn ) { BRLActionColumn brl = (BRLActionColumn) ac; if ( brl.getChildColumns().contains( col ) ) { return brl; } } } throw new IllegalStateException( "col is not a child of any of the defined BRLColumns." ); }
private boolean hasVariables(BRLActionColumn column) { Map<InterpolationVariable, Integer> ivs = new HashMap<InterpolationVariable, Integer>(); RuleModel rm = new RuleModel(); for ( IAction action : column.getDefinition() ) { rm.addRhsItem( action ); } RuleModelVisitor rmv = new RuleModelVisitor( ivs ); rmv.visit( rm ); return ivs.size() > 0; }
public BRLColumn< ? , ? > getBRLColumn(BRLVariableColumn col) { for ( CompositeColumn< ? > cc : conditionPatterns ) { if ( cc instanceof BRLConditionColumn ) { BRLConditionColumn brl = (BRLConditionColumn) cc; if ( brl.getChildColumns().contains( col ) ) { return brl; } } } for ( ActionCol52 ac : actionCols ) { if ( ac instanceof BRLActionColumn ) { BRLActionColumn brl = (BRLActionColumn) ac; if ( brl.getChildColumns().contains( col ) ) { return brl; } } } throw new IllegalStateException( "col is not a child of any of the defined BRLColumns." ); }
@Override public List<String> getAllRHSVariables() { Set<String> variables = new HashSet<String>(); for ( ActionCol52 col : dtable.getActionCols() ) { if ( col instanceof ActionInsertFactCol52 ) { ActionInsertFactCol52 action = (ActionInsertFactCol52) col; variables.add( action.getBoundName() ); } else if ( col instanceof BRLActionColumn ) { BRLActionColumn brl = (BRLActionColumn) col; for ( IAction a : brl.getDefinition() ) { if ( a instanceof ActionInsertFact ) { ActionInsertFact action = (ActionInsertFact) a; if ( action.isBound() ) { variables.add( action.getBoundName() ); } } } } } variables.addAll( super.getAllRHSVariables() ); return new ArrayList<String>( variables ); }
} else { BRLActionColumn bac = (BRLActionColumn) ac; for ( BRLActionVariableColumn variable : bac.getChildColumns() ) { columns.add( variable );
@Override public List<String> getRHSBoundFacts() { final Set<String> variables = new HashSet<String>(); for ( ActionCol52 col : dtable.getActionCols() ) { if ( col instanceof ActionInsertFactCol52 ) { ActionInsertFactCol52 action = (ActionInsertFactCol52) col; variables.add( action.getBoundName() ); } else if ( col instanceof BRLActionColumn ) { BRLActionColumn brl = (BRLActionColumn) col; for ( IAction a : brl.getDefinition() ) { if ( a instanceof ActionInsertFact ) { ActionInsertFact action = (ActionInsertFact) a; if ( action.isBound() ) { variables.add( action.getBoundName() ); } } } } } variables.addAll( super.getRHSBoundFacts() ); return new ArrayList<String>( variables ); }