####################################
## cvsRevision = "$Revision: 1.3 $" ##
####################################

## Background: 

## Thanks to Jack Park for this example of the reification of
## relationships a la the model found in version 3.10 of the Topic
## Maps Reference Model
## (http://www.isotopicmaps.org/tmrm/TMRM-3.10/TMRM-3.10.html), and
## implemented in versavant/Lib/BIGASSERT/.  Below, I've first
## reproduced the correspondence that led to the example.  The example
## is implemented in versavant/PARK/parkdemo.py, which effectively
## calls versavant/PARK/opt.py ("opt" is an acronym for "original
## population task").  The assertion model itself is implemented in
## versavant/Lib/BIGASSERT/, as already noted, and as will be clear if
## you read parkdemo.py.  -- Steve Newcomb, 16 June 2005

#######################################################

## Jack Park <jackpark@gmail.com> wrote:

## > Consider a subject, a specific individual who I won't identify for the
## > time being, but who has a name; Joe.
## > 
## > I want to say that Joe's shoesize was a 6 when he was 7 years old. How
## > do I do that?

## Steve Newcomb <srn@coolheads.com> replied:

## I cannot answer until you tell me what you want to reify.

## Note: "reify" means "provide a subject proxy for" and, therefore, at
##       least in this paradigm, it also implicitly means "provide with
##       an address in one or more subject-address spaces".

## Tell you what: answer "yes" or "no" to the following questions and
## I'll give you an answer to your question:

##   (I assume you want to reify Joe, so I won't ask about that.)

##   (1) Do you want to reify shoe sizes?  (Y/N)

##   (2) Do you want to reify ages?  (Y/N)

##   (3) Do you want to reify the relationships between shoe sizes and
##       the people who have them?  (Y/N)

##   (4) Do you want to reify the relationships between shoe sizes and
##       the ages at which they were observed?  (Y/N)

##   (5) Do you want to reify the names of people?  (Y/N)

##   (6) Do you want to reify the relationships between people and their
##       names?  (Y/N)

##   (7) Is there anything else about this example that you want to
##       reify?  (Y/N)

##       If your answer to question 7 is "yes", please give details.



## Jack wrote back:

## > The categorical answer, given that I think that a topic map is there
## > to point to answers to questions is YES. I want to be able to make
## > statements about people, places, and things, the statements for which
## > I want to be accurate, timely, and discussable.  It's not enough to
## > say "Oh, Joe wore size 6 shoes" and leave the user wondering when the
## > hell he wore that size shoe or is he a midget...

## ...and Steve replied:

## I'm going to assume "yes" is your answer to questions 1 through 6, and
## "no" is your answer to question 7.  I've re-ordered the questions,
## below, so that independent stuff is done before the stuff that depends
## on it.  I've also made some other design decisions, as you will see,
## just so you can have an answer to your reasonable request without
## waiting for me to ask you how you want to handle each such decision.

## I'm also taking the liberty of explaining this in implementation
## terms, so it's easier to relate to.  I'm saying there's
## a two-step procedure for reifying anything:

##   1. create a proxy for the thing to be reified.
##   2. add an SIP to the proxy you just created.

## ...but, in fact, at least in terms of the TMRM, it's impossible for a
## proxy to exist without an SIP, so the act of creating a proxy
## necessarily *includes* the act of providing it with an SIP.  
## I'm talking about the difference between theory and practice.  In
## theory, there's no proxy object, because a proxy is nothing more or
## less than a set of properties.

## Jack, the reason I say all this is to avoid the kind of confusion I
## caused when I sent you a version of Versavant, and you looked at a
## subject proxy display, and were perplexed by its link to a display of
## the corresponding proxy *object* display.  Proxies are not objects,
## just as sets are not objects.  Even so, in the explanation below, I
## pretend that proxies are objects.

## > >   (5) Do you want to reify the names of people?  YES!

## To make it possible to reify names:

##    In the TMA disclosure:

##      Create an SIP class whose name is "Name":

##        Disclose that proxies that have instances of this property
##        class will merge if the values of their instances of this
##        property class are the same.
    
##        Disclose that when instances of this property are merged into a
##        single instance, any one of the original values becomes the
##        value of the new single property instance.

##        Etc.

## To reify the name "Joe" in the subject map:

##      Create a proxy for the name "Joe".

##      Add an instance of the "Name" property class to that proxy.
##      Make its value "Joe".

## > >   (I assume you want to reify Joe, so I won't ask about that.)

## To make it possible to reify persons:

##    In the TMA disclosure:

##      Create an SIP class whose name is "Person Name Proxy":

##        Disclose that proxies that have instances of this property
##        class will merge if the values of their instances of this
##        property class are the same.
    
##        Disclose that when instances of this property are merged into a
##        single instance, any one of the original values becomes the
##        value of the new single property instance.

##        Etc.

## To reify Joe in the subject map:

##      Create a proxy for Joe.

##      Add an instance of the "Person Name Proxy" property class to that proxy.
##      Make its value the proxy whose subject is the name "Joe".  

##      Discussion: Here's another case of theory vs. practice.  In
##                  theory, the value of the "Person Name Proxy" property
##                  is the proxy whose subject is the name "Joe".  In
##                  practice, the value is a reference to that proxy.

## > >   (6) Do you want to reify the relationships between people and their
## > >       names?  YES!

## First of all, to make it possible to reify relationships:

##    Declare that your subject map is governed by a TMA for the
##    reification of relationships.  Let's assume it's the one in the
##    TMA plan I've attached to this note.

##    (Chances are you're going to use an existing, separate TMA for the
##    reification of relationships.  At your suggestion, Jack, I'm
##    working on one.  I'm attaching the plan for it in its present
##    state, which is not quite right or complete yet.  I'm also
##    attaching the diagram that appeared in a previous edition of TMRM.
##    The diagram doesn't exactly match the plan, but it's close enough.
##    Where the diagram says "a-topic", the plan says "a-proxy".  Where
##    the diagram says "a-sidp", the plan says "a-sip".  Etc.)

## To allow relationships between persons and their names to be reified:

##    Create a proxy for the "namedPerson" role of all
##    namedPerson-nameOfPerson relationships.  (You'll need an SIP class
##    for that, but I'm not going to go into that detail here.  Nor am I
##    bothering to specify, in this note, the SIPs of any of the other
##    role topics.  You might want to use yet another TMA, one that's for
##    the purpose of reifying roles in relationships, to facilitate that.
##    Or you may want to do that in your own peculiar way, either as an
##    independent TMA or as part of this TMA.  Or you might want to have
##    a bunch of TMAs for reifying various roles.)

##    Create a proxy for the "nameOfPerson" role of all
##    namedPerson-nameOfPerson relationships.

## To reify the relationship between the proxy for Joe and the name
## "Joe":

##    Create a proxy for the relationship between Joe and the name "Joe".

##    Add an instance of the a-sip property class (see attachments to
##    this note) to the proxy for the relationship between Joe and the
##    name "Joe".  Make its value the following list of two tuples:

##      ( [ reference to the proxy for the "namedPerson" role ],
##        [ reference to the proxy for Joe] )
##      ( [ reference to the proxy for the "nameOfPerson" role ],
##        [ reference to the proxy for name "Joe" ] )

##    Note: Because of the conferral rules in the assertion TMA described
##          in the attachments hereto, that's all you have to do.  The
##          c-proxies, the t-proxy, and all the rest of the necessary
##          assertion properties and property value components will be
##          conferred into existence automagically.

## > >   (1) Do you want to reify shoe sizes?  YES!

## To make it possible reify shoe sizes:

##    In the TMA disclosure:

##      Create an SIP class whose name is "Shoe Size".

##        Disclose that proxies that have instances of this property
##        class will merge if the values of their instances of this
##        property class are the same.
    
##        Disclose that when instances of this property are merged into a
##        single instance, any one of the original values becomes the
##        value of the new single property instance.

##        Etc.

## To reify the shoe size "6" in the subject map:

##      Create a proxy for shoe size "6".

##      Add an instance of the "Shoe Size" property class to that proxy.
##      Make its value "6".  

## > >   (2) Do you want to reify ages?  YES!

## To make it possible to reify ages:

##    In the TMA disclosure:

##      Create an SIP class whose name is "Age".

##        Disclose that proxies that have instances of this property
##        class will merge if the values of their instances of this
##        property class are the same.
    
##        Disclose that when instances of this property are merged into a
##        single instance, any one of the original values becomes the
##        value of the new single property instance.

##        Etc.

## To reify age 7 in the subject map:

##      Create a proxy for age 7.

##      Add an instance of the "Age" property class to that proxy.
##      Make its value "7".  


## > >   (4) Do you want to reify the relationships between shoe sizes and
## > >       the ages at which they were observed?  YES!

## To allow relationships between shoe sizes and the ages at which
## they were observed to be reified:

##    Create a proxy for the "shoeSizeObservation" role of all
##    shoeSizeObservation-ageAtShoeSizeObservation relationships.

##    Create a proxy for the "ageAtShoeSizeObservation" role of all
##    shoeSizeObservation-ageAtShoeSizeObservation relationships.

## To reify the relationship between Joe's shoe size and his age
## at the time at which his shoe size was observed:

##    Create a proxy for the relationship between Joe's shoe-size and the
##    age (7 years old) at which his shoe size was observed.

##    Add an instance of the a-sip property class (see attachments to
##    this note) to the proxy for the relationship between Joe's
##    shoe-size and the age at which his shoe size was observed.  Make
##    its value the following list of two tuples:

##      ( [ reference to the proxy for the "shoeSizeObservation" role ],
##        [ reference to the proxy for Joe's shoe size] )
##      ( [ reference to the proxy for the "ageAtShoeSizeObservation" role ],
##        [ reference to the proxy for the age of 7 ] )

## > >   (3) Do you want to reify the relationships between shoe sizes and
## > >       the people who have them?  YES!

## To allow relationships between persons and their shoe size at some specific
## age to be reified:

##    Create a proxy for the "personWithFeet" role of all
##    personWithFeet-observedShoeSize relationships.

##    Create a proxy for the "observedShoeSize" role of all
##    personWithFeet-observedShoeSize relationships.

## To reify the relationship between Joe and his shoe size as observed at
## age 7, in the subject map:

##    Create a proxy for an instance of a personWithFeet-observedShoeSize
##    relationship.

##    Add an instance of the a-sip property class (see attachments to
##    this note) to the proxy for the instance of the personWithFeet-observedShoeSize
##    relationship.  Make its value the following list of two tuples:

##      ( [ reference to the proxy for the "personWithFeet" role ],
##        [ reference to the proxy for Joe] )
##      ( [ reference to the proxy for the "observedShoeSize role ],
##        [ reference to the proxy for the relationship between Joe's
##          shoe-size and the age (7 years old) at which his shoe size
##          was observed ] )


