Permalink
Browse files

obo

  • Loading branch information...
1 parent e28f78b commit 412fc65622488fe81cb867cd14834f7b447d7df0 @cmungall cmungall committed Aug 26, 2010
Showing with 46 additions and 0 deletions.
  1. +46 −0 owl2_obo_parser.pl
View
@@ -0,0 +1,46 @@
+/* -*- Mode: Prolog -*- */
+
+:- module(owl2_obo_parser,
+ [
+ owl_parse_obo_syntax_file/2
+ ]).
+
+:- use_module(owl2_io).
+
+:- multifile owl2_io:suffix_format/2.
+owl2_io:suffix_format(obo,obo).
+
+
+:- multifile owl2_io:load_axioms_hook/3.
+owl2_io:load_axioms_hook(File,obo,Opts) :-
+ owl_parse_obo_syntax_file(File,Opts).
+
+owl_parse_obo_syntax_file(File,Opts) :-
+ absolute_file_name(File,Abs),
+ atom_concat(Abs,'.owl',OwlFile),
+ atom_concat('file://',OwlFile,OwlURI),
+ debug(obo,'obo2owl ~w ==> ~w URI: ~w',[File,OwlFile,OwlURI]),
+ obo2owl(File,OwlFile,OwlURI,Opts).
+
+obo2owl(In,Out,URI,Opts) :-
+ \+ exists_file(Out),
+ !,
+ debug(obo,'creating new owl file: ~w',[URI]),
+ run_obo2owl(In,Out,URI,Opts).
+obo2owl(In,Out,_URI,Opts) :-
+ time_file(In,InTime),
+ time_file(Out,OutTime),
+ debug(obo,'comparing ~w < ~w',[InTime,OutTime]),
+ InTime < OutTime,
+ \+ member(force(true),Opts),
+ !,
+ debug(obo,'~w < ~w -- using existing owl file',[InTime,OutTime]),
+ load_axioms(Out,owl,Opts).
+obo2owl(In,Out,URI,Opts) :-
+ run_obo2owl(In,Out,URI,Opts).
+
+run_obo2owl(In,Out,URI,Opts) :-
+ concat_atom(['obolib-obo2owl','-o',URI,In,'>/dev/null'],' ',Cmd),
+ shell(Cmd),
+ load_axioms(Out,owl,Opts).
+

0 comments on commit 412fc65

Please sign in to comment.