aboutsummaryrefslogtreecommitdiff
path: root/gn3/db/rdf.py
AgeCommit message (Expand)Author
2023-10-27Fix pylint error....Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com> Munyoki Kilyungi
2023-10-27Add functions that wrap around the common jsonld patterns....* gn3/db/rdf.py: Import jsonld. (query_frame_and_compact, query_and_compact, query_and_frame): New functions. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com> Munyoki Kilyungi
2023-10-27Break up long line....Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com> Munyoki Kilyungi
2023-10-27Ignore construct result for mypy compliance...This commit addresses the mypy issue below by ignoring the construct result. ``` error: Item "None" of "bytes | str | dict[Any, Any] | Graph | Document | None" has no attribute "serialize" [union-attr] ``` Munyoki Kilyungi
2023-10-27Abstract out (sparql) CONSTRUCT into a function....Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com> Munyoki Kilyungi
2023-10-27Delete gn3.db.rdf.sparql_query....* gn3/api/metadata.py: Remove sparql_query import. * gn3/db/rdf.py: Remove unused imports. (sparql_query): Delete. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com> Munyoki Kilyungi
2023-10-27Delete db.rdf.get_url_local_name....Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com> Munyoki Kilyungi
2023-10-27Implement "GET /metadata/phenotypes/:name"....* gn3/api/metadata.py: Delete gn3.db.rdf.get_phenotype_metadata. (phenotype): Rename this to ... (phenotypes): ... this and implement update logic. * gn3/db/rdf.py (get_phenotype_metadata): Delete. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com> Munyoki Kilyungi
2023-10-27Delete get_dataset_metadata....* gn3/db/rdf.py (get_dataset_metadata): Delete. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com> Munyoki Kilyungi
2023-10-27Implement "GET /metadata/publications/:name"....* gn3/api/metadata.py: Delete gn3.db.rdf.get_publication_metadata. (publication): Rename this ... (publications): ... to this. Return a json-ld result. * gn3/db/rdf.py (get_publication_metadata): Delete. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com> Munyoki Kilyungi
2023-10-27Add fabio: and prism: to PREFIXES....Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com> Munyoki Kilyungi
2023-10-27Implement "GET /metadata/datasets/:name"....* gn3/api/metadata.py: Import json, SPARQLWrapper.{JSON, JSONLD}. (dataset): Rename this to ... (datasets): ... this. Return a well formatted JSONLD result from a dataset. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com> Munyoki Kilyungi
2023-10-27Add missing dcat: prefix.Munyoki Kilyungi
2023-10-27Derive RDF_PREFIXES string from PREFIXES....Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com> Munyoki Kilyungi
2023-10-27Remove get_url_local_name when processing result keys....* gn3/db/rdf.py (sparql_query): Delete "get_url_local_name". Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com> Munyoki Kilyungi
2023-10-27Simplify CONSTRUCT query when fetching a dataset's metadata....* gn3/api/metadata.py (dataset): Update docstring. * gn3/db/rdf.py (get_dataset_metadata): Simplify CONSTRUCT query. Also, now you can fetch metadata using either an accession_id or the dataset's name. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com> Munyoki Kilyungi
2023-10-27Update RDF prefixes....Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com> Munyoki Kilyungi
2023-06-15Fetch genotypes from virtuoso...* gn3/api/metadata.py: Import get_genotype_metadata. (genotype): New end-point. * gn3/db/rdf.py (get_phenotype_metadata): New function. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com> Munyoki Kilyungi
2023-06-12Delete unused import...Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com> Munyoki Kilyungi
2023-06-12Fetch phenotypes from virtuoso...* gn3/api/metadata.py: Import get_phenotype_metadata. (phenotype): New end-point. * gn3/db/rdf.py (get_phenotype_metadata): New function. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com> Munyoki Kilyungi
2023-06-12Delete unused get_trait_metadata function...Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com> Munyoki Kilyungi
2023-06-07Add publication end-point...* gn3/api/metadata.py: Import get_publication_metadata (publication): New endpoint. * gn3/db/rdf.py (get_dataset_metadata): New function. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com> Munyoki Kilyungi
2023-06-07Nest duplicate entries into a list from a sparql result...Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com> Munyoki Kilyungi
2023-06-06Pass geoSeries as a URL...Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com> Munyoki Kilyungi
2023-06-06Rename gn:geoPlatform -> gn:geoPlatformUrl...Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com> Munyoki Kilyungi
2023-06-06Match how dataset metadata is fetched with GN1...* gn3/db/rdf.py (sparql_query): Parse CONSTRUCTS and SELECTS differently. (strip_url): Rename to ... (get_url_local_name): ... this. (get_dataset_metadata): Fetch extra fields in RDF. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com> Munyoki Kilyungi
2023-06-06Replace taxon prefix with ncbiTaxon which references NCBI...Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com> Munyoki Kilyungi
2023-06-02Replace SELECT with CONSTRUCT when fetching a dataset's metadata...* gn3/db/rdf.py: Importh pymonad.Nothing. (get_dataset_metadata): Replace SELECT with CONSTRUCT. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com> Munyoki Kilyungi
2023-06-02Create a function for stripping the last bit from a URL...* gn3/db/rdf.py: Import unquote and urlparse. (strip_url): New function. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com> Munyoki Kilyungi
2023-04-17Create new endpoint for fetching GeneRIF entries...* gn3/api/metadata.py: Import Template, sparql_query and RDF_PREFIXES. (get_genewiki_entries): New endpoint. * gn3/db/rdf.py: Add new constant for storing rdf prefixes. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com> Munyoki Kilyungi
2023-03-01Fetch trait metadata from RDF...* gn3/db/rdf.py (get_dataset_metadata): New function. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com> Munyoki Kilyungi
2022-12-08Remove unused importFrederick Muriuki Muriithi
2022-12-06Use a dataset's name to fetch it's metadata from RDF...* gn3/api/metadata.py (jsonify_dataset_metadata): Rewrite metadata end-point to use a dataset's name instead of it's accession_id. * gn3/db/rdf.py (get_dataset_metadata): Replace accession_id with name. Use one single RDF query instead of multiple queries. Munyoki Kilyungi
2022-11-16Inject SPARQLWrapper as a parameter...* gn3/db/rdf.py: Delete gn3.setting.SPARQL_ENDPOINT import. (sparql_query): Inject SPARQLWrapper. (get_dataset_metadata): Ditto. Munyoki Kilyungi
2022-11-02Re-implement RDF related code to use monads in its own module...* gn3/api/general.py: Replace gn3.db.datasets import with gn3.db.rdf. (dataset_metadata) <jsonify>: Replace datasets.dataset_metadata with rdf.get_dataset_metadata. * gn3/db/datasets.py: Remove unused imports. (sparql_query, dataset_metadata): Delete. * gn3/db/rdf.py: (sparql_query, get_dataset_metadata): New functions. Munyoki Kilyungi