如何在 Weaviate 中交叉引用另一个对象?
How to make a cross reference to another object in Weaviate?
如何在 Weaviate 中交叉引用另一个东西?
我尝试了下面的代码,但收到一条错误消息(也在下面)
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\"}"
}
]
}
答案可以在错误信息中找到;
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
如何在 Weaviate 中交叉引用另一个东西?
我尝试了下面的代码,但收到一条错误消息(也在下面)
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\"}"
}
]
}
答案可以在错误信息中找到;
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