Project

General

Profile

Actions

Query » History » Revision 20

« Previous | Revision 20/29 (diff) | Next »
Alison Craig, 03/04/2015 01:52 PM


Query

The Query parameter are named as an Interest

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

with a Data response of

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

For the Query Protocol, the user will send query parameters as a JSON list, with the format: {[field1]=[search1],[field2]=[search2],?=[search3]} where field1 and field2 are Name components, ? indicates an autocomplete search, and search* is what to use for searching on. (See Schema)

In response, the Query backend of the Catalog will make Data available that includes a list of names that match the query.


JSON Schemas

JSON Query
The query name is formatted JSON stored in the query-parameters of the Interest:

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

{
    "$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 Data JSON
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:

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

In addition, there is a view pair in the Name to indicate the results desired

{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "title": "Catalog Query Result",
    "type": "array",
    "items": {
        "title": "QueryResults",
        "type": "object",
        "properties": {
            "Length": {
                "description": "Total number of results"
                "type": "integer"
            },
            "View": {
               "minimum": 2
               "maximum": 2
               "description": "Pair of integers indicating which subset of the results we are receiving (first value being the lower index, second the upper index)" 
               "type": Array
            },
            "Results": {
               "description": "List of NDN names"
               "type": Array
            },
            "Next": {
                "description": "Autocomplete search potential next field(s)"
                "type": Array
            }
        },
        "required": [Length,View]
    },

}

Query View Data JSON

{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "title": "Catalog Query Result",
    "type": "array",
    "items": {
        "title": "QueryView",
        "type": "object",
        "properties": {
            "Length": {
                "description": "Total number of results"
                "type": "integer"
            },
            "View": {
               "minimum": 2
               "maximum": 2
               "description": "Pair of integers indicating which subset of the results we are receiving (first value being the lower index, second the upper index)" 
               "type": Array
            },
        },
        "required": [Length,View]
    },

}

Updated by Alison Craig about 9 years ago · 20 revisions