Project

General

Profile

Actions

Query » History » Revision 25

« Previous | Revision 25/29 (diff) | Next »
Chengyu Fan, 07/16/2015 10:07 AM


Catalog Query API

Catalogs feature an NDN name-based query API to enable discovery.

Query Request

Catalog queries are expressed as a JSON Interest name component:

/<prefix>/query/<query-parameters>

Query parameters simultaneously support two types of queries:

  1. component type-based
  2. absolute prefix-based

The requestor will encode query parameters as a JSON object, with the format: {[field1]=[search1],[field2]=[search2],?=[search3]} where field1 and field2 are Name components. ? indicates an absolute prefix-based autocomplete search where search3 is the prefix. (See Schema)

Query Parameters Schema


{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "title": "catalog query",
    "type": "object",
    "items": {
        "title": "query parameters",
        "type": "object",
        "properties": {
            "name": {
                "type": "string"
            },
            "activity": {
                "type": "string"
            },
            "product": {
                "type": "string"
            },
            "organization": {
                "type": "string"
            },
            "model": {
                "type": "string"
            },
            "experiment": {
                "type": "string"
            },
            "frequency": {
                "type": "string"
            },
            "modeling realm": {
                "type": "string"
            },
            "variable name": {
                "type": "string"
            },
            "ensemble member": {
                "type": "string"
            },
            "ensemble": {
                "type": "string"
            },
            "sample granularity": {
                "type": "string"
            },
            "start time": {
                "type": "string"
            },
            "field campaign": {
                "type": "string"
            },
            "optical properties for radiation": {
                "type": "string"
            },
            "grid resolution": {
                "type": "string"
            },
            "output type": {
                "type": "string"
            },
            "timestamp": {
                "type": "string"
            },
            "?": {
                "description": "Autocomplete search field"
                "type": "string"
            }
        },
        "required": []
    }
}

Query Results

Catalogs answer queries with one or more Query Result Data packets. Each packet contains a JSON list of matching NDN name URIs
Query responses are Data containing a JSON list of matching name URIs. Each packet is named according to:

/<prefix>/query-results/<query-parameters>/<version>/<catalog-id>/<result-count>/<view-begin>/<view-end>

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).

Upon receiving an acceptably recent version response, requesters may iterate through subsequent views for the (specified catalog, version) pair.

Query Results Data JSON

{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "title": "Catalog Query Result",
    "type": "array",
    "items": {
        "title": "QueryResults",
        "type": "object",
        "properties": {
            "results": {
               "description": "List of NDN name URIs"
               "type": Array
            },
            "? next": {
                "description": "Autocomplete search potential next field(s)"
                "type": Array
            }
        },
        "required": []
    },

}

Updated by Chengyu Fan almost 9 years ago · 25 revisions