org.neo4j.kernel.api.CountsRead Maven / Gradle / Ivy
/*
* Copyright (c) 2002-2015 "Neo Technology,"
* Network Engine for Objects in Lund AB [http://neotechnology.com]
*
* This file is part of Neo4j.
*
* Neo4j is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
package org.neo4j.kernel.api;
public interface CountsRead
{
int ANY_LABEL = -1;
int ANY_RELATIONSHIP_TYPE = -1;
/**
* The number of nodes in the graph.
*
* If the label parameter is {@link #ANY_LABEL}, this method returns the total number of nodes in the graph, i.e.
* {@code MATCH (n) RETURN count(n)}.
*
* If the label parameter is set to any other value, this method returns the number of nodes that has that label,
* i.e. {@code MATCH (n:LBL) RETURN count(n)}.
*
* @param labelId the label to get the count for, or {@link #ANY_LABEL} to get the total number of nodes.
* @return the number of matching nodes in the graph.
*/
long countsForNode( int labelId );
/**
* The number of relationships in the graph.
*
* Returns the number of relationships in the graph that matches the specified pattern,
* {@code (:startLabelId)-[:typeId]->(:endLabelId)}, like so:
*
*
*
* {@code startLabelId} {@code typeId} {@code endLabelId}
* Pattern
*
*
*
* {@link #ANY_LABEL} {@link #ANY_RELATIONSHIP_TYPE} {@link #ANY_LABEL}
* {@code MATCH} {@code ()-[r]->()} {@code RETURN count(r)}
*
*
* {@link #ANY_LABEL} {@code REL} {@link #ANY_LABEL}
* {@code MATCH} {@code ()-[r:REL]->()} {@code RETURN count(r)}
*
*
* {@code LHS} {@link #ANY_RELATIONSHIP_TYPE} {@link #ANY_LABEL}
* {@code MATCH} {@code (:LHS)-[r]->()} {@code RETURN count(r)}
*
*
* {@link #ANY_LABEL} {@link #ANY_RELATIONSHIP_TYPE} {@code RHS}
* {@code MATCH} {@code ()-[r]->(:RHS)} {@code RETURN count(r)}
*
*
* {@code LHS} {@code REL} {@link #ANY_LABEL}
* {@code MATCH} {@code (:LHS)-[r:REL]->()} {@code RETURN count(r)}
*
*
* {@link #ANY_LABEL} {@code REL} {@code RHS}
* {@code MATCH} {@code ()-[r:REL]->(:RHS)} {@code RETURN count(r)}
*
*
* {@code LHS} {@link #ANY_RELATIONSHIP_TYPE} {@code RHS}
* {@code MATCH} {@code (:LHS)-[r]->(:RHS)} {@code RETURN count(r)}
*
*
* {@code LHS} {@code REL} {@code RHS}
* {@code MATCH} {@code (:LHS)-[r:REL]->(:RHS)} {@code RETURN count(r)}
*
*
*
*
* @param startLabelId the label of the start node of relationships to get the count for, or {@link #ANY_LABEL}.
* @param typeId the type of relationships to get a count for, or {@link #ANY_RELATIONSHIP_TYPE}.
* @param endLabelId the label of the end node of relationships to get the count for, or {@link #ANY_LABEL}.
* @return the number of matching relationships in the graph.
*/
long countsForRelationship( int startLabelId, int typeId, int endLabelId );
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy