コード例 #1
0
  public Atom<List<Map<String, Vertex>>> compute(
      final List<Operation> arguments, final GremlinScriptContext context) throws RuntimeException {

    final int size = arguments.size();
    final SailGraph graph = (SailGraph) FunctionHelper.getGraph(arguments, 0, context);

    final String sparqlQuery;

    if (size == 1) {
      sparqlQuery = (String) arguments.get(0).compute().getValue();
    } else if (size == 2) {
      sparqlQuery = (String) arguments.get(1).compute().getValue();
    } else {
      throw new RuntimeException(this.createUnsupportedArgumentMessage());
    }

    return new Atom<List<Map<String, Vertex>>>(graph.executeSparql(sparqlQuery));
  }