This is tricky I've been playing with this recursive lookup query for a while trying to get it to work for multiple levels of hierarchy.
WITH RECURSIVE folders(communityid, lft,rgt, name, displayname, fullname) AS (
SELECT communityid, lft, rgt, name, displayname, 'http:// your root URl here /' || displayname || '/' AS fullname FROM jivecommunity
SELECT jc.communityid, jc.lft, jc.rgt, jc.name, jc.displayname, fullname || jc.displayname || '/'
FROM jivecommunity jc, folders f WHERE
jc.lft>f.lft AND jc.rgt<f.rgt
) SELECT * from folders ORDER BY fullname;
It works for spaces that are a couple of levels deep but anything more than three seems to fail. My alternative is to pull the space tree from jivecommunity with lft & rgh then adding in the top space manually.