in

The ORM Foundation

Get the facts!

Can I model "a bottle of pills" as a predicate and then refer to either the whole bottle of pills or a specific pill in a bottle in another predicate?

Last post Wed, Jun 15 2011 17:54 by Ken Evans. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • Wed, Jun 15 2011 16:21

    • sessaid
    • Top 100 Contributor
      Male
    • Joined on Mon, Jun 13 2011
    • Portland, Oregon
    • Posts 4

    Can I model "a bottle of pills" as a predicate and then refer to either the whole bottle of pills or a specific pill in a bottle in another predicate?

    Hi all,

    I am just learning about ORM and wondering if I will be able to model this example and the general case. I would like to have a predicate that stands for pills in bottles. I will then like to have a predicate that says that a pill is taken from a specific bottle.  Will I be able to reference a pill in a MedicationBottle where "MedicationBottle" is the predicate MedicationBottle(pill, container) or something like that?

     The idea is that medication bottles are created at the pharmacy (according to a prescription specification) by filling a container with medicine pills and then the medication bottle is used at home to get and administer a pill. I would like to model and track instances of all of these entities (pills, containers, medication bottles, uses of pills from a medication bottle, etc.)

    This is just one example. The general case is that I would like to compose entities in one area of my model and then refer to certain elements of the composed entity in other places of my model.  Is this doable in ORM?

     Thank you,

    Shahim

  • Wed, Jun 15 2011 17:54 In reply to

    • Ken Evans
    • Top 10 Contributor
      Male
    • Joined on Sun, Nov 18 2007
    • Stickford, UK
    • Posts 793

    Re: Can I model "a bottle of pills" as a predicate and then refer to either the whole bottle of pills or a specific pill in a bottle in another predicate?

     Hi Shahim,

    In principle, I don't see any problem with creating a model that does what you want.
    One approach to creating your model is to write down a series of what we call "elementary facts" that define your universe of discourse.(UoD).

    Here are some examples of possible facts.

    Prescription(.nr) is for Pill(.name) in Quantity()
    Pharmacy(.name) puts Quantity() of Pill(.name) in Bottle(.nr)
    Patient(.nr) removes Quantity() of Pill(.name) at Time() on Date() from Bottle(.nr)

    This last fact assumes that Pills do not have serial numbers on them.
    In the unlikely event that each pill has a serial number, you could say something like:

    Patient(.nr) removes Pill(.nr) at Time() on Date() from Bottle(.nr):

    After you have made a model, please feel free to post it in this forum for comments.

    Hope this helps you to get started.
     

    Ken

     

     

Page 1 of 1 (2 items)
© 2008-2020 The ORM Foundation: A UK not-for-profit organisation -------------- Terms of Service