W3C | Semantic Web

Semantic Web Area for Play

or, if you like, Semantic Web Application Platform... visiting RDF and all points west.

This NOT W3C endorsed material, it is related to the Semantic Web activity of the W3C.

Other related material:


This stuff is not guaranteed but is open source and available from the public w3c CVS repository.

Cwm - a general-purpose semantic web data processing tool

Check out *.py from the top level of the swap hierarchy to use it, check out the whole tree to develop.

Set up an alias (.bat file, etc) to make the cwm command cwm="python /wherever/cwm.py"

Other utilities in python


These are lists of RDF terms (properties and classes) which we have used for putting together test and demo applications, and organizing our dailiy lives. Most are defined in n3, many have xml versions. If you don't have it in XML, use cwm to transcode it.

cwm built-ins

For cwm these are magic - these are properties which cwm can infer or which allow cwm to infer things. They are like built-in functions in a programming language. Not every N3 processor handles the same built-ins.

Utility ontologies

Basic RDF ontologies

Not here, but things everyone needs

History: Motivation

These are a few things I put together to

The bits are now as follows. There is NO guarantee or support or anything for these.

Python modules

Serializing/deserializaing RDF: notation3.py

Originally written by Dan Connolly, uses a basic RDF stream parser interface

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.

By the way... Python is cool.

I had lamented that it ws a long time since I had a practial hacking environment, and Dan Connolly suggested Python as something you could start quickly but which would scale to a large system. One day, as 15 minutes before I was leaving had to leave for the the airport, I got my laptop back out of my bag, and sucked off the the web the python 1.6 system and the python tutorial, and , and a copy of a small notation3 parser Dan had Dan had hacked together. I was happy to find that Python is a language you can get can get into on one battery! I have been happily hacking ever since.

I remember Guido trying to persuade me to use python as I was trying to persuade him to write web software.software!

xml2rdf.py Parsing RDF

Based on Python's xmllib, this parser is ocmpatible with the RDF stream interface of, notation3.py. It completes the square of parsers and generators.

It has a command line mode for self-test purposes.

Closed World Machine : cwm.py

This is a triple store, in which triples are stored in/against the particular context in which they were read, eg RDF file or N3 { expression }. The features at the moment include

Cwm will run as a unix command, and is designed to be usable as a simple data manipulator for RDF on the lines of sed, awk, etc or xsl.

In progress.

Command line parameters

Some, marked (flag), can occur anywhere on the command line. The others are processed in order from left to right.

generate a maybe more up to date list of parameters
don't store, just process serially. (doesn't lose comment lines!) (flag)
input format RDF format from now on
output format is RDF. (flag)
load the resource. Parsed relative to the local directory, so a filename will work.
Output the current size of the store.
Apply the rules in a given resource, once each, to the store, the conclusions being added to the store.
Apply the rules in a given resource, once each, to the store, replacing the original contents of the store with those things concluded from the rules.
Apply any rules in the store to the store itself, conclusions being added to the store.
Dump the store in a more or less random order. This tends to be messy, as related information is not grouped.
Dump the store grouping statements by subject. This tends to be better than -ugly, but the default is to make the output as readable as possible using anonymous nodes wherever possible, and is therefore recommended. (flag)

Note that where a uri is given, this can be a filename of course. The default base URI of the process is the file URI of a file in the current working directory, so a local filename will be a valid relative URI. This is how URIs were supposed to work.

Rule file format

A rule file is simply a notation3 file. A rule is a statement which asserts an implication using log:imples (where the namespace must be http://www.w3.org/2000/10/swap/log#) between premise and a conclusion. The premise is simply a template: cwm will search for all combinations of statements in the store which match the template. Variables must be explicitly connected to the enclosing context (often, the document) by a "log:forAll" statement. For each match, a conclusion is formed by taking the conclusion and in it replacing any variables which have been matched with the values found. The following is an example:

@prefix log: <http://www.w3.org/2000/10/swap/log#> .
@prefix mech: <s1.n3#> .

<> log:forAll <#x> , <#y> .
{ <#x> mech:includes <#y> } log:implies { <#y> mech:partOf <#x> } .

The @prefix directives define the prefixes log: and mech: as representing namespaces. The <> log:forAll line declares #x and #y, two local identifiers, as being univerlly quantified variables in the context of this document (<>).

Places to talk about thisDesign issues

The code above investigated and raised issues discussed in the following documents.

not to mention


Contributors of code:

and contributions of ideas and all other kinds from those on #rdfig. Thanks to all. KUTGW!

Tim BL, with his director hat off
$Id: Overview.html,v 1.35 2002/05/15 18:15:44 1.20 2001/11/21 22:55:56 timbl Exp $

About this page