Пример #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: static void putTokenCounts(java.util.Map<String,Object> metaData, org.neo4j.internal.kernel.api.Kernel kernel) throws org.neo4j.internal.kernel.api.exceptions.TransactionFailureException
        internal static void PutTokenCounts(IDictionary <string, object> metaData, Kernel kernel)
        {
            using (Transaction tx = kernel.BeginTransaction([email protected]_Type.Explicit, LoginContext.AUTH_DISABLED))
            {
                TokenRead tokens = tx.TokenRead();
                metaData["labelCount"]            = tokens.LabelCount();
                metaData["relationshipTypeCount"] = tokens.RelationshipTypeCount();
                metaData["propertyKeyCount"]      = tokens.PropertyKeyCount();
                tx.Success();
            }
        }
Пример #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: static java.util.stream.Stream<RetrieveResult> retrieve(org.neo4j.internal.kernel.api.Kernel kernel) throws org.neo4j.internal.kernel.api.exceptions.TransactionFailureException
        internal static Stream <RetrieveResult> Retrieve(Kernel kernel)
        {
            using (Transaction tx = kernel.BeginTransaction([email protected]_Type.Explicit, LoginContext.AUTH_DISABLED))
            {
                TokenRead tokens = tx.TokenRead();

                IList <string> labels = new List <string>(tokens.LabelCount());
                tokens.LabelsGetAllTokens().forEachRemaining(t => labels.Add(t.name()));

                IList <string> relationshipTypes = new List <string>(tokens.RelationshipTypeCount());
                tokens.RelationshipTypesGetAllTokens().forEachRemaining(t => relationshipTypes.Add(t.name()));

                IList <string> propertyKeys = new List <string>(tokens.PropertyKeyCount());
                tokens.PropertyKeyGetAllTokens().forEachRemaining(t => propertyKeys.Add(t.name()));

                IDictionary <string, object> data = new Dictionary <string, object>();
                data["labels"]            = labels;
                data["relationshipTypes"] = relationshipTypes;
                data["propertyKeys"]      = propertyKeys;
                return(Stream.of(new RetrieveResult(Sections.TOKENS, data)));
            }
        }