Skip to content

Commit e6ffd4f

Browse files
authored
Merge pull request #82 from zhlu9890/develop
add ontology_get_term_by_name query
2 parents 31650ee + f727ed8 commit e6ffd4f

2 files changed

Lines changed: 430 additions & 0 deletions

File tree

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Get ontology term by searching name
2+
3+
name: ontology_get_term_by_name
4+
params:
5+
type: object
6+
required: [name, ts, "@onto_terms", "@onto_edges"]
7+
properties:
8+
name:
9+
type: string
10+
title: Ontology term's name
11+
description: Name of the Ontology term you want to get
12+
examples: ["terrestrial biome"]
13+
ancestor_term:
14+
type: string
15+
title: Ancestor ontology term
16+
description: Optional ancestor ontology term
17+
examples: ["ENVO:00000428"]
18+
ts:
19+
type: integer
20+
title: Versioning timestamp
21+
"@onto_terms":
22+
type: string
23+
title: Ontology terms collection name
24+
examples: ["ENVO_terms"]
25+
"@onto_edges":
26+
type: string
27+
title: Ontology edges collection name
28+
examples: ["ENVO_edges"]
29+
query_prefix: WITH @@onto_terms
30+
query: |
31+
LET ancestor_term_null=IS_NULL(@ancestor_term) OR LENGTH(@ancestor_term) == 0
32+
FOR t in @@onto_terms
33+
FILTER LOWER(t.name) == LOWER(@name)
34+
FILTER t.created <= @ts AND t.expired >= @ts
35+
limit 1
36+
FOR v, e, p IN 1..100 OUTBOUND t @@onto_edges
37+
FILTER ancestor_term_null OR v.id == @ancestor_term
38+
FILTER p.edges[*].created ALL <= @ts
39+
AND p.edges[*].expired ALL >= @ts
40+
AND p.edges[*].type ALL == "is_a"
41+
RETURN DISTINCT t

0 commit comments

Comments
 (0)