在dgraph中书写社交媒体的图式

2024-09-26 22:44:20 发布

您现在位置:Python中文网/ 问答频道 /正文

我是dgraph的初学者,从neo4j转换到dgraph。我写的模式,我有不同的社交媒体平台的细节。你知道吗

考虑到facebook,这个模式将有基本的个人资料、群组、页面的细节,以及fb个人资料和群组、页面之间的不同关系

profile_a is 'friends_of' profile_b;
user 'likes' page_b;
user is 'member_of' group_a
user 'works_at' place_a

twitter也有类似的情况,它们的关系将在哪里

twitter_user 'follows' user_a
user_a 'followed_by' users

我这么做是为了什么

type Person{
        name: string @index(exact) .
        id: string @index(exact) .
        profile: string @index(exact) .
        picture_link: string .
        status_count: int .
        location: string .
        tags: string .
        user_id: int .
        follower_count: string .
        friend_count: string .
        type: int @index(exact) .   
        likes : [Page] .
        friends_of : [Fb_User] .
        members_of : [Group] .
        works_at : {
            name: string .
        }      
    }

    type Fb_User{
        name: string @index(exact) .
        id: string @index(exact) .
        profile: string @index(exact) .
        picture_link: string .
        status_count: int .
        location: string .
        type: int @index(exact) .  
        location: string .   
        tags: string .
        user_id: int .
    }

    type Group{
        name: string @index(exact) .
        id: string @index(exact) .
        profile: string @index(exact) .
        picture_link: string .
        group_member : int .

    }

    type Page{
        name: string @index(exact) .
        id: string @index(exact) .
        profile: string @index(exact) .
        picture_link: string .
        page_type : int .

    }

    type Facebook
     {  
        label: string @index(exact)  

    }

请指导和纠正我的架构结构。期待在pydgraph中实现

谢谢

得到了他的帮助 https://tour.dgraph.io/schema/1/

我期望一个模式能够通过python代码接受基本的细节和关系


Tags: ofnameidstringindextypecount模式

热门问题