node-cayley
node-cayley copied to clipboard
Use APIv2 for read and delete
We recently released Cayley v0.6.1 and v2 of read/write API is now merged. I strongly suggest using it for read and delete operations because it's more effective and can handle large streams of data.
@dennwc sorry, too busy recently, I will do it and give you the feedback as soon as I can.
@dennwc
Currently read
API is on v2
, write
and delete
are on v1
for my lib, and all the test cases are based on Cayley v0.6.1
, and this is the only combination I can find for now to get all the test cases passed, switch any API to v2
will break some of the test cases.
So for version v0.6.1
still have the problem we talked before: Issue #530, the last comment I put.
And some of my friends are requesting the JSON-LD
support from me, so I did two simple tests to the Cayley v0.6.1
for the JSON-LD
support, seems cannot get it work:
curl -H "Content-Type: application/ld+json" -X POST -d '{"@context":"http://json-ld.org/contexts/person.jsonld","@id":"http://dbpedia.org/resource/John_Lennon","name":"John Lennon","born":"1940-10-09","spouse":"http://dbpedia.org/resource/Cynthia_Lennon"}' http://localhost:64210/api/v2/write
Then I got:
2017/06/09 15:01:36 http: panic serving 172.17.0.1:41504: runtime error: invalid memory address or nil pointer dereference
goroutine 59 [running]:
net/http.(*conn).serve.func1(0xc4202c6780)
/usr/local/go/src/net/http/server.go:1721 +0xd0
panic(0xd09a40, 0x1455ac0)
/usr/local/go/src/runtime/panic.go:489 +0x2cf
github.com/cayleygraph/cayley/vendor/github.com/linkeddata/gojsonld.(*DocumentLoader).loadDocument(0x0, 0xc4202b0690, 0x29, 0x0, 0x1, 0xc4202aca60)
/go/src/github.com/cayleygraph/cayley/vendor/github.com/linkeddata/gojsonld/documentLoader.go:27 +0xd0
github.com/cayleygraph/cayley/vendor/github.com/linkeddata/gojsonld.parse(0xc4201272c8, 0xcc5b20, 0xc4202ac990, 0xc4202aca60, 0x1, 0x1, 0xf0, 0x1e, 0x6)
/go/src/github.com/cayleygraph/cayley/vendor/github.com/linkeddata/gojsonld/contextApi.go:58 +0x1293
github.com/cayleygraph/cayley/vendor/github.com/linkeddata/gojsonld.expand(0xc4200452c8, 0x0, 0xd05320, 0xc4202b0660, 0xc4202b07b0, 0xc4202ac210, 0x402cbe, 0xc420045240)
/go/src/github.com/cayleygraph/cayley/vendor/github.com/linkeddata/gojsonld/expansionApi.go:55 +0x5876
github.com/cayleygraph/cayley/vendor/github.com/linkeddata/gojsonld.Expand(0xd05320, 0xc4202b0660, 0xc4200c8300, 0xc4202ac9f0, 0x10, 0x10, 0xcc5b20, 0xc4202b06f0)
/go/src/github.com/cayleygraph/cayley/vendor/github.com/linkeddata/gojsonld/api.go:54 +0x360
github.com/cayleygraph/cayley/vendor/github.com/linkeddata/gojsonld.toRDF(0xc420127898, 0xd05320, 0xc4202b0660, 0xc4202aca00, 0xc4202b0750, 0x0)
/go/src/github.com/cayleygraph/cayley/vendor/github.com/linkeddata/gojsonld/serializationApi.go:11 +0x6c
github.com/cayleygraph/cayley/vendor/github.com/linkeddata/gojsonld.ToRDF(0xd05320, 0xc4202b0660, 0xc4200c8300, 0xc42031c1e8, 0xca4500, 0xc4202ac960)
/go/src/github.com/cayleygraph/cayley/vendor/github.com/linkeddata/gojsonld/api.go:183 +0x19e
github.com/cayleygraph/cayley/quad/jsonld.NewReaderFromMap(0xd05320, 0xc4202b0660, 0xc4202ac960)
/go/src/github.com/cayleygraph/cayley/quad/jsonld/jsonld.go:39 +0x79
github.com/cayleygraph/cayley/quad/jsonld.NewReader(0x7ffaba942000, 0xc4200cc640, 0x7ffaba942000)
/go/src/github.com/cayleygraph/cayley/quad/jsonld/jsonld.go:34 +0x13b
github.com/cayleygraph/cayley/quad/jsonld.init.1.func2(0x7ffaba942000, 0xc4200cc640, 0xc4200cc640, 0x7ffaba942000)
/go/src/github.com/cayleygraph/cayley/quad/jsonld/jsonld.go:24 +0x35
github.com/cayleygraph/cayley/internal/http.(*API).ServeV2Write(0xc42005d460, 0x12e4f20, 0xc4203001c0, 0xc4202a5b00, 0x0, 0x0, 0x0, 0x0)
/go/src/github.com/cayleygraph/cayley/internal/http/write.go:215 +0x285
github.com/cayleygraph/cayley/internal/http.(*API).ServeV2Write-fm(0x12e4f20, 0xc4203001c0, 0xc4202a5b00, 0x0, 0x0, 0x0, 0xdf8a27)
/go/src/github.com/cayleygraph/cayley/internal/http/http.go:172 +0x66
github.com/cayleygraph/cayley/internal/http.LogRequest.func1(0x12e4f20, 0xc4203001c0, 0xc4202a5b00, 0x0, 0x0, 0x0)
/go/src/github.com/cayleygraph/cayley/internal/http/http.go:84 +0x221
github.com/cayleygraph/cayley/internal/http.CORS.func1(0x12e4f20, 0xc4203001c0, 0xc4202a5b00, 0x0, 0x0, 0x0)
/go/src/github.com/cayleygraph/cayley/internal/http/http.go:159 +0xaf
github.com/cayleygraph/cayley/vendor/github.com/julienschmidt/httprouter.(*Router).ServeHTTP(0xc42006e900, 0x12e4f20, 0xc4203001c0, 0xc4202a5b00)
/go/src/github.com/cayleygraph/cayley/vendor/github.com/julienschmidt/httprouter/router.go:299 +0x750
net/http.(*ServeMux).ServeHTTP(0x14696e0, 0x12e4f20, 0xc4203001c0, 0xc4202a5b00)
/usr/local/go/src/net/http/server.go:2238 +0x130
net/http.serverHandler.ServeHTTP(0xc4202fc000, 0x12e4f20, 0xc4203001c0, 0xc4202a5b00)
/usr/local/go/src/net/http/server.go:2568 +0x92
net/http.(*conn).serve(0xc4202c6780, 0x12e5c20, 0xc42029f400)
/usr/local/go/src/net/http/server.go:1825 +0x612
created by net/http.(*Server).Serve
/usr/local/go/src/net/http/server.go:2668 +0x2ce
Pls help to look into this two problems, thanks.