use of com.baidu.hugegraph.schema.PropertyKey in project incubator-hugegraph by apache.
the class OlapPropertyKeyCreateJob method execute.
@Override
public Object execute() {
SchemaTransaction schemaTx = this.params().schemaTransaction();
PropertyKey propertyKey = schemaTx.getPropertyKey(this.schemaId());
// Create olap index label schema
schemaTx.createIndexLabelForOlapPk(propertyKey);
// Create olap data table
this.params().graphTransaction().createOlapPk(propertyKey.id());
return null;
}
use of com.baidu.hugegraph.schema.PropertyKey in project incubator-hugegraph by apache.
the class EdgeLabelBuilder method append.
@Override
public EdgeLabel append() {
EdgeLabel edgeLabel = this.edgeLabelOrNull(this.name);
if (edgeLabel == null) {
throw new NotFoundException("Can't update edge label '%s' " + "since it doesn't exist", this.name);
}
// These methods will check params and fill to member variables
this.checkStableVars();
this.checkProperties(Action.APPEND);
this.checkNullableKeys(Action.APPEND);
Userdata.check(this.userdata, Action.APPEND);
for (String key : this.properties) {
PropertyKey propertyKey = this.graph().propertyKey(key);
edgeLabel.property(propertyKey.id());
}
for (String key : this.nullableKeys) {
PropertyKey propertyKey = this.graph().propertyKey(key);
edgeLabel.nullableKey(propertyKey.id());
}
edgeLabel.userdata(this.userdata);
this.graph().addEdgeLabel(edgeLabel);
return edgeLabel;
}
use of com.baidu.hugegraph.schema.PropertyKey in project incubator-hugegraph by apache.
the class VertexCoreTest method testQueryFilterByPropName.
@Test
public void testQueryFilterByPropName() {
HugeGraph graph = graph();
Assume.assumeTrue("Not support CONTAINS_KEY query", storeFeatures().supportsQueryWithContainsKey());
init10Vertices();
VertexLabel language = graph.vertexLabel("language");
PropertyKey dynamic = graph.propertyKey("dynamic");
// Query vertex by condition (does contain the property name?)
ConditionQuery q = new ConditionQuery(HugeType.VERTEX);
q.eq(HugeKeys.LABEL, language.id());
q.key(HugeKeys.PROPERTIES, dynamic.id());
List<Vertex> vertices = ImmutableList.copyOf(graph.vertices(q));
Assert.assertEquals(1, vertices.size());
assertContains(vertices, T.label, "language", "name", "python", "dynamic", true);
// Query vertex by condition (does contain the property name?)
q = new ConditionQuery(HugeType.VERTEX);
q.key(HugeKeys.PROPERTIES, dynamic.id());
vertices = ImmutableList.copyOf(graph.vertices(q));
Assert.assertEquals(1, vertices.size());
assertContains(vertices, T.label, "language", "name", "python", "dynamic", true);
}
use of com.baidu.hugegraph.schema.PropertyKey in project incubator-hugegraph by apache.
the class HugeGraphAuthProxy method removePropertyKey.
@Override
public Id removePropertyKey(Id key) {
PropertyKey pkey = this.hugegraph.propertyKey(key);
verifySchemaPermission(HugePermission.DELETE, pkey);
return this.hugegraph.removePropertyKey(key);
}
use of com.baidu.hugegraph.schema.PropertyKey in project incubator-hugegraph by apache.
the class CassandraSerializer method writeProperty.
@Override
protected Object writeProperty(PropertyKey propertyKey, Object value) {
BytesBuffer buffer = BytesBuffer.allocate(BytesBuffer.BUF_PROPERTY);
if (propertyKey == null) {
/*
* Since we can't know the type of the property value in some
* scenarios so need to construct a fake property key to
* serialize to reuse code.
*/
propertyKey = new PropertyKey(null, IdGenerator.of(0L), "fake");
propertyKey.dataType(DataType.fromClass(value.getClass()));
}
buffer.writeProperty(propertyKey, value);
buffer.forReadWritten();
return buffer.asByteBuffer();
}
Aggregations