Hi,
We are using version v1.7 rc2, and it is an embedded instance in a karaf
osgi container.
I'm struggling to figure out why the following query runs from the
command-line console, but not programmatically from our java code:
select from ( traverse in('EntityParent') from ( select from Entity
where name = 'Entity-A' ) ) where $depth > 0
I have a directed hierarchy of vertices of a generic class named Entity,
and I'm simply trying to get all the descendents.
As I stated before, his query works when I run from the command-line
console (console.sh), but when I run it within our application against our
embedded instance of OrientDB, it fails with the following exception:
Caused by:
com.orientechnologies.orient.core.sql.OCommandSQLParsingException: Error on
parsing command at position #0: No function with name 'in', available names
are :
[ifnull,count,last,set,newexcept,sum,date,distinct,distance,document,if,EXCEPT,map,avg,min,encode,coalesce,max,eval,list,format,difference,decode,unionall,sysdate,intersect,first]
at
com.orientechnologies.orient.core.sql.OSQLEngine.getFunction(OSQLEngine.java:354)
at
com.orientechnologies.orient.core.sql.functions.OSQLFunctionRuntime.setRoot(OSQLFunctionRuntime.java:163)
at
com.orientechnologies.orient.core.sql.filter.OSQLFilterItemAbstract.<init>(OSQLFilterItemAbstract.java:56)
at
com.orientechnologies.orient.core.sql.functions.OSQLFunctionRuntime.<init>(OSQLFunctionRuntime.java:51)
at
com.orientechnologies.orient.core.sql.OSQLHelper.getFunction(OSQLHelper.java:218)
at
com.orientechnologies.orient.core.sql.OSQLHelper.parseValue(OSQLHelper.java:197)
at
com.orientechnologies.orient.core.sql.OCommandExecutorSQLTraverse.parseFields(OCommandExecutorSQLTraverse.java:200)
at
com.orientechnologies.orient.core.sql.OCommandExecutorSQLTraverse.parse(OCommandExecutorSQLTraverse.java:66)
at
com.orientechnologies.orient.core.sql.OCommandExecutorSQLTraverse.parse(OCommandExecutorSQLTraverse.java:51)
at
com.orientechnologies.orient.core.sql.OCommandExecutorSQLDelegate.parse(OCommandExecutorSQLDelegate.java:49)
at
com.orientechnologies.orient.core.sql.OCommandExecutorSQLDelegate.parse(OCommandExecutorSQLDelegate.java:33)
at
com.orientechnologies.orient.core.sql.filter.OSQLTarget.extractTargets(OSQLTarget.java:99)
at
com.orientechnologies.orient.core.sql.filter.OSQLTarget.<init>(OSQLTarget.java:61)
... 24 more
I'm pretty sure the classes in the orientdb-graphdb library are being
included in our application...
(as I noticed was necessary in this post:
https://groups.google.com/forum/#!searchin/orient-database/No$20function$20with$20name$20$27in$27/orient-database/648vSSDV_NM/eB5RWaENCIUJ
)
Here is a code snippet from our application to show which classes we are
using in our client for querying the OrientDB graph database:
...
import com.orientechnologies.common.io.OIOException;
import com.orientechnologies.orient.core.Orient;
import com.orientechnologies.orient.core.command.OCommandRequest;
import com.orientechnologies.orient.core.db.ODatabase.STATUS;
import com.orientechnologies.orient.core.db.ODatabaseRecordThreadLocal;
import com.orientechnologies.orient.core.db.document.ODatabaseDocumentPool;
import com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx;
import com.orientechnologies.orient.core.exception.ODatabaseException;
import com.orientechnologies.orient.core.index.OIndexManager;
import com.orientechnologies.orient.core.index.OIndexManagerRemote;
import com.orientechnologies.orient.core.metadata.OMetadata;
import com.orientechnologies.orient.core.metadata.schema.OSchema;
import com.orientechnologies.orient.core.record.impl.ODocument;
import com.orientechnologies.orient.core.sql.OCommandSQL;
import com.orientechnologies.orient.core.sql.query.OSQLSynchQuery;
import com.tinkerpop.blueprints.impls.orient.OrientBaseGraph;
import com.tinkerpop.blueprints.impls.orient.OrientDynaElementIterable;
import com.tinkerpop.blueprints.impls.orient.OrientGraph;
import com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx;
import com.tinkerpop.blueprints.impls.orient.OrientVertex;
...
public OrientDynaElementIterable runGraphQuery(final String iText, final
int iLimit, final String fetchPlan,
final OrientBaseGraph graph) {
long start = 0;
if (LOG.isDebugEnabled()) {
start = new Date().getTime();
LOG.debug(String.format("Executing OrientDB graph
query:\n%s\n\nLimit: %s\nFetch Plan: %s",
iText, iLimit, fetchPlan));
}
OCommandRequest command = new OSQLSynchQuery<
OrientDynaElementIterable>(iText, iLimit);
if (StringUtils.isNotBlank(fetchPlan)) {
command.setFetchPlan(fetchPlan);
}
command = graph.command(command);
OrientDynaElementIterable result = null;
try {
result = command.execute();
} ...
}
I generally would have guessed if the query worked from the console, it
would also work programmatically.
Is the syntax of my query not correct?
Are we doing something wrong in our code when submitting the query?
Thanks in advance for your help!
Regards,
Andrew
--
---
You received this message because you are subscribed to the Google Groups
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.