Thanks Hartmut, But I was hoping to get the solution with an sql query, I am using HTTP API.
On Sunday, July 5, 2015 at 6:14:33 PM UTC+2, hartmut bischoff wrote: > > Hi, > don't know the java-way to do it, but have a solution in ruby. > With the active-orient-ORM-Adapter ( > https://github.com/topofocus/active-orient ) > you might do > > REST::Model.orientdb = ror = REST::OrientDB.new > puts r.class_hierachie( base_class: 'Produit' ).map{|c| "#{c}: \t > #{r.count_documents( o_class: c)} "}.join("\n") > > > With a similar schema I got > > topo@gamma:~/activeOrient$ irb /* call the interactive ruby interpreter >>> /* >> >> 2.2.1 :001 > require './config/boot' >> >> => true >> >> 2.2.1 :002 > r= REST::Model.orientdb = REST::OrientDB.new >> >> => #<REST::OrientDB:0x00000003e08c58 >>> @res=#<RestClient::Resource:0x00000003e6b970 @url="http://localhost:2480", >>> @block=nil, @options={:user=>"hctw", :password=>"**"}>, >>> @database="hc_database", @classes=[]> >> >> 2.2.1 :003 > puts r.class_hierachie( base_class: 'Contracts' ).map{|c| >>> "#{c}: \t #{r.count_documents( o_class: c)} "}.join("\n") >> >> /*url: query/hc_database/sql/select COUNT(*) from Forexes */ >> >> /*url: query/hc_database/sql/select COUNT(*) from Futures */ >> >> /*url: query/hc_database/sql/select COUNT(*) from Options */ >> >> /*url: query/hc_database/sql/select COUNT(*) from Stocks */ >> >> Forexes: 1 >> >> Futures: 1 >> >> Options: 2 >> >> Stocks: 60 >> >> => nil >> >> >> > > > On Saturday, July 4, 2015 at 10:10:33 PM UTC+2, @raph wrote: >> >> Hi Lvc@ >> >> I am using OrientDB and I am trying to do something "new" (I found no one >> talking about it) >> >> I have this schema : >> Vertex : >> Produit (abstract class) >> JBoss ( extends from Produit) >> WAS ( extends from Produit) >> Apache ( extends from Produit) >> >> And I want to get this result : >> class count >> ------------------------ >> Jboss x >> Apache y >> WAS z >> >> Where x,y and z are the number of records of each class. >> >> I've tried this query : "select @class, count(*) from Produit" and I got >> this : >> >> class count >> ------------------------ >> Jboss D >> >> where D = x+y+z >> >> Any ideas? >> >> On Wednesday, January 28, 2015 at 8:11:20 PM UTC+1, Lvc@ wrote: >>> >>> You can use the "instanceof" operator: >>> >>> WHERE @this instanceof Node >>> >>> Lvc@ >>> >>> >>> On 28 January 2015 at 19:04, Chris Whalen <[email protected]> wrote: >>> >>>> I am developing a system where (for example): >>>> >>>> *Vertices* >>>> Entity extends V >>>> Document extends Entity >>>> Node extends Entity >>>> Country extends Node >>>> Language extends Node >>>> ... more vertices can be created during run time but they all extend >>>> from the core Entity class or another class that already exists >>>> >>>> *Edges* >>>> ContainedIn extends E >>>> >>>> For example, I want to get a tree structure from a root vertex (17:0) >>>> using the 'ContainedIn' edge. I only want the vertexes that are of the >>>> 'Node' type. That mean I want back any Node, Country, or Language, or any >>>> other vertex that has Node as a parent. If there was only a known set of >>>> possible types, I would simply put in a where clause that checks against a >>>> list of @class types. Unfortunately, since new classes can and will be >>>> created by the end user I might not know all the classes that inherit from >>>> Node. >>>> >>>> *What I know can be done:* >>>> select @rid, Id, Name_ENG, $path from (traverse in('ContainedIn') from >>>> 17:0 where $depth < 4) where @class in ["Node", "Language", "Country"] >>>> >>>> *What I would like to do:* >>>> select @rid, Id, Name_ENG, $path from (traverse in('ContainedIn') from >>>> 17:0 where $depth < 4) where *@class inheritsFrom "Node"* >>>> >>>> Does anyone have any recommendations on how to build such a query? >>>> >>>> -- >>>> >>>> --- >>>> 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. >>>> >>> >>> -- --- 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.
