1. Summary

These constants control the format of result entries in the query result list returned by various search methods.

result = R_<a> | R_<b> | ...

Some constants can be combined using the bitwise-OR operator (|).

If no meta-information is requested the returned result is a list of entries. When meta-information is requested with pyvgx.R_COUNTS or pyvgx.R_TIMING the returned result is a dictionary containing the list of results plus the requested meta-information.

2. Result Entry Format

The format of each entry in the result list is controlled by these constants:

2.1. pyvgx.R_SIMPLE

pyvgx.R_SIMPLE = 0

Result list entries are singleton objects representing the value of the earliest display order field within the specified result fields.

[   field1,
    field1,
    field1,
    ...
]

2.2. pyvgx.R_STR

pyvgx.R_STR = 268435456

Result list entries are single strings built from the selected result fields. The entry format depends on the fields. The format is JSON compatible except when only fields included in F_AARC are requested (see below.)

[   "formatted_entry1",
    "formatted_entry2",
    "formatted_entry3",
    ...
]

When requesting a single field with a string value (such as F_ID) a simple string representation of the field value is returned. This is generally not JSON compatible, unless the string happens to represent a number.

When requesting multiple fields within F_AARC (such as F_ID|F_VAL) the combined fields are rendered as ASCII-art to help visualize the arc. This is not JSON compatible. The result entry is then formatted as ( F_ANCHOR )-[ F_REL F_MOD F_VAL ]->( F_ID ), rendering blank spaces for missing fields.

When requesting multiple fields where at least one is not part of F_AARC the result is rendered as JSON name/value pairs.

2.3. pyvgx.R_LIST

pyvgx.R_LIST = 536870912

Result list entries are lists of values as specified by the result fields. The field order is fixed.

[   [ field1, field2, ... ],
    [ field1, field2, ... ],
    [ field1, field2, ... ],
    ...
]

2.4. pyvgx.R_DICT

pyvgx.R_DICT = 805306368

Result list entries are dictionaries of name:value as specified by the result fields. Generally, the entry is a subset of:

entry_n = {
    'anchor'            : "<initial_vertex_identifier>",
    'anchor-internalid' : "<initial_vertex_internalid>",
    'arc': {
        'direction'       : "<arc_direction>",
        'relationship'    : "<relationship_type>",
        'modifier'        : "<modifier>",
        'value'           : <numeric_value>
    },
    'id'                : "<terminal_vertex_identifier>",
    'internalid'        : "<terminal_vertex_internalid>",
    'type'              : "<vertex_type>",
    'degree'            : <degree>,
    'indegree'          : <indegree>,
    'outdegree'         : <outdegree>,
    'vector'            : [(<"dim1">, <weight>), ("<dim2>", <weight>), ...],
    'properties'        : { <properties_dict> },
    'rankscore'         : <dynamic_rank>,
    'similarity'        : <similarity_score>,
    'hamming-distance'  : <hamming_distance>,
    'created'           : <TMC>,
    'modified'          : <TMM>,
    'expires'           : <TMX>,
    'descriptor'        : <numeric_descriptor>,
    'address'           : <vertex_memory_address>,
    'handle'            : <vertex_allocator_handle>,
    'raw-vertex'        : "<binary_dump>"
}

The result list is:

[   entry_1,
    entry_2,
    entry_3,
    ...
]

3. Result Meta Information

When one or more of the following constants are used the result will be a dictionary containing the list of results and the selected meta-information:

{   '<result_list_name>' : [ <result_entry1>, <result_entry2>, ... ],
    '<meta_name1>' : <meta_value1>,
    '<meta_name2>' : <meta_value2>,
    ...
}

3.1. pyvgx.R_TIMING

pyvgx.R_TIMING = 1073741824

Query execution timing information will be included as a meta named "time".

Neighborhood query result

{
    'neighborhood' : [ <entry1>, <entry2>, ... ]
    'time' : {
        'search' : <seconds>,
        'result' : <seconds>,
        'total'  : <seconds>
    }
}

Global query result

{
    'vertices' : [ <entry1>, <entry2>, ... ]
    'time' : {
        'search' : <seconds>,
        'result' : <seconds>,
        'total'  : <seconds>
    }
}

3.2. pyvgx.R_COUNTS

pyvgx.R_COUNTS = -2147483648

Information for query result counts will be included as a meta named "counts".

Neighborhood query result

{
    'neighborhood' : [ <entry1>, <entry2>, ... ]
    'counts' : {
        'neighbors' : <seconds>,
        'arcs'      : <seconds>
    }
}

Global query result

{
    'vertices' : [ <entry1>, <entry2>, ... ]
    'time' : {
        'search' : <seconds>,
        'result' : <seconds>,
        'total'  : <seconds>
    }
}

3.3. pyvgx.R_METAS

pyvgx.R_METAS = -1073741824

Shorthand for pyvgx.R_TIMING | pyvgx.R_COUNTS


PYVGX