社交网络与网络隶属关系 [英] Social Networking & Network Affiliations

查看:142
本文介绍了社交网络与网络隶属关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为一个社交网络项目计划数据库,
偶然发现了这个URL,这是对Facebook的
模式的(粗略的)反向工程猜测:



http://www.flickr.com/photos/ikhnaton2 / 533233247 /



我感兴趣的是从属关系的概念,我试图让
充分了解它们的工作原理,从技术上来讲。我有点困惑的是
FacebookGroups, FacebookEvent和关联表中的NetworkID列(关联中的NID)。这些网络关联如何互连?



在我自己的项目中,我有一个简单的配置文件表:

 创建表[dbo]。[配置文件] (
[profileid] [int] IDENTITY(1,1)NOT NULL,
[userid] [uniqueidentifier] NOT NULL,
[username] [varchar](255)COLLATE Latin1_General_CI_AI NOT NULL ,
[应用程序名称] [varchar](255)收集Latin1_General_CI_AI NOT NULL,
[同义] [bit] NULL,
[lastactivity] [datetime] NULL,
[lastupdated] [datetime] NULL,
约束[PK__Profiles__1DB06A4F]主键聚集

[profileid] ASC
),并且(IGNORE_DUP_KEY = OFF)ON [PRIMARY],
CONSTRAINT [PKProfiles]唯一命名为

[用户名] ASC,
[应用程序名称] ASC
)与(IGNORE_DUP_KEY = OFF)开启[主]
)在[主要]

一个个人资料可以具有许多从属关系。一个从属关系可以具有许多配置文件。而且我希望以一种隶属关系之间的关联告诉我有关关联配置文件的方式进行设计。实际上,基于用户选择的从属关系,我想知道如何推断该人的尽可能多的事情。



我的问题是,我应该如何设计我的网络从属关系表,以及它们如何按照上述要求运行
?粗略的SQL模式会在
您的响应中得到赞赏。



预先感谢...

解决方案

首先,它是一个对象架构,而不是数据库架构。其次,它并没有显示所有内容,还远远不够完整。查看Schools班级(而不是表格),注意关系,高中1和2以及学校列表。您是否在Profile类中看到包含这些外键的属性。



您的问题无法正确回答



其次,为什么要关心它的facebook呢?第三范式不是妖术吗?没有您不知道的永远的迷失之宝。



您是否希望从属关系和个人资料之间存在多对多关系?或不?您是否正在尝试发现从属关系之间的相互依存关系?



为什么不只是问我们有关如何设计您想做的事情的具体问题?



EDIT




一个配置文件可以具有许多从属关系。一个从属关系可以具有许多配置文件。


这是一个多对多的关系。



在物理数据库中,您需要很多映射表。



最简单的是,它包含两个表的PK以及该表的列PK。



因此,现在只需将列添加到映射表即可。



开始日期=>配置文件添加的日期隶属关系



End_Date =>本质上是逻辑删除



关于关系,您还想知道什么? / p>

考虑这些对象
1.视频
2.承租人
3.商店



有很多对许多人可以说是出租。



VideoID,RenterID,StoreID和



关于租金您还想知道什么


  1. 日期(已签出)

  2. 归还日期

  3. 到期日期

  4. 折扣(例如,租金3免费获得1个,这是第四个或类似的东西)


I am in the process of planning a database for a social networking project and stumbled upon this url which is a (crude) reverse engineered guess at facebook's schema:

http://www.flickr.com/photos/ikhnaton2/533233247/

What is of interest to me is the notion of "Affiliations" and I am trying to fully understand how they work, technically speaking. Where I am somewhat confused is the NetworkID column in the FacebookGroups", "FacebookEvent", and "Affiliations" tables (NID in Affiliations). How are these network affiliations interconnected?

In my own project, I have a simple profile table:

CREATE TABLE [dbo].[Profiles](
    [profileid] [int] IDENTITY(1,1) NOT NULL,
    [userid] [uniqueidentifier] NOT NULL,
    [username] [varchar](255) COLLATE Latin1_General_CI_AI NOT NULL,
    [applicationname] [varchar](255) COLLATE Latin1_General_CI_AI NOT NULL,
    [isanonymous] [bit] NULL,
    [lastactivity] [datetime] NULL,
    [lastupdated] [datetime] NULL,
 CONSTRAINT [PK__Profiles__1DB06A4F] PRIMARY KEY CLUSTERED 
(
    [profileid] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY],
 CONSTRAINT [PKProfiles] UNIQUE NONCLUSTERED 
(
    [username] ASC,
    [applicationname] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]

One profile can have many affiliations. And one affiliation can have many profiles. And I would like to design it in such a way that relationships between affiliations tells me something about the associated profiles. In fact, based on the affiliations that users select, I would like to know how to infer as many things as possible about that person.

My question is, how should I be designing my network affiliation tables and how do they operate per my above requirements? A rough SQL schema would be appreciated in your response.

Thanks in advance...

解决方案

First off, it's an object schema not a database schema. Second, it's not showing everything, far from complete. Look at the Schools class (not table) notice the relations, high school 1 and 2 and school list. Do you see properties in the Profile class to hold those "Foreign Keys".

Your question cannot be answered accurately

Second, why care how facebook does it? Third Normal Form isn't a black art? There's no Tome of Lost and Gone Forever knowledge you're not privy to.

Do you want a many to many relationship between affiliations and profiles? Or Not? Are you attempting to uncover interdependencies between affiliations?

Why not just ask us specific questions about how to design what YOU want to do?

EDIT

One profile can have many affiliations. And one affiliation can have many profiles.

This is a many-to-many relationship.

In a physical database you need a many-many mapping table.

At it's simplest it contains the PK from both tables and those columns form that table's PK.

So now just add columns to the mapping table.

Start_date => date the profile added that affiliation

End_Date => essentially a logical delete

What else do you want to know about the Relationship.

Think about these objects 1. Video 2. Renter 3. Store

There's a many to many to many that was can describe as a RENTAL.

The VideoID, RenterID, StoreID,

What else do you want to know about a "RENTAL"

  1. Date (Checked out)
  2. Returned Date
  3. Due Date
  4. Discount (say it's rent 3 get 1 free and this is the fourth or something)

这篇关于社交网络与网络隶属关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆