Re: [orientdb] running a gremlin query in groovy using groovyc , code examples

2015-03-28 Thread W. Craig Trader
What you're missing is (1) initializing Gremlin, and (2) collecting
results.  To initialize Gremlin, your code needs to execute the following
once (and preferably only once):

import com.tinkerpop.gremlin.groovy.Gremlin

Gremlin.load()


Once you've done that, you can run your query.  Right now your method
creates a Gremlin query, but hasn't started it.  There are lots of ways to
collect results; one way would be to use the Groovy collect() if you're
expecting a list of results. For something more complicated, such as the
what you're doing, I'd suggest something like this:

import com.tinkerpop.pipes.util.structures.Table

def t = new Table()
s.outE.inV.loop(2){it.object.firstName!=targetName  it.loops 
6}.path.filter{it.last().firstName==targetName}.transform{[it.findAll{it
instanceof Edge}.sum{it.weight}, it]}.table( t ).iterate()


That should give you a table structure that contains your results.

- Craig -

On Fri, Mar 20, 2015 at 12:24 PM, sck2015 sonukhullar@gmail.com wrote:

 I am trying to find path traversals and explore them by increasing weight,
 I was able to do this in gremlin and was trying to replicate the code in
 groovy (using groovyc to compile a groovy file and integrate with my other
 java code)... Can someone point me to documentation or how to execute the
 following query in a .groovy file, my understanding is that gremlin is
 interpreted by groovy but I cannot cache the results of the following
 pipeline which should return a set of weights and paths:

  public static List  findAllPaths(Vertex s, Vertex e) {
 String targetName = e.getProperty(firstName);
 // look at paths that end at target, match on first name, calc
 weights of these paths
 results = s.outE.inV.loop(2){it.object.firstName!=targetName 
 it.loops 
 6}.path.filter{it.last().firstName==targetName}.transform{[it.findAll{it
 instanceof Edge}.sum{it.weight}, it]};
 // how to save results of pipe

 }

 I've gotten simple gremlin queries to return and pass back a list to java,
 I could try stringing together gremlin pipelines but I thought the point of
 having .groovy files was to be able to use/integrate gremlin directly to
 talk to java, thanks, Sonu

 --

 ---
 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 orient-database+unsubscr...@googlegroups.com.
 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 orient-database+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[orientdb] Re: Can't ETL CSV with null values into mandatory table

2015-03-28 Thread Jeffrey Auguste


 OrientDB Server v2.0.2
To reproduce, load a csv with null values into a vector in strictmode with 
all parameters set to mandatory.


On Friday, March 27, 2015 at 9:08:46 PM UTC-4, Jeffrey Auguste wrote:

 My database is in strictmode and I have set all the field properties to 
 mandatory and remain nullable. Trying to load a csv into the vertex and it 
 fails when loading a null value.

  Error: The field 'Vertex.Field' is mandatory, but not found on record:

 The CSV record has a value of NULL for some of the fields and I am 
 converting that to an actual null value in the control file.

 I.E. { csv: {nullValue: NULL} }




-- 

--- 
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 orient-database+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [orientdb] Stable version of OrientDb for distributed environment?

2015-03-28 Thread Uffe Gavnholt
Hi Simon, thank you for your reply,


2.0.5 isn't stable in distributed mode by any means, I'll try to do what 
you suggest - thank you



On Saturday, March 28, 2015 at 1:25:46 PM UTC+1, Simon Gemmell wrote:

 Uffe we had some issues with distributed mode with 2.0.5 which have 
 apparently been fixed in the latest version of the code. Given the defect 
 density thus far I am wary but perhaps 2.0.6 will work for you when it is 
 released. It is easy to get the code and build it yourself, use the 2.0.x 
 branch.

 On Saturday, March 28, 2015 at 8:13:36 AM UTC+11, Lvc@ wrote:

 Hi Uffe,
 Get OrientDB 2.0.5

 Lvc@

 On 27 March 2015 at 18:07, Uffe Gavnholt ugav...@gmail.com wrote:

 Hi All,


 I'm having trouble finding a version of OrientDb that is stable enough 
 for a production environment in a distributed setup, I've tried the 
 versions I could find from 2.0.0 and on.

 Do anyone have experiences with a release that behaves, specificly it 
 appears to be distributed transactions that are unstable in current 
 releases?

 Best regards

 Uffe Gavnholt

 -- 

 --- 
 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 orient-databa...@googlegroups.com.
 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 orient-database+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[orientdb] Best practice: How to properly set an potentially unsafe RID?

2015-03-28 Thread Georg Göttlich
Hi everyone.

I just have a quick best practice question.
I want to set a Link property on a class instance. I have the RID of the 
link target as a string. The naive approach would look like this.

'INSERT INTO MyClass SET myLink = ' + itemId

(I can't use a parameter, because Oriento (wisely) escapes all input strings)


The trouble is, the the value for itemId comes in form of a user input over 
the internet. So I think a saver way would be to do it like this:

insert into MyClass set myLink = (select from OtherClass where @rid = :itemId)

Unfortunately params in sub queries don't work currently, so I resort to 
building the sub query with Oriento and adding it as a string.


But what is you general take on this? Is there a better way to do it?


Cheers

Georg







-- 

--- 
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 orient-database+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [orientdb] Hooks on vertices and edges

2015-03-28 Thread David Carr
FYI I created the Java Hook Tutorial and pushed it to master branch under
docs section 9.3.

On Fri, Mar 27, 2015 at 11:05 AM, W. Craig Trader craig.tra...@gmail.com
wrote:

 David ...

 In the short term, please share with the group.

 - Craig -

 On Fri, Mar 27, 2015 at 10:44 AM, David Carr dcarr...@gmail.com wrote:

 Followup questions:

 1. I'm using orientdb server version 2.0.5 so classes V and E are already
 there by default as soon as I create the database. Can you elaborate on
 exactly how to accomplish let V and E extend OTriggered?

 2. I was successful in creating a java hook despite the documentation
 being very hard to follow, incomplete, and containing bad examples that
 produce compile errors. I would like to put what I've learned and have
 working into some sort of summary that I can contribute back to the
 community for the next user who comes along. Do you have any suggestions on
 the best way to do this?

 One of the best things I like about http://php.net/manual/ is the user
 contributed notes at the bottom of each page. I don't see anything like
 that in the orientdb online manual. I could post a summary to this google
 group if that's the best way. Or possibly enhancing the online manual via a
 feature branch on git? Let me know.



 On Thursday, March 26, 2015 at 12:14:26 AM UTC-6, Luigi Dell'Aquila wrote:

 Hi David,

 you can just let V and E extend OTriggered, or define your hooks in Java
 if you want to avoid it.

 Regards

 Luigi


 2015-03-26 0:40 GMT+01:00 David Carr dcar...@gmail.com:

 After a bit of trial and error, I have been able to get hooks working
 on custom classes extended from the OTriggered class. However, I need hooks
 working on classes extended from V and E. I can't get it to work in my
 tests. Does anyone out there know if hooks are possible on vertices and
 edges or if this is on the development roadmap somewhere?

 --

 ---
 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 orient-databa...@googlegroups.com.
 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 orient-database+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.


  --

 ---
 You received this message because you are subscribed to a topic in the
 Google Groups OrientDB group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/orient-database/pq-SqklprHs/unsubscribe.
 To unsubscribe from this group and all its topics, send an email to
 orient-database+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.




-- 
David Carr
801.231.4946

-- 

--- 
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 orient-database+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[orientdb] Activity Feed

2015-03-28 Thread Thomas Kennedy
Hi,

Has anybody implemented an activity feed in Orient?

Something like Linkedin or Twitter.

I am looking for examples on how to do this?

Tom

-- 

--- 
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 orient-database+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [orientdb] Stable version of OrientDb for distributed environment?

2015-03-28 Thread Simon Gemmell
Uffe we had some issues with distributed mode with 2.0.5 which have 
apparently been fixed in the latest version of the code. Given the defect 
density thus far I am wary but perhaps 2.0.6 will work for you when it is 
released. It is easy to get the code and build it yourself, use the 2.0.x 
branch.

On Saturday, March 28, 2015 at 8:13:36 AM UTC+11, Lvc@ wrote:

 Hi Uffe,
 Get OrientDB 2.0.5

 Lvc@

 On 27 March 2015 at 18:07, Uffe Gavnholt ugav...@gmail.com javascript: 
 wrote:

 Hi All,


 I'm having trouble finding a version of OrientDb that is stable enough 
 for a production environment in a distributed setup, I've tried the 
 versions I could find from 2.0.0 and on.

 Do anyone have experiences with a release that behaves, specificly it 
 appears to be distributed transactions that are unstable in current 
 releases?

 Best regards

 Uffe Gavnholt

 -- 

 --- 
 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 orient-databa...@googlegroups.com javascript:.
 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 orient-database+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [orientdb] interesting question (unanswered) on stackoverflow: does OrientDB support hypergraphs

2015-03-28 Thread Luigi Dell'Aquila
IMHO it's merely a bug, edge creation should check that both ends are
vertices

Luigi


2015-03-26 13:12 GMT+01:00 MrFT frederik.til...@vsko.be:



 http://stackoverflow.com/questions/28781749/am-i-supposed-to-be-able-to-create-edges-between-two-edges-and-or-an-edge-and-a


 Am I supposed to be able to create edges between two edges and/or an edge
 and a node in OrientDB?
 http://stackoverflow.com/questions/28781749/am-i-supposed-to-be-able-to-create-edges-between-two-edges-and-or-an-edge-and-a

 In OrientDB, I can do CREATE EDGE E from someEdge to AnotherEdge. It will
 execute with no problem, and the edge will be created.

 However, if I do this in the graph editor in Studio, it's extremely buggy.
 The properties/settings window will not work at all.

 My question is: is it a bug that it lets me create edges between two
 edges/an edge and a node or is it 'merely' the graph editor that's buggy
 when I do this?


  --

 ---
 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 orient-database+unsubscr...@googlegroups.com.
 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 orient-database+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.