Below snippet is used to print vertex and edge labels, indexes, and property keys.
JanusGraphManagement janusGraphManagement = janusGraph.openManagement(); String schema = janusGraphManagement.printSchema(); System.out.println(schema);
Find the below working application.
PrintSchema.java
package com.sample.app.schema;
import org.janusgraph.core.JanusGraph;
import org.janusgraph.core.JanusGraphFactory;
import org.janusgraph.core.schema.JanusGraphManagement;
public class PrintSchema {
public static void main(String args[]) {
try (JanusGraph janusGraph = JanusGraphFactory.open("/Users/Shared/janus.properties")) {
JanusGraphManagement janusGraphManagement = janusGraph.openManagement();
String schema = janusGraphManagement.printSchema();
System.out.println(schema);
} finally {
System.out.println("\nDone!!!");
}
}
}
Output
------------------------------------------------------------------------------------------------ Vertex Label Name | Partitioned | Static | --------------------------------------------------------------------------------------------------- person | false | false | employee | false | false | --------------------------------------------------------------------------------------------------- Edge Label Name | Directed | Unidirected | Multiplicity | --------------------------------------------------------------------------------------------------- knows | true | false | MULTI | --------------------------------------------------------------------------------------------------- Property Key Name | Cardinality | Data Type | --------------------------------------------------------------------------------------------------- name | SINGLE | class java.lang.String | age | SINGLE | class java.lang.Integer | gender | SINGLE | class java.lang.Character | from | SINGLE | class java.lang.Integer | colleague | SINGLE | class java.lang.String | hobbies | SET | class java.lang.String | football | SINGLE | class java.lang.String | experience | SINGLE | class java.lang.Double | ABC Corp | SINGLE | class java.lang.Double | Delta Inc | SINGLE | class java.lang.Double | since | SINGLE | class java.lang.Integer | --------------------------------------------------------------------------------------------------- Graph Index (Vertex) | Type | Unique | Backing | Key: Status | --------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------- Graph Index (Edge) | Type | Unique | Backing | Key: Status | --------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------- Relation Index (VCI) | Type | Direction | Sort Key | Order | Status | --------------------------------------------------------------------------------------------------- Done!!!
Previous Next Home
No comments:
Post a Comment