Tim Berners-Lee
Decentralized Information Group
MIT Computer Science and Artificial Intelligence Laboratory
Derived from Semantic Web Tutorial
These slides: http://www.w3.org/2003/Talks/0520-www-tf1-d1-reach/
A built-in function for fetching RDF content off the web for processing.
{ <foo.rdf> log:semantics ?f } => { ?f a :InterestingFormula }.
For cwm, the named pages have to be in RDF/XML or N3. It uses Content-Type header and some heuristics.
Try squid and setenv http_proxy, if network performance is a problem.
Once we have the formula, how do we process it?
{ :a :b :c. :d :e :f. } log:includes { :a :b :c. }.
If someone's home page says that they are a vegetarian, then we believe that they are a vegetarian:
@forAll :x. { [is :homePage of :x] log:includes { :x a :Vegetarian }} => { :x a :Vegetarian}.
Note: This is a case where we need explicit quantification. With ?x, we would be talking about pages saying "everyone is a vegetarian".
Formulas are just sets of triples, so we can test for what is not contained.
If someone's page does not say they are vegetarian, let's assume they are an omnivore:
@forAll :x. {:x :homePage log:notIncludes { :x a :Vegetarian }} => { :x a :Omnivore }.
In the open web, you can never just have a default for a value.
You have to give a default with respect to some dataset.
If the specification for a car doesn't say what color it is then define it as black:
@forAll :car. { :car!auto:specification log:notIncludes {:car auto:color []}} => {:car auto:color auto:black}.
What if we could only infer the car was red?
{ ?car a auto:SuperSportyModel. } => { ?car auto:color auto:red. }
Our defaults rule won't use that fact unless we ask cwm to do another level of rules processing.
@forAll :car. { :car.auto:specification.log:conclusion log:notIncludes {:car auto:color []}} => {:car auto:color auto:black}.
If you want to build a formula out of different peices, you contruct their conjunction
( { :a :b :c. } { :d :e :f. } ) log:conjunction { :a :b :c. :d :e :f. }.
Use with log:semantics, etc
( { :a :b :c. } <foo.rdf>.log:semantics ) log:conjunction { :a :b :c. (whatever foo.rdf said). }.
{ ( <input.data>!log:semantics <axioms.n3>!log:semantics <system-rules.n3>!log:semantics ) log:conjunction ?f. ?f log:conclusion ?g. ?g log:notIncludes { ?request a :ValidRequest } } => { ?request a InvalidRequest }.
This means: if what you get by taking the input data, the axioms and the system rules together and thinking about it doesn't tell you that the request is valid, then it is invalid.
log:parsedAsN3: For a string, the formula you get by parsing it as a Notation3 document.
"<a> <b> <c>" log:parsedAsN3 {<a> <b> <c>}.
log:N3String: For a formula, a string which expressed that formula in N3.
{<a> <b> <c>} log:N3String "<a> <b> <c>".
(roughly.... The actual string generated may be a bit different.)
log:content: For a document, the string which was returned as the document contents when the URI of the resource was looked up.
<http://www.w3.org/> log:content """<?xml version="1.0" encoding"utf-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US"> and so on...
<http://example.org/> log:uri "http://example.org/".
Pulls aside the curtain, letting rules look at the actual text of the URI used to name something.
The option -mode r tells cwm to automatically incorporate certain remote documents.
:capitalCities log:definitiveDocument <http://example.org/listOfAllCapitalCities>.
tells cwm to use that document for information about the :capitalCities predicate
-mode s tells cwm to fetch "schema" documents.
For each term like <foo#bar>, the document <foo> is loaded and merged
We have this file:
... :MA a :USState; :borderstate :CT, :NH, :NY, :RI, :VT; :capital uscity:bostonma; :code "MA"; :name "Massachusetts"; :region :NewEngland . ...
{"MA"^state:code.state:borderstate^city:state city:name ?n} => {?n a :NAME_OF_CITY_IN_A_STATE_BORDERING_MASSACHUSETTS }.
Command line:
cwm http://www.w3.org/2000/10/swap/test/dbork/defdoc2.n3 --mode=rse --think
"Albany" a :NAME_OF_CITY_IN_A_STATE_BORDERING_MASSACHUSETTS . "Amherst" a :NAME_OF_CITY_IN_A_STATE_BORDERING_MASSACHUSETTS . "Avon" a :NAME_OF_CITY_IN_A_STATE_BORDERING_MASSACHUSETTS . "Bridgeport" a :NAME_OF_CITY_IN_A_STATE_BORDERING_MASSACHUSETTS . "Buffalo" a :NAME_OF_CITY_IN_A_STATE_BORDERING_MASSACHUSETTS . "Burlington" a :NAME_OF_CITY_IN_A_STATE_BORDERING_MASSACHUSETTS . "Concord" a :NAME_OF_CITY_IN_A_STATE_BORDERING_MASSACHUSETTS . "Danbury" a :NAME_OF_CITY_IN_A_STATE_BORDERING_MASSACHUSETTS . "Darien" a :NAME_OF_CITY_IN_A_STATE_BORDERING_MASSACHUSETTS .
:capitalCities log:definitiveDocument <http://example.org/listOfAllCapitalCities>.
also says that all true statements using :capitalCities are made in that document.
We could use this to query "what states are NOT adjacent to MA", which requires knowing our adjacency knowledge is complete.