use of com.baidu.hugegraph.structure.schema.EdgeLabel in project incubator-hugegraph-toolchain by apache.
the class EdgeLabelApiTest method testAppendWithSourceOrTargetLabel.
@Test
public void testAppendWithSourceOrTargetLabel() {
EdgeLabel edgeLabel1 = schema().edgeLabel("created").sourceLabel("person").targetLabel("software").singleTime().properties("date").build();
edgeLabel1 = edgeLabelAPI.create(edgeLabel1);
Assert.assertEquals("created", edgeLabel1.name());
Assert.assertEquals("person", edgeLabel1.sourceLabel());
Assert.assertEquals("software", edgeLabel1.targetLabel());
Assert.assertEquals(Frequency.SINGLE, edgeLabel1.frequency());
Set<String> props = ImmutableSet.of("date");
Assert.assertEquals(props, edgeLabel1.properties());
EdgeLabel edgeLabel2 = schema().edgeLabel("created").sourceLabel("person").targetLabel("person").properties("city").build();
Utils.assertResponseError(400, () -> {
edgeLabelAPI.append(edgeLabel2);
});
}
use of com.baidu.hugegraph.structure.schema.EdgeLabel in project incubator-hugegraph-toolchain by apache.
the class JobApiTest method testRebuildEdgeLabel.
@Test
public void testRebuildEdgeLabel() {
EdgeLabel created = schema().getEdgeLabel("created");
long taskId = rebuildAPI.rebuild(created);
Task task = taskAPI.get(taskId);
Assert.assertNotNull(task);
Assert.assertEquals(taskId, task.id());
waitUntilTaskCompleted(taskId);
}
use of com.baidu.hugegraph.structure.schema.EdgeLabel in project incubator-hugegraph-toolchain by apache.
the class RebuildAPI method rebuildIndex.
private long rebuildIndex(SchemaElement element) {
E.checkArgument(element instanceof VertexLabel || element instanceof EdgeLabel || element instanceof IndexLabel, "Only VertexLabel, EdgeLabel and IndexLabel support " + "rebuild, but got '%s'", element);
String path = String.join(PATH_SPLITOR, this.path(), element.type());
RestResult result = this.client.put(path, element.name(), element);
@SuppressWarnings("unchecked") Map<String, Object> task = result.readObject(Map.class);
return TaskAPI.parseTaskId(task);
}
use of com.baidu.hugegraph.structure.schema.EdgeLabel in project incubator-hugegraph-toolchain by apache.
the class EdgeLabelAPI method checkCreateOrUpdate.
@Override
protected Object checkCreateOrUpdate(SchemaElement schemaElement) {
EdgeLabel edgeLabel = (EdgeLabel) schemaElement;
Object el = edgeLabel;
if (this.client.apiVersionLt("0.54")) {
E.checkArgument(edgeLabel.ttl() == 0L && edgeLabel.ttlStartTime() == null, "Not support ttl until api version 0.54");
el = edgeLabel.switchV53();
}
return el;
}
Aggregations