Changeset 1416

Show
Ignore:
Timestamp:
09/10/08 22:57:51 (2 months ago)
Author:
sgillies
Message:

Improve temporal attestation titles and indexing

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • PleiadesEntity/trunk/Extensions/loader.py

    r1415 r1416  
    143143    } 
    144144 
    145 periods = {"Archaic":"Archaic (pre-550 BC)",  
    146     "Classical":"Classical (550 - 330 BC)", 
    147     "Hellenistic (Roman Republic)":"Hellenistic/Republican (330 - 30 BC)", 
    148     "Roman":"Roman (30 BC - AD 300)", 
    149     "Late Antique":"Late Antique (AD 300 - 625)"} 
    150 period_ids = {"Archaic":"archaic",  
    151     "Classical":"classical", 
    152     "Hellenistic (Roman Republic)":"hellenistic-republican", 
    153     "Roman":"roman", 
    154     "Late Antique":"late-antique"} 
     145periods = { 
     146    "Archaic": "Archaic (pre-550 BC)",  
     147    "Classical": "Classical (550 - 330 BC)", 
     148    "Hellenistic (Roman Republic)": "Hellenistic (Roman Republic; 330 - 30 BC)", 
     149    "Roman": "Roman (Early Empire; 30 BC - AD 300)", 
     150    "Late Antique": "Late Antique (AD 300 - 640)" 
     151    } 
     152period_ids = { 
     153    "Archaic": "archaic",  
     154    "Classical": "classical", 
     155    "Hellenistic (Roman Republic)": "hellenistic-republican", 
     156    "Roman": "roman", 
     157    "Late Antique": "late-antique" 
     158    } 
    155159 
    156160def parse_periods(xmlcontext, portalcontext, **kw): 
     
    184188            portalcontext.invokeFactory('TemporalAttestation', 
    185189                id=id, 
    186                 timePeriod=period, 
     190                timePeriod=id, 
    187191                attestationConfidence=confidence, 
    188192                **kw 
  • PleiadesEntity/trunk/content/TemporalAttestation.py

    r1401 r1416  
    8787    security.declareProtected(permissions.View, 'get_title') 
    8888    def get_title(self): 
    89         """Return a title string derived from the associated time period and attestation certainty """ 
    90         title = "Attested: %s" % self.getTimePeriod() 
     89        """Return a title string derived from the associated time period and 
     90        attestation certainty """ 
     91        vocab = self.getField('timePeriod').vocabulary 
     92        vd = dict(vocab.getDisplayList(self).items()) 
     93        tv = vd.get(self.getTimePeriod(), None) 
     94        title = "Attested: %s" % tv 
    9195        confidence = self.getAttestationConfidence() 
    9296        if confidence.startswith('less-'): 
  • PleiadesEntity/trunk/tests/LoadEntity.txt

    r1401 r1416  
    8787    >>> tps0 = tps[0].getObject() 
    8888    >>> tps0.Title() 
    89     'Attested: Roman (30 BC - AD 300)' 
     89    'Attested: Roman (Early Empire; 30 BC - AD 300)' 
    9090    >>> tps0.getId() 
    9191    'roman' 
     
    9494    >>> tps1 = tps[1].getObject() 
    9595    >>> tps1.Title() 
    96     'Attested: Late Antique (AD 300 - 625)' 
     96    'Attested: Late Antique (AD 300 - 640)' 
    9797    >>> tps1.getId() 
    9898    'late-antique' 
     
    111111 
    112112    >>> n0.getTimePeriods() 
    113     ['Roman (30 BC - AD 300)', 'Late Antique (AD 300 - 625)'] 
     113    ['roman', 'late-antique'] 
    114114 
    115115    >>> n1 = folder['names'][nids[1]] 
     
    168168    >>> tps1 = tps[1].getObject() 
    169169    >>> tps1.Title() 
    170     'Attested: Roman (30 BC - AD 300)' 
     170    'Attested: Roman (Early Empire; 30 BC - AD 300)' 
    171171    >>> tps1.getId() 
    172172    'roman' 
     
    175175    >>> tps2 = tps[2].getObject() 
    176176    >>> tps2.Title() 
    177     'Attested: Late Antique (AD 300 - 625)' 
     177    'Attested: Late Antique (AD 300 - 640)' 
    178178    >>> tps2.getId() 
    179179    'late-antique' 
     
    181181    'confident' 
    182182    >>> l.getTimePeriods() 
    183     ['Classical (550 - 330 BC)', 'Roman (30 BC - AD 300)', 'Late Antique (AD 300 - 625)'] 
     183    ['classical', 'roman', 'late-antique'] 
    184184 
    185185    Check Place time periods 
    186186 
    187187    >>> p.getTimePeriods() 
    188     ['Classical (550 - 330 BC)', 'Roman (30 BC - AD 300)', 'Late Antique (AD 300 - 625)'] 
     188    ['classical', 'roman', 'late-antique'] 
    189189 
    190190    Test associations 
  • PleiadesEntity/trunk/tests/TemporalAttestations.txt

    r1356 r1416  
    5656    >>> tps1 = tps[1].getObject() 
    5757    >>> tps1.Title() 
    58     'Attested: Hellenistic/Republican (330 - 30 BC)?' 
     58    'Attested: Hellenistic (Roman Republic; 330 - 30 BC)?' 
    5959    >>> tps1.getId() 
    6060    'hellenistic-republican' 
     
    6868    >>> tps0 = tps[0].getObject() 
    6969    >>> tps0.Title() 
    70     'Attested: Roman (30 BC - AD 300) - inferred' 
     70    'Attested: Roman (Early Empire; 30 BC - AD 300) - inferred' 
    7171    >>> tps0.getId() 
    7272    'roman' 
     
    7676    >>> tps1 = tps[1].getObject() 
    7777    >>> tps1.Title() 
    78     'Attested: Late Antique (AD 300 - 625)? - inferred' 
     78    'Attested: Late Antique (AD 300 - 640)? - inferred' 
    7979    >>> tps1.getId() 
    8080    'late-antique' 
     
    107107    >>> tps2 = tps[2].getObject() 
    108108    >>> tps2.Title() 
    109     'Attested: Hellenistic/Republican (330 - 30 BC)?' 
     109    'Attested: Hellenistic (Roman Republic; 330 - 30 BC)?' 
    110110    >>> tps2.getId() 
    111111    'hellenistic-republican' 
     
    115115    >>> tps3 = tps[3].getObject() 
    116116    >>> tps3.Title() 
    117     'Attested: Roman (30 BC - AD 300)' 
     117    'Attested: Roman (Early Empire; 30 BC - AD 300)' 
    118118    >>> tps3.getId() 
    119119    'roman' 
     
    123123    >>> tps4 = tps[4].getObject() 
    124124    >>> tps4.Title() 
    125     'Attested: Late Antique (AD 300 - 625)?' 
     125    'Attested: Late Antique (AD 300 - 640)?' 
    126126    >>> tps4.getId() 
    127127    'late-antique' 
  • PleiadesEntity/trunk/time.py

    r1401 r1416  
    88        vt = self.vtool.getVocabularyByName('time-periods') 
    99        self.t_keys = vt.getDisplayList(vt).keys() 
    10         self.t_vals = vt.getDisplayList(vt).values() 
    1110 
    1211    def __call__(self, a, b): 
    1312        if a in self.t_keys: 
    1413            ai = self.t_keys.index(a) 
    15         elif a in self.t_vals: 
    16             ai = self.t_vals.index(a) 
    1714        else: 
    1815            # a value not in the vocab is greater 
     
    2017        if b in self.t_keys: 
    2118            bi = self.t_keys.index(b) 
    22         elif b in self.t_vals: 
    23             bi = self.t_vals.index(b) 
    2419        else: 
    2520            # a value not in the vocab is greater 
    2621            return -1 
    27  
    2822        return ai - bi