参考文档:https://developers.flur.ee/docs/overview/schema/predicates/

1. 更新 Predicate

如果要把不是 index 的 predicate 设置成 index,对 predicate 进行更新的话,可以透过 [”_predicate/name”, “<predicate 名称>”] 来更新:

[
   {
      "_id":[
         "_predicate/name",
         "event/starttime"
      ],
      "index":true
   }
]

cURL:

# Linux
curl -H "Accept: application/json" -X POST -d '[{"_id":["_predicate\\/name","event/starttime"],"index":true}]' <http://13.114.145.25/fdb/seedao/testing/transact>

# Windows
curl -H "Accept: application/json" -X POST -d "[{\\"_id\\":[\\"_predicate\\/name\\",\\"event/starttime\\"],\\"index\\":true}]" <http://13.114.145.25/fdb/seedao/testing/transact>

查看谓词就能发现更新了:

{
      "_id":1008,
      "_predicate/name":"event/starttime",
      "_predicate/doc":"Event start time (ms timestamp)",
      "_predicate/type":"instant",
      "_predicate/index":true // <----------- updated
}

2. 查询 Collection 所有的 Predicates

如果要查询特定 collection 所有的 predicates,可以透过以下 Query:

{
   "select":{ "?predicate":["*"]},
   "where":[["?predicate", "_predicate/name", "?name"],
      {"filter":["(re-find (re-pattern \\"^<collection 名称>\\") ?name)"]}
   ]
}

例如对 user collection 的 curl :

# Linux
curl -H "Accept: application/json" -X POST -d '{"select":{"?predicate":["*"]},"where":[["?predicate","_predicate/name","?name"],{"filter":["(re-find (re-pattern \\"^user\\") ?name)"]}]}' <http://13.114.145.25/fdb/seedao/testing/query>

# Windows
curl -H "Accept: application/json" -X POST -d "{\\"select\\":{\\"?predicate\\":[\\"*\\"]},\\"where\\":[[\\"?predicate\\",\\"_predicate/name\\",\\"?name\\"],{\\"filter\\":[\\"(re-find (re-pattern \\\\\\"^user\\\\\\") ?name)\\"]}]}" <http://13.114.145.25/fdb/seedao/testing/query>

就会拿到所有 predicates 了