Results 1 to 8 of 8
  1. #1
    Join Date
    Jul 2003
    Posts
    24

    Unanswered: Searching on friends, friends' friends, friends' friends' friends, ...

    Hi,

    I am facing a challenge problem (at least for me). I need to serach anyone in a personal network whom hobby is golf. A personal network is someone's friends, and his/her friends' friends, and his/her friends' friends' friends, and so on. This problem can be broken down into

    1.how to represent the graphs data type in RD
    2. how to search recursively

    Thanks for any input

    v.

  2. #2
    Join Date
    Dec 2003
    Location
    Oklahoma, USA
    Posts
    354
    Sounds like a hierarchical query problem. Look here for some help:

    http://download-west.oracle.com/docs...4a.htm#2053937

    JoeB

  3. #3
    Join Date
    Jul 2003
    Posts
    24
    Originally posted by joebednarz
    Sounds like a hierarchical query problem. Look here for some help:

    http://download-west.oracle.com/docs...4a.htm#2053937

    JoeB
    Thanks for the inforamtion. I don't have the access to Oracle site. From my studying, DB only can represents the type of relationship in an limited manner.

  4. #4
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    if you do not have access to the oracle site, you should get it

    it's free

    you should really know how oracle hierarchical queries work


    a comment about your search requirement

    if you store friends, and friends of friends, etc., but all you want is anyone who plays golf, why not just search the table?

    presumably people wouldn't even be in the table if they weren't somebody's friend



    rudy
    http://r937.com/

  5. #5
    Join Date
    Jul 2003
    Posts
    24
    I came out a solution that only store the relationship between two people if it exists. And the application will take care of join them together.

    I don't use Oracle at this moment for this project . The hierarchical query doesn't seem to be standard one.

  6. #6
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    true, the START WITH / CONNECT BY syntax is proprietary, only oracle supports it

    however, no other database (to my knowledge) supports recursion

    if you can restrict how many "levels" deep the relationships can go, you can obtain what you want with a multiple self-join using left outer joins

    see http://www.sitepointforums.com/showt...ted#post975494

    rudy

  7. #7
    Join Date
    Jul 2003
    Posts
    24
    Originally posted by r937
    true, the START WITH / CONNECT BY syntax is proprietary, only oracle supports it

    however, no other database (to my knowledge) supports recursion

    if you can restrict how many "levels" deep the relationships can go, you can obtain what you want with a multiple self-join using left outer joins

    see http://www.sitepointforums.com/showt...ted#post975494

    rudy
    I had been the point before. The situation is the recursion depth can't be restrict. It is no way I can go down the path.

  8. #8
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    well, in that case, you will have to (shock! horror!) run a query inside a loop!!

    all i can say is, good luck to you, sir


    rudy

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •