GraphQuery

class polyglotdb.query.annotations.query.GraphQuery(corpus, to_find, stop_check=None)[source]

Base GraphQuery class.

Extend this class to implement more advanced query functions.

Parameters:
corpusCorpusContext

The corpus to query

to_findAnnotationNode

Name of the annotation type to search for

Methods

__init__(corpus, to_find[, stop_check])

aggregate(*args)

Aggregate the results of the query by a grouping factor or overall.

all()

Returns all results for the query

cache(*args)

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)

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.

filter_left_aligned(annotation_type)

Short cut function for aligning the queried annotations with another annotation type.

filter_not_left_aligned(annotation_type)

Short cut function for aligning the queried annotations with another annotation type.

filter_not_right_aligned(annotation_type)

Short cut function for aligning the queried annotations with another annotation type.

filter_right_aligned(annotation_type)

Short cut function for aligning the queried annotations with another annotation type.

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)

preload_acoustics(*args)

remove_subset(label)

required_nodes()

set_pause()

sets pauses in graph

set_properties(**kwargs)

to_csv(path)

Same as all, but the results of the query are output to the specified path as a CSV file.

to_json()