3

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!

kmc
  • 660
  • 13
  • 25

1 Answers1

1

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).

  • Cheers, eliminating film (and music) is what I ended up doing. Thanks for the other tips too. – kmc Aug 20 '11 at 12:30