cwm
index
/home/syosi/cvs-trunk/WWW/2000/10/swap/cwm.py

$Id: cwm.html,v 1.52 2007/12/16 01:06:11 syosi Exp $
 
Closed World Machine
 
(also, in Wales, a valley  - topologiclly a partially closed world perhaps?)
 
This is an application which knows a certian amount of stuff and can manipulate
it. It uses llyn, a (forward chaining) query engine, not an (backward chaining)
inference engine: that is, it will apply all rules it can but won't figure out
which ones to apply to prove something. 
 
 
License
-------
Cwm: http://www.w3.org/2000/10/swap/doc/cwm.html
 
Copyright (c) 2000-2004 World Wide Web Consortium, (Massachusetts 
Institute of Technology, European Research Consortium for Informatics 
and Mathematics, Keio University). All Rights Reserved. This work is 
distributed under the W3C Software License [1] 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.
 
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231

 
Modules
       
swap.RDFSink
swap.diag
swap.llyn
swap.notation3
string
sys
swap.toXML
swap.uripath

 
Functions
       
chdir(...)
chdir(path)
 
Change the current working directory to the specified path.
doCommand()
Command line RDF/N3 tool
        
 <command> <options> <steps> [--with <more args> ]
 
options:
 
--pipe        Don't store, just pipe out *
 
steps, in order left to right:
 
--rdf         Input & Output ** in RDF/XML insead of n3 from now on
--n3          Input & Output in N3 from now on. (Default)
--rdf=flags   Input & Output ** in RDF and set given RDF flags
--n3=flags    Input & Output in N3 and set N3 flags
--ntriples    Input & Output in NTriples (equiv --n3=usbpartane -bySubject -quiet)
--language=x  Input & Output in "x" (rdf, n3, etc)  --rdf same as: --language=rdf
--languageOptions=y     --n3=sp same as:  --language=n3 --languageOptions=sp
--ugly        Store input and regurgitate, data only, fastest *
--bySubject   Store input and regurgitate in subject order *
--no          No output *
              (default is to store and pretty print with anonymous nodes) *
--base=<uri>  Set the base URI. Input or output is done as though theis were the document URI.
--closure=flags  Control automatic lookup of identifiers (see below)
<uri>         Load document. URI may be relative to current directory.
 
--apply=foo   Read rules from foo, apply to store, adding conclusions to store
--patch=foo   Read patches from foo, applying insertions and deletions to store
--filter=foo  Read rules from foo, apply to store, REPLACING store with conclusions
--query=foo   Read a N3QL query from foo, apply it to the store, and replace the store with its conclusions
--sparql=foo   Read a SPARQL query from foo, apply it to the store, and replace the store with its conclusions
--rules       Apply rules in store to store, adding conclusions to store
--think       as -rules but continue until no more rule matches (or forever!)
--engine=otter use otter (in your $PATH) instead of llyn for linking, etc
--why         Replace the store with an explanation of its contents
--why=u       proof tries to be shorter
--mode=flags  Set modus operandi for inference (see below)
--reify       Replace the statements in the store with statements describing them.
--dereify     Undo the effects of --reify
--flatten     Reify only nested subexpressions (not top level) so that no {} remain.
--unflatten   Undo the effects of --flatten
--think=foo   as -apply=foo but continue until no more rule matches (or forever!)
--purge       Remove from store any triple involving anything in class log:Chaff
--data              Remove all except plain RDF triples (formulae, forAll, etc)
--strings     Dump :s to stdout ordered by :k whereever { :k log:outputString :s }
--crypto      Enable processing of crypto builtin functions. Requires python crypto.
--help        print this message
--revision    print CVS revision numbers of major modules
--chatty=50   Verbose debugging output of questionable use, range 0-99
--sparqlServer instead of outputting, start a SPARQL server on port 8000 of the store
--sparqlResults        After sparql query, print in sparqlResults format instead of rdf
 
finally:
 
--with        Pass any further arguments to the N3 store as os:argv values
 
 
            * mutually exclusive
            ** doesn't work for complex cases :-/
Examples:
  cwm --rdf foo.rdf --n3 --pipe     Convert from rdf/xml to rdf/n3
  cwm foo.n3 bar.n3 --think         Combine data and find all deductions
  cwm foo.n3 --flat --n3=spart
 
Mode flags affect inference extedning to the web:
 r   Needed to enable any remote stuff.
 a   When reading schema, also load rules pointed to by schema (requires r, s)
 E   Errors loading schemas of definitive documents are ignored
 m   Schemas and definitive documents laoded are merged into the meta knowledge
     (otherwise they are consulted independently)
 s   Read the schema for any predicate in a query.
 u   Generate unique ids using a run-specific
 
Closure flags are set to cause the working formula to be automatically exapnded to
the closure under the operation of looking up:
 
 s   the subject of a statement added
 p   the predicate of a statement added
 o   the object of a statement added
 t   the object of an rdf:type statement added
 i   any owl:imports documents
 r   any doc:rules documents
 E   errors are ignored --- This is independant of --mode=E
 
 n   Normalize IRIs to URIs
 e   Smush together any nodes which are = (owl:sameAs)
 
See http://www.w3.org/2000/10/swap/doc/cwm  for more documentation.
 
Setting the environment variable CWM_RDFLIB to 1 maked Cwm use rdflib to parse
rdf/xml files. Note that this requires rdflib.
getcwd(...)
getcwd() -> path
 
Return a string representing the current working directory.

 
Data
        cvsRevision = '$Revision: 1.52 $'
path = ['.', '/usr/lib/python2.4/site-packages/Cheesecake-0.6-py2.4.egg', '/usr/lib/python2.4/site-packages/setuptools-0.6c6-py2.4.egg', '/usr/lib/python2.4/site-packages/FuXi-0.85b.dev_r107-py2.4.egg', '/usr/lib/python2.4/site-packages/rdflib-2.4.0-py2.4-linux-i686.egg', '/usr/lib/python2.4/site-packages/storm-0.10-py2.4.egg', '/home/syosi/cvs-trunk/WWW/2000/10/swap', '/home/syosi/cvs-trunk/WWW/2000/10', '/usr/lib/python24.zip', '/usr/lib/python2.4', '/usr/lib/python2.4/plat-linux2', '/usr/lib/python2.4/lib-tk', '/usr/lib/python2.4/lib-dynload', '/usr/local/lib/python2.4/site-packages', '/usr/lib/python2.4/site-packages', '/usr/lib/python2.4/site-packages/HTMLgen', '/usr/lib/python2.4/site-packages/Numeric', '/usr/lib/python2.4/site-packages/PIL', '/usr/lib/python2.4/site-packages/cairo', '/usr/lib/python2.4/site-packages/gnuradio', ...]
qqq = '/home/syosi/cvs-trunk/WWW/2000/10/swap'
tracking = 0