MCPcopy
hub / github.com/cayleygraph/cayley / serveRawQuads

Method serveRawQuads

internal/gephi/stream.go:216–238  ·  view source on GitHub ↗
(ctx context.Context, gs *GraphStream, quads shape.Shape, limit int)

Source from the content-addressed store, hash-verified

214}
215
216func (s *GraphStreamHandler) serveRawQuads(ctx context.Context, gs *GraphStream, quads shape.Shape, limit int) {
217 it := shape.BuildIterator(s.QS, quads)
218 defer it.Close()
219
220 var sh, oh valHash
221 for i := 0; (limit < 0 || i < limit) && it.Next(ctx); i++ {
222 qv := it.Result()
223 if qv == nil {
224 continue
225 }
226 q := s.QS.Quad(qv)
227 quad.HashTo(q.Subject, sh[:])
228 quad.HashTo(q.Object, oh[:])
229 s, o := gs.addNode(q.Subject, sh, nil), gs.addNode(q.Object, oh, nil)
230 if s == "" || o == "" {
231 continue
232 }
233 gs.AddEdge(i, s, o, q.Predicate)
234 if err := gs.Flush(); err != nil {
235 return
236 }
237 }
238}
239
240func shouldInline(v quad.Value) bool {
241 switch v.(type) {

Callers 1

ServeHTTPMethod · 0.95

Calls 8

BuildIteratorFunction · 0.92
addNodeMethod · 0.80
AddEdgeMethod · 0.80
CloseMethod · 0.65
NextMethod · 0.65
ResultMethod · 0.65
QuadMethod · 0.65
FlushMethod · 0.65

Tested by

no test coverage detected