/*
 * Copyright (C) 1999-2004 <a href="mailto:mandarax@jbdietrich.com">Jens Dietrich</a>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
package org.mandarax.xkb;


import org.jdom.Document;
import org.mandarax.kernel.KnowledgeBase;
import org.mandarax.util.logging.LogCategories;

/**
 * Interface for xkb driver that can import / export knowledge bases from/to
 * xml data sources. XML data sources are represented by JDOM objects.
 * Question: should we avoid dependency on jdom on this abstract level?
 * <br>
 * <strong>Important Note:</strong>In version 2.2 the similar ZKB framework has been added. In the long term
 * ZKB will replace XKB! For details, see the <code>org.mandarax.zkb</code> package.
 * @author <A HREF="mailto:mandarax@jbdietrich.com">Jens Dietrich</A>
 * @version 3.3.1 <9 August 2004>
 * @since 1.4
 */
public interface XKBDriver extends LogCategories {

    /**
     * Export a knowledge base, i.e., convert it into an xml document.
     * @return an xml document
     * @param kb a knowledge base
     * @throws an XKBException is thrown if export fails
     */
    Document exportKnowledgeBase(KnowledgeBase kb) throws XKBException;

    /**
     * Get a short text describing the driver.
     * @return a text
     */
    String getDescription();

    /**
     * Get the location (URL) of the associated DTD.
     * @return a text
     */
    String getDTD();

    /**
     * Get the name of the driver.
     * @return a text
     */
    String getName();

    /**
     * Import a knowledge base, i.e., build it from an xml document.
     * @return a knowledge base
     * @param doc an xml document
     * @throws an XKBException is thrown if import fails
     */
    KnowledgeBase importKnowledgeBase(Document doc) throws XKBException;

    /**
     * Indicates whether the driver (and the underlying xml format (=dtd))
     * supports auto facts.
     * @return a boolean
     */
    boolean supportsAutoFacts();

    /**
     * Indicates whether the driver (and the underlying xml format (=dtd))
     * supports clause sets.
     * @return a boolean
     */
    boolean supportsClauseSets();

    /**
     * Indicates whether the driver (and the underlying xml format (=dtd))
     * supports facts. (some formats might see facts as rules without body)
     * @return a boolean
     */
    boolean supportsFacts();

    /**
     * Indicates whether the driver (and the underlying xml format (=dtd))
     * supports functions.
     * @return a boolean
     */
    boolean supportsFunctions();

    /**
     * Indicates whether the driver (and the underlying xml format (=dtd))
     * supports the java semantics (e.g. JFunctions, JPredicate).
     * @return a boolean
     */
    boolean supportsJavaSemantics();

    /**
     * Indicates whether the driver (and the underlying xml format (=dtd))
     * supports multiple premises.
     * @return a boolean
     */
    boolean supportsMultiplePremises();

    /**
     * Indicates whether the driver (and the underlying xml format (=dtd))
     * supports multiple premises connected by OR.
     * @return a boolean
     */
    boolean supportsOrPremises();

    /**
     * Indicates whether the driver (and the underlying xml format (=dtd))
     * supports types.
     * @return a boolean
     */
    boolean supportsTypes();
    
    /**
     * Indicates whether the driver (and the underlying xml format (=dtd))
     * supports queries.
     * @return a boolean
     */
    boolean supportsQueries();  
    /**
	 * Indicates whether the driver (and the underlying xml format (=dtd))
	 * supports negation as failure.
	 * @return a boolean
	 */
	boolean supportsNegationAsFailure();
}
