Package org.rumbledb.context
Class Name
java.lang.Object
org.rumbledb.context.Name
- All Implemented Interfaces:
com.esotericsoftware.kryo.KryoSerializable
,Serializable
,Comparable<Name>
public class Name
extends Object
implements Comparable<Name>, Serializable, com.esotericsoftware.kryo.KryoSerializable
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 Summary
FieldsModifier and TypeFieldDescriptionstatic final String
static final String
static final Name
static final Name
static final Name
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final Name
static final Name
static final String
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddArityToFunctionName
(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.int
static Name
createTypeNameFromLiteral
(String prefixedName, StaticContext moduleContext) Creates an expanded name resolving the prefix from namespace bindings.static Name
Creates an expanded name that has the default annotations namespace.static Name
createVariableInDefaultFunctionNamespace
(String localName) Creates an expanded name that has the default JSONiq type namespace.static Name
createVariableInDefaultTypeNamespace
(String localName) Creates an expanded name that has the default JSONiq function namespace.static Name
static Name
createVariableInDefaultXQueryTypeNamespace
(String localName) static Name
createVariableInNoNamespace
(String localName) Creates an expanded name that has no namespace.static Name
createVariableResolvingPrefix
(String prefix, String localName, StaticContext moduleContext) Creates an expanded name resolving the prefix from namespace bindings.boolean
int
hashCode()
void
void
read
(com.esotericsoftware.kryo.Kryo kryo, com.esotericsoftware.kryo.io.Input input) toString()
Converts to a string.void
write
(com.esotericsoftware.kryo.Kryo kryo, com.esotericsoftware.kryo.io.Output output)
-
Field Details
-
JSONIQ_DEFAULT_TYPE_NS
- See Also:
-
JSONIQ_DEFAULT_FUNCTION_NS
- See Also:
-
FN_NS
- See Also:
-
JN_NS
- See Also:
-
MATH_NS
- See Also:
-
MAP_NS
- See Also:
-
ARRAY_NS
- See Also:
-
XS_NS
- See Also:
-
JS_NS
- See Also:
-
LOCAL_NS
- See Also:
-
AN_NS
- See Also:
-
DEFAULT_COLLATION_NS
- See Also:
-
CONTEXT_ITEM
-
CONTEXT_POSITION
-
CONTEXT_COUNT
-
TEMP_VAR1
-
TEMP_VAR2
-
-
Constructor Details
-
Name
public Name() -
Name
-
-
Method Details
-
createVariableInNoNamespace
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
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
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
-
createVariableInDefaultAnnotationsNamespace
Creates an expanded name that has the default annotations namespace. By default, in Rumble, unprefixed annotations live in this namespace. This namespace includes all builtin annotations.- Parameters:
localName
- the name of the variable- Returns:
- the expanded name
-
createVariableInDefaultXQueryTypeNamespace
-
createVariableInDefaultXQueryFunctionNamespace
-
createVariableResolvingPrefix
public static Name createVariableResolvingPrefix(String prefix, String localName, StaticContext moduleContext) Creates an expanded name resolving the prefix from namespace bindings.- Parameters:
prefix
- the prefixlocalName
- the local namemoduleContext
- the module context containing the bindings.- Returns:
- the expanded name.
-
createTypeNameFromLiteral
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
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
-
getNamespace
-
getPrefix
-
getLocalName
-
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. -
compareTo
- Specified by:
compareTo
in interfaceComparable<Name>
-
equals
-
hashCode
public int hashCode() -
write
public void write(com.esotericsoftware.kryo.Kryo kryo, com.esotericsoftware.kryo.io.Output output) - Specified by:
write
in interfacecom.esotericsoftware.kryo.KryoSerializable
-
read
public void read(com.esotericsoftware.kryo.Kryo kryo, com.esotericsoftware.kryo.io.Input input) - Specified by:
read
in interfacecom.esotericsoftware.kryo.KryoSerializable
-
precomputeHashCode
public void precomputeHashCode()
-