The Assimilation Project  based on Assimilation version 1.1.7.1474836767
cma.query.ClientQuery Class Reference
Inheritance diagram for cma.query.ClientQuery:
Collaboration diagram for cma.query.ClientQuery:

Public Member Functions

def __init__ (self, queryname, JSON_metadata=None)
 
def post_db_init (self)
 
def bind_store (self, store)
 
def parameter_names (self)
 
def execute (self, executor_context, idsonly=False, expandJSON=False, maxJSON=0, elemsonly=False, params)
 
def supports_cmdline (self, language='en')
 
def cmdline_exec (self, executor_context, language='en', fmtstring=None, params)
 
def filter_json (self, executor_context, idsonly, expandJSON, maxJSON, resultiter, elemsonly=False)
 
def validate_json (self)
 
def validate_query_parameter_metadata (self, param, pinfo)
 
def validate_parameters (self, parameters)
 

Static Public Member Functions

def __meta_keyattrs__ ()
 
def set_node_query_url (node_query_url)
 
def load_from_file (store, pathname, queryname=None)
 
def load_directory (store, directoryname)
 
def load_tree (store, rootdirname, followlinks=False)
 

Data Fields

 queryname
 
 JSON_metadata
 

Static Public Attributes

string node_query_url = "/doquery/GetaNodeById"
 

Detailed Description

This class defines queries which can be requested from clients (typically JavaScript)
The output of all queries is JSON - as filtered by our security mechanism

Definition at line 43 of file query.py.

Constructor & Destructor Documentation

def cma.query.ClientQuery.__init__ (   self,
  queryname,
  JSON_metadata = None 
)
Parameters
----------
JSON_metadata  - a JSON string containing
'querytype':    a string denoting our query type - defaults to 'cypher'
'cypher':       a string containing our cypher query (if a cypher query)
'subtype':      a string giving the query subtype (if applicable)
'descriptions': a dict containing descriptions in various languages
    'language-key': A locale-language key
         'short'    a short description of this query in 'language-key'
         'long'     a long description of this query in 'language-key'
'parameters': a dict containing
        'name':     name of the parameter to the query
        'type':     the type of the parameter one of several noted
        'min':      optional minimum value for 'name'
        'max':      optional maximum value for 'name'
        'enumlist': array of possible enum values  (type = enum only)
        'lang':     language for this description as a dict:
                        'short':a short description of 'name' in language 'lang'
                        'long': a long description of 'name' in language 'lang'
                        'enumlist': dict of explanations for enumlist above

Languages are the typical 'en' 'en_us', 'es', 'es_mx', as per the locale-usual
Currently-known types are as follows:
    int     - an integer
    float   - an floating point number
    string  - a string
    ipaddr  - an IP address either ipv4 or ipv6 (as a string)
    macaddr - a 48 or 64 bit MAC address (as a string)
    bool    - a boolean value
    hostname- a host name (as string - always converted to lower case)
    dnsname - a DNS name (as a string - always converted to lower case)
    enum    - a finite enumeration of permissible values (case-insensitive)

Definition at line 48 of file query.py.

Member Function Documentation

def cma.query.ClientQuery.__meta_keyattrs__ ( )
static

Definition at line 97 of file query.py.

def cma.query.ClientQuery.bind_store (   self,
  store 
)
def cma.query.ClientQuery.cmdline_exec (   self,
  executor_context,
  language = 'en',
  fmtstring = None,
  params 
)
def cma.query.ClientQuery.execute (   self,
  executor_context,
  idsonly = False,
  expandJSON = False,
  maxJSON = 0,
  elemsonly = False,
  params 
)
def cma.query.ClientQuery.filter_json (   self,
  executor_context,
  idsonly,
  expandJSON,
  maxJSON,
  resultiter,
  elemsonly = False 
)
Return a sanitized (filtered) JSON stream from the input iterator
The idea of the filtering is to enforce security restrictions on which
things can be returned and which fields the executor is allowed to view.
This is currently completely ignored, and everthing is returned - as is.
This function is a generator.

parameters
----------
executor_context - security context to execute this in
ids_only - if True, return only the URL of the objects (via object id)
        otherwise return the objects themselves
resultiter - iterator giving return results for us to filter

Definition at line 177 of file query.py.

Referenced by cma.query.ClientQuery.cmdline_exec(), and cma.query.ClientQuery.execute().

Here is the caller graph for this function:

def cma.query.ClientQuery.load_directory (   store,
  directoryname 
)
static

Definition at line 537 of file query.py.

def cma.query.ClientQuery.load_from_file (   store,
  pathname,
  queryname = None 
)
static

Definition at line 518 of file query.py.

def cma.query.ClientQuery.load_tree (   store,
  rootdirname,
  followlinks = False 
)
static

Definition at line 549 of file query.py.

def cma.query.ClientQuery.parameter_names (   self)

Definition at line 122 of file query.py.

References cma.query.ClientQuery.execute().

Here is the call graph for this function:

def cma.query.ClientQuery.post_db_init (   self)

Definition at line 106 of file query.py.

References cma.query.ClientQuery._JSON_metadata, cma.query.ClientQuery.JSON_metadata, and cma.query.ClientQuery.validate_json().

Here is the call graph for this function:

def cma.query.ClientQuery.set_node_query_url (   node_query_url)
static

Definition at line 102 of file query.py.

def cma.query.ClientQuery.supports_cmdline (   self,
  language = 'en' 
)

Definition at line 148 of file query.py.

References cma.query.ClientQuery._JSON_metadata.

def cma.query.ClientQuery.validate_json (   self)
Validate the JSON metadata for this query - it's complicated!

Definition at line 241 of file query.py.

References cma.query.ClientQuery._JSON_metadata, cma.query.ClientQuery._store, and cma.query.ClientQuery.validate_query_parameter_metadata().

Referenced by cma.query.ClientQuery.bind_store(), and cma.query.ClientQuery.post_db_init().

Here is the call graph for this function:

Here is the caller graph for this function:

def cma.query.ClientQuery.validate_parameters (   self,
  parameters 
)
parameters is a Dict-like object containing parameter names and values

Definition at line 329 of file query.py.

References cma.query.ClientQuery._JSON_metadata, and cma.query.ClientQuery._store.

Referenced by cma.query.ClientQuery.cmdline_exec(), and cma.query.ClientQuery.execute().

Here is the caller graph for this function:

def cma.query.ClientQuery.validate_query_parameter_metadata (   self,
  param,
  pinfo 
)

Definition at line 305 of file query.py.

References cma.drawwithdot.type, and cma.query.ClientQuery.validate_query_parameter_metadata().

Referenced by cma.query.ClientQuery.validate_json(), and cma.query.ClientQuery.validate_query_parameter_metadata().

Here is the call graph for this function:

Here is the caller graph for this function:

Field Documentation

cma.query.ClientQuery.JSON_metadata

Definition at line 85 of file query.py.

Referenced by cma.query.ClientQuery.post_db_init().

string cma.query.ClientQuery.node_query_url = "/doquery/GetaNodeById"
static

Definition at line 47 of file query.py.

cma.query.ClientQuery.queryname

Definition at line 84 of file query.py.

Referenced by cma.query.ClientQuery.execute().


The documentation for this class was generated from the following file: