Hi,
The short answer is that you can't do it directly. The idea is that the parent P, as scripting object, should declare the corresponding methods to retrieve the specific child objects X, Y and X to be used directly from scripting: P.getChildrenX(), P.getChildrenY() and P.getChildrenZ(). And then your findRelation method implementation could be based on those methods.
But in case you implemented the findRelation first and you don't want to declare those methods on your objects, then you could adapt your implementation of the findAll(String type, String query) method to accept as a query the parent object P (a string representation with the type and the id basically) and then from that point you can invoke your findRelation(...) method. And you can access to it from scripting with Server.findAllForType(type of X, string representation of P).
Nevertheless, it's recommended to provide a rich API for your plug-in objects, as it will be better for the final users.
I hope it helps.
Sergio