mirror of https://gitee.com/bigwinds/arangodb
changed signature of the traversal functions
This commit is contained in:
parent
ae53a8c7c9
commit
de0da1e7b7
|
@ -664,9 +664,9 @@ TRI_associative_pointer_t* TRI_CreateFunctionsAql (void) {
|
|||
REGISTER_FUNCTION("GRAPH_SHORTEST_PATH", "GENERAL_GRAPH_SHORTEST_PATH", false, false, "s,als,als|a", NULL);
|
||||
REGISTER_FUNCTION("GRAPH_DISTANCE_TO", "GENERAL_GRAPH_DISTANCE_TO", false, false, "s,als,als|a", NULL);
|
||||
REGISTER_FUNCTION("TRAVERSAL", "GRAPH_TRAVERSAL", false, false, "h,h,s,s|a", NULL);
|
||||
REGISTER_FUNCTION("GRAPH_TRAVERSAL", "GENERAL_GRAPH_TRAVERSAL", false, false, "s,s,s|a", NULL);
|
||||
REGISTER_FUNCTION("GRAPH_TRAVERSAL", "GENERAL_GRAPH_TRAVERSAL", false, false, "s,als,s|a", NULL);
|
||||
REGISTER_FUNCTION("TRAVERSAL_TREE", "GRAPH_TRAVERSAL_TREE", false, false, "h,h,s,s,s|a", NULL);
|
||||
REGISTER_FUNCTION("GRAPH_TRAVERSAL_TREE", "GENERAL_GRAPH_TRAVERSAL_TREE", false, false, "s,s,s,s|a", NULL);
|
||||
REGISTER_FUNCTION("GRAPH_TRAVERSAL_TREE", "GENERAL_GRAPH_TRAVERSAL_TREE", false, false, "s,als,s,s|a", NULL);
|
||||
REGISTER_FUNCTION("EDGES", "GRAPH_EDGES", false, false, "h,s,s|l", NULL);
|
||||
REGISTER_FUNCTION("GRAPH_EDGES", "GENERAL_GRAPH_EDGES", false, false, "s,als|a", NULL);
|
||||
REGISTER_FUNCTION("GRAPH_VERTICES", "GENERAL_GRAPH_VERTICES", false, false, "s,als|a", NULL);
|
||||
|
|
|
@ -268,17 +268,21 @@ ArangoCollection.prototype.all = function () {
|
|||
/// Use *toArray* to get all documents at once:
|
||||
///
|
||||
/// @EXAMPLE_ARANGOSH_OUTPUT{collectionByExample}
|
||||
/// ~ db._create("users");
|
||||
/// db.users.all().toArray();
|
||||
/// db.users.byExample({ "id" : 323 }).toArray();
|
||||
/// db.users.byExample({ "name" : "Peter" }).toArray();
|
||||
/// db.users.byExample({ "name" : "Peter", "id" : 535 }).toArray();
|
||||
/// ~ db._drop("users");
|
||||
/// @END_EXAMPLE_ARANGOSH_OUTPUT
|
||||
///
|
||||
/// Use *next* to loop over all documents:
|
||||
///
|
||||
/// @EXAMPLE_ARANGOSH_OUTPUT{collectionByExampleNext}
|
||||
/// ~ db._create("users");
|
||||
/// var a = db.users.byExample( {"name" : "Peter" } );
|
||||
/// while (a.hasNext()) print(a.next());
|
||||
/// ~ db._drop("users");
|
||||
/// @END_EXAMPLE_ARANGOSH_OUTPUT
|
||||
///
|
||||
/// @endDocuBlock
|
||||
|
@ -513,7 +517,9 @@ ArangoCollection.prototype.byConditionBitarray = function (index, condition) {
|
|||
/// Use *toArray* to get all documents at once:
|
||||
///
|
||||
/// @EXAMPLE_ARANGOSH_OUTPUT{collectionRange}
|
||||
/// l = db.skip.range("age", 10, 13).toArray();
|
||||
/// ~ db._create("example");
|
||||
/// l = db.example.range("age", 10, 13).toArray();
|
||||
/// ~ db._drop("example")
|
||||
/// @END_EXAMPLE_ARANGOSH_OUTPUT
|
||||
///
|
||||
/// @endDocuBlock
|
||||
|
@ -693,12 +699,17 @@ ArangoCollection.prototype.geo = function(loc, order) {
|
|||
///
|
||||
/// To get the nearst two locations:
|
||||
///
|
||||
/// @TINYEXAMPLE{simple-query-near,nearest two location}
|
||||
/// @EXAMPLE_ARANGOSH_OUTPUT{collectionNear}
|
||||
/// db.geo.near(0,0).limit(2).toArray();
|
||||
/// @END_EXAMPLE_ARANGOSH_OUTPUT
|
||||
///
|
||||
/// If you need the distance as well, then you can use the *distance*
|
||||
/// operator:
|
||||
///
|
||||
/// @TINYEXAMPLE{simple-query-near2,nearest two location with distance in meter}
|
||||
/// @EXAMPLE_ARANGOSH_OUTPUT{collectionNearDistance}
|
||||
/// db.geo.near(0,0).distance().limit(2).toArray();
|
||||
/// @END_EXAMPLE_ARANGOSH_OUTPUT
|
||||
///
|
||||
/// @endDocuBlock
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -734,7 +745,10 @@ ArangoCollection.prototype.near = function (lat, lon) {
|
|||
///
|
||||
/// To find all documents within a radius of 2000 km use:
|
||||
///
|
||||
/// @TINYEXAMPLE{simple-query-within,within a radius}
|
||||
/// @EXAMPLE_ARANGOSH_OUTPUT{collectionWithin}
|
||||
/// db.geo.within(0, 0, 2000 * 1000).distance().toArray();
|
||||
/// @END_EXAMPLE_ARANGOSH_OUTPUT
|
||||
///
|
||||
/// @endDocuBlock
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -750,7 +764,7 @@ ArangoCollection.prototype.within = function (lat, lon, radius) {
|
|||
/// This will find the documents from the collection's fulltext index that match the search
|
||||
/// query.
|
||||
///
|
||||
/// In order to use the @FN{fulltext} operator, a fulltext index must be defined for the
|
||||
/// In order to use the *fulltext* operator, a fulltext index must be defined for the
|
||||
/// collection, for the specified attribute. If multiple fulltext indexes are defined
|
||||
/// for the collection and attribute, the most capable one will be selected.
|
||||
///
|
||||
|
@ -758,7 +772,9 @@ ArangoCollection.prototype.within = function (lat, lon, radius) {
|
|||
///
|
||||
/// To find all documents which contain the terms *text* and *word*:
|
||||
///
|
||||
/// @TINYEXAMPLE{simple-query-fulltext,complete match query}
|
||||
/// @EXAMPLE_ARANGOSH_OUTPUT{collectionFulltext}
|
||||
/// db.emails.fulltext("text", "word").toArray();
|
||||
/// @END_EXAMPLE_ARANGOSH_OUTPUT
|
||||
/// @endDocuBlock
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -909,7 +925,8 @@ ArangoCollection.prototype.iterate = function (iterator, options) {
|
|||
///
|
||||
/// @EXAMPLE_ARANGOSH_OUTPUT{documentsCollectionRemoveByExample}
|
||||
/// ~ db._create("example");
|
||||
/// db.content.removeByExample({ "domain": "de.celler" })
|
||||
/// ~ db.example.save({ Hello : "world" });
|
||||
/// db.example.removeByExample( {Hello : "world"} );
|
||||
/// ~ db._drop("example");
|
||||
/// @END_EXAMPLE_ARANGOSH_OUTPUT
|
||||
/// @endDocuBlock
|
||||
|
@ -953,7 +970,8 @@ ArangoCollection.prototype.removeByExample = function (example, waitForSync, lim
|
|||
///
|
||||
/// @EXAMPLE_ARANGOSH_OUTPUT{documentsCollectionReplaceByExample}
|
||||
/// ~ db._create("example");
|
||||
/// db.content.replaceByExample({ "domain": "de.celler" }, { "foo": "someValue }, false, 5)
|
||||
/// ~ db.example.save({ Hello : "world" });
|
||||
/// db.example.replaceByExample({ Hello: "world" }, {Hello: "mars"}, false, 5);
|
||||
/// ~ db._drop("example");
|
||||
/// @END_EXAMPLE_ARANGOSH_OUTPUT
|
||||
/// @endDocuBlock
|
||||
|
@ -966,7 +984,7 @@ ArangoCollection.prototype.replaceByExample = function (example, newValue, waitF
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief partially updates documents matching an example
|
||||
/// @startDocuBlock documentsCollectionUpdateByExample
|
||||
/// `collection.updateByExample(example, newValue`
|
||||
/// `collection.updateByExample(example, newValue)`
|
||||
///
|
||||
/// Partially updates all documents matching an example with a new document body.
|
||||
/// Specific attributes in the document body of each document matching the
|
||||
|
@ -1004,10 +1022,11 @@ ArangoCollection.prototype.replaceByExample = function (example, newValue, waitF
|
|||
///
|
||||
/// @EXAMPLE_ARANGOSH_OUTPUT{documentsCollectionUpdateByExample}
|
||||
/// ~ db._create("example");
|
||||
/// arangod> db.content.updateByExample({ "domain": "de.celler" }, { "foo": "someValue, "domain": null }, false)
|
||||
/// ~ db.example.save({ Hello : "world" });
|
||||
/// db.example.updateByExample({ Hello: "world" }, { Hello: "foo", Hello: "bar" }, false);
|
||||
/// ~ db._drop("example");
|
||||
/// @END_EXAMPLE_ARANGOSH_OUTPUT
|
||||
/// endDocuBlock
|
||||
/// @endDocuBlock
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ArangoCollection.prototype.updateByExample = function (example, newValue, keepNull, waitForSync, limit) {
|
||||
|
|
|
@ -314,27 +314,31 @@ SimpleQuery.prototype.clone = function () {
|
|||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief executes a query
|
||||
/// @startDocuBlock queryExecute
|
||||
/// `query.execute(batchSize)`
|
||||
///
|
||||
/// @FUN{@FA{query}.execute(@FA{batchSize})}
|
||||
/// Executes a simple query. If the optional batchSize value is specified,
|
||||
/// the server will return at most batchSize values in one roundtrip.
|
||||
/// The batchSize cannot be adjusted after the query is first executed.
|
||||
///
|
||||
/// Executes a simple query. If the optional @FA{batchSize} value is specified,
|
||||
/// the server will return at most @FN{batchSize} values in one roundtrip.
|
||||
/// The @FA{batchSize} cannot be adjusted after the query is first executed.
|
||||
///
|
||||
/// Note that there is no need to explicitly call the execute method if another
|
||||
/// **Note**: There is no need to explicitly call the execute method if another
|
||||
/// means of fetching the query results is chosen. The following two approaches
|
||||
/// lead to the same result:
|
||||
/// @code
|
||||
///
|
||||
/// @EXAMPLE_ARANGOSH_OUTPUT{executeQuery}
|
||||
/// result = db.users.all().toArray();
|
||||
/// q = db.users.all(); q.execute(); result = [ ]; while (q.hasNext()) { result.push(q.next()); }
|
||||
/// @endcode
|
||||
/// @END_EXAMPLE_ARANGOSH_OUTPUT
|
||||
///
|
||||
/// The following two alternatives both use a @FA{batchSize} and return the same
|
||||
/// The following two alternatives both use a batchSize and return the same
|
||||
/// result:
|
||||
/// @code
|
||||
///
|
||||
/// @EXAMPLE_ARANGOSH_OUTPUT{executeQueryBatchSize}
|
||||
/// q = db.users.all(); q.setBatchSize(20); q.execute(); while (q.hasNext()) { print(q.next()); }
|
||||
/// q = db.users.all(); q.execute(20); while (q.hasNext()) { print(q.next()); }
|
||||
/// @endcode
|
||||
/// @END_EXAMPLE_ARANGOSH_OUTPUT
|
||||
///
|
||||
/// @endDocuBlock
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
SimpleQuery.prototype.execute = function () {
|
||||
|
@ -356,19 +360,21 @@ SimpleQuery.prototype.execute = function () {
|
|||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief limit
|
||||
/// @startDocuBlock queryLimit
|
||||
/// `query.limit(number)`
|
||||
///
|
||||
/// @FUN{@FA{query}.limit(@FA{number})}
|
||||
///
|
||||
/// Limits a result to the first @FA{number} documents. Specifying a limit of
|
||||
/// @LIT{0} returns no documents at all. If you do not need a limit, just do
|
||||
/// Limits a result to the first *number* documents. Specifying a limit of
|
||||
/// *0* returns no documents at all. If you do not need a limit, just do
|
||||
/// not add the limit operator. The limit must be non-negative.
|
||||
///
|
||||
/// In general the input to @FN{limit} should be sorted. Otherwise it will be
|
||||
/// In general the input to *limit* should be sorted. Otherwise it will be
|
||||
/// unclear which documents are used in the result set.
|
||||
///
|
||||
/// *Examples*
|
||||
/// @EXAMPLES
|
||||
///
|
||||
/// @verbinclude simple2
|
||||
///
|
||||
/// @endDocuBlock
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
SimpleQuery.prototype.limit = function (limit) {
|
||||
|
@ -388,20 +394,22 @@ SimpleQuery.prototype.limit = function (limit) {
|
|||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief skip
|
||||
/// @startDocuBlock queySkip
|
||||
/// `query.skip(number)`
|
||||
///
|
||||
/// @FUN{@FA{query}.skip(@FA{number})}
|
||||
///
|
||||
/// Skips the first @FA{number} documents. If @FA{number} is positive, then skip
|
||||
/// the number of documents. If @FA{number} is negative, then the total amount N
|
||||
/// Skips the first *number* documents. If *number* is positive, then skip
|
||||
/// the number of documents. If *number* is negative, then the total amount N
|
||||
/// of documents must be known and the results starts at position (N +
|
||||
/// @FA{number}).
|
||||
/// *number*).
|
||||
///
|
||||
/// In general the input to @FN{limit} should be sorted. Otherwise it will be
|
||||
/// In general the input to *limit* should be sorted. Otherwise it will be
|
||||
/// unclear which documents are used in the result set.
|
||||
///
|
||||
/// *Examples*
|
||||
/// @EXAMPLES
|
||||
///
|
||||
/// @verbinclude simple8
|
||||
///
|
||||
/// @endDocuBlock
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
SimpleQuery.prototype.skip = function (skip) {
|
||||
|
@ -460,11 +468,12 @@ SimpleQuery.prototype.toArray = function () {
|
|||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief returns the batch size
|
||||
///
|
||||
/// @FUN{@FA{cursor}.getBatchSize()}
|
||||
/// @startDocuBlock cursorGetBatchSize
|
||||
/// `cursor.getBatchSize()`
|
||||
///
|
||||
/// Returns the batch size for queries. If the returned value is undefined, the
|
||||
/// server will determine a sensible batch size for any following requests.
|
||||
/// @endDocuBlock
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
SimpleQuery.prototype.getBatchSize = function () {
|
||||
|
@ -473,11 +482,12 @@ SimpleQuery.prototype.getBatchSize = function () {
|
|||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief sets the batch size for any following requests
|
||||
///
|
||||
/// @FUN{@FA{cursor}.setBatchSize(@FA{number})}
|
||||
/// @startDocuBlock cursorSetBatchSize
|
||||
/// `cursor.setBatchSize(number)`
|
||||
///
|
||||
/// Sets the batch size for queries. The batch size determines how many results
|
||||
/// are at most transferred from the server to the client in one chunk.
|
||||
/// @endDocuBlock
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
SimpleQuery.prototype.setBatchSize = function (value) {
|
||||
|
@ -488,27 +498,27 @@ SimpleQuery.prototype.setBatchSize = function (value) {
|
|||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief counts the number of documents
|
||||
/// @startDocuBlock cursorCount
|
||||
/// `cursor.count()`
|
||||
///
|
||||
/// @FUN{@FA{cursor}.count()}
|
||||
///
|
||||
/// The @FN{count} operator counts the number of document in the result set and
|
||||
/// returns that number. The @FN{count} operator ignores any limits and returns
|
||||
/// The *count* operator counts the number of document in the result set and
|
||||
/// returns that number. The *count* operator ignores any limits and returns
|
||||
/// the total number of documents found.
|
||||
///
|
||||
/// @note Not all simple queries support counting. In this case @LIT{null} is
|
||||
/// **Note**: Not all simple queries support counting. In this case *null* is
|
||||
/// returned.
|
||||
///
|
||||
/// @FUN{@FA{cursor}.count(@LIT{true})}
|
||||
/// `cursor.count(true)`
|
||||
///
|
||||
/// If the result set was limited by the @FN{limit} operator or documents were
|
||||
/// skiped using the @FN{skip} operator, the @FN{count} operator with argument
|
||||
/// @LIT{true} will use the number of elements in the final result set - after
|
||||
/// applying @FN{limit} and @FN{skip}.
|
||||
/// If the result set was limited by the *limit* operator or documents were
|
||||
/// skiped using the *skip* operator, the *count* operator with argument
|
||||
/// *true* will use the number of elements in the final result set - after
|
||||
/// applying *limit* and *skip*.
|
||||
///
|
||||
/// @note Not all simple queries support counting. In this case @LIT{null} is
|
||||
/// **Note**: Not all simple queries support counting. In this case *null* is
|
||||
/// returned.
|
||||
///
|
||||
/// *Examples*
|
||||
/// @EXAMPLES
|
||||
///
|
||||
/// Ignore any limit:
|
||||
///
|
||||
|
@ -517,6 +527,8 @@ SimpleQuery.prototype.setBatchSize = function (value) {
|
|||
/// Counting any limit or skip:
|
||||
///
|
||||
/// @verbinclude simple10
|
||||
///
|
||||
/// @endDocuBlock
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
SimpleQuery.prototype.count = function (applyPagination) {
|
||||
|
@ -531,16 +543,17 @@ SimpleQuery.prototype.count = function (applyPagination) {
|
|||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief checks if the cursor is exhausted
|
||||
/// @startDocuBlock cursorHasNext
|
||||
/// `cursor.hasNext()`
|
||||
///
|
||||
/// @FUN{@FA{cursor}.hasNext()}
|
||||
/// The *hasNext* operator returns *true*, then the cursor still has
|
||||
/// documents. In this case the next document can be accessed using the
|
||||
/// *next* operator, which will advance the cursor.
|
||||
///
|
||||
/// The @FN{hasNext} operator returns @LIT{true}, then the cursor still has
|
||||
/// documents. In this case the next document can be accessed using the
|
||||
/// @FN{next} operator, which will advance the cursor.
|
||||
///
|
||||
/// *Examples*
|
||||
/// @EXAMPLES
|
||||
///
|
||||
/// @verbinclude simple7
|
||||
/// @endDocuBlock
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
SimpleQuery.prototype.hasNext = function () {
|
||||
|
@ -551,18 +564,19 @@ SimpleQuery.prototype.hasNext = function () {
|
|||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief returns the next result document
|
||||
/// @startDocuBlock cursorNext
|
||||
/// `cursor.next()`
|
||||
///
|
||||
/// @FUN{@FA{cursor}.next()}
|
||||
///
|
||||
/// If the @FN{hasNext} operator returns @LIT{true}, then the underlying
|
||||
/// If the *hasNext* operator returns *true*, then the underlying
|
||||
/// cursor of the simple query still has documents. In this case the
|
||||
/// next document can be accessed using the @FN{next} operator, which
|
||||
/// will advance the underlying cursor. If you use @FN{next} on an
|
||||
/// exhausted cursor, then @LIT{undefined} is returned.
|
||||
/// next document can be accessed using the *next* operator, which
|
||||
/// will advance the underlying cursor. If you use *next* on an
|
||||
/// exhausted cursor, then *undefined* is returned.
|
||||
///
|
||||
/// *Examples*
|
||||
/// @EXAMPLES
|
||||
///
|
||||
/// @verbinclude simple5
|
||||
/// @endDocuBlock
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
SimpleQuery.prototype.next = function () {
|
||||
|
@ -573,12 +587,13 @@ SimpleQuery.prototype.next = function () {
|
|||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief disposes the result
|
||||
///
|
||||
/// @FUN{@FA{cursor}.dispose()}
|
||||
/// @startDocuBlock cursorDispose
|
||||
/// `cursor.dispose()`
|
||||
///
|
||||
/// If you are no longer interested in any further results, you should call
|
||||
/// @FN{dispose} in order to free any resources associated with the cursor.
|
||||
/// After calling @FN{dispose} you can no longer access the cursor.
|
||||
/// *dispose* in order to free any resources associated with the cursor.
|
||||
/// After calling *dispose* you can no longer access the cursor.
|
||||
/// @endDocuBlock
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
SimpleQuery.prototype.dispose = function() {
|
||||
|
|
|
@ -233,7 +233,7 @@
|
|||
new window.GraphManagementView(
|
||||
{
|
||||
collection: new window.GraphCollection(),
|
||||
collectionCollection: new window.arangoCollections()
|
||||
collectionCollection: this.arangoCollectionsStore
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<tr class="tableRow" id="row_newEdgeDefinitions<%= number%>">
|
||||
<th class="collectionTh">Edge definitions*:</th>
|
||||
<th class="collectionTh">
|
||||
<input onkeypress="return event.keyCode!=13" type="hidden" id="newEdgeDefinitions<%= number%>" value="" placeholder="Edge definitions" tabindex="-1" class="select2-offscreen">
|
||||
<input onkeypress="event.stopPropagation()" type="hidden" id="newEdgeDefinitions<%= number%>" value="" placeholder="Edge definitions" tabindex="-1" class="select2-offscreen">
|
||||
<button id="remove_newEdgeDefinitions<%= number%>" class="graphViewer-icon-button gv_internal_remove_line gv-icon-small delete"></button>
|
||||
</th><th>
|
||||
<a class="modalTooltips" title="Some info for edge definitions">
|
||||
|
@ -13,7 +13,7 @@
|
|||
<tr class="tableRow" id="row_fromCollections<%= number%>">
|
||||
<th class="collectionTh">fromCollections*:</th>
|
||||
<th class="collectionTh">
|
||||
<input onkeypress="return event.keyCode!=13" type="hidden" id="newfromCollections<%= number%>" value="" placeholder="fromCollections" tabindex="-1" class="select2-offscreen">
|
||||
<input onkeypress="event.stopPropagation()" type="hidden" id="newfromCollections<%= number%>" value="" placeholder="fromCollections" tabindex="-1" class="select2-offscreen">
|
||||
</th><th>
|
||||
<a class="modalTooltips" title="The collection that contain the start vertices of the relation.">
|
||||
<span class="arangoicon icon_arangodb_info"></span>
|
||||
|
@ -23,7 +23,7 @@
|
|||
<tr class="tableRow" id="row_toCollections<%= number%>">
|
||||
<th class="collectionTh">toCollections*:</th>
|
||||
<th class="collectionTh">
|
||||
<input onkeypress="return event.keyCode!=13" type="hidden" id="newtoCollections<%= number%>" value="" placeholder="toCollections" tabindex="-1" class="select2-offscreen">
|
||||
<input onkeypress="event.stopPropagation()" type="hidden" id="newtoCollections<%= number%>" value="" placeholder="toCollections" tabindex="-1" class="select2-offscreen">
|
||||
</th><th>
|
||||
<a class="modalTooltips" title="The collection that contain the end vertices of the relation.">
|
||||
<span class="arangoicon icon_arangodb_info"></span>
|
||||
|
|
|
@ -1,10 +1,15 @@
|
|||
<script id="modalGraphTable.ejs" type="text/template">
|
||||
<%
|
||||
var createTR = function(row) {
|
||||
var createTR = function(row, disableSubmitOnEnter) {
|
||||
var mandatory = '';
|
||||
if (row.mandatory) {
|
||||
mandatory = '*';
|
||||
}
|
||||
|
||||
var disableSubmitOnEnterString = '';
|
||||
if (disableSubmitOnEnter) {
|
||||
disableSubmitOnEnterString = 'onkeypress="event.stopPropagation()"';
|
||||
}
|
||||
%>
|
||||
<tr class="tableRow" id="<%='row_' + row.id%>">
|
||||
<th class="collectionTh"><%=row.label%><%=mandatory%>:</th>
|
||||
|
@ -13,12 +18,12 @@
|
|||
switch(row.type) {
|
||||
case "text":
|
||||
%>
|
||||
<input type="text" id="<%=row.id%>" value="<%=row.value||''%>" placeholder="<%=row.placeholder||''%>"></input>
|
||||
<input <%=disableSubmitOnEnterString%> type="text" id="<%=row.id%>" value="<%=row.value||''%>" placeholder="<%=row.placeholder||''%>"></input>
|
||||
<%
|
||||
break;
|
||||
case "password":
|
||||
%>
|
||||
<input type="password" id="<%=row.id%>" value="<%=row.value||''%>" placeholder="<%=row.placeholder||''%>"></input>
|
||||
<input <%=disableSubmitOnEnterString%> type="password" id="<%=row.id%>" value="<%=row.value||''%>" placeholder="<%=row.placeholder||''%>"></input>
|
||||
<%
|
||||
break;
|
||||
case "readonly":
|
||||
|
@ -36,7 +41,7 @@
|
|||
disabled = 'disabled';
|
||||
}
|
||||
%>
|
||||
<input type="checkbox" id="<%=row.id%>" value="<%=row.value%>" <%=checked%> <%=disabled%>></input>
|
||||
<input <%=disableSubmitOnEnterString%> type="checkbox" id="<%=row.id%>" value="<%=row.value%>" <%=checked%> <%=disabled%>></input>
|
||||
<%
|
||||
break;
|
||||
case "select":
|
||||
|
@ -54,7 +59,7 @@
|
|||
break;
|
||||
case "select2":
|
||||
%>
|
||||
<input type="hidden" id="<%=row.id%>" value="<%=row.value||''%>" placeholder="<%=row.placeholder||''%>"></input>
|
||||
<input <%=disableSubmitOnEnterString%> type="hidden" id="<%=row.id%>" value="<%=row.value||''%>" placeholder="<%=row.placeholder||''%>"></input>
|
||||
<% if (row.addAdd) {%>
|
||||
<button id="<%='addAfter_' + row.id%>" class="graphViewer-icon-button gv-icon-small add"></button>
|
||||
<% } %>
|
||||
|
@ -84,7 +89,7 @@
|
|||
<tbody>
|
||||
<%
|
||||
_.each(content, function(row) {
|
||||
createTR(row);
|
||||
createTR(row, disableSubmitOnEnter);
|
||||
});
|
||||
%>
|
||||
|
||||
|
@ -106,7 +111,7 @@
|
|||
<tbody>
|
||||
<%
|
||||
_.each(advancedContent.content, function(row) {
|
||||
createTR(row);
|
||||
createTR(row, disableSubmitOnEnter);
|
||||
});
|
||||
%>
|
||||
</tbody>
|
||||
|
|
|
@ -163,17 +163,23 @@
|
|||
self = this,
|
||||
collection,
|
||||
from,
|
||||
to, i;
|
||||
for (i = 0 ; i < $("tr[id*='newEdgeDefinitions']").length ; i++) {
|
||||
if ($('#s2id_fromCollections' + i) &&
|
||||
_.pluck($('#s2id_fromCollections' + i).select2("data"), "text") &&
|
||||
$('#newEdgeDefinitions' + i) &&
|
||||
$('#newEdgeDefinitions' + i).val() &&
|
||||
$('#s2id_toCollections' + i) &&
|
||||
_.pluck($('#s2id_toCollections' + i).select2("data"), "text") ) {
|
||||
from = _.pluck($('#s2id_fromCollections' + i).select2("data"), "text");
|
||||
to = _.pluck($('#s2id_toCollections' + i).select2("data"), "text");
|
||||
collection = $('#newEdgeDefinitions' + i).val();
|
||||
to,
|
||||
i,
|
||||
id,
|
||||
definitions;
|
||||
|
||||
definitions = $("tr[id*='newEdgeDefinitions']");
|
||||
for (i = 0 ; i < definitions.length ; i++) {
|
||||
id = definitions[i].id.split("row_newEdgeDefinitions")[1];
|
||||
if ($('#s2id_fromCollections' + id) &&
|
||||
_.pluck($('#s2id_fromCollections' + id).select2("data"), "text") &&
|
||||
$('#newEdgeDefinitions' + id) &&
|
||||
$('#newEdgeDefinitions' + id).val() &&
|
||||
$('#s2id_toCollections' + id) &&
|
||||
_.pluck($('#s2id_toCollections' + id).select2("data"), "text") ) {
|
||||
from = _.pluck($('#s2id_fromCollections' + id).select2("data"), "text");
|
||||
to = _.pluck($('#s2id_toCollections' + id).select2("data"), "text");
|
||||
collection = $('#newEdgeDefinitions' + id).val();
|
||||
edgeDefinitions.push(
|
||||
{
|
||||
collection: collection,
|
||||
|
@ -333,6 +339,12 @@
|
|||
},
|
||||
|
||||
addRemoveDefinition : function(e) {
|
||||
var collList = [],
|
||||
collections = this.options.collectionCollection.models;
|
||||
|
||||
collections.forEach(function (c) {
|
||||
collList.push(c.id);
|
||||
});
|
||||
e.stopPropagation();
|
||||
var id = $(e.currentTarget).attr("id"), number;
|
||||
if (id.indexOf("addAfter_newEdgeDefinitions") !== -1 ) {
|
||||
|
@ -343,21 +355,21 @@
|
|||
})
|
||||
);
|
||||
$('#newEdgeDefinitions'+this.counter).select2({
|
||||
tags: [],
|
||||
tags: collList,
|
||||
showSearchBox: false,
|
||||
minimumResultsForSearch: -1,
|
||||
width: "336px",
|
||||
maximumSelectionSize: 1
|
||||
});
|
||||
$('#newfromCollections'+this.counter).select2({
|
||||
tags: [],
|
||||
tags: collList,
|
||||
showSearchBox: false,
|
||||
minimumResultsForSearch: -1,
|
||||
width: "336px",
|
||||
maximumSelectionSize: 10
|
||||
});
|
||||
$('#newtoCollections'+this.counter).select2({
|
||||
tags: [],
|
||||
tags: collList,
|
||||
showSearchBox: false,
|
||||
minimumResultsForSearch: -1,
|
||||
width: "336px",
|
||||
|
@ -376,9 +388,12 @@
|
|||
},
|
||||
|
||||
createNewGraphModal2: function() {
|
||||
var buttons = [],
|
||||
tableContent = [];
|
||||
var buttons = [], collList = [],
|
||||
tableContent = [], collections = this.options.collectionCollection.models;
|
||||
|
||||
collections.forEach(function (c) {
|
||||
collList.push(c.id);
|
||||
});
|
||||
this.counter = 0;
|
||||
window.modalView.disableSubmitOnEnter = true;
|
||||
|
||||
|
@ -403,7 +418,8 @@
|
|||
true,
|
||||
false,
|
||||
true,
|
||||
1
|
||||
1,
|
||||
collList
|
||||
)
|
||||
);
|
||||
tableContent.push(
|
||||
|
@ -416,7 +432,8 @@
|
|||
true,
|
||||
false,
|
||||
false,
|
||||
10
|
||||
10,
|
||||
collList
|
||||
)
|
||||
);
|
||||
tableContent.push(
|
||||
|
@ -429,7 +446,8 @@
|
|||
true,
|
||||
false,
|
||||
false,
|
||||
10
|
||||
10,
|
||||
collList
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -441,7 +459,11 @@
|
|||
"",
|
||||
"Some info for vertex collections",
|
||||
"Vertex Collections",
|
||||
false
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
10,
|
||||
collList
|
||||
)
|
||||
);
|
||||
buttons.push(
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
};
|
||||
|
||||
var createTextStub = function(type, label, value, info, placeholder, mandatory, regexp,
|
||||
addDelete, addAdd, maxEntrySize) {
|
||||
addDelete, addAdd, maxEntrySize, tags) {
|
||||
var obj = {
|
||||
type: type,
|
||||
label: label
|
||||
|
@ -40,6 +40,9 @@
|
|||
if (maxEntrySize !== undefined) {
|
||||
obj.maxEntrySize = maxEntrySize;
|
||||
}
|
||||
if (tags !== undefined) {
|
||||
obj.tags = tags;
|
||||
}
|
||||
if (regexp){
|
||||
// returns true if the string contains the match
|
||||
obj.validateInput = function(el){
|
||||
|
@ -186,9 +189,9 @@
|
|||
},
|
||||
|
||||
createSelect2Entry: function(
|
||||
id, label, value, info, placeholder, mandatory, addDelete, addAdd, maxEntrySize) {
|
||||
id, label, value, info, placeholder, mandatory, addDelete, addAdd, maxEntrySize, tags) {
|
||||
var obj = createTextStub(this.tables.SELECT2, label, value, info, placeholder,
|
||||
mandatory, undefined, addDelete, addAdd, maxEntrySize);
|
||||
mandatory, undefined, addDelete, addAdd, maxEntrySize, tags);
|
||||
obj.id = id;
|
||||
return obj;
|
||||
},
|
||||
|
@ -283,7 +286,7 @@
|
|||
_.each(tableContent, function(r) {
|
||||
if (r.type === self.tables.SELECT2) {
|
||||
$('#'+r.id).select2({
|
||||
tags: [],
|
||||
tags: r.tags || [],
|
||||
showSearchBox: false,
|
||||
minimumResultsForSearch: -1,
|
||||
width: "336px",
|
||||
|
|
|
@ -5390,7 +5390,8 @@ function GRAPH_TRAVERSAL (vertexCollection,
|
|||
///
|
||||
/// *Parameters*
|
||||
/// * *graphName* : The name of the graph as a string.
|
||||
/// * *startVertex* : The ID of the start vertex of the traversal as a string.
|
||||
/// * *startVertexExample* : An example for the desired
|
||||
/// vertices (see [example](#short_explaination_of_the_vertex_example_parameter)).
|
||||
/// * *direction* : The direction of the edges as a string. Possible values
|
||||
/// are *outbound*, *inbound* and *any* (default).
|
||||
/// * *options* (optional) : Object containing optional options, see
|
||||
|
@ -5425,19 +5426,28 @@ function GRAPH_TRAVERSAL (vertexCollection,
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
function GENERAL_GRAPH_TRAVERSAL (graphName,
|
||||
startVertex,
|
||||
startVertexExample,
|
||||
direction,
|
||||
options) {
|
||||
"use strict";
|
||||
|
||||
var result = [];
|
||||
options = TRAVERSAL_PARAMS(options);
|
||||
options.fromVertexExample = startVertexExample;
|
||||
options.direction = direction;
|
||||
|
||||
return TRAVERSAL_FUNC("GRAPH_TRAVERSAL",
|
||||
TRAVERSAL.generalGraphDatasourceFactory(graphName),
|
||||
TO_ID(startVertex),
|
||||
undefined,
|
||||
direction,
|
||||
options);
|
||||
var graph = RESOLVE_GRAPH_TO_DOCUMENTS(graphName, options);
|
||||
var factory = TRAVERSAL.generalGraphDatasourceFactory(graphName);
|
||||
|
||||
graph.fromVertices.forEach(function (f) {
|
||||
result.push(TRAVERSAL_FUNC("GRAPH_TRAVERSAL",
|
||||
factory,
|
||||
TO_ID(f),
|
||||
undefined,
|
||||
direction,
|
||||
options));
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -5572,8 +5582,8 @@ function GENERAL_GRAPH_DISTANCE_TO (graphName,
|
|||
/// *Parameters*
|
||||
///
|
||||
/// * *graphName* : The name of the graph as a string.
|
||||
/// * *startVertex* : The ID of the start vertex
|
||||
/// of the traversal as a string.
|
||||
/// * *startVertexExample* : An example for the desired
|
||||
/// vertices (see [example](#short_explaination_of_the_vertex_example_parameter)).
|
||||
/// * *direction* : The direction of the edges as a string.
|
||||
/// Possible values are *outbound*, *inbound* and *any* (default).
|
||||
/// * *connectName* : The result attribute which
|
||||
|
@ -5611,25 +5621,32 @@ function GENERAL_GRAPH_DISTANCE_TO (graphName,
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function GENERAL_GRAPH_TRAVERSAL_TREE (graphName,
|
||||
startVertex,
|
||||
startVertexExample,
|
||||
direction,
|
||||
connectName,
|
||||
options) {
|
||||
"use strict";
|
||||
|
||||
var result = [];
|
||||
options = TRAVERSAL_TREE_PARAMS(options, connectName, "GRAPH_TRAVERSAL_TREE");
|
||||
options.fromVertexExample = startVertexExample;
|
||||
options.direction = direction;
|
||||
|
||||
var result = TRAVERSAL_FUNC("GRAPH_TRAVERSAL_TREE",
|
||||
TRAVERSAL.generalGraphDatasourceFactory(graphName),
|
||||
TO_ID(startVertex),
|
||||
undefined,
|
||||
direction,
|
||||
options);
|
||||
var graph = RESOLVE_GRAPH_TO_DOCUMENTS(graphName, options);
|
||||
var factory = TRAVERSAL.generalGraphDatasourceFactory(graphName), r;
|
||||
|
||||
if (result.length === 0) {
|
||||
return [ ];
|
||||
}
|
||||
return [ result[0][options.connect] ];
|
||||
graph.fromVertices.forEach(function (f) {
|
||||
r = TRAVERSAL_FUNC("GRAPH_TRAVERSAL_TREE",
|
||||
factory,
|
||||
TO_ID(f),
|
||||
undefined,
|
||||
direction,
|
||||
options);
|
||||
if (r.length > 0) {
|
||||
result.push([ r[0][options.connect] ]);
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -701,6 +701,7 @@ function ahuacatlQueryGeneralTraversalTestSuite() {
|
|||
var actual, result = [];
|
||||
|
||||
actual = getQueryResults("FOR e IN GRAPH_TRAVERSAL('werKenntWen', 'UnitTests_Hamburger/Caesar', 'outbound') RETURN e");
|
||||
actual = actual[0];
|
||||
actual.forEach(function (s) {
|
||||
result.push(s.vertex._key);
|
||||
});
|
||||
|
@ -716,11 +717,18 @@ function ahuacatlQueryGeneralTraversalTestSuite() {
|
|||
]);
|
||||
},
|
||||
|
||||
testGRAPH_TRAVERSALWithExamples: function () {
|
||||
var actual, result = [];
|
||||
|
||||
actual = getQueryResults("FOR e IN GRAPH_TRAVERSAL('werKenntWen', {}, 'outbound') RETURN e");
|
||||
assertEqual(actual.length , 7);
|
||||
},
|
||||
|
||||
testGENERAL_GRAPH_TRAVERSAL_TREE: function () {
|
||||
var actual, start, middle;
|
||||
|
||||
actual = getQueryResults("FOR e IN GRAPH_TRAVERSAL_TREE('werKenntWen', 'UnitTests_Hamburger/Caesar', 'outbound', 'connected') RETURN e");
|
||||
start = actual[0][0];
|
||||
start = actual[0][0][0];
|
||||
|
||||
assertEqual(start._key, "Caesar");
|
||||
assertTrue(start.hasOwnProperty("connected"));
|
||||
|
|
Loading…
Reference in New Issue