use of org.structr.bolt.index.SimpleCypherQuery 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.SimpleCypherQuery 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())));
}
use of org.structr.bolt.index.SimpleCypherQuery in project structr by structr.
the class BoltDatabaseService method getNodesByLabel.
@Override
public QueryResult<Node> getNodesByLabel(final String type) {
if (type == null) {
return getAllNodes();
}
final StringBuilder buf = new StringBuilder();
buf.append("MATCH (n");
if (tenantId != null) {
buf.append(":");
buf.append(tenantId);
}
buf.append(":");
buf.append(type);
buf.append(") RETURN n");
return QueryUtils.map(new NodeNodeMapper(this), new NodeResultStream(this, new SimpleCypherQuery(buf.toString())));
}
use of org.structr.bolt.index.SimpleCypherQuery in project structr by structr.
the class BoltDatabaseService method getNodesByTypeProperty.
@Override
public QueryResult<Node> getNodesByTypeProperty(final String type) {
if (type == null) {
return getAllNodes();
}
final StringBuilder buf = new StringBuilder();
buf.append("MATCH (n");
if (tenantId != null) {
buf.append(":");
buf.append(tenantId);
}
buf.append(") WHERE n.type = {type} RETURN n");
final SimpleCypherQuery query = new SimpleCypherQuery(buf.toString());
query.getParameters().put("type", type);
// return QueryUtils.map(mapper, tx.getNodes("MATCH (n) WHERE n.type = {type} RETURN n", map));
return QueryUtils.map(new NodeNodeMapper(this), new NodeResultStream(this, query));
}
use of org.structr.bolt.index.SimpleCypherQuery in project structr by structr.
the class BoltDatabaseService method getAllNodes.
@Override
public QueryResult<Node> getAllNodes() {
final StringBuilder buf = new StringBuilder();
buf.append("MATCH (n");
if (tenantId != null) {
buf.append(":");
buf.append(tenantId);
}
buf.append(") RETURN n");
return QueryUtils.map(new NodeNodeMapper(this), new NodeResultStream(this, new SimpleCypherQuery(buf.toString())));
}
Aggregations