We're Hiring!

OMERO and HQL Queries

General and open developer discussion about using OMERO APIs from C++, Java, Python, Matlab and more! Please new questions at https://forum.image.sc/tags/omero
Please note:
Historical discussions about OMERO. Please look for and ask new questions at https://forum.image.sc/tags/omero

If you are having trouble with custom code, please provide a link to a public repository, ideally GitHub.

OMERO and HQL Queries

Postby icaoberg » Fri Nov 12, 2010 1:24 pm

We tried to query directly from OMERO and got this error (bin/omero hql)

Code: Select all
InternalException: Failed to connect: exception
::Ice::EndpointParseException
{
    str = ssl  -p 4064 -h Image i join i.annotationLinks links join
links.child annotation where
}
icaoberg
 
Posts: 145
Joined: Fri Sep 17, 2010 9:05 pm
Location: Pittsburgh, PA

Re: OMERO and HQL Queries

Postby jmoore » Fri Nov 12, 2010 1:48 pm

Can you show us the full command that you executed? This should be a fairly straight-forward client-side configuration issue.

~Josh.
User avatar
jmoore
Site Admin
 
Posts: 1591
Joined: Fri May 22, 2009 1:29 pm
Location: Germany

Re: OMERO and HQL Queries

Postby icaoberg » Fri Nov 12, 2010 4:44 pm

the previous problem was solved, yet when jenn runs the query

Code: Select all
select annotation.file.id from Image i join i.annotationLinks links join
links.child annotation where i.id=4413


i get 0 rows as response, even though if i look at the image via
omero-client (it's Test/Relevance/32507_1_97519) there are attachments
listed under the Annotations section on the right.
icaoberg
 
Posts: 145
Joined: Fri Sep 17, 2010 9:05 pm
Location: Pittsburgh, PA

Re: OMERO and HQL Queries

Postby jmoore » Fri Nov 12, 2010 11:10 pm

Hi Ivan,

let's go by steps. Do you get similar results for each of the following?
Code: Select all
~ $ omero hql -q "select count(*) from Image i where i.id = 37406"
Using session 016500df-fd32-474d-a32a-071543134f78 (bk@localhost). Idle timeout: 10.0 min. Current group: demo
# | Col1
---+------
0 | 1   
(1 row)
~ $ omero hql -q "select count(*) from Image i join i.annotationLinks links join links.child annotation where i.id = 37406"
Using session 016500df-fd32-474d-a32a-071543134f78 (bk@localhost). Idle timeout: 10.0 min. Current group: demo
# | Col1
---+------
0 | 1   
(1 row)
~ $ omero hql -q "select count(annotation) from Image i join i.annotationLinks links join links.child annotation where i.id = 37406"
Using session 016500df-fd32-474d-a32a-071543134f78 (bk@localhost). Idle timeout: 10.0 min. Current group: demo
# | Col1
---+------
0 | 1   
(1 row)
~ $ omero hql -q "select annotation.id from Image i join i.annotationLinks links join links.child annotation where i.id = 37406"
Using session 016500df-fd32-474d-a32a-071543134f78 (bk@localhost). Idle timeout: 10.0 min. Current group: demo
# | Col1   
---+---------
0 | 8506915
(1 row)
~ $ omero hql -q "select annotation.file.id from Image i join i.annotationLinks links join links.child annotation where i.id = 37406"
Using session 016500df-fd32-474d-a32a-071543134f78 (bk@localhost). Idle timeout: 10.0 min. Current group: demo
# | Col1 
---+-------
0 | 35487
(1 row)


~J.
User avatar
jmoore
Site Admin
 
Posts: 1591
Joined: Fri May 22, 2009 1:29 pm
Location: Germany

Re: OMERO and HQL Queries

Postby icaoberg » Mon Nov 15, 2010 3:28 pm

using one of the image of the demo account -which i know has a table associated with it-. its basically the same code you gave us with a different image id. if use the id of a nonexistent image i get an empty list like it should be.

Code: Select all
-bash-3.2$ ./omero hql -q "select annotation.file.id from Image i join i.annotationLinks links join links.child annotation where i.id = 4401"
Using session def8b355-64a9-401d-bba5-6b491ba7d7d7 (demo@localhost). Idle timeout: 10.0 min. Current group: Researchers
Traceback (most recent call last):
  File "./omero", line 152, in <module>
    rv = omero.cli.argv()
  File "/usr0/local/omero.server/OMERO.server-Beta-4.2.0/lib/python/omero/cli.py", line 1149, in argv
    cli.invoke(args[1:])
  File "/usr0/local/omero.server/OMERO.server-Beta-4.2.0/lib/python/omero/cli.py", line 702, in invoke
    stop = self.onecmd(line, previous_args)
  File "/usr0/local/omero.server/OMERO.server-Beta-4.2.0/lib/python/omero/cli.py", line 771, in onecmd
    self.execute(line, previous_args)
  File "/usr0/local/omero.server/OMERO.server-Beta-4.2.0/lib/python/omero/cli.py", line 851, in execute
    args.func(args)
  File "/usr0/local/omero.server/OMERO.server-Beta-4.2.0/lib/python/omero/plugins/hql.py", line 35, in __call__
    self.hql(args)
  File "/usr0/local/omero.server/OMERO.server-Beta-4.2.0/lib/python/omero/plugins/hql.py", line 52, in hql
    rv = self.project(q, args.query, p)
  File "/usr0/local/omero.server/OMERO.server-Beta-4.2.0/lib/python/omero/plugins/hql.py", line 206, in project
    rv = querySvc.projection(queryStr, params)
  File "/usr0/local/omero.server/OMERO.server-Beta-4.2.0/lib/python/omero_api_IQuery_ice.py", line 150, in projection
    return _M_omero.api.IQuery._op_projection.invoke(self, ((query, params), _ctx))
omero.InternalException: exception ::omero::InternalException
{
    serverStackTrace = java.lang.ClassCastException: java.lang.Long cannot be cast to [Ljava.lang.Object;
        at omero.util.IceMapper$6.mapReturnValue(IceMapper.java:194)
        at omero.util.IceMapper.mapReturnValue(IceMapper.java:346)
        at ome.services.blitz.util.IceMethodInvoker.invoke(IceMethodInvoker.java:194)
        at ome.services.throttling.Callback.run(Callback.java:56)
        at ome.services.throttling.InThreadThrottlingStrategy.callInvokerWithMappedArgs(InThreadThrottlingStrategy.java:70)
        at ome.services.blitz.impl.AbstractAmdServant.callInvokerOnMappedArgs(AbstractAmdServant.java:141)
        at ome.services.blitz.impl.QueryI.projection_async(QueryI.java:124)
        at omero.api._IQueryTie.projection_async(_IQueryTie.java:134)
        at omero.api._IQueryDisp.___projection(_IQueryDisp.java:416)
        at omero.api._IQueryDisp.__dispatch(_IQueryDisp.java:536)
        at IceInternal.Incoming.invoke(Incoming.java:159)
        at Ice.ConnectionI.invokeAll(ConnectionI.java:2037)
        at Ice.ConnectionI.message(ConnectionI.java:972)
        at IceInternal.ThreadPool.run(ThreadPool.java:577)
        at IceInternal.ThreadPool.access$100(ThreadPool.java:12)
        at IceInternal.ThreadPool$EventHandlerThread.run(ThreadPool.java:971)

    serverExceptionClass = java.lang.ClassCastException
    message = java.lang.Long cannot be cast to [Ljava.lang.Object;
}
icaoberg
 
Posts: 145
Joined: Fri Sep 17, 2010 9:05 pm
Location: Pittsburgh, PA

Re: OMERO and HQL Queries

Postby jmoore » Mon Nov 15, 2010 4:26 pm

The ClassCastException is an issue (#2628) with 4.2.0 which is fixed the 4.2.1 release.

~Josh
User avatar
jmoore
Site Admin
 
Posts: 1591
Joined: Fri May 22, 2009 1:29 pm
Location: Germany

Re: OMERO and HQL Queries

Postby icaoberg » Mon Nov 15, 2010 4:41 pm

the quick solution would be to upgrade omero?
icaoberg
 
Posts: 145
Joined: Fri Sep 17, 2010 9:05 pm
Location: Pittsburgh, PA

Re: OMERO and HQL Queries

Postby jmoore » Mon Nov 15, 2010 5:08 pm

That would certainly be useful. For the moment, you can also return another value from the method to prevent the exception:
Code: Select all
select i.id, i.name from Image i ....

~Josh.
User avatar
jmoore
Site Admin
 
Posts: 1591
Joined: Fri May 22, 2009 1:29 pm
Location: Germany

Re: OMERO and HQL Queries

Postby icaoberg » Wed Nov 17, 2010 3:20 pm

we upgraded omero and it works fine.
Code: Select all
-bash-3.2$ ./omero hql -q "select annotation.file.id from Image i join i.annotationLinks links join links.child annotation where i.id = 4401"
Previously logged in to localhost as demo
Server: [localhost]
Username: [bhcho]demo
Password:
Created session 93f26432-bd26-4279-b0e7-c9a0d925e8be (demo@localhost). Idle timeout: 10.0 min. Current group: Researchers
# | Col1
---+------
0 | 4608
1 | 4740
2 | 4741
(3 rows)
icaoberg
 
Posts: 145
Joined: Fri Sep 17, 2010 9:05 pm
Location: Pittsburgh, PA


Return to Developer Discussion

Who is online

Users browsing this forum: No registered users and 1 guest