generated from ivoa-std/doc-template
-
Notifications
You must be signed in to change notification settings - Fork 6
/
appendix_json.tex
68 lines (55 loc) · 1.95 KB
/
appendix_json.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
\section{JSON encoding}
If it is required to write a MOC as an JSON string,
it is suggested to use the following syntax:
\par\noindent
\begin{lstlisting}[]
{ "order":[index,index,...], "order":[index, index...], ... }
\end{lstlisting}
As for the ASCII MOC serialization, if the best resolution
of the MOC (MOCORDER) is greater than the greatest stored order, the
MOCORDER should be provided with an empty index list.
\paragraph{Example of a JSON SMOC or TMOC:}
\par\noindent
\begin{lstlisting}[]
{"1":[1,2,4], "2":[12,13,14,21,23,25], "8":[]}
\end{lstlisting}
As with ASCII encoding, the differentiation of a spatial MOC from a temporal MOC could be done by prefixing the JSON MOC with an 's' or a 't' using a dedicated JSON hierarchy level. In the absence of this information, the nature of the MOC is determined by its context of use.
\begin{lstlisting}[]
{"t": {
"order":[index,index,...],
"order":[index, index...], ...
} }
\end{lstlisting}
or
\begin{lstlisting}[]
{"s": {
"order":[index,index,...],
"order":[index, index...], ...
} }
\end{lstlisting}
The coding of an STMOC will then be a list of couples (SMOC,TMOC) formalized in the following way:
\begin{lstlisting}[]
[
{"t": {
"order":[index,index,...],
"order":[index, index...], ... } },
{"s": {
"order":[index,index,...],
"order":[index, index...], ... } },
...
{"t": {
"order":[index,index,...],
"order":[index, index...], ... } },
{"s": {
"order":[index,index,...],
"order":[index, index...], ... } }
]
\end{lstlisting}
If the spatial or temporal orders of the highest \verb|"order":[index,index,...]| pair is lower than the respective spatial or temporal MOCORDER, then add an additional pair at the highest order with an empty index list.
\paragraph{Example of a JSON STMOC:}
\par\noindent
\begin{lstlisting}[]
[ { "t":{ "61":[0]}, "s":{ "29":[0,1,2]},
{ "t":{ "61":[2]}, "s":{ "28":[0]} },
{ "t":{ "61":[]}, "s":{ "29":[]} ]
\end{lstlisting}