Project

General

Profile

Query » History » Version 22

Alison Craig, 03/04/2015 01:54 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
            "Results": {
119
               "description": "List of NDN names"
120
               "type": Array
121
            },
122
            "Next": {
123
                "description": "Autocomplete search potential next field(s)"
124
                "type": Array
125 1 Alison Craig
            }
126
        },
127 22 Alison Craig
        "required": []
128 20 Alison Craig
    },
129
    
130
}
131
```
132
133
<b><i>Query View Data JSON</b></i>
134 21 Alison Craig
135 20 Alison Craig
```
136
{
137
    "$schema": "http://json-schema.org/draft-04/schema#",
138
    "title": "Catalog Query Result",
139
    "type": "array",
140
    "items": {
141
        "title": "QueryView",
142
        "type": "object",
143
        "properties": {
144
            "Length": {
145
                "description": "Total number of results"
146
                "type": "integer"
147
            },
148
            "View": {
149
               "minimum": 2
150
               "maximum": 2
151
               "description": "Pair of integers indicating which subset of the results we are receiving (first value being the lower index, second the upper index)" 
152
               "type": Array
153
            },
154 15 Alison Craig
        },
155
        "required": [Length,View]
156
    },
157
    
158
}
159
```