diff options
author | Munyoki Kilyungi | 2023-10-10 19:54:57 +0300 |
---|---|---|
committer | BonfaceKilz | 2023-10-27 13:45:32 +0300 |
commit | 3664f444d124a486274b3fbfaaca65daddf474cc (patch) | |
tree | 85cb0bb7f4d44de3a83b3bdfdd98e658fcc340a1 /gn3 | |
parent | 21dc453d7ef4a9cb7b9fdd0a22a101fca293905a (diff) | |
download | genenetwork3-3664f444d124a486274b3fbfaaca65daddf474cc.tar.gz |
Derive RDF_PREFIXES string from PREFIXES.
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
Diffstat (limited to 'gn3')
-rw-r--r-- | gn3/db/rdf.py | 45 |
1 files changed, 23 insertions, 22 deletions
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: <http://www.w3.org/ns/dcat#> -PREFIX dct: <http://purl.org/dc/terms/> -PREFIX ex: <http://example.org/stuff/1.0/> -PREFIX foaf: <http://xmlns.com/foaf/0.1/> -PREFIX generif: <http://www.ncbi.nlm.nih.gov/gene?cmd=Retrieve&dopt=Graphics&list_uids=> -PREFIX genotype: <http://genenetwork.org/genotype/> -PREFIX gn: <http://genenetwork.org/id/> -PREFIX gnc: <http://genenetwork.org/category/> -PREFIX gnt: <http://genenetwork.org/term/> -PREFIX owl: <http://www.w3.org/2002/07/owl#> -PREFIX phenotype: <http://genenetwork.org/phenotype/> -PREFIX publication: <http://genenetwork.org/publication/> -PREFIX pubmed: <http://rdf.ncbi.nlm.nih.gov/pubmed/> -PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> -PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> -PREFIX skos: <http://www.w3.org/2004/02/skos/core#> -PREFIX taxon: <https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=Info&id=> -PREFIX up: <http://purl.uniprot.org/core/> -PREFIX xkos: <http://rdf-vocabulary.ddialliance.org/xkos#> -PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> -""" + +RDF_PREFIXES = "\n".join([f"PREFIX {key}: <{value}>"for key, value in PREFIXES.items()]) def sparql_query( |