<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app
  PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
  "http://java.sun.com/dtd/web-app_2_3.dtd">

<!--
  This file is an exemplary web.xml file to start AceWiki and the ACE Editor.
-->

<web-app>

  <!--
    This text shows up as the title of the browser window.
  -->
  <display-name>Attempto Web Applications</display-name>


  <!-- Parameters -->

  <!--
    AceWiki needs to connect to the ACE parser (APE). This can be done by either
    directly call "ape.exe" (which can be compiled from the APE package), or by
    communicating to an APE server via a socket or a web service connection. This
    parameter specifies how APE should be accessed: "local", "socket" and
    "webservice" are allowed values.
  -->
  <context-param>
    <param-name>apetype</param-name>
    <param-value>local</param-value>
  </context-param>

  <!--
    This parameter defines the name (should always be "ape.exe") and the
    path of the executable when apetype is "local". The path can be omitted
    if the executable is located in the home directory of the servlet
    container service. Note that putting the path of "ape.exe" into the PATH
    environment variable is not sufficient.
  -->
  <context-param>
    <param-name>apecommand</param-name>
    <param-value>ape.exe</param-value>
  </context-param>

  <!--
    This parameter defines the host of the APE socket server for the case
    that apetype is "socket".
  -->
  <context-param>
    <param-name>apehost</param-name>
    <param-value>localhost</param-value>
  </context-param>

  <!--
    This parameter defines the port of APE socket server, when apetype is
    "socket". You can set up a locally running APE socket server by:
    ape.exe -server -port 2766
  -->
  <context-param>
    <param-name>apeport</param-name>
    <param-value>2766</param-value>
  </context-param>

  <!--
    This parameter defines the URL of an APE web service for the case that
    apetype is "webservice". There is a demo webservice running at:
    http://attempto.ifi.uzh.ch/ws/ape/apews.perl
    but it is recommended to set up your own webservice using e.g.
    ape.exe -httpserver -port 8000
  -->
  <context-param>
    <param-name>apewebservice</param-name>
    <param-value>http://localhost:8000</param-value>
  </context-param>

  <!--
    This parameter sets the directory for the log files. The value shown below is also the default.
  -->
  <context-param>
    <param-name>logdir</param-name>
    <param-value>logs</param-value>
  </context-param>

  <!--
    This parameter sets the directory for the AceWiki data. The value shown below is also the
    default.
  -->
  <context-param>
    <param-name>datadir</param-name>
    <param-value>data</param-value>
  </context-param>


  <!-- Servlets -->


  <!--
    The following is an exemplary servlet definition for an AceWiki backend. A backend manages the
    ontology, and several frontends can connect to one backend (i.e. connect to the same ontology).
  -->
  <servlet>

    <!--
      The name of the servlet is used as an identifier for the mappings (see below).
    -->
    <servlet-name>AceWikiBackend</servlet-name>

    <!--
      This argument points to the servlet class.
    -->
    <servlet-class>ch.uzh.ifi.attempto.acewiki.BackendServlet</servlet-class>

    <!--
      This parameter ensures that the backend starts before the frontend.
    -->
    <load-on-startup>1</load-on-startup>

    <!--
      The parameter 'ontology' is mandatory and specifies the name of the ontology. This name is
      used in the URIs of the OWL statements and for the file names on the server. Several servlet
      definitions can refer to the same ontology with the consequence that they access the same
      knowledge base.
    -->
    <init-param>
      <param-name>ontology</param-name>
      <param-value>test</param-value>
    </init-param>

    <!--
      The 'baseuri' parameter defines the base URI for the OWL statements. The URI for the ontology
      elements (i.e. words) are a concatenation of baseURI + ontologyName + word.
    -->
    <init-param>
      <param-name>baseuri</param-name>
      <param-value>http://attempto.ifi.uzh.ch/acewiki/</param-value>
    </init-param>

    <!--
      The 'reasoner' parameter specifies the reasoner or reasoner interface to be used. The
      following options are available at the moment:

      'HermiT':  The integrated HermiT reasoner is used. This is the default.
      'OWLlink': The OWLlink reasoner interface is applied, which can connect to reasoners like
                 FaCT++, Pellet or HermiT in a separate process (local or remote).
      'Pellet':  The Pellet OWL reasoner is called directly via the OWL API. Note that the AceWiki
                 package does not contain the Pellet libraries (because of license reasons). You
                 have to copy the files pellet-cli.jar, pellet-core.jar, pellet-datatypes.jar,
                 pellet-el.jar, pellet-owlapiv3.jar, and pellet-rules.jar into the directory "lib".
                 Pellet version 2.0.0 or later is needed.
      'none':    No reasoner is used.
    -->
    <init-param>
      <param-name>reasoner</param-name>
      <param-value>HermiT</param-value>
    </init-param>

    <!--
      The parameter 'reasoner_url' defines the URL over which the reasoner should be accessed. This
      parameter is only used when 'reasoner' is set to 'OWLlink'. The value shown below is also the
      default.
    -->
    <init-param>
      <param-name>reasoner_url</param-name>
      <param-value>http://localhost:8080</param-value>
    </init-param>

    <!--
      The parameter 'global_restrictions_policy' defines how the global restrictions on the axioms
      in OWL 2 should be ensured. See the following chapter of the OWL 2 documentation:
      http://www.w3.org/TR/2009/REC-owl2-syntax-20091027/#Global_Restrictions_on_Axioms_in_OWL_2_DL
      At the moment, only 'no_chains' (default) and 'unchecked' are supported. 'no_chains' has the
      effect that axioms containing property chains or transitivity are generally not considered
      for reasoning. 'unchecked' allows for the violation of the global restrictions and should
      only be used for testing. More options should become available in the future.
    -->
    <init-param>
      <param-name>global_restrictions_policy</param-name>
      <param-value>no_chains</param-value>
    </init-param>

    <!--
      The parameter 'owl_profile' can be used to set an OWL profile that defines which statements
      are used for reasoning. Possible values are "OWL2Full" (default), "OWL2EL", "OWL2QL", and
      "OWL2RL". Note that the global restrictions of the EL profile are not checked. See the
      following document for more information about the OWL profiles:
      http://www.w3.org/TR/owl2-profiles/
    -->
    <init-param>
      <param-name>owl_profile</param-name>
      <param-value>OWL2Full</param-value>
    </init-param>

  </servlet>

  <!--
    The following is an AceWiki frontend servlet connecting to the above defined backend. (It is
    possible to combine the frontend and backend in one single servlet by defining the respective
    parameters in the same servlet definition.)
  -->
  <servlet>
    <servlet-name>AceWiki</servlet-name>
    <servlet-class>ch.uzh.ifi.attempto.acewiki.AceWikiServlet</servlet-class>

    <!--
      This parameter refers to the backend servlet.
    -->
    <init-param>
      <param-name>backend</param-name>
      <param-value>AceWikiBackend</param-value>
    </init-param>

    <!--
      The parameter 'title' defines the title that is shown below the AceWiki logo.
    -->
    <init-param>
      <param-name>title</param-name>
      <param-value>AceWiki test</param-value>
    </init-param>

    <!--
      The 'login' parameter defines whether the login features are enabled: 'no' means that no
      login is possible (default); 'yes' means that login with password protection is enabled. The
      option 'nonpw' for a login without password is no longer supported.
    -->
    <init-param>
      <param-name>login</param-name>
      <param-value>yes</param-value>
    </init-param>

    <!--
      The 'login_required' parameter defines if and when login is required: 'no' means that no
      login is required to view and edit the wiki data (default); 'edit' means that login is
      required to edit the wiki data but not to view it; 'yes' means that login is required for
      viewing or editing the wiki data. This option is only relevant if the 'login' option is set
      to 'yes'.
    -->
    <init-param>
      <param-name>login_required</param-name>
      <param-value>edit</param-value>
    </init-param>

    <!--
      The 'register' parameter defines whether users can register themselves: 'yes' means that
      everyone can register (default); 'no' means that only users who are already registered
      (either done manually on the server or registered earlier when this option was 'yes') can
      login. This option is only relevant if the 'login' option is set to 'yes'.
    -->
    <init-param>
      <param-name>register</param-name>
      <param-value>yes</param-value>
    </init-param>

    <!--
      The parameter 'readonly' can be used to lock the wiki data so that no changes can be made.
      The default is 'off'.
    -->
    <init-param>
      <param-name>readonly</param-name>
      <param-value>off</param-value>
    </init-param>

  </servlet>

  <!--
    You can have several servlet definitions of the same servlet class within a single web.xml
    file. The code below launches a second AceWiki backend instance with a second frontend.
  -->
  <servlet>
    <servlet-name>AceWikiBackend2</servlet-name>
    <servlet-class>ch.uzh.ifi.attempto.acewiki.BackendServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
    <init-param>
      <param-name>ontology</param-name>
      <param-value>anothertest</param-value>
    </init-param>
    <init-param>
      <param-name>baseuri</param-name>
      <param-value>http://attempto.ifi.uzh.ch/acewiki/</param-value>
    </init-param>
  </servlet>

  <servlet>
    <servlet-name>AceWiki2</servlet-name>
    <servlet-class>ch.uzh.ifi.attempto.acewiki.AceWikiServlet</servlet-class>
    <init-param>
      <param-name>backend</param-name>
      <param-value>AceWikiBackend2</param-value>
    </init-param>
  </servlet>
  
  
  <!--
    The following servlets (one backend and three frontends) start an experimental version of a
    GF-based wiki that can be viewed and edited in different languages.
  -->
  <servlet>
  
    <servlet-name>GFWikiBackend</servlet-name>
    <servlet-class>ch.uzh.ifi.attempto.acewiki.BackendServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
    
    <!--
      This parameter has the consequence that the GF-engine is used instead of the default one.
    -->
    <init-param>
      <param-name>engine_class</param-name>
      <param-value>ch.uzh.ifi.attempto.acewiki.gf.GFEngine</param-value>
    </init-param>
    
    <!--
      This points to the pgf file with the grammar definition.
    -->
    <init-param>
      <param-name>pgf_file</param-name>
      <param-value>ch/uzh/ifi/attempto/acewiki/gf/Foods.pgf</param-value>
    </init-param>
    
    <!--
      This parameter defines all supported languages as a comma-separated list. The first
      one is the default, which is used for logging and for serialization.
    -->
    <init-param>
      <param-name>languages</param-name>
      <param-value>Eng,Ger,Ita</param-value>
    </init-param>
    
    <init-param>
      <param-name>ontology</param-name>
      <param-value>gf</param-value>
    </init-param>
  
  </servlet>
  
  <servlet>
  
    <servlet-name>GFWikiEng</servlet-name>
    <servlet-class>ch.uzh.ifi.attempto.acewiki.AceWikiServlet</servlet-class>
    
    <init-param>
      <param-name>backend</param-name>
      <param-value>GFWikiBackend</param-value>
    </init-param>
    
    <!--
      This parameter defines the language of the frontend instance.
    -->
    <init-param>
      <param-name>language</param-name>
      <param-value>Eng</param-value>
    </init-param>
    
    <init-param>
      <param-name>title</param-name>
      <param-value>GF Wiki in English</param-value>
    </init-param>
  
  </servlet>

  <servlet>
    <servlet-name>GFWikiGer</servlet-name>
    <servlet-class>ch.uzh.ifi.attempto.acewiki.AceWikiServlet</servlet-class>
    <init-param>
      <param-name>backend</param-name>
      <param-value>GFWikiBackend</param-value>
    </init-param>
    <init-param>
      <param-name>language</param-name>
      <param-value>Ger</param-value>
    </init-param>
    <init-param>
      <param-name>title</param-name>
      <param-value>GF Wiki in German</param-value>
    </init-param>
  </servlet>

  <servlet>
    <servlet-name>GFWikiIta</servlet-name>
    <servlet-class>ch.uzh.ifi.attempto.acewiki.AceWikiServlet</servlet-class>
    <init-param>
      <param-name>backend</param-name>
      <param-value>GFWikiBackend</param-value>
    </init-param>
    <init-param>
      <param-name>language</param-name>
      <param-value>Ita</param-value>
    </init-param>
    <init-param>
      <param-name>title</param-name>
      <param-value>GF Wiki in Italian</param-value>
    </init-param>
  </servlet>


  <!--
    The following is an exemplary servlet definition for an ACE Editor instance.
  -->
  <servlet>

    <!--
      The name of the servlet is used as an identifier for the mappings (see below).
    -->
    <servlet-name>ACE Editor</servlet-name>

    <!--
      This argument points to the servlet class.
    -->
    <servlet-class>ch.uzh.ifi.attempto.aceeditor.ACEEditorServlet</servlet-class>

    <!--
      The parameter 'lexicon' points to the lexicon file that should be loaded. This file should be
      formatted according to the ACE Lexicon Specification (see
      http://attempto.ifi.uzh.ch/site/docs/ace_lexicon.html).
    -->
    <init-param>
      <param-name>lexicon</param-name>
      <param-value>aceeditor_lexicon.pl</param-value>
    </init-param>

    <!--
      The parameter 'immutable_lexicon' defines whether the lexicon is immutable or can be changed
      by users.
    -->
    <init-param>
      <param-name>immutable_lexicon</param-name>
      <param-value>off</param-value>
    </init-param>

    <!--
      The parameter 'parse_with_clex' defines whether the compiled lexicon of the APE executable
      should be used for parsing the ACE sentences. Only the compiled lexicon of APE is used if the
      value is 'off'. If it is 'on' then the lexicon entries are passed to APE whenever a sentence
      is parsed. This parameter should always be 'off' if the parameter 'immutable_lexicon' (see
      above) is 'off'.
    -->
    <init-param>
      <param-name>parse_with_clex</param-name>
      <param-value>off</param-value>
    </init-param>

    <!--
      The parameter 'max_upload_file_size' defines the maximum size in bytes for files to be
      uploaded by users. 0 means unlimited file size. Uploading large files can make the web
      application become unresponsive or even crash.
    -->
    <init-param>
      <param-name>max_upload_file_size</param-name>
      <param-value>10000</param-value>
    </init-param>

  </servlet>
  
  
  <!-- Mappings -->

  <!--
    The mappings connect url-patterns with the servlets that should be shown when the respective
    URL is requested by the client. This can also be the root directory "/" of the servlet or a
    deeper structure like "/test/app1/".
  -->

  <!--
    This is the mapping for the first AceWiki instance.
  -->
  <servlet-mapping>
    <servlet-name>AceWiki</servlet-name>
    <url-pattern>/acewiki/</url-pattern>
  </servlet-mapping>

  <!--
    This is the mapping for the second AceWiki instance.
  -->
  <servlet-mapping>
    <servlet-name>AceWiki2</servlet-name>
    <url-pattern>/acewiki2/</url-pattern>
  </servlet-mapping>
  
  <!--
    These are the mappings for the multilingual GF engine (experimental).
  -->
  <servlet-mapping>
    <servlet-name>GFWikiEng</servlet-name>
    <url-pattern>/gfeng/</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>GFWikiGer</servlet-name>
    <url-pattern>/gfger/</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>GFWikiIta</servlet-name>
    <url-pattern>/gfita/</url-pattern>
  </servlet-mapping>
  
  <!--
    In some circumstances, the backends need URL-mappings too, because some environments skip
    servlets without mappings.
  -->
  <servlet-mapping>
    <servlet-name>AceWikiBackend</servlet-name>
    <url-pattern>/acewiki/backend/</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>AceWikiBackend2</servlet-name>
    <url-pattern>/acewiki2/backend/</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>GFWikiBackend</servlet-name>
    <url-pattern>/gf/</url-pattern>
  </servlet-mapping>
  
  <!--
    This is the mapping for the ACE Editor servlet.
  -->
  <servlet-mapping>
    <servlet-name>ACE Editor</servlet-name>
    <url-pattern>/aceeditor/</url-pattern>
  </servlet-mapping>
  
</web-app>
