org.eclipse.rdf4j.examples.function

## Class ExistingPalindromeFunction

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

- All Implemented Interfaces:
    Function

      public class ExistingPalindromeFunction
      extends Object
      implements Function

  An example custom SPARQL function that detects palindromes that already exist in the database.
  Author:
    Jeen Broekstra

- - ### Field Summary

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

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ExistingPalindromeFunction()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Value` | `evaluate(TripleSource tripleSource, Value... args)` Executes the existingPalindrome function.
    `Value` | `evaluate(ValueFactory valueFactory, Value... args)` Evaluate the function over the supplied input arguments, using the supplied `ValueFactory` to produce the result.
    `String` | `getURI()` return the URI 'http://example.org/custom-function/existingPalindrome' as a String

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

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

- - ### Field Detail

    - #### NAMESPACE

          public static final String NAMESPACE

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### ExistingPalindromeFunction

          public ExistingPalindromeFunction()

  - ### Method Detail

    - #### getURI

          public String getURI()

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

    - #### evaluate

          public Value evaluate(TripleSource tripleSource,
                                Value... args)
                         throws ValueExprEvaluationException

      Executes the existingPalindrome function.
      Specified by:
        `evaluate` in interface `Function`
      Parameters:
        `tripleSource` - the `TripleSource` used in the query evaluation. This can be used to access the current state of the store.
        `args` - the function input arguments.
      Returns:
        A boolean literal representing true if the input argument is a palindrome and exists in the database, false otherwise.
      Throws:
        `ValueExprEvaluationException` - if more than one argument is supplied or if the supplied argument is not a literal.

    - #### evaluate

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

      Description copied from interface: `Function`
      Evaluate the function over the supplied input arguments, using the supplied `ValueFactory` to produce the result.
      Specified by:
        `evaluate` in interface `Function`
      Parameters:
        `valueFactory` - a `ValueFactory` to use for producing the function result.
        `args` - the function input arguments.
      Returns:
        the function result value.
      Throws:
        `ValueExprEvaluationException`

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