Reputation: 1345
When I run this query in the freebase query builder
[{
"/type/object/id": "/en/michael_jackson",
"/type/object/name": null,
"/type/object/type": "/music/artist",
"/music/artist/album": [{
"id": null,
"name": [],
"release_type!=": "Single",
"/music/album/primary_release": [{
"name": null,
"track_list": [{name:null}]
}]
}]
}];
I get back the proper results, with album and track listing but if change the query to
[{
"/type/object/id": "/en/carly_rae_jepsen",
"/type/object/name": null,
"/type/object/type": "/music/artist",
"/music/artist/album": [{
"id": null,
"name": [],
"release_type!=": "Single",
"/music/album/primary_release": [{
"name": null,
"track_list": [{name:null}]
}]
}]
}];
I dont get back anything. You can try both of these queries at http://www.freebase.com/queryeditor. Can somebody point out what am I doing wrong? Both of these are artist, so I should get back abum and track listing for Carly Rae Jepsen also.
Upvotes: 2
Views: 134
Reputation: 10540
Not all albums have a primary release recorded. Unless you really care about this, I'd loosen your constraints and use a query like this:
[{
"id": "/en/carly_rae_jepsen",
"name": null,
"type": "/music/artist",
"/music/artist/album": [{
"id": null,
"name": null,
"release_type!=": "Single",
"/music/album/releases": [{
"name": null,
"track_list": [{"name":null}]
}]
}]
}]
Some other tweaks to the query:
If you want the primary release if available, but not have it constrain your query, you can use "optional":true. You could get even fancier by sorting all releases by release date and only taking the first one (on the assumption that that's got a good chance of being the primary release).
The resulting query would look like this:
[{
"id": "/en/carly_rae_jepsen",
"name": null,
"type": "/music/artist",
"album": [{
"id": null,
"name": [],
"release_type!=": "Single",
"primary_release": [{
"optional": true,
"name": null,
"track_list": [{
"name": null
}]
}],
"releases": [{
"name": null,
"track_list": [{
"name": null
}],
"release_date": null,
"sort": "release_date",
"limit": 1
}]
}]
}]
Upvotes: 1