Search in sources :

Example 1 with Message

use of com.alibaba.maxgraph.Message in project GraphScope by alibaba.

the class ResultParserUtils method parseEntry.

private static QueryResult parseEntry(Message.RawMessageProto message, GraphSchema schema, Graph graph) {
    try {
        Message.EntryProto entry = Message.EntryProto.parseFrom(message.getExtra().getExtraValueProp().getValueEntity().getPayload());
        EntryValueResult entryValueResult = new EntryValueResult();
        entryValueResult.setKey(parseRawMessage(entry.getKey(), schema, graph));
        entryValueResult.setValue(parseRawMessage(entry.getValue(), schema, graph));
        return entryValueResult;
    } catch (InvalidProtocolBufferException e) {
        throw new RuntimeException(e);
    }
}
Also used : Message(com.alibaba.maxgraph.Message) InvalidProtocolBufferException(com.google.protobuf.InvalidProtocolBufferException) EntryValueResult(com.alibaba.maxgraph.sdkcommon.graph.EntryValueResult)

Example 2 with Message

use of com.alibaba.maxgraph.Message in project GraphScope by alibaba.

the class ResultParserUtils method parseEdge.

private static EdgeResult parseEdge(Message.RawMessageProto message, GraphSchema schema, Graph graph) {
    long id = message.getId();
    int typeId = message.getTypeId();
    Message.ExtraEdgeEntityProto edgeEntity = message.getExtra().getExtraEdge();
    List<Message.PropertyEntityProto> propertyList = message.getExtra().getExtraValueProp().getPropListList();
    EdgeResult edgeResult = new EdgeResult(id, parseVertex(edgeEntity.getSrcId(), edgeEntity.getSrcTypeId(), schema, graph, 0), parseVertex(edgeEntity.getDstId(), edgeEntity.getDstTypeId(), schema, graph, 0), getEdgeLabel(typeId, id, schema));
    if (null != propertyList) {
        for (Message.PropertyEntityProto propertyEntity : propertyList) {
            edgeResult.addProperty(parseProperty(propertyEntity, edgeResult, schema, graph));
        }
    }
    return edgeResult;
}
Also used : PropertyEntityProto(com.alibaba.maxgraph.Message.PropertyEntityProto) Message(com.alibaba.maxgraph.Message) PropertyEntityProto(com.alibaba.maxgraph.Message.PropertyEntityProto) EdgeResult(com.alibaba.maxgraph.result.EdgeResult)

Example 3 with Message

use of com.alibaba.maxgraph.Message in project GraphScope by alibaba.

the class ResultParserUtils method parsePathEntry.

private static QueryResult parsePathEntry(Message.RawMessageProto message, GraphSchema schema, Graph graph) {
    try {
        Message.PathEntityProto pathEntity = Message.PathEntityProto.parseFrom(message.getExtra().getExtraValueProp().getValueEntity().getPayload());
        QueryResult pathValue = parseRawMessage(pathEntity.getMessage(), schema, graph);
        PathValueResult pathValueResult = new PathValueResult(pathValue, Sets.newHashSet(pathEntity.getLabelListList()));
        return pathValueResult;
    } catch (InvalidProtocolBufferException e) {
        throw new RuntimeException(e);
    }
}
Also used : QueryResult(com.alibaba.maxgraph.sdkcommon.graph.QueryResult) Message(com.alibaba.maxgraph.Message) PathValueResult(com.alibaba.maxgraph.result.PathValueResult) InvalidProtocolBufferException(com.google.protobuf.InvalidProtocolBufferException)

Aggregations

Message (com.alibaba.maxgraph.Message)3 InvalidProtocolBufferException (com.google.protobuf.InvalidProtocolBufferException)2 PropertyEntityProto (com.alibaba.maxgraph.Message.PropertyEntityProto)1 EdgeResult (com.alibaba.maxgraph.result.EdgeResult)1 PathValueResult (com.alibaba.maxgraph.result.PathValueResult)1 EntryValueResult (com.alibaba.maxgraph.sdkcommon.graph.EntryValueResult)1 QueryResult (com.alibaba.maxgraph.sdkcommon.graph.QueryResult)1