<?xml version="1.0"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd">
<?rfc toc="yes"?>
<?rfc compact="yes"?>
<?rfc subcompact="no"?>
<?rfc editing="no"?>
<?rfc private="Nine by Nine"?>

<rfc docName="Swish">

  <front>
    <title abbrev="Swish">Semantic Web Inference using Haskell</title>
    <author initials="G." surname="Klyne" fullname="Graham Klyne">
      <organization abbrev="Nine by Nine">Nine by Nine</organization>
      <address>
        <postal>
          <street>14 Chambrai Close</street>
          <street>Appleford</street>
          <city>Abingdon</city>
          <region>Oxon</region>
          <code>OX14 4NT</code>
          <country>UK</country>
        </postal>
        <phone>+44 1235 848491</phone>
        <facsimile>+44 1235 848562</facsimile>
        <email>GK-swish@ninebynine.org</email>
        <uri>http://www.ninebynine.net/</uri>
      </address>
    </author>
    <date day="29" month="May" year="2003"/>
    <keyword>Inference</keyword>
    <keyword>RDF</keyword>
    <keyword>Notation3</keyword>
    <keyword>Semantic Web</keyword>
    <keyword>Haskell</keyword>
    <keyword>W3C</keyword>
    <keyword>XML</keyword>
    <abstract>
      <t>This memo describes the software package Swish, which is
         being developed to conduct experiments in using the
         programming language Haskell as a basis for performing
         inference on Semantic Web data.
      </t>
    </abstract>
    <note title="&copy; 2003 G. Klyne;  Some rights reserved.">
      <t>$Id: swish-0.1.xml,v 1.1 2003/12/19 15:50:01 graham Exp $</t>
    </note>
  </front>

  <middle>

    <!-- Introduction -->
    <section anchor="Introduction" title="Introduction">
      <t>This memo describes Swish, a software package that is intended
         to provide a framework for building programs in Haskell that
         perform inference on RDF <xref target="W3C.rdf-syntax"/> data.
      </t>
      <t>Swish is primarily intended to be used as a starting point for 
         developing new RDF applications in Haskell, but it also includes
         a stand-alone program that can be used to perform some simple
         manipulation of RDF data. 
         Currently, only the Notation 3 <xref target="ref-notation3"/> 
         serialization form is supported, but I'd like to add support 
         for full RDF/XML in due course.
      </t>
      <t>The software can be downloaded from the web by following links 
         from <eref target="http://www.ninebynine.org/Software/Intro.html"/>.
         This software is made generally available under the GNU General 
         Public Licence (GPL), version 2 (or later), a full copy of 
         which is available at 
         <eref target="http://www.gnu.org/licenses/gpl.html"/>, and
         also as file GPL.TXT in the Swish software distribution.
         Other licensing arrangements may be negotiated with the
         author:  see LICENSING.TXT in the Swish software distribution.
      </t>
    </section>

    <!-- Background -->
    <section anchor="sect-Background" title="Background">
      <t>The Swish software package was developed as a result of
         experience using CWM <xref target="ref-cwm"/>, 
         an off-the-shelf general-purpose RDF processing program, 
         for evaluating simple inference rules on network access 
         control information expressed in RDF 
         <xref target="ref-netaccess"/>.  
         Specifically, while the general inference capabilities 
         of CWM were almost sufficient for the network access 
         application, some capabilities were required that are
         unlikely to be provided by any completely general-purpose 
         tool; e.g. analysis of IP network addresses by subnet 
         and host address.  
      </t>
      <t>Additionally, the framework for datatyped literals 
         currently proposed by the RDFcore working group 
         <xref target="ref-rdfcore"/> is quite open-ended, 
         and it is not specified  how generic applications may 
         provide support for new or non-standard datatypes.
      </t>
      <t>In light of these considerations, I sought ways of combining
         the full expressive capability of a general purpose programming 
         language with the declarative style of inference rules and
         formal specifications.
         Using Haskell <xref target="ref-haskell"/>,
         a pure functional programming language, 
         is the approach adopted.
      </t>
      <t>To use Haskell as a basis for performing inference on RDF data,
         certain capabilities are neded:
         <list style="symbols">
           <t>a means to store and access RDF data in Haskell,</t>
           <t>a capability to read RDF data using Haskell, and</t>
           <t>a capability to write RDF data using Haskell.</t>
         </list>
         Swish aims to provide these capabilities.  Further, it provides
         capabilities to compare RDF graphs (insensitive to possible 
         renaming of blank nodes), and to merge RDF graphs, renaming
         blank nodes as necessary to prevent unintended semantic 
         consequences <xref target="ref-rdf-semantics"/>.
      </t>
      <t>I anticipate that the main use for Swish will be as a 
         support library for new utilities that apply predefined
         RDF inference rules.  Where CWM is a general-purpose tool
         for manipulating RDF, I expect to use Swish as a toolkit for 
         creating tools to deal with specific RDF processing requirements.
         In time, this may lead to identification of some useful 
         capabilities that can guide the design of future 
         general-purpose RDF processing tools.
      </t>
      <t>The programming language Haskell was chosen for a number of 
         reasons:
         <list style="symbols">
           <t>it is a pure functional language supporting a style 
              of programming that is directly based on a specification
              that is being implemented,</t>
           <t>it is non-strict, employing lazy evaluation, 
              meaning that, expressions are generally not evaluated 
              unless and until their value is needed;  this further
              supports a style of programming that is close to the
              typical form of mathematical-style of description
              that is often used to specify RDF inference rules, and
           </t>
           <t>it is relatively mature, with good-quality 
              implementations available for a variety of platforms,
              supported by an active and extensive user community,
              and performance for compiled code that is comparable
              with that of more conventional programming languages.
           </t>
         </list>
         More information about Haskell can be found at
         <xref target="ref-haskell"/>.
         A useful paper discussing some particular characteristics of 
         functional programming languages is <xref target="ref-whyfp"/>.
      </t>
    </section>
    <!-- Description of software -->
    <section anchor="sect-swish-description" title="Description of Swish software">
      <t>Swish comprises a number of modules that can be invoked by
         Haskell programs, and a stand-alone command-line utility that 
         can be used to perform some basic processing of RDF data.
      </t>
      <t>The Haskell source code for the stand-alone utility may also be 
         used as a starting point for similar utilities that perform 
         specific application processing of RDF data.
      </t>
      <section anchor="sect-swish-parts" title="Swish software components">
        <t>Swish has the following components:
           <list style="symbols">
             <t>Swish.hs, SwishMain.hs, SwishMonad.hs, SwishCommands.hs:
                Swish is a command line utility that performas some simple
                RDF processing tasks:  checking Notation 3 syntax, comparing
                RDF graphs, merging RDF graphs.  The source code may also
                be used as a basis for creating new RDF processing 
                utilities.
             </t>
             <t>SwishTest.hs,
                RDFGraphTest.hs,  
                N3ParserTest.hs,
                N3FormatterTest.hs,
                GraphTest.hs,
                LookupMapTest.hs,    
                DateTimeTest.hs,
                ParseURITest.hs,  
                ParseTest.hs,
                URITest.hs:
                these are all test modules, and are not part of any
                swish application.  They use the HUnit library to 
                run a series of unit tests on the various swish 
                components.  Each of these compiles to a stand-alone
                program that runs a series of test cases.
             </t>
             <t>RDFGraph.hs:  this defines data types and methods for
                RDF graphs.
                It defines a datatype RDFLabel (URIs, bnodes, RDF literals 
                and a couple of other extensions for future use), 
                and datatype NSGraph that implements the graph class 
                interface.
                (NSGraph is similar to GraphMem but adds prefix and 
                formula lists to the content of a graph, and also defines
                a graph merge function that merges graphs with renaming of
                bnodes as needed to preserve semantics.)
                RDFGraph is a type synonym for NSGraph RDFLabel.
             </t>
             <t>N3Parser.hs:  a Notation3 parser that converts string
                into an RDFGraph value.  The parser is built using the 
                Parsec library (except the URI parser that is currently 
                based on some private parsing components).
             </t>
             <t>N3Formatter.hs:  a Notation3 formatter that converts an 
                RDFGraph value to a string, or to a ShowS function.  
                The formatter uses a monad to track formatter state.
                Currently, the formatter is pretty primitive, and is
                intended to minimally satisfy the round-tripping of RDF
                graphs via Notation3 format (also using N3Parser).
                Future versions may try to generate more human-friendly
                output.
             </t>
             <t>GraphClass.hs:  some basic definitions for a type class
                for representing and manipulating labelled directed 
                graphs.
             </t>
             <t>GraphMem.hs:  a graph implementation based on a simple 
                in-memory list structure.  There is much scope for 
                performance improvement by replacing the list structure
                with a more efficiently accessed structure.  (Ralf Hinze
                <eref target="http://www.informatik.uni-bonn.de/~ralf/"/>
                has some interesting options for this;  I like the idea 
                of using a splay trees.)  
                This code needs a reworking to properly separate the
                graph container structure from the graph node type.
             </t>
             <t>GraphMatch.hs: graph comparison function.  This function
                tests two graphs for isomorphism, taking account of nodes
                that are "variable" (i.e. may be freely renamed without 
                changing the fundmanetal graph structure).  The code
                implements an algorithm by Jeremy Carroll
                <xref target="ref-graphcomp"/>.
             </t>
             <t>URI.hs, ParseURI.hs:  URI handling code, including 
                methods to deduce and process relative URI references.
                The code is based on an early draft of the revised URI 
                specification <xref target="ref-rfc2396bis"/>, and may
                be subject to revision as that specification progresses.
             </t>
             <t>Parse.hs:  Simple parser code, based on some example 
                programs in Simon Thompson's book 
                The Craft of Functional Programming
                <xref target="ref-thompson"/>.
                This was written to support the URI handler, which was 
                my very first program in Haskell, and suffers from my 
                early confusion about how to use Haskell.
                In due course, the URI parser will be revised to use the 
                Parsec library, and this code will be retired.
             </t>
             <t>LookupMap.hs:  class and function definitions for lookup
                tables, which are used in various ways throughout the
                RDF graph handling code.  (The Swish package would 
                benefit from greatly from this code using a hash table 
                or some other more serious lookup algorithm.)
             </t>
             <t>ListHelpers.hs, MiscHelpers.hs: a few useful helper 
                functions.
             </t>
             <t>Data/*.n3: subdirectory Data of the main installation 
                directory contains a number of Notation3 data files that
                are used to test the Swish utility, and in particular
                are assumed to be present by the SwishTest program.
             </t>
             <t>ghcc.bat, MakeSwish.bat, TestSwish.bat:  
                these are files used to build and test the Swish software on
                a Windows operating system, 
                using the Glasgow Haskell Compiler (GHC).
                They have been tested under Windows 2000, and should work 
                on any recent Windows operating system (NT, 2K, XP, 98, 95)
                ghcc.bat will need to be edited to reflect the local 
                installation of GHC and the support libraries.
                Examination of these files should also provide any 
                information needed to build and run the software on
                non-Windows operating systems.
             </t>
             <t>A small number of other files contain further information 
                about the software and/or related topics.
             </t>
           </list>
        </t>
        <t>Currently, the only supported RDF graph serialization format 
           is Notation3, but future developments may add support
           for other formats.  RDF/XML would clearly be most desirable.
           Meanwhile, utilities such as CWM <xref target="ref-cwm"/>
           can be used convert RDF/XML to and from Notation 3 format.
        </t>
      </section>
      <section anchor="sect-swish-cmdline" title="Swish command format">
        <t>The Swish utility is a command-line utility that performs
           some simple RDF processing functions.  The capabilities provided
           are with a view to testing the underlying RDF library software
           rather than performing any particular application purpose.
        </t>
        <t>A Swish command contains a one or more command line options that
           are processed from left-to-right.
           The Swish program maintains an internal graph workspace, which
           is updated or referenced as the command options are processed.
        </t>
        <t>Swish command options:
           <list style="hanging">
             <t hangText="-?">
                Displays a summary of the command line options.
             </t>
             <t hangText="-n3">
                Indicates that Notation3 be used for subsequent input 
                and output.  (Currently, this is the only format option, 
                and is selected by default.)
             </t>
             <t hangText="-i[=file]">
                read file into the graph workspace, 
                replacing any existing graph.
                If the filename is omitted, the graph is read from
                standard input.
             </t>
             <t hangText="-m[=file]">
                read and merge file with the graph workspace.
                Blank nodes in the input file are renamed as necessary
                to avoid node identifiers already used by the existing
                graph.
                If the filename is omitted, the graph is read from
                standard input.
             </t>
             <t hangText="-c[=file]">
                read file and compare the resulting graph with the workspace.
                Graph comparison is done in a fashion that treats isomorphic
                graphs as equivalence, and is insensitive to renaming of
                blank nodes.  This is intended to match the definition
                of graph equivalence in the RDF abstract syntax 
                specification <xref target="W3C.rdf-concepts"/>.
                If the filename is omitted, the graph is read from
                standard input.
                If the graphs are unequal, the exit status code is 1.
             </t>
             <t hangText="-o[=file]">
                write the graph workspace to a file.
                If the filename is omitted, the graph is written to
                the standard output.
             </t>
          </list>
        </t>
        <t>The Swish program terminates with a status code that 
           indicates the final status of the operation(s) performed.
           Haskell distinguishes between a success status code whose
           value is not specified, assumed to be system dependent,
           and a failure code which is associated with an integer
           value.  
           The status code values returned by Swish are:
           <list style="hanging">
            <t hangText="Success">
                Operation completed successfully; graphs compare equal.
             </t>
            <t hangText="1">
                Graphs compare different.
             </t>
            <t hangText="2">
                Input data file incorrect format.
             </t>
            <t hangText="3">
                File access problem.
             </t>
            <t hangText="4">
                Incorrect option in command line.
             </t>
          </list>
        </t>
        <t>Here are some example Swish command lines:
           <list style="symbols">
            <t>swish -n3 -i=file
             <vspace/>
                Read 'file' as Notation3, and report any syntax errors.
             </t>
            <t>swich -n3 -i=file1 -c=file2
             <vspace/>
                Read 'file1' and 'file2' as Notation3, report any syntax 
                errors, and if both are OK, compare the resulting 
                graphs, indicating whether or not they are equivalent.
             </t>
            <t>swish -n3 -i=file1 -o=file2
             <vspace/>
                Read 'file1' as Notation3, report any syntax errors, 
                and output the resulting graph as reformatted Notation3.
                (The output will generally be different form the input,
                and may be unpretty.
                It may be used to test round-tripping of Notation 3 data.)
             </t>
          </list>
        </t>
      </section>
      <section anchor="sect-swish-api" title="Function interfaces">
        <t>[[[To be provided;  until then see the source files,
           notably SwishCommands.hs, GraphClass.hs, RDFGraph.hs,
           and the various test modules.]]]
        </t>
      </section>
    </section>
    <!-- Installation -->
    <section anchor="sect-Installation" title="Software installation">
      <t>The Swish software is distributed as a single ZIP archive.
         Start installation by creating an empty directory for the 
         software, and extracting the content of the ZIP archive into
         that directory.  Select the ZIP option that uses directory 
         information from the archive so that the sub-directory 
         structure is preserved.
      </t>
      <t>The following sections deal with how get get the software 
         running in different Haskell environments.  The instructions
         relate to MS Windows operating systems, but it should be
         fairly obvious how to adapt the procedures for Unix/Linux 
         systems.
      </t>
      <section anchor="sect-install-req" title="System requirements">
        <t>Swish is written entirely in Haskell, and should work with 
           any Haskell system that supports Haskell 98 together with 
           the extensions noted below.  The software has been tested 
           using Hugs <xref target="ref-hugs"/> (version November 2002), 
           Glasgow Haskell Compiler (GHC) <xref target="ref-ghc"/> 
           (version 5.04.3)
           and the interactive version of GHC (GHCi).
        </t>
        <t>The required extensions to standard Haskell-98 are:
           <list style="symbols">
            <t>Multi-parameter classes.</t>
            <t>Hierarchical libraries.</t>
            <t>Control.Monad.Trans and Control.Monad.State libraries,
                as distributed with GHC or Hugs.</t>
          </list>
        </t>
        <t>Some freely available additional Haskell libraries are used, 
           as described later.  For convenience, these are included
           with the Swish software distribution, but are not themselves
           part of the Swish software for licensing purpose.  More details
           are given later.
        </t>
        <t>My development has been performed mostly using Hugs on a 
           1.3GHz PC with 256Mb of memory.
           For most purposes, this has been more than adequate.  
           Some of the larger test cases, and the more perverse graph 
           comparisons, may take several minutes to run on this platform
           (SwishTest takes about 20 minutes).  In practice, the 
           applications are likely to be more demanding than basic
           requirements of Swish.
        </t>
      </section>
      <section anchor="sect-install-files" title="Installation files">
        <t>The Swish software distribution includes the following files:
           <list style="hanging">
            <t hangText="Install directory">
               <t>Swish.html, Swish.xml:  
                  this documentation file, and XML source code.
               </t>
               <t>*.hs: 
                  Haskell source files (see software overview above).
               </t>
               <t>*Test.hs: 
                  unit test Haskell source files.
               </t>
               <t>*.bat:
                  MS-Windows command files for building
                  and testing the software using GHC.
               </t>
               <t>*.txt:
                  additional information, including licensing details.
               </t>
            </t>
            <t hangText="Data subdirectory">
                Contains Notation3 data files used by the 
                SwishTest program.
             </t>
            <t hangText="Parsec subdirectory">
                Contains the Parsec library used by Swish.
             </t>
            <t hangText="HUnit subdirectory">
                Contains the HUnit library used by Swish test modules.
             </t>
            <t hangText="Sort subdirectory">
                Contains the Quicksort library used by Swish.
                (References to this module can be removed, and the
                standard Haskell function List.sort used in place
                of QuickSort.)
             </t>
          </list>
        </t>
      </section>
      <section anchor="sect-install-sys" title="System dependent details">
        <section anchor="sect-install-hugs" title="Installation using Hugs">
          <t>Running the Swish software under Hugs is straightforward.
             The Hugs options -98 and +N must be specified.
          </t>
          <t>Special steps that might help include:
             <list style="symbols">
              <t>Edit the Hugs registry key to include additional
                  directories for the Parsec, HUnit and Sort libraries.
               </t>
              <t>Edit the Hugs registry key to increase the Hugs heap
                  size (Hugs -h option) for some of the test cases.  
                  (Since doing that I've done some code tuning, 
                  which may mean the number below is unnecessarily high.)
               </t>
              <t>I have applied changes by using RegEdt32 to modify the
                  registry key 
                  HKEY_CURRENT_USER\Software\Haskell\Hugs\Nov 2002\Options,
                  though some of these changes can be applied using the 
                  Hugs :set command.  By saving these changes in the 
                  registry, I can run Hugs directly from my editor,
                  or by activiating a source file in file manager,
                  and have all the right options applied.
               </t>
              <t>To run a program in Hugs, use the :load command to
                  load the main program module;  if the library paths
                  are set correctly, all other files required will be
                  automatically located and loaded.  When a program is
                  loaded, type evaluate 'main' to execute it.
                  The Swish program itself is an exception to the above:
                  it is not designed to be run from an interactive shell.
                  To achieve the same effect, load Swishtest into Hugs, and
                  evaluate
                  <figure anchor="fig-hugs-runswish">
                  <preamble/>
<artwork>runSwish "command options"</artwork>
                  <postamble/>
                </figure>
                  noting that the command line must be supplied as a 
                  Haskell string expression (e.g. in double quotes).
               </t>
            </list>
          </t>
          <t>The full settings reported by my Hugs installation are:
             <figure anchor="fig-hugs-options">
              <preamble/>
              <artwork>
Current settings: +fewuiRWXN -stgGl.qQkoOIHT -h5000000 -p"%s&gt; " -r$$ -c40
Search path     : -P{Hugs}\libraries;{Hugs}\libraries\HUnit;
                    {Hugs}\libraries\Parsec;{Hugs}\libraries\Sort
Project Path    :
Source suffixes : -S.hs;.lhs
Editor setting  : -E"C:\\Program Files\\TextPad 4\\TextPad.exe"
Preprocessor    : -F
Compatibility   : Hugs Extensions (-98)
               </artwork>
              <postamble/>
            </figure>
          </t>
        </section>
        <section anchor="sect-install-ghci" title="Installation using GHCi">
          <t>Running the Swish software under GHCi is almost as easy
             as using Hugs.  GHCi command line options used include
             '-fglasgow-exts' and 
             '-iF:\Haskell\Lib\HUnit;F:\Haskell\Lib\Parsec;F:\Haskell\Lib\Sort'
             (adjusted according to the directories containing the library 
             files).
             Working under MS-Windows, 
             I find it convenient to create a desktop shortcut to run GHCi,
             specifying the Swish source directory and other options as
             properties of the shortcut.
          </t>
          <t>To run a program in the GHCi command interpreter, follow
             the same procedure that is described for running a program
             under Hugs.  The GHCi and Hugs command shells are very 
             similar.
          </t>
          <t>There is a GHCi initialization file '.ghci' that
             if placed in the appropriate startup directory is read 
             automatically by GHCi and defines some convenient commands
             for running the non-interactive GHC compiler from within
             the GHCi shell.
          </t>
        </section>
        <section anchor="sect-install-ghc" title="Installation using GHC">
          <t>MS-Windows command scripts have been prepared to compile
             and run the Swish software in an MS-Windows command
             window.  It should be straightforward to create Unix
             equivalents using information from these.  
             The relevant files are:
             <list style="symbols">
              <t>MakeSwish.bat, to compile and link all the programs.</t>
              <t>ghcc.bat, a helper file used by MakeSwish.bat to
                  compile and link a single program.</t>
              <t>TestSwish.bat, to run the various test programs.</t>
            </list>
             The file ghcc.bat assumes a standard GHC installation,
             with the GHC compiler is on the current search path, 
             and will probably need to be edited to refelct the 
             actual locations of the support libraries used.
          </t>
          <t>Once the programs have been compiled and linked, 
             they can be run in the usual way by using entering the
             program name at a command prompt.  The test programs
             do not expect any command line options and run to completion.
             The program Swish.exe takes command line options as 
             descriped <xref target="sect-swish-cmdline">above</xref>.
          </t>
          <t/>
        </section>
      </section>
      <section anchor="sect-install-test" title="Installation testing">
        <t>A Swish installation under GHC can be tested by running
           the command script TestSwish.bat, and ensuring that all
           tests complete with zero errors.  On a 1.7GHz PC running 
           Windows 2000, the tests take a few minutes to complete.
        </t>
        <t>To test the installation from an interactive shell, the test
           programs need to be loaded and executed individually.  
           To confirm a successful installation, it is probably 
           sufficient to load and run RDFGraphTest, which should 
           complete quite quickly (about 30 seconds under Hugs 
           on a 1.3GHz PC), 
           then run SwishTest which takes about 20 minutes on 
           the same system.
        </t>
      </section>
      <section anchor="sect-install-libs" title="Additional libraries used">
        <t>Swish uses some additional libraries that are not part of the
           swish software, but which are included with the Swish software 
           distribution for the convenience of users.
        </t>
        <t>Please note that these support libraries are distributed under 
           their own licensing terms and conditions, which I have reproduced 
           below where available.  Please contact the respective authors
           for further information.
        </t>
        <section anchor="sect-install-parsec" title="Parsec">
          <t>Parsec <xref target="ref-parsec"/>
             is a monadic parser combinator library for Haskell.
             I found it to be excellently documented and generally easy 
             to use.  It also serves as a useful introduction, 
             to using monads in Haskell.
          </t>
          <section anchor="sect-install-parsec-lic" title="Parsec licence">
            <t>
            Copyright 1999-2000, Daan Leijen. All rights reserved.
            </t>
            <t>
            Redistribution and use in source and binary forms, with or
            without modification, are permitted provided that the following
            conditions are met:
            <list style="symbols">
                <t>Redistributions of source code must retain the above
                 copyright notice, this list of conditions and the
                 following disclaimer.
              </t>
                <t>Redistributions in binary form must reproduce the above
                 copyright notice, this list of conditions and the
                 following disclaimer in the documentation and/or other
                 materials provided with the distribution.
              </t>
              </list>
            </t>
            <t>
            This software is provided by the copyright holders "as is" and
            any express or implied warranties, including, but not limited
            to, the implied warranties of merchantability and fitness for a
            particular purpose are disclaimed. In no event shall the
            copyright holders be liable for any direct, indirect,
            incidental, special, exemplary, or consequential damages (
            including, but not limited to, procurement of substitute goods
            or services; loss of use, data, or profits; or business
            interruption) however caused and on any theory of liability,
            whether in contract, strict liability, or tort (including
            negligence or otherwise) arising in any way out of the use of
            this software, even if advised of the possibility of such
            damage.
            </t>
          </section>
        </section>
        <section anchor="sect-install-quicksort" title="Quicksort">
          <t>Quicksort is part of a collection of sorting functions in
             haskell, published by Ralf Hinze <xref target="ref-sort"/>.
          </t>
          <t>At the time of writing, I can find no claim for copyright 
             or distribution licensing terms.
          </t>
        </section>
        <section anchor="sect-install-hunit" title="HUnit">
          <t>HUnit <xref target="ref-hunit"/>
             is a unit testing framework for Haskell,
             loosely modelled on the JUnit framework that is 
             popular with Java programmers.
          </t>
          <t>Swish application code does not use HUnit, but the test
             programs do make extensive use of it.
          </t>
          <section anchor="sect-install-hunit-lic" title="HUnit licence">
            <t>HUnit is Copyright (c) Dean Herington, 2002, all rights
               reserved, and is distributed as free software under the
               following license.
            </t>
            <t>Redistribution and use in source and binary forms, with or
               without modification, are permitted provided that the
               following conditions are met:
               <list style="symbols">
                <t>Redistributions of source code must retain the above
                    copyright notice, this list of conditions, and the
                    following disclaimer.
                 </t>
                <t>Redistributions in binary form must reproduce the above
                    copyright notice, this list of conditions, and the
                    following disclaimer in the documentation and/or other
                    materials provided with the distribution.
                 </t>
                <t>The names of the copyright holders may not be used to
                    endorse or promote products derived from this software
                    without specific prior written permission.
                 </t>
              </list>
            </t>
            <t>THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS"
               AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
               LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
               FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT
               SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT,
               INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
               DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
               SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
               OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
               LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (
               INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
               THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
               OF SUCH DAMAGE.
            </t>
          </section>
        </section>
      </section>
    </section>
    <!--
    <- XXXX ->
    <section anchor="sect-xxxx" title="XXXX">
      <t>...</t>
      <t>...:
         <list style="symbols">
          <t>...</t>
          <t>...</t>
        </list>
      </t>
    </section>
-->
    <!-- Conclusions -->
    <section anchor="sect-Conclusions" title="Conclusions">
      <t>Swish is very much a work-in-progress, and the present
         release is a first step along a path with many
         possible options for future developments.
      </t>
      <t>The immediate next step is to use the Swish framework
         in the construction of some special-purpose RDF
         inference tools.  My intent is to revisit my 
         earlier work <xref target="ref-netaccess"/>, and learn
         how that work may be served by using Haskell in place
         of a packaged RDF inference tool.
      </t>
      <t>The Swish code itself is far from perfect, and there
         is much additional functionality and improvement that
         can be made.
         But it does pass an extensive array of tests, and I believe
         it is sufficiently stable and functional for this initial
         release.
      </t>
      <t>The software distribution contains a file named TODO.TXT,
         which lists a number of specific possible enhancements that
         have been identified to date.
      </t>
    </section>
    <!-- Acknowledgements -->
    <section title="Acknowledgements">
      <t>I would like to thank the following, whose previous work has
         been most helpful to me (though, of course, they bear no
         responsibility for the failings of my work):
         <list style="symbols">
          <t>The Haskell community <xref target="ref-haskell"/> for
              not just one, but at least two, really solid Haskell 
              language implementations, a good range of supporting 
              libraries, and many points of useful advice offered
              though the Haskell mailing list.
           </t>
          <t>Dean Herington for his HUnit testing framework.
           </t>
          <t>Daan Leijen, for his Parsec library.
           </t>
        </list>
      </t>
      <t>This document has been authored in XML using the format described
         in RFC 2629 <xref target="RFC2629"/>, and converted to HTML using
         the XML2RFC utility developed by Marshall Rose
         (<eref target="http://xml.resource.org/"/>).
      </t>
    </section>
  </middle>
  <!-- End of main document -->
  <!-- Appendices -->
  <back>
    <references>
      <?rfc include="reference.W3C.rdf-syntax.xml"?> <!-- target='W3C.rdf-syntax' -->
      <?rfc include="reference.W3C.rdf-schema.xml"?> <!-- target='W3C.rdf-schema' -->
      <?rfc include="reference.RFC.2629.xml"?>

      <reference anchor="ref-notation3" target="http://www.w3.org/DesignIssues/Notation3.html">
        <front>
          <title>Notation3: Logic and Rules on RDF</title>
          <author initials="T." surname="Berners-Lee" fullname="Tim Berners-Lee">
            <organization>W3C/MIT</organization>
          </author>
          <date month="" year="1998"/>
        </front>
        <seriesInfo name="Design Issues" 
                    value="Ideas about Web Architecture - yet another notation"/>
      </reference>

      <reference anchor="ref-cwm" target="http://www.w3.org/2000/10/swap/doc/cwm.html">
        <front>
          <title>Cwm (closed world machine)</title>
          <author initials="T." surname="Berners-Lee" fullname="Tim Berners-Lee">
            <organization>W3C</organization>
          </author>
          <date month="September" year="2002"/>
        </front>
      </reference>

      <reference anchor="ref-graphcomp" target="http://www.hpl.hp.com/semweb/publications.htm#Matching%20RDF%20Graphs">
        <front>
          <title abbrev="Matching RDF Graphs">Matching RDF Graphs</title>
          <author initials="J." surname="Carroll" fullname="Jeremy Carroll">
            <organization abbrev="HP">Hewlett Packard Laboratories</organization>
          </author>
          <date day="" month="July" year="2001"/>
        </front>
      </reference>

      <reference anchor='ref-rfc2396bis' target="http://www.apache.org/~fielding/uri/rev-2002/draft-fielding-uri-rfc2396bis-01.html">
        <front>
          <title abbrev='URI Generic Syntax'>Uniform Resource Identifier (URI): Generic Syntax</title>
          <author initials='T.' surname='Berners-Lee' fullname='Tim Berners-Lee'>
            <organization abbrev="MIT/LCS">World Wide Web Consortium</organization>
            <address>
              <postal>
                <street>MIT/LCS, Room NE43-356</street>
                <street>200 Technology Square</street>
                <city>Cambridge</city>

                <region>MA</region>
                <code>02139</code>
                <country>USA</country>
              </postal>
              <phone>+1-617-253-5702</phone>
              <facsimile>+1-617-258-5999</facsimile>
              <email>timbl@w3.org</email>
              <uri>http://www.w3.org/People/Berners-Lee/</uri>
            </address>
          </author>
          <author initials='R.' surname='Fielding' fullname='Roy T. Fielding'>
            <organization abbrev="Day Software">Day Software</organization>
            <address>
              <postal>
                <street>2 Corporate Plaza, Suite 150</street>
                <city>Newport Beach</city>
                <region>CA</region>
                <code>92660</code>
                <country>USA</country>
              </postal>
              <phone>+1-949-999-2523</phone>
              <facsimile>+1-949-644-5064</facsimile>
              <email>roy.fielding@day.com</email>
              <uri>http://www.apache.org/~fielding/</uri>
            </address>
          </author>
          <author initials='L.' surname='Masinter' fullname='Larry Masinter'>
            <organization abbrev="Adobe">Adobe Systems Incorporated</organization>
            <address>
              <postal>
                <street>345 Park Ave</street>
                <city>San Jose</city>
                <region>CA</region>
                <code>95110</code>
                <country>USA</country>
              </postal>
              <phone>+1-408-536-3024</phone>
              <email>LMM@acm.org</email>
              <uri>http://larry.masinter.net/</uri>
            </address>
          </author>
          <date month='May' year='2003'></date>
          </front>
      </reference>

      <reference anchor="ref-rdfcore" target="http://www.w3.org/2001/sw/RDFCore/">
        <front>
          <title abbrev="W3C RDFcore working group">World Wide Web Consortium: RDFcore working group</title>
          <author>
            <organization></organization>
          </author>
          <date day="" month="" year=""/>
        </front>
      </reference>

      <reference anchor="ref-rdf-semantics" target="http://www.w3.org/TR/rdf-mt">
        <front>
          <title>RDF Semantics</title>
          <author initials="P" surname="Hayes" fullname="Patrick Hayes">
              <organization />
          </author>
          <date month="November" day="12" year="2002" />
        </front>
        <seriesInfo name="W3C WD" value="WD-rdf-mt-20021112" />
        <format type="HTML" target="http://www.w3.org/TR/2002/WD-rdf-mt-20021112" />
      </reference>

      <reference anchor="W3C.rdf-concepts" target="http://www.w3.org/TR/rdf-concepts/">
        <front>
          <title>Resource Description Framework (RDF): Concepts and Abstract Syntax</title>
          <author initials="G" surname="Klyne" fullname="Graham Klyne">
            <organization/>
          </author>
          <author initials="J" surname="Carroll" fullname="Jeremy J. Carroll">
            <organization/>
          </author>
          <date month="November" day="8" year="2002"/>
        </front>
        <seriesInfo name="W3C WD" value="WD-rdf-concepts-20021108"/>
        <format type="HTML" target="http://www.w3.org/TR/2002/WD-rdf-concepts-20021108"/>
      </reference>

      <reference anchor="ref-haskell" target="http://www.haskell.org/">
        <front>
          <title abbrev="Haskell community web site">Haskell community web site</title>
          <author>
            <organization></organization>
          </author>
          <date day="" month="" year=""/>
        </front>
      </reference>

      <reference anchor="ref-hugs" target="http://www.haskell.org/hugs/">
        <front>
          <title abbrev="Hugs98">Hugs online: Hugs98 web site</title>
          <author>
            <organization></organization>
          </author>
          <date day="" month="" year=""/>
        </front>
      </reference>

      <reference anchor="ref-ghc" target="http://www.haskell.org/ghc/">
        <front>
          <title abbrev="The Glasgow Haskell Compiler">The Glasgow Haskell Compiler (GHC) web site</title>
          <author>
            <organization></organization>
          </author>
          <date day="" month="" year=""/>
        </front>
      </reference>

      <reference anchor="ref-parsec" target="http://www.cs.uu.nl/~daan/parsec.html">
        <front>
          <title abbrev="Parsec">Daan online: Parsec</title>
          <author initials="D." surname="Leijen" fullname="Daan Leijen">
            <organization abbrev="Utrecht University">Utrecht University</organization>
          </author>
          <date day="" month="Oct" year="2001"/>
        </front>
      </reference>

      <reference anchor="ref-hunit" target="http://hunit.sourceforge.net/">
        <front>
          <title abbrev="HUnit">HUnit - Haskell Unit Testing</title>
          <author initials="D." surname="Herington" fullname="Dean Herington">
            <organization/>
          </author>
          <date day="" month="Feb" year="2002"/>
        </front>
      </reference>

      <reference anchor="ref-sort" target="http://www.informatik.uni-bonn.de/~ralf/software.html#sort">
        <front>
          <title abbrev="Sort">A library of sorting routines</title>
          <author initials="R." surname="Ralf" fullname="Ralf Hinze">
            <organization abbrev="Bonn University">Institute of Computer Science, Bonn University</organization>
          </author>
          <date day="" month="Apr" year="2002"/>
        </front>
      </reference>

      <reference anchor="ref-whyfp" target="http://www.math.chalmers.se/~rjmh/Papers/whyfp.html">
        <front>
          <title abbrev="Why Functional Programming Matters">Why Functional Programming Matters</title>
          <author initials="J." surname="Hughes" fullname="John Hughes">
            <organization abbrev="Chalmers University">Chalmers University of Technology </organization>
          </author>
          <date day="" month="" year="1984"/>
        </front>
      </reference>

      <reference anchor="ref-thompson" target="http://www.cs.kent.ac.uk/people/staff/sjt/craft2e/">
        <front>
          <title abbrev="The Craft of Functional Programming">Haskell: The Craft of Functional Programming, Second Edition</title>
          <author initials="S." surname="Thompson" fullname="Simon Thompson">
            <organization abbrev="University of Kent">University of Kent</organization>
          </author>
          <date day="" month="" year="1999"/>
        </front>
        <seriesInfo name="Addison-Wesley" value="ISBN 0-201-34275-8"/>
      </reference>

      <reference anchor="ref-netaccess" target="http://www.ninebynine.org/SWAD-E/Scenario-HomeNetwork/HomeNetworkConfig.html">
        <front>
          <title abbrev="Home Network Configuration">Using RDF for Home Network Configuration</title>
          <author initials="G." surname="Klyne" fullname="Graham Klyne">
            <organization abbrev="Nine by Nine">Nine by Nine</organization>
          </author>
          <date day="22" month="December" year="2002"/>
        </front>
      </reference>

      <reference anchor="ref-SWAD-E" target="http://www.w3.org/2001/sw/Europe/">
        <front>
          <title>European Semantic Web Advanced Development</title>
          <author initials="D." surname="Brickley" fullname="Dan Brickley">
            <organization>W3C/ILRT</organization>
          </author>
          <author initials="K." surname="Sharp" fullname="Kate Sharp">
            <organization>ILRT</organization>
          </author>
          <date month="" year="2002"/>
        </front>
      </reference>

      <reference anchor="ref-swad-e-calendaring" target="http://www.w3.org/2001/sw/Europe/reports/dev_workshop_report_2/">
        <front>
          <title>SWAD-Europe: Developer Workshop Report 2 - Semantic Web calendaring</title>
          <author initials="L." surname="Miller" fullname="Libby Miller">
            <organization>ILRT</organization>
          </author>
          <date month="" year="2002"/>
        </front>
      </reference>

<!--
      <reference anchor="refxxxx" target="xxxx">
        <front>
          <title>xxxx</title>
          <author initials="A." surname="BBBB" fullname="CCCC">
            <organization>DDDD</organization>
          </author>
          <date month="mmmm" year="yyyy"/>
        </front>
        <seriesInfo name="seriesname" value="seriesdocid"/>
      </reference>
-->

    </references>

    <section title="Revision history">
      <t>
        <list style="hanging">
          <t hangText="2003-05-30:">
            <list style="symbols">
              <t>Document initially created.
              </t>
            </list>
          </t>
        </list>
      </t>
    </section>

    <section title="Unresolved issues">
    <t>
      <list style="symbols">
        <t>See file TODO.TXT</t>
      </list>
    </t>
    </section>

    <section title="CVS revision log">
      <t>
        <figure anchor="fig-cvs-log">
          <preamble/>
          <artwork>
$Log: swish-0.1.xml,v $
Revision 1.1  2003/12/19 15:50:01  graham
Renamed Swish 0.1 document

Revision 1.6  2003/06/03 16:17:44  graham
Fix another typo

Revision 1.5  2003/06/03 11:31:13  graham
Fix typos in documentation

Revision 1.4  2003/05/31 00:11:21  graham
Fix various typos and omissions

Revision 1.3  2003/05/30 19:12:57  graham
Fixed some document typos and added RDF semantics reference

Revision 1.2  2003/05/30 18:37:25  graham
First formatted version of Swish documentation

Revision 1.1  2003/05/30 16:41:22  graham
Swish documentation, initial version.

           </artwork>
          <postamble/>
        </figure>
      </t>
    </section>
  </back>
</rfc>
