Thanks, this is a good solution I think. I'll try it.

The final solution I came up with is:

Query query = cloud.createNodeQuery();
query.addStep(cloud.getNodeManager("A"));
query.addRelationStep(cloud.getNodeManager("A"), "related",
"destination");
cloud.getList(query);

This is more or less the same as you suggest and indeed has the
disadvantage that every relation that needs to be obtained results in
another database call. Putting relation numbers in a single constraint
is a good way to solve this.

Regards,
Ronald Wildenberg
 

> -----Oorspronkelijk bericht-----
> Van: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] Namens Rob van Maris
> Verzonden: donderdag 21 oktober 2004 14:22
> Aan: [EMAIL PROTECTED]
> Onderwerp: RE: Fetching relations from the MMBase cloud
> 
> My solution:
> NodeIterator iNodes= cloud.getList(null, "A,related,A", null, 
> null, null, null, "destination", false).nodeIterator();
> 
> Then iterate and retrieve the relation nodes one by one using:
> Node related = iNodes().nextNode().getNodeValue("related");
> 
> One problem may be that the second step may result in 
> separate queries for each relation that is retrieved. 
> This can be overcome by first collecting all the nodenumbers:
> int relatedNumber = iNodes.nextNode.getIntValue("related.number")
> 
> Then construct a commaseparated string of these numbers, and 
> retrieve all objects A in one go using a constraint like 
> "NUMBER in (...)".
> 
> Rob van Maris
> Technical Consultant
> 
> Quantiq
> xmedia & communication solutions
> 
> Koninginneweg 11-13
> 1217 KP Hilversum
>  
> T    +31 (0)356257211
> M    +31 (0)651444006
> E    [EMAIL PROTECTED]
> W   http://www.quantiq.com
> 
> 
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> On Behalf Of Ronald Wildenberg
> Sent: donderdag 21 oktober 2004 10:18
> To: [EMAIL PROTECTED]
> Subject: Fetching relations from the MMBase cloud
> 
> 
> Hi,
> 
> I have a problem retrieving relations from an MMBase cloud. I 
> have the following (simplified) cloud model:
> 
> A - related - A
> A - related - B
> 
> I wish to retrieve all 'related' relations between A and A. 
> 
> 
> 
> 


-----------------------Disclaimer-------------------------
Dit bericht (met bijlagen) is met grote zorgvuldigheid samengesteld. Voor mogelijke 
onjuistheid en/of onvolledigheid van de hierin verstrekte informatie kan Kennisnet 
geen aansprakelijkheid aanvaarden, evenmin kunnen aan de inhoud van dit bericht (met 
bijlagen) rechten worden ontleend. De inhoud van dit bericht (met bijlagen) kan 
vertrouwelijke informatie bevatten en is uitsluitend bestemd voor de geadresseerde van 
dit bericht. Indien u niet de beoogde ontvanger van dit bericht bent, verzoekt 
Kennisnet u dit bericht te verwijderen, eventuele bijlagen niet te openen en wijst 
Kennisnet u op de onrechtmatigheid van het gebruiken, kopiëren of verspreiden van de 
inhoud van dit bericht (met bijlagen).

This message (with attachments) is given in good faith. Kennisnet cannot assume any 
responsibility for the accuracy or reliability of the information contained in this 
message (with attachments), nor shall the information be construed as constituting any 
obligation on the part of Kennisnet. The information contained in this message (with 
attachments) may be confidential or privileged and is only intended for the use of the 
named addressee. If you are not the intended recipient, you are requested by Kennisnet 
to delete this message (with attachments) without opening it and you are notified by 
Kennisnet that any disclosure, copying or distribution of the information contained in 
this message (with attachments) is strictly prohibited and unlawful.
----------------------------------------------------------


Reply via email to