Re: scope of _:existentials in N3Logic?

Tim,

at first I didn't understand why the behavior is different for blank
nodes matched by a variable (as in my example) and blank nodes named
explicitly in a rule (as in Dan's example) but then I went to look at
your N3Logic paper and on page 10 you write:

"N3 allows blank nodes in the conclusion of a rule, hence allowing the
creation of new objects."

So this is the reason for the difference if I am right? Whenever there's
a blank node in the rule conclusion a new object will be created.

There could also be another way to achieve this - by allowing variables
in conclusion that do not occur in the rule body (i.e. variables that
are not range restricted). For such variables a new blank node could be
created and for a blank node named explicitly in the rule head it's name
would be used so it would work the way Dan wanted it to. Is there some
problem with this approach I don't see?

Regards,
Jakub


Tim Berners-Lee schrieb:
> Jakub,
> 
> When adding new facts to the same graph, as you suggest,
> the same blank node is used:
> 
> 
> $ echo ':bob :likes _:s1. {:bob :likes ?X} => {:fred :likes ?X}.' | cwm --think --quiet
>      @prefix : <#> .
>     
>      @forAll :X.
>          @forSome :_g0 .    
>     :bob     :likes :_g0 .    
>     :fred     :likes :_g0 .
>     {
>         :bob     :likes :X .      
>         }     <http://www.w3.org/2000/10/swap/log#implies> {:fred     :likes :X .
>         } .
>     
> 
> Tim
> 
> 
> On 2010-02 -25, at 04:59, Jakub Kotowski wrote:
> 
>> Jos and Dan,
>>
>> So it means that rule bodies match graphs and rule heads create
>> different graphs...? Why is it so? Rule heads could well "create"
>> triples in the same graph that matched the body and then the blank-node
>> wouldn't and shouldn't have to be renamed.
>>
>> I am wondering what happens if a rule body variable binds to a
>> blank-node and rule head creates a new triple with this binding.
>>
>> For example:
>>
>> :bob :likes _:somebody_1.
>> {bob likes ?X} => {fred likes ?X}
>>
>> is the blank node in the new fred likes ... triple different from
>> _:somebody_1 too?
>>
>> Regards,
>> Jakub
>>
>>
>> jos.deroo@agfa.com schrieb:
>>> It took us 10 years to realize that the scope of blank nodes is the
>>> graph in which they occur :-)
>>> The answer we get from euler is the same as you got from cwm:
>>>
>>> eye --nope varscope1.n3 --pass
>>> #Processed by $Id: euler.yap 3310 2010-02-24 21:31:52Z josd $
>>>
>>> @prefix : <evarscope1#>.
>>> @prefix var: <http://localhost/var#>.
>>> @prefix e: <http://eulersharp.sourceforge.net/2003/03swap/log-rules#>.
>>> @prefix r: <http://www.w3.org/2000/10/swap/reason#>.
>>> @prefix n3: <http://www.w3.org/2004/06/rei#>.
>>>
>>> :bob :likes _:somebody_1.
>>> :fred :likes _:somebody_1.
>>> :alice :likes :trina.
>>> :trina :likes _:sk0.
>>>
>>>
>>> Kind regards,
>>>
>>> Jos De Roo | Agfa HealthCare
>>> Senior Researcher | HE/Advanced Clinical Applications Research
>>> T  +32 3444 7618
>>> http://www.agfa.com/w3c/jdroo/
>>>
>>> Quadrat NV, Kortrijksesteenweg 157, 9830 Sint-Martens-Latem, Belgium
>>> http://www.agfa.com/healthcare
>>>
>>>
>>> *Dan Connolly <connolly@w3.org>*
>>> Sent by: public-cwm-talk-request@w3.org
>>>
>>> 02/23/2010 11:16 PM
>>>
>>> 	
>>> To
>>> 	public-cwm-talk@w3.org
>>> cc
>>> 	
>>> Subject
>>> 	scope of _:existentials in N3Logic?
>>>
>>>
>>> 	
>>>
>>>
>>>
>>>
>>>
>>>
>>> I'm re-implementing N3Logic in scala... in particular, parsing
>>> N3 syntax into Coherent formulas. I'm trying to figure
>>> out how existential variables work in N3, and I'm surprised about
>>> something.
>>>
>>> Consider:
>>>
>>> There's somebody that Bob likes and Fred likes.
>>> And everybody that Alice likes also likes this somebody.
>>> Also, Alice likes Trina.
>>>
>>> Does Trina like this somebody?
>>>
>>> Of course Trina does, but when I try to write the problem
>>> down in N3, cwm doesn't handle it as I'd expect. cwm concludes
>>> that Trina likes something, but not that Trina likes
>>> the same somebody that Bob and Fred like.
>>>
>>> $ cat ...varscope1.n3
>>> @prefix : <evarscope1#>.
>>> @keywords is, of, a.
>>>
>>> bob likes _:somebody.
>>> fred likes _:somebody.
>>> { alice likes ?X } => { ?X likes _:somebody }.
>>> alice likes trina.
>>>
>>> $ cwm.py ...varscope1.n3 --think
>>> #Processed by Id: cwm.py,v 1.197 2007/12/13 15:38:39 syosi Exp
>>>       #    using base
>>> file:///home/connolly/projects/rdfsem/src/test/resources/varscope1.n3
>>>
>>> #  Notation3 generation by
>>> #       notation3.py,v 1.200 2007/12/11 21:18:08 syosi Exp
>>>
>>> #   Base was:
>>> file:///home/connolly/projects/rdfsem/src/test/resources/varscope1.n3
>>>    @prefix : <evarscope1#> .
>>>   @prefix va: <#> .
>>>
>>>    @forAll va:X.
>>>        @forSome va:_g0 .
>>>
>>>   :alice     :likes :trina .
>>>
>>>   :bob     :likes va:_g0 .
>>>
>>>   :fred     :likes va:_g0 .
>>>
>>>   :trina     :likes  [
>>>        ] .
>>>   {
>>>       :alice     :likes va:X .
>>>
>>>       }     <http://www.w3.org/2000/10/swap/log#implies>
>>> {va:X     :likes  [
>>>            ] .
>>>       } .
>>>
>>> #ENDS
>>>
>>> The surprise is bad news, but the good news is that cwm's
>>> way of reading this formula does fit inside coherent logic,
>>> which makes my coding goal straightforward...
>>>
>>> -- 
>>> Dan Connolly, W3C http://www.w3.org/People/Connolly/
>>> gpg D3C2 887B 0F92 6005 C541  0875 0F91 96DE 6E52 C29E
>>>
>>>
>>>
>>>
>>
>>
> 
> 

Received on Friday, 26 February 2010 12:19:01 UTC