@Test public void testEvaluate0() { assertFalse(((Literal)new ParallelSplitFunction(0).evaluate(SVF, SVF.createLiteral(3), SVF.createLiteral("hello"))).booleanValue()); }
@Override public Value evaluate(ValueFactory valueFactory, Value... args) throws ValueExprEvaluationException { if (args == null || args.length < 2) { throw new ValueExprEvaluationException(PARALLEL_SPLIT_FUNCTION.getLocalName() + " function has at least two mandatory arguments: <constant number of parallel forks> and <binding variable(s) to filter by>"); } for (Value v : args) { if (v == null) { throw new ValueExprEvaluationException(PARALLEL_SPLIT_FUNCTION.getLocalName() + " function does not allow null values"); } } try { int forks = Integer.parseInt(args[0].stringValue()); if (forks < 1) { throw new ValueExprEvaluationException(PARALLEL_SPLIT_FUNCTION.getLocalName() + " function first argument must be > 0"); } return valueFactory.createLiteral(Math.floorMod(Arrays.hashCode(args), forks) == forkIndex); } catch (NumberFormatException e) { throw new ValueExprEvaluationException(PARALLEL_SPLIT_FUNCTION.getLocalName() + " function first argument must be numeric constant"); } }
ParallelSplitFunction implements Function { @Override public Value evaluate(ValueFactory valueFactory, Value... args) throws ValueExprEvaluationException { if (args == null || args.length < 2) { throw new ValueExprEvaluationException(PARALLEL_SPLIT_FUNCTION.getLocalName() + " function has at least two mandatory arguments: <constant number of parallel forks> and <binding variable(s) to filter by>"); } for (Value v : args) { if (v == null) { throw new ValueExprEvaluationException(PARALLEL_SPLIT_FUNCTION.getLocalName() + " function does not allow null values"); } } try { int forks = Integer.parseInt(args[0].stringValue()); if (forks < 1) { throw new ValueExprEvaluationException(PARALLEL_SPLIT_FUNCTION.getLocalName() + " function first argument must be > 0"); } return valueFactory.createLiteral(Math.floorMod(Arrays.hashCode(args), forks) == forkIndex); } catch (NumberFormatException e) { throw new ValueExprEvaluationException(PARALLEL_SPLIT_FUNCTION.getLocalName() + " function first argument must be numeric constant"); } } }
ParallelSplitFunction implements Function { @Override public Value evaluate(ValueFactory valueFactory, Value... args) throws ValueExprEvaluationException { if (args == null || args.length < 2) { throw new ValueExprEvaluationException(PARALLEL_SPLIT_FUNCTION.getLocalName() + " function has at least two mandatory arguments: <constant number of parallel forks> and <binding variable(s) to filter by>"); } for (Value v : args) { if (v == null) { throw new ValueExprEvaluationException(PARALLEL_SPLIT_FUNCTION.getLocalName() + " function does not allow null values"); } } try { int forks = Integer.parseInt(args[0].stringValue()); if (forks < 1) { throw new ValueExprEvaluationException(PARALLEL_SPLIT_FUNCTION.getLocalName() + " function first argument must be > 0"); } return valueFactory.createLiteral(Math.floorMod(Arrays.hashCode(args), forks) == forkIndex); } catch (NumberFormatException e) { throw new ValueExprEvaluationException(PARALLEL_SPLIT_FUNCTION.getLocalName() + " function first argument must be numeric constant"); } } ParallelSplitFunction(int forkIndex); }
ParallelSplitFunction implements Function { @Override public Value evaluate(ValueFactory valueFactory, Value... args) throws ValueExprEvaluationException { if (args == null || args.length < 2) { throw new ValueExprEvaluationException(PARALLEL_SPLIT_FUNCTION.getLocalName() + " function has at least two mandatory arguments: <constant number of parallel forks> and <binding variable(s) to filter by>"); } for (Value v : args) { if (v == null) { throw new ValueExprEvaluationException(PARALLEL_SPLIT_FUNCTION.getLocalName() + " function does not allow null values"); } } try { int forks = Integer.parseInt(args[0].stringValue()); if (forks < 1) { throw new ValueExprEvaluationException(PARALLEL_SPLIT_FUNCTION.getLocalName() + " function first argument must be > 0"); } return valueFactory.createLiteral(Math.floorMod(Arrays.hashCode(args), forks) == forkIndex); } catch (NumberFormatException e) { throw new ValueExprEvaluationException(PARALLEL_SPLIT_FUNCTION.getLocalName() + " function first argument must be numeric constant"); } } ParallelSplitFunction(int forkIndex); @Override String getURI(); @Override Value evaluate(ValueFactory valueFactory, Value... args); static int getNumberOfForksFromFunctionArgument(String query, boolean sparqlUpdate, int stage); }
ParallelSplitFunction implements Function { @Override public Value evaluate(ValueFactory valueFactory, Value... args) throws ValueExprEvaluationException { if (args == null || args.length < 2) { throw new ValueExprEvaluationException(PARALLEL_SPLIT_FUNCTION.getLocalName() + " function has at least two mandatory arguments: <constant number of parallel forks> and <binding variable(s) to filter by>"); } for (Value v : args) { if (v == null) { throw new ValueExprEvaluationException(PARALLEL_SPLIT_FUNCTION.getLocalName() + " function does not allow null values"); } } try { int forks = Integer.parseInt(args[0].stringValue()); if (forks < 1) { throw new ValueExprEvaluationException(PARALLEL_SPLIT_FUNCTION.getLocalName() + " function first argument must be > 0"); } return valueFactory.createLiteral(Math.floorMod(Arrays.hashCode(args), forks) == forkIndex); } catch (NumberFormatException e) { throw new ValueExprEvaluationException(PARALLEL_SPLIT_FUNCTION.getLocalName() + " function first argument must be numeric constant"); } } ParallelSplitFunction(int forkIndex); @Override String getURI(); @Override Value evaluate(ValueFactory valueFactory, Value... args); static int getNumberOfForksFromFunctionArgument(String query, boolean sparqlUpdate, int stage);  }