{
   "$id": "http://example.com/example.json",
   "type": "object",
   "properties": {
      "query": {
         "$id": "/properties/query",
         "type": "object",
         "description": "Object that contains the information of a glycan query. Each piece of information in the query is optional however one piece must be present for a meaning full search. In later versions it will be possible to combine query objects using logical operations (AND, OR, NOT).",
         "properties": {
            "operation": {
               "$id": "/properties/query/properties/operation",
               "type": "string",
               "description": "his fields defines how the different parts/searches of the query are combined. Possible values are AND and OR. The default will be AND.",
               "examples": [
                  "AND"
               ]
            },
            "query_type": {
               "$id": "/properties/query/properties/query_type",
               "type": "string",
               "description": "This field is set if a search by glycan type (e.g. N-Glycan) will be performed. The complete list of glycan types is maintained by the glygen server.",
               "examples": [
                  "search_glycan"
               ]
            },
            "execution_time": {
               "$id": "/properties/query/properties/execution_time",
               "type": "string",
               "format": "date-time",
               "description": "The time when was query executed. Format is ISO8601 (yyyy-mm-ddThh:mm:ss.nnnnnn+|-hh:mm)",
               "examples": [
                  "2018-12-30T12:30:60.002658+06:00"
               ]
            },
            "mass_type": {
               "$id": "/properties/query/properties/mass_type",
               "type": "string",
               "description": "This field is set if a search by glycan mass is performed. Possible values are Native and Permethylated. The default will be Native.",
               "examples": [
                  "Native",
                  "Permethylated"
               ]
            },
            "mass": {
               "$id": "/properties/query/properties/mass",
               "type": "object",
               "description": "This objects is specified if a search by native glycan mass is performed. The search query consists of a minimum mass (glycan has to have equal or larger mass) and a maximum mass (glycan has to have equal or smaller mass). That way it defines an mass range to be searched.",
               "properties": {
                  "min": {
                     "$id": "/properties/query/properties/mass/properties/min",
                     "type": "integer",
                     "description": "Minimum value of the mass range.",
                     "default": 0,
                     "examples": [
                        100
                     ]
                  },
                  "max": {
                     "$id": "/properties/query/properties/mass/properties/max",
                     "type": "integer",
                     "description": "Maximum value of the mass range.",
                     "examples": [
                        6900
                     ]
                  }
               },
               "required": [
                  "min",
                  "max"
               ]
            },
            "number_monosaccharides": {
               "$id": "/properties/query/properties/number_monosaccharides",
               "type": "object",
               "description": "This objects is specified if a search by number of monosaccharides is performed. The search query consists of a minimum and a maximum value. That way it defines an range to be searched.",
               "properties": {
                  "min": {
                     "$id": "/properties/query/properties/number_monosaccharides/properties/min",
                     "type": "integer",
                     "description": "Minimum number of monosaccharides.",
                     "default": 1,
                     "examples": [
                        10
                     ]
                  },
                  "max": {
                     "$id": "/properties/query/properties/number_monosaccharides/properties/max",
                     "type": "integer",
                     "description": "Maximum number of monosaccharides.",
                     "examples": [
                        69
                     ]
                  }
               },
               "required": [
                  "min",
                  "max"
               ]
            },
            "glycan_type": {
               "$id": "/properties/query/properties/glycan_type",
               "type": "string",
               "description": "This field is set if a search by glycan type (e.g. N-Glycan) will be performed. The complete list of glycan types is maintained by the glygen server.",
               "examples": [
                  "N-linked"
               ]
            },
            "glycan_subtype": {
               "$id": "/properties/query/properties/glycan_subtype",
               "type": "string",
               "description": "This field is set if a search by glycan subtype (e.g. bisection) will be performed. The complete list of glycan subtypes is maintained by the glygen server. This field can be used intependendly from g"
            },
            "organism": {
               "$id": "/properties/query/properties/organism",
               "type": "object",
               "description": "This field is set if a search by organism (e.g. human) is performed. The value can either be a scientific species name (NCBI Taxonomy), a synonym or a NCBI Taxonomy ID.",
               "properties": {
                  "operation": {
                     "$id": "/properties/query/properties/organism/properties/operation",
                     "type": "string",
                     "description": "Specifies type of operation to perform.",
                     "default": "AND",
                     "examples": [
                        "AND",
                        "OR"
                     ]
                  },
                  "subsumption": {
                     "$id": "/properties/query/properties/organism/properties/supsumption",
                     "type": "boolean",
                     "description": "This field value indicates whether to include subsumption inferred species in the result or not. true - include subsumption inferred species in the result. false - do not include subsumption inferred species in the result.",
                     "examples": [
                        true,
                        false
                     ]
                  },
                  "organism_list": {
                     "$id": "/properties/query/properties/organism/properties/organism_list",
                     "type": "array",
                     "description": "List of organisms.",
                     "items": {
                        "$id": "/properties/query/properties/organism/properties/organism_list/items",
                        "type": "object",
                        "properties": {
                           "id": {
                              "$id": "/properties/query/properties/organism/properties/organism_list/items/properties/id",
                              "type": "integer",
                              "description": "The value can be a NCBI Taxonomy ID.",
                              "examples": [
                                 "9606",
                                 "10090"
                              ]
                           },
                           "name": {
                              "$id": "/properties/query/properties/organism/properties/organism_list/items/properties/name",
                              "type": "string",
                              "description": "The value can be a scientific species name.",
                              "examples": [
                                 "Homo sapiens",
                                 "Mus musculus"
                              ]
                           }
                        }
                     }
                  }
               }
            },
            "protein": {
               "$id": "/properties/query/properties/protein",
               "type": "string",
               "description": "This field is set if a search for glycans attached to a protein is performed. The input is a Uniprot protein ID.",
               "examples": [
                  "P01234"
               ]
            },
            "glycan_motif": {
               "$id": "/properties/query/properties/glycan_motif",
               "type": "string",
               "description": "This field is set if a search by glycan motif is performed (e.g. LewisX). All structures containing this motif will be found.",
               "examples": [
                  "LewisX"
               ]
            },
            "glycan": {
               "$id": "/properties/query/properties/glycan",
               "type": "object",
               "description": "This field is set if a search by glycan ID is performed.",
               "properties": {
                  "id": {
                     "$id": "/properties/query/properties/glycan/properties/id",
                     "type": "string",
                     "description": "This field is set if a search by glycan ID is performed. Either an intact ID or multiple comma separated IDs can be specified. The intact ID will lead to a single result while multiple comma separated IDs might lead to many result",
                     "examples": [
                        "G17689DH",
                        "G17689DH,G97894OW,G50264UK,G87648PY,G10581YA",
                        "carbNlink_45432_D000",
                        "carbNlink_45432_D000,18274,G01687",
                        "carbNlink_45432_D000,18274,G01687,G17689DH,G97894OW,G50264UK,G87648PY,G10581YA",
                        "G17689DH,G97894OW,G50264UK,G87648PY,G10581YA,carbNlink_45432_D000,18274,G01687",
                        "G17689DH,carbNlink_45432_D000,G97894OW,18274,G50264UK,G01687,G87648PY,G10581YA",
                        "carbNlink_45432_D000,G17689DH,18274,G97894OW,G01687,G87648PY"
                     ]
                  },
                  "subsumption": {
                     "$id": "/properties/query/properties/glycan/properties/supsumption",
                     "type": "integer",
                     "description": "This field value indicates whether to include glycan subsumption in the result or not. 1 - include subsumption values in the result. 0 - do not include subsumption values in the result.",
                     "examples": [
                        1,
                        0
                     ]
                  }
               }
            },
            "version": {
               "$id": "/properties/query/properties/version",
               "type": "string",
               "description": "The version of the query.",
               "examples": [
                  "1.2"
               ]
            },
            "enzyme": {
               "$id": "/properties/query/properties/enzyme",
               "type": "object",
               "description": "This field is set if a search for glycans synthesised by a certain enzyme is performed. The input is an object that consists of an ID and a type.",
               "properties": {
                  "id": {
                     "$id": "/properties/query/properties/enzyme/properties/id",
                     "type": "string",
                     "description": "ID of the enzyme this can either be a Uniprot ID (type=protein) or a gene name (type=gene).",
                     "examples": [
                        "MGAT2"
                     ]
                  },
                  "type": {
                     "$id": "/properties/query/properties/enzyme/properties/type",
                     "type": "string",
                     "description": "Type of the enzyme input. This can either be a gene or a protein",
                     "examples": [
                        "gene"
                     ]
                  }
               },
               "required": [
                  "id",
                  "type"
               ]
            },
            "composition": {
               "$id": "/properties/composition",
               "type": "array",
               "description": "The list of residues of the glycan.",
               "items": {
                  "$id": "/properties/composition/properties/residues/items/",
                  "type": "object",
                  "properties": {
                     "residue": {
                        "$id": "/properties/composition/properties/residues/items/properties/residue",
                        "type": "string",
                        "description": "This is the name of residue.",
                        "examples": [
                           "hex"
                        ]
                     },
                     "min": {
                        "$id": "/properties/composition/properties/residues/items/properties/min",
                        "type": "integer",
                        "description": "Minimum number of residue.",
                        "examples": [
                           1
                        ]
                     },
                     "max": {
                        "$id": "/properties/composition/properties/residues/items/properties/max",
                        "type": "integer",
                        "description": "Maximum number of residue.",
                        "examples": [
                           10
                        ]
                     }
                  },
                  "required": [
                     "residue",
                     "min",
                     "max"
                  ]
               }
            }
         },
         "required": [
            "operation",
            "query_type",
            "execution_time",
            "version"
         ]
      },
      "pagination": {
         "$id": "/properties/pagination",
         "type": "object",
         "properties": {
            "offset": {
               "$id": "/properties/pagination/properties/offset",
               "type": "integer",
               "description": "Start address of subset. This number specifies the first result to be included.",
               "default": 1,
               "examples": [
                  1
               ]
            },
            "limit": {
               "$id": "/properties/pagination/properties/limit",
               "type": "integer",
               "description": "Number of results in the subset. For example offset=11 and limit=30 will result in a subset from entry 11 to 40.",
               "default": 10,
               "examples": [
                  10
               ]
            },
            "total_length": {
               "$id": "/properties/pagination/properties/total_length",
               "type": "integer",
               "description": "Total number of results in the search result list.",
               "examples": [
                  19
               ]
            },
            "sort": {
               "$id": "/properties/pagination/properties/sort",
               "type": "string",
               "description": "This field is optional if not provided backend will decide sorting logic. Specifies which criteria was used to sort the list. Possible values are glycan id, mass, number_enzymes, number_proteins, number_sugar",
               "default": "id",
               "examples": [
                  "id"
               ]
            },
            "order": {
               "$id": "/properties/pagination/properties/order",
               "type": "string",
               "description": "Sort direction of the total result set. Possible values are asc and desc.",
               "default": "asc",
               "examples": [
                  "asc"
               ]
            }
         },
         "required": [
            "offset",
            "limit",
            "total_length",
            "order"
         ]
      },
      "results_history": {
         "$id": "/properties/results_history",
         "type": "array",
         "description": "A list of objects each representing an entry in the results history list.",
         "items": {
            "$id": "/properties/results_history/items",
            "type": "object",
            "properties": {
               "execution_time": {
                  "$id": "/properties/results_history/items/properties/execution_time",
                  "type": "string",
                  "description": "Time stamp at which time the result set was generated. This field uses ISO 8601 pattern: YYYY-MM-DDThh:mm:ss+-hh.",
                  "examples": [
                     "2008-09-15T15:53:00+05:00"
                  ]
               },
               "result_count": {
                  "$id": "/properties/results_history/items/properties/result_count",
                  "type": "number",
                  "description": "Total result count.",
                  "examples": [
                     5000
                  ]
               }
            },
            "required": [
               "execution_time",
               "result_count"
            ]
         }
      },
      "query_error": {
         "$id": "/properties/query_error",
         "type": "array",
         "description": "A list of objects each representing an entry in the query error list.",
         "items": {
            "$id": "/properties/query_error/items",
            "type": "object",
            "properties": {
               "key": {
                  "$id": "/properties/query_error/items/properties/key",
                  "type": "string",
                  "description": "This field specifies key name.",
                  "examples": [
                     "glytoucan_ac"
                  ]
               },
               "value": {
                  "$id": "/properties/query_error/items/properties/value",
                  "type": "string",
                  "description": "This field specifies value of the key.",
                  "examples": [
                     "G89290XU"
                  ]
               }
            },
            "required": [
               "key",
               "value"
            ]
         }
      },
      "results": {
         "$id": "/properties/results",
         "type": "array",
         "items": {
            "$id": "/properties/results/items",
            "type": "object",
            "properties": {
               "id": {
                  "$id": "/properties/results/items/properties/id",
                  "type": "string",
                  "description": "GlyTouCan accession number of the glycan.",
                  "examples": [
                     "G89290XU"
                  ]
               },
               "mass": {
                  "$id": "/properties/results/items/properties/mass",
                  "type": "number",
                  "description": "The mass number of the glycan.",
                  "examples": [
                     1502.5
                  ]
               },
               "mass_pme": {
                  "$id": "/properties/results/items/properties/mass_pme",
                  "type": "number",
                  "description": "The pMe mass number of the glycan.",
                  "examples": [
                     1802.5
                  ]
               },
               "number_proteins": {
                  "$id": "/properties/results/items/properties/number_proteins",
                  "type": "integer",
                  "title": "The Number_proteins Schema ",
                  "description": "The number of glycoproteins that contain the Glycan.",
                  "default": 0,
                  "examples": [
                     12
                  ]
               },
               "number_monosaccharides": {
                  "$id": "/properties/results/items/properties/number_monosaccharides",
                  "type": "integer",
                  "description": "The number of sugar in the glycan.",
                  "default": 0,
                  "examples": [
                     10
                  ]
               },
               "number_enzymes": {
                  "$id": "/properties/results/items/properties/number_enzymes",
                  "type": "integer",
                  "description": "The number of enzymes annonated as involved in the biosynthesis of the glycan.",
                  "default": 0,
                  "examples": [
                     10
                  ]
               },
               "iupac": {
                  "$id": "/properties/results/items/properties/iupac",
                  "type": "string",
                  "description": "IUPAC sequence of the glycan. This sequence may not always be present since not all glycans can be represented in IUPAC.",
                  "examples": [
                     "alpha-D-Manp-(1->3)[alpha-D-Manp-(1->6)]-beta-D-Manp-(1->4)-beta-D-GlcpNAc-(1->4)[beta-L-Fucp-(1->3)]-beta-D-GlcpNAc(1->"
                  ]
               },
               "glycoct": {
                  "$id": "/properties/results/items/properties/glycoct",
                  "type": "string",
                  "description": "GlycoCT sequence of the glycan. This sequence may not always be present.",
                  "examples": [
                     "RES\n1b:b-dglc-HEX-1:5\n2s:n-acetyl\n3b:b-lgal-HEX-1:5|6:d\n4b:b-dglc-HEX-1:5\n5s:n-acetyl\n6b:b-dman-HEX-1:5\n7b:a-dman-HEX-1:5\n8b:a-dman-HEX-1:5\nLIN\n1:1d(2+1)2n\n2:1o(3+1)3d\n3:1o(4+1)4d\n4:4d(2+1)5n\n5:4o(4+1)6d\n6:6o(3+1)7d\n7:6o(6+1)8d"
                  ]
               }
            },
            "required": [
               "id",
               "number_proteins",
               "number_enzymes"
            ]
         }
      }
   }
}
