Query » History » Version 24
Chengyu Fan, 07/14/2015 01:35 PM
1 | 23 | Anonymous | # Catalog Query API |
---|---|---|---|
2 | 1 | Alison Craig | |
3 | 23 | Anonymous | Catalogs feature an NDN name-based query API to enable discovery. |
4 | 1 | Alison Craig | |
5 | 9 | Alison Craig | |
6 | 23 | Anonymous | ## Query Request |
7 | 1 | Alison Craig | |
8 | 23 | Anonymous | Catalog queries are expressed as a JSON <query-parameters> Interest name component: |
9 | 1 | Alison Craig | |
10 | 23 | Anonymous | /<prefix>/query/<query-parameters> |
11 | 1 | Alison Craig | |
12 | 23 | Anonymous | Query parameters simultaneously support two types of queries: |
13 | 1 | Alison Craig | |
14 | 23 | Anonymous | 1. component type-based |
15 | 2. absolute prefix-based |
||
16 | 14 | Alison Craig | |
17 | 23 | Anonymous | The requestor will encode query parameters as a JSON object, 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 absolute prefix-based autocomplete search where <tt>search3</tt> is the prefix. <i>(See [[Schema]])</i> |
18 | 15 | Alison Craig | |
19 | 23 | Anonymous | ### Query Parameters Schema |
20 | 15 | Alison Craig | |
21 | |||
22 | 13 | Alison Craig | ``` |
23 | 1 | Alison Craig | |
24 | 13 | Alison Craig | { |
25 | "$schema": "http://json-schema.org/draft-04/schema#", |
||
26 | 16 | Anonymous | "title": "catalog query", |
27 | "type": "object", |
||
28 | 13 | Alison Craig | "items": { |
29 | 16 | Anonymous | "title": "query parameters", |
30 | 13 | Alison Craig | "type": "object", |
31 | "properties": { |
||
32 | 16 | Anonymous | "name": { |
33 | 13 | Alison Craig | "type": "string" |
34 | }, |
||
35 | 16 | Anonymous | "activity": { |
36 | 13 | Alison Craig | "type": "string" |
37 | }, |
||
38 | 16 | Anonymous | "product": { |
39 | 13 | Alison Craig | "type": "string" |
40 | }, |
||
41 | 16 | Anonymous | "organization": { |
42 | 13 | Alison Craig | "type": "string" |
43 | }, |
||
44 | 16 | Anonymous | "model": { |
45 | 13 | Alison Craig | "type": "string" |
46 | }, |
||
47 | 16 | Anonymous | "experiment": { |
48 | 13 | Alison Craig | "type": "string" |
49 | }, |
||
50 | 16 | Anonymous | "frequency": { |
51 | 13 | Alison Craig | "type": "string" |
52 | }, |
||
53 | 1 | Alison Craig | "modeling realm": { |
54 | "type": "string" |
||
55 | }, |
||
56 | "variable name": { |
||
57 | "type": "string" |
||
58 | 13 | Alison Craig | }, |
59 | "ensemble member": { |
||
60 | "type": "string" |
||
61 | }, |
||
62 | 16 | Anonymous | "ensemble": { |
63 | 13 | Alison Craig | "type": "string" |
64 | 16 | Anonymous | }, |
65 | 17 | Anonymous | "sample granularity": { |
66 | 13 | Alison Craig | "type": "string" |
67 | 16 | Anonymous | }, |
68 | "start time": { |
||
69 | 13 | Alison Craig | "type": "string" |
70 | 16 | Anonymous | }, |
71 | "field campaign": { |
||
72 | 13 | Alison Craig | "type": "string" |
73 | }, |
||
74 | "optical properties for radiation": { |
||
75 | "type": "string" |
||
76 | }, |
||
77 | "grid resolution": { |
||
78 | "type": "string" |
||
79 | 16 | Anonymous | }, |
80 | "output type": { |
||
81 | 13 | Alison Craig | "type": "string" |
82 | }, |
||
83 | "timestamp": { |
||
84 | "type": "string" |
||
85 | 1 | Alison Craig | }, |
86 | 13 | Alison Craig | "?": { |
87 | 1 | Alison Craig | "description": "Autocomplete search field" |
88 | "type": "string" |
||
89 | } |
||
90 | }, |
||
91 | "required": [] |
||
92 | } |
||
93 | } |
||
94 | |||
95 | 13 | Alison Craig | ``` |
96 | |||
97 | |||
98 | 23 | Anonymous | ## Query Results |
99 | 1 | Alison Craig | |
100 | 23 | Anonymous | Catalogs answer queries with one or more Query Result Data packets. Each packet contains a JSON list of matching NDN name URIs |
101 | Query responses are Data containing a JSON list of matching name URIs. Each packet is named according to: |
||
102 | 1 | Alison Craig | |
103 | 24 | Chengyu Fan | /<prefix>/query-results/<query-parameters>/<version>/<catalog-id>/<view-begin>/<view-end>/<result-count> |
104 | 15 | Alison Craig | |
105 | 23 | Anonymous | Each Data packet represents a "view" of the complete result set. The Data's name specifies the begin and end range of the current view as well as the total number of matching results. The response set is versioned and uniquely identifies the catalog that produced it (e.g. identity key digest). |
106 | 1 | Alison Craig | |
107 | 23 | Anonymous | Upon receiving an acceptably recent version response, requesters may iterate through subsequent views for the (specified catalog, version) pair. |
108 | |||
109 | ### Query Results Data JSON |
||
110 | |||
111 | |||
112 | 20 | Alison Craig | ``` |
113 | { |
||
114 | "$schema": "http://json-schema.org/draft-04/schema#", |
||
115 | "title": "Catalog Query Result", |
||
116 | "type": "array", |
||
117 | "items": { |
||
118 | "title": "QueryResults", |
||
119 | "type": "object", |
||
120 | "properties": { |
||
121 | 23 | Anonymous | "results": { |
122 | "description": "List of NDN name URIs" |
||
123 | 20 | Alison Craig | "type": Array |
124 | }, |
||
125 | 23 | Anonymous | "? next": { |
126 | 20 | Alison Craig | "description": "Autocomplete search potential next field(s)" |
127 | "type": Array |
||
128 | } |
||
129 | 15 | Alison Craig | }, |
130 | "required": [] |
||
131 | }, |
||
132 | |||
133 | } |
||
134 | ``` |