Interface TermFactory

All Known Implementing Classes:
SameObjectTermFactory

public interface TermFactory
Factory for creating terms.
Author:
Florent Tornil
  • Method Details

    • createOrGetConstant

      Constant createOrGetConstant(String label)
      Two objects created by a call to this function with the same label argument must be equals according to the definition given by the Constant implementation used
      Parameters:
      label - the label
      Returns:
      a constant with the given label
    • createOrGetLiteral

      <T> Literal<T> createOrGetLiteral(T value)
      Two object created by a call to this function with the same typed value argument must be equals according to the definition given by the Literal implementation used /!\ This method must not be used to create a number literal
      Type Parameters:
      T - the native type of the literal
      Parameters:
      value - the value
      Returns:
      a literal with the given value
    • createOrGetIntegerLiteral

      <T extends Number> Literal<Long> createOrGetIntegerLiteral(T value)
      Creates or reuses an integer literal from a numeric value.
      Type Parameters:
      T - the numeric type of the input value
      Parameters:
      value - the numeric value to convert
      Returns:
      a literal holding the integer value
    • createOrGetFloatLiteral

      <T extends Number> Literal<Double> createOrGetFloatLiteral(T value)
      Creates or reuses a floating-point literal from a numeric value.
      Type Parameters:
      T - the numeric type of the input value
      Parameters:
      value - the numeric value to convert
      Returns:
      a literal holding the floating-point value
    • createOrGetVariable

      Variable createOrGetVariable(String label)
      Two objects created by a call to this function with the same label argument must be equals according to the definition given by the Variable implementation used
      Parameters:
      label - the label
      Returns:
      a variable with the given label
    • createOrGetAnonymousVariable

      Variable createOrGetAnonymousVariable()
      Two objects created by a call to this function must never be equals according to the definition given by the Variable implementation used An anonymous Variable must not be equals to an existing Variable created by createOrGetVariable(String).
      Returns:
      a variable with a new label
    • createOrGetLogicalFunctionalTerm

      LogicalFunctionalTerm createOrGetLogicalFunctionalTerm(String name, List<Term> terms)
      Two objects created by a call to this function with the same label argument must be equals according to the definition given by the LogicalFunctionalTerm implementation used
      Parameters:
      name - the name of the function
      terms - the ordered arguments of the function
      Returns:
      a logical functional term with the given name and terms
    • createOrGetFreshVariable

      Variable createOrGetFreshVariable()
      Two objects created by a call to this function must never be equals according to the definition given by the Variable implementation used A Fresh Variable must not be equals to an existing Variable created by createOrGetVariable(String).
      Returns:
      a variable with a new label
    • createOrGetFreshConstant

      Constant createOrGetFreshConstant()
      Two objects created by a call to this function must never be equals according to the definition given by the Constant implementation used A Fresh Constant must not be equals to an existing Constant created by createOrGetConstant(String).
      Returns:
      a constant with a new label
    • forgetConstant

      boolean forgetConstant(String label)
      Forgets a previously created constant.
      This constant will no longer be considered as already existing in the factory.
      Parameters:
      label - the label of the previously created constant
      Returns:
      true iff such a constant already exists in the factory, and thus forgets it.
    • createOrGetXsdLiteral

      Literal<?> createOrGetXsdLiteral(String lexicalForm, String xsdType)
      Builds a literal from a lexical string and an XSD type reference (e.g. "xsd:integer" or "http://www.w3.org/2001/XMLSchema#dateTime").

      The lexical string is parsed into a Java Object based on the XSD type, then stored in a Literal.

      Parameters:
      lexicalForm - the lexical form to parse
      xsdType - the XSD type identifier
      Returns:
      the parsed literal
    • createOrGetXsdLiteral

      Literal<?> createOrGetXsdLiteral(String lexicalForm, XsdDataType dataType)
      Builds a literal from a lexical string and an XsdDataType.
      Parameters:
      lexicalForm - the lexical form to parse
      dataType - the target datatype
      Returns:
      the parsed literal
    • getNullLiteral

      Literal<?> getNullLiteral()
      Gets the null literal value.
      Returns:
      the null literal