Map related concept or collection, leaving out the relations.

    :param c: the concept or collection to map
    :param string language: Language to render the relation's label in
    :rtype: :class:`dict`
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
    }
1323432
def _model_relations(ins):
    
    relations = []
    for r in ins.relationships:
        # Hard times with the foreign model :)
        if isinstance(r.argument, Mapper):
            model_name = r.argument.class_.__name__
        elif hasattr(r.argument, 'arg'):
            model_name = r.argument.arg
        else:
            model_name = r.argument.__name__

        # Format
        relations.append(SaRelationshipDoc(
            key=r.key,
            doc=r.doc or '',
            model=model_name,
            pairs=map(lambda a_b_tuple: a_b_tuple[0].key if a_b_tuple[0].key == a_b_tuple[1].key else '{}={}'.format(a_b_tuple[0].key, a_b_tuple[1].key), r.local_remote_pairs),
            uselist=r.uselist
        ))
    return relations
946434
function collectionIsSame(c1, c2) {

	if (c1 === c2) return true;
	if (Function.getName(getType(c1)) !== Function.getName(getType(c2))) return false;
	if (c1.size !== c2.size) return false;

	let c1Iter = c1[Symbol.iterator]();
	let c2Iter = c2[Symbol.iterator]();

}
721826
def get_relations(self, rel_id=None, **kwargs):
        
        return self.get_elements(Relation, elem_id=rel_id, **kwargs)
118834
def _related(self, concept):
        
        return concept.hypernyms() + \
                concept.hyponyms() + \
                concept.member_meronyms() + \
                concept.substance_meronyms() + \
                concept.part_meronyms() + \
                concept.member_holonyms() + \
                concept.substance_holonyms() + \
                concept.part_holonyms() + \
                concept.attributes() + \
                concept.also_sees() + \
                concept.similar_tos()
615514
def transform_relations(rdf, relationmap):
    """"""

    affected_types = (SKOS.Concept, SKOS.Collection,
                      SKOSEXT.DeprecatedConcept)

    props = set()
    for t in affected_types:
        for conc in rdf.subjects(RDF.type, t):
            for p, o in rdf.predicate_objects(conc):
                if isinstance(o, (URIRef, BNode)) \
                   and (p in relationmap or not in_general_ns(p)):
                    props.add(p)

    for p in props:
        if mapping_match(p, relationmap):
            newval = mapping_get(p, relationmap)
            logging.debug("transform relation %s -> %s", p, str(newval))
            replace_predicate(
                rdf, p, newval, subjecttypes=affected_types)
        else:
            logging.info("Don't know what to do with relation %s", p)
627904
private Set<Label> scopeTypeLabelsImplicitPlayers(GraqlCompute query) {
        return scopeTypes(query)
                .filter(Concept::isRelationType)
                .map(Concept::asRelationType)
                .filter(RelationType::isImplicit)
                .flatMap(RelationType::roles)
                .flatMap(Role::players)
                .map(SchemaConcept::label)
                .collect(toSet());
    }
147944
private void allRelation(Options opt, RelationType rt, ClassDoc from) {
	String tagname = rt.lower;
	for (Tag tag : from.tags(tagname)) {
	    String t[] = tokenize(tag.text());    // l-src label l-dst target
	    t = t.length == 1 ? new String[] { "-", "-", "-", t[0] } : t; // Shorthand
	    if (t.length != 4) {
		System.err.println("Error in " + from + "\n" + tagname + " expects four fields (l-src label l-dst target): " + tag.text());
		return;
	    }
	    ClassDoc to = from.findClass(t[3]);
	    if (to != null) {
		if(hidden(to))
		    continue;
		relation(opt, rt, from, to, t[0], t[1], t[2]);
	    } else {
		if(hidden(t[3]))
		    continue;
		relation(opt, rt, from, from.toString(), to, t[3], t[0], t[1], t[2]);
	    }
	}
    }
6760
def map2set(data, relation):
    
    if data == None:
        return Null
    if isinstance(relation, Data):
        Log.error("Does not accept a Data")

    if is_data(relation):
        try:
            # relation[d] is expected to be a list
            # return set(cod for d in data for cod in relation[d])
            output = set()
            for d in data:
                for cod in relation.get(d, []):
                    output.add(cod)
            return output
        except Exception as e:
            Log.error("Expecting a dict with lists in codomain", e)
    else:
        try:
            # relation[d] is expected to be a list
            # return set(cod for d in data for cod in relation[d])
            output = set()
            for d in data:
                cod = relation(d)
                if cod == None:
                    continue
                output.add(cod)
            return output
        except Exception as e:
            Log.error("Expecting a dict with lists in codomain", e)
    return Null
354812
def relation_completions(
    completion_text: str, bel_spec: BELSpec, bel_fmt: str, size: int
) -> list:
    

    if bel_fmt == "short":
        relation_list = bel_spec["relations"]["list_short"]
    else:
        relation_list = bel_spec["relations"]["list_long"]

    matches = []
    for r in relation_list:
        if re.match(completion_text, r):
            matches.append(r)

    replace_list = []
    for match in matches:
        highlight = match.replace(completion_text, f"<em>{completion_text}</em>")
        replace_list.append(
            {
                "replacement": match,
                "label": match,
                "highlight": highlight,
                "type": "Relation",
            }
        )

    return replace_list[:size]
85508
public static Collection map(Mapper mapper, Collection c) {
        return map(mapper, c, false);
    }
336974
def from_name(cls, relation_name, conversations=None):
        
        if relation_name is None:
            return None
        relation_class = cls._cache.get(relation_name)
        if relation_class:
            return relation_class(relation_name, conversations)
        role, interface = hookenv.relation_to_role_and_interface(relation_name)
        if role and interface:
            relation_class = cls._find_impl(role, interface)
            if relation_class:
                cls._cache[relation_name] = relation_class
                return relation_class(relation_name, conversations)
        return None
1051540
def _do_relation(self):
        
        if self.chunks:
            ch = self.chunks[-1]
            for relation, role in ch.relations:
                if role == "SBJ" or role == "OBJ":
                    self.relations[role][relation] = ch
            if ch.type in ("VP",):
                self.relations[ch.type][ch.relation] = ch
401641
def relabel(self, mapping):
        
        if not isinstance(mapping, dict):
            raise pycmMatrixError(MAPPING_FORMAT_ERROR)
        if self.classes != list(mapping.keys()):
            raise pycmMatrixError(MAPPING_CLASS_NAME_ERROR)
        for row in self.classes:
            temp_dict = {}
            temp_dict_normalized = {}
            for col in self.classes:
                temp_dict[mapping[col]] = self.table[row][col]
                temp_dict_normalized[mapping[col]
                                     ] = self.normalized_table[row][col]
            del self.table[row]
            self.table[mapping[row]] = temp_dict
            del self.normalized_table[row]
            self.normalized_table[mapping[row]] = temp_dict_normalized
        self.matrix = self.table
        self.normalized_matrix = self.normalized_table
        for param in self.class_stat.keys():
            temp_dict = {}
            for classname in self.classes:
                temp_dict[mapping[classname]
                          ] = self.class_stat[param][classname]
            self.class_stat[param] = temp_dict
        self.classes = list(mapping.values())
        self.TP = self.class_stat["TP"]
        self.TN = self.class_stat["TN"]
        self.FP = self.class_stat["FP"]
        self.FN = self.class_stat["FN"]
        __class_stat_init__(self)
1121734
def language(self, language):
        
        if language is None:
            raise ValueError("Invalid value for `language`, must not be `None`")  # noqa: E501
        allowed_values = ["python", "r", "rmarkdown"]  # noqa: E501
        if language not in allowed_values:
            raise ValueError(
                "Invalid value for `language` ({0}), must be one of {1}"  # noqa: E501
                .format(language, allowed_values)
            )

        self._language = language
706618
def relations_of(self, target, include_object=False):
        '''  '''
        if include_object:
            _ = self._execute('''
                select relations.name, ob2.code from relations, objects as ob1, objects as ob2 where relations.src=ob1.id and ob2.id=relations.dst and ob1.code=?
            ''', (self.serialize(target),))
            for i in _:
                yield i[0], self.deserialize(i[1])
        else:

            _ = self._execute('''
                select distinct relations.name from relations, objects where relations.src=objects.id and objects.code=?
            ''', (self.serialize(target),))
            for i in _:
                yield i[0]
695818
def labels(self, mapping):
        
        # If any labels have been expressly removed, we need to track this
        # so that a future .patch() call can do the correct thing.
        existing = set([k for k in self.labels.keys()])
        incoming = set([k for k in mapping.keys()])
        self._label_removals = self._label_removals.union(existing.difference(incoming))

        # Actually update the labels on the object.
        self._patch_property("labels", copy.deepcopy(mapping))