$BK\J8=q$O!"(B
"Primer: Getting into RDF & Semantic Web using N3"
(http://www.w3.org/2000/10/swap/Primer.html)

$B$r!V0ULu!W$7$?$b$N$G$9!#(B $BK\Lu$K$O8m$j$,4^$^$l$k2DG=@-$,$"$j$^$9$N$G!"I,$:86J8$r8f;2>H2<$5$$!#(B
2/6/2003, $BGr@P(B $BE85W(B(Nobuhisa Shiraishi) <[email protected]>

W3C | Semantic Web | SWAP

-->
W3C | Semantic Web| Advanced Development | SWAP | Tutorial | Primer

N3$B$K$h$k(BRDF$B$H%;%^%s%F%#%C%/(BWeb$BF~Lg(B

The world of the semantic web, as based on RDF, is really simple at the base. This article shows you how to get started. It uses a simplified teaching language — Notation 3 or N3 — which is basically equivalent to RDF in its XML syntax, but easier to scribble when getting started.

-->

RDF$B$r%Y!<%9$H$9$k%;%^%s%F%#%C%/(BWeb$B$N@$3&$O!"4pK\$O$H$F$bC1=c$G$9!#(B $BK\J8=q$G$O!"4JN,2=$5$l$?650iMQ8@8l$G$"$k(B "Notation 3"(N3)$B$r;H$C$F!"(B $B%;%^%s%F%#%C%/(BWeb$B$N4pAC$K$D$$$F@bL@$7$^$9!#(B N3$B$O!"(BXML$BJ8K!$G$"$k(BRDF$B$H!"4pK\E*$K$[$\F1$85!G=$r;}$C$F$$$^$9$,!"(B $B=i?4

$B

RDF$B$G$O!"!VpJs$rI=$7$^$9!#(B N3$B$G$O!"$3$N(BRDF$B$K$*$1$k(B3$B$D$NMWAG$r!"0J2<$NMM$K!"(B $BKvHx$K%T%j%*%I$r$D$1$F5-=R$7$^$9!#(B

<#pat> <#knows> <#jo> .

$Bl9g$K$O!"(B $B8=:_$NJ8=q$NCf$r;XDj$7$^$9!#(B

$BNc30$H$7$F!"L\E*8l(B($B$@$1(B)$B$O!"!VCM!W$rI=$9J8;zNs$r(B $B;HMQ$9$k$3$H$b$G$-$^$9!#(B

<#pat> <#knows> <#jo> .
<#pat> <#age> "24" .

"knows"$B$H$$$&F0;l$O!"(BRDF$B$G$O!V%W%m%Q%F%#!W$H8F$P$l!"(B2$B$D$N$b$N$N4X78$r(B $BI=$9L>;l$K$"$?$j$^$9!#(B
$B$^$?!"0J2<$NJ8(B:

<#pat> <#child> <#al> .

$B$O!"4JC1$+$DFI$_$d$9$/$9$k$?$a$K!"(B

<#pat> has <#child> <#al> .

$B$^$?$O(B

<#al> is <#child> of <#pat> .

$B$N$h$&$K=q$/$3$H$b$G$-$^$9!#(B

$B$^$?!"0J2<$N(B2$B$D$N!">JN,5-K!(B($B%7%g!<%H%+%C%H(B)$B$r;H$&$3$H$,$G$-$^$9!#(B $BF1$8l9g!"%;%_%3%m%s(B";"$B$r;H$C$F!"(B $BF1$8

<#pat> <#child>  <#al>, <#chaz>, <#mo> ;
       <#age>    "24" ;
       <#eyecolor> "blue" .

$B$7$?$,$C$F!"Nc$($P0J2<$NI=$N$h$&$J%G!<%?$O!"(B

age eyecolor
pat 24 blue
al 3 green
jo 5 green

$B0J2<$N$h$&$K5-=R$9$k$3$H$,$G$-$^$9!#(B

  <#pat>   <#age> "24";  <#eyecolor> "blue" .
  <#al>    <#age>  "3";  <#eyecolor> "green" .
  <#jo>    <#age>  "5";  <#eyecolor> "green" .

$B$H$-$I$-!"%9%F!<%H%a%s%H$K4^$^$l$k$b$N$NCf$K!"(B $B<1JL;R$rM?$($:!"%W%m%Q%F%#$N$_$rM?$($?$$>l9g$,$"$j$^$9!#(B $B$3$N$h$&$J>l9g$K$O!"Bg$+$C$3(B"[]"$B$NCf$K!"%W%m%Q%F%#$N$_$r5-=R$7$^$9!#(B

<#pat> <#child> [ <#age> "4" ] , [ <#age> "3" ].

$B>e$NJ8>O$O!"!V(B#pat$B$O!"(B#age$B$,(B"4"$B$G$"$k(B#child$B$H!"(B#age$B$,(B"3"$B$G$"$k(B#child $B$r;}$C$F$$$k!#!W$H$$$&0UL#$rI=$7$^$9!#(B
$B$3$3$G!"0J2<$N(B2$B$D$NBg;v$JE@$,$"$j$^$9!#(B

($B>e5-$N(B1$BHVL\$NE@$K4X$7$F(B)$B!"$b$7A0!W$r;H$&$N$G$"$l$P!"(B $B>e$NI=$N%G!<%?$O!"0J2<$NMM$K=q$/$3$H$,$G$-$^$9!#(B

  [ <#name> "Pat"; <#age> "24";  <#eyecolor> "blue"  ].
  [ <#name> "Al" ; <#age>  "3";  <#eyecolor> "green" ].
  [ <#name> "Jo" ; <#age>  "5";  <#eyecolor> "green" ].

$BBg$+$C$3$K$O!"$$$m$$$m$JAH$_9g$o$;J}$,$"$j$^$9$N$G!"(B $B8e$[$I$$$/$D$+!"Nc$r<($7$^$9!#(B
N3$B$r;H$C$?%G!<%?$NI=8=J}K!$K$D$$$F$O!"$3$l$^$G@bL@$7$?0J30$K$O!"(B $B3X$V$3$H$O$5$[$I$"$j$^$;$s!#(B $B<!$K?J$_$^$7$g$&!#(B

$B35G0$N6&M-(B

$B%;%^%s%F%#%C%/(BWeb$B$G$O!"(B1$B$D$N%I%-%e%a%s%H$@$1$G!"(B $B2?$+$N0UL#$rDj5A$7$-$l$k$H$O8B$j$^$;$s!#(B $B$3$l$O!"1Q8l$G$b(B($B>l9g$K$h$C$F$O?t3X$G$b(B)$B$=$&$G$9$,!"(B $B2f!9$,!"(B($B9q2q?^=q4[$N%+%?%m%0%+!<%I$d(BWeb$B%Z!<%8$J$I$N(B) $B!V%?%$%H%k!W$H$$$&35G0$r;H$C$F%3%_%e%K%1!<%7%g%s$r$9$k>l9g$K$O!"(B $B2f!9$O!V%?%$%H%k!W$H$$$&6&M-$7$?35G0$KMj$k$3$H$K$J$k!"$H$$$&$3$H$G$9!#(B $B%;%^%s%F%#%C%/(BWeb$B$G$O!"!V%?%$%H%k!W$N35G0$r!"(B $BA4$/F1$8(BURI$B$r;HMQ$9$k$3$H$K$h$C$F!"(B $B6K$a$F@53N$K6&M-$7$^$9!#(B

N3$B$N%I%-%e%a%s%H$N%?%$%H%k$O!"0J2<$N$h$&$K$7$FM?$($k$3$H$,$G$-$^$9!#(B

<> <#title>  "A simple example of N3".

(<>$B$N$h$&$J6u$N(BURI$B$O!">o$K$=$l$,=q$+$l$F$$$k%I%-%e%a%s%H<+?H$r;X(B $B$7$^$9!#(B) <#title>$B$O!"$=$N%I%-%e%a%s%H$GDj5A$5$l$?!"(B#title$B$N35G0$r<($7$^$9!#(B $B$3$l$@$1$G$O!"FIDublin Core $B$H8F$P$l$k%W%m%Q%F%#$N%j%9%H$r:n$C$?%0%k!<%W$O!"(B $B$=$NCf$KH`$i$N!V%?%$%H%k!W$H$$$&35G0$rCx$7$F!"(B $B$3$l$K(B<http://purl.org/dc/elements/1.1/title>$B$H$$$&<1JL;R$rM?$($^$7$?!#(B

$B$7$?$,$C$F!"$3$l$r;H$($P!"0J2<$N$h$&$K!"(B $B$h$j87L)$KDj5A$5$l$?%9%F!<%H%a%s%H$r=q$/$3$H$,$G$-$^$9!#(B

<> <http://purl.org/dc/elements/1.1/title>
 "Primer - Getting into the Semantic Web and RDF using N3".

$B$b$A$m$s!"(B $BA0=P$N(B#age$B$d(B#eyecolor$B$J$I$NA4$F$KBP$7$F!"$3$N$h$&$JD9$$<1JL;R$r;H$&$N$O!"(B $B>/$7>iD9$G$9!#(B N3$B$G$O!"$3$ND9$$ItJ,$KBP$7$F!"C;$$%W%j%U%#%C%/%9$r@_Dj$9$k$3$H$,$G$-$k$h(B $B$&$K$J$C$F$$$^$9!#$3$l$O!"L>A06u4V<1JL;R(B(namespace identifier)$B$H8F$P$l$k(B $B$b$N$G!"(B"@prefix"$B$r;HMQ$7$F!"0J2<$N$h$&$K@_Dj$7$^$9!#(B

@prefix dc:  <http://purl.org/dc/elements/1.1/> .
<> dc:title  "Primer - Getting into the semantic web and RDF using N3".

$B%W%j%U%#%C%/%9$r;H$&:]$K$O!"(B"dc"$B$H(B"title"$B$N4V$K!"(B $B%O%C%7%e(B"#"$B$NBe$o$j$K%3%m%s(B":"$B$r;H$&$3$H!"(B $BA4BN$r%"%s%0%k%V%i%1%C%H(B"<>"$B$G$O0O$^$J$$$3$H$KCm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person)$B!"@8J*(B(AnimateObject)$B!"F0J*(B(Animal)$B!"(B $BGX$N9b$$?M(B(TallPerson)$B!"M'?M(B(Friend) $B$J$I$N%/%i%9$r9M$($F$_$F$/$@$5$$!#(B $B$J$*!"0J2<$N$h$&$K(B2$B$D$N%/%i%9$K4XO"$,$"$k$3$H$r5-=R$9$k$3$H$b$G$-$^$9!#(B $B$3$l$K$D$$$F$O!"(BRDF$B%9%-!<%^$N(B($B%/%i%9$N(B)$B%W%m%Q%F%#$H!"(B DAML$B%*%s%H%m%8(B$B$N%\%-%c%V%i%j$r(B $B3NG'$7$F$_$F2<$5$$!#(B

:Woman a rdfs:Class; rdfs:subClassOf :Person .

rdf:Property$B$O!"(B2$B$D$N$b$N$N4X78$r@k8@$9$k>l9g$K;H$o$l$^$9!#(B

:sister a rdf:Property.

2$B$D$N$b$N$N4V$K4X78$,B8:_$9$k>l9g!"(B $B$=$N4X78$K4X$9$k>pJs$O!"$9$0$5$^%/%i%9$H$7$FI=8=$9$k$3$H$,$G$-$^$9!#(B $B$"$k%W%m%Q%F%#$No$K(B1$B$D$N%/%i%9$KB0$5$J$1$l$P$J$i$J$$>l9g!"(B $B$=$N%/%i%9$O!"$=$N%W%m%Q%F%#$N(B $B%I%a%$%s(B $B$H8F$P$l$^$9!#(B $BF1MM$K!"$"$k%W%m%Q%F%#$NL\E*8l$,!"(B $B>o$K(B1$B$D$N%/%i%9$KB0$5$J$1$l$P$J$i$J$$>l9g!"(B $B$=$N%/%i%9$O!"(B $B%l%s%8(B $B$H8F$P$l$^$9!#(B 1$B$D$N%W%m%Q%F%#$O!"J#?t$N%I%a%$%s$H%l%s%8$r;}$D$3$H$,=PMh$^$9$,!"(B $BDL>o$O!"(B1$B$D$N%I%a%$%s$d%l%s%8$r;XDj$7$^$9!#(B

:sister rdfs:domain :Person; rdfs:range :Woman.

$B%/%i%9<1JL;R$OBgJ8;z$G;O$^$j!"%W%m%Q%F%#$O>.J8;z$G;O$^$j$^$9!#(B $B$3$l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Dj5A$5$l$^$9!#(B $B>e$NNc$O!"C1$K!"%I%-%e%a%s%H(B"x.rdf"$B$K!"(B "pat"$B$,(B"person"$B$G$"$k$H$$$&!V2>A[$N<0!W$,!"(B $B5-=R$5$l$F$$$k$3$H$r@k8@$7$F$$$k$@$1$G$9!#(B $B>e$N%9%F!<%H%a%s%H$O!"7h$7$F(B"pat"$B$,(B"person"$B$G$"$k$H$$$&$3$H$O8@$C$F$$$^$;$s!#(B ($B$3$l$r!"(BXML$B%7%j%"%i%$%<!<%7%g%s$7$?>l9g$K$O!"LdBj$,H/@8$7$^$9!#(B)

$B<0$r5-=R$9$k0lHVBg$-$JM}M3$O!"%k!<%k$r5-=R$9$k$?$a$G$9!#(B

$B%k!<%k(B

$B%k!<%k$r;H$&$3$H$K$h$C$F!"2>Dj$+$i7kO@$rF3$-=P$9$3$H$,$G$-$^$9!#(B $B%k!<%k$H$O!"%W%m%0%i%`$K$h$C$F=hM}$,2DG=$J7A<0$N%9%F!<%H%a%s%H$G$9!#(B $B:G$bC1=c$J%k!<%k$O!"(Blog:implies$B$H$$$&(B 1$B$D$N%W%m%Q%F%#$N$_$r;HMQ$9$k$3$H$G$9!#(B ($B%k!<%k$r=hM}$9$k$?$a$N%W%m%0%i%`%(%s%8%s$N(B1$B$D$H$7$F!"(B Euler$B$N:n@.$7$?(Bcwm$B$,$"$j$^$9!#(B) $B$3$l$+$i>R2p$9$k!"O@M}E*$G$`$7$mA06u4V$O!"(B $B0J2<$NDL$j$H$J$j$^$9!#(B

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

$BC1=c$J%k!<%k$NNc$H$7$F!"0J2<$r9M$($F$_$^$9!#(B

{ sensor:thermostat  math:greaterThan "30" . } log:implies { control:furnace control:setTo "1" . } .

$B>e$NA4$F$NItJ,$rM}2r$G$-$k%7%9%F%`$,9=C[$5$l$F$$$?>l9g!"(B $B0J2<$rM?$($k$H!"(B

sensor:thermostat  math:greaterThan "30" .

$B0J2<$N7kO@$,F3$-=P$5$l$^$9!#(B

control:furnace control:setTo "1".

$B$3$N%k!<%k$O!"C1=c$+$DJXMx$G$9$,!"l9g$G$b!"%3%s%F%-%9%HA4BN$rDL$8$F(B $B$=$l$,??$H$J$k$h$&$J<0$G$9!#(B $B$3$N$h$&$J<0$O!"(B"log:forAll"$B%W%m%Q%F%#$H$$$&(B $B!VKbK!$N!W%W%m%Q%F%#$r;H$C$F!"5-=R$9$k$3$H$,$G$-$^$9!#(B

this log:forAll :x, :y.
{:x :parent :y} log:implies {:y :child :x}.

$B>e5-$O!"!V$3$l$O(Bx$B$H(By$B$,$$$+$J$kCM$r$H$k>l9g$G$b??$G$"$k!#(B $B$b$7(Bx$B$,(By$B$N?F$G$"$k$J$i$P!"(By$B$O(Bx$B$N;R6!$G$"$k!#(B $B!W$H$$$&0UL#$rI=$7$^$9!#(B "this"$B$O!"$=$l$rD>@\0O$C$?%V%l%9$NCf$N<0$r;X$7$^$9!#(B $B>e5-$N$h$&$K!"30B&$N%l%Y%k$KB8:_$9$k>l9g$K$O!"(B $B$=$N%I%-%e%a%s%H$K=q$+$l$?<0$r;X$7$^$9!#(B

$B

:parent ont:inverse :child .

$B%^%7%s$K!"0lHLE*$J%k!<%k$rM?$($k$3$H$K$h$C$F!"(B $B>e$HF1$8;v$r!"?dO@$5$;$k$3$H$b$G$-$^$9!#(B

this log:forAll :p, :q .

{  :p ont:inverse :q . } log:implies

  { this log:forAll :x, :y.
      { :x :p :y. } log:implies { :y :q :x. }
  } .

$B>e5-$N30B&$N%k!<%k$O!"(B $B!V$b$7(Bp$B$H(Bq$B$,H?BP$G$"$k$J$i$P!"FbB&$N%k!<%k$,??$G$"$k!#(B $B!W$H$$$&0UL#$G$9!#(B $BFbB&$N%k!<%k$O!"(B $B!V$b$7(Bx$B$,(By$B$N(Bp$B$G$"$k$J$i$P!"(By$B$O(Bx$B$N(Bq$B$G$"$k!#!W(B $B$H$$$&0UL#$G$9!#(B $BFbB&$N%k!<%k$O!"$I$s$J(Bx$B$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$9$k$3$H$K$7$^$9!#(B

@prefix : <uncle#>.
:Fred is :father of :Joe.
:Bob is :brother of :Fred.

@prefix log: <http://www.w3.org/2000/10/swap/log#> .
this log:forAll :who1, :who2.
{ :who1 :father [ :brother :who2 ] } log:implies { :who1 :uncle :who2 }.

$B>e$N%k!<%k$O!"!VC/$+$NIc$K7;Do$,$$$k$J$i$P!"$=$N?M$OH`$i$N$*$8$G$"$k!W(B $B$H$$$&$3$H$r0UL#$7$^$9!#(B $B$3$N%k!<%k$r!"(Bcwm$B$K3JG<$9$l$P!"(B cwm $B$O!"%3%^%s%I%i%$%s%*%W%7%g%s(B"--think." $B$r;XDj$9$k$3$H$K$h$j!"(B $B$*$8$N>pJs$r?dO@$9$k$3$H$,$G$-$k$h$&$K$J$j$^$9!#(B

$BJL$N%U%!%$%k(B (uncleF.n3) $B$G!">e5-$N%k!<%k$r%U%#%k%?$H$7$F;H$C$F$_$^$9!#(B "--think"$B%*%W%7%g%s$r;HMQ$9$k$N$G$O$J$/!"(B $B%U%#%k%?$H$7$FF0:n$5$;$k$3$H$K$h$C$F!"(B $B%k!<%k$K9gCW$7$?>pJs$N$_$rA*Br$7!"(B $B;D$j$OA4$FGK4~$5$l$^$9!#(B $B%U%#%k%?$r;H$&$3$H$K$h$C$F!"(B $B0J2<$N4{CN$N>pJs$NCf$+$i!"M_$7$$O@M}E*$J4X78$rCj=P$9$k$3$H$,$G$-$^$9!#(B

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

this log:forAll :p.

# What is the relationship between Joe and Bob

{ :Joe :p :Bob } log:implies { :p a :RelationshipBetweeJoeAndBob }.

# Is Bob an Uncle of Joe?

{ :Joe :uncle :Bob } log:implies { :Joe :uncle :Bob }.

$B>e5-$r;HMQ$7$F!"(Bcwm$B$KBP$7$F!"O@M}E*$J4X78$r9M$($5$;$k$H!"(B $B0J2<$N7kO@$H$J$j$^$9!#(B

> python cwm.py uncle.n3 --think --filter=uncleF.n3
    :Joe     :uncle :Bob .
    :uncle     a :RelationshipBetweeJoeAndBob .

$B>e5-%3%^%s%I%i%$%s$O!"!V(B uncle.n3$B$rFI$_9~$s$G!"$=$l$+$iF@$k$3$H$,=PMh$k%k!<%k$r?dO@$7$J$5$$!#(B $B$=$7$F!"(BuncleF.n3$B%U%#%k%?$K$h$C$FA*Br$5$l$k>pJs$r=PNO$7$J$5$$!#(B $B!W$H$$$&0UL#$K$J$j$^$9!#(B

$B99$K(B...

$B>e5-$K$D$$$F$O!":#8e$b8!F$$rB3$1!";qNA$r:n@.$7$F$$$/I,MW$,$"$j$^$9!#(B $B99$J$k%"%$%G%"$N$?$a$K!"(B $B$$$m$$$m$JJ#;($JNc$NKDBg$J%j%9%H(B $B$,$"$j$^$9!#(B $B$?$@$7!"$3$l$i$K$O$"$^$j%A%e!<%H%j%"%kE*$J@bL@$O$D$$$F$$$^$;$s!#(B

Have fun!


$BMQ8l=8(B

$B0J2<$O!"@5<0$JDj5A$G$O$"$j$^$;$s!#(B $B$3$l$i$NMQ8l$,$I$&$$$&0UL#$G$"$k$+$rGD0.$9$k$?$a$N%X%k%W$G$9!#(B $B0J2<$N3FMQ8l$+$i$O!"$=$l$i$K4X$9$k99$K>\$7$$>pJs$X$N%j%s%/$,D%$i$l$F$$$^$9!#(B

$B%/%i%9(B(Class)
$B$b$N(B(Things)$B$N%;%C%H!#(B 1$B%Q%i%a!<%?=R8l!#C19`4X78!#(B
$B%I%a%$%s(B(domain)
$B%W%m%Q%F%#(B(Property)$B$K$*$$$F!"(B $B%W%m%Q%F%#(B(Property)$B$N
$B<0(B(Formula)
$B%9%F!<%H%a%s%H(B(statements) $B$N(B($B=g=x$N$J$$(B)$B%;%C%H!#(B N3$B$G$O!"Cf$+$C$3(B({})$B$r;HMQ$7$F=q$/$3$H$,$G$-$k!#(B
$B%3%s%F%-%9%H(B(context)
$B<0$H!"$=$l$K4^$^$l$k%9%F!<%H%a%s%H$H$N4X78!#(B
cwm
(valley$B%^%7%s$K8BDj$5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universal Resource Identifier("#"$B$J$7(B)$B$K$h$C$F<1JL$5$l$k!#(B "http:"$B$G;O$^$k(BURI$B$N>l9g$K$O!"%j%=!<%9$O!"(B $B0lHL%I%-%e%a%s%H$G$"$k!#(B
$B%9%F!<%H%a%s%H(B(Statement)
$B;HMQ$5$l$F$$$kFCDj$N=R8l$K$h$C$FDj5A$5$l$?0UL#$r
$B
$B%9%F!<%H%a%s%H$N(B3$B$D$NMWAG$K$*$$$F!"(B $B]$r<($7!"Nc$($P!"(B $B$=$N?'$dD9$5$J$I$N@bL@BP>]$G$"$k!VH$N$3$H!#(B
$B$b$N(B(Thing)
DAML$B$G$O!"Cj>]!"@8J*!"Hs@8J*!"$=$NB>$N(B $BA4$F$b$N$N0lHLE*$JL>A0!#(B $BA4$F$N$b$N$,4^$^$l$k%/%i%9!#(B (RDF$B$G$O(B"rdf:Resource"$B$G$"$k$?$a!":.Mp$7$d$9$$!#(B) "#"$B$r4^$`$b$7$/$O4^$^$J$$(BURI$B$G<1JL$5$l$k!#(B
$B??(B(Truth)
$BL>A06u4V(B"log:"$B$K$*$1$k(B $B>o$K??$H$J$k<0$N%/%i%9!#(B
$B%?%$%W(B(type)
$B$b$N$,$"$kFCDj$N%/%i%9$KB0$7$F$$$k$3$H$r0UL#$9$k!"FCJL$N%W%m%Q%F%#!#(B $B$b$N$H!"$=$l$,B0$9$k%/%i%9$H$N4X78!#(B
URI
Universal Resource Identifier$B!#(B $B$b$N(B($B%/%i%9!"%W%m%Q%F%#!"$"$i$f$kl9g$K!"(B $B$=$N%W%m%Q%F%#$r;H$&$3$H$b$G$-$k$,!"(B URI$B$r;H$&$3$H$K$h$C$F!"B>$N%I%-%e%a%s%H$d%7%9%F%`$O!"(B $B$"$J$?$N>pJs$r!"MF0W$K:FMxMQ$G$-$k$h$&$K$J$k!#(B
Tim BL, with his director hat off
$Id: Primer.ja.html,v 1.11 2005/11/18 09:20:11 chibao Exp $