Page:Aaron Swartz s A Programmable Web An Unfinished Work.pdf/65

Rh Naturally, it can also search through the resulting data to answer your questions in much the same way SPARQL does.

But cwm goes a step further. It doesn’t just search through data; it thinks about it. cwm can follow logical rules; take this one for example:

{ ?x a :Man } => { ?x :mortality :mortal }.

(If something is a man, then it’s mortal.) Feed this into cwm, along with:


 * Socrates a :Man.

And it will logically deduce that Socrates is mortal. Such rulesets obviously have all sorts of uses, from logical parlor games to actual programming. But one obvious use is providing conversions between different RDF formats. Imagine two schemas: “joe:”, which has “small”, “medium”, and “large” and “starbucks:” which has “short”, “tall”, “grande”, and “venti”. Now we can just write a few rules to convert between them:

{ ?x joe:size joe:small } <=> { ?x starbucks:size starbucks:tall }.

{ ?x joe:size joe:medium } <=> { ?x starbucks:size starbucks:grande }.

{ ?x joe:size joe:large } <=> { ?x starbucks:size starbucks:venti }.

Feed these rules into cwm, along with the data in one format, and cwm will “think” about it and spit out data in the other format.

But cwm can do much more than just basic logical inference. It also has a wide variety of built-ins, that can do everything from mathematical processing to advanced cryptography. With them, and some clever rules, you can even build entire programs using cwm.

Incidentally, none of this is new—nearly all this stuff was written in 2001.

cwm is also smart enough to go onto the Web and ﬁnd more rules like these, crawling through web pages for more bits of RDF to make it smarter. Following links and URLs and getting more data, it can surf the Web for data in the same way a bored teenager surfs the Web for fun.

If you’re interested in giving this process a spin for yourself, you can try Tim’s latest project: the Tabulator. It’s a little add-on to your web browser that lets it see