Example #1
0
def get_property(prop_name):
    if prop_name in get_legacy_spellings():
        raise KeyError('Legacy spelling: %s' % prop_name)

    prop = caching.get_schema_property(prop_name)
    if prop is not None:
        return prop

    prop = get_schema_set()['properties'][prop_name]

    # populate missing fields
    if 'domains' not in prop:
        prop['domains'] = ['Thing']
    if 'ranges' not in prop:
        prop['ranges'] = ['Text']
    if 'id' not in prop:
        prop['id'] = prop_name
    if 'label' not in prop:
        prop['label'] = prop['id']
    if 'comment' not in prop:
        prop['comment'] = prop['label']
    if 'comment_plain' not in prop:
        prop['comment_plain'] = prop['comment']
    if 'reversed_label' not in prop:
        prop['reversed_label'] = '[%%s] %s' % prop['label']

    caching.set_schema_property(prop_name, prop)
    return prop
Example #2
0
def get_property(prop_name):
    if prop_name in get_legacy_spellings():
        raise KeyError('Legacy spelling: %s' % prop_name)

    prop = caching.get_schema_property(prop_name)
    if prop is not None:
        return prop

    prop = get_schema_set()['properties'][prop_name]

    # populate missing fields
    if 'domains' not in prop:
        prop['domains'] = ['Thing']
    if 'ranges' not in prop:
        prop['ranges'] = ['Text']
    if 'id' not in prop:
        prop['id'] = prop_name
    if 'label' not in prop:
        prop['label'] = prop['id']
    if 'comment' not in prop:
        prop['comment'] = prop['label']
    if 'comment_plain' not in prop:
        prop['comment_plain'] = prop['comment']
    if 'reversed_label' not in prop:
        prop['reversed_label'] = '[%%s] %s' % prop['label']

    caching.set_schema_property(prop_name, prop)
    return prop
Example #3
0
def get_property(prop_name):
    if prop_name in get_legacy_spellings():
        raise KeyError("Legacy spelling: %s" % prop_name)

    prop = caching.get_schema_property(prop_name)
    if prop is not None:
        return prop

    prop = get_schema_set()["properties"][prop_name]
    if "reversed_label" not in prop:
        prop["reversed_label"] = "[%%s] %s" % prop["label"]
    caching.set_schema_property(prop_name, prop)
    return prop
Example #4
0
def get_property(prop_name):
    if prop_name in get_legacy_spellings():
        raise KeyError('Legacy spelling: %s' % prop_name)

    prop = caching.get_schema_property(prop_name)
    if prop is not None:
        return prop

    prop = get_schema_set()['properties'][prop_name]
    if 'reversed_label' not in prop:
        prop['reversed_label'] = '[%%s] %s' % prop['label']
    caching.set_schema_property(prop_name, prop)
    return prop