org.eclipse.rdf4j.examples.function

## Class PalindromeFunction

- java.lang.Object
- - org.eclipse.rdf4j.examples.function.PalindromeFunction

- All Implemented Interfaces:
    Function

      public class PalindromeFunction
      extends Object
      implements Function

  An example custom SPARQL function that detects palindromes
  Author:
    Jeen Broekstra

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `NAMESPACE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PalindromeFunction()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Value` | `evaluate(ValueFactory valueFactory, Value... args)` Executes the palindrome function.
    `String` | `getURI()` return the URI 'http://example.org/custom-function/palindrome' as a String

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface org.eclipse.rdf4j.query.algebra.evaluation.function.Function

      `evaluate`

- - ### Field Detail

    - #### NAMESPACE

          public static final String NAMESPACE

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### PalindromeFunction

          public PalindromeFunction()

  - ### Method Detail

    - #### getURI

          public String getURI()

      return the URI 'http://example.org/custom-function/palindrome' as a String
      Specified by:
        `getURI` in interface `Function`

    - #### evaluate

          public Value evaluate(ValueFactory valueFactory,
                                Value... args)
                         throws ValueExprEvaluationException

      Executes the palindrome function.
      Specified by:
        `evaluate` in interface `Function`
      Parameters:
        `valueFactory` - a `ValueFactory` to use for producing the function result.
        `args` - the function input arguments.
      Returns:
        A boolean literal representing true if the input argument is a palindrome, false otherwise.
      Throws:
        `ValueExprEvaluationException` - if more than one argument is supplied or if the supplied argument is not a literal.

Copyright © 2015-2021 Eclipse Foundation. All Rights Reserved.