From 3664f444d124a486274b3fbfaaca65daddf474cc Mon Sep 17 00:00:00 2001 From: Munyoki Kilyungi Date: Tue, 10 Oct 2023 19:54:57 +0300 Subject: Derive RDF_PREFIXES string from PREFIXES. Signed-off-by: Munyoki Kilyungi --- gn3/db/rdf.py | 45 +++++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 22 deletions(-) (limited to 'gn3') diff --git a/gn3/db/rdf.py b/gn3/db/rdf.py index b9cb468..521c2b7 100644 --- a/gn3/db/rdf.py +++ b/gn3/db/rdf.py @@ -12,29 +12,30 @@ from SPARQLWrapper import JSON, SPARQLWrapper from gn3.monads import MonadicDict +PREFIXES = { + "dct": "http://purl.org/dc/terms/", + "ex": "http://example.org/stuff/1.0/", + "foaf": "http://xmlns.com/foaf/0.1/", + "generif": "http://www.ncbi.nlm.nih.gov/gene?cmd=Retrieve&dopt=Graphics&list_uids=", + "genotype": "http://genenetwork.org/genotype/", + "gn": "http://genenetwork.org/id/", + "gnc": "http://genenetwork.org/category/", + "gnt": "http://genenetwork.org/term/", + "owl": "http://www.w3.org/2002/07/owl#", + "phenotype": "http://genenetwork.org/phenotype/", + "publication": "http://genenetwork.org/publication/", + "pubmed": "http://rdf.ncbi.nlm.nih.gov/pubmed/", + "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#", + "rdfs": "http://www.w3.org/2000/01/rdf-schema#", + "skos": "http://www.w3.org/2004/02/skos/core#", + "taxon": "https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=Info&id=", + "up": "http://purl.uniprot.org/core/", + "xkos": "http://rdf-vocabulary.ddialliance.org/xkos#", + "xsd": "http://www.w3.org/2001/XMLSchema#", +} -RDF_PREFIXES = """ -PREFIX dcat: -PREFIX dct: -PREFIX ex: -PREFIX foaf: -PREFIX generif: -PREFIX genotype: -PREFIX gn: -PREFIX gnc: -PREFIX gnt: -PREFIX owl: -PREFIX phenotype: -PREFIX publication: -PREFIX pubmed: -PREFIX rdf: -PREFIX rdfs: -PREFIX skos: -PREFIX taxon: -PREFIX up: -PREFIX xkos: -PREFIX xsd: -""" + +RDF_PREFIXES = "\n".join([f"PREFIX {key}: <{value}>"for key, value in PREFIXES.items()]) def sparql_query( -- cgit v1.2.3