You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Cayley gets stuck in a recursive loop when trying to insert quads from a struct that (eventually) points to itself
Steps to reproduce the issue:
e.g. (based on one of the examples)
type Person struct {
// dummy field to enforce all object to have a <id> <rdf:type> <ex:Person> relation
// means nothing for Go itself
rdfType struct{} `quad:"@type > ex:Person"`
//ID quad.IRI `json:"@id"` // tag @id is a special one - graph node value will be stored in this field
Name string `json:"ex:name"` // field name (predicate) may be written as json field name
Age int `quad:"ex:age"` // or in a quad tag
Relatives []*Person `quad:"ex:relative"`
}
bob := Person{
//ID: quad.IRI("ex:bob").Full().Short(),
Name: "Bob", Age: 32,
}
jane := Person{
//ID: quad.IRI("ex:bob").Full().Short(),
Name: "Jane", Age: 32,
}
bob.Relatives = []*Person{
&jane,
}
jane.Relatives = []*Person{
&bob,
}
fmt.Printf("saving: %+v\n", bob)
id, err := config.WriteAsQuads(writer, bob)
checkErr(err)
fmt.Println("id for object:", id) // should be equal
Description
Cayley gets stuck in a recursive loop when trying to insert quads from a struct that (eventually) points to itself
Steps to reproduce the issue:
e.g. (based on one of the examples)
Received results:
Expected results:
Nodes 'bob' and 'jane' added to graph without error
Output of
cayley version
or commit hash:Environment details:
Backend database: MemoryGraph
The text was updated successfully, but these errors were encountered: