Quantcast
Viewing all articles
Browse latest Browse all 13329

Need help with Data-Model for Articles

Hi there!

I am building a website which provides content/articles to help Small-Businesses, and as it turns out, creating a Data Model that scales well - but which is not overly complex - seems to be much more difficult than I originally thought?! :(

Here is some background about the content...

My website will be divided "Sections". There will be maybe 5-6 of these, and each one will be represented by a navigation tab and a corresponding "landing page".

These will include:
Code:

- Finance
- Legal
- Management
- Operations
- Marketing

(This list could change somewhat, but it is unlikely.)


When a user chooses a "Section", he/she is taken to a "Section Landing Page" that contains "Sub-Sections" - denoted by boxed areas - which contain hyperlinks to Articles for the given Sub-Section.

So far, so good...

However, where things started to get "sticky" was the fact that I had maybe 20-40 different ways to sub-divide each Section?!

One option would be to just map these 20-40 random "Sub-Sections" to a given "Section", but that would be confusing.

Another option would be to further sub-divide each Section (e.g. Section > Sub-Section > Sub-Sub-Section > Sub-Sub-Sub-Section,...), but that would be a real maintenance nightmare?!

So, instead, I created the concept of a "Dimension", which is an *intermediary* step between a "Section" and a "Sub-Section".

You can think of a "Dimension" as a way to logically group certain "Sub-Sections" together based on some common concept (e.g. "Business-Type").

Most "Dimensions" will map to every Section, but there are some that will only map to a particular Section.

Here are some examples of "Dimensions" and their corresponding "Sub-Sections"...

Code:

Business-Structure: (all)
- Sole Proprietorship
- Partnership
- LLC
- S-Corp
- C-Corp

Code:

Store-Type: (all)
- Brick-and-Mortar
- Online
- Hybrid

Code:

Offering: (all)
- Products
- Services
- Full-Service

Code:

Accounting: (Finance-only)
- Book-Keeping
- Payroll
- Taxes


(There is another concept that I need help with, but it's better to get a basic Data Model built first, before I confuse things too much!!) :D


Where I struggling the most is how to properly tie a "Section" to an end "Article"...


Below is what I have so far...


Business Rules:
- One SECTION can have one or more DIMENSIONS

- One DIMENSION can be associated with one or more SECTIONS

- Some DIMENSIONS will only map to a particular SECTION (e.g. "Accounting" ---> "Finance")

- Most DIMENSIONS will map to every SECTION

- One DIMENSION is made up of one or more SUBSECTIONS

- One SUBSECTION belongs to one and only one DIMENSION (This could change, but for now, let's assume this is true.)

- One SUBSECTION will have one or more ARTICLES

- One ARTICLE will map to one or more SUBSECTIONS

- An ARTICLE cannot "exist" outside of a SUBSECTION


Tables:

SECTION
- id (PK)
- slug (UK)
- name (UK)
- created_on
- updated_on


SECTION_DIMENSION
- id (PK)
- section_slug (FK)(UK1)
- dimension_slug (FK)(UK2)
- created_on
- updated_on


DIMENSION
- id (PK)
- slug (UK)
- name (UK)
- created_on
- updated_on


SUBSECTION
- id (PK)
- dimension_slug (FK)
- slug (UK)
- name (UK)
- created_on
- updated_on


SUBSECTION_ARTICLE
- id (PK)
- subsection_slug (FK1)(UK1)
- article_slug (FK2)(UK2)
- created_on
- updated_on


ARTICLE
- id (PK)
- slug (UK)
- heading (UK)
- author
- written_on
- body
- references
- created_on
- updated_on


Relationships:

SECTION -||-----|<- SECTION_DIMENSION ->|-----||- DIMENSION

DIMENSION -||---------|<- SUBSECTION

SUBSECTION -||--------|<- SUBSECTION_ARTICLE ->|-------||- ARTICLE


Questions:
1.) How does what I have so far look?


2.) For the SUBSECTION table, would it make sense to make my PK a combination of the parent Dimension Slug and the Subsection Slug like this...

SUBSECTION
- dimension_slug (PK1)
- slug (PK2)(UK)
- name (UK)
- created_on
- updated_on


3.) How do I tie-together a Section to a Sub-Section?

Do I take the SECTION_DIMENSION junction table and the SUBSECTION table, and create another junction table called SECTION_DIMENSION_SUBSECTION?

Or maybe take the SECTION and DIMENSION and SUBSECTION tables independently and form a junction table called SECTION_DIMENSION_SUBSECTION?

Or something else?


3.) How do I link a SECTION (and even a DIMENSION) to an ARTICLE?

This is where I get all mixed up?! :(

Sincerely,


Debbie

Viewing all articles
Browse latest Browse all 13329

Trending Articles