/[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.33 - (hide annotations) (download)
Sun May 8 14:18:02 2005 UTC (20 years, 2 months ago) by wakaba
Branch: MAIN
Changes since 1.32: +194 -25 lines
Element-type specialized class implemented; interface association bug fixed

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 wakaba 1.14 This module provides an object model for <QUOTE::dis> document format.
15 wakaba 1.1
16     @Author:
17     @@FullName: Wakaba
18     @@Mail: w@suika.fam.cx
19     @License:
20     @@@:
21     license:Perl+MPL
22     @@Original:
23     @@@FullName:
24 wakaba 1.19 manakai <CODE::lib/manakai/dis.pl> and <CODE::bin/cdis2pm.pl>
25 wakaba 1.1 @@@Year:2004
26     @@@Author:
27     @@@@FullName:Wakaba
28     @@@@Mail:w@suika.fam.cx
29     @Date:
30     @@@:
31 wakaba 1.33 $Date: 2005/05/07 13:56:36 $
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 wakaba 1.12 @@Module:
47     @@@Name: PerlCode
48     @@@WithFor:
49     ManakaiDOM:Perl
50 wakaba 1.3
51     @DefaultFor:
52     DIS:ForLatest
53 wakaba 1.1
54     Namespace:
55     @DIS:
56     http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/DIS#
57     @dis:
58     http://suika.fam.cx/~wakaba/archive/2004/8/18/lang#dis--
59     @dis2pm:
60     http://suika.fam.cx/~wakaba/archive/2004/11/8/dis2pm#
61 wakaba 1.5 @DISlib:
62     http://suika.fam.cx/~wakaba/archive/2004/dis/
63 wakaba 1.13 @disPerl:
64     http://suika.fam.cx/~wakaba/archive/2004/8/18/lang#dis--Perl--
65 wakaba 1.3 @DOMCore:
66     http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#
67 wakaba 1.30 @DOMException:
68     http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/Error/DOMException#
69 wakaba 1.3 @DOMLS:
70     http://suika.fam.cx/~wakaba/archive/2004/dom/ls#
71     @DOMMain:
72     http://suika.fam.cx/~wakaba/archive/2004/dom/main#
73     @infoset:
74     http://www.w3.org/2001/04/infoset#
75 wakaba 1.1 @lang:
76     http://suika.fam.cx/~wakaba/archive/2004/8/18/lang#
77     @license:
78     http://suika.fam.cx/~wakaba/archive/2004/8/18/license#
79     @ManakaiDOM:
80     http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom#
81 wakaba 1.5 @Markup:
82     http://suika.fam.cx/~wakaba/archive/2005/manakai/Markup#
83 wakaba 1.3 @MDOMX:
84     http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#
85 wakaba 1.1 @owl:
86     http://www.w3.org/2002/07/owl#
87     @Perl:
88     http://suika.fam.cx/~wakaba/archive/2004/8/18/lang#Perl--
89     @rdf:
90     http://www.w3.org/1999/02/22-rdf-syntax-ns#
91     @rdfs:
92     http://www.w3.org/2000/01/rdf-schema#
93 wakaba 1.32 @s:
94     http://suika.fam.cx/~wakaba/archive/2004/dis/Markup#
95 wakaba 1.3 @swcfg21:
96     http://suika.fam.cx/~wakaba/archive/2005/swcfg21#
97 wakaba 1.1 @TreeCore:\
98     @Util:
99     http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/
100    
101     ## -- "For" definitions
102    
103     ForDef:
104     @QName:
105     DIS:ForLatest
106     @Description:
107     @@lang:en
108     @@@:
109     For latest version of the <Module::Util:DIS> module implementation
110     @ISA:
111     ManakaiDOM:Perl
112    
113     ## -- Features
114    
115     ElementTypeBinding:
116     @Name: FeatureDef
117     @ElementType:
118     dis:ResourceDef
119     @ShadowContent:
120     @@rdf:type:
121     DOMMain:DOMFeature
122 wakaba 1.24 @@ForCheck:
123     ManakaiDOM:all
124 wakaba 1.1
125     ElementTypeBinding:
126     @Name: FeatureVerDef
127     @ElementType:
128     dis:ResourceDef
129     @ShadowContent:
130     @@rdf:type:
131     DOMMain:DOMFeature
132    
133     ElementTypeBinding:
134     @Name: featureQName
135     @ElementType:
136     dis:AppName
137     @ShadowContent:
138     @@ContentType:
139     dis:TypeQName
140    
141     FeatureDef:
142     @QName: Core
143     @FeatureVerDef:
144     @@QName: CoreFeature10
145     @@Version: 1.0
146 wakaba 1.24 @@DOMMetaImpl:instanceFeatureOf: Core
147 wakaba 1.1 @@FullName:
148     @@@lang:en
149     @@@@:
150     The <QUOTE::dis> object model, version 1.0
151     @@Description:
152     @@@lang:en
153     @@@@:
154     The <QUOTE::dis> object model, version 1.0.
155     @@DOMMain:requireFeature:
156     swcfg21:CoreFeature21
157    
158     ## -- SuikaWikiConfig/2.1 extended classes
159    
160     ClsDef:
161     @ClsQName: ManakaiDISImplementation
162     @ClsISA:
163 wakaba 1.3 swcfg21:ManakaiSWCFGImplementation::swcfg21:ForLatest
164 wakaba 1.1 @Description:
165     @@lang:en
166     @@@:
167     A <QUOTE::dis> implementation object.
168    
169     @Method:
170     @@Name: createDISDocument
171     @@Description:
172     @@@lang:en
173     @@@@:
174     Creates an empty <Class::ManakaiDISDocument> object.
175     @@Return:
176     @@@Type:ManakaiDISDocument
177     @@@Description:
178     @@@@lang:en
179     @@@@@:
180     The newly created <QUOTE::dis> document object.
181     @@@PerlDef:
182 wakaba 1.29 $r = bless $self-><M::swcfg21:SWCFGImplementation::swcfg21:ForLatest
183     .createSWCFGDocument>,
184     <ClassName::ManakaiDISDocument>;
185 wakaba 1.3 $r-><AS::swcfg21:SWCFGDocument::swcfg21:ForLatest
186     .defaultElementTypeNamespaceURI>
187 wakaba 1.1 (<Q::dis:>);
188    
189     @Method:
190 wakaba 1.2 @@Name: createDISParser
191     @@Description:
192     @@@lang:en
193     @@@@:
194 wakaba 1.1 Creates a <Class::ManakaiDISParser> object.
195 wakaba 1.2 @@Return:
196     @@@Type: ManakaiDISParser
197     @@@Description:
198     @@@@lang:en
199     @@@@@:
200 wakaba 1.1 A newly created <QUOTE::dis> parser.
201 wakaba 1.2 @@@PerlDef:
202 wakaba 1.3 $r = bless $self-><M::swcfg21:SWCFGImplementation::swcfg21:ForLatest
203     .createSWCFGParser>,
204 wakaba 1.1 <ClassName::ManakaiDISParser>;
205    
206     @Method:
207 wakaba 1.2 @@Name: createDISDatabase
208 wakaba 1.1 @@Description:
209     @@@lang:en
210     @@@@:
211 wakaba 1.2 Creates a new <QUOTE::dis> database.
212 wakaba 1.1 @@Return:
213 wakaba 1.2 @@@Type:ManakaiDISDatabase
214 wakaba 1.4 @@@Description:
215     @@@@lang:en
216     @@@@@:
217 wakaba 1.2 A newly created <QUOTE::dis> parser.
218 wakaba 1.4 @@@PerlDef:
219 wakaba 1.2 $r = bless {
220     forDef => {
221 wakaba 1.5 <Q::ManakaiDOM:all> => bless ({
222 wakaba 1.2 uri => <Q::ManakaiDOM:all>,
223     isa => {<Q::ManakaiDOM:all> => 1},
224     revISA => {},
225 wakaba 1.5 }, <ClassName::ManakaiDISForDefinition>),
226 wakaba 1.2 },
227     resDef => {},
228 wakaba 1.9 modDef => {},
229     seq => 0,
230 wakaba 1.3 }, <ClassName::ManakaiDISDatabase>;
231    
232     @Method:
233     @@Name: tfurisToURI
234     @@Description:
235     @@@lang:en
236     @@@@:
237     Converts a pair of name URI reference and <QUOTE::for> URI reference
238     into a <TYPE::dis:TFQNames>-expanded URI reference.
239     @@Param:
240     @@@Name: typeURI
241     @@@Type: NameURI
242     @@@Description:
243     @@@@lang:en
244     @@@@@:
245     A URI reference to identify a resource.
246     @@@InCase:
247     @@@@Value:
248     @@@@@is-null:1
249     @@@@Description:
250     @@@@@lang:en
251     @@@@@@:
252     Equivalent to <Q::DOMMain:any> (for historical reason).
253     @@Param:
254     @@@Name: forURI
255     @@@Type: ForURI
256     @@@Description:
257     @@@@lang:en
258     @@@@@:
259     A <QUOTE::for> URI reference.
260     @@@InCase:
261     @@@@Value:
262     @@@@@is-null:1
263     @@@@Description:
264     @@@@@lang:en
265     @@@@@@:
266     Equivalent to <QUOTE::for all>, i.e. <Q::ManakaiDOM:all>.
267     @@Return:
268     @@@Type:
269     DISCore:TFURI::ManakaiDOM:all
270     @@@Description:
271     @@@@lang:en
272     @@@@@:
273     The <TYPE::dis:TFQNames>-expanded URI references.
274     @@@PerlDef:
275     $typeURI = <Q::DOMMain:any> unless defined $typeURI;
276     $forURI = <Q::ManakaiDOM:all> unless defined $forURI;
277 wakaba 1.4 __CODE{tfurisToURI:: $turi => $typeURI, $furi => $forURI, $uri => $r}__;
278    
279     @ResourceDef:
280     @@QName: tfurisToURI
281     @@rdf:type:
282     dis2pm:BlockCode
283     @@enDesc:
284     Converts a pair of name URI reference and <QUOTE::for> URI reference
285     into a <TYPE::dis:TFQNames>-expanded URI reference.
286     @@PerlDef:
287     if ($furi eq <Q::ManakaiDOM:all>) {
288     $uri = $turi;
289 wakaba 1.3 } else {
290     ## NOTE: [RFC 3986]
291     ## fragment := *(pchar / "/" / "?")
292     ## pchar := unreserved / pct-encoded / sub-delims / [:@]
293     ## unreserved := ALPHA / DIGIT / [._~-]
294     ## sub-delims := [!$&'()*+,;=]
295     ## NOTE: [XPointer Framework]
296     ## SchemeData := *EscapedData
297     ## EscapedData := NormalChar / "^(" / "^)" / "^^"
298     ## / "(" SchemeData ")"
299     ## NormalChar := UnicodeChar - [()^]
300 wakaba 1.5 my $__turi = $turi;
301     my $__furi = $furi;
302     for my $__uri ($__turi, $__furi) {
303 wakaba 1.4 $__uri =~ s{([^0-9A-Za-z:;?=_./-])}{sprintf '%%%02X', ord $1}ge;
304 wakaba 1.3 }
305 wakaba 1.4 $uri = qq<data:,200411tf#xmlns(t=data:,200411tf%23)>.
306 wakaba 1.5 qq<t:tf($__turi,$__furi)>;
307 wakaba 1.3 }
308 wakaba 1.2
309 wakaba 1.5 @ResourceDef:
310 wakaba 1.6 @@QName: tfpurisToURI
311     @@rdf:type:
312     dis2pm:BlockCode
313     @@enDesc:
314     Converts a set of name URI reference and <QUOTE::for> URI reference
315     and <QUOTE::for+> URI references into a URi reference.
316     @@PerlDef:
317     if ($furi eq <Q::ManakaiDOM:all> and @{$forp} == 0) {
318     $uri = $turi;
319     } elsif (@{$forp}) {
320     my $__turi = $turi;
321     my $__furi = $furi;
322     for my $__uri ($__turi, $__furi) {
323     $__uri =~ s{([^0-9A-Za-z:;?=_./~!&+-])}{sprintf '%%%02X', ord $1}ge;
324     }
325     my @__fp;
326     for my $__uri (@{$forp}) {
327     my $__fpuri = $__uri;
328     $__fpuri =~ s{([^0-9A-Za-z:;?=_./~!&+-])}
329     {sprintf '%%%02X', ord $1}ge;
330     push @__fp, $__fpuri;
331     }
332     $uri = qq<data:,200411tf#xmlns(t=data:,200411tf%23)>.
333     qq<t:tfp($__turi,$__furi,>.join (',', @__fp).q<)>;
334     } else {
335     my $__turi = $turi;
336     my $__furi = $furi;
337     for my $__uri ($__turi, $__furi) {
338     $__uri =~ s{([^0-9A-Za-z:;?=_./-])}{sprintf '%%%02X', ord $1}ge;
339     }
340     $uri = qq<data:,200411tf#xmlns(t=data:,200411tf%23)>.
341     qq<t:tf($__turi,$__furi)>;
342     }
343    
344     @ResourceDef:
345 wakaba 1.5 @@QName: getChildResourceURI
346     @@rdf:type:
347     dis2pm:BlockCode
348     @@enDesc:
349     Gets an anonymous URI reference of a child resource of another
350     resource.
351     @@PerlDef:
352     my $__parent = $parentURI;
353     my $__ln = $localName;
354     for my $__uri ($__parent, $__ln) {
355 wakaba 1.6 $__uri =~ s{([^0-9A-Za-z:;?=_./~!&+-])}{sprintf '%%%02X', ord $1}ge;
356 wakaba 1.5 }
357     $result = q<data:,200411tf#xmlns(t=data:,200411tf%23)>.
358     qq<t:child($__parent,$__ln)>;
359    
360 wakaba 1.8 @IntMethod:
361     @@Name: camelCaseToUnderscoreName
362     @@enDesc:
363     Converts a camelCase name to a underscored_name.
364     @@ManakaiDOM:isStatic:1
365     @@Param:
366     @@@Name: camelName
367     @@@Type:
368 wakaba 1.18 DISLang:String::ManakaiDOM:all
369 wakaba 1.8 @@@enDesc:
370     The source name.
371     @@Return:
372     @@@Type:
373 wakaba 1.18 DISLang:String::ManakaiDOM:all
374 wakaba 1.8 @@@enDesc:
375     The result name.
376     @@@PerlDef:
377     $r = $camelName;
378     $r =~ s/^([A-Z0-9]+)$/lc $1/ge;
379     $r =~ s/([A-Z][A-Z0-9]*)$/"_".lc $1/ge;
380     $r =~ s/([A-Z0-9])([A-Z0-9]*)([A-Z0-9])/$1.lc ($2)."_".lc $3/ge;
381     $r =~ s/([A-Z])/"_".lc $1/ge;
382     $r =~ s/(?=[0-9](?!$))/_/g;
383 wakaba 1.9
384     @Method:
385     @@Name: plLoadDISDatabase
386     @@enDesc:
387     Loads a database from a file that was saved by
388     <M::ManakaiDISDatabase.plStore>.
389     \
390     {NOTE:: <QUOTE::dis> documents restored from external file
391     would have different <A::ManakaiDISDocument.implementation>
392     than this <Class::ManakaiDISImplementation>, even if
393     it has been created by this implementation
394     and stored in the same session.
395     \
396     }
397     @@Param:
398     @@@Name:fileName
399     @@@Type:
400 wakaba 1.18 DISLang:String::ManakaiDOM:all
401 wakaba 1.9 @@@enDesc:
402     An environment-dependent file name.
403     @@Return:
404     @@@Type: ManakaiDISDatabase
405     @@@SimpleException:
406     @@@PerlDef:
407     use Storable qw/retrieve/;
408     local $Carp::CarpLevel = $Carp::CarpLevel + 1;
409     $r = retrieve $fileName;
410    
411     ## Restores weak references
412     require Scalar::Util;
413     for my $doc (values %{$r->{<Q::DIS:sourceFile>}}) {
414     Scalar::Util::weaken ($doc->{<Q::TreeCore:node>}->{<Q::DIS:db>});
415     }
416     for my $def (values %{$r->{modDef}},
417     values %{$r->{forDef}},
418     values %{$r->{resDef}}) {
419     Scalar::Util::weaken ($def->{db});
420     }
421 wakaba 1.24
422     @DOMMetaImpl:provideFeature: CoreFeature10
423 wakaba 1.1 ##DISImplementation
424    
425 wakaba 1.9 ElementTypeBinding:
426     @Name: SimpleException
427     @ElementType:
428     dis:Description
429     @ShadowContent:
430     @@lang:en
431     @@@:
432     - Exception of type <PerlModule::Error::Simple>:::
433     I/O error or other error reported by <PerlModule::Storable>.
434    
435     ## TODO: Formal description required for simple exception
436    
437 wakaba 1.1 ClsDef:
438     @ClsQName: ManakaiDISParser
439     @ClsISA:
440 wakaba 1.3 swcfg21:ManakaiSWCFGParser::swcfg21:ForLatest
441 wakaba 1.1 @Description:
442     @@lang:en
443     @@@:
444     A SuikaWikiConfig/2.1 parser that returns <QUOTE::dis> object.
445     @Method:
446 wakaba 1.3 @@Name: parse
447     @@Description:
448     @@@lang:en
449     @@@@:
450 wakaba 1.1 Parses a <QUOTE::dis> document and returns it as an object tree.
451 wakaba 1.3 @@Param:
452     @@@Name: input
453     @@@Type:
454     DOMLS:LSInput::ManakaiDOM:ManakaiDOM3
455     @@@Description:
456     @@@@lang:en
457     @@@@@:
458 wakaba 1.1 The input source.
459 wakaba 1.3 @@Return:
460     @@@Type: ManakaiDISDocument
461     @@@Description:
462     @@@@lang:en
463     @@@@@:
464 wakaba 1.1 The <QUOTE::dis> document object created from the <P::input>.
465     @@@RaiseException:
466     @@@@@:
467     swcfg21:SWCFG_PARSE_ERR
468     @@@@Description:
469     @@@@@lang:en
470     @@@@@@:
471     The <IF::swcfg21:SWCFGParser> was unable to load the SuikaWikiConfig
472     document.
473     @@@PerlDef:
474     __DEEP{
475 wakaba 1.28 $r = $self->SUPER::parse ($input)
476     ## NOTE: Method name directly written
477     #< M::swcfg21:ManakaiSWCFGParser
478     # ::swcfg21:ForLatest.parse> ($input)
479 wakaba 1.1 }__;
480     if (defined $r) {
481     $r = bless $r, <ClassName::ManakaiDISDocument>;
482 wakaba 1.4 $r-><AS::swcfg21:SWCFGDocument::swcfg21:ForLatest
483     .defaultElementTypeNamespaceURI>
484     (<Q::dis:>);
485 wakaba 1.1 }
486     ##DISParser
487    
488     ClsDef:
489     @ClsQName: ManakaiDISNode
490     @Description:
491     @@lang:en
492     @@@:
493     <QUOTE::dis> node objects.
494 wakaba 1.7 @ImplNote:
495     @@lang:en
496     @@@:
497     This class does not inherit
498     <Class::swcfg21:ManakaiSWCFGNode::swcfg21:ForLatest>, since
499     inheriting classes such as <Class::ManakaiDISElement> indirectly
500     inherit it.
501 wakaba 1.1
502     @MethodRedef:
503     @@Name:lookupNamespacePrefix
504     @@Description:
505     @@@lang:en
506     @@@@:
507     Looks up the namespace prefix associated to the given
508     namespace URI. The default namespaces are ignored.
509     @@Param:
510     @@@Name:namespaceURI
511 wakaba 1.3 @@@Type: AnyURI
512 wakaba 1.1 @@@Description:
513     @@@@lang:en
514     @@@@@:
515     The namespace URI to look for.
516     @@@InCase:
517     @@@@Value:
518     @@@@@is-null:1
519     @@@@Description:
520     @@@@@lang:en
521     @@@@@@:
522     The <DOM::null> namespace.
523     @@NamedParam:
524     @@@Name: makeNewBinding
525     @@@Type:
526 wakaba 1.18 DOMMain:boolean::ManakaiDOM:all
527 wakaba 1.1 @@@Description:
528     @@@@lang:en
529     @@@@@:
530     Whether a new namespace prefix should be bound when
531     no namespace URI has been associated yet.
532     @@@InCase:
533     @@@@Value:true
534     @@@@Description:
535     @@@@@lang:en
536     @@@@@@:
537     New binding is made if no prefix associated.
538     @@@InCase:
539     @@@@Value:false
540     @@@@Description:
541     @@@@@lang:en
542     @@@@@@:
543     Simply returns the <DOM::null> if no prefix associated.
544     @@Return:
545     @@@Type:
546 wakaba 1.3 DISCore:NamespacePrefix::ManakaiDOM:all
547 wakaba 1.1 @@@Description:
548     @@@@lang:en
549     @@@@@:
550     An associated namespace prefix. If more than one prefix
551     are associated to the namespace URI, the returned prefix
552     is implementation dependent.
553     @@@InCase:
554     @@@@Value:
555     @@@@@is-null:1
556     @@@@Description:
557     @@@@@lang:en
558     @@@@@@:
559     No associated namespace prefix found.
560     @@@PerlDef:
561     $r = null;
562 wakaba 1.3 my $od = $self-><AG::swcfg21:SWCFGNode::swcfg21:ForLatest
563     .ownerDocument> || $self;
564 wakaba 1.7 my $binds = $od->{<Q::TreeCore:node>}->{<Q::swcfg21:nsBinding>};
565 wakaba 1.1 if (defined $namespaceURI) {
566     FIND: {
567     for my $prefix (keys %$binds) {
568     if (defined $binds->{$prefix} and
569     $binds->{$prefix} eq $namespaceURI) {
570     $r = $prefix;
571     last FIND;
572     }
573     }
574 wakaba 1.7
575     ## From module list
576     try {
577     my $db = $self-><AG::ManakaiDISNode.ownerDISDocument>
578     -><AG::ManakaiDISDocument.disDatabase>;
579     for my $mod_uri (keys %{$db->{modDef}}) {
580     my $mod = $db-><M::ManakaiDISDatabase.getModule> ($mod_uri);
581     my $mod_ln = $mod-><AG::ManakaiDISModuleDefinition.localName>;
582     next if exists $binds->{$mod_ln};
583     my $ns_uri = $mod-><M::ManakaiDISPropertyAccessor
584     .getPropertyText>
585     (<Q::dis:Namespace>, '');
586     if ($ns_uri eq $namespaceURI) {
587     $r = $mod_ln;
588     last FIND;
589     }
590     }
591     } catch <Class::ManakaiDISException> with {
592     my $err = shift;
593     $err->throw
594     unless $err->{<Q::MDOMX:subtype>} eq <Q::NO_DB_ASSOCIATED_ERR>;
595     };
596    
597 wakaba 1.1 last FIND unless $makeNewBinding;
598     ## Not found
599     if ($namespaceURI =~ /(\w+)$/) {
600     my $prefix = $1;
601     unless (exists $binds->{$prefix}) {
602     $binds->{$prefix} = $namespaceURI;
603     $r = $prefix;
604     last FIND;
605     }
606     }
607     my $i = 1;
608     {
609     unless (exists $binds->{'ns'.$i}) {
610     $binds->{$r = 'ns'.$i} = $namespaceURI;
611     last FIND;
612     }
613     $i++;
614     redo;
615     }
616     } # FIND
617     } else { ## Null namespace
618     FIND: {
619     if (exists $binds->{'nu'.'ll'} and not defined $binds->{'nu'.'ll'}) {
620     $r = 'nu'.'ll';
621     last FIND;
622     }
623     for my $prefix (keys %$binds) {
624     if (not defined $prefix) {
625     $r = $prefix;
626     last FIND;
627     }
628     }
629     last FIND unless $makeNewBinding;
630     ## Not found
631     my $i = '';
632     {
633     unless (exists $binds->{'nu'.'ll'.$i}) {
634     $binds->{$r = 'nu'.'ll'.$i} = null;
635     last FIND;
636     }
637     $i++;
638     redo;
639     }
640     }
641     }
642    
643     @MethodRedef:
644     @@Name:lookupNamespaceURI
645     @@Description:
646     @@@lang:en
647     @@@@:
648     Looks up the namespace URI associated to the given prefix.
649     @@Param:
650     @@@Name:prefix
651     @@@Type:
652 wakaba 1.3 DISCore:NamespacePrefix::ManakaiDOM:all
653 wakaba 1.1 @@@Description:
654     @@@@lang:en
655     @@@@@:
656     The namespace URI to look for.
657     @@NamedParam:
658     @@@Name: makeNewBinding
659     @@@Type:
660 wakaba 1.18 DOMMain:boolean::ManakaiDOM:all
661 wakaba 1.1 @@@Description:
662     @@@@lang:en
663     @@@@@:
664     Whether a new binding should be created if no namespace URI
665     is associated with the <P::prefix> or not.
666     @@@InCase:
667     @@@@Value:true
668     @@@@Description:
669     @@@@@lang:en
670     @@@@@@:
671     A new binding to the temporary namespace URI
672     exactly same as <P::prefix> is created
673     if no binding found.
674     @@@InCase:
675     @@@@Value:false
676     @@@@Description:
677     @@@@@lang:en
678     @@@@@@:
679     No new binding is created if no binding found. Note that
680     even if no association newly created, this method
681     returns the <DOM::null> value.
682 wakaba 1.12 @@NamedParam:
683     @@@Name: raisePrefixException
684     @@@Type:
685 wakaba 1.18 DOMMain:boolean::ManakaiDOM:all
686 wakaba 1.12 @@@enDesc:
687     Whehter an exception should be thrown if <P::prefix>
688     is not declared or not.
689 wakaba 1.1 @@Return:
690 wakaba 1.3 @@@Type: AnyURI
691 wakaba 1.1 @@@Description:
692     @@@@lang:en
693     @@@@@:The associated namespace URI.
694     @@@InCase:
695     @@@@Value:
696     @@@@@is-null:1
697     @@@@Description:
698     @@@@@lang:en
699     @@@@@@:
700 wakaba 1.3 No namespace URI is associated to the prefix or
701 wakaba 1.1 the <DOM::null> namespace is associated.
702 wakaba 1.12 @@@UndeclaredPrefixException:
703 wakaba 1.1 @@@PerlDef:
704 wakaba 1.3 my $od = $self-><AG::swcfg21:SWCFGNode::swcfg21:ForLatest
705     .ownerDocument> || $self;
706 wakaba 1.7 my $binds = $od->{<Q::TreeCore:node>}->{<Q::swcfg21:nsBinding>};
707 wakaba 1.1 if (exists $binds->{$prefix}) {
708     $r = $binds->{$prefix};
709     } else {
710 wakaba 1.7 ## From module list
711     FIND: {
712     try {
713     my $db = $self-><AG::ManakaiDISNode.ownerDISDocument>
714     -><AG::ManakaiDISDocument.disDatabase>;
715     for my $mod_uri (keys %{$db->{modDef}}) {
716     my $mod = $db-><M::ManakaiDISDatabase.getModule> ($mod_uri);
717     if ($mod-><AG::ManakaiDISModuleDefinition.localName>
718     eq $prefix) {
719     $r = $mod-><M::ManakaiDISPropertyAccessor
720     .getPropertyText>
721     (<Q::dis:Namespace>, null);
722     last FIND;
723     }
724     }
725     } catch <Class::ManakaiDISException> with {
726     my $err = shift;
727     $err->throw
728     unless $err->{<Q::MDOMX:subtype>} eq <Q::NO_DB_ASSOCIATED_ERR>;
729     };
730     if ($makeNewBinding) {
731     $r = $binds->{$prefix} = $prefix;
732 wakaba 1.12 } elsif ($raisePrefixException) {
733     __EXCEPTION{DIS:UNDECLARED_NS_PREFIX_ERR::
734     infoset:prefix => {$prefix},
735     MDOMX:param-name => 'prefix',
736     DIS:sourceNode => {$self},
737     }__;
738 wakaba 1.7 } else {
739     $r = null;
740     }
741     } # FIND
742 wakaba 1.1 }
743    
744     @IntMethod:
745     @@Name:getNodeReference
746     @@Description:
747     @@@lang:en
748     @@@@:
749     Returns a new reference to the node object.
750     @@ManakaiDOM:isStatic:1
751     @@Param:
752     @@@Name:object
753     @@@Type:
754     ManakaiDOM:ManakaiDOMNodeObject::ManakaiDOM:Perl
755     @@@Description:
756     @@@@lang:en
757     @@@@@:
758     The node object to be referred.
759     @@Return:
760     @@@Type: ManakaiDISNode
761     @@@Description:
762     @@@@lang:en
763     @@@@@:
764     A newly created reference.
765     @@@PerlDef:
766     my $class;
767 wakaba 1.5 if ($object->{<Q::swcfg21:nodeType>} eq '#element') {
768 wakaba 1.1 $class = <ClassName::ManakaiDISElement>;
769 wakaba 1.5 } elsif ($object->{<Q::swcfg21:nodeType>} eq '#comment') {
770 wakaba 1.1 $class = <ClassName::ManakaiDISComment>;
771 wakaba 1.5 } elsif ($object->{<Q::swcfg21:nodeType>} eq '#document') {
772 wakaba 1.1 $class = <ClassName::ManakaiDISDocument>;
773 wakaba 1.5 } elsif ($object->{<Q::swcfg21:nodeType>} eq '#fragment') {
774 wakaba 1.1 $class = <ClassName::ManakaiDISDocumentFragment>;
775     } else {
776     __ASSERT{DISPerl:invariant::
777 wakaba 1.5 msg => {qq[Node type: "$object->{<Q::swcfg21:nodeType>}" ].
778 wakaba 1.1 qq[(ref: "@{[ref $object]}")]},
779     }__;
780     }
781     $r = $object-><M::ManakaiDOM:ManakaiDOMNodeObject::ManakaiDOM:Perl
782     .newReference> ($class);
783    
784 wakaba 1.2 @Attr:
785     @@Name:ownerDISDocument
786     @@Description:
787     @@@lang:en
788     @@@@:
789     The <QUOTE::dis> document object associated with this node.
790     @@Get:
791 wakaba 1.3 @@@Type:ManakaiDISDocument
792 wakaba 1.2 @@@Description:
793     @@@@lang:en
794     @@@@@:
795     The document object associated with this node.
796     @@@InCase:
797     @@@@Value:
798     @@@@@is-null:1
799     @@@@Description:
800     @@@@@lang:en
801     @@@@@@:
802     This node is a document node.
803     @@@PerlDef:
804     $r = <ClassM::ManakaiDISNode.getNodeReference>
805 wakaba 1.22 ($self->{<Q::TreeCore:node>}->{<Q::swcfg21:ownerDocument>})
806     if $self->{<Q::TreeCore:node>}->{<Q::swcfg21:ownerDocument>};
807 wakaba 1.1 ##DISNode
808    
809     ClsDef:
810     @ClsQName: ManakaiDISElement
811 wakaba 1.7 @ClsISA: ManakaiDISNode
812 wakaba 1.1 @ClsISA:
813 wakaba 1.3 swcfg21:ManakaiSWCFGElement::swcfg21:ForLatest
814 wakaba 1.1 @Description:
815     @@lang:en
816     @@@:
817     <QUOTE::dis> element node objects.
818    
819     @Method:
820     @@Name: forMatch
821     @@Description:
822     @@@lang:en
823     @@@@:
824     Tests whether this element is for a <QUOTE::for> or not.
825     @@Param:
826     @@@Name: forArg
827     @@@Type: ForURI
828     @@@Description:
829     @@@@lang:en
830     @@@@@:
831     The <QUOTE::For> URI reference to test against.
832     @@Param:
833     @@@Name: forpArg
834     @@@Type: ForURIList
835     @@@Description:
836     @@@@lang:en
837     @@@@@:
838     The <QUOTE::For+> URI references to test against.
839     @@@InCase:
840     @@@@Value:
841     @@@@@is-null:1
842     @@@@Description:
843     @@@@@lang:en
844     @@@@@@:
845     No additional <QUOTE::For> URI reference.
846 wakaba 1.3 Equivalent to an empty array reference.
847 wakaba 1.1 @@Return:
848     @@@Type:
849 wakaba 1.18 DOMMain:boolean::ManakaiDOM:all
850 wakaba 1.1 @@@Description:
851     @@@@lang:en
852     @@@@@:
853     Whether this element is for <P::forArg> and <P::forpArg> or not.
854 wakaba 1.2 @@@UndeclaredPrefixException:
855     @@@NoDBException:
856     @@@PerlDef:
857 wakaba 1.3 $forArg = <Q::ManakaiDOM:all> unless defined $forArg;
858     $forpArg ||= [];
859 wakaba 1.2
860     FORMATCH: {
861     __DEEP{
862 wakaba 1.10 my $for_res = $self-><AG::ManakaiDISNode.ownerDISDocument>
863     -><AG::ManakaiDISDocument.disDatabase>
864     -><M::ManakaiDISDatabase.getFor> ($forArg);
865     my $forp_res = [map {
866     $self-><AG::ManakaiDISNode.ownerDISDocument>
867     -><AG::ManakaiDISDocument.disDatabase>
868     -><M::ManakaiDISDatabase.getFor> ($_)
869     } @{$forpArg}];
870    
871     my @ce = @{$self-><M::ManakaiDISElement.disAllChildElements>};
872 wakaba 1.2 for my $ce (@ce) {
873 wakaba 1.3 my $et = $ce-><AG::swcfg21:SWCFGElement::swcfg21:ForLatest
874     .expandedURI>;
875 wakaba 1.2 if ($et eq <Q::dis:ForCheck>) {
876 wakaba 1.14 my $fors = [split /\s+/, $ce-><M::swcfg21:SWCFGNode
877     ::swcfg21:ForLatest.value>];
878 wakaba 1.9 FCs: for my $f (@$fors) {
879 wakaba 1.2 if ($f =~ /^!=(.+)$/) { ## -- NOT EQUAL TO
880 wakaba 1.14 my $uri = $self-><M::ManakaiDISElement.qnameToURI> ($1);
881 wakaba 1.9 my $for = $self-><AG::ManakaiDISNode.ownerDISDocument>
882     -><AG::ManakaiDISDocument.disDatabase>
883     -><M::ManakaiDISDatabase.getFor> ($uri);
884 wakaba 1.14 $for-><AS::ManakaiDISForDefinition.isReferred> ($ce);
885 wakaba 1.10 for my $arg_res ($for_res, @{$forp_res}) {
886     if ($arg_res eq $for) {
887 wakaba 1.2 $r = false;
888     last FORMATCH;
889     }
890     }
891     } elsif ($f =~ /^!(.+)$/) { ## -- NOT ISA
892 wakaba 1.14 my $uri = $self-><M::ManakaiDISElement.qnameToURI> ($1);
893 wakaba 1.9 my $for = $self-><AG::ManakaiDISNode.ownerDISDocument>
894     -><AG::ManakaiDISDocument.disDatabase>
895     -><M::ManakaiDISDatabase.getFor> ($uri);
896 wakaba 1.14 $for-><AS::ManakaiDISForDefinition.isReferred> ($ce);
897 wakaba 1.10 for my $arg_res ($for_res, @{$forp_res}) {
898     if ($arg_res-><M::ManakaiDISForDefinition.isaURI> ($uri)) {
899 wakaba 1.2 $r = false;
900     last FORMATCH;
901     }
902     }
903     } elsif ($f =~ /^=(.+)$/) { ## -- EQUAL TO
904 wakaba 1.14 my $uri = $self-><M::ManakaiDISElement.qnameToURI> ($1);
905 wakaba 1.9 my $for = $self-><AG::ManakaiDISNode.ownerDISDocument>
906     -><AG::ManakaiDISDocument.disDatabase>
907     -><M::ManakaiDISDatabase.getFor> ($uri);
908 wakaba 1.14 $for-><AS::ManakaiDISForDefinition.isReferred> ($ce);
909 wakaba 1.10 for my $arg_res ($for_res, @{$forp_res}) {
910     if ($arg_res eq $for) {
911 wakaba 1.2 next FCs;
912     }
913     }
914     $r = false;
915     last FORMATCH;
916     } else { ## -- ISA
917 wakaba 1.14 my $uri = $self-><M::ManakaiDISElement.qnameToURI> ($f);
918 wakaba 1.9 my $for = $self-><AG::ManakaiDISNode.ownerDISDocument>
919     -><AG::ManakaiDISDocument.disDatabase>
920     -><M::ManakaiDISDatabase.getFor> ($uri);
921 wakaba 1.14 $for-><AS::ManakaiDISForDefinition.isReferred> ($ce);
922 wakaba 1.10 for my $arg_res ($for_res, @{$forp_res}) {
923     if ($arg_res-><M::ManakaiDISForDefinition.isaURI> ($uri)) {
924 wakaba 1.2 next FCs;
925     }
926     }
927     $r = false;
928     last FORMATCH;
929     }
930     } # FCs
931     } # dis:ForCheck
932     } # children
933    
934     my $has_for = false;
935     for my $ce (@ce) {
936 wakaba 1.11 if ($ce-><AG::swcfg21:SWCFGElement::swcfg21:ForLatest
937 wakaba 1.3 .expandedURI> eq
938 wakaba 1.2 <Q::dis:For>) {
939 wakaba 1.14 my $fors = [split /\s+/, $ce-><M::swcfg21:SWCFGNode
940     ::swcfg21:ForLatest.value>];
941 wakaba 1.2 my $ok = true;
942     $has_for = true;
943 wakaba 1.9 AFOR: for my $f (@$fors) {
944 wakaba 1.2 if ($f =~ /^!=(.+)$/) { ## -- NOT EQUAL TO
945 wakaba 1.14 my $uri = $self-><M::ManakaiDISElement.qnameToURI> ($1);
946 wakaba 1.9 my $for = $self-><AG::ManakaiDISNode.ownerDISDocument>
947     -><AG::ManakaiDISDocument.disDatabase>
948     -><M::ManakaiDISDatabase.getFor> ($uri);
949 wakaba 1.14 $for-><AS::ManakaiDISForDefinition.isReferred> ($ce);
950 wakaba 1.10 if ($for eq $for_res) {
951 wakaba 1.2 $ok = false;
952     last AFOR;
953     }
954     } elsif ($f =~ /^!(.+)$/) { ## -- NOT ISA
955 wakaba 1.14 my $uri = $self-><M::ManakaiDISElement.qnameToURI> ($1);
956 wakaba 1.9 my $for = $self-><AG::ManakaiDISNode.ownerDISDocument>
957     -><AG::ManakaiDISDocument.disDatabase>
958     -><M::ManakaiDISDatabase.getFor> ($uri);
959 wakaba 1.14 $for-><AS::ManakaiDISForDefinition.isReferred> ($ce);
960 wakaba 1.10 if ($for_res-><M::ManakaiDISForDefinition.isaURI> ($uri)) {
961 wakaba 1.2 $ok = false;
962     last AFOR;
963     }
964     } elsif ($f =~ /^=(.+)$/) { ## -- EQUAL TO
965 wakaba 1.14 my $uri = $self-><M::ManakaiDISElement.qnameToURI> ($1);
966 wakaba 1.9 my $for = $self-><AG::ManakaiDISNode.ownerDISDocument>
967     -><AG::ManakaiDISDocument.disDatabase>
968     -><M::ManakaiDISDatabase.getFor> ($uri);
969 wakaba 1.14 $for-><AS::ManakaiDISForDefinition.isReferred> ($ce);
970 wakaba 1.10 unless ($for eq $for_res) {
971 wakaba 1.2 $ok = false;
972     last AFOR;
973     }
974     } else { ## -- ISA
975 wakaba 1.14 my $uri = $self-><M::ManakaiDISElement.qnameToURI> ($f);
976 wakaba 1.9 my $for = $self-><AG::ManakaiDISNode.ownerDISDocument>
977     -><AG::ManakaiDISDocument.disDatabase>
978     -><M::ManakaiDISDatabase.getFor> ($uri);
979 wakaba 1.14 $for-><AS::ManakaiDISForDefinition.isReferred> ($ce);
980 wakaba 1.10 unless ($for_res-><M::ManakaiDISForDefinition.isaURI>($uri)){
981 wakaba 1.2 $ok = false;
982     last AFOR;
983     }
984     }
985     } # AFOR
986 wakaba 1.3 if ($ok) {
987     $r = true;
988     last FORMATCH;
989     }
990 wakaba 1.2 } # dis:For
991     } # $ce
992     $r = $has_for ? false : true;
993     }__;
994     } # FORMATCH
995 wakaba 1.1
996     @Method:
997     @@Name: mediaTypeMatch
998     @@Description:
999     @@@lang:en
1000     @@@@:
1001     Tests whether the content media type of this element matches to
1002     a type or not.
1003     @@Param:
1004     @@@Name: mediaType
1005     @@@Type: MediaTypeURI
1006     @@@Description:
1007     @@@@lang:en
1008     @@@@@:
1009     A media type URI reference to test against.
1010     @@Param:
1011 wakaba 1.3 @@@Name: defaultMediaType
1012 wakaba 1.1 @@@Type: MediaTypeURI
1013     @@@Description:
1014     @@@@lang:en
1015     @@@@@:
1016     The default media type for this element.
1017     @@@InCase:
1018     @@@@Value:
1019     @@@@@is-null:1
1020     @@@@Description:
1021     @@@@@lang:en
1022     @@@@@@:
1023     No default type provided. All <P::mediaType> will match.
1024 wakaba 1.12 @@ForParam:
1025     @@ForpParam:
1026 wakaba 1.1 @@Return:
1027     @@@Type:
1028 wakaba 1.18 DOMMain:boolean::ManakaiDOM:all
1029 wakaba 1.1 @@@Description:
1030     @@@@lang:en
1031     @@@@@:
1032     Whether this element is of <P::mediaType> or not.
1033 wakaba 1.2 @@@PerlDef:
1034     if (defined $mediaType) {
1035     __DEEP{
1036     my $ctn = $self-><M::ManakaiDISElement.disGetAttribute>
1037 wakaba 1.12 (<Q::dis:ContentType>, for_arg => $forArg,
1038     forp_arg => $forpArg);
1039 wakaba 1.2 my $ct;
1040     $ct = $ctn-><AG::ManakaiDISElement.qnameValueURI> if $ctn;
1041     $ct = $defaultMediaType unless defined $ct;
1042     my $res = $self-><AG::ManakaiDISNode.ownerDISDocument>
1043     -><AG::ManakaiDISDocument.disDatabase>
1044     -><M::ManakaiDISDatabase.getResource> ($ct);
1045     $res-><AS::ManakaiDISResourceDefinition.isReferred> ($ctn or $self);
1046 wakaba 1.7 unless ($res-><M::ManakaiDISResourceDefinition
1047 wakaba 1.10 .isSubsetOfURI> ($mediaType)) {
1048 wakaba 1.2 $r = false;
1049     } else {
1050     $r = true;
1051     }
1052     }__;
1053     } else {
1054     $r = true;
1055     }
1056 wakaba 1.1
1057     @Method:
1058 wakaba 1.10 @@Name:mediaTypeURI
1059     @@enDesc:
1060     The URI reference of the media type of this element.
1061     @@Type: MediaTypeURI
1062     @@NamedParam:
1063     @@@Name:defaultMediaType
1064     @@@Type:MediaTypeURI
1065     @@@enDesc:
1066     The default media type URI reference.
1067     @@@nullCase:
1068     @@@@enDesc:
1069     No default is specified.
1070     @@ForParam:
1071     @@ForpParam:
1072     @@Return:
1073     @@@enDesc:
1074     The media type URI reference of this element.
1075     @@@nullCase:
1076     @@@@enDesc:
1077     This element has no media type information and
1078     <P::defaultMediaType> parameter is not provided.
1079     @@@UndeclaredPrefixException:
1080     @@@PerlDef:
1081     __DEEP{
1082     my $ctn = $self-><M::ManakaiDISElement.disGetAttribute>
1083     (<Q::dis:ContentType>, for_arg => $forArg,
1084     forp_arg => $forpArg);
1085     $r = $ctn-><AG::ManakaiDISElement.qnameValueURI> if $ctn;
1086     }__;
1087    
1088     @Method:
1089 wakaba 1.1 @@Name: prefixToURI
1090     @@Description:
1091     @@@lang:en
1092     @@@@:
1093     Converts a namespace prefix into associated URI reference.
1094     @@Param:
1095     @@@Name: prefix
1096     @@@Type:
1097 wakaba 1.3 DISCore:NamespacePrefix::ManakaiDOM:all
1098 wakaba 1.1 @@@Description:
1099     @@@@lang:en
1100     @@@@@:
1101     A namespace prefix to look for.
1102     @@@InCase:
1103     @@@@Value:
1104     @@@@@is-null:1
1105     @@@@Description:
1106     @@@@@lang:en
1107     @@@@@@:
1108     Returns the default namespace URI.
1109     @@NodeParam:
1110     @@Return:
1111 wakaba 1.3 @@@Type: AnyURI
1112 wakaba 1.1 @@@Description:
1113     @@@@lang:en
1114     @@@@@: The URI references associated.
1115     @@@UndeclaredPrefixException:
1116     @@@PerlDef:
1117 wakaba 1.3 if (defined $prefix) {
1118 wakaba 1.1 __DEEP{
1119 wakaba 1.3 $r = $self-><M::swcfg21:SWCFGNode::swcfg21:ForLatest
1120     .lookupNamespaceURI> ($prefix);
1121 wakaba 1.1 }__;
1122     unless (defined $r) {
1123     __EXCEPTION{UNDECLARED_NS_PREFIX_ERR::
1124     infoset:prefix => {$prefix},
1125     MDOMX:param-name => 'prefix',
1126     DIS:sourceNode => {$node},
1127     }__;
1128     }
1129 wakaba 1.7 } else { ## Default namespace
1130     __DEEP{
1131     $r = ($self-><AG::ManakaiDISNode.ownerDISDocument> || $self)
1132     -><AG::ManakaiDISDocument.moduleElement>
1133     -><AG::ManakaiDISModuleElement.definingNamespaceURI>;
1134     }__;
1135 wakaba 1.1 }
1136    
1137     @Method:
1138     @@QName: qnameToURI
1139     @@Description:
1140     @@@lang:en
1141     @@@@:
1142     Converts a qualified name (<TYPE::dis:TypeQName>) to
1143     an expanded URI reference.
1144     @@Param:
1145     @@@Name: qname
1146     @@@Type:
1147 wakaba 1.18 dis:TypeQName::ManakaiDOM:all
1148 wakaba 1.1 @@@Description:
1149     @@@@lang:en
1150     @@@@@:
1151     A qualified name.
1152     @@NodeParam:
1153 wakaba 1.13 @@NamedParam:
1154     @@@Name: defaultNamespaceURI
1155     @@@Type: AnyURI
1156     @@@enDesc:
1157     Default namespace URI reference.
1158     @@@nullCase:
1159     @@@@enDesc:
1160     The default namespace is the namespace defined by the module
1161     to which this resource belongs.
1162 wakaba 1.1 @@Return:
1163     @@@Type: AnyURI
1164     @@@Description:
1165     @@@@lang:en
1166     @@@@@:
1167     The expanded URI reference.
1168     @@@UndeclaredPrefixException:
1169     @@@PerlDef:
1170     $qname =~ s/^\s+//; $qname =~ s/\s+$//;
1171 wakaba 1.15 my ($prefix, $lname) = split /\s*[:|]\s*/, $qname, 2;
1172 wakaba 1.1 __DEEP{
1173     if (defined $lname) {
1174     $r = $self-><M::ManakaiDISElement.prefixToURI> ($prefix) . $lname;
1175     } else { ## In default namespace
1176 wakaba 1.13 if (defined $defaultNamespaceURI) {
1177     $r = $defaultNamespaceURI . $prefix;
1178     } else {
1179     $r = $self-><M::ManakaiDISElement.prefixToURI> (null) . $prefix;
1180     }
1181 wakaba 1.1 }
1182 wakaba 1.4 }__;
1183 wakaba 1.1
1184     @Method:
1185     @@QName: qnameToPair
1186     @@Description:
1187     @@@lang:en
1188     @@@@:
1189     Converts a qualified name (<TYPE::dis:TypeQName>) to
1190     a pair of namespace URI and local name.
1191     @@Param:
1192     @@@Name: qname
1193     @@@Type:
1194 wakaba 1.18 dis:TypeQName::ManakaiDOM:all
1195 wakaba 1.1 @@@Description:
1196     @@@@lang:en
1197     @@@@@:
1198     A qualified name.
1199     @@NodeParam:
1200     @@Return:
1201     @@@Type:
1202 wakaba 1.18 Perl:ARRAY::ManakaiDOM:all
1203 wakaba 1.1 @@@Description:
1204     @@@@lang:en
1205     @@@@@:
1206     A list of namespace URI and local name.
1207     @@@UndeclaredPrefixException:
1208     @@@PerlDef:
1209     $qname =~ s/^\s+//; $qname =~ s/\s+$//;
1210 wakaba 1.15 my ($prefix, $lname) = split /\s*[:|]\s*/, $qname, 2;
1211 wakaba 1.1 __DEEP{
1212     if (defined $lname) {
1213     $r = [$self-><M::ManakaiDISElement.prefixToURI> ($prefix), $lname];
1214     } else { ## In default namespace
1215     $r = [$self-><M::ManakaiDISElement.prefixToURI> (null), $prefix];
1216     }
1217 wakaba 1.4 }__;
1218 wakaba 1.1
1219     @Method:
1220 wakaba 1.3 @@Name: tfqnamesToURI
1221 wakaba 1.1 @@Description:
1222     @@@lang:en
1223     @@@@:
1224 wakaba 1.3 Converts a <TYPE::dis:TFQNames>
1225 wakaba 1.1 into an expanded URI reference.
1226     @@Param:
1227     @@@Name: tfqnames
1228     @@@Type:
1229 wakaba 1.18 dis:TFQNames::ManakaiDOM:all
1230 wakaba 1.1 @@@Description:
1231     @@@@lang:en
1232     @@@@@:
1233 wakaba 1.3 A <TYPE::dis:TFQNames> to identify a resource.
1234 wakaba 1.1 @@Param:
1235     @@@Name: defaultTypeURI
1236     @@@Type: NameURI
1237     @@@Description:
1238     @@@@lang:en
1239     @@@@@:
1240     A name URI reference used if it is missing from
1241     <P::tfqnames>.
1242     @@@InCase:
1243     @@@@Value:
1244     @@@@@is-null:1
1245     @@@@Description:
1246     @@@@@lang:en
1247     @@@@@@:
1248     Equivalent to <Q::DOMMain:any>.
1249     @@Param:
1250     @@@Name: defaultForURI
1251     @@@Type: ForURI
1252     @@@Description:
1253     @@@@lang:en
1254     @@@@@:
1255     A <QUOTE::for> URI reference used if it is missing from
1256     <P::tfqnames>.
1257     @@@InCase:
1258     @@@@Value:
1259     @@@@@is-null:1
1260     @@@@Description:
1261     @@@@@lang:en
1262     @@@@@@:
1263     Equivalent to <QUOTE::for all>, i.e. <Q::ManakaiDOM:all>.
1264     @@NodeParam:
1265     @@Return:
1266     @@@Type:
1267 wakaba 1.3 DISCore:TFURI::ManakaiDOM:all
1268 wakaba 1.1 @@@Description:
1269     @@@@lang:en
1270     @@@@@:
1271 wakaba 1.3 The <TYPE::dis:TFQNames>-expanded URI references.
1272 wakaba 1.1 @@@UndeclaredPrefixException:
1273     @@@PerlDef:
1274 wakaba 1.15 my ($typeq, $forq) = split /\s*[:|][:|]\s*/, $tfqnames, 2;
1275 wakaba 1.1 my ($typeURI, $forURI);
1276     if (defined $forq) {
1277     __DEEP{
1278     $typeURI = $typeq eq ''
1279     ? defined $defaultTypeURI ? $defaultTypeURI
1280     : <Q::DOMMain:any>
1281     : $self-><M::ManakaiDISElement.qnameToURI> ($typeq, %opt);
1282     }__;
1283     if (length $forq) {
1284     $forURI = $self-><M::ManakaiDISElement.qnameToURI> ($forq, %opt);
1285     } else {
1286     $forURI = <Q::ManakaiDOM:all>;
1287     }
1288     } else { ## "For" omitted
1289     __DEEP{
1290     $typeURI = $typeq eq ''
1291     ? defined $defaultTypeURI ? $defaultTypeURI
1292     : <Q::DOMMain:any>
1293     : $self-><M::ManakaiDISElement.qnameToURI> ($typeq, %opt);
1294     }__;
1295 wakaba 1.3 $forURI = defined $defaultForURI ? $defaultForURI
1296     : <Q::ManakaiDOM:all>;
1297 wakaba 1.1 }
1298 wakaba 1.4 __CODE{tfurisToURI:: $turi => $typeURI, $furi => $forURI, $uri => $r}__;
1299 wakaba 1.2
1300     @Method:
1301 wakaba 1.33 @@Name: tfpqnamesToURI
1302     @@Description:
1303     @@@lang:en
1304     @@@@:
1305     Converts a <TYPE::DISCore:TFPQNames>
1306     into an expanded URI reference.
1307     @@Param:
1308     @@@Name: tfpqnames
1309     @@@Type:
1310     DISCore:TFPQNames::ManakaiDOM:all
1311     @@@Description:
1312     @@@@lang:en
1313     @@@@@:
1314     A <TYPE::DISCore:TFPQNames> to identify a resource.
1315     @@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     @@NodeParam:
1346     @@Return:
1347     @@@Type:
1348     DISCore:TFURI::ManakaiDOM:all
1349     @@@Description:
1350     @@@@lang:en
1351     @@@@@:
1352     The <TYPE::dis:TFQNames>-expanded URI references.
1353     @@@UndeclaredPrefixException:
1354     @@@PerlDef:
1355     my ($typeq, $forq, @forpq) = split /\s*[:|][:|]\s*/, $tfpqnames;
1356     my ($typeURI, $forURI);
1357     my $forpURI = [];
1358     undef $forq if defined $forq and $forq eq '+';
1359     if (defined $forq) {
1360     __DEEP{
1361     $typeURI = $typeq eq ''
1362     ? defined $defaultTypeURI ? $defaultTypeURI
1363     : <Q::DOMMain:any>
1364     : $self-><M::ManakaiDISElement.qnameToURI> ($typeq, %opt);
1365     if (length $forq) {
1366     $forURI = $self-><M::ManakaiDISElement.qnameToURI> ($forq, %opt);
1367     } else {
1368     $forURI = <Q::ManakaiDOM:all>;
1369     }
1370     }__;
1371     } else { ## "For" omitted
1372     __DEEP{
1373     $typeURI = $typeq eq ''
1374     ? defined $defaultTypeURI ? $defaultTypeURI
1375     : <Q::DOMMain:any>
1376     : $self-><M::ManakaiDISElement.qnameToURI> ($typeq, %opt);
1377     }__;
1378     $forURI = defined $defaultForURI ? $defaultForURI
1379     : <Q::ManakaiDOM:all>;
1380     }
1381     __DEEP{
1382     for my $forpq (@forpq) {
1383     push @$forpURI, $self-><M::ManakaiDISElement.qnameToURI>
1384     ($forpq, %opt);
1385     }
1386     }__;
1387     __CODE{tfpurisToURI:: $turi => $typeURI, $furi => $forURI,
1388     $forp => $forpURI, $uri => $r}__;
1389    
1390     @Method:
1391 wakaba 1.2 @@Name: disGetAttribute
1392     @@enDesc:
1393     Gets an attribute node.
1394     @@Param:
1395     @@@Name: attrName
1396     @@@Type: AnyURI
1397     @@@enDesc:
1398     The name expanded URI of the node to retrieve.
1399     @@ForParam:
1400     @@ForpParam:
1401     @@MediaTypeParam:
1402     @@MediaTypeDefaultParam:
1403     @@Return:
1404     @@@Type: ManakaiDISElement
1405     @@@enDesc:
1406     The attribute (property) element node.
1407     @@@nullCase:
1408     @@@@enDesc:
1409     No attribute node found.
1410     @@@PerlDef:
1411 wakaba 1.10 for my $c (@{$self-><M::ManakaiDISElement.disChildElements>
1412     (for_arg => $forArg, forp_arg => $forpArg)}) {
1413 wakaba 1.3 if ($c-><AG::swcfg21:SWCFGElement::swcfg21:ForLatest
1414     .expandedURI> eq $attrName and
1415 wakaba 1.12 $c-><M::ManakaiDISElement.mediaTypeMatch>
1416     ($mediaType, $defaultMediaType,
1417     for_arg => $forArg, forp_arg => $forpArg)) {
1418 wakaba 1.2 $r = $c;
1419     last;
1420     }
1421     }
1422    
1423     @Method:
1424     @@Name: disGetAttributeList
1425     @@enDesc:
1426     Gets attribute nodes.
1427 wakaba 1.3 @@Param:
1428     @@@Name: attrName
1429     @@@Type: AnyURI
1430     @@@enDesc:
1431     The name expanded URI of the node to retrieve.
1432 wakaba 1.2 @@ForParam:
1433     @@ForpParam:
1434     @@MediaTypeParam:
1435     @@MediaTypeDefaultParam:
1436     @@Return:
1437     @@@Type: ManakaiDISElementList
1438     @@@enDesc:
1439     The attribute (property) element nodes.
1440     @@@PerlDef:
1441     $r = bless [], <ClassName::ManakaiDISElementList>;
1442 wakaba 1.10 for my $c (@{$self-><M::ManakaiDISElement.disChildElements>
1443     (for_arg => $forArg, forp_arg => $forpArg)}) {
1444 wakaba 1.3 if ($c-><AG::swcfg21:SWCFGElement::swcfg21:ForLatest
1445     .expandedURI> eq $attrName and
1446 wakaba 1.12 $c-><M::ManakaiDISElement.mediaTypeMatch>
1447     ($mediaType, $defaultMediaType,
1448     for_arg => $forArg, forp_arg => $forpArg)) {
1449 wakaba 1.2 push @$r, $c;
1450     }
1451     }
1452    
1453 wakaba 1.4 @Method:
1454 wakaba 1.2 @@Name: disChildElements
1455     @@enDesc:
1456 wakaba 1.10 A list of child elements, with <QUOTE::for> check.
1457 wakaba 1.4 @@ForParam:
1458     @@ForpParam:
1459     @@Return:
1460     @@@Type: ManakaiDISElementList
1461 wakaba 1.2 @@@enDesc:
1462     The current snapshot of child nodes.
1463     @@@PerlDef:
1464 wakaba 1.4 $r = bless [], <ClassName::ManakaiDISElementList>;
1465     __DEEP{
1466     for my $cn (@{$self-><AG::swcfg21:SWCFGNode::swcfg21:ForLatest
1467     .childNodes>}) {
1468     ## $cn is an #element.
1469     my $dn = $cn->{<Q::TreeCore:node>}
1470     -><M::ManakaiDOM:ManakaiDOMNodeObject
1471     ::ManakaiDOM:Perl.newReference>
1472     (<ClassName::ManakaiDISElement>);
1473     next unless $dn-><M::ManakaiDISElement.forMatch> ($forArg, $forpArg);
1474     push @$r, $dn;
1475     }
1476     }__;
1477 wakaba 1.5
1478 wakaba 1.10 @Method:
1479     @@Name: disAllChildElements
1480     @@enDesc:
1481     A list of child elements, without <QUOTE::for> check.
1482     @@Return:
1483     @@@Type: ManakaiDISElementList
1484     @@@enDesc:
1485     The current snapshot of child nodes.
1486     @@@PerlDef:
1487     $r = bless [], <ClassName::ManakaiDISElementList>;
1488     __DEEP{
1489     for my $cn (@{$self-><AG::swcfg21:SWCFGNode::swcfg21:ForLatest
1490     .childNodes>}) {
1491     ## $cn is an #element.
1492     my $dn = $cn->{<Q::TreeCore:node>}
1493     -><M::ManakaiDOM:ManakaiDOMNodeObject
1494     ::ManakaiDOM:Perl.newReference>
1495     (<ClassName::ManakaiDISElement>);
1496     push @$r, $dn;
1497     }
1498     }__;
1499    
1500 wakaba 1.2 @Attr:
1501     @@Name: qnameValueURI
1502     @@enDesc:
1503     The element value (written as <TYPE::dis:TypeQName>), as URI reference.
1504     \
1505     {NOTE:: What should be if list value?
1506     \
1507     }
1508     @@Get:
1509     @@@Type:AnyURI
1510     @@@nullCase:
1511     @@@@enDesc:
1512     No value.
1513     @@@UndeclaredPrefixException:
1514 wakaba 1.3 @@@PerlDef:
1515 wakaba 1.4 __DEEP{
1516 wakaba 1.14 my $v = $self-><M::swcfg21:SWCFGNode::swcfg21:ForLatest.value>;
1517 wakaba 1.4 if (defined $v and not ref $v eq 'ARRAY') {
1518 wakaba 1.14 $r = $self-><M::ManakaiDISElement.qnameToURI> ($v, node => $self);
1519 wakaba 1.4 } else {
1520     $r = null;
1521     }
1522     }__;
1523    
1524     @Attr:
1525     @@Name: qnameValueLocalName
1526     @@enDesc:
1527     The local name part of the element value (assumed as
1528     written as <TYPE::dis:TypeQName>).
1529     \
1530     {NOTE:: What should be if list value?
1531     \
1532     }
1533     @@Get:
1534     @@@Type:
1535 wakaba 1.18 DISCore:LocalName::ManakaiDOM:all
1536 wakaba 1.4 @@@nullCase:
1537     @@@@enDesc:
1538     No value.
1539     @@@PerlDef:
1540     __DEEP{
1541 wakaba 1.14 my $v = $self-><M::swcfg21:SWCFGNode::swcfg21:ForLatest.value>;
1542 wakaba 1.4 if (defined $v and not ref $v eq 'ARRAY') {
1543 wakaba 1.15 my ($n, $v) = split /\s*[:|]\s*/, $v, 2;
1544 wakaba 1.4 $r = defined $v ? $v : $n;
1545     } else {
1546     $r = null;
1547     }
1548     }__;
1549    
1550     @Attr:
1551     @@Name: qnameValueNamespaceURI
1552     @@enDesc:
1553     The namespace URI of the element value (assumed as written
1554     in <TYPE::dis:TypeQName>).
1555     \
1556     {NOTE:: What should be if list value?
1557     \
1558     }
1559     @@Get:
1560     @@@Type:AnyURI
1561     @@@nullCase:
1562     @@@@enDesc:
1563     No value.
1564     @@@UndeclaredPrefixException:
1565     @@@PerlDef:
1566     __DEEP{
1567 wakaba 1.14 my $v = $self-><M::swcfg21:SWCFGNode::swcfg21:ForLatest.value>;
1568 wakaba 1.4 if (defined $v and not ref $v eq 'ARRAY') {
1569 wakaba 1.15 my ($p, $v) = split /\s*[:|]\s*/, $v, 2;
1570 wakaba 1.14 $r = $self-><M::ManakaiDISElement.prefixToURI>
1571 wakaba 1.4 (defined $v ? $p : null);
1572     } else {
1573     $r = null;
1574     }
1575     }__;
1576 wakaba 1.2
1577 wakaba 1.6 @Method:
1578 wakaba 1.3 @@Name: tfqnamesValueURI
1579 wakaba 1.2 @@enDesc:
1580 wakaba 1.3 The element value (written as <TYPE::dis:TFQNames>),
1581 wakaba 1.2 as URI reference.
1582     \
1583     {NOTE:: What should be if list value?
1584     \
1585     }
1586 wakaba 1.6 @@Param:
1587     @@@Name: defaultTypeURI
1588     @@@Type: NameURI
1589     @@@Description:
1590     @@@@lang:en
1591     @@@@@:
1592     A name URI reference used if it is missing from
1593     <P::tfqnames>.
1594     @@@InCase:
1595     @@@@Value:
1596     @@@@@is-null:1
1597     @@@@Description:
1598     @@@@@lang:en
1599     @@@@@@:
1600     Equivalent to <Q::DOMMain:any>.
1601     @@Param:
1602     @@@Name: defaultForURI
1603     @@@Type: ForURI
1604     @@@Description:
1605     @@@@lang:en
1606     @@@@@:
1607     A <QUOTE::for> URI reference used if it is missing from
1608     <P::tfqnames>.
1609     @@@InCase:
1610     @@@@Value:
1611     @@@@@is-null:1
1612     @@@@Description:
1613     @@@@@lang:en
1614     @@@@@@:
1615     Equivalent to <QUOTE::for all>, i.e. <Q::ManakaiDOM:all>.
1616 wakaba 1.33 @@ForParam:
1617     @@ForpParam:
1618 wakaba 1.6 @@Return:
1619 wakaba 1.2 @@@Type:ResourceURI
1620     @@@nullCase:
1621     @@@@enDesc:
1622     No value.
1623     @@@UndeclaredPrefixException:
1624 wakaba 1.3 @@@PerlDef:
1625 wakaba 1.14 my $v = $self-><M::swcfg21:SWCFGNode::swcfg21:ForLatest.value>;
1626 wakaba 1.2 if (defined $v and not ref $v eq 'ARRAY') {
1627     __DEEP{
1628 wakaba 1.33 if ($self-><M::ManakaiDISElement.mediaTypeMatch>
1629     (<Q::DISCore:TFPQNames>, <Q::dis:TFQNames>,
1630     for_arg => $forArg, forp_arg => $forpArg)) {
1631     $r = $self-><M::ManakaiDISElement.tfpqnamesToURI>
1632     ($v, $defaultTypeURI, $defaultForURI,
1633     node => $self);
1634     } else {
1635     $r = $self-><M::ManakaiDISElement.tfqnamesToURI>
1636     ($v, $defaultTypeURI, $defaultForURI,
1637     node => $self);
1638     }
1639 wakaba 1.2 }__;
1640     } else {
1641     $r = null;
1642     }
1643 wakaba 1.7
1644     @Method:
1645     @@Name: elementTypeMatch
1646     @@enDesc:
1647     Returns whether the element type of this element matches
1648     with another element type (either the same element type or
1649     this type is a subtype of another type).
1650     @@Param:
1651     @@@Name: etype
1652     @@@Type: ResourceURI
1653     @@@enDesc:
1654     An element type name URI reference to test.
1655     @@Return:
1656     @@@Type:
1657 wakaba 1.18 DOMMain:boolean::ManakaiDOM:all
1658 wakaba 1.7 @@@TrueCase:
1659     @@@@enDesc:
1660     Either the element type expanded URI reference of this element is
1661     same as <P::etype> or it is a sub-element type of <P::etype>.
1662     @@@FalseCase:
1663     @@@@enDesc:
1664     This element is not of <P::etype>.
1665     @@@NoDBException:
1666     @@@PerlDef:
1667     __DEEP{
1668 wakaba 1.14 my $et = $self-><AG::swcfg21:SWCFGElement::swcfg21:ForLatest
1669 wakaba 1.7 .expandedURI>;
1670     my $rdef = $self-><AG::ManakaiDISNode.ownerDISDocument>
1671     -><AG::ManakaiDISDocument.disDatabase>
1672     -><M::ManakaiDISDatabase.getResource> ($et);
1673     $r = $rdef-><M::ManakaiDISResourceDefinition.isSubsetOfURI> ($etype);
1674     }__;
1675    
1676     @Attr:
1677     @@Name: isResourceElement
1678     @@enDesc:
1679     Whether this element defines a resource or not.
1680     \
1681     {NOTE:: An element defines a resource if its element type is
1682     <Q::dis:ResourceDef> or its subtype.
1683     \
1684     }
1685     @@Get:
1686     @@@Type:
1687 wakaba 1.18 DOMMain:boolean::ManakaiDOM:all
1688 wakaba 1.7 @@@TrueCase:
1689     @@@@enDesc:
1690     This element defines a resource.
1691     @@@FalseCase:
1692     @@@@enDesc:
1693     This element does not define any resource.
1694     @@@NoDBException:
1695     @@@PerlDef:
1696     __DEEP{
1697     $r = $self-><M::ManakaiDISElement.elementTypeMatch>
1698     (<Q::dis:ResourceDef>);
1699     }__;
1700    
1701     @Attr:
1702     @@Name: isPropertyElement
1703     @@enDesc:
1704     Whether this element is a property or not.
1705     \
1706     {NOTE:: An element is a property if its element type is
1707     <Q::rdf:type> or if its element type's <Q::rdf:type>
1708     property is <Q::rdf:Property> or is <Q::dis:subsetOf>
1709     <Q::rdf:Property>.
1710     \
1711     }
1712     @@Get:
1713     @@@Type:
1714 wakaba 1.18 DOMMain:boolean::ManakaiDOM:all
1715 wakaba 1.7 @@@TrueCase:
1716     @@@@enDesc:
1717     This element is a property.
1718     @@@FalseCase:
1719     @@@@enDesc:
1720     This element is not a property.
1721     @@@NoDBException:
1722     @@@PerlDef:
1723     __DEEP{
1724     my $xn = $self-><AG::swcfg21:SWCFGElement::swcfg21:ForLatest
1725     .expandedURI>;
1726     if ($xn eq <Q::rdf:type>) {
1727     $r = true;
1728     } else {
1729     my $rdef = $self-><AG::ManakaiDISNode.ownerDISDocument>
1730     -><AG::ManakaiDISDocument.disDatabase>
1731     -><M::ManakaiDISDatabase.getResource> ($xn);
1732     $r = $rdef-><M::ManakaiDISResourceDefinition.isTypeURI>
1733     (<Q::rdf:Resource>);
1734     }
1735     }__;
1736 wakaba 1.18
1737     @Attr:
1738     @@Name: plImplementation
1739     @@enDesc:
1740     The <Class::PerlCode:ManakaiPerlCodeImplementation::ManakaiDOM:Perl>
1741     object.
1742     @@Type:
1743     PerlCode:ManakaiPerlCodeImplementation::ManakaiDOM:Perl
1744     @@Get:
1745     @@@nullCase:
1746     @@@@enDesc:
1747     There is no implementation that supports the feature
1748     <Feature::Util:PerlCode> version <FeatureVer:1.0>.
1749     @@@PerlDef:
1750     $r = ($self-><AG::SWCFGNode.ownerDocument> or
1751     $self)-><AG::SWCFGDoc.implementation>
1752     -><M::DOMMinImpl.getFeature>
1753     (<Q::Util:PerlCode> => '1.0');
1754    
1755     @Method:
1756     @@Name: plValueCodeFragment
1757     @@enDesc:
1758     A Perl code fragment for value attribute.
1759     @@Param:
1760     @@@Name: attrURI
1761     @@@Type: AnyURI
1762     @@@enDesc:
1763     The URI reference name of an attribute.
1764 wakaba 1.19 @@@nullCase:
1765     @@@@enDesc:
1766     This node itself is used.
1767 wakaba 1.18 @@Param:
1768 wakaba 1.23 @@@Name: disResource
1769     @@@Type: ManakaiDISResourceDefinition
1770 wakaba 1.18 @@@enDesc:
1771 wakaba 1.23 The <QUOTE::dis> resource object against which a value is evaluated.
1772 wakaba 1.18 @@ForParam:
1773     @@ForpParam:
1774     @@NamedParam:
1775     @@@Name:dataTypeURI
1776     @@@Type:
1777     ResourceURI
1778     @@@enDesc:
1779     The URI reference of a data type. It is used to convert
1780     untyped value and to define default value if <P::useDefaultValue>
1781     is set to <DOM::true>.
1782     @@@nullCase:
1783     @@@@enDesc:
1784     No data type. If the value is untyped, it is treated
1785     as if <Q::DISCore:String>.
1786     @@NamedParam:
1787     @@@Name:useDefaultValue
1788     @@@Type:
1789     DOMMain:boolean::ManakaiDOM:all
1790     @@@enDesc:
1791     Whether some default value should be provided if possible or not.
1792     @@Type:
1793     MPLCodeFragment
1794     @@Return:
1795     @@@enDesc:
1796     Perl code fragment object for value attribute.
1797     @@@nullCase:
1798     @@@@enDesc:
1799     There is no <P::attrURI> attribute.
1800     @@@UndeclaredPrefixException:
1801     @@@RaiseException:
1802     @@@@@:NO_PERL_CODE_IMPL_ERR
1803     @@@@enDesc:
1804     There is no implementation that implements
1805     the <Feature::Util:PerlCode> feature, version <FeatureVer::1.0>.
1806     @@@PerlDef:
1807     __DEEP{
1808     my $dataType;
1809 wakaba 1.19 my $vnode = defined $attrURI
1810     ? $self-><M::ManakaiDISElement.disGetAttribute>
1811 wakaba 1.18 ($attrURI,
1812     for_arg => $forArg,
1813 wakaba 1.19 forp_arg => $forpArg)
1814     : $self;
1815 wakaba 1.18 my $plimpl = $self-><AG::ManakaiDISElement.plImplementation>;
1816     if ($vnode) {
1817     unless ($plimpl) {
1818     __UNDEEP{__EXCEPTION{NO_PERL_CODE_IMPL_ERR}__}__;
1819     }
1820     my $isnull = $vnode-><M::ManakaiDISElement.disGetAttribute>
1821     (<Q::dis:is-null>,
1822     for_arg => $forArg,
1823     forp_arg => $forpArg);
1824     if ($isnull and $isnull-><M::SWCFGNode.value>) {
1825     $r = $plimpl-><M::MPLImpl.createPerlAtom> ('null');
1826     } else {
1827     my $vnode_type_uri = $vnode-><M::ManakaiDISElement.mediaTypeURI>;
1828     my $vnode_value = $vnode-><M::SWCFGNode.value>;
1829     if ($vnode_type_uri) {
1830 wakaba 1.23 my $vnode_type = $disResource->{db}
1831     -><M::ManakaiDISDatabase.getResource>
1832 wakaba 1.18 ($vnode_type_uri);
1833     if ($vnode_type-><M::ManakaiDISResourceDefinition.isSubsetOfURI>
1834     (<Q::dis:Boolean>)) {
1835     $r = $plimpl-><M::MPLImpl.createPerlAtom>
1836     ($vnode_value ? true : false);
1837     } elsif ($vnode_type-><M::ManakaiDISResourceDefinition
1838     .isSubsetOfURI>
1839     (<Q::dis:TypeQName>)) {
1840     $r = $plimpl-><M::MPLImpl.createPerlStringLiteral>
1841 wakaba 1.19 ($vnode-><M::ManakaiDISElement
1842 wakaba 1.18 .qnameToURI> ($vnode_value,
1843     node => $vnode));
1844 wakaba 1.23 } elsif ($vnode_type-><M::ManakaiDISResourceDefinition
1845     .isSubsetOfURI> (<Q::lang:Perl>)) {
1846     $r = $disResource-><M::ManakaiDISResourceDefinition
1847     .plPreprocessPerlStatement>
1848     ($vnode_value,
1849     node => $self,
1850     contains_statements => false);
1851 wakaba 1.18 } else { ## DISCore:String or some
1852     $r = $plimpl-><M::MPLImpl.createPerlStringLiteral>
1853     ($vnode_value);
1854     }
1855     } elsif ($dataTypeURI) {
1856 wakaba 1.23 $dataType ||= $disResource->{db}
1857     -><M::ManakaiDISDatabase.getResource>
1858 wakaba 1.21 ($dataTypeURI);
1859     if ($dataType-><M::ManakaiDISResourceDefinition.isSubsetOfURI>
1860     (<Q::DISIDL:AnyRealNumber>)) {
1861     $r = $plimpl-><M::MPLImpl.createPerlAtom> (0 + $vnode_value);
1862     } else { ## DOMMain:DOMString or some
1863 wakaba 1.18 $r = $plimpl-><M::MPLImpl.createPerlStringLiteral>
1864     ($vnode_value);
1865 wakaba 1.21 }
1866 wakaba 1.18 } else { ## Untyped
1867     $r = $plimpl-><M::MPLImpl.createPerlStringLiteral>($vnode_value);
1868     }
1869     }
1870     } # has value
1871    
1872     if (not $r and $useDefaultValue) {
1873 wakaba 1.23 $dataType ||= $disResource->{db}-><M::ManakaiDISDatabase.getResource>
1874 wakaba 1.18 ($dataTypeURI);
1875     if ($dataType-><M::ManakaiDISResourceDefinition.isSubsetOfURI>
1876     (<Q::DISLang:String>)) {
1877     $r = $plimpl-><M::MPLImpl.createPerlStringLiteral> ('');
1878     } elsif ($dataType-><M::ManakaiDISResourceDefinition.isSubsetOfURI>
1879     (<Q::DOMMain:boolean>) or
1880     $dataType-><M::ManakaiDISResourceDefinition.isSubsetOfURI>
1881 wakaba 1.21 (<Q::DISIDL:AnyRealNumber>)) {
1882 wakaba 1.18 $r = $plimpl-><M::MPLImpl.createPerlAtom> ('0');
1883     } elsif ($dataType-><M::ManakaiDISResourceDefinition.isSubsetOfURI>
1884     (<Q::Perl:ARRAY>)) {
1885     $r = $plimpl-><M::MPLImpl.createPerlAtom> ('[]');
1886     } elsif ($dataType-><M::ManakaiDISResourceDefinition.isSubsetOfURI>
1887     (<Q::Perl:hash>)) {
1888     $r = $plimpl-><M::MPLImpl.createPerlAtom> ('{}');
1889     }
1890     }
1891     }__;
1892 wakaba 1.19
1893     @Method:
1894     @@Name:plCodeFragment
1895     @@enDesc:
1896     Converts <Q::lang:dis> into Perl code.
1897     @@Param:
1898     @@@Name:disResource
1899     @@@Type:ManakaiDISResourceDefinition
1900     @@@enDesc:
1901     A <QUOTE::dis> resource with which code is evaluated.
1902     @@ForParam:
1903     @@ForpParam:
1904     @@NamedParam:
1905     @@@Name:containsStatements
1906     @@@Type:
1907     DOMMain:boolean::ManakaiDOM:all
1908     @@@enDesc:
1909     Whether the code is block-level or inline-level.
1910     @@Return:
1911     @@@Type: MPLCodeFragment
1912     @@@enDesc:
1913     Perl code converted from this node.
1914     @@@disPerlException:
1915     @@@PerlDef:
1916     __DEEP{
1917     my $plimpl = $self-><AG::ManakaiDISElement.plImplementation>;
1918     my $et = $self-><AG::swcfg21:SWCFGElement::swcfg21:ForLatest
1919     .expandedURI>;
1920     if ($et eq <Q::dis:Def>) {
1921     my $value = $self-><M::SWCFGNode.value>;
1922     if (defined $value) {
1923     __UNDEEP{__EXCEPTION{DISPERL_NO_VALUE_ALLOWED_ERR::
1924     DIS:sourceNode => {$self},
1925     DIS:elementType => {$et},
1926     }__}__;
1927     }
1928     $r = $plimpl-><M::MPLImpl.createPerlBlockContainer>;
1929     for my $c (@{$self-><M::ManakaiDISElement.disChildElements>
1930     (for_arg => $forArg, forp_arg => $forpArg)}) {
1931     my $ccode = $c-><M::ManakaiDISElement.plCodeFragment>
1932     ($disResource,
1933 wakaba 1.31 for_arg => $forArg, forp_arg => $forpArg,
1934     contains_statements => $containsStatements);
1935 wakaba 1.30 $r-><M::PLBlockCon.appendCodeFragment> ($ccode->clone) if $ccode;
1936 wakaba 1.19 }
1937     } elsif ({
1938     <Q::DISLang:constValue> => true,
1939     <Q::DISPerl:cloneCode> => true,
1940     }->{$et}) {
1941     my ($qname, $const_name, $on) = split /\s*\.\s*/,
1942     $self-><M::SWCFGNode.value>, 3;
1943 wakaba 1.31 my $parentResource = $disResource-><M::ManakaiDISPropertyAccessor
1944     .getPropertyResource>
1945     (<Q::dis2pm:parentResource>);
1946 wakaba 1.19 my $uri = $self-><M::ManakaiDISElement.tfqnamesToURI>
1947 wakaba 1.31 ($qname,
1948     ($parentResource-><M::ManakaiDISPropertyAccessor
1949     .getPropertyResource>
1950     (<Q::dis2pm:parentResource>) ||
1951     $parentResource || $disResource)->
1952     <AG::ManakaiDISResourceDefinition.nameURI>,
1953     $forArg, node => $self);
1954 wakaba 1.19 my $const;
1955     if (defined $const_name) {
1956     my $owner = $disResource->{db}-><M::ManakaiDISDatabase.getResource>
1957     ($uri);
1958     $owner-><AS::ManakaiDISResourceDefinition.isReferred> ($self);
1959     if ($et eq <Q::DISLang:constValue>) {
1960     $const = $owner-><M::ManakaiDISResourceDefinition
1961     .getConstResourceByName> ($const_name);
1962     unless (defined $const) {
1963     __UNDEEP{__EXCEPTION{RESOURCE_NOT_DEFINED_ERR::
1964 wakaba 1.30 DIS:parentURI => {$uri},
1965 wakaba 1.19 DIS:localName => {$const_name},
1966     DIS:sourceNode => {$self},
1967     DIS:elementType => {$et},
1968     DIS:expectedType => {<Q::ManakaiDOM:Const>},
1969     }__}__;
1970     }
1971     } else {
1972     $const = $owner-><M::ManakaiDISResourceDefinition
1973     .getChildResourceByNameAndType>
1974     ($const_name, <Q::DISLang:AnyMethod>);
1975     unless (defined $const) {
1976     __UNDEEP{__EXCEPTION{RESOURCE_NOT_DEFINED_ERR::
1977 wakaba 1.30 DIS:parentURI => {$uri},
1978 wakaba 1.19 DIS:localName => {$const_name},
1979     DIS:sourceNode => {$self},
1980     DIS:elementType => {$et},
1981     DIS:expectedType => {<Q::DISLang:AnyMethod>},
1982     }__}__;
1983     }
1984     }
1985     } else {
1986     $const = $disResource->{db}-><M::ManakaiDISDatabase.getResource>
1987     ($uri);
1988     }
1989     if ($const-><M::ManakaiDISResourceDefinition.isTypeURI>
1990     (<Q::ManakaiDOM:Const>)) {
1991     $const-><AS::ManakaiDISResourceDefinition.isReferred> ($self);
1992    
1993     my $data_type = $const-><AG::ManakaiDISResourceDefinition
1994     .disActualDataTypeResource>;
1995     my $val = $const->{src}-><M::ManakaiDISElement
1996     .plValueCodeFragment>
1997 wakaba 1.23 (<Q::dis:Value>, $disResource,
1998 wakaba 1.19 for_arg => $forArg,
1999     forp_arg => $forpArg,
2000     data_type_uri => $data_type
2001     -><AG::ManakaiDISResourceDefinition.uri>);
2002     unless (defined $val) {
2003     __UNDEEP{__EXCEPTION{NO_CONST_VALUE_ERR::
2004     DIS:uri => {$const->{uri}},
2005     DIS:localName => {$const->{localName}},
2006     DIS:sourceNode => {$const->{src}},
2007     DIS:elementType => {$et},
2008     }__}__;
2009     }
2010    
2011     if ($containsStatements) {
2012     $r = $plimpl-><M::MPLImpl.createPerlStatement>;
2013     my $rvar = $plimpl-><M::MPLImpl.createPerlVariable>
2014     ('$', null, 'r');
2015     $r-><M::PLAnyCon.appendNewAssignment> ($rvar => $val);
2016     } else {
2017     $r = $val;
2018     }
2019     } elsif ($const-><M::ManakaiDISResourceDefinition.isTypeURI>
2020     (<Q::DISLang:AnyMethod>)) {
2021 wakaba 1.22 my $ret = $const-><M::ManakaiDISResourceDefinition
2022 wakaba 1.19 .getChildResourceByType>
2023     ($const-><M::ManakaiDISResourceDefinition
2024     .isTypeURI> (<Q::DISLang:Method>)
2025     ? <Q::DISLang:MethodReturn>
2026     : ($on and $on eq 'set')
2027     ? <Q::DISLang:AttributeSet>
2028     : <Q::DISLang:AttributeGet>);
2029     unless ($ret) {
2030     __UNDEEP{
2031     if ($const-><M::ManakaiDISResourceDefinition
2032     .isTypeURI> (<Q::DISLang:Method>)) {
2033     __EXCEPTION{NO_METHOD_RETURN_ERR::
2034     DIS:errResource => {$const},
2035     DIS:sourceNode => {$const->{src}},
2036     DIS:elementType => {$et},
2037 wakaba 1.22 DIS:uri => {$const->{uri}},
2038     DIS:localName => {$const->{localName}},
2039 wakaba 1.19 }__;
2040     } elsif ($on and $on eq 'set') {
2041     __EXCEPTION{NO_ATTR_SET_ERR::
2042     DIS:errResource => {$const},
2043     DIS:sourceNode => {$const->{src}},
2044     DIS:elementType => {$et},
2045     }__;
2046     } else {
2047     __EXCEPTION{NO_ATTR_GET_ERR::
2048     DIS:errResource => {$const},
2049     DIS:sourceNode => {$const->{src}},
2050     DIS:elementType => {$et},
2051     }__;
2052     }
2053     }__; # UNDEEP
2054     }
2055     $r = $ret-><AG::ManakaiDISResourceDefinition.plCodeFragment>;
2056     } else {
2057     if ($et eq <Q::DISLang:constValue>) {
2058     __UNDEEP{__EXCEPTION{RESOURCE_NOT_DEFINED_ERR::
2059     DIS:uri => {$const->{uri}},
2060     DIS:localName => {$const->{localName}},
2061     DIS:sourceNode => {$self->{src}},
2062     DIS:expectedType => {<Q::ManakaiDOM:Const>},
2063     }__}__;
2064     } else { # DISPerl:cloneCode
2065     __UNDEEP{__EXCEPTION{RESOURCE_NOT_DEFINED_ERR::
2066     DIS:uri => {$const->{uri}},
2067     DIS:localName => {$const->{localName}},
2068     DIS:sourceNode => {$self->{src}},
2069     DIS:expectedType => {<Q::DISLang:AnyMethod>},
2070     }__}__;
2071     }
2072     }
2073     } elsif ($et eq <Q::DISLang:value>) {
2074     my $val = $self-><M::ManakaiDISElement
2075     .plValueCodeFragment>
2076 wakaba 1.23 (null, $disResource,
2077 wakaba 1.19 for_arg => $forArg,
2078     forp_arg => $forpArg);
2079 wakaba 1.22 $r = $plimpl-><M::MPLImpl.createPerlStatement>;
2080     my $rvar = $plimpl-><M::MPLImpl.createPerlVariable>
2081 wakaba 1.19 ('$', null, 'r');
2082 wakaba 1.22 $r-><M::PLAnyCon.appendNewAssignment> ($rvar => $val);
2083 wakaba 1.19 } elsif ({
2084     <Q::dis:GetProp> => true,
2085     <Q::dis:GetPropNode> => true,
2086     <Q::swcfg21:GetPropNode> => true,
2087     }->{$et}) {
2088     my $prop_uri = $self-><AG::ManakaiDISElement.qnameValueURI>;
2089     $disResource->{db}
2090     -><M::ManakaiDISDatabase.getResource> ($prop_uri)
2091     -><AS::ManakaiDISResourceDefinition.isReferred> ($self);
2092     $r = $plimpl-><M::MPLImpl.createPerlStatement>;
2093     my $val = $plimpl-><M::MPLImpl.createPerlInlineContainer>;
2094     $val-><M::PLInCon.appendCode> ('$self->{node}->{');
2095     $val-><M::PLAnyCon.appendStringLiteral> ($prop_uri);
2096     $val-><M::PLInCon.appendCode> ('}');
2097     my $rvar = $plimpl-><M::MPLImpl.createPerlVariable>
2098     ('$', null, 'r');
2099     $r-><M::PLAnyCon.appendNewAssignment> ($rvar => $val);
2100    
2101     if ({<Q::dis:GetPropNode> => true,
2102     <Q::swcfg21:GetPropNode> => true}->{$et}) {
2103     my $q = $plimpl-><M::MPLImpl.createPerlBlockContainer>;
2104     $q-><M::PLBlockCon.appendCodeFragment> ($r);
2105     $q-><M::PLBlockCon.appendNewIf>
2106     ($plimpl-><M::MPLImpl.createPerlInlineUnparsedCode>
2107     ('defined $r'),
2108     my $qt = $plimpl-><M::MPLImpl.createPerlBlockContainer>);
2109     $qt-><M::PLBlockCon.appendStatement>
2110     -><M::PLAnyCon.appendNewAssignment>
2111     ($rvar->clone => my $qtr = $plimpl-><M::MPLImpl
2112     .createPerlInlineContainer>);
2113     my $cls = $disResource->{db}-><M::ManakaiDISDatabase
2114     .getResource> ({
2115     <Q::dis:GetPropNode> => <Q::DOMCore:ManakaiDOMNode>,
2116     <Q::swcfg21:GetPropNode> =>
2117     <Q::swcfg21:ManakaiSWCFGNode>,
2118     }->{$et}, for_arg => $forArg);
2119     $cls-><AS::ManakaiDISResourceDefinition.isReferred> ($self);
2120     $qtr-><M::PLInCon.appendCode>
2121     ($cls-><AG::ManakaiDISResourceDefinition
2122     .plFullyQualifiedName> . q[->_get_node_reference ($r)]);
2123     $r = $q;
2124     }
2125     } elsif ($et eq <Q::dis:SetProp>) {
2126     my $prop_uri = $self-><AG::ManakaiDISElement.qnameValueURI>;
2127     $disResource->{db}
2128     -><M::ManakaiDISDatabase.getResource> ($prop_uri)
2129     -><AS::ManakaiDISResourceDefinition.isReferred> ($self);
2130     $r = $plimpl-><M::MPLImpl.createPerlStatement>;
2131     my $val = $plimpl-><M::MPLImpl.createPerlInlineContainer>;
2132     $val-><M::PLInCon.appendCode> ('$self->{node}->{');
2133     $val-><M::PLAnyCon.appendStringLiteral> ($prop_uri);
2134     $val-><M::PLInCon.appendCode> ('}');
2135     my $rvar = $plimpl-><M::MPLImpl.createPerlVariable>
2136     ('$', null, 'given');
2137     $r-><M::PLAnyCon.appendNewAssignment> ($val => $rvar);
2138     my $chk = $self-><M::ManakaiDISElement.disGetAttribute>
2139     (<Q::dis:CheckReadOnly>);
2140     if ($chk and $chk-><M::SWCFGNode.value>) {
2141 wakaba 1.31 my $q = $plimpl-><M::MPLImpl.createPerlIf>
2142 wakaba 1.19 (my $qc = $plimpl-><M::MPLImpl.createPerlInlineContainer>,
2143     my $qt = $plimpl-><M::MPLImpl.createPerlBlockContainer>);
2144     $qc-><M::PLInCon.appendCode> ('$self->{node}->{');
2145     $qc-><M::PLAnyCon.appendStringLiteral> (<Q::DOMCore:read-only>);
2146     $qc-><M::PLInCon.appendCode> ('}');
2147    
2148 wakaba 1.31 my $for_uri = $disResource->{db}-><M::ManakaiDISDatabase.getFor>
2149 wakaba 1.19 ($forArg)-><M::ManakaiDISForDefinition.isaURI>
2150     (<Q::ManakaiDOM:ManakaiDOM1>)
2151     ? $forArg : <Q::ManakaiDOM:ManakaiDOMLatest>;
2152 wakaba 1.31 my $cls = $disResource->{db}-><M::ManakaiDISDatabase.getResource>
2153 wakaba 1.19 (<Q::DOMCore:DOMException>,
2154     for_arg => $for_uri);
2155 wakaba 1.31 my $const = $disResource->{db}-><M::ManakaiDISDatabase.getResource>
2156 wakaba 1.19 (<Q::DOMCore:NO_MODIFICATION_ALLOWED_ERR>,
2157     for_arg => $for_uri);
2158 wakaba 1.31 my $subtype = $disResource->{db}
2159     -><M::ManakaiDISDatabase.getResource>
2160 wakaba 1.19 (<Q::MDOMX:NOMOD_THIS>,
2161     for_arg => $for_uri);
2162     $_-><AS::ManakaiDISResourceDefinition.isReferred>
2163     ($self) for $cls, $const, $subtype;
2164     my $context_param = $disResource-><M::ManakaiDISResourceDefinition
2165     .plGetContextParameter>;
2166     $disResource-><M::ManakaiDISResourceDefinition
2167     .plAppendThrow>
2168     ($qt, $cls, $const, $subtype,
2169     {%$context_param});
2170     $r = $q;
2171     } # Read-only checking
2172     } elsif ($et eq <Q::DOMMain:raiseException>) {
2173     my ($cls, $const, $subtype)
2174     = @{$disResource->{db}-><M::ManakaiDISDatabase.xcrefToResource>
2175     ($self-><M::SWCFGNode.value>,
2176     $self,
2177     node => $self,
2178     for_arg => $forArg)};
2179     my $context_param = $disResource-><M::ManakaiDISResourceDefinition
2180     .plGetContextParameter>;
2181     $disResource-><M::ManakaiDISResourceDefinition
2182     .plAppendThrow>
2183     ($r = $plimpl-><M::MPLImpl.createPerlBlockContainer>,
2184     $cls, $const, $subtype,
2185     {%$context_param});
2186     } elsif ({
2187     <Q::dis:ContentType> => true,
2188     <Q::dis:For> => true, <Q::dis:ForCheck> => true,
2189     <Q::dis:ImplNote> => true,
2190     <Q::DISLang:nop> => true,
2191     }->{$et}) {
2192     #
2193     } else {
2194     __UNDEEP{__EXCEPTION{UNSUPPORTED_ELEMENT_TYPE_ERR::
2195     DIS:sourceNode => {$self},
2196     DIS:elementType => {$et},
2197     }__}__;
2198     }
2199     }__; # DEEP
2200 wakaba 1.1 ##DISElement
2201    
2202 wakaba 1.19 ElementTypeBinding:
2203     @Name: disPerlException
2204     @ElementType:
2205     ManakaiDOM:raises
2206     @ShadowContent:
2207     @@@: DISPERL_NO_VALUE_ALLOWED_ERR
2208     @@Description:
2209     @@@lang:en
2210     @@@@:
2211     An element value is specified where it is not allowed.
2212     @ShadowSibling:
2213     @@ManakaiDOM:raises:
2214     @@@@: RESOURCE_NOT_DEFINED_ERR
2215     @@@Description:
2216     @@@@lang:en
2217     @@@@@:
2218     An undefined resource is referred or a referred resource
2219     is defined but have different type than the one expected.
2220     @@ManakaiDOM:raises:
2221     @@@@: NO_CONST_VALUE_ERR
2222     @@@Description:
2223     @@@@lang:en
2224     @@@@@:
2225     A constant value definition does not have its <Q::dis:Value>
2226     attribute.
2227     @@ManakaiDOM:raises:
2228     @@@@: NO_METHOD_RETURN_ERR
2229     @@@Description:
2230     @@@@lang:en
2231     @@@@@:
2232     A method definition does not have a <Q::DISLang:MethodReturn>
2233     child resource.
2234     @@ManakaiDOM:raises:
2235     @@@@: NO_ATTR_GET_ERR
2236     @@@Description:
2237     @@@@lang:en
2238     @@@@@:
2239     An attribute definition does not have a <Q::DISLang:AttributeGet>
2240     child resource.
2241     @@ManakaiDOM:raises:
2242     @@@@: NO_ATTR_SET_ERR
2243     @@@Description:
2244     @@@@lang:en
2245     @@@@@:
2246     An attribute setter is referred but the attribute definition
2247     does not have <Q::DISLang:AttributeSet> child resource.
2248     @@ManakaiDOM:raises:
2249     @@@@: UNSUPPORTED_ELEMENT_TYPE_ERR
2250     @@@Description:
2251     @@@@lang:en
2252     @@@@@:
2253     An unsupported type of element has appeared.
2254    
2255    
2256 wakaba 1.1 ClsDef:
2257 wakaba 1.4 @ClsQName: ManakaiDISModuleElement
2258     @ClsISA: ManakaiDISElement
2259     @enDesc:
2260     The <Q::dis:Module> elements.
2261    
2262     @Attr:
2263     @@Name: requireElement
2264     @@enDesc:
2265     The <Q::dis:Require> child element. The element is
2266     newly created if not exist.
2267     @@Type: ManakaiDISElement
2268     @@Get:
2269     @@@PerlDef:
2270     __DEEP{
2271 wakaba 1.29 $r = bless $self-><M::swcfg21:SWCFGNode
2272 wakaba 1.4 ::swcfg21:ForLatest.getAttributeNS>
2273 wakaba 1.29 (<Q::dis:>, 'Require', make_new_node => true),
2274     <ClassName::ManakaiDISElement>;
2275 wakaba 1.4 }__;
2276    
2277     @Attr:
2278     @@Name: defaultForURI
2279     @@enDesc:
2280     The value of <Q::dis:DefaultFor> attribute.
2281     @@Type: ForURI
2282     @@Get:
2283     @@@enDesc:
2284     The value of <Q::dis:DefaultFor> child element. If missing,
2285     <Q::ManakaiDOM:all> is returned.
2286     @@@PerlDef:
2287     __DEEP{
2288     my $df = $self-><M::swcfg21:SWCFGNode::swcfg21:ForLatest
2289     .getAttributeNS>
2290     (<Q::dis:>, 'DefaultFor');
2291     if ($df) {
2292 wakaba 1.29 $r = (bless $df, <ClassName::ManakaiDISElement>)
2293     -><AG::ManakaiDISElement.qnameValueURI>
2294 wakaba 1.4 || <Q::ManakaiDOM:all>;
2295     } else {
2296     $r = <Q::ManakaiDOM:all>;
2297     }
2298     }__;
2299     @@Set:
2300     @@@PerlDef:
2301     __DEEP{
2302     $self-><M::swcfg21:SWCFGNode::swcfg21:ForLatest.setAttributeNS>
2303     (<Q::dis:>, 'DefaultFor' => $given);
2304     }__;
2305 wakaba 1.7
2306     @Attr:
2307     @@Name: definingNamespaceURI
2308     @@enDesc:
2309     The value of <Q::dis:NamespaceURI> attribute, i.e.
2310     the URI reference of the namespace that this module primary
2311     defines.
2312     \
2313     {NOTE:: Defining namespace URI is <QUOTE::for> independent.
2314     \
2315     }
2316     @@Type: AnyURI
2317     @@Get:
2318     @@@PerlDef:
2319     __DEEP{
2320     my $df = $self-><M::swcfg21:SWCFGNode::swcfg21:ForLatest
2321     .getAttributeNS>
2322     (<Q::dis:>, 'Namespace');
2323     if ($df) {
2324 wakaba 1.14 $r = $df-><M::swcfg21:SWCFGNode::swcfg21:ForLatest.value>;
2325 wakaba 1.7 } else {
2326     __ASSERT{DISPerl:invariant::
2327     msg => {qq["dis:Namespace" attribute not found]},
2328     }__;
2329     }
2330     }__;
2331     @@Set:
2332     @@@PerlDef:
2333     __DEEP{
2334     $self-><M::swcfg21:SWCFGNode::swcfg21:ForLatest.setAttributeNS>
2335     (<Q::dis:>, 'Namespace' => $given);
2336     }__;
2337 wakaba 1.4 ##DISModuleElement
2338    
2339     ClsDef:
2340 wakaba 1.2 @ClsQName: ManakaiDISElementList
2341     @enDesc:
2342     @@lang:en
2343     @@@:
2344     Lists of elements.
2345     \
2346     {NOTE:: <Class::ManakaiDISElementList> is <QUOTE::dead>;
2347     later changes to the tree does not affect this type of objects.
2348     \
2349     }
2350     ##DISElementList
2351    
2352     ClsDef:
2353 wakaba 1.1 @ClsQName: ManakaiDISComment
2354 wakaba 1.7 @ClsISA: ManakaiDISNode
2355 wakaba 1.1 @ClsISA:
2356 wakaba 1.3 swcfg21:ManakaiSWCFGComment::swcfg21:ForLatest
2357 wakaba 1.1 @Description:
2358     @@lang:en
2359     @@@:
2360     <QUOTE::dis> comment node objects.
2361     ##DISComment
2362    
2363     ClsDef:
2364     @ClsQName: ManakaiDISDocumentFragment
2365 wakaba 1.7 @ClsISA: ManakaiDISNode
2366 wakaba 1.1 @ClsISA:
2367 wakaba 1.3 swcfg21:ManakaiSWCFGDocumentFragment::swcfg21:ForLatest
2368 wakaba 1.1 @Description:
2369     @@lang:en
2370     @@@:
2371     <QUOTE::dis> document fragment node objects.
2372     ##DISDocumentFragment
2373    
2374     ClsDef:
2375     @ClsQName: ManakaiDISDocument
2376 wakaba 1.7 @ClsISA: ManakaiDISNode
2377 wakaba 1.1 @ClsISA:
2378 wakaba 1.3 swcfg21:ManakaiSWCFGDocument::swcfg21:ForLatest
2379 wakaba 1.1 @Description:
2380     @@lang:en
2381     @@@:
2382     <QUOTE::dis> document node objects.
2383 wakaba 1.2
2384     @Attr:
2385 wakaba 1.4 @@Name: moduleElement
2386     @@enDesc:
2387     The <Q::dis:Module> element in this document. The element is
2388     newly created if not exist.
2389     @@Type: ManakaiDISModuleElement
2390     @@Get:
2391     @@@PerlDef:
2392     __DEEP{
2393     $r = $self-><M::swcfg21:SWCFGNode
2394     ::swcfg21:ForLatest.getAttributeNS>
2395     (<Q::dis:>, 'Module', make_new_node => true);
2396     }__;
2397     $r = bless $r, <ClassName::ManakaiDISModuleElement>;
2398    
2399     @Attr:
2400 wakaba 1.2 @@Name: disDatabase
2401     @@enDesc:
2402     Associated <QUOTE::dis> database.
2403    
2404     @@Type: ManakaiDISDatabase
2405     @@Get:
2406     @@@NoDBException:
2407     @@@PerlDef:
2408     if ($self->{<Q::TreeCore:node>}->{<Q::db>}) {
2409 wakaba 1.5 $r = $self->{<Q::TreeCore:node>}->{<Q::db>};
2410 wakaba 1.2 } else {
2411     __EXCEPTION{NO_ASSOCIATED_DB_ERR}__;
2412     }
2413     @@Set:
2414     @@@PerlDef:
2415     $self->{<Q::TreeCore:node>}->{<Q::db>} = $given;
2416     require Scalar::Util;
2417     Scalar::Util::weaken ($self->{<Q::TreeCore:node>}->{<Q::db>});
2418 wakaba 1.5
2419     @Method:
2420     @@Name: disChildElements
2421     @@enDesc:
2422 wakaba 1.10 A list of child elements, with <QUOTE::for> checks.
2423 wakaba 1.5 @@ForParam:
2424     @@ForpParam:
2425     @@Return:
2426     @@@Type: ManakaiDISElementList
2427     @@@enDesc:
2428     The current snapshot of child nodes.
2429     @@@PerlDef:
2430     $r = bless [], <ClassName::ManakaiDISElementList>;
2431     __DEEP{
2432     for my $cn (@{$self-><AG::swcfg21:SWCFGNode::swcfg21:ForLatest
2433     .childNodes>}) {
2434     next unless $cn-><AG::swcfg21:SWCFGNode::swcfg21:ForLatest
2435     .nodeType> eq '#element';
2436     my $dn = $cn->{<Q::TreeCore:node>}
2437     -><M::ManakaiDOM:ManakaiDOMNodeObject
2438     ::ManakaiDOM:Perl.newReference>
2439     (<ClassName::ManakaiDISElement>);
2440     next unless $dn-><M::ManakaiDISElement.forMatch> ($forArg, $forpArg);
2441     push @$r, $dn;
2442     }
2443     }__;
2444 wakaba 1.10
2445     @Method:
2446     @@Name: disAllChildElements
2447     @@enDesc:
2448     A list of child elements, without <QUOTE::for> checks.
2449     @@Return:
2450     @@@Type: ManakaiDISElementList
2451     @@@enDesc:
2452     The current snapshot of child nodes.
2453     @@@PerlDef:
2454     $r = bless [], <ClassName::ManakaiDISElementList>;
2455     __DEEP{
2456     for my $cn (@{$self-><AG::swcfg21:SWCFGNode::swcfg21:ForLatest
2457     .childNodes>}) {
2458     next unless $cn-><AG::swcfg21:SWCFGNode::swcfg21:ForLatest
2459     .nodeType> eq '#element';
2460     my $dn = $cn->{<Q::TreeCore:node>}
2461     -><M::ManakaiDOM:ManakaiDOMNodeObject
2462     ::ManakaiDOM:Perl.newReference>
2463     (<ClassName::ManakaiDISElement>);
2464     push @$r, $dn;
2465     }
2466     }__;
2467 wakaba 1.1 ##DISDocument
2468 wakaba 1.2
2469     PropDef:
2470     @QName: db
2471     @enDesc:
2472     Associated <QUOTE::dis> database.
2473     @rdfs:domain: ManakaiDISDocument
2474     @rdfs:range: ManakaiDISDatabase
2475    
2476     ## -- Definition object database
2477    
2478     ClsDef:
2479     @ClsQName: ManakaiDISDatabase
2480     @enDesc:
2481     Resource database created from <QUOTE::dis> source data.
2482 wakaba 1.4 @ClsISA: ManakaiDISExceptionTarget
2483 wakaba 1.2
2484     @Method:
2485     @@Name: getModule
2486     @@Description:
2487     @@@lang:en
2488     @@@@:
2489     Returns a <QUOTE::dis> module definition.
2490     @@Param:
2491 wakaba 1.9 @@@Name: moduleURI
2492 wakaba 1.2 @@@Type: ModuleURI
2493     @@@Description:
2494     @@@@lang:en
2495     @@@@@:
2496     A <QUOTE::dis> module URI reference.
2497 wakaba 1.9 @@ForParam:
2498 wakaba 1.2 @@Return:
2499     @@@Type: ManakaiDISModuleDefinition
2500     @@@Description:
2501     @@@@lang:en
2502     @@@@@:
2503     The module definition.
2504     @@@PerlDef:
2505 wakaba 1.9 my $modURI;
2506     if (defined $forArg) {
2507     __CODE{tfurisToURI:: $turi => $moduleURI, $furi => $forArg,
2508     $uri => $modURI}__;
2509     } else {
2510     $modURI = $moduleURI;
2511     }
2512 wakaba 1.2 if (defined $self->{modDef}->{$modURI}) {
2513     $r = $self->{modDef}->{$modURI};
2514     } else {
2515     $r = $self->{modDef}->{$modURI}
2516     = bless {
2517     uri => $modURI,
2518     db => $self,
2519     for => <Q::ManakaiDOM:all>,
2520     forp => [],
2521     }, <ClassName::ManakaiDISModuleDefinition>;
2522     require Scalar::Util;
2523     Scalar::Util::weaken ($r->{db});
2524     }
2525    
2526     @Method:
2527     @@Name: getFor
2528     @@Description:
2529     @@@lang:en
2530     @@@@:
2531     Returns a <QUOTE::for> definition object.
2532     @@Param:
2533     @@@Name: forURI
2534     @@@Type: ForURI
2535     @@@Description:
2536     @@@@lang:en
2537     @@@@@:
2538     A <QUOTE::for> URI reference.
2539     @@@InCase:
2540     @@@@Value:
2541     @@@@@is-null:1
2542     @@@@Description:
2543     @@@@@lang:en
2544     @@@@@@:
2545     Defaulted to <Q::ManakaiDOM:all>.
2546     @@Return:
2547     @@@Type: ManakaiDISForDefinition
2548     @@@PerlDef:
2549     $forURI = <Q::ManakaiDOM:all> unless defined $forURI;
2550     if (defined $self->{forDef}->{$forURI}) {
2551     $r = $self->{forDef}->{$forURI};
2552     } else {
2553     $r = $self->{forDef}->{$forURI}
2554     = bless {
2555     uri => $forURI,
2556     isa => {<Q::ManakaiDOM:all> => true},
2557     revISA => {},
2558     db => $self,
2559     }, <ClassName::ManakaiDISForDefinition>;
2560     $self->{forDef}->{<Q::ManakaiDOM:all>}->{revISA}->{$forURI} = true;
2561     require Scalar::Util;
2562     Scalar::Util::weaken ($r->{db});
2563     }
2564    
2565     @Method:
2566     @@Name: getResource
2567     @@Description:
2568     @@@lang:en
2569     @@@@:
2570     Returns a <QUOTE::dis> resource definition.
2571     @@Param:
2572 wakaba 1.9 @@@Name: resourceURI
2573 wakaba 1.2 @@@Type: ResourceURI
2574     @@@Description:
2575     @@@@lang:en
2576     @@@@@:
2577     A <QUOTE::dis> resource URI reference.
2578 wakaba 1.3 @@@nullCase:
2579 wakaba 1.2 @@@@Description:
2580     @@@@@lang:en
2581     @@@@@@:
2582     Defaulted to <Q::DOMMain:any>.
2583 wakaba 1.9 @@ForParam:
2584 wakaba 1.2 @@Return:
2585     @@@Type: ManakaiDISResourceDefinition
2586     @@@Description:
2587     @@@@lang:en
2588     @@@@@:
2589     The resource definition.
2590     @@@PerlDef:
2591 wakaba 1.9 $resourceURI = <Q::DOMMain:any> unless defined $resourceURI;
2592     my $resURI;
2593     if (defined $forArg) {
2594     __CODE{tfurisToURI:: $turi => $resourceURI, $furi => $forArg,
2595     $uri => $resURI}__;
2596     } else {
2597     $resURI = $resourceURI;
2598     }
2599 wakaba 1.2 if (defined $self->{resDef}->{$resURI}) {
2600     $r = $self->{resDef}->{$resURI};
2601     } else {
2602     $r = $self->{resDef}->{$resURI}
2603     = bless {
2604     uri => $resURI,
2605 wakaba 1.6 aliasURI => {$resURI => true},
2606 wakaba 1.2 subOf => {},
2607     supOf => {},
2608     db => $self,
2609     for => <Q::ManakaiDOM:all>,
2610     forp => [],
2611 wakaba 1.9 seq => -1,
2612 wakaba 1.2 }, <ClassName::ManakaiDISResourceDefinition>;
2613     require Scalar::Util;
2614     Scalar::Util::weaken ($r->{db});
2615     }
2616 wakaba 1.3
2617     @Method:
2618     @@Name: getSourceFile
2619     @@enDesc:
2620     Gets <QUOTE::dis> source document.
2621     @@Param:
2622     @@@Name: fileName
2623     @@@Type: FileURI
2624     @@@enDesc:
2625     A URI reference identifying a file.
2626     @@Return:
2627     @@@Type: ManakaiDISDocument
2628     @@@enDesc:
2629     The <QUOTE::dis> source document.
2630     @@@nullCase:
2631     @@@@enDesc:
2632     No document associated with that <P::fileName>.
2633     @@@PerlDef:
2634     $r = $self->{<Q::sourceFile>}->{$fileName};
2635     @Method:
2636     @@Name: setSourceFile
2637     @@enDesc:
2638     Puts <QUOTE::dis> source document object.
2639     @@Param:
2640     @@@Name: fileName
2641     @@@Type: FileURI
2642     @@@enDesc:
2643 wakaba 1.4 A URI reference identifying a file. If there is already a
2644 wakaba 1.3 source document, then the association has been updated.
2645     @@Param:
2646     @@@Name: doc
2647     @@@Type: ManakaiDISDocument
2648     @@@enDesc:
2649     The document object to set.
2650     @@Return:
2651     @@@PerlDef:
2652     $self->{<Q::sourceFile>}->{$fileName} = $doc;
2653 wakaba 1.4
2654     @Method:
2655     @@Name: loadModule
2656     @@enDesc:
2657     Loads definitions from a <QUOTE::dis> document.
2658     @@Param:
2659     @@@Name: doc
2660     @@@Type:ManakaiDISDocument
2661     @@@enDesc:
2662     The source <QUOTE::dis> document object. Its
2663     <A::ManakaiDISDocument.disDatabase> must be this database.
2664     @@Param:
2665     @@@Name: resolver
2666     @@@Type: DISModuleResolver
2667     @@@enDesc:
2668     The resolver to convert module name into <QUOTE::dis> document object.
2669     @@ForParam:
2670 wakaba 1.32 @@NamedParam:
2671     @@@Name: onResourceRead
2672     @@@Type:
2673     Perl:CODE::ManakaiDOM:all
2674     @@@enDesc:
2675     An event handler called when a resource is read.
2676     @@@nullCase:
2677     @@@@enDesc:
2678     No event handler is read.
2679 wakaba 1.4 @@Return:
2680     @@@RaiseException:
2681     @@@@@: NO_MODULE_QNAME_ERR
2682     @@@@enDesc:
2683     The <Q::dis:Module> element must have a <Q::dis:QName> attribute.
2684     @@@RaiseException:
2685     @@@@@: UNABLE_TO_GET_MODULE_ERR
2686     @@@@enDesc:
2687     The implementation is unable to get a module source.
2688 wakaba 1.5 @@@ForDefDupException:
2689     @@@ForDefNoQNameException:
2690     @@@ResDefDupException:
2691     @@@ElementNotAllowedException:
2692 wakaba 1.7 @@@RaiseException:
2693     @@@@@:NO_REQUIRED_ATTR_ERR
2694     @@@@enDesc:
2695     The <Q::dis:Module> element does not have
2696     <Q::dis:Namespace> attribute.
2697 wakaba 1.4 @@@PerlDef:
2698     $resolver = bless $resolver, <ClassName::ManakaiDISModuleResolver>
2699     if ref $resolver eq 'CODE';
2700     ## -- Module Name, URI
2701     $forArg = <Q::ManakaiDOM:all> unless defined $forArg;
2702     my $mod_node;
2703     my $mod_name_node;
2704     __DEEP{
2705     $mod_node = $doc-><AG::ManakaiDISDocument.moduleElement>;
2706     $mod_name_node = $mod_node-><M::swcfg21:SWCFGNode
2707     ::swcfg21:ForLatest.getAttributeNS>
2708     (<Q::dis:>, 'QName');
2709     unless ($mod_name_node) {
2710     __UNDEEP{
2711     __EXCEPTION{NO_MODULE_QNAME_ERR::
2712     DIS:sourceNode => {$mod_node},
2713     }__;
2714     }__;
2715     }
2716 wakaba 1.29 $mod_name_node = bless $mod_name_node, <ClassName::ManakaiDISElement>;
2717 wakaba 1.5 my $mod_name_uri = $mod_name_node
2718     -><AG::ManakaiDISElement.qnameValueURI>;
2719 wakaba 1.9 my $mod = $self-><M::ManakaiDISDatabase.getModule>
2720     ($mod_name_uri, for_arg => $forArg);
2721 wakaba 1.4
2722 wakaba 1.14 unless ($mod-><AG::ManakaiDISModuleDefinition.isDefined>) {
2723 wakaba 1.4 ## -- Initializes Module Definition Object
2724     $mod->{nameURI} = $mod_name_uri;
2725     $mod->{localName} = $mod_name_node-><AG::ManakaiDISElement
2726     .qnameValueLocalName>;
2727     $mod->{namespaceURI} = $mod_name_node-><AG::ManakaiDISElement
2728     .qnameValueNamespaceURI>;
2729     $mod->{for} = $forArg;
2730     $mod->{src} = $mod_node;
2731 wakaba 1.5 $mod->{<Q::isDefined>} = true;
2732 wakaba 1.4 $self-><M::ManakaiDISDatabase.setSourceFile>
2733 wakaba 1.5 ($mod->{nameURI} => $doc);
2734    
2735 wakaba 1.9 $mod->{<Q::DIS:sourceFile>}
2736     = $mod->{src}
2737     -><AG::swcfg21:SWCFGNode::swcfg21:ForLatest.ownerDocument>
2738     -><M::swcfg21:SWCFGNode::swcfg21:ForLatest.flag>
2739     (<Q::swcfg21:fileName>);
2740 wakaba 1.5
2741 wakaba 1.12 ## -- Loads "for" definition
2742     my $root_elements
2743     = $doc-><M::ManakaiDISDocument.disAllChildElements>;
2744     if ($mod->{for} eq <Q::ManakaiDOM:all>) {
2745     for my $el (@$root_elements) {
2746 wakaba 1.14 next unless $el-><AG::swcfg21:SWCFGElement::swcfg21:ForLatest
2747 wakaba 1.12 .expandedURI> eq <Q::dis:ForDef>;
2748     $self-><M::ManakaiDISDatabase.loadFor> ($mod, $el);
2749     }
2750     }
2751    
2752 wakaba 1.5 ## -- Loads "for all"
2753 wakaba 1.9 my $rmod = $self-><M::ManakaiDISDatabase.getModule>
2754     ($mod->{nameURI}, for_arg => <Q::ManakaiDOM:all>);
2755 wakaba 1.5 unless ($rmod-><AG::ManakaiDISModuleDefinition.isDefined>) {
2756     my $rdoc = $resolver-><M::ManakaiDISModuleResolver.uriToDocument>
2757 wakaba 1.9 ($self, $rmod->{uri}, $mod->{namespaceURI},
2758     $mod->{localName}, <Q::ManakaiDOM:all>);
2759 wakaba 1.5 unless ($rdoc) {
2760     __UNDEEP{
2761     __EXCEPTION{UNABLE_TO_GET_MODULE_ERR::
2762 wakaba 1.9 DIS:uri => {$rmod->{uri}},
2763 wakaba 1.5 DIS:namespaceURI => {$mod->{namespaceURI}},
2764     DIS:localName => {$mod->{localName}},
2765 wakaba 1.9 DIS:for => {<Q::ManakaiDOM:all>},
2766 wakaba 1.5 DIS:sourceNode => {$mod->{src}},
2767     }__;
2768     }__;
2769     }
2770     $self-><M::ManakaiDISDatabase.loadModule>
2771 wakaba 1.32 ($rdoc, $resolver, for_arg => <Q::ManakaiDOM:all>,
2772     on_resource_read => $onResourceRead);
2773 wakaba 1.5 } # Unless "for all" loaded
2774 wakaba 1.4
2775     ## -- Loads Required Modules
2776 wakaba 1.10 ## NOTE:: "dis:For" is not allowed since "dis:ForDef" is not read
2777 wakaba 1.4 my $req_node = $mod_node-><AG::ManakaiDISModuleElement
2778     .requireElement>;
2779 wakaba 1.10 for my $rm (@{$req_node-><M::ManakaiDISElement
2780     .disAllChildElements>}) {
2781 wakaba 1.4 next unless $rm-><AG::swcfg21:SWCFGElement::swcfg21:ForLatest
2782     .expandedURI> eq <Q::dis:Module>;
2783     my ($uri, $nuri, $ln, $for);
2784 wakaba 1.14 my $mqn = $rm-><M::swcfg21:SWCFGNode::swcfg21:ForLatest
2785 wakaba 1.4 .getAttributeNS> (<Q::dis:>, 'QName');
2786     if ($mqn) {
2787 wakaba 1.14 my $mqv = $mqn-><M::swcfg21:SWCFGNode::swcfg21:ForLatest
2788 wakaba 1.4 .value>;
2789 wakaba 1.29 my $mqp = (bless $mqn, <ClassName::ManakaiDISElement>)
2790     -><M::ManakaiDISElement.qnameToPair>
2791 wakaba 1.4 ($mqv, node => $mqn);
2792     ($nuri, $ln) = @$mqp;
2793     } else {
2794 wakaba 1.14 my $mn = $rm-><M::swcfg21:SWCFGNode::swcfg21:ForLatest
2795 wakaba 1.4 .getAttributeNS> (<Q::dis:>, 'Name');
2796     if ($mn) {
2797     $nuri = $mod->{namespaceURI};
2798 wakaba 1.14 $ln = $mn-><M::swcfg21:SWCFGNode::swcfg21:ForLatest.value>;
2799 wakaba 1.4 } else {
2800     $nuri = $mod->{namespaceURI};
2801     $ln = $mod->{localName};
2802     }
2803     }
2804 wakaba 1.14 my $wfn = $rm-><M::swcfg21:SWCFGNode::swcfg21:ForLatest
2805 wakaba 1.4 .getAttributeNS> (<Q::dis:>, 'WithFor');
2806     if ($wfn) {
2807 wakaba 1.29 $for = (bless $wfn, <ClassName::ManakaiDISElement>)
2808     -><AG::ManakaiDISElement.qnameValueURI>;
2809 wakaba 1.4 } else {
2810     $for = $mod->{for};
2811     }
2812 wakaba 1.9 my $rmod = $self-><M::ManakaiDISDatabase.getModule>
2813     ($nuri . $ln, for_arg => $for);
2814 wakaba 1.4 unless ($rmod-><AG::ManakaiDISModuleDefinition.isDefined>) {
2815     my $rdoc = $resolver-><M::ManakaiDISModuleResolver.uriToDocument>
2816 wakaba 1.9 ($self, $rmod->{uri}, $nuri, $ln, $for);
2817 wakaba 1.4 unless ($rdoc) {
2818     __UNDEEP{
2819     __EXCEPTION{UNABLE_TO_GET_MODULE_ERR::
2820 wakaba 1.9 DIS:uri => {$rmod->{uri}},
2821 wakaba 1.4 DIS:namespaceURI => {$nuri},
2822     DIS:localName => {$ln},
2823     DIS:for => {$for},
2824     DIS:sourceNode => {$rm},
2825     }__;
2826     }__;
2827     }
2828     $self-><M::ManakaiDISDatabase.loadModule>
2829 wakaba 1.32 ($rdoc, $resolver, for_arg => $for,
2830     on_resource_read => $onResourceRead);
2831 wakaba 1.4 }
2832     } # Child Module elements
2833    
2834 wakaba 1.12 ## -- Loads child resources
2835 wakaba 1.10 $root_elements = $doc-><M::ManakaiDISDocument.disChildElements>
2836     (for_arg => $forArg);
2837 wakaba 1.5 for my $el (@$root_elements) {
2838 wakaba 1.11 if ($el-><AG::ManakaiDISElement.isResourceElement>) {
2839 wakaba 1.7 $self-><M::ManakaiDISDatabase.loadResource>
2840 wakaba 1.9 ($mod, null, null, $el,
2841 wakaba 1.32 for_arg => $forArg,
2842     on_resource_read => $onResourceRead);
2843 wakaba 1.7 } else {
2844 wakaba 1.14 my $et = $el-><AG::swcfg21:SWCFGElement::swcfg21:ForLatest
2845 wakaba 1.7 .expandedURI>;
2846     if ({
2847 wakaba 1.5 <Q::dis:ForDef> => 1,
2848     <Q::dis:Module> => 1,
2849     <Q::dis:ImplNote> => 1,
2850 wakaba 1.7 }->{$et}) {
2851     #
2852     } else {
2853     __UNDEEP{
2854     __EXCEPTION{ELEMENT_NOT_ALLOWED_ERR::
2855     DIS:elementType => {$et},
2856     DIS:sourceNode => {$el},
2857     DIS:uri => {$mod->{uri}},
2858     }__;
2859 wakaba 1.5 }__;
2860 wakaba 1.7 }
2861     } # element types
2862     }
2863    
2864     my $dn = $mod_node-><M::swcfg21:SWCFGNode::swcfg21:ForLatest
2865     .getAttributeNS>
2866     (<Q::dis:>, 'Namespace');
2867 wakaba 1.14 unless ($dn and defined $dn-><M::swcfg21:SWCFGNode
2868     ::swcfg21:ForLatest.value>) {
2869 wakaba 1.7 __UNDEEP{
2870     __EXCEPTION{NO_REQUIRED_ATTR_ERR::
2871     DIS:elementType => {<Q::dis:Namespace>},
2872     DIS:sourceNode => {$mod_node},
2873 wakaba 1.5 }__;
2874 wakaba 1.7 }__;
2875 wakaba 1.5 }
2876     } # Unless this module loaded
2877     }__; # Deep
2878    
2879     @Method:
2880     @@Name: loadFor
2881     @@enDesc:
2882     Loads definition of a <QUOTE::for> from a <Q::dis:ForDef> element.
2883     @@Param:
2884     @@@Name: mod
2885     @@@Type: ManakaiDISModuleDefinition
2886     @@@enDesc:
2887     The module in which the <QUOTE::for> to load is defined.
2888     @@Param:
2889     @@@Name: el
2890     @@@Type:ManakaiDISElement
2891     @@@enDesc:
2892     The source <QUOTE::dis> <Q::dis:ForDef> element object.
2893     @@Return:
2894     @@@ForDefDupException:
2895     @@@ForDefNoQNameException:
2896     @@@ElementNotAllowedException:
2897     @@@PerlDef:
2898     __DEEP{
2899     my $qn_node = $el-><M::swcfg21:SWCFGNode
2900     ::swcfg21:ForLatest.getAttributeNS>
2901     (<Q::dis:>, 'QName');
2902     unless ($qn_node) {
2903     __UNDEEP{
2904     __EXCEPTION{NO_FOR_QNAME_ERR::
2905     DIS:sourceNode => {$qn_node},
2906     }__;
2907     }__;
2908     }
2909 wakaba 1.29 $qn_node = bless $qn_node, <ClassName::ManakaiDISElement>;
2910 wakaba 1.5 my $qn_uri = $qn_node-><AG::ManakaiDISElement.qnameValueURI>;
2911     my $for = $self-><M::ManakaiDISDatabase.getFor> ($qn_uri);
2912    
2913 wakaba 1.14 unless ($for-><AG::ManakaiDISForDefinition.isDefined>) {
2914 wakaba 1.10 ## -- Initializes "For" Definition Object
2915 wakaba 1.5 $for->{src} = $el;
2916     $for->{<Q::isDefined>} = true;
2917     $for->{<Q::definingModule>} = $mod->{uri};
2918    
2919 wakaba 1.10 for my $ce (@{$el-><M::ManakaiDISElement.disAllChildElements>}) {
2920 wakaba 1.5 my $xn = $ce-><AG::swcfg21:SWCFGElement::swcfg21:ForLatest
2921     .expandedURI>;
2922     if ($xn eq <Q::dis:ISA> or $xn eq <Q::dis:Implement>) {
2923     my $sfor = $self-><M::ManakaiDISDatabase.getFor>
2924 wakaba 1.7 ($ce-><AG::ManakaiDISElement.qnameValueURI>);
2925 wakaba 1.5 $for-><M::ManakaiDISForDefinition.addISA> ($sfor);
2926 wakaba 1.14 $sfor-><AS::ManakaiDISForDefinition.isReferred> ($ce);
2927 wakaba 1.5 ## TODO: warn if dis:Implement
2928     } elsif ({
2929     <Q::dis:Description> => 1,
2930     <Q::dis:ImplNote> => 1,
2931     <Q::dis:FullName> => 1,
2932     <Q::dis:QName> => 1,
2933     }->{$xn}) {
2934     #
2935     } else {
2936     __UNDEEP{
2937     __EXCEPTION{ELEMENT_NOT_ALLOWED_ERR::
2938     DIS:elementType => {$xn},
2939     DIS:sourceNode => {$ce},
2940     DIS:uri => {$mod->{uri}},
2941     }__;
2942     }__;
2943     }
2944     }
2945     } else {
2946     __UNDEEP{
2947     __EXCEPTION{FOR_ALREADY_DEFINED_ERR::
2948     DIS:sourceNode => {$el},
2949     DIS:anotherSourceNode => {$for->{src}},
2950     }__;
2951     }__;
2952     } # isDefine?
2953     }__; # DEEP
2954    
2955     @Method:
2956     @@Name: loadResource
2957     @@enDesc:
2958     Loads definition of a <QUOTE::dis> resource from a
2959     <Q::dis:ResourceDef> element.
2960     @@Param:
2961     @@@Name: mod
2962     @@@Type: ManakaiDISModuleDefinition
2963     @@@enDesc:
2964     The module in which the resource to load is defined.
2965     @@Param:
2966     @@@Name: parentResource
2967     @@@Type: ManakaiDISResourceDefinition
2968     @@@enDesc:
2969 wakaba 1.7 The (static) parent resource in which the resource to load is defined.
2970 wakaba 1.5 @@@nullCase:
2971     @@@@enDesc:
2972     The resource to load is a root resource, i.e. <P::el> is
2973     a direct child of the document node.
2974     @@Param:
2975 wakaba 1.7 @@@Name: dynParent
2976 wakaba 1.9 @@@Type: ManakaiDISResourceDefinition
2977 wakaba 1.7 @@@enDesc:
2978     The dynamic parent resource of the resource to load.
2979 wakaba 1.9 @@@nullCase:
2980 wakaba 1.7 @@@@enDesc:
2981 wakaba 1.9 If this resource is a root resource, i.e. <P::el> is
2982     a direct child of the document node.
2983 wakaba 1.7 @@Param:
2984 wakaba 1.5 @@@Name: el
2985     @@@Type:ManakaiDISElement
2986     @@@enDesc:
2987     The source <QUOTE::dis> <Q::dis:ResourceDef> element object.
2988     @@ForParam:
2989     @@ForpParam:
2990 wakaba 1.32 @@NamedParam:
2991     @@@Name: onResourceRead
2992     @@@Type:
2993     Perl:CODE::ManakaiDOM:all
2994     @@@enDesc:
2995     An event handler called when a resource is read.
2996     @@@nullCase:
2997     @@@@enDesc:
2998     No event handler is read.
2999 wakaba 1.5 @@Return:
3000     @@@ResDefDupException:
3001     @@@ElementNotAllowedException:
3002     @@@PerlDef:
3003     $forArg = <Q::ManakaiDOM:all> unless defined $forArg;
3004     $forpArg ||= [];
3005     __DEEP{
3006 wakaba 1.6 ## -- Node names
3007    
3008     ## Unique resource identifier generated from node id
3009     my $node_id = $el-><AG::swcfg21:SWCFGNode::swcfg21:ForLatest.nodeID>;
3010     my $node_uri;
3011     __CODE{tfpurisToURI:: $turi => $node_id, $furi => $forArg,
3012     $forp => $forpArg, $uri => $node_uri}__;
3013    
3014     ## User defined resource identifiers
3015 wakaba 1.5 my $qn_node = $el-><M::ManakaiDISElement.disGetAttribute>
3016     (<Q::dis:QName>, for_arg => $forArg,
3017     forp_arg => $forpArg);
3018     my $res;
3019     if ($qn_node) {
3020     my $qn_uri = $qn_node-><AG::ManakaiDISElement.qnameValueURI>;
3021 wakaba 1.9 $res = $self-><M::ManakaiDISDatabase.getResource>
3022     ($qn_uri, for_arg => $forArg);
3023 wakaba 1.14 if ($res-><AG::ManakaiDISForDefinition.isDefined>) {
3024 wakaba 1.5 __UNDEEP{
3025     __EXCEPTION{RESOURCE_ALREADY_DEFINED_ERR::
3026 wakaba 1.9 DIS:uri => {$res->{uri}},
3027 wakaba 1.5 DIS:sourceNode => {$qn_node},
3028     DIS:anotherSourceNode => {$res->{src}},
3029     }__;
3030 wakaba 1.6 }__;
3031 wakaba 1.5 }
3032     $res->{nameURI} = $qn_uri;
3033     $res->{localName} = $qn_node-><AG::ManakaiDISElement
3034     .qnameValueLocalName>;
3035     $res->{namespaceURI} = $qn_node-><AG::ManakaiDISElement
3036     .qnameValueNamespaceURI>;
3037     } else { ## Anonymous or local
3038     my $n_node = $el-><M::ManakaiDISElement.disGetAttribute>
3039     (<Q::dis:Name>, for_arg => $forArg,
3040     forp_arg => $forpArg);
3041     if ($n_node) {
3042     if ($parentResource) {
3043     my $puri = $parentResource->{uri};
3044     my $ru;
3045 wakaba 1.14 my $ln = $n_node-><M::swcfg21:SWCFGNode
3046     ::swcfg21:ForLatest.value>;
3047 wakaba 1.5 __CODE{getChildResourceURI:: $parentURI => $puri,
3048     $localName => $ln,
3049     $result => $ru}__;
3050 wakaba 1.9 $res = $self-><M::ManakaiDISDatabase.getResource>
3051     ($ru, for_arg => $forArg);
3052 wakaba 1.5 $res->{nameURI} = $ru;
3053 wakaba 1.14 $res->{localName} = $n_node-><M::swcfg21:SWCFGNode
3054     ::swcfg21:ForLatest.value>;
3055 wakaba 1.5 $res->{<Q::isAnon>} = true;
3056     } else { ## Root local name resource
3057 wakaba 1.14 my $ln = $n_node-><M::swcfg21:SWCFGNode
3058 wakaba 1.7 ::swcfg21:ForLatest.value>;
3059     my $ns_uri = $mod-><M::ManakaiDISPropertyAccessor
3060     .getPropertyText>
3061     (<Q::dis:Namespace>, null);
3062     my $qn_uri = $ns_uri . $ln;
3063 wakaba 1.9 $res = $self-><M::ManakaiDISDatabase.getResource>
3064     ($qn_uri, for_arg => $forArg);
3065 wakaba 1.14 if ($res-><AG::ManakaiDISForDefinition.isDefined>) {
3066 wakaba 1.6 __UNDEEP{
3067     __EXCEPTION{RESOURCE_ALREADY_DEFINED_ERR::
3068 wakaba 1.9 DIS:uri => {$res->{uri}},
3069 wakaba 1.6 DIS:sourceNode => {$n_node},
3070     DIS:anotherSourceNode => {$res->{src}},
3071     }__;
3072     }__;
3073     }
3074     $res->{nameURI} = $qn_uri;
3075 wakaba 1.7 $res->{namespaceURI} = $ns_uri;
3076     $res->{localName} = $ln;
3077 wakaba 1.5 }
3078     } else {
3079 wakaba 1.6 $res = $self-><M::ManakaiDISDatabase.getResource> ($node_uri);
3080 wakaba 1.5 $res->{<Q::isAnon>} = true;
3081     }
3082 wakaba 1.6 } # anon
3083 wakaba 1.5 $res->{for} = $forArg;
3084     $res->{forp} = $forpArg;
3085     $res->{src} = $el;
3086     $res->{<Q::definingModule>} = $mod->{uri};
3087 wakaba 1.9 $mod-><M::ManakaiDISPropertyAccessor.addPropertyResourceList>
3088     (<Q::DIS:resource>, $res);
3089 wakaba 1.8 $res->{<Q::dis2pm:parentResource>}
3090     = $parentResource ? $parentResource->{uri} : null;
3091     $res->{<Q::dynamicParentResource>}
3092 wakaba 1.9 = $dynParent ? $dynParent->{uri} : null;
3093     unless ($res->{uri} eq $node_uri) {
3094     my $nu_res = $self-><M::ManakaiDISDatabase.getResource> ($node_uri);
3095     $res-><M::ManakaiDISResourceDefinition.mergeAsAlias> ($nu_res);
3096     }
3097 wakaba 1.7 $res->{<Q::isDefined>} = true;
3098 wakaba 1.9 $res->{seq} = $self->{seq}++;
3099 wakaba 1.32 $res->{<Q::sourceNodeID>} = $node_id;
3100 wakaba 1.9
3101 wakaba 1.6 ## -- Alias
3102     my $al_node = $el-><M::ManakaiDISElement.disGetAttribute>
3103     (<Q::dis:AliasFor>, for_arg => $forArg,
3104     forp_arg => $forpArg);
3105     if ($al_node) {
3106     my $canon_uri = $al_node-><M::ManakaiDISElement.tfqnamesValueURI>
3107 wakaba 1.33 ($node_id, $forArg,
3108     for_arg => $self->{for},
3109     forp_arg => $self->{forp});
3110 wakaba 1.6 my $canon_res = $self-><M::ManakaiDISDatabase.getResource>
3111     ($canon_uri);
3112 wakaba 1.14 $canon_res-><AS::ManakaiDISResourceDefinition.isReferred> ($al_node);
3113 wakaba 1.11 $canon_res-><M::ManakaiDISResourceDefinition.mergeAsAlias>
3114     ($res, node => $al_node);
3115 wakaba 1.6 $res = $canon_res;
3116     }
3117 wakaba 1.5
3118 wakaba 1.11 ## -- Registers as child
3119     $parentResource-><M::ManakaiDISPropertyAccessor
3120     .addPropertyResourceList>
3121     (<Q::DIS:childResource>, $res)
3122     if $parentResource;
3123     $dynParent-><M::ManakaiDISPropertyAccessor
3124     .addPropertyResourceList>
3125     (<Q::DIS:dynamicChildResource>, $res)
3126     if $dynParent;
3127    
3128 wakaba 1.7 my $is_multires = false;
3129     my @props;
3130     my @cres;
3131 wakaba 1.10 my @ce0 = @{$el-><M::ManakaiDISElement.disChildElements>
3132     (for_arg => $forArg, forp_arg => $forpArg)};
3133 wakaba 1.7 while (@ce0) {
3134     my $ce = shift @ce0;
3135     if ($ce-><M::ManakaiDISElement.elementTypeMatch> (<Q::rdf:type>)) {
3136     my $type_uri = $ce-><AG::ManakaiDISElement.qnameValueURI>;
3137     $res->{<Q::rdf:type>}->{$type_uri} = true;
3138     my $type = $self-><M::ManakaiDISDatabase.getResource> ($type_uri);
3139 wakaba 1.14 $type-><AS::ManakaiDISResourceDefinition.isReferred> ($ce);
3140 wakaba 1.7 if ($type-><M::ManakaiDISResourceDefinition.isSubsetOfURI>
3141     (<Q::dis:MultipleResource>)) {
3142     $is_multires = true;
3143     }
3144     } elsif ($ce-><M::ManakaiDISElement.elementTypeMatch>
3145     (<Q::dis:subsetOf>)) {
3146     my $sres = $self-><M::ManakaiDISDatabase.getResource>
3147     ($ce-><M::ManakaiDISElement.tfqnamesValueURI>
3148 wakaba 1.33 ($node_id, $forArg,
3149     for_arg => $forArg, forp_arg => $forpArg));
3150 wakaba 1.7 $res-><M::ManakaiDISResourceDefinition.addSuperResource> ($sres);
3151 wakaba 1.11 } elsif ($ce-><AG::ManakaiDISElement.isResourceElement>) {
3152 wakaba 1.7 push @cres, $ce;
3153     } else {
3154     ## Property and invalid element is not checked, since not
3155     ## all property definitions has loaded at this stage.
3156     push @props, $ce;
3157     }
3158     } # @ce0
3159    
3160     ## -- Child resources
3161     unless ($is_multires) {
3162     for my $re (@cres) {
3163     unless ($al_node) {
3164     $self-><M::ManakaiDISDatabase.loadResource>
3165     ($mod, $res, $res, $re,
3166 wakaba 1.32 for_arg => $forArg, forp_arg => $forpArg,
3167     on_resource_read => $onResourceRead);
3168 wakaba 1.5 } else {
3169 wakaba 1.7 my $ac = $re-><M::ManakaiDISElement.disGetAttribute>
3170     (<Q::dis:aliasChild>, for_arg => $forArg,
3171     forp_arg => $forpArg);
3172     if ($ac and $ac-><M::swcfg21:SWCFGNode
3173     ::swcfg21:ForLatest.value>) {
3174     $self-><M::ManakaiDISDatabase.loadResource>
3175     ($mod, $res, $res, $re,
3176 wakaba 1.32 for_arg => $forArg, forp_arg => $forpArg,
3177     on_resource_read => $onResourceRead);
3178 wakaba 1.7 }
3179 wakaba 1.4 }
3180     }
3181 wakaba 1.7 }
3182 wakaba 1.5
3183 wakaba 1.7 ## -- Multiple representations
3184     if ($is_multires) {
3185     for my $pe (@props) {
3186     if ($pe-><M::ManakaiDISElement.elementTypeMatch>
3187 wakaba 1.10 (<Q::dis:resourceFor>)) {
3188 wakaba 1.14 my $for_uri = $pe-><AG::ManakaiDISElement.qnameValueURI>;
3189 wakaba 1.7 my $for = $self-><M::ManakaiDISDatabase.getFor> ($for_uri);
3190 wakaba 1.14 $for-><AS::ManakaiDISForDefinition.isReferred> ($pe);
3191 wakaba 1.7 $self-><M::ManakaiDISDatabase.loadResource>
3192     ($mod, $parentResource, $res, $el,
3193     for_arg => $forArg,
3194 wakaba 1.32 forp_arg => [@{$forpArg}, $for_uri],
3195     on_resource_read => $onResourceRead);
3196 wakaba 1.7 }
3197     }
3198     }
3199 wakaba 1.32 ($onResourceRead or sub {})->($self, $res);
3200 wakaba 1.5 }__; # DEEP
3201 wakaba 1.8
3202     @Method:
3203     @@Name: checkUndefinedResource
3204     @@enDesc:
3205     Checks whether there is referred but undefined resource or not.
3206     @@Return:
3207     @@@RaiseException:
3208     @@@@@: FOR_NOT_DEFINED_ERR
3209     @@@@enDesc:
3210     There is a <QUOTE::for> that is referred but not defined.
3211     @@@RaiseException:
3212     @@@@@: RESOURCE_NOT_DEFINED_ERR
3213     @@@@enDesc:
3214     There is a resource that is referred but not defined.
3215     @@@PerlDef:
3216     for my $fd (values %{$self->{forDef}}) {
3217     if (my $ref = $fd-><AG::ManakaiDISForDefinition.isReferred> and
3218     not $fd-><AG::ManakaiDISForDefinition.isDefined>) {
3219     __EXCEPTION{FOR_NOT_DEFINED_ERR::
3220     DIS:uri => {$fd->{uri}},
3221     DIS:sourceNode => {$ref},
3222     }__;
3223     }
3224     }
3225     for my $fd (values %{$self->{resDef}}) {
3226     if (my $ref = $fd-><AG::ManakaiDISResourceDefinition.isReferred> and
3227     not $fd-><AG::ManakaiDISResourceDefinition.isDefined>) {
3228     __EXCEPTION{RESOURCE_NOT_DEFINED_ERR::
3229     DIS:uri => {$fd->{uri}},
3230     DIS:sourceNode => {$ref},
3231     }__;
3232     }
3233     }
3234 wakaba 1.5
3235 wakaba 1.9
3236     @Method:
3237     @@Name: plStore
3238     @@enDesc:
3239     Saves this database to an external file.
3240     \
3241     {NOTE:: Saved files can be loaded by
3242     <M::ManakaiDISImplementation.plLoadDISDatabase>.
3243     \
3244     }
3245     @@Param:
3246     @@@Name: fileName
3247     @@@Type:
3248 wakaba 1.18 DISLang:String::ManakaiDOM:all
3249 wakaba 1.9 @@@enDesc:
3250     An environment-dependent file name of external database to save.
3251     \
3252     {NOTE:: If there is already a file named as <P::fileName>, then
3253     it is overwritten.
3254     \
3255     }
3256     @@Return:
3257     @@@SimpleException:
3258     @@@PerlDef:
3259     use Storable qw/nstore/;
3260     local $Carp::CarpLevel = $Carp::CarpLevel + 1;
3261     nstore $self, $fileName;
3262 wakaba 1.15
3263     @Method:
3264     @@Name: xcrefToResource
3265     @@enDesc:
3266     Returns a resource object selected by an exception code
3267     reference (<Q::DOMMain:XCodeRef>).
3268     @@Param:
3269     @@@Name: xcref
3270     @@@Type:
3271     DOMMain:XCodeRef::ManakaiDOM:all
3272     @@@enDesc:
3273     Exception code to select.
3274     @@Param:
3275     @@@Name: contextNode
3276     @@@Type: ManakaiDISElement
3277     @@@enDesc:
3278     A context element node. Namespace prefixes in
3279     <P::xcref> are resolved against this node.
3280 wakaba 1.16 @@ForParam:
3281 wakaba 1.15 @@NodeParam:
3282     @@Return:
3283     @@@Type:
3284     Perl:ARRAY::ManakaiDOM:all
3285     @@@enDesc:
3286     A reference to the array containing two or three
3287     resource definitions (<Class::ManakaiDISResourceDefinition>).
3288     The first (index <CODE::0>) resource is an exception class.
3289     The second (index <CODE::1>) resource is an exception code
3290     constant. The third (index <CODE::2>) resource
3291     is an exception subtype or <DOM::null> if the reference identifies
3292     no subtype.
3293     @@@RaiseException:
3294     @@@@@: RESOURCE_NOT_DEFINED_ERR
3295     @@@@enDesc:
3296     The resource identified by the <P::xcref> is not defined
3297     or not an exception.
3298     @@@PerlDef:
3299     my ($q1, $q2, $q3) = split /\s*\.\s*/, $xcref, 3;
3300     __DEEP{
3301     if (defined $q3) {
3302     $r->[2] = $self-><M::ManakaiDISDatabase.getResource>
3303 wakaba 1.16 ($contextNode-><M::ManakaiDISElement.tfqnamesToURI>
3304     ($q3, null, $forArg, node => $node));
3305 wakaba 1.15 $r->[1] = $r->[2]-><M::ManakaiDISPropertyAccessor
3306     .getPropertyResource>
3307     (<Q::dis2pm:parentResource>);
3308     } elsif (defined $q2) {
3309     if ($q2 =~ /:/) {
3310     $r->[1] = $self-><M::ManakaiDISDatabase.getResource>
3311 wakaba 1.16 ($contextNode-><M::ManakaiDISElement.tfqnamesToURI>
3312     ($q2, null, $forArg, node => $node));
3313 wakaba 1.15 } else {
3314     $r->[0] = $self-><M::ManakaiDISDatabase.getResource>
3315 wakaba 1.16 ($contextNode-><M::ManakaiDISElement.tfqnamesToURI>
3316     ($q1, null, $forArg, node => $node));
3317 wakaba 1.15 $r->[1] = $r->[0]-><M::ManakaiDISResourceDefinition
3318     .getConstResourceByName> ($q2);
3319     }
3320 wakaba 1.16 } else { ## $q1 only
3321 wakaba 1.15 $r->[2] = $self-><M::ManakaiDISDatabase.getResource>
3322 wakaba 1.16 ($contextNode-><M::ManakaiDISElement.tfqnamesToURI>
3323     ($q1, null, $forArg, node => $node));
3324 wakaba 1.15 if ($r->[2]-><M::ManakaiDISResourceDefinition
3325     .isTypeURI> (<Q::ManakaiDOM:ExceptionOrWarningSubType>)) {
3326     $r->[1] = $r->[2]-><M::ManakaiDISPropertyAccessor
3327     .getPropertyResource>
3328     (<Q::dis2pm:parentResource>);
3329     } else {
3330     $r->[1] = $r->[2]; CORE::delete $r->[2];
3331     }
3332     }
3333    
3334     if ($r->[2] and
3335     not $r->[2]-><M::ManakaiDISResourceDefinition
3336     .isTypeURI> (<Q::ManakaiDOM:ExceptionOrWarningSubType>)) {
3337     __UNDEEP{__EXCEPTION{RESOURCE_NOT_DEFINED_ERR::
3338     DIS:uri => {$r->[2]->{uri}},
3339     DIS:expectedType => {<Q::ManakaiDOM:ExceptionOrWarningSubType>},
3340     DIS:sourceNode => {$node},
3341     DIS:sourceCode => {$xcref},
3342     }__}__;
3343     }
3344 wakaba 1.16 $r->[2]-><AS::ManakaiDISResourceDefinition.isReferred>
3345     ($node or $contextNode)
3346     if $r->[2];
3347 wakaba 1.15
3348     if (not $r->[1] or
3349     not $r->[1]-><M::ManakaiDISResourceDefinition
3350     .isTypeURI> (<Q::ManakaiDOM:Const>)) {
3351     __UNDEEP{__EXCEPTION{RESOURCE_NOT_DEFINED_ERR::
3352     DIS:uri => {$r->[1]->{uri}},
3353     DIS:localName => {$r->[1]->{localName}},
3354     DIS:expectedType => {<Q::ManakaiDOM:Const>},
3355     DIS:sourceNode => {$node},
3356     DIS:sourceCode => {$xcref},
3357     }__}__;
3358     }
3359 wakaba 1.16 $r->[1]-><AS::ManakaiDISResourceDefinition.isReferred>
3360 wakaba 1.15 ($node or $contextNode);
3361    
3362     unless ($r->[0]) {
3363     my $cg = $r->[1]-><M::ManakaiDISPropertyAccessor
3364     .getPropertyResource>
3365     (<Q::dis2pm:parentResource>);
3366     $r->[0] = $cg-><M::ManakaiDISPropertyAccessor
3367     .getPropertyResource>
3368     (<Q::dis2pm:parentResource>) if $cg;
3369     }
3370     if (not $r->[0] or
3371     not $r->[0]-><M::ManakaiDISResourceDefinition
3372 wakaba 1.16 .isTypeURI> (<Q::DOMException:AnyExceptionClass>)) {
3373 wakaba 1.15 __UNDEEP{__EXCEPTION{RESOURCE_NOT_DEFINED_ERR::
3374     DIS:uri => {$r->[0]->{uri}},
3375     DIS:localName => {$r->[0]->{localName}},
3376 wakaba 1.16 DIS:expectedType => {<Q::DOMException:AnyExceptionClass>},
3377 wakaba 1.15 DIS:sourceNode => {$node},
3378     DIS:sourceCode => {$xcref},
3379     }__}__;
3380     }
3381 wakaba 1.16 $r->[0]-><AS::ManakaiDISResourceDefinition.isReferred>
3382 wakaba 1.15 ($node or $contextNode);
3383     }__;
3384 wakaba 1.2 ##DISDatabase
3385    
3386 wakaba 1.8 PropDef:
3387 wakaba 1.32 @QName: sourceNodeID
3388     @enDesc:
3389     The URI reference of the source node identifier.
3390     @rdfs:domain: ManakaiDISResourceDefinition
3391    
3392     PropDef:
3393 wakaba 1.9 @QName: resource
3394     @enDesc:
3395     Resources defined in a module.
3396     @rdfs:range: ManakaiDISResourceDefinition
3397     @rdfs:domain: ManakaiDISModuleDefinition
3398    
3399     PropDef:
3400 wakaba 1.8 @QName:
3401     dis2pm:parentResource
3402     @enDesc:
3403     Static parent resource. No parent for root resources.
3404    
3405     PropDef:
3406     @QName: dynamicParentResource
3407     @enDesc:
3408     Dynamic parent resource. No parent for root resources.
3409    
3410 wakaba 1.11 PropDef:
3411     @QName: childResource
3412     @enDesc:
3413     Static child resources.
3414    
3415     PropDef:
3416     @QName: dynamicChildResource
3417     @enDesc:
3418     Dynamic child resources.
3419    
3420 wakaba 1.5 ElementTypeBinding:
3421     @Name: ForDefDupException
3422     @ElementType:
3423     ManakaiDOM:raises
3424     @ShadowContent:
3425     @@@: FOR_ALREADY_DEFINED_ERR
3426     @@Description:
3427     @@@lang:en
3428     @@@@:
3429     The <QUOTE::for> is already defined elsewhere.
3430    
3431     ElementTypeBinding:
3432     @Name: ForDefNoQNameException
3433     @ElementType:
3434     ManakaiDOM:raises
3435     @ShadowContent:
3436     @@@: NO_FOR_QNAME_ERR
3437     @@Description:
3438     @@@lang:en
3439     @@@@:
3440     A <Q::dis:ForDef> element must have a <Q::dis:QName> attribute.
3441    
3442     ElementTypeBinding:
3443     @Name: ResDefDupException
3444     @ElementType:
3445     ManakaiDOM:raises
3446     @ShadowContent:
3447     @@@: RESOURCE_ALREADY_DEFINED_ERR
3448     @@Description:
3449     @@@lang:en
3450     @@@@:
3451     The <QUOTE::dis> resource is already defined elsewhere.
3452    
3453     ElementTypeBinding:
3454     @Name: ElementNotAllowedException
3455     @ElementType:
3456     ManakaiDOM:raises
3457     @ShadowContent:
3458     @@@: ELEMENT_NOT_ALLOWED_ERR
3459     @@Description:
3460     @@@lang:en
3461     @@@@:
3462     An element has found where it is not allowed.
3463    
3464 wakaba 1.4 IFClsDef:
3465     @QName:
3466     @@@: DISModuleResolver
3467     @@ForCheck: ForIF
3468     @QName:
3469     @@@: ManakaiDISModuleResolver
3470     @@ForCheck: ForClass
3471     @enDesc:
3472     Objects implementing <IF::DISModuleResolver> interface
3473     are used to convert module name into <QUOTE::dis> document object.
3474     \
3475     {NOTE:: It is also acceptable to pass a <Perl::CODE> reference
3476     as a method parameter where <IF::DISModuleResolver> is
3477     expected.
3478     \
3479     }
3480     @Method:
3481     @@Name: uriToDocument
3482     @@enDesc:
3483     Returns a <QUOTE::dis> document from module name information.
3484     @@Param:
3485     @@@Name: disDB
3486     @@@Type: ManakaiDISDatabase
3487     @@@enDesc:
3488     The <QUOTE::dis> database.
3489     @@Param:
3490     @@@Name: moduleURI
3491     @@@Type: ModuleURI
3492     @@@enDesc:
3493     The URI reference of the module.
3494     \
3495     {NOTE:: This parameter is redundant, since it can be
3496     composed from other three parameters.
3497     \
3498     }
3499     @@Param:
3500     @@@Name: moduleNamespaceURI
3501     @@@Type: AnyURI
3502     @@@enDesc:
3503     The namespace URI of the module name.
3504     @@Param:
3505     @@@Name: moduleLocalName
3506     @@@Type:
3507 wakaba 1.18 DISCore:LocalName::ManakaiDOM:all
3508 wakaba 1.4 @@@enDesc:
3509     The local name of the module name.
3510     @@Param:
3511     @@@Name: moduleFor
3512     @@@Type: ForURI
3513     @@@enDesc:
3514     The <QUOTE::for> URI reference for which the module is defined.
3515     @@Return:
3516     @@@Type: ManakaiDISDocument
3517     @@@enDesc:
3518     The <QUOTE::dis> document. It don't have to be a newly created
3519     object.
3520     @@@nullCase:
3521     @@@@enDesc:
3522     The method is unable to resolve the reference.
3523     @@@PerlDef:
3524     $r = $self->(@_);
3525     @ManakaiDOM:inputNormalizer:
3526     @@ContentType:
3527     lang:Perl
3528     @@@:
3529     $INPUT = bless $INPUT, <ClassName::ManakaiDISModuleResolver>
3530     if ref $INPUT eq 'CODE';
3531     @@ImplNote:
3532     @@@lang:en
3533     @@@@:
3534     <FILE::cdis2pm.pl> does not support non-datatype input normalizers yet.
3535     ##DISModuleResolver
3536    
3537 wakaba 1.3 PropDef:
3538     @QName: sourceFile
3539     @enDesc:
3540     Source <QUOTE::dis> documents.
3541     @rdfs:domain: ManakaiDISDatabase
3542     @rdfs:range: ManakaiDISDocument
3543    
3544 wakaba 1.2 ClsDef:
3545     @ClsQName: ManakaiDISModuleDefinition
3546     @enDesc:
3547     <QUOTE::dis> module definitions.
3548     @ClsISA: ManakaiDISPropertyAccessor
3549 wakaba 1.4 @ClsISA: ManakaiDISExceptionTarget
3550 wakaba 1.22 @ClsISA: ManakaiDISPerlModuleDefinition
3551 wakaba 1.2
3552     @Attr:
3553     @@Name: uri
3554     @@Type: ModuleURI
3555     @@Description:
3556     @@@lang:en
3557     @@@@:
3558     The URI reference of this <QUOTE::dis> module.
3559     @@Get:
3560     @@@PerlDef:
3561     $r = $self->{uri};
3562    
3563 wakaba 1.22 @IntMethod:
3564     @@Operator:
3565     @@@@:eq
3566     @@@ContentType:
3567     lang:Perl
3568     @@enDesc:
3569     Whether two <QUOTE::dis> module definitions are equal or not.
3570     Two <QUOTE::dis> module definitions are equal iff their canonical
3571     URI references are literally (in character-by-character) equivalent.
3572     @@Param:
3573     @@@Name: anotherModule
3574     @@@Type: ManakaiDISModuleDefinition
3575     @@@enDesc:
3576     Another <QUOTE::dis> module definition to compare.
3577     @@Return:
3578     @@@Type:
3579     DOMMain:boolean::ManakaiDOM:all
3580     @@@enDesc:
3581     Whether two resources are equal or not.
3582     @@@PerlDef:
3583     if (UNIVERSAL::isa ($anotherModule,
3584     <ClassName::ManakaiDISModuleDefinition>)) {
3585     $r = $self->{uri} eq $anotherModule->{uri};
3586     } else {
3587     $r = false;
3588     }
3589    
3590 wakaba 1.2 @Attr:
3591     @@Name: nameURI
3592     @@Type: NameURI
3593     @@enDesc:
3594     The URI reference of this module, without
3595     <QUOTE::for> identifier.
3596     @@Get:
3597 wakaba 1.3 @@@PerlDef:
3598 wakaba 1.4 $r = $self->{nameURI};
3599 wakaba 1.2
3600     @Attr:
3601     @@Name: localName
3602     @@enDesc:
3603     The local name of this module.
3604     @@Type:
3605 wakaba 1.3 DISCore:LocalName::ManakaiDOM:all
3606 wakaba 1.2 @@Get:
3607     @@@PerlDef:
3608     $r = $self->{localName};
3609    
3610     @Attr:
3611     @@Name: namespaceURI
3612     @@Type: AnyURI
3613     @@enDesc:
3614     The namespace URI of the name of this resource.
3615     @@Get:
3616     @@@PerlDef:
3617     $r = $self->{namespaceURI};
3618    
3619     @Attr:
3620     @@Name: forURI
3621     @@Type: ForURI
3622     @@enDesc:
3623     The <QUOTE::for> URI reference for which this module is defined.
3624     @@Get:
3625     @@@PerlDef:
3626     $r = $self->{for};
3627    
3628     @Attr:
3629     @@Name: isDefined
3630     @@Description:
3631     @@@lang:en
3632     @@@@:
3633     Whether this module is defined or not.
3634     @@Type:
3635 wakaba 1.18 DOMMain:boolean::ManakaiDOM:all
3636 wakaba 1.2 @@Get:
3637     @@@PerlDef:
3638     $r = $self->{<Q::isDefined>};
3639 wakaba 1.8
3640     @Attr:
3641     @@Name: plFullyQualifiedName
3642     @@enDesc:
3643     The fully-qualified Perl class package name.
3644     @@Type:
3645     Perl:package-name::ManakaiDOM:all
3646     @@Get:
3647     @@@NoPerlModuleNameException:
3648     @@@PerlDef:
3649     __DEEP{
3650     my $mg = $self->{db}-><M::ManakaiDISDatabase.getResource>
3651     ($self->{namespaceURI});
3652     unless ($self-><AG::ManakaiDISResourceDefinition.isDefined>) {
3653     __UNDEEP{
3654     __EXCEPTION{RESOURCE_NOT_DEFINED_ERR::
3655     DIS:uri => {$self->{namespaceURI}},
3656     DIS:sourceNode => {$self->{src}},
3657     }__;
3658     }__;
3659     }
3660     my $an = $mg->{src}-><M::ManakaiDISElement.disGetAttribute>
3661     (<Q::dis:AppName>, for_arg => $self->{for},
3662 wakaba 1.10 media_type => <Q::lang:Perl>,
3663     default_media_type => <Q::lang:Perl>);
3664 wakaba 1.8 if ($an) {
3665     $r = $an-><M::swcfg21:SWCFGNode::swcfg21:ForLatest.value>;
3666     $r =~ s/::$//g;
3667     $r .= '::' . $self->{localName};
3668     my $sf = $an-><M::ManakaiDISElement.disGetAttribute>
3669     (<Q::ManakaiDOM:moduleSuffix>,
3670     for_arg => $self->{for},
3671     media_type => <Q::lang:Perl>,
3672     default_media_type => <Q::lang:Perl>);
3673     if ($sf) {
3674     $r .= $sf-><M::swcfg21:SWCFGNode::swcfg21:ForLatest.value>;
3675     }
3676     } else {
3677 wakaba 1.10 $r = ($mg->{localName} || 'main') . '::' . $self->{localName};
3678 wakaba 1.8 }
3679     }__;
3680    
3681     @Attr:
3682     @@Name: plInterfaceName
3683     @@enDesc:
3684     The fully-qualified Perl interface package name.
3685     @@Type:
3686     Perl:package-name::ManakaiDOM:all
3687     @@Get:
3688     @@@NoPerlModuleNameException:
3689     @@@PerlDef:
3690     __DEEP{
3691     my $mg = $self->{db}-><M::ManakaiDISDatabase.getResource>
3692     ($self->{namespaceURI});
3693     unless ($self-><AG::ManakaiDISResourceDefinition.isDefined>) {
3694     __UNDEEP{
3695     __EXCEPTION{RESOURCE_NOT_DEFINED_ERR::
3696     DIS:uri => {$self->{namespaceURI}},
3697     DIS:sourceNode => {$self->{src}},
3698     }__;
3699     }__;
3700     }
3701     my $an = $mg->{src}-><M::ManakaiDISElement.disGetAttribute>
3702     (<Q::dis:AppName>, for_arg => $self->{for},
3703     forp_arg => [<Q::ManakaiDOM:ForIF>],
3704 wakaba 1.10 media_type => <Q::lang:Perl>,
3705     default_media_type => <Q::lang:Perl>);
3706 wakaba 1.8 if ($an) {
3707     $r = $an-><M::swcfg21:SWCFGNode::swcfg21:ForLatest.value>;
3708     $r =~ s/::$//g;
3709     my $sf = $an-><M::ManakaiDISElement.disGetAttribute>
3710     (<Q::ManakaiDOM:moduleSuffix>,
3711     for_arg => $self->{for},
3712     forp_arg => [<Q::ManakaiDOM:ForIF>],
3713     media_type => <Q::lang:Perl>,
3714     default_media_type => <Q::lang:Perl>);
3715     if ($sf) {
3716     $r .= $sf-><M::swcfg21:SWCFGNode::swcfg21:ForLatest.value>;
3717     }
3718     } else {
3719 wakaba 1.14 $r = $self-><AG::ManakaiDISModuleDefinition.plFullyQualifiedName>;
3720 wakaba 1.8 }
3721     }__;
3722 wakaba 1.22
3723     @Attr:
3724     @@Name: ownerModule
3725     @@ManakaiDOM:isRedefining:1
3726     @@enDesc:
3727     This module itself.
3728     @@Get:
3729     @@@Type: ManakaiDISModuleDefinition
3730     @@@PerlDef: $r = $self;
3731 wakaba 1.2 ##DISModuleDefinition
3732    
3733 wakaba 1.8 ElementTypeBinding:
3734     @Name: NoPerlModuleNameException
3735     @ElementType:
3736     ManakaiDOM:raises
3737     @ShadowContent:
3738     @@@: RESOURCE_NOT_DEFINED_ERR
3739     @@Description:
3740     @@@lang:en
3741     @@@@:
3742     The module group corresponding to the namespace URI
3743     of this module is not defined.
3744    
3745 wakaba 1.2 ClsDef:
3746     @ClsQName: ManakaiDISForDefinition
3747     @Description:
3748     @@lang:en
3749     @@@:
3750     <QUOTE::dis> <QUOTE::for> definitions.
3751 wakaba 1.4 @ClsISA: ManakaiDISExceptionTarget
3752 wakaba 1.2
3753     @Attr:
3754     @@Name: uri
3755     @@Type: ForURI
3756     @@Description:
3757     @@@lang:en
3758     @@@@:
3759     The URI reference of this <QUOTE::for>.
3760     @@Get:
3761     @@@PerlDef:
3762     $r = $self->{uri};
3763 wakaba 1.10
3764     @IntMethod:
3765     @@Operator:
3766     @@@@:eq
3767     @@@ContentType:
3768     lang:Perl
3769     @@enDesc:
3770     Whether two <QUOTE::for> definitions are equal or not.
3771     Two <QUOTE::for> definitions are equal iff one's URI reference
3772     is one of another's URI reference.
3773     \
3774     {NOTE:: Aliases for <QUOTE::for> is not allowed.
3775     \
3776     }
3777     @@ImplNote:
3778     @@@lang:en
3779     @@@@:
3780     In the current implementation, two are equal iff two are
3781     equal as reference.
3782     @@Param:
3783     @@@Name: anotherFor
3784     @@@Type: ManakaiDISForDefinition
3785     @@@enDesc:
3786     Another <QUOTE::for> definition to compare.
3787     @@Return:
3788     @@@Type:
3789 wakaba 1.18 DOMMain:boolean::ManakaiDOM:all
3790 wakaba 1.10 @@@enDesc:
3791     Whether two resources are equal or not.
3792     @@@PerlDef:
3793     if (UNIVERSAL::isa ($anotherFor, <ClassName::ManakaiDISForDefinition>)) {
3794     $r = $self->{uri} eq $anotherFor->{uri};
3795     } else {
3796     $r = false;
3797     }
3798 wakaba 1.2
3799     @Method:
3800     @@Name: isaURI
3801     @@Description:
3802     @@@lang:en
3803     @@@@:
3804     Whether this <QUOTE::for> is-a another <QUOTE::for> or not.
3805     @@Param:
3806     @@@Name: superURI
3807     @@@Type: ForURI
3808     @@@Description:
3809     @@@@lang:en
3810     @@@@@:
3811     Another <QUOTE::for> URI reference to test.
3812     @@Return:
3813     @@@Type:
3814 wakaba 1.18 DOMMain:boolean::ManakaiDOM:all
3815 wakaba 1.2 @@@TrueCase:
3816     @@@@enDesc:
3817     <P::superURI> is a super-<QUOTE::for> of this <QUOTE::for>.
3818     @@@FalseCase:
3819     @@@@enDesc:
3820     <P::superURI> is not a super-<QUOTE::for> of this <QUOTE::for>.
3821     @@@PerlDef:
3822     $r = $self->{uri} eq $superURI ? true : $self->{isa}->{$superURI};
3823    
3824     @Attr:
3825     @@Name: isDefined
3826     @@Description:
3827     @@@lang:en
3828     @@@@:
3829     Whether this <QUOTE::for> is already defined or not.
3830     @@Type:
3831 wakaba 1.18 DOMMain:boolean::ManakaiDOM:all
3832 wakaba 1.2 @@Get:
3833     @@@TrueCase:
3834     This <QUOTE::for> is already defined.
3835     @@@FalseCase:
3836     This <QUOTE::for> is not defined.
3837     @@@PerlDef:
3838     $r = $self->{<Q::isDefined>};
3839    
3840     @Attr:
3841     @@Name: isReferred
3842     @@Description:
3843     @@@lang:en
3844     @@@@:
3845     Whether this <QUOTE::for> is referred somewhere or not.
3846 wakaba 1.9 @@Type: ManakaiDISElement
3847 wakaba 1.2 @@Get:
3848     @@@InCase:
3849     @@@@Type:ManakaiDISElement
3850     @@@@enDesc:
3851     This <QUOTE::for> is referred by the element.
3852     @@@nullCase:
3853     This <QUOTE::for> is not referred.
3854     @@@PerlDef:
3855     $r = $self->{<Q::isReferred>};
3856     @@Set:
3857     @@@InCase:
3858     @@@@Type:ManakaiDISElement
3859     @@@@enDesc:
3860     This <QUOTE::for> is referred by the element.
3861     @@@PerlDef:
3862 wakaba 1.9 $self->{<Q::isReferred>} = $given if $given;
3863 wakaba 1.2
3864     @Attr:
3865 wakaba 1.22 @@Name: ownerModule
3866     @@ManakaiDOM:isRedefining:1
3867 wakaba 1.2 @@Description:
3868     @@@lang:en
3869     @@@@:
3870     The <QUOTE::dis> module in which this <QUOTE::for> is defined.
3871     @@Type: ManakaiDISModuleDefinition
3872     @@Get:
3873     @@@Description:
3874     @@@@lang:en
3875     @@@@@:
3876     The module object.
3877 wakaba 1.3 @@@nullCase:
3878 wakaba 1.2 @@@@Description:
3879     @@@@@lang:en
3880     @@@@@@:
3881     This <QUOTE::for> is not associated to any module.
3882     @@@PerlDef:
3883     $r = $self->{db}
3884     -><M::ManakaiDISDatabase.getResource>
3885     ($self->{<Q::definingModule>})
3886     if defined $self->{<Q::definingModule>};
3887 wakaba 1.5
3888 wakaba 1.2 @Method:
3889 wakaba 1.5 @@Name: addISA
3890 wakaba 1.2 @@enDesc:
3891 wakaba 1.5 Adds a <QUOTE::for> to the list of super-<QUOTE::for> of this
3892     <QUOTE::for>.
3893 wakaba 1.2 @@Param:
3894 wakaba 1.5 @@@Name: superFor
3895     @@@Type: ManakaiDISForDefinition
3896     @@@enDesc:
3897     A <QUOTE::for> definition object.
3898 wakaba 1.2 @@Return:
3899     @@@PerlDef:
3900 wakaba 1.5 my @from = ($self->{uri},
3901     grep {$self->{revISA}->{$_}} keys %{$self->{revISA}});
3902     my @to = ($superFor->{uri},
3903     grep {$superFor->{isa}->{$_}} keys %{$superFor->{isa}});
3904 wakaba 1.7 __DEEP{
3905     for my $from (@from) {
3906     for my $to (@to) {
3907     $self->{db}-><M::ManakaiDISDatabase.getFor>
3908     ($from)->{isa}->{$to} = true;
3909     $self->{db}-><M::ManakaiDISDatabase.getFor>
3910     ($to)->{revISA}->{$from} = true;
3911     }
3912 wakaba 1.5 }
3913 wakaba 1.7 }__;
3914 wakaba 1.5
3915 wakaba 1.2 ##DISForDefinition
3916    
3917     ClsDef:
3918 wakaba 1.22 @ClsQName: ManakaiDISPerlModuleDefinition
3919     @enDesc:
3920     A class inherited by classes whose object might (but not necessarily) define
3921     a Perl module.
3922     @ImplNote:
3923     @@lang:en
3924     @@@:
3925     Any object whose class inheriting this class must also inherit
3926     the <Class::ManakaiDISPropertyAccessor> class.
3927    
3928     @Method:
3929     @@Name: plGeneratePerlModuleFile
3930     @@enDesc:
3931     Generates a Perl file object.
3932     @@Return:
3933     @@@Type: PLFile
3934     @@@enDesc:
3935     A Perl file object generated from this resource.
3936     @@@RaiseException:
3937     @@@@@:NO_LICENSE_ATTR_ERR
3938     @@@@enDesc:
3939     The <Q::dis:Module> element does not have the
3940     <Q::dis:License> attribute.
3941     @@@NoPerlModuleNameException:
3942 wakaba 1.24 @@@RaiseException:
3943     @@@@@:RESOURCE_NOT_DEFINED_ERR
3944     @@@@enDesc:
3945     A feature referred from this module is not defined.
3946 wakaba 1.32 @@@RaiseException:
3947     @@@@@:RESOURCE_NOT_DEFINED_ERR
3948     @@@@enDesc:
3949     A markup vocabulary is referred but it is not defined
3950     or have a different type than the expected one.
3951 wakaba 1.22 @@@PerlDef:
3952     __DEEP{
3953     $r = $self-><AG::ManakaiDISPropertyAccessor.plImplementation>
3954     -><M::MPLImpl.createPerlFile>;
3955 wakaba 1.24
3956     ## -- Source information
3957 wakaba 1.22 $r-><AS::PLFile.sourceFile>
3958     ($self-><M::ManakaiDISPropertyAccessor.getPropertyText>
3959     (<Q::DIS:sourceFile>, ''));
3960     $r-><AS::PLFile.sourceModule> ($self->{nameURI});
3961     $r-><AS::PLFile.sourceFor> ($self->{for});
3962 wakaba 1.24
3963     ## -- License information
3964 wakaba 1.22 my $ownermod = $self-><AG::ManakaiDISPropertyAccessor.ownerModule>;
3965     my $license = $ownermod-><M::ManakaiDISPropertyAccessor
3966     .getPropertyResource> (<Q::dis:License>);
3967     unless ($license) {
3968     __UNDEEP{__EXCEPTION{NO_LICENSE_ATTR_ERR::
3969     DIS:sourceNode => {$ownermod->{src}},
3970     DIS:uri => {$ownermod->{uri}},
3971     }__}__;
3972     }
3973     $r-><AS::PLFile.licenseURI>
3974     ($license-><AG::ManakaiDISResourceDefinition.uri>);
3975    
3976 wakaba 1.24 ## -- Classes
3977 wakaba 1.22 ## TODO: Custom module construction support
3978 wakaba 1.27 my $thismod_name = $self-><AG::ManakaiDISModuleDefinition
3979     .plFullyQualifiedName>;
3980     my $thismod_pack = $r-><M::PLFile.getLastPackage>
3981     ($thismod_name, make_new_package => true);
3982     my %const;
3983 wakaba 1.22 for my $cls (@{$self-><M::ManakaiDISPropertyAccessor
3984     .getPropertyResourceList>
3985     (<Q::DIS:resource>)}) {
3986 wakaba 1.23 if ($cls-><AG::ManakaiDISResourceDefinition.ownerModule>
3987 wakaba 1.22 eq $ownermod) {
3988 wakaba 1.23 if ($cls-><M::ManakaiDISResourceDefinition.isTypeURI>
3989     (<Q::ManakaiDOM:Class>)) {
3990 wakaba 1.24 ## -- Subroutines and variables
3991 wakaba 1.23 my $pack = $cls-><AG::ManakaiDISResourceDefinition
3992     .plCodeFragment>;
3993     $r-><M::PLFile.appendPackage> ($pack);
3994 wakaba 1.24 my $pack_name = $cls-><AG::ManakaiDISResourceDefinition
3995     .plFullyQualifiedName>;
3996    
3997 wakaba 1.27 ## -- Constants
3998     for my $cr (@{$cls-><M::ManakaiDISPropertyAccessor
3999     .getPropertyResourceList>
4000     (<Q::DIS:childResource>)}) {
4001     if ($cr-><M::ManakaiDISResourceDefinition.isTypeURI>
4002     (<Q::ManakaiDOM:Const>)) {
4003     $thismod_pack-><M::PLPack.addExport>
4004     (null,
4005     my $nm = $cr-><AG::ManakaiDISResourceDefinition.plName>);
4006     $const{$nm} = $cr-><AG::ManakaiDISResourceDefinition
4007     .plFullyQualifiedName>;
4008     } elsif ($cr-><M::ManakaiDISResourceDefinition.isTypeURI>
4009     (<Q::ManakaiDOM:ConstGroup>)) {
4010     my $tag = $cr-><AG::ManakaiDISResourceDefinition.plName>;
4011     for my $gcr (@{$cr-><M::ManakaiDISPropertyAccessor
4012     .getPropertyResourceList>
4013     (<Q::DIS:childResource>)}) {
4014     if ($gcr-><M::ManakaiDISResourceDefinition.isTypeURI>
4015     (<Q::ManakaiDOM:Const>)) {
4016     $thismod_pack-><M::PLPack.addExport>
4017     ($tag, my $nm = $gcr-><AG::ManakaiDISResourceDefinition
4018     .plName>);
4019     $const{$nm} = $gcr-><AG::ManakaiDISResourceDefinition
4020     .plFullyQualifiedName>;
4021     }
4022     }
4023     }
4024     }
4025    
4026 wakaba 1.24 ## -- Features
4027     my %feature;
4028     for my $el (@{$cls->{src}
4029     -><M::ManakaiDISElement.disChildElements>
4030     (for_arg => $self->{for},
4031     forp_arg => $self->{forp})}) {
4032     next unless $el-><AG::swcfg21:SWCFGElement::swcfg21:ForLatest
4033     .expandedURI> eq <Q::DOMMetaImpl:provideFeature>;
4034     my $furi = $el-><AG::ManakaiDISElement.qnameValueURI>;
4035     my $f = $self->{db}-><M::ManakaiDISDatabase.getResource>
4036     ($furi);
4037     unless ($f-><AS::ManakaiDISResourceDefinition.isDefined>) {
4038     __UNDEEP{__EXCEPTION{RESOURCE_NOT_DEFINED_ERR::
4039     DIS:sourceNode => {$el},
4040     DIS:uri => {$furi},
4041     DIS:expectedType => {<Q::DOMMain:DOMFeature>},
4042     }__}__;
4043     }
4044     for my $s ($f, @{$f-><M::ManakaiDISPropertyAccessor
4045     .getPropertyResourceList>
4046     (<Q::DOMMetaImpl:extendFeature>,
4047     recursive => true,
4048     default_media_type => <Q::dis:TypeQName>)}) {
4049     $feature{$s-><AG::ManakaiDISResourceDefinition.uri>}
4050     = [$s, $el];
4051     }
4052     }
4053     for my $f (values %feature) {
4054     my @fname = @{$f->[0]-><AG::ManakaiDISResourceDefinition
4055     .featureNameList>};
4056     my $fver = $f->[0]-><M::ManakaiDISPropertyAccessor
4057     .getPropertyText>
4058     (<Q::dis:Version>, null);
4059     next unless defined $fver;
4060     my $fi = $self-><M::ManakaiDISPerlModuleDefinition
4061     .plIsFeatureImplemented> ($f->[0]->{uri}) ? true : false;
4062     my @ec = @{$f->[1]-><M::ManakaiDISElement.disChildElements>
4063     (for_arg => $self->{for},
4064     forp_arg => $self->{forp})};
4065     if (@ec) {
4066     for my $ec (@ec) {
4067     next unless $ec-><AG::swcfg21:SWCFGElement
4068     ::swcfg21:ForLatest
4069     .expandedURI> eq <Q::DOMMetaImpl:providedThrough>;
4070     my $curi = $ec-><M::ManakaiDISElement.tfqnamesValueURI>
4071 wakaba 1.33 ($self->{<Q::DIS:sourceNodeID>}, $self->{for},
4072     for_arg => $self->{for},
4073     forp_arg => $self->{forp});
4074 wakaba 1.24 my $c = $self->{db}-><M::ManakaiDISDatabase.getResource>
4075     ($curi);
4076     $c-><AS::ManakaiDISResourceDefinition.isReferred> ($ec);
4077     my $cp = $c-><AG::ManakaiDISResourceDefinition
4078     .plFullyQualifiedName>;
4079     for my $fname (@fname) {
4080     $r-><M::PLBlockCon.appendStatement>
4081 wakaba 1.28 ('$Message::DOM::ImplFeature{q<' . $cp .
4082     '>}->{q<' .
4083 wakaba 1.24 $fname . '>}->{q<' . $fver . '>} ||= '.$fi);
4084     $r-><M::PLBlockCon.appendStatement>
4085 wakaba 1.28 ('$Message::DOM::ImplFeature{q<' . $cp .
4086     '>}->{q<' . $fname . '>}->{q<>} = 1');
4087 wakaba 1.24 }
4088     }
4089     } else { ## No DOMMetaImpl:ProvidedThrough attribute
4090     for my $fname (@fname) {
4091     $r-><M::PLBlockCon.appendStatement>
4092 wakaba 1.28 ('$Message::DOM::ImplFeature{q<' . $pack_name .
4093     '>}->{q<' .
4094 wakaba 1.24 $fname . '>}->{q<' . $fver . '>} ||= '.$fi);
4095     $r-><M::PLBlockCon.appendStatement>
4096 wakaba 1.28 ('$Message::DOM::ImplFeature{q<' . $pack_name .
4097     '>}->{q<' . $fname . '>}->{q<>} = 1');
4098 wakaba 1.24 }
4099     }
4100     }
4101 wakaba 1.25
4102 wakaba 1.33 my %ifeature;
4103     my $ifpoint = 0;
4104     for my $feature (@{$cls-><M::ManakaiDISPropertyAccessor
4105     .getPropertyResourceList>
4106     (<Q::DOMMain:implementFeature>,
4107     isa_recursive => true,
4108     default_media_type => <Q::dis:TypeQName>)}) {
4109     my $fver = $feature-><M::ManakaiDISPropertyAccessor
4110     .getPropertyText>
4111     (<Q::dis:Version>, null);
4112     $ifpoint += $fver;
4113     my $fi = defined $fver
4114     ? $self-><M::ManakaiDISPerlModuleDefinition
4115     .plIsFeatureImplemented>
4116     ($feature->{uri}) ? true : false
4117     : true;
4118     for my $fname (@{$feature-><AG::ManakaiDISResourceDefinition
4119     .featureNameList>}) {
4120     $ifeature{$fname}->{$fver} = $fi;
4121     }
4122     }
4123     $r-><M::PLBlockCon.appendStatement>
4124     ('$Message::DOM::ClassFeature{q<' . $pack_name .
4125     '>} = ' . <ClassM::MPLImpl.perlLiteral> (\%ifeature));
4126     $r-><M::PLBlockCon.appendStatement>
4127     ('$Message::DOM::ClassPoint{q<' . $pack_name .
4128     '>} = ' . $ifpoint);
4129    
4130 wakaba 1.25 ## -- Roles
4131     for my $role (@{$cls-><M::ManakaiDISPropertyAccessor
4132 wakaba 1.26 .getPropertyResourceList>
4133     (<Q::DISLang:role>, isa_recursive => true,
4134     default_media_type => <Q::dis:TypeQName>)}) {
4135     if ($role-><M::ManakaiDISResourceDefinition.isSubsetOfURI>
4136     (<Q::DOMMetaImpl:ImplementationSourceForManakaiDOMImplementationRegistry>)) {
4137     $r-><M::PLBlockCon.appendStatement>
4138     ('$Message::DOM::ManakaiDOMImplementationRegistry'.
4139     '::SourceClass{q<' . $pack_name . '>} = 1');
4140 wakaba 1.25 }
4141 wakaba 1.26 if ($role-><M::ManakaiDISResourceDefinition.isSubsetOfURI>
4142     (<Q::DOMMetaImpl:ImplementationForManakaiDOMImplementationSource>)) {
4143     $r-><M::PLBlockCon.appendStatement>
4144     ('$Message::DOM::ManakaiDOMImplementationSource'.
4145     '::SourceClass{q<' . $pack_name . '>} = 1');
4146     }
4147     if ($role-><M::ManakaiDISResourceDefinition.isSubsetOfURI>
4148     (<Q::DOMMetaImpl:ImplementationCompatibleWithManakaiDOMMinimumImplementation>)
4149     ) {
4150 wakaba 1.25 $r-><M::PLBlockCon.appendStatement>
4151 wakaba 1.28 ('$Message::DOM::ManakaiDOMImplementation'.
4152 wakaba 1.26 '::CompatClass{q<' . $pack_name . '>} = 1');
4153 wakaba 1.25 }
4154 wakaba 1.32
4155     ## Node
4156     if ($role-><M::ManakaiDISResourceDefinition.isSubsetOfURI>
4157     (<Q::DOMCore:ElementRole>)) {
4158     my $for_specific_et;
4159     for my $et (@{$cls-><M::ManakaiDISPropertyAccessor
4160     .getPropertyResourceList>
4161     (<Q::s:elementType>, isa_recursive => true,
4162     default_media_type => <Q::dis:TFQNames>)}) {
4163     $for_specific_et = true;
4164     my $ln = $et-><AG::ManakaiDISResourceDefinition
4165     .mvLocalName>;
4166     $ln = '*' unless defined $ln;
4167     my $ns = $et-><AG::ManakaiDISResourceDefinition
4168     .mvNamespaceURI>;
4169     $ns = '' unless defined $ns;
4170     ## ISSUE: Is NULL-namespace should be allowed here?
4171     $r-><M::PLBlockCon.appendStatement>
4172     ('$Message::DOM::ManakaiDOMElement' .
4173     '::CompatClassET{q<' . $ns . '>}->{q<' . $ln .
4174     '>}->{q<' . $pack_name . '>} = 1');
4175     }
4176     $r-><M::PLBlockCon.appendStatement>
4177     ('$Message::DOM::ManakaiDOMElement'.
4178     '::CompatClass{q<' . $pack_name . '>} = 1')
4179     unless $for_specific_et;
4180     }
4181     if ($role-><M::ManakaiDISResourceDefinition.isSubsetOfURI>
4182     (<Q::DOMCore:AttributeRole>)) {
4183     my $for_specific_attr;
4184     for my $at (@{$cls-><M::ManakaiDISPropertyAccessor
4185     .getPropertyResourceList>
4186     (<Q::dis:DocAttr>, isa_recursive => true,
4187     default_media_type => <Q::dis:TFQNames>)}) {
4188     $for_specific_attr = true;
4189     my $ln = $at-><AG::ManakaiDISResourceDefinition
4190     .mvLocalName>;
4191     $ln = '*' unless defined $ln;
4192     my $ns = $at-><AG::ManakaiDISResourceDefinition
4193     .mvNamespaceURI>;
4194     $ns = '' unless defined $ns;
4195     my $et = $at-><AG::ManakaiDISResourceDefinition
4196     .mvOwnerElementResource>;
4197     my $etns = '*';
4198     my $etln = '*';
4199     if ($et) {
4200     $etns = $et-><AG::ManakaiDISResourceDefinition
4201     .mvLocalName>;
4202     $etln = '*' unless defined $etln;
4203     my $etns = $at-><AG::ManakaiDISResourceDefinition
4204     .mvNamespaceURI>;
4205     $etns = '' unless defined $etns;
4206     ## ISSUE: Should NULL-namespace be allowed here?
4207     }
4208    
4209     $r-><M::PLBlockCon.appendStatement>
4210     ('$Message::DOM::ManakaiDOMElement' .
4211     '::CompatClassAttr{q<' . $etns . '>}->{q<' . $etln .
4212     '>}->{q<' . $ns . '>}->{q<' . $ln . '>}->{q<' .
4213     $pack_name . '>} = 1');
4214     }
4215     $r-><M::PLBlockCon.appendStatement>
4216     ('$Message::DOM::ManakaiDOMAttr'.
4217     '::CompatClass{q<' . $pack_name . '>} = 1')
4218     unless $for_specific_attr;
4219     }
4220     if ($role-><M::ManakaiDISResourceDefinition.isSubsetOfURI>
4221     (<Q::DOMCore:TextRole>)) {
4222     $r-><M::PLBlockCon.appendStatement>
4223     ('$Message::DOM::ManakaiDOMText'.
4224     '::CompatClass{q<' . $pack_name . '>} = 1');
4225     }
4226     if ($role-><M::ManakaiDISResourceDefinition.isSubsetOfURI>
4227     (<Q::DOMCore:CommentRole>)) {
4228     $r-><M::PLBlockCon.appendStatement>
4229     ('$Message::DOM::ManakaiDOMComment'.
4230     '::CompatClass{q<' . $pack_name . '>} = 1');
4231     }
4232     if ($role-><M::ManakaiDISResourceDefinition.isSubsetOfURI>
4233     (<Q::DOMCore:CDATASectionRole>)) {
4234     $r-><M::PLBlockCon.appendStatement>
4235     ('$Message::DOM::ManakaiDOMCDATASection'.
4236     '::CompatClass{q<' . $pack_name . '>} = 1');
4237     }
4238     if ($role-><M::ManakaiDISResourceDefinition.isSubsetOfURI>
4239     (<Q::DOMCore:ProcessingInstructionRole>)) {
4240     $r-><M::PLBlockCon.appendStatement>
4241     ('$Message::DOM::ManakaiDOMProcessingInstruction'.
4242     '::CompatClass{q<' . $pack_name . '>} = 1');
4243     ## TODO: Target name dependent
4244     }
4245     if ($role-><M::ManakaiDISResourceDefinition.isSubsetOfURI>
4246     (<Q::DOMCore:DocumentRole>)) {
4247     $r-><M::PLBlockCon.appendStatement>
4248     ('$Message::DOM::ManakaiDOMDocument'.
4249     '::CompatClass{q<' . $pack_name . '>} = 1');
4250     ## TODO: by document type name and media type
4251     }
4252     if ($role-><M::ManakaiDISResourceDefinition.isSubsetOfURI>
4253     (<Q::DOMCore:DocumentFragmentRole>)) {
4254     $r-><M::PLBlockCon.appendStatement>
4255     ('$Message::DOM::ManakaiDOMDocumentFragment'.
4256     '::CompatClass{q<' . $pack_name . '>} = 1');
4257     }
4258     if ($role-><M::ManakaiDISResourceDefinition.isSubsetOfURI>
4259     (<Q::DOMCore:DocumentTypeRole>)) {
4260     $r-><M::PLBlockCon.appendStatement>
4261     ('$Message::DOM::ManakaiDOMDocumentType'.
4262     '::CompatClass{q<' . $pack_name . '>} = 1');
4263     ## TODO: Doctype name or public ID dependent
4264     }
4265     if ($role-><M::ManakaiDISResourceDefinition.isSubsetOfURI>
4266     (<Q::DOMCore:EntityRole>)) {
4267     $r-><M::PLBlockCon.appendStatement>
4268     ('$Message::DOM::ManakaiDOMEntity'.
4269     '::CompatClass{q<' . $pack_name . '>} = 1');
4270     ## TODO: Entity name or public ID dependent
4271     }
4272     if ($role-><M::ManakaiDISResourceDefinition.isSubsetOfURI>
4273     (<Q::DOMCore:EntityReferenceRole>)) {
4274     $r-><M::PLBlockCon.appendStatement>
4275     ('$Message::DOM::ManakaiDOMEntityReference'.
4276     '::CompatClass{q<' . $pack_name . '>} = 1');
4277     ## TODO: Entity name or public ID dependent
4278     }
4279     if ($role-><M::ManakaiDISResourceDefinition.isSubsetOfURI>
4280     (<Q::DOMCore:NotationRole>)) {
4281     $r-><M::PLBlockCon.appendStatement>
4282     ('$Message::DOM::ManakaiDOMNotation'.
4283     '::CompatClass{q<' . $pack_name . '>} = 1');
4284     ## TODO: Notation name or public ID dependent
4285     }
4286     if ($role-><M::ManakaiDISResourceDefinition.isSubsetOfURI>
4287     (<Q::DOMCore:NamespaceRole>)) {
4288     $r-><M::PLBlockCon.appendStatement>
4289     ('$Message::DOM::ManakaiDOMNamespace'.
4290     '::CompatClass{q<' . $pack_name . '>} = 1');
4291     }
4292 wakaba 1.25 }
4293 wakaba 1.23 } elsif ($cls-><M::ManakaiDISResourceDefinition.isTypeURI>
4294     (<Q::DISPerl:ScalarVariable>) and
4295     not $cls-><M::ManakaiDISPropertyAccessor
4296     .getPropertyResource> (<Q::dis2pm:parentResource>)) {
4297     $r-><M::PLBlockCon.appendCodeFragment>
4298     ($cls-><AG::ManakaiDISResourceDefinition.plCodeFragment>);
4299     }
4300 wakaba 1.22 }
4301 wakaba 1.27 } # Classes
4302    
4303     ## -- Exporter (constants)
4304     if (keys %const) {
4305     my $map = <ClassM::MPLImpl.perlLiteral> (\%const);
4306     $thismod_pack-><M::PLBlockCon.appendStatement> ("sub $_ ()")
4307     for keys %const;
4308     $thismod_pack-><M::PLPack.getSub> ('AUTOLOAD', make_new_node => true)
4309     -><M::PLBlockCon.appendCode> (q[
4310     my $al = our $AUTOLOAD;
4311     $al =~ s/.+:://;
4312     if (] . $map . q[->{$al}) {
4313     no strict 'refs';
4314     *{$AUTOLOAD} = \&{] . $map . q[->{$al}};
4315     goto &{$AUTOLOAD};
4316     } else {
4317     require Carp;
4318     Carp::croak (qq<Can't locate method "$AUTOLOAD">);
4319     }
4320     ]);
4321     $thismod_pack-><M::PLPack.getSub> ('import', make_new_node => true)
4322     -><M::PLBlockCon.appendCode> (q[
4323     my $self = shift;
4324     if (@_) {
4325     local $Exporter::ExportLevel = $Exporter::ExportLevel + 1;
4326     $self->SUPER::import (@_);
4327     for (grep {not /\W/} @_) {
4328     eval qq{$_};
4329     }
4330     }
4331     ]);
4332 wakaba 1.22 }
4333    
4334 wakaba 1.24 ## -- Require'ing external modules
4335 wakaba 1.22 ## TODO: Custom module construction support
4336     for my $uri (@{$r-><M::MPLCodeFragment.disGetRequireURIList>}) {
4337     my $mod = $self->{db}-><M::ManakaiDISDatabase.getResource> ($uri)
4338     -><AG::ManakaiDISResourceDefinition.ownerModule>;
4339     next unless $mod;
4340     my $pack = $mod-><AG::ManakaiDISModuleDefinition
4341     .plFullyQualifiedName>;
4342 wakaba 1.29 $r-><M::MPLCodeFragment.addRequirePerlModuleName> ($pack)
4343 wakaba 1.22 unless $pack eq $thismod_name;
4344     }
4345 wakaba 1.24
4346    
4347 wakaba 1.22 }__;
4348    
4349 wakaba 1.24 @Method:
4350     @@Name: plIsFeatureImplemented
4351 wakaba 1.32 @@enDesc:
4352 wakaba 1.24 Returns whether a feature is implemented by this module
4353     or resource or not.
4354     \
4355     {NOTE:: For modules, tests for features not provided
4356     by the modules will return <DOM::true>. For
4357     resources, if it does not provides the support
4358     for the feature, then this method will return <DOM::true>.
4359     \
4360     }
4361     \
4362     {NOTE:: Feature inheritances are not taken into account.
4363     \
4364     }
4365     @@Param:
4366     @@@Name:featureResourceURI
4367     @@@Type: ResourceURI
4368     @@@enDesc:
4369     The URI reference of the resource definition for
4370     the feature to test.
4371     @@Return:
4372     @@@Type:
4373     DOMMain:boolean::ManakaiDOM:all
4374     @@@enDesc:
4375     Whether the feature is implemented or not.
4376     @@@PerlDef:
4377     __DEEP{
4378     if (defined $self->{<Q::DIS:isFeatureImplemented>}
4379     ->{$featureResourceURI}) {
4380     $r = $self->{<Q::DIS:isFeatureImplemented>}
4381     ->{$featureResourceURI};
4382     } elsif ($self->isa (<ClassName::ManakaiDISModuleDefinition>)) {
4383     $r = true;
4384     for my $cls (@{$self-><M::ManakaiDISPropertyAccessor
4385     .getPropertyResourceList>
4386     (<Q::DIS:resource>)}) {
4387     if ($cls-><M::ManakaiDISResourceDefinition.isTypeURI>
4388     (<Q::ManakaiDOM:Class>)) {
4389     unless ($cls-><M::ManakaiDISPerlModuleDefinition
4390     .plIsFeatureImplemented>
4391     ($featureResourceURI)) {
4392     $r = false;
4393     last;
4394     }
4395     }
4396     ## NOTE: DISPerl:ScalarVariable's are always implemented
4397     }
4398     $self->{<Q::DIS:isFeatureImplemented>}
4399     ->{$featureResourceURI} = $r;
4400     } else { ## Resource definition
4401     ## TODO: Custom module definition
4402     if ($self-><M::ManakaiDISResourceDefinition.isFeatureProvided>
4403     ($featureResourceURI)) {
4404     if ($self-><M::ManakaiDISResourceDefinition.isTypeURI>
4405     (<Q::DISLang:MethodReturn>) or
4406     $self-><M::ManakaiDISResourceDefinition.isTypeURI>
4407     (<Q::DISLang:AttributeGet>) or
4408     $self-><M::ManakaiDISResourceDefinition.isTypeURI>
4409     (<Q::DISLang:AttributeSet>)) {
4410     my $def = $self->{src}-><M::ManakaiDISElement.disGetAttribute>
4411     (<Q::dis:Def>, for_arg => $self->{for},
4412     forp_arg => $self->{forp});
4413     $r = $def ? true : false;
4414     } else {
4415     $r = true;
4416     for my $res (@{$self-><M::ManakaiDISPropertyAccessor
4417     .getPropertyResourceList>
4418     (<Q::DIS:childResource>)}) {
4419     if ($res-><M::ManakaiDISResourceDefinition.isTypeURI>
4420     (<Q::DISLang:AnyMethod>)) {
4421     unless ($res-><M::ManakaiDISPerlModuleDefinition
4422     .plIsFeatureImplemented>
4423     ($featureResourceURI)) {
4424     $r = false;
4425     last;
4426     }
4427     }
4428     } # for
4429     } # self.type
4430     } else {
4431     $r = true;
4432     }
4433     $self->{<Q::DIS:isFeatureImplemented>}->{$featureResourceURI} = $r;
4434     }
4435     }__;
4436 wakaba 1.22
4437     ##DISPerlModuleDefinition
4438    
4439 wakaba 1.24 PropDef:
4440     @QName: isFeatureImplemented
4441     @enDesc:
4442     The list of whether a feature is implemented or not.
4443    
4444 wakaba 1.22 ResourceDef:
4445     @QName: PLFile
4446     @AliasFor:
4447     PerlCode:ManakaiPerlFile::ManakaiDOM:Perl
4448     @rdf:type:
4449     rdfs:Class
4450    
4451     ClsDef:
4452 wakaba 1.2 @ClsQName: ManakaiDISResourceDefinition
4453     @enDesc:
4454     <QUOTE::dis> resource definitions.
4455     @ClsISA: ManakaiDISPropertyAccessor
4456 wakaba 1.4 @ClsISA: ManakaiDISExceptionTarget
4457 wakaba 1.22 @ClsISA: ManakaiDISPerlModuleDefinition
4458 wakaba 1.21
4459     @IntMethod:
4460     @@Operator:
4461     @@@@:eq
4462     @@@ContentType:
4463     lang:Perl
4464     @@enDesc:
4465     Whether two <QUOTE::dis> resource definitions are equal or not.
4466     Two resource definitions are equal iff one's <A::.uri> is
4467     literally equal to another's <A::.uri>.
4468     @@Param:
4469     @@@Name: anotherResource
4470     @@@Type: ManakaiDISResourceDefinition
4471     @@@enDesc:
4472     Another resource definition to compare.
4473     @@Return:
4474     @@@Type:
4475     DOMMain:boolean::ManakaiDOM:all
4476     @@@enDesc:
4477     Whether two resources are equal or not.
4478     @@@PerlDef:
4479     if (UNIVERSAL::isa ($anotherResource,
4480     <ClassName::ManakaiDISResourceDefinition>)) {
4481     $r = $self->{uri} eq $anotherResource->{uri};
4482     } else {
4483     $r = false;
4484     }
4485 wakaba 1.2
4486     @Attr:
4487     @@Name: uri
4488     @@Type: ResourceURI
4489     @@Description:
4490     @@@lang:en
4491     @@@@:
4492     The URI reference of this <QUOTE::dis> resource.
4493     @@Get:
4494     @@@PerlDef:
4495     $r = $self->{uri};
4496    
4497     @Attr:
4498     @@Name: nameURI
4499     @@Type: NameURI
4500     @@enDesc:
4501     The URI reference of this <QUOTE::dis> resource, without
4502     <QUOTE::for> identifier.
4503     @@Get:
4504     @@@nullCase:
4505     @@@@enDesc:
4506     This resource does not have its name URI reference.
4507 wakaba 1.3 @@@PerlDef:
4508 wakaba 1.4 $r = $self->{nameURI};
4509 wakaba 1.2
4510     @Attr:
4511 wakaba 1.32 @@Name: sourceNodeID
4512     @@enDesc:
4513     The identifier URI reference of the source node.
4514     @@Type: ResourceURI
4515     @@Get:
4516     @@@nullCase:
4517     @@@@enDesc:
4518     The resource is not (yet) associated with any source node.
4519     @@@PerlDef:
4520     $r = $self->{<Q::DIS:sourceNodeID>};
4521     @@Set:
4522     @@@PerlDef:
4523     $self->{<Q::DIS:sourceNodeID>} = $given;
4524    
4525     @Attr:
4526 wakaba 1.2 @@Name: localName
4527     @@enDesc:
4528     The local name of this resource.
4529     @@Type:
4530 wakaba 1.3 DISCore:LocalName::ManakaiDOM:all
4531 wakaba 1.2 @@Get:
4532     @@@nullCase:
4533     @@@@enDesc:
4534     This resource does not have its local name.
4535     @@@PerlDef:
4536     $r = $self->{localName};
4537    
4538     @Attr:
4539     @@Name: namespaceURI
4540     @@Type: AnyURI
4541     @@enDesc:
4542     The namespace URI of the name of this resource.
4543     @@Get:
4544     @@@nullCase:
4545     The name of this resource does not have its namespace
4546     or this resource does not have its name.
4547     @@@PerlDef:
4548     $r = $self->{namespaceURI};
4549    
4550     @Attr:
4551     @@Name: isAnonymous
4552     @@enDesc:
4553     Whether this <QUOTE::dis> resource has name or not.
4554     @@Type:
4555 wakaba 1.18 DOMMain:boolean::ManakaiDOM:all
4556 wakaba 1.2 @@Get:
4557     @@@TrueCase:
4558     This resource does not have any global unique name.
4559     <A::ManakaiDISResourceDefinition.uri> is a temporary URI reference.
4560     @@@FalseCase:
4561     This resource does have its formal name.
4562     <A::ManakaiDISResourceDefinition.uri> is a URI reference
4563     generated from the name and the <QUOTE::for> URI reference
4564     of this resource.
4565     @@@PerlDef:
4566     $r = $self->{<Q::isAnon>};
4567    
4568     @Attr:
4569     @@Name: forURI
4570     @@enDesc:
4571     The <QUOTE::for> URI reference for which this resource is defined.
4572     @@Type:ForURI
4573     @@Get:
4574     @@@PerlDef:
4575     $r = $self->{for};
4576    
4577     @Attr:
4578     @@Name: forpURI
4579     @@enDesc:
4580     The <QUOTE::for+> URI references for which this resource is defined.
4581     @@Type: ForURIList
4582     @@Get:
4583 wakaba 1.15 @@@enDesc:
4584     List of <QUOTE::for> URI references. Note that this list is
4585     <QUOTE::dead>.
4586 wakaba 1.3 @@@PerlDef:
4587 wakaba 1.15 $r = [@{$self->{forp}}];
4588    
4589     @Method:
4590     @@Name: isForURI
4591     @@enDesc:
4592     Tests whether this resource is defined for a <QUOTE::for>
4593     or <QUOTE::for+> URI reference or not.
4594     @@Param:
4595     @@@Name:forURI
4596     @@@Type:ForURI
4597     @@@enDesc:
4598     A <QUOTE::for> URI reference to test.
4599     @@Return:
4600     @@@Type:
4601     DOMMain:boolean::ManakaiDOM:all
4602     @@@TrueCase:
4603     @@@@enDesc:
4604     This resource is for <P::forURI>.
4605     @@@FalseCase:
4606     @@@@enDesc:
4607     This resource is not for <P::forURI>.
4608     @@@PerlDef:
4609     __DEEP{
4610     for my $this_for_uri ($self->{for}, @{$self->{forp}}) {
4611     if ($this_for_uri eq $forURI) { ## Shortcut
4612     $r = true;
4613     last;
4614     }
4615     my $this_for = $self->{db}-><M::ManakaiDISDatabase.getFor>
4616     ($this_for_uri);
4617     if ($this_for-><M::ManakaiDISForDefinition.isaURI> ($forURI)) {
4618     $r = true;
4619     last;
4620     }
4621     }
4622     }__;
4623 wakaba 1.2
4624     @Method:
4625 wakaba 1.7 @@Name: isSubsetOfURI
4626 wakaba 1.2 @@Description:
4627     @@@lang:en
4628     @@@@:
4629     Whether this resource is a subset of another resource or not.
4630     @@Param:
4631     @@@Name: superURI
4632     @@@Type: ResourceURI
4633     @@@Description:
4634     @@@@lang:en
4635     @@@@@:
4636     Another resource URI reference to test.
4637     @@Return:
4638     @@@Type:
4639 wakaba 1.18 DOMMain:boolean::ManakaiDOM:all
4640 wakaba 1.2 @@@TrueCase:
4641     @@@@enDesc:
4642     <P::superURI> is a super-resource of this resource.
4643     @@@FalseCase:
4644     @@@@enDesc:
4645     <P::superURI> is not a super-resource of this resource.
4646     @@@PerlDef:
4647 wakaba 1.6 $r = $self->{aliasURI}->{$superURI} || $self->{subOf}->{$superURI};
4648 wakaba 1.2
4649 wakaba 1.7 @Method:
4650     @@Name: addSuperResource
4651     @@enDesc:
4652     Adds a <QUOTE::dis> resource to the list of super-resource
4653     of this <QUOTE::dis> resource.
4654     @@Param:
4655     @@@Name: superRes
4656     @@@Type: ManakaiDISResourceDefinition
4657     @@@enDesc:
4658     A <QUOTE::dis> resource definition object.
4659     @@Return:
4660     @@@PerlDef:
4661     my @from = ($self->{uri},
4662     grep {$self->{supOf}->{$_}} keys %{$self->{supOf}});
4663     my @to = ($superRes->{uri},
4664     grep {$superRes->{subOf}->{$_}} keys %{$superRes->{subOf}});
4665     __DEEP{
4666     for my $from (@from) {
4667     for my $to (@to) {
4668     $self->{db}-><M::ManakaiDISDatabase.getResource>
4669     ($from)->{subOf}->{$to} = true;
4670     $self->{db}-><M::ManakaiDISDatabase.getResource>
4671     ($to)->{supOf}->{$from} = true;
4672     }
4673     }
4674     }__;
4675    
4676 wakaba 1.2 @Attr:
4677     @@Name: isDefined
4678     @@Description:
4679     @@@lang:en
4680     @@@@:
4681     Whether this resource is already defined or not.
4682     @@Type:
4683 wakaba 1.18 DOMMain:boolean::ManakaiDOM:all
4684 wakaba 1.2 @@Get:
4685     @@@TrueCase:
4686     This resource is already defined.
4687     @@@FalseCase:
4688     This resource is not defined.
4689     @@@PerlDef:
4690     $r = $self->{<Q::isDefined>};
4691    
4692     @Attr:
4693     @@Name: isReferred
4694     @@Description:
4695     @@@lang:en
4696     @@@@:
4697     Whether this resource is referred or not.
4698 wakaba 1.7 @@Type: ManakaiDISElement
4699 wakaba 1.2 @@Get:
4700 wakaba 1.7 @@@enDesc:
4701 wakaba 1.9 An element that referres this resource.
4702 wakaba 1.2 @@@nullCase:
4703     This resource is not referred.
4704     @@@PerlDef:
4705     $r = $self->{<Q::isReferred>};
4706     @@Set:
4707 wakaba 1.7 @@@enDesc:
4708 wakaba 1.9 An element that referres this resource.
4709 wakaba 1.2 @@@PerlDef:
4710 wakaba 1.9 $self->{<Q::isReferred>} = $given if $given;
4711 wakaba 1.2
4712     @Attr:
4713 wakaba 1.22 @@Name: ownerModule
4714     @@ManakaiDOM:isRedefining:1
4715 wakaba 1.2 @@Description:
4716     @@@lang:en
4717     @@@@:
4718     The <QUOTE::dis> module in which this resource is defined.
4719     @@Type: ManakaiDISModuleDefinition
4720     @@Get:
4721     @@@Description:
4722     @@@@lang:en
4723     @@@@@:
4724     The module object.
4725 wakaba 1.3 @@@nullCase:
4726 wakaba 1.2 @@@@Description:
4727     @@@@@lang:en
4728     @@@@@@:
4729     This resource is not associated to any module.
4730     @@@PerlDef:
4731     $r = $self->{db}
4732     -><M::ManakaiDISDatabase.getModule>
4733     ($self->{<Q::definingModule>})
4734     if defined $self->{<Q::definingModule>};
4735    
4736 wakaba 1.6 @Method:
4737     @@Name: mergeAsAlias
4738     @@enDesc:
4739     Merges another resource definition as an alias of this resource.
4740     @@Param:
4741     @@@Name: aliasResource
4742     @@@Type: ManakaiDISResourceDefinition
4743     @@@enDesc:
4744     A resource to merge.
4745     \
4746     {NOTE:: After merging all references to <P::aliasResource>
4747     should be discarded.
4748     \
4749     }
4750 wakaba 1.11 @@NodeParam:
4751 wakaba 1.6 @@Return:
4752 wakaba 1.11 @@@RaiseException:
4753     @@@@@:MERGE_ITSELF_ERR
4754     @@@@@@enDesc:
4755     An attempt is made to merge this resource itself.
4756     @@@PerlDef:
4757     if ($self eq $aliasResource) {
4758     __EXCEPTION{MERGE_ITSELF_ERR::
4759     DIS:uri => {$self->{uri}},
4760     DIS:sourceNode => {$node},
4761     }__;
4762     }
4763 wakaba 1.6 for my $uri ($aliasResource->{uri},
4764     grep {$aliasResource->{aliasURI}->{$_}}
4765     keys %{$aliasResource->{aliasURI}}) {
4766     $self->{aliasURI}->{$uri} = true;
4767     $self->{db}->{resDef}->{$uri} = $self;
4768     $self->{subOf}->{$uri} = true;
4769     $self->{supOf}->{$uri} = true;
4770     }
4771     for my $uri (grep {$aliasResource->{subOf}->{$_}}
4772     keys %{$aliasResource->{subOf}}) {
4773     $self->{subOf}->{$uri} = true;
4774     }
4775     for my $uri (grep {$aliasResource->{supOf}->{$_}}
4776     keys %{$aliasResource->{supOf}}) {
4777     $self->{supOf}->{$uri} = true;
4778     }
4779     my @from = grep {$self->{supOf}->{$_}} keys %{$self->{supOf}};
4780     my @to = grep {$self->{subOf}->{$_}} keys %{$self->{subOf}};
4781     __DEEP{
4782     for my $from (@from) {
4783     for my $to (@to) {
4784     $self->{db}-><M::ManakaiDISDatabase.getResource>
4785     ($from)->{subOf}->{$to} = true;
4786     $self->{db}-><M::ManakaiDISDatabase.getResource>
4787     ($to)->{supOf}->{$from} = true;
4788     }
4789     }
4790     }__;
4791 wakaba 1.7
4792     @Method:
4793     @@Name: isTypeURI
4794     @@enDesc:
4795     Tests whether this resource is of a type or not.
4796     @@Param:
4797     @@@Name: typeURI
4798     @@@Type: ResourceURI
4799     @@@enDesc:
4800     A type URI reference to test.
4801     @@Return:
4802     @@@Type:
4803 wakaba 1.18 DOMMain:boolean::ManakaiDOM:all
4804 wakaba 1.7 @@@TrueCase:
4805     @@@@enDesc:
4806     This is a <P::typeURI> resource.
4807     @@@FalseCase:
4808     @@@@enDesc:
4809     This is not a <P::typeURI> resource.
4810     @@@PerlDef:
4811 wakaba 1.8 if ($self->{<Q::rdf:type>}->{$typeURI}) {
4812     $r = $self->{<Q::rdf:type>}->{$typeURI};
4813     } else {
4814     for my $t_type_uri (grep {$self->{<Q::rdf:type>}->{$_}}
4815     keys %{$self->{<Q::rdf:type>}}) {
4816     my $t_type = $self->{db}-><M::ManakaiDISDatabase.getResource>
4817     ($t_type_uri);
4818     if ($t_type-><M::ManakaiDISResourceDefinition.isSubsetOfURI>
4819     ($typeURI)) {
4820     $self->{<Q::rdf:type>}->{$typeURI} = $r = true;
4821     last;
4822     }
4823 wakaba 1.7 }
4824     }
4825 wakaba 1.8
4826     @Attr:
4827     @@Name: plName
4828     @@enDesc:
4829     The Perl name of this resource.
4830     @@Get:
4831     @@@Type:
4832 wakaba 1.18 DISLang:String::ManakaiDOM:all
4833 wakaba 1.8 @@@enDesc:
4834     - <Q::ManakaiDOM:Const>::: Constant function (local) name.
4835     \
4836     - <Q::ManakaiDOM:ConstGroup>::: Export group name (without
4837     <CHAR::COLON> prefix).
4838     \
4839     - <Q::DISLang:Attribute>::: Method name.
4840     \
4841     - <Q::DISLang:Method>::: Method name.
4842     @@@nullCase:
4843     @@@@enDesc:
4844     Either the type of this resource is not listed above
4845     or this Perl constructure is anonymous.
4846     @@@RaiseException:
4847     @@@@@: NO_LOCAL_NAME_ERR
4848     @@@@enDesc:
4849     The type of this resource is either
4850     <Q::ManakaiDOM:Const> or <Q::ManakaiDOM:ConstGroup> and
4851     the local name of this resource is not defined.
4852     @@@RaiseException:
4853     @@@@@: RESERVED_PERL_METHOD_NAME_ERR
4854     @@@@enDesc:
4855     The Perl method name constructed from the source
4856     result in a reserved name.
4857     @@@PerlDef:
4858     __DEEP{
4859     if (exists $self->{<Q::dis2pm:name>}) {
4860     $r = $self->{<Q::dis2pm:name>};
4861     } elsif ($self-><M::ManakaiDISResourceDefinition.isTypeURI>
4862 wakaba 1.27 (<Q::DISLang:AnyMethod>)) {
4863 wakaba 1.8 if (defined $self->{localName}) {
4864     $r = <ClassM::ManakaiDISImplementation.camelCaseToUnderscoreName>
4865     ($self->{localName});
4866     if ($self-><M::ManakaiDISPropertyAccessor.getPropertyBoolean>
4867     (<Q::ManakaiDOM:isForInternal>, false)) {
4868     $r = '_' . $r;
4869     }
4870     if ({
4871     import => 1,
4872     unimport => 1,
4873     isa => 1,
4874     can => 1,
4875     new => 1,
4876     as_string => 1,
4877     stringify => 1,
4878     clone => 1,
4879     }->{$r} or $r =~ /^___/) {
4880     __UNDEEP{
4881     __EXCEPTION{RESERVED_PERL_METHOD_NAME_ERR::
4882     DIS:uri => {$self->{uri}},
4883     DIS:soruceNode => {$self->{src}},
4884     DIS:generatedName => {$r},
4885     }__;
4886     }__;
4887 wakaba 1.11 }
4888     } elsif (my $op_uri = $self-><AG::ManakaiDISResourceDefinition
4889 wakaba 1.8 .plMethodOperator>) {
4890     $r = {
4891     <Q::ManakaiDOM:MUErrorHandler> => '___report_error',
4892 wakaba 1.29 <Q::DISPerl:AsStringMethod> => 'stringify',
4893 wakaba 1.16 <Q::DISPerl:NewMethod> => 'new',
4894     <Q::DISPerl:CloneMethod> => 'clone',
4895 wakaba 1.8 }->{$op_uri};
4896     $r = $op_uri if $op_uri =~ /^[A-Z]+$/;
4897     } else {
4898     $r = null;
4899     }
4900 wakaba 1.27 } elsif ($self-><M::ManakaiDISResourceDefinition.isTypeURI>
4901     (<Q::ManakaiDOM:Const>)) {
4902     unless (defined $self->{localName}) {
4903     __UNDEEP{
4904     __EXCEPTION{NO_LOCAL_NAME_ERR::
4905     DIS:uri => {$self->{uri}},
4906     DIS:sourceNode => {$self->{src}},
4907     }__;
4908     }__;
4909     }
4910     $r = uc $self->{localName};
4911     if ($r =~ /^_/ or $r =~ /_$/) {
4912     __UNDEEP{
4913     __EXCEPTION{RESERVED_PERL_METHOD_NAME_ERR::
4914     DIS:uri => {$self->{uri}},
4915     DIS:localName => {$self->{localName}},
4916     DIS:soruceNode => {$self->{src}},
4917     DIS:generatedName => {$r},
4918     }__;
4919     }__;
4920     }
4921     } elsif ($self-><M::ManakaiDISResourceDefinition.isTypeURI>
4922     (<Q::ManakaiDOM:ConstGroup>)) {
4923     $r = $self->{localName};
4924     unless (defined $r) {
4925     __UNDEEP{
4926     __EXCEPTION{NO_LOCAL_NAME_ERR::
4927     DIS:uri => {$self->{uri}},
4928     DIS:sourceNode => {$self->{src}},
4929     }__;
4930     }__;
4931     }
4932 wakaba 1.8 } else {
4933     $r = null;
4934     }
4935     $self->{<Q::dis2pm:name>} = $r;
4936     }__;
4937    
4938     @Attr:
4939     @@Name: plFullyQualifiedName
4940     @@enDesc:
4941     The fully-qualified Perl name of this resource.
4942     @@Type:
4943     DISLang:String::ManakaiDOM:all
4944     @@Get:
4945     @@@enDesc:
4946     Fully-qualified name.
4947     \
4948     - <Q::ManakaiDOM:Class>::: Class package name.
4949     \
4950     - <Q::ManakaiDOM:IF>::: Interface package name.
4951     \
4952     - <Q::DISPerl:ScalarVariable>::: Variable name (without variable
4953     type symbol such as <CODE::$>).
4954     @@@nullCase:
4955     @@@@enDesc:
4956     Otherwise.
4957     @@@NoPerlModuleNameException:
4958     @@@RaiseException:
4959     @@@@@: NO_LOCAL_NAME_ERR
4960     @@@@enDesc:
4961     The local name of this resource is not defined.
4962     @@@PerlDef:
4963     __DEEP{
4964 wakaba 1.27 if (exists $self->{<Q::PerlCode.plFullyQualifiedName>}) {
4965     $r = $self->{<Q::PerlCode:plFullyQualifiedName>};
4966 wakaba 1.8 } elsif ($self-><M::ManakaiDISResourceDefinition.isTypeURI>
4967     (<Q::ManakaiDOM:Class>) or
4968     $self-><M::ManakaiDISResourceDefinition.isTypeURI>
4969     (<Q::ManakaiDOM:IF>) or
4970     $self-><M::ManakaiDISResourceDefinition.isTypeURI>
4971     (<Q::DISPerl:ScalarVariable>)) {
4972 wakaba 1.14 my $an_node = $self->{src}-><M::ManakaiDISElement.disGetAttribute>
4973 wakaba 1.8 (<Q::dis:AppName>, for_arg => $self->{for},
4974     forp_arg => $self->{forp},
4975     media_type => <Q::lang:Perl>);
4976     if ($an_node) {
4977     ## NOTE: "lang:Perl" is fully-qualified name by definition
4978 wakaba 1.14 $r = $an_node-><M::swcfg21:SWCFGNode::swcfg21:ForLatest.value>;
4979 wakaba 1.8 } else {
4980 wakaba 1.10 unless (defined $self->{localName}) {
4981     __UNDEEP{
4982     __EXCEPTION{NO_LOCAL_NAME_ERR::
4983     DIS:sourceNode => {$self->{src}},
4984     }__;
4985     }__;
4986     }
4987 wakaba 1.8 if ($self-><M::ManakaiDISResourceDefinition.isTypeURI>
4988     (<Q::ManakaiDOM:IF>)) {
4989 wakaba 1.22 $r = $self-><AG::ManakaiDISResourceDefinition.ownerModule>
4990 wakaba 1.14 -><AG::ManakaiDISModuleDefinition.plInterfaceName>
4991 wakaba 1.8 . '::' . $self->{localName};
4992     } else {
4993 wakaba 1.22 $r = $self-><AG::ManakaiDISResourceDefinition.ownerModule>
4994 wakaba 1.14 -><AG::ManakaiDISModuleDefinition.plFullyQualifiedName>
4995 wakaba 1.8 . '::' . $self->{localName};
4996     }
4997     }
4998 wakaba 1.27 } elsif ($self-><M::ManakaiDISResourceDefinition.isTypeURI>
4999     (<Q::ManakaiDOM:Const>)) {
5000     $r = $self-><AG::ManakaiDISResourceDefinition.ownerModule>
5001     -><AG::ManakaiDISModuleDefinition.plFullyQualifiedName>
5002     . '::' . $self-><AG::ManakaiDISResourceDefinition.plName>;
5003 wakaba 1.8 } else {
5004     $r = null;
5005     }
5006 wakaba 1.27 $self->{<Q::PerlCode:plFullyQualifiedName>} = $r;
5007 wakaba 1.8 }__;
5008    
5009     @Attr:
5010 wakaba 1.15 @@Name: plVariableName
5011     @@enDesc:
5012     The Perl variable name with prefix.
5013     @@Type:
5014     lang:Perl::ManakaiDOM:all
5015     @@Get:
5016     @@@nullCase:
5017     @@@@enDesc:
5018     This resource does not define any Perl variable.
5019     @@@PerlDef:
5020 wakaba 1.23 my $pnm_node = $self->{src}-><M::ManakaiDISElement.disGetAttribute>
5021     (<Q::dis:AppName>,
5022     for_arg => $self->{for},
5023     forp_arg => $self->{forp},
5024     media_type => <Q::lang:Perl>,
5025     default_media_type => <Q::lang:Perl>);
5026     $r = $pnm_node ? $pnm_node-><M::SWCFGNode.value> : $self->{localName};
5027 wakaba 1.15 if (defined $r) {
5028     __DEEP{
5029 wakaba 1.18 if ($self-><M::ManakaiDISPropertyAccessor.getPropertyBoolean>
5030     (<Q::DISPerl:isNamedParameter>, false)) {
5031     $r = '$opt{' .
5032 wakaba 1.21 <ClassM::ManakaiDISImplementation.camelCaseToUnderscoreName>
5033     ($r) .
5034 wakaba 1.18 '}';
5035 wakaba 1.22 } else {
5036     my $dt = $self-><AG::ManakaiDISResourceDefinition
5037     .disActualDataTypeResource>;
5038     if ($dt-><M::ManakaiDISResourceDefinition.isSubsetOfURI>
5039 wakaba 1.18 (<Q::Perl:Array>)) {
5040 wakaba 1.22 $r = '@' . $r;
5041     } elsif ($dt-><M::ManakaiDISResourceDefinition.isSubsetOfURI>
5042 wakaba 1.18 (<Q::Perl:Hash>)) {
5043 wakaba 1.22 $r = '%' . $r;
5044     } else {
5045     $r = '$' . $r;
5046     }
5047 wakaba 1.18 }
5048     }__;
5049     }
5050    
5051     @Attr:
5052     @@Name: plPrototype
5053     @@enDesc:
5054     The Perl parameter prototype character.
5055     @@Type:
5056     lang:Perl::ManakaiDOM:all
5057     @@Get:
5058     @@@PerlDef:
5059     __DEEP{
5060 wakaba 1.22 my $dt = $self-><AG::ManakaiDISResourceDefinition
5061     .disActualDataTypeResource>;
5062     if ($dt-><M::ManakaiDISResourceDefinition.isSubsetOfURI>
5063 wakaba 1.15 (<Q::Perl:Array>)) {
5064     $r = '@' . $r;
5065 wakaba 1.22 } elsif ($dt-><M::ManakaiDISResourceDefinition.isSubsetOfURI>
5066 wakaba 1.15 (<Q::Perl:Hash>)) {
5067     $r = '%' . $r;
5068     } else {
5069     $r = '$' . $r;
5070     }
5071     }__;
5072    
5073     @Attr:
5074 wakaba 1.8 @@Name: plMethodOperator
5075     @@enDesc:
5076     The operator to overload by this method.
5077     @@Type:
5078     DISLang:String::ManakaiDOM:all
5079     @@Get:
5080     @@@enDesc:
5081     The operator, either Perl <CODE::use operator> operator name
5082     of manakai operator URI reference.
5083     @@@nullCase:
5084     @@@@enDesc:
5085     Either this resource does not define a Perl method or
5086     this method does not overload any operator.
5087     @@@UndeclaredPrefixException:
5088     @@@RaiseException:
5089     @@@@@: UNSUPPORTED_MEDIA_TYPE_ERR
5090     @@@@enDesc:
5091     Media type of the <Q::dis:Operator> node is not supported.
5092     @@@PerlDef:
5093     __DEEP{
5094     if (exists $self->{<Q::dis:Operator>}) {
5095     $r = $self->{<Q::dis:Operator>};
5096     } else {
5097     my $op_node = $self->{src}-><M::ManakaiDISElement.disGetAttribute>
5098     (<Q::dis:Operator>, for_arg => $self->{for},
5099     forp_arg => $self->{forp});
5100     if ($op_node) {
5101     if ($op_node-><M::ManakaiDISElement.mediaTypeMatch>
5102 wakaba 1.12 (<Q::lang:Perl>, for_arg => $self->{for},
5103     for_arg => $self->{forp})) {
5104 wakaba 1.14 $r = $op_node-><M::swcfg21:SWCFGNode::swcfg21:ForLatest.value>;
5105 wakaba 1.8 } elsif ($op_node-><M::ManakaiDISElement.mediaTypeMatch>
5106 wakaba 1.12 (<Q::dis:TypeQName>, for_arg => $self->{for},
5107     for_arg => $self->{forp})) {
5108 wakaba 1.8 $r = $op_node-><AG::ManakaiDISElement.qnameValueURI>;
5109     } else {
5110 wakaba 1.10 my $ct_uri = $op_node-><M::ManakaiDISElement.mediaTypeURI>
5111     (for_arg => $self->{for},
5112     forp_arg => $self->{forp});
5113 wakaba 1.8 __UNDEEP{
5114     __EXCEPTION{UNSUPPORTED_MEDIA_TYPE_ERR::
5115     DIS:uri => {$ct_uri},
5116 wakaba 1.10 DIS:sourceNode => {$op_node},
5117 wakaba 1.8 }__;
5118     }__;
5119     }
5120     } else {
5121     $r = null;
5122     }
5123     $self->{<Q::dis:Operator>} = $r;
5124     }
5125     }__;
5126    
5127     @Attr:
5128     @@Name: disDataTypeResource
5129     @@enDesc:
5130     <Q::dis:Type> attribute value of this resource.
5131     @@Type: ManakaiDISResourceDefinition
5132     @@Get:
5133     @@@RaiseException:
5134     @@@@@:NO_DIS_TYPE_ERR
5135     @@@@enDesc:
5136     <Q::dis:Type> attribute is not specified.
5137     @@@PerlDef:
5138     __DEEP{
5139     if (defined $self->{<Q::dis:Type>}) {
5140 wakaba 1.15 $r = $self->{db}-><M::ManakaiDISDatabase.getResource>
5141     ($self->{<Q::dis:Type>});
5142 wakaba 1.8 } else {
5143     $self->{<Q::dis2pm:TypeNode>}
5144     = $self->{src}-><M::ManakaiDISElement.disGetAttribute>
5145     (<Q::dis:Type>, for_arg => $self->{for},
5146     forp_arg => $self->{forp});
5147     if ($self->{<Q::dis2pm:TypeNode>}) {
5148     $r = $self->{<Q::dis:Type>}
5149     = $self->{<Q::dis2pm:TypeNode>}
5150 wakaba 1.18 -><M::ManakaiDISElement.tfqnamesValueURI>
5151 wakaba 1.33 (null, $self->{for}, for_arg => $self->{for},
5152     forp_arg => $self->{forp});
5153 wakaba 1.18 $r = $self->{db}-><M::ManakaiDISDatabase.getResource> ($r);
5154     $r-><AS::ManakaiDISResourceDefinition.isReferred>
5155     ($self->{<Q::dis2pm:TypeNode>});
5156 wakaba 1.8 } else {
5157     my $pr = $self-><M::ManakaiDISPropertyAccessor
5158     .getPropertyResource>
5159     (<Q::DIS:dynamicParentResource>);
5160     if ($pr) {
5161     $r = $pr-><AG::ManakaiDISResourceDefinition
5162     .disDataTypeResource>;
5163     $self->{<Q::dis2pm:TypeNode>}
5164     = $pr->{<Q::dis2pm:TypeNode>};
5165 wakaba 1.18 $self->{<Q::dis:Type>}
5166     = $r-><AG::ManakaiDISResourceDefinition.uri>;
5167 wakaba 1.8 } else { ## No parent
5168     __UNDEEP{
5169     __EXCEPTION{NO_DIS_TYPE_ERR::
5170     DIS:sourceNode => {$self->{src}},
5171     }__;
5172     }__;
5173     }
5174     }
5175     }
5176     }__;
5177    
5178     @Attr:
5179     @@Name: disDataTypeNode
5180     @@enDesc:
5181     <Q::dis:Type> node for this resource.
5182     @@Get:
5183     @@@Type: ManakaiDISElement
5184     @@@RaiseException:
5185     @@@@@:NO_DIS_TYPE_ERR
5186     @@@@enDesc:
5187     <Q::dis:Type> attribute is not specified.
5188     @@@PerlDef:
5189     __DEEP{
5190 wakaba 1.18 $self-><AG::ManakaiDISResourceDefinition.disDataTypeResource>;
5191 wakaba 1.8 }__;
5192     $r = $self->{<Q::dis2pm:TypeNode>};
5193    
5194     @Attr:
5195     @@Name: disActualDataTypeResource
5196     @@enDesc:
5197     <Q::dis:actualType> attribute value of this resource.
5198     @@Type: ManakaiDISResourceDefinition
5199     @@Get:
5200     @@@RaiseException:
5201     @@@@@:NO_DIS_TYPE_ERR
5202     @@@@enDesc:
5203     <Q::dis:actualType> attribute is not specified,
5204     and <Q::dis:Type> attribute, neigher.
5205     @@@PerlDef:
5206     __DEEP{
5207     if (defined $self->{<Q::dis:actualType>}) {
5208 wakaba 1.15 $r = $self->{db}-><M::ManakaiDISDatabase.getResource>
5209     ($self->{<Q::dis:actualType>});
5210 wakaba 1.8 } else {
5211     $self->{<Q::dis2pm:actualTypeNode>}
5212     = $self->{src}-><M::ManakaiDISElement.disGetAttribute>
5213     (<Q::dis:actualType>, for_arg => $self->{for},
5214     forp_arg => $self->{forp});
5215     if ($self->{<Q::dis2pm:actualTypeNode>}) {
5216     $r = $self->{<Q::dis:actualType>}
5217     = $self->{<Q::dis2pm:actualTypeNode>}
5218 wakaba 1.18 -><M::ManakaiDISElement.tfqnamesValueURI>
5219 wakaba 1.33 (null, $self->{for}, for_arg => $self->{for},
5220     forp_arg => $self->{forp});
5221 wakaba 1.18 $r = $self->{db}-><M::ManakaiDISDatabase.getResource> ($r);
5222     $r-><AS::ManakaiDISResourceDefinition.isReferred>
5223     ($self->{<Q::dis2pm:actualTypeNode>});
5224 wakaba 1.8 } elsif (defined $self->{<Q::dis:Type>}) {
5225     $r = $self->{<Q::dis:actualType>} = $self->{<Q::dis:Type>};
5226     $self->{<Q::dis2pm:actualTypeNode>}
5227     = $self->{<Q::dis2pm:TypeNode>};
5228 wakaba 1.18 $r = $self->{db}-><M::ManakaiDISDatabase.getResource> ($r);
5229 wakaba 1.8 } else {
5230     $self->{<Q::dis2pm:actualTypeNode>}
5231     = $self->{<Q::dis2pm:TypeNode>}
5232     = $self->{src}-><M::ManakaiDISElement.disGetAttribute>
5233     (<Q::dis:Type>, for_arg => $self->{for},
5234     forp_arg => $self->{forp});
5235     if ($self->{<Q::dis2pm:TypeNode>}) {
5236     $r = $self->{<Q::dis:actualType>}
5237     = $self->{<Q::dis:Type>}
5238     = $self->{<Q::dis2pm:TypeNode>}
5239 wakaba 1.18 -><M::ManakaiDISElement.tfqnamesValueURI>
5240 wakaba 1.33 (null, $self->{for}, for_arg => $self->{for},
5241     forp_arg => $self->{forp});
5242 wakaba 1.18 $r = $self->{db}-><M::ManakaiDISDatabase.getResource> ($r);
5243     $r-><AS::ManakaiDISResourceDefinition.isReferred>
5244     ($self->{<Q::dis2pm:actualTypeNode>});
5245 wakaba 1.8 } else {
5246     my $pr = $self-><M::ManakaiDISPropertyAccessor
5247     .getPropertyResource>
5248     (<Q::DIS:dynamicParentResource>);
5249     if ($pr) {
5250 wakaba 1.18 $r = $pr-><AG::ManakaiDISResourceDefinition
5251 wakaba 1.8 .disActualDataTypeResource>;
5252     $self->{<Q::dis2pm:actualTypeNode>}
5253     = $pr->{<Q::dis2pm:actualTypeNode>};
5254 wakaba 1.18 $self->{<Q::dis:actualType>}
5255     = $r-><AG::ManakaiDISResourceDefinition.uri>;
5256 wakaba 1.8 } else { ## No parent
5257     __UNDEEP{
5258     __EXCEPTION{NO_DIS_TYPE_ERR::
5259     DIS:sourceNode => {$self->{src}},
5260     }__;
5261     }__;
5262     }
5263     }
5264     }
5265     }
5266     }__;
5267    
5268     @Attr:
5269     @@Name: disActualDataTypeNode
5270     @@enDesc:
5271     <Q::dis:actualType> node for this resource.
5272     @@Get:
5273     @@@Type: ManakaiDISElement
5274     @@@RaiseException:
5275     @@@@@:NO_DIS_TYPE_ERR
5276     @@@@enDesc:
5277     <Q::dis:actualType> attribute is not specified,
5278     and <Q::dis:Type> attribute, neigher.
5279     @@@PerlDef:
5280     __DEEP{
5281 wakaba 1.18 $self-><AG::ManakaiDISResourceDefinition.disActualDataTypeResource>;
5282 wakaba 1.8 }__;
5283     $r = $self->{<Q::dis2pm:actualTypeNode>};
5284 wakaba 1.9
5285     @IntMethod:
5286     @@Operator:
5287     @@@@: <=>
5288     @@@ContentType:
5289     lang:Perl
5290     @@enDesc:
5291     Which is greater (i.e. the spaceship operator).
5292     A resource is less than another if it is loaded by
5293     <M::ManakaiDISDatabase.loadResource> before another is loaded.
5294     Order for non-loaded resource definitions are not defined.
5295     \
5296     {NOTE:: In the current implementation, non-loaded resources
5297     are less than any loaded resource and the order in
5298     non-loaded resources is unknown.
5299     \
5300     }
5301     @@Param:
5302     @@@Name: anotherResource
5303     @@@Type: ManakaiDISResourceDefinition
5304     @@@enDesc: Another resource to compare.
5305     @@Return:
5306     @@@Type:
5307 wakaba 1.18 DOMMain:unsigned-long::ManakaiDOM:all
5308 wakaba 1.9 @@@PerlDef:
5309     if (UNIVERSAL::isa ($anotherResource,
5310     <ClassName::ManakaiDISResourceDefinition>)) {
5311     $r = $self->{seq} <=> $anotherResource->{seq};
5312     } else {
5313     $r = overload::Overloaded ($self) <=> $anotherResource;
5314     }
5315 wakaba 1.12
5316     @Attr:
5317     @@Name: plCodeFragment
5318     @@enDesc:
5319     Perl code definition fragment of this resource.
5320     @@Type: MPLCodeFragment
5321     @@Get:
5322     @@@enDesc:
5323     Perl code.
5324     @@@nullCase:
5325     @@@@enDesc:
5326     This node does not have Perl code definition.
5327     @@@RaiseException:
5328     @@@@@:NO_METHOD_RETURN_ERR
5329     @@@@enDesc:
5330     This resource is a <Q::DISLang:Method> but it does not
5331     have <Q::DISLang:MethodReturn> child-resource.
5332     @@@RaiseException:
5333     @@@@@:NO_ATTR_GET_ERR
5334     @@@@enDesc:
5335     This resource is a <Q::DISLang:Attribute> but it does not
5336     have <Q::DISLang:AttributeGet> child-resource.
5337     @@@RaiseException:
5338     @@@@@:UNSUPPORTED_MEDIA_TYPE_ERR
5339     @@@@enDesc:
5340     The media type of <Q::dis:Def> element is not supported.
5341 wakaba 1.18 @@@RaiseException:
5342     @@@@@: NON_NAMED_PARAMETER_AFTER_NAMED_ERR
5343     @@@@enDesc:
5344     A non-named method paarameter is defined after
5345     a named method parameter appeared.
5346 wakaba 1.19 @@@disPerlException:
5347     @@@InlineElementException:
5348     @@@BlockElementException:
5349 wakaba 1.20 @@@RaiseException:
5350     @@@@@:PERL_SUBROUTINE_ALREADY_DEFINED_ERR
5351     @@@@enDesc:
5352     A resource defines a Perl subroutine whose name is
5353     same as the name of another subroutine.
5354     @@@RaiseException:
5355     @@@@@:PERL_OPERATOR_ALREADY_OVERLOADED_ERR
5356     @@@@enDesc:
5357     A resource is defined to overload an operator
5358     that is also defined to be overloaded by another resource.
5359     @@@RaiseException:
5360     @@@@@:PERL_UNUSED_SUBROUTINE_ERR
5361     @@@@enDesc:
5362     A resource defines a Perl subroutine which is not
5363     used anywhere.
5364 wakaba 1.12 @@@PerlDef:
5365     __DEEP{
5366     if (exists $self->{<Q::plCodeFragment>}) {
5367     $r = $self->{<Q::plCodeFragment>};
5368     } elsif (not $self->{src}) {
5369     $r = $self->{<Q::plCodeFragment>} = null;
5370     } elsif ($self-><M::ManakaiDISResourceDefinition.isTypeURI>
5371     (<Q::DISLang:MethodReturn>) or
5372     $self-><M::ManakaiDISResourceDefinition.isTypeURI>
5373     (<Q::DISLang:AttributeGet>) or
5374     $self-><M::ManakaiDISResourceDefinition.isTypeURI>
5375 wakaba 1.13 (<Q::DISLang:AttributeSet>) or
5376     $self-><M::ManakaiDISResourceDefinition.isTypeURI>
5377     (<Q::dis2pm:BlockCode>) or
5378     $self-><M::ManakaiDISResourceDefinition.isTypeURI>
5379 wakaba 1.18 (<Q::dis2pm:InlineCode>) or
5380     $self-><M::ManakaiDISResourceDefinition.isTypeURI>
5381     (<Q::DISLang:InputProcessor>)) {
5382 wakaba 1.13 $self->{<Q::plCodeFragment>} = null; ## To avoid loop
5383 wakaba 1.12 my $def = $self->{src}-><M::ManakaiDISElement.disGetAttribute>
5384     (<Q::dis:Def>, for_arg => $self->{for},
5385     forp_arg => $self->{forp});
5386 wakaba 1.19 my $is_inline = $self-><M::ManakaiDISResourceDefinition.isTypeURI>
5387     (<Q::dis2pm:InlineCode>) ? true : false;
5388     unless ($def) {
5389     $r = null;
5390     } elsif ($def-><M::ManakaiDISElement.mediaTypeMatch>
5391 wakaba 1.29 (<Q::lang:Perl>, null,
5392     for_arg => $self->{for},
5393     forp_arg => $self->{forp})) {
5394 wakaba 1.14 my $source_code = $def-><M::swcfg21:SWCFGNode
5395     ::swcfg21:ForLatest.value>;
5396 wakaba 1.12 $r = $self->{<Q::plCodeFragment>}
5397 wakaba 1.19 = $is_inline
5398     ? $self-><M::ManakaiDISResourceDefinition
5399     .plPreprocessPerlStatement>
5400     ($source_code,
5401     node => $def,
5402     contains_statements => false)
5403     : $self-><M::ManakaiDISResourceDefinition
5404 wakaba 1.30 .plPreprocessPerlCode>
5405     ($source_code,
5406     node => $def,
5407     method_resource =>
5408     $self-><M::ManakaiDISResourceDefinition
5409     .isTypeURI> (<Q::DISLang:MethodReturn>)
5410     ? $self-><M::ManakaiDISPropertyAccessor
5411     .getPropertyResource>
5412     (<Q::dis2pm:parentResource>)
5413     : null);
5414 wakaba 1.12 } elsif ($def-><M::ManakaiDISElement.mediaTypeMatch>
5415 wakaba 1.29 (<Q::lang:dis>, null,
5416     for_arg => $self->{for},
5417     forp_arg => $self->{forp})) {
5418 wakaba 1.12 $r = $self->{<Q::plCodeFragment>}
5419 wakaba 1.19 = $def-><M::ManakaiDISElement.plCodeFragment>
5420     ($self, for_arg => $self->{for},
5421     forp_arg => $self->{forp},
5422     contains_statements => not $is_inline);
5423 wakaba 1.12 } else {
5424     my $mt = $def-><M::ManakaiDISElement.mediaTypeURI>
5425     (for_arg => $self->{for},
5426     forp_arg => $self->{forp});
5427     __UNDEEP{
5428     __EXCEPTION{UNSUPPORTED_MEDIA_TYPE_ERR::
5429     DIS:uri => {$mt},
5430     DIS:sourceNode => {$def},
5431     }__;
5432     }__;
5433     } # media type
5434     } elsif ($self-><M::ManakaiDISResourceDefinition.isTypeURI>
5435     (<Q::DISLang:Method>)) {
5436 wakaba 1.13 $self->{<Q::plCodeFragment>} = null; ## To avoid loop
5437 wakaba 1.12 my $ret = $self-><M::ManakaiDISResourceDefinition
5438     .getChildResourceByType> (<Q::DISLang:MethodReturn>);
5439     unless ($ret) {
5440     __UNDEEP{
5441     __EXCEPTION{NO_METHOD_RETURN_ERR::
5442     DIS:errResource => {$self},
5443     DIS:sourceNode => {$self->{src}},
5444 wakaba 1.22 DIS:uri => {$self->{uri}},
5445     DIS:localName => {$self->{localName}},
5446 wakaba 1.12 }__;
5447     }__;
5448     }
5449 wakaba 1.22 my $plimpl = $self-><AG::ManakaiDISPropertyAccessor
5450 wakaba 1.18 .plImplementation>;
5451 wakaba 1.12 $r = $self->{<Q::plCodeFragment>}
5452 wakaba 1.18 = $plimpl-><M::MPLImpl.createPerlSub>
5453 wakaba 1.12 ($self-><AG::ManakaiDISResourceDefinition.plName>);
5454    
5455 wakaba 1.18 ## Method parameters
5456     my $params = $self-><M::ManakaiDISPropertyAccessor
5457     .getPropertyResourceList>
5458     (<Q::DIS:childResource>);
5459     my @param_variables;
5460     my @named_param_variables;
5461     my $prototype = '$';
5462     my $is_optional_param = false;
5463     my $is_named_param = false;
5464     for my $param (@$params) {
5465     next unless $param-><M::ManakaiDISResourceDefinition.isTypeURI>
5466     (<Q::DISLang:MethodParameter>);
5467     unless ($is_named_param) {
5468     if ($param-><M::ManakaiDISPropertyAccessor.getPropertyBoolean>
5469     (<Q::DISPerl:isNamedParameter>, false)) {
5470     $is_named_param = true;
5471     $is_optional_param = true;
5472     push @param_variables, ['%opt'];
5473     $prototype .= '%';
5474     } else { ## Non-named parameter
5475     push @param_variables, [
5476     $param-><AG::ManakaiDISResourceDefinition.plVariableName>,
5477     ];
5478     if ($param-><AG::ManakaiDISResourceDefinition.plIsNullable>) {
5479     $prototype .= ';' unless $is_optional_param;
5480     $is_optional_param = true;
5481     }
5482     $prototype .= $param-><AG::ManakaiDISResourceDefinition
5483     .plPrototype>;
5484     my $param_processor
5485     = $param-><M::ManakaiDISResourceDefinition
5486     .plGetMethodInputNormalizer>;
5487     if ($param_processor) {
5488     $param_variables[-1]->[1]
5489     = $param_processor-><AG::ManakaiDISResourceDefinition
5490     .plCodeFragment>->clone;
5491     $param_variables[-1]->[1]
5492     -><M::MPLCodeFragment.replaceVariable>
5493     ('$INPUT' => $param_variables[-1]->[0]);
5494     }
5495     }
5496     } else { ## Named parameter
5497     unless ($param-><M::ManakaiDISPropertyAccessor
5498     .getPropertyBoolean>
5499     (<Q::DISPerl:isNamedParameter>, false)) {
5500     __UNDEEP{__EXCEPTION{NON_NAMED_PARAMETER_AFTER_NAMED_ERR::
5501     DIS:sourceNode => {$param->{src}},
5502     DIS:uri => {$param->{uri}},
5503     DIS:localName => {$param->{localName}},
5504     }__}__;
5505     }
5506     }
5507     if ($is_named_param) {
5508     push @named_param_variables, [
5509     $param-><AG::ManakaiDISResourceDefinition.plVariableName>,
5510     null,
5511     '$' . $param-><AG::ManakaiDISResourceDefinition.localName>,
5512     ];
5513     my $param_processor
5514     = $param-><M::ManakaiDISResourceDefinition
5515     .plGetMethodInputNormalizer>;
5516     if ($param_processor) {
5517     $named_param_variables[-1]->[1]
5518     = $param_processor-><AG::ManakaiDISResourceDefinition
5519     .plCodeFragment>->clone;
5520     $named_param_variables[-1]->[1]
5521     -><M::MPLCodeFragment.replaceVariable>
5522     ('$INPUT' => $param_variables[-1]->[0]);
5523     }
5524     }
5525     } # %$params
5526    
5527     $r-><AS::MPLSub.prototype> ($prototype);
5528 wakaba 1.13 $r-><M::MPLSS.appendCodeFragment>
5529 wakaba 1.18 ($plimpl-><M::MPLImpl.createPerlStatement>
5530     ('my (' . join (', ', '$self',
5531     map {$_->[0]} @param_variables) . ') = @_'));
5532     for my $p (@param_variables, @named_param_variables) {
5533     if ($p->[1]) { ## Input processor
5534     $r-><M::MPLSS.appendCodeFragment> ($p->[1]);
5535     }
5536     }
5537    
5538     ## TODO: in/out
5539    
5540     ## Return value
5541     my $data_type;
5542     try {
5543     $data_type = $ret-><AG::ManakaiDISResourceDefinition
5544     .disActualDataTypeResource>;
5545     } catch <Class::ManakaiDISException> with {
5546     my $err = shift;
5547     if ($err->{<Q::MDOMX:subtype>} ne <Q::NO_DIS_TYPE_ERR>) {
5548     $err->throw;
5549     }
5550     };
5551    
5552     if ($data_type) {
5553     my $def = $ret->{src}-><M::ManakaiDISElement
5554     .plValueCodeFragment>
5555 wakaba 1.23 (<Q::dis:DefaultValue>, $self,
5556 wakaba 1.18 for_arg => $self->{for},
5557     forp_arg => $self->{forp},
5558     use_default_value => true,
5559     data_type_uri => $data_type
5560     -><AG::ManakaiDISResourceDefinition.uri>);
5561     my $rs = $plimpl-><M::MPLImpl.createPerlStatement>;
5562     my $rvar = $plimpl-><M::MPLImpl.createPerlVariable>
5563     ('$', null, 'r');
5564     $rvar-><AS::PerlCode:ManakaiPerlVariable::ManakaiDOM:Perl
5565     .variableScope> ('my');
5566     if ($def) {
5567     $rs-><M::PLAnyCon.appendNewAssignment> ($rvar => $def);
5568     } else {
5569     $rs-><M::PLInCon.appendCodeFragment> ($rvar);
5570     }
5571     $r-><M::MPLSS.appendCodeFragment> ($rs);
5572     }
5573    
5574     my $code = $ret-><AG::ManakaiDISResourceDefinition.plCodeFragment>;
5575 wakaba 1.19 if ($code) {
5576     for my $np (@named_param_variables) {
5577     $code-><M::MPLCodeFragment.replaceVariable>
5578     ($np->[2] => $np->[0]);
5579     }
5580     $r-><M::MPLSS.appendCodeFragment> ($code);
5581    
5582     $ret->{<Q::DIS:plDefined>} = true;
5583     $self->{<Q::DIS:plDefined>} = true;
5584 wakaba 1.21 } else { ## Method code not defined
5585 wakaba 1.19 my $cls = $self->{db}-><M::ManakaiDISDatabase.getResource>
5586     (<Q::DOMException:CoreException>,
5587     for_arg => <Q::ManakaiDOM:Perl>);
5588     my $const = $self->{db}-><M::ManakaiDISDatabase.getResource>
5589 wakaba 1.30 (<Q::DOMException:NOT_SUPPORTED_ERR>,
5590 wakaba 1.19 for_arg => <Q::ManakaiDOM:Perl>);
5591     my $subtype = $self->{db}-><M::ManakaiDISDatabase.getResource>
5592     (<Q::MDOMX:MDOM_IMPL_METHOD_NOT_IMPLEMENTED>,
5593     for_arg => <Q::ManakaiDOM:Perl>);
5594     $_-><AS::ManakaiDISResourceDefinition.isReferred>
5595     ($ret->{src}) for $cls, $const, $subtype;
5596     my $context_param = $ret-><M::ManakaiDISResourceDefinition
5597     .plGetContextParameter>;
5598     $self-><M::ManakaiDISResourceDefinition
5599     .plAppendThrow>
5600     ($r, $cls, $const, $subtype,
5601     {%$context_param});
5602     $ret->{<Q::DIS:plDefined>} = false;
5603     $self->{<Q::DIS:plDefined>} = false;
5604 wakaba 1.18 }
5605 wakaba 1.12
5606 wakaba 1.18 if ($data_type) {
5607     $r-><M::MPLSS.appendCodeFragment>
5608     ($plimpl-><M::MPLImpl.createPerlVariable>
5609     ('$', null, 'r'));
5610     }
5611 wakaba 1.12 } elsif ($self-><M::ManakaiDISResourceDefinition.isTypeURI>
5612     (<Q::DISLang:Attribute>)) {
5613 wakaba 1.13 $self->{<Q::plCodeFragment>} = null; ## To avoid loop
5614 wakaba 1.12 my $get = $self-><M::ManakaiDISResourceDefinition
5615     .getChildResourceByType> (<Q::DISLang:AttributeGet>);
5616     unless ($get) {
5617     __UNDEEP{
5618     __EXCEPTION{NO_ATTR_GET_ERR::
5619     DIS:errResource => {$self},
5620     DIS:sourceNode => {$self->{src}},
5621     }__;
5622     }__;
5623     }
5624 wakaba 1.22 my $plimpl = $self-><AG::ManakaiDISPropertyAccessor
5625 wakaba 1.20 .plImplementation>;
5626 wakaba 1.19 my $data_type = $get-><AG::ManakaiDISResourceDefinition
5627     .disActualDataTypeResource>;
5628     my $get_code = $plimpl-><M::MPLImpl.createPerlBlockContainer>;
5629 wakaba 1.21 $get_code-><M::PLBlockCon.appendStatement> (q<my ($self) = @_>);
5630 wakaba 1.19 my $code = $get-><AG::ManakaiDISResourceDefinition.plCodeFragment>;
5631     if ($code) {
5632     ## Default value
5633     my $def = $get->{src}-><M::ManakaiDISElement
5634     .plValueCodeFragment>
5635 wakaba 1.23 (<Q::dis:DefaultValue>, $self,
5636 wakaba 1.19 for_arg => $self->{for},
5637     forp_arg => $self->{forp},
5638     use_default_value => true,
5639     data_type_uri => $data_type
5640     -><AG::ManakaiDISResourceDefinition.uri>);
5641     my $rs = $plimpl-><M::MPLImpl.createPerlStatement>;
5642     my $rvar = $plimpl-><M::MPLImpl.createPerlVariable>
5643     ('$', null, 'r');
5644     $rvar-><AS::PerlCode:ManakaiPerlVariable::ManakaiDOM:Perl
5645     .variableScope> ('my');
5646     if ($def) {
5647     $rs-><M::PLAnyCon.appendNewAssignment> ($rvar => $def);
5648     } else {
5649     $rs-><M::PLInCon.appendCodeFragment> ($rvar);
5650     }
5651     $get_code-><M::PLBlockCon.appendCodeFragment> ($rs);
5652    
5653     ## Main code
5654     $get_code-><M::PLBlockCon.appendCodeFragment> ($code);
5655    
5656     ## Return value
5657     $get_code-><M::PLBlockCon.appendStatement> (q<$r>);
5658    
5659     $get->{<Q::DIS:plDefined>} = true;
5660     } else { ## Getter code not defined
5661     my $cls = $self->{db}-><M::ManakaiDISDatabase.getResource>
5662     (<Q::DOMException:CoreException>,
5663     for_arg => <Q::ManakaiDOM:Perl>);
5664     my $const = $self->{db}-><M::ManakaiDISDatabase.getResource>
5665 wakaba 1.30 (<Q::DOMException:NOT_SUPPORTED_ERR>,
5666 wakaba 1.19 for_arg => <Q::ManakaiDOM:Perl>);
5667     my $subtype = $self->{db}-><M::ManakaiDISDatabase.getResource>
5668     (<Q::MDOMX:MDOM_IMPL_ATTR_NOT_IMPLEMENTED>,
5669     for_arg => <Q::ManakaiDOM:Perl>);
5670     $_-><AS::ManakaiDISResourceDefinition.isReferred>
5671     ($get->{src}) for $cls, $const, $subtype;
5672     my $context_param = $get-><M::ManakaiDISResourceDefinition
5673     .plGetContextParameter>;
5674     $self-><M::ManakaiDISResourceDefinition
5675     .plAppendThrow>
5676     ($get_code, $cls, $const, $subtype,
5677     {%$context_param});
5678     $get->{<Q::DIS:plDefined>} = false;
5679     $self->{<Q::DIS:plDefined>} = false;
5680     }
5681    
5682     my $set = $self-><M::ManakaiDISResourceDefinition
5683     .getChildResourceByType> (<Q::DISLang:AttributeSet>);
5684     my $set_code = $plimpl-><M::MPLImpl.createPerlBlockContainer>;
5685     if ($set) {
5686     my $data_type = $set-><AG::ManakaiDISResourceDefinition
5687     .disActualDataTypeResource>;
5688     my $code = $set-><AG::ManakaiDISResourceDefinition.plCodeFragment>;
5689     if ($code) {
5690     ## Input
5691     $set_code-><M::PLBlockCon.appendStatement>
5692     (q<my ($self, $given) = @_>);
5693     my $param_processor
5694     = $set-><M::ManakaiDISResourceDefinition
5695     .plGetMethodInputNormalizer>;
5696     if ($param_processor) {
5697     my $pcode = $param_processor-><AG::ManakaiDISResourceDefinition
5698     .plCodeFragment>->clone;
5699     $pcode-><M::MPLCodeFragment.replaceVariable>
5700     ('$INPUT' => '$given');
5701     $set_code-><M::PLBlockCon.appendCodeFragment> ($pcode);
5702     }
5703    
5704     ## Main code
5705     $set_code-><M::PLBlockCon.appendCodeFragment> ($code);
5706    
5707     $set->{<Q::DIS:plDefined>} = true;
5708     $self->{<Q::DIS:plDefined>} = $get->{<Q::DIS:plDefined>};
5709     } else { ## Setter code not defined
5710 wakaba 1.21 $set_code-><M::PLBlockCon.appendStatement> (q<my ($self) = @_>);
5711 wakaba 1.19 my $cls = $self->{db}-><M::ManakaiDISDatabase.getResource>
5712     (<Q::DOMException:CoreException>,
5713     for_arg => <Q::ManakaiDOM:Perl>);
5714     my $const = $self->{db}-><M::ManakaiDISDatabase.getResource>
5715 wakaba 1.30 (<Q::DOMException:NOT_SUPPORTED_ERR>,
5716 wakaba 1.19 for_arg => <Q::ManakaiDOM:Perl>);
5717     my $subtype = $self->{db}-><M::ManakaiDISDatabase.getResource>
5718     (<Q::MDOMX:MDOM_IMPL_ATTR_NOT_IMPLEMENTED>,
5719     for_arg => <Q::ManakaiDOM:Perl>);
5720     $_-><AS::ManakaiDISResourceDefinition.isReferred>
5721     ($set->{src}) for $cls, $const, $subtype;
5722     my $context_param = $get-><M::ManakaiDISResourceDefinition
5723     .plGetContextParameter>;
5724     $self-><M::ManakaiDISResourceDefinition
5725     .plAppendThrow>
5726     ($set_code, $cls, $const, $subtype,
5727     {%$context_param});
5728     }
5729     $set->{<Q::DIS:plDefined>} = false;
5730     $self->{<Q::DIS:plDefined>} = false;
5731     } else { ## No attribute setter
5732 wakaba 1.21 $set_code-><M::PLBlockCon.appendStatement> (q<my ($self) = @_>);
5733 wakaba 1.19 my $cls = $self->{db}-><M::ManakaiDISDatabase.getResource>
5734     (<Q::DOMException:CoreException>,
5735     for_arg => <Q::ManakaiDOM:Perl>);
5736     my $const = $self->{db}-><M::ManakaiDISDatabase.getResource>
5737     (<Q::DOMException:NO_MODIFICATION_ALLOWED_ERR>,
5738     for_arg => <Q::ManakaiDOM:Perl>);
5739     my $subtype = $self->{db}-><M::ManakaiDISDatabase.getResource>
5740     (<Q::DOMException:READ_ONLY_ATTRIBUTE_ERR>,
5741     for_arg => <Q::ManakaiDOM:Perl>);
5742     $_-><AS::ManakaiDISResourceDefinition.isReferred>
5743     ($self->{src}) for $cls, $const, $subtype;
5744     my $context_param = $get-><M::ManakaiDISResourceDefinition
5745     .plGetContextParameter>;
5746     $self-><M::ManakaiDISResourceDefinition
5747     .plAppendThrow>
5748     ($set_code, $cls, $const, $subtype,
5749     {%$context_param});
5750     $self->{<Q::DIS:plDefined>} = $get->{<Q::DIS:plDefined>};
5751     }
5752    
5753 wakaba 1.12 $r = $self->{<Q::plCodeFragment>}
5754 wakaba 1.19 = $plimpl-><M::MPLImpl.createPerlSub>
5755 wakaba 1.12 ($self-><AG::ManakaiDISResourceDefinition.plName>);
5756 wakaba 1.19 $r-><AS::MPLSub.prototype> (q<$;$>);
5757 wakaba 1.12
5758 wakaba 1.19 ## TODO: Don't output "if" if non-debug build
5759 wakaba 1.12
5760 wakaba 1.19 $r-><M::PLBlockCon.appendNewIf>
5761     ($plimpl-><M::MPLImpl.createPerlInlineUnparsedCode>
5762     (q<@_ == 1>),
5763     $get_code,
5764     $set_code);
5765 wakaba 1.25
5766     ## -- Constants
5767 wakaba 1.20 } elsif ($self-><M::ManakaiDISResourceDefinition.isTypeURI>
5768 wakaba 1.21 (<Q::ManakaiDOM:Const>)) {
5769     my $data_type = $self-><AG::ManakaiDISResourceDefinition
5770     .disActualDataTypeResource>;
5771     my $value = $self->{src}
5772     -><M::ManakaiDISElement.plValueCodeFragment>
5773 wakaba 1.23 (<Q::dis:Value>, $self,
5774 wakaba 1.21 for_arg => $self->{for},
5775     forp_arg => $self->{forp},
5776     data_type_uri => $data_type
5777     -><AG::ManakaiDISResourceDefinition.uri>);
5778 wakaba 1.22 my $plimpl = $self-><AG::ManakaiDISPropertyAccessor
5779 wakaba 1.21 .plImplementation>;
5780     $r = $plimpl-><M::MPLImpl.createPerlSub>
5781     ($self-><AG::ManakaiDISResourceDefinition.plName>);
5782     $r-><M::PLBlockCon.appendCodeFragment> ($value);
5783     $r-><AS::MPLSub.prototype> ('');
5784 wakaba 1.25
5785     ## -- Classes
5786 wakaba 1.21 } elsif ($self-><M::ManakaiDISResourceDefinition.isTypeURI>
5787 wakaba 1.20 (<Q::ManakaiDOM:Class>)) {
5788 wakaba 1.22 my $plimpl = $self-><AG::ManakaiDISPropertyAccessor
5789 wakaba 1.20 .plImplementation>;
5790     $r = $plimpl-><M::MPLImpl.createPerlPackage>
5791     ($self-><AG::ManakaiDISResourceDefinition
5792     .plFullyQualifiedName>);
5793 wakaba 1.25 ## - Inheritance
5794 wakaba 1.20 for my $scls (@{$self-><M::ManakaiDISPropertyAccessor
5795     .getPropertyResourceList>
5796     (<Q::dis:ISA>,
5797     default_media_type => <Q::dis:TFQNames>)}) {
5798     my $spack_name = $scls-><AG::ManakaiDISResourceDefinition
5799     .plFullyQualifiedName>;
5800     if (defined $spack_name) {
5801     $r-><M::PLPack.addISAPackage> ($spack_name);
5802     }
5803 wakaba 1.22 $self-><M::ManakaiDISResourceDefinition.plAddRequireResource>
5804     ($scls => $r);
5805 wakaba 1.20 }
5806 wakaba 1.25
5807 wakaba 1.29 for my $el (@{$self->{src}-><M::ManakaiDISElement
5808     .disChildElements>
5809     (for_arg => $self->{for},
5810     forp_arg => $self->{forp})}) {
5811     if ($el-><AG::swcfg21:SWCFGElement::swcfg21:ForLatest.expandedURI>
5812     eq <Q::dis:AppISA> and
5813     $el-><M::ManakaiDISElement.mediaTypeMatch>
5814     (<Q::lang:Perl>, <Q::lang:Perl>,
5815     for_arg => $self->{for},
5816     forp_arg => $self->{forp})) {
5817     my $spack_name = $el-><M::SWCFGNode.value>;
5818     $r-><M::PLPack.addISAPackage> ($spack_name);
5819     $r-><M::MPLCodeFragment.addRequirePerlModuleName>
5820     ($spack_name);
5821     }
5822     }
5823    
5824 wakaba 1.25 ## - Implementing interfaces
5825 wakaba 1.20 for my $scls (@{$self-><M::ManakaiDISPropertyAccessor
5826     .getPropertyResourceList>
5827     (<Q::dis:Implement>, recursive_isa => true,
5828     default_media_type => <Q::dis:TFQNames>)}) {
5829     my $spack_name = $scls-><AG::ManakaiDISResourceDefinition
5830     .plFullyQualifiedName>;
5831     if (defined $spack_name) {
5832     $r-><M::PLPack.addImplementPackage> ($spack_name);
5833     }
5834     }
5835    
5836 wakaba 1.25 ## - Class members
5837 wakaba 1.20 my @cr = @{$self-><M::ManakaiDISPropertyAccessor
5838     .getPropertyResourceList>
5839     (<Q::DIS:childResource>)};
5840 wakaba 1.21 my @const;
5841 wakaba 1.20 for my $cr (@cr) {
5842 wakaba 1.25 ## - Subroutines
5843 wakaba 1.20 if ($cr-><M::ManakaiDISResourceDefinition.isTypeURI>
5844     (<Q::DISLang:Method>) or
5845     $cr-><M::ManakaiDISResourceDefinition.isTypeURI>
5846     (<Q::DISLang:Attribute>)) {
5847     my $is_attr = $cr-><M::ManakaiDISResourceDefinition.isTypeURI>
5848     (<Q::DISLang:Attribute>) ? true : false;
5849     my $pname = $cr-><AG::ManakaiDISResourceDefinition.plName>;
5850     my $op = $cr-><AG::ManakaiDISResourceDefinition
5851     .plMethodOperator>;
5852     my $psub = $cr-><AG::ManakaiDISResourceDefinition
5853     .plCodeFragment>;
5854     if (defined $pname) {
5855     if ($r-><M::PLPack.getSub> ($pname)) {
5856     __UNDEEP{__EXCEPTION{PERL_SUBROUTINE_ALREADY_DEFINED_ERR::
5857     PerlCode:localName => {$pname},
5858     DIS:uri => {$cr->{uri}},
5859     DIS:sourceNode => {$cr->{src}},
5860     }__}__;
5861     }
5862     $r-><M::PLPack.setSub> ($pname => $psub);
5863    
5864 wakaba 1.29 if (defined $op and
5865     defined $cr-><AG::ManakaiDISResourceDefinition
5866     .localName>) {
5867 wakaba 1.20 if ($op =~ /^[A-Z]+$/) {
5868     if ($r-><M::PLPack.getSubAliasName> ($op)) {
5869     __UNDEEP{__EXCEPTION{
5870     PERL_SUBROUTINE_ALREADY_DEFINED_ERR::
5871     PerlCode:localName => {$op},
5872     DIS:uri => {$cr->{uri}},
5873     DIS:sourceNode => {$cr->{src}},
5874     }__}__;
5875     }
5876     $r-><M::PLPack.setSubAliasName> ($op => $pname);
5877     } else {
5878     if ($r-><M::PLPack.getOverloadMethodName> ($op)) {
5879     __UNDEEP{__EXCEPTION{
5880     PERL_OPERATOR_ALREADY_OVERLOADED_ERR::
5881     PerlCode:operator => {$op},
5882     DIS:uri => {$cr->{uri}},
5883     DIS:sourceNode => {$cr->{src}},
5884     }__}__;
5885     }
5886     $r-><M::PLPack.setOverloadMethodName> ($op => $pname);
5887     }
5888     }
5889     } elsif (defined $op) {
5890     $r-><M::PLPack.setOverloadSub> ($op => $psub);
5891     } else {
5892     __UNDEEP{__EXCEPTION{PERL_UNUSED_SUBROUTINE_ERR::
5893     DIS:uri => {$cr->{uri}},
5894     DIS:sourceNode => {$cr->{src}},
5895     }__}__;
5896     }
5897 wakaba 1.25 ## - Constant groups
5898 wakaba 1.21 } elsif ($cr-><M::ManakaiDISResourceDefinition.isTypeURI>
5899     (<Q::ManakaiDOM:ConstGroup>)) {
5900     for my $gcr (@{$cr-><M::ManakaiDISPropertyAccessor
5901     .getPropertyResourceList>
5902     (<Q::DIS:childResource>)}) {
5903     if ($gcr-><M::ManakaiDISResourceDefinition.isTypeURI>
5904     (<Q::ManakaiDOM:Const>)) {
5905     my $sub = $gcr-><AG::ManakaiDISResourceDefinition
5906     .plCodeFragment>;
5907     if ($r-><M::PLPack.getSub> ($sub-><AG::MPLSub.localName>)) {
5908     __UNDEEP{__EXCEPTION{
5909     PERL_SUBROUTINE_ALREADY_DEFINED_ERR::
5910     PerlCode:localName => {$sub-><AG::MPLSub.localName>},
5911     DIS:uri => {$gcr->{uri}},
5912     DIS:sourceNode => {$gcr->{src}},
5913     }__}__;
5914     }
5915     $r-><M::PLPack.setSub>
5916     ($sub-><AG::MPLSub.localName> => $sub);
5917     push @const, $gcr;
5918     }
5919     }
5920 wakaba 1.25 ## - Constants
5921 wakaba 1.21 } elsif ($cr-><M::ManakaiDISResourceDefinition.isTypeURI>
5922     (<Q::ManakaiDOM:Const>)) {
5923     my $sub = $cr-><AG::ManakaiDISResourceDefinition.plCodeFragment>;
5924     if ($r-><M::PLPack.getSub> ($sub-><AG::MPLSub.localName>)) {
5925     __UNDEEP{__EXCEPTION{
5926     PERL_SUBROUTINE_ALREADY_DEFINED_ERR::
5927     PerlCode:localName => {$sub-><AG::MPLSub.localName>},
5928     DIS:uri => {$cr->{uri}},
5929     DIS:sourceNode => {$cr->{src}},
5930     }__}__;
5931     }
5932     $r-><M::PLPack.setSub> ($sub-><AG::MPLSub.localName> => $sub);
5933     push @const, $cr;
5934 wakaba 1.25 ## Package-scope variables
5935 wakaba 1.23 } elsif ($cr-><M::ManakaiDISResourceDefinition.isTypeURI>
5936     (<Q::DISPerl:ScalarVariable>)) {
5937     my $varn = $cr-><AG::ManakaiDISResourceDefinition
5938     .plVariableName>;
5939     my $var = $plimpl-><M::MPLImpl.createPerlVariable>
5940     (null, null, $varn);
5941     my $data_type = $cr-><AG::ManakaiDISResourceDefinition
5942     .disActualDataTypeResource>;
5943     my $value = $cr->{src}
5944     -><M::ManakaiDISElement.plValueCodeFragment>
5945     (<Q::dis:DefaultValue>, $cr,
5946     for_arg => $cr->{for},
5947     forp_arg => $cr->{forp},
5948     use_default_value => true,
5949     data_type_uri => $data_type
5950     -><AG::ManakaiDISResourceDefinition.uri>);
5951     if ($cr-><M::ManakaiDISPropertyAccessor.getPropertyBoolean>
5952     (<Q::DISPerl:defaultValueHasSelfReference>)) {
5953     $r-><M::PLBlockCon.appendStatement>
5954     -><M::PLBlockCon.appendCodeFragment> (my $v = $var->clone);
5955     $v-><AS::PerlCode:ManakaiPerlVariable::ManakaiDOM:Perl
5956     .variableScope> ('our');
5957     } else {
5958     $var-><AS::PerlCode:ManakaiPerlVariable::ManakaiDOM:Perl
5959     .variableScope> ('our');
5960     }
5961     $r-><M::PLBlockCon.appendStatement>
5962     -><M::PLAnyCon.appendNewAssignment> ($var => $value);
5963     } # Type of child resources
5964 wakaba 1.20 }
5965 wakaba 1.21
5966 wakaba 1.25 ## - Exceptions
5967 wakaba 1.21 if ($self-><M::ManakaiDISResourceDefinition.isTypeURI>
5968     (<Q::DOMException:AnyExceptionClass>)) {
5969     my $err_def = $plimpl-><M::MPLImpl.createPerlSub> ('___error_def');
5970     $err_def-><AS::MPLSub.prototype> ('');
5971     $err_def-><M::PLBlockCon.appendCode>
5972     ($plimpl-><M::MPLImpl.perlList>
5973     ([{
5974     map {
5975     $_-><AG::ManakaiDISResourceDefinition.plName> => {
5976     <Q::DOMCore:code> => 0 + $_
5977     -><AG::ManakaiDISResourceDefinition.plCodeFragment>,
5978     description => $_
5979     -><AG::ManakaiDISResourceDefinition.plMufDescriptionText>,
5980     # ($_->{ExpandedURI q< DOMCore:severity>}
5981     # ? (ExpandedURI q< DOMCore:severity>
5982     # => $_->{ExpandedURI q< DOMCore:severity>},
5983     # ExpandedURI q< DOMCore:type>
5984     # => $_->{ExpandedURI q< DOMCore:type>})
5985     # : ()),
5986     <Q::MDOMX:subtype> => {
5987     map {
5988     $_-><AG::ManakaiDISResourceDefinition.nameURI>
5989     => {
5990     description => $_
5991     -><AG::ManakaiDISResourceDefinition.plMufDescriptionText>,
5992     # ($_->{ExpandedURI q< DOMCore:severity>}
5993     # ? (ExpandedURI q< DOMCore:severity>
5994     # => $_->{ExpandedURI q< DOMCore:severity>},
5995     # ExpandedURI q< DOMCore:type>
5996     # => $_->{ExpandedURI q< DOMCore:type>})
5997     # : ()),
5998     },
5999     } grep {
6000     $_-><M::ManakaiDISResourceDefinition.isTypeURI>
6001     (<Q::ManakaiDOM:ExceptionOrWarningSubType>)
6002     } @{$_-><M::ManakaiDISPropertyAccessor
6003     .getPropertyResourceList>
6004     (<Q::DIS:childResource>)}
6005     },
6006     },
6007     } @const
6008     }]));
6009     $r-><M::PLPack.setSub> (___error_def => $err_def);
6010     }
6011 wakaba 1.25
6012     ## -- Global variables
6013 wakaba 1.23 } elsif ($self-><M::ManakaiDISResourceDefinition.isTypeURI>
6014     (<Q::DISPerl:ScalarVariable>)) {
6015     my $plimpl = $self-><AG::ManakaiDISPropertyAccessor
6016     .plImplementation>;
6017     my $varn = $self-><AG::ManakaiDISResourceDefinition.plVariableName>;
6018     my $var = $plimpl-><M::MPLImpl.createPerlVariable>
6019     (null, null, $varn);
6020     my $data_type = $self-><AG::ManakaiDISResourceDefinition
6021     .disActualDataTypeResource>;
6022     my $value = $self->{src}
6023     -><M::ManakaiDISElement.plValueCodeFragment>
6024     (<Q::dis:DefaultValue>, $self,
6025     for_arg => $self->{for},
6026     forp_arg => $self->{forp},
6027     use_default_value => true,
6028     data_type_uri => $data_type
6029     -><AG::ManakaiDISResourceDefinition.uri>);
6030     $r = $plimpl-><M::MPLImpl.createPerlStatement>;
6031     $r-><M::PLAnyCon.appendNewAssignment> ($var => $value);
6032 wakaba 1.13 } else { ## Not supported
6033 wakaba 1.19 $r = $self->{<Q::plCodeFragment>} = null;
6034 wakaba 1.12 } # rdf:type
6035     }__;
6036    
6037     @Method:
6038     @@Name: getChildResourceByType
6039     @@enDesc:
6040     Gets a static child resource selected by its type.
6041     @@Param:
6042     @@@Name:typeURI
6043     @@@Type:ResourceURI
6044     @@@enDesc:
6045     A URI reference identifying a resource type.
6046     @@Return:
6047     @@@Type: ManakaiDISResourceDefinition
6048     @@@enDesc:
6049     The first (by document order) child resource whose
6050     type matches with <P::resType>.
6051     @@@nullCase:
6052     @@@@enDesc:
6053     There is no resource whose type is <P::resType>.
6054     @@@PerlDef:
6055     __DEEP{
6056 wakaba 1.26 for my $cr_uri (@{$self->{<Q::DIS:childResource>}}) {
6057 wakaba 1.12 my $cr = $self->{db}-><M::ManakaiDISDatabase.getResource>
6058 wakaba 1.26 ($cr_uri);
6059 wakaba 1.12 if ($cr-><M::ManakaiDISResourceDefinition.isTypeURI> ($typeURI)) {
6060     $r = $cr;
6061     last;
6062     }
6063     }
6064     }__;
6065 wakaba 1.13
6066     @Method:
6067     @@Name: getChildResourceByNameAndType
6068     @@enDesc:
6069     Gets a static child resource selected by its local name and type.
6070     @@Param:
6071     @@@Name: localName
6072     @@@Type:
6073     DISCore:LocalName::ManakaiDOM:all
6074     @@@enDesc:
6075     A local name.
6076     @@Param:
6077     @@@Name:typeURI
6078     @@@Type:ResourceURI
6079     @@@enDesc:
6080     A URI reference identifying a resource type.
6081     @@Return:
6082     @@@Type: ManakaiDISResourceDefinition
6083     @@@enDesc:
6084     The first (by document order) child resource whose
6085     type matches for <P::localName> and <P::resType>.
6086     @@@nullCase:
6087     @@@@enDesc:
6088     There is no resource whose name is <P::localName> and
6089     whose type is <P::resType>.
6090     @@@PerlDef:
6091     __DEEP{
6092 wakaba 1.26 for my $cr_uri (@{$self->{<Q::DIS:childResource>}}) {
6093 wakaba 1.13 my $cr = $self->{db}-><M::ManakaiDISDatabase.getResource>
6094 wakaba 1.26 ($cr_uri);
6095 wakaba 1.14 my $ln = $cr-><AG::ManakaiDISResourceDefinition.localName>;
6096 wakaba 1.13 if (defined $ln and $ln eq $localName and
6097     $cr-><M::ManakaiDISResourceDefinition.isTypeURI> ($typeURI)) {
6098     $r = $cr;
6099     last;
6100     }
6101     }
6102     }__;
6103    
6104     @Method:
6105     @@Name: getConstResourceByName
6106     @@enDesc:
6107     Gets a constant value resource by its local name.
6108     @@Param:
6109     @@@Name:localName
6110     @@@Type:
6111     DISLang:String::ManakaiDOM:all
6112     @@@enDesc:
6113     Constant name.
6114     @@Return:
6115     @@@Type: ManakaiDISResourceDefinition
6116     @@@enDesc:
6117     The constant resource identified by <P::localName>.
6118     @@@nullCase:
6119     @@@@enDesc:
6120     There is no such constant resource.
6121     @@@PerlDef:
6122     __DEEP{
6123     my @constGroup;
6124 wakaba 1.26 for my $cr_uri (@{$self->{<Q::DIS:childResource>}}) {
6125 wakaba 1.13 my $cr = $self->{db}-><M::ManakaiDISDatabase.getResource>
6126 wakaba 1.26 ($cr_uri);
6127 wakaba 1.14 my $ln = $cr-><AG::ManakaiDISResourceDefinition.localName>;
6128 wakaba 1.13 if ($ln and $ln eq $localName and
6129     $cr-><M::ManakaiDISResourceDefinition.isTypeURI>
6130     (<Q::ManakaiDOM:Const>)) {
6131     $r = $cr;
6132     last;
6133     } elsif ($cr-><M::ManakaiDISResourceDefinition.isTypeURI>
6134     (<Q::ManakaiDOM:ConstGroup>)) {
6135     push @constGroup, $cr;
6136     }
6137     }
6138     unless ($r) {
6139     for my $cg (@constGroup) {
6140     $r = $cg-><M::ManakaiDISResourceDefinition
6141     .getChildResourceByNameAndType>
6142     ($localName, <Q::ManakaiDOM:Const>);
6143     last if $r;
6144     }
6145     }
6146     }__;
6147    
6148 wakaba 1.23 @ResourceDef:
6149     @@Name: RegQNameChar
6150     @@enDesc:
6151     A regular expression character class for <Q::dis:TypeQName>
6152     character.
6153     @@rdf:type:
6154     DISPerl:ScalarVariable
6155     @@DefaultValue:
6156     @@@@: qr/[^\s<>"'\\\[\]\{\},=\$\@%]/
6157     @@@ContentType:
6158     lang:Perl
6159     @@Type:
6160     DOMMain:any::ManakaiDOM:all
6161    
6162     @ResourceDef:
6163     @@Name: RegBlockContent
6164     @@enDesc:
6165     A regular expression for a block.
6166     @@rdf:type:
6167     DISPerl:ScalarVariable
6168     @@Type:
6169     DOMMain:any::ManakaiDOM:all
6170     @@DefaultValue:
6171     @@@@:
6172     qr/(?>[^{}\\]*)(?>(?>[^{}\\]+|\\.|\{(??{$RegBlockContent})\})*)/
6173     @@@ContentType:
6174     lang:Perl
6175     @@DISPerl:defaultValueHasSelfReference:1
6176    
6177 wakaba 1.13 @Method:
6178     @@Name: plPreprocessPerlCode
6179     @@enDesc:
6180     Preprocesses a Perl block-level code fragment.
6181     @@Param:
6182     @@@Name:codeArg
6183     @@@Type:
6184     lang:Perl::ManakaiDOM:all
6185     @@@enDesc:
6186     A Perl block-level code (statements and/or blocks).
6187 wakaba 1.15 @@NodeParam:
6188     @@NamedParam:
6189     @@@Name:methodResource
6190     @@@Type:ManakaiDISResourceDefinition
6191     @@@enDesc:
6192     The resource definition of the Perl method to which
6193     the <P::codeArg> belongs.
6194     @@@nullCase:
6195     @@@@enDesc:
6196     The <P::codeArg> does not belong to any method.
6197 wakaba 1.17 @@NamedParam:
6198     @@@Name:sourceFile
6199     @@@Type:
6200     DISLang:String::ManakaiDOM:all
6201     @@@enDesc:
6202     The source file name of the <P::codeArg>.
6203     @@@nullCase:
6204     @@@@enDesc:
6205     No source file information available.
6206     @@NamedParam:
6207     @@@Name:sourceLine
6208     @@@Type:
6209     DOMMain:unsigned-long::ManakaiDOM:all
6210     @@@enDesc:
6211     The line number in the <P::sourceFile> from which
6212     the <P::codeArg> begins.
6213     @@@nullCase:
6214     @@@@enDesc:
6215     No source file information available.
6216 wakaba 1.13 @@Return:
6217     @@@Type:
6218     lang:Perl::ManakaiDOM:all
6219     @@@enDesc:
6220     Preprocessed Perl code.
6221 wakaba 1.15 @@@BlockElementException:
6222     @@@InlineElementException:
6223 wakaba 1.13 @@@PerlDef:
6224 wakaba 1.15 unless ($self->{src}) {
6225     __EXCEPTION{NO_SOURCE_NODE_ERR::
6226     DIS:uri => {$self->{uri}},
6227     }__;
6228     }
6229     __DEEP{
6230     our $RegQNameChar;
6231     our $RegBlockContent;
6232 wakaba 1.22 my $plimpl = $self-><AG::ManakaiDISPropertyAccessor.plImplementation>;
6233 wakaba 1.15 $r = $plimpl-><M::MPLImpl.createPerlBlock>;
6234 wakaba 1.17 if (defined $sourceLine) {
6235     $r-><AS::PLBlockCon.sourceFile> ($sourceFile);
6236     $r-><AS::PLBlockCon.sourceLine> ($sourceLine);
6237     $r-><AS::PLBlockCon.currentSourceFile> ($sourceFile);
6238     $r-><AS::PLBlockCon.currentSourceLine> ($sourceLine);
6239     } elsif ($node) {
6240     my $np = $node-><M::swcfg21:SWCFGNode::swcfg21:ForLatest.nodePath>
6241     (key => [qw/Name QName Type type/]);
6242     $r-><AS::PLBlockCon.currentSourceFile> ($np);
6243     $r-><AS::PLBlockCon.currentSourceLine> (1);
6244     $r-><AS::PLBlockCon.sourceFile> ($np);
6245     $r-><AS::PLBlockCon.sourceLine> (1);
6246     }
6247 wakaba 1.15
6248 wakaba 1.16 for my $source_code (split /\b(_ _(?:(?!_ _)$RegQNameChar)+
6249 wakaba 1.15 (?:\{$RegBlockContent\})?
6250 wakaba 1.16 _ _)\b/x, $codeArg) {
6251 wakaba 1.15 ## Block-level element
6252 wakaba 1.16 if ($source_code =~ /_\_\z/ and
6253     $source_code =~ s/^_\_((?:(?!_\_)$RegQNameChar)+)//) {
6254 wakaba 1.15 my $et = $self->{src}
6255     -><M::ManakaiDISElement.qnameToURI>
6256     ($1,
6257     node => $node,
6258     default_namespace_uri => <Q::disPerl:>);
6259     if ($source_code =~ s/^\{//) {
6260     $source_code =~ s/\}__\z//;
6261     } else {
6262     $source_code = '';
6263     }
6264    
6265     # ## ISSUE: __FILE__ & __LINE__ will break if multiline substition happens.
6266    
6267     if ($et eq <Q::disPerl:DEEP> or $et eq <Q::disPerl:UNDEEP>) {
6268     my $block = $r-><M::PLBlockCon.appendBlock>;
6269     $block-><M::PLBlockCon.appendStatement>
6270     ('local $Error::Depth = $Error::Depth '.
6271     ($et eq <Q::disPerl:DEEP> ? '+' : '-').
6272     ' 1');
6273     $block-><M::PLBlockCon.appendCodeFragment>
6274 wakaba 1.17 ($self-><M::ManakaiDISResourceDefinition
6275     .plPreprocessPerlCode>
6276     ($source_code, node => $node,
6277     method_resource => $methodResource,
6278     source_file => $r-><AG::PLBlockCon
6279     .currentSourceFile>,
6280     source_line => $r-><AG::PLBlockCon
6281     .currentSourceLine>));
6282     $r-><M::PLBlockCon.skipLines> ($source_code);
6283 wakaba 1.15 } elsif ({
6284     <Q::disPerl:EXCEPTION> => 1,
6285     <Q::disPerl:WARNING> => 1,
6286     }->{$et}) {
6287 wakaba 1.17 $r-><M::PLBlockCon.skipLines> ($source_code);
6288 wakaba 1.29 if ($source_code =~ s/^((?:(?!::).)+)(?:::\s*)?//s) {
6289 wakaba 1.15 my ($cls, $const, $subtype)
6290     = @{$self->{db}-><M::ManakaiDISDatabase.xcrefToResource>
6291 wakaba 1.16 ($1, $self->{src},
6292     node => $node,
6293     for_arg => $self->{for})};
6294 wakaba 1.15 my $param = $self-><M::ManakaiDISResourceDefinition
6295     .plParsePreprocessParameter>
6296     ($source_code, node => $node);
6297     my $context_param
6298     = $self-><M::ManakaiDISResourceDefinition
6299     .plGetContextParameter>;
6300    
6301     $self-><M::ManakaiDISResourceDefinition
6302     .plAppendThrow>
6303     ($r, $cls, $const, $subtype,
6304     {%$param, %$context_param});
6305     } else {
6306     __UNDEEP{__EXCEPTION{PERL_PREPROCESS_NO_EXCEPTION_TYPE_ERR::
6307     DIS:sourceNode => {$node},
6308     DIS:sourceCode => {$source_code},
6309     DIS:elementType => {$et},
6310     }__}__;
6311     }
6312     } elsif ($et eq <Q::disPerl:CODE>) {
6313 wakaba 1.17 $r-><M::PLBlockCon.skipLines> ($source_code);
6314 wakaba 1.15 my $code_name;
6315     $source_code =~ s/^\s+//;
6316     if ($source_code =~ s/^((?>(?!::).)+)//s) {
6317     $code_name = $1;
6318     } else {
6319     __UNDEEP{
6320     __EXCEPTION{PERL_PREPROCESS_NO_CODE_NAME_ERR::
6321     DIS:sourceCode => {$source_code},
6322     DIS:sourceNode => {$node},
6323     DIS:elementType => {$et},
6324     }__;
6325     }__;
6326     }
6327     $source_code =~ s/^::\s*//;
6328     my $param = $self-><M::ManakaiDISResourceDefinition
6329     .plParsePreprocessParameter>
6330     ($source_code, node => $node);
6331     my $code_uri = $self->{src}-><M::ManakaiDISElement
6332     .tfqnamesToURI>
6333     ($code_name, null, $self->{for},
6334     node => $node);
6335     my $code = $self->{db}-><M::ManakaiDISDatabase.getResource>
6336     ($code_uri);
6337     $code-><AS::ManakaiDISResourceDefinition.isReferred>
6338     ($node || $self->{src});
6339     unless ($code-><M::ManakaiDISResourceDefinition.isTypeURI>
6340     (<Q::dis2pm:BlockCode>)) {
6341     __UNDEEP{__EXCEPTION{RESOURCE_NOT_DEFINED_ERR::
6342     DIS:uri => {$code_uri},
6343     DIS:sourceNode => {$node},
6344     DIS:sourceCode => {$source_code},
6345     DIS:expectedType => {<Q::dis2pm:BlockCode>},
6346     }__;}__;
6347     }
6348     my $pc = $code-><AG::ManakaiDISResourceDefinition
6349     .plCodeFragment>->clone;
6350     unless (defined $pc) {
6351     __UNDEEP{__EXCEPTION{PERL_CODE_NOT_DEFINED_ERR::
6352     DIS:sourceNode => {$node},
6353     DIS:sourceCode => {$source_code},
6354     DIS:uri => {$code_uri},
6355     }__}__;
6356     }
6357     for my $var (grep {/^\$/} keys %$param) {
6358     my $value;
6359     if ($param->{$var}->{type} eq 'variable') {
6360     $value = $plimpl-><M::MPLImpl.createPerlVariable>
6361     ('$', null, $param->{$var}->{value});
6362     } elsif ($param->{$var}->{type} eq 'code') {
6363 wakaba 1.22 $value = $self-><M::ManakaiDISResourceDefinition
6364     .plPreprocessPerlStatement>
6365     ($param->{$var}->{value},
6366     contains_statements => false);
6367 wakaba 1.15 } else {
6368     $value = $plimpl-><M::MPLImpl.createPerlStringLiteral>
6369     ($param->{$var}->{value});
6370     }
6371     $pc-><M::MPLCodeFragment.replaceVariable>
6372     ($var => $value);
6373     }
6374 wakaba 1.16 $r-><M::PLBlockCon.appendCodeFragment> ($pc);
6375 wakaba 1.15 } elsif ($et eq <Q::ManakaiDOM:InputNormalize>) {
6376 wakaba 1.17 $r-><M::PLBlockCon.skipLines> ($source_code);
6377 wakaba 1.15 unless ($methodResource) {
6378     __UNDEEP{__EXCEPTION{PERL_PREPROCESS_NO_METHOD_ERR::
6379     DIS:sourceNode => {$node},
6380     DIS:sourceCode => {$source_code},
6381     DIS:elementType => {$et},
6382     }__}__;
6383     }
6384     my $param = $methodResource
6385     -><M::ManakaiDISResourceDefinition
6386     .getChildResourceByNameAndType>
6387     ($source_code, <Q::DISLang:MethodParameter>);
6388     unless ($param) {
6389     __UNDEEP{__EXCEPTION{RESOURCE_NOT_DEFINED_ERR::
6390     DIS:sourceNode => {$node},
6391     DIS:sourceCode => {$source_code},
6392     DIS:elementType => {$et},
6393     DIS:localName => {$source_code},
6394     DIS:expectedType => {<Q::DISLang:MethodParameter>},
6395     }__}__;
6396     }
6397     my $norm = $param-><M::ManakaiDISResourceDefinition
6398     .plGetMethodInputNormalizer>;
6399     if ($norm) {
6400     my $norm_code = $norm-><AG::ManakaiDISResourceDefinition
6401     .plCodeFragment>->clone;
6402     $norm_code-><M::MPLCodeFragment.replaceVariable>
6403     ('$INPUT' => $param-><AG::ManakaiDISResourceDefinition
6404     .plVariableName>);
6405     $r-><M::PLBlockCon.appendCodeFragment> ($norm_code);
6406     }
6407     } elsif ($et eq <Q::disPerl:FOR>) {
6408 wakaba 1.17 if ($source_code =~ s/^(((?>(?!::).)*)::\s*)//) {
6409     $r-><M::PLBlockCon.skipLines> ($1);
6410 wakaba 1.31 V: for my $forq (split /\s*\|\s*/, $2) {
6411     my $notfor = ($forq =~ s/^!\s*// ? true : false);
6412 wakaba 1.15 my $for_uri = $self->{src}
6413     -><M::ManakaiDISElement.qnameToURI>
6414 wakaba 1.31 ($forq, node => $node);
6415     my $formatch = $self-><M::ManakaiDISResourceDefinition
6416     .isForURI> ($for_uri);
6417     if (($formatch and not $notfor) or
6418     (not $formatch and $notfor)) {
6419 wakaba 1.15 $r-><M::PLBlockCon.appendCodeFragment>
6420 wakaba 1.17 ($self-><M::ManakaiDISResourceDefinition
6421     .plPreprocessPerlCode>
6422     ($source_code, node => $node,
6423     method_resource => $methodResource,
6424     source_file => $r-><AG::PLBlockCon.
6425     currentSourceFile>,
6426     source_line => $r-><AG::PLBlockCon.
6427     currentSourceLine>));
6428 wakaba 1.15 last V;
6429     }
6430     } # V
6431 wakaba 1.17 $r-><M::PLBlockCon.skipLines> ($source_code);
6432 wakaba 1.15 } else {
6433     __UNDEEP{__EXCEPTION{PERL_PREPROCESS_NO_FOR_ERR::
6434     DIS:sourceNode => {$node},
6435     DIS:sourceCode => {$source_code},
6436     DIS:elementType => {$et},
6437     }__}__;
6438     }
6439     } elsif ($et eq <Q::disPerl:ASSERT>) {
6440 wakaba 1.17 $r-><M::PLBlockCon.skipLines> ($source_code);
6441 wakaba 1.15 my $assert_type;
6442     if ($source_code =~ s/^\s*($RegQNameChar+)\s*::\s*//o) {
6443     $assert_type = $self->{src}
6444     -><M::ManakaiDISElement.qnameToURI>
6445     ($1, node => $node);
6446     } else {
6447     __UNDEEP{__EXCEPTION{PERL_PREPROCESS_NO_ASSERT_TYPE_ERR::
6448     DIS:sourceNode => {$node},
6449     DIS:sourceCode => {$source_code},
6450     DIS:elementType => {$et},
6451     }__}__;
6452     }
6453     # if output assertion then
6454     =pod
6455     my $assert_block = $r-><M::PLBlockCon.appendBlock>;
6456    
6457     my $param = $self-><M::ManakaiDISResourceDefinition
6458     .plParsePreprocessParameter>
6459     ($source_code, node => $node);
6460     my $context_param
6461     = $self-><M::ManakaiDISResourceDefinition
6462     .plGetContextParameter>;
6463    
6464     if ($assert_type eq <Q::DISPerl:isPositive>) {
6465    
6466     $pre = perl_statement
6467     perl_assign
6468     'my $asActual' =>
6469     '('.perl_code ($param->{actual}, %opt).')';
6470     $cond = '$asActual > 0';
6471     $xparam->{ExpandedURI q<DOMMain:expectedLabel>} = 'a positive value';
6472     $xparam->{ExpandedURI q<DOMMain:actualValue>}
6473     = perl_code_literal q<$asActual>;
6474     } elsif ($atype eq ExpandedURI q<DISPerl:invariant>) {
6475     $cond = '0';
6476     $xparam->{ExpandedURI q<DOMMain:expectedLabel>} = $param->{msg};
6477     $xparam->{ExpandedURI q<DOMMain:actualValue>} = '(invariant)';
6478     } else {
6479     valid_err (q[Assertion type <].$atype.q[> is not supported],
6480     node => $opt{node});
6481     }
6482    
6483     $r = $pre . perl_if
6484     $cond,
6485     undef,
6486    
6487    
6488     my $cls = $self->{db}-><M::ManakaiDISDatabase.getResource>
6489     (<Q::DOMException:CoreException>);
6490     my $const = $self->{db}-><M::ManakaiDISDatabase.getResource>
6491     (<Q::MDOMX:MDOM_DEBUG_BUG>);
6492     my $subtype = $self->{db}-><M::ManakaiDISDatabase.getResource>
6493     (<Q::DOMMain:ASSERTION_ERR>);
6494 wakaba 1.16 $_-><AS::ManakaiDISResourceDefinition.isReferred>
6495 wakaba 1.15 ($node || $self->{src}) for $cls, $const, $subtype;
6496     $self-><M::ManakaiDISResourceDefinition
6497     .plAppendThrow>
6498     ($assert_block, $cls, $const, $subtype,
6499     {%$param, %$context_param,
6500     <Q::DOMMain:assertionType> => {
6501     type => 'quoted', value => $assert_type,
6502     },
6503     <Q::DOMMain:traceText> => {
6504     type => 'code',
6505     value => q<(sprintf 'at %s line %s%s%s',
6506     __FILE__, __LINE__, "\n\t",
6507     Carp::longmess ())>,
6508     }});
6509    
6510     =cut
6511    
6512     } elsif ({
6513     <Q::disPerl:FILE> => 1,
6514     <Q::disPerl:LINE> => 1,
6515     <Q::disPerl:PACKAGE> => 1,
6516     }->{$et}) {
6517     $r-><M::PLAnyCon.appendAtom>
6518     ('__'.{
6519     <Q::disPerl:FILE> => 'FILE',
6520     <Q::disPerl:LINE> => 'LINE',
6521     <Q::disPerl:PACKAGE> => 'PACKAGE',
6522     }->{$et}.'__');
6523     if (length $source_code) {
6524     __UNDEEP{__EXCEPTION{PERL_PREPROCESS_BLOCK_NOT_ALLOWED_ERR::
6525     DIS:sourceNode => {$node},
6526     DIS:sourceCode => {$source_code},
6527     DIS:elementType => {$et},
6528     }__}__;
6529     }
6530     } else {
6531     __UNDEEP{__EXCEPTION{UNSUPPORTED_ELEMENT_TYPE_ERR::
6532     DIS:sourceNode => {$node},
6533     DIS:sourceCode => {$source_code},
6534     DIS:elementType => {$et},
6535     }__}__;
6536     }
6537     } else { ## Other than block-level element
6538     $r-><M::PLBlockCon.appendCodeFragment>
6539     ($self-><M::ManakaiDISResourceDefinition
6540 wakaba 1.16 .plPreprocessPerlStatement>
6541 wakaba 1.17 ($source_code, contains_statements => true,
6542     source_file => $r-><AG::PLBlockCon
6543     .currentSourceFile>,
6544     source_line => $r-><AG::PLBlockCon
6545     .currentSourceLine>));
6546     $r-><M::PLBlockCon.skipLines> ($source_code);
6547 wakaba 1.15 }
6548     } # for
6549     }__; # DEEP
6550    
6551    
6552     ## Checks \p character classes
6553     # while ($s =~ /\\p{([^{}]+)}/gs) {
6554     # my $name = $1;
6555     # $State->{ExpandedURI q<dis2pm:Package>}
6556     # ->{$State->{ExpandedURI q<dis2pm:currentPackage>}}
6557     # ->{ExpandedURI q<dis2pm:requiredCharClass>}
6558     # ->{$name} ||= $opt{node} || 1;
6559     # }
6560    
6561 wakaba 1.13
6562     @Method:
6563     @@Name: plPreprocessPerlStatement
6564     @@enDesc:
6565     Preprocesses a Perl inline code fragment
6566     (code fragment smaller than statement).
6567     @@Param:
6568     @@@Name:codeArg
6569     @@@Type:
6570     lang:Perl::ManakaiDOM:all
6571     @@@enDesc:
6572     A Perl code fragment.
6573     @@NodeParam:
6574 wakaba 1.16 @@NamedParam:
6575     @@@Name:containsStatements
6576     @@@Type:
6577     DOMMain:boolean::ManakaiDOM:all
6578     @@@enDesc:
6579     Whether one or more statements might be contained
6580     in <P::codeArg> or not.
6581 wakaba 1.17 @@NamedParam:
6582     @@@Name:sourceFile
6583     @@@Type:
6584     DISLang:String::ManakaiDOM:all
6585     @@@enDesc:
6586     The source file name of the <P::codeArg>.
6587     @@@nullCase:
6588     @@@@enDesc:
6589     No source file information available.
6590     @@NamedParam:
6591     @@@Name:sourceLine
6592     @@@Type:
6593     DOMMain:unsigned-long::ManakaiDOM:all
6594     @@@enDesc:
6595     The line number in the <P::sourceFile> from which
6596     the <P::codeArg> begins.
6597     @@@nullCase:
6598     @@@@enDesc:
6599     No source file information available.
6600 wakaba 1.13 @@Return:
6601 wakaba 1.16 @@@Type:MPLCodeFragment
6602 wakaba 1.13 @@@enDesc:
6603     Preprocessed Perl code.
6604 wakaba 1.16 @@@InCase:
6605     @@@@Type:
6606     PerlCode:ManakaiPerlBlock::ManakaiDOM:Perl
6607     @@@@enDesc:
6608 wakaba 1.19 If <P::containsStatements> is <DOM::false>.
6609 wakaba 1.16 @@@InCase:
6610     @@@@Type:
6611     PerlCode:ManakaiPerlInlineContainer::ManakaiDOM:Perl
6612     @@@@enDesc:
6613 wakaba 1.19 If <P::containsStatements> is <DOM::true>.
6614 wakaba 1.13 @@@InlineElementException:
6615     @@@PerlDef:
6616     unless ($self->{src}) {
6617     __EXCEPTION{NO_SOURCE_NODE_ERR::
6618     DIS:uri => {$self->{uri}},
6619     }__;
6620     }
6621     __DEEP{
6622     our $RegQNameChar;
6623 wakaba 1.22 my $plimpl = $self-><AG::ManakaiDISPropertyAccessor.plImplementation>;
6624 wakaba 1.16 if ($containsStatements) {
6625     $r = $plimpl-><M::MPLImpl.createPerlBlockContainer>;
6626 wakaba 1.17 if (defined $sourceLine) {
6627     $r-><AS::PLBlockCon.sourceFile> ($sourceFile);
6628     $r-><AS::PLBlockCon.sourceLine> ($sourceLine);
6629     $r-><AS::PLBlockCon.currentSourceFile> ($sourceFile);
6630     $r-><AS::PLBlockCon.currentSourceLine> ($sourceLine);
6631     } elsif ($node) {
6632     my $np = $node-><M::swcfg21:SWCFGNode::swcfg21:ForLatest.nodePath>
6633     (key => [qw/Name QName Type type/]);
6634     $r-><AS::PLBlockCon.sourceFile> ($np);
6635     $r-><AS::PLBlockCon.sourceLine> (1);
6636     $r-><AS::PLBlockCon.currentSourceFile> ($np);
6637     $r-><AS::PLBlockCon.currentSourceLine> (1);
6638     }
6639 wakaba 1.16 } else {
6640     $r = $plimpl-><M::MPLImpl.createPerlInlineContainer>;
6641     }
6642     for my $source_code (split /(?<![\^\?qwr])(\x3C$RegQNameChar[^<>]+>
6643     )/ox, $codeArg) {
6644 wakaba 1.13 if ($source_code =~ s/^\x3C//) {
6645     $source_code =~ s/>$//;
6646     if ($source_code =~ /=$/) {
6647     ## TODO: Warning
6648     # valid_warn qq<Inline element "\x3C$source_code>" ends with a "=" - >.
6649     # q{should "=" be used place of "=>"?};
6650     }
6651     if ($source_code =~ s/^(.+?):://) {
6652     my $et = $self->{src}
6653     -><M::ManakaiDISElement.qnameToURI>
6654     ($1,
6655     node => $node,
6656     default_namespace_uri => <Q::disPerl:>);
6657     if ($et eq <Q::disPerl:Q>) { ## QName constant
6658     $r-><M::PLAnyCon.appendStringLiteral>
6659     ($self->{src}
6660     -><M::ManakaiDISElement.qnameToURI>
6661     ($source_code, node => $node));
6662     } elsif ({
6663     <Q::disPerl:M> => 1,
6664     <Q::disPerl:ClassM> => 1,
6665     <Q::disPerl:AG> => 1,
6666     <Q::disPerl:AS> => 1,
6667     }->{$et}) { ## Method call
6668     my ($class_qname, $method_qname)
6669     = split /\s*\.\s*/, $source_code, 2;
6670     my $class_uri
6671     = $self->{src}
6672     -><M::ManakaiDISElement.tfqnamesToURI>
6673     ($class_qname,
6674     $self-><AG::ManakaiDISResourceDefinition
6675 wakaba 1.33 .ownerClassNodeURI>,
6676 wakaba 1.13 $self->{for},
6677     node => $node);
6678     my $class = $self->{db}-><M::ManakaiDISDatabase.getResource>
6679     ($class_uri);
6680 wakaba 1.16 unless ($class-><AG::ManakaiDISResourceDefinition
6681     .isDefined>) {
6682     __UNDEEP{__EXCEPTION{RESOURCE_NOT_DEFINED_ERR::
6683     DIS:sourceNode => {$node},
6684     DIS:sourceCode => {$source_code},
6685     DIS:uri => {$class_uri},
6686     DIS:elementType => {$et},
6687     DIS:expectedType => {<Q::DISLang:AnyClass>},
6688     }__}__;
6689     }
6690 wakaba 1.14 $class-><AS::ManakaiDISResourceDefinition.isReferred>
6691 wakaba 1.13 ($node || $self->{src});
6692     if ($et eq <Q::disPerl::ClassM> and
6693     $class-><M::ManakaiDISResourceDefinition.isTypeURI>
6694     (<Q::ManakaiDOM:IF>)) {
6695     __UNDEEP{
6696     __EXCEPTION{INTERFACE_CLASS_METHOD_ERR::
6697     DIS:uri => {$class_uri},
6698     DIS:elementType => {$et},
6699     DIS:sourceNode => {$node || $self->{src}},
6700     DIS:sourceCode => {$source_code},
6701 wakaba 1.14 DIS:expectedType => {<Q::ManakaiDOM:IF>},
6702 wakaba 1.13 }__;
6703     }__;
6704     }
6705     unless ($class-><M::ManakaiDISResourceDefinition.isTypeURI>
6706     (<Q::ManakaiDOM:IF>)) {
6707 wakaba 1.20 $self-><M::ManakaiDISResourceDefinition.plAddRequireResource>
6708     ($class => $r);
6709 wakaba 1.13 }
6710 wakaba 1.14 my $method = $class-><M::ManakaiDISResourceDefinition
6711 wakaba 1.13 .getChildResourceByNameAndType>
6712     ($method_qname,
6713     {
6714     <Q::disPerl:AG> => <Q::DISLang:Attribute>,
6715     <Q::disPerl:AS> => <Q::DISLang:Attribute>,
6716     }->{$et} || <Q::DISLang:Method>);
6717     if (not $method or
6718     not $method-><AG::ManakaiDISResourceDefinition
6719     .isDefined>) {
6720     __UNDEEP{
6721     __EXCEPTION{RESOURCE_NOT_DEFINED_ERR::
6722     DIS:localName => {$method_qname},
6723 wakaba 1.33 DIS:parentURI => {$class_uri},
6724 wakaba 1.13 DIS:elementType => {$et},
6725     DIS:sourceNode => {$node || $self->{src}},
6726     DIS:sourceCode => {$source_code},
6727 wakaba 1.14 DIS:expectedType => {{
6728     <Q::disPerl:AG> => <Q::DISLang:Attribute>,
6729     <Q::disPerl:AS> => <Q::DISLang:Attribute>,
6730     }->{$et} || <Q::DISLang:Method>},
6731 wakaba 1.13 }__;
6732     }__;
6733     }
6734     my $class_name = '';
6735     if ($et eq <Q::disPerl:ClassM>) {
6736     $class_name = $class-><AG::ManakaiDISResourceDefinition
6737     .plFullyQualifiedName> . '->';
6738     }
6739     my $method_name = $method-><AG::ManakaiDISResourceDefinition
6740     .plName>;
6741     $r-><M::PLAnyCon.appendBare>
6742     ($class_name . $method_name);
6743     } elsif ({
6744     <Q::disPerl:Class> => 1,
6745     <Q::disPerl:ClassName> => 1,
6746     <Q::disPerl:IF> => 1,
6747     <Q::disPerl:IFName> => 1,
6748     }->{$et}) { ## Perl package name
6749     my $class_uri
6750     = $self->{src}
6751     -><M::ManakaiDISElement.tfqnamesToURI>
6752     ($source_code,
6753     $self-><AG::ManakaiDISResourceDefinition
6754 wakaba 1.33 .ownerClassNodeURI>,
6755 wakaba 1.13 $self->{for},
6756     node => $node);
6757     my $class = $self->{db}-><M::ManakaiDISDatabase.getResource>
6758     ($class_uri);
6759 wakaba 1.14 $class-><AS::ManakaiDISResourceDefinition.isReferred>
6760 wakaba 1.13 ($node || $self->{src});
6761 wakaba 1.14 my $pack = $class-><AG::ManakaiDISResourceDefinition
6762 wakaba 1.13 .plFullyQualifiedName>;
6763 wakaba 1.14 unless ($pack) {
6764     __UNDEEP{__EXCEPTION{NO_PERL_PACKAGE_NAME_ERR::
6765     DIS:sourceNode => {$node || $self->{src}},
6766     DIS:sourceCode => {$source_code},
6767     DIS:uri => {$class_uri},
6768     DIS:elementType => {$et},
6769     }__}__;
6770     }
6771 wakaba 1.13 if ({
6772     <Q::disPerl:ClassName> => 1,
6773     <Q::disPerl:IFName> => 1,
6774     }->{$et}) {
6775     $r-><M::PLAnyCon.appendStringLiteral> ($pack);
6776     } else {
6777     $r-><M::PLAnyCon.appendBare> ($pack);
6778     }
6779     } elsif ($et eq <Q::disPerl:Code>) { ## Inline code
6780     my $code_name;
6781     $source_code =~ s/^\s+//;
6782     if ($source_code =~ s/^((?>(?!::).)+)//s) {
6783     $code_name = $1;
6784     } else {
6785     __UNDEEP{
6786     __EXCEPTION{PERL_PREPROCESS_NO_CODE_NAME_ERR::
6787     DIS:sourceCode => {$source_code},
6788     DIS:sourceNode => {$node || $self->{src}},
6789     }__;
6790     }__;
6791     }
6792     $source_code =~ s/^::\s*//;
6793     my $param = $self-><M::ManakaiDISResourceDefinition
6794     .plParsePreprocessParameter>
6795     ($source_code, node => $node);
6796     my $code_uri = $self->{src}-><M::ManakaiDISElement
6797     .tfqnamesToURI>
6798     ($code_name, null, $self->{for},
6799     node => $node);
6800     my $code = $self->{db}-><M::ManakaiDISDatabase.getResource>
6801     ($code_uri);
6802 wakaba 1.14 $code-><AS::ManakaiDISResourceDefinition.isReferred>
6803 wakaba 1.13 ($node || $self->{src});
6804     unless ($code-><M::ManakaiDISResourceDefinition.isTypeURI>
6805     (<Q::dis2pm:InlineCode>)) {
6806     __UNDEEP{__EXCEPTION{RESOURCE_NOT_DEFINED_ERR::
6807     DIS:uri => {$code_uri},
6808     DIS:sourceNode => {$node || $self->{src}},
6809     DIS:sourceCode => {$source_code},
6810     DIS:expectedType => {<Q::dis2pm:InlineCode>},
6811     }__;}__;
6812     }
6813     my $pc = $code-><AG::ManakaiDISResourceDefinition
6814     .plCodeFragment>->clone;
6815     unless (defined $pc) {
6816     __UNDEEP{__EXCEPTION{PERL_CODE_NOT_DEFINED_ERR::
6817     DIS:sourceNode => {$node || $self->{src}},
6818     DIS:sourceCode => {$source_code},
6819     DIS:uri => {$code_uri},
6820     }__}__;
6821     }
6822     for my $var (grep {/^\$/} keys %$param) {
6823     my $value;
6824     if ($param->{$var}->{type} eq 'variable') {
6825     $value = $plimpl-><M::MPLImpl.createPerlVariable>
6826     ('$', null, $param->{$var}->{value});
6827     } elsif ($param->{$var}->{type} eq 'code') {
6828 wakaba 1.22 $value = $self-><M::ManakaiDISResourceDefinition
6829     .plPreprocessPerlStatement>
6830     ($param->{$var}->{value},
6831     contains_statements => false);
6832 wakaba 1.13 } else {
6833     $value = $plimpl-><M::MPLImpl.createPerlStringLiteral>
6834     ($param->{$var}->{value});
6835     }
6836     $pc-><M::MPLCodeFragment.replaceVariable>
6837     ($var => $value);
6838     }
6839 wakaba 1.16 $r-><M::PLInCon.appendCodeFragment> ($pc);
6840 wakaba 1.13 } elsif ($et eq <Q::disPerl:C>) {
6841     my ($class_qname, $const_name) = split /\./, $source_code, 2;
6842     my $class_uri
6843     = $self->{src}
6844     -><M::ManakaiDISElement.tfqnamesToURI>
6845     ($class_qname,
6846     $self-><AG::ManakaiDISResourceDefinition
6847 wakaba 1.33 .ownerClassNodeURI>,
6848 wakaba 1.13 $self->{for},
6849     node => $node);
6850     my $class = $self->{db}-><M::ManakaiDISDatabase.getResource>
6851     ($class_uri);
6852 wakaba 1.14 $class-><AS::ManakaiDISResourceDefinition.isReferred>
6853 wakaba 1.13 ($node || $self->{src});
6854     my $const = $class-><M::ManakaiDISResourceDefinition
6855     .getConstResourceByName> ($const_name);
6856     unless (defined $const) {
6857     __UNDEEP{__EXCEPTION{RESOURCE_NOT_DEFINED_ERR::
6858     DIS:sourceNode => {$node || $self->{src}},
6859     DIS:sourceCode => {$source_code},
6860     DIS:localName => {$const_name},
6861 wakaba 1.14 DIS:expectedType => {<Q::ManakaiDOM:Const>},
6862 wakaba 1.13 }__}__;
6863     }
6864 wakaba 1.30 $const-><AS::ManakaiDISResourceDefinition.isReferred> ($node);
6865    
6866     my $data_type = $const-><AG::ManakaiDISResourceDefinition
6867     .disActualDataTypeResource>;
6868     my $val = $const->{src}-><M::ManakaiDISElement
6869     .plValueCodeFragment>
6870     (<Q::dis:Value>, $const,
6871     for_arg => $const->{for},
6872     forp_arg => $const->{forp},
6873     data_type_uri => $data_type
6874     -><AG::ManakaiDISResourceDefinition.uri>);
6875     unless (defined $val) {
6876     __UNDEEP{__EXCEPTION{NO_CONST_VALUE_ERR::
6877     DIS:uri => {$const->{uri}},
6878     DIS:localName => {$const->{localName}},
6879     DIS:sourceNode => {$const->{src}},
6880     DIS:elementType => {$et},
6881     }__}__;
6882 wakaba 1.13 }
6883 wakaba 1.30 $r-><M::PLInCon.appendCodeFragment> ($val);
6884 wakaba 1.13 } else {
6885     __UNDEEP{__EXCEPTION{UNSUPPORTED_ELEMENT_TYPE_ERR::
6886     DIS:elementType => {$et},
6887     DIS:sourceNode => {$node || $self->{src}},
6888 wakaba 1.16 DIS:sourceCode => {$source_code},
6889 wakaba 1.13 }__}__;
6890     }
6891     } else {
6892     __UNDEEP{__EXCEPTION{PERL_PREPROCESS_NO_ELEMENT_TYPE_ERR::
6893     DIS:sourceNode => {$node || $self->{src}},
6894     DIS:sourceCode => {$source_code},
6895 wakaba 1.14 DIS:expectedType => {<Q::ManakaiDOM:ConstGroup>},
6896 wakaba 1.13 }__}__;
6897     }
6898     } else {
6899 wakaba 1.33 for my $source_code (split /(\b
6900     (?: t r u e \b|
6901     f a l s e \b|
6902     n u l l \b|
6903     t r y \s* \x7B ) |
6904     \ \\ p \x7B [^\x7B\x7D\\]+ \x7D)/x,
6905     $source_code) {
6906 wakaba 1.16 if ({
6907     'tr'.'ue' => true,
6908     'fal'.'se' => true,
6909     'nu'.'ll' => true,
6910     }->{$source_code}) {
6911     $r-><M::PLAnyCon.appendAtom> ({
6912     'tr'.'ue' => 1,
6913     'fal'.'se' => 0,
6914     'nu'.'ll' => 'undef',
6915     }->{$source_code});
6916 wakaba 1.18 } elsif ($source_code =~ /^t r y \s* \x7B$/x) {
6917     $r-><M::PLInCon.appendCode> ('tr'.
6918     'y '."\x7B".'local $Error::Depth = $Error::Depth + 3;');
6919 wakaba 1.20 $r-><M::MPLCodeFragment.addUsePerlModuleName>
6920     ('Message::Util::Error');
6921 wakaba 1.33 } elsif ($source_code =~ /^\\ p \x7B ([^\x7B\x7D\\]+) \x7D$/x) {
6922     my $cls = $1;
6923     $cls =~ s/^\s+//s;
6924     $cls =~ s/\s+$//s;
6925     ## TODO: Formal character class support required
6926     if ($cls =~ /^inxml\s*[:|]\s*(\w+)/) {
6927     $r-><M::PLAnyCon.appendAtom> ('\\'.'p{InXML'.$1.'}');
6928     $r-><M::MPLCodeFragment.addUseCharClassName>
6929     ('Char::Class::XML', 'InXML'.$1);
6930     } else {
6931     __UNDEEP{__EXCEPTION{RESOURCE_NOT_DEFINED_ERR::
6932     DIS:sourceNode => {$node},
6933     DIS:sourceCode => {$source_code},
6934     }__}__;
6935     }
6936 wakaba 1.16 } else {
6937 wakaba 1.29 if ($source_code =~ s/^(\s*[\w:]+\s*)//) {
6938     ## NOTE: "$cond ?\n1\n:0" would be a syntax error
6939     $r-><M::PLAnyCon.appendAtom> ($1);
6940     }
6941 wakaba 1.16 $r-><M::PLInCon.appendCode> ($source_code);
6942     }
6943     }
6944     } # Inline instruction or not
6945 wakaba 1.13 } # for
6946     }__; # DEEP
6947    
6948     @Attr:
6949 wakaba 1.33 @@Name: ownerClassNodeURI
6950 wakaba 1.13 @@enDesc:
6951 wakaba 1.33 The node URI reference of the class resource this resource
6952 wakaba 1.13 belongs to.
6953     @@Type: ResourceURI
6954     @@Get:
6955     @@@enDesc:
6956     The URI reference of the <TYPE::ManakaiDOM:Class> resource.
6957     If this resource is a class, then the URI reference
6958     of this resource is returned.
6959     @@@nullCase:
6960     @@@@enDesc:
6961     This resource does not belong to any class.
6962     @@@PerlDef:
6963     if (exists $self->{<Q::DIS:ownerClass>}) {
6964     $r = $self->{<Q::DIS:ownerClass>};
6965     } else {
6966     my $res = $self;
6967     __DEEP{
6968 wakaba 1.33 RES: {
6969 wakaba 1.13 if ($res-><M::ManakaiDISResourceDefinition.isTypeURI>
6970     (<Q::ManakaiDOM:Class>)) {
6971 wakaba 1.33 $r = $res-><AG::ManakaiDISResourceDefinition.sourceNodeID>;
6972 wakaba 1.13 } else {
6973     $res = $res-><M::ManakaiDISPropertyAccessor
6974     .getPropertyResource> (<Q::dis2pm:parentResource>);
6975 wakaba 1.33 redo RES if $res;
6976 wakaba 1.13 }
6977     }
6978     }__;
6979     $self->{<Q::DIS:ownerClass>} = $r;
6980     }
6981    
6982     @IntMethod:
6983     @@Name: plParsePreprocessParameter
6984     @@enDesc:
6985     Parses a parameter specification in preprocessing instruction
6986     and return it as a hash reference.
6987     \
6988     {NOTE:: The callee have to ensure that this resource has its
6989     <CODE::src> before the call to this method.
6990     \
6991     }
6992     @@Param:
6993     @@@Name: paramSpec
6994     @@@Type:
6995     DISLang:String::ManakaiDOM:all
6996     @@@enDesc:
6997     A parameter specification to parse.
6998     @@NodeParam:
6999     @@Return:
7000     @@@Type:
7001     Perl:hash::ManakaiDOM:all
7002     @@@enDesc:
7003     Hash containing parameters. Each hash value is also
7004     a hash reference, containing two keys <CODE::type>
7005     (its value is either <CODE::bare>, <CODE::quoted>,
7006     <CODE::code> or <CODE::variable>) and
7007     <CODE::value>.
7008     @@@RaiseException:
7009     @@@@@:BROKEN_PARAM_SPEC_ERR
7010     @@@@enDesc:
7011     The <P::paramSpec> is not well-formed.
7012     @@@PerlDef:
7013     our $RegQNameChar;
7014     our $RegBlockContent;
7015     $r = {};
7016     while ($paramSpec =~ s/^
7017     ## Parameter name
7018     (\$? $RegQNameChar+)\s*
7019    
7020     (?: =>? \s*
7021     ## ">" is now optional for inline element (">" is delimiter)
7022    
7023     ## Parameter value
7024     (
7025 wakaba 1.15 ## Variable or Bare string
7026     \ \$? $RegQNameChar+
7027 wakaba 1.13 |
7028     ## Quoted string
7029     '(?>[^'\\]*)' ## ISSUE: escape mechanism required?
7030     |
7031     ## Code
7032 wakaba 1.15 \ \{$RegBlockContent\}
7033 wakaba 1.13
7034     )
7035    
7036     \s*)?
7037    
7038     (?:,\s*|$)//ox) {
7039    
7040     my ($n, $v) = ($1, $2);
7041     if (defined $v) {
7042     if ($v =~ /^'/) {
7043     $v = {type => 'quoted',
7044     value => substr ($v, 1, length ($v) - 2)};
7045     } elsif ($v =~ /^\{/) {
7046     $v = {type => 'code', value => substr ($v, 1, length ($v) - 2)};
7047     } elsif ($v =~ /^\$/) {
7048 wakaba 1.21 $v = {type => 'variable', value => substr $v, 1};
7049 wakaba 1.13 } else {
7050     $v = {type => 'bare', value => $v};
7051     }
7052     } else {
7053     $v = {type => 'boolean', value => true};
7054     }
7055    
7056     if ($n =~ /^\$/) {
7057     $r->{$n} = $v;
7058     } else {
7059     __DEEP{
7060     $r->{$self->{src}-><M::ManakaiDISElement.qnameToURI>
7061     ($n, node => $node || $self->{src})} = $v;
7062     }__;
7063     }
7064     } # while
7065    
7066     if (length $paramSpec) {
7067     __EXCEPTION{BROKEN_PARAM_SPEC_ERR::
7068     DIS:sourceCode => {$paramSpec},
7069     DIS:sourceNode => {$node || $self->{src}},
7070     }__;
7071     }
7072    
7073 wakaba 1.15 @IntMethod:
7074     @@Name: plGetContextParameter
7075     @@enDesc:
7076     Returns contextual parameters which describes the <QUOTE::location>
7077     of this resource.
7078     @@Return:
7079     @@@Type:
7080     Perl:hash::ManakaiDOM:all
7081     @@@enDesc:
7082     Hash of parameters as <M::.plParsePreprocessParameter> returns.
7083     @@@PerlDef:
7084     $r = {};
7085     __DEEP{
7086     if ($self-><M::ManakaiDISResourceDefinition.isTypeURI>
7087     (<Q::DISLang:MethodReturn>)) {
7088     my $method = $self-><M::ManakaiDISPropertyAccessor
7089     .getPropertyResource> (<Q::dis2pm:parentResource>);
7090     $r->{<Q::MDOMX:method>}
7091     = {type => 'quoted',
7092     value => $method-><AG::ManakaiDISResourceDefinition.plName>};
7093     my $class = $method-><M::ManakaiDISPropertyAccessor
7094     .getPropertyResource> (<Q::dis2pm:parentResource>);
7095     $r->{<Q::MDOMX:class>}
7096     = {type => 'quoted',
7097     value => $class-><AG::ManakaiDISResourceDefinition
7098     .plFullyQualifiedName>};
7099     } elsif ($self-><M::ManakaiDISResourceDefinition.isTypeURI>
7100     (<Q::DISLang:AttributeGet>)) {
7101     my $attr = $self-><M::ManakaiDISPropertyAccessor
7102     .getPropertyResource> (<Q::dis2pm:parentResource>);
7103     $r->{<Q::MDOMX:attr>}
7104     = {type => 'quoted',
7105     value => $attr-><AG::ManakaiDISResourceDefinition.plName>};
7106     my $class = $attr-><M::ManakaiDISPropertyAccessor
7107     .getPropertyResource> (<Q::dis2pm:parentResource>);
7108     $r->{<Q::MDOMX:class>}
7109     = {type => 'quoted',
7110     value => $class-><AG::ManakaiDISResourceDefinition
7111     .plFullyQualifiedName>};
7112     $r->{<Q::MDOMX:on>} = {type => 'quoted', value => 'get'};
7113     } elsif ($self-><M::ManakaiDISResourceDefinition.isTypeURI>
7114     (<Q::DISLang:AttributeSet>)) {
7115     my $attr = $self-><M::ManakaiDISPropertyAccessor
7116     .getPropertyResource> (<Q::dis2pm:parentResource>);
7117     $r->{<Q::MDOMX:attr>}
7118     = {type => 'quoted',
7119     value => $attr-><AG::ManakaiDISResourceDefinition.plName>};
7120     my $class = $attr-><M::ManakaiDISPropertyAccessor
7121     .getPropertyResource> (<Q::dis2pm:parentResource>);
7122     $r->{<Q::MDOMX:class>}
7123     = {type => 'quoted',
7124     value => $class-><AG::ManakaiDISResourceDefinition
7125     .plFullyQualifiedName>};
7126     $r->{<Q::MDOMX:on>} = {type => 'quoted', value => 'set'};
7127     } else {
7128     $r->{<Q::MDOMX:resourceURI>} = {type => 'quoted',
7129     value => $self->{uri}};
7130     }
7131     }__;
7132    
7133     @Method:
7134     @@Name: plGetMethodInputNormalizer
7135     @@enDesc:
7136     Returns an input processor. This method assumes that
7137 wakaba 1.19 this resource is a method parameter (<Q::DISLang:MethodParameter>)
7138     or an attribute setter (<Q::DISLang:AttributeSet>).
7139 wakaba 1.15 @@Return:
7140     @@@Type:ManakaiDISResourceDefinition
7141     @@@enDesc:
7142     A <Q::DISLang:InputProcessor> corresponding to
7143     the parameter defined by this resource.
7144     \
7145     {NOTE:: <Q::ManakaiDOM:inputNormalize> property is
7146     obsolete in favor of <Q::DISLang:InputProcessor>;
7147     this method does not support the former.
7148     \
7149     }
7150     @@@nullCase:
7151     @@@@enDesc:
7152     No input processor found.
7153     @@@PerlDef:
7154     my $type;
7155 wakaba 1.30 my $type_node;
7156 wakaba 1.15 try {
7157     $type = $self-><AG::ManakaiDISResourceDefinition
7158     .disActualDataTypeResource>;
7159 wakaba 1.30 $type_node = $self-><AG::ManakaiDISResourceDefinition
7160     .disActualDataTypeNode>;
7161 wakaba 1.15 } catch <Class::ManakaiDISException> with {
7162     my $err = shift;
7163     unless ($err->{<Q::MDOMX:subtype>} eq <Q::DIS:NO_DIS_TYPE_ERR>) {
7164     $err->throw;
7165     }
7166     };
7167     if ($type) {
7168     __DEEP{
7169 wakaba 1.30 my $noinput = $type_node-><M::ManakaiDISElement.disGetAttribute>
7170     (<Q::ManakaiDOM:noInputNormalize>,
7171     for_arg => $self->{for},
7172     forp_arg => $self->{forp});
7173     ## NOTE: Is this correct?
7174     ## Should be "for" for the resource
7175     ## for which the "actualType" element
7176     ## is specified?
7177     unless ($noinput and $noinput-><M::SWCFGNode.value>) {
7178     $r = $type-><M::ManakaiDISResourceDefinition
7179     .getChildResourceByType>
7180 wakaba 1.15 (<Q::DISLang:InputProcessor>);
7181 wakaba 1.30 }
7182 wakaba 1.15 }__;
7183     }
7184    
7185     @IntMethod:
7186     @@Name: plAppendThrow
7187     @@enDesc:
7188     Appends a <Perl::report> method call statement for exception reporting.
7189     @@Param:
7190     @@@Name: parentNode
7191     @@@enDesc:
7192     The parent Perl code node to which a new statement is appended.
7193     @@@Type: PLBlockCon
7194     @@Param:
7195     @@@Name: xclass
7196     @@@Type: ManakaiDISResourceDefinition
7197     @@@enDesc:
7198     An exception class.
7199     @@Param:
7200     @@@Name: xcode
7201     @@@Type: ManakaiDISResourceDefinition
7202     @@@enDesc:
7203     An exception code constant.
7204     @@Param:
7205     @@@Name: xsubtype
7206     @@@Type: ManakaiDISResourceDefinition
7207     @@@enDesc:
7208     An exception subtype.
7209     @@@nullCase:
7210     @@@@enDesc:
7211     No subtype.
7212     @@Param:
7213     @@@Name: xparam
7214     @@@Type:
7215     Perl:hash::ManakaiDOM:all
7216     @@@enDesc:
7217     A hash containing parameters passed to the <Perl:report> method.
7218     A hash key is to be a parameter name. Hash values
7219     should also be hashes. A hash value hash has two values:
7220     <CODE::type> and <CODE::value>. A <CODE::value>
7221     value is a parameter value. If <CODE::type> is
7222     <CODE::code>, then <CODE::value> is assumed as a Perl code fragment.
7223     Otherwise, <CODE::value> is quoted to be interpreted as a string as is.
7224     @@Return:
7225 wakaba 1.16 @@@RaiseException:
7226     @@@@@: RESOURCE_NOT_DEFINED_ERR
7227     @@@@enDesc:
7228     Either <P::xclass>, <P::xcode> or <P::xsubtype>
7229     is not defined.
7230 wakaba 1.15 @@@PerlDef:
7231     my $statement = $parentNode-><M::PLBlockCon.appendStatement>
7232     ('report '.
7233     $xclass-><AG::ManakaiDISResourceDefinition.plFullyQualifiedName>.
7234     ' -object => $self');
7235 wakaba 1.16 my $xclass_module = $xclass-><AG::ManakaiDISResourceDefinition
7236 wakaba 1.22 .ownerModule>;
7237 wakaba 1.16 unless ($xclass-><AG::ManakaiDISResourceDefinition.isDefined> or
7238     not $xclass_module) {
7239     __EXCEPTION{RESOURCE_NOT_DEFINED_ERR::
7240     DIS:sourceNode => {$self->{src}},
7241     DIS:uri => {$xclass->{uri}},
7242     DIS:localName => {$xclass->{localName}},
7243     DIS:expectedType => {<Q::DOMException:AnyExceptionClass>},
7244     }__;
7245     }
7246 wakaba 1.29 $xclass-><AS::ManakaiDISResourceDefinition.isReferred> ($self->{src});
7247 wakaba 1.20 $self-><M::ManakaiDISResourceDefinition.plAddRequireResource>
7248     ($xclass_module => $statement);
7249 wakaba 1.15 $xparam->{-type} = {type => 'quoted',
7250     value => $xcode-><AG::ManakaiDISResourceDefinition
7251     .plName>};
7252     $xparam->{<Q::MDOMX:subtype>} = {type => 'quoted',
7253     value => $xsubtype->{nameURI}}
7254     if $xsubtype;
7255     for my $name (keys %$xparam) {
7256     my $pname = $name;
7257     $pname =~ s/(['\\])/\\$1/g;
7258     $pname = qq<'$pname'>;
7259     $statement-><M::PLInCon.appendCode>
7260     (', ' . $pname . ' => ');
7261     if ($xparam->{$name}->{type} eq 'code') {
7262     if (ref $xparam->{$name}->{value}) {
7263     $statement-><M::PLInCon.appendCodeFragment>
7264     ($xparam->{$name}->{value});
7265     } else {
7266 wakaba 1.16 $statement-><M::PLInCon.appendCodeFragment>
7267 wakaba 1.15 ($self-><M::ManakaiDISResourceDefinition
7268     .plPreprocessPerlStatement>
7269     ($xparam->{$name}->{value}));
7270     }
7271     } else { ## String as is
7272     $statement-><M::PLAnyCon.appendStringLiteral>
7273     ($xparam->{$name}->{value});
7274     }
7275     }
7276    
7277 wakaba 1.18 @Attr:
7278     @@Name: plIsNullable
7279     @@enDesc:
7280     Whether this resource is <QUOTE::nullable> or not.
7281     <QUOTE::Nullability> is defined for method parameters,
7282     method returns, attribute getters and attribute setters.
7283     @@Type:
7284     DOMMain:boolean::ManakaiDOM:all
7285     @@Get:
7286     @@@RaiseException:
7287     @@@@@:NO_DIS_TYPE_ERR
7288     @@@@enDesc:
7289     There is a <Q::ManakaiDOM:InCase> child resource
7290     that does not have <Q::dis:Type> attribute.
7291     @@@PerlDef:
7292     __DEEP{
7293     for my $incase (@{$self-><M::ManakaiDISPropertyAccessor
7294     .getPropertyResourceList>
7295     (<Q::DIS:childResource>)}) {
7296     next unless $incase-><M::ManakaiDISResourceDefinition.isTypeURI>
7297     (<Q::ManakaiDOM:InCase>);
7298     if ($incase-><AG::ManakaiDISResourceDefinition.disIsNullValue> or
7299     $incase-><AG::ManakaiDISResourceDefinition
7300     .disActualDataTypeResource>
7301     -><M::ManakaiDISResourceDefinition
7302     .isSubsetOfURI> (<Q::DOMMain:boolean>)) {
7303     $r = true;
7304     last;
7305     }
7306     }
7307     }__;
7308    
7309     @Attr:
7310     @@Name: disIsNullValue
7311     @@enDesc:
7312     Whether this resource have <DOM::null> value or not.
7313     A resource have <DOM::null> value iff it has
7314     <Q::dis:Value> attribute node that in turn has
7315     <Q::dis:is-null> attribute whose value set to <DOM::true>.
7316     @@Type:
7317     DOMMain:boolean::ManakaiDOM:all
7318     @@Get:
7319     @@@PerlDef:
7320     if ($self->{src}) {
7321     __DEEP{
7322     my $val = $self->{src}-><M::ManakaiDISElement.disGetAttribute>
7323     (<Q::dis:Value>,
7324     for_arg => $self->{for},
7325     forp_arg => $self->{forp});
7326     if ($val) {
7327     my $isnull = $val-><M::ManakaiDISElement.disGetAttribute>
7328     (<Q::dis:is-null>,
7329     for_arg => $self->{for},
7330     forp_arg => $self->{forp});
7331     if ($isnull and $isnull-><M::swcfg21:SWCFGNode::swcfg21:ForLatest
7332     .value>) {
7333     $r = true;
7334     }
7335     }
7336     }__;
7337     }
7338 wakaba 1.19
7339     @Attr:
7340     @@Name:plIsDefined
7341     @@enDesc:
7342     Whether a Perl implementation for this resource is available or not.
7343     @@Type:
7344     DOMMain:boolean::ManakaiDOM:all
7345     @@Get:
7346     @@@TrueCase:
7347     @@@@enDesc:
7348     This resource has its Perl definition and it is implemented.
7349     @@@FalseCase:
7350     @@@@enDesc:
7351     Either this resource does not have any Perl definition
7352     or it does have but it is not implemented yet.
7353     @@@PerlDef:
7354     if (exists $self->{<Q::TreeCore:node>}->{<Q::DIS:plDefined>}) {
7355     $r = $self->{<Q::TreeCore:node>}->{<Q::DIS:plDefined>};
7356     } else {
7357     __DEEP{
7358     my $typeuri = {
7359     <Q::ManakaiDOM:Class> => [
7360     <Q::DISLang:Method>, <Q::DISLang:Attribute>,
7361     ],
7362     <Q::DISLang:Method> => [
7363     <Q::DISLang:MethodReturn>,
7364     ],
7365     <Q::DISLang:Attribute> => [
7366     <Q::DISLang:AttributeGet>, <Q::DISLang::AttributeSet>,
7367     ],
7368     };
7369     OUTMOST:
7370     for my $mytype (keys %$typeuri) {
7371     if ($self-><M::ManakaiDISResourceDefinition.isTypeURI> ($mytype)) {
7372     for my $ctype ($typeuri->{$mytype}) {
7373     for my $cres (@{$self-><M::ManakaiDISPropertyAccessor
7374     .getPropertyResourceList>
7375     (<Q::DIS:childResource>)}) {
7376     if ($cres-><M::ManakaiDISResourceDefinition.isTypeURI>
7377     ($ctype)) {
7378     unless ($cres-><AG::ManakaiDISResourceDefinition
7379     .plIsDefined>) {
7380     $r = false; last OUTMOST;
7381     }
7382     }
7383     }
7384     next OUTMOST;
7385     }
7386     }
7387     } # OUTMOST
7388     }__;
7389     $self->{<Q::TreeCore:node>}->{<Q::DIS:plDefined>} = $r;
7390     }
7391 wakaba 1.20
7392     @IntMethod:
7393     @@Name: plAddRequireResource
7394     @@enDesc:
7395     Adds a resource to the list of resources that should
7396     be <Perl::require>d from a Perl code fragment.
7397     @@Param:
7398     @@@Name: resourceArg
7399     @@@Type: ManakaiDISResourceDefinition
7400     @@@enDesc:
7401     A resource that is <Perl::require>d by <P::codeArg>.
7402     @@Param:
7403     @@@Name: codeArg
7404     @@@Type: MPLCodeFragment
7405     @@@enDesc:
7406     A code fragment. <P::resourceArg> is added to the
7407     list of <Perl::require>d resources of this code fragment.
7408     @@Return:
7409     @@@PerlDef:
7410     __DEEP{
7411     $codeArg-><M::MPLCodeFragment.disAddRequireURI>
7412     ($resourceArg-><AG::ManakaiDISResourceDefinition.uri>);
7413     }__;
7414 wakaba 1.21
7415 wakaba 1.22 @Attr:
7416     @@ManakaiDOM:isForInternal:1
7417 wakaba 1.21 @@Name: plMufDescriptionText
7418     @@enDesc:
7419     {TODO:: Formal documentation-access API required.
7420     \
7421     }
7422 wakaba 1.22 @@Get:
7423 wakaba 1.21 @@@Type:
7424     DISLang:String::ManakaiDOM:all
7425     @@@PerlDef:
7426     __DEEP{
7427     my $muf = $self->{src}-><M::ManakaiDISElement.disGetAttribute>
7428     (<Q::dis:Def>, for_arg => $self->{for},
7429     forp_arg => $self->{forp},
7430     media_type => <Q::lang:muf>);
7431     if ($muf) {
7432     $r = $muf-><M::SWCFGNode.value>;
7433 wakaba 1.29 $r =~ s{< Q ::([^<>]+)>}{$self->{src}-><M::ManakaiDISElement.
7434     qnameToURI> ($1, node => $muf)}gex;
7435 wakaba 1.21 $r =~ s/\s+/ /g;
7436     $r =~ s/^ //;
7437     $r =~ s/ $//;
7438     } else {
7439     my $desc = $self->{src}-><M::ManakaiDISElement.disGetAttribute>
7440     (<Q::dis:Description>, for_arg => $self->{for},
7441     forp_arg => $self->{forp},
7442     media_type => <Q::lang:disdoc>,
7443     default_media_type => <Q::lang:disdoc>);
7444     if ($desc) {
7445     $r = $desc-><M::SWCFGNode.value>;
7446     $r =~ s/\s+/ /g;
7447     $r =~ s/^ //;
7448     $r =~ s/ $//;
7449     $r =~ s/%/%percent;/g;
7450     }
7451     }
7452     }__;
7453     @@@ImplNote:
7454     @@@@lang:en
7455     @@@@@: Currently only common-used patterns are supported.
7456 wakaba 1.24
7457     @Method:
7458     @@Name: isFeatureProvided
7459     @@enDesc:
7460     Whether a feature is provided by this resource or not.
7461     Note that the feature is actually available (implemented)
7462     or not is other thing (use <M::ManakaiDISPerlModuleDefinition
7463     .plIsFeatureImplemented> instead).
7464     @@Param:
7465     @@@Name: featureResourceURI
7466     @@@Type: ResourceURI
7467     @@@enDesc:
7468     The URI reference of the resource definition for the feature to test.
7469     @@Return:
7470     @@@Type:
7471     DOMMain:boolean::ManakaiDOM:all
7472     @@@enDesc:
7473     Whether the feature is provided or not.
7474     @@@PerlDef:
7475     __DEEP{
7476     my @f = @{$self-><M::ManakaiDISPropertyAccessor
7477     .getPropertyResourceList>
7478     (<Q::DOMMain:implementFeature>,
7479 wakaba 1.26 isa_recursive => true,
7480 wakaba 1.24 default_media_type => <Q::dis:TypeQName>)};
7481     if (@f) {
7482     for my $f (@f) {
7483     if ($f-><M::ManakaiDISResourceDefinition.isSubsetOfURI>
7484     ($featureResourceURI)) {
7485     $r = true;
7486     last;
7487     }
7488     }
7489     } else {
7490     my $parent = $self-><M::ManakaiDISPropertyAccessor
7491     .getPropertyResource>
7492     (<Q::dis2pm:parentResource>);
7493     $r = $parent-><M::ManakaiDISResourceDefinition.isFeatureProvided>
7494     ($featureResourceURI)
7495     if $parent;
7496     }
7497     }__;
7498    
7499     @Attr:
7500     @@Name: featureNameList
7501     @@enDesc:
7502     The list of the names of the feature defined by this resource.
7503     @@Type:
7504     Perl:ARRAY::ManakaiDOM:all
7505     @@Get:
7506     @@@RaiseException:
7507     @@@@@:UNSUPPORTED_MEDIA_TYPE_ERR
7508     @@@@enDesc:
7509     There is an <Q::dis:AppName> attribute whose media
7510     type is not supported.
7511     @@@RaiseException:
7512     @@@@@: NO_SOURCE_NODE_ERR
7513     @@@@enDesc:
7514     This resource definition does not have associated node
7515     in the source tree.
7516     @@@PerlDef:
7517     unless ($self->{src}) {
7518     __EXCEPTION{NO_SOURCE_NODE_ERR::
7519     DIS:uri => {$self->{uri}},
7520     }__;
7521     }
7522     __DEEP{
7523     for my $ce (@{$self->{src}-><M::ManakaiDISElement.disChildElements>
7524     (for_arg => $self->{for},
7525     forp_arg => $self->{forp})}) {
7526     if ($ce-><AG::swcfg21:SWCFGElement::swcfg21:ForLatest.expandedURI>
7527     eq <Q::dis:AppName>) {
7528     if ($ce-><M::ManakaiDISElement.mediaTypeMatch>
7529     (<Q::dis:TypeQName>,
7530     for_arg => $self->{for},
7531     forp_arg => $self->{forp},
7532     default_media_type => <Q::dis:String>)) {
7533     push @$r, lc $ce-><AG::ManakaiDISElement.qnameValueURI>;
7534     } elsif ($ce-><M::ManakaiDISElement.mediaTypeMatch>
7535     (<Q::dis:String>,
7536     for_arg => $self->{for},
7537     forp_arg => $self->{forp},
7538     default_media_type => <Q::dis:String>)) {
7539     push @$r, lc $ce-><M::SWCFGNode.value>;
7540     } else {
7541     my $mt = $ce-><M::ManakaiDISElement.mediaTypeURI>
7542     (for_arg => $self->{for},
7543     forp_arg => $self->{forp});
7544     __UNDEEP{
7545     __EXCEPTION{UNSUPPORTED_MEDIA_TYPE_ERR::
7546     DIS:uri => {$mt},
7547     DIS:sourceNode => {$ce},
7548     }__;
7549     }__;
7550     }
7551     }
7552     }
7553     unless (@$r) {
7554 wakaba 1.28 my $pr = $self-><M::ManakaiDISPropertyAccessor
7555     .getPropertyResource> (<Q::dis2pm:parentResource>);
7556     if ($pr) {
7557     if ($pr-><M::ManakaiDISResourceDefinition.isTypeURI>
7558     (<Q::DOMMain:DOMFeature>) and
7559     not $pr-><AG::ManakaiDISResourceDefinition.isAnonymous>) {
7560     push @$r, @{$pr-><AG::ManakaiDISResourceDefinition
7561     .featureNameList>};
7562     }
7563     }
7564     }
7565     unless (@$r) {
7566 wakaba 1.24 if ($self-><AG::ManakaiDISResourceDefinition.isAnonymous>) {
7567     my $ln = $self-><AG::ManakaiDISResourceDefinition.localName>;
7568 wakaba 1.28 push @$r, lc $ln if defined $ln;
7569 wakaba 1.24 } else {
7570 wakaba 1.28 push @$r, lc $self-><AG::ManakaiDISResourceDefinition.nameURI>;
7571 wakaba 1.24 }
7572     }
7573     }__;
7574 wakaba 1.32
7575     @Attr:
7576     @@Name: mvLocalName
7577     @@enDesc:
7578     The local name of the markup vocabulary element defined by this
7579     resource.
7580     @@Type:
7581     DISLang:String::ManakaiDOM:all
7582     @@Get:
7583     @@@nullCase:
7584     @@@@enDesc:
7585     Either this resource does not define a markup vocabulary element
7586     or it does define an element but it does not have a local name.
7587     @@@PerlDef:
7588     __DEEP{
7589     if (exists $self->{<Q::mvLocalName>}) {
7590     $r = $self->{<Q::mvLocalName>};
7591     } elsif ($self->{src}) {
7592     my $node = $self->{src}-><M::ManakaiDISElement.disGetAttribute>
7593     (<Q::dis:AppName>,
7594     for_arg => $self->{for},
7595     forp_arg => $self->{forp},
7596     media_type => <Q::dis:TypeQName>,
7597     default_media_type => <Q::dis:TypeQName>);
7598     if ($node) {
7599     $r = $self->{<Q::mvLocalName>}
7600     = $node-><AG::ManakaiDISElement.qnameValueLocalName>;
7601     } else {
7602     $r = $self->{<Q::mvLocalName>} = null;
7603     }
7604     } else {
7605     $r = $self->{<Q::mvLocalName>} = null;
7606     }
7607     }__;
7608    
7609     @Attr:
7610     @@Name: mvNamespaceURI
7611     @@enDesc:
7612     The namespace URI of the markup vocabulary element defined by this
7613     resource.
7614     @@Type: AnyURI
7615     @@Get:
7616     @@@nullCase:
7617     @@@@enDesc:
7618     Either this resource does not define a markup vocabulary element
7619     or it does define an element but it does not have a namespace URI.
7620     @@@PerlDef:
7621     __DEEP{
7622     if (exists $self->{<Q::mvNamespaceURI>}) {
7623     $r = $self->{<Q::mvNamespaceURI>};
7624     } elsif ($self->{src}) {
7625     my $node = $self->{src}-><M::ManakaiDISElement.disGetAttribute>
7626     (<Q::dis:AppName>,
7627     for_arg => $self->{for},
7628     forp_arg => $self->{forp},
7629     media_type => <Q::dis:TypeQName>,
7630     default_media_type => <Q::dis:TypeQName>);
7631     if ($node) {
7632     $r = $self->{<Q::mvNamespaceURI>}
7633     = $node-><AG::ManakaiDISElement.qnameValueNamespaceURI>;
7634     } else {
7635     $r = $self->{<Q::mvNamespaceURI>} = null;
7636     }
7637     } else {
7638     $r = $self->{<Q::mvNamespaceURI>} = null;
7639     }
7640     }__;
7641    
7642     @Attr:
7643     @@Name: mvOwnerElementResource
7644     @@enDesc:
7645     An <QUOTE::owner element> resource of the markup vocabulary
7646     element defined by this resource.
7647     @@Type: ManakaiDISResourceDefinition
7648     @@Get:
7649     @@@nullCase:
7650     @@@@enDesc:
7651     Either this resource does not define a markup vocabulary element
7652     or it does define an element but it does not have an owner.
7653     @@@PerlDef:
7654     __DEEP{
7655     if (exists $self->{<Q::DIS:mvOwnerElementURI>}) {
7656     $r = $self->{db}-><M::ManakaiDISDatabase.getResource>
7657     ($self->{<Q::DIS:mvOwnerElementURI>})
7658     if defined $self->{<Q::DIS:mvOwnerElementURI>};
7659     } elsif (defined $self->{<Q::dis2pm:parentResource>}) {
7660     $r = $self->{db}-><M::ManakaiDISDatabase.getResource>
7661     ($self->{<Q::dis2pm:parentResource>});
7662     undef $r unless $r-><M::ManakaiDISResourceDefinition
7663     .isTypeURI> (<Q::s:AnyOwnerElement>);
7664     $self->{<Q::DIS:mvOwnerElementURI>} = $r->{uri} if $r;
7665     }
7666     }__;
7667 wakaba 1.2 ##DISResourceDefinition
7668 wakaba 1.27
7669     PropDef:
7670 wakaba 1.32 @QName: mvLocalName
7671     @enDesc:
7672     <A::ManakaiDISResourceDefinition.mvLocalName>.
7673    
7674     PropDef:
7675     @QName: mvNamespaceURI
7676     @enDesc:
7677     <A::ManakaiDISResourceDefinition.mvNamespaceURI>.
7678    
7679     PropDef:
7680     @QName: mvOwnerElementURI
7681     @enDesc:
7682     <A::ManakaiDISResourceDefinition.mvOwnerElementResource>
7683     (<QUOTE::dis> resource URI reference).
7684    
7685     PropDef:
7686 wakaba 1.27 @QName: plFullyQualifiedName
7687     @enDesc:
7688     Fully qualified name.
7689 wakaba 1.2
7690 wakaba 1.19 PropDef:
7691     @QName:plDefined
7692     @enDesc:
7693     Whether a Perl definition for this resource is implemented or not.
7694    
7695 wakaba 1.13 ElementTypeBinding:
7696 wakaba 1.15 @Name: BlockElementException
7697     @ElementType:
7698     ManakaiDOM:raises
7699     @ShadowContent:
7700     @@@: PERL_PREPROCESS_NO_EXCEPTION_TYPE_ERR
7701     @@Description:
7702     @@@lang:en
7703     @@@@:
7704     An exception type specification is required but not specified.
7705     @ShadowSibling:
7706     @@ManakaiDOM:raises:
7707     @@@@: PERL_PREPROCESS_NO_CODE_NAME_ERR
7708     @@@Description:
7709     @@@@lang:en
7710     @@@@@:
7711     A code qualified name is required but not specified.
7712     @@ManakaiDOM:raises:
7713     @@@@: RESOURCE_NOT_DEFINED_ERR
7714     @@@Description:
7715     @@@@lang:en
7716     @@@@@:
7717     A referred resource is not defined or has different type.
7718     @@ManakaiDOM:raises:
7719     @@@@: PERL_CODE_NOT_DEFINED_ERR
7720     @@@Description:
7721     @@@@lang:en
7722     @@@@@:
7723     A referred resource does not have its Perl definition.
7724     @@ManakaiDOM:raises:
7725     @@@@: PERL_PREPROCESS_NO_METHOD_ERR
7726     @@@Description:
7727     @@@@lang:en
7728     @@@@@:
7729     A preprocessing instruction which is allowed only in
7730     methods is embeded in a context which is not in any method.
7731     @@ManakaiDOM:raises:
7732     @@@@: PERL_PREPROCESS_NO_FOR_ERR
7733     @@@Description:
7734     @@@@lang:en
7735     @@@@@:
7736     A <QUOTE::for> qualified name is required but not specified.
7737     @@ManakaiDOM:raises:
7738     @@@@: PERL_PREPROCESS_NO_ASSERT_TYPE_ERR
7739     @@@Description:
7740     @@@@lang:en
7741     @@@@@:
7742     An assertion type qualified name is required but not specified.
7743     @@ManakaiDOM:raises:
7744     @@@@: PERL_PREPROCESS_BLOCK_NOT_ALLOWED_ERR
7745     @@@Description:
7746     @@@@lang:en
7747     @@@@@:
7748     A preprocessing instruction block is specified
7749     but not allowed for this element type.
7750    
7751     ElementTypeBinding:
7752 wakaba 1.13 @Name: InlineElementException
7753     @ElementType:
7754     ManakaiDOM:raises
7755     @ShadowContent:
7756     @@@: NO_SOURCE_NODE_ERR
7757     @@Description:
7758     @@@lang:en
7759     @@@@:
7760     This resource definition does not have associated node
7761     in the source tree.
7762     @ShadowSibling:
7763     @@ManakaiDOM:raises:
7764     @@@@: INTERFACE_CLASS_METHOD_ERR
7765     @@@Description:
7766     @@@@lang:en
7767     @@@@@:
7768     An attempt is made to call a class (static) method
7769     via an interface, not class.
7770     @@ManakaiDOM:raises:
7771     @@@@: RESOURCE_NOT_DEFINED_ERR
7772     @@@Description:
7773     @@@@lang:en
7774     @@@@@:
7775     A package, method or attribute is not defined or not
7776     a resoure of that type.
7777     @@ManakaiDOM:raises:
7778     @@@@: NO_LOCAL_NAME_ERR
7779     @@@Description:
7780     @@@@lang:en
7781     @@@@@:
7782     A referred resource does not have its local name so
7783     that it is impossible to refer it by name.
7784     @@ManakaiDOM:raises:
7785     @@@@: RESERVED_PERL_METHOD_NAME_ERR
7786     @@@Description:
7787     @@@@lang:en
7788     @@@@@:
7789     A referred method has its name reserved for special-purpose.
7790     @@ManakaiDOM:raises:
7791     @@@@: BROKEN_PARAM_SPEC_ERR
7792     @@@Description:
7793     @@@@lang:en
7794     @@@@@:
7795     A parameter specification is not well-formed.
7796     @@ManakaiDOM:raises:
7797     @@@@: PERL_PREPROCESS_NO_CODE_NAME_ERR
7798 wakaba 1.14 @@@Description:
7799     @@@@lang:en
7800     @@@@@:
7801     A preprocessing instruction does not contain
7802     Perl code fragment name.
7803 wakaba 1.13 @@ManakaiDOM:raises:
7804     @@@@: PERL_CODE_NOT_DEFINED_ERR
7805 wakaba 1.14 @@@Description:
7806     @@@@lang:en
7807     @@@@@:
7808     The referred resource does not have its Perl definition.
7809 wakaba 1.13 @@ManakaiDOM:raises:
7810     @@@@: PERL_PREPROCESS_NO_ELEMENT_TYPE_ERR
7811 wakaba 1.14 @@@Description:
7812     @@@@lang:en
7813     @@@@@:
7814     A preprocessing instruction does not contain its element type name.
7815 wakaba 1.13 @@ManakaiDOM:raises:
7816     @@@@: UNSUPPORTED_ELEMENT_TYPE_ERR
7817 wakaba 1.14 @@@Description:
7818     @@@@lang:en
7819     @@@@@:
7820     An unknown element type is encounted.
7821     @@ManakaiDOM:raises:
7822     @@@@: NO_PERL_PACKAGE_NAME_ERR
7823     @@@Description:
7824     @@@@lang:en
7825     @@@@@:
7826     No Perl package name is defined for a class or interface.
7827 wakaba 1.13
7828     PropDef:
7829     @QName: ownerClass
7830     @enDesc:
7831     The class to which this resource belongs.
7832     @Type: ResourceURI
7833     @rdfs:range:
7834     rdf:Resource
7835     @rdfs:domain:
7836     ManakaiDOM:Class
7837    
7838 wakaba 1.12 ResourceDef:
7839     @QName: DOMMinImpl
7840     @rdf:type:
7841     ManakaiDOM:IF
7842     @AliasFor:
7843     DOMMetaImpl:ManakaiDOMMinimumImplementationIF::ManakaiDOM:ManakaiDOMLatest
7844    
7845     ResourceDef:
7846 wakaba 1.20 @QName: PLPack
7847     @rdf:type:
7848     ManakaiDOM:Class
7849     @AliasFor:
7850     PerlCode:ManakaiPerlPackageScope::ManakaiDOM:Perl
7851    
7852     ResourceDef:
7853 wakaba 1.12 @QName: SWCFGNode
7854     @rdf:type:
7855     ManakaiDOM:IF
7856     @AliasFor:
7857     swcfg21:SWCFGNode::swcfg21:ForLatest
7858    
7859     ResourceDef:
7860     @QName: SWCFGDoc
7861     @rdf:type:
7862     ManakaiDOM:IF
7863     @AliasFor:
7864     swcfg21:SWCFGDocument::swcfg21:ForLatest
7865    
7866     ResourceDef:
7867     @QName: MPLImpl
7868     @rdf:type:
7869     ManakaiDOM:Class
7870     @AliasFor:
7871     PerlCode:ManakaiPerlCodeImplementation::ManakaiDOM:Perl
7872    
7873     ResourceDef:
7874     @QName: MPLCodeFragment
7875     @rdf:type:
7876     ManakaiDOM:Class
7877     @AliasFor:
7878     PerlCode:ManakaiPerlCodeFragment::ManakaiDOM:Perl
7879    
7880     ResourceDef:
7881 wakaba 1.13 @QName: PLInCon
7882     @rdf:type:
7883     ManakaiDOM:Class
7884     @AliasFor:
7885     PerlCode:ManakaiPerlInlineContainer::ManakaiDOM:Perl
7886    
7887     ResourceDef:
7888 wakaba 1.15 @QName: PLBlockCon
7889     @rdf:type:
7890     ManakaiDOM:Class
7891     @AliasFor:
7892     PerlCode:ManakaiPerlStatementContainer::ManakaiDOM:Perl
7893    
7894     ResourceDef:
7895 wakaba 1.13 @QName: PLAnyCon
7896     @rdf:type:
7897     ManakaiDOM:Class
7898     @AliasFor:
7899     PerlCode:ManakaiPerlAnyContainer::ManakaiDOM:Perl
7900    
7901     ResourceDef:
7902     @QName: MPLSS
7903     @rdf:type:
7904     ManakaiDOM:Class
7905     @AliasFor:
7906     PerlCode:ManakaiPerlStatementContainer::ManakaiDOM:Perl
7907    
7908     ResourceDef:
7909 wakaba 1.12 @QName: MPLSub
7910     @rdf:type:
7911     ManakaiDOM:Class
7912     @AliasFor:
7913     PerlCode:ManakaiPerlSub::ManakaiDOM:Perl
7914    
7915     ResourceDef:
7916     @QName: MPLUnparsedCode
7917     @rdf:type:
7918     ManakaiDOM:Class
7919     @AliasFor:
7920     PerlCode:ManakaiPerlUnparsedCode::ManakaiDOM:Perl
7921    
7922     PropDef:
7923     @QName: plCodeFragment
7924     @enDesc:
7925     Cache for <A::ManakaiDISResourceDefinition.plCodeFragment>.
7926    
7927     XParamDef:
7928     @QName: errResource
7929     @enDesc:
7930     A resource on which an error has occurred.
7931    
7932 wakaba 1.8 XParamDef:
7933     @QName: generatedName
7934     @enDesc:
7935     A generated name.
7936    
7937 wakaba 1.2 ClsDef:
7938     @ClsQName: ManakaiDISPropertyAccessor
7939 wakaba 1.3 @enDesc:
7940 wakaba 1.2 Accessor methods for resource or module properties.
7941    
7942 wakaba 1.22 @Attr:
7943     @@Name:plImplementation
7944     @@enDesc:
7945     The <Class::PerlCode:ManakaiPerlCodeImplementation> object.
7946     @@Type: MPLImpl
7947     @@Get:
7948     @@@enDesc:
7949     The Perl code implementation object.
7950     @@@nullCase:
7951     This resource has no source tree associated.
7952     @@@RaiseException:
7953     @@@@@:NO_PERL_CODE_IMPL_ERR
7954     @@@@enDesc:
7955     There is no implementation that implements
7956     the <Feature::Util:PerlCode> feature, version <FeatureVer::1.0>.
7957     @@@PerlDef:
7958     if ($self->{src}) {
7959     __DEEP{
7960     $r = ($self->{src}-><AG::SWCFGNode.ownerDocument> or
7961     $self->{src})-><AG::SWCFGDoc.implementation>
7962     -><M::DOMMinImpl.getFeature>
7963     (<Q::Util:PerlCode> => '1.0');
7964     }__;
7965     unless (defined $r) {
7966     __EXCEPTION{NO_PERL_CODE_IMPL_ERR::
7967    
7968     }__;
7969     }
7970     }
7971    
7972     @Attr:
7973     @@Name: ownerModule
7974     @@enDesc:
7975     The <QUOTE::dis> module in which this object is defined.
7976     For a <QUOTE::dis> module object, the module itself is the
7977     <QUOTE::owner>.
7978     @@Get:
7979     @@@Type: ManakaiDISModuleDefinition
7980     @@@PerlDef: $r = $self;
7981    
7982     @Attr:
7983     @@Name: sourceElement
7984     @@enDesc:
7985     The source <QUOTE::dis> element node from which this
7986     definition is read.
7987     @@Get:
7988     @@@Type: ManakaiDISElement
7989     @@@InCase:
7990     @@@@Type: ManakaiDISModuleElement
7991     @@@@enDesc: If this resource is a module.
7992     @@@PerlDef: $r = $self->{src};
7993     @@@nullCase:
7994     @@@@enDesc:
7995     The definition is not yet read.
7996    
7997 wakaba 1.2 @Method:
7998 wakaba 1.8 @@Name: getPropertyBoolean
7999     @@enDesc:
8000     Gets boolean property value.
8001     @@PropNameParam:
8002     @@Param:
8003     @@@Name:default
8004     @@@Type:
8005     DOMMain:boolean::ManakaiDOM:all
8006     @@@enDesc:
8007     The default value that is returned if no explicit property
8008     value specification found for this resource.
8009     @@Return:
8010     @@@Type:
8011     DOMMain:boolean::ManakaiDOM:all
8012     @@@enDesc:
8013     The property value.
8014     @@@PerlDef:
8015     if (exists $self->{$propName}) {
8016     $r = defined $self->{$propName} ? $self->{$propName} : $default;
8017     } elsif ($self->{src}) {
8018 wakaba 1.18 my $attr_node = $self->{src}-><M::ManakaiDISElement.disGetAttribute>
8019 wakaba 1.8 ($propName, for_arg => $self->{for},
8020     forp_arg => $self->{forp});
8021 wakaba 1.18 $r = $self->{$propName} = ($attr_node
8022     ? ($attr_node-><M::SWCFGNode.value>
8023     ? true : false)
8024     : null);
8025 wakaba 1.8 $r = $default unless defined $r;
8026     } else {
8027     $r = $default;
8028     }
8029    
8030     @Method:
8031 wakaba 1.2 @@Name: getPropertyText
8032     @@enDesc:
8033     Gets property value text.
8034     @@PropNameParam:
8035     @@Param:
8036     @@@Name:default
8037     @@@Type:
8038 wakaba 1.3 swcfg21:SWCFGString::swcfg21:ForLatest
8039 wakaba 1.2 @@@enDesc:
8040     The default value that is returned if no explicit property
8041     value specification found for this resource.
8042     @@@nullCase:
8043     @@@@enDesc:
8044     No default value supplied; <DOM::null> is returned if
8045     no value specified.
8046     @@Return:
8047     @@@Type:
8048 wakaba 1.3 swcfg21:SWCFGString::swcfg21:ForLatest
8049 wakaba 1.2 @@@enDesc:
8050     The property value string.
8051     @@@nullCase:
8052     @@@@enDesc:
8053     No value nor default value has specified.
8054     @@@PerlDef:
8055     if (exists $self->{$propName}) {
8056     $r = defined $self->{$propName} ? $self->{$propName} : $default;
8057     } elsif ($self->{src}) {
8058     $r = $self->{src}-><M::ManakaiDISElement.disGetAttribute>
8059     ($propName, for_arg => $self->{for},
8060     forp_arg => $self->{forp});
8061 wakaba 1.8 if ($r) {
8062     $r = $self->{$propName}
8063 wakaba 1.14 = $r-><M::swcfg21:SWCFGNode::swcfg21:ForLatest.value>;
8064 wakaba 1.8 $r = $default unless defined $r;
8065     } else {
8066     $r = $default;
8067     $self->{$propName} = null;
8068     }
8069 wakaba 1.2 } else {
8070     $r = $default;
8071     }
8072    
8073     @Method:
8074     @@Name: getPropertyResource
8075     @@enDesc:
8076     Gets property value resource.
8077     @@PropNameParam:
8078 wakaba 1.10 @@NamedParam:
8079     @@@Name: defaultMediaType
8080     @@@Type: ResourceURI
8081     @@@enDesc:
8082     The URI reference of the default media type which is used
8083     when the property value is retrieved from the source tree
8084     and the source tree element does not have its <Q::dis:ContentType>
8085     attribute specified.
8086     @@@nullCase:
8087     @@@@enDesc:
8088     Defaulted to <Q::dis:TypeQName>.
8089 wakaba 1.2 @@Return:
8090     @@@Type: ManakaiDISResourceDefinition
8091     @@@enDesc:
8092     The property value resource.
8093     @@@nullCase:
8094     @@@@enDesc:
8095     No value has specified.
8096 wakaba 1.8 @@@UndeclaredPrefixException:
8097 wakaba 1.12 @@@RaiseException:
8098     @@@@@:UNSUPPORTED_MEDIA_TYPE_ERR
8099     @@@@enDesc:
8100     The media type of the attribute node in the source tree
8101     corresponding to this resource is not supported.
8102 wakaba 1.2 @@@PerlDef:
8103     if (defined $self->{$propName}) {
8104 wakaba 1.9 $r = $self->{db}-><M::ManakaiDISDatabase.getResource>
8105     ($self->{$propName});
8106 wakaba 1.8 } elsif ($self->{src}) {
8107     __DEEP{
8108     $r = $self->{src}-><M::ManakaiDISElement.disGetAttribute>
8109     ($propName, for_arg => $self->{for},
8110     forp_arg => $self->{forp});
8111     if ($r) {
8112 wakaba 1.10 $defaultMediaType = <Q::dis:TypeQName>
8113     unless defined $defaultMediaType;
8114     if ($r-><M::ManakaiDISElement.mediaTypeMatch>
8115 wakaba 1.12 (<Q::dis:TypeQName>, $defaultMediaType,
8116     for_arg => $self->{for},
8117     forp_arg => $self->{forp})) {
8118 wakaba 1.10 $self->{$propName}
8119     = $r-><AG::ManakaiDISElement.qnameValueURI>;
8120     } elsif ($r-><M::ManakaiDISElement.mediaTypeMatch>
8121 wakaba 1.12 (<Q::dis:TFQNames>, $defaultMediaType,
8122     for_arg => $self->{for},
8123     forp_arg => $self->{forp})) {
8124 wakaba 1.10 $self->{$propName}
8125     = $r-><M::ManakaiDISElement.tfqnamesValueURI>
8126 wakaba 1.32 ($self->{<Q::DIS:sourceNodeID>},
8127 wakaba 1.33 $self->{for},
8128     for_arg => $self->{for},
8129     forp_arg => $self->{forp});
8130 wakaba 1.10 } else {
8131     my $mt = $r-><M::ManakaiDISElement.mediaTypeURI>
8132     (for_arg => $self->{for},
8133     forp_arg => $self->{forp});
8134     __UNDEEP{
8135     __EXCEPTION{UNSUPPORTED_MEDIA_TYPE_ERR::
8136     DIS:uri => {$mt},
8137     DIS:sourceNode => {$r},
8138     }__;
8139     }__;
8140     }
8141 wakaba 1.9 $r = $self->{db}-><M::ManakaiDISDatabase.getResource>
8142     ($self->{$propName});
8143 wakaba 1.14 $r-><AS::ManakaiDISResourceDefinition.isReferred> ($self->{src});
8144 wakaba 1.8 }
8145     }__;
8146 wakaba 1.2 }
8147    
8148     @Method:
8149 wakaba 1.10 @@Name: getPropertyResourceList
8150     @@enDesc:
8151     Gets property value resource list.
8152     @@PropNameParam:
8153     @@NamedParam:
8154 wakaba 1.24 @@@Name: recursive
8155     @@@Type:
8156     DOMMain:boolean::ManakaiDOM:all
8157     @@@enDesc:
8158     Whether property resource values of this resource
8159     should also be included to the returned list or not.
8160     @@NamedParam:
8161 wakaba 1.10 @@@Name: recursiveISA
8162     @@@Type:
8163 wakaba 1.18 DOMMain:boolean::ManakaiDOM:all
8164 wakaba 1.10 @@@enDesc:
8165 wakaba 1.26 Whether the <Q::dis:ISA> ancestors of the resources
8166     that are property values should also be included in the returned list
8167     or not.
8168     @@@TrueCase:
8169     @@@@enDesc:
8170     If a property value is a resource <VAR::R> and
8171     the resource <VAR::R> <Q::dis:ISA>'s (or inherits) <VAR::S>, then
8172     the resource <VAR::S> is also a value in the list.
8173     @@@FalseCase:
8174     @@@@enDesc:
8175     Only the resources directly specified as property values is returned.
8176     @@NamedParam:
8177     @@@Name: isaRecursive
8178     @@@Type:
8179     DOMMain:boolean::ManakaiDOM:all
8180     @@@enDesc:
8181     Whether property resource values of <Q::dis:ISA> resources
8182     of this resource should also be included to the returned list or not.
8183     @@@TrueCase:
8184     @@@@enDesc:
8185     If this resource <Q::dis:ISA>'s (or inherits) another resource
8186     <VAR::S> and the <VAR::S> resource has a <P::propName>
8187     property value of <VAR::R>, then the resource <VAR::R>
8188     is also a value in the list.
8189     @@@FalseCase:
8190     @@@@enDesc:
8191     Only the resource directly specified is the returned.
8192 wakaba 1.10 @@NamedParam:
8193     @@@Name: defaultMediaType
8194     @@@Type: ResourceURI
8195     @@@enDesc:
8196     The URI reference of the default media type which is used
8197     when the property value is retrieved from the source tree
8198     and the source tree element does not have its <Q::dis:ContentType>
8199     attribute specified.
8200     @@@nullCase:
8201     @@@@enDesc:
8202     Defaulted to <Q::dis:TypeQName>.
8203     @@Return:
8204     @@@Type: ResourceList
8205     @@@enDesc:
8206     An array reference of the property value resources.
8207     \
8208     {NOTE:: This list is <QUOTE::dead>.
8209     \
8210     }
8211     @@@UndeclaredPrefixException:
8212 wakaba 1.12 @@@RaiseException:
8213     @@@@@:UNSUPPORTED_MEDIA_TYPE_ERR
8214     @@@@enDesc:
8215     The media type of the attribute node in the source tree
8216     corresponding to this resource is not supported.
8217 wakaba 1.10 @@@PerlDef:
8218     $r = [];
8219     if (defined $self->{$propName}) {
8220 wakaba 1.26 for my $res_uri (@{ref $self->{$propName} eq 'ARRAY'
8221 wakaba 1.10 ? $self->{$propName} : []}) {
8222     push @$r,
8223 wakaba 1.26 $self->{db}-><M::ManakaiDISDatabase.getResource> ($res_uri);
8224 wakaba 1.10 }
8225     } elsif ($self->{src}) {
8226     __DEEP{
8227     $self->{$propName} = [];
8228     $defaultMediaType = <Q::dis:TypeQName>
8229     unless defined $defaultMediaType;
8230     for my $res_name_node
8231     (@{$self->{src}-><M::ManakaiDISElement.disGetAttributeList>
8232     ($propName, for_arg => $self->{for},
8233     forp_arg => $self->{forp})}) {
8234     my $res_uri;
8235     if ($res_name_node-><M::ManakaiDISElement.mediaTypeMatch>
8236 wakaba 1.12 (<Q::dis:TypeQName>, $defaultMediaType,
8237     for_arg => $self->{for},
8238     forp_arg => $self->{forp})) {
8239 wakaba 1.10 $res_uri = $res_name_node-><AG::ManakaiDISElement.qnameValueURI>;
8240     } elsif ($res_name_node-><M::ManakaiDISElement.mediaTypeMatch>
8241 wakaba 1.12 (<Q::dis:TFQNames>, $defaultMediaType,
8242     for_arg => $self->{for},
8243     forp_arg => $self->{forp})) {
8244 wakaba 1.10 $res_uri =$res_name_node-><M::ManakaiDISElement.tfqnamesValueURI>
8245 wakaba 1.32 ($self->{<Q::DIS:sourceNodeID>},
8246 wakaba 1.33 $self->{for},
8247     for_arg => $self->{for},
8248     forp_arg => $self->{forp});
8249     } elsif ($res_name_node-><M::ManakaiDISElement.mediaTypeMatch>
8250     (<Q::DISCore:TFPQNames>, $defaultMediaType,
8251     for_arg => $self->{for},
8252     forp_arg => $self->{forp})) {
8253     $res_uri=$res_name_node-><M::ManakaiDISElement.tfqnamesValueURI>
8254     ($self->{<Q::DIS:sourceNodeID>},
8255     $self->{for},
8256     for_arg => $self->{for},
8257     forp_arg => $self->{forp});
8258 wakaba 1.10 } else {
8259     my $mt = $res_name_node-><M::ManakaiDISElement.mediaTypeURI>
8260     (for_arg => $self->{for},
8261     forp_arg => $self->{forp});
8262     __UNDEEP{
8263     __EXCEPTION{UNSUPPORTED_MEDIA_TYPE_ERR::
8264     DIS:uri => {$mt},
8265     DIS:sourceNode => {$res_name_node},
8266     }__;
8267     }__;
8268     }
8269 wakaba 1.26 push @{$self->{$propName}}, $res_uri;
8270 wakaba 1.10 my $res = $self->{db}-><M::ManakaiDISDatabase.getResource>
8271     ($res_uri);
8272     push @$r, $res;
8273 wakaba 1.14 $res-><AS::ManakaiDISResourceDefinition.isReferred>
8274 wakaba 1.10 ($res_name_node);
8275 wakaba 1.32 if ($isaRecursive) {
8276     my $stop_rec = $res_name_node-><M::ManakaiDISElement
8277     .disGetAttribute>
8278     (<Q::DISCore:stopISARecursive>,
8279     for_arg => $self->{for},
8280     forp_arg => $self->{forp});
8281     $isaRecursive = false
8282     if $stop_rec and $stop_rec-><M::SWCFGNode.value>;
8283     }
8284 wakaba 1.10 }
8285     }__;
8286     }
8287 wakaba 1.24 if ($recursive) {
8288     __DEEP{
8289     $opt{___recursive_isa_done} ||= {$self->{uri} => true};
8290     my @p_res = @$r;
8291     for my $p_res (@p_res) {
8292     next if $opt{___recursive_isa_done}->{$p_res->{uri}};
8293     $opt{___recursive_isa_done}->{$p_res->{uri}} = true;
8294     push @$r, @{$p_res-><M::ManakaiDISPropertyAccessor
8295     .getPropertyResourceList>
8296     ($propName, recursive => true,
8297     recursive_isa => $recursiveISA,
8298     ___recursive_isa_done => $opt{___recursive_isa_done},
8299     default_media_type => $defaultMediaType)};
8300     }
8301     }__;
8302     }
8303 wakaba 1.10 if ($recursiveISA) {
8304     __DEEP{
8305     $opt{___recursive_isa_done} ||= {$self->{uri} => true};
8306     my @p_res = @$r;
8307     for my $p_res (@p_res) {
8308     next if $opt{___recursive_isa_done}->{$p_res->{uri}};
8309     $opt{___recursive_isa_done}->{$p_res->{uri}} = true;
8310     push @$r, @{$p_res-><M::ManakaiDISPropertyAccessor
8311     .getPropertyResourceList>
8312 wakaba 1.33 (<Q::dis:ISA>,
8313     recursive => true,
8314 wakaba 1.10 ___recursive_isa_done => $opt{___recursive_isa_done},
8315     default_media_type => $defaultMediaType)};
8316     }
8317     }__;
8318     }
8319 wakaba 1.26 if ($isaRecursive) {
8320 wakaba 1.25 __DEEP{
8321     $opt{___recursive_isa_done} ||= {$self->{uri} => true};
8322 wakaba 1.26 my @p_res = @{$self-><M::ManakaiDISPropertyAccessor
8323     .getPropertyResourceList>
8324     (<Q::dis:ISA>, recursive_isa => false,
8325     recursive => true,
8326     default_media_type => <Q::dis:TFQNames>)};
8327 wakaba 1.25 for my $p_res (@p_res) {
8328     push @$r, @{$p_res-><M::ManakaiDISPropertyAccessor
8329 wakaba 1.26 .getPropertyResourceList>
8330     ($propName, recursive_isa => false,
8331     recursive => false,
8332     default_media_type => $defaultMediaType)};
8333 wakaba 1.25 }
8334     }__;
8335     }
8336    
8337     @Method:
8338 wakaba 1.2 @@Name: addPropertyResourceList
8339     @@enDesc:
8340     Adds a resource to a resource-list property value.
8341     \
8342     {ISSUE:: Should an exception be thrown if the property is
8343     not of list?
8344     \
8345     }
8346 wakaba 1.10 \
8347     {NOTE:: If the property is not <QUOTE::get>ten ever, adding
8348     an item clears the list --- i.e. the property values
8349     in the source tree will be ignored. Call
8350     <M::ManakaiDISPropertyAccessor.getPropertyResourceList>
8351     before adding to avoid this behavior.
8352     \
8353     }
8354 wakaba 1.2 @@PropNameParam:
8355     @@Param:
8356     @@@Name: res
8357     @@@Type: ManakaiDISResourceDefinition
8358     @@@enDesc:
8359     A resource to add.
8360     @@Return:
8361     @@@PerlDef:
8362     if (ref $self->{$propName} eq 'ARRAY') {
8363 wakaba 1.26 push @{$self->{$propName}}, $res->{uri};
8364 wakaba 1.2 } elsif (not defined $self->{$propName}) {
8365 wakaba 1.26 $self->{$propName} = [$res->{uri}];
8366 wakaba 1.25 } else {
8367     __ASSERT{DISPerl:invariant::
8368     msg => {q[ref $self->{<].qq[$propName>} = "@{[ref
8369     $self->{$propName}]}"]},
8370     }__;
8371 wakaba 1.2 }
8372    
8373 wakaba 1.3 ElementTypeBinding:
8374     @Name: PropNameParam
8375     @ElementType:
8376     dis:ResourceDef
8377     @ShadowContent:
8378     @@rdf:type:
8379     DISLang:MethodParameter
8380     @@Name: propName
8381     @@Type: ResourceURI
8382     @@Description:
8383     @@@lang:en
8384     @@@@:
8385     The name of the property.
8386    
8387 wakaba 1.2 ##DISPropertyAccessor
8388    
8389     PropDef:
8390     @QName:isAnon
8391     @Description:
8392     @@lang:en
8393     @@@:
8394     Whether the subject resource is anonymous or not.
8395     @Type:
8396 wakaba 1.18 DOMMain:boolean::ManakaiDOM:all
8397 wakaba 1.2
8398     PropDef:
8399     @QName:isDefined
8400     @Description:
8401     @@lang:en
8402     @@@:
8403     Whether the subject resource is defined or not.
8404    
8405     PropDef:
8406 wakaba 1.3 @QName:isReferred
8407 wakaba 1.2 @Description:
8408     @@lang:en
8409     @@@:
8410     Whether the subject resource is referred or not.
8411     @Type:
8412     DOMMain:any
8413    
8414     PropDef:
8415     @QName:definingModule
8416     @Description:
8417     @@lang:en
8418     @@@:
8419     The <QUOTE::dis> module in which the subject resource is defined.
8420 wakaba 1.22 \
8421     {NOTE:: The local name should have been <QUOTE::ownerModule> or some.
8422     \
8423     }
8424 wakaba 1.2 @rdfs:domain:
8425     DISCore:Module
8426 wakaba 1.1
8427     ## -- Datatypes
8428    
8429     URITypeDef:
8430 wakaba 1.3 @QName: AnyURI
8431     @Description:
8432     @@lang:en
8433     @@@:
8434     Any URI references.
8435    
8436     URITypeDef:
8437     @QName: FileURI
8438     @enDesc:
8439     URI references identifying file.
8440    
8441     URITypeDef:
8442 wakaba 1.1 @QName: ForURI
8443     @Description:
8444     @@lang:en
8445     @@@:
8446     <QUOTE::For> URI references.
8447    
8448     DataTypeDef:
8449     @QName: ForURIList
8450     @Description:
8451     @@lang:en
8452     @@@:
8453     References to the array containing <QUOTE::for> URI references.
8454    
8455     URITypeDef:
8456 wakaba 1.3 @QName: ResourceURI
8457     @Description:
8458     @@lang:en
8459     @@@:
8460     A URI reference for a <QUOTE::dis> resource.
8461    
8462     URITypeDef:
8463 wakaba 1.1 @QName: MediaTypeURI
8464     @Description:
8465     @@lang:en
8466     @@@:
8467     Media type URI references.
8468 wakaba 1.3 @rdfs:subClassOf: ResourceURI
8469    
8470     URITypeDef:
8471     @QName: ModuleURI
8472     @enDesc:
8473     URI references for <QUOET::dis> modules.
8474     @rdfs:subClassOf: ResourceURI
8475    
8476     URITypeDef:
8477     @QName: NameURI
8478     @enDesc:
8479     URI references identifying a resource.
8480     @rdfs:subClassOf: ResourceURI
8481 wakaba 1.10
8482     DataTypeDef:
8483     @QName: ResourceList
8484     @enDesc:
8485     References to array containing resource definition objects.
8486     @rdfs:subClassOf:
8487     Perl:ARRAY::ManakaiDOM:all
8488 wakaba 1.3
8489     ElementTypeBinding:
8490     @Name: DataTypeDef
8491     @ElementType:
8492     dis:ResourceDef
8493     @ShadowContent:
8494     @@rdf:type:
8495     ManakaiDOM:DataType
8496    
8497     ElementTypeBinding:
8498     @Name: URITypeDef
8499     @ElementType:
8500     dis:ResourceDef
8501     @ShadowContent:
8502     @@rdf:type:
8503     ManakaiDOM:DataType
8504     @@rdfs:subClassOf: AnyURI
8505 wakaba 1.1
8506     ## -- Exceptions
8507    
8508     XParamDef:
8509 wakaba 1.5 @QName: anotherSourceNode
8510     @enDesc:
8511     Another source node in which an error has occurred. In cases
8512     of <QUOTE::already defined> errors, it is the node that
8513     defines the resource first.
8514     @Type: ManakaiDISNode
8515 wakaba 1.3
8516 wakaba 1.12 ResourceDef:
8517     @QName: UNDECLARED_NS_PREFIX_ERR
8518     @For: ForLatest
8519     @AliasFor:
8520     DIS:UNDECLARED_NS_PREFIX_ERR::swcfg21:ForLatest
8521    
8522 wakaba 1.3 ExceptionDef:
8523     @ClsQName: ManakaiDISException
8524     @enDesc:
8525     Exceptions for the <QUOTE::dis> operations.
8526 wakaba 1.4 @ClsISA:
8527     ManakaiDOM:ManakaiDOMException::ManakaiDOM:Perl
8528 wakaba 1.3 @XConstGroupDef:
8529     @@ClsQName: ManakaiDISExceptionCode
8530     @@enDesc:
8531     Exception codes for <Class::ManakaiDISException>.
8532     @@XConstDef:
8533 wakaba 1.11 @@@Name: HIERARCHY_REQUEST_ERR
8534     @@@Value:3
8535     @@@enDesc:
8536     An attempt is made to break the hierarchy.
8537     @@@XSubTypeDef:
8538     @@@@QName: MERGE_ITSELF_ERR
8539     @@@@enDesc:
8540     An attempt is made to merge the resource to itself.
8541     @@@@XSourceNodeParam:
8542     @@@@XParam:
8543     @@@@@QName:uri
8544     @@@@@enDesc:
8545     The URI reference of the resource to merge.
8546     @@@@enMufDef:
8547     An attempt is made to merge the resource <%p (name => {<Q::DIS:uri>}
8548     );> to itself
8549     @@XConstDef:
8550 wakaba 1.8 @@@Name: NOT_SUPPORTED_ERR
8551     @@@Value:9
8552     @@@enDesc:
8553     An attempt is made to do something the implementation does not support.
8554     @@@XSubTypeDef:
8555     @@@@QName: UNSUPPORTED_MEDIA_TYPE_ERR
8556     @@@@enDesc:
8557     The implementation does not support the media type.
8558     @@@@XParam:
8559     @@@@@QName: uri
8560     @@@@@enDesc:
8561     The URI reference of the media type that is not supported.
8562     @@@@XSourceNodeParam:
8563 wakaba 1.30 @@@@XParam:
8564     @@@@@QName:elementType
8565     @@@@@enDesc:
8566     The URI reference of the element type of the element
8567     in which the media type is referenced.
8568 wakaba 1.12 @@@@enMufDef:
8569 wakaba 1.30 %p (name => {<Q::DIS:sourceCode>}, prefix => {"}, suffix => {": }
8570     );%p (name => {<Q::DIS:elementType>}, prefix => { (Element type: <},
8571     suffix => {>) }
8572     );Media type <%p (name => {<Q::DIS:uri>});> is not supported
8573 wakaba 1.3 @@@XSubTypeDef:
8574 wakaba 1.13 @@@@QName: UNSUPPORTED_ELEMENT_TYPE_ERR
8575     @@@@enDesc:
8576     An unsupported type of element is encounted.
8577     @@@@XSourceNodeParam:
8578     @@@@XParam:
8579     @@@@@QName:elementType
8580     @@@@@enDesc:
8581     The element type URI reference of the element.
8582 wakaba 1.16 @@@@enMufDef:
8583     Element type "%p (name => {<Q::DIS:elementType>});" is not supported
8584 wakaba 1.13 @@@XSubTypeDef:
8585 wakaba 1.12 @@@@QName: NO_PERL_CODE_IMPL_ERR
8586 wakaba 1.3 @@@@enDesc:
8587 wakaba 1.12 There is no implementation that supports the
8588     <Feature::Util:PerlCode> feature, version
8589     <FeatureVer::1.0>.
8590 wakaba 1.3 @@XConstDef:
8591     @@@Name: INVALID_STATE_ERR
8592     @@@Value:11
8593     @@@enDesc:
8594     An attempt is made to use an object that is not (or no longer) usable.
8595     @@@XSubTypeDef:
8596     @@@@QName: NO_ASSOCIATED_DB_ERR
8597     @@@@enDesc:
8598     No <QUOTE::dis> database has been associated with this document.
8599 wakaba 1.4 @@XConstDef:
8600     @@@Name: INVALID_SOURCE_ERR
8601     @@@Value: 200
8602     @@@enDesc:
8603     The source input is well-formed but invalid.
8604     @@@XSubTypeDef:
8605     @@@@QName: NO_MODULE_QNAME_ERR
8606     @@@@enDesc:
8607     The <Q::dis:Module> element must have its <Q::dis:QName>
8608     attribute.
8609 wakaba 1.8 @@@@XSourceNodeParam:
8610     @@@XSubTypeDef:
8611     @@@@QName: NO_LOCAL_NAME_ERR
8612     @@@@enDesc:
8613     The resource does not have a local name.
8614     @@@@XSourceNodeParam:
8615 wakaba 1.4 @@@XSubTypeDef:
8616     @@@@QName: UNABLE_TO_GET_MODULE_ERR
8617     @@@@enDesc:
8618     The implementation is unable to get the module source.
8619     @@@@Def:
8620     @@@@@ContentType:
8621     lang:muf
8622     @@@@@lang:en
8623     @@@@@@:
8624     Unable to get the module source of <%p (name => {<Q::DIS:uri>});>
8625     @@@@XParam:
8626     @@@@@QName: uri
8627     @@@@@enDesc:
8628     The URI reference of the module.
8629     @@@@XParam:
8630     @@@@@QName: namespaceURI
8631     @@@@@enDesc:
8632     The namespace URI of the module name.
8633     @@@@XParam:
8634     @@@@@QName: localName
8635     @@@@@enDesc:
8636     The local name of the module name.
8637     @@@@XParam:
8638     @@@@@QName: for
8639     @@@@@enDesc:
8640     The <QUOTE::for> of the module.
8641 wakaba 1.5 @@@XSubTypeDef:
8642     @@@@QName: NO_FOR_QNAME_ERR
8643     @@@@enDesc:
8644     A <Q::dis:ForDef> element must have <Q::dis:QName> attribute.
8645     @@@@XSourceNodeParam:
8646     @@@XSubTypeDef:
8647     @@@@QName: FOR_ALREADY_DEFINED_ERR
8648     @@@@enDesc:
8649     The <QUOTE::for> named as the same URI reference has
8650     already defined.
8651     @@@@XSourceNodeParam:
8652     @@@@XParam:
8653     @@@@@QName: anotherSourceNode
8654     @@@@@enDesc:
8655     The node that defines the <QUOTE::for> URI reference before.
8656 wakaba 1.7 @@@@XParam:
8657     @@@@@Name: uri
8658     @@@@@enDesc:
8659     The URI reference of the <QUOTE::for> attempted to define.
8660     @@@@enMufDef:
8661     <QUOTE::For> <%p (name => {<Q::DIS:uri>});> is already defined
8662 wakaba 1.5 @@@XSubTypeDef:
8663     @@@@QName: RESOURCE_ALREADY_DEFINED_ERR
8664     @@@@enDesc:
8665     The <QUOTE::dis> resource named as the same URI reference has
8666     already defined.
8667     @@@@XSourceNodeParam:
8668     @@@@XParam:
8669     @@@@@QName: anotherSourceNode
8670     @@@@@enDesc:
8671     The node that defines the <QUOTE::for> URI reference before.
8672 wakaba 1.7 @@@@XParam:
8673     @@@@@Name: uri
8674     @@@@@enDesc:
8675     The URI reference of the resource attempted to define.
8676     @@@@enMufDef:
8677     Resource <%p (name => {<Q::DIS:uri>});> is already defined
8678 wakaba 1.5 @@@XSubTypeDef:
8679     @@@@QName: ELEMENT_NOT_ALLOWED_ERR
8680     @@@@enDesc:
8681     An element has occured where it is not allowed.
8682     @@@@enMufDef:
8683     Module <%p (name => {<Q::DIS:uri>});>:
8684     Element of type <%p (name => {<Q::DIS:elementType>});>
8685     is not allowed here
8686     @@@@XSourceNodeParam:
8687     @@@@XParam:
8688     @@@@@QName: elementType
8689     @@@@@enDesc:
8690     The expanded element type name of the element.
8691     @@@@XParam:
8692     @@@@@QName: uri
8693     @@@@@enDesc:
8694     The URI reference of the module.
8695 wakaba 1.7 @@@XSubTypeDef:
8696     @@@@QName: NO_REQUIRED_ATTR_ERR
8697     @@@@enDesc:
8698     A required attribute is not specified.
8699     @@@@XSourceNodeParam:
8700     @@@@XParam:
8701     @@@@@QName: elementType
8702     @@@@@enDesc:
8703     The expanded URI reference of the attribute name.
8704     @@@@enMufDef:
8705     Attribute <%p (name => {<Q::DIS:elementType>});> must be specified
8706 wakaba 1.8 @@@XSubTypeDef:
8707     @@@@QName: FOR_NOT_DEFINED_ERR
8708     @@@@enDesc:
8709     A <QUOTE::for> is referred but not defined.
8710     @@@@XSourceNodeParam:
8711     @@@@XParam:
8712     @@@@@QName: uri
8713     @@@@@enDesc:
8714     The URI reference of the <QUOTE::for> that is not defined.
8715     @@@@enMufDef:
8716     <QUOTE::For> <%p (name => {<Q::DIS:uri>});> is not defined
8717     @@@XSubTypeDef:
8718     @@@@QName: RESOURCE_NOT_DEFINED_ERR
8719     @@@@enDesc:
8720 wakaba 1.13 A <QUOTE::dis> resource is referred but not defined
8721     or the resource referred does not have the type expected.
8722 wakaba 1.8 @@@@XSourceNodeParam:
8723     @@@@XParam:
8724     @@@@@QName: uri
8725     @@@@@enDesc:
8726     The URI reference of the resource that is not defined.
8727 wakaba 1.13 @@@@XParam:
8728     @@@@@QName: elementType
8729     @@@@@enDesc:
8730     <QUOTE::dis> element type (either tree element type
8731     or preprocessing element type) of the element
8732     in which a reference to the undefined resource is contained.
8733     @@@@XParam:
8734 wakaba 1.30 @@@@@QName:parentURI
8735     @@@@@enDesc:
8736     The URI reference of the resource from whose child resources
8737     a resource is tried to find.
8738     @@@@XParam:
8739 wakaba 1.13 @@@@@QName: localName
8740     @@@@@enDesc:
8741     The local name of the undefined resource.
8742     @@@@XParam:
8743     @@@@QName: sourceCode
8744     @@@@enDesc:
8745     Source code fragment that referres this resource.
8746     @@@@XParam:
8747     @@@@@QName:expectedType
8748     @@@@@enDesc:
8749     Expected resource type.
8750 wakaba 1.8 @@@@enMufDef:
8751 wakaba 1.14 %p (name => {<Q::DIS:sourceCode>}, prefix => {"}, suffix => {": });
8752 wakaba 1.30 %p (name => {<Q::DIS:parentURI>}, prefix => {(In <}, suffix => {>) });
8753 wakaba 1.13 Resource%p (name => {<Q::DIS:uri>}, prefix => { <},
8754     suffix => {>});%p (name => {<Q::DIS:localName>},
8755     prefix => { "}, suffix => {"}); is not defined or wrong type%p
8756     (name => {<Q::DIS:expectedType>}, prefix => { (<},
8757     suffix => {> is expected)});
8758     @@@XSubTypeDef:
8759     @@@@QName: NO_SOURCE_NODE_ERR
8760     @@@@enDesc:
8761     A resource does not have associated node in the source tree.
8762     @@@@XSourceNodeParam:
8763     @@@@XParam:
8764     @@@@@QName:uri
8765     @@@@@enDesc:
8766     The URI reference of the resource.
8767 wakaba 1.8 @@@XSubTypeDef:
8768     @@@@QName: RESERVED_PERL_METHOD_NAME_ERR
8769     @@@@enDesc:
8770     A reserved Perl method name is used.
8771     @@@@XParam:
8772     @@@@@QName:uri
8773     @@@@@enDesc:
8774     The URI reference of the method resource.
8775     @@@@XSourceNodeParam:
8776     @@@@XParam:
8777     @@@@@QName: generatedName
8778     @@@@@enDesc:
8779     A reserved method name.
8780     @@@XSubTypeDef:
8781     @@@@QName: NO_DIS_TYPE_ERR
8782     @@@@enDesc:
8783     <Q::dis:Type> attribute is not found.
8784     @@@@XSourceNodeParam:
8785 wakaba 1.12 @@@XSubTypeDef:
8786     @@@@QName: NO_METHOD_RETURN_ERR
8787     @@@@enDesc:
8788     A <Q::DISLang:Method> resource does not have any
8789     <Q::DISLang:MethodReturn> child.
8790     @@@@XSourceNodeParam:
8791 wakaba 1.22 @@@@XParam:
8792     @@@@@QName:errResource
8793     @@@@@enDesc: The method resource.
8794     @@@@XParam:
8795     @@@@@QName:uri
8796     @@@@@enDesc:
8797     The URI reference of the method.
8798     @@@@XParam:
8799     @@@@@QName:localName
8800     @@@@@enDesc:
8801     The local name of the resource.
8802     @@@@enMufDef:
8803     Method "%p (name => {<Q::DIS:localName>});" does not have
8804     "Return" child
8805 wakaba 1.12 @@@XSubTypeDef:
8806     @@@@QName: NO_ATTR_GET_ERR
8807     @@@@enDesc:
8808     A <Q::DISLang:Attribute> resource does not have any
8809     <Q::DISLang:AttributeGet> child.
8810     @@@@XSourceNodeParam:
8811 wakaba 1.13 @@@XSubTypeDef:
8812     @@@@QName:INTERFACE_CLASS_METHOD_ERR
8813     @@@@enDesc:
8814     An attempt is made to call a static (class) method
8815     from an interface.
8816     @@@@XSourceNodeParam:
8817     @@@@XParam:
8818     @@@@@QName:uri
8819     @@@@@enDesc:
8820     The URI reference of the interface.
8821     @@@@XParam:
8822     @@@@@QName:sourceCode
8823     @@@@@enDesc:
8824     Source code fragment that calls a class method.
8825     @@@@XParam:
8826     @@@@@QName:elementType
8827     @@@@@enDesc:
8828     The element type URI reference of the element
8829     that calls a method.
8830     @@@XSubTypeDef:
8831     @@@@QName: BROKEN_PARAM_SPEC_ERR
8832     @@@@enDesc:
8833     A parameter specification is broken.
8834     @@@@XParam:
8835     @@@@@QName: sourceCode
8836     @@@@@enDesc:
8837     Source code fragment that contains the broken parameter
8838     specification.
8839     @@@@XSourceNodeParam:
8840 wakaba 1.15 @@@@enMufDef:
8841     %p (name => {<Q::DIS:sourceCode>}, prefix => {"},
8842     suffix => {": });Broken parameter specification
8843 wakaba 1.13 @@@XSubTypeDef:
8844     @@@@QName:PERL_PREPROCESS_NO_ELEMENT_TYPE_ERR
8845     @@@@enDesc:
8846     A preprocessing instruction does not have its element
8847     type.
8848     @@@@XSourceNodeParam:
8849     @@@@XParam:
8850     @@@@@QName:sourceCode
8851     @@@@@enDesc:
8852     Source code fragment.
8853 wakaba 1.16 @@@@enMufDef:
8854     %p (name => {<Q::DIS:sourceCode>}, prefix => {"},
8855     suffix => {": });Element type name is not specified
8856 wakaba 1.13 @@@XSubTypeDef:
8857 wakaba 1.15 @@@@QName: NO_PERL_PACKAGE_NAME_ERR
8858 wakaba 1.13 @@@@enDesc:
8859 wakaba 1.15 No Perl package name is defined for the resource referred.
8860 wakaba 1.13 @@@@XSourceNodeParam:
8861     @@@@XParam:
8862 wakaba 1.15 @@@@@QName:sourceCode
8863 wakaba 1.13 @@@@@enDesc:
8864     Source code fragment.
8865     @@@@XParam:
8866 wakaba 1.15 @@@@@QName:uri
8867     @@@@@enDesc:
8868     THe URI reference of the resource referred.
8869     @@@@XParam:
8870     @@@@@QName:elementType
8871     @@@@@enDesc:
8872     The element type of Perl preprocessing instruction
8873     in which the resource is referred.
8874     @@@@enMufDef:
8875     %p (name => {<Q::DIS:uri>}, prefix => {<}, suffix => {>: });Perl
8876     package name is not defined
8877     @@@XSubTypeDef:
8878     @@@@QName: PERL_PREPROCESS_NO_EXCEPTION_TYPE_ERR
8879     @@@@enDesc:
8880     An exception type specification is required.
8881     @@@@XSourceNodeParam:
8882     @@@@XSourceCodeParam:
8883     @@@@XParam:
8884     @@@@@QName:elementType
8885     @@@@@enDesc:
8886     The element type of the preprocessing instruction.
8887     @@@XSubTypeDef:
8888     @@@@QName: PERL_PREPROCESS_NO_CODE_NAME_ERR
8889     @@@@enDesc:
8890     A code name specification is required.
8891     @@@@XSourceNodeParam:
8892     @@@@XSourceCodeParam:
8893     @@@@XParam:
8894 wakaba 1.13 @@@@@QName:elementType
8895     @@@@@enDesc:
8896 wakaba 1.15 The element type of the preprocessing instruction.
8897 wakaba 1.13 @@@XSubTypeDef:
8898     @@@@QName: PERL_CODE_NOT_DEFINED_ERR
8899     @@@@enDesc:
8900 wakaba 1.15 The specified resource does not have its Perl definition.
8901 wakaba 1.13 @@@@XSourceNodeParam:
8902 wakaba 1.15 @@@@XSourceCodeParam:
8903 wakaba 1.13 @@@@XParam:
8904 wakaba 1.15 @@@@@QName:elementType
8905     @@@@@enDesc:
8906     The element type of the preprocessing instruction.
8907     @@@@XParam:
8908     @@@@@QName:uri
8909 wakaba 1.13 @@@@@enDesc:
8910 wakaba 1.15 The URI reference of the resource referred.
8911 wakaba 1.13 @@@@XParam:
8912     @@@@@QName:localName
8913     @@@@@enDesc:
8914     The local name of the resource referred.
8915 wakaba 1.15 @@@XSubTypeDef:
8916     @@@@QName: PERL_PREPROCESS_NO_METHOD_ERR
8917     @@@@enDesc:
8918     A preprocessing instruction which is only allowed in
8919     method definitions is used in a code which is not a method.
8920     @@@@XSourceNodeParam:
8921     @@@@XSourceCodeParam:
8922 wakaba 1.13 @@@@XParam:
8923 wakaba 1.15 @@@@@QName:elementType
8924 wakaba 1.13 @@@@@enDesc:
8925 wakaba 1.15 The element type of the preprocessing instruction.
8926 wakaba 1.14 @@@XSubTypeDef:
8927 wakaba 1.15 @@@@QName: PERL_PREPROCESS_NO_FOR_ERR
8928 wakaba 1.14 @@@@enDesc:
8929 wakaba 1.15 A <QUOTE::for> specification is required.
8930 wakaba 1.14 @@@@XSourceNodeParam:
8931 wakaba 1.15 @@@@XSourceCodeParam:
8932 wakaba 1.14 @@@@XParam:
8933 wakaba 1.15 @@@@@QName:elementType
8934 wakaba 1.14 @@@@@enDesc:
8935 wakaba 1.15 The element type of the preprocessing instruction.
8936     @@@XSubTypeDef:
8937     @@@@QName: PERL_PREPROCESS_NO_ASSERT_TYPE_ERR
8938     @@@@enDesc:
8939     An assertion type specification is required.
8940     @@@@XSourceNodeParam:
8941     @@@@XSourceCodeParam:
8942 wakaba 1.14 @@@@XParam:
8943 wakaba 1.15 @@@@@QName:elementType
8944 wakaba 1.14 @@@@@enDesc:
8945 wakaba 1.15 The element type of the preprocessing instruction.
8946     @@@XSubTypeDef:
8947     @@@@QName: PERL_PREPROCESS_BLOCK_NOT_ALLOWED_ERR
8948     @@@@enDesc:
8949     A preprocessing instruction block occurred with
8950     element type which does not allow it.
8951     @@@@XSourceNodeParam:
8952     @@@@XSourceCodeParam:
8953 wakaba 1.14 @@@@XParam:
8954     @@@@@QName:elementType
8955     @@@@@enDesc:
8956 wakaba 1.15 The element type of the preprocessing instruction.
8957 wakaba 1.18 @@@XSubTypeDef:
8958     @@@@QName: NON_NAMED_PARAMETER_AFTER_NAMED_ERR
8959     @@@@enDesc:
8960     A non-named method parameter following
8961     any named method parameter is occurred.
8962     @@@@XSourceNodeParam:
8963     @@@@XParam:
8964     @@@@@QName:uri
8965     @@@@@enDesc:
8966     The URI reference of the non-named method parameter resource.
8967     @@@@XParam:
8968     @@@@@QName:localName
8969     @@@@@enDesc:
8970     The local name of the non-named method parameter.
8971 wakaba 1.19 @@@XSubTypeDef:
8972     @@@@QName:DISPERL_NO_VALUE_ALLOWED_ERR
8973     @@@@enDesc:
8974     An element node have a value but the definition
8975     of that element type does not allow it.
8976     @@@@XSourceNodeParam:
8977     @@@@XParam:
8978     @@@@@QName:elementType
8979     @@@@@enDesc:
8980     The element type URI reference of the element.
8981     @@@XSubTypeDef:
8982     @@@@QName:NO_CONST_VALUE_ERR
8983     @@@@enDesc:
8984     The source element node for a constant value resource
8985     does not have <Q::dis:Value> attribute.
8986     @@@@XSourceNodeParam:
8987     @@@@XParam:
8988     @@@@@QName:elemntType
8989     @@@@@enDesc:
8990     The element type URI reference of the element from which
8991     a constant value resource is referred.
8992     @@@@XParam:
8993     @@@@@QName:uri
8994     @@@@@enDesc:
8995     The resource URI reference of the constant value resource.
8996     @@@@XParam:
8997     @@@@@QName:localName
8998     @@@@@enDesc:
8999     The local name of the constant value resource.
9000     @@@XSubTypeDef:
9001     @@@@QName:NO_ATTR_SET_ERR
9002     @@@@enDesc:
9003     An attribute setter is referred but the attribute
9004     does not define any setter.
9005     @@@@XSourceNodeParam:
9006     @@@@XParam:
9007     @@@@@QName:errResource
9008     @@@@@enDesc:
9009     The attribute resource.
9010     @@@@XParam:
9011     @@@@@QName:elementType
9012     @@@@@enDesc:
9013     The type of the element by which this attribute
9014     is referred.
9015 wakaba 1.20 @@@XSubTypeDef:
9016     @@@@QName: PERL_SUBROUTINE_ALREADY_DEFINED_ERR
9017     @@@@enDesc:
9018     A resource defines a Perl subroutine whose name is
9019     same as another subroutine.
9020     @@@@XSourceNodeParam:
9021     @@@@XParam:
9022     @@@@@QName:uri
9023     @@@@@enDesc:
9024     The URI reference of the resource that defines the Perl subroutine.
9025     @@@@XParam:
9026     @@@@@QName:
9027     PerlCode:localName
9028     @@@@@enDesc:
9029     The name of the Perl subroutine.
9030     @@@XSubTypeDef:
9031     @@@@QName: PERL_OPERATOR_ALREADY_OVERLOADED_ERR
9032     @@@@enDesc:
9033     A resource is defined to overload a Perl operator which
9034     is already overloaded by another resource.
9035     @@@@XSourceNodeParam:
9036     @@@@XParam:
9037     @@@@@QName:uri
9038     @@@@@enDesc:
9039     The URI reference of the resource that defines the overloading.
9040     @@@@XParam:
9041     @@@@@QName:
9042     PerlCode:operator
9043     @@@@@enDesc:
9044     The operator.
9045     @@@XSubTypeDef:
9046     @@@@QName: PERL_UNUSED_SUBROUTINE_ERR
9047     @@@@enDesc:
9048     A resource defines a Perl subroutine but it is not used.
9049     @@@@XSourceNodeParam:
9050     @@@@XParam:
9051     @@@@@QName:uri
9052     @@@@@enDesc:
9053     The URI reference of the resource.
9054 wakaba 1.22 @@@XSubTypeDef:
9055     @@@@QName: NO_LICENSE_ATTR_ERR
9056     @@@@enDesc:
9057     The <Q::dis:Module> element does not have the
9058     <Q::dis:License> attribute.
9059     @@@@XSourceNodeParam:
9060     @@@@XParam:
9061     @@@@@QName:uri
9062     @@@@@enDesc:
9063     The URI reference of the module.
9064 wakaba 1.25 @@@XSubTypeDef:
9065     @@@@QName: UNSUPPORTED_ROLE_ERR
9066     @@@@enDesc:
9067     A <Q::dis:Role> is not supported.
9068     @@@@XSourceNodeParam:
9069     @@@@XParam:
9070     @@@@@QName:uri
9071     @@@@@enDesc:
9072     The URI reference of the unsupported role.
9073     @@@@enMufDef:
9074     Role <%p (name => {<Q::DIS:uri>});> is not supported
9075 wakaba 1.4 ##DISException
9076 wakaba 1.13
9077     XParamDef:
9078     @QName:expectedType
9079     @Type: ResourceURI
9080     @enDesc:
9081     Expected resource type URI reference.
9082    
9083     XParamDef:
9084     @QName: sourceCode
9085     @Type:
9086     DISLang:String::ManakaiDOM:all
9087     @enDesc:
9088     The source code fragment in which an error occurred.
9089 wakaba 1.5
9090     XParamDef:
9091     @QName: elementType
9092     @Type: ResourceURI
9093     @enDesc:
9094     The name of the element type.
9095    
9096     XParamDef:
9097     @QName: uri
9098     @Type: ResourceURI
9099     @enDesc:
9100     The name of the resource, composed from <Q::namespaceURI>,
9101     <Q::localName> and <Q::for>.
9102    
9103     XParamDef:
9104     @QName: localName
9105     @Type:
9106 wakaba 1.18 DISCore:LocalName::ManakaiDOM:all
9107 wakaba 1.5 @enDesc:
9108     The local name of the resource, unique in <Q::namespaceURI> namespace.
9109    
9110     XParamDef:
9111     @QName: namespaceURI
9112     @Type: AnyURI
9113     @enDesc:
9114     The namespace URI reference of the resource name.
9115    
9116     XParamDef:
9117     @QName: for
9118     @Type: ForURI
9119     @enDesc:
9120     The <QUOTE::for> URI reference of the resource.
9121    
9122     ElementTypeBinding:
9123     @Name: XSourceNodeParam
9124     @ElementType:
9125     ManakaiDOM:exceptionOrWarningParameter
9126     @ShadowContent:
9127     @@QName: sourceNode
9128     @@Description:
9129     @@@lang:en
9130     @@@@:
9131     The node in which an error has occurred.
9132 wakaba 1.15
9133     ElementTypeBinding:
9134     @Name: XSourceCodeParam
9135     @ElementType:
9136     ManakaiDOM:exceptionOrWarningParameter
9137     @ShadowContent:
9138     @@QName: sourceCode
9139     @@Description:
9140     @@@lang:en
9141     @@@@:
9142     The source code in which an error has occurred.
9143 wakaba 1.4
9144     ClsDef:
9145     @ClsQName: ManakaiDISExceptionTarget
9146     @enDesc:
9147     Objects that is able to be the target of an exception.
9148     @IntMethod:
9149     @@Operator:
9150     @@@@:
9151     ManakaiDOM:MUErrorHandler
9152     @@@ContentType:
9153     dis:TypeQName
9154     @@Description:
9155     @@@lang:en
9156     @@@@:
9157     This method is a generic error handler; all manakai exceptions
9158     and warnings associated to an object are once reported to this method
9159     and then delivered to appropriate entities.
9160     \
9161     If the error is an exception (such as <X::DOMCore:DOMException> or
9162     <X::ManakaiDOM:ManakaiDOMImplementationException>), it is
9163     simply thrown. If the error is only a warning, it is reported
9164     via the <IF::DOMCore:DOMError> interface.
9165     \
9166     See <PerlModule::Message::Util::Error> documentation for more
9167     information on the error reporting mechanism.
9168     \
9169     {NOTE:: This kind of methods are named as <Perl::___report_error>
9170     in the convention of <PerlModule::Message::Util::Error>.
9171     \
9172     }
9173     @@Param:
9174     @@@Name:err
9175     @@@Type:
9176     ManakaiDOM:ManakaiDOMExceptionOrWarning::ManakaiDOM:Perl
9177     @@@Description:
9178     @@@@lang:en
9179     @@@@@:
9180     An exception object that describes what kind of error it is
9181     and how it should be recovered.
9182     \
9183     {NOTE:: Exception objects in manakai implementation
9184     inherit the class <PerlModule::Message::Util::Error>,
9185     that in turn inherits <PerlModule::Error>.
9186     \
9187     }
9188     @@Return:
9189     @@@PerlDef:
9190     if ($err->isa (<ClassName::ManakaiDOM:ManakaiDOMException
9191     ::ManakaiDOM:Perl>)) {
9192     $err->throw;
9193     } else {
9194     \## TODO: Implement warning reporting
9195     warn $err->stringify;
9196     }
9197     ##DISExceptionTarget
9198    
9199     ForDef:
9200     @QName:
9201     DIS:ForIF
9202     ForDef:
9203     @QName:
9204     DIS:ForClass
9205    
9206     ElementTypeBinding:
9207     @Name: IFClsDef
9208     @ElementType:
9209     dis:ResourceDef
9210     @ShadowContent:
9211     @@rdf:type:
9212     @@@@:
9213     dis:MultipleResource
9214     @@@ForCheck: !ForClass !ForIF
9215     @@rdf:type:
9216     @@@@:
9217     ManakaiDOM:IF
9218     @@@ForCheck: ForIF
9219     @@rdf:type:
9220     @@@@:
9221     ManakaiDOM:Class
9222     @@@ForCheck: ForClass
9223     @@resourceFor: ForIF
9224     @@resourceFor:
9225     @@@@: ForClass
9226     @@@ForCheck: ForLatest
9227     @@DOMMain:implementFeature:
9228     @@@@:CoreFeature10
9229     @@@ForCheck: ForClass
9230     @@ForCheck:
9231     ManakaiDOM:Perl
9232 wakaba 1.3
9233     ElementTypeBinding:
9234     @Name: ClsDef
9235     @ElementType:
9236     dis:ResourceDef
9237     @ShadowContent:
9238     @@rdf:type:
9239     ManakaiDOM:Class
9240     @@AliasFor:
9241     @@@@:
9242 wakaba 1.11 ::DIS:ForLatest
9243 wakaba 1.3 @@@For:
9244 wakaba 1.11 !=DIS:ForLatest
9245 wakaba 1.3 @@ForCheck:
9246     ManakaiDOM:Perl
9247     @@DOMMain:implementFeature: CoreFeature10
9248    
9249     ElementTypeBinding:
9250     @Name: ExceptionDef
9251     @ElementType:
9252     dis:ResourceDef
9253     @ShadowContent:
9254     @@rdf:type:
9255     ManakaiDOM:ExceptionClass
9256     @@AliasFor:
9257     @@@@:
9258     ::ForLatest
9259     @@@For:
9260     !=ForLatest
9261     @@ForCheck:
9262     ManakaiDOM:Perl
9263     @@DOMMain:implementFeature: CoreFeature10
9264    
9265     ElementTypeBinding:
9266     @Name: ClsQName
9267     @ElementType:
9268     dis:QName
9269    
9270     ElementTypeBinding:
9271     @Name: ClsISA
9272     @ElementType:
9273     dis:ISA
9274    
9275     ElementTypeBinding:
9276     @Name: Method
9277     @ElementType:
9278     dis:ResourceDef
9279     @ShadowContent:
9280     @@rdf:type:
9281     DISLang:Method
9282    
9283     ElementTypeBinding:
9284     @Name: IntMethod
9285     @ElementType:
9286     dis:ResourceDef
9287     @ShadowContent:
9288     @@rdf:type:
9289     DISLang:Method
9290     @@ManakaiDOM:isForInternal:1
9291    
9292     ElementTypeBinding:
9293     @Name: Attr
9294     @ElementType:
9295     dis:ResourceDef
9296     @ShadowContent:
9297     @@rdf:type:
9298     DISLang:Attribute
9299    
9300     ElementTypeBinding:
9301     @Name: Return
9302     @ElementType:
9303     dis:ResourceDef
9304     @ShadowContent:
9305     @@rdf:type:
9306     DISLang:MethodReturn
9307    
9308     ElementTypeBinding:
9309     @Name: Get
9310     @ElementType:
9311     dis:ResourceDef
9312     @ShadowContent:
9313     @@rdf:type:
9314     DISLang:AttributeGet
9315    
9316     ElementTypeBinding:
9317     @Name: Set
9318     @ElementType:
9319     dis:ResourceDef
9320     @ShadowContent:
9321     @@rdf:type:
9322     DISLang:AttributeSet
9323    
9324     ElementTypeBinding:
9325     @Name: Param
9326     @ElementType:
9327     dis:ResourceDef
9328     @ShadowContent:
9329     @@rdf:type:
9330     DISLang:MethodParameter
9331    
9332     ElementTypeBinding:
9333     @Name: PerlDef
9334     @ElementType:
9335     dis:Def
9336     @ShadowContent:
9337     @@ContentType:
9338     lang:Perl
9339    
9340     ElementTypeBinding:
9341     @Name: disDef
9342     @ElementType:
9343     dis:Def
9344     @ShadowContent:
9345     @@ContentType:
9346     lang:dis
9347    
9348     ElementTypeBinding:
9349     @Name: InCase
9350     @ElementType:
9351     dis:ResourceDef
9352     @ShadowContent:
9353     @@rdf:type:
9354     ManakaiDOM:InCase
9355    
9356     ElementTypeBinding:
9357     @Name: nullCase
9358     @ElementType:
9359     dis:ResourceDef
9360     @ShadowContent:
9361     @@rdf:type:
9362     ManakaiDOM:InCase
9363     @@Value:
9364     @@@is-null:1
9365    
9366     ElementTypeBinding:
9367     @Name: TrueCase
9368     @ElementType:
9369     dis:ResourceDef
9370     @ShadowContent:
9371     @@rdf:type:
9372     ManakaiDOM:InCase
9373     @@Value:true
9374     @@Type:
9375 wakaba 1.18 DOMMain:boolean::ManakaiDOM:all
9376 wakaba 1.3
9377    
9378     ElementTypeBinding:
9379     @Name: FalseCase
9380     @ElementType:
9381     dis:ResourceDef
9382     @ShadowContent:
9383     @@rdf:type:
9384     ManakaiDOM:InCase
9385     @@Value:false
9386     @@Type:
9387 wakaba 1.18 DOMMain:boolean::ManakaiDOM:all
9388 wakaba 1.3
9389     ElementTypeBinding:
9390     @Name: enDesc
9391     @ElementType:
9392     dis:Description
9393     @ShadowContent:
9394     @@lang:en
9395    
9396     ElementTypeBinding:
9397     @Name: PropDef
9398     @ElementType:
9399     dis:ResourceDef
9400     @ShadowContent:
9401     @@rdf:type:
9402     rdf:Property
9403     @@AliasFor:
9404     @@@@:
9405     ::ManakaiDOM:all
9406     @@@For:
9407     !=ManakaiDOM:all
9408    
9409     ElementTypeBinding:
9410     @Name: MethodRedef
9411     @ElementType:
9412     dis:ResourceDef
9413     @ShadowContent:
9414     @@rdf:type:
9415     DISLang:Method
9416     @@ManakaiDOM:isRedefining:1
9417    
9418     ElementTypeBinding:
9419     @Name: NamedParam
9420     @ElementType:
9421     dis:ResourceDef
9422     @ShadowContent:
9423     @@rdf:type:
9424     DISLang:MethodParameter
9425     @@DISPerl:isNamedParameter:1
9426    
9427     ElementTypeBinding:
9428     @Name: NodeParam
9429     @ElementType:
9430     dis:ResourceDef
9431     @ShadowContent:
9432     @@rdf:type:
9433     DISLang:MethodParameter
9434     @@DISPerl:isNamedParameter:1
9435     @@Name: node
9436     @@Type: ManakaiDISNode
9437     @@Description:
9438     @@@lang:en
9439     @@@@:
9440     The node in which the name has occurred. It is intended
9441     to be reported when an exception had been raised.
9442     @@ResourceDef:
9443     @@@rdf:type:
9444     ManakaiDOM:InCase
9445     @@@Value:
9446     @@@@is-null:1
9447     @@@Description:
9448     @@@@lang:en
9449     @@@@@:
9450     The source of the name is not a node.
9451    
9452     ElementTypeBinding:
9453     @Name: ForParam
9454     @ElementType:
9455     dis:ResourceDef
9456     @ShadowContent:
9457     @@rdf:type:
9458     DISLang:MethodParameter
9459     @@DISPerl:isNamedParameter:1
9460     @@Name: forArg
9461     @@Type: ForURI
9462     @@Description:
9463     @@@lang:en
9464     @@@@:
9465     The <QUOTE::for> URI reference.
9466     @@ResourceDef:
9467     @@@rdf:type:
9468     ManakaiDOM:InCase
9469     @@@Value:
9470     @@@@is-null:1
9471     @@@Description:
9472     @@@@lang:en
9473     @@@@@:
9474     Equivalent to <Q::ManakaiDOM:all>, i.e. <QUOTE::for all>.
9475    
9476     ElementTypeBinding:
9477     @Name: ForpParam
9478     @ElementType:
9479     dis:ResourceDef
9480     @ShadowContent:
9481     @@rdf:type:
9482     DISLang:MethodParameter
9483     @@DISPerl:isNamedParameter:1
9484     @@Name: forpArg
9485     @@Type: ForURIList
9486     @@Description:
9487     @@@lang:en
9488     @@@@:
9489     An array reference containing additional <QUOTE::for>
9490     constraints (<QUOTE::For+> list).
9491     @@ResourceDef:
9492     @@@rdf:type:
9493     ManakaiDOM:InCase
9494     @@@Value:
9495     @@@@is-null:1
9496     @@@Description:
9497     @@@@lang:en
9498     @@@@@:
9499     Equivalent to the empty array reference.
9500    
9501     ElementTypeBinding:
9502     @Name: MediaTypeParam
9503     @ElementType:
9504     dis:ResourceDef
9505     @ShadowContent:
9506     @@rdf:type:
9507     DISLang:MethodParameter
9508     @@DISPerl:isNamedParameter:1
9509     @@Name: mediaType
9510     @@Type: MediaTypeURI
9511     @@Description:
9512     @@@lang:en
9513     @@@@:
9514     The URI reference identifying a media type.
9515     @@ResourceDef:
9516     @@@rdf:type:
9517     ManakaiDOM:InCase
9518     @@@Value:
9519     @@@@is-null:1
9520     @@@Description:
9521     @@@@lang:en
9522     @@@@@:
9523     No media type specified.
9524    
9525     ElementTypeBinding:
9526     @Name: MediaTypeDefaultParam
9527     @ElementType:
9528     dis:ResourceDef
9529     @ShadowContent:
9530     @@rdf:type:
9531     DISLang:MethodParameter
9532     @@DISPerl:isNamedParameter:1
9533     @@Name: defaultMediaType
9534     @@Type: MediaTypeURI
9535     @@Description:
9536     @@@lang:en
9537     @@@@:
9538     The default media type, i.e. the type used when no explicit
9539     specification is not found in the source tree.
9540     @@ResourceDef:
9541     @@@rdf:type:
9542     ManakaiDOM:InCase
9543     @@@Value:
9544     @@@@is-null:1
9545     @@@Description:
9546     @@@@lang:en
9547     @@@@@:
9548     Defaulted to <Q::DOMMain:any>.
9549    
9550     ElementTypeBinding:
9551     @Name: RaiseException
9552     @ElementType:
9553     ManakaiDOM:raises
9554    
9555     ElementTypeBinding:
9556     @Name: UndeclaredPrefixException
9557     @ElementType:
9558     ManakaiDOM:raises
9559     @ShadowContent:
9560     @@@: UNDECLARED_NS_PREFIX_ERR
9561     @@Description:
9562     @@@lang:en
9563     @@@@:
9564     The implementation has encounted an undeclared namespace prefix.
9565    
9566     ElementTypeBinding:
9567     @Name: NoDBException
9568     @ElementType:
9569     ManakaiDOM:raises
9570     @ShadowContent:
9571     @@@: NO_DB_ASSOCIATED_ERR
9572     @@Description:
9573     @@@lang:en
9574     @@@@:
9575     No <QUOTE::dis> database is associated to this document.
9576    
9577     ElementTypeBinding:
9578     @Name: XConstGroupDef
9579     @ElementType:
9580     dis:ResourceDef
9581     @ShadowContent:
9582     @@rdf:type:
9583     ManakaiDOM:ConstGroup
9584     @@Type:
9585     DOMMain:unsigned-short::ManakaiDOM:all
9586     @@rdfs:subClassOf:
9587     DOMMain:unsigned-short::ManakaiDOM:all
9588    
9589     ElementTypeBinding:
9590     @Name: XConstDef
9591     @ElementType:
9592     dis:ResourceDef
9593     @ShadowContent:
9594     @@rdf:type:
9595     ManakaiDOM:Const
9596    
9597     ElementTypeBinding:
9598     @Name: XSubTypeDef
9599     @ElementType:
9600     dis:ResourceDef
9601     @ShadowContent:
9602     @@rdf:type:
9603     ManakaiDOM:ExceptionOrWarningSubType
9604    
9605     ElementTypeBinding:
9606     @Name: XParam
9607     @ElementType:
9608     ManakaiDOM:exceptionOrWarningParameter
9609    
9610     ElementTypeBinding:
9611     @Name: XParamDef
9612     @ElementType:
9613     dis:ResourceDef
9614     @ShadowContent:
9615     @@rdf:type:
9616     DOMMain:XWParameter
9617 wakaba 1.12 @@For:
9618     =ManakaiDOM:all
9619 wakaba 1.3
9620     ElementTypeBinding:
9621     @Name: enMufDef
9622     @ElementType:
9623     dis:Def
9624     @ShadowContent:
9625     @@ContentType:
9626     lang:muf
9627     @@lang:en
9628 wakaba 1.21
9629 wakaba 1.3

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24