Reputation: 109
I am not a database expert., However I have a business case in which I want to store information related to a large family with more than 20,000 members , starting from a patriarch and inserting new members who are born , the data concern their names , dates of birth , occupations , data of death and so on.
What is the best data model for such case ?
After making a research I am a little bit confused between hierarchal or graph data model , So , does any of them fit the problem or another solution is better ?
Upvotes: 0
Views: 280
Reputation: 739
This problem fits perfectly within the realm of graph databases and is fairly easy to implement. In InfiniteGraph, the data model would look something like the following:
UPDATE SCHEMA {
CREATE CLASS Person {
name : String,
dateOfBirth : DateTime,
dateOfDeath : DateTime,
education : List {
Element: Reference { EdgeClass: Education, EdgeAttribute School },
CollectionTypeName: TreeListOfReference
},
residence : List {
Element: Reference { EdgeClass: Residence, EdgeAttribute Address },
CollectionTypeName: TreeListOfReference
},
birthMother : Reference { referenced: Person },
birthFather : Reference { referenced: Person }
}
CREATE CLASS Education {
startDate : Date,
endDate : Date,
certificate : String,
school : Reference { Referenced: School }
}
CREATE CLASS School {
name : String
}
CREATE CLASS Residence {
startDate : Date,
endDate : Date,
address : Reference { Referenced: Address },
resident : Reference { Referenced: Person }
}
CREATE CLASS GeoPosition {
latitude : Float,
latitude : Float
}
CREATE CLASS Address SUPERCLASS GeoPosition {
street1 : String,
street2 : String,
city : String,
state : String,
country : String,
postalCode : String,
resident : List {
Element: Reference { EdgeClass: Residence, EdgeAttribute Person },
CollectionTypeName: TreeListOfReference
}
}
}
InfiniteGraph is a massively scalable object-oriented graph database. I've solved many problems like yours using the product.
Upvotes: 1