W3C home > Mailing lists > Public > www-rdf-logic@w3.org > September 2001

a formal design for RDF/N3 context/scopes

From: Dan Connolly <connolly@w3.org>
Date: Thu, 06 Sep 2001 15:23:17 -0500
Message-ID: <3B97DB35.7F450115@w3.org>
To: las@olin.edu
CC: www-rdf-logic@w3.org
I think I've got a handle on how to relate N3
{} syntax to KIF, i.e. FOPL + quoting.
log:forAll and log:forSome are special-magic syntax,
but all the rest comes out in the wash.

rdf-logic folks, this might not make much sense;
I'm mostly writing it down to discuss with one
or two people, but I'm copying the rest of
rdf-logic just in case it's useful to some folks...

Some examples for discussion:
 (based in http://www.w3.org/2000/10/swap/test/
	though many are not checked in/chacl'd)

basic RDF:

--- test/meet/blue.n3
  -- (see also http://www.w3.org/2000/10/swap/test/meet/blue.rdf)
@prefix p:  <http://www.example.org/personal_details#> .
@prefix m:  <http://www.example.org/meeting_organization#> .
 
<http://www.example.org/people#fred>
        p:GivenName     "Fred";
        p:hasEmail              <mailto:fred@example.com>;
        m:attending     <http://meetings.example.com/cal#m1> .
 
<http://meetings.example.com/cal#m1>
        m:homePage              <http://meetings.example.com/m1/hp> .
--->KIF-->
(prefix "p" "http://www.example.org/personal_details#")
(prefix "m" "http://www.example.org/meeting_organization#")
    (and
     (p__GivenName http://www.example.org/people#fred "Fred")
     (p__hasEmail http://www.example.org/people#fred
mailto:fred@example.com )
     (m__attending http://www.example.org/people#fred
http://meetings.example.com/cal#m1 )
     (m__homePage http://meetings.example.com/cal#m1
http://meetings.example.com/m1/hp )
    )
---


with a so-called anonymous node:

-- test/meet/red.n3

@prefix m:  <http://www.example.org/meeting_organization#> .
@prefix g:  <http://www.another.example.org/geographical#> .
 
<http://meetings.example.com/cal#m1>
        m:Location [ g:zip "02139"; g:lat "14.124425"; g:long "14.245"
];
        m:chair   <http://www.example.org/people#fred> .
---
(prefix "m" "http://www.example.org/meeting_organization#")
(prefix "g" "http://www.another.example.org/geographical#")
  (exists (?thing_1 )
    (and
     (g__zip ?thing_1 "02139")
     (g__lat ?thing_1 "14.124425")
     (g__long ?thing_1 "14.245")
     (m__Location http://meetings.example.com/cal#m1 ?thing_1 )
     (m__chair http://meetings.example.com/cal#m1
http://www.example.org/people#fred )
    )
  )
---


question: does it matter whether the ground facts are inside
the (exists () ...) or not?


Now onto the tricky bits... subformulas/scopes/contexts...
N3 {} is mapped to KIF quasi-quoting ^(...).

--- test/subformula1.n3
@prefix log: <http://www.w3.org/2000/10/swap/log#>.
@prefix : <http://www.w3.org/2000/10/swapt/test/quot-sem#>.
 
{ :weather :is :rainy }
  log:implies { :I :giveRideTo :you }.
 
:weather :is :rainy.
---- in KIF:
(prefix "log" "http://www.w3.org/2000/10/swap/log#")
(prefix "" "http://www.w3.org/2000/10/swapt/test/quot-sem#")
    (and
     (log__implies ^        (__is __weather __rainy )
^        (__giveRideTo __I __you )
)
     (__is __weather __rainy )
    )
----


Quantifying into the quoted expression...

--- subformula2.n3
@prefix log: <http://www.w3.org/2000/10/swap/log#>.
@prefix : <http://www.w3.org/2000/10/swapt/test/quot-sem#>.
 
this log:forAll :x.
 
{ :x a :Dog }
  log:implies { :x :gets :Fleas }.
 
:fido a :Dog.
--->KIF-->
(prefix "log" "http://www.w3.org/2000/10/swap/log#")
(prefix "" "http://www.w3.org/2000/10/swapt/test/quot-sem#")
   (forall (?x )
    (and
     (log__implies ^       
(http://www.w3.org/1999/02/22-rdf-syntax-ns#type , ?x __Dog )
^        (__gets , ?x __Fleas )
)
     (http://www.w3.org/1999/02/22-rdf-syntax-ns#type __fido __Dog )
    )
   )
---

Quantifiers inside the quoted part:

--- test/tom-mary.n3
@prefix : <whatever#> .
 
:Tom :believes {
    :Mary :wants {
        :Mary :marriedTo [ a :Sailor ]
    }
}.
--->KIF-->
(prefix "" "file:/home/connolly/w3ccvs/WWW/2000/10/swap/whatever#")
     (__believes __Tom ^        (__wants __Mary ^       (exists
(?thing_3 )
        (and
         (http://www.w3.org/1999/02/22-rdf-syntax-ns#type ?thing_3
__Sailor )
         (__marriedTo __Mary ?thing_3 )
        )
      )
)
)
---

and the grand finale...

http://www.w3.org/2000/10/swap/test/acl-pf.n3
http://www.w3.org/2000/10/swap/test/acl-pf.kif
  (not yet chacl'd)

All above examples produced by a KIF sink module:

  http://www.w3.org/2000/10/swap/KIFSink.py
  $Id: KIFSink.py,v 1.1 2001/09/06 20:13:05 connolly Exp $ 

I've also got a KIF parser, though I don't have
it connected with the rest of the swap/cwm stuff:

  http://www.w3.org/2000/10/swap/kifForm.html
  http://www.w3.org/2000/10/swap/kifForm.g

-- 
Dan Connolly, W3C http://www.w3.org/People/Connolly/
Received on Thursday, 6 September 2001 16:23:20 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 7 December 2009 10:52:41 GMT