fix(reasoner): query edge add property (#211)

This commit is contained in:
Donghai 2024-04-22 19:13:45 +08:00 committed by GitHub
parent ff948d5403
commit 56fe76b49a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -22,6 +22,7 @@ import com.antgroup.openspg.cloudext.interfaces.graphstore.model.lpg.record.Edge
import com.antgroup.openspg.cloudext.interfaces.graphstore.model.lpg.record.VertexRecord;
import com.antgroup.openspg.cloudext.interfaces.graphstore.model.lpg.record.struct.GraphLPGRecordStruct;
import com.antgroup.openspg.cloudext.interfaces.graphstore.model.lpg.schema.EdgeTypeName;
import com.antgroup.openspg.reasoner.common.constants.Constants;
import com.antgroup.openspg.reasoner.common.graph.edge.Direction;
import com.antgroup.openspg.reasoner.common.graph.edge.IEdge;
import com.antgroup.openspg.reasoner.common.graph.edge.impl.Edge;
@ -175,11 +176,21 @@ public class CloudExtGraphState extends MemGraphState {
new Edge<>(
srcVertexId,
dstVertexId,
new EdgeProperty(edgeRecord.toPropertyMapWithId()),
0L,
toReasonerEdgeProperty(edgeRecord),
edgeRecord.getVersion(),
direction,
edgeRecord.getEdgeType().toString()));
}
return results;
}
private EdgeProperty toReasonerEdgeProperty(EdgeRecord edgeRecord) {
Map<String, Object> otherProperties = edgeRecord.toPropertyMap();
otherProperties.put(Constants.EDGE_FROM_ID_KEY, edgeRecord.getSrcId());
otherProperties.put(Constants.EDGE_TO_ID_KEY, edgeRecord.getDstId());
otherProperties.put(
Constants.EDGE_FROM_ID_TYPE_KEY, edgeRecord.getEdgeType().getStartVertexType());
otherProperties.put(Constants.EDGE_TO_ID_TYPE_KEY, edgeRecord.getEdgeType().getEndVertexType());
return new EdgeProperty(otherProperties);
}
}