Freebase 查询 - 排除某些值

发布于 2024-10-31 17:13:54 字数 399 浏览 1 评论 0原文

我想检索所有电影的名称及其类型。如果有关流派的信息为空也没关系,但如果流派已知,我想检索它。

"/film/film/genre": [{"id":null,"optional":"optional"}]

但我对同性恋色情不感兴趣,所以我想排除所有类型为“/en/gay_pornography”的电影。

"/film/film/genre": [{"id|=":["/en/gay_pornography"],"optional":"forbidden"}]

问题是,如何将其组合到一个查询中?即如何获取所有电影,即使是那些没有类型且排除 pr0n 的电影?

编辑:需要排除多种流派,例如/en/porngraphic_movie

I want to retrieve name of all movies and their genre. It's ok if information about genre is empty, but if genre is known I want to retrieve it.

"/film/film/genre": [{"id":null,"optional":"optional"}]

But I'm not interested in gay pornography, so I want to exclude all movies with genre "/en/gay_pornography".

"/film/film/genre": [{"id|=":["/en/gay_pornography"],"optional":"forbidden"}]

The problem is, how to combine it in one query? I.e. how to get all movies, even those with no genre and exclude pr0n?

Edit: it's required to exclude multiple genres, e.g. also /en/pornographic_movie

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

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

发布评论

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

评论(2

妖妓 2024-11-07 17:13:54

你基本上就在那里:你只需要两个“流派”子句。 MQL 允许您通过在任何子句上允许任意前缀来实现此目的:

[{
  "id":   null,
  "type": "/film/film",
  "genre": [{
    "id":       null,
    "optional": true
  }],
  "forbid:genre": {
    "id|=": [
      "/en/gay_pornography",
      "/en/pornographic_movie"
    ],
    "optional": "forbidden"
  }
}]​

http://tinyurl.com/4449ufg

You're basically there: you just need two "genre" clauses. MQL lets you do this by allowing arbitrary prefixes on any clause:

[{
  "id":   null,
  "type": "/film/film",
  "genre": [{
    "id":       null,
    "optional": true
  }],
  "forbid:genre": {
    "id|=": [
      "/en/gay_pornography",
      "/en/pornographic_movie"
    ],
    "optional": "forbidden"
  }
}]​

http://tinyurl.com/4449ufg

甜警司 2024-11-07 17:13:54

使用 "but not" 运算符:

 "genre": [{
    "id":       null,
    "id!=":     "/en/gay_pornography",
    "optional": true
  }]

完整示例:http://tinyurl.com/3tjdb4j

编辑:这不能回答问题。它只是阻止该特定 ID 被列为电影的类型,但并不禁止该电影。 @phillip-kendal 的答案是正确的。

Use the "but not" operator:

 "genre": [{
    "id":       null,
    "id!=":     "/en/gay_pornography",
    "optional": true
  }]

Full example: http://tinyurl.com/3tjdb4j

Edit: This doesn't answer the question. It just prevents that particular id from being listed as a genre of the film but doesn't forbid the film. @phillip-kendal's answer is correct.

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