boolean addAbductiveReturnArgument = query.isAbductive()
&& ! StringUtils.isEmpty( patternDescr.getIdentifier() )
&& args.size() < params.length;
if ( addAbductiveReturnArgument ) {
ExprConstraintDescr extraDescr = new ExprConstraintDescr( patternDescr.getIdentifier() );
extraDescr.setPosition( patternDescr.getConstraint().getDescrs().size() );
extraDescr.setType( ExprConstraintDescr.Type.POSITIONAL );
args.add( extraDescr );
}
// Deal with the constraints, both positional and bindings
for ( int i = 0, length = args.size(); i < length; i++ ) {
BaseDescr base = args.get( i );
String expression = null;
boolean isPositional = false;
boolean isBinding = false;
BindingDescr bind = null;
ConstraintConnectiveDescr result = null;
if ( base instanceof BindingDescr ) {
bind = (BindingDescr) base;
expression = bind.getVariable() + (bind.isUnification() ? " := " : " : ") + bind.getExpression();
isBinding = true;
} else {
if ( base instanceof ExprConstraintDescr ) {
ExprConstraintDescr ecd = (ExprConstraintDescr) base;
expression = ecd.getExpression();
isPositional = ecd.getType() == ExprConstraintDescr.Type.POSITIONAL;
} else {
expression = base.getText();
}