Collection<AtomVariable> xSingleton = Collections.singleton( (AtomVariable) x );
BuiltInAtom oneVarAtom = new BuiltInAtom( Namespaces.SWRLB + "tokenize", x, data, semicolan );
BindingHelper sharedVarHelper = StringOperators.tokenize.createHelper( oneVarAtom );
assertTrue( sharedVarHelper.getBindableVars( emptyCollection ).equals( xSingleton ) );
VariableBinding emptyBinding = new VariableBinding( kb.getABox() );
sharedVarHelper.rebind( emptyBinding );
VariableBinding fillBinding = new VariableBinding( kb.getABox() );
List<String> expected = Arrays.asList( new String[] { "hi", "bye", "foo", "bar" } );
List<String> tokens = new ArrayList<String>();
while ( sharedVarHelper.selectNextBinding() ) {
sharedVarHelper.setCurrentBinding( fillBinding );
String token = ATermUtils.getLiteralValue( fillBinding.get( x ).getTerm() );
tokens.add( token );
}
assertEquals("String tokenizer returned unexpected sequence of tokens", expected, tokens );
}