消除 any_reverse 反射的 MQL 结果

发布于 2024-11-30 15:20:56 字数 1476 浏览 0 评论 0原文

我试图将所有事件放在地理边界框中(大约覆盖法国),但我想排除所有重复发生的事件,所以我不会得到大量的法国网球公开赛等。为此,我在查询中使用了以下内容。

"/time/event/instance_of_recurring_event": {
    "id":    null,
    "optional": "forbidden"
}

但是,我注意到出现了戛纳电影节(每年的单独活动),因为它们没有设置 instance_of_recurring_event 属性。然而,我可以看到重复事件“戛纳电影节”与 2006 年、2007 年、2008 年(等)电影节活动有链接,所以我想我也许可以通过一些反思来消除它们。到目前为止我所得到的是:

[{
  "name": null,
  "id":   null,
  "/time/event/instance_of_recurring_event": {
    "id":       null,
    "optional": "forbidden"
  },
  "/time/event/locations": [{
    "geolocation": {
      "latitude>":  43.2,
      "latitude<":  49.68,
      "longitude>": -5.1,
      "longitude<": 7.27
    }
  }],
  "/type/reflect/any_reverse": [{
    "id":            null,
    "estimate-count": null,
    "name":          null,
    "/time/recurring_event/current_frequency": null
  }]
}]​

这让我看到2008年戛纳电影节与戛纳电影节主题相关联(每年重复一次),但我不知道是否有任何方法可以使用它来消除我的名单中的 2008 年戛纳电影节。这有道理吗?

尝试此处用于查询编辑器。

感谢您的帮助!

I'm trying to get all events in a geo bounding box (that approximately covers France), but I want to exclude all recurring events, so I don't get heaps of French Tennis opens and the like. For this I used the following in my query.

"/time/event/instance_of_recurring_event": {
    "id":    null,
    "optional": "forbidden"
}

However, I've noted Cannes film festivals appear (the individual events for each year), because they do not have the instance_of_recurring_event property set. I can however see that the Recurring Event "Cannes Film Festival" has links to the 2006, 2007, 2008 (etc) film festival events, so I thought I might be able to eliminate them using some reflection. What I have so far is:

[{
  "name": null,
  "id":   null,
  "/time/event/instance_of_recurring_event": {
    "id":       null,
    "optional": "forbidden"
  },
  "/time/event/locations": [{
    "geolocation": {
      "latitude>":  43.2,
      "latitude<":  49.68,
      "longitude>": -5.1,
      "longitude<": 7.27
    }
  }],
  "/type/reflect/any_reverse": [{
    "id":            null,
    "estimate-count": null,
    "name":          null,
    "/time/recurring_event/current_frequency": null
  }]
}]​

This allows me to see that the 2008 Cannes film festival is linked to by the Cannes Film Festival subject (that has a yearly recurrence), but I don't know if there's any way to use that to eliminate the 2008 Cannes film festival from my list. Does that make sense?

Try here for the query editor.

Thanks for any help!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

悍妇囚夫 2024-12-07 15:20:56

试试这个:http://tinyurl.com/3okuuzw

一些更改:

  1. 我添加了类型: /time/event 这样你就只能得到该类型的对象。在您的查询中,您没有受到类型限制,并且在 Freebase 中,您可以在没有类型的情况下断言对象上的属性。这是一个微小的更改,可能不会产生大的影响。

  2. 戛纳电影节所属的 /film/film_festival_event 类型有一个属性 /film/film_festival_event/festival 指向电影节系列。

我在查询末尾添加了一个子句,以排除具有该属性设置的对象,并假设它们是重复事件。

这仅适用于电影节,但您可以对其他属性重复使用相同的模式。

[{
  "name": null,
  "mid":   null,
  "type" :"/time/event",
  "/time/event/instance_of_recurring_event": {
    "id":       null,
    "optional": "forbidden"
  },
  "/time/event/locations": [{
    "geolocation": {
      "latitude>":  43.2,
      "latitude<":  49.68,
      "longitude>": -5.1,
      "longitude<": 7.27
    }
  }],
  "/film/film_festival_event/festival": [{
    "mid":            null,
    "optional": "forbidden",
    "limit" : 0
  }]
}]​

一些补充要点

:如果您想将标识符存储在数据库中或稍后以任何方式重新使用它们,您应该使用“mid”而不是“id”。 mid 是比 id 更强的标识符,因为它可以在合并和其他数据转换中幸存下来。询问 mid 而不是 id 也更快 - 当结果集很大时实际上会产生很大的差异。

b. "limit" : 0 表示“在结果中根本不返回此子句”。我认为您仍然需要 mid,因为您必须在具有其他指令的子句中至少拥有一个属性(在本例中为限制和可选)。

Try this: http://tinyurl.com/3okuuzw

A couple of changes:

  1. I added the type: /time/event so that you 'll only get objects of that type. In your query, you were not restricting by type, and in Freebase, you can assert a property on an object without the type. This is a minor change and probably won't have a big effect.

  2. The /film/film_festival_event type of which the Cannes festival is one has a property /film/film_festival_event/festival pointing to the festival series.

I added a clause at the end of the query to exclude objects that have that property set with the assumption that they are recurring events.

This will only work for film festivals, but you can re-use the same pattern for other properties.

[{
  "name": null,
  "mid":   null,
  "type" :"/time/event",
  "/time/event/instance_of_recurring_event": {
    "id":       null,
    "optional": "forbidden"
  },
  "/time/event/locations": [{
    "geolocation": {
      "latitude>":  43.2,
      "latitude<":  49.68,
      "longitude>": -5.1,
      "longitude<": 7.27
    }
  }],
  "/film/film_festival_event/festival": [{
    "mid":            null,
    "optional": "forbidden",
    "limit" : 0
  }]
}]​

Some additional points:

a. You should use "mid" instead of "id" if you want to store the identifiers in your db or re-use them in any way later. mid is a stronger identifier than id since it survives merges and other data transformations. It's also faster to ask for mid instead of id - actually makes a big difference when the result set is large.

b. "limit" : 0 says "don't return this clause at all in the results". I think you still need the mid because you have to have at least one property in a clause that has other directives (limit and optional in this case).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文