@contribute
2016-04-08T02:04:30.000000Z
字数 3308
阅读 3221
tinkerpop
MULTI
, SIMPLE
, MANY2ONE
, ONE2MANY
, ONE2ONE
五个中的一个。
{
"name": "working-on",
"multiplicity": "MULTI"
}
注意:
1. 创建后不能被修改。
2. 每天边都必须有个标签。
{
"name": "location"
}
Integer
, Float
, Boolean
和 String
四种类型。SINGLE
, LIST
和 SET
三种类型。
{
"name": "population",
"datatype": "Integer",
"cardinality": "SINGLE"
}
注意:
Integer
: 在-9007199254740992
和+9007199254740992
之间,也就是±2^53
.
String
: 小于等于65535个字节。
[
{
"edgeindexes": [],
"edgelabels": [
{
"multiplicity": "simple",
"name": "route"
}
],
"propertykeys": [
{
"cardinality": "single",
"datatype": "string",
"name": "city"
}
],
"vertexindexes": [
{
"composite": false,
"name": "cityindex",
"propertykeys": [
"city"
],
"unique": false
}
],
"vertexlabels": [
{
"name": "location"
}
]
}
]
Method | URI | Request | Response | Description |
---|---|---|---|---|
get | /schema | - | [ { "edgeindexes": [], "edgelabels": [ {"multiplicity":"simple", "name":"route"} ], "propertykeys": [ {"cardinality":"single", "datatype":"string", "name":"city"} ], "vertexindexes": [ {"composite":false, "name":"cityindex", "propertykeys":[ "city" ], "unique":false} ], "vertexlabels": [ {"name": "location"} ] } ] | 返回json格式的schema |
post | /schema | { "edgeindexes": [], "edgelabels": [ {"multiplicity":"simple", "name":"route"} ], "propertykeys": [ {"cardinality":"single", "datatype":"string", "name":"city"} ], "vertexindexes": [ {"composite":false, "name":"cityindex", "propertykeys":[ "city" ], "unique":false} ], "vertexlabels": [ {"name": "location"} ] } | [ { "edgeindexes": [], "edgelabels": [ {"multiplicity":"simple", "name":"route"} ], "propertykeys": [ {"cardinality":"single", "datatype":"string", "name":"city"} ], "vertexindexes": [ {"composite":false, "name":"cityindex", "propertykeys":[ "city" ], "unique":false} ], "vertexlabels": [ {"name": "location"} ] } ] | 更新schema |
参考IBM bluemix的schema设计和titan的schema定义设计出来的schema。
[
{
/*顶点标签的定义。*/
"vertexlabels": [
{
"name": "location",
/* 支持过期时间,单位为秒*/
"ttl":"1000"
},
{
"name":"god"
}
],
/*边标签的定义。*/
"edgelabels": [
{
"multiplicity": "simple",
"name": "route"
},
{
"multiplicity": "simple",
"name": "create",
"ttl":"5000"
}
],
/*属性定义。*/
"propertykeys": [
{
"cardinality": "single",
"datatype": "string",
"name": "name"
},
{
"cardinality": "single",
"datatype": "string",
"name": "description"
},
{
"cardinality": "list",
"datatype": "string",
"name": "oldname"
},
{
"cardinality": "set",
"datatype": "string",
"name": "address",
/*支持按照此字段排序*/
"order":true
}
],
/*顶点索引。*/
"vertexindexes": [
{
/* 建立关于city和name的composite内部索引。 */
"backend":"internal"
"indextype": "composite",
"name": "cityindex",
"propertykeys": [
"city","name"
],
"unique": false
},
{
/* 建立关于oldname和description外部的索引。 */
"backend":"external"
"indextype": "mixed",
"name": "oldNameAndDescription",
"mixIndexName":"search",
"propertykeys": [
"oldname","description"
],
"unique": false
}
],
/*边索引。*/
"edgeindexes": []
}
]
{
/*顶点标签增删改操作。*/
"vertexlabels":
{
/*添加*/
"add":{"name":"person"},
},
/*边标签增删改操作。*/
"edgelabels":
{
/*添加*/
"add":{"multiplicity": "simple","name": "addedEdgeLabels"},
},
/*属性增删改操作。*/
"propertykeys":
{
/*添加*/
"add":{"cardinality": "single","datatype": "string","name": "addedname"},
},
}
相关参考::
1. Titan支持的数据类型
2. IBM Graph bluemix schema
3. Titan index
4. Titan schema
5. Titan-1.0.0 官方文档