/[suikacvs]/messaging/manakai/lib/Message/Util/DIS.dis
Suika

Contents of /messaging/manakai/lib/Message/Util/DIS.dis

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.7 - (hide annotations) (download)
Wed Mar 2 07:46:31 2005 UTC (20 years, 4 months ago) by wakaba
Branch: MAIN
Changes since 1.6: +428 -83 lines
ManakaiDISDatabase->loadResource implemented

1 wakaba 1.1 Module:
2     @QName:
3     Util:DIS
4     @FullName:
5     @@lang: en
6     @@@:
7     <QUOTE::DIS> Object Model
8     @Namespace:
9     http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/DIS#
10    
11     @Description:
12     @@lang:en
13     @@@:
14     This module provides an object model for <QUITE::dis> document format.
15    
16     @Author:
17     @@FullName: Wakaba
18     @@Mail: w@suika.fam.cx
19     @License:
20     @@@:
21     license:Perl+MPL
22     @@Original:
23     @@@FullName:
24     manakai <CODE::lib/manakai/dis.pl>
25     @@@Year:2004
26     @@@Author:
27     @@@@FullName:Wakaba
28     @@@@Mail:w@suika.fam.cx
29     @Date:
30     @@@:
31 wakaba 1.7 $Date: 2005/02/28 04:32:40 $
32 wakaba 1.1 @@ContentType:
33     dis:Date.RCS
34    
35     @Require:
36     @@Module:
37     @@@Name: SuikaWikiConfig21
38 wakaba 1.5 @@@QName:
39     Markup:SuikaWikiConfig21
40 wakaba 1.1 @@@WithFor:
41 wakaba 1.3 swcfg21:ForLatest
42     @@Module:
43     @@@Name: DIS
44     @@@WithFor:
45     DIS:ForLatest
46    
47     @DefaultFor:
48     DIS:ForLatest
49 wakaba 1.1
50     Namespace:
51     @DIS:
52     http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/DIS#
53     @dis:
54     http://suika.fam.cx/~wakaba/archive/2004/8/18/lang#dis--
55     @dis2pm:
56     http://suika.fam.cx/~wakaba/archive/2004/11/8/dis2pm#
57 wakaba 1.5 @DISlib:
58     http://suika.fam.cx/~wakaba/archive/2004/dis/
59 wakaba 1.3 @DOMCore:
60     http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#
61     @DOMLS:
62     http://suika.fam.cx/~wakaba/archive/2004/dom/ls#
63     @DOMMain:
64     http://suika.fam.cx/~wakaba/archive/2004/dom/main#
65     @infoset:
66     http://www.w3.org/2001/04/infoset#
67 wakaba 1.1 @lang:
68     http://suika.fam.cx/~wakaba/archive/2004/8/18/lang#
69     @license:
70     http://suika.fam.cx/~wakaba/archive/2004/8/18/license#
71     @ManakaiDOM:
72     http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom#
73 wakaba 1.5 @Markup:
74     http://suika.fam.cx/~wakaba/archive/2005/manakai/Markup#
75 wakaba 1.3 @MDOMX:
76     http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#
77 wakaba 1.1 @owl:
78     http://www.w3.org/2002/07/owl#
79     @Perl:
80     http://suika.fam.cx/~wakaba/archive/2004/8/18/lang#Perl--
81     @rdf:
82     http://www.w3.org/1999/02/22-rdf-syntax-ns#
83     @rdfs:
84     http://www.w3.org/2000/01/rdf-schema#
85 wakaba 1.3 @swcfg21:
86     http://suika.fam.cx/~wakaba/archive/2005/swcfg21#
87 wakaba 1.1 @TreeCore:\
88     @Util:
89     http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/
90    
91     ## -- "For" definitions
92    
93     ForDef:
94     @QName:
95     DIS:ForLatest
96     @Description:
97     @@lang:en
98     @@@:
99     For latest version of the <Module::Util:DIS> module implementation
100     @ISA:
101     ManakaiDOM:Perl
102    
103     ## -- Features
104    
105     ElementTypeBinding:
106     @Name: FeatureDef
107     @ElementType:
108     dis:ResourceDef
109     @ShadowContent:
110     @@rdf:type:
111     DOMMain:DOMFeature
112     @@AliasFor:
113     @@@@:
114     ::ManakaiDOM:all
115     @@@For:
116     !=ManakaiDOM:all
117    
118     ElementTypeBinding:
119     @Name: FeatureVerDef
120     @ElementType:
121     dis:ResourceDef
122     @ShadowContent:
123     @@rdf:type:
124     DOMMain:DOMFeature
125    
126     ElementTypeBinding:
127     @Name: featureQName
128     @ElementType:
129     dis:AppName
130     @ShadowContent:
131     @@ContentType:
132     dis:TypeQName
133    
134     FeatureDef:
135     @QName: Core
136     @FeatureVerDef:
137     @@QName: CoreFeature10
138     @@Version: 1.0
139     @@ISA: Core
140     @@FullName:
141     @@@lang:en
142     @@@@:
143     The <QUOTE::dis> object model, version 1.0
144     @@Description:
145     @@@lang:en
146     @@@@:
147     The <QUOTE::dis> object model, version 1.0.
148     @@DOMMain:requireFeature:
149     swcfg21:CoreFeature21
150    
151     ## -- SuikaWikiConfig/2.1 extended classes
152    
153     ClsDef:
154     @ClsQName: ManakaiDISImplementation
155     @ClsISA:
156 wakaba 1.3 swcfg21:ManakaiSWCFGImplementation::swcfg21:ForLatest
157 wakaba 1.1 @Description:
158     @@lang:en
159     @@@:
160     A <QUOTE::dis> implementation object.
161    
162     @Method:
163     @@Name: createDISDocument
164     @@Description:
165     @@@lang:en
166     @@@@:
167     Creates an empty <Class::ManakaiDISDocument> object.
168     @@Return:
169     @@@Type:ManakaiDISDocument
170     @@@Description:
171     @@@@lang:en
172     @@@@@:
173     The newly created <QUOTE::dis> document object.
174     @@@PerlDef:
175 wakaba 1.3 $r = $self-><M::swcfg21:SWCFGImplementation::swcfg21:ForLatest
176     .createSWCFGDocument>;
177     $r-><AS::swcfg21:SWCFGDocument::swcfg21:ForLatest
178     .defaultElementTypeNamespaceURI>
179 wakaba 1.1 (<Q::dis:>);
180    
181     @Method:
182 wakaba 1.2 @@Name: createDISParser
183     @@Description:
184     @@@lang:en
185     @@@@:
186 wakaba 1.1 Creates a <Class::ManakaiDISParser> object.
187 wakaba 1.2 @@Return:
188     @@@Type: ManakaiDISParser
189     @@@Description:
190     @@@@lang:en
191     @@@@@:
192 wakaba 1.1 A newly created <QUOTE::dis> parser.
193 wakaba 1.2 @@@PerlDef:
194 wakaba 1.3 $r = bless $self-><M::swcfg21:SWCFGImplementation::swcfg21:ForLatest
195     .createSWCFGParser>,
196 wakaba 1.1 <ClassName::ManakaiDISParser>;
197    
198     @Method:
199 wakaba 1.2 @@Name: createDISDatabase
200 wakaba 1.1 @@Description:
201     @@@lang:en
202     @@@@:
203 wakaba 1.2 Creates a new <QUOTE::dis> database.
204 wakaba 1.1 @@Return:
205 wakaba 1.2 @@@Type:ManakaiDISDatabase
206 wakaba 1.4 @@@Description:
207     @@@@lang:en
208     @@@@@:
209 wakaba 1.2 A newly created <QUOTE::dis> parser.
210 wakaba 1.4 @@@PerlDef:
211 wakaba 1.2 $r = bless {
212     forDef => {
213 wakaba 1.5 <Q::ManakaiDOM:all> => bless ({
214 wakaba 1.2 uri => <Q::ManakaiDOM:all>,
215     isa => {<Q::ManakaiDOM:all> => 1},
216     revISA => {},
217 wakaba 1.5 }, <ClassName::ManakaiDISForDefinition>),
218 wakaba 1.2 },
219     resDef => {},
220 wakaba 1.3 }, <ClassName::ManakaiDISDatabase>;
221    
222     @Method:
223     @@Name: tfurisToURI
224     @@Description:
225     @@@lang:en
226     @@@@:
227     Converts a pair of name URI reference and <QUOTE::for> URI reference
228     into a <TYPE::dis:TFQNames>-expanded URI reference.
229     @@Param:
230     @@@Name: typeURI
231     @@@Type: NameURI
232     @@@Description:
233     @@@@lang:en
234     @@@@@:
235     A URI reference to identify a resource.
236     @@@InCase:
237     @@@@Value:
238     @@@@@is-null:1
239     @@@@Description:
240     @@@@@lang:en
241     @@@@@@:
242     Equivalent to <Q::DOMMain:any> (for historical reason).
243     @@Param:
244     @@@Name: forURI
245     @@@Type: ForURI
246     @@@Description:
247     @@@@lang:en
248     @@@@@:
249     A <QUOTE::for> URI reference.
250     @@@InCase:
251     @@@@Value:
252     @@@@@is-null:1
253     @@@@Description:
254     @@@@@lang:en
255     @@@@@@:
256     Equivalent to <QUOTE::for all>, i.e. <Q::ManakaiDOM:all>.
257     @@Return:
258     @@@Type:
259     DISCore:TFURI::ManakaiDOM:all
260     @@@Description:
261     @@@@lang:en
262     @@@@@:
263     The <TYPE::dis:TFQNames>-expanded URI references.
264     @@@PerlDef:
265     $typeURI = <Q::DOMMain:any> unless defined $typeURI;
266     $forURI = <Q::ManakaiDOM:all> unless defined $forURI;
267 wakaba 1.4 __CODE{tfurisToURI:: $turi => $typeURI, $furi => $forURI, $uri => $r}__;
268    
269     @ResourceDef:
270     @@QName: tfurisToURI
271     @@rdf:type:
272     dis2pm:BlockCode
273     @@enDesc:
274     Converts a pair of name URI reference and <QUOTE::for> URI reference
275     into a <TYPE::dis:TFQNames>-expanded URI reference.
276     @@PerlDef:
277     if ($furi eq <Q::ManakaiDOM:all>) {
278     $uri = $turi;
279 wakaba 1.3 } else {
280     ## NOTE: [RFC 3986]
281     ## fragment := *(pchar / "/" / "?")
282     ## pchar := unreserved / pct-encoded / sub-delims / [:@]
283     ## unreserved := ALPHA / DIGIT / [._~-]
284     ## sub-delims := [!$&'()*+,;=]
285     ## NOTE: [XPointer Framework]
286     ## SchemeData := *EscapedData
287     ## EscapedData := NormalChar / "^(" / "^)" / "^^"
288     ## / "(" SchemeData ")"
289     ## NormalChar := UnicodeChar - [()^]
290 wakaba 1.5 my $__turi = $turi;
291     my $__furi = $furi;
292     for my $__uri ($__turi, $__furi) {
293 wakaba 1.4 $__uri =~ s{([^0-9A-Za-z:;?=_./-])}{sprintf '%%%02X', ord $1}ge;
294 wakaba 1.3 }
295 wakaba 1.4 $uri = qq<data:,200411tf#xmlns(t=data:,200411tf%23)>.
296 wakaba 1.5 qq<t:tf($__turi,$__furi)>;
297 wakaba 1.3 }
298 wakaba 1.2
299 wakaba 1.5 @ResourceDef:
300 wakaba 1.6 @@QName: tfpurisToURI
301     @@rdf:type:
302     dis2pm:BlockCode
303     @@enDesc:
304     Converts a set of name URI reference and <QUOTE::for> URI reference
305     and <QUOTE::for+> URI references into a URi reference.
306     @@PerlDef:
307     if ($furi eq <Q::ManakaiDOM:all> and @{$forp} == 0) {
308     $uri = $turi;
309     } elsif (@{$forp}) {
310     my $__turi = $turi;
311     my $__furi = $furi;
312     for my $__uri ($__turi, $__furi) {
313     $__uri =~ s{([^0-9A-Za-z:;?=_./~!&+-])}{sprintf '%%%02X', ord $1}ge;
314     }
315     my @__fp;
316     for my $__uri (@{$forp}) {
317     my $__fpuri = $__uri;
318     $__fpuri =~ s{([^0-9A-Za-z:;?=_./~!&+-])}
319     {sprintf '%%%02X', ord $1}ge;
320     push @__fp, $__fpuri;
321     }
322     $uri = qq<data:,200411tf#xmlns(t=data:,200411tf%23)>.
323     qq<t:tfp($__turi,$__furi,>.join (',', @__fp).q<)>;
324     } else {
325     my $__turi = $turi;
326     my $__furi = $furi;
327     for my $__uri ($__turi, $__furi) {
328     $__uri =~ s{([^0-9A-Za-z:;?=_./-])}{sprintf '%%%02X', ord $1}ge;
329     }
330     $uri = qq<data:,200411tf#xmlns(t=data:,200411tf%23)>.
331     qq<t:tf($__turi,$__furi)>;
332     }
333    
334     @ResourceDef:
335 wakaba 1.5 @@QName: getChildResourceURI
336     @@rdf:type:
337     dis2pm:BlockCode
338     @@enDesc:
339     Gets an anonymous URI reference of a child resource of another
340     resource.
341     @@PerlDef:
342     my $__parent = $parentURI;
343     my $__ln = $localName;
344     for my $__uri ($__parent, $__ln) {
345 wakaba 1.6 $__uri =~ s{([^0-9A-Za-z:;?=_./~!&+-])}{sprintf '%%%02X', ord $1}ge;
346 wakaba 1.5 }
347     $result = q<data:,200411tf#xmlns(t=data:,200411tf%23)>.
348     qq<t:child($__parent,$__ln)>;
349    
350 wakaba 1.1 ##DISImplementation
351    
352     ClsDef:
353     @ClsQName: ManakaiDISParser
354     @ClsISA:
355 wakaba 1.3 swcfg21:ManakaiSWCFGParser::swcfg21:ForLatest
356 wakaba 1.1 @Description:
357     @@lang:en
358     @@@:
359     A SuikaWikiConfig/2.1 parser that returns <QUOTE::dis> object.
360     @Method:
361 wakaba 1.3 @@Name: parse
362     @@Description:
363     @@@lang:en
364     @@@@:
365 wakaba 1.1 Parses a <QUOTE::dis> document and returns it as an object tree.
366 wakaba 1.3 @@Param:
367     @@@Name: input
368     @@@Type:
369     DOMLS:LSInput::ManakaiDOM:ManakaiDOM3
370     @@@Description:
371     @@@@lang:en
372     @@@@@:
373 wakaba 1.1 The input source.
374 wakaba 1.3 @@Return:
375     @@@Type: ManakaiDISDocument
376     @@@Description:
377     @@@@lang:en
378     @@@@@:
379 wakaba 1.1 The <QUOTE::dis> document object created from the <P::input>.
380     @@@RaiseException:
381     @@@@@:
382     swcfg21:SWCFG_PARSE_ERR
383     @@@@Description:
384     @@@@@lang:en
385     @@@@@@:
386     The <IF::swcfg21:SWCFGParser> was unable to load the SuikaWikiConfig
387     document.
388     @@@PerlDef:
389     __DEEP{
390 wakaba 1.3 $r = $self-><M::swcfg21:ManakaiSWCFGParser
391     ::swcfg21:ForLatest.parse> ($input);
392 wakaba 1.1 }__;
393     if (defined $r) {
394     $r = bless $r, <ClassName::ManakaiDISDocument>;
395 wakaba 1.4 $r-><AS::swcfg21:SWCFGDocument::swcfg21:ForLatest
396     .defaultElementTypeNamespaceURI>
397     (<Q::dis:>);
398 wakaba 1.1 }
399     ##DISParser
400    
401     ClsDef:
402     @ClsQName: ManakaiDISNode
403     @Description:
404     @@lang:en
405     @@@:
406     <QUOTE::dis> node objects.
407 wakaba 1.7 @ImplNote:
408     @@lang:en
409     @@@:
410     This class does not inherit
411     <Class::swcfg21:ManakaiSWCFGNode::swcfg21:ForLatest>, since
412     inheriting classes such as <Class::ManakaiDISElement> indirectly
413     inherit it.
414 wakaba 1.1
415     @MethodRedef:
416     @@Name:lookupNamespacePrefix
417     @@Description:
418     @@@lang:en
419     @@@@:
420     Looks up the namespace prefix associated to the given
421     namespace URI. The default namespaces are ignored.
422     @@Param:
423     @@@Name:namespaceURI
424 wakaba 1.3 @@@Type: AnyURI
425 wakaba 1.1 @@@Description:
426     @@@@lang:en
427     @@@@@:
428     The namespace URI to look for.
429     @@@InCase:
430     @@@@Value:
431     @@@@@is-null:1
432     @@@@Description:
433     @@@@@lang:en
434     @@@@@@:
435     The <DOM::null> namespace.
436     @@NamedParam:
437     @@@Name: makeNewBinding
438     @@@Type:
439     DOMMain:boolean
440     @@@Description:
441     @@@@lang:en
442     @@@@@:
443     Whether a new namespace prefix should be bound when
444     no namespace URI has been associated yet.
445     @@@InCase:
446     @@@@Value:true
447     @@@@Description:
448     @@@@@lang:en
449     @@@@@@:
450     New binding is made if no prefix associated.
451     @@@InCase:
452     @@@@Value:false
453     @@@@Description:
454     @@@@@lang:en
455     @@@@@@:
456     Simply returns the <DOM::null> if no prefix associated.
457     @@Return:
458     @@@Type:
459 wakaba 1.3 DISCore:NamespacePrefix::ManakaiDOM:all
460 wakaba 1.1 @@@Description:
461     @@@@lang:en
462     @@@@@:
463     An associated namespace prefix. If more than one prefix
464     are associated to the namespace URI, the returned prefix
465     is implementation dependent.
466     @@@InCase:
467     @@@@Value:
468     @@@@@is-null:1
469     @@@@Description:
470     @@@@@lang:en
471     @@@@@@:
472     No associated namespace prefix found.
473     @@@PerlDef:
474     $r = null;
475 wakaba 1.3 my $od = $self-><AG::swcfg21:SWCFGNode::swcfg21:ForLatest
476     .ownerDocument> || $self;
477 wakaba 1.7 my $binds = $od->{<Q::TreeCore:node>}->{<Q::swcfg21:nsBinding>};
478 wakaba 1.1 if (defined $namespaceURI) {
479     FIND: {
480     for my $prefix (keys %$binds) {
481     if (defined $binds->{$prefix} and
482     $binds->{$prefix} eq $namespaceURI) {
483     $r = $prefix;
484     last FIND;
485     }
486     }
487 wakaba 1.7
488     ## From module list
489     try {
490     my $db = $self-><AG::ManakaiDISNode.ownerDISDocument>
491     -><AG::ManakaiDISDocument.disDatabase>;
492     for my $mod_uri (keys %{$db->{modDef}}) {
493     my $mod = $db-><M::ManakaiDISDatabase.getModule> ($mod_uri);
494     my $mod_ln = $mod-><AG::ManakaiDISModuleDefinition.localName>;
495     next if exists $binds->{$mod_ln};
496     my $ns_uri = $mod-><M::ManakaiDISPropertyAccessor
497     .getPropertyText>
498     (<Q::dis:Namespace>, '');
499     if ($ns_uri eq $namespaceURI) {
500     $r = $mod_ln;
501     last FIND;
502     }
503     }
504     } catch <Class::ManakaiDISException> with {
505     my $err = shift;
506     $err->throw
507     unless $err->{<Q::MDOMX:subtype>} eq <Q::NO_DB_ASSOCIATED_ERR>;
508     };
509    
510 wakaba 1.1 last FIND unless $makeNewBinding;
511     ## Not found
512     if ($namespaceURI =~ /(\w+)$/) {
513     my $prefix = $1;
514     unless (exists $binds->{$prefix}) {
515     $binds->{$prefix} = $namespaceURI;
516     $r = $prefix;
517     last FIND;
518     }
519     }
520     my $i = 1;
521     {
522     unless (exists $binds->{'ns'.$i}) {
523     $binds->{$r = 'ns'.$i} = $namespaceURI;
524     last FIND;
525     }
526     $i++;
527     redo;
528     }
529     } # FIND
530     } else { ## Null namespace
531     FIND: {
532     if (exists $binds->{'nu'.'ll'} and not defined $binds->{'nu'.'ll'}) {
533     $r = 'nu'.'ll';
534     last FIND;
535     }
536     for my $prefix (keys %$binds) {
537     if (not defined $prefix) {
538     $r = $prefix;
539     last FIND;
540     }
541     }
542     last FIND unless $makeNewBinding;
543     ## Not found
544     my $i = '';
545     {
546     unless (exists $binds->{'nu'.'ll'.$i}) {
547     $binds->{$r = 'nu'.'ll'.$i} = null;
548     last FIND;
549     }
550     $i++;
551     redo;
552     }
553     }
554     }
555    
556     @MethodRedef:
557     @@Name:lookupNamespaceURI
558     @@Description:
559     @@@lang:en
560     @@@@:
561     Looks up the namespace URI associated to the given prefix.
562     @@Param:
563     @@@Name:prefix
564     @@@Type:
565 wakaba 1.3 DISCore:NamespacePrefix::ManakaiDOM:all
566 wakaba 1.1 @@@Description:
567     @@@@lang:en
568     @@@@@:
569     The namespace URI to look for.
570     @@NamedParam:
571     @@@Name: makeNewBinding
572     @@@Type:
573     DOMMain:boolean
574     @@@Description:
575     @@@@lang:en
576     @@@@@:
577     Whether a new binding should be created if no namespace URI
578     is associated with the <P::prefix> or not.
579     @@@InCase:
580     @@@@Value:true
581     @@@@Description:
582     @@@@@lang:en
583     @@@@@@:
584     A new binding to the temporary namespace URI
585     exactly same as <P::prefix> is created
586     if no binding found.
587     @@@InCase:
588     @@@@Value:false
589     @@@@Description:
590     @@@@@lang:en
591     @@@@@@:
592     No new binding is created if no binding found. Note that
593     even if no association newly created, this method
594     returns the <DOM::null> value.
595     @@Return:
596 wakaba 1.3 @@@Type: AnyURI
597 wakaba 1.1 @@@Description:
598     @@@@lang:en
599     @@@@@:The associated namespace URI.
600     @@@InCase:
601     @@@@Value:
602     @@@@@is-null:1
603     @@@@Description:
604     @@@@@lang:en
605     @@@@@@:
606 wakaba 1.3 No namespace URI is associated to the prefix or
607 wakaba 1.1 the <DOM::null> namespace is associated.
608     @@@PerlDef:
609 wakaba 1.3 my $od = $self-><AG::swcfg21:SWCFGNode::swcfg21:ForLatest
610     .ownerDocument> || $self;
611 wakaba 1.7 my $binds = $od->{<Q::TreeCore:node>}->{<Q::swcfg21:nsBinding>};
612 wakaba 1.1 if (exists $binds->{$prefix}) {
613     $r = $binds->{$prefix};
614     } else {
615 wakaba 1.7 ## From module list
616     FIND: {
617     try {
618     my $db = $self-><AG::ManakaiDISNode.ownerDISDocument>
619     -><AG::ManakaiDISDocument.disDatabase>;
620     for my $mod_uri (keys %{$db->{modDef}}) {
621     my $mod = $db-><M::ManakaiDISDatabase.getModule> ($mod_uri);
622     if ($mod-><AG::ManakaiDISModuleDefinition.localName>
623     eq $prefix) {
624     $r = $mod-><M::ManakaiDISPropertyAccessor
625     .getPropertyText>
626     (<Q::dis:Namespace>, null);
627     last FIND;
628     }
629     }
630     } catch <Class::ManakaiDISException> with {
631     my $err = shift;
632     $err->throw
633     unless $err->{<Q::MDOMX:subtype>} eq <Q::NO_DB_ASSOCIATED_ERR>;
634     };
635     if ($makeNewBinding) {
636     $r = $binds->{$prefix} = $prefix;
637     } else {
638     $r = null;
639     }
640     } # FIND
641 wakaba 1.1 }
642    
643     @IntMethod:
644     @@Name:getNodeReference
645     @@Description:
646     @@@lang:en
647     @@@@:
648     Returns a new reference to the node object.
649     @@ManakaiDOM:isStatic:1
650     @@Param:
651     @@@Name:object
652     @@@Type:
653     ManakaiDOM:ManakaiDOMNodeObject::ManakaiDOM:Perl
654     @@@Description:
655     @@@@lang:en
656     @@@@@:
657     The node object to be referred.
658     @@Return:
659     @@@Type: ManakaiDISNode
660     @@@Description:
661     @@@@lang:en
662     @@@@@:
663     A newly created reference.
664     @@@PerlDef:
665     my $class;
666 wakaba 1.5 if ($object->{<Q::swcfg21:nodeType>} eq '#element') {
667 wakaba 1.1 $class = <ClassName::ManakaiDISElement>;
668 wakaba 1.5 } elsif ($object->{<Q::swcfg21:nodeType>} eq '#comment') {
669 wakaba 1.1 $class = <ClassName::ManakaiDISComment>;
670 wakaba 1.5 } elsif ($object->{<Q::swcfg21:nodeType>} eq '#document') {
671 wakaba 1.1 $class = <ClassName::ManakaiDISDocument>;
672 wakaba 1.5 } elsif ($object->{<Q::swcfg21:nodeType>} eq '#fragment') {
673 wakaba 1.1 $class = <ClassName::ManakaiDISDocumentFragment>;
674     } else {
675     __ASSERT{DISPerl:invariant::
676 wakaba 1.5 msg => {qq[Node type: "$object->{<Q::swcfg21:nodeType>}" ].
677 wakaba 1.1 qq[(ref: "@{[ref $object]}")]},
678     }__;
679     }
680     $r = $object-><M::ManakaiDOM:ManakaiDOMNodeObject::ManakaiDOM:Perl
681     .newReference> ($class);
682    
683 wakaba 1.2 @Attr:
684     @@Name:ownerDISDocument
685     @@Description:
686     @@@lang:en
687     @@@@:
688     The <QUOTE::dis> document object associated with this node.
689     @@Get:
690 wakaba 1.3 @@@Type:ManakaiDISDocument
691 wakaba 1.2 @@@Description:
692     @@@@lang:en
693     @@@@@:
694     The document object associated with this node.
695     @@@InCase:
696     @@@@Value:
697     @@@@@is-null:1
698     @@@@Description:
699     @@@@@lang:en
700     @@@@@@:
701     This node is a document node.
702     @@@PerlDef:
703     $r = <ClassM::ManakaiDISNode.getNodeReference>
704     ($self->{<Q::TreeCore:node>}->{<Q::DOMCore:ownerDocument>})
705     if $self->{<Q::TreeCore:node>}->{<Q::DOMCore:ownerDocument>};
706 wakaba 1.1 ##DISNode
707    
708     ClsDef:
709     @ClsQName: ManakaiDISElement
710 wakaba 1.7 @ClsISA: ManakaiDISNode
711 wakaba 1.1 @ClsISA:
712 wakaba 1.3 swcfg21:ManakaiSWCFGElement::swcfg21:ForLatest
713 wakaba 1.1 @Description:
714     @@lang:en
715     @@@:
716     <QUOTE::dis> element node objects.
717    
718     @Method:
719     @@Name: forMatch
720     @@Description:
721     @@@lang:en
722     @@@@:
723     Tests whether this element is for a <QUOTE::for> or not.
724     @@Param:
725     @@@Name: forArg
726     @@@Type: ForURI
727     @@@Description:
728     @@@@lang:en
729     @@@@@:
730     The <QUOTE::For> URI reference to test against.
731     @@Param:
732     @@@Name: forpArg
733     @@@Type: ForURIList
734     @@@Description:
735     @@@@lang:en
736     @@@@@:
737     The <QUOTE::For+> URI references to test against.
738     @@@InCase:
739     @@@@Value:
740     @@@@@is-null:1
741     @@@@Description:
742     @@@@@lang:en
743     @@@@@@:
744     No additional <QUOTE::For> URI reference.
745 wakaba 1.3 Equivalent to an empty array reference.
746 wakaba 1.1 @@Return:
747     @@@Type:
748     DOMMain:boolean
749     @@@Description:
750     @@@@lang:en
751     @@@@@:
752     Whether this element is for <P::forArg> and <P::forpArg> or not.
753 wakaba 1.2 @@@UndeclaredPrefixException:
754     @@@NoDBException:
755     @@@PerlDef:
756 wakaba 1.3 $forArg = <Q::ManakaiDOM:all> unless defined $forArg;
757     $forpArg ||= [];
758 wakaba 1.2
759     FORMATCH: {
760     __DEEP{
761 wakaba 1.4 my @ce = @{$self-><M::ManakaiDISElement.disChildElements>};
762 wakaba 1.2 for my $ce (@ce) {
763 wakaba 1.3 my $et = $ce-><AG::swcfg21:SWCFGElement::swcfg21:ForLatest
764     .expandedURI>;
765 wakaba 1.2 if ($et eq <Q::dis:ForCheck>) {
766 wakaba 1.3 my $for = [split /\s+/, $ce-><AG::swcfg21:SWCFGNode
767     ::swcfg21:ForLatest.value>];
768 wakaba 1.2 FCs: for my $f (@$for) {
769     if ($f =~ /^!=(.+)$/) { ## -- NOT EQUAL TO
770     my $uri = $self-><AG::ManakaiDISElement.qnameToURI> ($1);
771     my $f = $self-><AG::ManakaiDISNode.ownerDISDocument>
772     -><AG::ManakaiDISDocument.disDatabase>
773     -><M::ManakaiDISDatabase.getFor> ($uri);
774     $f-><AG::ManakaiDISForDefinition.isReferred> ($ce);
775 wakaba 1.3 for my $arg_uri ($forArg, @{$forpArg}) {
776 wakaba 1.2 if ($uri eq $arg_uri) {
777     $r = false;
778     last FORMATCH;
779     }
780     }
781     } elsif ($f =~ /^!(.+)$/) { ## -- NOT ISA
782     my $uri = $self-><AG::ManakaiDISElement.qnameToURI> ($1);
783     my $f = $self-><AG::ManakaiDISNode.ownerDISDocument>
784     -><AG::ManakaiDISDocument.disDatabase>
785     -><M::ManakaiDISDatabase.getFor> ($uri);
786     $f-><AG::ManakaiDISForDefinition.isReferred> ($ce);
787 wakaba 1.3 for my $arg_uri ($forArg, @{$forpArg}) {
788 wakaba 1.2 if ($f-><M::ManakaiDISForDefinition.isaURI> ($arg_uri)) {
789     $r = false;
790     last FORMATCH;
791     }
792     }
793     } elsif ($f =~ /^=(.+)$/) { ## -- EQUAL TO
794     my $uri = $self-><AG::ManakaiDISElement.qnameToURI> ($1);
795     my $f = $self-><AG::ManakaiDISNode.ownerDISDocument>
796     -><AG::ManakaiDISDocument.disDatabase>
797     -><M::ManakaiDISDatabase.getFor> ($uri);
798     $f-><AG::ManakaiDISForDefinition.isReferred> ($ce);
799 wakaba 1.3 for my $arg_uri ($forArg, @{$forpArg}) {
800 wakaba 1.2 if ($arg_uri eq $uri) {
801     next FCs;
802     }
803     }
804     $r = false;
805     last FORMATCH;
806     } else { ## -- ISA
807     my $uri = $self-><AG::ManakaiDISElement.qnameToURI> ($1);
808     my $f = $self-><AG::ManakaiDISNode.ownerDISDocument>
809     -><AG::ManakaiDISDocument.disDatabase>
810     -><M::ManakaiDISDatabase.getFor> ($uri);
811     $f-><AG::ManakaiDISForDefinition.isReferred> ($ce);
812 wakaba 1.3 for my $arg_uri ($forArg, @{$forpArg}) {
813 wakaba 1.2 if ($f-><M::ManakaiDISForDefinition.isaURI> ($arg_uri)) {
814     next FCs;
815     }
816     }
817     $r = false;
818     last FORMATCH;
819     }
820     } # FCs
821     } # dis:ForCheck
822     } # children
823    
824     my $has_for = false;
825     for my $ce (@ce) {
826 wakaba 1.3 if ($self-><AG::swcfg21:SWCFGElement::swcfg21:ForLatest
827     .expandedURI> eq
828 wakaba 1.2 <Q::dis:For>) {
829 wakaba 1.3 my $for = [split /\s+/, $ce-><AG::swcfg21:SWCFGNode
830     ::swcfg21:ForLatest.value>];
831 wakaba 1.2 my $ok = true;
832     $has_for = true;
833     AFOR: for my $f (@$for) {
834     if ($f =~ /^!=(.+)$/) { ## -- NOT EQUAL TO
835     my $uri = $self-><AG::ManakaiDISElement.qnameToURI> ($1);
836     my $f = $self-><AG::ManakaiDISNode.ownerDISDocument>
837     -><AG::ManakaiDISDocument.disDatabase>
838     -><M::ManakaiDISDatabase.getFor> ($uri);
839     $f-><AG::ManakaiDISForDefinition.isReferred> ($ce);
840 wakaba 1.3 if ($uri eq $forArg) {
841 wakaba 1.2 $ok = false;
842     last AFOR;
843     }
844     } elsif ($f =~ /^!(.+)$/) { ## -- NOT ISA
845     my $uri = $self-><AG::ManakaiDISElement.qnameToURI> ($1);
846     my $f = $self-><AG::ManakaiDISNode.ownerDISDocument>
847     -><AG::ManakaiDISDocument.disDatabase>
848     -><M::ManakaiDISDatabase.getFor> ($uri);
849     $f-><AG::ManakaiDISForDefinition.isReferred> ($ce);
850 wakaba 1.3 if ($f-><M::ManakaiDISForDefinition.isaURI> ($forArg)) {
851 wakaba 1.2 $ok = false;
852     last AFOR;
853     }
854     } elsif ($f =~ /^=(.+)$/) { ## -- EQUAL TO
855     my $uri = $self-><AG::ManakaiDISElement.qnameToURI> ($1);
856     my $f = $self-><AG::ManakaiDISNode.ownerDISDocument>
857     -><AG::ManakaiDISDocument.disDatabase>
858     -><M::ManakaiDISDatabase.getFor> ($uri);
859     $f-><AG::ManakaiDISForDefinition.isReferred> ($ce);
860 wakaba 1.3 unless ($uri eq $forArg) {
861 wakaba 1.2 $ok = false;
862     last AFOR;
863     }
864     } else { ## -- ISA
865     my $uri = $self-><AG::ManakaiDISElement.qnameToURI> ($1);
866     my $f = $self-><AG::ManakaiDISNode.ownerDISDocument>
867     -><AG::ManakaiDISDocument.disDatabase>
868     -><M::ManakaiDISDatabase.getFor> ($uri);
869     $f-><AG::ManakaiDISForDefinition.isReferred> ($ce);
870 wakaba 1.3 unless ($f-><M::ManakaiDISForDefinition.isaURI> ($forArg)) {
871 wakaba 1.2 $ok = false;
872     last AFOR;
873     }
874     }
875     } # AFOR
876 wakaba 1.3 if ($ok) {
877     $r = true;
878     last FORMATCH;
879     }
880 wakaba 1.2 } # dis:For
881     } # $ce
882     $r = $has_for ? false : true;
883     }__;
884     } # FORMATCH
885 wakaba 1.1
886     @Method:
887     @@Name: mediaTypeMatch
888     @@Description:
889     @@@lang:en
890     @@@@:
891     Tests whether the content media type of this element matches to
892     a type or not.
893     @@Param:
894     @@@Name: mediaType
895     @@@Type: MediaTypeURI
896     @@@Description:
897     @@@@lang:en
898     @@@@@:
899     A media type URI reference to test against.
900     @@Param:
901 wakaba 1.3 @@@Name: defaultMediaType
902 wakaba 1.1 @@@Type: MediaTypeURI
903     @@@Description:
904     @@@@lang:en
905     @@@@@:
906     The default media type for this element.
907     @@@InCase:
908     @@@@Value:
909     @@@@@is-null:1
910     @@@@Description:
911     @@@@@lang:en
912     @@@@@@:
913     No default type provided. All <P::mediaType> will match.
914     @@Return:
915     @@@Type:
916     DOMMain:boolean
917     @@@Description:
918     @@@@lang:en
919     @@@@@:
920     Whether this element is of <P::mediaType> or not.
921 wakaba 1.2 @@@PerlDef:
922     if (defined $mediaType) {
923     __DEEP{
924     my $ctn = $self-><M::ManakaiDISElement.disGetAttribute>
925     (<Q::dis:ContentType>);
926     my $ct;
927     $ct = $ctn-><AG::ManakaiDISElement.qnameValueURI> if $ctn;
928     $ct = $defaultMediaType unless defined $ct;
929     my $res = $self-><AG::ManakaiDISNode.ownerDISDocument>
930     -><AG::ManakaiDISDocument.disDatabase>
931     -><M::ManakaiDISDatabase.getResource> ($ct);
932     $res-><AS::ManakaiDISResourceDefinition.isReferred> ($ctn or $self);
933 wakaba 1.7 unless ($res-><M::ManakaiDISResourceDefinition
934     .isSubsetOfURI> ($ct)) {
935 wakaba 1.2 $r = false;
936     } else {
937     $r = true;
938     }
939     }__;
940     } else {
941     $r = true;
942     }
943 wakaba 1.1
944     @Method:
945     @@Name: prefixToURI
946     @@Description:
947     @@@lang:en
948     @@@@:
949     Converts a namespace prefix into associated URI reference.
950     @@Param:
951     @@@Name: prefix
952     @@@Type:
953 wakaba 1.3 DISCore:NamespacePrefix::ManakaiDOM:all
954 wakaba 1.1 @@@Description:
955     @@@@lang:en
956     @@@@@:
957     A namespace prefix to look for.
958     @@@InCase:
959     @@@@Value:
960     @@@@@is-null:1
961     @@@@Description:
962     @@@@@lang:en
963     @@@@@@:
964     Returns the default namespace URI.
965     @@NodeParam:
966     @@Return:
967 wakaba 1.3 @@@Type: AnyURI
968 wakaba 1.1 @@@Description:
969     @@@@lang:en
970     @@@@@: The URI references associated.
971     @@@UndeclaredPrefixException:
972     @@@PerlDef:
973 wakaba 1.3 if (defined $prefix) {
974 wakaba 1.1 __DEEP{
975 wakaba 1.3 $r = $self-><M::swcfg21:SWCFGNode::swcfg21:ForLatest
976     .lookupNamespaceURI> ($prefix);
977 wakaba 1.1 }__;
978     unless (defined $r) {
979     __EXCEPTION{UNDECLARED_NS_PREFIX_ERR::
980     infoset:prefix => {$prefix},
981     MDOMX:param-name => 'prefix',
982     DIS:sourceNode => {$node},
983     }__;
984     }
985 wakaba 1.7 } else { ## Default namespace
986     __DEEP{
987     $r = ($self-><AG::ManakaiDISNode.ownerDISDocument> || $self)
988     -><AG::ManakaiDISDocument.moduleElement>
989     -><AG::ManakaiDISModuleElement.definingNamespaceURI>;
990     }__;
991 wakaba 1.1 }
992    
993     @Method:
994     @@QName: qnameToURI
995     @@Description:
996     @@@lang:en
997     @@@@:
998     Converts a qualified name (<TYPE::dis:TypeQName>) to
999     an expanded URI reference.
1000     @@Param:
1001     @@@Name: qname
1002     @@@Type:
1003     dis:TypeQName
1004     @@@Description:
1005     @@@@lang:en
1006     @@@@@:
1007     A qualified name.
1008     @@NodeParam:
1009     @@Return:
1010     @@@Type: AnyURI
1011     @@@Description:
1012     @@@@lang:en
1013     @@@@@:
1014     The expanded URI reference.
1015     @@@UndeclaredPrefixException:
1016     @@@PerlDef:
1017     $qname =~ s/^\s+//; $qname =~ s/\s+$//;
1018     my ($prefix, $lname) = split /:/, $qname;
1019     __DEEP{
1020     if (defined $lname) {
1021     $r = $self-><M::ManakaiDISElement.prefixToURI> ($prefix) . $lname;
1022     } else { ## In default namespace
1023     $r = $self-><M::ManakaiDISElement.prefixToURI> (null) . $prefix;
1024     }
1025 wakaba 1.4 }__;
1026 wakaba 1.1
1027     @Method:
1028     @@QName: qnameToPair
1029     @@Description:
1030     @@@lang:en
1031     @@@@:
1032     Converts a qualified name (<TYPE::dis:TypeQName>) to
1033     a pair of namespace URI and local name.
1034     @@Param:
1035     @@@Name: qname
1036     @@@Type:
1037     dis:TypeQName
1038     @@@Description:
1039     @@@@lang:en
1040     @@@@@:
1041     A qualified name.
1042     @@NodeParam:
1043     @@Return:
1044     @@@Type:
1045     Perl:ARRAY
1046     @@@Description:
1047     @@@@lang:en
1048     @@@@@:
1049     A list of namespace URI and local name.
1050     @@@UndeclaredPrefixException:
1051     @@@PerlDef:
1052     $qname =~ s/^\s+//; $qname =~ s/\s+$//;
1053     my ($prefix, $lname) = split /:/, $qname;
1054     __DEEP{
1055     if (defined $lname) {
1056     $r = [$self-><M::ManakaiDISElement.prefixToURI> ($prefix), $lname];
1057     } else { ## In default namespace
1058     $r = [$self-><M::ManakaiDISElement.prefixToURI> (null), $prefix];
1059     }
1060 wakaba 1.4 }__;
1061 wakaba 1.1
1062     @Method:
1063 wakaba 1.3 @@Name: tfqnamesToURI
1064 wakaba 1.1 @@Description:
1065     @@@lang:en
1066     @@@@:
1067 wakaba 1.3 Converts a <TYPE::dis:TFQNames>
1068 wakaba 1.1 into an expanded URI reference.
1069     @@Param:
1070     @@@Name: tfqnames
1071     @@@Type:
1072 wakaba 1.3 dis:TFQNames
1073 wakaba 1.1 @@@Description:
1074     @@@@lang:en
1075     @@@@@:
1076 wakaba 1.3 A <TYPE::dis:TFQNames> to identify a resource.
1077 wakaba 1.1 @@Param:
1078     @@@Name: defaultTypeURI
1079     @@@Type: NameURI
1080     @@@Description:
1081     @@@@lang:en
1082     @@@@@:
1083     A name URI reference used if it is missing from
1084     <P::tfqnames>.
1085     @@@InCase:
1086     @@@@Value:
1087     @@@@@is-null:1
1088     @@@@Description:
1089     @@@@@lang:en
1090     @@@@@@:
1091     Equivalent to <Q::DOMMain:any>.
1092     @@Param:
1093     @@@Name: defaultForURI
1094     @@@Type: ForURI
1095     @@@Description:
1096     @@@@lang:en
1097     @@@@@:
1098     A <QUOTE::for> URI reference used if it is missing from
1099     <P::tfqnames>.
1100     @@@InCase:
1101     @@@@Value:
1102     @@@@@is-null:1
1103     @@@@Description:
1104     @@@@@lang:en
1105     @@@@@@:
1106     Equivalent to <QUOTE::for all>, i.e. <Q::ManakaiDOM:all>.
1107     @@NodeParam:
1108     @@Return:
1109     @@@Type:
1110 wakaba 1.3 DISCore:TFURI::ManakaiDOM:all
1111 wakaba 1.1 @@@Description:
1112     @@@@lang:en
1113     @@@@@:
1114 wakaba 1.3 The <TYPE::dis:TFQNames>-expanded URI references.
1115 wakaba 1.1 @@@UndeclaredPrefixException:
1116     @@@PerlDef:
1117     my ($typeq, $forq) = split /\s*::\s*/, $tfqnames, 2;
1118     my ($typeURI, $forURI);
1119     if (defined $forq) {
1120     __DEEP{
1121     $typeURI = $typeq eq ''
1122     ? defined $defaultTypeURI ? $defaultTypeURI
1123     : <Q::DOMMain:any>
1124     : $self-><M::ManakaiDISElement.qnameToURI> ($typeq, %opt);
1125     }__;
1126     if (length $forq) {
1127     $forURI = $self-><M::ManakaiDISElement.qnameToURI> ($forq, %opt);
1128     } else {
1129     $forURI = <Q::ManakaiDOM:all>;
1130     }
1131     } else { ## "For" omitted
1132     __DEEP{
1133     $typeURI = $typeq eq ''
1134     ? defined $defaultTypeURI ? $defaultTypeURI
1135     : <Q::DOMMain:any>
1136     : $self-><M::ManakaiDISElement.qnameToURI> ($typeq, %opt);
1137     }__;
1138 wakaba 1.3 $forURI = defined $defaultForURI ? $defaultForURI
1139     : <Q::ManakaiDOM:all>;
1140 wakaba 1.1 }
1141 wakaba 1.4 __CODE{tfurisToURI:: $turi => $typeURI, $furi => $forURI, $uri => $r}__;
1142 wakaba 1.2
1143     @Method:
1144     @@Name: disGetAttribute
1145     @@enDesc:
1146     Gets an attribute node.
1147     @@Param:
1148     @@@Name: attrName
1149     @@@Type: AnyURI
1150     @@@enDesc:
1151     The name expanded URI of the node to retrieve.
1152     @@ForParam:
1153     @@ForpParam:
1154     @@MediaTypeParam:
1155     @@MediaTypeDefaultParam:
1156     @@Return:
1157     @@@Type: ManakaiDISElement
1158     @@@enDesc:
1159     The attribute (property) element node.
1160     @@@nullCase:
1161     @@@@enDesc:
1162     No attribute node found.
1163     @@@PerlDef:
1164 wakaba 1.5 for my $c (@{$self-><M::ManakaiDISElement.disChildElements>}) {
1165 wakaba 1.3 if ($c-><AG::swcfg21:SWCFGElement::swcfg21:ForLatest
1166     .expandedURI> eq $attrName and
1167 wakaba 1.2 $c-><AG::ManakaiDISElement.forMatch> ($forArg, $forpArg) and
1168     $c-><AG::ManakaiDISElement.mediaTypeMatch>
1169 wakaba 1.3 ($mediaType, $defaultMediaType)) {
1170 wakaba 1.2 $r = $c;
1171     last;
1172     }
1173     }
1174    
1175     @Method:
1176     @@Name: disGetAttributeList
1177     @@enDesc:
1178     Gets attribute nodes.
1179 wakaba 1.3 @@Param:
1180     @@@Name: attrName
1181     @@@Type: AnyURI
1182     @@@enDesc:
1183     The name expanded URI of the node to retrieve.
1184 wakaba 1.2 @@ForParam:
1185     @@ForpParam:
1186     @@MediaTypeParam:
1187     @@MediaTypeDefaultParam:
1188     @@Return:
1189     @@@Type: ManakaiDISElementList
1190     @@@enDesc:
1191     The attribute (property) element nodes.
1192     @@@PerlDef:
1193     $r = bless [], <ClassName::ManakaiDISElementList>;
1194 wakaba 1.5 for my $c (@{$self-><M::ManakaiDISElement.disChildElements>}) {
1195 wakaba 1.3 if ($c-><AG::swcfg21:SWCFGElement::swcfg21:ForLatest
1196     .expandedURI> eq $attrName and
1197 wakaba 1.2 $c-><AG::ManakaiDISElement.forMatch> ($forArg, $forpArg) and
1198     $c-><AG::ManakaiDISElement.mediaTypeMatch>
1199 wakaba 1.3 ($mediaType, $defaultMediaType)) {
1200 wakaba 1.2 push @$r, $c;
1201     }
1202     }
1203    
1204 wakaba 1.4 @Method:
1205 wakaba 1.2 @@Name: disChildElements
1206     @@enDesc:
1207     A list of child elements.
1208 wakaba 1.4 @@ForParam:
1209     @@ForpParam:
1210     @@Return:
1211     @@@Type: ManakaiDISElementList
1212 wakaba 1.2 @@@enDesc:
1213     The current snapshot of child nodes.
1214     @@@PerlDef:
1215 wakaba 1.4 $r = bless [], <ClassName::ManakaiDISElementList>;
1216     __DEEP{
1217     for my $cn (@{$self-><AG::swcfg21:SWCFGNode::swcfg21:ForLatest
1218     .childNodes>}) {
1219     ## $cn is an #element.
1220     my $dn = $cn->{<Q::TreeCore:node>}
1221     -><M::ManakaiDOM:ManakaiDOMNodeObject
1222     ::ManakaiDOM:Perl.newReference>
1223     (<ClassName::ManakaiDISElement>);
1224     next unless $dn-><M::ManakaiDISElement.forMatch> ($forArg, $forpArg);
1225     push @$r, $dn;
1226     }
1227     }__;
1228 wakaba 1.5
1229 wakaba 1.2 @Attr:
1230     @@Name: qnameValueURI
1231     @@enDesc:
1232     The element value (written as <TYPE::dis:TypeQName>), as URI reference.
1233     \
1234     {NOTE:: What should be if list value?
1235     \
1236     }
1237     @@Get:
1238     @@@Type:AnyURI
1239     @@@nullCase:
1240     @@@@enDesc:
1241     No value.
1242     @@@UndeclaredPrefixException:
1243 wakaba 1.3 @@@PerlDef:
1244 wakaba 1.4 __DEEP{
1245     my $v = $self-><AG::swcfg21:SWCFGNode::swcfg21:ForLatest.value>;
1246     if (defined $v and not ref $v eq 'ARRAY') {
1247     $r = $self-><AG::ManakaiDISElement.qnameToURI> ($v, node => $self);
1248     } else {
1249     $r = null;
1250     }
1251     }__;
1252    
1253     @Attr:
1254     @@Name: qnameValueLocalName
1255     @@enDesc:
1256     The local name part of the element value (assumed as
1257     written as <TYPE::dis:TypeQName>).
1258     \
1259     {NOTE:: What should be if list value?
1260     \
1261     }
1262     @@Get:
1263     @@@Type:
1264     DISCore:LocalName
1265     @@@nullCase:
1266     @@@@enDesc:
1267     No value.
1268     @@@PerlDef:
1269     __DEEP{
1270     my $v = $self-><AG::swcfg21:SWCFGNode::swcfg21:ForLatest.value>;
1271     if (defined $v and not ref $v eq 'ARRAY') {
1272     my ($n, $v) = split /:/, $v, 2;
1273     $r = defined $v ? $v : $n;
1274     } else {
1275     $r = null;
1276     }
1277     }__;
1278    
1279     @Attr:
1280     @@Name: qnameValueNamespaceURI
1281     @@enDesc:
1282     The namespace URI of the element value (assumed as written
1283     in <TYPE::dis:TypeQName>).
1284     \
1285     {NOTE:: What should be if list value?
1286     \
1287     }
1288     @@Get:
1289     @@@Type:AnyURI
1290     @@@nullCase:
1291     @@@@enDesc:
1292     No value.
1293     @@@UndeclaredPrefixException:
1294     @@@PerlDef:
1295     __DEEP{
1296     my $v = $self-><AG::swcfg21:SWCFGNode::swcfg21:ForLatest.value>;
1297     if (defined $v and not ref $v eq 'ARRAY') {
1298     my ($p, $v) = split /:/, $v, 2;
1299     $r = $self-><AG::ManakaiDISElement.prefixToURI>
1300     (defined $v ? $p : null);
1301     } else {
1302     $r = null;
1303     }
1304     }__;
1305 wakaba 1.2
1306 wakaba 1.6 @Method:
1307 wakaba 1.3 @@Name: tfqnamesValueURI
1308 wakaba 1.2 @@enDesc:
1309 wakaba 1.3 The element value (written as <TYPE::dis:TFQNames>),
1310 wakaba 1.2 as URI reference.
1311     \
1312     {NOTE:: What should be if list value?
1313     \
1314     }
1315 wakaba 1.6 @@Param:
1316     @@@Name: defaultTypeURI
1317     @@@Type: NameURI
1318     @@@Description:
1319     @@@@lang:en
1320     @@@@@:
1321     A name URI reference used if it is missing from
1322     <P::tfqnames>.
1323     @@@InCase:
1324     @@@@Value:
1325     @@@@@is-null:1
1326     @@@@Description:
1327     @@@@@lang:en
1328     @@@@@@:
1329     Equivalent to <Q::DOMMain:any>.
1330     @@Param:
1331     @@@Name: defaultForURI
1332     @@@Type: ForURI
1333     @@@Description:
1334     @@@@lang:en
1335     @@@@@:
1336     A <QUOTE::for> URI reference used if it is missing from
1337     <P::tfqnames>.
1338     @@@InCase:
1339     @@@@Value:
1340     @@@@@is-null:1
1341     @@@@Description:
1342     @@@@@lang:en
1343     @@@@@@:
1344     Equivalent to <QUOTE::for all>, i.e. <Q::ManakaiDOM:all>.
1345     @@Return:
1346 wakaba 1.2 @@@Type:ResourceURI
1347     @@@nullCase:
1348     @@@@enDesc:
1349     No value.
1350     @@@UndeclaredPrefixException:
1351 wakaba 1.3 @@@PerlDef:
1352     my $v = $self-><AG::swcfg21:SWCFGNode::swcfg21:ForLatest.value>;
1353 wakaba 1.2 if (defined $v and not ref $v eq 'ARRAY') {
1354     __DEEP{
1355 wakaba 1.6 $r = $self-><AG::ManakaiDISElement.tfqnamesToURI>
1356     ($v, $defaultTypeURI, $defaultForURI);
1357 wakaba 1.2 }__;
1358     } else {
1359     $r = null;
1360     }
1361 wakaba 1.7
1362     @Method:
1363     @@Name: elementTypeMatch
1364     @@enDesc:
1365     Returns whether the element type of this element matches
1366     with another element type (either the same element type or
1367     this type is a subtype of another type).
1368     @@Param:
1369     @@@Name: etype
1370     @@@Type: ResourceURI
1371     @@@enDesc:
1372     An element type name URI reference to test.
1373     @@Return:
1374     @@@Type:
1375     DOMMain:boolean
1376     @@@TrueCase:
1377     @@@@enDesc:
1378     Either the element type expanded URI reference of this element is
1379     same as <P::etype> or it is a sub-element type of <P::etype>.
1380     @@@FalseCase:
1381     @@@@enDesc:
1382     This element is not of <P::etype>.
1383     @@@NoDBException:
1384     @@@PerlDef:
1385     __DEEP{
1386     my $et = $self-><M::swcfg21:SWCFGElement::swcfg21:ForLatest
1387     .expandedURI>;
1388     my $rdef = $self-><AG::ManakaiDISNode.ownerDISDocument>
1389     -><AG::ManakaiDISDocument.disDatabase>
1390     -><M::ManakaiDISDatabase.getResource> ($et);
1391     $r = $rdef-><M::ManakaiDISResourceDefinition.isSubsetOfURI> ($etype);
1392     }__;
1393    
1394     @Attr:
1395     @@Name: isResourceElement
1396     @@enDesc:
1397     Whether this element defines a resource or not.
1398     \
1399     {NOTE:: An element defines a resource if its element type is
1400     <Q::dis:ResourceDef> or its subtype.
1401     \
1402     }
1403     @@Get:
1404     @@@Type:
1405     DOMMain:boolean
1406     @@@TrueCase:
1407     @@@@enDesc:
1408     This element defines a resource.
1409     @@@FalseCase:
1410     @@@@enDesc:
1411     This element does not define any resource.
1412     @@@NoDBException:
1413     @@@PerlDef:
1414     __DEEP{
1415     $r = $self-><M::ManakaiDISElement.elementTypeMatch>
1416     (<Q::dis:ResourceDef>);
1417     }__;
1418    
1419     @Attr:
1420     @@Name: isPropertyElement
1421     @@enDesc:
1422     Whether this element is a property or not.
1423     \
1424     {NOTE:: An element is a property if its element type is
1425     <Q::rdf:type> or if its element type's <Q::rdf:type>
1426     property is <Q::rdf:Property> or is <Q::dis:subsetOf>
1427     <Q::rdf:Property>.
1428     \
1429     }
1430     @@Get:
1431     @@@Type:
1432     DOMMain:boolean
1433     @@@TrueCase:
1434     @@@@enDesc:
1435     This element is a property.
1436     @@@FalseCase:
1437     @@@@enDesc:
1438     This element is not a property.
1439     @@@NoDBException:
1440     @@@PerlDef:
1441     __DEEP{
1442     my $xn = $self-><AG::swcfg21:SWCFGElement::swcfg21:ForLatest
1443     .expandedURI>;
1444     if ($xn eq <Q::rdf:type>) {
1445     $r = true;
1446     } else {
1447     my $rdef = $self-><AG::ManakaiDISNode.ownerDISDocument>
1448     -><AG::ManakaiDISDocument.disDatabase>
1449     -><M::ManakaiDISDatabase.getResource> ($xn);
1450     $r = $rdef-><M::ManakaiDISResourceDefinition.isTypeURI>
1451     (<Q::rdf:Resource>);
1452     }
1453     }__;
1454 wakaba 1.1 ##DISElement
1455    
1456     ClsDef:
1457 wakaba 1.4 @ClsQName: ManakaiDISModuleElement
1458     @ClsISA: ManakaiDISElement
1459     @enDesc:
1460     The <Q::dis:Module> elements.
1461    
1462     @Attr:
1463     @@Name: requireElement
1464     @@enDesc:
1465     The <Q::dis:Require> child element. The element is
1466     newly created if not exist.
1467     @@Type: ManakaiDISElement
1468     @@Get:
1469     @@@PerlDef:
1470     __DEEP{
1471     $r = $self-><M::swcfg21:SWCFGNode
1472     ::swcfg21:ForLatest.getAttributeNS>
1473     (<Q::dis:>, 'Require', make_new_node => true);
1474     }__;
1475    
1476     @Attr:
1477     @@Name: defaultForURI
1478     @@enDesc:
1479     The value of <Q::dis:DefaultFor> attribute.
1480     @@Type: ForURI
1481     @@Get:
1482     @@@enDesc:
1483     The value of <Q::dis:DefaultFor> child element. If missing,
1484     <Q::ManakaiDOM:all> is returned.
1485     @@@PerlDef:
1486     __DEEP{
1487     my $df = $self-><M::swcfg21:SWCFGNode::swcfg21:ForLatest
1488     .getAttributeNS>
1489     (<Q::dis:>, 'DefaultFor');
1490     if ($df) {
1491     $r = $df-><AG::ManakaiDISElement.qnameValueURI>
1492     || <Q::ManakaiDOM:all>;
1493     } else {
1494     $r = <Q::ManakaiDOM:all>;
1495     }
1496     }__;
1497     @@Set:
1498     @@@PerlDef:
1499     __DEEP{
1500     $self-><M::swcfg21:SWCFGNode::swcfg21:ForLatest.setAttributeNS>
1501     (<Q::dis:>, 'DefaultFor' => $given);
1502     }__;
1503 wakaba 1.7
1504     @Attr:
1505     @@Name: definingNamespaceURI
1506     @@enDesc:
1507     The value of <Q::dis:NamespaceURI> attribute, i.e.
1508     the URI reference of the namespace that this module primary
1509     defines.
1510     \
1511     {NOTE:: Defining namespace URI is <QUOTE::for> independent.
1512     \
1513     }
1514     @@Type: AnyURI
1515     @@Get:
1516     @@@PerlDef:
1517     __DEEP{
1518     my $df = $self-><M::swcfg21:SWCFGNode::swcfg21:ForLatest
1519     .getAttributeNS>
1520     (<Q::dis:>, 'Namespace');
1521     if ($df) {
1522     $r = $df-><AG::swcfg21:SWCFGNode::swcfg21:ForLatest.value>;
1523     } else {
1524     __ASSERT{DISPerl:invariant::
1525     msg => {qq["dis:Namespace" attribute not found]},
1526     }__;
1527     }
1528     }__;
1529     @@Set:
1530     @@@PerlDef:
1531     __DEEP{
1532     $self-><M::swcfg21:SWCFGNode::swcfg21:ForLatest.setAttributeNS>
1533     (<Q::dis:>, 'Namespace' => $given);
1534     }__;
1535 wakaba 1.4 ##DISModuleElement
1536    
1537     ClsDef:
1538 wakaba 1.2 @ClsQName: ManakaiDISElementList
1539     @enDesc:
1540     @@lang:en
1541     @@@:
1542     Lists of elements.
1543     \
1544     {NOTE:: <Class::ManakaiDISElementList> is <QUOTE::dead>;
1545     later changes to the tree does not affect this type of objects.
1546     \
1547     }
1548     ##DISElementList
1549    
1550     ClsDef:
1551 wakaba 1.1 @ClsQName: ManakaiDISComment
1552 wakaba 1.7 @ClsISA: ManakaiDISNode
1553 wakaba 1.1 @ClsISA:
1554 wakaba 1.3 swcfg21:ManakaiSWCFGComment::swcfg21:ForLatest
1555 wakaba 1.1 @Description:
1556     @@lang:en
1557     @@@:
1558     <QUOTE::dis> comment node objects.
1559     ##DISComment
1560    
1561     ClsDef:
1562     @ClsQName: ManakaiDISDocumentFragment
1563 wakaba 1.7 @ClsISA: ManakaiDISNode
1564 wakaba 1.1 @ClsISA:
1565 wakaba 1.3 swcfg21:ManakaiSWCFGDocumentFragment::swcfg21:ForLatest
1566 wakaba 1.1 @Description:
1567     @@lang:en
1568     @@@:
1569     <QUOTE::dis> document fragment node objects.
1570     ##DISDocumentFragment
1571    
1572     ClsDef:
1573     @ClsQName: ManakaiDISDocument
1574 wakaba 1.7 @ClsISA: ManakaiDISNode
1575 wakaba 1.1 @ClsISA:
1576 wakaba 1.3 swcfg21:ManakaiSWCFGDocument::swcfg21:ForLatest
1577 wakaba 1.1 @Description:
1578     @@lang:en
1579     @@@:
1580     <QUOTE::dis> document node objects.
1581 wakaba 1.2
1582     @Attr:
1583 wakaba 1.4 @@Name: moduleElement
1584     @@enDesc:
1585     The <Q::dis:Module> element in this document. The element is
1586     newly created if not exist.
1587     @@Type: ManakaiDISModuleElement
1588     @@Get:
1589     @@@PerlDef:
1590     __DEEP{
1591     $r = $self-><M::swcfg21:SWCFGNode
1592     ::swcfg21:ForLatest.getAttributeNS>
1593     (<Q::dis:>, 'Module', make_new_node => true);
1594     }__;
1595     $r = bless $r, <ClassName::ManakaiDISModuleElement>;
1596    
1597     @Attr:
1598 wakaba 1.2 @@Name: disDatabase
1599     @@enDesc:
1600     Associated <QUOTE::dis> database.
1601    
1602     @@Type: ManakaiDISDatabase
1603     @@Get:
1604     @@@NoDBException:
1605     @@@PerlDef:
1606     if ($self->{<Q::TreeCore:node>}->{<Q::db>}) {
1607 wakaba 1.5 $r = $self->{<Q::TreeCore:node>}->{<Q::db>};
1608 wakaba 1.2 } else {
1609     __EXCEPTION{NO_ASSOCIATED_DB_ERR}__;
1610     }
1611     @@Set:
1612     @@@PerlDef:
1613     $self->{<Q::TreeCore:node>}->{<Q::db>} = $given;
1614     require Scalar::Util;
1615     Scalar::Util::weaken ($self->{<Q::TreeCore:node>}->{<Q::db>});
1616 wakaba 1.5
1617     @Method:
1618     @@Name: disChildElements
1619     @@enDesc:
1620     A list of child elements.
1621     @@ForParam:
1622     @@ForpParam:
1623     @@Return:
1624     @@@Type: ManakaiDISElementList
1625     @@@enDesc:
1626     The current snapshot of child nodes.
1627     @@@PerlDef:
1628     $r = bless [], <ClassName::ManakaiDISElementList>;
1629     __DEEP{
1630     for my $cn (@{$self-><AG::swcfg21:SWCFGNode::swcfg21:ForLatest
1631     .childNodes>}) {
1632     next unless $cn-><AG::swcfg21:SWCFGNode::swcfg21:ForLatest
1633     .nodeType> eq '#element';
1634     my $dn = $cn->{<Q::TreeCore:node>}
1635     -><M::ManakaiDOM:ManakaiDOMNodeObject
1636     ::ManakaiDOM:Perl.newReference>
1637     (<ClassName::ManakaiDISElement>);
1638     next unless $dn-><M::ManakaiDISElement.forMatch> ($forArg, $forpArg);
1639     push @$r, $dn;
1640     }
1641     }__;
1642 wakaba 1.1 ##DISDocument
1643 wakaba 1.2
1644     PropDef:
1645     @QName: db
1646     @enDesc:
1647     Associated <QUOTE::dis> database.
1648     @rdfs:domain: ManakaiDISDocument
1649     @rdfs:range: ManakaiDISDatabase
1650    
1651     ## -- Definition object database
1652    
1653     ClsDef:
1654     @ClsQName: ManakaiDISDatabase
1655     @enDesc:
1656     Resource database created from <QUOTE::dis> source data.
1657 wakaba 1.4 @ClsISA: ManakaiDISExceptionTarget
1658 wakaba 1.2
1659     @Method:
1660     @@Name: getModule
1661     @@Description:
1662     @@@lang:en
1663     @@@@:
1664     Returns a <QUOTE::dis> module definition.
1665     @@Param:
1666     @@@Name: modURI
1667     @@@Type: ModuleURI
1668     @@@Description:
1669     @@@@lang:en
1670     @@@@@:
1671     A <QUOTE::dis> module URI reference.
1672     @@Return:
1673     @@@Type: ManakaiDISModuleDefinition
1674     @@@Description:
1675     @@@@lang:en
1676     @@@@@:
1677     The module definition.
1678     @@@PerlDef:
1679     if (defined $self->{modDef}->{$modURI}) {
1680     $r = $self->{modDef}->{$modURI};
1681     } else {
1682     $r = $self->{modDef}->{$modURI}
1683     = bless {
1684     uri => $modURI,
1685     db => $self,
1686     for => <Q::ManakaiDOM:all>,
1687     forp => [],
1688     }, <ClassName::ManakaiDISModuleDefinition>;
1689     require Scalar::Util;
1690     Scalar::Util::weaken ($r->{db});
1691     }
1692    
1693     @Method:
1694     @@Name: getFor
1695     @@Description:
1696     @@@lang:en
1697     @@@@:
1698     Returns a <QUOTE::for> definition object.
1699     @@Param:
1700     @@@Name: forURI
1701     @@@Type: ForURI
1702     @@@Description:
1703     @@@@lang:en
1704     @@@@@:
1705     A <QUOTE::for> URI reference.
1706     @@@InCase:
1707     @@@@Value:
1708     @@@@@is-null:1
1709     @@@@Description:
1710     @@@@@lang:en
1711     @@@@@@:
1712     Defaulted to <Q::ManakaiDOM:all>.
1713     @@Return:
1714     @@@Type: ManakaiDISForDefinition
1715     @@@PerlDef:
1716     $forURI = <Q::ManakaiDOM:all> unless defined $forURI;
1717     if (defined $self->{forDef}->{$forURI}) {
1718     $r = $self->{forDef}->{$forURI};
1719     } else {
1720     $r = $self->{forDef}->{$forURI}
1721     = bless {
1722     uri => $forURI,
1723     isa => {<Q::ManakaiDOM:all> => true},
1724     revISA => {},
1725     db => $self,
1726     }, <ClassName::ManakaiDISForDefinition>;
1727     $self->{forDef}->{<Q::ManakaiDOM:all>}->{revISA}->{$forURI} = true;
1728     require Scalar::Util;
1729     Scalar::Util::weaken ($r->{db});
1730     }
1731    
1732     @Method:
1733     @@Name: getResource
1734     @@Description:
1735     @@@lang:en
1736     @@@@:
1737     Returns a <QUOTE::dis> resource definition.
1738     @@Param:
1739     @@@Name: resURI
1740     @@@Type: ResourceURI
1741     @@@Description:
1742     @@@@lang:en
1743     @@@@@:
1744     A <QUOTE::dis> resource URI reference.
1745 wakaba 1.3 @@@nullCase:
1746 wakaba 1.2 @@@@Description:
1747     @@@@@lang:en
1748     @@@@@@:
1749     Defaulted to <Q::DOMMain:any>.
1750     @@Return:
1751     @@@Type: ManakaiDISResourceDefinition
1752     @@@Description:
1753     @@@@lang:en
1754     @@@@@:
1755     The resource definition.
1756     @@@PerlDef:
1757     $resURI = <Q::DOMMain:any> unless defined $resURI;
1758     if (defined $self->{resDef}->{$resURI}) {
1759     $r = $self->{resDef}->{$resURI};
1760     } else {
1761     $r = $self->{resDef}->{$resURI}
1762     = bless {
1763     uri => $resURI,
1764 wakaba 1.6 aliasURI => {$resURI => true},
1765 wakaba 1.2 subOf => {},
1766     supOf => {},
1767     db => $self,
1768     for => <Q::ManakaiDOM:all>,
1769     forp => [],
1770     }, <ClassName::ManakaiDISResourceDefinition>;
1771     require Scalar::Util;
1772     Scalar::Util::weaken ($r->{db});
1773     }
1774 wakaba 1.3
1775     @Method:
1776     @@Name: getSourceFile
1777     @@enDesc:
1778     Gets <QUOTE::dis> source document.
1779     @@Param:
1780     @@@Name: fileName
1781     @@@Type: FileURI
1782     @@@enDesc:
1783     A URI reference identifying a file.
1784     @@Return:
1785     @@@Type: ManakaiDISDocument
1786     @@@enDesc:
1787     The <QUOTE::dis> source document.
1788     @@@nullCase:
1789     @@@@enDesc:
1790     No document associated with that <P::fileName>.
1791     @@@PerlDef:
1792     $r = $self->{<Q::sourceFile>}->{$fileName};
1793     @Method:
1794     @@Name: setSourceFile
1795     @@enDesc:
1796     Puts <QUOTE::dis> source document object.
1797     @@Param:
1798     @@@Name: fileName
1799     @@@Type: FileURI
1800     @@@enDesc:
1801 wakaba 1.4 A URI reference identifying a file. If there is already a
1802 wakaba 1.3 source document, then the association has been updated.
1803     @@Param:
1804     @@@Name: doc
1805     @@@Type: ManakaiDISDocument
1806     @@@enDesc:
1807     The document object to set.
1808     @@Return:
1809     @@@PerlDef:
1810     $self->{<Q::sourceFile>}->{$fileName} = $doc;
1811 wakaba 1.4
1812     @Method:
1813     @@Name: loadModule
1814     @@enDesc:
1815     Loads definitions from a <QUOTE::dis> document.
1816     @@Param:
1817     @@@Name: doc
1818     @@@Type:ManakaiDISDocument
1819     @@@enDesc:
1820     The source <QUOTE::dis> document object. Its
1821     <A::ManakaiDISDocument.disDatabase> must be this database.
1822     @@Param:
1823     @@@Name: resolver
1824     @@@Type: DISModuleResolver
1825     @@@enDesc:
1826     The resolver to convert module name into <QUOTE::dis> document object.
1827     @@ForParam:
1828     @@Return:
1829     @@@RaiseException:
1830     @@@@@: NO_MODULE_QNAME_ERR
1831     @@@@enDesc:
1832     The <Q::dis:Module> element must have a <Q::dis:QName> attribute.
1833     @@@RaiseException:
1834     @@@@@: UNABLE_TO_GET_MODULE_ERR
1835     @@@@enDesc:
1836     The implementation is unable to get a module source.
1837 wakaba 1.5 @@@ForDefDupException:
1838     @@@ForDefNoQNameException:
1839     @@@ResDefDupException:
1840     @@@ElementNotAllowedException:
1841 wakaba 1.7 @@@RaiseException:
1842     @@@@@:NO_REQUIRED_ATTR_ERR
1843     @@@@enDesc:
1844     The <Q::dis:Module> element does not have
1845     <Q::dis:Namespace> attribute.
1846 wakaba 1.4 @@@PerlDef:
1847     $resolver = bless $resolver, <ClassName::ManakaiDISModuleResolver>
1848     if ref $resolver eq 'CODE';
1849     ## -- Module Name, URI
1850     $forArg = <Q::ManakaiDOM:all> unless defined $forArg;
1851     my $mod_node;
1852     my $mod_name_node;
1853     __DEEP{
1854     $mod_node = $doc-><AG::ManakaiDISDocument.moduleElement>;
1855     $mod_name_node = $mod_node-><M::swcfg21:SWCFGNode
1856     ::swcfg21:ForLatest.getAttributeNS>
1857     (<Q::dis:>, 'QName');
1858     unless ($mod_name_node) {
1859     __UNDEEP{
1860     __EXCEPTION{NO_MODULE_QNAME_ERR::
1861     DIS:sourceNode => {$mod_node},
1862     }__;
1863     }__;
1864     }
1865     my $mod_uri;
1866 wakaba 1.5 my $mod_name_uri = $mod_name_node
1867     -><AG::ManakaiDISElement.qnameValueURI>;
1868 wakaba 1.4 __CODE{tfurisToURI:: $turi => $mod_name_uri, $furi => $forArg,
1869     $uri => $mod_uri}__;
1870 wakaba 1.5 my $mod = $self-><M::ManakaiDISDatabase.getModule> ($mod_uri);
1871 wakaba 1.4
1872     unless ($mod-><M::ManakaiDISModuleDefinition.isDefined>) {
1873     ## -- Initializes Module Definition Object
1874     $mod->{nameURI} = $mod_name_uri;
1875     $mod->{localName} = $mod_name_node-><AG::ManakaiDISElement
1876     .qnameValueLocalName>;
1877     $mod->{namespaceURI} = $mod_name_node-><AG::ManakaiDISElement
1878     .qnameValueNamespaceURI>;
1879     $mod->{for} = $forArg;
1880     $mod->{src} = $mod_node;
1881 wakaba 1.5 $mod->{<Q::isDefined>} = true;
1882 wakaba 1.4 $self-><M::ManakaiDISDatabase.setSourceFile>
1883 wakaba 1.5 ($mod->{nameURI} => $doc);
1884    
1885    
1886     ## -- Loads "for all"
1887     my $nuri = $mod->{nameURI};
1888     my $forall = <Q::ManakaiDOM:all>;
1889     my $uri;
1890     __CODE{tfurisToURI:: $turi => $nuri, $furi => $forall,
1891     $uri => $uri}__;
1892     my $rmod = $self-><M::ManakaiDISDatabase.getModule> ($uri);
1893     unless ($rmod-><AG::ManakaiDISModuleDefinition.isDefined>) {
1894     my $rdoc = $resolver-><M::ManakaiDISModuleResolver.uriToDocument>
1895     ($self, $uri, $mod->{namespaceURI},
1896     $mod->{localName}, $forall);
1897     unless ($rdoc) {
1898     __UNDEEP{
1899     __EXCEPTION{UNABLE_TO_GET_MODULE_ERR::
1900     DIS:uri => {$uri},
1901     DIS:namespaceURI => {$mod->{namespaceURI}},
1902     DIS:localName => {$mod->{localName}},
1903     DIS:for => {$forall},
1904     DIS:sourceNode => {$mod->{src}},
1905     }__;
1906     }__;
1907     }
1908     $self-><M::ManakaiDISDatabase.loadModule>
1909     ($rdoc, $resolver, for_arg => $forall);
1910     } # Unless "for all" loaded
1911 wakaba 1.4
1912     ## -- Loads Required Modules
1913     my $req_node = $mod_node-><AG::ManakaiDISModuleElement
1914     .requireElement>;
1915     for my $rm (@{$req_node-><M::ManakaiDISElement.disChildElements>}) {
1916     next unless $rm-><AG::swcfg21:SWCFGElement::swcfg21:ForLatest
1917     .expandedURI> eq <Q::dis:Module>;
1918     my ($uri, $nuri, $ln, $for);
1919     my $mqn = $rm-><AG::swcfg21:SWCFGNode::swcfg21:ForLatest
1920     .getAttributeNS> (<Q::dis:>, 'QName');
1921     if ($mqn) {
1922     my $mqv = $mqn-><AG::swcfg21:SWCFGNode::swcfg21:ForLatest
1923     .value>;
1924     my $mqp = $mqn-><AG::ManakaiDISElement.qnameToPair>
1925     ($mqv, node => $mqn);
1926     ($nuri, $ln) = @$mqp;
1927     } else {
1928     my $mn = $rm-><AG::swcfg21:SWCFGNode::swcfg21:ForLatest
1929     .getAttributeNS> (<Q::dis:>, 'Name');
1930     if ($mn) {
1931     $nuri = $mod->{namespaceURI};
1932     $ln = $mn-><AG::swcfg21:SWCFGNode::swcfg21:ForLatest.value>;
1933     } else {
1934     $nuri = $mod->{namespaceURI};
1935     $ln = $mod->{localName};
1936     }
1937     }
1938     my $wfn = $rm-><AG::swcfg21:SWCFGNode::swcfg21:ForLatest
1939     .getAttributeNS> (<Q::dis:>, 'WithFor');
1940     if ($wfn) {
1941     $for = $wfn-><AG::ManakaiDISElement.qnameValueURI>;
1942     } else {
1943     $for = $mod->{for};
1944     }
1945     my $xuri = $nuri . $ln;
1946     __CODE{tfurisToURI:: $turi => $xuri, $furi => $for,
1947     $uri => $uri}__;
1948     my $rmod = $self-><M::ManakaiDISDatabase.getModule> ($uri);
1949     unless ($rmod-><AG::ManakaiDISModuleDefinition.isDefined>) {
1950     my $rdoc = $resolver-><M::ManakaiDISModuleResolver.uriToDocument>
1951     ($self, $uri, $nuri, $ln, $for);
1952     unless ($rdoc) {
1953     __UNDEEP{
1954     __EXCEPTION{UNABLE_TO_GET_MODULE_ERR::
1955     DIS:uri => {$uri},
1956     DIS:namespaceURI => {$nuri},
1957     DIS:localName => {$ln},
1958     DIS:for => {$for},
1959     DIS:sourceNode => {$rm},
1960     }__;
1961     }__;
1962     }
1963     $self-><M::ManakaiDISDatabase.loadModule>
1964     ($rdoc, $resolver, for_arg => $for);
1965     }
1966     } # Child Module elements
1967    
1968 wakaba 1.5 my $root_elements = $doc-><M::ManakaiDISDocument.disChildElements>;
1969     if ($mod->{for} eq <Q::ManakaiDOM:all>) {
1970     ## -- Loads "for" definitions
1971     for my $el (@$root_elements) {
1972     next unless $el-><M::swcfg21:SWCFGElement::swcfg21:ForLatest
1973     .expandedURI> eq <Q::dis:ForDef>;
1974     $self-><M::ManakaiDISDatabase.loadFor> ($mod, $el);
1975     }
1976     }
1977    
1978     for my $el (@$root_elements) {
1979 wakaba 1.7 if ($el-><M::ManakaiDISElement.isResourceElement>) {
1980     $self-><M::ManakaiDISDatabase.loadResource>
1981     ($mod, null, $mod, $el,
1982     for_arg => $forArg);
1983     } else {
1984     my $et = $el-><M::swcfg21:SWCFGElement::swcfg21:ForLatest
1985     .expandedURI>;
1986     if ({
1987 wakaba 1.5 <Q::dis:ForDef> => 1,
1988     <Q::dis:Module> => 1,
1989     <Q::dis:ImplNote> => 1,
1990 wakaba 1.7 }->{$et}) {
1991     #
1992     } else {
1993     __UNDEEP{
1994     __EXCEPTION{ELEMENT_NOT_ALLOWED_ERR::
1995     DIS:elementType => {$et},
1996     DIS:sourceNode => {$el},
1997     DIS:uri => {$mod->{uri}},
1998     }__;
1999 wakaba 1.5 }__;
2000 wakaba 1.7 }
2001     } # element types
2002     }
2003    
2004     my $dn = $mod_node-><M::swcfg21:SWCFGNode::swcfg21:ForLatest
2005     .getAttributeNS>
2006     (<Q::dis:>, 'Namespace');
2007     unless ($dn and defined $dn-><AG::swcfg21:SWCFGNode
2008     ::swcfg21:ForLatest.value>) {
2009     __UNDEEP{
2010     __EXCEPTION{NO_REQUIRED_ATTR_ERR::
2011     DIS:elementType => {<Q::dis:Namespace>},
2012     DIS:sourceNode => {$mod_node},
2013 wakaba 1.5 }__;
2014 wakaba 1.7 }__;
2015 wakaba 1.5 }
2016     } # Unless this module loaded
2017     }__; # Deep
2018    
2019     @Method:
2020     @@Name: loadFor
2021     @@enDesc:
2022     Loads definition of a <QUOTE::for> from a <Q::dis:ForDef> element.
2023     @@Param:
2024     @@@Name: mod
2025     @@@Type: ManakaiDISModuleDefinition
2026     @@@enDesc:
2027     The module in which the <QUOTE::for> to load is defined.
2028     @@Param:
2029     @@@Name: el
2030     @@@Type:ManakaiDISElement
2031     @@@enDesc:
2032     The source <QUOTE::dis> <Q::dis:ForDef> element object.
2033     @@Return:
2034     @@@ForDefDupException:
2035     @@@ForDefNoQNameException:
2036     @@@ElementNotAllowedException:
2037     @@@PerlDef:
2038     __DEEP{
2039     my $qn_node = $el-><M::swcfg21:SWCFGNode
2040     ::swcfg21:ForLatest.getAttributeNS>
2041     (<Q::dis:>, 'QName');
2042     unless ($qn_node) {
2043     __UNDEEP{
2044     __EXCEPTION{NO_FOR_QNAME_ERR::
2045     DIS:sourceNode => {$qn_node},
2046     }__;
2047     }__;
2048     }
2049     my $qn_uri = $qn_node-><AG::ManakaiDISElement.qnameValueURI>;
2050     my $for = $self-><M::ManakaiDISDatabase.getFor> ($qn_uri);
2051    
2052     unless ($for-><M::ManakaiDISForDefinition.isDefined>) {
2053     ## -- Initializes For Definition Object
2054     $for->{src} = $el;
2055     $for->{<Q::isDefined>} = true;
2056     $for->{<Q::definingModule>} = $mod->{uri};
2057    
2058     for my $ce (@{$el-><M::ManakaiDISElement.disChildElements>}) {
2059     my $xn = $ce-><AG::swcfg21:SWCFGElement::swcfg21:ForLatest
2060     .expandedURI>;
2061     if ($xn eq <Q::dis:ISA> or $xn eq <Q::dis:Implement>) {
2062     my $sfor = $self-><M::ManakaiDISDatabase.getFor>
2063 wakaba 1.7 ($ce-><AG::ManakaiDISElement.qnameValueURI>);
2064 wakaba 1.5 $for-><M::ManakaiDISForDefinition.addISA> ($sfor);
2065 wakaba 1.7 $sfor-><M::ManakaiDISForDefinition.isReferred> ($ce);
2066 wakaba 1.5 ## TODO: warn if dis:Implement
2067     } elsif ({
2068     <Q::dis:Description> => 1,
2069     <Q::dis:ImplNote> => 1,
2070     <Q::dis:FullName> => 1,
2071     <Q::dis:QName> => 1,
2072     }->{$xn}) {
2073     #
2074     } else {
2075     __UNDEEP{
2076     __EXCEPTION{ELEMENT_NOT_ALLOWED_ERR::
2077     DIS:elementType => {$xn},
2078     DIS:sourceNode => {$ce},
2079     DIS:uri => {$mod->{uri}},
2080     }__;
2081     }__;
2082     }
2083     }
2084     } else {
2085     __UNDEEP{
2086     __EXCEPTION{FOR_ALREADY_DEFINED_ERR::
2087     DIS:sourceNode => {$el},
2088     DIS:anotherSourceNode => {$for->{src}},
2089     }__;
2090     }__;
2091     } # isDefine?
2092     }__; # DEEP
2093    
2094     @Method:
2095     @@Name: loadResource
2096     @@enDesc:
2097     Loads definition of a <QUOTE::dis> resource from a
2098     <Q::dis:ResourceDef> element.
2099     @@Param:
2100     @@@Name: mod
2101     @@@Type: ManakaiDISModuleDefinition
2102     @@@enDesc:
2103     The module in which the resource to load is defined.
2104     @@Param:
2105     @@@Name: parentResource
2106     @@@Type: ManakaiDISResourceDefinition
2107     @@@enDesc:
2108 wakaba 1.7 The (static) parent resource in which the resource to load is defined.
2109 wakaba 1.5 @@@nullCase:
2110     @@@@enDesc:
2111     The resource to load is a root resource, i.e. <P::el> is
2112     a direct child of the document node.
2113     @@Param:
2114 wakaba 1.7 @@@Name: dynParent
2115     @@@Type:
2116     DOMMain:Object
2117     @@@enDesc:
2118     The dynamic parent resource of the resource to load.
2119     @@@InCase:
2120     @@@@Type: ManakaiDISResourceDefinition
2121     @@@@enDesc:
2122     If this resource is one of representations of
2123     <Q::dis:MultileResource>, then <P::dynParent> is that <QUOTE::multiple>
2124     resource definition. Otherwise, same as <P::parentResource>.
2125     @@@InCase:
2126     @@@@Type: ManakaiDISModuleDefinition
2127     @@@@enDesc:
2128     If this resource is a root resource, then <P::dynParent> is
2129     the module in which the resource is defined, i.e. same
2130     as <P::mod>.
2131     @@Param:
2132 wakaba 1.5 @@@Name: el
2133     @@@Type:ManakaiDISElement
2134     @@@enDesc:
2135     The source <QUOTE::dis> <Q::dis:ResourceDef> element object.
2136     @@ForParam:
2137     @@ForpParam:
2138     @@Return:
2139     @@@ResDefDupException:
2140     @@@ElementNotAllowedException:
2141     @@@PerlDef:
2142     $forArg = <Q::ManakaiDOM:all> unless defined $forArg;
2143     $forpArg ||= [];
2144     __DEEP{
2145 wakaba 1.6 ## -- Node names
2146    
2147     ## Unique resource identifier generated from node id
2148     my $node_id = $el-><AG::swcfg21:SWCFGNode::swcfg21:ForLatest.nodeID>;
2149     my $node_uri;
2150     __CODE{tfpurisToURI:: $turi => $node_id, $furi => $forArg,
2151     $forp => $forpArg, $uri => $node_uri}__;
2152    
2153     ## User defined resource identifiers
2154 wakaba 1.5 my $qn_node = $el-><M::ManakaiDISElement.disGetAttribute>
2155     (<Q::dis:QName>, for_arg => $forArg,
2156     forp_arg => $forpArg);
2157     my $res;
2158     if ($qn_node) {
2159     my $qn_uri = $qn_node-><AG::ManakaiDISElement.qnameValueURI>;
2160 wakaba 1.4 my $uri;
2161 wakaba 1.5 __CODE{tfurisToURI:: $turi => $qn_uri, $furi => $forArg,
2162 wakaba 1.4 $uri => $uri}__;
2163 wakaba 1.5 $res = $self-><M::ManakaiDISDatabase.getResource> ($uri);
2164     if ($res-><M::ManakaiDISForDefinition.isDefined>) {
2165     __UNDEEP{
2166     __EXCEPTION{RESOURCE_ALREADY_DEFINED_ERR::
2167     DIS:uri => {$uri},
2168     DIS:sourceNode => {$qn_node},
2169     DIS:anotherSourceNode => {$res->{src}},
2170     }__;
2171 wakaba 1.6 }__;
2172 wakaba 1.5 }
2173     $res->{nameURI} = $qn_uri;
2174     $res->{localName} = $qn_node-><AG::ManakaiDISElement
2175     .qnameValueLocalName>;
2176     $res->{namespaceURI} = $qn_node-><AG::ManakaiDISElement
2177     .qnameValueNamespaceURI>;
2178     } else { ## Anonymous or local
2179     my $n_node = $el-><M::ManakaiDISElement.disGetAttribute>
2180     (<Q::dis:Name>, for_arg => $forArg,
2181     forp_arg => $forpArg);
2182     if ($n_node) {
2183     if ($parentResource) {
2184     my $puri = $parentResource->{uri};
2185     my $ru;
2186     my $ln = $res->{localName};
2187     __CODE{getChildResourceURI:: $parentURI => $puri,
2188     $localName => $ln,
2189     $result => $ru}__;
2190     my $uri;
2191     __CODE{tfurisToURI:: $turi => $ru, $furi => $forArg,
2192     $uri => $uri}__;
2193     $res = $self-><M::ManakaiDISDatabase.getResource> ($uri);
2194     $res->{nameURI} = $ru;
2195 wakaba 1.6 $res->{localName} = $n_node-><AG::swcfg21:SWCFGNode
2196     ::swcfg21:ForLatest.value>;
2197 wakaba 1.5 $res->{<Q::isAnon>} = true;
2198 wakaba 1.6 $res->{aliasURI}->{$node_uri} = true;
2199     $self->{resDef}->{$node_uri} = $res;
2200 wakaba 1.5 } else { ## Root local name resource
2201 wakaba 1.7 my $ln = $n_node-><AG::swcfg21:SWCFGNode
2202     ::swcfg21:ForLatest.value>;
2203     my $ns_uri = $mod-><M::ManakaiDISPropertyAccessor
2204     .getPropertyText>
2205     (<Q::dis:Namespace>, null);
2206     my $qn_uri = $ns_uri . $ln;
2207 wakaba 1.6 my $uri;
2208     __CODE{tfurisToURI:: $turi => $qn_uri, $furi => $forArg,
2209     $uri => $uri}__;
2210     $res = $self-><M::ManakaiDISDatabase.getResource> ($uri);
2211     if ($res-><M::ManakaiDISForDefinition.isDefined>) {
2212     __UNDEEP{
2213     __EXCEPTION{RESOURCE_ALREADY_DEFINED_ERR::
2214     DIS:uri => {$uri},
2215     DIS:sourceNode => {$n_node},
2216     DIS:anotherSourceNode => {$res->{src}},
2217     }__;
2218     }__;
2219     }
2220     $res->{nameURI} = $qn_uri;
2221 wakaba 1.7 $res->{namespaceURI} = $ns_uri;
2222     $res->{localName} = $ln;
2223 wakaba 1.5 }
2224     } else {
2225 wakaba 1.6 $res = $self-><M::ManakaiDISDatabase.getResource> ($node_uri);
2226 wakaba 1.5 $res->{<Q::isAnon>} = true;
2227     }
2228 wakaba 1.6 } # anon
2229 wakaba 1.5 $res->{for} = $forArg;
2230     $res->{forp} = $forpArg;
2231     $res->{src} = $el;
2232     $res->{<Q::definingModule>} = $mod->{uri};
2233     $res->{<Q::dis2pm:parentResource>} = $parentResource->{uri}
2234     if $parentResource;
2235 wakaba 1.6 $res->{aliasURI}->{$node_uri} = true;
2236     $self->{resDef}->{$node_uri} = $res;
2237 wakaba 1.7 $res->{<Q::isDefined>} = true;
2238 wakaba 1.6
2239     ## -- Alias
2240     my $al_node = $el-><M::ManakaiDISElement.disGetAttribute>
2241     (<Q::dis:AliasFor>, for_arg => $forArg,
2242     forp_arg => $forpArg);
2243     if ($al_node) {
2244     my $canon_uri = $al_node-><M::ManakaiDISElement.tfqnamesValueURI>
2245     ($node_id, $forArg);
2246     my $canon_res = $self-><M::ManakaiDISDatabase.getResource>
2247     ($canon_uri);
2248     $canon_res-><M::ManakaiDISResourceDefinition.isReferred> ($al_node);
2249     $canon_res-><M::ManakaiDISResourceDefinition.mergeAsAlias> ($res);
2250     $res = $canon_res;
2251     }
2252 wakaba 1.5
2253 wakaba 1.7 my $is_multires = false;
2254     my @props;
2255     my @cres;
2256     my @ce0 = @{$el-><M::ManakaiDISElement.disChildElements>};
2257     while (@ce0) {
2258     my $ce = shift @ce0;
2259     if ($ce-><M::ManakaiDISElement.elementTypeMatch> (<Q::rdf:type>)) {
2260     my $type_uri = $ce-><AG::ManakaiDISElement.qnameValueURI>;
2261     $res->{<Q::rdf:type>}->{$type_uri} = true;
2262     my $type = $self-><M::ManakaiDISDatabase.getResource> ($type_uri);
2263     $type-><M::ManakaiDISResourceDefinition.isReferred> ($ce);
2264     if ($type-><M::ManakaiDISResourceDefinition.isSubsetOfURI>
2265     (<Q::dis:MultipleResource>)) {
2266     $is_multires = true;
2267     }
2268     } elsif ($ce-><M::ManakaiDISElement.elementTypeMatch>
2269     (<Q::dis:subsetOf>)) {
2270     my $sres = $self-><M::ManakaiDISDatabase.getResource>
2271     ($ce-><M::ManakaiDISElement.tfqnamesValueURI>
2272     ($node_id, $forArg));
2273     $res-><M::ManakaiDISResourceDefinition.addSuperResource> ($sres);
2274     } elsif ($ce-><M::ManakaiDISElement.isResourceElement>) {
2275     push @cres, $ce;
2276     } else {
2277     ## Property and invalid element is not checked, since not
2278     ## all property definitions has loaded at this stage.
2279     push @props, $ce;
2280     }
2281     } # @ce0
2282    
2283     ## -- Child resources
2284     unless ($is_multires) {
2285     for my $re (@cres) {
2286     unless ($al_node) {
2287     $self-><M::ManakaiDISDatabase.loadResource>
2288     ($mod, $res, $res, $re,
2289     for_arg => $forArg, forp_arg => $forpArg);
2290 wakaba 1.5 } else {
2291 wakaba 1.7 my $ac = $re-><M::ManakaiDISElement.disGetAttribute>
2292     (<Q::dis:aliasChild>, for_arg => $forArg,
2293     forp_arg => $forpArg);
2294     if ($ac and $ac-><M::swcfg21:SWCFGNode
2295     ::swcfg21:ForLatest.value>) {
2296     $self-><M::ManakaiDISDatabase.loadResource>
2297     ($mod, $res, $res, $re,
2298     for_arg => $forArg, forp_arg => $forpArg);
2299     }
2300 wakaba 1.4 }
2301     }
2302 wakaba 1.7 }
2303 wakaba 1.5
2304 wakaba 1.7 ## -- Multiple representations
2305     if ($is_multires) {
2306     for my $pe (@props) {
2307     if ($pe-><M::ManakaiDISElement.elementTypeMatch>
2308     (<Q::dis:ResourceFor>)) {
2309     my $for_uri = $pe-><M::ManakaiDISElement.qnameValueURI>;
2310     my $for = $self-><M::ManakaiDISDatabase.getFor> ($for_uri);
2311     $for-><M::ManakaiDISForDefinition.isReferred> ($pe);
2312     $self-><M::ManakaiDISDatabase.loadResource>
2313     ($mod, $parentResource, $res, $el,
2314     for_arg => $forArg,
2315     forp_arg => [@{$forpArg}, $for_uri]);
2316     }
2317     }
2318     }
2319 wakaba 1.5 }__; # DEEP
2320    
2321 wakaba 1.2 ##DISDatabase
2322    
2323 wakaba 1.5 ElementTypeBinding:
2324     @Name: ForDefDupException
2325     @ElementType:
2326     ManakaiDOM:raises
2327     @ShadowContent:
2328     @@@: FOR_ALREADY_DEFINED_ERR
2329     @@Description:
2330     @@@lang:en
2331     @@@@:
2332     The <QUOTE::for> is already defined elsewhere.
2333    
2334     ElementTypeBinding:
2335     @Name: ForDefNoQNameException
2336     @ElementType:
2337     ManakaiDOM:raises
2338     @ShadowContent:
2339     @@@: NO_FOR_QNAME_ERR
2340     @@Description:
2341     @@@lang:en
2342     @@@@:
2343     A <Q::dis:ForDef> element must have a <Q::dis:QName> attribute.
2344    
2345     ElementTypeBinding:
2346     @Name: ResDefDupException
2347     @ElementType:
2348     ManakaiDOM:raises
2349     @ShadowContent:
2350     @@@: RESOURCE_ALREADY_DEFINED_ERR
2351     @@Description:
2352     @@@lang:en
2353     @@@@:
2354     The <QUOTE::dis> resource is already defined elsewhere.
2355    
2356     ElementTypeBinding:
2357     @Name: ElementNotAllowedException
2358     @ElementType:
2359     ManakaiDOM:raises
2360     @ShadowContent:
2361     @@@: ELEMENT_NOT_ALLOWED_ERR
2362     @@Description:
2363     @@@lang:en
2364     @@@@:
2365     An element has found where it is not allowed.
2366    
2367 wakaba 1.4 IFClsDef:
2368     @QName:
2369     @@@: DISModuleResolver
2370     @@ForCheck: ForIF
2371     @QName:
2372     @@@: ManakaiDISModuleResolver
2373     @@ForCheck: ForClass
2374     @enDesc:
2375     Objects implementing <IF::DISModuleResolver> interface
2376     are used to convert module name into <QUOTE::dis> document object.
2377     \
2378     {NOTE:: It is also acceptable to pass a <Perl::CODE> reference
2379     as a method parameter where <IF::DISModuleResolver> is
2380     expected.
2381     \
2382     }
2383     @Method:
2384     @@Name: uriToDocument
2385     @@enDesc:
2386     Returns a <QUOTE::dis> document from module name information.
2387     @@Param:
2388     @@@Name: disDB
2389     @@@Type: ManakaiDISDatabase
2390     @@@enDesc:
2391     The <QUOTE::dis> database.
2392     @@Param:
2393     @@@Name: moduleURI
2394     @@@Type: ModuleURI
2395     @@@enDesc:
2396     The URI reference of the module.
2397     \
2398     {NOTE:: This parameter is redundant, since it can be
2399     composed from other three parameters.
2400     \
2401     }
2402     @@Param:
2403     @@@Name: moduleNamespaceURI
2404     @@@Type: AnyURI
2405     @@@enDesc:
2406     The namespace URI of the module name.
2407     @@Param:
2408     @@@Name: moduleLocalName
2409     @@@Type:
2410     DISCore:LocalName
2411     @@@enDesc:
2412     The local name of the module name.
2413     @@Param:
2414     @@@Name: moduleFor
2415     @@@Type: ForURI
2416     @@@enDesc:
2417     The <QUOTE::for> URI reference for which the module is defined.
2418     @@Return:
2419     @@@Type: ManakaiDISDocument
2420     @@@enDesc:
2421     The <QUOTE::dis> document. It don't have to be a newly created
2422     object.
2423     @@@nullCase:
2424     @@@@enDesc:
2425     The method is unable to resolve the reference.
2426     @@@PerlDef:
2427     $r = $self->(@_);
2428     @ManakaiDOM:inputNormalizer:
2429     @@ContentType:
2430     lang:Perl
2431     @@@:
2432     $INPUT = bless $INPUT, <ClassName::ManakaiDISModuleResolver>
2433     if ref $INPUT eq 'CODE';
2434     @@ImplNote:
2435     @@@lang:en
2436     @@@@:
2437     <FILE::cdis2pm.pl> does not support non-datatype input normalizers yet.
2438     ##DISModuleResolver
2439    
2440 wakaba 1.3 PropDef:
2441     @QName: sourceFile
2442     @enDesc:
2443     Source <QUOTE::dis> documents.
2444     @rdfs:domain: ManakaiDISDatabase
2445     @rdfs:range: ManakaiDISDocument
2446    
2447 wakaba 1.2 ClsDef:
2448     @ClsQName: ManakaiDISModuleDefinition
2449     @enDesc:
2450     <QUOTE::dis> module definitions.
2451     @ClsISA: ManakaiDISPropertyAccessor
2452 wakaba 1.4 @ClsISA: ManakaiDISExceptionTarget
2453 wakaba 1.2
2454     @Attr:
2455     @@Name: uri
2456     @@Type: ModuleURI
2457     @@Description:
2458     @@@lang:en
2459     @@@@:
2460     The URI reference of this <QUOTE::dis> module.
2461     @@Get:
2462     @@@PerlDef:
2463     $r = $self->{uri};
2464    
2465     @Attr:
2466     @@Name: nameURI
2467     @@Type: NameURI
2468     @@enDesc:
2469     The URI reference of this module, without
2470     <QUOTE::for> identifier.
2471     @@Get:
2472 wakaba 1.3 @@@PerlDef:
2473 wakaba 1.4 $r = $self->{nameURI};
2474 wakaba 1.2
2475     @Attr:
2476     @@Name: localName
2477     @@enDesc:
2478     The local name of this module.
2479     @@Type:
2480 wakaba 1.3 DISCore:LocalName::ManakaiDOM:all
2481 wakaba 1.2 @@Get:
2482     @@@PerlDef:
2483     $r = $self->{localName};
2484    
2485     @Attr:
2486     @@Name: namespaceURI
2487     @@Type: AnyURI
2488     @@enDesc:
2489     The namespace URI of the name of this resource.
2490     @@Get:
2491     @@@PerlDef:
2492     $r = $self->{namespaceURI};
2493    
2494     @Attr:
2495     @@Name: forURI
2496     @@Type: ForURI
2497     @@enDesc:
2498     The <QUOTE::for> URI reference for which this module is defined.
2499     @@Get:
2500     @@@PerlDef:
2501     $r = $self->{for};
2502    
2503     @Attr:
2504     @@Name: isDefined
2505     @@Description:
2506     @@@lang:en
2507     @@@@:
2508     Whether this module is defined or not.
2509     @@Type:
2510     DOMMain:boolean
2511     @@Get:
2512     @@@PerlDef:
2513     $r = $self->{<Q::isDefined>};
2514     ##DISModuleDefinition
2515    
2516     ClsDef:
2517     @ClsQName: ManakaiDISForDefinition
2518     @Description:
2519     @@lang:en
2520     @@@:
2521     <QUOTE::dis> <QUOTE::for> definitions.
2522 wakaba 1.4 @ClsISA: ManakaiDISExceptionTarget
2523 wakaba 1.2
2524     @Attr:
2525     @@Name: uri
2526     @@Type: ForURI
2527     @@Description:
2528     @@@lang:en
2529     @@@@:
2530     The URI reference of this <QUOTE::for>.
2531     @@Get:
2532     @@@PerlDef:
2533     $r = $self->{uri};
2534    
2535     @Method:
2536     @@Name: isaURI
2537     @@Description:
2538     @@@lang:en
2539     @@@@:
2540     Whether this <QUOTE::for> is-a another <QUOTE::for> or not.
2541     @@Param:
2542     @@@Name: superURI
2543     @@@Type: ForURI
2544     @@@Description:
2545     @@@@lang:en
2546     @@@@@:
2547     Another <QUOTE::for> URI reference to test.
2548     @@Return:
2549     @@@Type:
2550     DOMMain:boolean
2551     @@@TrueCase:
2552     @@@@enDesc:
2553     <P::superURI> is a super-<QUOTE::for> of this <QUOTE::for>.
2554     @@@FalseCase:
2555     @@@@enDesc:
2556     <P::superURI> is not a super-<QUOTE::for> of this <QUOTE::for>.
2557     @@@PerlDef:
2558     $r = $self->{uri} eq $superURI ? true : $self->{isa}->{$superURI};
2559    
2560     @Attr:
2561     @@Name: isDefined
2562     @@Description:
2563     @@@lang:en
2564     @@@@:
2565     Whether this <QUOTE::for> is already defined or not.
2566     @@Type:
2567     DOMMain:boolean
2568     @@Get:
2569     @@@TrueCase:
2570     This <QUOTE::for> is already defined.
2571     @@@FalseCase:
2572     This <QUOTE::for> is not defined.
2573     @@@PerlDef:
2574     $r = $self->{<Q::isDefined>};
2575    
2576     @Attr:
2577     @@Name: isReferred
2578     @@Description:
2579     @@@lang:en
2580     @@@@:
2581     Whether this <QUOTE::for> is referred somewhere or not.
2582     @@Type:
2583     DOMMain:any
2584     @@Get:
2585     @@@InCase:
2586     @@@@Type:ManakaiDISElement
2587     @@@@enDesc:
2588     This <QUOTE::for> is referred by the element.
2589     @@@nullCase:
2590     This <QUOTE::for> is not referred.
2591     @@@PerlDef:
2592     $r = $self->{<Q::isReferred>};
2593     @@Set:
2594     @@@InCase:
2595     @@@@Type:ManakaiDISElement
2596     @@@@enDesc:
2597     This <QUOTE::for> is referred by the element.
2598     @@@PerlDef:
2599     $self->{<Q::isReferred>} = true if $given;
2600    
2601     @Attr:
2602     @@Name: definingModule
2603     @@Description:
2604     @@@lang:en
2605     @@@@:
2606     The <QUOTE::dis> module in which this <QUOTE::for> is defined.
2607     @@Type: ManakaiDISModuleDefinition
2608     @@Get:
2609     @@@Description:
2610     @@@@lang:en
2611     @@@@@:
2612     The module object.
2613 wakaba 1.3 @@@nullCase:
2614 wakaba 1.2 @@@@Description:
2615     @@@@@lang:en
2616     @@@@@@:
2617     This <QUOTE::for> is not associated to any module.
2618     @@@PerlDef:
2619     $r = $self->{db}
2620     -><M::ManakaiDISDatabase.getResource>
2621     ($self->{<Q::definingModule>})
2622     if defined $self->{<Q::definingModule>};
2623 wakaba 1.5
2624 wakaba 1.2 @Method:
2625 wakaba 1.5 @@Name: addISA
2626 wakaba 1.2 @@enDesc:
2627 wakaba 1.5 Adds a <QUOTE::for> to the list of super-<QUOTE::for> of this
2628     <QUOTE::for>.
2629 wakaba 1.2 @@Param:
2630 wakaba 1.5 @@@Name: superFor
2631     @@@Type: ManakaiDISForDefinition
2632     @@@enDesc:
2633     A <QUOTE::for> definition object.
2634 wakaba 1.2 @@Return:
2635     @@@PerlDef:
2636 wakaba 1.5 my @from = ($self->{uri},
2637     grep {$self->{revISA}->{$_}} keys %{$self->{revISA}});
2638     my @to = ($superFor->{uri},
2639     grep {$superFor->{isa}->{$_}} keys %{$superFor->{isa}});
2640 wakaba 1.7 __DEEP{
2641     for my $from (@from) {
2642     for my $to (@to) {
2643     $self->{db}-><M::ManakaiDISDatabase.getFor>
2644     ($from)->{isa}->{$to} = true;
2645     $self->{db}-><M::ManakaiDISDatabase.getFor>
2646     ($to)->{revISA}->{$from} = true;
2647     }
2648 wakaba 1.5 }
2649 wakaba 1.7 }__;
2650 wakaba 1.5
2651 wakaba 1.2 ##DISForDefinition
2652    
2653     ClsDef:
2654     @ClsQName: ManakaiDISResourceDefinition
2655     @enDesc:
2656     <QUOTE::dis> resource definitions.
2657     @ClsISA: ManakaiDISPropertyAccessor
2658 wakaba 1.4 @ClsISA: ManakaiDISExceptionTarget
2659 wakaba 1.2
2660     @Attr:
2661     @@Name: uri
2662     @@Type: ResourceURI
2663     @@Description:
2664     @@@lang:en
2665     @@@@:
2666     The URI reference of this <QUOTE::dis> resource.
2667     @@Get:
2668     @@@PerlDef:
2669     $r = $self->{uri};
2670    
2671     @Attr:
2672     @@Name: nameURI
2673     @@Type: NameURI
2674     @@enDesc:
2675     The URI reference of this <QUOTE::dis> resource, without
2676     <QUOTE::for> identifier.
2677     @@Get:
2678     @@@nullCase:
2679     @@@@enDesc:
2680     This resource does not have its name URI reference.
2681 wakaba 1.3 @@@PerlDef:
2682 wakaba 1.4 $r = $self->{nameURI};
2683 wakaba 1.2
2684     @Attr:
2685     @@Name: localName
2686     @@enDesc:
2687     The local name of this resource.
2688     @@Type:
2689 wakaba 1.3 DISCore:LocalName::ManakaiDOM:all
2690 wakaba 1.2 @@Get:
2691     @@@nullCase:
2692     @@@@enDesc:
2693     This resource does not have its local name.
2694     @@@PerlDef:
2695     $r = $self->{localName};
2696    
2697     @Attr:
2698     @@Name: namespaceURI
2699     @@Type: AnyURI
2700     @@enDesc:
2701     The namespace URI of the name of this resource.
2702     @@Get:
2703     @@@nullCase:
2704     The name of this resource does not have its namespace
2705     or this resource does not have its name.
2706     @@@PerlDef:
2707     $r = $self->{namespaceURI};
2708    
2709     @Attr:
2710     @@Name: isAnonymous
2711     @@enDesc:
2712     Whether this <QUOTE::dis> resource has name or not.
2713     @@Type:
2714     DOMMain:boolean
2715     @@Get:
2716     @@@TrueCase:
2717     This resource does not have any global unique name.
2718     <A::ManakaiDISResourceDefinition.uri> is a temporary URI reference.
2719     @@@FalseCase:
2720     This resource does have its formal name.
2721     <A::ManakaiDISResourceDefinition.uri> is a URI reference
2722     generated from the name and the <QUOTE::for> URI reference
2723     of this resource.
2724     @@@PerlDef:
2725     $r = $self->{<Q::isAnon>};
2726    
2727     @Attr:
2728     @@Name: forURI
2729     @@enDesc:
2730     The <QUOTE::for> URI reference for which this resource is defined.
2731     @@Type:ForURI
2732     @@Get:
2733     @@@PerlDef:
2734     $r = $self->{for};
2735    
2736     @Attr:
2737     @@Name: forpURI
2738     @@enDesc:
2739     The <QUOTE::for+> URI references for which this resource is defined.
2740     @@Type: ForURIList
2741     @@Get:
2742 wakaba 1.3 @@@PerlDef:
2743 wakaba 1.2 $r = $self->{forp};
2744    
2745     @Method:
2746 wakaba 1.7 @@Name: isSubsetOfURI
2747 wakaba 1.2 @@Description:
2748     @@@lang:en
2749     @@@@:
2750     Whether this resource is a subset of another resource or not.
2751     @@Param:
2752     @@@Name: superURI
2753     @@@Type: ResourceURI
2754     @@@Description:
2755     @@@@lang:en
2756     @@@@@:
2757     Another resource URI reference to test.
2758     @@Return:
2759     @@@Type:
2760     DOMMain:boolean
2761     @@@TrueCase:
2762     @@@@enDesc:
2763     <P::superURI> is a super-resource of this resource.
2764     @@@FalseCase:
2765     @@@@enDesc:
2766     <P::superURI> is not a super-resource of this resource.
2767     @@@PerlDef:
2768 wakaba 1.6 $r = $self->{aliasURI}->{$superURI} || $self->{subOf}->{$superURI};
2769 wakaba 1.2
2770 wakaba 1.7 @Method:
2771     @@Name: addSuperResource
2772     @@enDesc:
2773     Adds a <QUOTE::dis> resource to the list of super-resource
2774     of this <QUOTE::dis> resource.
2775     @@Param:
2776     @@@Name: superRes
2777     @@@Type: ManakaiDISResourceDefinition
2778     @@@enDesc:
2779     A <QUOTE::dis> resource definition object.
2780     @@Return:
2781     @@@PerlDef:
2782     my @from = ($self->{uri},
2783     grep {$self->{supOf}->{$_}} keys %{$self->{supOf}});
2784     my @to = ($superRes->{uri},
2785     grep {$superRes->{subOf}->{$_}} keys %{$superRes->{subOf}});
2786     __DEEP{
2787     for my $from (@from) {
2788     for my $to (@to) {
2789     $self->{db}-><M::ManakaiDISDatabase.getResource>
2790     ($from)->{subOf}->{$to} = true;
2791     $self->{db}-><M::ManakaiDISDatabase.getResource>
2792     ($to)->{supOf}->{$from} = true;
2793     }
2794     }
2795     }__;
2796    
2797 wakaba 1.2 @Attr:
2798     @@Name: isDefined
2799     @@Description:
2800     @@@lang:en
2801     @@@@:
2802     Whether this resource is already defined or not.
2803     @@Type:
2804     DOMMain:boolean
2805     @@Get:
2806     @@@TrueCase:
2807     This resource is already defined.
2808     @@@FalseCase:
2809     This resource is not defined.
2810     @@@PerlDef:
2811     $r = $self->{<Q::isDefined>};
2812    
2813     @Attr:
2814     @@Name: isReferred
2815     @@Description:
2816     @@@lang:en
2817     @@@@:
2818     Whether this resource is referred or not.
2819 wakaba 1.7 @@Type: ManakaiDISElement
2820 wakaba 1.2 @@Get:
2821 wakaba 1.7 @@@enDesc:
2822     This resource is referred by the element.
2823 wakaba 1.2 @@@nullCase:
2824     This resource is not referred.
2825     @@@PerlDef:
2826     $r = $self->{<Q::isReferred>};
2827     @@Set:
2828 wakaba 1.7 @@@enDesc:
2829     This resource is referred by this element.
2830 wakaba 1.2 @@@PerlDef:
2831 wakaba 1.7 $self->{<Q::isReferred>} = true if $given;
2832 wakaba 1.2
2833     @Attr:
2834     @@Name: definingModule
2835     @@Description:
2836     @@@lang:en
2837     @@@@:
2838     The <QUOTE::dis> module in which this resource is defined.
2839     @@Type: ManakaiDISModuleDefinition
2840     @@Get:
2841     @@@Description:
2842     @@@@lang:en
2843     @@@@@:
2844     The module object.
2845 wakaba 1.3 @@@nullCase:
2846 wakaba 1.2 @@@@Description:
2847     @@@@@lang:en
2848     @@@@@@:
2849     This resource is not associated to any module.
2850     @@@PerlDef:
2851     $r = $self->{db}
2852     -><M::ManakaiDISDatabase.getModule>
2853     ($self->{<Q::definingModule>})
2854     if defined $self->{<Q::definingModule>};
2855     @@Set:
2856     @@@Description:
2857     @@@@lang:en
2858     @@@@@:
2859     The module object to which the <QUOTE::defining module> is set.
2860     @@@PerlDef:
2861     $self->{<Q::defininingModule>}
2862     = $given-><AG::ManakaiDISModuleDefinition.uri>;
2863    
2864 wakaba 1.6 @Method:
2865     @@Name: mergeAsAlias
2866     @@enDesc:
2867     Merges another resource definition as an alias of this resource.
2868     @@Param:
2869     @@@Name: aliasResource
2870     @@@Type: ManakaiDISResourceDefinition
2871     @@@enDesc:
2872     A resource to merge.
2873     \
2874     {NOTE:: After merging all references to <P::aliasResource>
2875     should be discarded.
2876     \
2877     }
2878     @@Return:
2879     @@@PerlDef:
2880     for my $uri ($aliasResource->{uri},
2881     grep {$aliasResource->{aliasURI}->{$_}}
2882     keys %{$aliasResource->{aliasURI}}) {
2883     $self->{aliasURI}->{$uri} = true;
2884     $self->{db}->{resDef}->{$uri} = $self;
2885     $self->{subOf}->{$uri} = true;
2886     $self->{supOf}->{$uri} = true;
2887     }
2888     for my $uri (grep {$aliasResource->{subOf}->{$_}}
2889     keys %{$aliasResource->{subOf}}) {
2890     $self->{subOf}->{$uri} = true;
2891     }
2892     for my $uri (grep {$aliasResource->{supOf}->{$_}}
2893     keys %{$aliasResource->{supOf}}) {
2894     $self->{supOf}->{$uri} = true;
2895     }
2896     my @from = grep {$self->{supOf}->{$_}} keys %{$self->{supOf}};
2897     my @to = grep {$self->{subOf}->{$_}} keys %{$self->{subOf}};
2898     __DEEP{
2899     for my $from (@from) {
2900     for my $to (@to) {
2901     $self->{db}-><M::ManakaiDISDatabase.getResource>
2902     ($from)->{subOf}->{$to} = true;
2903     $self->{db}-><M::ManakaiDISDatabase.getResource>
2904     ($to)->{supOf}->{$from} = true;
2905     }
2906     }
2907     }__;
2908 wakaba 1.7
2909     @Method:
2910     @@Name: isTypeURI
2911     @@enDesc:
2912     Tests whether this resource is of a type or not.
2913     @@Param:
2914     @@@Name: typeURI
2915     @@@Type: ResourceURI
2916     @@@enDesc:
2917     A type URI reference to test.
2918     @@Return:
2919     @@@Type:
2920     DOMMain:boolean
2921     @@@TrueCase:
2922     @@@@enDesc:
2923     This is a <P::typeURI> resource.
2924     @@@FalseCase:
2925     @@@@enDesc:
2926     This is not a <P::typeURI> resource.
2927     @@@PerlDef:
2928     for my $t_type_uri (grep {$self->{<Q::rdf:type>}->{$_}}
2929     keys %{$self->{<Q::rdf:type>}}) {
2930     my $t_type = $self->{db}-><M::ManakaiDISDatabase.getResource>
2931     ($t_type_uri);
2932     if ($t_type-><M::ManakaiDISResourceDefinition.isSubsetOfURI>
2933     ($typeURI)) {
2934     $r = true;
2935     last;
2936     }
2937     }
2938 wakaba 1.2 ##DISResourceDefinition
2939    
2940     ClsDef:
2941     @ClsQName: ManakaiDISPropertyAccessor
2942 wakaba 1.3 @enDesc:
2943 wakaba 1.2 Accessor methods for resource or module properties.
2944    
2945     @Method:
2946     @@Name: getPropertyText
2947     @@enDesc:
2948     Gets property value text.
2949     @@PropNameParam:
2950     @@Param:
2951     @@@Name:default
2952     @@@Type:
2953 wakaba 1.3 swcfg21:SWCFGString::swcfg21:ForLatest
2954 wakaba 1.2 @@@enDesc:
2955     The default value that is returned if no explicit property
2956     value specification found for this resource.
2957     @@@nullCase:
2958     @@@@enDesc:
2959     No default value supplied; <DOM::null> is returned if
2960     no value specified.
2961     @@Return:
2962     @@@Type:
2963 wakaba 1.3 swcfg21:SWCFGString::swcfg21:ForLatest
2964 wakaba 1.2 @@@enDesc:
2965     The property value string.
2966     @@@nullCase:
2967     @@@@enDesc:
2968     No value nor default value has specified.
2969     @@@PerlDef:
2970     if (exists $self->{$propName}) {
2971     $r = defined $self->{$propName} ? $self->{$propName} : $default;
2972     } elsif ($self->{src}) {
2973     $r = $self->{src}-><M::ManakaiDISElement.disGetAttribute>
2974     ($propName, for_arg => $self->{for},
2975     forp_arg => $self->{forp});
2976     $self->{$propName} = $r;
2977     $r = $default unless defined $r;
2978     } else {
2979     $r = $default;
2980     }
2981    
2982     @Method:
2983     @@Name: getPropertyResource
2984     @@enDesc:
2985     Gets property value resource.
2986     @@PropNameParam:
2987     @@Return:
2988     @@@Type: ManakaiDISResourceDefinition
2989     @@@enDesc:
2990     The property value resource.
2991     @@@nullCase:
2992     @@@@enDesc:
2993     No value has specified.
2994     @@@PerlDef:
2995     if (defined $self->{$propName}) {
2996     $r = $self->{db}-><M::ManakaiDISDatabase.getResource>
2997     ($self->{$propName});
2998     } else {
2999     $r = null;
3000     }
3001    
3002     @Method:
3003     @@Name: addPropertyResourceList
3004     @@enDesc:
3005     Adds a resource to a resource-list property value.
3006     \
3007     {ISSUE:: Should an exception be thrown if the property is
3008     not of list?
3009     \
3010     }
3011     @@PropNameParam:
3012     @@Param:
3013     @@@Name: res
3014     @@@Type: ManakaiDISResourceDefinition
3015     @@@enDesc:
3016     A resource to add.
3017     @@Return:
3018     @@@PerlDef:
3019     if (ref $self->{$propName} eq 'ARRAY') {
3020     push @{$self->{$propName}}, $res->{uri};
3021     } elsif (not defined $self->{$propName}) {
3022     $self->{$propName} = [$res->{uri}];
3023     }
3024    
3025 wakaba 1.3 ElementTypeBinding:
3026     @Name: PropNameParam
3027     @ElementType:
3028     dis:ResourceDef
3029     @ShadowContent:
3030     @@rdf:type:
3031     DISLang:MethodParameter
3032     @@Name: propName
3033     @@Type: ResourceURI
3034     @@Description:
3035     @@@lang:en
3036     @@@@:
3037     The name of the property.
3038    
3039 wakaba 1.2 ##DISPropertyAccessor
3040    
3041     PropDef:
3042     @QName:isAnon
3043     @Description:
3044     @@lang:en
3045     @@@:
3046     Whether the subject resource is anonymous or not.
3047     @Type:
3048     DOMMain:boolean
3049    
3050     PropDef:
3051     @QName:isDefined
3052     @Description:
3053     @@lang:en
3054     @@@:
3055     Whether the subject resource is defined or not.
3056    
3057     PropDef:
3058 wakaba 1.3 @QName:isReferred
3059 wakaba 1.2 @Description:
3060     @@lang:en
3061     @@@:
3062     Whether the subject resource is referred or not.
3063     @Type:
3064     DOMMain:any
3065    
3066     PropDef:
3067     @QName:definingModule
3068     @Description:
3069     @@lang:en
3070     @@@:
3071     The <QUOTE::dis> module in which the subject resource is defined.
3072     @rdfs:domain:
3073     DISCore:Module
3074 wakaba 1.1
3075     ## -- Datatypes
3076    
3077     URITypeDef:
3078 wakaba 1.3 @QName: AnyURI
3079     @Description:
3080     @@lang:en
3081     @@@:
3082     Any URI references.
3083    
3084     URITypeDef:
3085     @QName: FileURI
3086     @enDesc:
3087     URI references identifying file.
3088    
3089     URITypeDef:
3090 wakaba 1.1 @QName: ForURI
3091     @Description:
3092     @@lang:en
3093     @@@:
3094     <QUOTE::For> URI references.
3095    
3096     DataTypeDef:
3097     @QName: ForURIList
3098     @Description:
3099     @@lang:en
3100     @@@:
3101     References to the array containing <QUOTE::for> URI references.
3102    
3103     URITypeDef:
3104 wakaba 1.3 @QName: ResourceURI
3105     @Description:
3106     @@lang:en
3107     @@@:
3108     A URI reference for a <QUOTE::dis> resource.
3109    
3110     URITypeDef:
3111 wakaba 1.1 @QName: MediaTypeURI
3112     @Description:
3113     @@lang:en
3114     @@@:
3115     Media type URI references.
3116 wakaba 1.3 @rdfs:subClassOf: ResourceURI
3117    
3118     URITypeDef:
3119     @QName: ModuleURI
3120     @enDesc:
3121     URI references for <QUOET::dis> modules.
3122     @rdfs:subClassOf: ResourceURI
3123    
3124     URITypeDef:
3125     @QName: NameURI
3126     @enDesc:
3127     URI references identifying a resource.
3128     @rdfs:subClassOf: ResourceURI
3129    
3130     ElementTypeBinding:
3131     @Name: DataTypeDef
3132     @ElementType:
3133     dis:ResourceDef
3134     @ShadowContent:
3135     @@rdf:type:
3136     ManakaiDOM:DataType
3137    
3138     ElementTypeBinding:
3139     @Name: URITypeDef
3140     @ElementType:
3141     dis:ResourceDef
3142     @ShadowContent:
3143     @@rdf:type:
3144     ManakaiDOM:DataType
3145     @@rdfs:subClassOf: AnyURI
3146 wakaba 1.1
3147     ## -- Exceptions
3148    
3149     XParamDef:
3150     @QName: sourceNode
3151     @Description:
3152     @@lang:en
3153     @@@:
3154 wakaba 1.4 The node in which an error has occurred.
3155 wakaba 1.5 @Type: ManakaiDISNode
3156    
3157     XParamDef:
3158     @QName: anotherSourceNode
3159     @enDesc:
3160     Another source node in which an error has occurred. In cases
3161     of <QUOTE::already defined> errors, it is the node that
3162     defines the resource first.
3163     @Type: ManakaiDISNode
3164 wakaba 1.3
3165     ExceptionDef:
3166     @ClsQName: ManakaiDISException
3167     @enDesc:
3168     Exceptions for the <QUOTE::dis> operations.
3169 wakaba 1.4 @ClsISA:
3170     ManakaiDOM:ManakaiDOMException::ManakaiDOM:Perl
3171 wakaba 1.3 @XConstGroupDef:
3172     @@ClsQName: ManakaiDISExceptionCode
3173     @@enDesc:
3174     Exception codes for <Class::ManakaiDISException>.
3175     @@XConstDef:
3176     @@@Name: NAMESPACE_ERR
3177     @@@Value:14
3178     @@@enDesc:
3179     An error related to namespaces has occurred.
3180     @@@XSubTypeDef:
3181     @@@@QName: UNDECLARED_NS_PREFIX_ERR
3182     @@@@enDesc:
3183     The implementation has encounted an undeclared namespace
3184     prefix.
3185 wakaba 1.7 @@@@XParam:
3186     @@@@@QName:
3187     infoset:prefix
3188     @@@@@enDesc:
3189     The namespace prefix.
3190     @@@@enMufDef:
3191     Namespace prefix "%p (name => {<Q::infoset:prefix>});" is
3192     not declared
3193 wakaba 1.3 @@XConstDef:
3194     @@@Name: INVALID_STATE_ERR
3195     @@@Value:11
3196     @@@enDesc:
3197     An attempt is made to use an object that is not (or no longer) usable.
3198     @@@XSubTypeDef:
3199     @@@@QName: NO_ASSOCIATED_DB_ERR
3200     @@@@enDesc:
3201     No <QUOTE::dis> database has been associated with this document.
3202 wakaba 1.4 @@XConstDef:
3203     @@@Name: INVALID_SOURCE_ERR
3204     @@@Value: 200
3205     @@@enDesc:
3206     The source input is well-formed but invalid.
3207     @@@XSubTypeDef:
3208     @@@@QName: NO_MODULE_QNAME_ERR
3209     @@@@enDesc:
3210     The <Q::dis:Module> element must have its <Q::dis:QName>
3211     attribute.
3212     @@@XSubTypeDef:
3213     @@@@QName: UNABLE_TO_GET_MODULE_ERR
3214     @@@@enDesc:
3215     The implementation is unable to get the module source.
3216     @@@@Def:
3217     @@@@@ContentType:
3218     lang:muf
3219     @@@@@lang:en
3220     @@@@@@:
3221     Unable to get the module source of <%p (name => {<Q::DIS:uri>});>
3222     @@@@XParam:
3223     @@@@@QName: uri
3224     @@@@@enDesc:
3225     The URI reference of the module.
3226     @@@@XParam:
3227     @@@@@QName: namespaceURI
3228     @@@@@enDesc:
3229     The namespace URI of the module name.
3230     @@@@XParam:
3231     @@@@@QName: localName
3232     @@@@@enDesc:
3233     The local name of the module name.
3234     @@@@XParam:
3235     @@@@@QName: for
3236     @@@@@enDesc:
3237     The <QUOTE::for> of the module.
3238 wakaba 1.5 @@@XSubTypeDef:
3239     @@@@QName: NO_FOR_QNAME_ERR
3240     @@@@enDesc:
3241     A <Q::dis:ForDef> element must have <Q::dis:QName> attribute.
3242     @@@@XSourceNodeParam:
3243     @@@XSubTypeDef:
3244     @@@@QName: FOR_ALREADY_DEFINED_ERR
3245     @@@@enDesc:
3246     The <QUOTE::for> named as the same URI reference has
3247     already defined.
3248     @@@@XSourceNodeParam:
3249     @@@@XParam:
3250     @@@@@QName: anotherSourceNode
3251     @@@@@enDesc:
3252     The node that defines the <QUOTE::for> URI reference before.
3253 wakaba 1.7 @@@@XParam:
3254     @@@@@Name: uri
3255     @@@@@enDesc:
3256     The URI reference of the <QUOTE::for> attempted to define.
3257     @@@@enMufDef:
3258     <QUOTE::For> <%p (name => {<Q::DIS:uri>});> is already defined
3259 wakaba 1.5 @@@XSubTypeDef:
3260     @@@@QName: RESOURCE_ALREADY_DEFINED_ERR
3261     @@@@enDesc:
3262     The <QUOTE::dis> resource named as the same URI reference has
3263     already defined.
3264     @@@@XSourceNodeParam:
3265     @@@@XParam:
3266     @@@@@QName: anotherSourceNode
3267     @@@@@enDesc:
3268     The node that defines the <QUOTE::for> URI reference before.
3269 wakaba 1.7 @@@@XParam:
3270     @@@@@Name: uri
3271     @@@@@enDesc:
3272     The URI reference of the resource attempted to define.
3273     @@@@enMufDef:
3274     Resource <%p (name => {<Q::DIS:uri>});> is already defined
3275 wakaba 1.5 @@@XSubTypeDef:
3276     @@@@QName: ELEMENT_NOT_ALLOWED_ERR
3277     @@@@enDesc:
3278     An element has occured where it is not allowed.
3279     @@@@enMufDef:
3280     Module <%p (name => {<Q::DIS:uri>});>:
3281     Element of type <%p (name => {<Q::DIS:elementType>});>
3282     is not allowed here
3283     @@@@XSourceNodeParam:
3284     @@@@XParam:
3285     @@@@@QName: elementType
3286     @@@@@enDesc:
3287     The expanded element type name of the element.
3288     @@@@XParam:
3289     @@@@@QName: uri
3290     @@@@@enDesc:
3291     The URI reference of the module.
3292 wakaba 1.7 @@@XSubTypeDef:
3293     @@@@QName: NO_REQUIRED_ATTR_ERR
3294     @@@@enDesc:
3295     A required attribute is not specified.
3296     @@@@XSourceNodeParam:
3297     @@@@XParam:
3298     @@@@@QName: elementType
3299     @@@@@enDesc:
3300     The expanded URI reference of the attribute name.
3301     @@@@enMufDef:
3302     Attribute <%p (name => {<Q::DIS:elementType>});> must be specified
3303 wakaba 1.4 ##DISException
3304 wakaba 1.5
3305     XParamDef:
3306     @QName: elementType
3307     @Type: ResourceURI
3308     @enDesc:
3309     The name of the element type.
3310    
3311     XParamDef:
3312     @QName: uri
3313     @Type: ResourceURI
3314     @enDesc:
3315     The name of the resource, composed from <Q::namespaceURI>,
3316     <Q::localName> and <Q::for>.
3317    
3318     XParamDef:
3319     @QName: localName
3320     @Type:
3321     DISCore:LocalName
3322     @enDesc:
3323     The local name of the resource, unique in <Q::namespaceURI> namespace.
3324    
3325     XParamDef:
3326     @QName: namespaceURI
3327     @Type: AnyURI
3328     @enDesc:
3329     The namespace URI reference of the resource name.
3330    
3331     XParamDef:
3332     @QName: for
3333     @Type: ForURI
3334     @enDesc:
3335     The <QUOTE::for> URI reference of the resource.
3336    
3337     ElementTypeBinding:
3338     @Name: XSourceNodeParam
3339     @ElementType:
3340     ManakaiDOM:exceptionOrWarningParameter
3341     @ShadowContent:
3342     @@QName: sourceNode
3343     @@Description:
3344     @@@lang:en
3345     @@@@:
3346     The node in which an error has occurred.
3347 wakaba 1.4
3348     ClsDef:
3349     @ClsQName: ManakaiDISExceptionTarget
3350     @enDesc:
3351     Objects that is able to be the target of an exception.
3352     @IntMethod:
3353     @@Operator:
3354     @@@@:
3355     ManakaiDOM:MUErrorHandler
3356     @@@ContentType:
3357     dis:TypeQName
3358     @@Description:
3359     @@@lang:en
3360     @@@@:
3361     This method is a generic error handler; all manakai exceptions
3362     and warnings associated to an object are once reported to this method
3363     and then delivered to appropriate entities.
3364     \
3365     If the error is an exception (such as <X::DOMCore:DOMException> or
3366     <X::ManakaiDOM:ManakaiDOMImplementationException>), it is
3367     simply thrown. If the error is only a warning, it is reported
3368     via the <IF::DOMCore:DOMError> interface.
3369     \
3370     See <PerlModule::Message::Util::Error> documentation for more
3371     information on the error reporting mechanism.
3372     \
3373     {NOTE:: This kind of methods are named as <Perl::___report_error>
3374     in the convention of <PerlModule::Message::Util::Error>.
3375     \
3376     }
3377     @@Param:
3378     @@@Name:err
3379     @@@Type:
3380     ManakaiDOM:ManakaiDOMExceptionOrWarning::ManakaiDOM:Perl
3381     @@@Description:
3382     @@@@lang:en
3383     @@@@@:
3384     An exception object that describes what kind of error it is
3385     and how it should be recovered.
3386     \
3387     {NOTE:: Exception objects in manakai implementation
3388     inherit the class <PerlModule::Message::Util::Error>,
3389     that in turn inherits <PerlModule::Error>.
3390     \
3391     }
3392     @@Return:
3393     @@@PerlDef:
3394     if ($err->isa (<ClassName::ManakaiDOM:ManakaiDOMException
3395     ::ManakaiDOM:Perl>)) {
3396     $err->throw;
3397     } else {
3398     \## TODO: Implement warning reporting
3399     warn $err->stringify;
3400     }
3401     ##DISExceptionTarget
3402    
3403     ForDef:
3404     @QName:
3405     DIS:ForIF
3406     ForDef:
3407     @QName:
3408     DIS:ForClass
3409    
3410     ElementTypeBinding:
3411     @Name: IFClsDef
3412     @ElementType:
3413     dis:ResourceDef
3414     @ShadowContent:
3415     @@rdf:type:
3416     @@@@:
3417     dis:MultipleResource
3418     @@@ForCheck: !ForClass !ForIF
3419     @@rdf:type:
3420     @@@@:
3421     ManakaiDOM:IF
3422     @@@ForCheck: ForIF
3423     @@rdf:type:
3424     @@@@:
3425     ManakaiDOM:Class
3426     @@@ForCheck: ForClass
3427     @@resourceFor: ForIF
3428     @@resourceFor:
3429     @@@@: ForClass
3430     @@@ForCheck: ForLatest
3431     @@DOMMain:implementFeature:
3432     @@@@:CoreFeature10
3433     @@@ForCheck: ForClass
3434     @@ForCheck:
3435     ManakaiDOM:Perl
3436 wakaba 1.3
3437     ElementTypeBinding:
3438     @Name: ClsDef
3439     @ElementType:
3440     dis:ResourceDef
3441     @ShadowContent:
3442     @@rdf:type:
3443     ManakaiDOM:Class
3444     @@AliasFor:
3445     @@@@:
3446     ::ForLatest
3447     @@@For:
3448     !=ForLatest
3449     @@ForCheck:
3450     ManakaiDOM:Perl
3451     @@DOMMain:implementFeature: CoreFeature10
3452    
3453     ElementTypeBinding:
3454     @Name: ExceptionDef
3455     @ElementType:
3456     dis:ResourceDef
3457     @ShadowContent:
3458     @@rdf:type:
3459     ManakaiDOM:ExceptionClass
3460     @@AliasFor:
3461     @@@@:
3462     ::ForLatest
3463     @@@For:
3464     !=ForLatest
3465     @@ForCheck:
3466     ManakaiDOM:Perl
3467     @@DOMMain:implementFeature: CoreFeature10
3468    
3469     ElementTypeBinding:
3470     @Name: ClsQName
3471     @ElementType:
3472     dis:QName
3473    
3474     ElementTypeBinding:
3475     @Name: ClsISA
3476     @ElementType:
3477     dis:ISA
3478    
3479     ElementTypeBinding:
3480     @Name: Method
3481     @ElementType:
3482     dis:ResourceDef
3483     @ShadowContent:
3484     @@rdf:type:
3485     DISLang:Method
3486    
3487     ElementTypeBinding:
3488     @Name: IntMethod
3489     @ElementType:
3490     dis:ResourceDef
3491     @ShadowContent:
3492     @@rdf:type:
3493     DISLang:Method
3494     @@ManakaiDOM:isForInternal:1
3495    
3496     ElementTypeBinding:
3497     @Name: Attr
3498     @ElementType:
3499     dis:ResourceDef
3500     @ShadowContent:
3501     @@rdf:type:
3502     DISLang:Attribute
3503    
3504     ElementTypeBinding:
3505     @Name: Return
3506     @ElementType:
3507     dis:ResourceDef
3508     @ShadowContent:
3509     @@rdf:type:
3510     DISLang:MethodReturn
3511    
3512     ElementTypeBinding:
3513     @Name: Get
3514     @ElementType:
3515     dis:ResourceDef
3516     @ShadowContent:
3517     @@rdf:type:
3518     DISLang:AttributeGet
3519    
3520     ElementTypeBinding:
3521     @Name: Set
3522     @ElementType:
3523     dis:ResourceDef
3524     @ShadowContent:
3525     @@rdf:type:
3526     DISLang:AttributeSet
3527    
3528     ElementTypeBinding:
3529     @Name: Param
3530     @ElementType:
3531     dis:ResourceDef
3532     @ShadowContent:
3533     @@rdf:type:
3534     DISLang:MethodParameter
3535    
3536     ElementTypeBinding:
3537     @Name: PerlDef
3538     @ElementType:
3539     dis:Def
3540     @ShadowContent:
3541     @@ContentType:
3542     lang:Perl
3543    
3544     ElementTypeBinding:
3545     @Name: disDef
3546     @ElementType:
3547     dis:Def
3548     @ShadowContent:
3549     @@ContentType:
3550     lang:dis
3551    
3552     ElementTypeBinding:
3553     @Name: InCase
3554     @ElementType:
3555     dis:ResourceDef
3556     @ShadowContent:
3557     @@rdf:type:
3558     ManakaiDOM:InCase
3559    
3560     ElementTypeBinding:
3561     @Name: nullCase
3562     @ElementType:
3563     dis:ResourceDef
3564     @ShadowContent:
3565     @@rdf:type:
3566     ManakaiDOM:InCase
3567     @@Value:
3568     @@@is-null:1
3569    
3570     ElementTypeBinding:
3571     @Name: TrueCase
3572     @ElementType:
3573     dis:ResourceDef
3574     @ShadowContent:
3575     @@rdf:type:
3576     ManakaiDOM:InCase
3577     @@Value:true
3578     @@Type:
3579     DOMMain:boolean
3580    
3581    
3582     ElementTypeBinding:
3583     @Name: FalseCase
3584     @ElementType:
3585     dis:ResourceDef
3586     @ShadowContent:
3587     @@rdf:type:
3588     ManakaiDOM:InCase
3589     @@Value:false
3590     @@Type:
3591     DOMMain:boolean
3592    
3593     ElementTypeBinding:
3594     @Name: enDesc
3595     @ElementType:
3596     dis:Description
3597     @ShadowContent:
3598     @@lang:en
3599    
3600     ElementTypeBinding:
3601     @Name: PropDef
3602     @ElementType:
3603     dis:ResourceDef
3604     @ShadowContent:
3605     @@rdf:type:
3606     rdf:Property
3607     @@AliasFor:
3608     @@@@:
3609     ::ManakaiDOM:all
3610     @@@For:
3611     !=ManakaiDOM:all
3612    
3613     ElementTypeBinding:
3614     @Name: MethodRedef
3615     @ElementType:
3616     dis:ResourceDef
3617     @ShadowContent:
3618     @@rdf:type:
3619     DISLang:Method
3620     @@ManakaiDOM:isRedefining:1
3621    
3622     ElementTypeBinding:
3623     @Name: NamedParam
3624     @ElementType:
3625     dis:ResourceDef
3626     @ShadowContent:
3627     @@rdf:type:
3628     DISLang:MethodParameter
3629     @@DISPerl:isNamedParameter:1
3630    
3631     ElementTypeBinding:
3632     @Name: NodeParam
3633     @ElementType:
3634     dis:ResourceDef
3635     @ShadowContent:
3636     @@rdf:type:
3637     DISLang:MethodParameter
3638     @@DISPerl:isNamedParameter:1
3639     @@Name: node
3640     @@Type: ManakaiDISNode
3641     @@Description:
3642     @@@lang:en
3643     @@@@:
3644     The node in which the name has occurred. It is intended
3645     to be reported when an exception had been raised.
3646     @@ResourceDef:
3647     @@@rdf:type:
3648     ManakaiDOM:InCase
3649     @@@Value:
3650     @@@@is-null:1
3651     @@@Description:
3652     @@@@lang:en
3653     @@@@@:
3654     The source of the name is not a node.
3655    
3656     ElementTypeBinding:
3657     @Name: ForParam
3658     @ElementType:
3659     dis:ResourceDef
3660     @ShadowContent:
3661     @@rdf:type:
3662     DISLang:MethodParameter
3663     @@DISPerl:isNamedParameter:1
3664     @@Name: forArg
3665     @@Type: ForURI
3666     @@Description:
3667     @@@lang:en
3668     @@@@:
3669     The <QUOTE::for> URI reference.
3670     @@ResourceDef:
3671     @@@rdf:type:
3672     ManakaiDOM:InCase
3673     @@@Value:
3674     @@@@is-null:1
3675     @@@Description:
3676     @@@@lang:en
3677     @@@@@:
3678     Equivalent to <Q::ManakaiDOM:all>, i.e. <QUOTE::for all>.
3679    
3680     ElementTypeBinding:
3681     @Name: ForpParam
3682     @ElementType:
3683     dis:ResourceDef
3684     @ShadowContent:
3685     @@rdf:type:
3686     DISLang:MethodParameter
3687     @@DISPerl:isNamedParameter:1
3688     @@Name: forpArg
3689     @@Type: ForURIList
3690     @@Description:
3691     @@@lang:en
3692     @@@@:
3693     An array reference containing additional <QUOTE::for>
3694     constraints (<QUOTE::For+> list).
3695     @@ResourceDef:
3696     @@@rdf:type:
3697     ManakaiDOM:InCase
3698     @@@Value:
3699     @@@@is-null:1
3700     @@@Description:
3701     @@@@lang:en
3702     @@@@@:
3703     Equivalent to the empty array reference.
3704    
3705     ElementTypeBinding:
3706     @Name: MediaTypeParam
3707     @ElementType:
3708     dis:ResourceDef
3709     @ShadowContent:
3710     @@rdf:type:
3711     DISLang:MethodParameter
3712     @@DISPerl:isNamedParameter:1
3713     @@Name: mediaType
3714     @@Type: MediaTypeURI
3715     @@Description:
3716     @@@lang:en
3717     @@@@:
3718     The URI reference identifying a media type.
3719     @@ResourceDef:
3720     @@@rdf:type:
3721     ManakaiDOM:InCase
3722     @@@Value:
3723     @@@@is-null:1
3724     @@@Description:
3725     @@@@lang:en
3726     @@@@@:
3727     No media type specified.
3728    
3729     ElementTypeBinding:
3730     @Name: MediaTypeDefaultParam
3731     @ElementType:
3732     dis:ResourceDef
3733     @ShadowContent:
3734     @@rdf:type:
3735     DISLang:MethodParameter
3736     @@DISPerl:isNamedParameter:1
3737     @@Name: defaultMediaType
3738     @@Type: MediaTypeURI
3739     @@Description:
3740     @@@lang:en
3741     @@@@:
3742     The default media type, i.e. the type used when no explicit
3743     specification is not found in the source tree.
3744     @@ResourceDef:
3745     @@@rdf:type:
3746     ManakaiDOM:InCase
3747     @@@Value:
3748     @@@@is-null:1
3749     @@@Description:
3750     @@@@lang:en
3751     @@@@@:
3752     Defaulted to <Q::DOMMain:any>.
3753    
3754     ElementTypeBinding:
3755     @Name: RaiseException
3756     @ElementType:
3757     ManakaiDOM:raises
3758    
3759     ElementTypeBinding:
3760     @Name: UndeclaredPrefixException
3761     @ElementType:
3762     ManakaiDOM:raises
3763     @ShadowContent:
3764     @@@: UNDECLARED_NS_PREFIX_ERR
3765     @@Description:
3766     @@@lang:en
3767     @@@@:
3768     The implementation has encounted an undeclared namespace prefix.
3769    
3770     ElementTypeBinding:
3771     @Name: NoDBException
3772     @ElementType:
3773     ManakaiDOM:raises
3774     @ShadowContent:
3775     @@@: NO_DB_ASSOCIATED_ERR
3776     @@Description:
3777     @@@lang:en
3778     @@@@:
3779     No <QUOTE::dis> database is associated to this document.
3780    
3781     ElementTypeBinding:
3782     @Name: XConstGroupDef
3783     @ElementType:
3784     dis:ResourceDef
3785     @ShadowContent:
3786     @@rdf:type:
3787     ManakaiDOM:ConstGroup
3788     @@Type:
3789     DOMMain:unsigned-short::ManakaiDOM:all
3790     @@rdfs:subClassOf:
3791     DOMMain:unsigned-short::ManakaiDOM:all
3792    
3793     ElementTypeBinding:
3794     @Name: XConstDef
3795     @ElementType:
3796     dis:ResourceDef
3797     @ShadowContent:
3798     @@rdf:type:
3799     ManakaiDOM:Const
3800    
3801     ElementTypeBinding:
3802     @Name: XSubTypeDef
3803     @ElementType:
3804     dis:ResourceDef
3805     @ShadowContent:
3806     @@rdf:type:
3807     ManakaiDOM:ExceptionOrWarningSubType
3808    
3809     ElementTypeBinding:
3810     @Name: XParam
3811     @ElementType:
3812     ManakaiDOM:exceptionOrWarningParameter
3813    
3814     ElementTypeBinding:
3815     @Name: XParamDef
3816     @ElementType:
3817     dis:ResourceDef
3818     @ShadowContent:
3819     @@rdf:type:
3820     DOMMain:XWParameter
3821     @@AliasFor:
3822     @@@For:
3823     !=ManakaiDOM:all
3824     @@@@:
3825     ::ManakaiDOM:all
3826    
3827     ElementTypeBinding:
3828     @Name: enMufDef
3829     @ElementType:
3830     dis:Def
3831     @ShadowContent:
3832     @@ContentType:
3833     lang:muf
3834     @@lang:en
3835    

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24