Project

General

Profile

Query » History » Version 15

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

1 1 Alison Craig
Query
2
=====
3 8 Alison Craig
The Query parameter are named as
4 9 Alison Craig
5
    /<prefix>/query/<query-parameters>
6
7 15 Alison Craig
with a response of
8 6 Alison Craig
9 15 Alison Craig
    /<prefix>/query/<query-parameters>/output
10
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
    "title": "Catalog Query",
30
    "type": "array",
31
    "items": {
32
        "title": "QueryField",
33
        "type": "object",
34
        "properties": {
35
            "Name": {
36
                "type": "string"
37
            },
38
            "Activity": {
39
                "type": "string"
40
            },
41
            "Product": {
42
                "type": "string"
43
            },
44
            "Organization": {
45
                "type": "string"
46
            },
47
            "Model": {
48
                "type": "string"
49
            },
50
            "Experiment": {
51
                "type": "string"
52
            },
53
            "Frequency": {
54
                "type": "string"
55
            },
56
            "modeling realm": {
57
                "type": "string"
58
            },
59
            "variable name": {
60
                "type": "string"
61
            },
62
            "ensemble member": {
63
                "type": "string"
64
            },
65
            "Ensemble": {
66
                "type": "string"
67
            },"Sample Granularity": {
68
                "type": "string"
69
            },"Start Time": {
70
                "type": "string"
71
            },"field campaign": {
72
                "type": "string"
73
            },
74
            "optical properties for radiation": {
75
                "type": "string"
76
            },
77
            "grid resolution": {
78
                "type": "string"
79
            }"output type": {
80
                "type": "string"
81
            },
82
            "timestamp": {
83
                "type": "string"
84
            },
85
            "?": {
86
                "description": "Autocomplete search field"
87
                "type": "string"
88
            }
89
        },
90
        "required": []
91 1 Alison Craig
    }
92
}
93
94
```
95
96
97 15 Alison Craig
<b><i>Query Results Data JSON</b></i>
98
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: 
99 1 Alison Craig
100 15 Alison Craig
    /<prefix>/query/<query-parameters>/output
101
102
103
104
```
105
{
106
    "$schema": "http://json-schema.org/draft-04/schema#",
107
    "title": "Catalog Query Result",
108
    "type": "array",
109
    "items": {
110
        "title": "QueryResults",
111
        "type": "object",
112
        "properties": {
113
            "Length": {
114
                "description": "Total number of results"
115
                "type": "integer"
116
            },
117
            "View": {
118
               "minimum": 2
119
               "maximum": 2
120
               "description": "Pair of integers indicating which subset of the results we are receiving (first value being the lower index, second the upper index)" 
121
               "type": Array
122
            },
123
            "Results": {
124
               "description": "List of NDN names"
125
               "type": Array
126
            },
127
            "Next": {
128
                "description": "Autocomplete search potential next field(s)"
129
                "type": Array
130
            }
131
        },
132
        "required": [Length,View]
133
    },
134
    
135
}
136
```