W3C | Semantic Web | SWAP
Cwm (pronounced coom) is a general-purpose data processor for the semantic web, somewhat like sed, awk, etc. for text files or XSLT for XML. It is a forward chaining reasoner which can be used for querying, checking, transforming and filtering information. Its core language is RDF, extended to include rules, and it uses RDF/XML or RDF/N3 (see Notation3 Primer) serializations as required.
Cwm is written in python; it is part of SWAP, a Semantic Web Application Platform. It is open source under the W3C software license.
Quick Reference:
The Semantic Web Tutorial Using N3 covers features such as:
See also: Cwm command line arguments reference.
Other features are in development, and haven't been documented as thoroughly:
Be careful when using rules from an untrusted source.
Be carfeul even when using cryptography. I am not an expert but a few things to watch are:
Originally, the name is from from "Closed World Machine" because it processed information in a limited space, cwm does not make any assumptions about a closed world. Think of it as defined area but with openings - like a valley.
see also Sean Palmer's guide to cwm -- sometimes it is more up to date than this!
Check out other programs which use the same language:
This swap code is open source and available for those that want to play with it, but comes with no warranty.
$ cvs -d:pserver:[email protected]:/sources/public login password? anonymous $ cvs -d:pserver:[email protected]:/sources/public get 2000/10/swap
In the following, we assume $SWAP expands to the place where you have code checked out.
The best test of works is what has been tested. So the list of files in the regression test defines the set of features which are generally checked on each checkin. Cwm developers agree that all the tests have to pass before code is checked in. To run the tests, do make in the swap/test directory. We reckon to add a test for a new bug, so that bugs don't recur in future versions.
Each subdirectory of test has its own detailed.tests file. In that you can put tests for new features. Note that the test commands are all writted to be run in $SWAP/test.
cvs update
to ensure you have any changes
other people have done before running tests.cd $SWAP/test; make
fast
Cwm developers agree to keep line lengths below 80 characters, though we have some code that predates that agreement.
An in-memory store which does the inference. See the Formula class methods for a more or less conventional RDF API. A Forumula is a set of statements.
Originally written by Dan Connolly, uses a basic RDF stream parser interface, migrating to API
The command line form (alias n3 python notation3.py; n3 -help) allows RDF to be parsed and re-output.
The module will also run as a CGI script to convert N3 to RDF M&S 1.0 - by DanC magic.
Based on Python's xmllib, this parser is compatible with the RDF stream interface of, notation3.py. It completes the square of parsers and generators. Defunct. Now use sax parser and sax2rdf.py.
It has a command line mode for self-test purposes.
These are quite easy to add to. Look at a few and clone a similar one to the one you have made.
The code above investigated and raised issues discussed in the following documents.
not to mention
Thanks to Dan Connolly for writing the first code and thereby introducing me to Python, and to him and Sean Palmer and Mark Nottingham for writing built-in function modules. Eric Prud'hommeaux wrote the remote database query and mySQL interface. Sandro Hawke has made various contributions. Yosi Scharf engineered the cwm 1.0.0 release and fixed various bugs and added SPARQL support. Thanks to Sean for his guide to cwm, as well as n3p, which is the basis for Cwm's Sparql parser.. Thanks for all on #RDFIG for being everything which is #RDFIG.
Development of cwm is supported in part by funding from US Defense Advanced Research Projects Agency (DARPA) and Air Force Research Laboratory, Air Force Materiel Command, USAF, under agreement number F30602-00-2-0593, "Semantic Web Development".
Cwm: http://www.w3.org/2000/10/swap/doc/cwm.html
Copyright © 2000-2004 World Wide Web Consortium, (Massachusetts Institute of Technology, European Research Consortium for Informatics and Mathematics, Keio University). Parts of the Sparql parser are Copyright © Sean Palmer. 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
Historical stuff from this page