<?xml version="1.0" encoding="utf-8"?>

<!--
LEGAL NOTICE: This file may contain software under additional
license(s).  Such software appears herein as encoded strings in the
content of <TMAModule> elements.  Each such string may contain legal
notices that are applicable to it, including but not limited to
licensing information.
-->

<!DOCTYPE VersavantTopicMap [
<!--
## Versavant Topic Map Application Bus / Subject Addressing Engine v%s
## Copyright 2005 Steven R. Newcomb
##
## This software is licensed under the Apache License, Version 2.0
## (the "License"); you may not use this file except in compliance
## with the License.  Copies of the License are available at
##        http://www.apache.org/licenses/LICENSE-2.0
## Unless required by applicable law or agreed to in writing,
## software distributed under the License is distributed on an "AS
## IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
## express or implied.  See the License for the specific language
## governing permissions and limitations under the License.
##
## Copies of the source code and the license are available at
##        http://www.versavant.org

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

-->

<!-- An expression of a subject map.  The document element. -->
<!ELEMENT VersavantTopicMap ( VersavantTMA+, ProxyObject+, IoMapsDict)>
<!ATTLIST VersavantTopicMap
    VersavantTopicMapDTDVersion       CDATA    #REQUIRED
    VersavantSystemTMAName            CDATA    #REQUIRED
    OSPathSeparator                   CDATA    #REQUIRED
    TopicMapName                      CDATA    #REQUIRED
    PythonVersion                     CDATA    #REQUIRED
    VersavantVersion                  CDATA    #REQUIRED
>

<!-- A universe of discourse.  A "topic map application". A named set
     of value type, property class, and conferral rule definitions /
     implementations.  (The name is the value of the AppNm attribute.)
     -->
<!ELEMENT VersavantTMA ( TMAConfigFile, TMAModule*)>
<!ATTLIST VersavantTMA
    AppNm   CDATA   #REQUIRED
>

<!-- The configuration file that originally defined this universe of
     discourse. It's in XML, but certain characters have been escaped
     so the whole thing can appear in the PCDATA content of this
     element.  -->
<!ELEMENT TMAConfigFile ( #PCDATA)>
<!ATTLIST TMAConfigFile
    ConfSrcPath  CDATA   #REQUIRED
>

<!-- A Python module that implements functions used in this universe
     of discourse (UOD).  Some characters have been escaped so that it
     can appear in the PCDATA content of this element. -->
<!ELEMENT TMAModule ( #PCDATA)>
<!ATTLIST TMAModule
    ModName         CDATA  #REQUIRED
    ModSrcFileName  CDATA  #REQUIRED
>

<!-- An expression of a subject proxy.  In topic maps, these are
     called "topics". -->
<!ELEMENT ProxyObject ( Property+)>
<!ATTLIST ProxyObject
        id       ID     #REQUIRED
   proxyId       CDATA  #REQUIRED
>

<!-- A property of a subject proxy.  The value of the property is
     encoded as the content of this element.  PAppNm gives the name of
     the universe of discourse that defines/implements the property's
     class.  PClass is the name of the property class.  IsSIP is "Y"
     if the property class is a subject-identifying property class,
     "N" otherwise.  -->
<!ELEMENT Property ( #PCDATA)>
<!ATTLIST Property
    PAppNm  CDATA    #REQUIRED
    PClass  CDATA    #REQUIRED
    IsSIP   CDATA   "N"
>

<!-- I/O overhead needed by Versavant's XML import/export process in
     order to appropriately tweak property values that contain
     references to subject proxies.  -->
<!ELEMENT IoMapsDict ( #PCDATA)>
]>


<VersavantTopicMap
    TopicMapName="email_subject_map"
    VersavantTopicMapDTDVersion="1.3"
    OSPathSeparator="/"
    PythonVersion="2.4.2"
    VersavantVersion="1.75"
    VersavantSystemTMAName="Vsys"


  ><VersavantTMA AppNm="Vsys"

    ><TMAConfigFile ConfSrcPath="">S''%0a.</TMAConfigFile

  ></VersavantTMA


  ><VersavantTMA AppNm="uod1"

    ><TMAConfigFile ConfSrcPath="uod1.xml">S'%3c?xml version="1.0" encoding="ASCII"?%3e\r\n%3c!-- %3c!DOCTYPE VersavantTMA SYSTEM "http://www.versavant.org/dtds/TMAConfigFile.dtd"%3e--%3e\r\n%3c!--\r\n#####################################################################\r\n#####################################################################\r\n## Copyright 2005 Steven R. Newcomb                                ##\r\n##                                                                 ##\r\n## This software is licensed under the Apache License, Version 2.0 ##\r\n## (the "License"); you may not use this file except in compliance ##\r\n## with the License.  Copies of the License are available at       ##\r\n##        http://www.apache.org/licenses/LICENSE-2.0               ##\r\n##                                                                 ##\r\n## Unless required by applicable law or agreed to in writing,      ##\r\n## software distributed under the License is distributed on an "AS ##\r\n## IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either ##\r\n## express or implied.  See the License for the specific language  ##\r\n## governing permissions and limitations under the License.        ##\r\n##                                                                 ##\r\n## Copies of the source code and the license are available at      ##\r\n##        http://www.versavant.org                                 ##\r\n#####################################################################\r\n#####################################################################\r\n--%3e\r\n%3c!DOCTYPE VersavantTMA SYSTEM "../versavantTMA.dtd"%3e\r\n%3cVersavantTMA\r\nVersavantTMADTDVersion="1"\r\n\r\n  %3e%3cDesc%3eUniverse of Discourse (UoD) for EMAIL subjects.%3c/Desc\r\n\r\n  %3e%3cValueType ValueTypeName="rawProxyIdList"\r\n    %3e%3cDesc%3eGeneral-purpose list-of-subject-proxies value type.%3c/Desc\r\n    %3e%3cValueIsNotOfType__\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/VTproxyIdList.py"\r\n      functionName="ValueIsNotOfType_proxyIdList_"\r\n    /%3e%3cInstanceOf__ValueTypeToXMLContentString\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/VTproxyIdList.py"\r\n      functionName="InstanceOf_proxyIdListRaw_ValueTypeToXMLContentString"\r\n    /%3e%3cXMLContentStringToInstanceOf__ValueType\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/VTproxyIdList.py"\r\n      functionName="XMLContentStringToInstanceOf_proxyIdListRaw_ValueType"\r\n  /%3e%3c/ValueType\r\n\r\n  %3e%3cValueType ValueTypeName="rawUnicodeString"\r\n    %3e%3cDesc%3eGeneral-purpose Unicode string value type.%3c/Desc\r\n    %3e%3cValueIsNotOfType__\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/VTstring.py"\r\n      functionName="ValueIsNotOfType_rawUnicodeString_"\r\n    /%3e%3cInstanceOf__ValueTypeToXMLContentString\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/VTstring.py"\r\n      functionName="InstanceOf_rawUnicodeString_ValueTypeToXMLContentString"\r\n    /%3e%3cXMLContentStringToInstanceOf__ValueType\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/VTstring.py"\r\n      functionName="XMLContentStringToInstanceOf_rawUnicodeString_ValueType"\r\n  /%3e%3c/ValueType\r\n\r\n  %3e%3cValueType ValueTypeName="rawUnicodeStringList"\r\n    %3e%3cDesc%3eGeneral-purpose value type that is a list of raw Unicode strings.%3c/Desc\r\n    %3e%3cValueIsNotOfType__\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/VTstringList.py"\r\n      functionName="ValueIsNotOfType_unicodeStringList_"\r\n    /%3e%3cInstanceOf__ValueTypeToXMLContentString\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/VTstringList.py"\r\n      functionName="InstanceOf_rawUnicodeStringList_ValueTypeToXMLContentString"\r\n    /%3e%3cXMLContentStringToInstanceOf__ValueType\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/VTstringList.py"\r\n      functionName="XMLContentStringToInstanceOf_rawUnicodeStringList_ValueType"\r\n  /%3e%3c/ValueType\r\n\r\n  %3e%3cPropertyClass PropertyClassName="personNames" ValueType="rawUnicodeStringList"\r\n    %3e%3cDesc%3eSIP for persons; each item is a name for the person; if any name matches, it\'s the same subject.%3c/Desc\r\n    %3e%3cAdd__PropToOverheadDict\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCstringSet.py"\r\n      functionName="Add_stringSet_anyMatch_PropToOverheadDict"\r\n    /%3e%3cRemove__PropFromOverheadDict\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCstringSet.py"\r\n      functionName="Remove_stringSet_anyMatch_PropFromOverheadDict"\r\n    /%3e%3cMerge__PropertyValues\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCstringSet.py"\r\n      functionName="Merge_stringSet_PropertyValues"\r\n    /%3e%3cMergeProxiesBecause__PropertyInstancesSpecifySameSubject\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCstringSet.py"\r\n      functionName="MergeProxiesBecause_stringSet_anyMatch_PropertyInstancesSpecifySameSubject"\r\n    /%3e%3cValuesOf__PropertyInstancesAreSignificantlyDifferent\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCstringSet.py"\r\n      functionName="ValuesOf_stringSet_PropertyInstancesAreSignificantlyDifferent"\r\n    /%3e%3cProxiesWith__ValueNotSignificantlyDifferentFrom\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCstringSet.py"\r\n      functionName="ProxiesOfSubjectIdentifiedBy_stringSet_anyMatch_Value"\r\n  /%3e%3c/PropertyClass\r\n\r\n  %3e%3cPropertyClass PropertyClassName="emails" ValueType="rawProxyIdList"\r\n    %3e%3cDesc%3eSet of emails.%3c/Desc\r\n    %3e%3cAdd__PropToOverheadDict\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCproxyIdSet.py"\r\n      functionName="Add_proxyIdSet_PropToOverheadDict"\r\n    /%3e%3cRemove__PropFromOverheadDict\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCproxyIdSet.py"\r\n      functionName="Remove_proxyIdSet_PropFromOverheadDict"\r\n    /%3e%3cMerge__PropertyValues\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCproxyIdSet.py"\r\n      functionName="Merge_accumulatingProxyIdSet_PropertyValues"\r\n    /%3e%3cValuesOf__PropertyInstancesAreSignificantlyDifferent\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCproxyIdSet.py"\r\n      functionName="ValuesOf_proxyIdSet_PropertyInstancesAreSignificantlyDifferent"\r\n    /%3e%3cProxiesWith__ValueNotSignificantlyDifferentFrom\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCproxyIdSet.py"\r\n      functionName="ProxiesOfSubjectIdentifiedBy_proxyIdSet_Value"\r\n    /%3e%3cUpdateProxyReferencesIn__Value\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCproxyIdSet.py"\r\n      functionName="UpdateProxyReferencesIn_proxyIdSet_Value"\r\n  /%3e%3c/PropertyClass\r\n\r\n  %3e%3cPropertyClass PropertyClassName="emailSubjectLines" ValueType="rawProxyIdList"\r\n    %3e%3cDesc%3eSet of email subject lines.%3c/Desc\r\n    %3e%3cAdd__PropToOverheadDict\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCproxyIdSet.py"\r\n      functionName="Add_proxyIdSet_PropToOverheadDict"\r\n    /%3e%3cRemove__PropFromOverheadDict\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCproxyIdSet.py"\r\n      functionName="Remove_proxyIdSet_PropFromOverheadDict"\r\n    /%3e%3cMerge__PropertyValues\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCproxyIdSet.py"\r\n      functionName="Merge_accumulatingProxyIdSet_PropertyValues"\r\n    /%3e%3cValuesOf__PropertyInstancesAreSignificantlyDifferent\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCproxyIdSet.py"\r\n      functionName="ValuesOf_proxyIdSet_PropertyInstancesAreSignificantlyDifferent"\r\n    /%3e%3cProxiesWith__ValueNotSignificantlyDifferentFrom\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCproxyIdSet.py"\r\n      functionName="ProxiesOfSubjectIdentifiedBy_proxyIdSet_Value"\r\n    /%3e%3cUpdateProxyReferencesIn__Value\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCproxyIdSet.py"\r\n      functionName="UpdateProxyReferencesIn_proxyIdSet_Value"\r\n  /%3e%3c/PropertyClass\r\n\r\n  %3e%3cPropertyClass PropertyClassName="emailID" ValueType="rawUnicodeString"\r\n    %3e%3cDesc%3eSIP for emails; values are email "Message-ID:s".%3c/Desc\r\n    %3e%3cAdd__PropToOverheadDict\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCstring.py"\r\n      functionName="Add_string_PropToOverheadDict"\r\n    /%3e%3cRemove__PropFromOverheadDict\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCstring.py"\r\n      functionName="Remove_string_PropFromOverheadDict"\r\n    /%3e%3cMerge__PropertyValues\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCstring.py"\r\n      functionName="Merge_string_PropertyValues"\r\n    /%3e%3cMergeProxiesBecause__PropertyInstancesSpecifySameSubject\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCstring.py"\r\n      functionName="MergeProxiesBecause_string_PropertyInstancesSpecifySameSubject"\r\n    /%3e%3cValuesOf__PropertyInstancesAreSignificantlyDifferent\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCstring.py"\r\n      functionName="ValuesOf_string_PropertyInstancesAreSignificantlyDifferent"\r\n    /%3e%3cProxiesWith__ValueNotSignificantlyDifferentFrom\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCstring.py"\r\n      functionName="ProxiesOfSubjectIdentifiedBy_string_Value"\r\n  /%3e%3c/PropertyClass\r\n\r\n  %3e%3cPropertyClass PropertyClassName="sender" ValueType="rawProxyIdList"\r\n    %3e%3cDesc%3eReference to a sender (a person) of an email.%3c/Desc\r\n    %3e%3cAdd__PropToOverheadDict\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCproxyIdSet.py"\r\n      functionName="Add_proxyIdSet_PropToOverheadDict"\r\n    /%3e%3cRemove__PropFromOverheadDict\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCproxyIdSet.py"\r\n      functionName="Remove_proxyIdSet_PropFromOverheadDict"\r\n    /%3e%3cMerge__PropertyValues\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCproxyIdSet.py"\r\n      functionName="Merge_proxyIdSet_PropertyValues"\r\n    /%3e%3cValuesOf__PropertyInstancesAreSignificantlyDifferent\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCproxyIdSet.py"\r\n      functionName="ValuesOf_proxyIdSet_PropertyInstancesAreSignificantlyDifferent"\r\n    /%3e%3cProxiesWith__ValueNotSignificantlyDifferentFrom\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCproxyIdSet.py"\r\n      functionName="ProxiesOfSubjectIdentifiedBy_proxyIdSet_Value"\r\n    /%3e%3cUpdateProxyReferencesIn__Value\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCproxyIdSet.py"\r\n      functionName="UpdateProxyReferencesIn_proxyIdSet_Value"\r\n  /%3e%3c/PropertyClass\r\n\r\n  %3e%3cPropertyClass PropertyClassName="subjectLine" ValueType="rawProxyIdList"\r\n    %3e%3cDesc%3eReference to proxy for a subject line.%3c/Desc\r\n    %3e%3cAdd__PropToOverheadDict\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCproxyIdSet.py"\r\n      functionName="Add_proxyIdSet_PropToOverheadDict"\r\n    /%3e%3cRemove__PropFromOverheadDict\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCproxyIdSet.py"\r\n      functionName="Remove_proxyIdSet_PropFromOverheadDict"\r\n    /%3e%3cMerge__PropertyValues\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCproxyIdSet.py"\r\n      functionName="Merge_accumulatingProxyIdSet_PropertyValues"\r\n    /%3e%3cValuesOf__PropertyInstancesAreSignificantlyDifferent\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCproxyIdSet.py"\r\n      functionName="ValuesOf_proxyIdSet_PropertyInstancesAreSignificantlyDifferent"\r\n    /%3e%3cProxiesWith__ValueNotSignificantlyDifferentFrom\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCproxyIdSet.py"\r\n      functionName="ProxiesOfSubjectIdentifiedBy_proxyIdSet_Value"\r\n    /%3e%3cUpdateProxyReferencesIn__Value\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCproxyIdSet.py"\r\n      functionName="UpdateProxyReferencesIn_proxyIdSet_Value"\r\n  /%3e%3c/PropertyClass\r\n\r\n  %3e%3cPropertyClass PropertyClassName="inReplyTo" ValueType="rawProxyIdList"\r\n    %3e%3cDesc%3eReference to the email, if any, to which this email is a reply.%3c/Desc\r\n    %3e%3cAdd__PropToOverheadDict\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCproxyIdSet.py"\r\n      functionName="Add_proxyIdSet_PropToOverheadDict"\r\n    /%3e%3cRemove__PropFromOverheadDict\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCproxyIdSet.py"\r\n      functionName="Remove_proxyIdSet_PropFromOverheadDict"\r\n    /%3e%3cMerge__PropertyValues\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCproxyIdSet.py"\r\n      functionName="Merge_proxyIdSet_PropertyValues"\r\n    /%3e%3cValuesOf__PropertyInstancesAreSignificantlyDifferent\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCproxyIdSet.py"\r\n      functionName="ValuesOf_proxyIdSet_PropertyInstancesAreSignificantlyDifferent"\r\n    /%3e%3cProxiesWith__ValueNotSignificantlyDifferentFrom\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCproxyIdSet.py"\r\n      functionName="ProxiesOfSubjectIdentifiedBy_proxyIdSet_Value"\r\n    /%3e%3cUpdateProxyReferencesIn__Value\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCproxyIdSet.py"\r\n      functionName="UpdateProxyReferencesIn_proxyIdSet_Value"\r\n  /%3e%3c/PropertyClass\r\n\r\n  %3e%3cPropertyClass PropertyClassName="previousInThread" ValueType="rawProxyIdList"\r\n    %3e%3cDesc%3eReference to the email that appears previous to this one in the same thread, if any.%3c/Desc\r\n    %3e%3cAdd__PropToOverheadDict\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCproxyIdSet.py"\r\n      functionName="Add_proxyIdSet_PropToOverheadDict"\r\n    /%3e%3cRemove__PropFromOverheadDict\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCproxyIdSet.py"\r\n      functionName="Remove_proxyIdSet_PropFromOverheadDict"\r\n    /%3e%3cMerge__PropertyValues\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCproxyIdSet.py"\r\n      functionName="Merge_proxyIdSet_PropertyValues"\r\n    /%3e%3cValuesOf__PropertyInstancesAreSignificantlyDifferent\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCproxyIdSet.py"\r\n      functionName="ValuesOf_proxyIdSet_PropertyInstancesAreSignificantlyDifferent"\r\n    /%3e%3cProxiesWith__ValueNotSignificantlyDifferentFrom\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCproxyIdSet.py"\r\n      functionName="ProxiesOfSubjectIdentifiedBy_proxyIdSet_Value"\r\n    /%3e%3cUpdateProxyReferencesIn__Value\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCproxyIdSet.py"\r\n      functionName="UpdateProxyReferencesIn_proxyIdSet_Value"\r\n  /%3e%3c/PropertyClass\r\n\r\n  %3e%3cPropertyClass PropertyClassName="nextInThread" ValueType="rawProxyIdList"\r\n    %3e%3cDesc%3eReference to the email that appears next in the same thread, if any.%3c/Desc\r\n    %3e%3cAdd__PropToOverheadDict\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCproxyIdSet.py"\r\n      functionName="Add_proxyIdSet_PropToOverheadDict"\r\n    /%3e%3cRemove__PropFromOverheadDict\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCproxyIdSet.py"\r\n      functionName="Remove_proxyIdSet_PropFromOverheadDict"\r\n    /%3e%3cMerge__PropertyValues\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCproxyIdSet.py"\r\n      functionName="Merge_proxyIdSet_PropertyValues"\r\n    /%3e%3cValuesOf__PropertyInstancesAreSignificantlyDifferent\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCproxyIdSet.py"\r\n      functionName="ValuesOf_proxyIdSet_PropertyInstancesAreSignificantlyDifferent"\r\n    /%3e%3cProxiesWith__ValueNotSignificantlyDifferentFrom\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCproxyIdSet.py"\r\n      functionName="ProxiesOfSubjectIdentifiedBy_proxyIdSet_Value"\r\n    /%3e%3cUpdateProxyReferencesIn__Value\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCproxyIdSet.py"\r\n      functionName="UpdateProxyReferencesIn_proxyIdSet_Value"\r\n  /%3e%3c/PropertyClass\r\n\r\n  %3e%3cPropertyClass PropertyClassName="threadStart" ValueType="rawProxyIdList"\r\n    %3e%3cDesc%3eReference to the email starting this thread, if not the same as this email.%3c/Desc\r\n    %3e%3cAdd__PropToOverheadDict\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCproxyIdSet.py"\r\n      functionName="Add_proxyIdSet_PropToOverheadDict"\r\n    /%3e%3cRemove__PropFromOverheadDict\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCproxyIdSet.py"\r\n      functionName="Remove_proxyIdSet_PropFromOverheadDict"\r\n    /%3e%3cMerge__PropertyValues\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCproxyIdSet.py"\r\n      functionName="Merge_proxyIdSet_PropertyValues"\r\n    /%3e%3cValuesOf__PropertyInstancesAreSignificantlyDifferent\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCproxyIdSet.py"\r\n      functionName="ValuesOf_proxyIdSet_PropertyInstancesAreSignificantlyDifferent"\r\n    /%3e%3cProxiesWith__ValueNotSignificantlyDifferentFrom\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCproxyIdSet.py"\r\n      functionName="ProxiesOfSubjectIdentifiedBy_proxyIdSet_Value"\r\n    /%3e%3cUpdateProxyReferencesIn__Value\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCproxyIdSet.py"\r\n      functionName="UpdateProxyReferencesIn_proxyIdSet_Value"\r\n  /%3e%3c/PropertyClass\r\n\r\n  %3e%3cPropertyClass PropertyClassName="content" ValueType="rawUnicodeString"\r\n    %3e%3cDesc%3eEntire content of email.%3c/Desc\r\n    %3e%3cAdd__PropToOverheadDict\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCstring.py"\r\n      functionName="Add_string_PropToOverheadDict"\r\n    /%3e%3cRemove__PropFromOverheadDict\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCstring.py"\r\n      functionName="Remove_string_PropFromOverheadDict"\r\n    /%3e%3cMerge__PropertyValues\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCstring.py"\r\n      functionName="BOGUS_Merge_string_PropertyValues"\r\n    /%3e%3cValuesOf__PropertyInstancesAreSignificantlyDifferent\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCstring.py"\r\n      functionName="ValuesOf_string_PropertyInstancesAreSignificantlyDifferent"\r\n    /%3e%3cProxiesWith__ValueNotSignificantlyDifferentFrom\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCstring.py"\r\n      functionName="ProxiesOfSubjectIdentifiedBy_string_Value"\r\n  /%3e%3c/PropertyClass\r\n\r\n  %3e%3cPropertyClass PropertyClassName="date" ValueType="rawUnicodeString"\r\n    %3e%3cDesc%3eSIP for dates; values are date strings normalized to YYYY/MM/DD.%3c/Desc\r\n    %3e%3cAdd__PropToOverheadDict\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCstring.py"\r\n      functionName="Add_string_PropToOverheadDict"\r\n    /%3e%3cRemove__PropFromOverheadDict\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCstring.py"\r\n      functionName="Remove_string_PropFromOverheadDict"\r\n    /%3e%3cMerge__PropertyValues\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCstring.py"\r\n      functionName="Merge_string_PropertyValues"\r\n    /%3e%3cMergeProxiesBecause__PropertyInstancesSpecifySameSubject\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCstring.py"\r\n      functionName="MergeProxiesBecause_string_PropertyInstancesSpecifySameSubject"\r\n    /%3e%3cValuesOf__PropertyInstancesAreSignificantlyDifferent\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCstring.py"\r\n      functionName="ValuesOf_string_PropertyInstancesAreSignificantlyDifferent"\r\n    /%3e%3cProxiesWith__ValueNotSignificantlyDifferentFrom\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCstring.py"\r\n      functionName="ProxiesOfSubjectIdentifiedBy_string_Value"\r\n  /%3e%3c/PropertyClass\r\n\r\n  %3e%3cPropertyClass PropertyClassName="firstEmail" ValueType="rawProxyIdList"\r\n    %3e%3cDesc%3eSIP for threads; value is a reference to the proxy for the first email in the thread.%3c/Desc\r\n    %3e%3cAdd__PropToOverheadDict\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCproxyIdSet.py"\r\n      functionName="Add_proxyIdSet_PropToOverheadDict"\r\n    /%3e%3cRemove__PropFromOverheadDict\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCproxyIdSet.py"\r\n      functionName="Remove_proxyIdSet_PropFromOverheadDict"\r\n    /%3e%3cMerge__PropertyValues\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCproxyIdSet.py"\r\n      functionName="Merge_proxyIdSet_PropertyValues"\r\n    /%3e%3cMergeProxiesBecause__PropertyInstancesSpecifySameSubject\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCproxyIdSet.py"\r\n      functionName="MergeProxiesBecause_proxyIdSet_PropertyInstancesSpecifySameSubject"\r\n    /%3e%3cValuesOf__PropertyInstancesAreSignificantlyDifferent\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCproxyIdSet.py"\r\n      functionName="ValuesOf_proxyIdSet_PropertyInstancesAreSignificantlyDifferent"\r\n    /%3e%3cProxiesWith__ValueNotSignificantlyDifferentFrom\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCproxyIdSet.py"\r\n      functionName="ProxiesOfSubjectIdentifiedBy_proxyIdSet_Value"\r\n    /%3e%3cUpdateProxyReferencesIn__Value\r\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCproxyIdSet.py"\r\n      functionName="UpdateProxyReferencesIn_proxyIdSet_Value"\r\n  /%3e%3c/PropertyClass\r\n\r\n%3e%3c/VersavantTMA%3e\r\n'%0ap1%0a.</TMAConfigFile

    ><TMAModule ModName="001_PCproxyIdSet" ModSrcFileName="001_PCproxyIdSet.py">S'#####################################################################\r\n#####################################################################\r\n## Copyright 2005 Steven R. Newcomb                                ##\r\n##                                                                 ##\r\n## This software is licensed under the Apache License, Version 2.0 ##\r\n## (the "License"); you may not use this file except in compliance ##\r\n## with the License.  Copies of the License are available at       ##\r\n##        http://www.apache.org/licenses/LICENSE-2.0               ##\r\n##                                                                 ##\r\n## Unless required by applicable law or agreed to in writing,      ##\r\n## software distributed under the License is distributed on an "AS ##\r\n## IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either ##\r\n## express or implied.  See the License for the specific language  ##\r\n## governing permissions and limitations under the License.        ##\r\n##                                                                 ##\r\n## Copies of the source code and the license are available at      ##\r\n##        http://www.versavant.org                                 ##\r\n#####################################################################\r\n#####################################################################\r\n\r\n####################################\r\ncvsRevision = "$Revision: 1.8 $" ##\r\n####################################\r\n\r\n\r\nimport sys, pdb\r\n\r\n\r\n#######################################\r\n## proxyIdSet PC implementation ##\r\n#######################################\r\n\r\n## These functions are useful as implementations of SIPs or OPs whose\r\n## values are lists of references to proxies.  Obviously, the name\r\n## "proxyIdSet" only applies to these (library) functions; TMA\r\n## designers can use any name(s) for such properties.\r\n\r\n#######################################################\r\ndef Add_proxyIdSet_PropToOverheadDict( vsv, propertyInstance, overheadDict, proxyIdMap):\r\n\r\n    if proxyIdMap:\r\n        value = %5b%5d\r\n        for proxyId in propertyInstance._value:\r\n            value.append( proxyIdMap%5b proxyId%5d)\r\n        propertyInstance._value = value\r\n\r\n    workDict = {}\r\n    for proxyId in propertyInstance._value:\r\n        workDict%5b proxyId%5d = None\r\n    propertyInstance.listOfIdsOfReferencedProxies = propertyInstance._value = workDict.keys()\r\n\r\n    hashablePropertyValue = propertyInstance.hashablePropertyValue = frozenset( propertyInstance._value)\r\n\r\n    if overheadDict.has_key( hashablePropertyValue):\r\n        if overheadDict%5b hashablePropertyValue%5d.has_key( propertyInstance.proxyId):\r\n            vsv.errMsg( \'ProxyId %25s is already listed in the overheadDict of property class for the value (%25s)\' %25 (\r\n                propertyInstance.proxyId, propertyInstance._value))\r\n            sys.exit( 1)\r\n        overheadDict%5b hashablePropertyValue%5d%5b propertyInstance.proxyId%5d = None\r\n    else:\r\n        overheadDict%5b hashablePropertyValue%5d = { propertyInstance.proxyId: None}\r\n\r\n    vsv.addNewProxyReferencesToReferencedProxiesDict( propertyInstance)\r\n\r\n#######################################################\r\ndef Remove_proxyIdSet_PropFromOverheadDict( vsv, propertyInstance, overheadDict):\r\n    hashablePropertyValue = propertyInstance.hashablePropertyValue\r\n    if not overheadDict.has_key( hashablePropertyValue):\r\n        vsv.errMsg( \'No entry in overheadDict of property class for the value (%25s) of property %25s\' %25 (\r\n            propertyInstance._value,\r\n            vsv.catKey( propertyInstance.topicMap.topicMapName, propertyInstance.propertyInstanceKey)))\r\n        sys.exit( 1)\r\n    if propertyInstance.proxyId not in overheadDict%5b hashablePropertyValue%5d:\r\n        vsv.errMsg( \'ProxyId %25s not found in the overheadDict of property class for the value (%25s) of property %25s\' %25 (\r\n            propertyInstance.proxyId,\r\n            propertyInstance._value,\r\n            vsv.catKey( propertyInstance.topicMap.topicMapName, propertyInstance.propertyInstanceKey)))\r\n        sys.exit( 1)\r\n\r\n    del overheadDict%5b hashablePropertyValue%5d%5b propertyInstance.proxyId%5d\r\n    if not len( overheadDict%5b hashablePropertyValue%5d):\r\n        del overheadDict%5b hashablePropertyValue%5d\r\n\r\n    vsv.removeOldProxyReferencesFromReferencedProxiesDict( propertyInstance)\r\n\r\n#######################################################\r\ndef ValueIsInvalidFor_proxyIdSet_Property( vsv, propertyValue, propertyClass, propertyInstance = None):\r\n    ## the value type validator does everything necessary\r\n    return False\r\n\r\n#######################################################\r\ndef Merge_proxyIdSet_PropertyValues( vsv, value1, value2):\r\n    if value1 == value2:\r\n        return value1\r\n    else:\r\n        return None  ## merge is unsuccessful\r\n\r\n#######################################################\r\ndef Merge_accumulatingProxyIdSet_PropertyValues( vsv, value1, value2):\r\n    wkdict = {}\r\n    for proxyId in value1:\r\n        wkdict%5b proxyId%5d = None\r\n    for proxyId in value2:\r\n        wkdict%5b proxyId%5d = None\r\n    return wkdict.keys()\r\n\r\n#######################################################\r\ndef ValuesOf_proxyIdSet_PropertyInstancesAreSignificantlyDifferent( vsv, value1, value2):\r\n    if frozenset( value1) != frozenset( value2):  ## ignore differences in sequence and ignore redundant entries\r\n        return True\r\n    return False\r\n\r\n#######################################################\r\ndef MergeProxiesBecause_proxyIdSet_PropertyInstancesSpecifySameSubject( vsv, propertyClass):\r\n    for key in propertyClass.overheadDict:\r\n        if len( propertyClass.overheadDict%5b key%5d) %3e 1:\r\n            vsv.mergeListOfProxies( propertyClass, key, propertyClass.overheadDict%5b key%5d.keys())\r\n\r\n#######################################################\r\ndef ProxiesOfSubjectIdentifiedBy_proxyIdSet_Value( vsv, propertyClass, value):\r\n    hashablePropertyValue = frozenset( value)\r\n    if propertyClass.overheadDict.has_key( hashablePropertyValue):\r\n        return propertyClass.overheadDict%5b hashablePropertyValue%5d.keys()\r\n    else:\r\n        return %5b%5d  ## empty list -- no match\r\n\r\n#######################################################\r\ndef UpdateProxyReferencesIn_proxyIdSet_Value( vsv, propertyInstance, proxyIdToReplace, replacementProxyId):\r\n    value = propertyInstance._value\r\n    if proxyIdToReplace not in value:\r\n        vsv.errMsg( \'proxyIdToReplace "%25s" not found in the value of %25s\' %25 (\r\n            proxyIdToReplace,\r\n            vsv.catKey( propertyInstance.topicMap.topicMapName, propertyInstance.propertyInstanceKey)))\r\n        sys.exit( 1)\r\n\r\n    propertyClass = propertyInstance.propertyClass\r\n    \r\n\r\n    ## Remove old value from the "overhead" data for this property class\r\n    if propertyClass.Remove__PropFromOverheadDictFArgString:\r\n        execStr = \'propertyClass.Remove__PropFromOverheadDictF( vsv, propertyInstance, propertyClass.overheadDict, %25s)\' %25 (\r\n            propertyClass.Remove__PropFromOverheadDictFArgString)\r\n        exec execStr\r\n    else:\r\n        propertyClass.Remove__PropFromOverheadDictF( vsv, propertyInstance, propertyClass.overheadDict)\r\n\r\n    ## Replace the proxyIdToReplace with the replacementProxyId\r\n    oldValue = value%5b:%5d\r\n    del value%5b:%5d\r\n    for proxyId in oldValue:\r\n        if proxyId == proxyIdToReplace:\r\n            proxyId = replacementProxyId\r\n        if proxyId not in value:\r\n            value.append( proxyId)\r\n        \r\n    ## Expose the list of proxy references that appear in the value as a list of proxyIds\r\n    propertyInstance.listOfIdsOfReferencedProxies = value\r\n        ## happens to be a list, so use the same list\r\n\r\n\r\n    ## Add new value to the "overhead" data for this property class\r\n    if propertyClass.Add__PropToOverheadDictFArgString:\r\n        execStr = \'propertyClass.Add__PropToOverheadDictF( vsv, propertyInstance, propertyClass.overheadDict, None, %25s)\' %25 (\r\n            propertyClass.Add__PropToOverheadDictFArgString)\r\n        exec execStr\r\n    else:\r\n        propertyClass.Add__PropToOverheadDictF( vsv, propertyInstance, propertyClass.overheadDict, None)\r\n\r\n'%0ap1%0a.</TMAModule

    ><TMAModule ModName="001_PCstring" ModSrcFileName="001_PCstring.py">S'#####################################################################\r\n#####################################################################\r\n## Versavant Topic Map Application Bus / Subject Addressing Engine ##\r\n## Copyright 2005 Steven R. Newcomb                                ##\r\n##                                                                 ##\r\n## This software is licensed under the Apache License, Version 2.0 ##\r\n## (the "License"); you may not use this file except in compliance ##\r\n## with the License.  Copies of the License are available at       ##\r\n##        http://www.apache.org/licenses/LICENSE-2.0               ##\r\n##                                                                 ##\r\n## Unless required by applicable law or agreed to in writing,      ##\r\n## software distributed under the License is distributed on an "AS ##\r\n## IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either ##\r\n## express or implied.  See the License for the specific language  ##\r\n## governing permissions and limitations under the License.        ##\r\n##                                                                 ##\r\n## Copies of the source code and the license are available at      ##\r\n##        http://www.versavant.org                                 ##\r\n#####################################################################\r\n#####################################################################\r\n\r\n####################################\r\ncvsRevision = "$Revision: 1.9 $" ##\r\n####################################\r\n\r\n######################################################################################\r\n## A simple property class implementation for properties whose values are strings.  ##\r\n######################################################################################\r\n\r\n#######################################################\r\ndef Add_string_PropToOverheadDict( vsv, propertyInstance, overheadDict, proxyIdMap):\r\n    valueHash = propertyInstance.hashablePropertyValue = propertyInstance._value\r\n    if overheadDict.has_key( valueHash):\r\n        overheadDict%5b valueHash%5d.append( propertyInstance.proxyId)\r\n    else:\r\n        overheadDict%5b valueHash%5d = %5b propertyInstance.proxyId%5d\r\n\r\n\r\n#######################################################\r\ndef Remove_string_PropFromOverheadDict( vsv, propertyInstance, overheadDict):\r\n    valueHash = propertyInstance.hashablePropertyValue\r\n    overheadDict%5b valueHash%5d.remove( propertyInstance.proxyId)\r\n    if not len( overheadDict%5b valueHash%5d):\r\n        del overheadDict%5b valueHash%5d  ## be a good citizen and clean up after yourself\r\n\r\n\r\n#######################################################\r\ndef Merge_string_PropertyValues( vsv, value1, value2):\r\n    if value1 == value2:\r\n        return value1\r\n    else:\r\n        return None  ## the merge failed.\r\n\r\n#######################################################\r\ndef BOGUS_Merge_string_PropertyValues( vsv, value1, value2):\r\n    return value1\r\n\r\n#######################################################\r\ndef ValuesOf_string_PropertyInstancesAreSignificantlyDifferent( vsv, value1, value2):\r\n    if value1 == value2:\r\n        return False\r\n    else:\r\n        return True  \r\n\r\n#######################################################\r\ndef ProxiesOfSubjectIdentifiedBy_string_Value( vsv, propertyClass, value):\r\n    if propertyClass.overheadDict.has_key( value):\r\n        return propertyClass.overheadDict%5b value%5d\r\n    else:\r\n        return %5b%5d  ## empty list -- no match\r\n\r\n#######################################################\r\ndef MergeProxiesBecause_string_PropertyInstancesSpecifySameSubject( vsv, propertyClass):\r\n    ## Declare this one if and only if your property class is for SIPs\r\n    ## (subject identity properties).\r\n\r\n    for hashablePropertyValue in propertyClass.overheadDict:\r\n        if len( propertyClass.overheadDict%5b hashablePropertyValue%5d) %3e 1:\r\n            vsv.mergeListOfProxies( propertyClass, hashablePropertyValue, propertyClass.overheadDict%5b hashablePropertyValue%5d)\r\n    \r\n'%0ap1%0a.</TMAModule

    ><TMAModule ModName="001_PCstringSet" ModSrcFileName="001_PCstringSet.py">S'#####################################################################\r\n#####################################################################\r\n## Versavant Topic Map Application Bus / Subject Addressing Engine ##\r\n## Copyright 2005 Steven R. Newcomb                                ##\r\n##                                                                 ##\r\n## This software is licensed under the Apache License, Version 2.0 ##\r\n## (the "License"); you may not use this file except in compliance ##\r\n## with the License.  Copies of the License are available at       ##\r\n##        http://www.apache.org/licenses/LICENSE-2.0               ##\r\n##                                                                 ##\r\n## Unless required by applicable law or agreed to in writing,      ##\r\n## software distributed under the License is distributed on an "AS ##\r\n## IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either ##\r\n## express or implied.  See the License for the specific language  ##\r\n## governing permissions and limitations under the License.        ##\r\n##                                                                 ##\r\n## Copies of the source code and the license are available at      ##\r\n##        http://www.versavant.org                                 ##\r\n#####################################################################\r\n#####################################################################\r\n\r\n####################################\r\ncvsRevision = "$Revision: 1.8 $" ##\r\n####################################\r\n\r\n#######################################################################\r\n## This property class assumes a value type of lists whose items are ##\r\n## strings.  However, they are treated as a set, not a list; their   ##\r\n## order is not significant and redundant items will be ignored.     ##\r\n## The value type implementation found in                            ##\r\n## versavant/Lib/VTstringSet.py can be used.                         ##\r\n##                                                                   ##\r\n## * Subject sameness is having all the same items in both values.   ##\r\n##                                                                   ##\r\n## * If you desire any two values to be regarded as having the same  ##\r\n##   subject if they have one or more items in common, use the       ##\r\n##   variant functions with "anyMatch" in their names.               ##\r\n#######################################################################\r\n\r\n###\r\nimport pdb, traceback\r\n###\r\n\r\n#######################################################\r\n## Subject sameness is sameness of the whole sets:\r\ndef Add_stringSet_PropToOverheadDict( vsv, propertyInstance, overheadDict, proxyIdMap):\r\n    hashableValue = propertyInstance.hashablePropertyValue = frozenset( propertyInstance._value)\r\n    if overheadDict.has_key( hashableValue):\r\n        overheadDict%5b hashableValue%5d.append( propertyInstance.proxyId)\r\n    else:\r\n        overheadDict%5b hashableValue%5d = %5b propertyInstance.proxyId%5d\r\n\r\n#######################################################\r\n## Subject sameness is sameness of any item in the sets (intersection of sets is non-empty):\r\ndef Add_stringSet_anyMatch_PropToOverheadDict( vsv, propertyInstance, overheadDict, proxyIdMap):\r\n\r\n    value = propertyInstance._value\r\n    for item in value:\r\n        if overheadDict.has_key( item):\r\n            overheadDict%5b item%5d.append( propertyInstance.proxyId)\r\n        else:\r\n            overheadDict%5b item%5d = %5b propertyInstance.proxyId%5d\r\n\r\n\r\n#######################################################\r\ndef Remove_stringSet_PropFromOverheadDict( vsv, propertyInstance, overheadDict):\r\n## Subject sameness is sameness of the whole sets:\r\n    hashableValue = propertyInstance.hashablePropertyValue\r\n    overheadDict%5b hashableValue%5d.remove( propertyInstance.proxyId)\r\n    if not len( overheadDict%5b hashableValue%5d):\r\n        del overheadDict%5b hashableValue%5d\r\n\r\n#######################################################\r\ndef Remove_stringSet_anyMatch_PropFromOverheadDict( vsv, propertyInstance, overheadDict):\r\n## Subject sameness is sameness of any item in the sets (intersection of sets is non-empty):\r\n\r\n    value = propertyInstance._value\r\n    for item in value:\r\n        try:   ## because this is an anymatch situation, it may already have been removed.\r\n            overheadDict%5b item%5d.remove( propertyInstance.proxyId)\r\n        except:\r\n            pass\r\n        try:\r\n            if not len( overheadDict%5b item%5d):\r\n                try:\r\n                    del overheadDict%5b item%5d\r\n                except:\r\n                    pass\r\n        except:\r\n            pass\r\n\r\n#######################################################\r\n## This works either way.\r\ndef Merge_stringSet_PropertyValues( vsv, value1, value2):\r\n    newList = %5b%5d\r\n    for stringItem in value1:\r\n        if stringItem not in newList:\r\n            newList.append( stringItem)\r\n    for stringItem in value2:\r\n        if stringItem not in newList:\r\n            newList.append( stringItem)\r\n    return newList\r\n\r\n#######################################################\r\n## This works either way.\r\ndef ValuesOf_stringSet_PropertyInstancesAreSignificantlyDifferent( vsv, value1, value2):\r\n    if frozenset( value1) == frozenset( value2):\r\n        return False\r\n    else:\r\n        return True  \r\n\r\n#######################################################\r\ndef ProxiesOfSubjectIdentifiedBy_stringSet_Value( vsv, propertyClass, value):\r\n## Subject sameness is sameness of the whole set:\r\n    fset = frozenset( value)\r\n    if propertyClass.overheadDict.has_key( fset):\r\n        return propertyClass.overheadDict%5b fset%5d\r\n    else:\r\n        return %5b%5d  ## empty list -- no match\r\n\r\n#######################################################\r\ndef ProxiesOfSubjectIdentifiedBy_stringSet_anyMatch_Value( vsv, propertyClass, value):\r\n## Subject sameness is sameness of any item in the sets (intersection of sets is non-empty):\r\n    proxyIdList = %5b%5d\r\n    for item in value:\r\n        if propertyClass.overheadDict.has_key( item):\r\n            for proxyId in propertyClass.overheadDict%5b item%5d:\r\n                if proxyId not in proxyIdList:\r\n                    proxyIdList.append( proxyId)\r\n    return proxyIdList\r\n\r\n#######################################################\r\ndef MergeProxiesBecause_stringSet_PropertyInstancesSpecifySameSubject( vsv, propertyClass):\r\n## Subject sameness is sameness of the whole set:\r\n    ## Declare this one if and only if your property class is for SIPs\r\n    ## (subject identity properties).\r\n    for hashablePropertyValue in propertyClass.overheadDict:\r\n        if len( propertyClass.overheadDict%5b hashablePropertyValue%5d) %3e 1:\r\n            vsv.mergeListOfProxies( propertyClass, hashablePropertyValue, propertyClass.overheadDict%5b hashablePropertyValue%5d)\r\n    \r\n#######################################################\r\ndef MergeProxiesBecause_stringSet_anyMatch_PropertyInstancesSpecifySameSubject( vsv, propertyClass):\r\n## Subject sameness is sameness of any item in the sets (intersection of sets is non-empty):\r\n    ## Declare this one if and only if your property class is for SIPs\r\n    ## (subject identity properties).\r\n    itemList = propertyClass.overheadDict.keys()  ## stabilize what we\'re doing\r\n    for item in itemList:\r\n        if len( propertyClass.overheadDict%5b item%5d) %3e 1:\r\n            vsv.mergeListOfProxies( propertyClass, item, propertyClass.overheadDict%5b item%5d)\r\n            foundThingsToMerge = True\r\n\r\n\r\n'%0ap1%0a.</TMAModule

    ><TMAModule ModName="001_VTproxyIdList" ModSrcFileName="001_VTproxyIdList.py">S'#####################################################################\r\n#####################################################################\r\n## Versavant Topic Map Application Bus / Subject Addressing Engine ##\r\n## Copyright 2005 Steven R. Newcomb                                ##\r\n##                                                                 ##\r\n## This software is licensed under the Apache License, Version 2.0 ##\r\n## (the "License"); you may not use this file except in compliance ##\r\n## with the License.  Copies of the License are available at       ##\r\n##        http://www.apache.org/licenses/LICENSE-2.0               ##\r\n##                                                                 ##\r\n## Unless required by applicable law or agreed to in writing,      ##\r\n## software distributed under the License is distributed on an "AS ##\r\n## IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either ##\r\n## express or implied.  See the License for the specific language  ##\r\n## governing permissions and limitations under the License.        ##\r\n##                                                                 ##\r\n## Copies of the source code and the license are available at      ##\r\n##        http://www.versavant.org                                 ##\r\n#####################################################################\r\n#####################################################################\r\n\r\n####################################\r\ncvsRevision = "$Revision: 1.10 $" ##\r\n####################################\r\n\r\n\r\n#############################################\r\n## "proxyIdList" value type implementation ##\r\n#############################################\r\n\r\n## This value type is useful for storing references to proxies,\r\n## regardless of whether they are treated by the property classes that\r\n## use this value type are lists or sets.  For example, you should use\r\n## this "proxyIdList" value type for both "proxyIdSet"-type property\r\n## classes and "proxyIdList"-type property classes.  At this level,\r\n## it doesn\'t matter.\r\n\r\n## Values are lists of proxyIds, i.e., proxy.proxyId values, which are\r\n## always strings of decimal digits that begin with two zeroes.\r\n\r\n## When you create other value types that contain proxy references,\r\n## you can use this implementation as a guide.  It\'s tricky to\r\n## manage proxy references, not only because they die when merged, but\r\n## also because they can\'t possibly retain their original IDs when\r\n## they are imported.\r\n\r\n## NOTE: During importation of instances of this value type from XML,\r\n## some recordkeeping is done in vsv.currentTopicMapHoldingDict%5b\r\n## \'IoMapsDict\'%5d%5b (TMA name)%5d%5b propertyClassName%5d.  \r\n\r\nimport types, traceback\r\n\r\n#######################################################\r\ndef ValueIsNotOfType_proxyIdList_(vsv, propertyValue, propertyClass, propertyInstance = None, **args):\r\n    propertyClassName = propertyClass.propertyClassName\r\n    topicMap = propertyClass.topicMap\r\n    TMA = propertyClass.TMA\r\n    TMAName = TMA.TMAName\r\n\r\n    if not ( isinstance( propertyValue, types.ListType) or isinstance( propertyValue, types.TupleType)):\r\n        traceback.print_stack()\r\n        if propertyInstance:\r\n            vsv.errMsg( \'Value "%25s" of property %25s is neither list nor tuple.\' %25 ( propertyValue, propertyInstance.propertyInstanceKey))\r\n        else:\r\n            vsv.errMsg( \'Value "%25s" of a prospective %25s property is neither list nor tuple.\' %25 ( propertyValue, vsv.catKey( TMAName, propertyClassName)))\r\n        return True\r\n\r\n    for proxyId in propertyValue:\r\n        if not isinstance(proxyId, types.StringType):\r\n            if propertyInstance:\r\n                vsv.errMsg( \'At least one item ("%25s") in the value of property %25s is not a string.\' %25 ( proxyId, propertyInstance.propertyInstanceKey))\r\n            else:\r\n                vsv.errMsg( \'At least one item ("%25s") in the value of a presumptive %25s property is not a string.\' %25 ( proxyId, vsv.catKey( TMAName, propertyClassName)))\r\n            return True\r\n        if not vsv.proxyIdStrValidatorRE.match( proxyId):\r\n            if propertyInstance:\r\n                vsv.errMsg( \'An item ("%25s") in the value of property %25s does not look like a proxy identifier string.\' %25 ( proxyId, propertyInstance.propertyInstanceKey))\r\n            else:\r\n                vsv.errMsg( \'An item ("%25s") in the value of a presumptive %25s property does not look like a proxy identifier string.\' %25 ( proxyId, vsv.catKey( TMAName, propertyClassName)))\r\n            return True\r\n\r\n        proxy = vsv.isProxyId( proxyId, topicMap)\r\n        if not proxy:\r\n            if proxyId not in vsv.currentTopicMapHoldingDict%5b \'IoMapsDict\'%5d%5b \'TMAs\'%5d%5b propertyInstance.TMAName%5d%5b propertyClassName%5d:\r\n                   ## We\'re probably in the process of importing a topic map, and these are\r\n                   ## references to proxies that don\'t exist yet because they haven\'t been imported\r\n                   ## yet.  The above check is supposed to calm our fears that this proxy reference\r\n                   ## is invalid, giving us reason to believe that it will soon be valid, even\r\n                   ## though it\'s not quite valid yet.\r\n\r\n                if propertyInstance:\r\n                    errString = \'An item ("%25s") in the list is not the ID of any proxy in topic map "%25s".\' %25 ( proxyId, propertyInstance.topicMap.topicMapName)\r\n                else:\r\n                    errString = \'An item ("%25s") in the list is not the ID of any proxy in any open topic map.\' %25 ( proxyId)\r\n                vsv.errMsg( errString)\r\n                return True\r\n        if proxy:\r\n            if proxy.forwardTo:\r\n                vsv.errMsg( \'An item ("%25s") in the list that is the value of property %25s is the ID of a dead proxy.  Only the IDs of living proxies are permitted.\' %25 ( proxyId, propertyInstance.topicMap.topicMapName))\r\n                return True\r\n\r\n    return False  ## all\'s well, presumably.                    \r\n\r\n#######################################################\r\ndef ValueIsNotOfType_proxyIdAndNoneList_(vsv, propertyValue, propertyClass, propertyInstance = None, **args):\r\n    propertyClassName = propertyClass.propertyClassName\r\n    topicMap = propertyClass.topicMap\r\n    TMA = propertyClass.TMA\r\n    TMAName = TMA.TMAName\r\n\r\n    if not ( isinstance( propertyValue, types.ListType) or isinstance( propertyValue, types.TupleType)):\r\n        traceback.print_stack()\r\n        if propertyInstance:\r\n            vsv.errMsg( \'Value "%25s" of property %25s is neither list nor tuple.\' %25 ( propertyValue, propertyInstance.propertyInstanceKey))\r\n        else:\r\n            vsv.errMsg( \'Value "%25s" of a prospective %25s property is neither list nor tuple.\' %25 ( propertyValue, vsv.catKey( TMAName, propertyClassName)))\r\n        return True\r\n\r\n    for proxyId in propertyValue:\r\n\r\n        if not ( isinstance( proxyId, types.StringType) or isinstance( proxyId, types.NoneType)):\r\n            if propertyInstance:\r\n                vsv.errMsg( \'At least one item ("%25s") in the value of property %25s is neither string nor None.\' %25 ( proxyId, propertyInstance.propertyInstanceKey))\r\n            else:\r\n                vsv.errMsg( \'At least one item ("%25s") in the value of a presumptive %25s property is neither string nor None.\' %25 ( proxyId, vsv.catKey( TMAName, propertyClassName)))\r\n            return True\r\n\r\n        if proxyId != None:\r\n            if not vsv.proxyIdStrValidatorRE.match( proxyId):\r\n                if propertyInstance:\r\n                    vsv.errMsg( \'A string ("%25s") in the value of property %25s does not look like a proxy identifier string.\' %25 ( proxyId, propertyInstance.propertyInstanceKey))\r\n                else:\r\n                    vsv.errMsg( \'An string ("%25s") in the value of a presumptive %25s property does not look like a proxy identifier string.\' %25 ( proxyId, vsv.catKey( TMAName, propertyClassName)))\r\n                return True\r\n\r\n            if not topicMap.proxies.has_key( proxyId):\r\n                if proxyId not in vsv.currentTopicMapHoldingDict%5b \'IoMapsDict\'%5d%5b \'TMAs\'%5d%5b propertyInstance.TMAName%5d%5b propertyClassName%5d:\r\n                       ## We\'re probably in the process of importing a topic map, and these are\r\n                       ## references to proxies that don\'t exist yet because they haven\'t been imported\r\n                       ## yet.  The above check is supposed to calm our fears that this proxy reference\r\n                       ## is invalid, giving us reason to believe that it will soon be valid, even\r\n                       ## though it\'s not quite valid yet.\r\n\r\n                    if propertyInstance:\r\n                        errString = \'An item ("%25s") in the list is not the ID of any proxy in topic map "%25s".\' %25 ( proxyId, propertyInstance.topicMap.topicMapName)\r\n                    else:\r\n                        errString = \'An item ("%25s") in the list is not the ID of any proxy in any open topic map.\' %25 ( proxyId)\r\n                    vsv.errMsg( errString)\r\n                    return True\r\n            else:\r\n                proxy = topicMap.proxies%5b proxyId%5d\r\n                if proxy.forwardTo:\r\n                    vsv.errMsg( \'An item ("%25s") in the list that is the value of property %25s is the ID of a dead proxy.  Only the IDs of living proxies are permitted.\' %25 ( proxyId, propertyInstance.topicMap.topicMapName))\r\n                    return True\r\n\r\n    return False  ## all\'s well, presumably.                    \r\n\r\n#######################################################\r\ndef InstanceOf_proxyIdList_ValueTypeToXMLContentString(vsv, propertyInstance):\r\n    return vsv.cPickleDumpObjectAsXMLContentString( propertyInstance._value)\r\n\r\n#######################################################\r\ndef XMLContentStringToInstanceOf_proxyIdList_ValueType(vsv, string, propertyClass, **args):\r\n    ## Import a list of proxy references, adjusting them as necessary to\r\n    ## the new proxyIds of the imported proxies to which they refer.\r\n\r\n    oldProxyIdList = vsv.cPickleLoadObjectFromXMLContentString( string)\r\n\r\n    mem2xmlProxyIdDict = vsv.currentTopicMapHoldingDict%5b \'IoMapsDict\'%5d%5b \'ProxyIds.mem2xml\'%5d\r\n        ## This dictionary allows us to look up the in-xml element id of a\r\n        ## proxy, given the proxy\'s proxyId as it was in the topic map\r\n        ## from which the proxy was exported as xml.\r\n\r\n    firstImportedProxyId = vsv.firstImportedProxyId\r\n        ## This is an integer which, if we were to convert it into a\r\n        ## string of decimal digits with 2 prepended zero characters,\r\n        ## would be the proxyId of the first (the first, that is, not\r\n        ## counting the proxies created in order to register the TMAs\r\n        ## of the xml topic map being imported) in-memory proxy to be\r\n        ## imported into the being-imported-into topic map from the\r\n        ## xml topic map that we\'re importing.\r\n\r\n    propertyClassName = propertyClass.propertyClassName\r\n    TMAName = propertyClass.TMA.TMAName\r\n\r\n    newProxyIdList = %5b%5d\r\n\r\n    for oldProxyId in oldProxyIdList:\r\n        xmlProxyNum = mem2xmlProxyIdDict%5b int( oldProxyId)%5d\r\n        newProxyNum = (xmlProxyNum + firstImportedProxyId) - 1\r\n        newProxyId = \'00%25s\' %25 ( newProxyNum)\r\n        newProxyIdList.append( newProxyId)\r\n\r\n        appDict = vsv.currentTopicMapHoldingDict%5b \'IoMapsDict\'%5d%5b \'TMAs\'%5d%5b TMAName%5d\r\n        if not appDict.has_key( propertyClassName):\r\n            appDict%5b propertyClassName%5d = %5b newProxyId%5d\r\n        else:\r\n            if newProxyId not in appDict%5b propertyClassName%5d:\r\n                appDict%5b propertyClassName%5d.append( newProxyId)\r\n    ## vsv.IoMapsDict%5b args%5b \'TMAName\'%5d%5d%5b propertyClassName%5d will be consulted by\r\n    ## the ValueIsNotOfType__() function in order to avoid a logical logjam over this.\r\n    ## The logical logjam is that we\'re referring to proxies that haven\'t been imported\r\n    ## yet, and the ValueIsNotOfType__() function checks to see that the proxy references are valid.\r\n    ## This gives the ValueIsNotOfType__() function something to fall back on, as it checks.\r\n    ## See that function, above, for more.\r\n\r\n    return newProxyIdList\r\n\r\n#######################################################\r\ndef InstanceOf_proxyIdListRaw_ValueTypeToXMLContentString(vsv, propertyInstance):\r\n    return repr( propertyInstance._value)\r\n\r\n#######################################################\r\ndef XMLContentStringToInstanceOf_proxyIdListRaw_ValueType(vsv, string, propertyClass, **args):\r\n    ## Import a list of proxy references, adjusting them as necessary to\r\n    ## the new proxyIds of the imported proxies to which they refer.\r\n\r\n    exec \'oldProxyIdList = %25s\' %25 ( string)\r\n\r\n    mem2xmlProxyIdDict = vsv.currentTopicMapHoldingDict%5b \'IoMapsDict\'%5d%5b \'ProxyIds.mem2xml\'%5d\r\n        ## This dictionary allows us to look up the in-xml element id of a\r\n        ## proxy, given the proxy\'s proxyId as it was in the topic map\r\n        ## from which the proxy was exported as xml.\r\n\r\n    firstImportedProxyId = vsv.firstImportedProxyId\r\n        ## This is an integer which, if we were to convert it into a\r\n        ## string of decimal digits with 2 prepended zero characters,\r\n        ## would be the proxyId of the first (the first, that is, not\r\n        ## counting the proxies created in order to register the TMAs\r\n        ## of the xml topic map being imported) in-memory proxy to be\r\n        ## imported into the being-imported-into topic map from the\r\n        ## xml topic map that we\'re importing.\r\n\r\n    propertyClassName = propertyClass.propertyClassName\r\n    TMAName = propertyClass.TMA.TMAName\r\n\r\n    newProxyIdList = %5b%5d\r\n\r\n    for oldProxyId in oldProxyIdList:\r\n        if oldProxyId == None:\r\n            newProxyIdList.append( None)\r\n        else:\r\n            xmlProxyNum = mem2xmlProxyIdDict%5b int( oldProxyId)%5d\r\n            newProxyNum = (xmlProxyNum + firstImportedProxyId) - 1\r\n            newProxyId = \'00%25s\' %25 ( newProxyNum)\r\n            newProxyIdList.append( newProxyId)\r\n\r\n            appDict = vsv.currentTopicMapHoldingDict%5b \'IoMapsDict\'%5d%5b \'TMAs\'%5d%5b TMAName%5d\r\n            if not appDict.has_key( propertyClassName):\r\n                appDict%5b propertyClassName%5d = %5b newProxyId%5d\r\n            else:\r\n                if newProxyId not in appDict%5b propertyClassName%5d:\r\n                    appDict%5b propertyClassName%5d.append( newProxyId)\r\n        ## vsv.IoMapsDict%5b args%5b \'TMAName\'%5d%5d%5b propertyClassName%5d will be consulted by\r\n        ## the ValueIsNotOfType__() function in order to avoid a logical logjam over this.\r\n        ## The logical logjam is that we\'re referring to proxies that haven\'t been imported\r\n        ## yet, and the ValueIsNotOfType__() function checks to see that the proxy references are valid.\r\n        ## This gives the ValueIsNotOfType__() function something to fall back on, as it checks.\r\n        ## See that function, above, for more.\r\n\r\n    return newProxyIdList\r\n\r\n#######################################################\r\ndef InstanceOf_proxyIdListRaw_ValueTypeToXMLContentString(vsv, propertyInstance):\r\n    return repr( propertyInstance._value)\r\n\r\n#######################################################\r\ndef XMLContentStringToInstanceOf_proxyIdOrNoneListRaw_ValueType(vsv, string, propertyClass, **args):\r\n    ## Import a list of proxy references, adjusting them as necessary to\r\n    ## the new proxyIds of the imported proxies to which they refer.\r\n\r\n    exec \'oldProxyIdList = %25s\' %25 ( string)\r\n\r\n    mem2xmlProxyIdDict = vsv.currentTopicMapHoldingDict%5b \'IoMapsDict\'%5d%5b \'ProxyIds.mem2xml\'%5d\r\n        ## This dictionary allows us to look up the in-xml element id of a\r\n        ## proxy, given the proxy\'s proxyId as it was in the topic map\r\n        ## from which the proxy was exported as xml.\r\n\r\n    firstImportedProxyId = vsv.firstImportedProxyId\r\n        ## This is an integer which, if we were to convert it into a\r\n        ## string of decimal digits with 2 prepended zero characters,\r\n        ## would be the proxyId of the first (the first, that is, not\r\n        ## counting the proxies created in order to register the TMAs\r\n        ## of the xml topic map being imported) in-memory proxy to be\r\n        ## imported into the being-imported-into topic map from the\r\n        ## xml topic map that we\'re importing.\r\n\r\n    propertyClassName = propertyClass.propertyClassName\r\n    TMAName = propertyClass.TMA.TMAName\r\n\r\n    newProxyIdList = %5b%5d\r\n\r\n    for oldProxyId in oldProxyIdList:\r\n        if oldProxyId != None:\r\n            xmlProxyNum = mem2xmlProxyIdDict%5b int( oldProxyId)%5d\r\n            newProxyNum = (xmlProxyNum + firstImportedProxyId) - 1\r\n            newProxyId = \'00%25s\' %25 ( newProxyNum)\r\n            newProxyIdList.append( newProxyId)\r\n\r\n            appDict = vsv.currentTopicMapHoldingDict%5b \'IoMapsDict\'%5d%5b \'TMAs\'%5d%5b TMAName%5d\r\n            if not appDict.has_key( propertyClassName):\r\n                appDict%5b propertyClassName%5d = %5b newProxyId%5d\r\n            else:\r\n                if newProxyId not in appDict%5b propertyClassName%5d:\r\n                    appDict%5b propertyClassName%5d.append( newProxyId)\r\n        ## vsv.IoMapsDict%5b args%5b \'TMAName\'%5d%5d%5b propertyClassName%5d will be consulted by\r\n        ## the ValueIsNotOfType__() function in order to avoid a logical logjam over this.\r\n        ## The logical logjam is that we\'re referring to proxies that haven\'t been imported\r\n        ## yet, and the ValueIsNotOfType__() function checks to see that the proxy references are valid.\r\n        ## This gives the ValueIsNotOfType__() function something to fall back on, as it checks.\r\n        ## See that function, above, for more.\r\n\r\n        else:\r\n            newProxyIdList.append( None)\r\n\r\n    return newProxyIdList\r\n\r\n'%0ap1%0a.</TMAModule

    ><TMAModule ModName="001_VTstring" ModSrcFileName="001_VTstring.py">S'#####################################################################\r\n#####################################################################\r\n## Versavant Topic Map Application Bus / Subject Addressing Engine ##\r\n## Copyright 2005 Steven R. Newcomb                                ##\r\n##                                                                 ##\r\n## This software is licensed under the Apache License, Version 2.0 ##\r\n## (the "License"); you may not use this file except in compliance ##\r\n## with the License.  Copies of the License are available at       ##\r\n##        http://www.apache.org/licenses/LICENSE-2.0               ##\r\n##                                                                 ##\r\n## Unless required by applicable law or agreed to in writing,      ##\r\n## software distributed under the License is distributed on an "AS ##\r\n## IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either ##\r\n## express or implied.  See the License for the specific language  ##\r\n## governing permissions and limitations under the License.        ##\r\n##                                                                 ##\r\n## Copies of the source code and the license are available at      ##\r\n##        http://www.versavant.org                                 ##\r\n#####################################################################\r\n#####################################################################\r\n\r\n####################################\r\ncvsRevision = "$Revision: 1.7 $" ##\r\n####################################\r\n\r\n\r\n################################################################\r\n## This simple value type is for strings.                     ##\r\n## They will be stored in pickled form                        ##\r\n## in the XML file.  (See below for raw storage and unicode.) ##\r\n################################################################\r\n\r\nimport types\r\n\r\n#######################################################\r\ndef ValueIsNotOfType_string_( vsv, propertyValue, propertyClass, propertyInstance = None):\r\n    if not ( isinstance( propertyValue, types.StringType) or isinstance( propertyValue, types.UnicodeType)):\r\n        vsv.errMsg( \'Value "%25s" is neither a string nor a unicode; it\\\'s a %25s.\' %25 ( propertyValue, type( propertyValue)))\r\n        return True\r\n    return False\r\n\r\n#######################################################\r\ndef InstanceOf_string_ValueTypeToXMLContentString( vsv, propertyInstance):\r\n    return vsv.cPickleDumpObjectAsXMLContentString( propertyInstance._value)\r\n\r\n#######################################################\r\ndef XMLContentStringToInstanceOf_string_ValueType( vsv, string, propertyClass):\r\n    return vsv.cPickleLoadObjectFromXMLContentString( string)\r\n\r\n\r\n#######################################################\r\ndef InstanceOf_stringRaw_ValueTypeToXMLContentString( vsv, propertyInstance):\r\n    return propertyInstance._value.replace( \'%3c\', \'%25.LT.%25\').replace( \'%3e\', \'%25.GT.%25\')\r\n\r\n#######################################################\r\ndef XMLContentStringToInstanceOf_stringRaw_ValueType( vsv, string, propertyClass):\r\n    return string.replace( \'%25.LT.%25\', \'%3c\').replace( \'%25.GT.%25\', \'%3e\')\r\n\r\n######################################################################\r\n## Use these for string values that need to be directly editable in ##\r\n## the interchangeable XML file.  This avoids pickling/unpickling,  ##\r\n## allowing the strings to appear "in the raw" in the file.         ##\r\n######################################################################\r\ndef ValueIsNotOfType_rawString_( vsv, propertyValue, propertyClass, propertyInstance = None):\r\n    if not isinstance( propertyValue, types.StringType):\r\n        vsv.errMsg( \'Value "%25s" is not a string, it is a %25s.\' %25 ( propertyValue, type( propertyValue)))\r\n        return True\r\n    return False\r\n\r\n#######################################################\r\ndef InstanceOf_rawString_ValueTypeToXMLContentString( vsv, propertyInstance):\r\n    return propertyInstance._value.replace( \'%26\', \'%26amp;\').replace( \'%3c\', \'%26lt;\').replace( \'%3e\', \'%26gt;\').encode( \'utf-8\')\r\n\r\n#######################################################\r\ndef XMLContentStringToInstanceOf_rawString_ValueType( vsv, string, propertyClass):\r\n    return string.replace( \'%26lt;\', \'%3c\').replace( \'%26gt;\', \'%3e\').replace( \'%26amp;\', \'%26\').encode( \'ASCII\')\r\n\r\n\r\n\r\n\r\n## Unicode version, with pickling. ##\r\n#######################################################\r\ndef ValueIsNotOfType_unicodeString_( vsv, propertyValue, propertyClass, propertyInstance = None):\r\n    if not isinstance( propertyValue, types.UnicodeType):\r\n        vsv.errMsg( \'Value "%25s" is not a Unicode string.\' %25 ( propertyValue))\r\n        return True\r\n    return False\r\n\r\n#######################################################\r\ndef InstanceOf_unicodeString_ValueTypeToXMLContentString( vsv, propertyInstance):\r\n    return vsv.cPickleDumpObjectAsXMLContentString( propertyInstance._value)\r\n\r\n#######################################################\r\ndef XMLContentStringToInstanceOf_unicodeString_ValueType( vsv, string, propertyClass):\r\n    return vsv.cPickleLoadObjectFromXMLContentString( string)\r\n\r\n\r\n## Unicode version, no pickling (raw). ##\r\n######################################################################\r\n## Use these for string values that need to be directly editable in ##\r\n## the interchangeable XML file.  This avoids pickling/unpickling,  ##\r\n## allowing the strings to appear "in the raw" in the file.         ##\r\n######################################################################\r\ndef ValueIsNotOfType_rawUnicodeString_( vsv, propertyValue, propertyClass, propertyInstance = None):\r\n    if not ( isinstance( propertyValue, types.UnicodeType) or isinstance( propertyValue, types.StringType)):\r\n        vsv.errMsg( \'Value "%25s" is neither a %3ctype \\\'unicode\\\'%3e nor a %3ctype \\\'str\\\'%3e; it\\\'s a %25s.\' %25 ( propertyValue, type( propertyValue)))\r\n        return True\r\n    return False\r\n\r\n#######################################################\r\ndef InstanceOf_rawUnicodeString_ValueTypeToXMLContentString( vsv, propertyInstance):\r\n##    return propertyInstance._value.replace( u\'%26\', u\'VSV-ENTITY-amp\').replace( u\'%3c\', u\'%26lt;\').replace( u\'%3e\', u\'%26gt;\')\r\n    return vsv.pickleStringXMLEscapify( propertyInstance._value)\r\n\r\n#######################################################\r\ndef XMLContentStringToInstanceOf_rawUnicodeString_ValueType( vsv, string, propertyClass):\r\n##     return string.replace( u\'%26lt;\', u\'%3c\').replace( u\'%26gt;\', u\'%3e\').replace( u\'VSV-ENTITY-amp\', u\'%26\')\r\n    return vsv.pickleStringXMLUnescapify( string)\r\n\r\n'%0ap1%0a.</TMAModule

    ><TMAModule ModName="001_VTstringList" ModSrcFileName="001_VTstringList.py">S'#####################################################################\r\n#####################################################################\r\n## Versavant Topic Map Application Bus / Subject Addressing Engine ##\r\n## Copyright 2005 Steven R. Newcomb                                ##\r\n##                                                                 ##\r\n## This software is licensed under the Apache License, Version 2.0 ##\r\n## (the "License"); you may not use this file except in compliance ##\r\n## with the License.  Copies of the License are available at       ##\r\n##        http://www.apache.org/licenses/LICENSE-2.0               ##\r\n##                                                                 ##\r\n## Unless required by applicable law or agreed to in writing,      ##\r\n## software distributed under the License is distributed on an "AS ##\r\n## IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either ##\r\n## express or implied.  See the License for the specific language  ##\r\n## governing permissions and limitations under the License.        ##\r\n##                                                                 ##\r\n## Copies of the source code and the license are available at      ##\r\n##        http://www.versavant.org                                 ##\r\n#####################################################################\r\n#####################################################################\r\n\r\n####################################\r\ncvsRevision = "$Revision: 1.7 $" ##\r\n####################################\r\n\r\n\r\n##############################################\r\n## This value type is for lists of strings. ##\r\n##############################################\r\n\r\nimport types\r\n\r\n#######################################################\r\ndef ValueIsNotOfType_stringList_( vsv, propertyValue, propertyClass, propertyInstance = None):\r\n    if not isinstance( propertyValue, types.ListType):\r\n        vsv.errMsg( \'Value "%25s" is not a list.\' %25 propertyValue)\r\n        return True\r\n    for item in propertyValue:\r\n        if not isinstance( item, types.StringType):\r\n            vsv.errMsg( \'Item ("%25s") in value "%25s" is not a string.\' %25 ( item, propertyValue))\r\n            return True\r\n    return False\r\n\r\n#######################################################\r\ndef InstanceOf_stringList_ValueTypeToXMLContentString( vsv, propertyInstance):\r\n    return vsv.cPickleDumpObjectAsXMLContentString( propertyInstance._value)\r\n\r\n#######################################################\r\ndef XMLContentStringToInstanceOf_stringList_ValueType( vsv, string, propertyClass):\r\n    return vsv.cPickleLoadObjectFromXMLContentString( string)\r\n\r\n\r\n##############################\r\n## Lists of Unicode strings ##\r\n##############################\r\n\r\n#######################################################\r\ndef ValueIsNotOfType_unicodeStringList_( vsv, propertyValue, propertyClass, propertyInstance = None):\r\n    if not isinstance( propertyValue, types.ListType):\r\n        vsv.errMsg( \'Value "%25s" is not a list.\' %25 propertyValue)\r\n        return True\r\n    for item in propertyValue:\r\n        if not isinstance( item, types.UnicodeType):\r\n            vsv.errMsg( \'Item ("%25s") in value "%25s" is not a Unicode string.\' %25 ( item, propertyValue))\r\n            return True\r\n    return False\r\n\r\n\r\n\r\n##################################\r\n## Lists of raw  strings ##\r\n##################################\r\n\r\n#######################################################\r\ndef InstanceOf_rawStringList_ValueTypeToXMLContentString( vsv, propertyInstance):\r\n    return repr( propertyInstance._value)\r\n\r\n#######################################################\r\ndef XMLContentStringToInstanceOf_rawStringList_ValueType( vsv, string, propertyClass):\r\n    exec \'stringList = %25s\' %25 ( string)\r\n    return stringList\r\n\r\n##################################\r\n## Lists of raw Unicode strings ##\r\n##################################\r\n\r\n#######################################################\r\ndef InstanceOf_rawUnicodeStringList_ValueTypeToXMLContentString( vsv, propertyInstance):\r\n    return vsv.pickleStringXMLEscapify( repr( propertyInstance._value))\r\n\r\n#######################################################\r\ndef XMLContentStringToInstanceOf_rawUnicodeStringList_ValueType( vsv, string, propertyClass):\r\n    exec \'unicodeStringList = %25s\' %25 ( vsv.pickleStringXMLUnescapify( string))\r\n    return unicodeStringList\r\n\r\n'%0ap1%0a.</TMAModule

  ></VersavantTMA


  ><VersavantTMA AppNm="uod2"

    ><TMAConfigFile ConfSrcPath="uod2.xml">S'%3c?xml version="1.0" encoding="ASCII"?%3e\n%3c!-- %3c!DOCTYPE VersavantTMA SYSTEM "http://www.versavant.org/dtds/TMAConfigFile.dtd"%3e--%3e\n%3c!--\n#####################################################################\n#####################################################################\n## Copyright 2005 Steven R. Newcomb                                ##\n##                                                                 ##\n## This software is licensed under the Apache License, Version 2.0 ##\n## (the "License"); you may not use this file except in compliance ##\n## with the License.  Copies of the License are available at       ##\n##        http://www.apache.org/licenses/LICENSE-2.0               ##\n##                                                                 ##\n## Unless required by applicable law or agreed to in writing,      ##\n## software distributed under the License is distributed on an "AS ##\n## IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either ##\n## express or implied.  See the License for the specific language  ##\n## governing permissions and limitations under the License.        ##\n##                                                                 ##\n## Copies of the source code and the license are available at      ##\n##        http://www.versavant.org                                 ##\n#####################################################################\n#####################################################################\n--%3e\n%3c!DOCTYPE VersavantTMA SYSTEM "../versavantTMA.dtd"%3e\n%3cVersavantTMA\nVersavantTMADTDVersion="1"\n\n  %3e%3cDesc%3eUniverse of Discourse (UoD) for EMAIL subjects.%3c/Desc\n\n  %3e%3cValueType ValueTypeName="rawProxyIdList"\n    %3e%3cDesc%3eGeneral-purpose list-of-subject-proxies value type.%3c/Desc\n    %3e%3cValueIsNotOfType__\n      functionModuleFilePath="${VSVEXECDIR}/Lib/VTproxyIdList.py"\n      functionName="ValueIsNotOfType_proxyIdList_"\n    /%3e%3cInstanceOf__ValueTypeToXMLContentString\n      functionModuleFilePath="${VSVEXECDIR}/Lib/VTproxyIdList.py"\n      functionName="InstanceOf_proxyIdListRaw_ValueTypeToXMLContentString"\n    /%3e%3cXMLContentStringToInstanceOf__ValueType\n      functionModuleFilePath="${VSVEXECDIR}/Lib/VTproxyIdList.py"\n      functionName="XMLContentStringToInstanceOf_proxyIdListRaw_ValueType"\n  /%3e%3c/ValueType\n\n  %3e%3cValueType ValueTypeName="rawUnicodeString"\n    %3e%3cDesc%3eGeneral-purpose Unicode string value type.%3c/Desc\n    %3e%3cValueIsNotOfType__\n      functionModuleFilePath="${VSVEXECDIR}/Lib/VTstring.py"\n      functionName="ValueIsNotOfType_rawUnicodeString_"\n    /%3e%3cInstanceOf__ValueTypeToXMLContentString\n      functionModuleFilePath="${VSVEXECDIR}/Lib/VTstring.py"\n      functionName="InstanceOf_rawUnicodeString_ValueTypeToXMLContentString"\n    /%3e%3cXMLContentStringToInstanceOf__ValueType\n      functionModuleFilePath="${VSVEXECDIR}/Lib/VTstring.py"\n      functionName="XMLContentStringToInstanceOf_rawUnicodeString_ValueType"\n  /%3e%3c/ValueType\n\n  %3e%3cValueType ValueTypeName="rawUnicodeStringList"\n    %3e%3cDesc%3eGeneral-purpose value type that is a list of raw Unicode strings.%3c/Desc\n    %3e%3cValueIsNotOfType__\n      functionModuleFilePath="${VSVEXECDIR}/Lib/VTstringList.py"\n      functionName="ValueIsNotOfType_unicodeStringList_"\n    /%3e%3cInstanceOf__ValueTypeToXMLContentString\n      functionModuleFilePath="${VSVEXECDIR}/Lib/VTstringList.py"\n      functionName="InstanceOf_rawUnicodeStringList_ValueTypeToXMLContentString"\n    /%3e%3cXMLContentStringToInstanceOf__ValueType\n      functionModuleFilePath="${VSVEXECDIR}/Lib/VTstringList.py"\n      functionName="XMLContentStringToInstanceOf_rawUnicodeStringList_ValueType"\n  /%3e%3c/ValueType\n\n  %3e%3cPropertyClass PropertyClassName="emailAddresses" ValueType="rawUnicodeStringList"\n    %3e%3cDesc%3eSIP for persons; each item is an email address for the person; if any email address matches, it\'s the same subject.%3c/Desc\n    %3e%3cAdd__PropToOverheadDict\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCstringSet.py"\n      functionName="Add_stringSet_anyMatch_PropToOverheadDict"\n    /%3e%3cRemove__PropFromOverheadDict\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCstringSet.py"\n      functionName="Remove_stringSet_anyMatch_PropFromOverheadDict"\n    /%3e%3cMerge__PropertyValues\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCstringSet.py"\n      functionName="Merge_stringSet_PropertyValues"\n    /%3e%3cMergeProxiesBecause__PropertyInstancesSpecifySameSubject\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCstringSet.py"\n      functionName="MergeProxiesBecause_stringSet_anyMatch_PropertyInstancesSpecifySameSubject"\n    /%3e%3cValuesOf__PropertyInstancesAreSignificantlyDifferent\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCstringSet.py"\n      functionName="ValuesOf_stringSet_PropertyInstancesAreSignificantlyDifferent"\n    /%3e%3cProxiesWith__ValueNotSignificantlyDifferentFrom\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCstringSet.py"\n      functionName="ProxiesOfSubjectIdentifiedBy_stringSet_anyMatch_Value"\n  /%3e%3c/PropertyClass\n\n  %3e%3cPropertyClass PropertyClassName="subjectLine" ValueType="rawUnicodeString"\n    %3e%3cDesc%3eSIP for subject lines; values are email "Subject:s".%3c/Desc\n    %3e%3cAdd__PropToOverheadDict\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCstring.py"\n      functionName="Add_string_PropToOverheadDict"\n    /%3e%3cRemove__PropFromOverheadDict\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCstring.py"\n      functionName="Remove_string_PropFromOverheadDict"\n    /%3e%3cMerge__PropertyValues\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCstring.py"\n      functionName="Merge_string_PropertyValues"\n    /%3e%3cMergeProxiesBecause__PropertyInstancesSpecifySameSubject\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCstring.py"\n      functionName="MergeProxiesBecause_string_PropertyInstancesSpecifySameSubject"\n    /%3e%3cValuesOf__PropertyInstancesAreSignificantlyDifferent\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCstring.py"\n      functionName="ValuesOf_string_PropertyInstancesAreSignificantlyDifferent"\n    /%3e%3cProxiesWith__ValueNotSignificantlyDifferentFrom\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCstring.py"\n      functionName="ProxiesOfSubjectIdentifiedBy_string_Value"\n  /%3e%3c/PropertyClass\n\n  %3e%3cPropertyClass PropertyClassName="date" ValueType="rawProxyIdList"\n    %3e%3cDesc%3eOP for emails; value is a reference to the proxy for the date of the email.%3c/Desc\n    %3e%3cAdd__PropToOverheadDict\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCproxyIdSet.py"\n      functionName="Add_proxyIdSet_PropToOverheadDict"\n    /%3e%3cRemove__PropFromOverheadDict\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCproxyIdSet.py"\n      functionName="Remove_proxyIdSet_PropFromOverheadDict"\n    /%3e%3cMerge__PropertyValues\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCproxyIdSet.py"\n      functionName="Merge_accumulatingProxyIdSet_PropertyValues"\n    /%3e%3cValuesOf__PropertyInstancesAreSignificantlyDifferent\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCproxyIdSet.py"\n      functionName="ValuesOf_proxyIdSet_PropertyInstancesAreSignificantlyDifferent"\n    /%3e%3cProxiesWith__ValueNotSignificantlyDifferentFrom\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCproxyIdSet.py"\n      functionName="ProxiesOfSubjectIdentifiedBy_proxyIdSet_Value"\n    /%3e%3cUpdateProxyReferencesIn__Value\n      functionModuleFilePath="${VSVEXECDIR}/Lib/PCproxyIdSet.py"\n      functionName="UpdateProxyReferencesIn_proxyIdSet_Value"\n  /%3e%3c/PropertyClass\n\n%3e%3c/VersavantTMA%3e\n'%0ap1%0a.</TMAConfigFile

    ><TMAModule ModName="001_PCproxyIdSet" ModSrcFileName="001_PCproxyIdSet.py">S'#####################################################################\r\n#####################################################################\r\n## Copyright 2005 Steven R. Newcomb                                ##\r\n##                                                                 ##\r\n## This software is licensed under the Apache License, Version 2.0 ##\r\n## (the "License"); you may not use this file except in compliance ##\r\n## with the License.  Copies of the License are available at       ##\r\n##        http://www.apache.org/licenses/LICENSE-2.0               ##\r\n##                                                                 ##\r\n## Unless required by applicable law or agreed to in writing,      ##\r\n## software distributed under the License is distributed on an "AS ##\r\n## IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either ##\r\n## express or implied.  See the License for the specific language  ##\r\n## governing permissions and limitations under the License.        ##\r\n##                                                                 ##\r\n## Copies of the source code and the license are available at      ##\r\n##        http://www.versavant.org                                 ##\r\n#####################################################################\r\n#####################################################################\r\n\r\n####################################\r\ncvsRevision = "$Revision: 1.8 $" ##\r\n####################################\r\n\r\n\r\nimport sys, pdb\r\n\r\n\r\n#######################################\r\n## proxyIdSet PC implementation ##\r\n#######################################\r\n\r\n## These functions are useful as implementations of SIPs or OPs whose\r\n## values are lists of references to proxies.  Obviously, the name\r\n## "proxyIdSet" only applies to these (library) functions; TMA\r\n## designers can use any name(s) for such properties.\r\n\r\n#######################################################\r\ndef Add_proxyIdSet_PropToOverheadDict( vsv, propertyInstance, overheadDict, proxyIdMap):\r\n\r\n    if proxyIdMap:\r\n        value = %5b%5d\r\n        for proxyId in propertyInstance._value:\r\n            value.append( proxyIdMap%5b proxyId%5d)\r\n        propertyInstance._value = value\r\n\r\n    workDict = {}\r\n    for proxyId in propertyInstance._value:\r\n        workDict%5b proxyId%5d = None\r\n    propertyInstance.listOfIdsOfReferencedProxies = propertyInstance._value = workDict.keys()\r\n\r\n    hashablePropertyValue = propertyInstance.hashablePropertyValue = frozenset( propertyInstance._value)\r\n\r\n    if overheadDict.has_key( hashablePropertyValue):\r\n        if overheadDict%5b hashablePropertyValue%5d.has_key( propertyInstance.proxyId):\r\n            vsv.errMsg( \'ProxyId %25s is already listed in the overheadDict of property class for the value (%25s)\' %25 (\r\n                propertyInstance.proxyId, propertyInstance._value))\r\n            sys.exit( 1)\r\n        overheadDict%5b hashablePropertyValue%5d%5b propertyInstance.proxyId%5d = None\r\n    else:\r\n        overheadDict%5b hashablePropertyValue%5d = { propertyInstance.proxyId: None}\r\n\r\n    vsv.addNewProxyReferencesToReferencedProxiesDict( propertyInstance)\r\n\r\n#######################################################\r\ndef Remove_proxyIdSet_PropFromOverheadDict( vsv, propertyInstance, overheadDict):\r\n    hashablePropertyValue = propertyInstance.hashablePropertyValue\r\n    if not overheadDict.has_key( hashablePropertyValue):\r\n        vsv.errMsg( \'No entry in overheadDict of property class for the value (%25s) of property %25s\' %25 (\r\n            propertyInstance._value,\r\n            vsv.catKey( propertyInstance.topicMap.topicMapName, propertyInstance.propertyInstanceKey)))\r\n        sys.exit( 1)\r\n    if propertyInstance.proxyId not in overheadDict%5b hashablePropertyValue%5d:\r\n        vsv.errMsg( \'ProxyId %25s not found in the overheadDict of property class for the value (%25s) of property %25s\' %25 (\r\n            propertyInstance.proxyId,\r\n            propertyInstance._value,\r\n            vsv.catKey( propertyInstance.topicMap.topicMapName, propertyInstance.propertyInstanceKey)))\r\n        sys.exit( 1)\r\n\r\n    del overheadDict%5b hashablePropertyValue%5d%5b propertyInstance.proxyId%5d\r\n    if not len( overheadDict%5b hashablePropertyValue%5d):\r\n        del overheadDict%5b hashablePropertyValue%5d\r\n\r\n    vsv.removeOldProxyReferencesFromReferencedProxiesDict( propertyInstance)\r\n\r\n#######################################################\r\ndef ValueIsInvalidFor_proxyIdSet_Property( vsv, propertyValue, propertyClass, propertyInstance = None):\r\n    ## the value type validator does everything necessary\r\n    return False\r\n\r\n#######################################################\r\ndef Merge_proxyIdSet_PropertyValues( vsv, value1, value2):\r\n    if value1 == value2:\r\n        return value1\r\n    else:\r\n        return None  ## merge is unsuccessful\r\n\r\n#######################################################\r\ndef Merge_accumulatingProxyIdSet_PropertyValues( vsv, value1, value2):\r\n    wkdict = {}\r\n    for proxyId in value1:\r\n        wkdict%5b proxyId%5d = None\r\n    for proxyId in value2:\r\n        wkdict%5b proxyId%5d = None\r\n    return wkdict.keys()\r\n\r\n#######################################################\r\ndef ValuesOf_proxyIdSet_PropertyInstancesAreSignificantlyDifferent( vsv, value1, value2):\r\n    if frozenset( value1) != frozenset( value2):  ## ignore differences in sequence and ignore redundant entries\r\n        return True\r\n    return False\r\n\r\n#######################################################\r\ndef MergeProxiesBecause_proxyIdSet_PropertyInstancesSpecifySameSubject( vsv, propertyClass):\r\n    for key in propertyClass.overheadDict:\r\n        if len( propertyClass.overheadDict%5b key%5d) %3e 1:\r\n            vsv.mergeListOfProxies( propertyClass, key, propertyClass.overheadDict%5b key%5d.keys())\r\n\r\n#######################################################\r\ndef ProxiesOfSubjectIdentifiedBy_proxyIdSet_Value( vsv, propertyClass, value):\r\n    hashablePropertyValue = frozenset( value)\r\n    if propertyClass.overheadDict.has_key( hashablePropertyValue):\r\n        return propertyClass.overheadDict%5b hashablePropertyValue%5d.keys()\r\n    else:\r\n        return %5b%5d  ## empty list -- no match\r\n\r\n#######################################################\r\ndef UpdateProxyReferencesIn_proxyIdSet_Value( vsv, propertyInstance, proxyIdToReplace, replacementProxyId):\r\n    value = propertyInstance._value\r\n    if proxyIdToReplace not in value:\r\n        vsv.errMsg( \'proxyIdToReplace "%25s" not found in the value of %25s\' %25 (\r\n            proxyIdToReplace,\r\n            vsv.catKey( propertyInstance.topicMap.topicMapName, propertyInstance.propertyInstanceKey)))\r\n        sys.exit( 1)\r\n\r\n    propertyClass = propertyInstance.propertyClass\r\n    \r\n\r\n    ## Remove old value from the "overhead" data for this property class\r\n    if propertyClass.Remove__PropFromOverheadDictFArgString:\r\n        execStr = \'propertyClass.Remove__PropFromOverheadDictF( vsv, propertyInstance, propertyClass.overheadDict, %25s)\' %25 (\r\n            propertyClass.Remove__PropFromOverheadDictFArgString)\r\n        exec execStr\r\n    else:\r\n        propertyClass.Remove__PropFromOverheadDictF( vsv, propertyInstance, propertyClass.overheadDict)\r\n\r\n    ## Replace the proxyIdToReplace with the replacementProxyId\r\n    oldValue = value%5b:%5d\r\n    del value%5b:%5d\r\n    for proxyId in oldValue:\r\n        if proxyId == proxyIdToReplace:\r\n            proxyId = replacementProxyId\r\n        if proxyId not in value:\r\n            value.append( proxyId)\r\n        \r\n    ## Expose the list of proxy references that appear in the value as a list of proxyIds\r\n    propertyInstance.listOfIdsOfReferencedProxies = value\r\n        ## happens to be a list, so use the same list\r\n\r\n\r\n    ## Add new value to the "overhead" data for this property class\r\n    if propertyClass.Add__PropToOverheadDictFArgString:\r\n        execStr = \'propertyClass.Add__PropToOverheadDictF( vsv, propertyInstance, propertyClass.overheadDict, None, %25s)\' %25 (\r\n            propertyClass.Add__PropToOverheadDictFArgString)\r\n        exec execStr\r\n    else:\r\n        propertyClass.Add__PropToOverheadDictF( vsv, propertyInstance, propertyClass.overheadDict, None)\r\n\r\n'%0ap1%0a.</TMAModule

    ><TMAModule ModName="001_PCstring" ModSrcFileName="001_PCstring.py">S'#####################################################################\r\n#####################################################################\r\n## Versavant Topic Map Application Bus / Subject Addressing Engine ##\r\n## Copyright 2005 Steven R. Newcomb                                ##\r\n##                                                                 ##\r\n## This software is licensed under the Apache License, Version 2.0 ##\r\n## (the "License"); you may not use this file except in compliance ##\r\n## with the License.  Copies of the License are available at       ##\r\n##        http://www.apache.org/licenses/LICENSE-2.0               ##\r\n##                                                                 ##\r\n## Unless required by applicable law or agreed to in writing,      ##\r\n## software distributed under the License is distributed on an "AS ##\r\n## IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either ##\r\n## express or implied.  See the License for the specific language  ##\r\n## governing permissions and limitations under the License.        ##\r\n##                                                                 ##\r\n## Copies of the source code and the license are available at      ##\r\n##        http://www.versavant.org                                 ##\r\n#####################################################################\r\n#####################################################################\r\n\r\n####################################\r\ncvsRevision = "$Revision: 1.9 $" ##\r\n####################################\r\n\r\n######################################################################################\r\n## A simple property class implementation for properties whose values are strings.  ##\r\n######################################################################################\r\n\r\n#######################################################\r\ndef Add_string_PropToOverheadDict( vsv, propertyInstance, overheadDict, proxyIdMap):\r\n    valueHash = propertyInstance.hashablePropertyValue = propertyInstance._value\r\n    if overheadDict.has_key( valueHash):\r\n        overheadDict%5b valueHash%5d.append( propertyInstance.proxyId)\r\n    else:\r\n        overheadDict%5b valueHash%5d = %5b propertyInstance.proxyId%5d\r\n\r\n\r\n#######################################################\r\ndef Remove_string_PropFromOverheadDict( vsv, propertyInstance, overheadDict):\r\n    valueHash = propertyInstance.hashablePropertyValue\r\n    overheadDict%5b valueHash%5d.remove( propertyInstance.proxyId)\r\n    if not len( overheadDict%5b valueHash%5d):\r\n        del overheadDict%5b valueHash%5d  ## be a good citizen and clean up after yourself\r\n\r\n\r\n#######################################################\r\ndef Merge_string_PropertyValues( vsv, value1, value2):\r\n    if value1 == value2:\r\n        return value1\r\n    else:\r\n        return None  ## the merge failed.\r\n\r\n#######################################################\r\ndef BOGUS_Merge_string_PropertyValues( vsv, value1, value2):\r\n    return value1\r\n\r\n#######################################################\r\ndef ValuesOf_string_PropertyInstancesAreSignificantlyDifferent( vsv, value1, value2):\r\n    if value1 == value2:\r\n        return False\r\n    else:\r\n        return True  \r\n\r\n#######################################################\r\ndef ProxiesOfSubjectIdentifiedBy_string_Value( vsv, propertyClass, value):\r\n    if propertyClass.overheadDict.has_key( value):\r\n        return propertyClass.overheadDict%5b value%5d\r\n    else:\r\n        return %5b%5d  ## empty list -- no match\r\n\r\n#######################################################\r\ndef MergeProxiesBecause_string_PropertyInstancesSpecifySameSubject( vsv, propertyClass):\r\n    ## Declare this one if and only if your property class is for SIPs\r\n    ## (subject identity properties).\r\n\r\n    for hashablePropertyValue in propertyClass.overheadDict:\r\n        if len( propertyClass.overheadDict%5b hashablePropertyValue%5d) %3e 1:\r\n            vsv.mergeListOfProxies( propertyClass, hashablePropertyValue, propertyClass.overheadDict%5b hashablePropertyValue%5d)\r\n    \r\n'%0ap1%0a.</TMAModule

    ><TMAModule ModName="001_PCstringSet" ModSrcFileName="001_PCstringSet.py">S'#####################################################################\r\n#####################################################################\r\n## Versavant Topic Map Application Bus / Subject Addressing Engine ##\r\n## Copyright 2005 Steven R. Newcomb                                ##\r\n##                                                                 ##\r\n## This software is licensed under the Apache License, Version 2.0 ##\r\n## (the "License"); you may not use this file except in compliance ##\r\n## with the License.  Copies of the License are available at       ##\r\n##        http://www.apache.org/licenses/LICENSE-2.0               ##\r\n##                                                                 ##\r\n## Unless required by applicable law or agreed to in writing,      ##\r\n## software distributed under the License is distributed on an "AS ##\r\n## IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either ##\r\n## express or implied.  See the License for the specific language  ##\r\n## governing permissions and limitations under the License.        ##\r\n##                                                                 ##\r\n## Copies of the source code and the license are available at      ##\r\n##        http://www.versavant.org                                 ##\r\n#####################################################################\r\n#####################################################################\r\n\r\n####################################\r\ncvsRevision = "$Revision: 1.8 $" ##\r\n####################################\r\n\r\n#######################################################################\r\n## This property class assumes a value type of lists whose items are ##\r\n## strings.  However, they are treated as a set, not a list; their   ##\r\n## order is not significant and redundant items will be ignored.     ##\r\n## The value type implementation found in                            ##\r\n## versavant/Lib/VTstringSet.py can be used.                         ##\r\n##                                                                   ##\r\n## * Subject sameness is having all the same items in both values.   ##\r\n##                                                                   ##\r\n## * If you desire any two values to be regarded as having the same  ##\r\n##   subject if they have one or more items in common, use the       ##\r\n##   variant functions with "anyMatch" in their names.               ##\r\n#######################################################################\r\n\r\n###\r\nimport pdb, traceback\r\n###\r\n\r\n#######################################################\r\n## Subject sameness is sameness of the whole sets:\r\ndef Add_stringSet_PropToOverheadDict( vsv, propertyInstance, overheadDict, proxyIdMap):\r\n    hashableValue = propertyInstance.hashablePropertyValue = frozenset( propertyInstance._value)\r\n    if overheadDict.has_key( hashableValue):\r\n        overheadDict%5b hashableValue%5d.append( propertyInstance.proxyId)\r\n    else:\r\n        overheadDict%5b hashableValue%5d = %5b propertyInstance.proxyId%5d\r\n\r\n#######################################################\r\n## Subject sameness is sameness of any item in the sets (intersection of sets is non-empty):\r\ndef Add_stringSet_anyMatch_PropToOverheadDict( vsv, propertyInstance, overheadDict, proxyIdMap):\r\n\r\n    value = propertyInstance._value\r\n    for item in value:\r\n        if overheadDict.has_key( item):\r\n            overheadDict%5b item%5d.append( propertyInstance.proxyId)\r\n        else:\r\n            overheadDict%5b item%5d = %5b propertyInstance.proxyId%5d\r\n\r\n\r\n#######################################################\r\ndef Remove_stringSet_PropFromOverheadDict( vsv, propertyInstance, overheadDict):\r\n## Subject sameness is sameness of the whole sets:\r\n    hashableValue = propertyInstance.hashablePropertyValue\r\n    overheadDict%5b hashableValue%5d.remove( propertyInstance.proxyId)\r\n    if not len( overheadDict%5b hashableValue%5d):\r\n        del overheadDict%5b hashableValue%5d\r\n\r\n#######################################################\r\ndef Remove_stringSet_anyMatch_PropFromOverheadDict( vsv, propertyInstance, overheadDict):\r\n## Subject sameness is sameness of any item in the sets (intersection of sets is non-empty):\r\n\r\n    value = propertyInstance._value\r\n    for item in value:\r\n        try:   ## because this is an anymatch situation, it may already have been removed.\r\n            overheadDict%5b item%5d.remove( propertyInstance.proxyId)\r\n        except:\r\n            pass\r\n        try:\r\n            if not len( overheadDict%5b item%5d):\r\n                try:\r\n                    del overheadDict%5b item%5d\r\n                except:\r\n                    pass\r\n        except:\r\n            pass\r\n\r\n#######################################################\r\n## This works either way.\r\ndef Merge_stringSet_PropertyValues( vsv, value1, value2):\r\n    newList = %5b%5d\r\n    for stringItem in value1:\r\n        if stringItem not in newList:\r\n            newList.append( stringItem)\r\n    for stringItem in value2:\r\n        if stringItem not in newList:\r\n            newList.append( stringItem)\r\n    return newList\r\n\r\n#######################################################\r\n## This works either way.\r\ndef ValuesOf_stringSet_PropertyInstancesAreSignificantlyDifferent( vsv, value1, value2):\r\n    if frozenset( value1) == frozenset( value2):\r\n        return False\r\n    else:\r\n        return True  \r\n\r\n#######################################################\r\ndef ProxiesOfSubjectIdentifiedBy_stringSet_Value( vsv, propertyClass, value):\r\n## Subject sameness is sameness of the whole set:\r\n    fset = frozenset( value)\r\n    if propertyClass.overheadDict.has_key( fset):\r\n        return propertyClass.overheadDict%5b fset%5d\r\n    else:\r\n        return %5b%5d  ## empty list -- no match\r\n\r\n#######################################################\r\ndef ProxiesOfSubjectIdentifiedBy_stringSet_anyMatch_Value( vsv, propertyClass, value):\r\n## Subject sameness is sameness of any item in the sets (intersection of sets is non-empty):\r\n    proxyIdList = %5b%5d\r\n    for item in value:\r\n        if propertyClass.overheadDict.has_key( item):\r\n            for proxyId in propertyClass.overheadDict%5b item%5d:\r\n                if proxyId not in proxyIdList:\r\n                    proxyIdList.append( proxyId)\r\n    return proxyIdList\r\n\r\n#######################################################\r\ndef MergeProxiesBecause_stringSet_PropertyInstancesSpecifySameSubject( vsv, propertyClass):\r\n## Subject sameness is sameness of the whole set:\r\n    ## Declare this one if and only if your property class is for SIPs\r\n    ## (subject identity properties).\r\n    for hashablePropertyValue in propertyClass.overheadDict:\r\n        if len( propertyClass.overheadDict%5b hashablePropertyValue%5d) %3e 1:\r\n            vsv.mergeListOfProxies( propertyClass, hashablePropertyValue, propertyClass.overheadDict%5b hashablePropertyValue%5d)\r\n    \r\n#######################################################\r\ndef MergeProxiesBecause_stringSet_anyMatch_PropertyInstancesSpecifySameSubject( vsv, propertyClass):\r\n## Subject sameness is sameness of any item in the sets (intersection of sets is non-empty):\r\n    ## Declare this one if and only if your property class is for SIPs\r\n    ## (subject identity properties).\r\n    itemList = propertyClass.overheadDict.keys()  ## stabilize what we\'re doing\r\n    for item in itemList:\r\n        if len( propertyClass.overheadDict%5b item%5d) %3e 1:\r\n            vsv.mergeListOfProxies( propertyClass, item, propertyClass.overheadDict%5b item%5d)\r\n            foundThingsToMerge = True\r\n\r\n\r\n'%0ap1%0a.</TMAModule

    ><TMAModule ModName="001_VTproxyIdList" ModSrcFileName="001_VTproxyIdList.py">S'#####################################################################\r\n#####################################################################\r\n## Versavant Topic Map Application Bus / Subject Addressing Engine ##\r\n## Copyright 2005 Steven R. Newcomb                                ##\r\n##                                                                 ##\r\n## This software is licensed under the Apache License, Version 2.0 ##\r\n## (the "License"); you may not use this file except in compliance ##\r\n## with the License.  Copies of the License are available at       ##\r\n##        http://www.apache.org/licenses/LICENSE-2.0               ##\r\n##                                                                 ##\r\n## Unless required by applicable law or agreed to in writing,      ##\r\n## software distributed under the License is distributed on an "AS ##\r\n## IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either ##\r\n## express or implied.  See the License for the specific language  ##\r\n## governing permissions and limitations under the License.        ##\r\n##                                                                 ##\r\n## Copies of the source code and the license are available at      ##\r\n##        http://www.versavant.org                                 ##\r\n#####################################################################\r\n#####################################################################\r\n\r\n####################################\r\ncvsRevision = "$Revision: 1.10 $" ##\r\n####################################\r\n\r\n\r\n#############################################\r\n## "proxyIdList" value type implementation ##\r\n#############################################\r\n\r\n## This value type is useful for storing references to proxies,\r\n## regardless of whether they are treated by the property classes that\r\n## use this value type are lists or sets.  For example, you should use\r\n## this "proxyIdList" value type for both "proxyIdSet"-type property\r\n## classes and "proxyIdList"-type property classes.  At this level,\r\n## it doesn\'t matter.\r\n\r\n## Values are lists of proxyIds, i.e., proxy.proxyId values, which are\r\n## always strings of decimal digits that begin with two zeroes.\r\n\r\n## When you create other value types that contain proxy references,\r\n## you can use this implementation as a guide.  It\'s tricky to\r\n## manage proxy references, not only because they die when merged, but\r\n## also because they can\'t possibly retain their original IDs when\r\n## they are imported.\r\n\r\n## NOTE: During importation of instances of this value type from XML,\r\n## some recordkeeping is done in vsv.currentTopicMapHoldingDict%5b\r\n## \'IoMapsDict\'%5d%5b (TMA name)%5d%5b propertyClassName%5d.  \r\n\r\nimport types, traceback\r\n\r\n#######################################################\r\ndef ValueIsNotOfType_proxyIdList_(vsv, propertyValue, propertyClass, propertyInstance = None, **args):\r\n    propertyClassName = propertyClass.propertyClassName\r\n    topicMap = propertyClass.topicMap\r\n    TMA = propertyClass.TMA\r\n    TMAName = TMA.TMAName\r\n\r\n    if not ( isinstance( propertyValue, types.ListType) or isinstance( propertyValue, types.TupleType)):\r\n        traceback.print_stack()\r\n        if propertyInstance:\r\n            vsv.errMsg( \'Value "%25s" of property %25s is neither list nor tuple.\' %25 ( propertyValue, propertyInstance.propertyInstanceKey))\r\n        else:\r\n            vsv.errMsg( \'Value "%25s" of a prospective %25s property is neither list nor tuple.\' %25 ( propertyValue, vsv.catKey( TMAName, propertyClassName)))\r\n        return True\r\n\r\n    for proxyId in propertyValue:\r\n        if not isinstance(proxyId, types.StringType):\r\n            if propertyInstance:\r\n                vsv.errMsg( \'At least one item ("%25s") in the value of property %25s is not a string.\' %25 ( proxyId, propertyInstance.propertyInstanceKey))\r\n            else:\r\n                vsv.errMsg( \'At least one item ("%25s") in the value of a presumptive %25s property is not a string.\' %25 ( proxyId, vsv.catKey( TMAName, propertyClassName)))\r\n            return True\r\n        if not vsv.proxyIdStrValidatorRE.match( proxyId):\r\n            if propertyInstance:\r\n                vsv.errMsg( \'An item ("%25s") in the value of property %25s does not look like a proxy identifier string.\' %25 ( proxyId, propertyInstance.propertyInstanceKey))\r\n            else:\r\n                vsv.errMsg( \'An item ("%25s") in the value of a presumptive %25s property does not look like a proxy identifier string.\' %25 ( proxyId, vsv.catKey( TMAName, propertyClassName)))\r\n            return True\r\n\r\n        proxy = vsv.isProxyId( proxyId, topicMap)\r\n        if not proxy:\r\n            if proxyId not in vsv.currentTopicMapHoldingDict%5b \'IoMapsDict\'%5d%5b \'TMAs\'%5d%5b propertyInstance.TMAName%5d%5b propertyClassName%5d:\r\n                   ## We\'re probably in the process of importing a topic map, and these are\r\n                   ## references to proxies that don\'t exist yet because they haven\'t been imported\r\n                   ## yet.  The above check is supposed to calm our fears that this proxy reference\r\n                   ## is invalid, giving us reason to believe that it will soon be valid, even\r\n                   ## though it\'s not quite valid yet.\r\n\r\n                if propertyInstance:\r\n                    errString = \'An item ("%25s") in the list is not the ID of any proxy in topic map "%25s".\' %25 ( proxyId, propertyInstance.topicMap.topicMapName)\r\n                else:\r\n                    errString = \'An item ("%25s") in the list is not the ID of any proxy in any open topic map.\' %25 ( proxyId)\r\n                vsv.errMsg( errString)\r\n                return True\r\n        if proxy:\r\n            if proxy.forwardTo:\r\n                vsv.errMsg( \'An item ("%25s") in the list that is the value of property %25s is the ID of a dead proxy.  Only the IDs of living proxies are permitted.\' %25 ( proxyId, propertyInstance.topicMap.topicMapName))\r\n                return True\r\n\r\n    return False  ## all\'s well, presumably.                    \r\n\r\n#######################################################\r\ndef ValueIsNotOfType_proxyIdAndNoneList_(vsv, propertyValue, propertyClass, propertyInstance = None, **args):\r\n    propertyClassName = propertyClass.propertyClassName\r\n    topicMap = propertyClass.topicMap\r\n    TMA = propertyClass.TMA\r\n    TMAName = TMA.TMAName\r\n\r\n    if not ( isinstance( propertyValue, types.ListType) or isinstance( propertyValue, types.TupleType)):\r\n        traceback.print_stack()\r\n        if propertyInstance:\r\n            vsv.errMsg( \'Value "%25s" of property %25s is neither list nor tuple.\' %25 ( propertyValue, propertyInstance.propertyInstanceKey))\r\n        else:\r\n            vsv.errMsg( \'Value "%25s" of a prospective %25s property is neither list nor tuple.\' %25 ( propertyValue, vsv.catKey( TMAName, propertyClassName)))\r\n        return True\r\n\r\n    for proxyId in propertyValue:\r\n\r\n        if not ( isinstance( proxyId, types.StringType) or isinstance( proxyId, types.NoneType)):\r\n            if propertyInstance:\r\n                vsv.errMsg( \'At least one item ("%25s") in the value of property %25s is neither string nor None.\' %25 ( proxyId, propertyInstance.propertyInstanceKey))\r\n            else:\r\n                vsv.errMsg( \'At least one item ("%25s") in the value of a presumptive %25s property is neither string nor None.\' %25 ( proxyId, vsv.catKey( TMAName, propertyClassName)))\r\n            return True\r\n\r\n        if proxyId != None:\r\n            if not vsv.proxyIdStrValidatorRE.match( proxyId):\r\n                if propertyInstance:\r\n                    vsv.errMsg( \'A string ("%25s") in the value of property %25s does not look like a proxy identifier string.\' %25 ( proxyId, propertyInstance.propertyInstanceKey))\r\n                else:\r\n                    vsv.errMsg( \'An string ("%25s") in the value of a presumptive %25s property does not look like a proxy identifier string.\' %25 ( proxyId, vsv.catKey( TMAName, propertyClassName)))\r\n                return True\r\n\r\n            if not topicMap.proxies.has_key( proxyId):\r\n                if proxyId not in vsv.currentTopicMapHoldingDict%5b \'IoMapsDict\'%5d%5b \'TMAs\'%5d%5b propertyInstance.TMAName%5d%5b propertyClassName%5d:\r\n                       ## We\'re probably in the process of importing a topic map, and these are\r\n                       ## references to proxies that don\'t exist yet because they haven\'t been imported\r\n                       ## yet.  The above check is supposed to calm our fears that this proxy reference\r\n                       ## is invalid, giving us reason to believe that it will soon be valid, even\r\n                       ## though it\'s not quite valid yet.\r\n\r\n                    if propertyInstance:\r\n                        errString = \'An item ("%25s") in the list is not the ID of any proxy in topic map "%25s".\' %25 ( proxyId, propertyInstance.topicMap.topicMapName)\r\n                    else:\r\n                        errString = \'An item ("%25s") in the list is not the ID of any proxy in any open topic map.\' %25 ( proxyId)\r\n                    vsv.errMsg( errString)\r\n                    return True\r\n            else:\r\n                proxy = topicMap.proxies%5b proxyId%5d\r\n                if proxy.forwardTo:\r\n                    vsv.errMsg( \'An item ("%25s") in the list that is the value of property %25s is the ID of a dead proxy.  Only the IDs of living proxies are permitted.\' %25 ( proxyId, propertyInstance.topicMap.topicMapName))\r\n                    return True\r\n\r\n    return False  ## all\'s well, presumably.                    \r\n\r\n#######################################################\r\ndef InstanceOf_proxyIdList_ValueTypeToXMLContentString(vsv, propertyInstance):\r\n    return vsv.cPickleDumpObjectAsXMLContentString( propertyInstance._value)\r\n\r\n#######################################################\r\ndef XMLContentStringToInstanceOf_proxyIdList_ValueType(vsv, string, propertyClass, **args):\r\n    ## Import a list of proxy references, adjusting them as necessary to\r\n    ## the new proxyIds of the imported proxies to which they refer.\r\n\r\n    oldProxyIdList = vsv.cPickleLoadObjectFromXMLContentString( string)\r\n\r\n    mem2xmlProxyIdDict = vsv.currentTopicMapHoldingDict%5b \'IoMapsDict\'%5d%5b \'ProxyIds.mem2xml\'%5d\r\n        ## This dictionary allows us to look up the in-xml element id of a\r\n        ## proxy, given the proxy\'s proxyId as it was in the topic map\r\n        ## from which the proxy was exported as xml.\r\n\r\n    firstImportedProxyId = vsv.firstImportedProxyId\r\n        ## This is an integer which, if we were to convert it into a\r\n        ## string of decimal digits with 2 prepended zero characters,\r\n        ## would be the proxyId of the first (the first, that is, not\r\n        ## counting the proxies created in order to register the TMAs\r\n        ## of the xml topic map being imported) in-memory proxy to be\r\n        ## imported into the being-imported-into topic map from the\r\n        ## xml topic map that we\'re importing.\r\n\r\n    propertyClassName = propertyClass.propertyClassName\r\n    TMAName = propertyClass.TMA.TMAName\r\n\r\n    newProxyIdList = %5b%5d\r\n\r\n    for oldProxyId in oldProxyIdList:\r\n        xmlProxyNum = mem2xmlProxyIdDict%5b int( oldProxyId)%5d\r\n        newProxyNum = (xmlProxyNum + firstImportedProxyId) - 1\r\n        newProxyId = \'00%25s\' %25 ( newProxyNum)\r\n        newProxyIdList.append( newProxyId)\r\n\r\n        appDict = vsv.currentTopicMapHoldingDict%5b \'IoMapsDict\'%5d%5b \'TMAs\'%5d%5b TMAName%5d\r\n        if not appDict.has_key( propertyClassName):\r\n            appDict%5b propertyClassName%5d = %5b newProxyId%5d\r\n        else:\r\n            if newProxyId not in appDict%5b propertyClassName%5d:\r\n                appDict%5b propertyClassName%5d.append( newProxyId)\r\n    ## vsv.IoMapsDict%5b args%5b \'TMAName\'%5d%5d%5b propertyClassName%5d will be consulted by\r\n    ## the ValueIsNotOfType__() function in order to avoid a logical logjam over this.\r\n    ## The logical logjam is that we\'re referring to proxies that haven\'t been imported\r\n    ## yet, and the ValueIsNotOfType__() function checks to see that the proxy references are valid.\r\n    ## This gives the ValueIsNotOfType__() function something to fall back on, as it checks.\r\n    ## See that function, above, for more.\r\n\r\n    return newProxyIdList\r\n\r\n#######################################################\r\ndef InstanceOf_proxyIdListRaw_ValueTypeToXMLContentString(vsv, propertyInstance):\r\n    return repr( propertyInstance._value)\r\n\r\n#######################################################\r\ndef XMLContentStringToInstanceOf_proxyIdListRaw_ValueType(vsv, string, propertyClass, **args):\r\n    ## Import a list of proxy references, adjusting them as necessary to\r\n    ## the new proxyIds of the imported proxies to which they refer.\r\n\r\n    exec \'oldProxyIdList = %25s\' %25 ( string)\r\n\r\n    mem2xmlProxyIdDict = vsv.currentTopicMapHoldingDict%5b \'IoMapsDict\'%5d%5b \'ProxyIds.mem2xml\'%5d\r\n        ## This dictionary allows us to look up the in-xml element id of a\r\n        ## proxy, given the proxy\'s proxyId as it was in the topic map\r\n        ## from which the proxy was exported as xml.\r\n\r\n    firstImportedProxyId = vsv.firstImportedProxyId\r\n        ## This is an integer which, if we were to convert it into a\r\n        ## string of decimal digits with 2 prepended zero characters,\r\n        ## would be the proxyId of the first (the first, that is, not\r\n        ## counting the proxies created in order to register the TMAs\r\n        ## of the xml topic map being imported) in-memory proxy to be\r\n        ## imported into the being-imported-into topic map from the\r\n        ## xml topic map that we\'re importing.\r\n\r\n    propertyClassName = propertyClass.propertyClassName\r\n    TMAName = propertyClass.TMA.TMAName\r\n\r\n    newProxyIdList = %5b%5d\r\n\r\n    for oldProxyId in oldProxyIdList:\r\n        if oldProxyId == None:\r\n            newProxyIdList.append( None)\r\n        else:\r\n            xmlProxyNum = mem2xmlProxyIdDict%5b int( oldProxyId)%5d\r\n            newProxyNum = (xmlProxyNum + firstImportedProxyId) - 1\r\n            newProxyId = \'00%25s\' %25 ( newProxyNum)\r\n            newProxyIdList.append( newProxyId)\r\n\r\n            appDict = vsv.currentTopicMapHoldingDict%5b \'IoMapsDict\'%5d%5b \'TMAs\'%5d%5b TMAName%5d\r\n            if not appDict.has_key( propertyClassName):\r\n                appDict%5b propertyClassName%5d = %5b newProxyId%5d\r\n            else:\r\n                if newProxyId not in appDict%5b propertyClassName%5d:\r\n                    appDict%5b propertyClassName%5d.append( newProxyId)\r\n        ## vsv.IoMapsDict%5b args%5b \'TMAName\'%5d%5d%5b propertyClassName%5d will be consulted by\r\n        ## the ValueIsNotOfType__() function in order to avoid a logical logjam over this.\r\n        ## The logical logjam is that we\'re referring to proxies that haven\'t been imported\r\n        ## yet, and the ValueIsNotOfType__() function checks to see that the proxy references are valid.\r\n        ## This gives the ValueIsNotOfType__() function something to fall back on, as it checks.\r\n        ## See that function, above, for more.\r\n\r\n    return newProxyIdList\r\n\r\n#######################################################\r\ndef InstanceOf_proxyIdListRaw_ValueTypeToXMLContentString(vsv, propertyInstance):\r\n    return repr( propertyInstance._value)\r\n\r\n#######################################################\r\ndef XMLContentStringToInstanceOf_proxyIdOrNoneListRaw_ValueType(vsv, string, propertyClass, **args):\r\n    ## Import a list of proxy references, adjusting them as necessary to\r\n    ## the new proxyIds of the imported proxies to which they refer.\r\n\r\n    exec \'oldProxyIdList = %25s\' %25 ( string)\r\n\r\n    mem2xmlProxyIdDict = vsv.currentTopicMapHoldingDict%5b \'IoMapsDict\'%5d%5b \'ProxyIds.mem2xml\'%5d\r\n        ## This dictionary allows us to look up the in-xml element id of a\r\n        ## proxy, given the proxy\'s proxyId as it was in the topic map\r\n        ## from which the proxy was exported as xml.\r\n\r\n    firstImportedProxyId = vsv.firstImportedProxyId\r\n        ## This is an integer which, if we were to convert it into a\r\n        ## string of decimal digits with 2 prepended zero characters,\r\n        ## would be the proxyId of the first (the first, that is, not\r\n        ## counting the proxies created in order to register the TMAs\r\n        ## of the xml topic map being imported) in-memory proxy to be\r\n        ## imported into the being-imported-into topic map from the\r\n        ## xml topic map that we\'re importing.\r\n\r\n    propertyClassName = propertyClass.propertyClassName\r\n    TMAName = propertyClass.TMA.TMAName\r\n\r\n    newProxyIdList = %5b%5d\r\n\r\n    for oldProxyId in oldProxyIdList:\r\n        if oldProxyId != None:\r\n            xmlProxyNum = mem2xmlProxyIdDict%5b int( oldProxyId)%5d\r\n            newProxyNum = (xmlProxyNum + firstImportedProxyId) - 1\r\n            newProxyId = \'00%25s\' %25 ( newProxyNum)\r\n            newProxyIdList.append( newProxyId)\r\n\r\n            appDict = vsv.currentTopicMapHoldingDict%5b \'IoMapsDict\'%5d%5b \'TMAs\'%5d%5b TMAName%5d\r\n            if not appDict.has_key( propertyClassName):\r\n                appDict%5b propertyClassName%5d = %5b newProxyId%5d\r\n            else:\r\n                if newProxyId not in appDict%5b propertyClassName%5d:\r\n                    appDict%5b propertyClassName%5d.append( newProxyId)\r\n        ## vsv.IoMapsDict%5b args%5b \'TMAName\'%5d%5d%5b propertyClassName%5d will be consulted by\r\n        ## the ValueIsNotOfType__() function in order to avoid a logical logjam over this.\r\n        ## The logical logjam is that we\'re referring to proxies that haven\'t been imported\r\n        ## yet, and the ValueIsNotOfType__() function checks to see that the proxy references are valid.\r\n        ## This gives the ValueIsNotOfType__() function something to fall back on, as it checks.\r\n        ## See that function, above, for more.\r\n\r\n        else:\r\n            newProxyIdList.append( None)\r\n\r\n    return newProxyIdList\r\n\r\n'%0ap1%0a.</TMAModule

    ><TMAModule ModName="001_VTstring" ModSrcFileName="001_VTstring.py">S'#####################################################################\r\n#####################################################################\r\n## Versavant Topic Map Application Bus / Subject Addressing Engine ##\r\n## Copyright 2005 Steven R. Newcomb                                ##\r\n##                                                                 ##\r\n## This software is licensed under the Apache License, Version 2.0 ##\r\n## (the "License"); you may not use this file except in compliance ##\r\n## with the License.  Copies of the License are available at       ##\r\n##        http://www.apache.org/licenses/LICENSE-2.0               ##\r\n##                                                                 ##\r\n## Unless required by applicable law or agreed to in writing,      ##\r\n## software distributed under the License is distributed on an "AS ##\r\n## IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either ##\r\n## express or implied.  See the License for the specific language  ##\r\n## governing permissions and limitations under the License.        ##\r\n##                                                                 ##\r\n## Copies of the source code and the license are available at      ##\r\n##        http://www.versavant.org                                 ##\r\n#####################################################################\r\n#####################################################################\r\n\r\n####################################\r\ncvsRevision = "$Revision: 1.7 $" ##\r\n####################################\r\n\r\n\r\n################################################################\r\n## This simple value type is for strings.                     ##\r\n## They will be stored in pickled form                        ##\r\n## in the XML file.  (See below for raw storage and unicode.) ##\r\n################################################################\r\n\r\nimport types\r\n\r\n#######################################################\r\ndef ValueIsNotOfType_string_( vsv, propertyValue, propertyClass, propertyInstance = None):\r\n    if not ( isinstance( propertyValue, types.StringType) or isinstance( propertyValue, types.UnicodeType)):\r\n        vsv.errMsg( \'Value "%25s" is neither a string nor a unicode; it\\\'s a %25s.\' %25 ( propertyValue, type( propertyValue)))\r\n        return True\r\n    return False\r\n\r\n#######################################################\r\ndef InstanceOf_string_ValueTypeToXMLContentString( vsv, propertyInstance):\r\n    return vsv.cPickleDumpObjectAsXMLContentString( propertyInstance._value)\r\n\r\n#######################################################\r\ndef XMLContentStringToInstanceOf_string_ValueType( vsv, string, propertyClass):\r\n    return vsv.cPickleLoadObjectFromXMLContentString( string)\r\n\r\n\r\n#######################################################\r\ndef InstanceOf_stringRaw_ValueTypeToXMLContentString( vsv, propertyInstance):\r\n    return propertyInstance._value.replace( \'%3c\', \'%25.LT.%25\').replace( \'%3e\', \'%25.GT.%25\')\r\n\r\n#######################################################\r\ndef XMLContentStringToInstanceOf_stringRaw_ValueType( vsv, string, propertyClass):\r\n    return string.replace( \'%25.LT.%25\', \'%3c\').replace( \'%25.GT.%25\', \'%3e\')\r\n\r\n######################################################################\r\n## Use these for string values that need to be directly editable in ##\r\n## the interchangeable XML file.  This avoids pickling/unpickling,  ##\r\n## allowing the strings to appear "in the raw" in the file.         ##\r\n######################################################################\r\ndef ValueIsNotOfType_rawString_( vsv, propertyValue, propertyClass, propertyInstance = None):\r\n    if not isinstance( propertyValue, types.StringType):\r\n        vsv.errMsg( \'Value "%25s" is not a string, it is a %25s.\' %25 ( propertyValue, type( propertyValue)))\r\n        return True\r\n    return False\r\n\r\n#######################################################\r\ndef InstanceOf_rawString_ValueTypeToXMLContentString( vsv, propertyInstance):\r\n    return propertyInstance._value.replace( \'%26\', \'%26amp;\').replace( \'%3c\', \'%26lt;\').replace( \'%3e\', \'%26gt;\').encode( \'utf-8\')\r\n\r\n#######################################################\r\ndef XMLContentStringToInstanceOf_rawString_ValueType( vsv, string, propertyClass):\r\n    return string.replace( \'%26lt;\', \'%3c\').replace( \'%26gt;\', \'%3e\').replace( \'%26amp;\', \'%26\').encode( \'ASCII\')\r\n\r\n\r\n\r\n\r\n## Unicode version, with pickling. ##\r\n#######################################################\r\ndef ValueIsNotOfType_unicodeString_( vsv, propertyValue, propertyClass, propertyInstance = None):\r\n    if not isinstance( propertyValue, types.UnicodeType):\r\n        vsv.errMsg( \'Value "%25s" is not a Unicode string.\' %25 ( propertyValue))\r\n        return True\r\n    return False\r\n\r\n#######################################################\r\ndef InstanceOf_unicodeString_ValueTypeToXMLContentString( vsv, propertyInstance):\r\n    return vsv.cPickleDumpObjectAsXMLContentString( propertyInstance._value)\r\n\r\n#######################################################\r\ndef XMLContentStringToInstanceOf_unicodeString_ValueType( vsv, string, propertyClass):\r\n    return vsv.cPickleLoadObjectFromXMLContentString( string)\r\n\r\n\r\n## Unicode version, no pickling (raw). ##\r\n######################################################################\r\n## Use these for string values that need to be directly editable in ##\r\n## the interchangeable XML file.  This avoids pickling/unpickling,  ##\r\n## allowing the strings to appear "in the raw" in the file.         ##\r\n######################################################################\r\ndef ValueIsNotOfType_rawUnicodeString_( vsv, propertyValue, propertyClass, propertyInstance = None):\r\n    if not ( isinstance( propertyValue, types.UnicodeType) or isinstance( propertyValue, types.StringType)):\r\n        vsv.errMsg( \'Value "%25s" is neither a %3ctype \\\'unicode\\\'%3e nor a %3ctype \\\'str\\\'%3e; it\\\'s a %25s.\' %25 ( propertyValue, type( propertyValue)))\r\n        return True\r\n    return False\r\n\r\n#######################################################\r\ndef InstanceOf_rawUnicodeString_ValueTypeToXMLContentString( vsv, propertyInstance):\r\n##    return pro