[Developers] querying a property in reverse

Augusto Callejas acallejas at appliedminds.com
Tue Aug 28 23:45:57 UTC 2007


hi-

consider a simple query between a film and performance.
i can either query from the film and work my way to the performance:

{
  "query":[{
    "name":"The Star Wars Holiday Special",
    "starring":[{
      "character":"Han Solo",
      "type":"/film/performance"
    }],
    "type":"/film/film"
  }]
}

or query from the performance and work my way to the film:

{
  "query":[{
    "character":"Han Solo",
    "film":[{
      "name":"The Star Wars Holiday Special",
      "type":"/film/film"
    }],
    "type":"/film/performance"
  }]
}

however, say i want to always want to start from the performance,
but i don't know the relationship from performance to film is "film" but i
know the relationship from film to performance is "starring".  how can i
query on the "starring" property but in reverse without having to perform a
separate query for the reverse property?  ideally, it would be nice to be
able to query like this:

{
  "query":[{
    "character":"Han Solo",
    "reverse(starring)":[{
      "name":"The Star Wars Holiday Special",
      "type":"/film/film"
    }],
    "type":"/film/performance"
  }]
}

where "reverse(starring)" equals "film".

thanks,
augusto.




More information about the Developers mailing list