Skip to content

Solr Implementation

SolrImplementation dataclass

Bases: EntityInterface, AssociationInterface, SearchInterface

Implementation of Monarch Interfaces for Solr endpoint

get_association_counts

get_association_counts(entity)

Get association counts for a given entity

This method uses chunks of solr query syntax mapped to the association type

Parameters:

Name Type Description Default
entity str
required

get_associations

get_associations(
    category=None,
    subject=None,
    predicate=None,
    object=None,
    subject_closure=None,
    object_closure=None,
    entity=None,
    direct=None,
    offset=0,
    limit=20,
)

Retrieve paginated association records, with filter options

Parameters:

Name Type Description Default
category List[str]

Filter to only associations matching the specified categories. Defaults to None.

None
predicate List[str]

Filter to only associations matching the specified predicates. Defaults to None.

None
subject List[str]

Filter to only associations matching the specified subjects. Defaults to None.

None
object List[str]

Filter to only associations matching the specified objects. Defaults to None.

None
subject_closure str

Filter to only associations with the specified term ID as an ancestor of the subject. Defaults to None

None
object_closure str

Filter to only associations with the specified term ID as an ancestor of the object. Defaults to None

None
entity List[str]

Filter to only associations where the specified entities are the subject or the object. Defaults to None.

None
offset int

Result offset, for pagination. Defaults to 0.

0
limit int

Limit results to specified number. Defaults to 20.

20

Returns:

Name Type Description
AssociationResults AssociationResults

Dataclass representing results of an association search.

get_entity

get_entity(id, extra)

Retrieve a specific entity by exact ID match, with optional extras

Parameters:

Name Type Description Default
id str

id of the entity to search for.

required
extra bool

Whether to include association counts and hierarchy in the response.

required

Returns:

Name Type Description
Entity Node

Dataclass representing results of an entity search.

search

search(
    q="*:*",
    offset=0,
    limit=20,
    category=None,
    in_taxon=None,
    facet_fields=None,
    facet_queries=None,
    filter_queries=None,
    sort=None,
)

Search for entities by label, with optional filters