@contribute
2016-09-05T13:35:33.000000Z
字数 2535
阅读 2525
tinkerpop
提交一个schema。
- schema 的id在图中已经存在,如果schema不存在,怎返回错误。
更新一个schema。(现在只能添加顶点和边标签、属性)
- method :
POST- address:
/api/schema/script/:gid- parameter1: 参数名:
schema;类型:String;格式:json。- return: 将schema转换后script脚本。
提交参数:
{"vertexlabels": [{"name": "person","ttl": 0},{"name": "god","ttl": 0}],"edgelabels": [{"name": "create","ttl": 0,"multiplicity": "MANY2ONE"},{"name": "knows","ttl": 313410,"multiplicity": "MULTI"}],"propertykeys": [{"cardinality": "SINGLE","datatype": "String","name": "name","ttl": 0,"order": true},{"cardinality": "SET","datatype": "String","name": "age","ttl": 324,"order": true}]}
返回结果:
mgmt = graph.openManagement()HPvmYa = mgmt.makeVertexLabel('person').make()kAOqFO = mgmt.makeVertexLabel('god').make()jtJyjt = mgmt.makeEdgeLabel('create').multiplicity(MANY2ONE).make()QEsVNf = mgmt.makeEdgeLabel('knows').multiplicity(MULTI).make()mgmt.setTTL(QEsVNf, Duration.ofSeconds(313,410))ckYTXj = mgmt.makePropertyKey('name').cardinality(Cardinality.SINGLE).dataType(String.class).make()LKOays = mgmt.makePropertyKey('age').cardinality(Cardinality.SET).dataType(String.class).make()mgmt.setTTL(LKOays, Duration.ofSeconds(324))mgmt.commit()
- method :
GET- address:
/api/schema/:id- return: 将schema转换后script脚本。
请求:
/api/schema/schema-001231
返回:
{"vertexlabels": [{"name": "person","ttl": 0},{"name": "god","ttl": 0}],"edgelabels": [{"name": "create","ttl": 0,"multiplicity": "MANY2ONE"},{"name": "knows","ttl": 313410,"multiplicity": "MULTI"}],"propertykeys": [{"cardinality": "SINGLE","datatype": "String","name": "name","ttl": 0,"order": true},{"cardinality": "SET","datatype": "String","name": "age","ttl": 324,"order": true}]}
- method :
POST- address:
/api/schema/:id- parameter1: 参数名:
schema;类型:String;格式:json。- return: 合并后json格式的schema定义。
/api/schema/schema-001231
请求参数:
{"vertexlabels": [{"name": "Hemigod","ttl": 0},{"name": "god","ttl": 0}],"edgelabels": [{"name": "knows","ttl": 313410,"multiplicity": "MULTI"}],"propertykeys": [{"cardinality": "SET","datatype": "String","name": "age","ttl": 324,"order": true}]}
返回结果
{"vertexlabels": [{"name": "person","ttl": 0},{"name": "Hemigod","ttl": 0},{"name": "god","ttl": 0}],"edgelabels": [{"name": "create","ttl": 0,"multiplicity": "MANY2ONE"},{"name": "knows","ttl": 313410,"multiplicity": "MULTI"}],"propertykeys": [{"cardinality": "SINGLE","datatype": "String","name": "name","ttl": 0,"order": true},{"cardinality": "SET","datatype": "String","name": "age","ttl": 324,"order": true}]}