GetSchema
Retrieve schema information based on current data.
Parameters
- [optional] ref: Reference to other entities or connections within the transaction.
- [optional] type: This can be "entities", "connections", or "both". Default is set to "both" when not specified.
Details
If no parameters are provided, it returns refreshed schema information about entities and connections. This can be expensive when there is a sizeable amount of metadata.
Either ref or type can be specified. If the same ref value is used to represent searches on entities as well as connections in a transaction, the Schema will contain information from the entity search.
For more complex searches to find schema for, a Find command must be used first within the transaction. refresh is ignored for calls with ref. When a ref is specified, the schema of the requested objects will be computed (cached will not be used).
For each class of Entity, the following information is returned as a dictionary:
- matched: Number of objects that match the search.
- properties: List of properties for the class.
nullif no properties are defined.
For each class of Connection, the following information is returned as a dictionary:
- src: Source class of the connection.
- dst: Destination class of the connection.
- properties: List of properties for the connection.
nullif no properties are defined. - matched: Number of objects that match the search.
Each property of an Entity or Connection is reported as either the legacy
array [matched, indexed, type] or an object such as
{"count": 123, "type": "String"}. Clients should accept both formats.
- count (object) or matched (array): Number of objects with the property.
- type: Type for the property. See supported types.
- indexed (legacy array only): Whether any index kind is defined for the
property. The object form does not report this flag. Use :doc:
GetIndexesand its indexes field to inspect index kinds and parameters.
Examples
[{
"GetSchema": {
}
}]
Successful response:
[{
"GetSchema": {
"connections": {
"classes": {
"_BoundingBoxToImage": [{
"dst": "_Image",
"matched": 36781,
"properties": null,
"src": "_BoundingBox"
}],
"_DescriptorSetToDescriptor": [{
"dst": "_Descriptor",
"matched": 2165,
"properties": null,
"src": "_DescriptorSet"
}],
"_PolygonToImage": [{
"dst": "_Image",
"matched": 36335,
"properties": null,
"src": "_Polygon"
}],
"has_descriptor": [{
"dst": "_Descriptor",
"matched": 2165,
"properties": {
"corpus": [2165, false, "String"],
"yfcc_id": [2165, true, "Number"]
},
"src": "_Image"
}],
"segmentation": [{
"dst": "_Image",
"matched": 5000,
"properties": {
"corpus": [5000, false, "String"],
"id": [5000, true, "Number"]
},
"src": "_Image"
}]
},
"returned": 5
},
"entities": {
"classes": {
"_BoundingBox": {
"matched": 36781,
"properties": {
"_height": [36781, false, "Number"],
"_label": [36781, false, "String"],
"_width": [36781, false, "Number"],
"_x": [36781, false, "Number"],
"_y": [36781, false, "Number"],
"area": [36781, false, "Number"],
"area_perc": [36781, false, "Number"],
"bbox_id": [36781, true, "Number"],
"category_id": [36781, false, "Number"],
"corpus": [36781, false, "String"],
"image_id": [36781, false, "Number"],
"is_crowd": [36781, false, "Number"]
}
},
"_Descriptor": {
"matched": 2165,
"properties": {
"_label": [2165, false, "String"],
"corpus": [2165, false, "String"],
"yfcc_id": [2165, true, "Number"]
}
},
"_DescriptorSet": {
"matched": 1,
"properties": {
"_dimensions": [1, false, "Number"],
"_name": [1, true, "String"]
}
},
"_Image": {
"matched": 10000,
"properties": {
"aspect_ratio": [5000, false, "Number"],
"coco_url": [5000, false, "String"],
"corpus": [10000, false, "String"],
"date_captured": [5000, false, "Datetime"],
"file_name": [5000, false, "String"],
"flickr_url": [5000, false, "String"],
"height": [5000, false, "Number"],
"id": [5000, true, "Number"],
"license": [5000, false, "Number"],
"seg_id": [5000, true, "Number"],
"type": [5000, false, "String"],
"width": [5000, false, "Number"],
"yfcc_id": [5000, true, "Number"]
}
},
"_Polygon": {
"matched": 36335,
"properties": {
"_area": [36335, false, "Number"],
"_height": [36335, false, "Number"],
"_label": [36335, false, "String"],
"_polygons": [36335, false, "Blob"],
"_width": [36335, false, "Number"],
"_x": [36335, false, "Number"],
"_y": [36335, false, "Number"],
"ann_id": [36335, true, "Number"],
"category_id": [36335, false, "Number"],
"corpus": [36335, false, "String"],
"image_id": [36335, false, "Number"]
}
}
},
"returned": 5
},
"status": 0
}
}]
GetSchema command for polygons labeled "dog" that are greater than 10000 pixels in area:
[{
"FindPolygon": {
"_ref": 1,
"with_label": "dog",
"constraints": ["$_area", ">", 10000]
}
}, {
"GetSchema": {
"ref": 1
}
}]
Successful response:
[{
"FindPolygon": {
"returned": 0,
"status": 0
}
}, {
"GetSchema": {
"entities": {
"classes": {
"_Polygon": {
"matched": 131,
"properties": {
"_area": [131, false, "Number"],
"_height": [131, false, "Number"],
"_label": [131, false, "String"],
"_polygons": [131, false, "Blob"],
"_width": [131, false, "Number"],
"_x": [131, false, "Number"],
"_y": [131, false, "Number"],
"ann_id": [131, true, "Number"],
"category_id": [131, false, "Number"],
"corpus": [131, false, "String"],
"image_id": [131, false, "Number"]
}
}
},
"returned": 1
},
"status": 0
}
}]