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 Details

  • Constructor Details

    • PalindromeFunction

      public PalindromeFunction()
  • Method Details

    • 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.