First attempt to add gremlin query support
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/resource-registry@146773 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
6e4e0fe259
commit
d4b69c2c1e
|
@ -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;
|
||||
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue