Search code examples
jsonfreebasemql

Using FreeBase to retrieve sports teams by league


As shown here http://tinyurl.com/kw2z65f I am using the following query:

[{
  "type": "/sports/sports_team",
  "name": null,
  "limit": 300,
  "league": [{
    "type": "/sports/sports_league_participation",
    "name": null
  }]
}]

You'll see that it returns some of the following teams; however, I would like to filter it by league; I only want NBA basketball teams.

{
  "name": "Detroit Pistons",
  "league": [{
    "name": null,
    "type": "/sports/sports_league_participation"
  }],
  "type": "/sports/sports_team"
},
{
  "name": "Detroit Lions",
  "league": [
    {
      "name": null,
      "type": "/sports/sports_league_participation"
    },
    {
      "name": null,
      "type": "/sports/sports_league_participation"
    },
    {
      "name": null,
      "type": "/sports/sports_league_participation"
    }
  ],
  "type": "/sports/sports_team"
},
{
  "name": "Detroit Tigers",
  "league": [{
    "name": null,
    "type": "/sports/sports_league_participation"
  }],
  "type": "/sports/sports_team"
},
{
  "name": "Detroit Red Wings",
  "league": [{
    "name": null,
    "type": "/sports/sports_league_participation"
  }],
  "type": "/sports/sports_team"
},

Note: I have tried "name":"National Basketball Association", etc. but nothing seems to work.

How can I filter FreeBase by league?


Solution

  • Maybe this helps you

    [{
      "type": "/sports/sports_team",
      "name": null,
      "limit": 300,
      "league": [{
        "type": "/sports/sports_league_participation",
        "/sports/sports_league_participation/league": [{
          "name": "National Basketball Association"
        }]
      }]
    }]