Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I think your setup is too complicated. Also, you set up your relationships a bit like <em>sub-classes</em>. But relationships and sub-classes are completely different concepts, and I think you might be mixing them up.</p> <p>Here is what I propose:</p> <p>Have an entity <strong>Location</strong>, with attributes <strong>latitude</strong>, <strong>longitude</strong> and <strong>name</strong>. Set <strong>latitude</strong> and <strong>longitude</strong> as non-optional, but <strong>name</strong> as optional. Now you have all the basic building blocks you need.</p> <p>In your code you can define objects such as *POI of type <strong>Location</strong>, *destination of type <strong>Location</strong> and *startPoint of type <strong>Location</strong>. You can use the coordinates to calculate the shortest route for example. By setting the <strong>name</strong> you can make any <strong>Location</strong> into a POI. If you want names for non-POIs, create a boolean attribute <strong>isPOI</strong>. </p> <p>Now, if you want to store specific travel routes, you can introduce an entity <strong>Route</strong>, with attributes like <strong>name</strong>, <strong>date</strong> etc. and a one-to-many relationship to <strong>Location</strong>. Note that you can not put the many <strong>Locations</strong> in any particular order with this scheme. However, what you could do is include two more one-to-one relationships to <strong>Location</strong>, one called <strong>startLocation</strong> and one <strong>destination</strong>. </p> <p>If you really need a more complex description of itineraries in your core data model, you probably need another entity. You could call it <strong>TravelPoints</strong> with a many-to-one relationship to <strong>Route</strong>, a one-to-one relationship to <strong>Location</strong> and attributes like <strong>arrivalDate</strong>, <strong>timeStayed</strong> or <strong>departureDate</strong>, <strong>sequentialNumber</strong> (to indicated the order in <strong>Route</strong>), etc. </p> <p>With this setup you should be able to go far with your project.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload