data-modeling

How to handle Model Validation and Consistency Checking in java

Hello My question is best illustrated with some code. Please browse through the code and read the question at the end. enum PropertySourceEnum { DEFAULT, CALCULATED, USER, UNKNOWN } enum PropertyValidityEnum { ERROR, WARNING, OK } class WorkerProperty <T>{ private T value; private PropertyValidity...

How to model coarse grained geolocation to correct market

Use case example: Client A comes to request sales information, enters their zip code and are directed to Representative X. Since there is an effectively infinite number of zip codes there will not be an agent assigned to every single zip code which would then move out to the county level, and then so on into a region of counties and fin...

historical data modelling literature, methods and techniques

Howdy, Last year we launched http://tweetMp.org.au - a site dedicated to Australian politics and twitter. Late last year our politician schema needed to be adjusted because some politicians retired and new politicians came in. Changing our db required manual (SQL) change, so I was considering implementing a CMS for our admins to make...

Data modeling advice for a forum application on Google App Engine

I'm writing a simple forum-like application on Google App Engine and trying to avoid scalability issues. I'm new to this non-RBDMS approach, i'd like to avoid pitfalls from the beginning. The forum design is pretty simple, posts and replies will be the only concepts. What will be the best approach to the problem if the forum have million...

Products database design for product lines, categories, manufacturers, related software, product attributes, etc.

I am redeveloping the front end and database for a medium size products database so that it can support categories/subcategories, product lines, manufacturers, supported software and product attributes. Right now there is only a products table. There will be pages for products by line, by category/subcategory, by manufacturer, by suppo...

Tools to generate a database diagram/ER diagram from existing Oracle database?

Looking for tools (windows platform) to genereate ER diagram (or similar) from an existing Oracle database. Any good tools out there that are free to use or low cost? ...

Core Data model design — search vs relationships?

I'm familiar with Core Data basics and have done some dabbling, but have not really done any major apps. Now I need to plan for one. And the question is not specifically about Core Data, but more about data design in general, though I am going to use Core Data to implement it on iPhone which is important for considering performance. Ima...

Object model for persons/workers who can be of multiple types ("jobs")

Let's say I'm modeling a workforce of workaholics. We have Bob, who is both a plumber and a carpenter by trade. There's Jane, who is a teacher. And finally Jack, the detective, bowling-alley entrepreneur, and mad scientist. Each position or job type can have properties or methods specific to only that job. For example, a plumber will ha...

how to store/model users/faceboook users/linkedin users, etc, with ActiveRecord?

My app has "normal" users: those which come through a typical signup page facebook(FB) users: those which come from Facebook connect "FB-normal" users: a user that can log with both email/password * FB connect Further, there's the a slew of other openID-ish login methods (I don't think openID itself will be acceptable since it doesn...

Architecture abstraction problem in Repository ASP.NET MVC

Hi. I'm working with MVC ASP.NET 3.5 SP1 on VS2008. I'm looking for a way to abstract this three methods I have in my Users repository. public User GetUser(Log log) { return db.Users.FirstOrDefault(u => u.Logs.Any(l => l.id.Equals(log.id))); } public User GetUser(Product product) { return db.Users.FirstOrDefault(u => u.Products.Any...

Rails data modeling - alternatves to has_many :through, given polymorphism?

I'm working on an application that allows users to associate images with specific events. Events are owned by a user. The easy solution would of course be: class Image < ActiveRecord::Base belongs_to :event end class Event < ActiveRecord::Base has_many :images belongs_to :user end class User < ActiveRecord::Base has_many :eve...

How to properly cascade delete managed objects in Core Data?

I have a Core Data model which has three entities: A, B, and C. A has a one-to-many relationship with B, and B has a many-to-many relationship with C. The delete rule for A -> B is "Cascade", and B -> A is "No Action". The delete rule for B -> C is "No Action", and C -> B is "Deny". I am having trouble performing a delete on the A entit...

sql database model for contact details

I need a db to store, i.e. user records. Regular stuff: name, e-mail, address, phone, fax and so on. The problem is, in this case there can be more than one phone number per user. And more than one e-mail. Even more than one address. And a lot more of more-than-one stuff. One approach is to store everything in one table, e.g. serialize...

Model login constraints based on time

Good morning, for an existing web application I need to implement "time based login constraints". It means that for each user, later maybe each group, I can define timeslots when they are (not) allowed to log in into the system. As all data for the application is stored in database tables, I need to somehow create a way to model this id...

How do I set Wordpress Posts to be sub-posts of another Post?

I have X posts about various people. I want to have each person post have a subset of associated posts. Is there any way to do this? I understand people could be categories, but then I run into a problem of not being able to allow for textual data associated with the people (categories don't have a post-page equivalent). Thanks in adva...

Modeling a many-to-many relationship in ASP.NET MVC using LINQ to SQL

I've been reading and watching videos about MVC and I'm starting to get a little confused. The simple tutorials are far too simple and they seem to only involve a single database table. Whoopty doo! The advanced tutorials assume a lot of knowledge is present and I have trouble following those. Not to mention, there are 15 ways to model ...

Complex Filtered Parent-Child LINQ to SQL Query

The title and tags of this post may be incorrect since my solution may end up being more MVC Controller - Model related instead of LINQ related... I am building an MVC (not that the platform is important) site to display Invoices and the Invoice Details for approval before being paid. Basically this gives me a standard Master-Detail dat...

Database Design - NULL Foreign Keys

Hello, and thanks for reading. I'm making a DB for a puppy shop. I have a table for puppies and a table for owners. A puppy can have one owner, owners can own more than one puppy, but not all puppies are owned. What's a good way to handle this situation? Do I use a FK in the puppy table that is NULL if the puppy doesn't have an owne...

Modelling tournament brackets in MongoDB

I've been experimenting with MongoDB in order to move some parts of an app to it. I'm thinking a document-based db like mongodb would be a nice fit for tournament brackets but I'm having sort of a hard time coming up with a suitable model. (still trying to break free from RDBMS dogma) Anyone have any ideas for a good way to model Single...

Recommended Document Structure for CouchDB

We are currently considering a change from Postgres to CouchDB for a usage monitoring application. Some numbers: Approximately 2000 connections, polled every 5 minutes, for approximately 600,000 new rows per day. In Postgres, we store this data, partitioned by day: t_usage {service_id, timestamp, data_in, data_out} t_usage_20100101 i...