[Developers] querying a property in reverse
John Giannandrea
jg at metaweb.com
Wed Aug 29 04:22:38 UTC 2007
Augusto Callejas wrote:
> 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?
You can do this in a roundabout way, with something like this:
{
"query":[{
"/type/reflect/any_master":[{
"link":{
"master_property":{
"reverse_property":"/film/film/starring"
}
},
"name":"The Star Wars Holiday Special",
"type":"/film/film"
}],
"character":"Han Solo",
"type":"/film/performance"
}]
}
However this requires that you know which property is the master and
reverse
otherwise you would need two clauses mirroring each other.
Im curious about your use case that would know one property id but
not be able to find the inverse from the schema. Can you say a
little more
about how this situation would arise in your app?
-jg
More information about the Developers
mailing list