Returns the rdfs.label value of an entity (class or property), if existing.
    Defaults to DEFAULT_LANGUAGE. Returns the RDF.Literal resource

    Args:
    language: 'en', 'it' etc..
    getall: returns a list of all labels rather than a string
433062
def entityLabel(rdfGraph, anEntity, language=DEFAULT_LANGUAGE, getall=True):
    

    if getall:
        temp = []
        for o in rdfGraph.objects(anEntity, RDFS.label):
            temp += [o]
        return temp
    else:
        for o in rdfGraph.objects(anEntity, RDFS.label):
            if getattr(o, 'language') and getattr(o, 'language') == language:
                return o
        return ""
867718
def get_cts_metadata(self, key: str, lang: str = None) -> Literal:
        
        return self.metadata.get_single(RDF_NAMESPACES.CTS.term(key), lang)
190277
def _map_relation(c, language='any'):
    
    label = c.label(language)
    return {
        'id': c.id,
        'type': c.type,
        'uri': c.uri,
        'label': label.label if label else None
    }
353750
def _get_entity_prop(self, entity, prop):
        
        variant = self.params.get('variant')
        lang = self.params.get('lang')

        if entity.get(prop):
            ent = entity[prop]
            try:
                return ent[variant or lang].get('value')
            except AttributeError:
                return ent.get('value')
1075402
def process_synonyms(self, entity: List[dict]) -> List[dict]:
        
        label = entity['label']
        for synonym in entity['synonyms']:
            # these are internal errors and users should never see them
            if 'literal' not in synonym:
                raise ValueError(f'Synonym not given a literal for label: {label}')
            elif len(synonym) > 1:
                raise ValueError(f'Too many keys in synonym for label: {label}')
        return entity
661041
def translate_labels(val):
    '''
    
    '''
    if not isinstance(val, dict):
        if not isinstance(val, list):
            val = split(val)
        new_val = {}
        for item in val:
            if isinstance(item, dict):
                if len(item) != 1:
                    raise SaltInvocationError('Invalid label(s)')
                key = next(iter(item))
                val = item[key]
            else:
                try:
                    key, val = split(item, '=', 1)
                except ValueError:
                    key = item
                    val = ''
            if not isinstance(key, six.string_types):
                key = six.text_type(key)
            if not isinstance(val, six.string_types):
                val = six.text_type(val)
            new_val[key] = val
        val = new_val
    return val
258550
def joinStringsInList(literalEntities, prefLanguage="en"):
    
    match = []

    if len(literalEntities) == 1:
        return literalEntities[0]
    elif len(literalEntities) > 1:
        for x in literalEntities:
            if getattr(x, 'language') and getattr(x,
                                                  'language') == prefLanguage:
                match.append(x)
        if not match:  # don't bother about language
            for x in literalEntities:
                match.append(x)

    return " - ".join([x for x in match])
184564
def get(self, name):
        
        if self.structs.has_key(name):
            return self.structs[name]
        elif self.enums.has_key(name):
            return self.enums[name]
        elif self.interfaces.has_key(name):
            return self.interfaces[name]
        else:
            raise RpcException(ERR_INVALID_PARAMS, "Unknown entity: '%s'" % name)
1221323
def get_language():
    
    lang = _get_language()

    if not lang:
        return get_fallback_language()

    langs = [l[0] for l in settings.SUPPORTED_LANGUAGES]
    if lang not in langs and "-" in lang:
        lang = lang.split("-")[0]

    if lang in langs:
        return lang

    return settings.DEFAULT_LANGUAGE
1074107
function getLabelDefaultText(idx, opt) {
        return useNameLabel ? data.getName(idx) : getDefaultLabel(data, idx);
    }
1314099
def labels(self):
        
        if not self.__labels:
            self.__labels = Labels(self.__connection)
        return self.__labels
1280882
def get_meta(self):
        
        rdf = self.get_meta_rdf(fmt='n3')
        return ThingMeta(self, rdf, self._client.default_lang, fmt='n3')
948598
def get_creator(self, lang=None):
        
        return self.parent.parent.metadata.get_label(lang=lang)
525150
public static String getLabel(Object value) {
        if (value != null) {
            if (value instanceof CompositeObject) {
                CompositeObject descriptor = (CompositeObject) value;
                String label = getLanguageLabel(descriptor);
                return label != null ? label : descriptor.toString();
            } else if (value.getClass().isArray()) {
                Object[] objects = (Object[]) value;
                return getLabel(Arrays.asList(objects));
            } else if (value instanceof Iterable) {
                StringBuilder sb = new StringBuilder();
                for (Object o : ((Iterable) value)) {
                    if (sb.length() > 0) {
                        sb.append(",");
                    }
                    sb.append(getLabel(o));
                }
                return "[" + sb.toString() + "]";
            } else if (value instanceof Map) {
                StringBuilder sb = new StringBuilder();
                for (Map.Entry<String, Object> entry : ((Map<String, Object>) value).entrySet()) {
                    if (sb.length() > 0) {
                        sb.append(",");
                    }
                    sb.append(entry.getKey());
                    sb.append(":");
                    sb.append(getLabel(entry.getValue()));
                }
                return "{" + sb.toString() + "}";
            }
            return value.toString();
        }
        return null;
    }
682846
public String getLabel(HasOther e) {

	List<LangString> labels = ((HasLabel) e).getLabel();
	if ((labels == null) || (labels.isEmpty()))
	    return null;
	if (e instanceof HasLabel)
	    return labels.get(0).getValue();
	return "pFact: label TODO";
    }
464832
def get_language(self):
        
        return get_language_parameter(self.request, self.query_language_key, default=self.get_default_language(object=object))
1286031
def iterator(self):
        
        default_language = getattr(self, '_default_language', None)
        for obj in super(MultilingualModelQuerySet, self).iterator():
            obj._default_language = default_language
            yield obj