Class Name

java.lang.Object
org.rumbledb.context.Name
All Implemented Interfaces:
Serializable, Comparable<Name>

public class Name extends Object implements Comparable<Name>, Serializable
This class represents expanded names, corresponding to QNames in the W3C XQuery standard. An expanded name consists logically of a namespace (possibly absent) and a local name. A namespace may also have a proxy called a namespace prefix, used in lexical representation (e.g., name of the function or variable in JSONiq code). Expanded names serve as (global or local) variable names, function names, and error codes.
Author:
Ghislain Fourny
See Also:
  • Field Details

  • Constructor Details

  • Method Details

    • createVariableInNoNamespace

      public static Name createVariableInNoNamespace(String localName)
      Creates an expanded name that has no namespace. In JSONiq, unprefixed variables are never in a namespace.
      Parameters:
      localName - the name of the variable
      Returns:
      the expanded name
    • createVariableInDefaultTypeNamespace

      public static Name createVariableInDefaultTypeNamespace(String localName)
      Creates an expanded name that has the default JSONiq function namespace. By default, in Rumble, unprefixed function names live in this namespace. This namespace is for convenience and includes all functions in XQuery's fn namespace, JSONiq's jn (JSONiq core) and jnlib (JSONiq library) namespaces, as well as any user-defined functions with unprefixed names.
      Parameters:
      localName - the name of the variable
      Returns:
      the expanded name
    • createVariableInDefaultFunctionNamespace

      public static Name createVariableInDefaultFunctionNamespace(String localName)
      Creates an expanded name that has the default JSONiq type namespace. By default, in Rumble, unprefixed type names live in this namespace. This namespace is for convenience and includes all builtin XQuery and JSONiq functions.
      Parameters:
      localName - the name of the variable
      Returns:
      the expanded name
    • createNameInDefaultXQueryAnnotationsNamespace

      public static Name createNameInDefaultXQueryAnnotationsNamespace(String localName)
      Creates an expanded name that has the default XQuery annotations namespace. This is used for unprefixed annotations in XQuery.
      Parameters:
      localName - the name of the variable
      Returns:
      the expanded name
    • createNameInJsoniqAnnotationsNamespace

      public static Name createNameInJsoniqAnnotationsNamespace(String localName)
      Creates an expanded name that has the default JSONiq annotations namespace. This is used for implementation-defined JSONiq annotations in Rumble.
      Parameters:
      localName - the name of the annotation
      Returns:
      the expanded name
    • createVariableInDefaultBuiltinFunctionNamespace

      public static Name createVariableInDefaultBuiltinFunctionNamespace(String localName)
    • createVariableInDefaultXMLSchemaTypeNamespace

      public static Name createVariableInDefaultXMLSchemaTypeNamespace(String localName)
    • createVariableResolvingPrefix

      public static Name createVariableResolvingPrefix(String prefix, String localName, StaticContext moduleContext)
      Creates an expanded name resolving the prefix from namespace bindings.
      Parameters:
      prefix - the prefix
      localName - the local name
      moduleContext - the module context containing the bindings.
      Returns:
      the expanded name.
    • createTypeNameFromLiteral

      public static Name createTypeNameFromLiteral(String prefixedName, StaticContext moduleContext)
      Creates an expanded name resolving the prefix from namespace bindings.
      Parameters:
      prefixedName - the QName literal.
      moduleContext - the module context containing the bindings.
      Returns:
      the expanded name.
    • addArityToFunctionName

      public Name addArityToFunctionName(int arity)
      Converts the expanded name to an expanded name whose local name has a #n suffix, where n is the arity of the function, in order to encode the whole function identifier as an expanded name. This is only used to keep track of dependencies between functions and variables in the dependency resolution mechanism, and it should not be used for other purposes.
      Parameters:
      arity - the arity of the function.
      Returns:
      the expanded name
    • toString

      public String toString()
      Converts to a string. If there is a prefix, it is used. Otherwise, if there is a namespace, the Clark notation of the expanded name is returned. Otherwise, the local name is returned.
      Overrides:
      toString in class Object
      Returns:
      The converted string.
    • compareTo

      public int compareTo(Name o)
      Specified by:
      compareTo in interface Comparable<Name>