use of org.neo4j.internal.kernel.api.TokenRead in project neo4j by neo4j.
the class TokensSection method putTokenCounts.
static void putTokenCounts(Map<String, Object> metaData, Kernel kernel) throws TransactionFailureException {
try (KernelTransaction tx = kernel.beginTransaction(KernelTransaction.Type.EXPLICIT, LoginContext.AUTH_DISABLED)) {
TokenRead tokens = tx.tokenRead();
metaData.put("labelCount", tokens.labelCount());
metaData.put("relationshipTypeCount", tokens.relationshipTypeCount());
metaData.put("propertyKeyCount", tokens.propertyKeyCount());
tx.commit();
}
}
use of org.neo4j.internal.kernel.api.TokenRead in project neo4j by neo4j.
the class TransactionImpl method findRelationships.
@Override
public ResourceIterator<Relationship> findRelationships(RelationshipType relationshipType, Map<String, Object> propertyValues) {
checkRelationshipType(relationshipType);
checkArgument(propertyValues != null, "Property values can not be null");
KernelTransaction transaction = kernelTransaction();
TokenRead tokenRead = transaction.tokenRead();
int typeId = tokenRead.relationshipType(relationshipType.name());
PropertyIndexQuery.ExactPredicate[] queries = convertToQueries(propertyValues, tokenRead);
return relationshipsByTypeAndProperties(transaction, typeId, queries);
}
use of org.neo4j.internal.kernel.api.TokenRead in project neo4j by neo4j.
the class TransactionImpl method findRelationships.
@Override
public ResourceIterator<Relationship> findRelationships(RelationshipType relationshipType, String key, String template, StringSearchMode searchMode) {
checkRelationshipType(relationshipType);
checkPropertyKey(key);
checkArgument(template != null, "Template must not be null");
KernelTransaction transaction = kernelTransaction();
TokenRead tokenRead = transaction.tokenRead();
int typeId = tokenRead.relationshipType(relationshipType.name());
int propertyId = tokenRead.propertyKey(key);
PropertyIndexQuery query = getIndexQuery(template, searchMode, propertyId);
return relationshipsByTypeAndProperty(transaction, typeId, query);
}
use of org.neo4j.internal.kernel.api.TokenRead in project neo4j by neo4j.
the class TransactionImpl method findNodes.
@Override
public ResourceIterator<Node> findNodes(final Label myLabel, final String key, final String value, final StringSearchMode searchMode) {
checkLabel(myLabel);
checkPropertyKey(key);
checkArgument(value != null, "Template must not be null");
KernelTransaction transaction = kernelTransaction();
TokenRead tokenRead = transaction.tokenRead();
int labelId = tokenRead.nodeLabel(myLabel.name());
int propertyId = tokenRead.propertyKey(key);
PropertyIndexQuery query = getIndexQuery(value, searchMode, propertyId);
return nodesByLabelAndProperty(transaction, labelId, query);
}
use of org.neo4j.internal.kernel.api.TokenRead in project neo4j by neo4j.
the class RelationshipEntity method getPropertyKeys.
@Override
public Iterable<String> getPropertyKeys() {
KernelTransaction transaction = internalTransaction.kernelTransaction();
List<String> keys = new ArrayList<>();
try {
RelationshipScanCursor relationships = transaction.ambientRelationshipCursor();
PropertyCursor properties = transaction.ambientPropertyCursor();
singleRelationship(transaction, relationships);
TokenRead token = transaction.tokenRead();
relationships.properties(properties);
while (properties.next()) {
keys.add(token.propertyKeyName(properties.propertyKey()));
}
} catch (PropertyKeyIdNotFoundKernelException e) {
throw new IllegalStateException("Property key retrieved through kernel API should exist.", e);
}
return keys;
}
Aggregations