Project

General

Profile

Query » History » Version 21

Alison Craig, 03/04/2015 01:53 PM

1 1 Alison Craig
Query
2
=====
3 19 Alison Craig
The Query parameter are named as an Interest
4 9 Alison Craig
5
    /<prefix>/query/<query-parameters>
6
7 18 Alison Craig
with a Data response of
8 6 Alison Craig
9 20 Alison Craig
    /<prefix>/query/<query-parameters>/<view>
10 15 Alison Craig
11
12 11 Alison Craig
For the Query Protocol, the user will send query parameters as a JSON list, with the format: <tt>{[field1]=[search1],[field2]=[search2],?=[search3]</tt>} where <tt>field1</tt> and <tt>field2</tt> are Name components, <tt>?</tt> indicates an autocomplete search, and <tt>search*</tt> is what to use for searching on. <i>(See [[Schema]])</i>
13 1 Alison Craig
14
In response, the Query backend of the Catalog will make Data available that includes a list of names that match the query.
15
16
----
17
18 13 Alison Craig
<b>JSON Schemas</b>
19 14 Alison Craig
20 13 Alison Craig
<b><i>JSON Query</i></b>
21 15 Alison Craig
The query name is formatted JSON stored in the query-parameters of the Interest:
22 1 Alison Craig
23 15 Alison Craig
     /<prefix>/query/<query-parameters>
24
25 13 Alison Craig
```
26 1 Alison Craig
27 13 Alison Craig
{
28
    "$schema": "http://json-schema.org/draft-04/schema#",
29 16 Anonymous
    "title": "catalog query",
30
    "type": "object",
31 13 Alison Craig
    "items": {
32 16 Anonymous
        "title": "query parameters",
33 13 Alison Craig
        "type": "object",
34
        "properties": {
35 16 Anonymous
            "name": {
36 13 Alison Craig
                "type": "string"
37
            },
38 16 Anonymous
            "activity": {
39 13 Alison Craig
                "type": "string"
40
            },
41 16 Anonymous
            "product": {
42 13 Alison Craig
                "type": "string"
43
            },
44 16 Anonymous
            "organization": {
45 13 Alison Craig
                "type": "string"
46
            },
47 16 Anonymous
            "model": {
48 13 Alison Craig
                "type": "string"
49
            },
50 16 Anonymous
            "experiment": {
51 13 Alison Craig
                "type": "string"
52
            },
53 16 Anonymous
            "frequency": {
54 13 Alison Craig
                "type": "string"
55
            },
56 1 Alison Craig
            "modeling realm": {
57
                "type": "string"
58
            },
59
            "variable name": {
60
                "type": "string"
61 13 Alison Craig
            },
62
            "ensemble member": {
63
                "type": "string"
64
            },
65 16 Anonymous
            "ensemble": {
66 13 Alison Craig
                "type": "string"
67 16 Anonymous
            },
68 17 Anonymous
            "sample granularity": {
69 13 Alison Craig
                "type": "string"
70 16 Anonymous
            },
71
            "start time": {
72 13 Alison Craig
                "type": "string"
73 16 Anonymous
            },
74
            "field campaign": {
75 13 Alison Craig
                "type": "string"
76
            },
77
            "optical properties for radiation": {
78
                "type": "string"
79
            },
80
            "grid resolution": {
81
                "type": "string"
82 16 Anonymous
            },
83
            "output type": {
84 13 Alison Craig
                "type": "string"
85
            },
86
            "timestamp": {
87
                "type": "string"
88
            },
89
            "?": {
90
                "description": "Autocomplete search field"
91
                "type": "string"
92
            }
93
        },
94
        "required": []
95 1 Alison Craig
    }
96
}
97
98
```
99
100
101 15 Alison Craig
<b><i>Query Results Data JSON</b></i>
102
With the query results, the Data returns the Query Results by using the query parameters (above) in the Name produced and a JSON Blob for the results: 
103 1 Alison Craig
104 20 Alison Craig
    /<prefix>/query/<query-parameters>/<view>
105 18 Alison Craig
106 20 Alison Craig
In addition, there is a view pair in the Name to indicate the results desired
107 15 Alison Craig
108
109
```
110
{
111
    "$schema": "http://json-schema.org/draft-04/schema#",
112
    "title": "Catalog Query Result",
113
    "type": "array",
114
    "items": {
115
        "title": "QueryResults",
116
        "type": "object",
117
        "properties": {
118
            "Length": {
119
                "description": "Total number of results"
120
                "type": "integer"
121
            },
122
            "View": {
123
               "minimum": 2
124
               "maximum": 2
125
               "description": "Pair of integers indicating which subset of the results we are receiving (first value being the lower index, second the upper index)" 
126
               "type": Array
127
            },
128
            "Results": {
129
               "description": "List of NDN names"
130
               "type": Array
131
            },
132
            "Next": {
133
                "description": "Autocomplete search potential next field(s)"
134 1 Alison Craig
                "type": Array
135
            }
136 20 Alison Craig
        },
137
        "required": [Length,View]
138
    },
139
    
140
}
141
```
142
143
<b><i>Query View Data JSON</b></i>
144 21 Alison Craig
145 20 Alison Craig
```
146
{
147
    "$schema": "http://json-schema.org/draft-04/schema#",
148
    "title": "Catalog Query Result",
149
    "type": "array",
150
    "items": {
151
        "title": "QueryView",
152
        "type": "object",
153
        "properties": {
154
            "Length": {
155
                "description": "Total number of results"
156
                "type": "integer"
157
            },
158
            "View": {
159
               "minimum": 2
160
               "maximum": 2
161
               "description": "Pair of integers indicating which subset of the results we are receiving (first value being the lower index, second the upper index)" 
162
               "type": Array
163
            },
164 15 Alison Craig
        },
165
        "required": [Length,View]
166
    },
167
    
168
}
169
```