private MutableIntObjectMap <MutableLongSet> GetTypeToRelMapForDirection(RelationshipDirection direction) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.eclipse.collections.api.map.primitive.MutableIntObjectMap<org.eclipse.collections.api.set.primitive.MutableLongSet> relTypeToRelsMap; MutableIntObjectMap <MutableLongSet> relTypeToRelsMap; switch (direction) { case RelationshipDirection.INCOMING: relTypeToRelsMap = Incoming(); break; case RelationshipDirection.OUTGOING: relTypeToRelsMap = Outgoing(); break; case RelationshipDirection.LOOP: relTypeToRelsMap = Loops(); break; default: throw new System.ArgumentException("Unknown direction: " + direction); } return(relTypeToRelsMap); }
public void RemoveRelationship(RelationshipType relationshipType, RelationshipDirection relationshipDirection, GameBaseObject relationshipTo) { // if null instanciate Relationships if (Relationships == null) { Relationships = new List <GameObjectRelationship>(); } // if relationshipTo's Relationships is null instanciate Relationships if (relationshipTo.Relationships == null) { relationshipTo.Relationships = new List <GameObjectRelationship>(); } // remove new relationship Relationships.Remove(new GameObjectRelationship(relationshipType, relationshipDirection, relationshipTo)); // remove other type of relationship if (relationshipDirection == RelationshipDirection.ParentToChild) { relationshipTo.Relationships.Remove(new GameObjectRelationship(relationshipType, RelationshipDirection.ChildToParent, this)); } else if (relationshipDirection == RelationshipDirection.ChildToParent) { relationshipTo.Relationships.Remove(new GameObjectRelationship(relationshipType, RelationshipDirection.ParentToChild, this)); } }
public virtual int AugmentDegree(RelationshipDirection direction, int degree, int typeId) { switch (direction) { case RelationshipDirection.INCOMING: if (_incoming != null && _incoming.containsKey(typeId)) { return(_diffStrategy.augmentDegree(degree, _incoming.get(typeId).size())); } break; case RelationshipDirection.OUTGOING: if (_outgoing != null && _outgoing.containsKey(typeId)) { return(_diffStrategy.augmentDegree(degree, _outgoing.get(typeId).size())); } break; case RelationshipDirection.LOOP: if (_loops != null && _loops.containsKey(typeId)) { return(_diffStrategy.augmentDegree(degree, _loops.get(typeId).size())); } break; default: throw new System.ArgumentException("Unknown direction: " + direction); } return(degree); }
public Neo4JRelationshipAttribute( string name, RelationshipDirection direction) { Name = name; Direction = direction; }
private int DegreeForDirectionAndType(StorageNodeCursor cursor, RelationshipDirection direction, int relType) { int degree = 0; using (StorageRelationshipGroupCursor groups = StorageReader.allocateRelationshipGroupCursor()) { groups.Init(cursor.EntityReference(), cursor.RelationshipGroupReference()); while (groups.Next()) { if (relType == ANY_RELATIONSHIP_TYPE || relType == groups.Type()) { switch (direction) { case RelationshipDirection.OUTGOING: degree += groups.OutgoingCount() + groups.LoopCount(); break; case RelationshipDirection.INCOMING: degree += groups.IncomingCount() + groups.LoopCount(); break; case RelationshipDirection.LOOP: degree += groups.OutgoingCount() + groups.IncomingCount() + groups.LoopCount(); break; default: throw new System.ArgumentException(direction.name()); } } } } return(degree); }
public virtual void AddRelationship(long relId, int typeId, RelationshipDirection direction) { if (!HasAddedRelationships()) { _relationshipsAdded = new RelationshipChangesForNode(DiffStrategy.ADD); } _relationshipsAdded.addRelationship(relId, typeId, direction); }
public RelationshipPatternExpression( [NotNull] RelationshipDirection direction, [NotNull] RelationshipDetailExpression details ) { Direction = direction; Details = details; }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public org.neo4j.server.rest.repr.ListRepresentation getNodeRelationships(long nodeId, RelationshipDirection direction, java.util.Collection<String> types) throws NodeNotFoundException public override ListRepresentation GetNodeRelationships(long nodeId, RelationshipDirection direction, ICollection <string> types) { using (Transaction transaction = _graph.beginTx()) { ListRepresentation nodeRelationships = base.GetNodeRelationships(nodeId, direction, types); transaction.Success(); return(nodeRelationships); } }
/// <summary> /// Gets all the relationships regardless of submodel /// </summary> /// <param name="direction"></param> /// <param name="includeInherited"></param> /// <returns></returns> public IEnumerable <Relationship> GetRelationships(RelationshipDirection direction, bool includeInherited) { if (Model == null) { throw new InvalidOperationException("Cannot get relationship of nodes when model is not set."); } return(Model.GetRelationships(this, includeInherited)); }
public RestTraversal RelationShips(RelationshipDirection relationShipDirection, string relationShipType) { if (_relationShipFilter == null) { _relationShipFilter = new RelationShipFilter(); this.Add(_relationShipFilter); } _relationShipFilter.Add(new RelationFilter(relationShipDirection, relationShipType)); return(this); }
public RestTraversal RelationShips(RelationshipDirection relationShipDirection, string relationShipType) { if (_relationShipFilter == null) { _relationShipFilter = new RelationShipFilter(); this.Add(_relationShipFilter); } _relationShipFilter.Add(new RelationFilter(relationShipDirection,relationShipType)); return this; }
public void DetermineRelationshipDirectionShouldReturnExplicitDirection(RelationshipDirection direction) { // Arrange var relationship = new TestRelationship(new NodeReference(0)) { Direction = direction }; var calculatedDirection = Relationship.DetermineRelationshipDirection(null, relationship); Assert.AreEqual(direction, calculatedDirection); }
public override int AugmentDegree(RelationshipDirection direction, int degree, int typeId) { if (HasAddedRelationships()) { degree = _relationshipsAdded.augmentDegree(direction, degree, typeId); } if (HasRemovedRelationships()) { degree = _relationshipsRemoved.augmentDegree(direction, degree, typeId); } return(degree); }
public virtual void AddRelationship(long relId, int typeId, RelationshipDirection direction) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.eclipse.collections.api.map.primitive.MutableIntObjectMap<org.eclipse.collections.api.set.primitive.MutableLongSet> relTypeToRelsMap = getTypeToRelMapForDirection(direction); MutableIntObjectMap <MutableLongSet> relTypeToRelsMap = GetTypeToRelMapForDirection(direction); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.eclipse.collections.api.set.primitive.MutableLongSet rels = relTypeToRelsMap.getIfAbsentPut(typeId, org.eclipse.collections.impl.set.mutable.primitive.LongHashSet::new); //JAVA TO C# CONVERTER TODO TASK: Method reference constructor syntax is not converted by Java to C# Converter: MutableLongSet rels = relTypeToRelsMap.getIfAbsentPut(typeId, LongHashSet::new); rels.add(relId); }
/// <summary> /// Gets all the relationships of the Entity regardless of submodel /// </summary> /// <param name="entity"></param> /// <param name="includeInherited"></param> /// <returns></returns> public IEnumerable <Relationship> GetRelationships(Entity entity, RelationshipDirection direction = RelationshipDirection.Both, bool includeInherited = false) { Dictionary <string, Relationship> relationships = new Dictionary <string, Relationship>(); Entity current = entity; Func <Relationship, bool> func; switch (direction) { case RelationshipDirection.Out: func = RelationshipOut; break; case RelationshipDirection.Both: func = RelationshipBoth; break; case RelationshipDirection.In: default: func = RelationshipIn; break; } do { foreach (Relationship rel in Relationships.Relationship.Where(func).ToList()) { if (relationships.ContainsKey(rel.Name) == false) { relationships.Add(rel.Name, rel); } } current = current.ParentEntity; } while (current != null && includeInherited); return(relationships.Select(x => x.Value).ToList()); bool RelationshipIn(Relationship item) { return(item.Source.Label == current.Label); } bool RelationshipOut(Relationship item) { return(item.Target?.Label == current.Label); } bool RelationshipBoth(Relationship item) { return(item.Source.Label == current.Label || item.Target?.Label == current.Label); } }
private RelationshipDetails( RelationshipDirection relationshipDirection, SymbolicName?symbolicName, RelationshipTypes?relationshipTypes, RelationshipLength?length, Properties?properties) { Direction = relationshipDirection; SymbolicName = symbolicName; Types = relationshipTypes; Length = length; Properties = properties; }
public virtual void RemoveRelationship(long relId, int typeId, RelationshipDirection direction) { if (HasAddedRelationships()) { if (_relationshipsAdded.removeRelationship(relId, typeId, direction)) { // This was a rel that was added in this tx, no need to add it to the remove list, instead we just // remove it from added relationships. return; } } if (!HasRemovedRelationships()) { _relationshipsRemoved = new RelationshipChangesForNode(DiffStrategy.REMOVE); } _relationshipsRemoved.addRelationship(relId, typeId, direction); }
public virtual LongIterator getRelationships(RelationshipDirection direction, int type) { switch (direction) { case RelationshipDirection.INCOMING: return(_incoming != null?PrimitiveIdsByType(_incoming, type) : ImmutableEmptyLongIterator.INSTANCE); case RelationshipDirection.OUTGOING: return(_outgoing != null?PrimitiveIdsByType(_outgoing, type) : ImmutableEmptyLongIterator.INSTANCE); case RelationshipDirection.LOOP: return(_loops != null?PrimitiveIdsByType(_loops, type) : ImmutableEmptyLongIterator.INSTANCE); default: throw new System.ArgumentException("Unknown direction: " + direction); } }
public virtual bool RemoveRelationship(long relId, int typeId, RelationshipDirection direction) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.eclipse.collections.api.map.primitive.MutableIntObjectMap<org.eclipse.collections.api.set.primitive.MutableLongSet> relTypeToRelsMap = getTypeToRelMapForDirection(direction); MutableIntObjectMap <MutableLongSet> relTypeToRelsMap = GetTypeToRelMapForDirection(direction); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.eclipse.collections.api.set.primitive.MutableLongSet rels = relTypeToRelsMap.get(typeId); MutableLongSet rels = relTypeToRelsMap.get(typeId); if (rels != null && rels.remove(relId)) { if (rels.Empty) { relTypeToRelsMap.remove(typeId); } return(true); } return(false); }
public static PropertyDeclarationSyntax AddNeo4JRelationshipAttribute( this PropertyDeclarationSyntax methodSyntax, string name, RelationshipDirection direction) { AttributeSyntax attribute = Attribute(IdentifierName(Global(Neo4JRelationshipAttribute))) .AddArgumentListArguments( AttributeArgument( LiteralExpression( SyntaxKind.NumericLiteralExpression, Literal(name))) .WithNameColon( NameColon(IdentifierName(nameof(name)))), AttributeArgument( MemberAccessExpression( SyntaxKind.SimpleMemberAccessExpression, IdentifierName(Global(Neo4JRelationshipDirection)), IdentifierName(MapDirection(direction)))) .WithNameColon( NameColon(IdentifierName(nameof(direction))))); return(methodSyntax.AddAttributeLists(AttributeList(SingletonSeparatedList(attribute)))); }
public static string GetSymbol(this RelationshipDirection val) { return(GetEnumDesc(val)); }
public RelationFilter(RelationshipDirection relationShipDirection, string relationShipTypeFilter) { _direction=relationShipDirection; _relationShipTypeFilter = relationShipTypeFilter; }
public static HttpStatusCode GetRelationshipsOnNode(string dbUrl, long nodeId, RelationshipDirection direction, IEnumerable <string> relationships, out string response) { if (direction == null) { direction = RelationshipDirection.All; } if (relationships == null || !relationships.Any()) { return (HttpRest.Get( string.Concat(Connection.GetServiceRoot(dbUrl).Node, "/", nodeId.ToString(), "/relationships/", direction.ToString()), out response)); } return (HttpRest.Get( string.Concat(Connection.GetServiceRoot(dbUrl).Node, "/", nodeId.ToString(), "/relationships/", direction.ToString(), "/", string.Join("&", relationships)), out response)); }
public IItemEnumerable<IRelationship> GetRelationships(IObjectId objectId, bool includeSubRelationshipTypes, RelationshipDirection? relationshipDirection, IObjectType type, IOperationContext context) { if (objectId == null || objectId.Id == null) { throw new ArgumentException("Invalid object id!"); } string id = objectId.Id; string typeId = (type == null ? null : type.Id); IRelationshipService service = Binding.GetRelationshipService(); IOperationContext ctxt = new OperationContext(context); PageFetcher<IRelationship>.FetchPage fetchPageDelegate = delegate(long maxNumItems, long skipCount) { // fetch the relationships IObjectList relList = service.GetObjectRelationships(RepositoryId, id, includeSubRelationshipTypes, relationshipDirection, typeId, ctxt.FilterString, ctxt.IncludeAllowableActions, maxNumItems, skipCount, null); // convert relationship objects IList<IRelationship> page = new List<IRelationship>(); if (relList.Objects != null) { foreach (IObjectData rod in relList.Objects) { IRelationship relationship = GetObject(CreateObjectId(rod.Id), ctxt) as IRelationship; if (relationship == null) { throw new CmisRuntimeException("Repository returned an object that is not a relationship!"); } page.Add(relationship); } } return new PageFetcher<IRelationship>.Page<IRelationship>(page, relList.NumItems, relList.HasMoreItems); }; return new CollectionEnumerable<IRelationship>(new PageFetcher<IRelationship>(DefaultContext.MaxItemsPerPage, fetchPageDelegate)); }
public RelationFilter(RelationshipDirection relationShipDirection, string relationShipTypeFilter) { _direction = relationShipDirection; _relationShipTypeFilter = relationShipTypeFilter; }
public NeoRelationship(string type, RelationshipDirection direction) { Type = type; Direction = direction; }
private static string MapDirection(RelationshipDirection direction) => direction switch {
public RelatedResource(EntityRef relationshipType, RelationshipDirection direction) { RelationshipTypeId = relationshipType; RelationshipDirection = direction; }
public IObjectList GetObjectRelationships(string repositoryId, string objectId, bool? includeSubRelationshipTypes, RelationshipDirection? relationshipDirection, string typeId, string filter, bool? includeAllowableActions, long? maxItems, long? skipCount, IExtensionsData extension) { RelationshipServicePortClient port = Provider.GetRelationshipService(); try { return Converter.Convert(port.getObjectRelationships(repositoryId, objectId, includeSubRelationshipTypes == null ? true : (bool)includeSubRelationshipTypes, (enumRelationshipDirection?)CmisValue.CmisToSerializerEnum(relationshipDirection), typeId, filter, includeAllowableActions, maxItems.ToString(), skipCount.ToString(), Converter.ConvertExtension(extension))); } catch (FaultException<cmisFaultType> fe) { throw ConvertException(fe); } catch (Exception e) { throw new CmisRuntimeException("Error: " + e.Message, e); } }
public LongIterator getAddedRelationships(RelationshipDirection direction, int relType) { return(ImmutableEmptyLongIterator.INSTANCE); }
/// <summary> /// Applies the related resource condition to the structured query. /// </summary> /// <param name="structuredQuery">The structured query.</param> /// <param name="relationshipSettings">The relationship settings.</param> private static void ApplyRelatedResourceCondition(StructuredQuery structuredQuery, ReportRelationshipSettings relationshipSettings, QuerySettings querySettings) { RelationshipDirection direction = relationshipSettings.Direction == ReportRelationshipSettings.ReportRelationshipDirection.Forward ? RelationshipDirection.Forward : RelationshipDirection.Reverse; // Find existing equivalent relation. RelatedResource relation = ( from related in structuredQuery.RootEntity.RelatedEntities let rr = related as RelatedResource where rr != null && rr.RelationshipTypeId.Id == relationshipSettings.RelationshipId && rr.RelationshipDirection == direction && rr.Recursive == RecursionMode.None select rr).FirstOrDefault( ); if (relation == null) { // Add if not already found relation = new RelatedResource { NodeId = Guid.NewGuid( ), RelationshipDirection = direction, RelationshipTypeId = new Model.EntityRef(relationshipSettings.RelationshipId), ResourceMustExist = true, }; List <Entity> relatedEntities = new List <Entity>( ); if (structuredQuery.RootEntity.RelatedEntities != null) { relatedEntities.AddRange(structuredQuery.RootEntity.RelatedEntities); } relatedEntities.Add(relation); structuredQuery.RootEntity.RelatedEntities = relatedEntities; } // Add in the unsaved changes prior to the SQL generation and report run if (relationshipSettings.EntityId != 0 || (relationshipSettings.IncludedEntityIds != null && relationshipSettings.IncludedEntityIds.Count > 0) || (relationshipSettings.ExcludedEntityIds != null && relationshipSettings.ExcludedEntityIds.Count > 0)) { relation.FauxRelationships = new FauxRelationships { HasTargetResource = relationshipSettings.EntityId != 0, IsTargetResourceTemporary = Model.EntityId.IsTemporary(relationshipSettings.EntityId), HasIncludedResources = relationshipSettings.IncludedEntityIds != null && relationshipSettings.IncludedEntityIds.Count > 0, HasExcludedResources = relationshipSettings.ExcludedEntityIds != null && relationshipSettings.ExcludedEntityIds.Count > 0 }; } // Set execute-time information into query settings object querySettings.TargetResource = relationshipSettings.EntityId; querySettings.IncludeResources = relationshipSettings.IncludedEntityIds?.Distinct(); querySettings.ExcludeResources = relationshipSettings.ExcludedEntityIds?.Distinct(); // In the event that the entity that is passed into us has yet to be actually created then it will be 0 and should not be used in the query condition. if (relationshipSettings.EntityId != 0) { var condition = new QueryCondition { Expression = new IdExpression { NodeId = relation.NodeId }, Operator = ConditionType.Equal, Parameter = "@targetResource" }; List <QueryCondition> queryConditions = new List <QueryCondition>( ); if (structuredQuery.Conditions != null) { queryConditions.AddRange(structuredQuery.Conditions); } queryConditions.Add(condition); structuredQuery.Conditions = queryConditions; } }
public virtual LongIterator getAddedRelationships(RelationshipDirection direction, int relType) { return(_relationshipsAdded != null?_relationshipsAdded.getRelationships(direction, relType) : ImmutableEmptyLongIterator.INSTANCE); }
/// <inheritdoc/> public IDataReader GetUserRelationship(int userId, int relatedUserId, int relationshipId, RelationshipDirection relationshipDirection) { return(this._provider.ExecuteReader("GetUserRelationshipsByMultipleIDs", userId, relatedUserId, relationshipId, relationshipDirection)); }
public int augmentDegree(RelationshipDirection direction, int degree, int typeId) { return(degree); }