Skip to content

Solr

SolrImplementation dataclass

Bases: EntityInterface, AssociationInterface, SearchInterface, GroundingInterface

Implementation of Monarch Interfaces for Solr endpoint

get_association_counts

Get list of association counts for a given entity

get_associations

Retrieve paginated association records, with filter options

Parameters:

Name Type Description Default
category List[AssociationCategory]

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

None
predicate List[AssociationPredicate]

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

None
subject Optional[List[str]]

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

None
object Optional[List[str]]

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

None
subject_closure Optional[str]

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

None
object_closure Optional[str]

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

None
entity Optional[List[str]]

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

None
q Optional[str]

Query string to search within matches. Defaults to None.

None
compact bool

Return compact results with fewer fields. Defaults to False.

False
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 Union[AssociationResults, CompactAssociation]

Dataclass representing results of an association search.

get_counterpart_entities

Get a list of entities directly associated with this_entity fetched from associations in the Solr index

Parameters:

Name Type Description Default
this_entity Entity

The entity to get associations for

required
entity str

an entity ID occurring in either the subject or object. Defaults to None.

None
subject str

an entity ID occurring in the subject. Defaults to None.

None
predicate str

a predicate value. Defaults to None.

None
object str

an entity ID occurring in the object. Defaults to None.

None

get_entity

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 Optional[Union[Node, Entity]]

Dataclass representing results of an entity search.

Node Optional[Union[Node, Entity]]

Dataclass representing results of an entity search with extra=True.

get_histopheno

Get histopheno counts for a given subject_closure

get_multi_entity_associations

Get associations between multiple entities and counterparts of a given category

Parameters:

Name Type Description Default
entity List[str]

List of entity IDs to get associations for

required
counterpart_category List[str]

List of categories of counterpart entity to get associations for. Defaults to None.

None
offset int

Result offset, for pagination. Defaults to 0.

0
limit int

Limit results to specified number. Defaults to 20.

required
limit_per_group int

Limit results to specified number per group. Defaults to 20.

20

ground_entity

Grounds a single entity

Parameters:

Name Type Description Default
text str

Text to ground

required

Returns:

Name Type Description
Entity List[Entity]

Dataclass representing a single entity

search

Search for entities by label, with optional filters

Parameters:

Name Type Description Default
q str

Query string. Defaults to ":".

'*:*'
offset int

Result offset, for pagination. Defaults to 0.

0
limit int

Limit results to specified number. Defaults to 20.

20
category List[str]

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

None
in_taxon_label List[str]

Filter to only entities matching the specified taxon label. Defaults to None.

None
facet_fields List[str]

List of fields to include facet counts for. Defaults to None.

None
facet_queries List[str]

List of queries to include facet counts for. Defaults to None.

None
filter_queries List[str]

List of queries to filter results by. Defaults to None.

None
sort str

Sort results by the specified field. Defaults to None.

None

Returns:

Name Type Description
SearchResults SearchResults

Dataclass representing results of a search.

solr_is_available

Check if the Solr instance is available