mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'devel' of github.com:triAGENS/ArangoDB into devel
This commit is contained in:
commit
f89311460f
|
@ -1,6 +1,8 @@
|
|||
v2.2.0 (XXXX-XX-XX)
|
||||
-------------------
|
||||
|
||||
* fixed check-version for empty directory
|
||||
|
||||
* moved try/catch block to the top of routing chain
|
||||
|
||||
* added mountedApp function for foxx-manager
|
||||
|
|
|
@ -18,6 +18,6 @@ build-books: md-files
|
|||
build-book:
|
||||
@test -d books/$(NAME) || mkdir books/$(NAME)
|
||||
cd $(NAME) && gitbook build -o ../books/$(NAME)
|
||||
cp Users/arangodb_logo2.png books/Users/
|
||||
cp Users/Arangodb_Logo.png books/Users/
|
||||
@for file in $(basename $(MD_FILES)); do echo "remove $${file}.md";rm $${file}.md;done
|
||||
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
After Width: | Height: | Size: 7.0 KiB |
|
@ -23,7 +23,13 @@ existing collection named "users" on the server.
|
|||
Let's further assume the import at hand is encoded in JSON. We'll be using these
|
||||
example user records to import:
|
||||
|
||||
@verbinclude arangoimp-data-json
|
||||
```
|
||||
{ "name" : { "first" : "John", "last" : "Connor" }, "active" : true, "age" : 25, "likes" : [ "swimming"] }
|
||||
{ "name" : { "first" : "Jim", "last" : "O'Brady" }, "age" : 19, "likes" : [ "hiking", "singing" ] }
|
||||
{ "name" : { "first" : "Lisa", "last" : "Jones" }, "dob" : "1981-04-09", "likes" : [ "running" ] }
|
||||
```
|
||||
|
||||
<!--@verbinclude arangoimp-data-json-->
|
||||
|
||||
To import these records, all you need to do is to put them into a file (with one
|
||||
line for each record to import) and run the following command:
|
||||
|
|
|
@ -22,6 +22,7 @@ Truncates a collection, removing all documents but keeping all its indexes.
|
|||
|
||||
Truncates a collection:
|
||||
|
||||
```
|
||||
arango> col = db.examples;
|
||||
[ArangoCollection 91022, "examples" (status new born)]
|
||||
arango> col.save({ "Hello" : "World" });
|
||||
|
@ -31,6 +32,7 @@ arango> col.count();
|
|||
arango> col.truncate();
|
||||
arango> col.count();
|
||||
0
|
||||
```
|
||||
|
||||
`collection.properties()`
|
||||
|
||||
|
|
|
@ -54,6 +54,7 @@
|
|||
* [Language Basics](Aql/Basics.md)
|
||||
* [Operators](Aql/Operators.md)
|
||||
* [High level Operations](Aql/Operations.md)
|
||||
* [Graph Operations](Aql/GraphOperations.md)
|
||||
* [Advanced Features](Aql/Advanced.md)
|
||||
<!-- 11 -->
|
||||
* [Extending AQL](AqlExtending/README.md)
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 26 KiB |
|
@ -24,7 +24,7 @@
|
|||
<!-- Title -->
|
||||
<h1>
|
||||
<i class="fa fa-spinner fa-spin"></i>
|
||||
<a href="https://www.arangodb.org" target="_blank"><img src="../arangodb_logo2.png" style= width="222" height="35" border="0" alt="ArangoDB" style="position:fixed"></a>
|
||||
<div style="position:relative; bottom:50px; left:110px; font-size:22pt">2.1.0</div>
|
||||
<a href="https://www.arangodb.org" > <img src="../Arangodb_Logo.png" alt="ArangoDB" border="0" style="position:relative"></a>
|
||||
<div style="position:relative; bottom:45px; left:90px; font-size:12pt">2.1.0</div>
|
||||
</h1>
|
||||
</div>
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
{% if options.links.issues !== false && (options.links.issues || githubId) %}
|
||||
{% set _divider = true %}
|
||||
<li>
|
||||
<a href="{{ options.links.issues|default(githubHost+githubId+"/issues") }}" target="blank"class="issues-link">Need more help?</a>
|
||||
<a href="{{ options.links.issues|default(githubHost+githubId+"/issues") }}" target="blank"class="issues-link">Have any questions?</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if _divider %}
|
||||
|
@ -53,9 +53,9 @@
|
|||
x = x[x.length - 2] + '/' + x[x.length - 1];
|
||||
jQuery('a',this).each(function(){
|
||||
var str = jQuery(this).attr('href');
|
||||
if(str.search(x) != -1){
|
||||
console.log(x);
|
||||
console.log(str);
|
||||
if(str.search(x) != -1){
|
||||
console.log(x);
|
||||
console.log(str);
|
||||
flag = false;
|
||||
}
|
||||
});
|
||||
|
@ -64,7 +64,7 @@
|
|||
}
|
||||
});
|
||||
jQuery(".summary>li").on("click",function(){
|
||||
jQuery(".summary>li>ul").hide();
|
||||
jQuery(".summary>li").show();
|
||||
jQuery("ul",this).slideDown();
|
||||
});
|
||||
</script>
|
|
@ -52,4 +52,9 @@
|
|||
{{ htmlSnippet("body:end")|default("") }}
|
||||
</body>
|
||||
{{ htmlSnippet("html:end")|default("") }}
|
||||
<script type="text/javascript">
|
||||
jQuery(".summary>li").each(function(){
|
||||
jQuery('ul',this).hide();
|
||||
});
|
||||
</script>
|
||||
</html>
|
||||
|
|
|
@ -39,11 +39,11 @@ start () {
|
|||
fi
|
||||
|
||||
if [ "$1" = "--upgrade" ]; then
|
||||
$DAEMON -c $CONF --uid arangodb --gid arangodb $@
|
||||
$DAEMON -c $CONF --uid arangodb --gid arangodb --no-server $@
|
||||
RETVAL=$?
|
||||
log_end_msg $RETVAL
|
||||
else
|
||||
$DAEMON -c $CONF --uid arangodb --gid arangodb --check-version
|
||||
$DAEMON -c $CONF --uid arangodb --gid arangodb --no-server --check-version
|
||||
RETVAL=$?
|
||||
|
||||
if test $RETVAL -eq 0; then
|
||||
|
|
|
@ -716,7 +716,7 @@ TRI_associative_pointer_t* TRI_CreateFunctionsAql (void) {
|
|||
REGISTER_FUNCTION("GRAPH_VERTICES", "GENERAL_GRAPH_VERTICES", false, false, "s,als|a", NULL);
|
||||
REGISTER_FUNCTION("NEIGHBORS", "GRAPH_NEIGHBORS", false, false, "h,h,s,s|l", NULL);
|
||||
REGISTER_FUNCTION("GRAPH_NEIGHBORS", "GENERAL_GRAPH_NEIGHBORS", false, false, "s,als|a", NULL);
|
||||
REGISTER_FUNCTION("GRAPH_COMMON_NEIGHBORS", "GENERAL_GRAPH_COMMON_NEIGHBORS", false, false, "s,als,als|a", NULL);
|
||||
REGISTER_FUNCTION("GRAPH_COMMON_NEIGHBORS", "GENERAL_GRAPH_COMMON_NEIGHBORS", false, false, "s,als,als|a,a", NULL);
|
||||
REGISTER_FUNCTION("GRAPH_COMMON_PROPERTIES", "GENERAL_GRAPH_COMMON_PROPERTIES", false, false, "s,als,als|a", NULL);
|
||||
REGISTER_FUNCTION("GRAPH_ECCENTRICITY", "GENERAL_GRAPH_ECCENTRICITY", false, false, "s|a", NULL);
|
||||
REGISTER_FUNCTION("GRAPH_BETWEENNESS", "GENERAL_GRAPH_BETWEENNESS", false, false, "s|a", NULL);
|
||||
|
|
|
@ -770,6 +770,27 @@ int ArangoServer::startupServer () {
|
|||
startServer = false;
|
||||
}
|
||||
|
||||
// check version
|
||||
bool checkVersion = false;
|
||||
|
||||
if (_applicationServer->programOptions().has("check-version")) {
|
||||
checkVersion = true;
|
||||
}
|
||||
|
||||
// run upgrade script
|
||||
bool performUpgrade = false;
|
||||
|
||||
if (_applicationServer->programOptions().has("upgrade")) {
|
||||
performUpgrade = true;
|
||||
}
|
||||
|
||||
// skip an upgrade even if VERSION is missing
|
||||
bool skipUpgrade = false;
|
||||
|
||||
if (_applicationServer->programOptions().has("no-upgrade")) {
|
||||
skipUpgrade = true;
|
||||
}
|
||||
|
||||
// .............................................................................
|
||||
// prepare the various parts of the Arango server
|
||||
// .............................................................................
|
||||
|
@ -779,7 +800,7 @@ int ArangoServer::startupServer () {
|
|||
}
|
||||
|
||||
// open all databases
|
||||
openDatabases();
|
||||
openDatabases(checkVersion, performUpgrade);
|
||||
|
||||
// fetch the system database
|
||||
TRI_vocbase_t* vocbase = TRI_UseDatabaseServer(_server, TRI_VOC_SYSTEM_DATABASE);
|
||||
|
@ -809,19 +830,6 @@ int ArangoServer::startupServer () {
|
|||
_applicationV8->setVocbase(vocbase);
|
||||
_applicationV8->setConcurrency(concurrency);
|
||||
|
||||
bool performUpgrade = false;
|
||||
|
||||
if (_applicationServer->programOptions().has("upgrade")) {
|
||||
performUpgrade = true;
|
||||
}
|
||||
|
||||
// skip an upgrade even if VERSION is missing
|
||||
bool skipUpgrade = false;
|
||||
|
||||
if (_applicationServer->programOptions().has("no-upgrade")) {
|
||||
skipUpgrade = true;
|
||||
}
|
||||
|
||||
#ifdef TRI_ENABLE_MRUBY
|
||||
_applicationMR->setVocbase(vocbase);
|
||||
_applicationMR->setConcurrency(_dispatcherThreads);
|
||||
|
@ -851,7 +859,7 @@ int ArangoServer::startupServer () {
|
|||
_applicationServer->prepare2();
|
||||
|
||||
// run version check
|
||||
if (_applicationServer->programOptions().has("check-version")) {
|
||||
if (checkVersion) {
|
||||
_applicationV8->runUpgradeCheck();
|
||||
}
|
||||
|
||||
|
@ -1098,7 +1106,7 @@ int ArangoServer::runScript (TRI_vocbase_t* vocbase) {
|
|||
/// @brief opens the database
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void ArangoServer::openDatabases () {
|
||||
void ArangoServer::openDatabases (bool checkVersion, bool performUpgrade) {
|
||||
TRI_vocbase_defaults_t defaults;
|
||||
|
||||
// override with command-line options
|
||||
|
@ -1125,10 +1133,13 @@ void ArangoServer::openDatabases () {
|
|||
LOG_FATAL_AND_EXIT("cannot create server instance: out of memory");
|
||||
}
|
||||
|
||||
const bool isUpgrade = _applicationServer->programOptions().has("upgrade");
|
||||
res = TRI_StartServer(_server, isUpgrade);
|
||||
res = TRI_StartServer(_server, checkVersion, performUpgrade);
|
||||
|
||||
if (res != TRI_ERROR_NO_ERROR) {
|
||||
if (checkVersion && res == TRI_ERROR_ARANGO_EMPTY_DATADIR) {
|
||||
TRI_EXIT_FUNCTION(EXIT_SUCCESS, NULL);
|
||||
}
|
||||
|
||||
LOG_FATAL_AND_EXIT("cannot start server: %s", TRI_errno_string(res));
|
||||
}
|
||||
|
||||
|
|
|
@ -158,7 +158,7 @@ namespace triagens {
|
|||
/// @brief opens the system database
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void openDatabases ();
|
||||
void openDatabases (bool checkVersion, bool performUpgrade);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief closes the database
|
||||
|
|
|
@ -290,12 +290,16 @@ static int WriteServerId (char const* filename) {
|
|||
/// @brief read / create the server id on startup
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static int DetermineServerId (TRI_server_t* server) {
|
||||
static int DetermineServerId (TRI_server_t* server, bool checkVersion) {
|
||||
int res;
|
||||
|
||||
res = ReadServerId(server->_serverIdFilename);
|
||||
|
||||
if (res == TRI_ERROR_FILE_NOT_FOUND) {
|
||||
if (checkVersion) {
|
||||
return TRI_ERROR_ARANGO_EMPTY_DATADIR;
|
||||
}
|
||||
|
||||
// id file does not yet exist. now create it
|
||||
res = GenerateServerId();
|
||||
|
||||
|
@ -1390,7 +1394,8 @@ static int Move14AlphaDatabases (TRI_server_t* server) {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static int InitDatabases (TRI_server_t* server,
|
||||
bool isUpgrade) {
|
||||
bool checkVersion,
|
||||
bool performUpgrade) {
|
||||
TRI_vector_string_t names;
|
||||
int res;
|
||||
|
||||
|
@ -1404,7 +1409,7 @@ static int InitDatabases (TRI_server_t* server,
|
|||
if (names._length == 0) {
|
||||
char* name;
|
||||
|
||||
if (! isUpgrade && HasOldCollections(server)) {
|
||||
if (! performUpgrade && HasOldCollections(server)) {
|
||||
LOG_ERROR("no databases found. Please start the server with the --upgrade option");
|
||||
|
||||
return TRI_ERROR_ARANGO_DATADIR_INVALID;
|
||||
|
@ -1422,7 +1427,7 @@ static int InitDatabases (TRI_server_t* server,
|
|||
}
|
||||
}
|
||||
|
||||
if (res == TRI_ERROR_NO_ERROR && isUpgrade) {
|
||||
if (res == TRI_ERROR_NO_ERROR && performUpgrade) {
|
||||
char const* systemName;
|
||||
|
||||
assert(names._length > 0);
|
||||
|
@ -1782,7 +1787,8 @@ TRI_server_id_t TRI_GetIdServer () {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
int TRI_StartServer (TRI_server_t* server,
|
||||
bool isUpgrade) {
|
||||
bool checkVersion,
|
||||
bool performUpgrade) {
|
||||
int res;
|
||||
|
||||
if (! TRI_IsDirectory(server->_basePath)) {
|
||||
|
@ -1832,7 +1838,11 @@ int TRI_StartServer (TRI_server_t* server,
|
|||
// read the server id
|
||||
// .............................................................................
|
||||
|
||||
res = DetermineServerId(server);
|
||||
res = DetermineServerId(server, checkVersion);
|
||||
|
||||
if (res == TRI_ERROR_ARANGO_EMPTY_DATADIR) {
|
||||
return res;
|
||||
}
|
||||
|
||||
if (res != TRI_ERROR_NO_ERROR) {
|
||||
LOG_ERROR("reading/creating server file failed: %s",
|
||||
|
@ -1894,7 +1904,11 @@ int TRI_StartServer (TRI_server_t* server,
|
|||
// perform an eventual migration of the databases.
|
||||
// .............................................................................
|
||||
|
||||
res = InitDatabases(server, isUpgrade);
|
||||
res = InitDatabases(server, checkVersion, performUpgrade);
|
||||
|
||||
if (res == TRI_ERROR_ARANGO_EMPTY_DATADIR) {
|
||||
return res;
|
||||
}
|
||||
|
||||
if (res != TRI_ERROR_NO_ERROR) {
|
||||
LOG_ERROR("unable to initialise databases: %s",
|
||||
|
@ -1909,7 +1923,7 @@ int TRI_StartServer (TRI_server_t* server,
|
|||
if (server->_appPath != NULL &&
|
||||
strlen(server->_appPath) > 0 &&
|
||||
! TRI_IsDirectory(server->_appPath)) {
|
||||
if (! isUpgrade) {
|
||||
if (! performUpgrade) {
|
||||
LOG_ERROR("specified --javascript.app-path directory '%s' does not exist. "
|
||||
"Please start again with --upgrade option to create it.",
|
||||
server->_appPath);
|
||||
|
@ -1929,7 +1943,7 @@ int TRI_StartServer (TRI_server_t* server,
|
|||
if (server->_devAppPath != NULL &&
|
||||
strlen(server->_devAppPath) > 0 &&
|
||||
! TRI_IsDirectory(server->_devAppPath)) {
|
||||
if (! isUpgrade) {
|
||||
if (! performUpgrade) {
|
||||
LOG_ERROR("specified --javascript.dev-app-path directory '%s' does not exist. "
|
||||
"Please start again with --upgrade option to create it.",
|
||||
server->_devAppPath);
|
||||
|
@ -1979,7 +1993,7 @@ int TRI_StartServer (TRI_server_t* server,
|
|||
// .............................................................................
|
||||
|
||||
// scan all databases
|
||||
res = OpenDatabases(server, isUpgrade);
|
||||
res = OpenDatabases(server, performUpgrade);
|
||||
|
||||
if (res != TRI_ERROR_NO_ERROR) {
|
||||
LOG_ERROR("could not iterate over all databases: %s",
|
||||
|
@ -2686,6 +2700,10 @@ bool TRI_MSync (int fd,
|
|||
return true;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- END-OF-FILE
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
// Local Variables:
|
||||
// mode: outline-minor
|
||||
// outline-regexp: "/// @brief\\|/// {@inheritDoc}\\|/// @addtogroup\\|/// @page\\|// --SECTION--\\|/// @\\}"
|
||||
|
|
|
@ -151,7 +151,8 @@ TRI_server_id_t TRI_GetIdServer (void);
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
int TRI_StartServer (TRI_server_t*,
|
||||
bool);
|
||||
bool checkVersion,
|
||||
bool performUpgrade);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief stop the server
|
||||
|
|
|
@ -104,6 +104,7 @@
|
|||
"ERROR_ARANGO_INDEX_DOCUMENT_ATTRIBUTE_MISSING" : { "code" : 1234, "message" : "index insertion warning - attribute missing in document" },
|
||||
"ERROR_ARANGO_INDEX_CREATION_FAILED" : { "code" : 1235, "message" : "index creation failed" },
|
||||
"ERROR_ARANGO_DATAFILE_FULL" : { "code" : 1300, "message" : "datafile full" },
|
||||
"ERROR_ARANGO_EMPTY_DATADIR" : { "code" : 1301, "message" : "server database directory is empty" },
|
||||
"ERROR_REPLICATION_NO_RESPONSE" : { "code" : 1400, "message" : "no response" },
|
||||
"ERROR_REPLICATION_INVALID_RESPONSE" : { "code" : 1401, "message" : "invalid response" },
|
||||
"ERROR_REPLICATION_MASTER_ERROR" : { "code" : 1402, "message" : "master error" },
|
||||
|
@ -206,12 +207,15 @@
|
|||
"ERROR_GRAPH_COULD_NOT_CHANGE_EDGE" : { "code" : 1908, "message" : "could not change edge" },
|
||||
"ERROR_GRAPH_TOO_MANY_ITERATIONS" : { "code" : 1909, "message" : "too many iterations" },
|
||||
"ERROR_GRAPH_INVALID_FILTER_RESULT" : { "code" : 1910, "message" : "invalid filter result" },
|
||||
"ERROR_GRAPH_COLLECTION_MULTI_USE" : { "code" : 1920, "message" : "an edge collection may only be used once in one edge definition of a graph." },
|
||||
"ERROR_GRAPH_COLLECTION_USE_IN_MULTI_GRAPHS" : { "code" : 1921, "message" : " is already used by another graph in a different edge definition." },
|
||||
"ERROR_GRAPH_CREATE_MISSING_NAME" : { "code" : 1922, "message" : "a graph name is required to create a graph." },
|
||||
"ERROR_GRAPH_CREATE_MISSING_EDGE_DEFINITION" : { "code" : 1923, "message" : "at least one edge definition is required to create a graph." },
|
||||
"ERROR_SESSION_UNKNOWN" : { "code" : 1950, "message" : "unknown session" },
|
||||
"ERROR_SESSION_EXPIRED" : { "code" : 1951, "message" : "session expired" },
|
||||
"ERROR_GRAPH_COLLECTION_MULTI_USE" : { "code" : 1920, "message" : "multi use of edge collection in edge def" },
|
||||
"ERROR_GRAPH_COLLECTION_USE_IN_MULTI_GRAPHS" : { "code" : 1921, "message" : "edge collection already used in edge def" },
|
||||
"ERROR_GRAPH_CREATE_MISSING_NAME" : { "code" : 1922, "message" : "missing graph name" },
|
||||
"ERROR_GRAPH_CREATE_MALFORMED_EDGE_DEFINITION" : { "code" : 1923, "message" : "malformed edge def" },
|
||||
"ERROR_GRAPH_NOT_FOUND" : { "code" : 1924, "message" : "graph not found" },
|
||||
"ERROR_GRAPH_DUPLICATE" : { "code" : 1925, "message" : "graph already exists" },
|
||||
"ERROR_GRAPH_VERTEX_COL_DOES_NOT_EXIST" : { "code" : 1926, "message" : "collection does not exist" },
|
||||
"ERROR_SESSION_UNKNOWN" : { "code" : 1950, "message" : "unknown session" },
|
||||
"ERROR_SESSION_EXPIRED" : { "code" : 1951, "message" : "session expired" },
|
||||
"SIMPLE_CLIENT_UNKNOWN_ERROR" : { "code" : 2000, "message" : "unknown client error" },
|
||||
"SIMPLE_CLIENT_COULD_NOT_CONNECT" : { "code" : 2001, "message" : "could not connect to server" },
|
||||
"SIMPLE_CLIENT_COULD_NOT_WRITE" : { "code" : 2002, "message" : "could not write to server" },
|
||||
|
@ -221,7 +225,6 @@
|
|||
"ERROR_ARANGO_INDEX_BITARRAY_INSERT_ITEM_UNSUPPORTED_VALUE" : { "code" : 3413, "message" : "bitarray index insert failure - document attribute value unsupported in index" },
|
||||
"ERROR_ARANGO_INDEX_BITARRAY_CREATION_FAILURE_DUPLICATE_ATTRIBUTES" : { "code" : 3415, "message" : "bitarray index creation failure - one or more index attributes are duplicated." },
|
||||
"ERROR_ARANGO_INDEX_BITARRAY_CREATION_FAILURE_DUPLICATE_VALUES" : { "code" : 3417, "message" : "bitarray index creation failure - one or more index attribute values are duplicated." },
|
||||
"ERROR_APP_ALREADY_EXISTS" : { "code": 4000, "message": "App is already installed" },
|
||||
"RESULT_KEY_EXISTS" : { "code" : 10000, "message" : "element not inserted into structure, because key already exists" },
|
||||
"RESULT_ELEMENT_EXISTS" : { "code" : 10001, "message" : "element not inserted into structure, because it already exists" },
|
||||
"RESULT_KEY_NOT_FOUND" : { "code" : 10002, "message" : "key not found in structure" },
|
||||
|
|
|
@ -104,6 +104,7 @@
|
|||
"ERROR_ARANGO_INDEX_DOCUMENT_ATTRIBUTE_MISSING" : { "code" : 1234, "message" : "index insertion warning - attribute missing in document" },
|
||||
"ERROR_ARANGO_INDEX_CREATION_FAILED" : { "code" : 1235, "message" : "index creation failed" },
|
||||
"ERROR_ARANGO_DATAFILE_FULL" : { "code" : 1300, "message" : "datafile full" },
|
||||
"ERROR_ARANGO_EMPTY_DATADIR" : { "code" : 1301, "message" : "server database directory is empty" },
|
||||
"ERROR_REPLICATION_NO_RESPONSE" : { "code" : 1400, "message" : "no response" },
|
||||
"ERROR_REPLICATION_INVALID_RESPONSE" : { "code" : 1401, "message" : "invalid response" },
|
||||
"ERROR_REPLICATION_MASTER_ERROR" : { "code" : 1402, "message" : "master error" },
|
||||
|
@ -206,14 +207,15 @@
|
|||
"ERROR_GRAPH_COULD_NOT_CHANGE_EDGE" : { "code" : 1908, "message" : "could not change edge" },
|
||||
"ERROR_GRAPH_TOO_MANY_ITERATIONS" : { "code" : 1909, "message" : "too many iterations" },
|
||||
"ERROR_GRAPH_INVALID_FILTER_RESULT" : { "code" : 1910, "message" : "invalid filter result" },
|
||||
"ERROR_GRAPH_COLLECTION_MULTI_USE" : { "code" : 1920, "message" : "an edge collection may only be used once in one edge definition of a graph." },
|
||||
"ERROR_GRAPH_COLLECTION_USE_IN_MULTI_GRAPHS" : { "code" : 1921, "message" : " is already used by another graph in a different edge definition." },
|
||||
"ERROR_GRAPH_CREATE_MISSING_NAME" : { "code" : 1922, "message" : "a graph name is required to create a graph." },
|
||||
"ERROR_GRAPH_CREATE_MALFORMED_EDGE_DEFINITION" : { "code" : 1923, "message" : "the edge definition is malformed. It has to be an array of objects." },
|
||||
"ERROR_GRAPH_NOT_FOUND" : { "code" : 1924, "message" : "a graph with this name could not be found." },
|
||||
"ERROR_GRAPH_DUPLICATE" : { "code" : 1925, "message" : "a graph with this name already exists." },
|
||||
"ERROR_SESSION_UNKNOWN" : { "code" : 1950, "message" : "unknown session" },
|
||||
"ERROR_SESSION_EXPIRED" : { "code" : 1951, "message" : "session expired" },
|
||||
"ERROR_GRAPH_COLLECTION_MULTI_USE" : { "code" : 1920, "message" : "multi use of edge collection in edge def" },
|
||||
"ERROR_GRAPH_COLLECTION_USE_IN_MULTI_GRAPHS" : { "code" : 1921, "message" : "edge collection already used in edge def" },
|
||||
"ERROR_GRAPH_CREATE_MISSING_NAME" : { "code" : 1922, "message" : "missing graph name" },
|
||||
"ERROR_GRAPH_CREATE_MALFORMED_EDGE_DEFINITION" : { "code" : 1923, "message" : "malformed edge def" },
|
||||
"ERROR_GRAPH_NOT_FOUND" : { "code" : 1924, "message" : "graph not found" },
|
||||
"ERROR_GRAPH_DUPLICATE" : { "code" : 1925, "message" : "graph already exists" },
|
||||
"ERROR_GRAPH_VERTEX_COL_DOES_NOT_EXIST" : { "code" : 1926, "message" : "collection does not exist" },
|
||||
"ERROR_SESSION_UNKNOWN" : { "code" : 1950, "message" : "unknown session" },
|
||||
"ERROR_SESSION_EXPIRED" : { "code" : 1951, "message" : "session expired" },
|
||||
"SIMPLE_CLIENT_UNKNOWN_ERROR" : { "code" : 2000, "message" : "unknown client error" },
|
||||
"SIMPLE_CLIENT_COULD_NOT_CONNECT" : { "code" : 2001, "message" : "could not connect to server" },
|
||||
"SIMPLE_CLIENT_COULD_NOT_WRITE" : { "code" : 2002, "message" : "could not write to server" },
|
||||
|
@ -223,7 +225,6 @@
|
|||
"ERROR_ARANGO_INDEX_BITARRAY_INSERT_ITEM_UNSUPPORTED_VALUE" : { "code" : 3413, "message" : "bitarray index insert failure - document attribute value unsupported in index" },
|
||||
"ERROR_ARANGO_INDEX_BITARRAY_CREATION_FAILURE_DUPLICATE_ATTRIBUTES" : { "code" : 3415, "message" : "bitarray index creation failure - one or more index attributes are duplicated." },
|
||||
"ERROR_ARANGO_INDEX_BITARRAY_CREATION_FAILURE_DUPLICATE_VALUES" : { "code" : 3417, "message" : "bitarray index creation failure - one or more index attribute values are duplicated." },
|
||||
"ERROR_APP_ALREADY_EXISTS" : { "code": 4000, "message": "App is already installed" },
|
||||
"RESULT_KEY_EXISTS" : { "code" : 10000, "message" : "element not inserted into structure, because key already exists" },
|
||||
"RESULT_ELEMENT_EXISTS" : { "code" : 10001, "message" : "element not inserted into structure, because it already exists" },
|
||||
"RESULT_KEY_NOT_FOUND" : { "code" : 10002, "message" : "key not found in structure" },
|
||||
|
|
|
@ -1480,7 +1480,7 @@ var _create = function (graphName, edgeDefinitions) {
|
|||
);
|
||||
|
||||
try {
|
||||
g = gdb.document(graphName);
|
||||
var g = gdb.document(graphName);
|
||||
} catch (e) {
|
||||
if (e.errorNum !== errors.ERROR_ARANGO_DOCUMENT_NOT_FOUND.code) {
|
||||
throw e;
|
||||
|
@ -1709,6 +1709,7 @@ var Graph = function(graphName, edgeDefinitions, vertexCollections, edgeCollecti
|
|||
createHiddenProperty(this, "__edgeDefinitions", edgeDefinitions);
|
||||
createHiddenProperty(this, "__idsToRemove", []);
|
||||
createHiddenProperty(this, "__collectionsToLock", []);
|
||||
createHiddenProperty(this, "__singleVertexCollections", []);
|
||||
|
||||
// fills this.__idsToRemove and this.__collectionsToLock
|
||||
var removeEdge = function (edgeId, options) {
|
||||
|
@ -1959,6 +1960,7 @@ var checkIfMayBeDropped = function(colName, graphName, graphs) {
|
|||
}
|
||||
}
|
||||
);
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
|
@ -2292,7 +2294,7 @@ Graph.prototype._getVertexCollectionByName = function(name) {
|
|||
/// @brief get common neighbors of two vertices in the graph.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Graph.prototype._listCommonNeighbors = function(vertex1Example, vertex2Example, options) {
|
||||
Graph.prototype._listCommonNeighbors = function(vertex1Example, vertex2Example, optionsVertex1, optionsVertex2) {
|
||||
|
||||
var ex1 = transformExample(vertex1Example);
|
||||
var ex2 = transformExample(vertex2Example);
|
||||
|
@ -2300,12 +2302,15 @@ Graph.prototype._listCommonNeighbors = function(vertex1Example, vertex2Example,
|
|||
+ " IN GRAPH_COMMON_NEIGHBORS(@graphName"
|
||||
+ ',@ex1'
|
||||
+ ',@ex2'
|
||||
+ ',@options'
|
||||
+ ',@options1'
|
||||
+ ',@options2'
|
||||
+ ') SORT ATTRIBUTES(e)[0] RETURN e';
|
||||
options = options || {};
|
||||
optionsVertex1 = optionsVertex1 || {};
|
||||
optionsVertex2 = optionsVertex2 || {};
|
||||
var bindVars = {
|
||||
"graphName": this.__name,
|
||||
"options": options,
|
||||
"options1": optionsVertex1,
|
||||
"options2": optionsVertex2,
|
||||
"ex1": ex1,
|
||||
"ex2": ex2
|
||||
};
|
||||
|
@ -2316,20 +2321,23 @@ Graph.prototype._listCommonNeighbors = function(vertex1Example, vertex2Example,
|
|||
/// @brief get amount of common neighbors of two vertices in the graph.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Graph.prototype._amountCommonNeighbors = function(vertex1Example, vertex2Example, options) {
|
||||
Graph.prototype._amountCommonNeighbors = function(vertex1Example, vertex2Example, optionsVertex1, optionsVertex2) {
|
||||
var ex1 = transformExample(vertex1Example);
|
||||
var ex2 = transformExample(vertex2Example);
|
||||
var query = "FOR e"
|
||||
+ " IN GRAPH_COMMON_NEIGHBORS(@graphName"
|
||||
+ ',@ex1'
|
||||
+ ',@ex2'
|
||||
+ ',@options'
|
||||
+ ',@options1'
|
||||
+ ',@options2'
|
||||
+ ') FOR a in ATTRIBUTES(e) FOR b in ATTRIBUTES(e[a]) '
|
||||
+ 'SORT ATTRIBUTES(e)[0] RETURN [a, b, LENGTH(e[a][b]) ]';
|
||||
options = options || {};
|
||||
optionsVertex1 = optionsVertex1 || {};
|
||||
optionsVertex2 = optionsVertex2 || {};
|
||||
var bindVars = {
|
||||
"graphName": this.__name,
|
||||
"options": options,
|
||||
"options1": optionsVertex1,
|
||||
"options2": optionsVertex2,
|
||||
"ex1": ex1,
|
||||
"ex2": ex2
|
||||
};
|
||||
|
@ -2405,19 +2413,222 @@ Graph.prototype._amountCommonProperties = function(vertex1Example, vertex2Exampl
|
|||
return returnHash;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @startDocuBlock JSF_general_graph__extendEdgeDefinitions
|
||||
/// Extends the edge definitions of a graph. If the edge collection of the edge definition
|
||||
/// to add is already used in the graph or used in a different graph with different from
|
||||
/// an to collections an error is thrown.
|
||||
///
|
||||
/// `general-graph._extendEdgeDefinitions(edgeDefinition)`
|
||||
///
|
||||
/// *edgeDefinition* - [string] : the edge definition to extend the graph
|
||||
///
|
||||
/// @EXAMPLES
|
||||
///
|
||||
/// @EXAMPLE_ARANGOSH_OUTPUT{general_graph__extendEdgeDefinitions}
|
||||
/// var examples = require("org/arangodb/graph-examples/example-graph.js");
|
||||
/// var ed1 = examples._directedRelationDefinition("myEC1", ["myVC1"], ["myVC2"]);
|
||||
/// var ed2 = examples._directedRelationDefinition("myEC2", ["myVC1"], ["myVC3"]);
|
||||
/// var g = examples._create("myGraph", [ed1]);
|
||||
/// g._extendEdgeDefinitions(ed2);
|
||||
/// @END_EXAMPLE_ARANGOSH_OUTPUT
|
||||
///
|
||||
/// @endDocuBlock
|
||||
///
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Graph.prototype._extendEdgeDefinitions = function(edgeDefinition) {
|
||||
var self = this;
|
||||
var err;
|
||||
//check if edgeCollection not already used
|
||||
var eC = edgeDefinition.collection;
|
||||
// ... in same graph
|
||||
if (this.__edgeCollections[eC] !== undefined) {
|
||||
err = new ArangoError();
|
||||
err.errorNum = arangodb.errors.ERROR_GRAPH_COLLECTION_MULTI_USE.code;
|
||||
err.errorMessage = arangodb.errors.ERROR_GRAPH_COLLECTION_MULTI_USE.message;
|
||||
throw err;
|
||||
}
|
||||
//in different graph
|
||||
db._graphs.toArray().forEach(
|
||||
function(singleGraph) {
|
||||
var sGEDs = singleGraph.edgeDefinitions;
|
||||
sGEDs.forEach(
|
||||
function(sGED) {
|
||||
var col = sGED.collection;
|
||||
if (col === eC) {
|
||||
if (JSON.stringify(sGED) !== JSON.stringify(edgeDefinition)) {
|
||||
err = new ArangoError();
|
||||
err.errorNum = arangodb.errors.ERROR_GRAPH_COLLECTION_USE_IN_MULTI_GRAPHS.code;
|
||||
err.errorMessage = col
|
||||
+ arangodb.errors.ERROR_GRAPH_COLLECTION_USE_IN_MULTI_GRAPHS.message;
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
findOrCreateCollectionsByEdgeDefinitions([edgeDefinition]);
|
||||
|
||||
this.__edgeDefinitions.push(edgeDefinition);
|
||||
this.__edgeCollections[edgeDefinition.collection] = db[edgeDefinition.collection];
|
||||
edgeDefinition.from.forEach(
|
||||
function(vc) {
|
||||
if (self.__vertexCollections[vc] === undefined) {
|
||||
self.__vertexCollections[vc] = db[vc];
|
||||
}
|
||||
}
|
||||
);
|
||||
edgeDefinition.to.forEach(
|
||||
function(vc) {
|
||||
if (self.__vertexCollections[vc] === undefined) {
|
||||
self.__vertexCollections[vc] = db[vc];
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
};
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @startDocuBlock JSF_general_graph__editEdgeDefinition
|
||||
/// Edits the edge definitions of a graph. The edge definition used as argument will
|
||||
/// replace the existing edge definition the corresponding edge definition in graphs
|
||||
/// edge definitions. Other graphs with the same edge definition will be modified, too.
|
||||
///
|
||||
/// `general-graph._editEdgeDefinition(edgeDefinition, dropCollections)`
|
||||
///
|
||||
/// *edgeDefinition* - [string] : the edge definition to replace the existing edge
|
||||
/// definition with the same attribut *collection*.
|
||||
/// *dropCollections* - bool : True, all collections that are not used anymore in any
|
||||
/// graph will be removed. Default: true.
|
||||
///
|
||||
/// @EXAMPLES
|
||||
///
|
||||
/// @EXAMPLE_ARANGOSH_OUTPUT{general_graph__editEdgeDefinition}
|
||||
/// var examples = require("org/arangodb/graph-examples/example-graph.js");
|
||||
/// var ed1 = examples._directedRelationDefinition("myEC1", ["myVC1"], ["myVC2"]);
|
||||
/// var ed2 = examples._directedRelationDefinition("myEC1", ["myVC2"], ["myVC3"]);
|
||||
/// var g = examples._create("myGraph", [ed1, ed2]);
|
||||
/// g._editEdgeDefinition(ed2, true);
|
||||
/// @END_EXAMPLE_ARANGOSH_OUTPUT
|
||||
///
|
||||
/// @endDocuBlock
|
||||
///
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Graph.prototype._editEdgeDefinitions = function(edgeDefinition, dropCollections) {
|
||||
var self = this;
|
||||
var dropCandidates;
|
||||
var currentEdgeDefinition = {};
|
||||
|
||||
|
||||
//check, if in graphs edge definition
|
||||
if (this.__edgeCollections[edgeDefinition.collection] === undefined) {
|
||||
var err = new ArangoError();
|
||||
err.errorNum = arangodb.errors.ERROR_GRAPH_EDGE_COLLECTION_NOT_USED.code;
|
||||
err.errorMessage = arangodb.errors.ERROR_GRAPH_EDGE_COLLECTION_NOT_USED.message;
|
||||
throw err;
|
||||
}
|
||||
|
||||
//change definition for ALL graphs
|
||||
var graphs = getGraphCollection().toArray();
|
||||
graphs.forEach(
|
||||
function(graph) {
|
||||
var eDs = graph.edgeDefinitions;
|
||||
eDs.forEach(
|
||||
function(eD, id) {
|
||||
if(eD.collection === edgeDefinition.collection) {
|
||||
currentEdgeDefinition.from = eD.from;
|
||||
currentEdgeDefinition.to = eD.to;
|
||||
eDs[id].from = edgeDefinition.from;
|
||||
eDs[id].to = edgeDefinition.to;
|
||||
db._graphs.update(graph._key, {edgeDefinitions: eDs});
|
||||
if (graph._key === self.__name) {
|
||||
self.__edgeDefinitions[id].from = edgeDefinition.from;
|
||||
self.__edgeDefinitions[id].to = edgeDefinition.to;
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
findOrCreateCollectionsByEdgeDefinitions([edgeDefinition]);
|
||||
|
||||
if (dropCollections !== false) {
|
||||
//eval collection to be dropped
|
||||
dropCandidates = currentEdgeDefinition.from;
|
||||
currentEdgeDefinition.to.forEach(
|
||||
function (col) {
|
||||
if (dropCandidates.indexOf(col) === -1) {
|
||||
dropCandidates.push(col);
|
||||
}
|
||||
}
|
||||
);
|
||||
dropCandidates.forEach(
|
||||
function(dc) {
|
||||
if (checkIfMayBeDropped(dc, null, graphs)) {
|
||||
db._drop(dc);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
//push "new" collections into vertexCollections
|
||||
edgeDefinition.from.forEach(
|
||||
function(vc) {
|
||||
if (self.__vertexCollections[vc] === undefined) {
|
||||
self.__vertexCollections[vc] = db[vc];
|
||||
}
|
||||
}
|
||||
);
|
||||
edgeDefinition.to.forEach(
|
||||
function(vc) {
|
||||
if (self.__vertexCollections[vc] === undefined) {
|
||||
self.__vertexCollections[vc] = db[vc];
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
//remove "old" collections from vertexCollections
|
||||
dropCandidates.forEach(
|
||||
function(dropCanditate) {
|
||||
var drop = true;
|
||||
self.__edgeDefinitions.forEach(
|
||||
function(eD) {
|
||||
eD.from.forEach(
|
||||
function(vC) {
|
||||
if (vC === dropCanditate) {
|
||||
drop = false;
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
if (drop) {
|
||||
delete self.__vertexCollections[dropCanditate];
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
};
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @startDocuBlock JSF_general_graph__deleteEdgeDefinition
|
||||
/// Deletes an edge definition defined by the edge collection of a graph. If the
|
||||
/// collections defined in the edge definition (collection, from, to) are not used
|
||||
/// in another graph, the
|
||||
/// in another graph, they will be removed.
|
||||
///
|
||||
/// `general-graph.__deleteEdgeDefinition(edgeCollectionName, dropCollections)`
|
||||
/// `general-graph._deleteEdgeDefinition(edgeCollectionName, dropCollections)`
|
||||
///
|
||||
/// *edgeCollectionName* - string : name of edge collection defined in *collection* of the edge
|
||||
/// definition.
|
||||
/// *dropCollections* - bool : True, all collections are removed, if not used in another edge
|
||||
/// definition (including other graphs). Deflaut: true.
|
||||
/// definition (including other graphs). Default: true.
|
||||
///
|
||||
/// @EXAMPLES
|
||||
///
|
||||
|
@ -2478,6 +2689,57 @@ Graph.prototype._deleteEdgeDefinition = function(edgeCollection, dropCollections
|
|||
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @startDocuBlock JSF_general_graph__addVertexCollection
|
||||
/// Adds a vertex collection to the graph. If the collection does not exist, it will be created.
|
||||
///
|
||||
/// `general-graph._addVertexCollection(vertexCollectionName, createCollection)`
|
||||
///
|
||||
/// *vertexCollectionName* - string : name of vertex collection.
|
||||
/// *createCollection* - bool : if true the collection will be created if it does not exist. Default: true.
|
||||
///
|
||||
/// @EXAMPLES
|
||||
///
|
||||
/// @EXAMPLE_ARANGOSH_OUTPUT{general_graph__addeleteVertexCollection}
|
||||
/// var examples = require("org/arangodb/graph-examples/example-graph.js");
|
||||
/// var ed1 = examples._directedRelationDefinition("myEC1", ["myVC1"], ["myVC2"]);
|
||||
/// var g = examples._create("myGraph", [ed1, ed2]);
|
||||
/// g._addVertexCollection("myVC3", true);
|
||||
/// @END_EXAMPLE_ARANGOSH_OUTPUT
|
||||
///
|
||||
/// @endDocuBlock
|
||||
///
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Graph.prototype._addVertexCollection = function(vertexCollection, createCollection) {
|
||||
//check edgeCollection
|
||||
var ec = db._collection(vertexCollection);
|
||||
var err;
|
||||
if (ec === null) {
|
||||
if (createCollection !== false) {
|
||||
db._create(vertexCollection);
|
||||
} else {
|
||||
err = new ArangoError();
|
||||
err.errorNum = arangodb.errors.ERROR_GRAPH_VERTEX_COL_DOES_NOT_EXIST.code;
|
||||
err.errorMessage = vertexCollection + arangodb.errors.ERROR_GRAPH_VERTEX_COL_DOES_NOT_EXIST.message;
|
||||
throw err;
|
||||
}
|
||||
} else if (ec.type !== 3) {
|
||||
//TODO
|
||||
err = new ArangoError();
|
||||
err.errorNum = 1927;
|
||||
err.errorMessage = "";
|
||||
throw err;
|
||||
}
|
||||
|
||||
this.__singleVertexCollections.push(vertexCollection);
|
||||
|
||||
};
|
||||
|
||||
Graph.prototype._getVertexCollections = function() {
|
||||
return this.__singleVertexCollections;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -46,6 +46,31 @@
|
|||
return g;
|
||||
};
|
||||
|
||||
var createRoutePlannerGraph = function() {
|
||||
var edgeDefinition = [];
|
||||
edgeDefinition.push(Graph._directedRelationDefinition("highway", ["city"], ["city"]));
|
||||
edgeDefinition.push(Graph._directedRelationDefinition(
|
||||
"road", ["village", "city"], ["village", "city"])
|
||||
);
|
||||
var g = Graph._create("routeplanner", edgeDefinition);
|
||||
var berlin = g.city.save({_key: "Berlin", population : 3000000, isCapital : true});
|
||||
var cologne = g.city.save({_key: "Cologne", population : 1000000, isCapital : false});
|
||||
var munich = g.city.save({_key: "Munich", population : 1000000, isCapital : true});
|
||||
var olpe = g.village.save({_key: "Olpe", population : 80000, isCapital : false});
|
||||
var rosenheim = g.village.save({_key: "Rosenheim", population : 80000, isCapital : false});
|
||||
g.highway.save(berlin._id, cologne._id, {distance: 850});
|
||||
g.highway.save(berlin._id, munich._id, {distance: 600});
|
||||
g.highway.save(munich._id, cologne._id, {distance: 650});
|
||||
g.road.save(berlin._id, olpe._id, {distance: 700});
|
||||
g.road.save(berlin._id, rosenheim._id, {distance: 800});
|
||||
g.road.save(munich._id, rosenheim._id, {distance: 80});
|
||||
g.road.save(munich._id, olpe._id, {distance: 600});
|
||||
g.road.save(cologne._id, olpe._id, {distance: 100});
|
||||
g.road.save(cologne._id, rosenheim._id, {distance: 750});
|
||||
return g;
|
||||
};
|
||||
|
||||
|
||||
var dropGraph = function(name) {
|
||||
return Graph._drop(name);
|
||||
};
|
||||
|
@ -55,6 +80,8 @@
|
|||
dropGraph(name);
|
||||
}
|
||||
switch (name) {
|
||||
case "routeplanner":
|
||||
return createRoutePlannerGraph();
|
||||
case "social":
|
||||
return createSocialGraph();
|
||||
}
|
||||
|
|
|
@ -307,7 +307,7 @@ function GeneralGraphCreationSuite() {
|
|||
);
|
||||
fail();
|
||||
} catch (err) {
|
||||
assertEqual(err.errorMessage, "a graph name is required to create a graph.");
|
||||
assertEqual(err.errorMessage, ERRORS.ERROR_GRAPH_CREATE_MISSING_NAME.message);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -426,6 +426,9 @@ function GeneralGraphCreationSuite() {
|
|||
vc5 = "UnitTestEdgeDefDeleteVertexCol5";
|
||||
try {
|
||||
graph._drop(gN1);
|
||||
} catch(ignore) {
|
||||
}
|
||||
try {
|
||||
graph._drop(gN2);
|
||||
} catch(ignore) {
|
||||
}
|
||||
|
@ -447,11 +450,255 @@ function GeneralGraphCreationSuite() {
|
|||
|
||||
try {
|
||||
graph._drop(gN1);
|
||||
} catch(ignore) {
|
||||
}
|
||||
try {
|
||||
graph._drop(gN2);
|
||||
} catch(ignore) {
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
test_extendEdgeDefinitionFromExistingGraph1: function() {
|
||||
var gN1 = "UnitTestEdgeDefExtend1Graph1",
|
||||
ec1 = "UnitTestEdgeDefExtend1EdgeCol1",
|
||||
vc1 = "UnitTestEdgeDefExtend1VertexCol1",
|
||||
vc2 = "UnitTestEdgeDefExtend1VertexCol2",
|
||||
vc3 = "UnitTestEdgeDefExtend1VertexCol3";
|
||||
|
||||
try {
|
||||
graph._drop(gN1);
|
||||
} catch(ignore) {
|
||||
}
|
||||
|
||||
var dr1 = graph._directedRelationDefinition(ec1, [vc1], [vc2]),
|
||||
dr2 = graph._directedRelationDefinition(ec1, [vc2], [vc3]),
|
||||
g1 = graph._create(gN1, [dr1]);
|
||||
|
||||
try {
|
||||
g1._extendEdgeDefinitions(dr2);
|
||||
} catch (e) {
|
||||
assertEqual(
|
||||
e.errorMessage,
|
||||
arangodb.errors.ERROR_GRAPH_COLLECTION_MULTI_USE.message
|
||||
);
|
||||
}
|
||||
|
||||
try {
|
||||
graph._drop(gN1);
|
||||
} catch(ignore) {
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
test_extendEdgeDefinitionFromExistingGraph2: function() {
|
||||
var gN1 = "UnitTestEdgeDefExtend2Graph1",
|
||||
gN2 = "UnitTestEdgeDefExtend2Graph2",
|
||||
ec1 = "UnitTestEdgeDefExtend2EdgeCol1",
|
||||
ec2 = "UnitTestEdgeDefExtend2EdgeCol2",
|
||||
ec3 = "UnitTestEdgeDefExtend2EdgeCol3",
|
||||
vc1 = "UnitTestEdgeDefExtend2VertexCol1",
|
||||
vc2 = "UnitTestEdgeDefExtend2VertexCol2",
|
||||
vc3 = "UnitTestEdgeDefExtend2VertexCol3",
|
||||
vc4 = "UnitTestEdgeDefExtend2VertexCol4",
|
||||
vc5 = "UnitTestEdgeDefExtend2VertexCol5";
|
||||
try {
|
||||
graph._drop(gN1);
|
||||
} catch(ignore) {
|
||||
}
|
||||
try {
|
||||
graph._drop(gN2);
|
||||
} catch(ignore) {
|
||||
}
|
||||
|
||||
var dr1 = graph._directedRelationDefinition(ec1, [vc1], [vc1, vc2]),
|
||||
dr2 = graph._directedRelationDefinition(ec2, [vc3], [vc4, vc5]),
|
||||
dr2a = graph._directedRelationDefinition(ec2, [vc3], [vc4]),
|
||||
g1 = graph._create(gN1, [dr1]),
|
||||
g2 = graph._create(gN2, [dr2]);
|
||||
|
||||
try {
|
||||
g1._extendEdgeDefinitions(dr2a);
|
||||
} catch (e) {
|
||||
assertEqual(
|
||||
e.errorMessage,
|
||||
ec2 + arangodb.errors.ERROR_GRAPH_COLLECTION_USE_IN_MULTI_GRAPHS.message
|
||||
);
|
||||
}
|
||||
|
||||
try {
|
||||
graph._drop(gN1);
|
||||
} catch(ignore) {
|
||||
}
|
||||
try {
|
||||
graph._drop(gN2);
|
||||
} catch(ignore) {
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
test_extendEdgeDefinitionFromExistingGraph3: function() {
|
||||
var gN1 = "UnitTestEdgeDefExtend3Graph1",
|
||||
gN2 = "UnitTestEdgeDefExtend3Graph2",
|
||||
ec1 = "UnitTestEdgeDefExtend3EdgeCol1",
|
||||
ec2 = "UnitTestEdgeDefExtend3EdgeCol2",
|
||||
ec3 = "UnitTestEdgeDefExtend3EdgeCol3",
|
||||
vc1 = "UnitTestEdgeDefExtend3VertexCol1",
|
||||
vc2 = "UnitTestEdgeDefExtend3VertexCol2",
|
||||
vc3 = "UnitTestEdgeDefExtend3VertexCol3",
|
||||
vc4 = "UnitTestEdgeDefExtend3VertexCol4",
|
||||
vc5 = "UnitTestEdgeDefExtend3VertexCol5";
|
||||
try {
|
||||
graph._drop(gN1);
|
||||
} catch(ignore) {
|
||||
}
|
||||
try {
|
||||
graph._drop(gN2);
|
||||
} catch(ignore) {
|
||||
}
|
||||
|
||||
var dr1 = graph._directedRelationDefinition(ec1, [vc1], [vc1, vc2]),
|
||||
dr2 = graph._directedRelationDefinition(ec2, [vc3], [vc4, vc5]),
|
||||
dr3 = graph._directedRelationDefinition(ec3, [vc3], [vc4]),
|
||||
g1 = graph._create(gN1, [dr1]),
|
||||
g2 = graph._create(gN2, [dr2]);
|
||||
|
||||
assertEqual([dr1], g1.__edgeDefinitions);
|
||||
g1._extendEdgeDefinitions(dr2);
|
||||
assertEqual([dr1, dr2], g1.__edgeDefinitions);
|
||||
g1._extendEdgeDefinitions(dr3);
|
||||
assertEqual([dr1, dr2, dr3], g1.__edgeDefinitions);
|
||||
|
||||
|
||||
try {
|
||||
graph._drop(gN1);
|
||||
} catch(ignore) {
|
||||
}
|
||||
try {
|
||||
graph._drop(gN2);
|
||||
} catch(ignore) {
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
test_editEdgeDefinitionFromExistingGraph1: function() {
|
||||
var gN1 = "UnitTestEdgeDefEdit1Graph1",
|
||||
ec1 = "UnitTestEdgeDefEdit1EdgeCol1",
|
||||
ec2 = "UnitTestEdgeDefEdit1EdgeCol2",
|
||||
vc1 = "UnitTestEdgeDefEdit1VertexCol1",
|
||||
vc2 = "UnitTestEdgeDefEdit1VertexCol2",
|
||||
vc3 = "UnitTestEdgeDefEdit1VertexCol3",
|
||||
vc4 = "UnitTestEdgeDefEdit1VertexCol4",
|
||||
vc5 = "UnitTestEdgeDefEdit1VertexCol5";
|
||||
try {
|
||||
graph._drop(gN1);
|
||||
} catch(ignore) {
|
||||
}
|
||||
|
||||
var dr1 = graph._directedRelationDefinition(ec1, [vc1], [vc1, vc2]),
|
||||
dr2 = graph._directedRelationDefinition(ec2, [vc3], [vc4, vc5]),
|
||||
g1 = graph._create(gN1, [dr1]);
|
||||
|
||||
try {
|
||||
g1._editEdgeDefinitions(dr2);
|
||||
} catch (e) {
|
||||
assertEqual(
|
||||
e.errorMessage,
|
||||
arangodb.errors.ERROR_GRAPH_EDGE_COLLECTION_NOT_USED
|
||||
);
|
||||
}
|
||||
|
||||
try {
|
||||
graph._drop(gN1);
|
||||
} catch(ignore) {
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
test_editEdgeDefinitionFromExistingGraph2: function() {
|
||||
var gN1 = "UnitTestEdgeDefEdit2Graph1",
|
||||
gN2 = "UnitTestEdgeDefEdit2Graph2",
|
||||
ec1 = "UnitTestEdgeDefEdit2EdgeCol1",
|
||||
vc1 = "UnitTestEdgeDefEdit2VertexCol1",
|
||||
vc2 = "UnitTestEdgeDefEdit2VertexCol2",
|
||||
vc3 = "UnitTestEdgeDefEdit2VertexCol3",
|
||||
vc4 = "UnitTestEdgeDefEdit2VertexCol4",
|
||||
vc5 = "UnitTestEdgeDefEdit2VertexCol5";
|
||||
try {
|
||||
graph._drop(gN1);
|
||||
} catch(ignore) {
|
||||
}
|
||||
try {
|
||||
graph._drop(gN2);
|
||||
} catch(ignore) {
|
||||
}
|
||||
|
||||
var dr1 = graph._directedRelationDefinition(ec1, [vc1], [vc1, vc2]),
|
||||
dr2 = graph._directedRelationDefinition(ec1, [vc3], [vc4, vc5]),
|
||||
g1 = graph._create(gN1, [dr1]),
|
||||
g2 = graph._create(gN2, [dr1]);
|
||||
|
||||
g1._editEdgeDefinitions(dr2, true);
|
||||
assertEqual([dr2], g1.__edgeDefinitions);
|
||||
assertEqual([dr2], g2.__edgeDefinitions);
|
||||
assertTrue(db._collection(vc1) === null);
|
||||
assertTrue(db._collection(vc2) === null);
|
||||
|
||||
try {
|
||||
graph._drop(gN1);
|
||||
} catch(ignore) {
|
||||
}
|
||||
try {
|
||||
graph._drop(gN2);
|
||||
} catch(ignore) {
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
test_editEdgeDefinitionFromExistingGraph3: function() {
|
||||
var prefix = "UnitTestEdgeDefEdit3",
|
||||
gN1 = prefix + "Graph1",
|
||||
gN2 = prefix + "Graph2",
|
||||
ec1 = prefix + "EdgeCol1",
|
||||
ec2 = prefix + "EdgeCol2",
|
||||
vc1 = prefix + "VertexCol1",
|
||||
vc2 = prefix + "VertexCol2",
|
||||
vc3 = prefix + "VertexCol3",
|
||||
vc4 = prefix + "VertexCol4",
|
||||
vc5 = prefix + "VertexCol5";
|
||||
try {
|
||||
graph._drop(gN1);
|
||||
} catch(ignore) {
|
||||
}
|
||||
try {
|
||||
graph._drop(gN2);
|
||||
} catch(ignore) {
|
||||
}
|
||||
|
||||
var dr1 = graph._directedRelationDefinition(ec1, [vc1], [vc1, vc2]),
|
||||
dr2 = graph._directedRelationDefinition(ec1, [vc3], [vc4, vc5]),
|
||||
dr3 = graph._directedRelationDefinition(ec2, [vc2], [vc2, vc3]),
|
||||
g1 = graph._create(gN1, [dr1, dr3]),
|
||||
g2 = graph._create(gN2, [dr1]);
|
||||
|
||||
g1._editEdgeDefinitions(dr2, true);
|
||||
assertEqual([dr2, dr3], g1.__edgeDefinitions);
|
||||
assertEqual([dr2], g2.__edgeDefinitions);
|
||||
assertTrue(db._collection(vc1) === null);
|
||||
assertFalse(db._collection(vc2) === null);
|
||||
|
||||
try {
|
||||
graph._drop(gN1);
|
||||
} catch(ignore) {
|
||||
}
|
||||
try {
|
||||
graph._drop(gN2);
|
||||
} catch(ignore) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -2106,10 +2353,10 @@ function GeneralGraphCommonNeighborsSuite() {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testCommonNeighborsAny: function () {
|
||||
actual = testGraph._listCommonNeighbors(v3 , v6, {direction : 'any'});
|
||||
actual = testGraph._listCommonNeighbors(v3 , v6);
|
||||
assertEqual(actual[0][v3][v6][0]._id , v2);
|
||||
assertEqual(actual[0][v3][v6][1]._id , v7);
|
||||
actual = testGraph._amountCommonNeighbors(v3 , v6, {direction : 'any'});
|
||||
actual = testGraph._amountCommonNeighbors(v3 , v6);
|
||||
assertEqual(actual[0][v3][0][v6] , 2);
|
||||
},
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -2117,7 +2364,7 @@ function GeneralGraphCommonNeighborsSuite() {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testCommonNeighborsIn: function () {
|
||||
actual = testGraph._listCommonNeighbors({} , {}, {direction : 'inbound'});
|
||||
actual = testGraph._listCommonNeighbors({} , {}, {direction : 'inbound'}, {direction : 'inbound'});
|
||||
assertEqual(actual[0][v3][v6][0]._id, v2);
|
||||
assertEqual(actual[1][v5][v8][0]._id, v3);
|
||||
assertEqual(actual[1][v5][v7][0]._id, v3);
|
||||
|
@ -2127,7 +2374,7 @@ function GeneralGraphCommonNeighborsSuite() {
|
|||
assertEqual(actual[4][v8][v5][0]._id, v3);
|
||||
assertEqual(actual[4][v8][v7][0]._id, v3);
|
||||
|
||||
actual = testGraph._amountCommonNeighbors({} , {}, {direction : 'inbound'});
|
||||
actual = testGraph._amountCommonNeighbors({} , {}, {direction : 'inbound'}, {direction : 'inbound'});
|
||||
assertEqual(actual[0][v3][0][v6] , 1);
|
||||
assertEqual(actual[1][v5][0][v8] , 1);
|
||||
assertEqual(actual[1][v5][1][v7] , 1);
|
||||
|
@ -2148,6 +2395,7 @@ function GeneralGraphCommonNeighborsSuite() {
|
|||
testCommonNeighborsOut: function () {
|
||||
actual = testGraph._listCommonNeighbors(
|
||||
{hugo: true}, {heinz: 1},
|
||||
{direction: 'outbound', minDepth: 1, maxDepth: 3},
|
||||
{direction: 'outbound', minDepth: 1, maxDepth: 3}
|
||||
);
|
||||
assertEqual(Object.keys(actual[1])[0], v2);
|
||||
|
@ -2157,17 +2405,18 @@ function GeneralGraphCommonNeighborsSuite() {
|
|||
assertEqual(actual[1][Object.keys(actual[1])[0]][v3].length, 4);
|
||||
|
||||
assertEqual(Object.keys(actual[0])[0], v1);
|
||||
assertEqual(Object.keys(actual[0][Object.keys(actual[0])[0]]), [v3, v8]);
|
||||
assertEqual(Object.keys(actual[0][Object.keys(actual[0])[0]]), [v8, v3]);
|
||||
|
||||
assertEqual(actual[0][Object.keys(actual[0])[0]][v3].length, 4);
|
||||
assertEqual(actual[0][Object.keys(actual[0])[0]][v8].length, 3);
|
||||
|
||||
actual = testGraph._amountCommonNeighbors(
|
||||
{hugo: true }, {heinz: 1},
|
||||
{direction: 'outbound', minDepth: 1, maxDepth: 3},
|
||||
{direction: 'outbound', minDepth: 1, maxDepth: 3}
|
||||
);
|
||||
assertEqual(actual[0][v1][0][v3], 4);
|
||||
assertEqual(actual[0][v1][1][v8], 3);
|
||||
assertEqual(actual[0][v1][0][v8], 3);
|
||||
assertEqual(actual[0][v1][1][v3], 4);
|
||||
assertEqual(actual[1][v2][0][v8], 3);
|
||||
assertEqual(actual[1][v2][1][v3], 4);
|
||||
},
|
||||
|
@ -2248,6 +2497,83 @@ function GeneralGraphCommonNeighborsSuite() {
|
|||
};
|
||||
}
|
||||
|
||||
function VertexCollectionChainedFluentAQLResultsSuite() {
|
||||
var prefix = "UnitTestGraphVertexCollection",
|
||||
g1,
|
||||
g2,
|
||||
gN1 = prefix + "Graph1",
|
||||
gN2 = prefix + "Graph2",
|
||||
eC1 = prefix + "EdgeCollection1",
|
||||
eC2 = prefix + "EdgeCollection2",
|
||||
vC1 = prefix + "VertexCollection1",
|
||||
vC2 = prefix + "VertexCollection2",
|
||||
vC3 = prefix + "VertexCollection3",
|
||||
vC4 = prefix + "VertexCollection4",
|
||||
vC5 = prefix + "VertexCollection5";
|
||||
|
||||
return {
|
||||
|
||||
setUp : function() {
|
||||
try {
|
||||
arangodb.db._collection("_graphs").remove(gN1);
|
||||
} catch (ignore) {
|
||||
}
|
||||
try {
|
||||
arangodb.db._collection("_graphs").remove(gN2);
|
||||
} catch (ignore) {
|
||||
}
|
||||
g1 = graph._create(
|
||||
gN1,
|
||||
graph._edgeDefinitions(
|
||||
graph._directedRelationDefinition(
|
||||
eC1, [vC1], [vC1, vC2]
|
||||
)
|
||||
)
|
||||
);
|
||||
g2 = graph._create(
|
||||
gN2,
|
||||
graph._edgeDefinitions(
|
||||
graph._directedRelationDefinition(
|
||||
eC2, [vC3], [vC1]
|
||||
)
|
||||
)
|
||||
);
|
||||
},
|
||||
|
||||
tearDown : function() {
|
||||
graph._drop(gN1);
|
||||
graph._drop(gN2);
|
||||
try {db[vC4].drop()} catch (e) {}
|
||||
},
|
||||
|
||||
test_addVertexCollection1: function() {
|
||||
g1._addVertexCollection(vC1, false);
|
||||
assertEqual(g1._getVertexCollections(), [vC1]);
|
||||
},
|
||||
|
||||
test_addVertexCollection2: function() {
|
||||
try {
|
||||
g1._addVertexCollection(vC4, false);
|
||||
} catch (e) {
|
||||
assertEqual(e.errorNum, ERRORS.ERROR_GRAPH_VERTEX_COL_DOES_NOT_EXIST.code);
|
||||
assertEqual(e.errorMessage, vC4 + ERRORS.ERROR_GRAPH_VERTEX_COL_DOES_NOT_EXIST.message);
|
||||
}
|
||||
assertTrue(db._collection(vC4) === null);
|
||||
assertEqual(g1._getVertexCollections(), []);
|
||||
},
|
||||
|
||||
test_addVertexCollection3: function() {
|
||||
g1._addVertexCollection(vC4);
|
||||
assertEqual(g1._getVertexCollections(), [vC4]);
|
||||
assertTrue(db._collection(vC4) !== null);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- main
|
||||
|
@ -2262,6 +2588,7 @@ jsunity.run(GeneralGraphAQLQueriesSuite);
|
|||
jsunity.run(EdgesAndVerticesSuite);
|
||||
jsunity.run(GeneralGraphCreationSuite);
|
||||
jsunity.run(ChainedFluentAQLResultsSuite);
|
||||
jsunity.run(VertexCollectionChainedFluentAQLResultsSuite);
|
||||
|
||||
return jsunity.done();
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -30,10 +30,9 @@
|
|||
/// @author Copyright 2014, triAGENS GmbH, Cologne, Germany
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
var internal = require("internal");
|
||||
var cluster = require("org/arangodb/cluster");
|
||||
var fs = require("fs");
|
||||
var db = internal.db;
|
||||
var db = require("org/arangodb").db;
|
||||
var console = require("console");
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
@ -124,7 +123,7 @@ exports.databaseVersion = function () {
|
|||
}
|
||||
|
||||
// path to the VERSION file
|
||||
var versionFile = internal.db._path() + "/VERSION";
|
||||
var versionFile = db._path() + "/VERSION";
|
||||
var lastVersion = null;
|
||||
|
||||
// VERSION file exists, read its contents
|
||||
|
@ -152,11 +151,11 @@ exports.databaseVersion = function () {
|
|||
}
|
||||
|
||||
// extract server version
|
||||
var currentServerVersion = internal.db._version().match(/^(\d+\.\d+).*$/);
|
||||
var currentServerVersion = db._version().match(/^(\d+\.\d+).*$/);
|
||||
|
||||
// server version is invalid for some reason
|
||||
if (! currentServerVersion) {
|
||||
logger.error("Unexpected ArangoDB server version: " + internal.db._version());
|
||||
logger.error("Unexpected ArangoDB server version: " + db._version());
|
||||
return { result: exports.NO_SERVER_VERSION };
|
||||
}
|
||||
|
||||
|
|
|
@ -340,9 +340,9 @@ function ahuacatlQueryGeneralCommonTestSuite() {
|
|||
/// @brief checks GRAPH_COMMON_NEIGHBORS()
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testEdgesIn: function () {
|
||||
testCommonNeighborsIn: function () {
|
||||
|
||||
actual = getQueryResults("FOR e IN GRAPH_COMMON_NEIGHBORS('bla3', {} , {}, {direction : 'inbound'}) SORT ATTRIBUTES(e)[0] RETURN e");
|
||||
actual = getQueryResults("FOR e IN GRAPH_COMMON_NEIGHBORS('bla3', {} , {}, {direction : 'inbound'}, {direction : 'inbound'}) SORT ATTRIBUTES(e)[0] RETURN e");
|
||||
assertEqual(actual[0]["UnitTestsAhuacatlVertex1/v3"]["UnitTestsAhuacatlVertex2/v6"][0]._id, "UnitTestsAhuacatlVertex1/v2");
|
||||
assertEqual(actual[1]["UnitTestsAhuacatlVertex2/v5"]["UnitTestsAhuacatlVertex2/v8"][0]._id, "UnitTestsAhuacatlVertex1/v3");
|
||||
assertEqual(actual[1]["UnitTestsAhuacatlVertex2/v5"]["UnitTestsAhuacatlVertex2/v7"][0]._id, "UnitTestsAhuacatlVertex1/v3");
|
||||
|
@ -362,8 +362,9 @@ function ahuacatlQueryGeneralCommonTestSuite() {
|
|||
/// @brief checks GRAPH_COMMON_NEIGHBORS()
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testEdgesOut: function () {
|
||||
actual = getQueryResults("FOR e IN GRAPH_COMMON_NEIGHBORS('bla3', { hugo : true } , {heinz : 1}, {direction : 'outbound', minDepth : 1, maxDepth : 3}) SORT e RETURN e");
|
||||
testCommonNeighborsOut: function () {
|
||||
actual = getQueryResults("FOR e IN GRAPH_COMMON_NEIGHBORS('bla3', { hugo : true } , {heinz : 1}, " +
|
||||
" {direction : 'outbound', minDepth : 1, maxDepth : 3}, {direction : 'outbound', minDepth : 1, maxDepth : 3}) SORT e RETURN e");
|
||||
assertEqual(Object.keys(actual[0])[0], "UnitTestsAhuacatlVertex1/v2");
|
||||
assertEqual(Object.keys(actual[0][Object.keys(actual[0])[0]]), ["UnitTestsAhuacatlVertex2/v8", "UnitTestsAhuacatlVertex1/v3"]);
|
||||
|
||||
|
@ -371,13 +372,39 @@ function ahuacatlQueryGeneralCommonTestSuite() {
|
|||
assertEqual(actual[0][Object.keys(actual[0])[0]]["UnitTestsAhuacatlVertex1/v3"].length, 4);
|
||||
|
||||
assertEqual(Object.keys(actual[1])[0], "UnitTestsAhuacatlVertex1/v1");
|
||||
assertEqual(Object.keys(actual[1][Object.keys(actual[1])[0]]), ["UnitTestsAhuacatlVertex1/v3", "UnitTestsAhuacatlVertex2/v8"]);
|
||||
assertEqual(Object.keys(actual[1][Object.keys(actual[1])[0]]), ["UnitTestsAhuacatlVertex2/v8", "UnitTestsAhuacatlVertex1/v3"]);
|
||||
|
||||
assertEqual(actual[1][Object.keys(actual[1])[0]]["UnitTestsAhuacatlVertex1/v3"].length, 4);
|
||||
assertEqual(actual[1][Object.keys(actual[1])[0]]["UnitTestsAhuacatlVertex2/v8"].length, 3);
|
||||
|
||||
},
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief checks GRAPH_COMMON_NEIGHBORS()
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testCommonNeighborsMixedOptions: function () {
|
||||
actual = getQueryResults("FOR e IN GRAPH_COMMON_NEIGHBORS('bla3', {} , {}, " +
|
||||
"{direction : 'outbound', vertexCollectionRestriction : 'UnitTestsAhuacatlVertex1'}, " +
|
||||
"{direction : 'inbound', minDepth : 1, maxDepth : 2, vertexCollectionRestriction : 'UnitTestsAhuacatlVertex2'}) SORT e RETURN e");
|
||||
assertEqual(Object.keys(actual[0])[0], "UnitTestsAhuacatlVertex1/v2");
|
||||
assertEqual(Object.keys(actual[0][Object.keys(actual[0])[0]]), ["UnitTestsAhuacatlVertex2/v5", "UnitTestsAhuacatlVertex2/v8", "UnitTestsAhuacatlVertex2/v7"]);
|
||||
|
||||
assertEqual(actual[0][Object.keys(actual[0])[0]]["UnitTestsAhuacatlVertex2/v5"].length, 1);
|
||||
assertEqual(actual[0][Object.keys(actual[0])[0]]["UnitTestsAhuacatlVertex2/v8"].length, 1);
|
||||
assertEqual(actual[0][Object.keys(actual[0])[0]]["UnitTestsAhuacatlVertex2/v7"].length, 2);
|
||||
|
||||
assertEqual(Object.keys(actual[1])[0], "UnitTestsAhuacatlVertex1/v1");
|
||||
assertEqual(Object.keys(actual[1][Object.keys(actual[1])[0]]), ["UnitTestsAhuacatlVertex2/v6", "UnitTestsAhuacatlVertex2/v5", "UnitTestsAhuacatlVertex2/v8", "UnitTestsAhuacatlVertex2/v7"]);
|
||||
|
||||
assertEqual(actual[1][Object.keys(actual[1])[0]]["UnitTestsAhuacatlVertex2/v6"].length, 1);
|
||||
assertEqual(actual[1][Object.keys(actual[1])[0]]["UnitTestsAhuacatlVertex2/v5"].length, 1);
|
||||
assertEqual(actual[1][Object.keys(actual[1])[0]]["UnitTestsAhuacatlVertex2/v8"].length, 1);
|
||||
assertEqual(actual[1][Object.keys(actual[1])[0]]["UnitTestsAhuacatlVertex2/v7"].length, 1);
|
||||
|
||||
},
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief checks GRAPH_COMMON_PROPERTIES()
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -2064,10 +2091,10 @@ function ahuacatlQueryGeneralCycleSSuite() {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief executes the test suite
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
jsunity.run(ahuacatlQueryGeneralCommonTestSuite);
|
||||
jsunity.run(ahuacatlQueryGeneralCycleSSuite);
|
||||
jsunity.run(ahuacatlQueryGeneralTraversalTestSuite);
|
||||
jsunity.run(ahuacatlQueryGeneralPathsTestSuite);
|
||||
jsunity.run(ahuacatlQueryGeneralCommonTestSuite);
|
||||
jsunity.run(ahuacatlQueryGeneralEdgesTestSuite);
|
||||
|
||||
|
||||
|
|
|
@ -129,6 +129,7 @@ ERROR_ARANGO_INDEX_CREATION_FAILED,1235,"index creation failed","Will be raised
|
|||
################################################################################
|
||||
|
||||
ERROR_ARANGO_DATAFILE_FULL,1300,"datafile full","Will be raised when the datafile reaches its limit."
|
||||
ERROR_ARANGO_EMPTY_DATADIR,1301,"server database directory is empty","Will be raised when encoutering an empty server database directory."
|
||||
|
||||
################################################################################
|
||||
## ArangoDB replication errors
|
||||
|
@ -286,6 +287,13 @@ ERROR_GRAPH_COULD_NOT_CREATE_EDGE,1907,"could not create edge","Will be raised w
|
|||
ERROR_GRAPH_COULD_NOT_CHANGE_EDGE,1908,"could not change edge","Will be raised when the edge could not be changed."
|
||||
ERROR_GRAPH_TOO_MANY_ITERATIONS,1909,"too many iterations","Will be raised when too many iterations are done in a graph traversal."
|
||||
ERROR_GRAPH_INVALID_FILTER_RESULT,1910,"invalid filter result","Will be raised when an invalid filter result is returned in a graph traversal."
|
||||
ERROR_GRAPH_COLLECTION_MULTI_USE,1920,"multi use of edge collection in edge def","an edge collection may only be used once in one edge definition of a graph.",
|
||||
ERROR_GRAPH_COLLECTION_USE_IN_MULTI_GRAPHS,1921,"edge collection already used in edge def"," is already used by another graph in a different edge definition.",
|
||||
ERROR_GRAPH_CREATE_MISSING_NAME,1922,"missing graph name","a graph name is required to create a graph.",
|
||||
ERROR_GRAPH_CREATE_MALFORMED_EDGE_DEFINITION,1923,"malformed edge def","the edge definition is malformed. It has to be an array of objects.",
|
||||
ERROR_GRAPH_NOT_FOUND,1924,"graph not found","a graph with this name could not be found.",
|
||||
ERROR_GRAPH_DUPLICATE,1925,"graph already exists","a graph with this name already exists.",
|
||||
ERROR_GRAPH_VERTEX_COL_DOES_NOT_EXIST,1926,"collection does not exist"," does not exist.",
|
||||
|
||||
################################################################################
|
||||
## Session errors
|
||||
|
|
|
@ -100,6 +100,7 @@ void TRI_InitialiseErrorMessages (void) {
|
|||
REG_ERROR(ERROR_ARANGO_INDEX_DOCUMENT_ATTRIBUTE_MISSING, "index insertion warning - attribute missing in document");
|
||||
REG_ERROR(ERROR_ARANGO_INDEX_CREATION_FAILED, "index creation failed");
|
||||
REG_ERROR(ERROR_ARANGO_DATAFILE_FULL, "datafile full");
|
||||
REG_ERROR(ERROR_ARANGO_EMPTY_DATADIR, "server database directory is empty");
|
||||
REG_ERROR(ERROR_REPLICATION_NO_RESPONSE, "no response");
|
||||
REG_ERROR(ERROR_REPLICATION_INVALID_RESPONSE, "invalid response");
|
||||
REG_ERROR(ERROR_REPLICATION_MASTER_ERROR, "master error");
|
||||
|
@ -202,6 +203,13 @@ void TRI_InitialiseErrorMessages (void) {
|
|||
REG_ERROR(ERROR_GRAPH_COULD_NOT_CHANGE_EDGE, "could not change edge");
|
||||
REG_ERROR(ERROR_GRAPH_TOO_MANY_ITERATIONS, "too many iterations");
|
||||
REG_ERROR(ERROR_GRAPH_INVALID_FILTER_RESULT, "invalid filter result");
|
||||
REG_ERROR(ERROR_GRAPH_COLLECTION_MULTI_USE, "multi use of edge collection in edge def");
|
||||
REG_ERROR(ERROR_GRAPH_COLLECTION_USE_IN_MULTI_GRAPHS, "edge collection already used in edge def");
|
||||
REG_ERROR(ERROR_GRAPH_CREATE_MISSING_NAME, "missing graph name");
|
||||
REG_ERROR(ERROR_GRAPH_CREATE_MALFORMED_EDGE_DEFINITION, "malformed edge def");
|
||||
REG_ERROR(ERROR_GRAPH_NOT_FOUND, "graph not found");
|
||||
REG_ERROR(ERROR_GRAPH_DUPLICATE, "graph already exists");
|
||||
REG_ERROR(ERROR_GRAPH_VERTEX_COL_DOES_NOT_EXIST, "collection does not exist");
|
||||
REG_ERROR(ERROR_SESSION_UNKNOWN, "unknown session");
|
||||
REG_ERROR(ERROR_SESSION_EXPIRED, "session expired");
|
||||
REG_ERROR(SIMPLE_CLIENT_UNKNOWN_ERROR, "unknown client error");
|
||||
|
|
|
@ -213,6 +213,8 @@ extern "C" {
|
|||
/// Will be raised when an attempt to create an index has failed.
|
||||
/// - 1300: @LIT{datafile full}
|
||||
/// Will be raised when the datafile reaches its limit.
|
||||
/// - 1301: @LIT{server database directory is empty}
|
||||
/// Will be raised when encoutering an empty server database directory.
|
||||
/// - 1400: @LIT{no response}
|
||||
/// Will be raised when the replication applier does not receive any or an
|
||||
/// incomplete response from the master.
|
||||
|
@ -477,6 +479,21 @@ extern "C" {
|
|||
/// - 1910: @LIT{invalid filter result}
|
||||
/// Will be raised when an invalid filter result is returned in a graph
|
||||
/// traversal.
|
||||
/// - 1920: @LIT{multi use of edge collection in edge def}
|
||||
/// an edge collection may only be used once in one edge definition of a
|
||||
/// graph.
|
||||
/// - 1921: @LIT{edge collection already used in edge def}
|
||||
/// is already used by another graph in a different edge definition.
|
||||
/// - 1922: @LIT{missing graph name}
|
||||
/// a graph name is required to create a graph.
|
||||
/// - 1923: @LIT{malformed edge def}
|
||||
/// the edge definition is malformed. It has to be an array of objects.
|
||||
/// - 1924: @LIT{graph not found}
|
||||
/// a graph with this name could not be found.
|
||||
/// - 1925: @LIT{graph already exists}
|
||||
/// a graph with this name already exists.
|
||||
/// - 1926: @LIT{collection does not exist}
|
||||
/// does not exist.
|
||||
/// - 1950: @LIT{unknown session}
|
||||
/// Will be raised when an invalid/unknown session id is passed to the server.
|
||||
/// - 1951: @LIT{session expired}
|
||||
|
@ -1444,6 +1461,16 @@ void TRI_InitialiseErrorMessages (void);
|
|||
|
||||
#define TRI_ERROR_ARANGO_DATAFILE_FULL (1300)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief 1301: ERROR_ARANGO_EMPTY_DATADIR
|
||||
///
|
||||
/// server database directory is empty
|
||||
///
|
||||
/// Will be raised when encoutering an empty server database directory.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define TRI_ERROR_ARANGO_EMPTY_DATADIR (1301)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief 1400: ERROR_REPLICATION_NO_RESPONSE
|
||||
///
|
||||
|
@ -2517,6 +2544,76 @@ void TRI_InitialiseErrorMessages (void);
|
|||
|
||||
#define TRI_ERROR_GRAPH_INVALID_FILTER_RESULT (1910)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief 1920: ERROR_GRAPH_COLLECTION_MULTI_USE
|
||||
///
|
||||
/// multi use of edge collection in edge def
|
||||
///
|
||||
/// an edge collection may only be used once in one edge definition of a graph.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define TRI_ERROR_GRAPH_COLLECTION_MULTI_USE (1920)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief 1921: ERROR_GRAPH_COLLECTION_USE_IN_MULTI_GRAPHS
|
||||
///
|
||||
/// edge collection already used in edge def
|
||||
///
|
||||
/// is already used by another graph in a different edge definition.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define TRI_ERROR_GRAPH_COLLECTION_USE_IN_MULTI_GRAPHS (1921)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief 1922: ERROR_GRAPH_CREATE_MISSING_NAME
|
||||
///
|
||||
/// missing graph name
|
||||
///
|
||||
/// a graph name is required to create a graph.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define TRI_ERROR_GRAPH_CREATE_MISSING_NAME (1922)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief 1923: ERROR_GRAPH_CREATE_MALFORMED_EDGE_DEFINITION
|
||||
///
|
||||
/// malformed edge def
|
||||
///
|
||||
/// the edge definition is malformed. It has to be an array of objects.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define TRI_ERROR_GRAPH_CREATE_MALFORMED_EDGE_DEFINITION (1923)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief 1924: ERROR_GRAPH_NOT_FOUND
|
||||
///
|
||||
/// graph not found
|
||||
///
|
||||
/// a graph with this name could not be found.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define TRI_ERROR_GRAPH_NOT_FOUND (1924)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief 1925: ERROR_GRAPH_DUPLICATE
|
||||
///
|
||||
/// graph already exists
|
||||
///
|
||||
/// a graph with this name already exists.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define TRI_ERROR_GRAPH_DUPLICATE (1925)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief 1926: ERROR_GRAPH_VERTEX_COL_DOES_NOT_EXIST
|
||||
///
|
||||
/// collection does not exist
|
||||
///
|
||||
/// does not exist.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define TRI_ERROR_GRAPH_VERTEX_COL_DOES_NOT_EXIST (1926)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief 1950: ERROR_SESSION_UNKNOWN
|
||||
///
|
||||
|
|
Loading…
Reference in New Issue