LexiconQuery

class polyglotdb.query.lexicon.query.LexiconQuery(corpus, to_find)[source]

Class for generating a Cypher query over the lexicon (type information about annotations in the corpus)

Methods

__init__(corpus, to_find) Initialize self.
aggregate(*args) Aggregate the results of the query by a grouping factor or overall.
all()
cache()
clear_columns() Remove any columns specified.
columns(*args) Add one or more additional columns to the results.
count() Returns the number of rows in the query.
create_subset(label) Create a type subset
cypher() Generates a Cypher statement based on the query.
cypher_params()
delete() Remove the results of a query from the graph.
filter(*args) Apply one or more filters to a query.
generate_return() Generates final statement from query object, calling whichever one of the other generate statements is specified in the query obj
get()
group_by(*args) Specify one or more fields for how aggregates should be grouped.
limit(limit) sets object limit to parameter limit
offset(number)
optional_nodes()
order_by(field[, descending]) Specify how the results of the query should be ordered.
preload(*args)
remove_subset(label) Delete a subset label from the corpus.
required_nodes()
set_properties(**kwargs) Set properties of the returned data.
to_csv(path) Same as all, but the results of the query are output to the specified path as a CSV file.
to_json()
create_subset(label)[source]

Create a type subset

Parameters:
label : str

Name of the subset

remove_subset(label)[source]

Delete a subset label from the corpus.

N.B. This function only removes the type subset label, not any annotations or data in the corpus.

Parameters:
label : str

Name of the subset to remove

set_properties(**kwargs)[source]

Set properties of the returned data. Setting a property to None will result in it being deleted.

Parameters:
kwargs : kwargs

Properties to set