0

当我使用 cayley api/v2/write 接口来存储 json-ld 数据时,我遇到了一些错误。

凯利版:

➜ cayley ./cayley 版本 Cayley v0.6.1 内置 2017-04-12T11:41:20-07:00

测试命令:

curl -H "Content-Type:application/ld+json" -X POST -d '[{"@context":"http://json-ld.org/contexts/persion.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

错误信息:

    2017/06/08 08:04:37 http: panic serving 127.0.0.1:52187: runtime error: invalid memory address or nil pointer dereference
goroutine 13 [running]:
net/http.(*conn).serve.func1(0xc42021f180)
    /usr/lib/go/src/net/http/server.go:1721 +0xd0
panic(0x190fbc0, 0x2062b80)
    /usr/lib/go/src/runtime/panic.go:489 +0x2cf
github.com/cayleygraph/cayley/vendor/github.com/linkeddata/gojsonld.(*DocumentLoader).loadDocument(0x0, 0xc420215ec0, 0x2a, 0x0, 0x1, 0xc4202bd120)
    /home/barak/src/cayley/src/github.com/cayleygraph/cayley/vendor/github.com/linkeddata/gojsonld/documentLoader.go:27 +0xd0
github.com/cayleygraph/cayley/vendor/github.com/linkeddata/gojsonld.parse(0xc4201112c8, 0x18cb700, 0xc4202bd040, 0xc4202bd120, 0x1, 0x1, 0x0, 0x0, 0x0)
    /home/barak/src/cayley/src/github.com/cayleygraph/cayley/vendor/github.com/linkeddata/gojsonld/contextApi.go:58 +0x1293
github.com/cayleygraph/cayley/vendor/github.com/linkeddata/gojsonld.expand(0xc4201112c8, 0x0, 0x190b4a0, 0xc420215e90, 0x0, 0x0, 0x0, 0x0)
    /home/barak/src/cayley/src/github.com/cayleygraph/cayley/vendor/github.com/linkeddata/gojsonld/expansionApi.go:55 +0x5876
github.com/cayleygraph/cayley/vendor/github.com/linkeddata/gojsonld.expand(0xc4201112c8, 0x0, 0x18bf120, 0xc4202beae0, 0xc42032c000, 0x0, 0x0, 0x0)
    /home/barak/src/cayley/src/github.com/cayleygraph/cayley/vendor/github.com/linkeddata/gojsonld/expansionApi.go:27 +0x59d6
github.com/cayleygraph/cayley/vendor/github.com/linkeddata/gojsonld.Expand(0x18bf120, 0xc4202beae0, 0xc4201df800, 0x0, 0xc420276000, 0x2258000, 0x0, 0x0)
    /home/barak/src/cayley/src/github.com/cayleygraph/cayley/vendor/github.com/linkeddata/gojsonld/api.go:54 +0x360
github.com/cayleygraph/cayley/vendor/github.com/linkeddata/gojsonld.toRDF(0xc420111898, 0x18bf120, 0xc4202beae0, 0xc4202bd0c0, 0xc420215f80, 0x0)
    /home/barak/src/cayley/src/github.com/cayleygraph/cayley/vendor/github.com/linkeddata/gojsonld/serializationApi.go:11 +0x6c
github.com/cayleygraph/cayley/vendor/github.com/linkeddata/gojsonld.ToRDF(0x18bf120, 0xc4202beae0, 0xc4201df800, 0xc42009e8e8, 0x18aa660, 0xc4202bcff0)
    /home/barak/src/cayley/src/github.com/cayleygraph/cayley/vendor/github.com/linkeddata/gojsonld/api.go:183 +0x19e
github.com/cayleygraph/cayley/quad/jsonld.NewReaderFromMap(0x18bf120, 0xc4202beae0, 0xc4202bcff0)
    /home/barak/src/cayley/src/github.com/cayleygraph/cayley/quad/jsonld/jsonld.go:39 +0x79
github.com/cayleygraph/cayley/quad/jsonld.NewReader(0x2340380, 0xc420231380, 0x2340380)
    /home/barak/src/cayley/src/github.com/cayleygraph/cayley/quad/jsonld/jsonld.go:34 +0x13b
github.com/cayleygraph/cayley/quad/jsonld.init.1.func2(0x2340380, 0xc420231380, 0xc420231380, 0x2340380)
    /home/barak/src/cayley/src/github.com/cayleygraph/cayley/quad/jsonld/jsonld.go:24 +0x35
github.com/cayleygraph/cayley/internal/http.(*API).ServeV2Write(0xc4200666d0, 0x1ef1fa0, 0xc4200a0c40, 0xc420221d00, 0x0, 0x0, 0x0, 0x0)
    /home/barak/src/cayley/src/github.com/cayleygraph/cayley/internal/http/write.go:215 +0x285
github.com/cayleygraph/cayley/internal/http.(*API).ServeV2Write-fm(0x1ef1fa0, 0xc4200a0c40, 0xc420221d00, 0x0, 0x0, 0x0, 0x1a00655)
    /home/barak/src/cayley/src/github.com/cayleygraph/cayley/internal/http/http.go:172 +0x66
github.com/cayleygraph/cayley/internal/http.LogRequest.func1(0x1ef1fa0, 0xc4200a0c40, 0xc420221d00, 0x0, 0x0, 0x0)
    /home/barak/src/cayley/src/github.com/cayleygraph/cayley/internal/http/http.go:84 +0x221
github.com/cayleygraph/cayley/internal/http.CORS.func1(0x1ef1fa0, 0xc4200a0c40, 0xc420221d00, 0x0, 0x0, 0x0)
    /home/barak/src/cayley/src/github.com/cayleygraph/cayley/internal/http/http.go:159 +0xaf
github.com/cayleygraph/cayley/vendor/github.com/julienschmidt/httprouter.(*Router).ServeHTTP(0xc4202151d0, 0x1ef1fa0, 0xc4200a0c40, 0xc420221d00)
    /home/barak/src/cayley/src/github.com/cayleygraph/cayley/vendor/github.com/julienschmidt/httprouter/router.go:299 +0x750
net/http.(*ServeMux).ServeHTTP(0x2076200, 0x1ef1fa0, 0xc4200a0c40, 0xc420221d00)
    /usr/lib/go/src/net/http/server.go:2238 +0x130
net/http.serverHandler.ServeHTTP(0xc4202a8160, 0x1ef1fa0, 0xc4200a0c40, 0xc420221d00)
    /usr/lib/go/src/net/http/server.go:2568 +0x92
net/http.(*conn).serve(0xc42021f180, 0x1ef2ca0, 0xc420231280)
    /usr/lib/go/src/net/http/server.go:1825 +0x612
created by net/http.(*Server).Serve
    /usr/lib/go/src/net/http/server.go:2668 +0x2ce

你能帮助我吗 ?谢谢你。

4

1 回答 1

1

这是一个错误。应该在新版本的 Cayley 中修复。

于 2018-02-05T12:39:05.353 回答