-
Notifications
You must be signed in to change notification settings - Fork 0
/
makehab.pro
62 lines (50 loc) · 1.86 KB
/
makehab.pro
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
:- use_module(bio(bioprolog_util)).
:- use_module(bio(ontol_db)).
tax(T) :-
solutions(T,taxenv(T,_,_),Ts),
member(T,Ts).
makehab(ID,N,TextDef,CDef) :-
tax(T),
atom_concat('NCBITaxon:',Frag,T),
atom_concat('ENVO:H',Frag,ID),
class(T,TN),
debug(e,'tax: ~w',[TN]),
atom_concat(TN,' habitat',N),
setof(E,EN^taxenv(T,E,EN),Es),
maplist(class,Es,ENs),
jlist(ENs,ENA),
sformat(TextDef,'An environmental system which overlaps ~w and supports the growth of an ecological population of ~w',[ENA,TN]),
s(Sys),
solutions(overlaps=E,member(E,Es),Diffs),
CDef=cdef(Sys,[supports_population_of=T|Diffs]).
jlist(L,A) :-
L=[H|T],
concat_atom(T,', ',AT),
concat_atom([H,AT],' and ',A).
whab :-
makehab(ID,N,TextDef,CDef),
format('[Term]~n'),
format('id: ~w~n',[ID]),
format('name: ~w~n',[N]),
format('def: "~w" []~n',[TextDef]),
CDef=cdef(_,Diffs),
format('intersection_of: ENVO:01000254 ! environmental system~n',[]),
forall(member(R=D,Diffs),
( class(D,DN),
format('intersection_of: ~w ~w ! ~w~n',[R,D,DN]))),
nl,
fail.
h('ENVO:00002036').
s('ENVO:01000254').
/*
Based on Vangelis' mappings of EOL species to ENVO classes, we would
automatically generate these classes in experimental branches of ENVO (for
the environments) and PCO (for the ecological populations of each species)
where:
- "[Species S] habitat" is an environmental system which overlaps with
[ENVO classes E1...En] and supports the growth of a [PCO ecological
population of Species S]"
- subclass axioms would be something like "'Species S habitat' overlaps
some 'ENVO class Ei'" and "'Species S habitat' habitat for some [PCO
ecological population of Species S]"
*/