OO world-confused

Source: Internet
Author: User

I recently read OODBS and thought about how to describe a real world. Then I am confused.

Write and think about the process:

Consider a simple class Person.

Class Person
{
String Name;
List <Person> Friend;
}

 

However, this does not take into account the degree of association between an object's attributes and objects, such as the difference between a good friend and a general friend. The associated class is introduced as follows:

Class Friend
{
Person person1;
Person person2; // after this parameter is added, the relationship "Friend" can exist independently of "Person" (because the information is full), that is, associating Relation becomes a basic element.
Int Rate;
}
Class Person
{
String Name;
List <Friend> Friend;
}

 

Without losing its universality, the world is like this:

Class Entity
{
List <Relation> Relation; List <Attribute> Attribute;
List <Func> Method;
}
Class Relation
{List <Entity> Entity; List <Attribute> Attribute; // like Rate = 0.5}

The E-R model.

Func hasn't figured it out yet. Maybe you can write a delegate that limits the object type. It's just writing a function pointer.

The specific functions you want to implement have not been figured out yet, but there are still some simple ideas, such as implementation:

Person p;
Var result = p. get ("Friend "). where (x => x. get ("Birthday "). get ("Year") = 2000 );. get ("Friend "). where (x => x. get ("Name "). contain ("Bob "));

 

This is equivalent to SNS network mining. At present, we should divide the above implementation into two parts: storage and mining.

 

It may be because the demand is not fixed or too broad, so it is up to you to do it yourself.

You can use OODBS to drum up db4o for several days and have limited understanding of the activation level. In this way, multi-layer associations will read a large number of objects. [Progress: preliminary test]

Use RDBS. Because of the complexity of the data structure of object attributes, it is difficult to unify the data into a table. It is also difficult to query different data. [Progress: Database Design]

With pureXML, performance and information redundancy are problems. In addition, it is not easy to search by combining Chinese Word Segmentation technology. [Progress: Simple Research]

 

There are so many ideas. Here we only involve static object relationships, and there are no abstract concepts such as design object interaction, time, and event. It is difficult to describe a world ~

 

4-29 Postscript:

This is a rare fact. It turns out that graph database has some implementations, such as Neo4j, which can also be processed by the Map/Reduce idea.

However, this is not yet mature. This year, Workshop will be held, although in China.

In addition, there are still many details to consider about the needs to describe the world.

In general, I still have to find a new database design book ~~~

 

5-11 supplement:

Let's take a good look at the Database concept. The Unfortunately and there are no simple answers in the book is really cool and cool.

If it is a static world without considering the workload, the description may not be a problem, but the introduction of time, dynamic up, Entity and Relation is not that simple.

Or I think too much.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.