1% This file is part of the Attempto Parsing Engine (APE).
    2% Copyright 2008-2010, Kaarel Kaljurand <kaljurand@gmail.com>.
    3%
    4% The Attempto Parsing Engine (APE) is free software: you can redistribute it and/or modify it
    5% under the terms of the GNU Lesser General Public License as published by the Free Software
    6% Foundation, either version 3 of the License, or (at your option) any later version.
    7%
    8% The Attempto Parsing Engine (APE) is distributed in the hope that it will be useful, but WITHOUT
    9% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
   10% PURPOSE. See the GNU Lesser General Public License for more details.
   11%
   12% You should have received a copy of the GNU Lesser General Public License along with the Attempto
   13% Parsing Engine (APE). If not, see http://www.gnu.org/licenses/.
   14
   15
   16:- module(get_owl_output, [
   17		get_owl_output/6
   18	]).

Interface for the OWL outputs

author
- Kaarel Kaljurand
version
- 2010-11-26

*/

   28:- use_module(drs_to_owlswrl).   29:- use_module(owlfss_owlrdfxml).   30:- use_module(owlswrl_to_xml).   31:- use_module(owlswrl_to_fss).   32:- use_module('../../logger/error_logger').   33
   34:- use_module('../xmlterm_to_xmlatom', [
   35		xmlterm_to_xmlatom/2
   36	]).   37
   38:- use_module('../serialize_term', [
   39		serialize_term_into_atom/2
   40	]).
 get_owl_output(+OwlOutputType:atom, +Comment:atom, +Drs:term, +Uri:atom, -ContentType:atom, -Output:atom) is det
Arguments:
OwlOutputType- is one of {owlfss, owlfsspp, owlxml}
Comment- is a comment to be included in the ontology (currently ignored)
Drs- is an Attempto DRS
Uri- is the name of the ontology to be created
ContentType- is the content type of the result, one of {text/xml, text/plain}
Output- is the output of the conversion to OWL
   52get_owl_output(owlrdf, Comment, Drs, Uri, 'text/xml', Output) :-
   53	ignore(drs_to_owlswrl:drs_to_owlswrl(Drs, Uri, Comment, OwlFss)),
   54	(
   55		get_messages_with_type(owl, [])
   56	->
   57		owlfss_owlrdfxml:owlfss_owlrdfxml(OwlFss, OwlRdfxml),
   58		xmlterm_to_xmlatom(OwlRdfxml, Output)
   59	;
   60		Output = ''
   61	).
   62
   63get_owl_output(owlfss, Comment, Drs, Uri, 'text/plain', Output) :-
   64	ignore(drs_to_owlswrl:drs_to_owlswrl(Drs, Uri, Comment, OwlFss)),
   65	(
   66		get_messages_with_type(owl, [])
   67	->
   68		serialize_term_into_atom(OwlFss, Output)
   69	;
   70		Output = ''
   71	).
   72
   73get_owl_output(owlfsspp, Comment, Drs, Uri, 'text/plain', Output) :-
   74	ignore(drs_to_owlswrl:drs_to_owlswrl(Drs, Uri, Comment, OwlFss)),
   75	(
   76		get_messages_with_type(owl, [])
   77	->
   78		owlswrl_to_fss:owlswrl_to_fss(OwlFss, Output)
   79	;
   80		Output = ''
   81	).
   82
   83get_owl_output(owlxml, Comment, Drs, Uri, 'text/xml', Output) :-
   84	ignore(drs_to_owlswrl:drs_to_owlswrl(Drs, Uri, Comment, OwlFss)),
   85	(
   86		get_messages_with_type(owl, [])
   87	->
   88		owlswrl_to_xml:owlswrl_to_xml(OwlFss, OwlXml),
   89		xmlterm_to_xmlatom(OwlXml, Output)
   90	;
   91		Output = ''
   92	)