private boolean isApplicable( Collection<AtomVariable> bound ) { boolean[] boundPositions = new boolean[ atom.getAllArguments().size() ]; for ( int i = 0; i < boundPositions.length; i++ ) { if ( bound.contains( atom.getAllArguments().get( i ) ) ) boundPositions[i] = true; else boundPositions[i] = false; } return function.isApplicable( boundPositions ); }
private boolean isApplicable( Collection<AtomVariable> bound ) { boolean[] boundPositions = new boolean[ atom.getAllArguments().size() ]; for ( int i = 0; i < boundPositions.length; i++ ) { if ( bound.contains( atom.getAllArguments().get( i ) ) ) boundPositions[i] = true; else boundPositions[i] = false; } return function.isApplicable( boundPositions ); }
public void rebind(VariableBinding newBinding) { Literal[] arguments = new Literal[ atom.getAllArguments().size() ]; int i = 0; for ( AtomDObject obj : atom.getAllArguments() ) { arguments[i++] = newBinding.get( obj ); } result = test.test( arguments ); }
public void rebind(VariableBinding newBinding) { Literal[] arguments = new Literal[ atom.getAllArguments().size() ]; int i = 0; for ( AtomDObject obj : atom.getAllArguments() ) { arguments[i++] = newBinding.get( obj ); } result = test.test( arguments ); }
public Collection<? extends AtomVariable> getBindableVars( Collection<AtomVariable> bound ) { AtomDObject head = null; for ( AtomDObject obj : atom.getAllArguments() ) { if (head == null) { head = obj; // Can only bind first argument to a function if ( !VariableUtils.isVariable( head ) ) return Collections.emptySet(); } else { // Cannot bind a variable that occurs in multiple places. if ( head.equals( obj ) ) return Collections.emptySet(); } } if ( head == null ) return Collections.emptySet(); return Collections.singleton( (AtomVariable) head ); }
public Collection<? extends AtomVariable> getBindableVars(Collection<AtomVariable> bound) { head = null; for ( AtomDObject obj : atom.getAllArguments() ) { if (head == null) { head = obj; // Can only bind first argument to tokenize if ( !VariableUtils.isVariable( head ) ) return Collections.emptySet(); } else { // Cannot bind a variable that occurs in multiple places. if ( head.equals( obj ) ) return Collections.emptySet(); } } if ( head == null ) return Collections.emptySet(); return Collections.singleton( (AtomVariable) head ); }
public Collection<? extends AtomVariable> getBindableVars(Collection<AtomVariable> bound) { head = null; for ( AtomDObject obj : atom.getAllArguments() ) { if (head == null) { head = obj; // Can only bind first argument to tokenize if ( !VariableUtils.isVariable( head ) ) return Collections.emptySet(); } else { // Cannot bind a variable that occurs in multiple places. if ( head.equals( obj ) ) return Collections.emptySet(); } } if ( head == null ) return Collections.emptySet(); return Collections.singleton( (AtomVariable) head ); }
public Collection<? extends AtomVariable> getBindableVars( Collection<AtomVariable> bound ) { AtomDObject head = null; for ( AtomDObject obj : atom.getAllArguments() ) { if (head == null) { head = obj; // Can only bind first argument to a function if ( !VariableUtils.isVariable( head ) ) return Collections.emptySet(); } else { // Cannot bind a variable that occurs in multiple places. if ( head.equals( obj ) ) return Collections.emptySet(); } } if ( head == null ) return Collections.emptySet(); return Collections.singleton( (AtomVariable) head ); }
private NodeProvider[] createProviders(List<RuleAtom> processed, boolean lastWME) { List<AtomDObject> args = atom.getAllArguments(); NodeProvider[] providers = new NodeProvider[args.size()]; AtomObjectTranslator translator = new AtomObjectTranslator(abox, processed, lastWME); for (int i = 0; i < providers.length; i++) { providers[i] = translator.translateObject(args.get(i), true); } return providers; }
if ( atom.getAllArguments().size() == 0 ) return; Literal[] arguments = new Literal[ atom.getAllArguments().size() - 1 ]; for ( AtomDObject obj : atom.getAllArguments() ) { Literal lit = newBinding.get( obj );
public String toString() { return URIUtils.getLocalName(getPredicate().toString())+"("+getAllArguments()+")"; } }
if ( atom.getAllArguments().size() == 0 ) return; Literal[] arguments = new Literal[ atom.getAllArguments().size() - 1 ]; for ( AtomDObject obj : atom.getAllArguments() ) { Literal lit = newBinding.get( obj );
public String toString() { return URIUtils.getLocalName(getPredicate().toString())+"("+getAllArguments()+")"; } }
/** * {@inheritDoc} */ public void visit(BuiltInAtom atom) { int arity = atom.getAllArguments().size(); ATermAppl[] args = new ATermAppl[arity+1]; args[0] = ATermUtils.makeTermAppl( atom.getPredicate() ); int i = 1; for( AtomDObject arg : atom.getAllArguments() ) { args[i++] = translate( arg ); } term = ATermUtils.makeBuiltinAtom( args ); }
/** * {@inheritDoc} */ public void visit(BuiltInAtom atom) { int arity = atom.getAllArguments().size(); ATermAppl[] args = new ATermAppl[arity+1]; args[0] = ATermUtils.makeTermAppl( atom.getPredicate() ); int i = 1; for( AtomDObject arg : atom.getAllArguments() ) { args[i++] = translate( arg ); } term = ATermUtils.makeBuiltinAtom( args ); }
public void rebind(VariableBinding newBinding) { if ( atom.getAllArguments().size() < 3 ) { tokens = null; return; } Literal matchLit = newBinding.get( atom.getAllArguments().get( 0 ) ); if ( matchLit != null ) { match = ATermUtils.getLiteralValue( matchLit.getTerm() ); } String splittingString = ATermUtils.getLiteralValue( newBinding.get( atom.getAllArguments().get(1) ).getTerm() ); String splittingPattern = ATermUtils.getLiteralValue( newBinding.get( atom.getAllArguments().get(2) ).getTerm() ); String[] splits = splittingString.split( splittingPattern ); tokens = Arrays.asList( splits ).iterator(); if ( match != null ) { while ( tokens.hasNext() ) { String token = tokens.next(); if ( token.equals( match ) ) { tokens = Collections.singleton( token ).iterator(); break; } } } }
public void rebind(VariableBinding newBinding) { if ( atom.getAllArguments().size() < 3 ) { tokens = null; return; } Literal matchLit = newBinding.get( atom.getAllArguments().get( 0 ) ); if ( matchLit != null ) { match = ATermUtils.getLiteralValue( matchLit.getTerm() ); } String splittingString = ATermUtils.getLiteralValue( newBinding.get( atom.getAllArguments().get(1) ).getTerm() ); String splittingPattern = ATermUtils.getLiteralValue( newBinding.get( atom.getAllArguments().get(2) ).getTerm() ); String[] splits = splittingString.split( splittingPattern ); tokens = Arrays.asList( splits ).iterator(); if ( match != null ) { while ( tokens.hasNext() ) { String token = tokens.next(); if ( token.equals( match ) ) { tokens = Collections.singleton( token ).iterator(); break; } } } }
public void rebind(VariableBinding newBinding) { Literal[] arguments = new Literal[ atom.getAllArguments().size() ]; arguments[i] = newBinding.get( atom.getAllArguments().get( i ) ); VariableBinding newPartial = new VariableBinding( newBinding.getABox() ); for ( int i = 0; i < arguments.length; i++ ) { AtomDObject arg = atom.getAllArguments().get( i ); Literal result = arguments[ i ]; Literal current = newBinding.get( arg );
public void rebind(VariableBinding newBinding) { Literal[] arguments = new Literal[ atom.getAllArguments().size() ]; arguments[i] = newBinding.get( atom.getAllArguments().get( i ) ); VariableBinding newPartial = new VariableBinding( newBinding.getABox() ); for ( int i = 0; i < arguments.length; i++ ) { AtomDObject arg = atom.getAllArguments().get( i ); Literal result = arguments[ i ]; Literal current = newBinding.get( arg );