Search in sources :

Example 1 with RelationshipResultStream

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())));
}
Also used : SimpleCypherQuery(org.structr.bolt.index.SimpleCypherQuery) RelationshipResultStream(org.structr.bolt.index.RelationshipResultStream) RelationshipRelationshipMapper(org.structr.bolt.mapper.RelationshipRelationshipMapper)

Example 2 with RelationshipResultStream

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())));
}
Also used : SimpleCypherQuery(org.structr.bolt.index.SimpleCypherQuery) RelationshipResultStream(org.structr.bolt.index.RelationshipResultStream) RelationshipRelationshipMapper(org.structr.bolt.mapper.RelationshipRelationshipMapper)

Aggregations

RelationshipResultStream (org.structr.bolt.index.RelationshipResultStream)2 SimpleCypherQuery (org.structr.bolt.index.SimpleCypherQuery)2 RelationshipRelationshipMapper (org.structr.bolt.mapper.RelationshipRelationshipMapper)2