Retrieving/storing All related Actors in Freebase

跟風遠走 提交于 2019-12-04 18:44:18

You can do this all in a single MQL query with different subqueries for the directed/wrote/acted in properties. Just make sure you make each subquery optional.

For example:

[{
  "a:starring": {
    "actor": "Joe Pesci"
  },
  "b:starring": {
    "actor": "Robert De Niro"
  },
  "directed_by": [{
    "id": null,
    "name": null,
    "optional": true
  }],
  "produced_by": [{
    "id": null,
    "name": null,
    "optional": true
  }],
  "written_by": [{
    "id": null,
    "name": null,
    "optional": true
  }],
  "executive_produced_by": [{
    "id": null,
    "name": null,
    "optional": true
  }],
  "name": null,
  "mid": null,
  "starring": [{
    "actor": {
      "mid": null,
      "name": null
    }
  }],
  "type": "/film/film"
}]

I don't know MQL but standard SQL would be like this:

Select
p.Name + ' has worked with '+p2.name+' on the movie '+m.Name
from Person p
join Roles r on r.PersonId=p.Id
join Movie m on m.Id=r.MovieId
join Roles r2 on r.MovieId=m.Id and r2.Id <> r.Id
join Person p2 on p2.Id=r2.PersonId
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!