diff options
author | Munyoki Kilyungi | 2024-09-02 19:17:00 +0300 |
---|---|---|
committer | BonfaceKilz | 2024-09-05 16:39:14 +0300 |
commit | 3f3d711ea04ea8b3c680557a58d174259695044d (patch) | |
tree | ed5c9142c0cc418777c993842b12edf3ddf333fa /gn3 | |
parent | 31efdc3b1060aeb9187a5b1d641c7e5632ff2538 (diff) | |
download | genenetwork3-3f3d711ea04ea8b3c680557a58d174259695044d.tar.gz |
Set OPTIONAL values to default to an empty string.
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
Diffstat (limited to 'gn3')
-rw-r--r-- | gn3/db/rdf/wiki.py | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/gn3/db/rdf/wiki.py b/gn3/db/rdf/wiki.py index a78dd74..a208b74 100644 --- a/gn3/db/rdf/wiki.py +++ b/gn3/db/rdf/wiki.py @@ -119,19 +119,24 @@ CONSTRUCT { dct:hasVersion ?version ; dct:identifier $comment_id ; dct:identifier ?id_ . - OPTIONAL { ?uid gnt:reason ?reason } . + OPTIONAL { ?uid gnt:reason ?reason_ } . OPTIONAL { ?uid gnt:belongsToSpecies ?speciesId . - ?speciesId gnt:shortName ?species . + ?speciesId gnt:shortName ?species_ . } . - OPTIONAL { ?uid dct:references ?pubmedId . } . - OPTIONAL { ?uid foaf:homepage ?weburl . } . - OPTIONAL { ?uid gnt:initial ?usercode . } . - OPTIONAL { ?uid foaf:mbox ?email . } . - OPTIONAL { ?uid gnt:belongsToCategory ?category . } . + OPTIONAL { ?uid dct:references ?pmid . } . + OPTIONAL { ?uid foaf:homepage ?weburl_ . } . + OPTIONAL { ?uid gnt:initial ?usercode_ . } . + OPTIONAL { ?uid foaf:mbox ?email_ . } . + OPTIONAL { ?uid gnt:belongsToCategory ?category_ . } . BIND (str(?version) AS ?versionId) . - BIND (str(?pubmedId) AS ?pmid) . BIND (str(?createTime) AS ?created) . + BIND (COALESCE(?reason_, "") AS ?reason) . + BIND (COALESCE(?weburl_, "") AS ?weburl) . + BIND (COALESCE(?usercode_, "") AS ?usercode) . + BIND (COALESCE(?email_, "") AS ?email) . + BIND (COALESCE(?species_, "") AS ?species) . + BIND (COALESCE(?category_, "") AS ?category) . } ORDER BY DESC(?version) DESC(?createTime) """).substitute(prefix=RDF_PREFIXES, comment_id=comment_id) results = query_frame_and_compact( |