Get all the items of the given relationship type related to this item.
426120
def get_relation_type(self, relation_type):
        
        qs = self.get_queryset()
        return qs.filter(relation_type=relation_type)
84252
def relatedItems(self):
        '''
        
        '''
        if self.registration:
            return self.registration.revenueitem_set.exclude(pk=self.pk)
1040729
function getRelationships(model) {
    const modelName = model.constructor.name;
    const properties = typed_conversions_1.hashToArray(exports.relationshipsByModel[modelName], "property") || [];
    let parent = Object.getPrototypeOf(model.constructor);
    while (parent.name) {
        const subClass = new parent();
        const subClassName = subClass.constructor.name;
        properties.push(...typed_conversions_1.hashToArray(exports.relationshipsByModel[subClassName], "property"));
        parent = Object.getPrototypeOf(subClass.constructor);
    }
    return properties;
}
1298737
public RelationshipTuple[] getRelationships(Context context,
                                                String pid,
                                                String relationship)
            throws ServerException {
        return worker.getRelationships(context, pid, relationship);
    }
704328
protected function getRelationshipsThatMatchType($type)
    {
        return array_filter(
            $this->mapRelationshipsToIdAndData(),
            function ($relationship) use ($type) {
                $relationshipType = Arr::get($relationship, 'type');

                return Str::snakeCase($type) === Str::snakeCase($relationshipType);
            }
        );
    }
402155
private <T> Iterator<T> getAll(String entityType, IUnmarshaller<T> unmarshaller) throws StorageException {
        String query = matchAllQuery();
        return getAll(entityType, unmarshaller, query);
    }
807050
public function getRelations()
    {
        if (!isset($this->relationships)) {
            $this->relationships = array();
            // load them manually
            $mm = $this->getModelsManager();
            $relationships = $mm->getRelations(get_class($this));
            // Temporary fix because $mm->getRelations() doesn't support hasManyToMany relations right now.
            // get them separately and merge them
            $mtmRelationships = $mm->getHasManyToMany($this);

            $relationships = array_merge($relationships, $mtmRelationships);

            foreach ($relationships as $relation) {
                // todo load custom relationship
                $this->relationships[] = new Relation($relation, $mm);
            }
        }
        return $this->relationships;
    }
1161590
def get_relationships(manager, handle_id1, handle_id2, rel_type=None, legacy=True):
    
    if rel_type:
        q = """
        MATCH (a:Node {{handle_id: {{handle_id1}}}})-[r:{rel_type}]-(b:Node {{handle_id: {{handle_id2}}}})
        RETURN collect(r) as relationships
        """.format(rel_type=rel_type)
    else:
        q = """
            MATCH (a:Node {handle_id: {handle_id1}})-[r]-(b:Node {handle_id: {handle_id2}})
            RETURN collect(r) as relationships
            """
    with manager.session as s:
        if legacy:
            relationships = s.run(q, {'handle_id1': handle_id1, 'handle_id2': handle_id2}).single()['relationships']
            return [relationship.id for relationship in relationships]
        return s.run(q, {'handle_id1': handle_id1, 'handle_id2': handle_id2}).single()['relationships']
332835
public function getTaxonomiesByType($type)
    {
        $taxonomies = new ArrayCollection();

        /** @var TermRelationships $relationship */
        foreach ($this->getTermRelationships() as $relationship) {
            if ($type === $relationship->getTaxonomy()->getTaxonomy()) {
                $taxonomies[] = $relationship->getTaxonomy();
            }
        }

        return ($taxonomies->count() == 0) ? null : $taxonomies;
    }
425929
public function getRelationships($type = null, $direction = null)
    {
        if (null === $direction) {
            $relationships = array_merge($this->inboundRelationships, $this->outboundRelationships);
        } else {
            $dir = strtoupper($direction);
            if (!in_array($direction, array('IN', 'OUT'))) {
                throw new \InvalidArgumentException(sprintf('The direction "%s" is not valid', $direction));
            }
            $relationships = ('IN' === $dir) ? $this->getInboundRelationships() : $this->getOutboundRelationships();
        }

        if (null === $type) {
            return $relationships;
        }

        $collection = array();
        foreach ($relationships as $rel) {
            if ($rel->getType() === $type) {
                $collection[] = $rel;
            }
        }

        return $collection;
    }
878436
def _get_rel_of_type(self, reltype):
        
        matching = [rel for rel in self.values() if rel.reltype == reltype]
        if len(matching) == 0:
            tmpl = "no relationship of type '%s' in collection"
            raise KeyError(tmpl % reltype)
        if len(matching) > 1:
            tmpl = "multiple relationships of type '%s' in collection"
            raise ValueError(tmpl % reltype)
        return matching[0]
315416
def relation_types():
    """"""
    rel_types = []
    md = metadata()
    for key in ('provides', 'requires', 'peers'):
        section = md.get(key)
        if section:
            rel_types.extend(section.keys())
    return rel_types
1077978
@Override
	public ObjectList getObjectRelationships(String repositoryId, String objectId, Boolean includeSubRelationshipTypes, RelationshipDirection relationshipDirection, String typeId, String filter, Boolean includeAllowableActions, BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
		return relationshipService.getObjectRelationships(repositoryId, objectId, includeSubRelationshipTypes, relationshipDirection, typeId, filter, includeAllowableActions, maxItems, skipCount, extension);
	}
1168957
def relations(cls):
        
        return [c.key for c in cls.__mapper__.iterate_properties
                if isinstance(c, RelationshipProperty)]
551999
public List<ExtendedRelation> getRelations(String baseTable,
			String relatedTable) throws SQLException {
		return getRelations(baseTable, null, relatedTable, null, null, null);
	}
957449
public List<Relationship> getNextRelationships() {
        final List<Relationship> nextRelationships = new LinkedList<Relationship>();
        for (final Relationship r : relationships) {
            if (r.getType() == RelationshipType.NEXT) {
                nextRelationships.add(r);
            }
        }
        return nextRelationships;
    }
98374
private Set<RelationshipTuple> getRels(String relsDatastreamName) {
        List<Datastream> relsDatastreamVersions = m_datastreams.get(relsDatastreamName);

        if (relsDatastreamVersions == null || relsDatastreamVersions.size() == 0) {
            return new HashSet<RelationshipTuple>();
        }

        Datastream latestRels = relsDatastreamVersions.get(0);

        for (Datastream v : relsDatastreamVersions) {
           	if (v.DSCreateDT == null){
           		latestRels = v;
           		break;
           	}
            if (v.DSCreateDT.getTime() > latestRels.DSCreateDT.getTime()) {
                latestRels = v;
            }
        }

        try {
            return RDFRelationshipReader.readRelationships(latestRels);
        } catch (ServerException e) {
            throw new RuntimeException("Error reading object relationships in " + relsDatastreamName, e);
        }
    }