this provides a convenience layer for working with a Solr database whose schema is defined in LinkML. It provides bindings both from slots in your schema to queries, and binds result objects to your object model.
import tests.test_models.amigo as amigo
qe = SolrQueryEngine(schema=schema,
endpoint=SolrEndpoint(url=my_solr_url))
result = qe.search(target_class=OntologyClass,
isa_partof_closure='GO:0031965') ## nuclear membrane
for oc in result.items:
print(f'Term: {oc.id} {oc.annotation_class_label} ... ')
Unlike querying with the native pysolr API, this will validate input keys (which your IDE will be aware of), and will instantiate an instance of your model class.
- validate query inputs (also IDE-aware)
- instantiate classes in your object model
- provide mappings from abstracted domain model concepts
See tests/test_models/amigo.yaml for an example schema
(this schema was autogenerated from the AmiGO schema
pipenv run gen-python myschema.yaml > myschema.py
See tests/test_models/amigo.py for an example
See tests/test_query.py for an example
More documentation coming soon. For now, consult the tests.
See the Makefile:
tests/test_models/amigo.yaml: linkml_solr/utils/golr_schema_utils.py
pipenv run python $< tests/test_golr/*yaml > $@
Alpha code. Functionality is very incomplete
- write
- customizable dynamic mapping
- automatic de-nesting/de-normalization
- autogen of model-specific API
- expose additional solr functionality