0

I want to create a data model for Web Search or Redirect. We are hosting some web site asset. Some times visitor enters a keyword from search engine to enter the web site asset, some times visitor enters web site asset directly without searching. Some of our web site assets are later configured to send the request to another web site asset, and this is done by redirect. We want to track which way to enter our web site asset. I want to create WEBSITE_ASSET, USER_AGENT, SEARCH_ENGINE entities to represent the base entities, and WEB_SEARCH and WEB_REDIRECT as entities to represent the search and redirect activities, and WEB_SESSION as the entity all activity going to.

Web Search and Redirect Model

The USER_AGENT and SEARCH_ENGINE can produce WEB_SEARCH, the USER_AGENT and WEBSITE_ASSET can product WEB_REDIRECT, the WEB_SEARCH, or WEB_REDIRECT can produce WEB_SESSION, or USER_AGENT AND WEBSITE_ASSET can produce WEB_SESSION. The ENTRY_ID on WEB_SESSION references the WEB_REDIRECT.ID or WEB_SEARCH.ID or its own ID if it it not from WEB_SEARCH or WEB_REDIRECT.

Does the model look right?

5
  • Does the model look right? Short answer, no - you have a number of issues that could result in inconsistent data or a whole lot of programming work to keep straight. The first thing I can see is that Web_Session needs to have three subtypes - Website_Session, Redirect_Session and Search_Session to handle the unique properties of each. Read this SO question/answer to understand how to implement subtypes within a RDBMS: stackoverflow.com/questions/4896831/…
    – user212533
    Commented Jul 26, 2021 at 16:58
  • I'm not sure if the model fits in subtypes. The WEB_SEARCH is equivalent to SEARCH_SESSION, the WEB_REDIRECT is equivalent to REDIRECT_SESSION. Both are short and quick until the WEB_SESSION is created. Once WEB_SESSION is created, both SEARCH_SESSION and REDIRECT_SESSION no longer exist. The entry to WEB_SESSION could either be REDIRECT or SEARCH, that's why I set entry_id for tracking the route.
    – xyz
    Commented Jul 26, 2021 at 17:32
  • That's why they are exclusive subtypes - the Web_Session can only only have one origin, the entry_id would be the discriminator.
    – user212533
    Commented Jul 26, 2021 at 17:34
  • USER_AGENT and WEBSITE_ASSET can produce WEB_SESSION. If WEB_SESSION is truly having exclusive subtypes, REDIRECT_SESSION and SEARCH_SESSION are the two subtypes, and there shouldn't be other types. Since there is, I feel something wrong with the logic. Let's start with basic - USER_AGENT and WEBSITE_ASSET can produce WEB_SESSION, right?
    – xyz
    Commented Jul 26, 2021 at 18:20
  • That's not what your diagram suggests since you have arrows from Web_Redirect and Web_Search. You have three subtypes, you are ignoring the case of "USER_AGENT and WEBSITE_ASSET can produce WEB_SESSION". Comments are not for extended discussion, so if there is something missing either update your question or I'd be happy to continue this in chat.
    – user212533
    Commented Jul 26, 2021 at 18:38

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.