API result "Record"

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

When using the API modules to query for semantic data, different datatypes may have different output formats. This page gives an example for datatype "Record"Holds compound property values that consist of a short list of values with fixed type and order 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": "Soccer result",
                "key": "Soccer_result",
                "redi": "",
                "typeid": "_rec",
                "mode": 1,
                "format": ""
            }
        ],
        "results": {
            "Borussia M\u00f6nchengladbach": {
                "printouts": {
                    "Soccer result": [
                        {
                            "Soccer date": {
                                "label": "Soccer date",
                                "key": "Soccer_date",
                                "typeid": "_dat",
                                "item": [
                                    {
                                        "timestamp": "1538784000",
                                        "raw": "1/2018/10/6"
                                    }
                                ]
                            },
                            "Soccer home team": {
                                "label": "Soccer home team",
                                "key": "Soccer_home_team",
                                "typeid": "_wpg",
                                "item": [
                                    {
                                        "fulltext": "Bayern M\u00fcnchen",
                                        "fullurl": "https://www.semantic-mediawiki.org/wiki/Bayern_M%C3%BCnchen",
                                        "namespace": 0,
                                        "exists": "",
                                        "displaytitle": ""
                                    }
                                ]
                            },
                            "Soccer guest team": {
                                "label": "Soccer guest team",
                                "key": "Soccer_guest_team",
                                "typeid": "_wpg",
                                "item": [
                                    {
                                        "fulltext": "Borussia M\u00f6nchengladbach",
                                        "fullurl": "https://www.semantic-mediawiki.org/wiki/Borussia_M%C3%B6nchengladbach",
                                        "namespace": 0,
                                        "exists": "1",
                                        "displaytitle": ""
                                    }
                                ]
                            },
                            "Soccer homescore": {
                                "label": "Soccer homescore",
                                "key": "Soccer_homescore",
                                "typeid": "_num",
                                "item": [
                                    0
                                ]
                            },
                            "Soccer guestscore": {
                                "label": "Soccer guestscore",
                                "key": "Soccer_guestscore",
                                "typeid": "_num",
                                "item": [
                                    3
                                ]
                            }
                        },
                        {
                            "Soccer date": {
                                "label": "Soccer date",
                                "key": "Soccer_date",
                                "typeid": "_dat",
                                "item": [
                                    {
                                        "timestamp": "813628800",
                                        "raw": "1/1995/10/14"
                                    }
                                ]
                            },
                            "Soccer home team": {
                                "label": "Soccer home team",
                                "key": "Soccer_home_team",
                                "typeid": "_wpg",
                                "item": [
                                    {
                                        "fulltext": "Bayern M\u00fcnchen",
                                        "fullurl": "https://www.semantic-mediawiki.org/wiki/Bayern_M%C3%BCnchen",
                                        "namespace": 0,
                                        "exists": "",
                                        "displaytitle": ""
                                    }
                                ]
                            },
                            "Soccer guest team": {
                                "label": "Soccer guest team",
                                "key": "Soccer_guest_team",
                                "typeid": "_wpg",
                                "item": [
                                    {
                                        "fulltext": "Borussia M\u00f6nchengladbach",
                                        "fullurl": "https://www.semantic-mediawiki.org/wiki/Borussia_M%C3%B6nchengladbach",
                                        "namespace": 0,
                                        "exists": "1",
                                        "displaytitle": ""
                                    }
                                ]
                            },
                            "Soccer homescore": {
                                "label": "Soccer homescore",
                                "key": "Soccer_homescore",
                                "typeid": "_num",
                                "item": [
                                    1
                                ]
                            },
                            "Soccer guestscore": {
                                "label": "Soccer guestscore",
                                "key": "Soccer_guestscore",
                                "typeid": "_num",
                                "item": [
                                    2
                                ]
                            }
                        },
                        {
                            "Soccer date": {
                                "label": "Soccer date",
                                "key": "Soccer_date",
                                "typeid": "_dat",
                                "item": [
                                    {
                                        "timestamp": "1312675200",
                                        "raw": "1/2011/8/7"
                                    }
                                ]
                            },
                            "Soccer home team": {
                                "label": "Soccer home team",
                                "key": "Soccer_home_team",
                                "typeid": "_wpg",
                                "item": [
                                    {
                                        "fulltext": "Bayern M\u00fcnchen",
                                        "fullurl": "https://www.semantic-mediawiki.org/wiki/Bayern_M%C3%BCnchen",
                                        "namespace": 0,
                                        "exists": "",
                                        "displaytitle": ""
                                    }
                                ]
                            },
                            "Soccer guest team": {
                                "label": "Soccer guest team",
                                "key": "Soccer_guest_team",
                                "typeid": "_wpg",
                                "item": [
                                    {
                                        "fulltext": "Borussia M\u00f6nchengladbach",
                                        "fullurl": "https://www.semantic-mediawiki.org/wiki/Borussia_M%C3%B6nchengladbach",
                                        "namespace": 0,
                                        "exists": "1",
                                        "displaytitle": ""
                                    }
                                ]
                            },
                            "Soccer homescore": {
                                "label": "Soccer homescore",
                                "key": "Soccer_homescore",
                                "typeid": "_num",
                                "item": [
                                    0
                                ]
                            },
                            "Soccer guestscore": {
                                "label": "Soccer guestscore",
                                "key": "Soccer_guestscore",
                                "typeid": "_num",
                                "item": [
                                    1
                                ]
                            }
                        }
                    ]
                }
            }
        },
        "serializer": "SMW\\Serializers\\QueryResultSerializer",
        "version": 2,
        "meta": {
            "hash": "9be700bc86bc361e3519b012f5f7f5ca",
            "count": 1,
            "offset": 0,
            "source": "",
            "time": "0.016576"
        }
    }
}