1
0
Fork 0

Merge branch 'devel' of https://github.com/triAGENS/ArangoDB into devel

This commit is contained in:
scottashton 2014-06-05 16:59:53 +02:00
commit e6b4fff2f4
22 changed files with 322 additions and 273 deletions

View File

@ -3,6 +3,11 @@ v2.2.0 (XXXX-XX-XX)
* added mountedApp function for foxx-manager * added mountedApp function for foxx-manager
* fixed issue #883: arango 2.1 - when starting multi-machine cluster, UI web
does not change to cluster overview
* fixed dfdb: should not start any other V8 threads
* cleanup of version-check, added module org/arangodb/database-version, * cleanup of version-check, added module org/arangodb/database-version,
added --check-version option added --check-version option

View File

@ -3,6 +3,7 @@ all: build-books
.PHONY: md-files .PHONY: md-files
MDPP_FILES = $(wildcard *.mdpp */*.mdpp */*/*.mdpp) MDPP_FILES = $(wildcard *.mdpp */*.mdpp */*/*.mdpp)
MD_FILES = $(wildcard Users/*/*.md)
md-files: md-files:
@for file in $(basename $(MDPP_FILES)); do echo "converting $${file}.mdpp"; markdown-pp.py $${file}.mdpp $${file}.md; done @for file in $(basename $(MDPP_FILES)); do echo "converting $${file}.mdpp"; markdown-pp.py $${file}.mdpp $${file}.md; done
@ -18,3 +19,5 @@ build-book:
@test -d books/$(NAME) || mkdir books/$(NAME) @test -d books/$(NAME) || mkdir books/$(NAME)
cd $(NAME) && gitbook build -o ../books/$(NAME) cd $(NAME) && gitbook build -o ../books/$(NAME)
cp Users/arangodb_logo2.png books/Users/ cp Users/arangodb_logo2.png books/Users/
@for file in $(basename $(MD_FILES)); do echo "remove $${file}.md";rm $${file}.md;done

View File

@ -1,32 +0,0 @@
!CHAPTER Address of a Collection
All collections in ArangoDB have an unique identifier and an unique
name. ArangoDB internally uses the collection's unique identifier to look up
collections. This identifier, however, is managed by ArangoDB and the user has
no control over it. In order to allow users to use their own names, each collection
also has an unique name which is specified by the user. To access a collection
from the user perspective, the collection name should be used, i.e.:
*db._collection(collection-name)*
A collection is created by a ["db._create"](../Collections/DatabaseMethods.md) call.
For example: Assume that the collection identifier is `7254820` and the name is
`demo`, then the collection can be accessed as:
db._collection("demo")
If no collection with such a name exists, then *null* is returned.
There is a short-cut that can be used for non-system collections:
*db.collection-name*
This call will either return the collection named *db.collection-name* or create
a new one with that name and a set of default properties.
Note: Creating a collection on the fly using *db.collection-name* is
not recommend and does not work in _arangosh_. To create a new collection, please
use
*db._create(collection-name)*

View File

@ -1,6 +1,7 @@
!CHAPTER Collection Methods !CHAPTER Collection Methods
`collection.drop()` `collection.drop()`
Drops a collection and all its indexes. Drops a collection and all its indexes.
*Examples* *Examples*

View File

@ -8,3 +8,39 @@ The most import call is the call to create a new collection
<!-- <!--
, see @ref HandlingCollectionsCreate "db._create". , see @ref HandlingCollectionsCreate "db._create".
--> -->
!SECTION Address of a Collection
All collections in ArangoDB have an unique identifier and an unique
name. ArangoDB internally uses the collection's unique identifier to look up
collections. This identifier, however, is managed by ArangoDB and the user has
no control over it. In order to allow users to use their own names, each collection
also has an unique name which is specified by the user. To access a collection
from the user perspective, the collection name should be used, i.e.:
`db._collection(collection-name)``
A collection is created by a ["db._create"](../Collections/DatabaseMethods.md) call.
For example: Assume that the collection identifier is `7254820` and the name is
`demo`, then the collection can be accessed as:
db._collection("demo")
If no collection with such a name exists, then *null* is returned.
There is a short-cut that can be used for non-system collections:
*db.collection-name*
This call will either return the collection named *db.collection-name* or create
a new one with that name and a set of default properties.
Note: Creating a collection on the fly using *db.collection-name* is
not recommend and does not work in _arangosh_. To create a new collection, please
use
`db._create(collection-name)`
This call will create a new collection called *collection-name*.

View File

@ -1,10 +1,12 @@
!CHAPTER Notes about Databases !CHAPTER Notes about Databases
Please keep in mind that each database contains its own system collections, Please keep in mind that each database contains its own system collections,
which need to set up when a database is created. This will make the creation which need to set up when a database is created. This will make the creation of a database take a while.
of a database take a while. Replication is configured on a per-database level,
meaning that any replication logging or applying for a new database must Replication is configured on a per-database level, meaning that any replication logging or applying for a new database must
be configured explicitly after a new database has been created. Foxx applications be configured explicitly after a new database has been created.
Foxx applications
are also available only in the context of the database they have been installed are also available only in the context of the database they have been installed
in. A new database will only provide access to the system applications shipped in. A new database will only provide access to the system applications shipped
with ArangoDB (that is the web interface at the moment) and no other Foxx with ArangoDB (that is the web interface at the moment) and no other Foxx

View File

@ -1,10 +1,19 @@
!CHAPTER Fluent AQL Interface !CHAPTER Fluent AQL Interface
TODO: write intro This chapter describes a fluent interface to query your graph.
The philosophy of this interface is to at first select a group of starting elements (vertices or edges) and from there on explore the graph with your query by selecting connected elements.
As an example you can start with a set of vertices, select their direct neighbors and finally their outgoing edges.
The result of this query will be the set of outgoing edges.
For each part of the query it is possible to further refine the resulting set of elements by giving examples for them.
!SECTION Starting Points !SECTION Starting Points
TODO: write intro This section describes the entry points for the fluent interface.
In the philosophy of this module you have to start with a specific subset of vertices or edges and from there on iterate over the graph.
Therefore you get exactly this two entry points:
* Select a set of edges
* Select a set of vertices
!SUBSECTION Edges !SUBSECTION Edges
@ -24,7 +33,7 @@ The resulting set of edges can be filtered by defining one or more `examples`.
* A string, only the edge having this value as it's id is returned. * A string, only the edge having this value as it's id is returned.
* An example object, defining a set of attributes. * An example object, defining a set of attributes.
Only edges having these attributes are matched. Only edges having these attributes are matched.
* A list containing example objects andor strings. * A list containing example objects and/or strings.
All edges matching at least one of the elements in the list are returned. All edges matching at least one of the elements in the list are returned.
<br /> <br />
@EXAMPLES @EXAMPLES
@ -67,7 +76,7 @@ The resulting set of edges can be filtered by defining one or more `examples`.
* A string, only the vertex having this value as it's id is returned. * A string, only the vertex having this value as it's id is returned.
* An example object, defining a set of attributes. * An example object, defining a set of attributes.
Only vertices having these attributes are matched. Only vertices having these attributes are matched.
* A list containing example objects andor strings. * A list containing example objects and/or strings.
All vertices matching at least one of the elements in the list are returned. All vertices matching at least one of the elements in the list are returned.
<br /> <br />
@EXAMPLES @EXAMPLES
@ -92,7 +101,13 @@ g._vertices([{name: "Alice"}, {name: "Bob"}]).toArray();
@END_EXAMPLE_ARANGOSH_OUTPUT @END_EXAMPLE_ARANGOSH_OUTPUT
<!-- @endDocuBlock --> <!-- @endDocuBlock -->
!SECTION Fluent query options !SECTION Working with the query cursor
The fluent query object handles cursor creation and maintenance for you.
A cursor will be created as soon as you request the first result.
If you are unhappy with the current result and want to refine it further you can execute a further step in the query which cleans up the cursor for you.
In this interface you get the complete functionality available for general AQL cursors directly on your query.
The cursor functionality is described in this section.
!SUBSECTION ToArray !SUBSECTION ToArray
@ -219,6 +234,13 @@ query.count();
@END_EXAMPLE_ARANGOSH_OUTPUT @END_EXAMPLE_ARANGOSH_OUTPUT
<!-- @endDocuBlock --> <!-- @endDocuBlock -->
!SECTION Fluent queries
After the selection of the entry point you can now query your graph in
a fluent way, meaning each of the functions on your query returns the query again.
Hence it is possible to chain arbitrary many executions one after the other.
In this section all available query statements are described.
!SUBSECTION Edges !SUBSECTION Edges
<!-- @startDocuBlock JSF_general_graph_fluent_aql_edges --> <!-- @startDocuBlock JSF_general_graph_fluent_aql_edges -->
@ -236,7 +258,7 @@ The resulting set of edges can be filtered by defining one or more `examples`.
* A string, only the edge having this value as it's id is returned. * A string, only the edge having this value as it's id is returned.
* An example object, defining a set of attributes. * An example object, defining a set of attributes.
Only edges having these attributes are matched. Only edges having these attributes are matched.
* A list containing example objects andor strings. * A list containing example objects and/or strings.
All edges matching at least one of the elements in the list are returned. All edges matching at least one of the elements in the list are returned.
<br /> <br />
@EXAMPLES @EXAMPLES
@ -287,7 +309,7 @@ The resulting set of edges can be filtered by defining one or more `examples`.
* A string, only the edge having this value as it's id is returned. * A string, only the edge having this value as it's id is returned.
* An example object, defining a set of attributes. * An example object, defining a set of attributes.
Only edges having these attributes are matched. Only edges having these attributes are matched.
* A list containing example objects andor strings. * A list containing example objects and/or strings.
All edges matching at least one of the elements in the list are returned. All edges matching at least one of the elements in the list are returned.
<br /> <br />
@EXAMPLES @EXAMPLES
@ -338,7 +360,7 @@ The resulting set of edges can be filtered by defining one or more `examples`.
* A string, only the edge having this value as it's id is returned. * A string, only the edge having this value as it's id is returned.
* An example object, defining a set of attributes. * An example object, defining a set of attributes.
Only edges having these attributes are matched. Only edges having these attributes are matched.
* A list containing example objects andor strings. * A list containing example objects and/or strings.
All edges matching at least one of the elements in the list are returned. All edges matching at least one of the elements in the list are returned.
<br /> <br />
@EXAMPLES @EXAMPLES
@ -390,7 +412,7 @@ The resulting set of vertices can be filtered by defining one or more `examples`
* A string, only the vertex having this value as it's id is returned. * A string, only the vertex having this value as it's id is returned.
* An example object, defining a set of attributes. * An example object, defining a set of attributes.
Only vertices having these attributes are matched. Only vertices having these attributes are matched.
* A list containing example objects andor strings. * A list containing example objects and/or strings.
All vertices matching at least one of the elements in the list are returned. All vertices matching at least one of the elements in the list are returned.
<br /> <br />
@EXAMPLES @EXAMPLES
@ -442,7 +464,7 @@ The resulting set of vertices can be filtered by defining one or more `examples`
* A string, only the vertex having this value as it's id is returned. * A string, only the vertex having this value as it's id is returned.
* An example object, defining a set of attributes. * An example object, defining a set of attributes.
Only vertices having these attributes are matched. Only vertices having these attributes are matched.
* A list containing example objects andor strings. * A list containing example objects and/or strings.
All vertices matching at least one of the elements in the list are returned. All vertices matching at least one of the elements in the list are returned.
<br /> <br />
@EXAMPLES @EXAMPLES
@ -494,7 +516,7 @@ The resulting set of vertices can be filtered by defining one or more `examples`
* A string, only the vertex having this value as it's id is returned. * A string, only the vertex having this value as it's id is returned.
* An example object, defining a set of attributes. * An example object, defining a set of attributes.
Only vertices having these attributes are matched. Only vertices having these attributes are matched.
* A list containing example objects andor strings. * A list containing example objects and/or strings.
All vertices matching at least one of the elements in the list are returned. All vertices matching at least one of the elements in the list are returned.
<br /> <br />
@EXAMPLES @EXAMPLES
@ -545,7 +567,7 @@ The resulting set of vertices can be filtered by defining one or more `examples`
* A string, only the vertex having this value as it's id is returned. * A string, only the vertex having this value as it's id is returned.
* An example object, defining a set of attributes. * An example object, defining a set of attributes.
Only vertices having these attributes are matched. Only vertices having these attributes are matched.
* A list containing example objects andor strings. * A list containing example objects and/or strings.
All vertices matching at least one of the elements in the list are returned. All vertices matching at least one of the elements in the list are returned.
<br /> <br />
@EXAMPLES @EXAMPLES
@ -643,7 +665,7 @@ The result set is reduced to the set of elements that matches the given `example
* A string, only the elements having this value as it's id is returned. * A string, only the elements having this value as it's id is returned.
* An example object, defining a set of attributes. * An example object, defining a set of attributes.
Only elements having these attributes are matched. Only elements having these attributes are matched.
* A list containing example objects andor strings. * A list containing example objects and/or strings.
All elements matching at least one of the elements in the list are returned. All elements matching at least one of the elements in the list are returned.
<br /> <br />
@EXAMPLES @EXAMPLES

View File

@ -0,0 +1,6 @@
!CHAPTER General Graphs
This chapter describes the multi-collection graph module.
It allows you to define a graph that is spread across several edge and document collections.
This allows you to structure your models in line with your domain and group them logically in collections and giving you the power to query them in the same graph queries.
There is no need to include the referenced collections within the query, this module will handle it for you.

View File

@ -36,7 +36,6 @@ If you have any questions don't hesitate to ask on:
- [github](https://github.com/triAGENS/ArangoDB/issues) - [github](https://github.com/triAGENS/ArangoDB/issues)
- [google groups](https://groups.google.com/forum/?hl=de#!forum/arangodb) - [google groups](https://groups.google.com/forum/?hl=de#!forum/arangodb)
or
- [stackoverflow](http://stackoverflow.com/questions/tagged/arangodb) - [stackoverflow](http://stackoverflow.com/questions/tagged/arangodb)
We will respond as soon as possible. We will respond as soon as possible.

View File

@ -24,7 +24,6 @@
* [Notes about Databases](Databases/Notes.md) * [Notes about Databases](Databases/Notes.md)
<!-- 6 --> <!-- 6 -->
* [Handling Collections](Collections/README.md) * [Handling Collections](Collections/README.md)
* [Address of a Collection](Collections/CollectionAddress.md)
* [Collection Methods](Collections/CollectionMethods.md) * [Collection Methods](Collections/CollectionMethods.md)
* [Database Methods](Collections/DatabaseMethods.md) * [Database Methods](Collections/DatabaseMethods.md)
<!-- 7 --> <!-- 7 -->
@ -68,6 +67,7 @@
* [Edge Methods](Blueprint-Graphs/EdgeMethods.md) * [Edge Methods](Blueprint-Graphs/EdgeMethods.md)
<!-- 13.5 --> <!-- 13.5 -->
* [General-Graphs](General-Graphs/README.md) * [General-Graphs](General-Graphs/README.md)
* [Graph Functions](General-Graphs/GeneralGraphFunctions.md)
* [Fluent AQL Interface](General-Graphs/FluentAQLInterface.md) * [Fluent AQL Interface](General-Graphs/FluentAQLInterface.md)
<!-- 14 --> <!-- 14 -->
* [Traversals](Traversals/README.md) * [Traversals](Traversals/README.md)

View File

@ -1,6 +1,7 @@
import os import os
import inspect import inspect
def file_content(filepath): def file_content(filepath):
""" Fetches and formats file's content to perform the required operation. """ Fetches and formats file's content to perform the required operation.
""" """
@ -28,7 +29,7 @@ def fetch_comments(dirpath):
""" """
comments_filename = "allComments.txt" comments_filename = "allComments.txt"
fh = open(comments_filename, "w") fh = open(comments_filename, "a")
for root, directories, files in os.walk(dirpath): for root, directories, files in os.walk(dirpath):
for filename in files: for filename in files:
@ -37,7 +38,7 @@ def fetch_comments(dirpath):
for comment in file_comments: for comment in file_comments:
fh.write("\n<!-- filename: %s -->\n" % filename) fh.write("\n<!-- filename: %s -->\n" % filename)
for _com in comment: for _com in comment:
_text = _com.replace("/", "") _text = _com.replace("///", "")
if len(_text.strip()) == 0: if len(_text.strip()) == 0:
_text = _text.replace("\n", "<br />") _text = _text.replace("\n", "<br />")
_text = _text.strip() _text = _text.strip()
@ -51,5 +52,15 @@ def fetch_comments(dirpath):
fh.close() fh.close()
if __name__ == "__main__": if __name__ == "__main__":
dirpath = "/Users/Thomas/code/ArangoDB" open("allComments.txt", "w").close()
fetch_comments(dirpath) path = ["arangod/cluster","arangod/RestHandler","arangod/V8Server",
"lib/Admin","lib/HttpServer",
"js/actions","js/client","js/apps","js/common","js/server"]
for i in path:
dirpath = os.path.abspath(os.path.join(os.path.dirname( __file__ ), os.pardir,"ArangoDB/../../"+i))
fetch_comments(dirpath)
print dirpath
os.path.abspath(os.path.join(os.path.dirname( __file__ ), '..', 'templates'))

View File

@ -170,7 +170,8 @@ noinst_LIBRARIES = \
lib/libarango.a \ lib/libarango.a \
lib/libarango_v8.a \ lib/libarango_v8.a \
lib/libarango_fe.a \ lib/libarango_fe.a \
lib/libarango_client.a lib/libarango_client.a \
arangod/libarangod.a
if ENABLE_MRUBY if ENABLE_MRUBY
noinst_LIBRARIES += lib/libarango_mruby.a noinst_LIBRARIES += lib/libarango_mruby.a

View File

@ -157,7 +157,7 @@ static int HashIndexHelper (TRI_hash_index_t const* hashIndex,
acc = TRI_FindAccessorVocShaper(shaper, shapedJson._sid, path); acc = TRI_FindAccessorVocShaper(shaper, shapedJson._sid, path);
// field not part of the object // field not part of the object
if (acc == NULL || acc->_shape == NULL) { if (acc == NULL || acc->_resultSid == 0) {
shapedSub._sid = TRI_LookupBasicSidShaper(TRI_SHAPE_NULL); shapedSub._sid = TRI_LookupBasicSidShaper(TRI_SHAPE_NULL);
shapedSub._length = 0; shapedSub._length = 0;
shapedSub._offset = 0; shapedSub._offset = 0;

View File

@ -1,25 +1,18 @@
# -*- mode: Makefile; -*- # -*- mode: Makefile; -*-
################################################################################ ## -----------------------------------------------------------------------------
## --SECTION-- PROGRAM ## --SECTION-- LIBRARY
################################################################################ ## -----------------------------------------------------------------------------
################################################################################ ################################################################################
### @brief program "arangod" ### @brief library "libarangod.a"
################################################################################ ################################################################################
bin_arangod_CPPFLAGS = \ arangod_libarangod_a_CPPFLAGS = \
-I@top_srcdir@/arangod \ -I@top_srcdir@/arangod \
$(AM_CPPFLAGS) $(AM_CPPFLAGS)
bin_arangod_LDADD = \ arangod_libarangod_a_SOURCES = \
lib/libarango_fe.a \
lib/libarango_v8.a \
lib/libarango.a \
$(LIBS) \
@V8_LIBS@
bin_arangod_SOURCES = \
arangod/Actions/actions.cpp \ arangod/Actions/actions.cpp \
arangod/Actions/RestActionHandler.cpp \ arangod/Actions/RestActionHandler.cpp \
arangod/Ahuacatl/ahuacatl-access-optimiser.c \ arangod/Ahuacatl/ahuacatl-access-optimiser.c \
@ -127,7 +120,7 @@ bin_arangod_SOURCES = \
if ENABLE_CLUSTER if ENABLE_CLUSTER
bin_arangod_SOURCES += \ arangod_libarangod_a_SOURCES += \
arangod/Cluster/AgencyComm.cpp \ arangod/Cluster/AgencyComm.cpp \
arangod/Cluster/ApplicationCluster.cpp \ arangod/Cluster/ApplicationCluster.cpp \
arangod/Cluster/ClusterComm.cpp \ arangod/Cluster/ClusterComm.cpp \
@ -141,15 +134,43 @@ bin_arangod_SOURCES += \
endif endif
if ENABLE_MRUBY
arangod_libarangod_a_SOURCES += \
arangod/MRServer/ApplicationMR.cpp \
arangod/MRServer/mr-actions.cpp
endif
## -----------------------------------------------------------------------------
## --SECTION-- PROGRAM
## -----------------------------------------------------------------------------
################################################################################
### @brief program "arangod"
################################################################################
bin_arangod_CPPFLAGS = \
-I@top_srcdir@/arangod \
$(AM_CPPFLAGS)
bin_arangod_LDADD = \
arangod/libarangod.a \
lib/libarango_fe.a \
lib/libarango_v8.a \
lib/libarango.a \
$(LIBS) \
@V8_LIBS@
bin_arangod_SOURCES = \
arangod/RestServer/arango.cpp
if ENABLE_MRUBY if ENABLE_MRUBY
bin_arangod_LDADD += \ bin_arangod_LDADD += \
lib/libarango_mruby.a \ lib/libarango_mruby.a \
@MRUBY_LIBS@ @MRUBY_LIBS@
bin_arangod_SOURCES += \
arangod/MRServer/ApplicationMR.cpp \
arangod/MRServer/mr-actions.cpp
endif endif
################################################################################ ################################################################################

View File

@ -10074,7 +10074,7 @@ static v8::Handle<v8::Integer> PropertyQueryShapedJson (v8::Local<v8::String> na
TRI_shape_access_t const* acc = TRI_FindAccessorVocShaper(shaper, sid, pid); TRI_shape_access_t const* acc = TRI_FindAccessorVocShaper(shaper, sid, pid);
// key not found // key not found
if (acc == 0 || acc->_shape == 0) { if (acc == 0 || acc->_resultSid == 0) {
return scope.Close(v8::Handle<v8::Integer>()); return scope.Close(v8::Handle<v8::Integer>());
} }

View File

@ -1195,7 +1195,7 @@ static int SkiplistIndexHelper (const TRI_skiplist_index_t* skiplistIndex,
TRI_shape_access_t const* acc = TRI_FindAccessorVocShaper(skiplistIndex->base._collection->_shaper, shapedJson._sid, shape); TRI_shape_access_t const* acc = TRI_FindAccessorVocShaper(skiplistIndex->base._collection->_shaper, shapedJson._sid, shape);
if (acc == NULL || acc->_shape == NULL) { if (acc == NULL || acc->_resultSid == 0) {
return TRI_ERROR_ARANGO_INDEX_DOCUMENT_ATTRIBUTE_MISSING; return TRI_ERROR_ARANGO_INDEX_DOCUMENT_ATTRIBUTE_MISSING;
} }
@ -2035,7 +2035,7 @@ static int BitarrayIndexHelper(const TRI_bitarray_index_t* baIndex,
acc = TRI_FindAccessorVocShaper(baIndex->base._collection->_shaper, shapedDoc->_sid, shape); acc = TRI_FindAccessorVocShaper(baIndex->base._collection->_shaper, shapedDoc->_sid, shape);
if (acc == NULL || acc->_shape == NULL) { if (acc == NULL || acc->_resultSid == 0) {
return TRI_ERROR_ARANGO_INDEX_BITARRAY_UPDATE_ATTRIBUTE_MISSING; return TRI_ERROR_ARANGO_INDEX_BITARRAY_UPDATE_ATTRIBUTE_MISSING;
} }
@ -2078,7 +2078,7 @@ static int BitarrayIndexHelper(const TRI_bitarray_index_t* baIndex,
acc = TRI_FindAccessorVocShaper(baIndex->base._collection->_shaper, shapedJson._sid, shape); acc = TRI_FindAccessorVocShaper(baIndex->base._collection->_shaper, shapedJson._sid, shape);
if (acc == NULL || acc->_shape == NULL) { if (acc == NULL || acc->_resultSid == 0) {
return TRI_ERROR_ARANGO_INDEX_DOCUMENT_ATTRIBUTE_MISSING; return TRI_ERROR_ARANGO_INDEX_DOCUMENT_ATTRIBUTE_MISSING;
} }

View File

@ -908,20 +908,28 @@ bool TRI_ExtractShapedJsonVocShaper (TRI_shaper_t* shaper,
return false; return false;
} }
*shape = accessor->_shape; if (accessor->_resultSid == 0) {
if (accessor->_shape == NULL) {
LOG_TRACE("expecting any object for path %lu, got nothing", LOG_TRACE("expecting any object for path %lu, got nothing",
(unsigned long) pid); (unsigned long) pid);
return sid == 0; return sid == 0;
} }
if (sid != 0 && sid != accessor->_shape->_sid) { *shape = shaper->lookupShapeId(shaper, accessor->_resultSid);
if (*shape == nullptr) {
LOG_TRACE("expecting any object for path %lu, got unknown shape id %lu",
(unsigned long) pid,
(unsigned long) accessor->_resultSid);
return sid == 0;
}
if (sid != 0 && sid != accessor->_resultSid) {
LOG_TRACE("expecting sid %lu for path %lu, got sid %lu", LOG_TRACE("expecting sid %lu for path %lu, got sid %lu",
(unsigned long) sid, (unsigned long) sid,
(unsigned long) pid, (unsigned long) pid,
(unsigned long) accessor->_shape->_sid); (unsigned long) accessor->_resultSid);
return false; return false;
} }

View File

@ -2018,8 +2018,6 @@ Graph.prototype._listCommonNeighbors = function(vertex1Example, vertex2Example,
"ex2": ex2 "ex2": ex2
}; };
return db._query(query, bindVars, {count: true}).toArray(); return db._query(query, bindVars, {count: true}).toArray();
}; };
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

View File

@ -1408,7 +1408,7 @@ function ChainedFluentAQLResultsSuite() {
test_getExampleNeighborsOfSelectedVerticesResultingAQL: function() { test_getExampleNeighborsOfSelectedVerticesResultingAQL: function() {
var query = g._vertices({name: uaName}) var query = g._vertices({name: uaName})
.neighbors([{ .neighbors([{
name: uaName name: ubName
},{ },{
name: p1Name name: p1Name
}]); }]);
@ -1420,31 +1420,27 @@ function ChainedFluentAQLResultsSuite() {
assertEqual(query.bindVars.options_0, {}); assertEqual(query.bindVars.options_0, {});
assertEqual(query.bindVars.options_1, { assertEqual(query.bindVars.options_1, {
neighborExamples: [{ neighborExamples: [{
name: uaName name: ubName
},{ },{
name: p1Name name: p1Name
}] }]
}); });
}, },
/* Not yet working, neighbors requires vertex-examples in AQL
test_getExampleNeighborsOfSelectedVertices: function() { test_getExampleNeighborsOfSelectedVertices: function() {
var result = g._vertices({name: uaName}) var result = g._vertices({name: uaName})
.neighbors([{ .neighbors([{
name: uaName name: ubName
},{ },{
name: p1Name name: p1Name
}]) }])
.toArray(); .toArray();
assertEqual(result.length, 2); assertEqual(result.length, 2);
var sorted = _.sortBy(result, "name"); var sorted = _.sortBy(result, "name");
assertEqual(sorted[0].name, uaName); assertEqual(sorted[0].name, ubName);
assertEqual(sorted[1].name, p1Name); assertEqual(sorted[1].name, p1Name);
}, },
*/
test_getEdgesOfNeighborsResultingAQL: function() { test_getEdgesOfNeighborsResultingAQL: function() {
var query = g._vertices({name: uaName}) var query = g._vertices({name: uaName})
.neighbors() .neighbors()
@ -1940,10 +1936,26 @@ function EdgesAndVerticesSuite() {
function GeneralGraphCommonNeighborsSuite() { function GeneralGraphCommonNeighborsSuite() {
var vertex = null;
var edge = null;
var testGraph, actual; var testGraph, actual;
var v1ColName = "UnitTestsAhuacatlVertex1";
var v2ColName = "UnitTestsAhuacatlVertex2";
var eColName = "UnitTestsAhuacatlEdge1";
var v1;
var v2;
var v3;
var v4;
var v5;
var v6;
var v7;
var v8;
var createKeyValueObject = function(key, value) {
var res = {};
res[key] = value;
return res;
};
return { return {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -1951,48 +1963,48 @@ function GeneralGraphCommonNeighborsSuite() {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
setUp: function () { setUp: function () {
db._drop("UnitTestsAhuacatlVertex1"); db._drop(v1ColName);
db._drop("UnitTestsAhuacatlVertex2"); db._drop(v2ColName);
db._drop("UnitTestsAhuacatlEdge1"); db._drop(eColName);
vertex1 = db._create("UnitTestsAhuacatlVertex1"); var vertex1 = db._create(v1ColName);
vertex2 = db._create("UnitTestsAhuacatlVertex2"); var vertex2 = db._create(v2ColName);
edge1 = db._createEdgeCollection("UnitTestsAhuacatlEdge1"); var edge1 = db._createEdgeCollection(eColName);
vertex1.save({ _key: "v1" , hugo : true}); v1 = vertex1.save({ _key: "v1" , hugo : true})._id;
vertex1.save({ _key: "v2" ,hugo : true}); v2 = vertex1.save({ _key: "v2" ,hugo : true})._id;
vertex1.save({ _key: "v3" , heinz : 1}); v3 = vertex1.save({ _key: "v3" , heinz : 1})._id;
vertex1.save({ _key: "v4" , harald : "meier"}); v4 = vertex1.save({ _key: "v4" , harald : "meier"})._id;
vertex2.save({ _key: "v5" , ageing : true}); v5 = vertex2.save({ _key: "v5" , ageing : true})._id;
vertex2.save({ _key: "v6" , harald : "meier", ageing : true}); v6 = vertex2.save({ _key: "v6" , harald : "meier", ageing : true})._id;
vertex2.save({ _key: "v7" ,harald : "meier"}); v7 = vertex2.save({ _key: "v7" ,harald : "meier"})._id;
vertex2.save({ _key: "v8" ,heinz : 1, harald : "meier"}); v8 = vertex2.save({ _key: "v8" ,heinz : 1, harald : "meier"})._id;
function makeEdge(from, to, collection) { function makeEdge(from, to, collection) {
collection.save(from, to, { what: from.split("/")[1] + "->" + to.split("/")[1] }); collection.save(from, to, { what: from.split("/")[1] + "->" + to.split("/")[1] });
} }
makeEdge("UnitTestsAhuacatlVertex1/v1", "UnitTestsAhuacatlVertex1/v2", edge1); makeEdge(v1, v2, edge1);
makeEdge("UnitTestsAhuacatlVertex1/v2", "UnitTestsAhuacatlVertex1/v3", edge1); makeEdge(v2, v3, edge1);
makeEdge("UnitTestsAhuacatlVertex1/v3", "UnitTestsAhuacatlVertex2/v5", edge1); makeEdge(v3, v5, edge1);
makeEdge("UnitTestsAhuacatlVertex1/v2", "UnitTestsAhuacatlVertex2/v6", edge1); makeEdge(v2, v6, edge1);
makeEdge("UnitTestsAhuacatlVertex2/v6", "UnitTestsAhuacatlVertex2/v7", edge1); makeEdge(v6, v7, edge1);
makeEdge("UnitTestsAhuacatlVertex1/v4", "UnitTestsAhuacatlVertex2/v7", edge1); makeEdge(v4, v7, edge1);
makeEdge("UnitTestsAhuacatlVertex1/v3", "UnitTestsAhuacatlVertex2/v7", edge1); makeEdge(v3, v7, edge1);
makeEdge("UnitTestsAhuacatlVertex2/v8", "UnitTestsAhuacatlVertex1/v1", edge1); makeEdge(v8, v1, edge1);
makeEdge("UnitTestsAhuacatlVertex1/v3", "UnitTestsAhuacatlVertex2/v5", edge1); makeEdge(v3, v5, edge1);
makeEdge("UnitTestsAhuacatlVertex1/v3", "UnitTestsAhuacatlVertex2/v8", edge1); makeEdge(v3, v8, edge1);
try { try {
db._collection("_graphs").remove("_graphs/bla3") db._collection("_graphs").remove("_graphs/bla3");
} catch (err) { } catch (ignore) {
} }
testGraph = graph._create( testGraph = graph._create(
"bla3", "bla3",
graph._edgeDefinitions( graph._edgeDefinitions(
graph._directedRelationDefinition("UnitTestsAhuacatlEdge1", graph._directedRelationDefinition(eColName,
["UnitTestsAhuacatlVertex1", "UnitTestsAhuacatlVertex2"], [v1ColName, v2ColName],
["UnitTestsAhuacatlVertex1", "UnitTestsAhuacatlVertex2"] [v1ColName, v2ColName]
) )
) )
); );
@ -2003,12 +2015,12 @@ function GeneralGraphCommonNeighborsSuite() {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
tearDown: function () { tearDown: function () {
db._drop("UnitTestsAhuacatlVertex1"); db._drop(v1ColName);
db._drop("UnitTestsAhuacatlVertex2"); db._drop(v2ColName);
db._drop("UnitTestsAhuacatlEdge1"); db._drop(eColName);
try { try {
db._collection("_graphs").remove("_graphs/bla3") db._collection("_graphs").remove("_graphs/bla3");
} catch (err) { } catch (ignore) {
} }
}, },
@ -2017,14 +2029,11 @@ function GeneralGraphCommonNeighborsSuite() {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
testCommonNeighborsAny: function () { testCommonNeighborsAny: function () {
actual = testGraph._listCommonNeighbors('UnitTestsAhuacatlVertex1/v3' , 'UnitTestsAhuacatlVertex2/v6', {direction : 'any'}); actual = testGraph._listCommonNeighbors(v3 , v6, {direction : 'any'});
assertEqual(actual[0]["UnitTestsAhuacatlVertex1/v3"]["UnitTestsAhuacatlVertex2/v6"][0]._id , "UnitTestsAhuacatlVertex1/v2"); assertEqual(actual[0][v3][v6][0]._id , v2);
assertEqual(actual[0]["UnitTestsAhuacatlVertex1/v3"]["UnitTestsAhuacatlVertex2/v6"][1]._id , "UnitTestsAhuacatlVertex2/v7"); assertEqual(actual[0][v3][v6][1]._id , v7);
actual = testGraph._amountCommonNeighbors(v3 , v6, {direction : 'any'});
assertEqual(actual[0][v3][0][v6] , 2);
actual = testGraph._amountCommonNeighbors('UnitTestsAhuacatlVertex1/v3' , 'UnitTestsAhuacatlVertex2/v6', {direction : 'any'});
assertEqual(actual[0]["UnitTestsAhuacatlVertex1/v3"][0]["UnitTestsAhuacatlVertex2/v6"] , 2);
}, },
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief checks GRAPH_COMMON_NEIGHBORS() /// @brief checks GRAPH_COMMON_NEIGHBORS()
@ -2032,28 +2041,25 @@ function GeneralGraphCommonNeighborsSuite() {
testCommonNeighborsIn: function () { testCommonNeighborsIn: function () {
actual = testGraph._listCommonNeighbors({} , {}, {direction : 'inbound'}); actual = testGraph._listCommonNeighbors({} , {}, {direction : 'inbound'});
assertEqual(actual[0]["UnitTestsAhuacatlVertex1/v3"]["UnitTestsAhuacatlVertex2/v6"][0]._id , "UnitTestsAhuacatlVertex1/v2"); assertEqual(actual[0][v3][v6][0]._id, v2);
assertEqual(actual[1]["UnitTestsAhuacatlVertex2/v5"]["UnitTestsAhuacatlVertex2/v8"][0]._id , "UnitTestsAhuacatlVertex1/v3"); assertEqual(actual[1][v5][v8][0]._id, v3);
assertEqual(actual[1]["UnitTestsAhuacatlVertex2/v5"]["UnitTestsAhuacatlVertex2/v7"][0]._id , "UnitTestsAhuacatlVertex1/v3"); assertEqual(actual[1][v5][v7][0]._id, v3);
assertEqual(actual[2][v6][v3][0]._id, v2);
assertEqual(actual[3][v7][v5][0]._id, v3);
assertEqual(actual[2]["UnitTestsAhuacatlVertex2/v6"]["UnitTestsAhuacatlVertex1/v3"][0]._id , "UnitTestsAhuacatlVertex1/v2"); assertEqual(actual[3][v7][v8][0]._id, v3);
assertEqual(actual[3]["UnitTestsAhuacatlVertex2/v7"]["UnitTestsAhuacatlVertex2/v5"][0]._id , "UnitTestsAhuacatlVertex1/v3"); assertEqual(actual[4][v8][v5][0]._id, v3);
assertEqual(actual[3]["UnitTestsAhuacatlVertex2/v7"]["UnitTestsAhuacatlVertex2/v8"][0]._id , "UnitTestsAhuacatlVertex1/v3"); assertEqual(actual[4][v8][v7][0]._id, v3);
assertEqual(actual[4]["UnitTestsAhuacatlVertex2/v8"]["UnitTestsAhuacatlVertex2/v5"][0]._id , "UnitTestsAhuacatlVertex1/v3");
assertEqual(actual[4]["UnitTestsAhuacatlVertex2/v8"]["UnitTestsAhuacatlVertex2/v7"][0]._id , "UnitTestsAhuacatlVertex1/v3");
actual = testGraph._amountCommonNeighbors({} , {}, {direction : 'inbound'}); actual = testGraph._amountCommonNeighbors({} , {}, {direction : 'inbound'});
assertEqual(actual[0]["UnitTestsAhuacatlVertex1/v3"][0]["UnitTestsAhuacatlVertex2/v6"] , 1); assertEqual(actual[0][v3][0][v6] , 1);
assertEqual(actual[1]["UnitTestsAhuacatlVertex2/v5"][0]["UnitTestsAhuacatlVertex2/v8"] , 1); assertEqual(actual[1][v5][0][v8] , 1);
assertEqual(actual[1]["UnitTestsAhuacatlVertex2/v5"][1]["UnitTestsAhuacatlVertex2/v7"] , 1); assertEqual(actual[1][v5][1][v7] , 1);
assertEqual(actual[2]["UnitTestsAhuacatlVertex2/v6"][0]["UnitTestsAhuacatlVertex1/v3"] , 1); assertEqual(actual[2][v6][0][v3] , 1);
assertEqual(actual[3]["UnitTestsAhuacatlVertex2/v7"][0]["UnitTestsAhuacatlVertex2/v5"] , 1); assertEqual(actual[3][v7][0][v5] , 1);
assertEqual(actual[3]["UnitTestsAhuacatlVertex2/v7"][1]["UnitTestsAhuacatlVertex2/v8"] , 1); assertEqual(actual[3][v7][1][v8] , 1);
assertEqual(actual[4]["UnitTestsAhuacatlVertex2/v8"][0]["UnitTestsAhuacatlVertex2/v5"] , 1); assertEqual(actual[4][v8][0][v5] , 1);
assertEqual(actual[4]["UnitTestsAhuacatlVertex2/v8"][1]["UnitTestsAhuacatlVertex2/v7"] , 1); assertEqual(actual[4][v8][1][v7] , 1);
}, },
@ -2063,26 +2069,30 @@ function GeneralGraphCommonNeighborsSuite() {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
testCommonNeighborsOut: function () { testCommonNeighborsOut: function () {
actual = testGraph._listCommonNeighbors( { hugo : true } , {heinz : 1}, {direction : 'outbound', minDepth : 1, maxDepth : 3}); actual = testGraph._listCommonNeighbors(
assertEqual(Object.keys(actual[1])[0] , "UnitTestsAhuacatlVertex1/v2"); {hugo: true}, {heinz: 1},
assertEqual(Object.keys(actual[1][Object.keys(actual[1])[0]]) , ["UnitTestsAhuacatlVertex2/v8", "UnitTestsAhuacatlVertex1/v3"]); {direction: 'outbound', minDepth: 1, maxDepth: 3}
);
assertEqual(Object.keys(actual[1])[0], v2);
assertEqual(Object.keys(actual[1][Object.keys(actual[1])[0]]), [v8, v3]);
assertEqual(actual[1][Object.keys(actual[1])[0]]["UnitTestsAhuacatlVertex2/v8"].length , 3); assertEqual(actual[1][Object.keys(actual[1])[0]][v8].length, 3);
assertEqual(actual[1][Object.keys(actual[1])[0]]["UnitTestsAhuacatlVertex1/v3"].length , 4); assertEqual(actual[1][Object.keys(actual[1])[0]][v3].length, 4);
assertEqual(Object.keys(actual[0])[0] , "UnitTestsAhuacatlVertex1/v1"); assertEqual(Object.keys(actual[0])[0], v1);
assertEqual(Object.keys(actual[0][Object.keys(actual[0])[0]]) , ["UnitTestsAhuacatlVertex1/v3", "UnitTestsAhuacatlVertex2/v8"]); assertEqual(Object.keys(actual[0][Object.keys(actual[0])[0]]), [v3, v8]);
assertEqual(actual[0][Object.keys(actual[0])[0]]["UnitTestsAhuacatlVertex1/v3"].length , 4);
assertEqual(actual[0][Object.keys(actual[0])[0]]["UnitTestsAhuacatlVertex2/v8"].length , 3);
actual = testGraph._amountCommonNeighbors({ hugo : true } , {heinz : 1}, {direction : 'outbound', minDepth : 1, maxDepth : 3});
assertEqual(actual[0]["UnitTestsAhuacatlVertex1/v1"][0]["UnitTestsAhuacatlVertex1/v3"] , 4);
assertEqual(actual[0]["UnitTestsAhuacatlVertex1/v1"][1]["UnitTestsAhuacatlVertex2/v8"] , 3);
assertEqual(actual[1]["UnitTestsAhuacatlVertex1/v2"][0]["UnitTestsAhuacatlVertex2/v8"] , 3);
assertEqual(actual[1]["UnitTestsAhuacatlVertex1/v2"][1]["UnitTestsAhuacatlVertex1/v3"] , 4);
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}
);
assertEqual(actual[0][v1][0][v3], 4);
assertEqual(actual[0][v1][1][v8], 3);
assertEqual(actual[1][v2][0][v8], 3);
assertEqual(actual[1][v2][1][v3], 4);
}, },
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -2090,78 +2100,50 @@ function GeneralGraphCommonNeighborsSuite() {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
testCommonProperties: function () { testCommonProperties: function () {
actual = testGraph._listCommonProperties( { } , {}, {}); actual = testGraph._listCommonProperties({} ,{} ,{});
assertEqual(actual[0]["UnitTestsAhuacatlVertex1/v1"][0]._id , "UnitTestsAhuacatlVertex1/v2"); assertEqual(actual[0][v1][0]._id , v2);
assertEqual(actual[1]["UnitTestsAhuacatlVertex1/v2"][0]._id , "UnitTestsAhuacatlVertex1/v1"); assertEqual(actual[1][v2][0]._id , v1);
assertEqual(actual[2]["UnitTestsAhuacatlVertex1/v3"][0]._id , "UnitTestsAhuacatlVertex2/v8"); assertEqual(actual[2][v3][0]._id , v8);
assertEqual(actual[3]["UnitTestsAhuacatlVertex1/v4"][0]._id , "UnitTestsAhuacatlVertex2/v6"); assertEqual(actual[3][v4][0]._id , v6);
assertEqual(actual[3]["UnitTestsAhuacatlVertex1/v4"][1]._id , "UnitTestsAhuacatlVertex2/v8"); assertEqual(actual[3][v4][1]._id , v8);
assertEqual(actual[3]["UnitTestsAhuacatlVertex1/v4"][2]._id , "UnitTestsAhuacatlVertex2/v7"); assertEqual(actual[3][v4][2]._id , v7);
assertEqual(actual[4][v5][0]._id , v6);
assertEqual(actual[5][v6][0]._id , v4);
assertEqual(actual[5][v6][1]._id , v5);
assertEqual(actual[5][v6][2]._id , v8);
assertEqual(actual[5][v6][3]._id , v7);
assertEqual(actual[6][v7][0]._id , v4);
assertEqual(actual[6][v7][1]._id , v6);
assertEqual(actual[6][v7][2]._id , v8);
assertEqual(actual[7][v8][0]._id , v3);
assertEqual(actual[7][v8][1]._id , v4);
assertEqual(actual[7][v8][2]._id , v6);
assertEqual(actual[7][v8][3]._id , v7);
assertEqual(actual[4]["UnitTestsAhuacatlVertex2/v5"][0]._id , "UnitTestsAhuacatlVertex2/v6"); actual = testGraph._amountCommonProperties({} ,{} ,{});
assertEqual(actual[5]["UnitTestsAhuacatlVertex2/v6"][0]._id , "UnitTestsAhuacatlVertex1/v4");
assertEqual(actual[5]["UnitTestsAhuacatlVertex2/v6"][1]._id , "UnitTestsAhuacatlVertex2/v5");
assertEqual(actual[5]["UnitTestsAhuacatlVertex2/v6"][2]._id , "UnitTestsAhuacatlVertex2/v8");
assertEqual(actual[5]["UnitTestsAhuacatlVertex2/v6"][3]._id , "UnitTestsAhuacatlVertex2/v7");
assertEqual(actual[6]["UnitTestsAhuacatlVertex2/v7"][0]._id , "UnitTestsAhuacatlVertex1/v4");
assertEqual(actual[6]["UnitTestsAhuacatlVertex2/v7"][1]._id , "UnitTestsAhuacatlVertex2/v6");
assertEqual(actual[6]["UnitTestsAhuacatlVertex2/v7"][2]._id , "UnitTestsAhuacatlVertex2/v8");
assertEqual(actual[7]["UnitTestsAhuacatlVertex2/v8"][0]._id , "UnitTestsAhuacatlVertex1/v3");
assertEqual(actual[7]["UnitTestsAhuacatlVertex2/v8"][1]._id , "UnitTestsAhuacatlVertex1/v4");
assertEqual(actual[7]["UnitTestsAhuacatlVertex2/v8"][2]._id , "UnitTestsAhuacatlVertex2/v6");
assertEqual(actual[7]["UnitTestsAhuacatlVertex2/v8"][3]._id , "UnitTestsAhuacatlVertex2/v7");
actual = testGraph._amountCommonProperties( { } , {}, {});
assertEqual(actual, [ assertEqual(actual, [
{ createKeyValueObject(v1, 1),
"UnitTestsAhuacatlVertex1/v1" : 1 createKeyValueObject(v2, 1),
}, createKeyValueObject(v3, 1),
{ createKeyValueObject(v4, 3),
"UnitTestsAhuacatlVertex1/v2" : 1 createKeyValueObject(v5, 1),
}, createKeyValueObject(v6, 4),
{ createKeyValueObject(v7, 3),
"UnitTestsAhuacatlVertex1/v3" : 1 createKeyValueObject(v8, 4)
},
{
"UnitTestsAhuacatlVertex1/v4" : 3
},
{
"UnitTestsAhuacatlVertex2/v5" : 1
},
{
"UnitTestsAhuacatlVertex2/v6" : 4
},
{
"UnitTestsAhuacatlVertex2/v7" : 3
},
{
"UnitTestsAhuacatlVertex2/v8" : 4
}
]); ]);
}, },
testCommonPropertiesWithFilters: function () { testCommonPropertiesWithFilters: function () {
actual = testGraph._listCommonProperties({ageing : true} , {harald : 'meier'}, {}); actual = testGraph._listCommonProperties({ageing : true} , {harald : 'meier'}, {});
assertEqual(actual[0]["UnitTestsAhuacatlVertex2/v5"][0]._id , "UnitTestsAhuacatlVertex2/v6"); assertEqual(actual[0][v5][0]._id , v6);
assertEqual(actual[1]["UnitTestsAhuacatlVertex2/v6"][0]._id , "UnitTestsAhuacatlVertex1/v4"); assertEqual(actual[1][v6][0]._id , v4);
assertEqual(actual[1]["UnitTestsAhuacatlVertex2/v6"][1]._id , "UnitTestsAhuacatlVertex2/v8"); assertEqual(actual[1][v6][1]._id , v8);
assertEqual(actual[1]["UnitTestsAhuacatlVertex2/v6"][2]._id , "UnitTestsAhuacatlVertex2/v7"); assertEqual(actual[1][v6][2]._id , v7);
actual = testGraph._amountCommonProperties({ageing : true} , {harald : 'meier'}, {}); actual = testGraph._amountCommonProperties({ageing : true} , {harald : 'meier'}, {});
assertEqual(actual, [ assertEqual(actual, [
{ createKeyValueObject(v5, 1),
"UnitTestsAhuacatlVertex2/v5" : 1 createKeyValueObject(v6, 3)
},
{
"UnitTestsAhuacatlVertex2/v6" : 3
}
]); ]);
}, },
@ -2169,40 +2151,24 @@ function GeneralGraphCommonNeighborsSuite() {
testCommonPropertiesWithFiltersAndIgnoringKeyHarald: function () { testCommonPropertiesWithFiltersAndIgnoringKeyHarald: function () {
actual = testGraph._listCommonProperties( {} , {}, {ignoreProperties : 'harald'}); actual = testGraph._listCommonProperties( {} , {}, {ignoreProperties : 'harald'});
assertEqual(actual[0]["UnitTestsAhuacatlVertex1/v1"][0]._id , "UnitTestsAhuacatlVertex1/v2"); assertEqual(actual[0][v1][0]._id , v2);
assertEqual(actual[1]["UnitTestsAhuacatlVertex1/v2"][0]._id , "UnitTestsAhuacatlVertex1/v1"); assertEqual(actual[1][v2][0]._id , v1);
assertEqual(actual[2]["UnitTestsAhuacatlVertex1/v3"][0]._id , "UnitTestsAhuacatlVertex2/v8"); assertEqual(actual[2][v3][0]._id , v8);
assertEqual(actual[3][v5][0]._id , v6);
assertEqual(actual[3]["UnitTestsAhuacatlVertex2/v5"][0]._id , "UnitTestsAhuacatlVertex2/v6"); assertEqual(actual[4][v6][0]._id , v5);
assertEqual(actual[5][v8][0]._id , v3);
assertEqual(actual[4]["UnitTestsAhuacatlVertex2/v6"][0]._id , "UnitTestsAhuacatlVertex2/v5");
assertEqual(actual[5]["UnitTestsAhuacatlVertex2/v8"][0]._id , "UnitTestsAhuacatlVertex1/v3");
actual = testGraph._amountCommonProperties({} , {}, {ignoreProperties : 'harald'}); actual = testGraph._amountCommonProperties({} , {}, {ignoreProperties : 'harald'});
assertEqual(actual, [ assertEqual(actual, [
{ createKeyValueObject(v1, 1),
"UnitTestsAhuacatlVertex1/v1" : 1 createKeyValueObject(v2, 1),
}, createKeyValueObject(v3, 1),
{ createKeyValueObject(v5, 1),
"UnitTestsAhuacatlVertex1/v2" : 1 createKeyValueObject(v6, 1),
}, createKeyValueObject(v8, 1)
{
"UnitTestsAhuacatlVertex1/v3" : 1
},
{
"UnitTestsAhuacatlVertex2/v5" : 1
},
{
"UnitTestsAhuacatlVertex2/v6" : 1
},
{
"UnitTestsAhuacatlVertex2/v8" : 1
}
]); ]);
} }
} };
} }

View File

@ -70,6 +70,7 @@ static bool BytecodeShapeAccessor (TRI_shaper_t* shaper, TRI_shape_access_t* acc
paids = (TRI_shape_aid_t*) (((char const*) path) + sizeof(TRI_shape_path_t)); paids = (TRI_shape_aid_t*) (((char const*) path) + sizeof(TRI_shape_path_t));
// collect the bytecode // collect the bytecode
// we need at least 2 entries in the vector to store an accessor // we need at least 2 entries in the vector to store an accessor
TRI_InitVectorPointer2(&ops, shaper->_memoryZone, 2); TRI_InitVectorPointer2(&ops, shaper->_memoryZone, 2);
@ -214,7 +215,7 @@ static bool BytecodeShapeAccessor (TRI_shaper_t* shaper, TRI_shape_access_t* acc
TRI_DestroyVectorPointer(&ops); TRI_DestroyVectorPointer(&ops);
accessor->_shape = NULL; accessor->_resultSid = 0;
accessor->_code = NULL; accessor->_code = NULL;
return true; return true;
@ -222,7 +223,7 @@ static bool BytecodeShapeAccessor (TRI_shaper_t* shaper, TRI_shape_access_t* acc
else { else {
TRI_DestroyVectorPointer(&ops); TRI_DestroyVectorPointer(&ops);
accessor->_shape = NULL; accessor->_resultSid = 0;
accessor->_code = NULL; accessor->_code = NULL;
return true; return true;
@ -238,7 +239,8 @@ static bool BytecodeShapeAccessor (TRI_shaper_t* shaper, TRI_shape_access_t* acc
return false; return false;
} }
accessor->_shape = shape; // remember resulting sid
accessor->_resultSid = shape->_sid;
// steal buffer from ops vector so we don't need to copy it // steal buffer from ops vector so we don't need to copy it
accessor->_code = const_cast<void const**>(ops._buffer); accessor->_code = const_cast<void const**>(ops._buffer);
@ -262,7 +264,7 @@ static bool ExecuteBytecodeShapeAccessor (TRI_shape_access_t const* accessor,
TRI_shape_size_t pos; TRI_shape_size_t pos;
TRI_shape_size_t* offsetsV; TRI_shape_size_t* offsetsV;
if (accessor->_shape == NULL) { if (accessor->_resultSid == 0) {
return false; return false;
} }
@ -364,7 +366,7 @@ bool TRI_ExecuteShapeAccessor (TRI_shape_access_t const* accessor,
return false; return false;
} }
result->_sid = accessor->_shape->_sid; result->_sid = accessor->_resultSid;
result->_data.data = (char*) begin; result->_data.data = (char*) begin;
result->_data.length = (uint32_t) (((char const*) end) - ((char const*) begin)); result->_data.length = (uint32_t) (((char const*) end) - ((char const*) begin));
@ -384,12 +386,12 @@ void TRI_PrintShapeAccessor (TRI_shape_access_t* accessor) {
(unsigned long) accessor->_sid, (unsigned long) accessor->_sid,
(unsigned long) accessor->_pid); (unsigned long) accessor->_pid);
if (accessor->_shape == NULL) { if (accessor->_resultSid == 0) {
printf(" result shape: -\n"); printf(" result shape: -\n");
return; return;
} }
printf(" result shape: %lu\n", (unsigned long) accessor->_shape->_sid); printf(" result shape: %lu\n", (unsigned long) accessor->_resultSid);
void const** ops = static_cast<void const**>(accessor->_code); void const** ops = static_cast<void const**>(accessor->_code);

View File

@ -54,7 +54,7 @@ typedef struct TRI_shape_access_s {
TRI_shape_sid_t _sid; // shaped identifier of the shape we are looking at TRI_shape_sid_t _sid; // shaped identifier of the shape we are looking at
TRI_shape_pid_t _pid; // path identifier of the attribute path TRI_shape_pid_t _pid; // path identifier of the attribute path
TRI_shape_t const* _shape; // resulting shape TRI_shape_sid_t _resultSid; // resulting shape
void const** _code; // bytecode void const** _code; // bytecode
TRI_memory_zone_t* _memoryZone; TRI_memory_zone_t* _memoryZone;