Example #1
0
 def col_defs(self):
     if self.parameter:
         return [
             LinkCol(self,
                     'sample',
                     model_col=Sample.name,
                     get_object=lambda i: i.valueset.language),
             Col(self,
                 'region',
                 model_col=Sample.region,
                 get_object=lambda i: i.valueset.language,
                 format=lambda i: i.valueset.language.region),
             FamilyCol(self,
                       'family',
                       get_object=lambda i: i.valueset.language.languoid,
                       model_col=Languoid.family_name,
                       choices=get_distinct_values(Languoid.family_name)),
             Col(self, 'value', model_col=Measurement.value),
             LinkToMapCol(self,
                          '#',
                          get_object=lambda i: i.valueset.language),
         ]
     if self.language:
         return [
             LinkCol(self,
                     'measure',
                     model_col=Parameter.name,
                     get_object=lambda i: i.valueset.parameter),
             Col(self,
                 'description',
                 get_object=lambda i: i.valueset.parameter,
                 model_col=Parameter.description),
             Col(self, 'value', model_col=Measurement.value),
         ]
     return Values.col_defs(self)
Example #2
0
    def col_defs(self):
        refs_col = RefsCol(self, 'references')
        res = [DetailsRowLinkCol(self, 'd')]
        get = lambda what, i: getattr(i, {'p': 'parameter', 'l': 'language'}[what])

        if self.parameter:
            return res + [
                LinkCol(self, 'language',
                        model_col=Language.name, get_obj=partial(get, 'l')),
                refs_col,
                LinkToMapCol(self, 'm', get_obj=partial(get, 'l')),
            ]

        if self.language:
            return res + [
                LinkCol(self, 'parameter',
                        model_col=Parameter.name, get_obj=partial(get, 'p')),
                refs_col,
            ]

        return res + [
            LinkCol(self, 'language', model_col=Language.name, get_obj=partial(get, 'l')),
            LinkCol(
                self, 'parameter', model_col=Parameter.name, get_obj=partial(get, 'p')),
            refs_col,
        ]
Example #3
0
 def col_defs(self):
     res = [
         ConceptIdCol(self, 'id', sClass='left'),
     ]
     if self.parameter:
         res.extend([
             Col(self, 'name', sTitle='Concept in source'),
             Col(self, 'description', sTitle='English gloss'),
             LinkCol(self,
                     'conceptlist',
                     get_object=lambda v: v.valueset.contribution),
         ])
     elif self.contribution:
         #
         # TODO: join Value_data for each source language!
         #
         for lang, alias in self._langs.items():
             res.append(ConceptInSourceCol(self, lang, alias=alias))
         res.append(Col(self, 'description', sTitle='English gloss'))
         res.append(
             LinkCol(self,
                     'concept_set',
                     model_col=Parameter.name,
                     get_object=lambda v: v.valueset.parameter))
     else:
         res.extend([
             Col(self, 'name', sTitle='Description in source'),
             Col(self, 'description', sTitle='English gloss'),
             LinkCol(self,
                     'concept_set',
                     model_col=Parameter.name,
                     get_object=lambda v: v.valueset.parameter),
         ])
     return res
Example #4
0
 def col_defs(self):
     res = []
     if self.language:
         res.extend([
             LinkCol(self,
                     'gloss_en',
                     sTitle=self.req._('English'),
                     model_col=common.Parameter.name,
                     get_object=lambda v: v.valueset.parameter),
         ])
     elif self.parameter:
         res.extend([
             LinkCol(self,
                     'language',
                     sTitle=self.req._('Language'),
                     get_object=lambda v: v.valueset.language),
             Col(
                 self,
                 'desc',
                 sTitle=self.req._('Location'),
                 get_object=lambda v: v.valueset.language,
                 model_col=common.Language.description,
             ),
         ])
         # FIXME: link to map!
     res.append(Col(self, 'name', sTitle=self.req._('Word')))
     res.append(AudioCol(self, '#'))
     return res
Example #5
0
 def col_defs(self):
     base = [
         Col(self, 'id', bSortable=False, input_size='mini'),
         LinkCol(self,
                 'name',
                 sTitle='Primary text',
                 sClass="object-language"),
         TsvCol(self, 'analyzed', sTitle='Analyzed text'),
         TsvCol(self, 'gloss', sClass="gloss"),
         Col(self,
             'description',
             sTitle=self.req.translate('Translation'),
             sClass="translation"),
         DetailsRowLinkCol(self, "d", sTitle="IGT"),
     ]
     if not self.language:
         base.append(
             LinkCol(self,
                     'language',
                     model_col=Language.name,
                     get_obj=lambda i: i.language,
                     bSortable=not self.language,
                     bSearchable=not self.language))
     base.append(RefsCol(self, 'references'))
     return base
Example #6
0
 def col_defs(self):
     cols = [
         LinkCol(
             self,
             'language',
             model_col=common.Language.name,
             get_obj=lambda i: i.language,
             bSortable=not self.language,
             bSearchable=not self.language),
         LinkCol(self, 'name', sTitle='Primary text', sClass="object-language"),
         TsvCol(self, 'analyzed', sTitle='Analyzed text'),
         TsvCol(self, 'gloss', sClass="gloss"),
         Col(self,
             'description',
             sTitle=self.req.translate('Translation'),
             sClass="translation"),
         DetailsRowLinkCol(self, 'd'),
     ]
     if not self.crossgramdata:
         cols.append(LinkCol(
             self,
             'contribution',
             model_col=models.CrossgramData.name,
             get_obj=lambda i: i.contribution))
     return cols
Example #7
0
    def col_defs(self):
        base = [
            LinkCol(self, 'name'),
        ]
        if not self.language:
            base.append(
                LinkCol(self,
                        'language',
                        get_obj=lambda i: i.language,
                        model_col=Language.name))

        if not self.declarativetype:
            base.append(
                LinkCol(self,
                        'declarativetype',
                        sTitle="Declarative?",
                        get_obj=lambda i: i.declarativetype,
                        model_col=DeclarativeType.name))

        if not self.mainclauseverb:
            base.append(
                LinkCol(self,
                        'mainclauseverb',
                        sTitle="Main clause construction?",
                        get_obj=lambda i: i.mainclauseverb,
                        model_col=MainClauseVerb.name))

        return base
Example #8
0
 def col_defs(self):
     base = [
         LinkCol(self,
                 'form',
                 get_obj=lambda i: i.unit,
                 model_col=Morpheme.name),
     ]
     if not self.unitparameter:
         base.append(FunctionCol(self, 'function',
                                 get_obj=lambda i: i.unit))
     if not self.construction:  #
         if self.meaning_type != "lexical":
             base.append(
                 LinkCol(self,
                         'construction',
                         get_obj=lambda i: i.construction,
                         model_col=Construction.name))
     if not self.language and not self.construction:
         base.append(
             LinkCol(self,
                     'language',
                     model_col=Language.name,
                     get_obj=lambda i: i.unit.language))
     return base + [
         CognatesetCol(self,
                       'cognatesets',
                       get_obj=lambda i: i.unit.counterparts,
                       bSearchable=False),
         RefsCol(self, 'references', get_obj=lambda i: i.unit)
     ]
Example #9
0
 def col_defs(self):
     res = []
     if self.parameter:
         res = [
             LinkCol(self,
                     'language',
                     model_col=Language.name,
                     get_object=lambda i: i.valueset.language),
         ]
     elif self.language:
         res = [
             IntegerIdCol(self,
                          'id',
                          input_size='mini',
                          model_col=Parameter.id,
                          get_object=lambda i: i.valueset.parameter),
             LinkCol(self,
                     'meaning',
                     model_col=Parameter.name,
                     get_object=lambda i: i.valueset.parameter),
         ]
     return res + [
         Col(self, 'name', sTitle='Word', model_col=Value.name),
         Col(self, 'loan', model_col=Word.loan),
     ]
Example #10
0
    def col_defs(self):
        if self.parameter:
            return [
                LinkCol(self,
                        'language',
                        model_col=common.Language.name,
                        get_object=lambda i: i.valueset.language),
                Col(self, 'name', sTitle='Orthography'),
                Col(self, 'description', sTitle='IPA'),
                Col(self, 'segments', model_col=models.Form.segments),
                LinkToMapCol(self, 'm', get_object=lambda i: i.valueset.language),
            ]

        if self.language:
            return [
                LinkCol(self,
                        'parameter',
                        sTitle=self.req.translate('Parameter'),
                        model_col=common.Parameter.name,
                        get_object=lambda i: i.valueset.parameter),
                Col(self, 'name', sTitle='Orthography'),
                Col(self, 'description', sTitle='IPA'),
                Col(self, 'segments', model_col=models.Form.segments),
            ]

        return [
            Col(self, 'name', sTitle='Orthography'),
            Col(self, 'description', sTitle='IPA'),
            Col(self, 'segments', model_col=models.Form.segments),
        ]
Example #11
0
 def col_defs(self):
     return [
         LinkCol(self, 'name'),
         DescriptionLinkCol(self, 'description'),
         LinkCol(
             self, 'language', model_col=Language.name, get_obj=lambda i: i.language),
     ]
Example #12
0
 def col_defs(self):
     res = [
         LinkCol(self, 'name'),
         Col(self, 'description'),
     ]
     if not self.panel:
         res.append(LinkCol(self, 'panel', get_object=lambda i: i.panel))
     return res
Example #13
0
 def col_defs(self):
     name_col = unitvalue.UnitValueNameCol(self, 'value')
     if self.unitparameter and self.unitparameter.domain:
         name_col.choices = sorted([de.name for de in self.unitparameter.domain])
     return [
         name_col,
         LinkCol(self, 'word', get_object=lambda i: i.unit, model_col=common.Unit.name),
         LinkCol(self, 'dictionary', get_object=lambda i: i.unit.dictionary, model_col=Dictionary.name),
     ]
Example #14
0
 def col_defs(self):
     return [
             Col(self, 'grapheme', sTitle='Grapheme'), 
             LinkCol(self, 'name', get_objects=lambda v:
                 v.valueset.parameter),
             Col(self, 'bipa_grapheme', sTitle="BIPA Grapheme"),
             Col(self, 'frequency', sTitle='Frequency'),
             LinkCol(self, 'transcription_data', get_object=lambda v:
                 v.valueset.contribution, sTitle="Dataset"),
             Col(self, 'url', sTitle="URL")
             ]
Example #15
0
 def col_defs(self):
     name_col = UnitValueNameCol(self, 'value')
     if self.unitparameter and self.unitparameter.domain:
         name_col.choices = sorted([de.name for de in self.unitparameter.domain])
     return [
         LinkCol(self, 'Construction', get_obj=lambda i: i.unit, model_col=common.Unit.name),
         ConstructionFeatureIdCol(self, 'Feature Id', sClass='left', model_col=sailsUnitParameter.id, get_obj=lambda i: i.unitparameter),
         LinkCol(self, 'Feature', get_obj=lambda i: i.unitparameter, model_col=common.UnitParameter.name),
         name_col,
         Col(self, 'Source', model_col=sailsUnitValue.source),
         Col(self, 'Comment', model_col=sailsUnitValue.comment)
     ]
Example #16
0
 def col_defs(self):
     cols = [DetailsRowLinkCol(self, 'd')]
     if not self.crossgramdata:
         cols.append(LinkCol(
             self,
             'contribution',
             model_col=models.CrossgramData.name,
             get_obj=lambda i: i.contribution))
     cols.extend([
         LinkCol(self, 'name'),
         Col(self, 'description')])
     return cols
Example #17
0
 def col_defs(self):
     return [
         LinkCol(self,
                 'language',
                 get_obj=lambda i: i.counterpart.language,
                 model_col=Language.name),
         LinkCol(self,
                 'form',
                 get_obj=lambda i: i.counterpart,
                 model_col=Morpheme.name),
         FunctionCol(self, 'function', get_obj=lambda i: i.counterpart),
         RefsCol(self, 'references', get_obj=lambda i: i.counterpart)
     ]
Example #18
0
 def col_defs(self):
     lang = self.Recipient if self.type == 'donor' else self.Donor
     ltitle = 'Recipient language' if self.type == 'donor' else 'Donor languoid'
     ldesc = {
         'donor':
         "These are the names of languages and families from which the "
         "recipient language borrowed words directly or indirectly.",
         'recipient':
         "These are the names of recipient languages that borrowed words "
         "directly or indirectly from this languoid."
     }[self.type]
     res = []
     if self.language:
         w1desc = {
             'donor':
             "%s words contributed to other languages." %
             self.language.name,
             'recipient':
             "%s words borrowed from other languages." % self.language.name,
         }[self.type]
         w2desc = {
             'donor': "Words borrowed from %s." % self.language.name,
             'recipient': "Words contributed to %s." % self.language.name,
         }[self.type]
         res.extend([
             RelWordsCol(self,
                         'self',
                         sTitle='Borrowed words'
                         if self.type != 'donor' else 'Source words',
                         sDescription=w1desc,
                         model_col=self.SourceWord.name
                         if self.type == 'donor' else self.TargetWord.name),
             RelationCol(self, 'relation'),
             LinkCol(self,
                     'language',
                     sTitle=ltitle,
                     sDescription=ldesc,
                     get_obj=lambda i: i.language,
                     model_col=lang.name),
             LinkCol(self,
                     'other',
                     model_col=common.Unit.name,
                     sTitle='Borrowed word'
                     if self.type == 'donor' else 'Source word',
                     sDescription=w2desc),
             LinkToMapCol(self,
                          'm',
                          get_obj=lambda i: i.language,
                          map_id=self.type + '-map'),
         ])
     return res
Example #19
0
 def col_defs(self):
     type_col = Col(self,
                    'type',
                    model_col=models.Experiment.type,
                    choices=get_distinct_values(models.Experiment.type))
     if self.parameter:
         return [
             ValueNameCol(self, 'value'),
             LinkCol(self,
                     'language',
                     model_col=Language.name,
                     get_object=lambda i: i.valueset.language),
             Col(self,
                 'sample_size',
                 model_col=models.Experiment.sample_size),
             type_col,
             RefsCol(self, 'source'),
             DetailsRowLinkCol(self, '#', button_text='abstract'),
         ]
     if self.language:
         return [
             ValueNameCol(self, 'value'),
             Col(self,
                 'sample_size',
                 model_col=models.Experiment.sample_size),
             type_col,
             LinkCol(self,
                     'parameter',
                     model_col=Parameter.name,
                     get_object=lambda i: i.valueset.parameter),
             RefsCol(self, 'source'),
             DetailsRowLinkCol(self, '#', button_text='abstract'),
         ]
     return [
         ValueNameCol(self, 'value'),
         LinkCol(self,
                 'language',
                 model_col=Language.name,
                 get_object=lambda i: i.valueset.language),
         Col(self, 'sample_size', model_col=models.Experiment.sample_size),
         type_col,
         LinkCol(self,
                 'parameter',
                 model_col=Parameter.name,
                 get_object=lambda i: i.valueset.parameter),
         RefsCol(self, 'source'),
         DetailsRowLinkCol(self, '#', button_text='abstract'),
     ]
Example #20
0
 def col_defs(self):
     res = [
         SampleIdCol(self, 'sample', model_col=common.Value.id),
         Col(self, 'artefact', model_col=models.Sample.artefact_id),
     ]
     if not self.parameter:
         res.append(
             CategoryCol(self,
                         'type',
                         choices=get_distinct_values(
                             common.DomainElement.name),
                         model_col=common.DomainElement.name))
     if self.parameter:
         res.append(
             LinkCol(self,
                     'contribution',
                     get_object=lambda v: v.valueset.contribution))
     if self.contribution:
         pass
     if not self.language:
         res.extend([
             RegionCol(self,
                       'region',
                       choices=get_distinct_values(models.Location.region)),
             SubRegionCol(self, 'subregion'),
             Col(self,
                 'site',
                 model_col=models.Sample.site_name,
                 choices=get_distinct_values(models.Sample.site_name)),
         ])
     return res
Example #21
0
 def col_defs(self):
     return [
         IntegerIdCol(self, 'number'),
         LinkCol(self, 'name'),
         Col(
             self,
             'canton',
             sTitle='Canton',
             model_col=models.Variety.canton,
             choices=get_distinct_values(models.Variety.canton),
         ),
         Col(
             self,
             'group',
             sTitle='Dialect group',
             model_col=models.Variety.group,
             choices=get_distinct_values(models.Variety.group),
         ),
         #Col(self, 'population', model_col=models.Variety.population),
         Col(self,
             'recorded',
             model_col=models.Variety.recorded,
             sTitle='Date of recording'),
         Col(self,
             'latitude',
             sDescription='<small>The geographic latitude</small>'),
         Col(self,
             'longitude',
             sDescription='<small>The geographic longitude</small>'),
         LinkToMapCol(self, 'm'),
     ]
Example #22
0
 def col_defs(self):
     return [
         LinkCol(self, 'name'),
         FrequencyCol(self, 'frequency'),
         DescCol(self, 'description'),
         ClassCol(self, 'segment_class', Segment.segment_class),
     ]
Example #23
0
 def col_defs(self):
     return [
         LinkCol(self, 'contributor'),
         Col(self, 'description'),
         BaseRefsCol(self, 'sources'),
         Col(self, 'url', format=lambda i: maybe_external_link(i.url)),
     ]
Example #24
0
 def col_defs(self):
     from clld.web.datatables.contribution import ContributorsCol, CitationCol
     return [
         Col(self,
             'number',
             sTitle='number',
             model_col=Dictionary.number,
             input_size='mini'),
         LinkCol(
             self,
             'dictionary',
             sTitle='dictionary'),
         ContributorsCol(
             self,
             name='author',
             sTitle='author'),
         Col(self,
             'entries',
             sTitle='entries',
             sClass='right',
             model_col=Dictionary.count_words),
         YearCol(
             self,
             'year',
             bSearchable=False,
             sTitle='year',
             model_col=Dictionary.published),
         CitationCol(self, 'cite', sTitle='cite'),
     ]
Example #25
0
 def col_defs(self):
     return [
         IdCol(self, 'id'),
         LinkCol(self, 'name'),
         Col(self, 'cognates', model_col=Cognateset.representation),
         ProviderCol(self, 'provider', get_object=lambda i: i.contribution),
     ]
Example #26
0
    def col_defs(self):
        if self.parameter:
            return [
                InventoryCol(self, 'inventory'),
                LinkCol(self,
                        'language',
                        model_col=Language.name,
                        get_object=lambda i: i.valueset.language),
                RefsCol(self, 'source'),
                LinkToMapCol(self,
                             'm',
                             get_object=lambda i: i.valueset.language),
            ]

        res = super(Phonemes, self).col_defs()[1:]
        if self.contribution:
            param = lambda item: item.valueset.parameter
            return [
                DatapointCol(self, 'valueset'),
                FrequencyCol(self, 'frequency', get_object=param),
                ClassCol(self,
                         'segment_class',
                         Segment.segment_class,
                         get_object=param),
                ClassCol(self,
                         'combined_class',
                         Segment.combined_class,
                         get_object=param)
            ]
        return res
Example #27
0
 def col_defs(self):
     return [
         LinkCol(self, 'name'),
         LinkToMapCol(self, '#'),
         Col(self,
             'region',
             model_col=Sample.region,
             choices=get_distinct_values(Sample.region)),
         Col(self, 'location', model_col=Sample.location),
         Col(self,
             'latitude',
             input_size='mini',
             sDescription='<small>The geographic latitude</small>'),
         Col(self,
             'longitude',
             input_size='mini',
             sDescription='<small>The geographic longitude</small>'),
         Col(self,
             'samplesize',
             input_size='mini',
             model_col=Sample.samplesize),
         LangCol(self,
                 'languoid',
                 get_object=lambda i: i.languoid,
                 model_col=Languoid.name),
         FamilyCol(self,
                   'family',
                   get_object=lambda i: i.languoid,
                   model_col=Languoid.family_name,
                   choices=get_distinct_values(Languoid.family_name)),
     ]
Example #28
0
    def col_defs(self):
        cols = [DetailsRowLinkCol(self, 'd', button_text='citation')]
        if self.provider:
            cols.append(BibkeyCol(self, 'key'))
        cols.extend([
            LinkCol(self, 'name'),
            Col(self, 'description', sTitle='Title'),
            FtsCol(self, 'fts', model_col=Ref.fts),
            CaCol(self, 'ca_language'),
        ])

        if not self.complexquery:
            cols.append(Col(self, 'year', model_col=Source.year_int))
            cols.append(Col(self, 'pages', model_col=Source.pages_int))

        cols.append(DoctypeCol(self, 'doctype'))
        cols.append(CaCol(self, 'ca_doctype'))
        if not self.provider:
            cols.append(ProviderCol(self, 'provider'))
        if self.language:
            cols.append(DirectAssignmentCol(
                self, 'd',
                sTitle='da',
                sDescription="Signals whether the reference is directly assigned to this languoid or inherited from daughter languoids.",
                bSortable=False,
                bSearchable=False))
        return cols
Example #29
0
    def col_defs(self):
        res = [Col(self, 'name', sTitle='Grapheme')]
        if not self.parameter:
            res.extend([
                SoundSegmentGraphemeCol(self,
                                        'bipa_grapheme',
                                        model_col=Parameter.name,
                                        sTitle="BIPA Grapheme"),
                SoundSegmentNameCol(self,
                                    'name',
                                    model_col=Parameter.description),
            ])

        if not self.contribution:
            res.extend([
                LinkCol(self,
                        'transcription_data',
                        get_object=lambda v: v.valueset.contribution,
                        sTitle="Dataset",
                        model_col=Contribution.id),
                DatatypeCol(self,
                            'type',
                            get_object=lambda v: v.valueset.contribution,
                            **({} if self.parameter else {
                                'sFilter': 'transcription system'
                            })),
            ])
        if self.contribution:
            if self.contribution.with_url:
                res.append(URLCol(self, 'url', sTitle="URL"))
            if self.contribution.with_image:
                res.append(ImageCol(self, 'image'))
            if self.contribution.with_audio:
                res.append(AudioCol(self, 'audio'))
        return res
Example #30
0
 def col_defs(self):
     return [
         IntegerIdCol(self, 'id', sTitle='ID'),
         LinkCol(
             self,
             'language_name',
             route_name='language',
             sDescription=
             "This is the name of the language (or family, in the case "
             "of donor languages) that was adopted in the World Loanword Database. "
             "Alternative names can be found on the individual language pages."
         ),
         Col(self,
             'language_family',
             model_col=WoldLanguage.affiliation,
             sDescription=
             "This is the name of the highest family that is generally "
             "accepted to which the language belongs. "),
         VocabularyCol(
             self,
             'vocabulary',
             get_object=lambda i: i.vocabulary,
             sDescription="For recipient languages, this column shows the "
             "corresponding vocabulary."),
     ]
Example #31
0
 def format(self, item):
     return HTML.span(LinkCol.format(self, item), style="font-family: monospace;")
Example #32
0
 def __init__(self, dt, name, **kw):
     kw['sTitle'] = 'Reconstruction' if dt.language and dt.language.proto \
         else 'Cognate'
     LinkCol.__init__(self, dt, name, **kw)
Example #33
0
 def format(self, item):
     return HTML.span(
         map_marker_img(self.dt.req, self.get_obj(item)),
         LinkCol.format(self, item))
Example #34
0
 def __init__(self, dt, name, **kw):
     kw["model_col"] = Contribution.name
     kw["choices"] = [(p.id, p.name) for p in DBSession.query(Provider)]
     LinkCol.__init__(self, dt, name, **kw)
Example #35
0
 def format(self, item):
     obj = self.get_obj(item)
     if obj:
         return LinkCol.format(self, item)
     return ""