Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 Database Design and Application Architecture
 SQL Store Routes of Hiking

Author  Topic 

swissivan
Starting Member

30 Posts

Posted - 2014-03-10 : 05:05:50
Dear All

Thank you for your attention.

I am writing a hiking guide system that helps user to find out if they go wrong path.

I need to build a sytem that indicate the routes of hiking.

The hiking rules will be set by the chairman using an interface, so I need to store the rules in database.

I would like to use linked list to store the hiking routes before.


Path Previous Current Next
1 NULL 1 2
1 1 2 3
1 2 3 4
1 3 4 NULL

However, I underestimated the situations that may happen.

For example, I got the following rules come together

a) Multiple Possible Checkpoints

A > B or A > C (After checkpoint A, you can go to either B or C)

b) Skip CheckPoint

D > (E) > F or D > F (checkpoint E can be skipped)

c) Repeated Checkpoints

G > H > I > G > H > I > ... (If the action in checkpoint I is not passed, then you need to go back to checkpoint G again)

d) Group Optional Checkpoints

J > { K / L / M} > O (After checkpoint J, you can either go to K or L or M which is in the same group, let say checkpoints K, L and M are belongs to 'Water Area')

I need to let the chairman to define 'Water area' = { K / L / M }

and the the rules J > 'Water area' > O


My Search
I can think of using linked list to handle the above situations, but it is really complicated

e.g. to store the following rule P > Q / R / S > (T) > U / V > W > X > (P > ... W)

I need build many records

P > Q, P > R, P > S, P > Q > T, P > R > T, P > S > T, Q > T > U, ....

and it seems difficult to query and it is not a good database structure, anyone got ideas or experience on storing route like data? Any suggesstion? Many thanks

Best Regards

Ivan
   

- Advertisement -