1

如何交叉引用 Wea​​viate 中的另一件事?

我尝试了下面的代码,但收到一条错误消息(也在下面)

weaviateObj = {
  "class": "Article",
  "schema": {
     "articleTitle": articlemeta.title,
     "publisherId": articlemeta.publisherId,
     "digitalObjectIdentifier": articlemeta.digitalObjectIdentifier,
     "publishedInJournal": {
          "beacon" : WEAVIATE_URL + "/v1/things/" + journaluuid
     }
    }
}

r = runREST(WEAVIATE_URL + "/v1/things", weaviateObj, 0, "POST")

错误:

{
    "error": [
        {
            "message": "invalid thing: invalid cref: reference must be an array, but got a map: map[string]interface {}{\"beacon\":\"http://localhost:8080/v1/things/7d60395e-db76-4401-9994-692ce0f5b10d\"}"
        }
    ]
}
4

1 回答 1

0

答案可以在错误信息中找到;

invalid cref: reference must be an array, but got a map: map[string]interface {}

您正在发送map[string]这样的:

"publishedInJournal": {
     "beacon" : WEAVIATE_URL + "/v1/things/" + journaluuid
}

但它应该是一个数组:

"publishedInJournal": [{
     "beacon" : WEAVIATE_URL + "/v1/things/" + journaluuid
}]

PS:
另外,不确定指的是什么WEAVIATE_URL,但请确保语法是:weaviate://localhost/things/ + journaluuid

于 2019-08-22T09:25:53.460 回答