W3C home > Mailing lists > Public > public-cwm-talk@w3.org > April to June 2010

log:Truth rule

From: Story Henry <henry.story@bblfish.net>
Date: Mon, 26 Apr 2010 20:38:24 +0100
Message-Id: <A6D4F996-7769-45CA-90F3-BD447CBACC14@bblfish.net>
To: public-cwm-talk@w3.org
I wrote out the following rule


---------✁---------✂-----------------✃-----------------------
$  cat test.n3

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

@forAll :G, :s, :r, :o .
{  :G a log:Truth;
      log:includes {:s :r :o. } } => { :s :r :o. } .

{ :joe :loves :jane .
  :jane :loves :jack. } a log:Truth . 
---------✁---------✂-----------------✃-----------------------


( Thanks to DanC for pointing out the importance of @forAll here )
This works

---------✁---------✂-----------------✃-----------------------
$ cwm  test.n3 --think  
#Processed by Id: cwm.py,v 1.197 2007/12/13 15:38:39 syosi Exp 
#[snip]

     @prefix : <#> .
    @prefix log: <http://www.w3.org/2000/10/swap/log#> .
    
     @forAll :G,
                :o,
                :r,
                :s .
    
    :jane     :loves :jack .
    
    :joe     :loves :jane .
    {
        :jane     :loves :jack .
        :joe     :loves :jane .
        
        }     a log:Truth .
    {
        :G     a log:Truth;
             log:includes {:s     :r :o .
            } .
        
        }     log:implies {:s     :r :o .
        } .
---------✁---------✂-----------------✃-----------------------


Ie we get :jane :loves :jack as a fact.
This is close to Tarski's definition of truth, so I think we could add this to 
the log: rules no?

As a side note, I found that the same command with '--mode=rse' does not work. It gives the error. Not sure if --mode=rse is still needed
   
---------✁---------✂-----------------✃-----------------------
$ cwm  --mode=rse test.n3 --think  
#Processed by Id: cwm.py,v 1.197 2007/12/13 15:38:39 syosi Exp 
        #    using base file:///Users/hjs/Programming/FoafSSL/foafssl-java/papers/spot2009/n3/test.n3
        Traceback (most recent call last):
  File "/Users/hjs/Programming/w3.org/2000/10/swap/cwm.py", line 750, in <module>
    doCommand()
  File "/Users/hjs/Programming/w3.org/2000/10/swap/cwm.py", line 617, in doCommand
    think(workingContext, mode=option_flags["think"])
  File "/Users/hjs/Programming/w3.org/2000/10/swap/query.py", line 89, in think
    return InferenceTask(knowledgeBase, ruleFormula, mode=mode, why=why, repeat=1).run()
  File "/Users/hjs/Programming/w3.org/2000/10/swap/query.py", line 184, in run
    return self.runBrilliant()
  File "/Users/hjs/Programming/w3.org/2000/10/swap/query.py", line 208, in runBrilliant
    total = scheduler.run(int.__add__)
  File "/Users/hjs/Programming/w3.org/2000/10/swap/query.py", line 1964, in run
    retVal = self.next()
  File "/Users/hjs/Programming/w3.org/2000/10/swap/query.py", line 1958, in next
    return retVal.thunk()
  File "/Users/hjs/Programming/w3.org/2000/10/swap/query.py", line 160, in addRule
    return Rule(task, subj, obj, statement, variables).once()
  File "/Users/hjs/Programming/w3.org/2000/10/swap/query.py", line 474, in once
    total = query.resolve()
  File "/Users/hjs/Programming/w3.org/2000/10/swap/query.py", line 804, in resolve
    k = self.matchFormula(self.statements, self.variables, self._existentialVariables)
  File "/Users/hjs/Programming/w3.org/2000/10/swap/query.py", line 975, in matchFormula
    nbs = item.doIncludes(queue, existentials, variables, bindings)
  File "/Users/hjs/Programming/w3.org/2000/10/swap/query.py", line 1505, in doIncludes
    unmatched=more_unmatched, mode=item.query.mode):
  File "/Users/hjs/Programming/w3.org/2000/10/swap/query.py", line 1417, in setup
    schema = pred.dereference(mode, self.query.workingContext)
AttributeError: 'AnonymousUniversal' object has no attribute 'dereference'
---------✁---------✂-----------------✃-----------------------

But the following works, but I am not sure if it is going to do the right thing.

---------✁---------✂-----------------✃-----------------------
hjs@bblfish-2:2$ cwm  test.n3 --think  --mode=rse
#Processed by Id: cwm.py,v 1.197 2007/12/13 15:38:39 syosi Exp 
        #    using base file:///Users/hjs/Programming/FoafSSL/foafssl-java/papers/spot2009/n3/test.n3
        
#  Notation3 generation by
#       notation3.py,v 1.200 2007/12/11 21:18:08 syosi Exp

#   Base was: file:///Users/hjs/Programming/FoafSSL/foafssl-java/papers/spot2009/n3/test.n3
     @prefix : <#> .
    @prefix log: <http://www.w3.org/2000/10/swap/log#> .
    
     @forAll :G,
                :o,
                :r,
                :s .
    
    :jane     :loves :jack .
    
    :joe     :loves :jane .
    {
        :jane     :loves :jack .
        :joe     :loves :jane .
        
        }     a log:Truth .
    {
        :G     a log:Truth;
             log:includes {:s     :r :o .
            } .
        
        }     log:implies {:s     :r :o .
        } .
---------✁---------✂-----------------✃-----------------------


Henry
Received on Monday, 26 April 2010 19:39:06 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 26 April 2010 19:39:12 GMT