Hi Anthony,
to first answer the question about the example:
There is one line missing in the example which defines the myGraph variable.
It is hidden by accident and will be visible in the next documentation build.
The line which is missing is:
arangosh> var myGraph = {};
This creates an empty myGraph object. This object is only to hold references to
the vertex documents, it is not directly related to the arangodb graph modules.
the example could also use independent variables for each line:
arangosh> var v1 = db.vertex.insert({name: "vertex 1"});
arangosh> var v2 = db.vertex.insert({name: "vertex 2"});
arangosh> var e = db.relations.insert(v1, v2, {label: "knows"});
this and the above are identical on the database side.
But now let me point you in a better direction on how to use graphs.
I think it is best if you would check the manual chapter about graphs
https://docs.arangodb.com/3.1/Manual/Graphs/index.html
<https://docs.arangodb.com/3.1/Manual/Graphs/index.html> for further
information.
best
Michael
> Am 04.01.2017 um 02:02 schrieb Anthony Wong <[email protected]>:
>
> I have imported the csv files to arangodb, which are virtualmachine and
> server. Now, I would like to create the graph to show the relationship of
> virtualmachine and server.
>
>
>
> I read the manual and try to define the Edge to correlate both collections.
> However I am not clear about how to define the edge. (i.e. I need to
> correlate the name of server with virtualhost of virtualmachine)
>
>
>
> Edge Manual
> <https://docs.arangodb.com/3.1/Manual/DataModeling/Documents/DocumentMethods.html>
>
> arangosh> myGraph.v1 = db.vertex.insert({ name : "vertex 1" });
>
> arangosh> myGraph.v2 = db.vertex.insert({ name : "vertex 2" });
>
> arangosh> myGraph.e1 = db.relation.insert(myGraph.v1, myGraph.v2, ........> {
> label : "knows"});
>
>
>
> In this example, how to define myGraph?
>
> JavaScript exception: ReferenceError: myGraph is not defined
> !myGraph.v1 = db.vertex.insert({ name : "vertex 1" });
> !^
> stacktrace: ReferenceError: myGraph is not defined
> at <shell command>:1:1
>
>
> Also, I should define the attribute of collection one by one? myGraph.v1 =
> db.server.insert({ name : "server" }); myGraph.v2 =
> db.virtualmachine.insert({ name : "virtualhost" });
>
>
>
> Thanks for your help.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "ArangoDB" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected]
> <mailto:[email protected]>.
> For more options, visit https://groups.google.com/d/optout
> <https://groups.google.com/d/optout>.
--
You received this message because you are subscribed to the Google Groups
"ArangoDB" 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.