This wiki is being moved to a new server and cannot be edited. Please sit tight. Thank you.

API result "Quantity"

From semantic-mediawiki.org
< API module "ask"
API module "ask"API result "Quantity"
Quantity
API result format for data type Quantity
Keywords
API · API module · API result · action ask · ask · action askargs · askargs · datatype Quantity

When using the API to query for semantic data, different datatypes may have different output formats. This page gives an example for datatype "Quantity"Holds values that describe quantities, containing both a number and a unit using API-module "ask"Allows to do ask queries. API-module "askargs"Allows to do ask queries with as little ask query specific syntax as possible however uses the same output format.

Example JSON result output[edit]

You can experiment with the api result output yourself by using the API Sandbox. The following example can be reproduced here.

{
    "query": {
        "printrequests": [
            {
                "label": "Has area",
                "key": "Has_area",
                "redi": "",
                "typeid": "_qty",
                "mode": 1,
                "format": ""
            }
        ],
        "results": {
            "Demo:Amsterdam": {
                "printouts": {
                    "Has area": [
                        {
                            "value": 219,
                            "unit": "km\u00b2"
                        }
                    ]
                }
            }
        },
        "serializer": "SMW\\Serializers\\QueryResultSerializer",
        "version": 2,
        "meta": {
            "hash": "b4abea6ee35b037b4c32ec181be89fdd",
            "count": 1,
            "offset": 0,
            "source": "",
            "time": "0.003392"
        }
    }
}