How do I make a cross-reference to another thing in Weaviate?
I tried the code below, but I get an error message (also below)
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:
{
"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\"}"
}
]
}
The answer can be found in the error message;
invalid cref: reference must be an array, but got a map: map[string]interface {}
You are sending a map[string]
like this:
"publishedInJournal": {
"beacon" : WEAVIATE_URL + "/v1/things/" + journaluuid
}
But it should be an array:
"publishedInJournal": [{
"beacon" : WEAVIATE_URL + "/v1/things/" + journaluuid
}]
PS:
Also, not sure what WEAVIATE_URL
reffers to, but make sure the syntax is: weaviate://localhost/things/ + journaluuid