freebaseapi中的条件查询

freebaseapi中的条件查询,freebase,Freebase,我希望从Freebase中提取旅游景点列表及其城市、州和国家信息。具有位置的属性为 “/location/location/containedby”。此对象有不同的类型,“位置/位置”或“/base/libraininess/bibs_location”。如果对象具有“/base/librainess/bibs_location”,我可以获取“city”、“state”等值。但是,如果对象只有类型“/location/location”,我需要转到并获取其“containedby”字段,然后重新

我希望从Freebase中提取旅游景点列表及其城市、州和国家信息。具有位置的属性为 “/location/location/containedby”。此对象有不同的类型,“位置/位置”或“/base/libraininess/bibs_location”。如果对象具有“/base/librainess/bibs_location”,我可以获取“city”、“state”等值。但是,如果对象只有类型“/location/location”,我需要转到并获取其“containedby”字段,然后重新执行上述逻辑

我的问题是我是否可以在Freebase中执行条件查询,比如type=“/location/location/”get xyz。如果类型==“/base/biblioness/bibs_location”获取abc

MQL:


MQL不支持条件逻辑,但您可以查询您可能感兴趣的所有信息,使子查询成为可选的,这样它们就不会过滤结果,然后查看您得到的结果。它需要在结果处理器中使用条件代码,但不必进行多次查询。例如,您可以查询多个级别的
/location/location/contained
,以及
/base/libraininess/bibs_location/state
和您想要的任何其他内容

不过,在你花太多时间做这件事之前,你可能需要检查一下
/base/libraininess/bibs_location
的人口分布情况。在我看来,它只有不到2K个实体

[{
  "type":   "/travel/tourist_attraction",
  "id":     null,
  "name":   null,
  "name~=": "^San Diego",
  "/location/location/containedby": {
    "type": "/base/biblioness/bibs_location",
    "name": null,
    "id":   null
  },
  "/location/location/geolocation": [{
    "id":        null,
    "latitude":  null,
    "longitude": null
  }]
}]