//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private static java.util.List<java.util.Map<String,Object>> indexes(org.neo4j.internal.kernel.api.TokenRead tokens, org.neo4j.internal.kernel.api.SchemaRead schemaRead, Anonymizer anonymizer) throws org.neo4j.internal.kernel.api.exceptions.schema.IndexNotFoundKernelException private static IList <IDictionary <string, object> > Indexes(TokenRead tokens, SchemaRead schemaRead, Anonymizer anonymizer) { IList <IDictionary <string, object> > indexes = new List <IDictionary <string, object> >(); SilentTokenNameLookup tokenLookup = new SilentTokenNameLookup(tokens); IEnumerator <IndexReference> iterator = schemaRead.IndexesGetAll(); while (iterator.MoveNext()) { IndexReference index = iterator.Current; IDictionary <string, object> data = new Dictionary <string, object>(); data["labels"] = Map(index.Schema().EntityTokenIds, id => anonymizer.Label(tokenLookup.LabelGetName(id), id)); data["properties"] = Map(index.Schema().PropertyIds, id => anonymizer.PropertyKey(tokenLookup.PropertyKeyGetName(id), id)); Org.Neo4j.Register.Register_DoubleLongRegister register = Registers.newDoubleLongRegister(); schemaRead.IndexUpdatesAndSize(index, register); data["totalSize"] = register.ReadSecond(); data["updatesSinceEstimation"] = register.ReadFirst(); schemaRead.IndexSample(index, register); data["estimatedUniqueSize"] = register.ReadFirst(); indexes.Add(data); } return(indexes); }
private static IList <IDictionary <string, object> > RelationshipCounts(TokenRead tokens, Read read, Anonymizer anonymizer) { IList <IDictionary <string, object> > relationshipCounts = new List <IDictionary <string, object> >(); IDictionary <string, object> relationshipCount = new Dictionary <string, object>(); relationshipCount["count"] = read.CountsForRelationshipWithoutTxState(-1, -1, -1); relationshipCounts.Add(relationshipCount); IList <NamedToken> labels = Iterators.asList(tokens.LabelsGetAllTokens()); tokens.RelationshipTypesGetAllTokens().forEachRemaining(t => { long count = read.CountsForRelationshipWithoutTxState(-1, t.id(), -1); IDictionary <string, object> relationshipTypeCount = new Dictionary <string, object>(); relationshipTypeCount.put("relationshipType", anonymizer.RelationshipType(t.name(), t.id())); relationshipTypeCount.put("count", count); relationshipCounts.Add(relationshipTypeCount); foreach (NamedToken label in labels) { long startCount = read.CountsForRelationshipWithoutTxState(label.id(), t.id(), -1); if (startCount > 0) { IDictionary <string, object> x = new Dictionary <string, object>(); x.put("relationshipType", anonymizer.RelationshipType(t.name(), t.id())); x.put("startLabel", anonymizer.Label(label.name(), label.id())); x.put("count", startCount); relationshipCounts.Add(x); } long endCount = read.CountsForRelationshipWithoutTxState(-1, t.id(), label.id()); if (endCount > 0) { IDictionary <string, object> x = new Dictionary <string, object>(); x.put("relationshipType", anonymizer.RelationshipType(t.name(), t.id())); x.put("endLabel", anonymizer.Label(label.name(), label.id())); x.put("count", endCount); relationshipCounts.Add(x); } } }); return(relationshipCounts); }
private static IList <IDictionary <string, object> > NodeCounts(TokenRead tokens, Read read, Anonymizer anonymizer) { IList <IDictionary <string, object> > nodeCounts = new List <IDictionary <string, object> >(); IDictionary <string, object> nodeCount = new Dictionary <string, object>(); nodeCount["count"] = read.CountsForNodeWithoutTxState(-1); nodeCounts.Add(nodeCount); tokens.LabelsGetAllTokens().forEachRemaining(t => { long count = read.CountsForNodeWithoutTxState(t.id()); IDictionary <string, object> labelCount = new Dictionary <string, object>(); labelCount.put("label", anonymizer.Label(t.name(), t.id())); labelCount.put("count", count); nodeCounts.Add(labelCount); }); return(nodeCounts); }
private static IList <IDictionary <string, object> > Constraints(TokenRead tokens, SchemaRead schemaRead, Anonymizer anonymizer) { IList <IDictionary <string, object> > constraints = new List <IDictionary <string, object> >(); SilentTokenNameLookup tokenLookup = new SilentTokenNameLookup(tokens); IEnumerator <ConstraintDescriptor> iterator = schemaRead.ConstraintsGetAll(); while (iterator.MoveNext()) { ConstraintDescriptor constraint = iterator.Current; EntityType entityType = constraint.Schema().entityType(); IDictionary <string, object> data = new Dictionary <string, object>(); data["properties"] = Map(constraint.Schema().PropertyIds, id => anonymizer.PropertyKey(tokenLookup.PropertyKeyGetName(id), id)); data["type"] = ConstraintType(constraint); int entityTokenId = constraint.Schema().EntityTokenIds[0]; switch (entityType.innerEnumValue) { case EntityType.InnerEnum.NODE: data["label"] = anonymizer.Label(tokenLookup.LabelGetName(entityTokenId), entityTokenId); constraints.Add(data); break; case EntityType.InnerEnum.RELATIONSHIP: data["relationshipType"] = anonymizer.RelationshipType(tokenLookup.RelationshipTypeGetName(entityTokenId), entityTokenId); constraints.Add(data); break; default: break; } } return(constraints); }