use of com.alibaba.graphscope.gaia.store.ExperimentalGraphStore in project GraphScope by alibaba.
the class QueryTest method main.
public static void main(String[] args) {
GaiaConfig config = new ExperimentalGaiaConfig("conf");
GraphStoreService graphStore = new ExperimentalGraphStore(config);
IdMaker queryIdMaker = new IncrementalQueryIdMaker();
test_CR_1_1(config, graphStore, queryIdMaker);
test_CR_1_2(config, graphStore, queryIdMaker);
test_CR_2(config, graphStore, queryIdMaker);
test_CR_3_1(config, graphStore, queryIdMaker);
test_CR_3_2(config, graphStore, queryIdMaker);
test_CR_5(config, graphStore, queryIdMaker);
test_CR_6(config, graphStore, queryIdMaker);
test_CR_7(config, graphStore, queryIdMaker);
test_CR_8(config, graphStore, queryIdMaker);
test_CR_9(config, graphStore, queryIdMaker);
test_CR_11(config, graphStore, queryIdMaker);
test_CR_12(config, graphStore, queryIdMaker);
}
use of com.alibaba.graphscope.gaia.store.ExperimentalGraphStore in project GraphScope by alibaba.
the class GaiaGraphStep method processPrimaryKey.
/**
* label + id -> global_id
*/
public static boolean processPrimaryKey(final GaiaGraphStep<?, ?> graphStep, final HasContainer hasContainer, final List<HasContainer> originalContainers, boolean[] primaryKeyAsIndex, final GraphStoreService graphStore) {
if (graphStep.ids.length == 0 && isValidPrimaryKey(hasContainer) && (hasContainer.getKey().equals(T.label.getAccessor()) && isValidPrimaryKey(getContainer(originalContainers, "id")) || hasContainer.getKey().equals("id") && isValidPrimaryKey(getContainer(originalContainers, T.label.getAccessor())))) {
primaryKeyAsIndex[0] = true;
}
if (!hasContainer.getKey().equals(T.label.getAccessor()) && !hasContainer.getKey().equals("id") || hasContainer.getBiPredicate() != Compare.eq && hasContainer.getBiPredicate() != Contains.within || !isFirstHasContainerWithKey(hasContainer, originalContainers) || !primaryKeyAsIndex[0] || !(graphStore instanceof ExperimentalGraphStore)) {
return false;
}
if (primaryKeyAsIndex[0] && hasContainer.getKey().equals(T.label.getAccessor())) {
HasContainer propertyIdContainer = getContainer(originalContainers, "id");
P predicate = hasContainer.getPredicate();
if (predicate.getValue() instanceof List && ((List) predicate.getValue()).get(0) instanceof String) {
List<String> values = (List<String>) predicate.getValue();
values.forEach(k -> {
long globalId = graphStore.getGlobalId(Long.valueOf(k), ((Number) propertyIdContainer.getPredicate().getValue()).longValue());
graphStep.addIds(globalId);
});
} else if (predicate.getValue() instanceof String) {
long globalId = graphStore.getGlobalId(Long.valueOf((String) predicate.getValue()), ((Number) propertyIdContainer.getPredicate().getValue()).longValue());
graphStep.addIds(globalId);
} else {
throw new UnsupportedOperationException("hasLabel value type not support " + predicate.getValue().getClass());
}
}
return true;
}
use of com.alibaba.graphscope.gaia.store.ExperimentalGraphStore in project GraphScope by alibaba.
the class GremlinServiceMain method main.
public static void main(String[] args) throws Exception {
logger.info("start server");
Settings settings = load();
GremlinServer server = new GremlinServer(settings);
// create graph
GaiaConfig gaiaConfig = new ExperimentalGaiaConfig("conf");
GraphStoreService storeService = new ExperimentalGraphStore(gaiaConfig);
GaiaProcessorLoader.load(gaiaConfig, storeService);
// set global variables
Graph traversalGraph = server.getServerGremlinExecutor().getGraphManager().getGraph("graph");
GlobalEngineConf.setGlobalVariables(traversalGraph.variables());
// bind g to traversal source
Bindings globalBindings = PlanUtils.getGlobalBindings(server.getServerGremlinExecutor().getGremlinExecutor());
globalBindings.put("g", traversalGraph.traversal());
// start gremlin server
server.start().exceptionally(t -> {
logger.error("Gremlin Server was unable to start and will now begin shutdown" + " {}", t);
server.stop().join();
return null;
}).join();
}
Aggregations