use of org.structr.bolt.index.RelationshipResultStream in project structr by structr.
the class BoltDatabaseService method getAllRelationships.
@Override
public QueryResult<Relationship> getAllRelationships() {
final StringBuilder buf = new StringBuilder();
buf.append("MATCH (");
if (tenantId != null) {
buf.append(":");
buf.append(tenantId);
}
buf.append(")-[r]->(");
if (tenantId != null) {
buf.append(":");
buf.append(tenantId);
}
buf.append(") RETURN r");
return QueryUtils.map(new RelationshipRelationshipMapper(this), new RelationshipResultStream(this, new SimpleCypherQuery(buf.toString())));
}
use of org.structr.bolt.index.RelationshipResultStream in project structr by structr.
the class BoltDatabaseService method getRelationshipsByType.
@Override
public QueryResult<Relationship> getRelationshipsByType(final String type) {
if (type == null) {
return getAllRelationships();
}
final StringBuilder buf = new StringBuilder();
buf.append("MATCH (");
if (tenantId != null) {
buf.append(":");
buf.append(tenantId);
}
buf.append(")-[r:");
buf.append(type);
buf.append("]->(");
if (tenantId != null) {
buf.append(":");
buf.append(tenantId);
}
buf.append(") RETURN r");
return QueryUtils.map(new RelationshipRelationshipMapper(this), new RelationshipResultStream(this, new SimpleCypherQuery(buf.toString())));
}
Aggregations