diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/query/Query.java b/src/main/java/org/gcube/informationsystem/resourceregistry/query/Query.java index aa2e25b..628d84b 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/query/Query.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/query/Query.java @@ -22,4 +22,6 @@ public interface Query { public String query(String query, Integer limit, String fetchPlan) throws InvalidQueryException; + public String gremlinQuery(String query) throws InvalidQueryException; + } diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/query/QueryImpl.java b/src/main/java/org/gcube/informationsystem/resourceregistry/query/QueryImpl.java index d77fff3..c2c980a 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/query/QueryImpl.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/query/QueryImpl.java @@ -167,7 +167,43 @@ public class QueryImpl implements Query { } } - - } + + @Override + public String gremlinQuery(String query) throws InvalidQueryException { + throw new UnsupportedOperationException(); + /* + OGremlinHelper.global().create(); + + ODatabaseDocumentTx oDatabaseDocumentTx = null; + try { + oDatabaseDocumentTx = ContextUtility + .getActualSecurityContextDatabaseTx(PermissionMode.READER); + + + String finalQuery = String.format("select gremlin('%s')", query); + OCommandSQL OCommandSQL = new OCommandSQL(finalQuery); + OCommandRequest oCommandRequest = oDatabaseDocumentTx.command(OCommandSQL); + OBasicResultSet res = oCommandRequest.execute(); + + Iterator iterator = res.iterator(); + + while(iterator.hasNext()){ + ODocument oDocument = (ODocument) iterator.next(); + logger.debug("{}", oDocument); + } + + return res.toString(); + + } catch (Exception e) { + throw new InvalidQueryException(e.getMessage()); + } finally { + if (oDatabaseDocumentTx != null) { + oDatabaseDocumentTx.close(); + } + } + */ + } + + }