简体   繁体   中英

MQL query to get all properties for the particular MID in Freebase

Take a look at this MID "/m/02r4n63" of freebase . Question is how to get all the properties related to this MID.
Freebase page for this MID.
I need to extract all the properties like director, producer, starring, etc from this page.

I tried these queries in endpoint

{
    "*": null,
    "type": "/film/film",
    "id": "/m/02r4n63"
}

Output of above query gives properties related to /film/film only and gives starring list as null .

I tried this one

[{
    "master_property": {
        "name": null,
        "id": null
    },
    "source": {
        "mid": "/m/02r4n63"
    },
    "target": null,
    "target_value": null,
    "type": "/type/link"
}]

Output of above query misses out /film/starring property.

I also tried

{
    "id": "/m/01jrbb",
    "/type/reflect/any_master": [{
        "id": null,
        "link": {
            "master_property": {
                "id": null,
                "name": null
            },
            "target": null,
            "target_value": null
        }
    }],
    "/type/reflect/any_value": [{
        "link": {
            "master_property": {
                "id": null,
                "name": null
            },
            "target": null,
            "target_value": null
        }
    }],
    "/type/reflect/any_reverse": [{
        "id": null,
        "link": {
            "master_property": {
                "reverse_property": {
                    "id": null,
                    "key": null,
                    "name": null
                }
            }
        }
    }]
}

But again it misses out properties like Description .

I want to cover all the properties. I tried the topic search API already. That's the output I want. But I want it through MQL query as I need the names of the properties too.

Help is highly appreciated.

The Topic API is the best way to get all information about a given topic:

https://www.googleapis.com/freebase/v1/topic/m/02r4n63

You can get the name of a property using MQL eg:

{
  "name": null,
  "id": "/film/film/starring"
}

which will return "Performances". Of course, these are mostly going to be properties that you've seen before, so you'll probably want to either cache them or just pre-populate a static list.

If you want "starring", you can just split the key returned and take the last slash (/) delimited segment.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM