\hypertarget{autotoc_md561_src_plugins_reference_examples_alternative_README_md}{}\section{Example\+: Alternative References}\label{autotoc_md561_src_plugins_reference_examples_alternative_README_md}
For this example the following configuration is used\+:


\begin{DoxyCode}
; this example uses the ni plugin syntax
; 1. metadata
[rootkey/ref]
check/reference = recursive

[otherkey/newref]
check/reference = alternative

; 2. configuration data
rootkey/ref = ../otherkey

otherkey/ref = ../yetanotherkey
otherkey/newref = ../otherotherkey

otherotherkey/ref = ../nonexistent
otherotherkey/newref = ../mergekey

yetanotherkey/ref = ../mergekey
yetanotherkey/newref = ../nonexistent

mergekey/ref = ../finalkey
mergekey/newref = ../finalkey

finalkey = ""
\end{DoxyCode}


We mount it by executing\+:


\begin{DoxyCode}
cat << EOF > alternative.ini
; this example uses the ni plugin syntax
; 1. metadata
[rootkey/ref]
check/reference = recursive

[otherkey/newref]
check/reference = alternative

; 2. configuration data
rootkey/ref = ../otherkey

otherkey/ref = ../yetanotherkey
otherkey/newref = ../otherotherkey

otherotherkey/ref = ../nonexistent
otherotherkey/newref = ../mergekey

yetanotherkey/ref = ../mergekey
yetanotherkey/newref = ../nonexistent

mergekey/ref = ../finalkey
mergekey/newref = ../finalkey

finalkey = ""
EOF

kdb mount alternative.ini user:/tests/reference/alternative ni reference
\end{DoxyCode}


The file contains a specification, which marks {\ttfamily user\+:/tests/reference/alternative/rootkey/ref} as our root reference key and {\ttfamily user\+:/tests/reference/alternative/otherkey/newref} as an alternative reference.

The actual configuration contains then a structure which is processed by the plugin like follows\+:


\begin{DoxyEnumerate}
\item {\ttfamily user\+:/tests/reference/alternative/rootkey/ref} is read and its reference validated.
\item {\ttfamily user\+:/tests/reference/alternative/otherkey/ref} is read and its reference validated.
\item {\ttfamily user\+:/tests/reference/alternative/otherkey/newref} is discovered as an alternative reference and stored for later.
\item {\ttfamily user\+:/tests/reference/alternative/yetanotherkey/ref} is read and its reference validated.
\item {\ttfamily user\+:/tests/reference/alternative/mergekey/ref} is read and its reference validated.
\item {\ttfamily user\+:/tests/reference/alternative/finalkey} does not contain a reference, so we stop here.
\item Processing of the alternative reference chain from {\ttfamily user\+:/tests/reference/alternative/otherkey/newref} starts.
\item {\ttfamily user\+:/tests/reference/alternative/otherkey/newref} is read and its reference validated.
\item {\ttfamily user\+:/tests/reference/alternative/otherotherkey/newref} is read and its reference validated.
\item {\ttfamily user\+:/tests/reference/alternative/mergekey/newref} is read and its reference validated.
\item {\ttfamily user\+:/tests/reference/alternative/finalkey} does not contain a reference, so we stop here.
\end{DoxyEnumerate}

The resulting reference graph looks like this\+:



As you can see, the plugin completely ignores {\ttfamily user\+:/tests/reference/alternative/yetanotherkey/newref} as well as {\ttfamily user\+:/tests/reference/alternative/otherother/ref} and in turn does not throw an error because {\ttfamily user\+:/tests/reference/alternative/nonexistent} does not exist. However, the plugin does still exhaustively check both of the alternative reference chains. If you want to prohibit this, you can set the metakey {\ttfamily check/reference/restrict} to an empty value on whichever key you want to be a leaf node in the graph.

After we are done we can unmount the example with\+:


\begin{DoxyCode}
kdb umount user:/tests/reference/alternative
\end{DoxyCode}
 