/[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.62 - (hide annotations) (download)
Thu Oct 6 10:53:36 2005 UTC (19 years, 9 months ago) by wakaba
Branch: MAIN
Changes since 1.61: +27 -4 lines
++ manakai/t/ChangeLog	6 Oct 2005 10:33:09 -0000
2005-10-06  Wakaba  <wakaba@suika.fam.cx>

	* Makefile: Updated for new version of "domts2perl.pl".

++ manakai/bin/ChangeLog	6 Oct 2005 10:26:28 -0000
2005-10-06  Wakaba  <wakaba@suika.fam.cx>

	* mkdommemlist.pl: Revised for new "dae" database.

	* domts2perl.pl (--domtest2perl-option): New option.

	* domtest2perl.pl: Revised for new DOM Perl binding.

	* Makefile: Rules to make "dommemlist.pl.tmp" revised.

++ manakai/lib/Message/Util/ChangeLog	6 Oct 2005 10:30:19 -0000
2005-10-06  Wakaba  <wakaba@suika.fam.cx>

	* DIS.dis (getAnyResourceURIList, getModuleURIList): New methods.

++ manakai/lib/Message/Util/DIS/ChangeLog	6 Oct 2005 10:32:00 -0000
2005-10-06  Wakaba  <wakaba@suika.fam.cx>

	* Perl.dis (plFullyQualifiedName): Fully qualified
	name of the constant function is now a name in
	the package of the class (it was a name in module package).

	* Value.dis (getResource): Use "getAnyResource"
	method instead of "getResource" method.

++ manakai/lib/Message/DOM/ChangeLog	6 Oct 2005 10:37:05 -0000
2005-10-06  Wakaba  <wakaba@suika.fam.cx>

	* DOMCore.dis (ManakaiDOMEmptyNodeList): New class.
	(ManakaiDOMCharacterData): Methods reimplemented.
	(splitText): Reimplemented.
	(childNodes): Returns a "ManakaiDOMEmptyNodeList"
	for non-parent node types.

	* DOMXML.dis (childNodes): Returns a "ManakaiDOMEmptyNodeList"
	        for non-parent node types.

2005-10-05  Wakaba  <wakaba@suika.fam.cx>

	* ManakaiDOMLS2003.dis: Revised to new format.

	* GenericLS.dis (DOMLS:ParseString): New feature.

	* DOMMain.pm (StringExtend): Code portions of raising
++ manakai/lib/manakai/ChangeLog	6 Oct 2005 10:32:30 -0000
2005-10-06  Wakaba  <wakaba@suika.fam.cx>

	* domtest.pl, genlib.pl: Use new DOM Perl binding.

1 wakaba 1.1 Module:
2 wakaba 1.51 @QName: Util|DIS
3 wakaba 1.1 @FullName:
4     @@lang: en
5     @@@:
6     <QUOTE::DIS> Object Model
7     @Namespace:
8     http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/DIS#
9    
10     @Description:
11     @@lang:en
12     @@@:
13 wakaba 1.14 This module provides an object model for <QUOTE::dis> document format.
14 wakaba 1.1
15 wakaba 1.53 @DISCore:author: DISCore|Wakaba
16 wakaba 1.1 @License:
17     @@@:
18     license:Perl+MPL
19     @@Original:
20     @@@FullName:
21 wakaba 1.19 manakai <CODE::lib/manakai/dis.pl> and <CODE::bin/cdis2pm.pl>
22 wakaba 1.1 @@@Year:2004
23 wakaba 1.53 @@@DISCore:author: DISCore|Wakaba
24 wakaba 1.1 @Date:
25     @@@:
26 wakaba 1.62 $Date: 2005/10/02 23:35:32 $
27 wakaba 1.1 @@ContentType:
28     dis:Date.RCS
29    
30     @Require:
31     @@Module:
32 wakaba 1.51 @@@QName: Markup|SuikaWikiConfig21
33     @@@WithFor: swcfg21|ForLatest
34 wakaba 1.3 @@Module:
35 wakaba 1.51 @@@QName: Util|DIS
36     @@@WithFor: DIS|ForLatest
37 wakaba 1.12 @@Module:
38 wakaba 1.51 @@@QName: Util|DIS
39     @@@WithFor: DIS|ForEmpty
40 wakaba 1.47 @@Module:
41 wakaba 1.51 @@@QName: Util|PerlCode
42     @@@WithFor: ManakaiDOM|Perl
43 wakaba 1.47 @@Module:
44     @@@QName: MDOM|DOMFeature
45     @@@WithFor: ManakaiDOM|all
46 wakaba 1.48 @@Module:
47     @@@QName: DIS|Perl
48     @@@WithFor: DIS|ForLatest
49     @@Module:
50     @@@QName: DIS|Value
51     @@@WithFor: DIS|ForLatest
52 wakaba 1.3
53 wakaba 1.51 @DefaultFor: DIS|ForLatest
54 wakaba 1.1
55     Namespace:
56     @DIS:
57     http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/DIS#
58     @dis:
59     http://suika.fam.cx/~wakaba/archive/2004/8/18/lang#dis--
60 wakaba 1.3 @DOMCore:
61     http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#
62     @DOMLS:
63     http://suika.fam.cx/~wakaba/archive/2004/dom/ls#
64     @DOMMain:
65     http://suika.fam.cx/~wakaba/archive/2004/dom/main#
66 wakaba 1.48 @dp:
67     http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/DIS#Perl/
68     @dv:
69     http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/DIS#Value/
70 wakaba 1.52 @dx:
71     http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/Error/DOMException#
72 wakaba 1.47 @ecore:
73     http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/Error/Core/
74 wakaba 1.3 @infoset:
75     http://www.w3.org/2001/04/infoset#
76 wakaba 1.47 @kwd:
77     http://suika.fam.cx/~wakaba/archive/2005/rfc2119/
78 wakaba 1.1 @lang:
79     http://suika.fam.cx/~wakaba/archive/2004/8/18/lang#
80     @license:
81     http://suika.fam.cx/~wakaba/archive/2004/8/18/license#
82     @ManakaiDOM:
83     http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom#
84 wakaba 1.5 @Markup:
85     http://suika.fam.cx/~wakaba/archive/2005/manakai/Markup#
86 wakaba 1.47 @MDOM:
87     http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom#ManakaiDOM.
88 wakaba 1.3 @MDOMX:
89     http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#
90 wakaba 1.53 @mn:
91     http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/ManakaiNode#
92 wakaba 1.1 @rdf:
93     http://www.w3.org/1999/02/22-rdf-syntax-ns#
94     @rdfs:
95     http://www.w3.org/2000/01/rdf-schema#
96 wakaba 1.32 @s:
97     http://suika.fam.cx/~wakaba/archive/2004/dis/Markup#
98 wakaba 1.3 @swcfg21:
99     http://suika.fam.cx/~wakaba/archive/2005/swcfg21#
100 wakaba 1.1 @Util:
101     http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/
102    
103     ## -- "For" definitions
104    
105     ForDef:
106 wakaba 1.51 @QName: DIS|ForEmpty
107     @enDesc:
108     For any version
109     @ISA: ManakaiDOM|Perl
110    
111     ForDef:
112 wakaba 1.1 @QName:
113     DIS:ForLatest
114     @Description:
115     @@lang:en
116     @@@:
117     For latest version of the <Module::Util:DIS> module implementation
118 wakaba 1.47 @ISA: DIS|ForEmpty
119 wakaba 1.1
120 wakaba 1.51 ## -- Module sets
121 wakaba 1.38
122 wakaba 1.51 ResourceDef:
123     @QName: Util|
124     @For: DIS|ForEmpty
125     @rdf:type: dis|ModuleGroup
126     @FullName:
127     @@lang:en
128     @@@:
129     Manakai support modules
130     @DISPerl:packageName:
131     Message::Util::
132     @DISPerl:interfacePackageName:
133     @@@:
134     Message::Util::IF::
135     @@For: DIS|ForEmpty !DIS|ForLatest
136     @DISPerl:interfacePackageName:
137     @@@:
138     Message::Util::IFLatest::
139     @@For: DIS|ForLatest
140     @ImplNote:
141     @@lang:en
142     @@@:
143     Resources <Q::Util|> for <Q::ManakaiDOM|all> and for <Q::ManakaiDOM|Perl>
144     is defined in module <Module::Util|ManakaiNode>.
145 wakaba 1.38
146     ResourceDef:
147     @QName:
148     DIS:
149     @rdf:type:
150     dis:ModuleGroup
151     @FullName:
152     @@lang:en
153     @@@:
154     <QUOTE::dis> modules
155 wakaba 1.51 @DISPerl:packageName:
156     Message::Util::DIS::
157     @DISPerl:interfacePackageName:
158 wakaba 1.48 Message::Util::IF::
159 wakaba 1.38
160 wakaba 1.1 ## -- Features
161    
162     ElementTypeBinding:
163     @Name: FeatureDef
164     @ElementType:
165     dis:ResourceDef
166     @ShadowContent:
167 wakaba 1.52 @@rdf:type: DOMFeature|Feature
168 wakaba 1.24 @@ForCheck:
169 wakaba 1.49 =ManakaiDOM:all
170 wakaba 1.1
171     ElementTypeBinding:
172     @Name: FeatureVerDef
173     @ElementType:
174     dis:ResourceDef
175     @ShadowContent:
176 wakaba 1.52 @@rdf:type: DOMFeature|Feature
177 wakaba 1.1
178     ElementTypeBinding:
179     @Name: featureQName
180     @ElementType:
181 wakaba 1.52 DOMFeature:name
182 wakaba 1.1 @ShadowContent:
183 wakaba 1.52 @@ContentType: DISCore|QName
184 wakaba 1.1
185     FeatureDef:
186     @QName: Core
187     @FeatureVerDef:
188     @@QName: CoreFeature10
189     @@Version: 1.0
190 wakaba 1.60 @@DOMFeature:instanceOf: Core
191 wakaba 1.1 @@FullName:
192     @@@lang:en
193     @@@@:
194     The <QUOTE::dis> object model, version 1.0
195     @@Description:
196     @@@lang:en
197     @@@@:
198     The <QUOTE::dis> object model, version 1.0.
199     @@DOMMain:requireFeature:
200     swcfg21:CoreFeature21
201    
202 wakaba 1.38 ## -- Roles
203    
204     ElementTypeBinding:
205     @Name: RoleDef
206     @ElementType:
207     dis:ResourceDef
208     @ShadowContent:
209     @@rdf:type:
210     DISLang:Role
211     @@ForCheck:
212     =ManakaiDOM:all
213    
214     RoleDef:
215     @QName: ModuleRole
216     @enDesc:
217     Any class playing this role may be returned by
218     <M::ManakaiDISModuleDefinition.getFeature> method with
219     appropriate feature parameters.
220    
221     RoleDef:
222     @QName: ForRole
223     @enDesc:
224     Any class playing this role may be returned by
225     <M::ManakaiDISForDefinition.getFeature> method with
226     appropriate feature parameters.
227    
228     RoleDef:
229     @QName: ResourceRole
230     @enDesc:
231     Any class playing this role may be returned by
232     <M::ManakaiDISResourceDefinition.getFeature> method with
233     appropriate feature parameters.
234    
235     RoleDef:
236     @QName: ElementRole
237     @enDesc:
238     Any class playing this role may be returned by
239     <M::ManakaiDISElement.getFeature> method with
240     appropriate feature parameters.
241    
242     RoleDef:
243     @QName: DatabaseRole
244     @enDesc:
245     Any class playing this role may be returned by
246     <M::ManakaiDISDatabase.getFeature> method with
247     appropriate feature parameters.
248    
249 wakaba 1.47
250     ElementTypeBinding:
251     @Name: IFQName
252     @ElementType:
253     dis:QName
254     @ShadowContent:
255     @@ForCheck: ManakaiDOM|ForIF
256    
257     ElementTypeBinding:
258     @Name: ClsQName
259     @ElementType:
260     dis:QName
261     @ShadowContent:
262     @@ForCheck: ManakaiDOM|ForClass
263    
264     ElementTypeBinding:
265     @Name: IFISA
266     @ElementType:
267     dis:ISA
268     @ShadowContent:
269     @@ForCheck: ManakaiDOM|ForIF
270    
271     ElementTypeBinding:
272     @Name: ClsISA
273     @ElementType:
274     dis:ISA
275     @ShadowContent:
276     @@ForCheck: ManakaiDOM|ForClass
277    
278     ElementTypeBinding:
279     @Name: IFClsDef
280     @ElementType:
281     dis:ResourceDef
282     @ShadowContent:
283     @@rdf:type:
284     @@@@: dis|MultipleResource
285     @@@ForCheck: !ManakaiDOM|ForIF !ManakaiDOM|ForClass
286     @@resourceFor: ManakaiDOM|ForIF
287     @@resourceFor:
288     @@@@: ManakaiDOM|ForClass
289     @@@ForCheck: ForEmpty !=ForEmpty
290     @@For: ForLatest
291     @@For: =ForEmpty
292    
293     @@rdf:type:
294     @@@@: ManakaiDOM|IF
295     @@@ForCheck: ManakaiDOM|ForIF
296    
297     @@rdf:type:
298     @@@@: ManakaiDOM|Class
299     @@@ForCheck: ManakaiDOM|ForClass
300     @@Implement:
301     @@@@: ||ForEmpty||ManakaiDOM|ForIF
302     @@@ContentType: DISCore|TFPQNames
303     @@@ForCheck: ManakaiDOM|ForClass ForEmpty
304     @@Implement:
305     @@@@: ||ForLatest||ManakaiDOM|ForIF
306     @@@ContentType: DISCore|TFPQNames
307     @@@ForCheck: ManakaiDOM|ForClass ForLatest
308    
309     @@DOMMain:implementFeature:
310     @@@@: CoreFeature10
311     @@@For: ForLatest
312    
313     ElementTypeBinding:
314     @Name: ClsDef
315     @ElementType:
316     dis:ResourceDef
317     @ShadowContent:
318     @@rdf:type:
319     @@@@: dis|MultipleResource
320     @@@ForCheck: !ManakaiDOM|ForIF !ManakaiDOM|ForClass
321    
322     @@resourceFor:
323     @@@@: ManakaiDOM|ForClass
324     @@@ForCheck: ForEmpty !=ForEmpty
325     @@For: ForLatest
326    
327     @@rdf:type:
328     @@@@: ManakaiDOM|Class
329     @@@ForCheck: ManakaiDOM|ForClass
330    
331     @@DOMMain:implementFeature:
332     @@@@: CoreFeature10
333     @@@For: ForLatest
334    
335     ElementTypeBinding:
336     @Name: clsActualType
337     @ElementType:
338     dis:actualType
339     @ShadowContent:
340     @@ForCheck: ManakaiDOM|ForClass
341    
342 wakaba 1.1 ## -- SuikaWikiConfig/2.1 extended classes
343    
344 wakaba 1.47 IFClsDef:
345     @IFQName: DISImplementation
346 wakaba 1.1 @ClsQName: ManakaiDISImplementation
347 wakaba 1.47
348 wakaba 1.1 @ClsISA:
349 wakaba 1.3 swcfg21:ManakaiSWCFGImplementation::swcfg21:ForLatest
350 wakaba 1.48 @ClsISA: dp|ManakaiDISImplementationPerl
351     @ClsISA: dv|ManakaiDISImplementationValue
352    
353 wakaba 1.1 @Description:
354     @@lang:en
355     @@@:
356     A <QUOTE::dis> implementation object.
357    
358     @Method:
359     @@Name: createDISDocument
360     @@Description:
361     @@@lang:en
362     @@@@:
363 wakaba 1.47 Creates an empty <IF::DISDocument> node.
364 wakaba 1.1 @@Return:
365 wakaba 1.47 @@@Type: DISDocument
366     @@@clsActualType: ManakaiDISDocument
367 wakaba 1.1 @@@Description:
368     @@@@lang:en
369     @@@@@:
370     The newly created <QUOTE::dis> document object.
371     @@@PerlDef:
372 wakaba 1.29 $r = bless $self-><M::swcfg21:SWCFGImplementation::swcfg21:ForLatest
373     .createSWCFGDocument>,
374     <ClassName::ManakaiDISDocument>;
375 wakaba 1.3 $r-><AS::swcfg21:SWCFGDocument::swcfg21:ForLatest
376     .defaultElementTypeNamespaceURI>
377 wakaba 1.1 (<Q::dis:>);
378    
379     @Method:
380 wakaba 1.2 @@Name: createDISParser
381     @@Description:
382     @@@lang:en
383     @@@@:
384 wakaba 1.47 Creates a <IF::DISParser> object.
385 wakaba 1.2 @@Return:
386 wakaba 1.47 @@@Type: DISParser
387     @@@clsActualType: ManakaiDISParser
388 wakaba 1.2 @@@Description:
389     @@@@lang:en
390     @@@@@:
391 wakaba 1.1 A newly created <QUOTE::dis> parser.
392 wakaba 1.2 @@@PerlDef:
393 wakaba 1.3 $r = bless $self-><M::swcfg21:SWCFGImplementation::swcfg21:ForLatest
394     .createSWCFGParser>,
395 wakaba 1.1 <ClassName::ManakaiDISParser>;
396    
397     @Method:
398 wakaba 1.2 @@Name: createDISDatabase
399 wakaba 1.1 @@Description:
400     @@@lang:en
401     @@@@:
402 wakaba 1.2 Creates a new <QUOTE::dis> database.
403 wakaba 1.1 @@Return:
404 wakaba 1.47 @@@Type: DISDatabase
405     @@@clsActualType: ManakaiDISDatabase
406 wakaba 1.4 @@@Description:
407     @@@@lang:en
408     @@@@@:
409 wakaba 1.2 A newly created <QUOTE::dis> parser.
410 wakaba 1.4 @@@PerlDef:
411 wakaba 1.2 $r = bless {
412     forDef => {
413 wakaba 1.5 <Q::ManakaiDOM:all> => bless ({
414 wakaba 1.2 uri => <Q::ManakaiDOM:all>,
415     isa => {<Q::ManakaiDOM:all> => 1},
416     revISA => {},
417 wakaba 1.5 }, <ClassName::ManakaiDISForDefinition>),
418 wakaba 1.2 },
419     resDef => {},
420 wakaba 1.9 modDef => {},
421     seq => 0,
422 wakaba 1.3 }, <ClassName::ManakaiDISDatabase>;
423 wakaba 1.48 $r->{forDef}->{<Q::ManakaiDOM:all>}->{db} = $r;
424 wakaba 1.3
425     @Method:
426     @@Name: tfurisToURI
427     @@Description:
428     @@@lang:en
429     @@@@:
430     Converts a pair of name URI reference and <QUOTE::for> URI reference
431 wakaba 1.47 into a <Q::dis:TFQNames>-expanded URI reference.
432 wakaba 1.3 @@Param:
433     @@@Name: typeURI
434     @@@Type: NameURI
435     @@@Description:
436     @@@@lang:en
437     @@@@@:
438     A URI reference to identify a resource.
439 wakaba 1.49 @@@nullCase:
440 wakaba 1.3 @@@@Description:
441     @@@@@lang:en
442     @@@@@@:
443     Equivalent to <Q::DOMMain:any> (for historical reason).
444     @@Param:
445     @@@Name: forURI
446     @@@Type: ForURI
447     @@@Description:
448     @@@@lang:en
449     @@@@@:
450     A <QUOTE::for> URI reference.
451 wakaba 1.49 @@@nullCase:
452 wakaba 1.3 @@@@Description:
453     @@@@@lang:en
454     @@@@@@:
455     Equivalent to <QUOTE::for all>, i.e. <Q::ManakaiDOM:all>.
456     @@Return:
457     @@@Type:
458     DISCore:TFURI::ManakaiDOM:all
459     @@@Description:
460     @@@@lang:en
461     @@@@@:
462 wakaba 1.47 The <Q::dis:TFQNames>-expanded URI references.
463 wakaba 1.3 @@@PerlDef:
464     $typeURI = <Q::DOMMain:any> unless defined $typeURI;
465     $forURI = <Q::ManakaiDOM:all> unless defined $forURI;
466 wakaba 1.4 __CODE{tfurisToURI:: $turi => $typeURI, $furi => $forURI, $uri => $r}__;
467    
468     @ResourceDef:
469 wakaba 1.47 @@ForCheck: ManakaiDOM|ForClass
470 wakaba 1.4 @@QName: tfurisToURI
471 wakaba 1.60 @@rdf:type: DISPerl|BlockCode
472 wakaba 1.4 @@enDesc:
473     Converts a pair of name URI reference and <QUOTE::for> URI reference
474 wakaba 1.47 into a <Q::dis:TFQNames>-expanded URI reference.
475 wakaba 1.4 @@PerlDef:
476     if ($furi eq <Q::ManakaiDOM:all>) {
477     $uri = $turi;
478 wakaba 1.3 } else {
479     ## NOTE: [RFC 3986]
480     ## fragment := *(pchar / "/" / "?")
481     ## pchar := unreserved / pct-encoded / sub-delims / [:@]
482     ## unreserved := ALPHA / DIGIT / [._~-]
483     ## sub-delims := [!$&'()*+,;=]
484     ## NOTE: [XPointer Framework]
485     ## SchemeData := *EscapedData
486     ## EscapedData := NormalChar / "^(" / "^)" / "^^"
487     ## / "(" SchemeData ")"
488     ## NormalChar := UnicodeChar - [()^]
489 wakaba 1.5 my $__turi = $turi;
490     my $__furi = $furi;
491     for my $__uri ($__turi, $__furi) {
492 wakaba 1.58 $__uri =~ s{([^0-9A-Za-z!\$'()*,:;=?\@_./~-])}{sprintf '%%%02X', ord $1}ge;
493 wakaba 1.3 }
494 wakaba 1.58 $uri = qq<tag:suika.fam.cx,2005-09:$__turi+$__furi>;
495 wakaba 1.3 }
496 wakaba 1.2
497 wakaba 1.5 @ResourceDef:
498 wakaba 1.6 @@QName: tfpurisToURI
499 wakaba 1.60 @@rdf:type: DISPerl|BlockCode
500 wakaba 1.6 @@enDesc:
501     Converts a set of name URI reference and <QUOTE::for> URI reference
502     and <QUOTE::for+> URI references into a URi reference.
503 wakaba 1.47 @@ForCheck: ManakaiDOM|ForClass
504 wakaba 1.6 @@PerlDef:
505     if ($furi eq <Q::ManakaiDOM:all> and @{$forp} == 0) {
506     $uri = $turi;
507     } elsif (@{$forp}) {
508     my $__turi = $turi;
509     my $__furi = $furi;
510     for my $__uri ($__turi, $__furi) {
511 wakaba 1.58 $__uri =~ s{([^0-9A-Za-z!\$'()*,:;=?\@_./~-])}{sprintf '%%%02X', ord $1}ge;
512 wakaba 1.6 }
513     my @__fp;
514     for my $__uri (@{$forp}) {
515     my $__fpuri = $__uri;
516 wakaba 1.58 $__fpuri =~ s{([^0-9A-Za-z!\$'()*,:;=?\@_./~-])}
517 wakaba 1.6 {sprintf '%%%02X', ord $1}ge;
518     push @__fp, $__fpuri;
519     }
520 wakaba 1.58 $uri = qq<tag:suika.fam.cx,2005-09:$__turi+$__furi+>.join ('+', @__fp);
521 wakaba 1.6 } else {
522     my $__turi = $turi;
523     my $__furi = $furi;
524     for my $__uri ($__turi, $__furi) {
525 wakaba 1.58 $__uri =~ s{([^0-9A-Za-z!\$'(),*:;=?\@_./~-])}{sprintf '%%%02X', ord $1}ge;
526 wakaba 1.6 }
527 wakaba 1.58 $uri = qq<tag:suika.fam.cx,2005-09:$__turi+$__furi>;
528 wakaba 1.6 }
529    
530 wakaba 1.43 @ImplNote:
531     @@lang:en
532     @@@:
533     {TODO:: IRI support.
534     }
535    
536 wakaba 1.6 @ResourceDef:
537 wakaba 1.5 @@QName: getChildResourceURI
538 wakaba 1.60 @@rdf:type: DISPerl|BlockCode
539 wakaba 1.5 @@enDesc:
540     Gets an anonymous URI reference of a child resource of another
541     resource.
542 wakaba 1.47 @@ForCheck: ManakaiDOM|ForClass
543 wakaba 1.5 @@PerlDef:
544     my $__parent = $parentURI;
545     my $__ln = $localName;
546     for my $__uri ($__parent, $__ln) {
547 wakaba 1.58 $__uri =~ s{([^0-9A-Za-z!\$'(),*:;=?\@_./~-])}{sprintf '%%%02X', ord $1}ge;
548 wakaba 1.5 }
549 wakaba 1.58 $result = qq<data:suika.fam.cx,2005-09::$__parent+$__ln>;
550 wakaba 1.5
551 wakaba 1.8 @IntMethod:
552     @@Name: camelCaseToUnderscoreName
553     @@enDesc:
554     Converts a camelCase name to a underscored_name.
555     @@ManakaiDOM:isStatic:1
556 wakaba 1.47 @@ForCheck: ManakaiDOM|ForClass
557 wakaba 1.8 @@Param:
558     @@@Name: camelName
559     @@@Type:
560 wakaba 1.18 DISLang:String::ManakaiDOM:all
561 wakaba 1.8 @@@enDesc:
562     The source name.
563     @@Return:
564     @@@Type:
565 wakaba 1.18 DISLang:String::ManakaiDOM:all
566 wakaba 1.8 @@@enDesc:
567     The result name.
568     @@@PerlDef:
569     $r = $camelName;
570     $r =~ s/^([A-Z0-9]+)$/lc $1/ge;
571     $r =~ s/([A-Z][A-Z0-9]*)$/"_".lc $1/ge;
572     $r =~ s/([A-Z0-9])([A-Z0-9]*)([A-Z0-9])/$1.lc ($2)."_".lc $3/ge;
573     $r =~ s/([A-Z])/"_".lc $1/ge;
574     $r =~ s/(?=[0-9](?!$))/_/g;
575 wakaba 1.9
576 wakaba 1.60 @DOMFeature:provides: CoreFeature10
577 wakaba 1.1 ##DISImplementation
578    
579 wakaba 1.47 IFClsDef:
580     @IFQName: DISParser
581 wakaba 1.1 @ClsQName: ManakaiDISParser
582 wakaba 1.47
583     @IFISA: swcfg21|SWCFGParser||swcfg21|ForLatest
584 wakaba 1.1 @ClsISA:
585 wakaba 1.3 swcfg21:ManakaiSWCFGParser::swcfg21:ForLatest
586 wakaba 1.47
587 wakaba 1.1 @Description:
588     @@lang:en
589     @@@:
590     A SuikaWikiConfig/2.1 parser that returns <QUOTE::dis> object.
591     @Method:
592 wakaba 1.3 @@Name: parse
593     @@Description:
594     @@@lang:en
595     @@@@:
596 wakaba 1.1 Parses a <QUOTE::dis> document and returns it as an object tree.
597 wakaba 1.3 @@Param:
598     @@@Name: input
599     @@@Type:
600 wakaba 1.37 DOMLS:LSInput::ManakaiDOM:ManakaiDOMLatest
601 wakaba 1.3 @@@Description:
602     @@@@lang:en
603     @@@@@:
604 wakaba 1.1 The input source.
605 wakaba 1.3 @@Return:
606 wakaba 1.47 @@@Type: DISDocument
607     @@@clsActualType: ManakaiDISDocument
608 wakaba 1.3 @@@Description:
609     @@@@lang:en
610     @@@@@:
611 wakaba 1.1 The <QUOTE::dis> document object created from the <P::input>.
612     @@@RaiseException:
613     @@@@@:
614 wakaba 1.47 swcfg21:SWCFG_PARSE_ERR::swcfg21:ForLatest
615 wakaba 1.1 @@@@Description:
616     @@@@@lang:en
617     @@@@@@:
618     The <IF::swcfg21:SWCFGParser> was unable to load the SuikaWikiConfig
619     document.
620     @@@PerlDef:
621     __DEEP{
622 wakaba 1.28 $r = $self->SUPER::parse ($input)
623     ## NOTE: Method name directly written
624     #< M::swcfg21:ManakaiSWCFGParser
625     # ::swcfg21:ForLatest.parse> ($input)
626 wakaba 1.1 }__;
627     if (defined $r) {
628     $r = bless $r, <ClassName::ManakaiDISDocument>;
629 wakaba 1.4 $r-><AS::swcfg21:SWCFGDocument::swcfg21:ForLatest
630     .defaultElementTypeNamespaceURI>
631     (<Q::dis:>);
632 wakaba 1.1 }
633 wakaba 1.52
634     @IntMethod:
635     @@ForCheck: ManakaiDOM|ForClass
636     @@Operator:
637     @@@@: DISPerl|NewMethod
638     @@@ContentType: DISCore|QName
639     @@ForCheck: ManakaiDOM|ForClass
640     @@enDesc:
641     Creates a new instance of the <IF::DISParser> interface
642     and returns it.
643    
644     {NOTE:: This method is compatible with the role <Q::DOMLS:ParserRole>
645     so that this class is accessible via the
646     <M::DOMLS|DOMImplementationLSExtended.createMLSParser>
647     method.
648     }
649     @@Param:
650     @@@Name: impl
651     @@@Type: DOMFeature|MinimumImplementation||ManakaiDOM|ManakaiDOMLatest
652     @@@enDesc:
653     An implementation object. The <M::DOMFeature|GetFeature.getFeature>
654     method with parameter values <Feature::DIS|Core> and
655     <FeatureVer::1.0> respectively <kwd:MUST> return
656     an object implementing the <IF::DISImplementation> interface.
657     @@Param:
658     @@@Name: features
659     @@@Type: DISLang|String||ManakaiDOM|all
660     @@@dis:actualType: DOMFeature|FeaturesString||ManakaiDOM|ManakaiDOMLatest
661     @@@enDesc:
662     A list of requested features. In the current implementation
663     this parameter is ignored.
664     @@Return:
665     @@@Type: DOMMain|Object||ManakaiDOM|all
666     @@@actualType: ManakaiDISParser
667     @@@enDesc: The newly created parser object.
668     @@@PerlDef:
669     __DEEP{
670     $r = $self->SUPER::new
671     ($impl-><M::DOMFeature|GetFeature
672     ||ManakaiDOM|ManakaiDOMLatest.getFeature>
673     (<Q::swcfg21:Core> => '2.1'),
674     $features);
675     }__;
676 wakaba 1.1 ##DISParser
677    
678 wakaba 1.47 IFClsDef:
679     @IFQName: DISNode
680 wakaba 1.1 @ClsQName: ManakaiDISNode
681 wakaba 1.47
682 wakaba 1.1 @Description:
683     @@lang:en
684     @@@:
685     <QUOTE::dis> node objects.
686 wakaba 1.7 @ImplNote:
687     @@lang:en
688     @@@:
689     This class does not inherit
690     <Class::swcfg21:ManakaiSWCFGNode::swcfg21:ForLatest>, since
691     inheriting classes such as <Class::ManakaiDISElement> indirectly
692     inherit it.
693 wakaba 1.1
694     @MethodRedef:
695 wakaba 1.47 @@ForCheck: ManakaiDOM|ForClass
696 wakaba 1.1 @@Name:lookupNamespacePrefix
697     @@Description:
698     @@@lang:en
699     @@@@:
700     Looks up the namespace prefix associated to the given
701     namespace URI. The default namespaces are ignored.
702     @@Param:
703     @@@Name:namespaceURI
704 wakaba 1.3 @@@Type: AnyURI
705 wakaba 1.1 @@@Description:
706     @@@@lang:en
707     @@@@@:
708     The namespace URI to look for.
709 wakaba 1.49 @@@nullCase:
710 wakaba 1.1 @@@@Description:
711     @@@@@lang:en
712     @@@@@@:
713     The <DOM::null> namespace.
714     @@NamedParam:
715     @@@Name: makeNewBinding
716     @@@Type:
717 wakaba 1.18 DOMMain:boolean::ManakaiDOM:all
718 wakaba 1.1 @@@Description:
719     @@@@lang:en
720     @@@@@:
721     Whether a new namespace prefix should be bound when
722     no namespace URI has been associated yet.
723 wakaba 1.49 @@@TrueCase:
724 wakaba 1.1 @@@@Description:
725     @@@@@lang:en
726     @@@@@@:
727     New binding is made if no prefix associated.
728 wakaba 1.49 @@@FalseCase:
729 wakaba 1.1 @@@@Description:
730     @@@@@lang:en
731     @@@@@@:
732     Simply returns the <DOM::null> if no prefix associated.
733     @@Return:
734 wakaba 1.47 @@@Type: swcfg21|SWCFGString||swcfg21|ForLatest
735     @@@actualType:
736 wakaba 1.3 DISCore:NamespacePrefix::ManakaiDOM:all
737 wakaba 1.1 @@@Description:
738     @@@@lang:en
739     @@@@@:
740     An associated namespace prefix. If more than one prefix
741     are associated to the namespace URI, the returned prefix
742     is implementation dependent.
743 wakaba 1.49 @@@nullCase:
744 wakaba 1.1 @@@@Description:
745     @@@@@lang:en
746     @@@@@@:
747     No associated namespace prefix found.
748     @@@PerlDef:
749     $r = null;
750 wakaba 1.3 my $od = $self-><AG::swcfg21:SWCFGNode::swcfg21:ForLatest
751     .ownerDocument> || $self;
752 wakaba 1.53 my $binds = $od->{<H::mn:node>}->{<H::swcfg21:nsBinding>};
753 wakaba 1.1 if (defined $namespaceURI) {
754     FIND: {
755     for my $prefix (keys %$binds) {
756     if (defined $binds->{$prefix} and
757     $binds->{$prefix} eq $namespaceURI) {
758     $r = $prefix;
759     last FIND;
760     }
761     }
762 wakaba 1.7
763     ## From module list
764     try {
765     my $db = $self-><AG::ManakaiDISNode.ownerDISDocument>
766     -><AG::ManakaiDISDocument.disDatabase>;
767     for my $mod_uri (keys %{$db->{modDef}}) {
768     my $mod = $db-><M::ManakaiDISDatabase.getModule> ($mod_uri);
769 wakaba 1.48 my $mod_ln = $mod-><AG::DISAnyResource.localName>;
770 wakaba 1.7 next if exists $binds->{$mod_ln};
771 wakaba 1.57 my $ns_uri = $mod-><AG::DIS|DISModule.targetNamespaceURI>;
772     $ns_uri = '' unless defined $ns_uri;
773 wakaba 1.7 if ($ns_uri eq $namespaceURI) {
774     $r = $mod_ln;
775     last FIND;
776     }
777     }
778 wakaba 1.48 } catch <IF::DISException> with {
779 wakaba 1.7 my $err = shift;
780     $err->throw
781 wakaba 1.47 unless $err->{<Q::MDOMX:subtype>} eq <Q::NO_ASSOCIATED_DB_ERR>;
782 wakaba 1.7 };
783    
784 wakaba 1.1 last FIND unless $makeNewBinding;
785     ## Not found
786     if ($namespaceURI =~ /(\w+)$/) {
787     my $prefix = $1;
788     unless (exists $binds->{$prefix}) {
789     $binds->{$prefix} = $namespaceURI;
790     $r = $prefix;
791     last FIND;
792     }
793     }
794     my $i = 1;
795     {
796     unless (exists $binds->{'ns'.$i}) {
797     $binds->{$r = 'ns'.$i} = $namespaceURI;
798     last FIND;
799     }
800     $i++;
801     redo;
802     }
803     } # FIND
804     } else { ## Null namespace
805     FIND: {
806     if (exists $binds->{'nu'.'ll'} and not defined $binds->{'nu'.'ll'}) {
807     $r = 'nu'.'ll';
808     last FIND;
809     }
810     for my $prefix (keys %$binds) {
811     if (not defined $prefix) {
812     $r = $prefix;
813     last FIND;
814     }
815     }
816     last FIND unless $makeNewBinding;
817     ## Not found
818     my $i = '';
819     {
820     unless (exists $binds->{'nu'.'ll'.$i}) {
821     $binds->{$r = 'nu'.'ll'.$i} = null;
822     last FIND;
823     }
824     $i++;
825     redo;
826     }
827     }
828     }
829    
830     @MethodRedef:
831 wakaba 1.47 @@ForCheck: ManakaiDOM|ForClass
832 wakaba 1.1 @@Name:lookupNamespaceURI
833     @@Description:
834     @@@lang:en
835     @@@@:
836     Looks up the namespace URI associated to the given prefix.
837     @@Param:
838     @@@Name:prefix
839     @@@Type:
840 wakaba 1.3 DISCore:NamespacePrefix::ManakaiDOM:all
841 wakaba 1.1 @@@Description:
842     @@@@lang:en
843     @@@@@:
844     The namespace URI to look for.
845     @@NamedParam:
846     @@@Name: makeNewBinding
847     @@@Type:
848 wakaba 1.18 DOMMain:boolean::ManakaiDOM:all
849 wakaba 1.1 @@@Description:
850     @@@@lang:en
851     @@@@@:
852     Whether a new binding should be created if no namespace URI
853     is associated with the <P::prefix> or not.
854 wakaba 1.49 @@@TrueCase:
855 wakaba 1.1 @@@@Description:
856     @@@@@lang:en
857     @@@@@@:
858     A new binding to the temporary namespace URI
859     exactly same as <P::prefix> is created
860     if no binding found.
861 wakaba 1.49 @@@FalseCase:
862 wakaba 1.1 @@@@Description:
863     @@@@@lang:en
864     @@@@@@:
865     No new binding is created if no binding found. Note that
866     even if no association newly created, this method
867     returns the <DOM::null> value.
868 wakaba 1.12 @@NamedParam:
869     @@@Name: raisePrefixException
870     @@@Type:
871 wakaba 1.18 DOMMain:boolean::ManakaiDOM:all
872 wakaba 1.12 @@@enDesc:
873     Whehter an exception should be thrown if <P::prefix>
874     is not declared or not.
875 wakaba 1.1 @@Return:
876 wakaba 1.3 @@@Type: AnyURI
877 wakaba 1.1 @@@Description:
878     @@@@lang:en
879     @@@@@:The associated namespace URI.
880 wakaba 1.49 @@@nullCase:
881 wakaba 1.1 @@@@Description:
882     @@@@@lang:en
883     @@@@@@:
884 wakaba 1.3 No namespace URI is associated to the prefix or
885 wakaba 1.1 the <DOM::null> namespace is associated.
886 wakaba 1.12 @@@UndeclaredPrefixException:
887 wakaba 1.1 @@@PerlDef:
888 wakaba 1.51 my $od = $self-><AG::DISNode.ownerDISDocument> || $self;
889 wakaba 1.53 my $binds = $od->{<H::mn:node>}->{<H::swcfg21:nsBinding>};
890 wakaba 1.1 if (exists $binds->{$prefix}) {
891     $r = $binds->{$prefix};
892     } else {
893 wakaba 1.7 ## From module list
894     FIND: {
895     try {
896 wakaba 1.51 my $db = $od-><AG::DISDocument.disDatabase>;
897 wakaba 1.7 for my $mod_uri (keys %{$db->{modDef}}) {
898     my $mod = $db-><M::ManakaiDISDatabase.getModule> ($mod_uri);
899 wakaba 1.48 if ($mod-><AG::DISAnyResource.localName>
900 wakaba 1.7 eq $prefix) {
901 wakaba 1.57 $r = $mod-><AG::DIS|DISModule.targetNamespaceURI>;
902 wakaba 1.7 last FIND;
903     }
904     }
905 wakaba 1.48 } catch <IF::DISException> with {
906 wakaba 1.7 my $err = shift;
907     $err->throw
908 wakaba 1.47 unless $err->{<Q::MDOMX:subtype>} eq <Q::NO_ASSOCIATED_DB_ERR>;
909 wakaba 1.7 };
910     if ($makeNewBinding) {
911     $r = $binds->{$prefix} = $prefix;
912 wakaba 1.12 } elsif ($raisePrefixException) {
913     __EXCEPTION{DIS:UNDECLARED_NS_PREFIX_ERR::
914     infoset:prefix => {$prefix},
915     MDOMX:param-name => 'prefix',
916     DIS:sourceNode => {$self},
917     }__;
918 wakaba 1.7 } else {
919     $r = null;
920     }
921     } # FIND
922 wakaba 1.1 }
923    
924     @IntMethod:
925 wakaba 1.47 @@ForCheck: ManakaiDOM|ForClass
926 wakaba 1.1 @@Name:getNodeReference
927     @@Description:
928     @@@lang:en
929     @@@@:
930     Returns a new reference to the node object.
931     @@ManakaiDOM:isStatic:1
932     @@Param:
933     @@@Name:object
934 wakaba 1.47 @@@Type: ManakaiNode|NodeStem||ManakaiDOM|Perl
935 wakaba 1.1 @@@Description:
936     @@@@lang:en
937     @@@@@:
938     The node object to be referred.
939     @@Return:
940     @@@Type: ManakaiDISNode
941     @@@Description:
942     @@@@lang:en
943     @@@@@:
944     A newly created reference.
945     @@@PerlDef:
946     my $class;
947 wakaba 1.53 if ($object->{<H::swcfg21:nodeType>} eq '#element') {
948 wakaba 1.1 $class = <ClassName::ManakaiDISElement>;
949 wakaba 1.53 } elsif ($object->{<H::swcfg21:nodeType>} eq '#comment') {
950 wakaba 1.1 $class = <ClassName::ManakaiDISComment>;
951 wakaba 1.53 } elsif ($object->{<H::swcfg21:nodeType>} eq '#document') {
952 wakaba 1.1 $class = <ClassName::ManakaiDISDocument>;
953 wakaba 1.53 } elsif ($object->{<H::swcfg21:nodeType>} eq '#fragment') {
954 wakaba 1.1 $class = <ClassName::ManakaiDISDocumentFragment>;
955     } else {
956     __ASSERT{DISPerl:invariant::
957 wakaba 1.53 msg => {qq[Node type: "$object->{<H::swcfg21:nodeType>}" ].
958 wakaba 1.1 qq[(ref: "@{[ref $object]}")]},
959     }__;
960     }
961 wakaba 1.47 __CODE{ManakaiNode|getNewReference||ManakaiDOM|Perl::
962     $object => $object,
963     $ref => $r,
964     $class => $class,
965     }__;
966 wakaba 1.1
967 wakaba 1.2 @Attr:
968     @@Name:ownerDISDocument
969     @@Description:
970     @@@lang:en
971     @@@@:
972     The <QUOTE::dis> document object associated with this node.
973     @@Get:
974 wakaba 1.47 @@@Type: DISDocument
975     @@@clsActualType: ManakaiDISDocument
976 wakaba 1.2 @@@Description:
977     @@@@lang:en
978     @@@@@:
979     The document object associated with this node.
980 wakaba 1.49 @@@nullCase:
981 wakaba 1.2 @@@@Description:
982     @@@@@lang:en
983     @@@@@@:
984     This node is a document node.
985     @@@PerlDef:
986     $r = <ClassM::ManakaiDISNode.getNodeReference>
987 wakaba 1.53 ($self->{<H::mn:node>}->{<H::swcfg21:ownerDocument>})
988     if $self->{<H::mn:node>}->{<H::swcfg21:ownerDocument>};
989 wakaba 1.1 ##DISNode
990    
991 wakaba 1.47 IFClsDef:
992 wakaba 1.48 @IFQName: NSResolverDIS
993     @ClsQName: ManakaiNSResolverDIS
994 wakaba 1.1
995 wakaba 1.38
996 wakaba 1.1 @Method:
997 wakaba 1.48 @@Name: prefixToURI
998 wakaba 1.1 @@Description:
999     @@@lang:en
1000     @@@@:
1001 wakaba 1.48 Converts a namespace prefix into associated URI reference.
1002 wakaba 1.1 @@Param:
1003 wakaba 1.48 @@@Name: prefix
1004     @@@Type:
1005     DISCore:NamespacePrefix::ManakaiDOM:all
1006 wakaba 1.1 @@@Description:
1007     @@@@lang:en
1008     @@@@@:
1009 wakaba 1.48 A namespace prefix to look for.
1010 wakaba 1.49 @@@nullCase:
1011 wakaba 1.1 @@@@Description:
1012     @@@@@lang:en
1013     @@@@@@:
1014 wakaba 1.48 Returns the default namespace URI.
1015     @@NodeParam:
1016 wakaba 1.1 @@Return:
1017 wakaba 1.48 @@@Type: AnyURI
1018 wakaba 1.1 @@@Description:
1019     @@@@lang:en
1020 wakaba 1.48 @@@@@: The URI references associated.
1021 wakaba 1.2 @@@UndeclaredPrefixException:
1022     @@@PerlDef:
1023 wakaba 1.48 if (defined $prefix) {
1024     __DEEP{
1025     $r = $self-><M::SWCFGNode.lookupNamespaceURI> ($prefix);
1026     }__;
1027     unless (defined $r) {
1028     __EXCEPTION{UNDECLARED_NS_PREFIX_ERR::
1029     infoset:prefix => {$prefix},
1030     MDOMX:param-name => 'prefix',
1031     DIS:sourceNode => {$node},
1032     }__;
1033     }
1034 wakaba 1.53 } elsif (defined $self->{<H::mn:node>}
1035     ->{<H::DIS|defaultNamespaceURI>}) {
1036     $r = $self->{<H::mn:node>}->{<H::DIS|defaultNamespaceURI>};
1037 wakaba 1.48 } else { ## Default namespace
1038 wakaba 1.2 __DEEP{
1039 wakaba 1.48 $r = ($self-><AG::ManakaiDISNode.ownerDISDocument> || $self)
1040     -><AG::ManakaiDISDocument.moduleElement>
1041     -><AG::ManakaiDISModuleElement.definingNamespaceURI>;
1042 wakaba 1.2 }__;
1043 wakaba 1.48 }
1044 wakaba 1.1
1045     @Method:
1046 wakaba 1.48 @@Name: qnameToURI
1047 wakaba 1.1 @@Description:
1048     @@@lang:en
1049     @@@@:
1050 wakaba 1.48 Converts a qualified name (<Q::dis:TypeQName>) to
1051     an expanded URI reference.
1052 wakaba 1.1 @@Param:
1053 wakaba 1.48 @@@Name: qname
1054     @@@Type:
1055     dis:TypeQName::ManakaiDOM:all
1056 wakaba 1.1 @@@Description:
1057     @@@@lang:en
1058     @@@@@:
1059 wakaba 1.48 A qualified name.
1060     @@NodeParam:
1061     @@NamedParam:
1062     @@@Name: defaultNamespaceURI
1063     @@@Type: AnyURI
1064     @@@enDesc:
1065     Default namespace URI reference.
1066     @@@nullCase:
1067     @@@@enDesc:
1068     The default namespace is the namespace defined by the module
1069     to which this resource belongs.
1070 wakaba 1.1 @@Return:
1071 wakaba 1.48 @@@Type: AnyURI
1072 wakaba 1.1 @@@Description:
1073     @@@@lang:en
1074     @@@@@:
1075 wakaba 1.48 The expanded URI reference.
1076     @@@UndeclaredPrefixException:
1077 wakaba 1.2 @@@PerlDef:
1078 wakaba 1.48 $qname =~ s/^\s+//; $qname =~ s/\s+$//;
1079     my ($prefix, $lname) = split /\s*[:|]\s*/, $qname, 2;
1080     __DEEP{
1081     if (defined $lname) {
1082     $r = $self-><M::NSResolverDIS.prefixToURI> ($prefix) . $lname;
1083     } else { ## In default namespace
1084 wakaba 1.13 if (defined $defaultNamespaceURI) {
1085     $r = $defaultNamespaceURI . $prefix;
1086     } else {
1087 wakaba 1.48 $r = $self-><M::NSResolverDIS.prefixToURI> (null) . $prefix;
1088 wakaba 1.13 }
1089 wakaba 1.1 }
1090 wakaba 1.4 }__;
1091 wakaba 1.1
1092     @Method:
1093 wakaba 1.47 @@Name: qnameToPair
1094 wakaba 1.1 @@Description:
1095     @@@lang:en
1096     @@@@:
1097 wakaba 1.47 Converts a qualified name (<Q::dis:TypeQName>) to
1098 wakaba 1.1 a pair of namespace URI and local name.
1099     @@Param:
1100     @@@Name: qname
1101     @@@Type:
1102 wakaba 1.18 dis:TypeQName::ManakaiDOM:all
1103 wakaba 1.1 @@@Description:
1104     @@@@lang:en
1105     @@@@@:
1106     A qualified name.
1107     @@NodeParam:
1108     @@Return:
1109     @@@Type:
1110 wakaba 1.60 DISPerl:ARRAY::ManakaiDOM:all
1111 wakaba 1.1 @@@Description:
1112     @@@@lang:en
1113     @@@@@:
1114     A list of namespace URI and local name.
1115     @@@UndeclaredPrefixException:
1116     @@@PerlDef:
1117     $qname =~ s/^\s+//; $qname =~ s/\s+$//;
1118 wakaba 1.15 my ($prefix, $lname) = split /\s*[:|]\s*/, $qname, 2;
1119 wakaba 1.1 __DEEP{
1120     if (defined $lname) {
1121 wakaba 1.48 $r = [$self-><M::NSResolverDIS.prefixToURI> ($prefix), $lname];
1122 wakaba 1.1 } else { ## In default namespace
1123 wakaba 1.48 $r = [$self-><M::NSResolverDIS.prefixToURI> (null), $prefix];
1124 wakaba 1.1 }
1125 wakaba 1.4 }__;
1126 wakaba 1.1
1127     @Method:
1128 wakaba 1.3 @@Name: tfqnamesToURI
1129 wakaba 1.1 @@Description:
1130     @@@lang:en
1131     @@@@:
1132 wakaba 1.47 Converts a <Q::dis:TFQNames>
1133 wakaba 1.1 into an expanded URI reference.
1134     @@Param:
1135     @@@Name: tfqnames
1136     @@@Type:
1137 wakaba 1.18 dis:TFQNames::ManakaiDOM:all
1138 wakaba 1.1 @@@Description:
1139     @@@@lang:en
1140     @@@@@:
1141 wakaba 1.47 A <Q::dis:TFQNames> to identify a resource.
1142 wakaba 1.1 @@Param:
1143     @@@Name: defaultTypeURI
1144     @@@Type: NameURI
1145     @@@Description:
1146     @@@@lang:en
1147     @@@@@:
1148     A name URI reference used if it is missing from
1149     <P::tfqnames>.
1150 wakaba 1.49 @@@nullCase:
1151 wakaba 1.1 @@@@Description:
1152     @@@@@lang:en
1153     @@@@@@:
1154     Equivalent to <Q::DOMMain:any>.
1155     @@Param:
1156     @@@Name: defaultForURI
1157     @@@Type: ForURI
1158     @@@Description:
1159     @@@@lang:en
1160     @@@@@:
1161     A <QUOTE::for> URI reference used if it is missing from
1162     <P::tfqnames>.
1163 wakaba 1.49 @@@nullCase:
1164 wakaba 1.1 @@@@Description:
1165     @@@@@lang:en
1166     @@@@@@:
1167     Equivalent to <QUOTE::for all>, i.e. <Q::ManakaiDOM:all>.
1168     @@NodeParam:
1169     @@Return:
1170     @@@Type:
1171 wakaba 1.3 DISCore:TFURI::ManakaiDOM:all
1172 wakaba 1.1 @@@Description:
1173     @@@@lang:en
1174     @@@@@:
1175 wakaba 1.47 The <Q::dis:TFQNames>-expanded URI references.
1176 wakaba 1.1 @@@UndeclaredPrefixException:
1177     @@@PerlDef:
1178 wakaba 1.15 my ($typeq, $forq) = split /\s*[:|][:|]\s*/, $tfqnames, 2;
1179 wakaba 1.1 my ($typeURI, $forURI);
1180     if (defined $forq) {
1181     __DEEP{
1182     $typeURI = $typeq eq ''
1183     ? defined $defaultTypeURI ? $defaultTypeURI
1184     : <Q::DOMMain:any>
1185 wakaba 1.48 : $self-><M::NSResolverDIS.qnameToURI> ($typeq, %opt);
1186 wakaba 1.1 }__;
1187     if (length $forq) {
1188 wakaba 1.48 $forURI = $self-><M::NSResolverDIS.qnameToURI> ($forq, %opt);
1189 wakaba 1.1 } else {
1190     $forURI = <Q::ManakaiDOM:all>;
1191     }
1192     } else { ## "For" omitted
1193     __DEEP{
1194     $typeURI = $typeq eq ''
1195     ? defined $defaultTypeURI ? $defaultTypeURI
1196     : <Q::DOMMain:any>
1197 wakaba 1.48 : $self-><M::NSResolverDIS.qnameToURI> ($typeq, %opt);
1198 wakaba 1.1 }__;
1199 wakaba 1.3 $forURI = defined $defaultForURI ? $defaultForURI
1200     : <Q::ManakaiDOM:all>;
1201 wakaba 1.1 }
1202 wakaba 1.4 __CODE{tfurisToURI:: $turi => $typeURI, $furi => $forURI, $uri => $r}__;
1203 wakaba 1.2
1204     @Method:
1205 wakaba 1.33 @@Name: tfpqnamesToURI
1206     @@Description:
1207     @@@lang:en
1208     @@@@:
1209 wakaba 1.47 Converts a <Q::DISCore:TFPQNames>
1210 wakaba 1.33 into an expanded URI reference.
1211     @@Param:
1212     @@@Name: tfpqnames
1213     @@@Type:
1214     DISCore:TFPQNames::ManakaiDOM:all
1215     @@@Description:
1216     @@@@lang:en
1217     @@@@@:
1218 wakaba 1.47 A <Q::DISCore:TFPQNames> to identify a resource.
1219 wakaba 1.33 @@Param:
1220     @@@Name: defaultTypeURI
1221     @@@Type: NameURI
1222     @@@Description:
1223     @@@@lang:en
1224     @@@@@:
1225     A name URI reference used if it is missing from
1226     <P::tfqnames>.
1227 wakaba 1.49 @@@nullCase:
1228 wakaba 1.33 @@@@Description:
1229     @@@@@lang:en
1230     @@@@@@:
1231     Equivalent to <Q::DOMMain:any>.
1232     @@Param:
1233     @@@Name: defaultForURI
1234     @@@Type: ForURI
1235     @@@Description:
1236     @@@@lang:en
1237     @@@@@:
1238     A <QUOTE::for> URI reference used if it is missing from
1239     <P::tfqnames>.
1240 wakaba 1.49 @@@nullCase:
1241 wakaba 1.33 @@@@Description:
1242     @@@@@lang:en
1243     @@@@@@:
1244     Equivalent to <QUOTE::for all>, i.e. <Q::ManakaiDOM:all>.
1245     @@NodeParam:
1246     @@Return:
1247     @@@Type:
1248     DISCore:TFURI::ManakaiDOM:all
1249     @@@Description:
1250     @@@@lang:en
1251     @@@@@:
1252 wakaba 1.47 The <Q::dis:TFQNames>-expanded URI references.
1253 wakaba 1.33 @@@UndeclaredPrefixException:
1254     @@@PerlDef:
1255     my ($typeq, $forq, @forpq) = split /\s*[:|][:|]\s*/, $tfpqnames;
1256     my ($typeURI, $forURI);
1257     my $forpURI = [];
1258     undef $forq if defined $forq and $forq eq '+';
1259     if (defined $forq) {
1260     __DEEP{
1261     $typeURI = $typeq eq ''
1262     ? defined $defaultTypeURI ? $defaultTypeURI
1263     : <Q::DOMMain:any>
1264 wakaba 1.48 : $self-><M::NSResolverDIS.qnameToURI> ($typeq, %opt);
1265 wakaba 1.33 if (length $forq) {
1266 wakaba 1.48 $forURI = $self-><M::NSResolverDIS.qnameToURI> ($forq, %opt);
1267 wakaba 1.33 } else {
1268     $forURI = <Q::ManakaiDOM:all>;
1269     }
1270     }__;
1271     } else { ## "For" omitted
1272     __DEEP{
1273     $typeURI = $typeq eq ''
1274     ? defined $defaultTypeURI ? $defaultTypeURI
1275     : <Q::DOMMain:any>
1276 wakaba 1.48 : $self-><M::NSResolverDIS.qnameToURI> ($typeq, %opt);
1277 wakaba 1.33 }__;
1278     $forURI = defined $defaultForURI ? $defaultForURI
1279     : <Q::ManakaiDOM:all>;
1280     }
1281     __DEEP{
1282     for my $forpq (@forpq) {
1283 wakaba 1.48 push @$forpURI, $self-><M::NSResolverDIS.qnameToURI>
1284 wakaba 1.33 ($forpq, %opt);
1285     }
1286     }__;
1287     __CODE{tfpurisToURI:: $turi => $typeURI, $furi => $forURI,
1288     $forp => $forpURI, $uri => $r}__;
1289 wakaba 1.48 ##NSResolverDIS
1290    
1291     PropDef:
1292     @QName: defaultNamespaceURI
1293     @enDesc:
1294     Default namespace URI for an element.
1295 wakaba 1.57 @DIS:key: dns
1296 wakaba 1.48
1297     IFClsDef:
1298     @IFQName: DISElement
1299     @ClsQName: ManakaiDISElement
1300    
1301     @ClsISA: ManakaiNSResolverDIS
1302     @ClsISA: ManakaiDISNode
1303     @ClsISA:
1304     swcfg21:ManakaiSWCFGElement::swcfg21:ForLatest
1305     @ClsISA: dp|ManakaiDISElementPerl
1306    
1307     @Description:
1308     @@lang:en
1309     @@@:
1310     <QUOTE::dis> element node objects.
1311    
1312     @DISLang:role: ElementRole
1313 wakaba 1.33
1314     @Method:
1315 wakaba 1.48 @@Name: forMatch
1316     @@Description:
1317     @@@lang:en
1318     @@@@:
1319     Tests whether this element is for a <QUOTE::for> or not.
1320 wakaba 1.2 @@Param:
1321 wakaba 1.48 @@@Name: forArg
1322     @@@Type: ForURI
1323     @@@Description:
1324     @@@@lang:en
1325     @@@@@:
1326     The <QUOTE::For> URI reference to test against.
1327 wakaba 1.3 @@Param:
1328 wakaba 1.48 @@@Name: forpArg
1329     @@@Type: ForURIList
1330     @@@Description:
1331     @@@@lang:en
1332     @@@@@:
1333     The <QUOTE::For+> URI references to test against.
1334 wakaba 1.49 @@@nullCase:
1335 wakaba 1.48 @@@@Description:
1336     @@@@@lang:en
1337     @@@@@@:
1338     No additional <QUOTE::For> URI reference.
1339     Equivalent to an empty array reference.
1340 wakaba 1.49 @@NamedParam:
1341     @@@Name: databaseArg
1342     @@@Type: DISDatabase
1343     @@@enDesc:
1344     A <QUOTE::dis> database.
1345     @@@nullCase:
1346     @@@@enDesc:
1347     The database associated to the document is used.
1348 wakaba 1.2 @@Return:
1349 wakaba 1.48 @@@Type:
1350     DOMMain:boolean::ManakaiDOM:all
1351     @@@Description:
1352     @@@@lang:en
1353     @@@@@:
1354     Whether this element is for <P::forArg> and <P::forpArg> or not.
1355     @@@UndeclaredPrefixException:
1356     @@@NoDBException:
1357 wakaba 1.2 @@@PerlDef:
1358 wakaba 1.48 $forArg = <Q::ManakaiDOM:all> unless defined $forArg;
1359     $forpArg ||= [];
1360    
1361     FORMATCH: {
1362     __DEEP{
1363 wakaba 1.49 my $for_res = ($databaseArg ||=
1364     $self-><AG::DISNode.ownerDISDocument>
1365     -><AG::DISDocument.disDatabase>)
1366     -><M::DISDatabase.getFor> ($forArg);
1367 wakaba 1.48 my $forp_res = [map {
1368 wakaba 1.49 $databaseArg-><M::DISDatabase.getFor> ($_)
1369 wakaba 1.48 } @{$forpArg}];
1370    
1371     my @ce = @{$self-><M::ManakaiDISElement.disAllChildElements>};
1372     for my $ce (@ce) {
1373     my $et = $ce-><AG::swcfg21:SWCFGElement::swcfg21:ForLatest
1374     .expandedURI>;
1375     if ($et eq <Q::dis:ForCheck>) {
1376     my $fors = [split /\s+/, $ce-><M::swcfg21:SWCFGNode
1377     ::swcfg21:ForLatest.value>];
1378     FCs: for my $f (@$fors) {
1379     if ($f =~ /^!=(.+)$/) { ## -- NOT EQUAL TO
1380     my $uri = $self-><M::NSResolverDIS.qnameToURI> ($1);
1381 wakaba 1.49 my $for = $databaseArg-><M::DISDatabase.getFor> ($uri);
1382 wakaba 1.48 $for-><AS::DISAnyResource.isReferred> ($ce);
1383     for my $arg_res ($for_res, @{$forp_res}) {
1384     if ($arg_res eq $for) {
1385     $r = false;
1386     last FORMATCH;
1387     }
1388     }
1389     } elsif ($f =~ /^!(.+)$/) { ## -- NOT ISA
1390     my $uri = $self-><M::NSResolverDIS.qnameToURI> ($1);
1391 wakaba 1.49 my $for = $databaseArg-><M::DISDatabase.getFor> ($uri);
1392 wakaba 1.48 $for-><AS::DISAnyResource.isReferred> ($ce);
1393     for my $arg_res ($for_res, @{$forp_res}) {
1394     if ($arg_res-><M::DISFor.isaURI> ($uri)) {
1395     $r = false;
1396     last FORMATCH;
1397     }
1398     }
1399     } elsif ($f =~ /^=(.+)$/) { ## -- EQUAL TO
1400     my $uri = $self-><M::NSResolverDIS.qnameToURI> ($1);
1401 wakaba 1.49 my $for = $databaseArg-><M::DISDatabase.getFor> ($uri);
1402 wakaba 1.48 $for-><AS::DISAnyResource.isReferred> ($ce);
1403     for my $arg_res ($for_res, @{$forp_res}) {
1404     if ($arg_res eq $for) {
1405     next FCs;
1406     }
1407     }
1408     $r = false;
1409     last FORMATCH;
1410     } else { ## -- ISA
1411     my $uri = $self-><M::NSResolverDIS.qnameToURI> ($f);
1412 wakaba 1.49 my $for = $databaseArg-><M::DISDatabase.getFor> ($uri);
1413 wakaba 1.48 $for-><AS::DISAnyResource.isReferred> ($ce);
1414     for my $arg_res ($for_res, @{$forp_res}) {
1415     if ($arg_res-><M::DISFor.isaURI> ($uri)) {
1416     next FCs;
1417     }
1418     }
1419     $r = false;
1420     last FORMATCH;
1421     }
1422     } # FCs
1423     } # dis:ForCheck
1424     } # children
1425    
1426     my $has_for = false;
1427     for my $ce (@ce) {
1428     if ($ce-><AG::swcfg21:SWCFGElement::swcfg21:ForLatest
1429     .expandedURI> eq
1430     <Q::dis:For>) {
1431     my $fors = [split /\s+/, $ce-><M::swcfg21:SWCFGNode
1432     ::swcfg21:ForLatest.value>];
1433     my $ok = true;
1434     $has_for = true;
1435     AFOR: for my $f (@$fors) {
1436     if ($f =~ /^!=(.+)$/) { ## -- NOT EQUAL TO
1437     my $uri = $self-><M::NSResolverDIS.qnameToURI> ($1);
1438 wakaba 1.49 my $for = $databaseArg-><M::DISDatabase.getFor> ($uri);
1439 wakaba 1.48 $for-><AS::DISAnyResource.isReferred> ($ce);
1440     if ($for eq $for_res) {
1441     $ok = false;
1442     last AFOR;
1443     }
1444     } elsif ($f =~ /^!(.+)$/) { ## -- NOT ISA
1445     my $uri = $self-><M::NSResolverDIS.qnameToURI> ($1);
1446 wakaba 1.49 my $for = $databaseArg-><M::DISDatabase.getFor> ($uri);
1447 wakaba 1.48 $for-><AS::DISAnyResource.isReferred> ($ce);
1448     if ($for_res-><M::ManakaiDISForDefinition.isaURI> ($uri)) {
1449     $ok = false;
1450     last AFOR;
1451     }
1452     } elsif ($f =~ /^=(.+)$/) { ## -- EQUAL TO
1453     my $uri = $self-><M::NSResolverDIS.qnameToURI> ($1);
1454 wakaba 1.49 my $for = $databaseArg-><M::DISDatabase.getFor> ($uri);
1455 wakaba 1.48 $for-><AS::DISAnyResource.isReferred> ($ce);
1456     unless ($for eq $for_res) {
1457     $ok = false;
1458     last AFOR;
1459     }
1460     } else { ## -- ISA
1461     my $uri = $self-><M::NSResolverDIS.qnameToURI> ($f);
1462 wakaba 1.49 my $for = $databaseArg-><M::DISDatabase.getFor> ($uri);
1463 wakaba 1.48 $for-><AS::DISAnyResource.isReferred> ($ce);
1464     unless ($for_res-><M::ManakaiDISForDefinition.isaURI>($uri)){
1465     $ok = false;
1466     last AFOR;
1467     }
1468     }
1469     } # AFOR
1470     if ($ok) {
1471     $r = true;
1472     last FORMATCH;
1473     }
1474     } # dis:For
1475     } # $ce
1476     $r = $has_for ? false : true;
1477     }__;
1478     } # FORMATCH
1479 wakaba 1.2
1480 wakaba 1.4 @Method:
1481 wakaba 1.48 @@Name: mediaTypeMatch
1482     @@Description:
1483     @@@lang:en
1484     @@@@:
1485     Tests whether the content media type of this element matches to
1486     a type or not.
1487     @@Param:
1488     @@@Name: mediaType
1489     @@@Type: MediaTypeURI
1490     @@@Description:
1491     @@@@lang:en
1492     @@@@@:
1493     A media type URI reference to test against.
1494     @@Param:
1495     @@@Name: defaultMediaType
1496     @@@Type: MediaTypeURI
1497     @@@Description:
1498     @@@@lang:en
1499     @@@@@:
1500     The default media type for this element.
1501 wakaba 1.49 @@@nullCase:
1502 wakaba 1.48 @@@@Description:
1503     @@@@@lang:en
1504     @@@@@@:
1505     No default type provided. All <P::mediaType> will match.
1506 wakaba 1.4 @@ForParam:
1507     @@ForpParam:
1508 wakaba 1.49 @@NamedParam:
1509     @@@Name: databaseArg
1510     @@@Type: DISDatabase
1511     @@@enDesc:
1512     A <QUOTE::dis> database.
1513     @@@nullCase:
1514     @@@@enDesc:
1515     The database associated to the document is used.
1516 wakaba 1.4 @@Return:
1517 wakaba 1.48 @@@Type:
1518     DOMMain:boolean::ManakaiDOM:all
1519     @@@Description:
1520     @@@@lang:en
1521     @@@@@:
1522     Whether this element is of <P::mediaType> or not.
1523 wakaba 1.2 @@@PerlDef:
1524 wakaba 1.48 if (defined $mediaType) {
1525     __DEEP{
1526 wakaba 1.49 my $ctn = $self-><M::SWCFGNode.getAttributeNS>
1527     (<Q::dis:>, 'ContentType');
1528 wakaba 1.48 my $ct;
1529     $ct = $ctn-><AG::DISElement.qnameValueURI> if $ctn;
1530     $ct = $defaultMediaType unless defined $ct;
1531     my $res = $self-><AG::ManakaiDISNode.ownerDISDocument>
1532     -><AG::ManakaiDISDocument.disDatabase>
1533     -><M::ManakaiDISDatabase.getResource> ($ct);
1534     $res-><AS::DISAnyResource.isReferred> ($ctn or $self);
1535     unless ($res-><M::ManakaiDISResourceDefinition
1536     .isSubsetOfURI> ($mediaType)) {
1537     $r = false;
1538     } else {
1539     $r = true;
1540     }
1541     }__;
1542     } else {
1543     $r = true;
1544     }
1545 wakaba 1.5
1546 wakaba 1.10 @Method:
1547 wakaba 1.48 @@Name:mediaTypeURI
1548 wakaba 1.10 @@enDesc:
1549 wakaba 1.48 The URI reference of the media type of this element.
1550     @@Type: MediaTypeURI
1551     @@NamedParam:
1552     @@@Name:defaultMediaType
1553     @@@Type:MediaTypeURI
1554     @@@enDesc:
1555     The default media type URI reference.
1556     @@@nullCase:
1557     @@@@enDesc:
1558     No default is specified.
1559     @@ForParam:
1560     @@ForpParam:
1561 wakaba 1.10 @@Return:
1562     @@@enDesc:
1563 wakaba 1.48 The media type URI reference of this element.
1564 wakaba 1.2 @@@nullCase:
1565     @@@@enDesc:
1566 wakaba 1.48 This element has no media type information and
1567     <P::defaultMediaType> parameter is not provided.
1568 wakaba 1.2 @@@UndeclaredPrefixException:
1569 wakaba 1.3 @@@PerlDef:
1570 wakaba 1.48 __DEEP{
1571     $r = $defaultMediaType;
1572 wakaba 1.49 my $ctn = $self-><M::SWCFGNode.getAttributeNS>
1573     (<Q::dis:>, 'ContentType');
1574 wakaba 1.48 $r = $ctn-><AG::DISElement.qnameValueURI> if $ctn;
1575     }__;
1576 wakaba 1.4
1577 wakaba 1.48 @Method:
1578     @@Name: disGetAttribute
1579     @@enDesc:
1580     Gets an attribute node.
1581     @@Param:
1582     @@@Name: attrName
1583     @@@Type: AnyURI
1584     @@@enDesc:
1585     The name expanded URI of the node to retrieve.
1586     @@ForParam:
1587     @@ForpParam:
1588     @@MediaTypeParam:
1589     @@MediaTypeDefaultParam:
1590 wakaba 1.49 @@NamedParam:
1591     @@@Name: databaseArg
1592     @@@Type: DISDatabase
1593     @@@enDesc:
1594     A <QUOTE::dis> database.
1595     @@@nullCase:
1596     @@@@enDesc:
1597     The database associated to the document is used.
1598 wakaba 1.48 @@Return:
1599     @@@Type: DISElement
1600     @@@clsActualType: ManakaiDISElement
1601     @@@enDesc:
1602     The attribute (property) element node.
1603     @@@nullCase:
1604     @@@@enDesc:
1605     No attribute node found.
1606     @@@PerlDef:
1607     C: for my $c (@{$self-><M::ManakaiDISElement.disChildElements>
1608 wakaba 1.49 (for_arg => $forArg, forp_arg => $forpArg,
1609     database_arg => $databaseArg)}) {
1610 wakaba 1.48 if ($c-><AG::swcfg21:SWCFGElement::swcfg21:ForLatest
1611     .expandedURI> eq $attrName and
1612     $c-><M::ManakaiDISElement.mediaTypeMatch>
1613     ($mediaType, $defaultMediaType,
1614 wakaba 1.49 for_arg => $forArg, forp_arg => $forpArg,
1615     database_arg => $databaseArg)) {
1616 wakaba 1.48 $r = $c;
1617     last C;
1618     }
1619     }
1620    
1621     @Method:
1622     @@Name: disGetAttributeList
1623     @@enDesc:
1624     Gets attribute nodes.
1625     @@Param:
1626     @@@Name: attrName
1627     @@@Type: AnyURI
1628     @@@enDesc:
1629     The name expanded URI of the node to retrieve.
1630     @@ForParam:
1631     @@ForpParam:
1632     @@MediaTypeParam:
1633     @@MediaTypeDefaultParam:
1634 wakaba 1.49 @@NamedParam:
1635     @@@Name: databaseArg
1636     @@@Type: DISDatabase
1637     @@@enDesc:
1638     A <QUOTE::dis> database.
1639     @@@nullCase:
1640     @@@@enDesc:
1641     The database associated to the document is used.
1642 wakaba 1.48 @@Return:
1643     @@@Type: DISElementList
1644     @@@clsActualType: ManakaiDISElementList
1645     @@@enDesc:
1646     The attribute (property) element nodes.
1647     @@@PerlDef:
1648     $r = bless [], <ClassName::ManakaiDISElementList>;
1649     for my $c (@{$self-><M::ManakaiDISElement.disChildElements>
1650 wakaba 1.49 (for_arg => $forArg, forp_arg => $forpArg,
1651     database_arg => $databaseArg)}) {
1652 wakaba 1.48 if ($c-><AG::swcfg21:SWCFGElement::swcfg21:ForLatest
1653     .expandedURI> eq $attrName and
1654     $c-><M::ManakaiDISElement.mediaTypeMatch>
1655     ($mediaType, $defaultMediaType,
1656 wakaba 1.49 for_arg => $forArg, forp_arg => $forpArg,
1657     database_arg => $databaseArg)) {
1658 wakaba 1.48 push @$r, $c;
1659     }
1660     }
1661    
1662     @Method:
1663     @@Name: disChildElements
1664     @@enDesc:
1665     A list of child elements, with <QUOTE::for> check.
1666     @@ForParam:
1667     @@ForpParam:
1668 wakaba 1.49 @@NamedParam:
1669     @@@Name: databaseArg
1670     @@@Type: DISDatabase
1671     @@@enDesc:
1672     A <QUOTE::dis> database.
1673     @@@nullCase:
1674     @@@@enDesc:
1675     The database associated to the document is used.
1676 wakaba 1.48 @@Return:
1677     @@@Type: DISElementList
1678     @@@clsActualType: ManakaiDISElementList
1679     @@@enDesc:
1680     The current snapshot of child nodes.
1681     @@@PerlDef:
1682     $r = bless [], <ClassName::ManakaiDISElementList>;
1683     __DEEP{
1684     C: for my $cn (@{$self-><AG::swcfg21:SWCFGNode::swcfg21:ForLatest
1685     .childNodes>}) {
1686     ## $cn is an #element.
1687     my $dn;
1688     __CODE{ManakaiNode|getNewReference||ManakaiDOM|Perl::
1689 wakaba 1.53 $object => {$cn->{<H::mn:node>}},
1690 wakaba 1.48 $ref => $dn,
1691     $class => {<ClassName::ManakaiDISElement>},
1692     }__;
1693     next C unless $dn-><M::ManakaiDISElement.forMatch>
1694 wakaba 1.49 ($forArg, $forpArg,
1695     database_arg => $databaseArg);
1696 wakaba 1.48 push @$r, $dn;
1697     }
1698     }__;
1699    
1700     @Method:
1701     @@Name: disAllChildElements
1702     @@enDesc:
1703     A list of child elements, without <QUOTE::for> check.
1704     @@Return:
1705     @@@Type: DISElementList
1706     @@@clsActualType: ManakaiDISElementList
1707     @@@enDesc:
1708     The current snapshot of child nodes.
1709     @@@PerlDef:
1710     $r = bless [], <ClassName::ManakaiDISElementList>;
1711     __DEEP{
1712     for my $cn (@{$self-><AG::swcfg21:SWCFGNode::swcfg21:ForLatest
1713     .childNodes>}) {
1714     ## $cn is an #element.
1715     my $dn;
1716     __CODE{ManakaiNode|getNewReference||ManakaiDOM|Perl::
1717 wakaba 1.53 $object => {$cn->{<H::mn:node>}},
1718 wakaba 1.48 $ref => $dn,
1719     $class => {<ClassName::ManakaiDISElement>},
1720     }__;
1721     push @$r, $dn;
1722     }
1723     }__;
1724    
1725     @Attr:
1726     @@Name: qnameValueURI
1727     @@enDesc:
1728     The element value (written as <Q::dis:TypeQName>), as URI reference.
1729     \
1730     {NOTE:: What should be if list value?
1731     \
1732     }
1733     @@Get:
1734     @@@Type:AnyURI
1735     @@@nullCase:
1736     @@@@enDesc:
1737     No value.
1738     @@@UndeclaredPrefixException:
1739     @@@PerlDef:
1740     __DEEP{
1741     my $v = $self-><M::swcfg21:SWCFGNode::swcfg21:ForLatest.value>;
1742     if (defined $v and not ref $v eq 'ARRAY') {
1743     $r = $self-><M::NSResolverDIS.qnameToURI> ($v, node => $self);
1744     } else {
1745     $r = null;
1746     }
1747     }__;
1748    
1749     @Attr:
1750     @@Name: qnameValueLocalName
1751 wakaba 1.4 @@enDesc:
1752     The local name part of the element value (assumed as
1753 wakaba 1.47 written as <Q::dis:TypeQName>).
1754 wakaba 1.4 \
1755     {NOTE:: What should be if list value?
1756     \
1757     }
1758     @@Get:
1759     @@@Type:
1760 wakaba 1.18 DISCore:LocalName::ManakaiDOM:all
1761 wakaba 1.4 @@@nullCase:
1762     @@@@enDesc:
1763     No value.
1764     @@@PerlDef:
1765     __DEEP{
1766 wakaba 1.14 my $v = $self-><M::swcfg21:SWCFGNode::swcfg21:ForLatest.value>;
1767 wakaba 1.4 if (defined $v and not ref $v eq 'ARRAY') {
1768 wakaba 1.15 my ($n, $v) = split /\s*[:|]\s*/, $v, 2;
1769 wakaba 1.4 $r = defined $v ? $v : $n;
1770     } else {
1771     $r = null;
1772     }
1773     }__;
1774    
1775     @Attr:
1776 wakaba 1.43 @@Name: qnameValuePrefix
1777     @@enDesc:
1778     The prefix part of the element value (assumed as
1779 wakaba 1.47 written as <Q::dis:TypeQName>).
1780 wakaba 1.43 \
1781     {NOTE:: What should be if list value?
1782     \
1783     }
1784     @@Get:
1785     @@@Type:
1786     DISCore:NamespacePrefix::ManakaiDOM:all
1787     @@@nullCase:
1788     @@@@enDesc:
1789     No value.
1790     @@@PerlDef:
1791     __DEEP{
1792     my $v = $self-><M::swcfg21:SWCFGNode::swcfg21:ForLatest.value>;
1793     if (defined $v and not ref $v eq 'ARRAY') {
1794     my ($p, $l) = split /\s*[:|]\s*/, $v, 2;
1795     $r = defined $l ? $p : null;
1796     } else {
1797     $r = null;
1798     }
1799     }__;
1800    
1801     @Attr:
1802 wakaba 1.4 @@Name: qnameValueNamespaceURI
1803     @@enDesc:
1804     The namespace URI of the element value (assumed as written
1805 wakaba 1.47 in <Q::dis:TypeQName>).
1806 wakaba 1.4 \
1807     {NOTE:: What should be if list value?
1808     \
1809     }
1810     @@Get:
1811     @@@Type:AnyURI
1812     @@@nullCase:
1813     @@@@enDesc:
1814     No value.
1815     @@@UndeclaredPrefixException:
1816     @@@PerlDef:
1817     __DEEP{
1818 wakaba 1.14 my $v = $self-><M::swcfg21:SWCFGNode::swcfg21:ForLatest.value>;
1819 wakaba 1.4 if (defined $v and not ref $v eq 'ARRAY') {
1820 wakaba 1.15 my ($p, $v) = split /\s*[:|]\s*/, $v, 2;
1821 wakaba 1.48 $r = $self-><M::NSResolverDIS.prefixToURI>
1822 wakaba 1.4 (defined $v ? $p : null);
1823     } else {
1824     $r = null;
1825     }
1826     }__;
1827 wakaba 1.2
1828 wakaba 1.6 @Method:
1829 wakaba 1.3 @@Name: tfqnamesValueURI
1830 wakaba 1.2 @@enDesc:
1831 wakaba 1.47 The element value (written as <Q::dis:TFQNames>),
1832 wakaba 1.2 as URI reference.
1833     \
1834     {NOTE:: What should be if list value?
1835     \
1836     }
1837 wakaba 1.6 @@Param:
1838     @@@Name: defaultTypeURI
1839     @@@Type: NameURI
1840     @@@Description:
1841     @@@@lang:en
1842     @@@@@:
1843     A name URI reference used if it is missing from
1844     <P::tfqnames>.
1845 wakaba 1.49 @@@nullCase:
1846 wakaba 1.6 @@@@Description:
1847     @@@@@lang:en
1848     @@@@@@:
1849     Equivalent to <Q::DOMMain:any>.
1850     @@Param:
1851     @@@Name: defaultForURI
1852     @@@Type: ForURI
1853     @@@Description:
1854     @@@@lang:en
1855     @@@@@:
1856     A <QUOTE::for> URI reference used if it is missing from
1857     <P::tfqnames>.
1858 wakaba 1.49 @@@nullCase:
1859 wakaba 1.6 @@@@Description:
1860     @@@@@lang:en
1861     @@@@@@:
1862     Equivalent to <QUOTE::for all>, i.e. <Q::ManakaiDOM:all>.
1863 wakaba 1.33 @@ForParam:
1864     @@ForpParam:
1865 wakaba 1.49 @@NamedParam:
1866     @@@Name:databaseArg
1867     @@@Type:DISDatabase
1868 wakaba 1.6 @@Return:
1869 wakaba 1.2 @@@Type:ResourceURI
1870     @@@nullCase:
1871     @@@@enDesc:
1872     No value.
1873     @@@UndeclaredPrefixException:
1874 wakaba 1.3 @@@PerlDef:
1875 wakaba 1.14 my $v = $self-><M::swcfg21:SWCFGNode::swcfg21:ForLatest.value>;
1876 wakaba 1.2 if (defined $v and not ref $v eq 'ARRAY') {
1877     __DEEP{
1878 wakaba 1.33 if ($self-><M::ManakaiDISElement.mediaTypeMatch>
1879 wakaba 1.48 (<Q::DISCore:TFPQNames>, <Q::DISCore:TFPQNames>,
1880 wakaba 1.49 for_arg => $forArg, forp_arg => $forpArg,
1881     database_arg => $databaseArg)) {
1882 wakaba 1.48 $r = $self-><M::NSResolverDIS.tfpqnamesToURI>
1883 wakaba 1.33 ($v, $defaultTypeURI, $defaultForURI,
1884     node => $self);
1885     } else {
1886 wakaba 1.48 $r = $self-><M::NSResolverDIS.tfqnamesToURI>
1887 wakaba 1.33 ($v, $defaultTypeURI, $defaultForURI,
1888     node => $self);
1889     }
1890 wakaba 1.2 }__;
1891     } else {
1892     $r = null;
1893     }
1894 wakaba 1.7
1895     @Method:
1896     @@Name: elementTypeMatch
1897     @@enDesc:
1898     Returns whether the element type of this element matches
1899     with another element type (either the same element type or
1900     this type is a subtype of another type).
1901     @@Param:
1902     @@@Name: etype
1903     @@@Type: ResourceURI
1904     @@@enDesc:
1905     An element type name URI reference to test.
1906     @@Return:
1907     @@@Type:
1908 wakaba 1.18 DOMMain:boolean::ManakaiDOM:all
1909 wakaba 1.7 @@@TrueCase:
1910     @@@@enDesc:
1911     Either the element type expanded URI reference of this element is
1912     same as <P::etype> or it is a sub-element type of <P::etype>.
1913     @@@FalseCase:
1914     @@@@enDesc:
1915     This element is not of <P::etype>.
1916     @@@NoDBException:
1917     @@@PerlDef:
1918     __DEEP{
1919 wakaba 1.14 my $et = $self-><AG::swcfg21:SWCFGElement::swcfg21:ForLatest
1920 wakaba 1.7 .expandedURI>;
1921     my $rdef = $self-><AG::ManakaiDISNode.ownerDISDocument>
1922     -><AG::ManakaiDISDocument.disDatabase>
1923     -><M::ManakaiDISDatabase.getResource> ($et);
1924     $r = $rdef-><M::ManakaiDISResourceDefinition.isSubsetOfURI> ($etype);
1925     }__;
1926    
1927     @Attr:
1928     @@Name: isResourceElement
1929     @@enDesc:
1930     Whether this element defines a resource or not.
1931     \
1932     {NOTE:: An element defines a resource if its element type is
1933     <Q::dis:ResourceDef> or its subtype.
1934     \
1935     }
1936     @@Get:
1937     @@@Type:
1938 wakaba 1.18 DOMMain:boolean::ManakaiDOM:all
1939 wakaba 1.7 @@@TrueCase:
1940     @@@@enDesc:
1941     This element defines a resource.
1942     @@@FalseCase:
1943     @@@@enDesc:
1944     This element does not define any resource.
1945     @@@NoDBException:
1946     @@@PerlDef:
1947     __DEEP{
1948 wakaba 1.49 $r = ($self-><AG::SWCFGElement.expandedURI> eq <Q::dis:ResourceDef>);
1949 wakaba 1.7 }__;
1950    
1951 wakaba 1.49 @Method:
1952 wakaba 1.7 @@Name: isPropertyElement
1953     @@enDesc:
1954     Whether this element is a property or not.
1955     \
1956     {NOTE:: An element is a property if its element type is
1957     <Q::rdf:type> or if its element type's <Q::rdf:type>
1958     property is <Q::rdf:Property> or is <Q::dis:subsetOf>
1959     <Q::rdf:Property>.
1960     \
1961     }
1962 wakaba 1.49 @@NamedParam:
1963     @@@Name: databaseArg
1964     @@@Type: DIS|DISDatabase
1965     @@@nullCase:
1966     @@Return:
1967 wakaba 1.7 @@@Type:
1968 wakaba 1.18 DOMMain:boolean::ManakaiDOM:all
1969 wakaba 1.7 @@@TrueCase:
1970     @@@@enDesc:
1971     This element is a property.
1972     @@@FalseCase:
1973     @@@@enDesc:
1974     This element is not a property.
1975     @@@NoDBException:
1976     @@@PerlDef:
1977     __DEEP{
1978 wakaba 1.48 my $xn = $self-><AG::SWCFGElement.expandedURI>;
1979 wakaba 1.7 if ($xn eq <Q::rdf:type>) {
1980     $r = true;
1981     } else {
1982 wakaba 1.49 my $rdef = ($databaseArg or
1983     $self-><AG::DISNode.ownerDISDocument>
1984     -><AG::DISDocument.disDatabase>)
1985     -><M::DISDatabase.getResource> ($xn);
1986 wakaba 1.48 $r = $rdef-><M::DISResource.isTypeURI> (<Q::rdf:Property>);
1987 wakaba 1.18 }
1988     }__;
1989 wakaba 1.19
1990     @Method:
1991 wakaba 1.38 @@Name: getFeature
1992     @@Description:
1993     @@@lang:en
1994     @@@@:
1995     Returns a specialized object that implements the specialized
1996     interfaces of the specified feature and version.
1997     @@Param:
1998     @@@Name: feature
1999 wakaba 1.47 @@@Type: swcfg21|SWCFGString||swcfg21|ForLatest
2000     @@@actualType: DOMFeature|FeatureNameString||ManakaiDOM|ManakaiDOMLatest
2001 wakaba 1.38 @@@Description:
2002     @@@@lang:en
2003     @@@@@:
2004     A feature name to request.
2005     @@Param:
2006     @@@Name: version
2007 wakaba 1.47 @@@Type: swcfg21|SWCFGString||swcfg21|ForLatest
2008 wakaba 1.38 @@@actualType:
2009 wakaba 1.47 DOMFeature|FeatureVersionString||ManakaiDOM|ManakaiDOMLatest
2010 wakaba 1.38 @@@Description:
2011     @@@@lang:en
2012     @@@@@:
2013     A feature version number to request.
2014     @@Return:
2015     @@@Type:
2016     DOMMain:Object::ManakaiDOM:all
2017     @@@Description:
2018     @@@@lang:en
2019     @@@@@:
2020     An object that implements the specialized APIs of the
2021     <P::feature> and <P::version>.
2022 wakaba 1.49 @@@nullCase:
2023     @@@@enDesc:
2024 wakaba 1.38 There is no object available that implements interfaces
2025     associated with the <P::feature> and <P::version>.
2026     @@@PerlDef:
2027     $feature =~ s/^\+//;
2028     CLASS: for my $class (grep {
2029     $Message::Util::DIS::ManakaiDISElement::CompatClass{$_}
2030     } keys %Message::Util::DIS::ManakaiDISElement::CompatClass) {
2031     if ($Message::DOM::ClassFeature{$class}->{$feature}->{$version}) {
2032 wakaba 1.47 __CODE{ManakaiNode|getNewReference||ManakaiDOM|Perl::
2033 wakaba 1.53 $object => {$self->{<H::mn:node>}},
2034 wakaba 1.47 $ref => $r,
2035     $class => $class,
2036     }__;
2037 wakaba 1.38 last CLASS;
2038     }
2039     }
2040 wakaba 1.1
2041 wakaba 1.48 @Method:
2042     @@Name: unlinkFromDocument
2043     @@enDesc:
2044     Removes any relationship to this node from the owner document tree.
2045     In addition, namespace bindings are copied from the document.
2046     The node <kwd:MUST> be a cloned one (or just newly created one)
2047     so that it does not have any parent-child relationship.
2048    
2049     {NOTE:: Once a subtree has removed from the document, the nodes
2050     belongs to the subtree can't be part of any document anymore.
2051     }
2052 wakaba 1.49 @@Param:
2053     @@@Name: databaseArg
2054     @@@Type: DISDatabase
2055     @@@enDesc:
2056     The <QUOTE::dis> database.
2057 wakaba 1.48 @@Return:
2058     @@@PerlDef:
2059     __DEEP{
2060 wakaba 1.53 my $ods = $self->{<H::mn:node>}->{<H::swcfg21:ownerDocument>};
2061     $self->{<H::mn:node>}->{<H::swcfg21:nsBinding>}
2062 wakaba 1.49 = $self-><M::DISElement.getNamespaceBindingList> ($databaseArg);
2063 wakaba 1.53 $self->{<H::mn:node>}->{<H::DIS|defaultNamespaceURI>}
2064 wakaba 1.49 = ${$self-><M::DISElement.getDefaultNamespaceURIRef>};
2065 wakaba 1.53 my @nodes = ($self->{<H::mn:node>});
2066 wakaba 1.49 while (defined (my $node = shift @nodes)) {
2067 wakaba 1.53 CORE::delete $node->{<H::swcfg21:ownerDocument>};
2068     push @nodes, grep {$_} @{$node->{<H::swcfg21:childNodes>}},
2069     $node->{<H::swcfg21:shadowContent>},
2070     $node->{<H::swcfg21:shadowSibling>};
2071 wakaba 1.49 }
2072 wakaba 1.53 $self->{<H::mn:node>}
2073 wakaba 1.49 -><M::ManakaiNode|NodeStem||ManakaiDOM|Perl.orphanate>;
2074     }__;
2075    
2076     @Method:
2077     @@Name: getNamespaceBindingList
2078     @@enDesc:
2079     Returns the <QUOTE::live> hash reference of namespace bindings.
2080 wakaba 1.51 @@Type: DISPerl|HASH||ManakaiDOM|all
2081 wakaba 1.49 @@Param:
2082     @@@Name: databaseArg
2083     @@@Type: DISDatabase
2084     @@@enDesc:
2085     The <QUOTE::dis> database.
2086     @@Return:
2087     @@@PerlDef:
2088 wakaba 1.53 my $ods = $self->{<H::mn:node>}->{<H::swcfg21:ownerDocument>};
2089     if ($ods->{<H::DIS|allNSBindings>}) {
2090     $r = $ods->{<H::DIS|allNSBindings>};
2091 wakaba 1.49 } else {
2092     if ($databaseArg) {
2093     for my $mod_uri (keys %{$databaseArg->{modDef}}) {
2094     my $mod = $databaseArg-><M::DISDatabase.getModule> ($mod_uri);
2095 wakaba 1.53 $ods->{<H::DIS|allNSBindings>}
2096 wakaba 1.49 ->{$mod-><AG::DISAnyResource.localName>}
2097 wakaba 1.57 = $mod-><AG::DIS|DISModule.targetNamespaceURI>;
2098 wakaba 1.48 }
2099     }
2100 wakaba 1.53 for my $prefix (keys %{$ods->{<H::swcfg21:nsBinding>}}) {
2101     $ods->{<H::DIS|allNSBindings>}->{$prefix}
2102     = $ods->{<H::swcfg21:nsBinding>}->{$prefix};
2103 wakaba 1.48 }
2104 wakaba 1.53 $r = $ods->{<H::DIS|allNSBindings>};
2105 wakaba 1.49 }
2106    
2107     @Method:
2108     @@Name: getDefaultNamespaceURIRef
2109     @@enDesc: A reference to the URI of the default namespace.
2110 wakaba 1.51 @@Type: DISPerl|SCALAR||ManakaiDOM|all
2111 wakaba 1.49 @@Return:
2112     @@@PerlDef:
2113 wakaba 1.53 my $ods = $self->{<H::mn:node>}->{<H::swcfg21:ownerDocument>};
2114     if ($ods->{<H::DIS|defaultNamespaceURI>}) {
2115     $r = \ ($ods->{<H::DIS|defaultNamespaceURI>});
2116 wakaba 1.49 } else {
2117     __DEEP{
2118 wakaba 1.53 $r = \($ods->{<H::DIS|defaultNamespaceURI>}
2119 wakaba 1.49 = $self-><AG::DISNode.ownerDISDocument>
2120     -><AG::DISDocument.moduleElement>
2121     -><AG::DISModuleElement.definingNamespaceURI>);
2122     }__;
2123     }
2124    
2125 wakaba 1.48
2126     @Method:
2127     @@Name: preserveNodePath
2128     @@enDesc:
2129     Saves a copy of node path string.
2130     @@Return:
2131     @@@PerlDef:
2132     __DEEP{
2133     $self-><M::SWCFGNode.flag> (nodePath => $self-><M::SWCFGNode.nodePath>
2134     (key => [qw/QName Name Type type/]));
2135     }__;
2136    
2137     @Method:
2138     @@Operator:
2139     @@@ContentType:
2140     dis:TypeQName
2141     @@@@:
2142     DISPerl:CloneMethod
2143 wakaba 1.19 @@Description:
2144     @@@lang:en
2145     @@@@:
2146 wakaba 1.48 Makes a copy of this node. All child nodes are cloned and
2147     all flags and options are copied (rather than cloned).
2148     The new node does not have any parent.
2149     @@Return:
2150     @@@Type: DISElement
2151 wakaba 1.19 @@@Description:
2152     @@@@lang:en
2153     @@@@@:
2154 wakaba 1.48 The cloned node.
2155     \
2156     If this node is a document node, then the another document is made.
2157     @@@PerlDef:
2158     $r = bless $self->SUPER::clone, <ClassName::ManakaiDISElement>;
2159     ##DISElement
2160 wakaba 1.19
2161 wakaba 1.49 PropDef:
2162     @QName: allNSBindings
2163     @enDesc:
2164     Collected set of namespace bindings for a node.
2165    
2166 wakaba 1.47 IFClsDef:
2167     @IFQName: DISModuleElement
2168     @ClsQName: ManakaiDISModuleElement
2169 wakaba 1.19
2170 wakaba 1.47 @IFISA: DISElement
2171 wakaba 1.4 @ClsISA: ManakaiDISElement
2172 wakaba 1.47
2173 wakaba 1.4 @enDesc:
2174     The <Q::dis:Module> elements.
2175    
2176 wakaba 1.38 @DISLang:role:
2177     @@@:
2178     DISLang:NullRole
2179     @@DISCore:stopISARecursive:1
2180    
2181 wakaba 1.4 @Attr:
2182     @@Name: requireElement
2183     @@enDesc:
2184     The <Q::dis:Require> child element. The element is
2185     newly created if not exist.
2186 wakaba 1.47 @@Type: DISElement
2187     @@clsActualType: ManakaiDISElement
2188 wakaba 1.4 @@Get:
2189     @@@PerlDef:
2190     __DEEP{
2191 wakaba 1.29 $r = bless $self-><M::swcfg21:SWCFGNode
2192 wakaba 1.4 ::swcfg21:ForLatest.getAttributeNS>
2193 wakaba 1.29 (<Q::dis:>, 'Require', make_new_node => true),
2194     <ClassName::ManakaiDISElement>;
2195 wakaba 1.4 }__;
2196    
2197     @Attr:
2198     @@Name: defaultForURI
2199     @@enDesc:
2200     The value of <Q::dis:DefaultFor> attribute.
2201     @@Type: ForURI
2202     @@Get:
2203     @@@enDesc:
2204     The value of <Q::dis:DefaultFor> child element. If missing,
2205     <Q::ManakaiDOM:all> is returned.
2206     @@@PerlDef:
2207     __DEEP{
2208     my $df = $self-><M::swcfg21:SWCFGNode::swcfg21:ForLatest
2209     .getAttributeNS>
2210     (<Q::dis:>, 'DefaultFor');
2211     if ($df) {
2212 wakaba 1.29 $r = (bless $df, <ClassName::ManakaiDISElement>)
2213 wakaba 1.48 -><AG::DISElement.qnameValueURI>
2214 wakaba 1.4 || <Q::ManakaiDOM:all>;
2215     } else {
2216     $r = <Q::ManakaiDOM:all>;
2217     }
2218     }__;
2219     @@Set:
2220     @@@PerlDef:
2221     __DEEP{
2222     $self-><M::swcfg21:SWCFGNode::swcfg21:ForLatest.setAttributeNS>
2223     (<Q::dis:>, 'DefaultFor' => $given);
2224     }__;
2225 wakaba 1.7
2226     @Attr:
2227     @@Name: definingNamespaceURI
2228     @@enDesc:
2229 wakaba 1.48 The value of <Q::dis:Namespace> attribute, i.e.
2230 wakaba 1.7 the URI reference of the namespace that this module primary
2231     defines.
2232     \
2233     {NOTE:: Defining namespace URI is <QUOTE::for> independent.
2234     \
2235     }
2236     @@Type: AnyURI
2237     @@Get:
2238     @@@PerlDef:
2239     __DEEP{
2240     my $df = $self-><M::swcfg21:SWCFGNode::swcfg21:ForLatest
2241     .getAttributeNS>
2242     (<Q::dis:>, 'Namespace');
2243     if ($df) {
2244 wakaba 1.14 $r = $df-><M::swcfg21:SWCFGNode::swcfg21:ForLatest.value>;
2245 wakaba 1.7 } else {
2246     __ASSERT{DISPerl:invariant::
2247     msg => {qq["dis:Namespace" attribute not found]},
2248     }__;
2249     }
2250     }__;
2251     @@Set:
2252     @@@PerlDef:
2253     __DEEP{
2254     $self-><M::swcfg21:SWCFGNode::swcfg21:ForLatest.setAttributeNS>
2255     (<Q::dis:>, 'Namespace' => $given);
2256     }__;
2257 wakaba 1.4 ##DISModuleElement
2258    
2259 wakaba 1.47 IFClsDef:
2260     @IFQName: DISElementList
2261 wakaba 1.2 @ClsQName: ManakaiDISElementList
2262 wakaba 1.47
2263 wakaba 1.2 @enDesc:
2264     @@lang:en
2265     @@@:
2266     Lists of elements.
2267     \
2268     {NOTE:: <Class::ManakaiDISElementList> is <QUOTE::dead>;
2269     later changes to the tree does not affect this type of objects.
2270     \
2271     }
2272     ##DISElementList
2273    
2274 wakaba 1.47 IFClsDef:
2275     @IFQName: DISComment
2276 wakaba 1.1 @ClsQName: ManakaiDISComment
2277 wakaba 1.47
2278 wakaba 1.7 @ClsISA: ManakaiDISNode
2279 wakaba 1.1 @ClsISA:
2280 wakaba 1.3 swcfg21:ManakaiSWCFGComment::swcfg21:ForLatest
2281 wakaba 1.47
2282 wakaba 1.1 @Description:
2283     @@lang:en
2284     @@@:
2285     <QUOTE::dis> comment node objects.
2286     ##DISComment
2287    
2288 wakaba 1.47 IFClsDef:
2289     @IFQName: DISDocumentFragment
2290 wakaba 1.1 @ClsQName: ManakaiDISDocumentFragment
2291 wakaba 1.47
2292 wakaba 1.7 @ClsISA: ManakaiDISNode
2293 wakaba 1.1 @ClsISA:
2294 wakaba 1.3 swcfg21:ManakaiSWCFGDocumentFragment::swcfg21:ForLatest
2295 wakaba 1.47
2296 wakaba 1.1 @Description:
2297     @@lang:en
2298     @@@:
2299     <QUOTE::dis> document fragment node objects.
2300     ##DISDocumentFragment
2301    
2302 wakaba 1.47 IFClsDef:
2303     @IFQName: DISDocument
2304 wakaba 1.1 @ClsQName: ManakaiDISDocument
2305 wakaba 1.47
2306 wakaba 1.7 @ClsISA: ManakaiDISNode
2307 wakaba 1.1 @ClsISA:
2308 wakaba 1.3 swcfg21:ManakaiSWCFGDocument::swcfg21:ForLatest
2309 wakaba 1.47
2310 wakaba 1.1 @Description:
2311     @@lang:en
2312     @@@:
2313     <QUOTE::dis> document node objects.
2314 wakaba 1.2
2315     @Attr:
2316 wakaba 1.4 @@Name: moduleElement
2317     @@enDesc:
2318     The <Q::dis:Module> element in this document. The element is
2319     newly created if not exist.
2320 wakaba 1.47 @@Type: DISModuleElement
2321     @@clsActualType: ManakaiDISModuleElement
2322 wakaba 1.4 @@Get:
2323     @@@PerlDef:
2324     __DEEP{
2325     $r = $self-><M::swcfg21:SWCFGNode
2326     ::swcfg21:ForLatest.getAttributeNS>
2327     (<Q::dis:>, 'Module', make_new_node => true);
2328     }__;
2329     $r = bless $r, <ClassName::ManakaiDISModuleElement>;
2330    
2331     @Attr:
2332 wakaba 1.2 @@Name: disDatabase
2333     @@enDesc:
2334     Associated <QUOTE::dis> database.
2335    
2336 wakaba 1.47 @@Type: DISDatabase
2337     @@clsActualType: ManakaiDISDatabase
2338 wakaba 1.2 @@Get:
2339     @@@NoDBException:
2340     @@@PerlDef:
2341 wakaba 1.53 if ($self->{<H::mn:node>}->{<H::DIS|db>}) {
2342     $r = $self->{<H::mn:node>}->{<H::DIS|db>};
2343 wakaba 1.2 } else {
2344     __EXCEPTION{NO_ASSOCIATED_DB_ERR}__;
2345     }
2346     @@Set:
2347     @@@PerlDef:
2348 wakaba 1.53 $self->{<H::mn:node>}->{<H::DIS|db>} = $given;
2349 wakaba 1.2 require Scalar::Util;
2350 wakaba 1.53 Scalar::Util::weaken ($self->{<H::mn:node>}->{<H::DIS|db>});
2351 wakaba 1.5
2352     @Method:
2353     @@Name: disChildElements
2354     @@enDesc:
2355 wakaba 1.10 A list of child elements, with <QUOTE::for> checks.
2356 wakaba 1.5 @@ForParam:
2357     @@ForpParam:
2358 wakaba 1.49 @@NamedParam:
2359     @@@Name: databaseArg
2360     @@@Type: DISDatabase
2361     @@@enDesc:
2362     A <QUOTE::dis> database.
2363     @@@nullCase:
2364     @@@@enDesc:
2365     The database associated to the document is used.
2366 wakaba 1.5 @@Return:
2367 wakaba 1.47 @@@Type: DISElementList
2368     @@@clsActualType: ManakaiDISElementList
2369 wakaba 1.5 @@@enDesc:
2370     The current snapshot of child nodes.
2371     @@@PerlDef:
2372     $r = bless [], <ClassName::ManakaiDISElementList>;
2373     __DEEP{
2374 wakaba 1.47 C: for my $cn (@{$self-><AG::swcfg21:SWCFGNode::swcfg21:ForLatest
2375 wakaba 1.5 .childNodes>}) {
2376 wakaba 1.47 next C unless $cn-><AG::swcfg21:SWCFGNode::swcfg21:ForLatest
2377 wakaba 1.5 .nodeType> eq '#element';
2378 wakaba 1.47 my $dn;
2379     __CODE{ManakaiNode|getNewReference||ManakaiDOM|Perl::
2380 wakaba 1.53 $object => {$cn->{<H::mn:node>}},
2381 wakaba 1.47 $ref => $dn,
2382     $class => {<ClassName::ManakaiDISElement>},
2383     }__;
2384     next C unless $dn-><M::ManakaiDISElement.forMatch>
2385 wakaba 1.49 ($forArg, $forpArg,
2386     database_arg => $databaseArg);
2387 wakaba 1.5 push @$r, $dn;
2388     }
2389     }__;
2390 wakaba 1.10
2391     @Method:
2392     @@Name: disAllChildElements
2393     @@enDesc:
2394     A list of child elements, without <QUOTE::for> checks.
2395     @@Return:
2396 wakaba 1.47 @@@Type: DISElementList
2397     @@@clsActualType: ManakaiDISElementList
2398 wakaba 1.10 @@@enDesc:
2399     The current snapshot of child nodes.
2400     @@@PerlDef:
2401     $r = bless [], <ClassName::ManakaiDISElementList>;
2402     __DEEP{
2403 wakaba 1.47 C: for my $cn (@{$self-><AG::swcfg21:SWCFGNode::swcfg21:ForLatest
2404 wakaba 1.10 .childNodes>}) {
2405 wakaba 1.47 next C unless $cn-><AG::swcfg21:SWCFGNode::swcfg21:ForLatest
2406 wakaba 1.10 .nodeType> eq '#element';
2407 wakaba 1.47 my $dn;
2408     __CODE{ManakaiNode|getNewReference||ManakaiDOM|Perl::
2409 wakaba 1.53 $object => {$cn->{<H::mn:node>}},
2410 wakaba 1.47 $ref => $dn,
2411     $class => {<ClassName::ManakaiDISElement>},
2412     }__;
2413 wakaba 1.10 push @$r, $dn;
2414     }
2415     }__;
2416 wakaba 1.51
2417     @Method:
2418     @@Name: addNamespaceBinding
2419     @@Param:
2420     @@@Name: prefix
2421     @@@Type: DISLang|String||ManakaiDOM|all
2422     @@Param:
2423     @@@Name: namespaceURI
2424     @@@Type: DISLang|String||ManakaiDOM|all
2425     @@@nullCase:
2426     @@Return:
2427     @@@PerlDef:
2428     if (defined $namespaceURI) {
2429 wakaba 1.53 $self->{<H::mn:node>}->{<H::swcfg21:nsBinding>}->{$prefix}
2430 wakaba 1.51 = $namespaceURI;
2431     } else {
2432 wakaba 1.53 CORE::delete $self->{<H::mn:node>}->{<H::swcfg21:nsBinding>}
2433 wakaba 1.51 ->{$prefix};
2434     }
2435 wakaba 1.1 ##DISDocument
2436 wakaba 1.2
2437     PropDef:
2438     @QName: db
2439     @enDesc:
2440     Associated <QUOTE::dis> database.
2441     @rdfs:domain: ManakaiDISDocument
2442     @rdfs:range: ManakaiDISDatabase
2443    
2444     ## -- Definition object database
2445    
2446 wakaba 1.47 IFClsDef:
2447     @IFQName: DISDatabase
2448 wakaba 1.2 @ClsQName: ManakaiDISDatabase
2449 wakaba 1.47
2450 wakaba 1.48 @ClsISA: dp|ManakaiDISDatabasePerl
2451 wakaba 1.47 @ClsISA: ManakaiDISExceptionTarget
2452    
2453 wakaba 1.2 @enDesc:
2454     Resource database created from <QUOTE::dis> source data.
2455    
2456 wakaba 1.38 @DISLang:role: DatabaseRole
2457    
2458 wakaba 1.2 @Method:
2459     @@Name: getModule
2460     @@Description:
2461     @@@lang:en
2462     @@@@:
2463     Returns a <QUOTE::dis> module definition.
2464     @@Param:
2465 wakaba 1.9 @@@Name: moduleURI
2466 wakaba 1.2 @@@Type: ModuleURI
2467     @@@Description:
2468     @@@@lang:en
2469     @@@@@:
2470     A <QUOTE::dis> module URI reference.
2471 wakaba 1.9 @@ForParam:
2472 wakaba 1.2 @@Return:
2473 wakaba 1.47 @@@Type: DISModule
2474     @@@clsActualType: ManakaiDISModuleDefinition
2475 wakaba 1.2 @@@Description:
2476     @@@@lang:en
2477     @@@@@:
2478     The module definition.
2479     @@@PerlDef:
2480 wakaba 1.9 my $modURI;
2481     if (defined $forArg) {
2482     __CODE{tfurisToURI:: $turi => $moduleURI, $furi => $forArg,
2483     $uri => $modURI}__;
2484     } else {
2485     $modURI = $moduleURI;
2486     }
2487 wakaba 1.2 if (defined $self->{modDef}->{$modURI}) {
2488     $r = $self->{modDef}->{$modURI};
2489     } else {
2490     $r = $self->{modDef}->{$modURI}
2491     = bless {
2492     uri => $modURI,
2493     db => $self,
2494     for => <Q::ManakaiDOM:all>,
2495     forp => [],
2496     }, <ClassName::ManakaiDISModuleDefinition>;
2497     require Scalar::Util;
2498     Scalar::Util::weaken ($r->{db});
2499     }
2500    
2501     @Method:
2502     @@Name: getFor
2503     @@Description:
2504     @@@lang:en
2505     @@@@:
2506     Returns a <QUOTE::for> definition object.
2507     @@Param:
2508     @@@Name: forURI
2509     @@@Type: ForURI
2510     @@@Description:
2511     @@@@lang:en
2512     @@@@@:
2513     A <QUOTE::for> URI reference.
2514 wakaba 1.49 @@@nullCase:
2515 wakaba 1.2 @@@@Description:
2516     @@@@@lang:en
2517     @@@@@@:
2518     Defaulted to <Q::ManakaiDOM:all>.
2519     @@Return:
2520 wakaba 1.47 @@@Type: DISFor
2521     @@@clsActualType: ManakaiDISForDefinition
2522 wakaba 1.2 @@@PerlDef:
2523     $forURI = <Q::ManakaiDOM:all> unless defined $forURI;
2524     if (defined $self->{forDef}->{$forURI}) {
2525     $r = $self->{forDef}->{$forURI};
2526 wakaba 1.55 } elsif (defined $self->{<H::DIS|resourceModuleMap>}->{$forURI}) {
2527     __DEEP{
2528     $self-><M::dp|ManakaiDISDatabasePerl.plLoadDISDatabaseModule>
2529     ($self-><M::DIS|DISDatabase.getModule>
2530     (${$self->{<H::DIS|resourceModuleMap>}->{$forURI}}));
2531     }__;
2532     unless (defined $self->{forDef}->{$forURI}) {
2533     __EXCEPTION{DIS|RESOURCE_NOT_DEFINED_ERR::
2534     DIS:uri => {$forURI},
2535     DIS:moduleURI => {${$self->{<H::DIS|resourceModuleMap>}
2536     ->{$forURI}}},
2537     }__;
2538     }
2539     $r = $self->{forDef}->{$forURI};
2540 wakaba 1.2 } else {
2541     $r = $self->{forDef}->{$forURI}
2542     = bless {
2543     uri => $forURI,
2544     isa => {<Q::ManakaiDOM:all> => true},
2545     revISA => {},
2546     db => $self,
2547     }, <ClassName::ManakaiDISForDefinition>;
2548     $self->{forDef}->{<Q::ManakaiDOM:all>}->{revISA}->{$forURI} = true;
2549     require Scalar::Util;
2550     Scalar::Util::weaken ($r->{db});
2551     }
2552    
2553     @Method:
2554     @@Name: getResource
2555     @@Description:
2556     @@@lang:en
2557     @@@@:
2558     Returns a <QUOTE::dis> resource definition.
2559     @@Param:
2560 wakaba 1.9 @@@Name: resourceURI
2561 wakaba 1.2 @@@Type: ResourceURI
2562     @@@Description:
2563     @@@@lang:en
2564     @@@@@:
2565     A <QUOTE::dis> resource URI reference.
2566 wakaba 1.3 @@@nullCase:
2567 wakaba 1.2 @@@@Description:
2568     @@@@@lang:en
2569     @@@@@@:
2570     Defaulted to <Q::DOMMain:any>.
2571 wakaba 1.9 @@ForParam:
2572 wakaba 1.2 @@Return:
2573 wakaba 1.47 @@@Type: DISResource
2574     @@@clsActualType: ManakaiDISResourceDefinition
2575 wakaba 1.2 @@@Description:
2576     @@@@lang:en
2577     @@@@@:
2578     The resource definition.
2579 wakaba 1.54 @@@RaiseException:
2580     @@@@@: DIS|RESOURCE_NOT_DEFINED_ERR
2581     @@@@enDesc:
2582     The resource should be included in database submodule but
2583     it is not.
2584 wakaba 1.2 @@@PerlDef:
2585 wakaba 1.9 $resourceURI = <Q::DOMMain:any> unless defined $resourceURI;
2586     my $resURI;
2587     if (defined $forArg) {
2588     __CODE{tfurisToURI:: $turi => $resourceURI, $furi => $forArg,
2589     $uri => $resURI}__;
2590     } else {
2591     $resURI = $resourceURI;
2592     }
2593 wakaba 1.54
2594 wakaba 1.2 if (defined $self->{resDef}->{$resURI}) {
2595     $r = $self->{resDef}->{$resURI};
2596 wakaba 1.54 } elsif (defined $self->{<H::DIS|resourceModuleMap>}->{$resURI}) {
2597     __DEEP{
2598     $self-><M::dp|ManakaiDISDatabasePerl.plLoadDISDatabaseModule>
2599     ($self-><M::DIS|DISDatabase.getModule>
2600     (${$self->{<H::DIS|resourceModuleMap>}->{$resURI}}));
2601     }__;
2602     unless (defined $self->{resDef}->{$resURI}) {
2603     __EXCEPTION{DIS|RESOURCE_NOT_DEFINED_ERR::
2604     DIS:uri => {$resURI},
2605     DIS:moduleURI => {${$self->{<H::DIS|resourceModuleMap>}
2606     ->{$resURI}}},
2607     }__;
2608     }
2609     $r = $self->{resDef}->{$resURI};
2610 wakaba 1.2 } else {
2611     $r = $self->{resDef}->{$resURI}
2612     = bless {
2613     uri => $resURI,
2614 wakaba 1.6 aliasURI => {$resURI => true},
2615 wakaba 1.2 db => $self,
2616     for => <Q::ManakaiDOM:all>,
2617     forp => [],
2618 wakaba 1.9 seq => -1,
2619 wakaba 1.2 }, <ClassName::ManakaiDISResourceDefinition>;
2620     require Scalar::Util;
2621     Scalar::Util::weaken ($r->{db});
2622     }
2623 wakaba 1.3
2624     @Method:
2625 wakaba 1.61 @@Name: getAnyResource
2626     @@enDesc:
2627     Returns a resource object, either module, <Q::for>, or resource.
2628     @@Param:
2629     @@@Name: resourceURI
2630     @@@Type: ResourceURI
2631     @@@Description:
2632     @@@@lang:en
2633     @@@@@:
2634     A resource URI.
2635     @@@nullCase:
2636     @@@@Description:
2637     @@@@@lang:en
2638     @@@@@@:
2639     Defaulted to <Q::DOMMain:any>.
2640     @@ForParam:
2641     @@Return:
2642     @@@Type: DIS|DISAnyResource
2643     @@@Description:
2644     @@@@lang:en
2645     @@@@@:
2646     The resource definition.
2647     @@@RaiseException:
2648     @@@@@: DIS|RESOURCE_NOT_DEFINED_ERR
2649     @@@@enDesc:
2650     The resource should be included in database submodule but
2651     it is not.
2652     @@@PerlDef:
2653     $resourceURI = <Q::DOMMain:any> unless defined $resourceURI;
2654     my $resURI;
2655     if (defined $forArg) {
2656     __CODE{tfurisToURI:: $turi => $resourceURI, $furi => $forArg,
2657     $uri => $resURI}__;
2658     } else {
2659     $resURI = $resourceURI;
2660     }
2661    
2662     if (defined $self->{resDef}->{$resURI}) {
2663     $r = $self->{resDef}->{$resURI};
2664     } elsif (defined $self->{modDef}->{$resURI}) {
2665     $r = $self->{modDef}->{$resURI};
2666     } elsif (defined $self->{forDef}->{$resURI}) {
2667     $r = $self->{forDef}->{$resURI};
2668     } elsif (defined $self->{<H::DIS|resourceModuleMap>}->{$resURI}) {
2669     __DEEP{
2670     $self-><M::dp|ManakaiDISDatabasePerl.plLoadDISDatabaseModule>
2671     ($self-><M::DIS|DISDatabase.getModule>
2672     (${$self->{<H::DIS|resourceModuleMap>}->{$resURI}}));
2673     }__;
2674     if (defined $self->{resDef}->{$resURI}) {
2675     $r = $self->{resDef}->{$resURI};
2676     } elsif (defined $self->{forDef}->{$resURI}) {
2677     $r = $self->{forDef}->{$resURI};
2678     } else {
2679     __EXCEPTION{DIS|RESOURCE_NOT_DEFINED_ERR::
2680     DIS:uri => {$resURI},
2681     DIS:moduleURI => {${$self->{<H::DIS|resourceModuleMap>}
2682     ->{$resURI}}},
2683     }__;
2684     }
2685     } else {
2686     __DEEP{
2687 wakaba 1.62 $r = $self-><M::DIS|DISDatabase.getResource> ($resURI);
2688 wakaba 1.61 }__;
2689     }
2690    
2691     @Method:
2692 wakaba 1.3 @@Name: getSourceFile
2693     @@enDesc:
2694     Gets <QUOTE::dis> source document.
2695     @@Param:
2696     @@@Name: fileName
2697     @@@Type: FileURI
2698     @@@enDesc:
2699     A URI reference identifying a file.
2700     @@Return:
2701 wakaba 1.47 @@@Type: DISDocument
2702     @@@clsActualType: ManakaiDISDocument
2703 wakaba 1.3 @@@enDesc:
2704     The <QUOTE::dis> source document.
2705     @@@nullCase:
2706     @@@@enDesc:
2707     No document associated with that <P::fileName>.
2708     @@@PerlDef:
2709 wakaba 1.53 $r = $self->{<H::DIS|sourceFile>}->{$fileName};
2710 wakaba 1.3 @Method:
2711     @@Name: setSourceFile
2712     @@enDesc:
2713     Puts <QUOTE::dis> source document object.
2714     @@Param:
2715     @@@Name: fileName
2716     @@@Type: FileURI
2717     @@@enDesc:
2718 wakaba 1.4 A URI reference identifying a file. If there is already a
2719 wakaba 1.3 source document, then the association has been updated.
2720     @@Param:
2721     @@@Name: doc
2722 wakaba 1.47 @@@Type: DISDocument
2723     @@@clsActualType: ManakaiDISDocument
2724 wakaba 1.3 @@@enDesc:
2725     The document object to set.
2726     @@Return:
2727     @@@PerlDef:
2728 wakaba 1.53 $self->{<H::DIS|sourceFile>}->{$fileName} = $doc;
2729 wakaba 1.4
2730     @Method:
2731     @@Name: loadModule
2732     @@enDesc:
2733     Loads definitions from a <QUOTE::dis> document.
2734     @@Param:
2735     @@@Name: doc
2736 wakaba 1.47 @@@Type: DISDocument
2737     @@@clsActualType: ManakaiDISDocument
2738 wakaba 1.4 @@@enDesc:
2739     The source <QUOTE::dis> document object. Its
2740     <A::ManakaiDISDocument.disDatabase> must be this database.
2741     @@Param:
2742     @@@Name: resolver
2743     @@@Type: DISModuleResolver
2744     @@@enDesc:
2745     The resolver to convert module name into <QUOTE::dis> document object.
2746     @@ForParam:
2747 wakaba 1.32 @@NamedParam:
2748     @@@Name: onResourceRead
2749     @@@Type:
2750 wakaba 1.60 DISPerl:CODE::ManakaiDOM:all
2751 wakaba 1.32 @@@enDesc:
2752     An event handler called when a resource is read.
2753     @@@nullCase:
2754     @@@@enDesc:
2755     No event handler is read.
2756 wakaba 1.4 @@Return:
2757     @@@RaiseException:
2758     @@@@@: NO_MODULE_QNAME_ERR
2759     @@@@enDesc:
2760     The <Q::dis:Module> element must have a <Q::dis:QName> attribute.
2761     @@@RaiseException:
2762     @@@@@: UNABLE_TO_GET_MODULE_ERR
2763     @@@@enDesc:
2764     The implementation is unable to get a module source.
2765 wakaba 1.5 @@@ForDefDupException:
2766     @@@ForDefNoQNameException:
2767     @@@ResDefDupException:
2768     @@@ElementNotAllowedException:
2769 wakaba 1.7 @@@RaiseException:
2770     @@@@@:NO_REQUIRED_ATTR_ERR
2771     @@@@enDesc:
2772     The <Q::dis:Module> element does not have
2773     <Q::dis:Namespace> attribute.
2774 wakaba 1.4 @@@PerlDef:
2775     $resolver = bless $resolver, <ClassName::ManakaiDISModuleResolver>
2776     if ref $resolver eq 'CODE';
2777     ## -- Module Name, URI
2778     $forArg = <Q::ManakaiDOM:all> unless defined $forArg;
2779     my $mod_node;
2780     my $mod_name_node;
2781     __DEEP{
2782 wakaba 1.48 $mod_node = $doc-><AG::DISDocument.moduleElement>;
2783     $mod_name_node = $mod_node-><M::SWCFGNode.getAttributeNS>
2784 wakaba 1.4 (<Q::dis:>, 'QName');
2785     unless ($mod_name_node) {
2786     __UNDEEP{
2787     __EXCEPTION{NO_MODULE_QNAME_ERR::
2788     DIS:sourceNode => {$mod_node},
2789     }__;
2790     }__;
2791     }
2792 wakaba 1.51 $mod_name_node = bless $mod_name_node, <ClassName::ManakaiDISElement>
2793     if $mod_name_node->isa (<ClassName::swcfg21:ManakaiSWCFGElement
2794     ::swcfg21:ForLatest>);
2795 wakaba 1.5 my $mod_name_uri = $mod_name_node
2796 wakaba 1.48 -><AG::DISElement.qnameValueURI>;
2797     my $mod = $self-><M::DISDatabase.getModule>
2798 wakaba 1.9 ($mod_name_uri, for_arg => $forArg);
2799 wakaba 1.4
2800 wakaba 1.48 unless ($mod-><AG::DISAnyResource.isDefined>) {
2801 wakaba 1.4 ## -- Initializes Module Definition Object
2802 wakaba 1.59 my $v = $mod_name_node-><AG::DISElement.qnameValueLocalName>;
2803     __CODE{DISPerl|HashStringRef||ManakaiDOM|all::
2804     $result => {$mod->{localName}},
2805     $given => {$v},
2806     }__;
2807     my $ns = $mod_name_node-><AG::DISElement.qnameValueNamespaceURI>;
2808     __CODE{DISPerl|HashStringRef||ManakaiDOM|all::
2809     $result => {$mod->{namespaceURI}},
2810     $given => {$ns},
2811     }__;
2812     __CODE{DISPerl|HashStringRef||ManakaiDOM|all::
2813     $result => {$mod->{for}},
2814     $given => {$forArg},
2815     }__;
2816 wakaba 1.4 $mod->{src} = $mod_node;
2817 wakaba 1.48 $mod->{<Q::DIS|isDefined>} = true;
2818 wakaba 1.49 $self-><M::DISDatabase.setSourceFile> ($mod_name_uri => $doc);
2819 wakaba 1.48
2820 wakaba 1.57 $mod-><AS::DIS|ManakaiDISModuleDefinition.targetNamespaceURI>
2821     ($mod_node-><AG::DISModuleElement.definingNamespaceURI>);
2822 wakaba 1.48
2823     __CODE{dv:createValue::
2824     $result => {$mod->{<Q::DIS:sourceFile>}},
2825 wakaba 1.49 $value => {$doc-><M::SWCFGNode.flag> (<Q::swcfg21:fileName>)},
2826 wakaba 1.48 $base_type => {<Q::DISCore:String>},
2827     $type => {<Q::DISCore:String>},
2828 wakaba 1.60 $name => {<Q::DIS:sourceFile>},
2829 wakaba 1.48 }__;
2830 wakaba 1.5
2831 wakaba 1.12 ## -- Loads "for" definition
2832     my $root_elements
2833 wakaba 1.48 = $doc-><M::DISDocument.disAllChildElements>;
2834     if ($mod-><AG::DISAnyResource.forURI> eq <Q::ManakaiDOM:all>) {
2835     R: for my $el (@$root_elements) {
2836     next R unless $el-><AG::SWCFGElement
2837 wakaba 1.12 .expandedURI> eq <Q::dis:ForDef>;
2838 wakaba 1.48 $self-><M::DISDatabase.loadFor> ($mod, $el);
2839 wakaba 1.12 }
2840     }
2841    
2842 wakaba 1.5 ## -- Loads "for all"
2843 wakaba 1.48 my $rmod = $self-><M::DISDatabase.getModule>
2844 wakaba 1.51 ($mod_name_uri,
2845 wakaba 1.48 for_arg => <Q::ManakaiDOM:all>);
2846     unless ($rmod-><AG::DISAnyResource.isDefined>) {
2847     my $rdoc = $resolver-><M::DISModuleResolver.uriToDocument>
2848     ($self, $rmod-><AG::DISAnyResource.uri>,
2849     $mod-><AG::DISAnyResource.namespaceURI>,
2850     $mod-><AG::DISAnyResource.localName>,
2851     <Q::ManakaiDOM:all>);
2852 wakaba 1.5 unless ($rdoc) {
2853     __UNDEEP{
2854     __EXCEPTION{UNABLE_TO_GET_MODULE_ERR::
2855 wakaba 1.48 DIS:uri => {$rmod-><AG::DISAnyResource.uri>},
2856     DIS:namespaceURI =>
2857     {$mod-><AG::DISAnyResource.namespaceURI>},
2858     DIS:localName => {$mod-><AG::DISAnyResource.localName>},
2859 wakaba 1.9 DIS:for => {<Q::ManakaiDOM:all>},
2860 wakaba 1.48 DIS:sourceNode => {$mod-><AG::DISAnyResource.sourceElement>},
2861 wakaba 1.5 }__;
2862     }__;
2863     }
2864 wakaba 1.48 $self-><M::DISDatabase.loadModule>
2865 wakaba 1.32 ($rdoc, $resolver, for_arg => <Q::ManakaiDOM:all>,
2866     on_resource_read => $onResourceRead);
2867 wakaba 1.5 } # Unless "for all" loaded
2868 wakaba 1.4
2869     ## -- Loads Required Modules
2870 wakaba 1.10 ## NOTE:: "dis:For" is not allowed since "dis:ForDef" is not read
2871 wakaba 1.48 my $req_node = $mod_node-><AG::DISModuleElement.requireElement>;
2872     for my $rm (@{$req_node-><M::DISElement.disAllChildElements>}) {
2873     next unless $rm-><AG::SWCFGElement.expandedURI> eq <Q::dis:Module>;
2874 wakaba 1.4 my ($uri, $nuri, $ln, $for);
2875 wakaba 1.48 my $mqn = $rm-><M::SWCFGNode.getAttributeNS> (<Q::dis:>, 'QName');
2876 wakaba 1.4 if ($mqn) {
2877 wakaba 1.48 my $mqv = $mqn-><M::SWCFGNode.value>;
2878 wakaba 1.51 my $mqp = ($mqn->isa (<ClassName::swcfg21:ManakaiSWCFGElement
2879     ::swcfg21:ForLatest>)
2880     ? (bless $mqn, <ClassName::ManakaiDISElement>) : $mqn)
2881 wakaba 1.48 -><M::NSResolverDIS.qnameToPair> ($mqv, node => $mqn);
2882 wakaba 1.4 ($nuri, $ln) = @$mqp;
2883     } else {
2884 wakaba 1.48 my $mn = $rm-><M::SWCFGNode.getAttributeNS> (<Q::dis:>, 'Name');
2885 wakaba 1.4 if ($mn) {
2886 wakaba 1.48 $nuri = $mod-><AG::DISAnyResource.namespaceURI>;
2887     $ln = $mn-><M::SWCFGNode.value>;
2888 wakaba 1.4 } else {
2889 wakaba 1.48 $nuri = $mod-><AG::DISAnyResource.namespaceURI>;
2890     $ln = $mod-><AG::DISAnyResource.localName>;
2891 wakaba 1.4 }
2892     }
2893 wakaba 1.48 my $wfn = $rm-><M::SWCFGNode.getAttributeNS>
2894     (<Q::dis:>, 'WithFor');
2895 wakaba 1.4 if ($wfn) {
2896 wakaba 1.51 $for = ($wfn->isa (<ClassName::swcfg21:ManakaiSWCFGElement
2897     ::swcfg21:ForLatest>)
2898     ? (bless $wfn, <ClassName::ManakaiDISElement>) : $wfn)
2899 wakaba 1.48 -><AG::DISElement.qnameValueURI>;
2900 wakaba 1.4 } else {
2901 wakaba 1.48 $for = $mod-><AG::DISAnyResource.forURI>;
2902 wakaba 1.4 }
2903 wakaba 1.48 my $rmod = $self-><M::DISDatabase.getModule>
2904 wakaba 1.9 ($nuri . $ln, for_arg => $for);
2905 wakaba 1.48 unless ($rmod-><AG::DISAnyResource.isDefined>) {
2906     my $rdoc = $resolver-><M::DISModuleResolver.uriToDocument>
2907     ($self, $rmod-><AG::DISAnyResource.uri>,
2908     $nuri, $ln, $for);
2909 wakaba 1.4 unless ($rdoc) {
2910     __UNDEEP{
2911     __EXCEPTION{UNABLE_TO_GET_MODULE_ERR::
2912 wakaba 1.48 DIS:uri => {$rmod-><AG::DISAnyResource.uri>},
2913 wakaba 1.4 DIS:namespaceURI => {$nuri},
2914     DIS:localName => {$ln},
2915     DIS:for => {$for},
2916     DIS:sourceNode => {$rm},
2917     }__;
2918     }__;
2919     }
2920 wakaba 1.48 $self-><M::DISDatabase.loadModule>
2921 wakaba 1.32 ($rdoc, $resolver, for_arg => $for,
2922     on_resource_read => $onResourceRead);
2923 wakaba 1.4 }
2924     } # Child Module elements
2925    
2926 wakaba 1.12 ## -- Loads child resources
2927 wakaba 1.48 $root_elements = $doc-><M::DISDocument.disChildElements>
2928 wakaba 1.49 (for_arg => $forArg,
2929     database_arg => $self);
2930 wakaba 1.5 for my $el (@$root_elements) {
2931 wakaba 1.48 if ($el-><AG::DISElement.isResourceElement>) {
2932     $self-><M::DISDatabase.loadResource>
2933 wakaba 1.9 ($mod, null, null, $el,
2934 wakaba 1.32 for_arg => $forArg,
2935     on_resource_read => $onResourceRead);
2936 wakaba 1.7 } else {
2937 wakaba 1.48 my $et = $el-><AG::SWCFGElement.expandedURI>;
2938 wakaba 1.7 if ({
2939 wakaba 1.5 <Q::dis:ForDef> => 1,
2940     <Q::dis:Module> => 1,
2941     <Q::dis:ImplNote> => 1,
2942 wakaba 1.7 }->{$et}) {
2943     #
2944     } else {
2945     __UNDEEP{
2946     __EXCEPTION{ELEMENT_NOT_ALLOWED_ERR::
2947     DIS:elementType => {$et},
2948     DIS:sourceNode => {$el},
2949     DIS:uri => {$mod->{uri}},
2950     }__;
2951 wakaba 1.5 }__;
2952 wakaba 1.7 }
2953     } # element types
2954     }
2955    
2956 wakaba 1.48 my $dn = $mod_node-><M::SWCFGNode.getAttributeNS>
2957     (<Q::dis:>, 'Namespace');
2958     unless ($dn and defined $dn-><M::SWCFGNode.value>) {
2959 wakaba 1.7 __UNDEEP{
2960     __EXCEPTION{NO_REQUIRED_ATTR_ERR::
2961     DIS:elementType => {<Q::dis:Namespace>},
2962     DIS:sourceNode => {$mod_node},
2963 wakaba 1.5 }__;
2964 wakaba 1.7 }__;
2965 wakaba 1.5 }
2966     } # Unless this module loaded
2967     }__; # Deep
2968    
2969     @Method:
2970     @@Name: loadFor
2971     @@enDesc:
2972     Loads definition of a <QUOTE::for> from a <Q::dis:ForDef> element.
2973     @@Param:
2974     @@@Name: mod
2975 wakaba 1.47 @@@Type: DISModule
2976     @@@clsActualType: ManakaiDISModuleDefinition
2977 wakaba 1.5 @@@enDesc:
2978     The module in which the <QUOTE::for> to load is defined.
2979     @@Param:
2980     @@@Name: el
2981 wakaba 1.47 @@@Type: DISElement
2982 wakaba 1.5 @@@enDesc:
2983     The source <QUOTE::dis> <Q::dis:ForDef> element object.
2984     @@Return:
2985     @@@ForDefDupException:
2986     @@@ForDefNoQNameException:
2987     @@@ElementNotAllowedException:
2988     @@@PerlDef:
2989     __DEEP{
2990 wakaba 1.48 my $qn_node = $el-><M::SWCFGNode.getAttributeNS> (<Q::dis:>, 'QName');
2991 wakaba 1.5 unless ($qn_node) {
2992     __UNDEEP{
2993     __EXCEPTION{NO_FOR_QNAME_ERR::
2994 wakaba 1.48 DIS:sourceNode => {$el},
2995 wakaba 1.5 }__;
2996     }__;
2997     }
2998 wakaba 1.51 $qn_node = bless $qn_node, <ClassName::ManakaiDISElement>
2999     if $qn_node->isa (<ClassName::swcfg21:ManakaiSWCFGElement
3000     ::swcfg21:ForLatest>);
3001 wakaba 1.48 my $qn_uri = $qn_node-><AG::DISElement.qnameValueURI>;
3002     my $for = $self-><M::DISDatabase.getFor> ($qn_uri);
3003 wakaba 1.5
3004 wakaba 1.48 unless ($for-><AG::DISAnyResource.isDefined>) {
3005 wakaba 1.10 ## -- Initializes "For" Definition Object
3006 wakaba 1.5 $for->{src} = $el;
3007 wakaba 1.53 $for->{<H::DIS|isDefined>} = true;
3008     $for->{<H::DIS|definingModule>} = \ ($mod->{uri});
3009 wakaba 1.5
3010 wakaba 1.10 for my $ce (@{$el-><M::ManakaiDISElement.disAllChildElements>}) {
3011 wakaba 1.48 my $xn = $ce-><AG::SWCFGElement.expandedURI>;
3012 wakaba 1.5 if ($xn eq <Q::dis:ISA> or $xn eq <Q::dis:Implement>) {
3013 wakaba 1.48 my $sfor = $self-><M::DISDatabase.getFor>
3014     ($ce-><AG::DISElement.qnameValueURI>);
3015     $for-><M::DISFor.addISA> ($sfor);
3016     $sfor-><AS::DISAnyResource.isReferred> ($ce);
3017 wakaba 1.5 ## TODO: warn if dis:Implement
3018     } elsif ({
3019     <Q::dis:Description> => 1,
3020     <Q::dis:ImplNote> => 1,
3021     <Q::dis:FullName> => 1,
3022     <Q::dis:QName> => 1,
3023     }->{$xn}) {
3024     #
3025     } else {
3026     __UNDEEP{
3027     __EXCEPTION{ELEMENT_NOT_ALLOWED_ERR::
3028     DIS:elementType => {$xn},
3029     DIS:sourceNode => {$ce},
3030 wakaba 1.48 DIS:uri => {$qn_uri},
3031 wakaba 1.5 }__;
3032     }__;
3033     }
3034     }
3035     } else {
3036     __UNDEEP{
3037     __EXCEPTION{FOR_ALREADY_DEFINED_ERR::
3038     DIS:sourceNode => {$el},
3039 wakaba 1.48 DIS:anotherSourceNode => {$el},
3040     DIS:uri => {$qn_uri},
3041 wakaba 1.5 }__;
3042     }__;
3043     } # isDefine?
3044     }__; # DEEP
3045    
3046     @Method:
3047     @@Name: loadResource
3048     @@enDesc:
3049     Loads definition of a <QUOTE::dis> resource from a
3050     <Q::dis:ResourceDef> element.
3051     @@Param:
3052     @@@Name: mod
3053 wakaba 1.47 @@@Type: DISModule
3054     @@@clsActualType: ManakaiDISModuleDefinition
3055 wakaba 1.5 @@@enDesc:
3056     The module in which the resource to load is defined.
3057     @@Param:
3058     @@@Name: parentResource
3059 wakaba 1.47 @@@Type: DISResource
3060     @@@clsActualType: ManakaiDISResourceDefinition
3061 wakaba 1.5 @@@enDesc:
3062 wakaba 1.7 The (static) parent resource in which the resource to load is defined.
3063 wakaba 1.5 @@@nullCase:
3064     @@@@enDesc:
3065     The resource to load is a root resource, i.e. <P::el> is
3066     a direct child of the document node.
3067     @@Param:
3068 wakaba 1.7 @@@Name: dynParent
3069 wakaba 1.47 @@@Type: DISResource
3070     @@@clsActualType: ManakaiDISResourceDefinition
3071 wakaba 1.7 @@@enDesc:
3072     The dynamic parent resource of the resource to load.
3073 wakaba 1.9 @@@nullCase:
3074 wakaba 1.7 @@@@enDesc:
3075 wakaba 1.9 If this resource is a root resource, i.e. <P::el> is
3076     a direct child of the document node.
3077 wakaba 1.7 @@Param:
3078 wakaba 1.5 @@@Name: el
3079 wakaba 1.47 @@@Type: DISElement
3080     @@@clsActualType: ManakaiDISElement
3081 wakaba 1.5 @@@enDesc:
3082     The source <QUOTE::dis> <Q::dis:ResourceDef> element object.
3083     @@ForParam:
3084     @@ForpParam:
3085 wakaba 1.32 @@NamedParam:
3086     @@@Name: onResourceRead
3087     @@@Type:
3088 wakaba 1.60 DISPerl:CODE::ManakaiDOM:all
3089 wakaba 1.32 @@@enDesc:
3090     An event handler called when a resource is read.
3091     @@@nullCase:
3092     @@@@enDesc:
3093     No event handler is read.
3094 wakaba 1.5 @@Return:
3095     @@@ResDefDupException:
3096     @@@ElementNotAllowedException:
3097 wakaba 1.49 @@@RaiseException:
3098     @@@@@: NO_RDF_TYPE_ERR
3099     @@@@enDesc:
3100     There is a resorce that does not have any <Q::rdf:type>
3101     attribute.
3102 wakaba 1.5 @@@PerlDef:
3103     $forArg = <Q::ManakaiDOM:all> unless defined $forArg;
3104     $forpArg ||= [];
3105     __DEEP{
3106 wakaba 1.6 ## -- Node names
3107    
3108     ## Unique resource identifier generated from node id
3109 wakaba 1.50 my $node_id = $el-><AG::SWCFGNode.nodeIDRef>;
3110 wakaba 1.6 my $node_uri;
3111 wakaba 1.50 __CODE{tfpurisToURI:: $turi => {$$node_id}, $furi => $forArg,
3112 wakaba 1.6 $forp => $forpArg, $uri => $node_uri}__;
3113    
3114 wakaba 1.54 my $al_node = $el-><M::DISElement.disGetAttribute>
3115     (<Q::dis:AliasFor>, for_arg => $forArg,
3116     forp_arg => $forpArg,
3117     database_arg => $self);
3118     my $al_canon_uri;
3119     if ($al_node) {
3120     $al_canon_uri = $al_node-><M::DISElement.tfqnamesValueURI>
3121 wakaba 1.59 ($$node_id, $forArg,
3122     for_arg => $forArg,
3123     forp_arg => $forpArg,
3124     database_arg => $self);
3125 wakaba 1.54 }
3126    
3127 wakaba 1.6 ## User defined resource identifiers
3128 wakaba 1.5 my $qn_node = $el-><M::ManakaiDISElement.disGetAttribute>
3129     (<Q::dis:QName>, for_arg => $forArg,
3130 wakaba 1.49 forp_arg => $forpArg,
3131     database_arg => $self);
3132 wakaba 1.5 my $res;
3133 wakaba 1.54 ALD: {
3134 wakaba 1.5 if ($qn_node) {
3135     my $qn_uri = $qn_node-><AG::ManakaiDISElement.qnameValueURI>;
3136 wakaba 1.9 $res = $self-><M::ManakaiDISDatabase.getResource>
3137     ($qn_uri, for_arg => $forArg);
3138 wakaba 1.48 if ($res-><AG::DISAnyResource.isDefined>) {
3139 wakaba 1.54 last ALD if defined $al_canon_uri and
3140     $res->{aliasURI}->{$al_canon_uri};
3141 wakaba 1.5 __UNDEEP{
3142     __EXCEPTION{RESOURCE_ALREADY_DEFINED_ERR::
3143 wakaba 1.54 DIS:uri => {$qn_uri},
3144 wakaba 1.5 DIS:sourceNode => {$qn_node},
3145     DIS:anotherSourceNode => {$res->{src}},
3146     }__;
3147 wakaba 1.6 }__;
3148 wakaba 1.5 }
3149 wakaba 1.59 my $v = $qn_node-><AG::DIS|DISElement.qnameValueLocalName>;
3150     __CODE{DISPerl|HashStringRef||ManakaiDOM|all::
3151     $result => {$res->{localName}},
3152     $given => {$v},
3153     }__;
3154     my $ns = $qn_node-><AG::DIS|DISElement.qnameValueNamespaceURI>;
3155     __CODE{DISPerl|HashStringRef||ManakaiDOM|all::
3156     $result => {$res->{namespaceURI}},
3157     $given => {$ns},
3158     }__;
3159 wakaba 1.5 } else { ## Anonymous or local
3160     my $n_node = $el-><M::ManakaiDISElement.disGetAttribute>
3161     (<Q::dis:Name>, for_arg => $forArg,
3162 wakaba 1.49 forp_arg => $forpArg,
3163     database_arg => $self);
3164 wakaba 1.5 if ($n_node) {
3165     if ($parentResource) {
3166     my $puri = $parentResource->{uri};
3167     my $ru;
3168 wakaba 1.14 my $ln = $n_node-><M::swcfg21:SWCFGNode
3169     ::swcfg21:ForLatest.value>;
3170 wakaba 1.5 __CODE{getChildResourceURI:: $parentURI => $puri,
3171     $localName => $ln,
3172     $result => $ru}__;
3173 wakaba 1.9 $res = $self-><M::ManakaiDISDatabase.getResource>
3174     ($ru, for_arg => $forArg);
3175 wakaba 1.59 my $v = $n_node-><M::SWCFGNode.value>;
3176     __CODE{DISPerl|HashStringRef||ManakaiDOM|all::
3177     $result => {$res->{localName}},
3178     $given => {$v},
3179     }__;
3180 wakaba 1.53 $res->{<H::DIS|isAnon>} = true;
3181 wakaba 1.5 } else { ## Root local name resource
3182 wakaba 1.48 my $ln = $n_node-><M::SWCFGNode.value>;
3183     my $ns_uri = $mod-><AG::DISAnyResource.sourceElement>
3184     -><AG::DISModuleElement.definingNamespaceURI>;
3185 wakaba 1.7 my $qn_uri = $ns_uri . $ln;
3186 wakaba 1.9 $res = $self-><M::ManakaiDISDatabase.getResource>
3187     ($qn_uri, for_arg => $forArg);
3188 wakaba 1.48 if ($res-><AG::DISAnyResource.isDefined>) {
3189 wakaba 1.6 __UNDEEP{
3190     __EXCEPTION{RESOURCE_ALREADY_DEFINED_ERR::
3191 wakaba 1.48 DIS:uri => {$res-><AG::DISAnyResource.uri>},
3192 wakaba 1.6 DIS:sourceNode => {$n_node},
3193 wakaba 1.48 DIS:anotherSourceNode
3194     => {$res-><AG::DISAnyResource.sourceElement>},
3195 wakaba 1.6 }__;
3196     }__;
3197     }
3198 wakaba 1.59 __CODE{DISPerl|HashStringRef||ManakaiDOM|all::
3199     $result => {$res->{namespaceURI}},
3200     $given => {$ns_uri},
3201     }__;
3202     __CODE{DISPerl|HashStringRef||ManakaiDOM|all::
3203     $result => {$res->{localName}},
3204     $given => {$ln},
3205     }__;
3206 wakaba 1.5 }
3207     } else {
3208 wakaba 1.48 $res = $self-><M::DISDatabase.getResource> ($node_uri);
3209 wakaba 1.53 $res->{<H::DIS|isAnon>} = true;
3210 wakaba 1.5 }
3211 wakaba 1.6 } # anon
3212 wakaba 1.59 __CODE{DISPerl|HashStringRef||ManakaiDOM|all::
3213     $result => {$res->{for}},
3214     $given => {$forArg},
3215     }__;
3216 wakaba 1.5 $res->{forp} = $forpArg;
3217     $res->{src} = $el;
3218 wakaba 1.53 $res->{<H::DIS|definingModule>} = \ ($mod->{uri});
3219 wakaba 1.55 $mod-><M::DIS|ManakaiDISModuleDefinition.addResourceList> ($res);
3220 wakaba 1.54 $res-><AS::DIS|ManakaiDISResourceDefinition.parentResource>
3221     ($parentResource) if $parentResource;
3222     $res-><AS::DIS|ManakaiDISResourceDefinition.dynamicParentResource>
3223     ($dynParent) if $dynParent;
3224 wakaba 1.9 unless ($res->{uri} eq $node_uri) {
3225 wakaba 1.48 my $nu_res = $self-><M::DISDatabase.getResource> ($node_uri);
3226     $res-><M::DISResource.mergeAsAlias> ($nu_res);
3227 wakaba 1.9 }
3228 wakaba 1.53 $res->{<H::DIS|isDefined>} = true;
3229 wakaba 1.9 $res->{seq} = $self->{seq}++;
3230 wakaba 1.50 $res-><AS::DISAnyResource.sourceNodeIDRef> ($node_id);
3231 wakaba 1.9
3232 wakaba 1.6 ## -- Alias
3233     if ($al_node) {
3234 wakaba 1.54 my $canon_res = $self-><M::DISDatabase.getResource> ($al_canon_uri);
3235 wakaba 1.48 $canon_res-><AS::DISAnyResource.isReferred> ($al_node);
3236     $canon_res-><M::DISResource.mergeAsAlias> ($res, node => $al_node);
3237 wakaba 1.6 $res = $canon_res;
3238     }
3239 wakaba 1.54 } # ALD
3240 wakaba 1.5
3241 wakaba 1.11 ## -- Registers as child
3242 wakaba 1.54 $parentResource-><M::DIS|ManakaiDISResourceDefinition
3243     .addChildResource> ($res)
3244 wakaba 1.11 if $parentResource;
3245 wakaba 1.54 $dynParent-><M::DIS|ManakaiDISResourceDefinition
3246     .addDynamicChildResource> ($res)
3247 wakaba 1.11 if $dynParent;
3248    
3249 wakaba 1.7 my $is_multires = false;
3250     my @props;
3251     my @cres;
3252 wakaba 1.48 my @ce0 = @{$el-><M::DISElement.disChildElements>
3253 wakaba 1.49 (for_arg => $forArg, forp_arg => $forpArg,
3254     database_arg => $self)};
3255     my $has_type = $al_node;
3256 wakaba 1.7 while (@ce0) {
3257     my $ce = shift @ce0;
3258 wakaba 1.49 if ($ce-><M::DISElement.elementTypeMatch> (<Q::rdf:type>,
3259     database_arg => $self)) {
3260     $has_type = true;
3261 wakaba 1.48 my $type_uri = $ce-><AG::DISElement.qnameValueURI>;
3262     my $type = $self-><M::DISDatabase.getResource> ($type_uri);
3263     $res-><M::DISResourceProp.addPropertyResourceUList>
3264     (<Q::rdf:type>, $type);
3265     $type-><AS::DISAnyResource.isReferred> ($ce);
3266     if ($type-><M::DISResource.isSubsetOfURI>
3267 wakaba 1.7 (<Q::dis:MultipleResource>)) {
3268     $is_multires = true;
3269     }
3270 wakaba 1.48 } elsif ($ce-><M::DISElement.elementTypeMatch>
3271 wakaba 1.49 (<Q::dis:subsetOf>,
3272     database_arg => $self)) {
3273 wakaba 1.48 my $sres = $self-><M::DISDatabase.getResource>
3274     ($ce-><M::DISElement.tfqnamesValueURI>
3275 wakaba 1.50 ($$node_id, $forArg,
3276 wakaba 1.49 for_arg => $forArg, forp_arg => $forpArg,
3277     database_arg => $self));
3278 wakaba 1.48 $res-><M::DISResource.addSuperResource> ($sres);
3279     } elsif ($ce-><AG::DISElement.isResourceElement>) {
3280 wakaba 1.7 push @cres, $ce;
3281 wakaba 1.48 } elsif ($ce-><M::DISElement.elementTypeMatch>
3282 wakaba 1.49 (<Q::dis:dataType>,
3283     database_arg => $self)) {
3284 wakaba 1.48 my $uri = $ce-><AG::DISElement.qnameValueURI>;
3285     __CODE{dv:createURI::
3286     $uri => $uri,
3287     $result => {$res->{<Q::dis:dataType>}},
3288 wakaba 1.60 $name => {$ce-><AG::SWCFGElement.expandedURI>},
3289 wakaba 1.48 }__;
3290     my $type = $self-><M::DISDatabase.getResource> ($uri);
3291     $type-><AS::DISAnyResource.isReferred> ($ce);
3292     } elsif ($ce-><M::DISElement.elementTypeMatch>
3293 wakaba 1.49 (<Q::dis:multipleProperties>,
3294     database_arg => $self)) {
3295 wakaba 1.48 my $uri = $ce-><AG::DISElement.qnameValueURI>;
3296     __CODE{dv:createURI::
3297     $uri => $uri,
3298     $result => {$res->{<Q::dis:multipleProperties>}},
3299 wakaba 1.60 $name => {$ce-><AG::SWCFGElement.expandedURI>},
3300 wakaba 1.48 }__;
3301     my $type = $self-><M::DISDatabase.getResource> ($uri);
3302     $type-><AS::DISAnyResource.isReferred> ($ce);
3303 wakaba 1.7 } else {
3304     ## Property and invalid element is not checked, since not
3305     ## all property definitions has loaded at this stage.
3306     push @props, $ce;
3307     }
3308     } # @ce0
3309    
3310 wakaba 1.49 unless ($has_type) {
3311     __UNDEEP{__EXCEPTION{NO_RDF_TYPE_ERR::
3312     DIS:uri => {$res->{uri}},
3313     DIS:sourceNode => {$el},
3314     }__}__;
3315     }
3316    
3317 wakaba 1.7 ## -- Child resources
3318     unless ($is_multires) {
3319     for my $re (@cres) {
3320     unless ($al_node) {
3321     $self-><M::ManakaiDISDatabase.loadResource>
3322     ($mod, $res, $res, $re,
3323 wakaba 1.32 for_arg => $forArg, forp_arg => $forpArg,
3324     on_resource_read => $onResourceRead);
3325 wakaba 1.5 } else {
3326 wakaba 1.7 my $ac = $re-><M::ManakaiDISElement.disGetAttribute>
3327     (<Q::dis:aliasChild>, for_arg => $forArg,
3328 wakaba 1.49 forp_arg => $forpArg,
3329     database_arg => $self);
3330 wakaba 1.48 if ($ac and $ac-><M::SWCFGNode.value>) {
3331 wakaba 1.7 $self-><M::ManakaiDISDatabase.loadResource>
3332     ($mod, $res, $res, $re,
3333 wakaba 1.32 for_arg => $forArg, forp_arg => $forpArg,
3334     on_resource_read => $onResourceRead);
3335 wakaba 1.7 }
3336 wakaba 1.4 }
3337     }
3338 wakaba 1.7 }
3339 wakaba 1.5
3340 wakaba 1.7 ## -- Multiple representations
3341     if ($is_multires) {
3342     for my $pe (@props) {
3343     if ($pe-><M::ManakaiDISElement.elementTypeMatch>
3344 wakaba 1.49 (<Q::dis:resourceFor>,
3345     database_arg => $self)) {
3346 wakaba 1.14 my $for_uri = $pe-><AG::ManakaiDISElement.qnameValueURI>;
3347 wakaba 1.7 my $for = $self-><M::ManakaiDISDatabase.getFor> ($for_uri);
3348 wakaba 1.48 $for-><AS::DISAnyResource.isReferred> ($pe);
3349 wakaba 1.7 $self-><M::ManakaiDISDatabase.loadResource>
3350     ($mod, $parentResource, $res, $el,
3351     for_arg => $forArg,
3352 wakaba 1.32 forp_arg => [@{$forpArg}, $for_uri],
3353     on_resource_read => $onResourceRead);
3354 wakaba 1.7 }
3355     }
3356     }
3357 wakaba 1.48 ($onResourceRead or sub {})->($self, $res);
3358     }__; # DEEP
3359 wakaba 1.2
3360 wakaba 1.48 @Method:
3361     @@Name: readProperties
3362     @@enDesc:
3363     Reads property values in the source tree and
3364     removes the source tree from the database.
3365     @@NamedParam:
3366     @@@Name: onResourceRead
3367     @@@Type:
3368 wakaba 1.60 DISPerl:CODE::ManakaiDOM:all
3369 wakaba 1.48 @@@enDesc:
3370     An event handler called when a resource is read.
3371     @@@nullCase:
3372     @@@@enDesc:
3373     No event handler is read.
3374     @@Return:
3375     @@@RaiseException:
3376     @@@@@: UNSUPPORTED_ELEMENT_TYPE_ERR
3377     @@@@enDesc:
3378     There is an element whose element type is not supported.
3379 wakaba 1.2 @@@PerlDef:
3380 wakaba 1.48 __DEEP{
3381     for my $fd (values %{$self->{modDef}},
3382     values %{$self->{forDef}},
3383     values %{$self->{resDef}}) {
3384     if ($fd-><AG::DISAnyResource.isDefined>) {
3385     $fd-><M::DISAnyResource.readProperties>
3386     (on_resource_read => $onResourceRead);
3387     }
3388     }
3389 wakaba 1.53 CORE::delete $self->{<H::DIS|sourceFile>};
3390 wakaba 1.48 }__;
3391 wakaba 1.10
3392 wakaba 1.48 @Method:
3393     @@Name: checkUndefinedResource
3394 wakaba 1.44 @@enDesc:
3395 wakaba 1.48 Checks whether there is referred but undefined resource or not.
3396     @@Return:
3397     @@@RaiseException:
3398     @@@@@: FOR_NOT_DEFINED_ERR
3399     @@@@enDesc:
3400     There is a <QUOTE::for> that is referred but not defined.
3401     @@@RaiseException:
3402     @@@@@: RESOURCE_NOT_DEFINED_ERR
3403     @@@@enDesc:
3404     There is a resource that is referred but not defined.
3405 wakaba 1.44 @@@PerlDef:
3406 wakaba 1.48 for my $fd (values %{$self->{forDef}}) {
3407     if (my $ref = $fd-><AG::DISAnyResource.isReferred> and
3408     not $fd-><AG::DISAnyResource.isDefined>) {
3409     __EXCEPTION{FOR_NOT_DEFINED_ERR::
3410     DIS:uri => {$fd-><AG::DISAnyResource.uri>},
3411     DIS:sourceNodePath => {$ref},
3412     }__;
3413     }
3414     }
3415     for my $fd (values %{$self->{resDef}}) {
3416     if (my $ref = $fd-><AG::DISAnyResource.isReferred> and
3417     not $fd-><AG::DISAnyResource.isDefined>) {
3418     __EXCEPTION{RESOURCE_NOT_DEFINED_ERR::
3419     DIS:uri => {$fd-><AG::DISAnyResource.uri>},
3420     DIS:sourceNodePath => {$ref},
3421     }__;
3422     }
3423     }
3424    
3425     @Method:
3426     @@Name: xcrefToResource
3427 wakaba 1.10 @@enDesc:
3428 wakaba 1.48 Returns a resource object selected by an exception code
3429     reference (<Q::DOMMain:XCodeRef>).
3430 wakaba 1.10 @@Param:
3431 wakaba 1.48 @@@Name: xcref
3432 wakaba 1.10 @@@Type:
3433 wakaba 1.48 DOMMain:XCodeRef::ManakaiDOM:all
3434 wakaba 1.10 @@@enDesc:
3435 wakaba 1.48 Exception code to select.
3436 wakaba 1.2 @@Param:
3437 wakaba 1.48 @@@Name: contextNode
3438 wakaba 1.50 @@@Type: NSResolverDIS
3439 wakaba 1.48 @@@enDesc:
3440     A context element node. Namespace prefixes in
3441     <P::xcref> are resolved against this node.
3442     @@ForParam:
3443     @@NodeParam:
3444 wakaba 1.2 @@Return:
3445     @@@Type:
3446 wakaba 1.60 DISPerl:ARRAY::ManakaiDOM:all
3447 wakaba 1.48 @@@enDesc:
3448     A reference to the array containing two or three
3449     resource definitions (<Class::ManakaiDISResourceDefinition>).
3450     The first (index <CODE::0>) resource is an exception class.
3451     The second (index <CODE::1>) resource is an exception code
3452     constant. The third (index <CODE::2>) resource
3453     is an exception subtype or <DOM::null> if the reference identifies
3454     no subtype.
3455     @@@RaiseException:
3456     @@@@@: RESOURCE_NOT_DEFINED_ERR
3457 wakaba 1.2 @@@@enDesc:
3458 wakaba 1.48 The resource identified by the <P::xcref> is not defined
3459     or not an exception.
3460 wakaba 1.2 @@@PerlDef:
3461 wakaba 1.48 my ($q1, $q2, $q3) = split /\s*\.\s*/, $xcref, 3;
3462     __DEEP{
3463     if (defined $q3) {
3464     $r->[2] = $self-><M::ManakaiDISDatabase.getResource>
3465     ($contextNode-><M::NSResolverDIS.tfqnamesToURI>
3466     ($q3, null, $forArg, node => $node));
3467 wakaba 1.54 $r->[1] = $r->[2]-><AG::DIS|DISResource.parentResource>;
3468 wakaba 1.48 } elsif (defined $q2) {
3469     if ($q2 =~ /:/) {
3470     $r->[1] = $self-><M::ManakaiDISDatabase.getResource>
3471     ($contextNode-><M::NSResolverDIS.tfqnamesToURI>
3472     ($q2, null, $forArg, node => $node));
3473     } else {
3474     $r->[0] = $self-><M::ManakaiDISDatabase.getResource>
3475     ($contextNode-><M::NSResolverDIS.tfqnamesToURI>
3476     ($q1, null, $forArg, node => $node));
3477     $r->[1] = $r->[0]-><M::ManakaiDISResourceDefinition
3478     .getConstResourceByName> ($q2);
3479     }
3480     } else { ## $q1 only
3481     $r->[2] = $self-><M::ManakaiDISDatabase.getResource>
3482     ($contextNode-><M::NSResolverDIS.tfqnamesToURI>
3483     ($q1, null, $forArg, node => $node));
3484     if ($r->[2]-><M::ManakaiDISResourceDefinition
3485     .isTypeURI> (<Q::ManakaiDOM:ExceptionOrWarningSubType>)) {
3486 wakaba 1.54 $r->[1] = $r->[2]-><AG::DIS|DISResource.parentResource>;
3487 wakaba 1.48 } else {
3488     $r->[1] = $r->[2]; CORE::delete $r->[2];
3489     }
3490     }
3491 wakaba 1.2
3492 wakaba 1.48 if ($r->[2] and
3493     not $r->[2]-><M::ManakaiDISResourceDefinition
3494     .isTypeURI> (<Q::ManakaiDOM:ExceptionOrWarningSubType>)) {
3495     __UNDEEP{__EXCEPTION{RESOURCE_NOT_DEFINED_ERR::
3496     DIS:uri => {$r->[2]->{uri}},
3497     DIS:expectedType => {<Q::ManakaiDOM:ExceptionOrWarningSubType>},
3498     DIS:sourceNode => {$node},
3499     DIS:sourceCode => {$xcref},
3500     }__}__;
3501     }
3502     $r->[2]-><AS::DISAnyResource.isReferred>
3503     ($node or $contextNode)
3504     if $r->[2];
3505    
3506     if (not $r->[1] or
3507     not $r->[1]-><M::ManakaiDISResourceDefinition
3508     .isTypeURI> (<Q::ManakaiDOM:Const>)) {
3509     __UNDEEP{__EXCEPTION{RESOURCE_NOT_DEFINED_ERR::
3510     DIS:uri => {$r->[1]->{uri}},
3511 wakaba 1.59 DIS:localName => {$r->[1]-><AG::DIS|DISAnyResource.localName>},
3512 wakaba 1.48 DIS:expectedType => {<Q::ManakaiDOM:Const>},
3513     DIS:sourceNode => {$node},
3514     DIS:sourceCode => {$xcref},
3515     }__}__;
3516     }
3517     $r->[1]-><AS::DISAnyResource.isReferred>
3518     ($node or $contextNode);
3519 wakaba 1.5
3520 wakaba 1.48 unless ($r->[0]) {
3521 wakaba 1.54 my $cg = $r->[1]-><AG::DIS|DISResource.parentResource>;
3522     $r->[0] = $cg-><AG::DIS|DISResource.parentResource> if $cg;
3523 wakaba 1.48 }
3524     if (not $r->[0] or
3525     not $r->[0]-><M::ManakaiDISResourceDefinition
3526 wakaba 1.60 .isTypeURI> (<Q::dx:AnyExceptionAnyClass>)) {
3527 wakaba 1.48 __UNDEEP{__EXCEPTION{RESOURCE_NOT_DEFINED_ERR::
3528     DIS:uri => {$r->[0]->{uri}},
3529 wakaba 1.59 DIS:localName => {$r->[0]-><AG::DIS|DISAnyResource.localName>},
3530 wakaba 1.60 DIS:expectedType => {<Q::dx:AnyExceptionAnyClass>},
3531 wakaba 1.48 DIS:sourceNode => {$node},
3532     DIS:sourceCode => {$xcref},
3533     }__}__;
3534 wakaba 1.5 }
3535 wakaba 1.48 $r->[0]-><AS::DISAnyResource.isReferred>
3536     ($node or $contextNode);
3537 wakaba 1.7 }__;
3538 wakaba 1.5
3539 wakaba 1.38 @Method:
3540     @@Name: getFeature
3541     @@Description:
3542     @@@lang:en
3543     @@@@:
3544     Returns a specialized object that implements the specialized
3545     interfaces of the specified feature and version.
3546     @@Param:
3547     @@@Name: feature
3548     @@@Type:
3549     DISLang:String::ManakaiDOM:all
3550     @@@actualType:
3551     ManakaiDOM:ManakaiDOMFeatureName::ManakaiDOM:ManakaiDOMLatest
3552     @@@Description:
3553     @@@@lang:en
3554     @@@@@:
3555     A feature name to request.
3556     @@Param:
3557     @@@Name: version
3558     @@@Type:
3559     DISLang:String::ManakaiDOM:all
3560     @@@actualType:
3561     ManakaiDOM:ManakaiDOMFeatureVersion::ManakaiDOM:ManakaiDOMLatest
3562     @@@Description:
3563     @@@@lang:en
3564     @@@@@:
3565     A feature version number to request.
3566     @@Return:
3567 wakaba 1.39 @@@Type:
3568     DOMMain:Object::ManakaiDOM:all
3569 wakaba 1.38 @@@Description:
3570     @@@@lang:en
3571     @@@@@:
3572     An object that implements the specialized APIs of the
3573     <P::feature> and <P::version>.
3574 wakaba 1.49 @@@nullCase:
3575     @@@@enDesc:
3576 wakaba 1.38 There is no object available that implements interfaces
3577     associated with the <P::feature> and <P::version>.
3578     @@@PerlDef:
3579     $feature =~ s/^\+//;
3580     CLASS: for my $class (grep {
3581 wakaba 1.48 $Message::Util::DIS::ManakaiDISDatabase::CompatClass{$_}
3582     } keys %Message::Util::DIS::ManakaiDISDatabase::CompatClass) {
3583 wakaba 1.38 if ($Message::DOM::ClassFeature{$class}->{$feature}->{$version}) {
3584 wakaba 1.39 $r = bless {o => $self}, $class;
3585 wakaba 1.38 last CLASS;
3586     }
3587     }
3588    
3589 wakaba 1.22 @Method:
3590 wakaba 1.48 @@Name: free
3591 wakaba 1.22 @@enDesc:
3592 wakaba 1.48 Marks the database, resources in the database, and source
3593     <QUOTE::dis> document trees in the database as no longer used.
3594     @@ForCheck: ManakaiDOM|ForClass
3595 wakaba 1.22 @@Return:
3596     @@@PerlDef:
3597 wakaba 1.53 for my $file (values %{$self->{<H::DIS|sourceFile>}}) {
3598 wakaba 1.48 $file-><M::ManakaiNode|ManakaiNodeRef||ManakaiDOM|Perl.free>
3599     if $file;
3600     }
3601     CORE::delete $self->{modDef};
3602     CORE::delete $self->{forDef};
3603     CORE::delete $self->{resDef};
3604 wakaba 1.62
3605     @Method:
3606     @@Name: getModuleURIList
3607     @@enDesc:
3608     Returns a snapshot list of URIs of modules in the database.
3609     @@Return:
3610     @@@Type: DISPerl|ARRAY||ManakaiDOM|all
3611     @@@enDesc:
3612     A snapshot list of URIs.
3613     @@@PerlDef:
3614     $r = [map {$_-><AG::DIS|DISAnyResource.uri>} values %{$self->{modDef}}];
3615    
3616     @Method:
3617     @@Name: getAnyResourceURIList
3618     @@enDesc:
3619     Returns a snapshot list of URIs of resources in the database.
3620     @@Return:
3621     @@@Type: DISPerl|ARRAY||ManakaiDOM|all
3622     @@@enDesc:
3623     A snapshot list of URIs.
3624     @@@PerlDef:
3625     $r = [keys %{$self->{<H::DIS|resourceModuleMap>}},
3626     map {$_-><AG::DIS|DISAnyResource.uri>} values %{$self->{modDef}}];
3627 wakaba 1.48 ##DISDatabase
3628    
3629     PropDef:
3630 wakaba 1.54 @QName: DIS|resourceModuleMap
3631     @enDesc:
3632     Resource-module mapping table.
3633     @DIS:key: rm
3634     @Type: DISPerl|HASH
3635    
3636     PropDef:
3637 wakaba 1.48 @QName: sourceNodeID
3638     @enDesc:
3639     The URI reference of the source node identifier.
3640 wakaba 1.55 @rdfs:domain: DIS|DISResource||DIS|ForEmpty
3641     @DIS:key: snid
3642     @Type: DISPerl|SCALAR
3643 wakaba 1.24
3644 wakaba 1.48 PropDef:
3645 wakaba 1.55 @QName: DIS|resource
3646     @enDesc:
3647 wakaba 1.48 Resources defined in a module.
3648 wakaba 1.55 @rdfs:range: DIS|DISResource||DIS|ForEmpty
3649     @rdfs:domain: DIS|DISModule||DIS|ForEmpty
3650     @DIS:key: mres
3651     @Type: DISPerl|ARRAY
3652 wakaba 1.22
3653 wakaba 1.48 PropDef:
3654 wakaba 1.54 @QName: DIS|parentResource
3655 wakaba 1.48 @enDesc:
3656     Static parent resource. No parent for root resources.
3657 wakaba 1.54 @DIS:key: puri
3658 wakaba 1.27
3659 wakaba 1.48 PropDef:
3660 wakaba 1.54 @QName: DIS|dynamicParentResource
3661 wakaba 1.48 @enDesc:
3662     Dynamic parent resource. No parent for root resources.
3663 wakaba 1.54 @DIS:key: dpuri
3664 wakaba 1.25
3665 wakaba 1.48 PropDef:
3666 wakaba 1.54 @QName: DIS|childResource
3667 wakaba 1.48 @enDesc:
3668     Static child resources.
3669 wakaba 1.54 @DIS:key: curis
3670 wakaba 1.35
3671 wakaba 1.48 PropDef:
3672 wakaba 1.54 @QName: DIS|dynamicChildResource
3673 wakaba 1.48 @enDesc:
3674     Dynamic child resources.
3675 wakaba 1.54 @DIS:key: dcuris
3676    
3677     PropDef:
3678     @QName: DIS|key
3679     @enDesc:
3680     Property name in resource objects.
3681     @rdfs:subPropertyOf: DISPerl|propHashKey
3682     @dataType: DISCore|String
3683     @multipleProperties: DISCore|Single
3684    
3685     ResourceDef:
3686     @QName: DIS|DISResourceList
3687     @enDesc:
3688     A reference to array whose items are resource
3689     (<IF::DIS|DISAnyResource||DIS|ForEmpty>) objects.
3690     @rdfs:subClassOf: DISPerl|ARRAY
3691     @For: =ManakaiDOM|all
3692     @rdf:type: DISLang|DataType
3693     @For: DIS|ForEmpty !=DIS|ForEmpty
3694     @AliasFor:
3695     @@@@: ||ManakaiDOM|all
3696     @@@For: DIS|ForEmpty
3697 wakaba 1.38
3698 wakaba 1.48 ElementTypeBinding:
3699     @Name: ForDefDupException
3700     @ElementType:
3701     ManakaiDOM:raises
3702     @ShadowContent:
3703     @@@: FOR_ALREADY_DEFINED_ERR
3704     @@Description:
3705     @@@lang:en
3706     @@@@:
3707     The <QUOTE::for> is already defined elsewhere.
3708 wakaba 1.27
3709 wakaba 1.48 ElementTypeBinding:
3710     @Name: ForDefNoQNameException
3711     @ElementType:
3712     ManakaiDOM:raises
3713     @ShadowContent:
3714     @@@: NO_FOR_QNAME_ERR
3715     @@Description:
3716     @@@lang:en
3717     @@@@:
3718     A <Q::dis:ForDef> element must have a <Q::dis:QName> attribute.
3719 wakaba 1.22
3720 wakaba 1.48 ElementTypeBinding:
3721     @Name: ResDefDupException
3722     @ElementType:
3723     ManakaiDOM:raises
3724     @ShadowContent:
3725     @@@: RESOURCE_ALREADY_DEFINED_ERR
3726     @@Description:
3727     @@@lang:en
3728     @@@@:
3729     The <QUOTE::dis> resource is already defined elsewhere.
3730 wakaba 1.24
3731 wakaba 1.48 ElementTypeBinding:
3732     @Name: ElementNotAllowedException
3733     @ElementType:
3734     ManakaiDOM:raises
3735     @ShadowContent:
3736     @@@: ELEMENT_NOT_ALLOWED_ERR
3737     @@Description:
3738     @@@lang:en
3739     @@@@:
3740     An element has found where it is not allowed.
3741 wakaba 1.24
3742 wakaba 1.48 IFClsDef:
3743     @IFQName: DISModuleResolver
3744     @ClsQName: ManakaiDISModuleResolver
3745 wakaba 1.22
3746 wakaba 1.48 @enDesc:
3747     Objects implementing <IF::DISModuleResolver> interface
3748     are used to convert module name into <QUOTE::dis> document object.
3749     \
3750     {NOTE:: It is also acceptable to pass a <Perl::CODE> reference
3751     as a method parameter where <IF::DISModuleResolver> is
3752     expected.
3753     \
3754     }
3755 wakaba 1.24 @Method:
3756 wakaba 1.48 @@Name: uriToDocument
3757 wakaba 1.32 @@enDesc:
3758 wakaba 1.48 Returns a <QUOTE::dis> document from module name information.
3759     @@Param:
3760     @@@Name: disDB
3761     @@@Type: DISDatabase
3762     @@@clsActualType: ManakaiDISDatabase
3763     @@@enDesc:
3764     The <QUOTE::dis> database.
3765     @@Param:
3766     @@@Name: moduleURI
3767     @@@Type: ModuleURI
3768     @@@enDesc:
3769     The URI reference of the module.
3770     \
3771     {NOTE:: This parameter is redundant, since it can be
3772     composed from other three parameters.
3773     \
3774     }
3775     @@Param:
3776     @@@Name: moduleNamespaceURI
3777     @@@Type: AnyURI
3778     @@@enDesc:
3779     The namespace URI of the module name.
3780     @@Param:
3781     @@@Name: moduleLocalName
3782     @@@Type:
3783     DISCore:LocalName::ManakaiDOM:all
3784     @@@enDesc:
3785     The local name of the module name.
3786 wakaba 1.24 @@Param:
3787 wakaba 1.48 @@@Name: moduleFor
3788     @@@Type: ForURI
3789 wakaba 1.24 @@@enDesc:
3790 wakaba 1.48 The <QUOTE::for> URI reference for which the module is defined.
3791 wakaba 1.24 @@Return:
3792 wakaba 1.48 @@@Type: DISDocument
3793     @@@clsActualType: ManakaiDISDocument
3794 wakaba 1.24 @@@enDesc:
3795 wakaba 1.48 The <QUOTE::dis> document. It don't have to be a newly created
3796     object.
3797     @@@nullCase:
3798     @@@@enDesc:
3799     The method is unable to resolve the reference.
3800 wakaba 1.24 @@@PerlDef:
3801 wakaba 1.48 $r = $self->(@_);
3802    
3803     @ResourceDef:
3804     @@rdf:type: DISLang|InputProcessor
3805     @@PerlDef:
3806     $INPUT = bless $INPUT, <ClassName::ManakaiDISModuleResolver>
3807     if ref $INPUT eq 'CODE';
3808     ##DISModuleResolver
3809 wakaba 1.22
3810 wakaba 1.24 PropDef:
3811 wakaba 1.48 @QName: sourceFile
3812     @enDesc:
3813     Source <QUOTE::dis> documents.
3814     @rdfs:domain: DISDatabase
3815     @rdfs:range: DISDocument
3816    
3817     IFClsDef:
3818     @IFQName: DISAnyResource
3819     @ClsQName: ManakaiDISAnyResource
3820    
3821 wakaba 1.52 @ClsISA: DOMFeature|ManakaiHasFeatureByGetFeature||ManakaiDOM|ManakaiDOMLatest
3822    
3823 wakaba 1.24 @enDesc:
3824 wakaba 1.48 {P:: A <IF::DISAnyResource> object represents a resource defined
3825     in <QUOTE::dis> files. In <QUOTE::dis> model, resources are
3826     categorized as:
3827    
3828     - Module::: A <QUOTE::dis> module is a file entity.
3829     This kind of objects <kwd:MUST> implement the
3830     <IF::DISModule> interface.
3831    
3832     - <QUOTE::For>::: A <QUOTE::for> is a target for which
3833     resources are defined. This kind of objects
3834     <kwd:MUST> implement the <IF::DISFor> interface.
3835    
3836     - <QUOTE::dis> Resource::: Something described in <QUOTE::dis>.
3837     This kind of objects <kwd:MUST> implement the
3838     <IF::DISModule> interface.
3839 wakaba 1.24
3840 wakaba 1.48 }
3841 wakaba 1.22
3842 wakaba 1.48 The objects implementing this interface <kwd:MUST> also implement
3843     the <IF::DOMMinImpl> interface.
3844 wakaba 1.47
3845 wakaba 1.48 @Attr:
3846     @@Name: uri
3847     @@Type: AnyURI
3848     @@Description:
3849     @@@lang:en
3850     @@@@:
3851     The URI reference of the resource.
3852     @@Get:
3853     @@@enDesc:
3854     The representive URI reference of the resource.
3855 wakaba 1.21
3856 wakaba 1.48 {NOTE:: The URI might be non-persistent if the
3857     resource is not assigned a URI in <QUOTE::dis> source file,
3858     in which case a URI is randomly-generated at the
3859     time of object generation.
3860     }
3861     @@@PerlDef:
3862     $r = $self->{uri};
3863 wakaba 1.54
3864     @Attr:
3865     @@Name: uriRef
3866     @@Type: DISPerl|SCALAR||ManakaiDOM|all
3867     @@enDesc:
3868     A reference to the URI of the resource.
3869    
3870     {NOTE:: Applications <kwd:MUST-NOT> modify the referenced
3871     value directly.
3872     }
3873     @@Get:
3874     @@@PerlDef: $r = \ ($self->{uri});
3875 wakaba 1.48
3876     @Attr:
3877     @@Name: uris
3878     @@Type:
3879 wakaba 1.60 DISPerl:Array::ManakaiDOM:all
3880 wakaba 1.48 @@enDesc:
3881     A set of URIs that identifies the resource.
3882     @@Get:
3883     @@@enDesc:
3884     A reference to array in which the URIs are contained
3885     in undefined order.
3886 wakaba 1.38
3887 wakaba 1.48 {NOTE:: The array is <EM::not> live; it is only a snapshot.
3888     }
3889 wakaba 1.47
3890 wakaba 1.48 @Method:
3891     @@Name: isSameResource
3892 wakaba 1.21 @@Operator:
3893     @@@@:eq
3894     @@@ContentType:
3895     lang:Perl
3896     @@enDesc:
3897 wakaba 1.48 Whether two resources are same or not. Two resources are
3898     same if and only if their <A::DISAnyResource.uri> are
3899     equivalent as strings (i.e. in character-by-character based matching).
3900 wakaba 1.21 @@Param:
3901     @@@Name: anotherResource
3902 wakaba 1.48 @@@Type: DISAnyResource
3903 wakaba 1.21 @@@enDesc:
3904 wakaba 1.48 Another resource object to compare.
3905 wakaba 1.21 @@Return:
3906     @@@Type:
3907     DOMMain:boolean::ManakaiDOM:all
3908     @@@enDesc:
3909 wakaba 1.48 Whether two resources are same or not.
3910     @@@TrueCase:
3911     @@@@enDesc: Two resources are same.
3912     @@@FalseCase:
3913     @@@@enDesc: Two resources are different.
3914 wakaba 1.21 @@@PerlDef:
3915     if (UNIVERSAL::isa ($anotherResource,
3916 wakaba 1.48 <ClassName::ManakaiDISAnyResource>)) {
3917 wakaba 1.21 $r = $self->{uri} eq $anotherResource->{uri};
3918     }
3919 wakaba 1.2
3920     @Attr:
3921     @@Name: nameURI
3922     @@Type: NameURI
3923     @@enDesc:
3924 wakaba 1.48 The URI reference of this module, without
3925 wakaba 1.2 <QUOTE::for> identifier.
3926     @@Get:
3927 wakaba 1.49 @@@enDesc:
3928     The name URI of the resource.
3929     @@@nullCase:
3930     @@@@enDesc:
3931     The resource has no name URI.
3932    
3933     {NOTE:: A resource has no URI if and only if the resource
3934     has no local name.
3935     }
3936 wakaba 1.3 @@@PerlDef:
3937 wakaba 1.49 if (defined $self->{localName}) {
3938     $r = defined $self->{namespaceURI}
3939 wakaba 1.59 ? ${$self->{namespaceURI}} . ${$self->{localName}}
3940     : ${$self->{localName}};
3941 wakaba 1.49 }
3942 wakaba 1.2
3943     @Attr:
3944 wakaba 1.48 @@Name: localName
3945 wakaba 1.32 @@enDesc:
3946 wakaba 1.48 The local name of this module.
3947 wakaba 1.32
3948 wakaba 1.48 {NOTE:: <QUOTE::for> resources has no local name.
3949     }
3950 wakaba 1.2 @@Type:
3951 wakaba 1.3 DISCore:LocalName::ManakaiDOM:all
3952 wakaba 1.2 @@Get:
3953     @@@PerlDef:
3954 wakaba 1.59 $r = defined $self->{localName} ? ${$self->{localName}} : null;
3955 wakaba 1.2
3956     @Attr:
3957     @@Name: namespaceURI
3958     @@Type: AnyURI
3959     @@enDesc:
3960     The namespace URI of the name of this resource.
3961 wakaba 1.48
3962     {NOTE:: <QUOTE::for> resources has no namespace URI.
3963     }
3964 wakaba 1.2 @@Get:
3965     @@@PerlDef:
3966 wakaba 1.59 $r = defined $self->{namespaceURI} ? ${$self->{namespaceURI}} : null;
3967 wakaba 1.2
3968     @Attr:
3969     @@Name: forURI
3970 wakaba 1.48 @@Type: ForURI
3971 wakaba 1.2 @@enDesc:
3972 wakaba 1.48 The <QUOTE::for> URI reference for which this module is defined.
3973 wakaba 1.2 @@Get:
3974     @@@PerlDef:
3975 wakaba 1.59 $r = defined $self->{for} ? ${$self->{for}} : null;
3976 wakaba 1.2
3977     @Attr:
3978     @@Name: forpURI
3979     @@enDesc:
3980     The <QUOTE::for+> URI references for which this resource is defined.
3981 wakaba 1.48
3982     {NOTE:: <QUOTE::for> resources has no <QUOTE::for+> URI.
3983     }
3984 wakaba 1.2 @@Type: ForURIList
3985     @@Get:
3986 wakaba 1.15 @@@enDesc:
3987     List of <QUOTE::for> URI references. Note that this list is
3988     <QUOTE::dead>.
3989 wakaba 1.3 @@@PerlDef:
3990 wakaba 1.15 $r = [@{$self->{forp}}];
3991    
3992     @Method:
3993     @@Name: isForURI
3994     @@enDesc:
3995     Tests whether this resource is defined for a <QUOTE::for>
3996     or <QUOTE::for+> URI reference or not.
3997     @@Param:
3998     @@@Name:forURI
3999     @@@Type:ForURI
4000     @@@enDesc:
4001     A <QUOTE::for> URI reference to test.
4002     @@Return:
4003     @@@Type:
4004     DOMMain:boolean::ManakaiDOM:all
4005     @@@TrueCase:
4006     @@@@enDesc:
4007     This resource is for <P::forURI>.
4008     @@@FalseCase:
4009     @@@@enDesc:
4010     This resource is not for <P::forURI>.
4011     @@@PerlDef:
4012     __DEEP{
4013 wakaba 1.59 C: for my $this_for_uri (${$self->{for}||\''}, @{$self->{forp}||[]}) {
4014 wakaba 1.15 if ($this_for_uri eq $forURI) { ## Shortcut
4015     $r = true;
4016 wakaba 1.48 last C;
4017 wakaba 1.15 }
4018 wakaba 1.48 my $this_for = $self->{db}-><M::DIS|DISDatabase.getFor>
4019 wakaba 1.15 ($this_for_uri);
4020 wakaba 1.48 if ($this_for-><M::DIS|DISFor.isaURI> ($forURI)) {
4021 wakaba 1.15 $r = true;
4022 wakaba 1.48 last C;
4023 wakaba 1.15 }
4024     }
4025     }__;
4026 wakaba 1.48
4027     @Attr:
4028     @@Name: isDefined
4029 wakaba 1.2 @@Description:
4030     @@@lang:en
4031     @@@@:
4032 wakaba 1.48 Whether this module is defined or not.
4033     @@Type:
4034     DOMMain:boolean::ManakaiDOM:all
4035     @@Get:
4036     @@@PerlDef:
4037 wakaba 1.53 $r = $self->{<H::DIS|isDefined>};
4038 wakaba 1.48
4039     @Attr:
4040     @@Name: ownerModule
4041     @@enDesc:
4042     The module in which the resource is defined. If the resource
4043     is a module, the module itself is the attribute value.
4044     @@Get:
4045     @@@Type: DISModule
4046     @@@clsActualType: ManakaiDISModuleDefinition
4047     @@@enDesc:
4048     The owner module object.
4049     @@@nullCase:
4050 wakaba 1.2 @@@@enDesc:
4051 wakaba 1.48 The resource is not part of any module since
4052     its definition is not read (i.e. <A::DISAnyResource.isDefined> is
4053     <DOM::false>).
4054 wakaba 1.2 @@@PerlDef:
4055 wakaba 1.48 $r = $self->{db}
4056     -><M::DISDatabase.getModule>
4057 wakaba 1.53 (${$self->{<H::DIS|definingModule>}})
4058     if defined $self->{<H::DIS|definingModule>};
4059 wakaba 1.2
4060 wakaba 1.48 @Attr:
4061 wakaba 1.54 @@Name: ownerModuleURI
4062     @@enDesc:
4063     A URI of the owner module of the resource.
4064     @@Type: DIS|AnyURI
4065     @@nullCase:
4066     @@@enDesc:
4067     The resource does not belong to any module since the
4068     resource definition is not read yet.
4069     @@Get:
4070     @@@PerlDef:
4071     if (defined $self->{<H::DIS|definingModule>}) {
4072     $r = ${$self->{<H::DIS|definingModule>}};
4073     }
4074    
4075     @Attr:
4076     @@Name: ownerModuleURIRef
4077     @@enDesc:
4078     A reference to a URI of the owner module of the resource.
4079     @@Type: DISPerl|SCALAR||ManakaiDOM|Perl
4080     @@nullCase:
4081     @@@enDesc:
4082     The resource does not belong to any module since the
4083     resource definition is not read yet.
4084     @@Get:
4085     @@@PerlDef:
4086     $r = $self->{<H::DIS|definingModule>};
4087    
4088     @Attr:
4089 wakaba 1.48 @@Name: isReferred
4090     @@Description:
4091     @@@lang:en
4092     @@@@:
4093     Whether the resource is referenced somewhere or not.
4094     @@Type: DISLang|String||ManakaiDOM|all
4095     @@Get:
4096     @@@enDesc:
4097     A node path string that identifies the node from
4098     which the resource is referenced.
4099     @@@nullCase:
4100     The resource is not referred.
4101     @@@PerlDef:
4102 wakaba 1.53 $r = $self->{<H::DIS|isReferred>};
4103 wakaba 1.48 @@Set:
4104 wakaba 1.7 @@@enDesc:
4105 wakaba 1.48 A node path string that identifies the node from
4106     which the resource is referenced.
4107     @@@InCase:
4108     @@@@Type: DISElement
4109     @@@@enDesc:
4110     The resource is referenced by the element. It's node path
4111     string is set as the attribute value.
4112     @@@PerlDef:
4113     if (defined $given) {
4114     if (ref $given) {
4115 wakaba 1.50 if ($given->isa (<IFName::dv|DVValue>)) {
4116     $given = $given-><AG::dv|DVValue.sourceNodePath>;
4117     } else {
4118     $given = $given-><M::SWCFGNode.flag> ('nodePath') ||
4119     $given-><M::SWCFGNode.nodePath>
4120 wakaba 1.52 (key => [qw/QName Name type Type/]);
4121 wakaba 1.50 }
4122 wakaba 1.48 }
4123 wakaba 1.53 $self->{<H::DIS|isReferred>} = $given;
4124 wakaba 1.48 }
4125    
4126     @Attr:
4127     @@Name: sourceNodeID
4128     @@enDesc:
4129     The identifier URI reference of the source node.
4130     @@enDesc:
4131     @@@ForCheck: ManakaiDOM|ForClass
4132     @@@@:
4133     Modules and <QUOTE::for>s does not have source node identifier
4134     in the current implementation.
4135     @@Type: AnyURI
4136     @@Get:
4137     @@@nullCase:
4138     @@@@enDesc:
4139     The resource is not (yet) associated with any source node.
4140     @@@PerlDef:
4141 wakaba 1.53 if (defined $self->{<H::DIS:sourceNodeID>}) {
4142     $r = ${$self->{<H::DIS:sourceNodeID>}};
4143 wakaba 1.50 } else {
4144     $r = null;
4145     }
4146     @@Set:
4147     @@@PerlDef:
4148     if (defined $given) {
4149 wakaba 1.53 $self->{<H::DIS:sourceNodeID>} = \$given;
4150 wakaba 1.50 } else {
4151 wakaba 1.53 CORE::delete $self->{<H::DIS:sourceNodeID>};
4152 wakaba 1.50 }
4153    
4154     @Attr:
4155     @@Name: sourceNodeIDRef
4156     @@enDesc:
4157     The identifier URI reference of the source node.
4158     @@enDesc:
4159     @@@ForCheck: ManakaiDOM|ForClass
4160     @@@@:
4161     Modules and <QUOTE::for>s does not have source node identifier
4162     in the current implementation.
4163 wakaba 1.60 @@Type: DISPerl|SCALAR||ManakaiDOM|all
4164 wakaba 1.50 @@Get:
4165     @@@nullCase:
4166     @@@@enDesc:
4167     The resource is not (yet) associated with any source node.
4168     @@@PerlDef:
4169 wakaba 1.53 $r = $self->{<H::DIS:sourceNodeID>};
4170 wakaba 1.48 @@Set:
4171 wakaba 1.7 @@@PerlDef:
4172 wakaba 1.50 if (defined $given) {
4173 wakaba 1.53 $self->{<H::DIS:sourceNodeID>} = $given;
4174 wakaba 1.50 } else {
4175 wakaba 1.53 CORE::delete $self->{<H::DIS:sourceNodeID>};
4176 wakaba 1.50 }
4177 wakaba 1.7
4178 wakaba 1.2 @Attr:
4179 wakaba 1.48 @@Name: isAnonymous
4180     @@enDesc:
4181     Whether the resource has persistent name or not.
4182     @@Type:
4183 wakaba 1.18 DOMMain:boolean::ManakaiDOM:all
4184 wakaba 1.2 @@Get:
4185     @@@TrueCase:
4186 wakaba 1.48 This resource does <EM::not> have any globally unique name.
4187     <A::DISAnyResource.uri> is a temporary URI reference.
4188 wakaba 1.2 @@@FalseCase:
4189 wakaba 1.48 This resource does have its formal name.
4190     <A::DISAnyResource.uri> is a URI reference
4191     generated from the name and the <QUOTE::for> URI reference
4192     of this resource.
4193 wakaba 1.2 @@@PerlDef:
4194 wakaba 1.53 $r = $self->{<H::DIS|isAnon>};
4195 wakaba 1.2
4196     @Attr:
4197 wakaba 1.48 @@Name: sourceElement
4198     @@enDesc:
4199     The source <QUOTE::dis> element node from which this
4200     definition is read.
4201 wakaba 1.2 @@Get:
4202 wakaba 1.48 @@@Type: DISElement
4203     @@@clsActualType: ManakaiDISElement
4204     @@@InCase:
4205     @@@@Type: DISModuleElement
4206     @@@@clsActualType: ManakaiDISModuleElement
4207     @@@@enDesc: If this resource is a module.
4208     @@@PerlDef: $r = $self->{src};
4209 wakaba 1.2 @@@nullCase:
4210 wakaba 1.48 @@@@enDesc:
4211     The definition is not yet read.
4212 wakaba 1.2
4213     @Attr:
4214 wakaba 1.48 @@Name: database
4215     @@enDesc:
4216     The <QUOTE::dis> database to which the resource belongs.
4217     @@Type: DISDatabase
4218     @@clsActualType: ManakaiDISDatabase
4219 wakaba 1.2 @@Get:
4220     @@@PerlDef:
4221 wakaba 1.48 $r = $self->{db};
4222    
4223 wakaba 1.6 @Method:
4224 wakaba 1.48 @@Name: readProperties
4225 wakaba 1.6 @@enDesc:
4226 wakaba 1.48 Reads property values in the source tree and
4227     removes reference to the source node.
4228     @@NamedParam:
4229     @@@Name: onResourceRead
4230     @@@Type:
4231 wakaba 1.60 DISPerl:CODE::ManakaiDOM:all
4232 wakaba 1.6 @@@enDesc:
4233 wakaba 1.48 An event handler called when a resource is read.
4234     @@@nullCase:
4235     @@@@enDesc:
4236     No event handler is read.
4237 wakaba 1.6 @@Return:
4238 wakaba 1.11 @@@RaiseException:
4239 wakaba 1.48 @@@@@: UNSUPPORTED_ELEMENT_TYPE_ERR
4240     @@@@enDesc:
4241     There is an element whose element type is not supported.
4242 wakaba 1.11 @@@PerlDef:
4243 wakaba 1.6 __DEEP{
4244 wakaba 1.48 if (my $src = $self->{src}) {
4245 wakaba 1.49 my $for = $self-><AG::DISAnyResource.forURI>;
4246     my $forp = $self-><AG::DISAnyResource.forpURI>;
4247     my $db = $self-><AG::DISAnyResource.database>;
4248 wakaba 1.48 for my $el (@{$src-><M::DISElement.disChildElements>
4249 wakaba 1.49 (for_arg => $for,
4250     forp_arg => $forp,
4251     database_arg => $db)}) {
4252 wakaba 1.48 my $xu = $el-><AG::SWCFGElement.expandedURI>;
4253     if ({
4254     <Q::dis:AliasFor> => true,
4255     <Q::dis:ContentType> => true,
4256     <Q::dis:dataType> => true,
4257     <Q::dis:For> => true,
4258     <Q::dis:ForCheck> => true,
4259     <Q::dis:Name> => true,
4260     <Q::dis:Namespace> => true,
4261     <Q::dis:multipleProperties> => true,
4262     <Q::rdf:type> => true,
4263     <Q::dis:QName> => true,
4264     <Q::dis:Require> => true,
4265     <Q::dis:resourceFor> => true,
4266     }->{$xu}) {
4267     #
4268 wakaba 1.49 } elsif ($el-><M::DISElement.isPropertyElement>
4269     (database_arg => $db)) {
4270 wakaba 1.48 my $add_prop;
4271     $add_prop = sub ($$$) {
4272     my ($self, $el, $db) = @_;
4273     my $prop = $db-><M::DISDatabase.getResource>
4274     ($el-><AG::SWCFGElement.expandedURI>);
4275     my $prop_uri = $prop-><AG::DISAnyResource.uri>;
4276     my $prop_mult = $prop-><AG::DISResource.multiplePropertiesURI>;
4277     my $new_value;
4278     my $base_type;
4279     my $copy_tree = false;
4280    
4281 wakaba 1.49 my %mtopt = (for_arg => $for,
4282     forp_arg => $forp,
4283 wakaba 1.48 default_media_type => $prop-><AG::DISResource
4284 wakaba 1.49 .defaultLextypeURI>,
4285     database_arg => $db);
4286 wakaba 1.51 my $new_value_type = $el-><M::DISElement.mediaTypeURI>(%mtopt);
4287    
4288 wakaba 1.48 if ($el-><M::DISElement.mediaTypeMatch>
4289     (<Q::dis:TypeQName>, $mtopt{default_media_type}, %mtopt)) {
4290     __CODE{dv|createValue::
4291     $value => {null},
4292     $base_type => {$base_type = <Q::dis:TypeQName>},
4293 wakaba 1.50 $type => {$new_value_type},
4294 wakaba 1.48 $result => $new_value,
4295 wakaba 1.60 $name => {$prop_uri},
4296 wakaba 1.48 }__;
4297     $new_value-><AS::dv|DVQNameValue.localName>
4298     ($el-><AG::DISElement.qnameValueLocalName>);
4299     $new_value-><AS::dv|DVQNameValue.prefix>
4300 wakaba 1.49 (my $prefix = $el-><AG::DISElement.qnameValuePrefix>);
4301     if (not defined $prefix) {
4302     if ($el-><M::DISElement.mediaTypeMatch>
4303     (<Q::DISCore:LanguageTag>,
4304     $mtopt{default_media_type}, %mtopt)) {
4305     $new_value-><AS::dv|DVQNameValue.namespaceURI>
4306     ('urn:x-suika-fam-cx:lang:');
4307     } elsif ($el-><M::DISElement.mediaTypeMatch>
4308     (<Q::DISCore:ScriptTag>,
4309     $mtopt{default_media_type}, %mtopt)) {
4310     $new_value-><AS::dv|DVQNameValue.namespaceURI>
4311     ('http://suika.fam.cx/~wakaba/archive/2005/5/script#');
4312     } else {
4313     $new_value-><AS::dv|DVQNameValue.namespaceURI>
4314     ($el-><AG::DISElement.qnameValueNamespaceURI>);
4315     }
4316     } else {
4317     $new_value-><AS::dv|DVQNameValue.namespaceURI>
4318     ($el-><AG::DISElement.qnameValueNamespaceURI>);
4319     }
4320 wakaba 1.48 ## TODO: Check whether defined
4321     } elsif ($el-><M::DISElement.mediaTypeMatch>
4322     (<Q::dis:TFQNames>, $mtopt{default_media_type}, %mtopt) or
4323     $el-><M::DISElement.mediaTypeMatch>
4324     (<Q::DISCore:TFPQNames>, $mtopt{default_media_type}, %mtopt)) {
4325     __CODE{dv|createURI::
4326     $uri => {$el-><M::DISElement.tfqnamesValueURI>
4327     ($self-><AG::DISAnyResource.sourceNodeID>,
4328     $self-><AG::DISAnyResource.forURI>,
4329     for_arg => $self-><AG::DISAnyResource.forURI>,
4330 wakaba 1.49 forp_arg => $self-><AG::DISAnyResource.forpURI>,
4331     database_arg => $db)},
4332 wakaba 1.48 $result => $new_value,
4333 wakaba 1.60 $name => {$prop_uri},
4334 wakaba 1.48 }__;
4335     ## TODO: Check whether defined
4336 wakaba 1.50 $new_value_type = <Q::DISCore:URI>;
4337 wakaba 1.48 } elsif ($el-><M::DISElement.mediaTypeMatch>
4338     (<Q::lang:Perl>, $mtopt{default_media_type},
4339     %mtopt)) {
4340     $el-><M::DISElement.preserveNodePath>;
4341 wakaba 1.50 __CODE{dv|createValueRef::
4342     $value_ref => {$el-><AG::SWCFGNode.valueRef>},
4343 wakaba 1.49 $base_type => {$base_type = <Q::lang:Perl>},
4344 wakaba 1.50 $type => {$new_value_type},
4345 wakaba 1.48 $result => $new_value,
4346 wakaba 1.60 $name => $prop_uri,
4347 wakaba 1.48 }__;
4348     for my $p (<Q::dis:Type>, <Q::dis:actualType>) {
4349     if (UNIVERSAL::isa ($self->{$p},<IFName::dv|DVURIValue>)) {
4350     my $v;
4351     __CODE{dv|createURI::
4352     $uri => {$self->{$p}-><AG::dv|DVURIValue.uri>},
4353     $result => $v,
4354 wakaba 1.60 $name => $prop_uri,
4355 wakaba 1.48 }__;
4356     $new_value-><M::dv|DVValue.setProperty> ($p => $v);
4357     }
4358     }
4359 wakaba 1.49 $new_value-><AS::dv|DVNSValue.defaultNamespaceURIRef>
4360     ($el-><M::DISElement.getDefaultNamespaceURIRef>);
4361     $new_value-><AS::dv|DVNSValue.namespaceBindingList>
4362     ($el-><M::DISElement.getNamespaceBindingList> ($db));
4363     $new_value-><AS::dv|DVValue.sourceNodePath>
4364     ($el-><M::SWCFGNode.flag> ('nodePath'));
4365 wakaba 1.48 } elsif ($el-><M::DISElement.mediaTypeMatch>
4366     (<Q::lang:disdoc>, $mtopt{default_media_type},
4367     %mtopt) or
4368     $el-><M::DISElement.mediaTypeMatch>
4369     (<Q::lang:disdocInline>, $mtopt{default_media_type},
4370 wakaba 1.49 %mtopt) or
4371     $el-><M::DISElement.mediaTypeMatch>
4372     (<Q::lang:muf>, $mtopt{default_media_type},
4373     %mtopt)) {
4374     $el-><M::DISElement.preserveNodePath>;
4375 wakaba 1.50 __CODE{dv|createValueRef::
4376     $value_ref => {$el-><AG::SWCFGNode.valueRef>},
4377 wakaba 1.49 $base_type => {$base_type = <Q::lang:disdoc>},
4378 wakaba 1.50 $type => $new_value_type,
4379 wakaba 1.49 $result => $new_value,
4380 wakaba 1.60 $name => $prop_uri,
4381 wakaba 1.49 }__;
4382     $new_value-><AS::dv|DVNSValue.defaultNamespaceURIRef>
4383     ($el-><M::DISElement.getDefaultNamespaceURIRef>);
4384     $new_value-><AS::dv|DVNSValue.namespaceBindingList>
4385     ($el-><M::DISElement.getNamespaceBindingList> ($db));
4386     $new_value-><AS::dv|DVValue.sourceNodePath>
4387     ($el-><M::SWCFGNode.flag> ('nodePath'));
4388     } elsif ($el-><M::DISElement.mediaTypeMatch>
4389 wakaba 1.52 (<Q::dx|XCRef>,
4390     $mtopt{default_media_type}, %mtopt)) {
4391     my $x = $db-><M::DISDatabase.xcrefToResource>
4392     ($el-><M::SWCFGNode.value>,
4393 wakaba 1.59 $el, node => $el,
4394     for_arg => $self-><AG::DIS|DISAnyResource.forURI>);
4395 wakaba 1.52 __CODE{dv|createURI::
4396     $uri => {($x->[2] or $x->[1] or $x->[0])
4397     -><AG::DISAnyResource.uri>},
4398     $result => $new_value,
4399 wakaba 1.60 $name => $prop_uri,
4400 wakaba 1.52 }__;
4401     $new_value-><M::dv|DVURIValue.getResource> ($db)
4402     -><AS::DISAnyResource.isReferred> ($el);
4403     $new_value_type = <Q::DISCore:URI>;
4404     } elsif ($el-><M::DISElement.mediaTypeMatch>
4405     (<Q::DISLang|MemberRef>,
4406     $mtopt{default_media_type}, %mtopt)) {
4407     my $v = $el-><M::SWCFGNode.value>;
4408     $v =~ s/^\s+//; $v =~ s/\s+$//;
4409     my ($clsq, $mem, $gs) = split /\s*\.\s*/, $v, 3;
4410     my $res;
4411     if (defined $mem) {
4412     my $cls = $db-><M::DISDatabase.getResource>
4413     ($el-><M::DISElement.tfqnamesValueURI>
4414     ($clsq, $self-><AG::DISAnyResource.sourceNodeID>,
4415     $self-><AG::DISAnyResource.forURI>, node => $el));
4416     $cls-><AS::DISAnyResource.isReferred> ($el);
4417     $res = $cls-><M::DISResource.getChildResourceByNameAndType>
4418     ($mem, <Q::DISLang:AnyMethod>);
4419     unless ($res) {
4420     __UNDEEP{__EXCEPTION{DIS|RESOURCE_NOT_DEFINED_ERR::
4421     DIS:localName => {$mem},
4422     DIS:parentURI => {$cls-><AG::DISAnyResource.uri>},
4423     DIS:elementType => {$el-><AG::SWCFGElement
4424     .expandedURI>},
4425     DIS:sourceNode => {$el},
4426     DIS:sourceCode => {$v},
4427     DIS:expectedType => {
4428     defined $gs ? <Q::DISLang:Attribute>
4429     : <Q::DISLang:Method>
4430     },
4431     }__}__;
4432     }
4433     if (defined $gs) {
4434     $res = $res-><M::DISResource.getChildResourceByType>
4435     ($gs eq 'get' ? <Q::DISLang|AttributeGet>
4436     : <Q::DISLang|AttributeSet>);
4437     unless ($res) {
4438     __UNDEEP{__EXCEPTION{DIS|RESOURCE_NOT_DEFINED_ERR::
4439     DIS:parentURI => {$res-><AG::DISAnyResource.uri>},
4440     DIS:elementType => {$el-><AG::SWCFGElement
4441     .expandedURI>},
4442     DIS:sourceNode => {$el},
4443     DIS:sourceCode => {$v},
4444     DIS:expectedType => {
4445     $gs eq 'get' ? <Q::DISLang:AttributeGet>
4446     : <Q::DISLang:AttributeSet>
4447     },
4448     }__}__;
4449     }
4450     }
4451     } else {
4452     $res = $db-><M::DISDatabase.getResource>
4453     ($el-><M::DISElement.tfqnamesValueURI>
4454     ($clsq, $self-><AG::DISAnyResource.sourceNodeID>,
4455     $self-><AG::DISAnyResource.forURI>, node => $el));
4456     }
4457     $res-><AS::DISAnyResource.isReferred> ($el);
4458     __CODE{dv|createURI::
4459     $uri => {$el-><AG::DISAnyResource.uri>},
4460     $result => $new_value,
4461 wakaba 1.60 $name => $prop_uri,
4462 wakaba 1.52 }__;
4463     $new_value_type = <Q::DISCore:URI>;
4464     } elsif ($el-><M::DISElement.mediaTypeMatch>
4465 wakaba 1.49 (<Q::lang:dis>, $mtopt{default_media_type},
4466     %mtopt)) {
4467     $copy_tree = true;
4468 wakaba 1.48 $el-><M::DISElement.preserveNodePath>;
4469     my $elc = $el->clone;
4470     __CODE{dv|createValue::
4471     $value => {$elc},
4472 wakaba 1.49 $base_type => {$base_type = <Q::lang:dis>},
4473 wakaba 1.50 $type => $new_value_type,
4474 wakaba 1.48 $result => $new_value,
4475 wakaba 1.60 $name => $prop_uri,
4476 wakaba 1.48 }__;
4477 wakaba 1.49 $elc-><M::DISElement.unlinkFromDocument> ($db);
4478 wakaba 1.48 } else {
4479     __CODE{dv|createValue::
4480     $value => {$el-><M::SWCFGNode.value>},
4481     $base_type => {$base_type = <Q::DISCore:String>},
4482 wakaba 1.50 $type => $new_value_type,
4483 wakaba 1.48 $result => $new_value,
4484 wakaba 1.60 $name => $prop_uri,
4485 wakaba 1.48 }__;
4486     }
4487    
4488     unless ($copy_tree) {
4489     for my $ce (@{$el-><M::DISElement.disChildElements>
4490 wakaba 1.49 (for_arg => $for,
4491     forp_arg => $forp,
4492     database_arg => $db)}) {
4493 wakaba 1.48 my $xu = $ce-><AG::SWCFGElement.expandedURI>;
4494     if ({
4495     <Q::dis:AliasFor> => true,
4496     <Q::dis:For> => true,
4497     <Q::dis:ForCheck> => true,
4498     <Q::dis:ContentType> => true,
4499     <Q::dis:resourceFor> => true,
4500     }->{$xu}) {
4501     #
4502 wakaba 1.49 } elsif ($ce-><M::DISElement.isPropertyElement>
4503     (database_arg => $db)) {
4504 wakaba 1.48 my $pr;
4505     __DEEP{
4506     $pr = $add_prop->($self, $ce, $db);
4507     }__;
4508     if ($pr->{prop_mult} eq <Q::DISCore|OrderedList>) {
4509     my $cpv = $new_value-><M::dv|DVValue.getProperty> ($xu);
4510     if (not $cpv) {
4511     __CODE{dv|createOrderedList::
4512     $result => {$cpv},
4513     $type => {$mtopt{default_media_type}},
4514     $base_type => {<Q::DISCore:String>},
4515     }__;
4516     $new_value-><M::dv|DVValue.setProperty> ($xu => $cpv);
4517     }
4518     $cpv-><M::dv|DVList.addItem> ($pr->{new_value});
4519     } elsif ($pr->{prop_mult} eq <Q::DISCore|UnorderedList>) {
4520     my $cpv = $new_value-><M::dv|DVValue.getProperty> ($xu);
4521     if (not $cpv) {
4522     __CODE{dv|createUnorderedList::
4523     $result => {$cpv},
4524     $type => {$mtopt{default_media_type}},
4525     $base_type => {<Q::DISCore:String>},
4526     }__;
4527     $new_value-><M::dv|DVValue.setProperty> ($xu => $cpv);
4528     }
4529     $cpv-><M::dv|DVList.addItem> ($pr->{new_value});
4530     } else {
4531     $new_value-><M::dv|DVValue.setProperty>
4532     ($xu => $pr->{new_value});
4533     }
4534     } else {
4535     __UNDEEP{__EXCEPTION{UNSUPPORTED_ELEMENT_TYPE_ERR::
4536     DIS:elementType => {$xu},
4537     DIS:sourceNode => {$ce},
4538     }__}__;
4539     }
4540     }} # copy_tree
4541    
4542     {new_value => $new_value, base_type => $base_type,
4543 wakaba 1.50 prop_uri => $prop_uri, prop_mult => $prop_mult,
4544     new_value_type => $new_value_type};
4545 wakaba 1.48 };
4546    
4547     my $pr;
4548     __DEEP{
4549 wakaba 1.49 $pr = $add_prop->($self, $el, $db);
4550 wakaba 1.48 }__;
4551     if ($pr->{prop_mult} eq <Q::DISCore|OrderedList>) {
4552     if (not $self->{$pr->{prop_uri}}) {
4553     __CODE{dv|createOrderedList::
4554     $result => {$self->{$pr->{prop_uri}}},
4555 wakaba 1.50 $type => {$pr->{new_value_type}},
4556 wakaba 1.48 $base_type => {$pr->{base_type} || <Q::DISCore:String>},
4557     }__;
4558     }
4559     $self->{$pr->{prop_uri}}-><M::dv|DVList.addItem>
4560     ($pr->{new_value});
4561     } elsif ($pr->{prop_mult} eq <Q::DISCore|UnorderedList>) {
4562     if (not $self->{$pr->{prop_uri}}) {
4563     __CODE{dv|createUnorderedList::
4564     $result => {$self->{$pr->{prop_uri}}},
4565 wakaba 1.50 $type => {$pr->{new_value_type}},
4566 wakaba 1.48 $base_type => {$pr->{base_type} || <Q::DISCore:String>},
4567     }__;
4568     }
4569     $self->{$pr->{prop_uri}}-><M::dv|DVList.addItem>
4570     ($pr->{new_value});
4571     } else {
4572     $self->{$pr->{prop_uri}} = $pr->{new_value};
4573     }
4574 wakaba 1.53
4575     if ($el-><M::DISElement.elementTypeMatch>
4576     (<Q::DISPerl:propHashKey>, database_arg => $db)) {
4577     $db-><M::dp|DISDatabasePerl.plAddHashKey>
4578     ($xu => $pr->{new_value}-><AG::dv|DVValue.stringValue>
4579     => $self);
4580     }
4581 wakaba 1.48 } elsif ($el-><AG::DISElement.isResourceElement>) {
4582     ## TODO: Should rdf:type be validated?
4583     } else {
4584     __UNDEEP{__EXCEPTION{UNSUPPORTED_ELEMENT_TYPE_ERR::
4585     DIS:elementType => {$xu},
4586     DIS:sourceNode => {$el},
4587     }__}__;
4588     }
4589 wakaba 1.6 }
4590 wakaba 1.48 CORE::delete $self->{src};
4591     ($onResourceRead or sub () {})->($self, $self);
4592 wakaba 1.6 }
4593     }__;
4594 wakaba 1.61
4595     @Method:
4596     @@ForCheck: ManakaiDOM|ForIF
4597     @@Name: isTypeURI
4598     @@enDesc:
4599     Tests whether this resource is of a type or not.
4600     @@Param:
4601     @@@Name: typeURI
4602     @@@Type: ResourceURI
4603     @@@enDesc:
4604     A type URI reference to test.
4605     @@Return:
4606     @@@Type:
4607     DOMMain:boolean::ManakaiDOM:all
4608     @@@TrueCase:
4609     @@@@enDesc:
4610     This is a <P::typeURI> resource.
4611     @@@FalseCase:
4612     @@@@enDesc:
4613     This is not a <P::typeURI> resource.
4614 wakaba 1.48 ##DISAnyResource
4615    
4616     IFClsDef:
4617     @IFQName: DISModule
4618     @ClsQName: ManakaiDISModuleDefinition
4619    
4620     @ClsISA: ManakaiDISPropertyAccessor
4621     @ClsISA: ManakaiDISExceptionTarget
4622     @ClsISA: ManakaiDISPerlModuleDefinition
4623     @ClsISA: dp|ManakaiDISModulePerl
4624     @ClsISA: dp|ManakaiDISAnyResourcePerl
4625     @ClsISA: ManakaiDISAnyResource
4626    
4627     @Implement: DOMMinImpl
4628    
4629     @enDesc:
4630     <QUOTE::dis> module definitions.
4631    
4632     @enDesc:
4633     @@ForCheck: ManakaiDOM|ForIF
4634     @@@:
4635     The objects implementing the <IF::DISModule> interface <kwd:MUST>
4636     also implement the <IF::DISAnyResource> interface.
4637 wakaba 1.7
4638 wakaba 1.48 @DISLang:role: ModuleRole
4639    
4640     @Attr:
4641     @@ForCheck: ManakaiDOM|ForClass
4642     @@Name: uris
4643     @@Type:
4644 wakaba 1.60 DISPerl:Array::ManakaiDOM:all
4645 wakaba 1.7 @@enDesc:
4646 wakaba 1.48 A reference to the snapshot array containing the URI reference
4647     of the module.
4648     @@Get:
4649 wakaba 1.7 @@@PerlDef:
4650 wakaba 1.48 $r = [$self->{uri}];
4651 wakaba 1.8
4652     @Attr:
4653 wakaba 1.48 @@ForCheck: ManakaiDOM|ForClass
4654     @@Name: ownerModule
4655     @@ManakaiDOM:isRedefining:1
4656 wakaba 1.8 @@enDesc:
4657 wakaba 1.48 This module itself.
4658     @@Get:
4659     @@@Type: DISModule
4660     @@@clsActualType: ManakaiDISModuleDefinition
4661     @@@nullCase:
4662     @@@@enDesc:
4663     The resource is not part of any module since
4664     its definition is not read (<IF::DISModule.isDefined> is <DOM::false>).
4665     @@@PerlDef: $r = $self;
4666    
4667     @Method:
4668     @@ForCheck: ManakaiDOM|ForClass
4669     @@Name: getFeature
4670     @@Description:
4671     @@@lang:en
4672     @@@@:
4673     Returns a specialized object that implements the specialized
4674     interfaces of the specified feature and version.
4675     @@Param:
4676     @@@Name: feature
4677     @@@Type:
4678     DISLang:String::ManakaiDOM:all
4679     @@@actualType: DOMFeature|FeatureNameString||ManakaiDOM|ManakaiDOMLatest
4680     @@@Description:
4681     @@@@lang:en
4682     @@@@@:
4683     A feature name to request.
4684     @@Param:
4685     @@@Name: version
4686     @@@Type:
4687     DISLang:String::ManakaiDOM:all
4688     @@@actualType:
4689     DOMFeature|FeatureVersionString||ManakaiDOM|ManakaiDOMLatest
4690     @@@Description:
4691     @@@@lang:en
4692     @@@@@:
4693     A feature version number to request.
4694     @@Return:
4695     @@@Type:
4696     DOMMain:Object::ManakaiDOM:all
4697     @@@Description:
4698     @@@@lang:en
4699     @@@@@:
4700     An object that implements the specialized APIs of the
4701     <P::feature> and <P::version>.
4702 wakaba 1.49 @@@nullCase:
4703     @@@@enDesc:
4704 wakaba 1.48 There is no object available that implements interfaces
4705     associated with the <P::feature> and <P::version>.
4706     @@@PerlDef:
4707     $feature =~ s/^\+//;
4708     CLASS: for my $class (grep {
4709     $Message::Util::DIS::ManakaiDISModuleDefinition::CompatClass{$_}
4710     } keys %Message::Util::DIS::ManakaiDISModuleDefinition::CompatClass) {
4711     if ($Message::DOM::ClassFeature{$class}->{$feature}->{$version}) {
4712     $r = bless {o => $self}, $class;
4713     last CLASS;
4714 wakaba 1.27 }
4715 wakaba 1.8 }
4716    
4717     @Attr:
4718 wakaba 1.48 @@Name: isAnonymous
4719 wakaba 1.8 @@enDesc:
4720 wakaba 1.48 Whether the resource has persistent name or not.
4721     @@Type:
4722     DOMMain:boolean::ManakaiDOM:all
4723     @@ForCheck: ManakaiDOM|ForClass
4724 wakaba 1.8 @@Get:
4725 wakaba 1.48 @@@TrueCase:
4726 wakaba 1.8 @@@@enDesc:
4727 wakaba 1.48 A module <kwd:MUST> have a name.
4728 wakaba 1.55 @@@PerlDef: $r = false;
4729    
4730     @Method:
4731     @@Name: addResourceList
4732     @@ForCheck: ManakaiDOM|ForClass
4733     @@enDesc:
4734     Adds a resource to the list of resources belongs to the module.
4735     @@Param:
4736     @@@Name: disResource
4737     @@@Type: DIS|DISResource
4738     @@@enDesc: The resource to add.
4739     @@Return:
4740     @@@PerlDef:
4741     __DEEP{
4742     push @{$self->{<H::DIS|resource>}||=[]},
4743     $disResource-><AG::DIS|DISAnyResource.uriRef>;
4744     }__;
4745    
4746     @Method:
4747     @@Name: getResourceList
4748     @@enDesc:
4749     Returns the list of resources belongs to the module.
4750     @@Return:
4751     @@@Type: DIS|ResourceList
4752     @@@enDesc:
4753     The current snapshot of children.
4754     @@@PerlDef:
4755     __DEEP{
4756     my $db = $self-><AG::DIS|DISAnyResource.database>;
4757     $r = [map {
4758     $db-><M::DIS|DISDatabase.getResource> ($$_)
4759     } @{$self->{<H::DIS|resource>}}];
4760     }__;
4761 wakaba 1.57
4762     @Attr:
4763     @@Name: targetNamespaceURI
4764     @@enDesc:
4765     The default namespace URI of the resources defined in the module.
4766     @@Type: DIS|AnyURI
4767     @@Get:
4768     @@@PerlDef:
4769     $r = defined $self->{<H::DIS|defaultNamespaceURI>}
4770     ? ${$self->{<H::DIS|defaultNamespaceURI>}} : null;
4771     @@Set:
4772     @@@ForCheck: ManakaiDOM|ForClass
4773     @@@PerlDef:
4774     if (defined $given) {
4775     $self->{<H::DIS|defaultNamespaceURI>} = \$given;
4776     } else {
4777     CORE::delete $self->{<H::DIS|defaultNamespaceURI>};
4778     }
4779 wakaba 1.61
4780     @Method:
4781     @@ForCheck: ManakaiDOM|ForClass
4782     @@Name: isTypeURI
4783     @@enDesc:
4784     Tests whether this resource is of a type or not.
4785     @@Param:
4786     @@@Name: typeURI
4787     @@@Type: ResourceURI
4788     @@@enDesc:
4789     A type URI reference to test.
4790     @@Return:
4791     @@@Type:
4792     DOMMain:boolean::ManakaiDOM:all
4793     @@@TrueCase:
4794     @@@@enDesc:
4795     This is a <P::typeURI> resource.
4796     @@@FalseCase:
4797     @@@@enDesc:
4798     This is not a <P::typeURI> resource.
4799     @@@PerlDef:
4800     __DEEP{
4801     $r = $self-><AG::DIS|DISAnyResource.database>
4802     -><M::DIS|DISDatabase.getResource> (<Q::DISCore:Module>)
4803     -><M::DIS|DISAnyResource.isTypeURI> ($typeURI);
4804     }__;
4805 wakaba 1.48 ##DISModule
4806 wakaba 1.55
4807     ClsDef:
4808     @ClsQName: ManakaiDISModuleLite
4809    
4810     @ClsISA: DIS|ManakaiDISAnyResource
4811 wakaba 1.57 @ClsISA: dx|ManakaiDefaultErrorHandler||ManakaiDOM|Perl
4812 wakaba 1.55
4813     @Implement: DOMMinImpl
4814     @Implement: DIS|DISResourceProp
4815     @Implement: dp|DISAnyResourcePerl
4816     @Implement: dp|DISModulePerl
4817     @Implement: dp|DISResourcePerlModule
4818    
4819     @enDesc:
4820     The <Class::ManakaiDISModuleLite> class provides very small
4821     subset of <Class::ManakaiDISModuleDefinition> class. If a
4822     method or attribute which is not implemented by the class, then
4823     the object is updated to the <Class::ManakaiDISModuleDefinition>
4824     by reading additional properties from the <QUOTE::dis> database.
4825    
4826     @Attr:
4827     @@ForCheck: ManakaiDOM|ForClass
4828     @@Name: uris
4829     @@Type:
4830 wakaba 1.60 DISPerl:Array::ManakaiDOM:all
4831 wakaba 1.55 @@enDesc:
4832     A reference to the snapshot array containing the URI reference
4833     of the module.
4834     @@Get:
4835     @@@PerlDef:
4836     $r = [$self->{uri}];
4837    
4838     @Attr:
4839     @@ForCheck: ManakaiDOM|ForClass
4840     @@Name: ownerModule
4841     @@ManakaiDOM:isRedefining:1
4842     @@enDesc:
4843     This module itself.
4844     @@Get:
4845     @@@Type: DISModule
4846     @@@clsActualType: ManakaiDISModuleDefinition
4847     @@@nullCase:
4848     @@@@enDesc:
4849     The resource is not part of any module since
4850     its definition is not read (<IF::DISModule.isDefined> is <DOM::false>).
4851     @@@PerlDef: $r = $self;
4852    
4853     @Attr:
4854     @@Name: isAnonymous
4855     @@enDesc:
4856     Whether the resource has persistent name or not.
4857     @@Type:
4858     DOMMain:boolean::ManakaiDOM:all
4859     @@ForCheck: ManakaiDOM|ForClass
4860     @@Get:
4861     @@@TrueCase:
4862     @@@@enDesc:
4863     A module <kwd:MUST> have a name.
4864     @@@PerlDef: $r = false;
4865    
4866     @Method:
4867     @@Operator:
4868     @@@@: AUTOLOAD
4869     @@@ContentType: lang|Perl
4870     @@Return:
4871     @@@PerlDef:
4872 wakaba 1.57 my $al = our $AUTOLOAD;
4873     $al =~ s/.+:://;
4874     if ($al ne 'DESTROY') {
4875    
4876 wakaba 1.55 __DEEP{
4877     $self-><AG::DIS|DISAnyResource.database>
4878     -><M::dp|ManakaiDISDatabasePerl.plLoadDISDatabaseModule> ($self);
4879     }__;
4880     if (ref $self eq <ClassName::ManakaiDISModuleLite>) {
4881     __EXCEPTION{DIS|RESOURCE_NOT_DEFINED_ERR::
4882     DIS:uri => {$self-><AG::DIS|DISAnyResource.uri>},
4883     DIS:moduleURI => {$self-><AG::DIS|DISAnyResource.uri>},
4884     }__;
4885     }
4886    
4887     my $code = $self->can ($al);
4888     if ($code) {
4889     goto &$code;
4890     } else {
4891     require Carp;
4892     local $Carp::CarpLevel = $Error::Level;
4893     Carp::croak (qq<Can't locate method "$AUTOLOAD">);
4894     }
4895 wakaba 1.57
4896     } # $al
4897    
4898     @Attr:
4899     @@Name: targetNamespaceURI
4900     @@enDesc:
4901     The default namespace URI of the resources defined in the module.
4902     @@Type: DIS|AnyURI
4903     @@Get:
4904     @@@PerlDef:
4905     $r = defined $self->{<H::DIS|defaultNamespaceURI>}
4906     ? ${$self->{<H::DIS|defaultNamespaceURI>}} : null;
4907 wakaba 1.61
4908     @Method:
4909     @@ForCheck: ManakaiDOM|ForClass
4910     @@Name: isTypeURI
4911     @@enDesc:
4912     Tests whether this resource is of a type or not.
4913     @@Param:
4914     @@@Name: typeURI
4915     @@@Type: ResourceURI
4916     @@@enDesc:
4917     A type URI reference to test.
4918     @@Return:
4919     @@@Type:
4920     DOMMain:boolean::ManakaiDOM:all
4921     @@@TrueCase:
4922     @@@@enDesc:
4923     This is a <P::typeURI> resource.
4924     @@@FalseCase:
4925     @@@@enDesc:
4926     This is not a <P::typeURI> resource.
4927     @@@PerlDef:
4928     __DEEP{
4929     $r = $self-><AG::DIS|DISAnyResource.database>
4930     -><M::DIS|DISDatabase.getResource> (<Q::DISCore:Module>)
4931     -><M::DIS|DISAnyResource.isTypeURI> ($typeURI);
4932     }__;
4933 wakaba 1.55 ##DISModuleLite
4934 wakaba 1.48
4935     IFClsDef:
4936     @IFQName: DISFor
4937     @ClsQName: ManakaiDISForDefinition
4938    
4939     @ClsISA: dp|ManakaiDISAnyResourcePerl
4940     @ClsISA: ManakaiDISAnyResource
4941     @ClsISA: ManakaiDISExceptionTarget
4942    
4943     @DISLang:role: ForRole
4944    
4945     @Description:
4946     @@lang:en
4947     @@@:
4948     <QUOTE::dis> <QUOTE::for> definitions.
4949 wakaba 1.8
4950     @Attr:
4951 wakaba 1.48 @@ForCheck: ManakaiDOM|ForClass
4952     @@Name: uris
4953     @@Type:
4954 wakaba 1.60 DISPerl:Array::ManakaiDOM:all
4955 wakaba 1.48 @@actualType: ForURIList
4956 wakaba 1.15 @@enDesc:
4957 wakaba 1.48 A reference to the snapshot array containing the URI reference
4958     of the <QUOTE::for>.
4959 wakaba 1.15 @@Get:
4960     @@@PerlDef:
4961 wakaba 1.48 $r = [$self->{uri}];
4962 wakaba 1.18
4963 wakaba 1.48 @Method:
4964     @@Name: isaURI
4965     @@Description:
4966     @@@lang:en
4967     @@@@:
4968     Whether this <QUOTE::for> is-a another <QUOTE::for> or not.
4969     @@Param:
4970     @@@Name: superURI
4971     @@@Type: ForURI
4972     @@@Description:
4973     @@@@lang:en
4974     @@@@@:
4975     Another <QUOTE::for> URI reference to test.
4976     @@Return:
4977     @@@Type:
4978     DOMMain:boolean::ManakaiDOM:all
4979     @@@TrueCase:
4980     @@@@enDesc:
4981     <P::superURI> is a super-<QUOTE::for> of this <QUOTE::for>.
4982     @@@FalseCase:
4983     @@@@enDesc:
4984     <P::superURI> is not a super-<QUOTE::for> of this <QUOTE::for>.
4985 wakaba 1.18 @@@PerlDef:
4986 wakaba 1.48 $r = $self->{uri} eq $superURI ? true : $self->{isa}->{$superURI};
4987 wakaba 1.15
4988 wakaba 1.48 @Method:
4989     @@Name: addISA
4990 wakaba 1.8 @@enDesc:
4991 wakaba 1.48 Adds a <QUOTE::for> to the list of super-<QUOTE::for> of this
4992     <QUOTE::for>.
4993     @@Param:
4994     @@@Name: superFor
4995     @@@Type: DISFor
4996     @@@clsActualType: ManakaiDISForDefinition
4997 wakaba 1.8 @@@enDesc:
4998 wakaba 1.48 A <QUOTE::for> definition object.
4999     @@Return:
5000 wakaba 1.8 @@@PerlDef:
5001 wakaba 1.48 my @from = ($self->{uri},
5002     grep {$self->{revISA}->{$_}} keys %{$self->{revISA}});
5003     my @to = ($superFor->{uri},
5004     grep {$superFor->{isa}->{$_}} keys %{$superFor->{isa}});
5005 wakaba 1.8 __DEEP{
5006 wakaba 1.48 for my $from (@from) {
5007     for my $to (@to) {
5008     $self->{db}-><M::ManakaiDISDatabase.getFor>
5009     ($from)->{isa}->{$to} = true;
5010     $self->{db}-><M::ManakaiDISDatabase.getFor>
5011     ($to)->{revISA}->{$from} = true;
5012 wakaba 1.8 }
5013     }
5014     }__;
5015    
5016 wakaba 1.48 @Method:
5017     @@Name: getFeature
5018     @@Description:
5019     @@@lang:en
5020     @@@@:
5021     Returns a specialized object that implements the specialized
5022     interfaces of the specified feature and version.
5023     @@Param:
5024     @@@Name: feature
5025     @@@Type:
5026     DISLang:String::ManakaiDOM:all
5027     @@@actualType:
5028     ManakaiDOM:ManakaiDOMFeatureName::ManakaiDOM:ManakaiDOMLatest
5029     @@@Description:
5030     @@@@lang:en
5031     @@@@@:
5032     A feature name to request.
5033     @@Param:
5034     @@@Name: version
5035     @@@Type:
5036     DISLang:String::ManakaiDOM:all
5037     @@@actualType:
5038     ManakaiDOM:ManakaiDOMFeatureVersion::ManakaiDOM:ManakaiDOMLatest
5039     @@@Description:
5040     @@@@lang:en
5041     @@@@@:
5042     A feature version number to request.
5043     @@Return:
5044     @@@Type:
5045     DOMMain:Object::ManakaiDOM:all
5046     @@@Description:
5047     @@@@lang:en
5048     @@@@@:
5049     An object that implements the specialized APIs of the
5050     <P::feature> and <P::version>.
5051 wakaba 1.49 @@@nullCase:
5052     @@@@enDesc:
5053 wakaba 1.48 There is no object available that implements interfaces
5054     associated with the <P::feature> and <P::version>.
5055     @@@PerlDef:
5056     $feature =~ s/^\+//;
5057     CLASS: for my $class (grep {
5058     $Message::Util::DIS::ManakaiDISForDefinition::CompatClass{$_}
5059     } keys %Message::Util::DIS::ManakaiDISForDefinition::CompatClass) {
5060     if ($Message::DOM::ClassFeature{$class}->{$feature}->{$version}) {
5061     $r = bless {o => $self}, $class;
5062     last CLASS;
5063 wakaba 1.8 }
5064     }
5065    
5066     @Attr:
5067 wakaba 1.48 @@Name: isAnonymous
5068 wakaba 1.8 @@enDesc:
5069 wakaba 1.48 Whether the resource has persistent name or not.
5070     @@Type:
5071     DOMMain:boolean::ManakaiDOM:all
5072     @@ForCheck: ManakaiDOM|ForClass
5073 wakaba 1.8 @@Get:
5074 wakaba 1.48 @@@TrueCase:
5075 wakaba 1.8 @@@@enDesc:
5076 wakaba 1.48 A <QUOTE::for> <kwd:MUST> have a name.
5077     @@@PerlDef: $r = true;
5078 wakaba 1.8
5079     @Attr:
5080 wakaba 1.48 @@ForCheck: ManakaiDOM|ForClass
5081     @@Name: forURI
5082     @@Type: ForURI
5083 wakaba 1.8 @@enDesc:
5084 wakaba 1.48 The <QUOTE::for> URI reference for which this module is defined.
5085 wakaba 1.8 @@Get:
5086 wakaba 1.48 @@@InCase:
5087     @@@@Value:
5088     @@@@@@: ManakaiDOM|all
5089     @@@@@ContentType: dis|TypeQName
5090 wakaba 1.8 @@@@enDesc:
5091 wakaba 1.48 The attribute value is always <Q::ManakaiDOM|all> for a
5092     <QUOTE::for> resource.
5093 wakaba 1.8 @@@PerlDef:
5094 wakaba 1.48 $r = <Q::ManakaiDOM|all>;
5095 wakaba 1.8
5096     @Attr:
5097 wakaba 1.48 @@Name: forpURI
5098 wakaba 1.8 @@enDesc:
5099 wakaba 1.48 The <QUOTE::for+> URI references for which this resource is defined.
5100     @@Type: ForURIList
5101 wakaba 1.8 @@Get:
5102 wakaba 1.48 @@@enDesc:
5103     List of <QUOTE::for> URI references. Note that this list is
5104     <QUOTE::dead>.
5105     @@@InCase:
5106     @@@@Value:
5107     @@@@@@: []
5108     @@@@@ContentType: lang|Perl
5109 wakaba 1.8 @@@@enDesc:
5110 wakaba 1.48 The attribute value is always an empty array reference
5111     for a <QUOTE::for> resource.
5112     @@@PerlDef: $r = [];
5113 wakaba 1.9
5114 wakaba 1.48 @Method:
5115     @@Name: isForURI
5116 wakaba 1.9 @@enDesc:
5117 wakaba 1.48 Tests whether this resource is defined for a <QUOTE::for>
5118     or <QUOTE::for+> URI reference or not.
5119 wakaba 1.9 @@Param:
5120 wakaba 1.48 @@@Name:forURI
5121     @@@Type:ForURI
5122     @@@enDesc:
5123     A <QUOTE::for> URI reference to test.
5124 wakaba 1.9 @@Return:
5125     @@@Type:
5126 wakaba 1.48 DOMMain:boolean::ManakaiDOM:all
5127     @@@TrueCase:
5128     @@@@enDesc:
5129     This resource is for <P::forURI>. The attribute
5130     always takes this value for <QUOTE::for> resources.
5131     @@@PerlDef: $r = true;
5132 wakaba 1.12
5133     @Attr:
5134 wakaba 1.48 @@ForCheck: ManakaiDOM|ForClass
5135     @@Name: nameURI
5136     @@Type: NameURI
5137 wakaba 1.12 @@enDesc:
5138 wakaba 1.48 The URI reference of this module, without
5139     <QUOTE::for> identifier.
5140 wakaba 1.12 @@Get:
5141 wakaba 1.49 @@@enDesc:
5142     The attribute value is always equals to
5143     <A::DISAnyResource.uri> for <QUOTE::for> resources.
5144     @@@PerlDef: $r = $self->{uri};
5145 wakaba 1.61
5146     @Method:
5147     @@ForCheck: ManakaiDOM|ForClass
5148     @@Name: isTypeURI
5149     @@enDesc:
5150     Tests whether this resource is of a type or not.
5151     @@Param:
5152     @@@Name: typeURI
5153     @@@Type: ResourceURI
5154     @@@enDesc:
5155     A type URI reference to test.
5156     @@Return:
5157     @@@Type:
5158     DOMMain:boolean::ManakaiDOM:all
5159     @@@TrueCase:
5160     @@@@enDesc:
5161     This is a <P::typeURI> resource.
5162     @@@FalseCase:
5163     @@@@enDesc:
5164     This is not a <P::typeURI> resource.
5165     @@@PerlDef:
5166     __DEEP{
5167     $r = $self-><AG::DIS|DISAnyResource.database>
5168     -><M::DIS|DISDatabase.getResource> (<Q::DISCore:For>)
5169     -><M::DIS|DISAnyResource.isTypeURI> ($typeURI);
5170     }__;
5171 wakaba 1.48 ##DISFor
5172 wakaba 1.18
5173 wakaba 1.48 PropDef:
5174     @QName: isFeatureImplemented
5175     @enDesc:
5176     The list of whether a feature is implemented or not.
5177 wakaba 1.18
5178 wakaba 1.48 IFClsDef:
5179     @IFQName: DISResource
5180     @ClsQName: ManakaiDISResourceDefinition
5181 wakaba 1.19
5182 wakaba 1.48 @ClsISA: ManakaiDISResourceMV
5183     @ClsISA: dp|ManakaiDISResourcePerl
5184     @ClsISA: ManakaiDISPerlModuleDefinition
5185     @ClsISA: dp|ManakaiDISAnyResourcePerl
5186     @ClsISA: ManakaiDISPropertyAccessor
5187     @ClsISA: ManakaiDISAnyResource
5188     @ClsISA: ManakaiDISExceptionTarget
5189 wakaba 1.19
5190 wakaba 1.48 @DISLang:role: ResourceRole
5191 wakaba 1.19
5192 wakaba 1.48 @enDesc:
5193     <QUOTE::dis> resource definitions.
5194 wakaba 1.19
5195 wakaba 1.48 @enDesc:
5196     @@ForCheck: ManakaiDOM|ForIF
5197     @@@:
5198     The objects implementing the <IF::DISResource> interface
5199     <kwd:MUST> also implement the <IF::DISAnyResource> interface.
5200 wakaba 1.12
5201 wakaba 1.46 @Attr:
5202 wakaba 1.48 @@ForCheck: ManakaiDOM|ForClass
5203     @@Name: uris
5204     @@Type:
5205 wakaba 1.60 DISPerl:Array::ManakaiDOM:all
5206 wakaba 1.46 @@enDesc:
5207 wakaba 1.48 Returns the current <EM::snapshot> of the URI references
5208     for this resource, including the alias URI references.
5209 wakaba 1.46 @@Get:
5210     @@@PerlDef:
5211 wakaba 1.48 $r = [grep {$self->{aliasURI}->{$_}} keys %{$self->{aliasURI}}];
5212 wakaba 1.46
5213 wakaba 1.12 @Method:
5214 wakaba 1.48 @@Name: isSubsetOfURI
5215     @@Description:
5216 wakaba 1.37 @@@lang:en
5217     @@@@:
5218 wakaba 1.48 Whether this resource is a subset of another resource or not.
5219     @@Param:
5220     @@@Name: superURI
5221     @@@Type: ResourceURI
5222     @@@Description:
5223     @@@@lang:en
5224     @@@@@:
5225     Another resource URI reference to test.
5226 wakaba 1.12 @@Return:
5227 wakaba 1.48 @@@Type:
5228     DOMMain:boolean::ManakaiDOM:all
5229     @@@TrueCase:
5230     @@@@enDesc:
5231     <P::superURI> is a super-resource of this resource.
5232     @@@FalseCase:
5233 wakaba 1.12 @@@@enDesc:
5234 wakaba 1.48 <P::superURI> is not a super-resource of this resource.
5235 wakaba 1.12 @@@PerlDef:
5236 wakaba 1.48 $r = $self->{aliasURI}->{$superURI} || $self->{subOf}->{$superURI};
5237 wakaba 1.13
5238     @Method:
5239 wakaba 1.48 @@Name: addSuperResource
5240 wakaba 1.13 @@enDesc:
5241 wakaba 1.48 Adds a <QUOTE::dis> resource to the list of super-resource
5242     of this <QUOTE::dis> resource.
5243 wakaba 1.13 @@Param:
5244 wakaba 1.48 @@@Name: superRes
5245 wakaba 1.47 @@@Type: DISResource
5246     @@@clsActualType: ManakaiDISResourceDefinition
5247 wakaba 1.13 @@@enDesc:
5248 wakaba 1.48 A <QUOTE::dis> resource definition object.
5249     @@Return:
5250 wakaba 1.13 @@@PerlDef:
5251 wakaba 1.48 my @from = ($self->{uri},
5252 wakaba 1.50 grep {$self->{supOf}->{$_}} keys %{$self->{supOf}||{}});
5253 wakaba 1.48 my @to = ($superRes->{uri},
5254 wakaba 1.50 grep {$superRes->{subOf}->{$_}} keys %{$superRes->{subOf}||{}});
5255 wakaba 1.13 __DEEP{
5256 wakaba 1.48 for my $from (@from) {
5257     for my $to (@to) {
5258     $self->{db}-><M::ManakaiDISDatabase.getResource>
5259     ($from)->{subOf}->{$to} = true;
5260     $self->{db}-><M::ManakaiDISDatabase.getResource>
5261     ($to)->{supOf}->{$from} = true;
5262 wakaba 1.13 }
5263     }
5264     }__;
5265 wakaba 1.48
5266 wakaba 1.13 @Method:
5267 wakaba 1.48 @@Name: mergeAsAlias
5268 wakaba 1.13 @@enDesc:
5269 wakaba 1.48 Merges another resource definition as an alias of this resource.
5270 wakaba 1.13 @@Param:
5271 wakaba 1.48 @@@Name: aliasResource
5272 wakaba 1.47 @@@Type: DISResource
5273     @@@clsActualType: ManakaiDISResourceDefinition
5274 wakaba 1.13 @@@enDesc:
5275 wakaba 1.48 A resource to merge.
5276     \
5277     {NOTE:: After merging all references to <P::aliasResource>
5278     should be discarded.
5279     \
5280     }
5281     @@NodeParam:
5282     @@Return:
5283     @@@RaiseException:
5284     @@@@@:MERGE_ITSELF_ERR
5285     @@@@@@enDesc:
5286     An attempt is made to merge this resource itself.
5287 wakaba 1.13 @@@PerlDef:
5288 wakaba 1.48 if ($self eq $aliasResource) {
5289     __EXCEPTION{MERGE_ITSELF_ERR::
5290     DIS:uri => {$self->{uri}},
5291     DIS:sourceNode => {$node},
5292     }__;
5293     }
5294     for my $uri ($aliasResource->{uri},
5295     grep {$aliasResource->{aliasURI}->{$_}}
5296     keys %{$aliasResource->{aliasURI}}) {
5297     $self->{aliasURI}->{$uri} = true;
5298     $self->{db}->{resDef}->{$uri} = $self;
5299     $self->{subOf}->{$uri} = true;
5300     $self->{supOf}->{$uri} = true;
5301     }
5302     for my $uri (grep {$aliasResource->{subOf}->{$_}}
5303 wakaba 1.50 keys %{$aliasResource->{subOf}||{}}) {
5304 wakaba 1.48 $self->{subOf}->{$uri} = true;
5305     }
5306     for my $uri (grep {$aliasResource->{supOf}->{$_}}
5307 wakaba 1.50 keys %{$aliasResource->{supOf}||{}}) {
5308 wakaba 1.48 $self->{supOf}->{$uri} = true;
5309     }
5310 wakaba 1.50 my @from = grep {$self->{supOf}->{$_}} keys %{$self->{supOf}||{}};
5311     my @to = grep {$self->{subOf}->{$_}} keys %{$self->{subOf}||{}};
5312 wakaba 1.13 __DEEP{
5313 wakaba 1.48 for my $from (@from) {
5314     for my $to (@to) {
5315     $self->{db}-><M::ManakaiDISDatabase.getResource>
5316     ($from)->{subOf}->{$to} = true;
5317     $self->{db}-><M::ManakaiDISDatabase.getResource>
5318     ($to)->{supOf}->{$from} = true;
5319 wakaba 1.13 }
5320     }
5321     }__;
5322    
5323     @Method:
5324 wakaba 1.48 @@Name: isTypeURI
5325 wakaba 1.13 @@enDesc:
5326 wakaba 1.48 Tests whether this resource is of a type or not.
5327 wakaba 1.13 @@Param:
5328 wakaba 1.48 @@@Name: typeURI
5329     @@@Type: ResourceURI
5330 wakaba 1.13 @@@enDesc:
5331 wakaba 1.48 A type URI reference to test.
5332     @@Return:
5333 wakaba 1.17 @@@Type:
5334 wakaba 1.48 DOMMain:boolean::ManakaiDOM:all
5335     @@@TrueCase:
5336 wakaba 1.17 @@@@enDesc:
5337 wakaba 1.48 This is a <P::typeURI> resource.
5338     @@@FalseCase:
5339 wakaba 1.17 @@@@enDesc:
5340 wakaba 1.48 This is not a <P::typeURI> resource.
5341 wakaba 1.13 @@@PerlDef:
5342 wakaba 1.48 if (not $self->{<Q::rdf:type>}) {
5343     #
5344     } elsif ($self->{<Q::rdf:type>}->{$typeURI}) {
5345     $r = true;
5346     } else {
5347     __DEEP{
5348     C: for my $t_type_uri (grep {$self->{<Q::rdf:type>}->{$_}}
5349     keys %{$self->{<Q::rdf:type>}}) {
5350     my $t_type = $self-><AG::DISAnyResource.database>
5351     -><M::DISDatabase.getResource> ($t_type_uri);
5352     if ($t_type-><M::DISResource.isSubsetOfURI> ($typeURI)) {
5353     $self-><M::DISResourceProp.addPropertyURIUList>
5354     (<Q::rdf:type>, $typeURI);
5355     $r = true;
5356     last C;
5357     }
5358     }
5359 wakaba 1.15 }__;
5360     }
5361    
5362 wakaba 1.48 @Attr:
5363     @@Name: disDataTypeResource
5364     @@enDesc:
5365     The resource referenced by <Q::dis:Type> property.
5366 wakaba 1.15
5367 wakaba 1.48 = If the resource has the <Q::dis:Type> property,
5368     then its value references the data type resource.
5369 wakaba 1.15
5370 wakaba 1.48 = If the resource has no <Q::dis:Type> property but
5371     the dynamic parent resource has the <Q::dis:Type> property,
5372     then its value references the data type resource.
5373    
5374     = Otherwise, the resource has no associated data type resoruce;
5375     this method throws a <X::NO_DIS_TYPE_ERR> exception.
5376     @@Type: DISResource
5377     @@clsActualType: ManakaiDISResourceDefinition
5378     @@Get:
5379     @@@RaiseException:
5380     @@@@@:NO_DIS_TYPE_ERR
5381 wakaba 1.16 @@@@enDesc:
5382 wakaba 1.48 <Q::dis:Type> attribute is not specified.
5383 wakaba 1.13 @@@PerlDef:
5384 wakaba 1.48 __DEEP{
5385     if (UNIVERSAL::isa ($self->{<Q::dis:Type>}, <IFName::dv|DVURIValue>)) {
5386     $r = $self->{<Q::dis:Type>}-><M::dv|DVURIValue.getResource>
5387     ($self-><AG::DISAnyResource.database>);
5388     } else {
5389 wakaba 1.54 my $pr = $self-><AG::DIS|DISResource.dynamicParentResource>;
5390 wakaba 1.48 $r = $pr-><AG::DISResource.disDataTypeResource> if $pr;
5391     }
5392     }__;
5393     unless ($r) {
5394     __EXCEPTION{NO_DIS_TYPE_ERR::
5395     DIS:uri => {$self-><AG::DISAnyResource.uri>},
5396     DIS:sourceNode => {$self-><AG::DISAnyResource.sourceElement>},
5397 wakaba 1.13 }__;
5398     }
5399 wakaba 1.48
5400     @Attr:
5401     @@Name: disDataTypeValue
5402     @@enDesc:
5403     The <Q::dis:Type> property value for the resource.
5404     @@Get:
5405     @@@Type: dv|DVURIValue
5406     @@@clsActualType: dv|ManakaiDVURIValue
5407     @@@RaiseException:
5408     @@@@@:NO_DIS_TYPE_ERR
5409     @@@@enDesc:
5410     <Q::dis:Type> attribute is not specified.
5411     @@@PerlDef:
5412 wakaba 1.13 __DEEP{
5413 wakaba 1.48 if (UNIVERSAL::isa ($self->{<Q::dis:Type>}, <IFName::dv|DVURIValue>)) {
5414     $r = $self->{<Q::dis:Type>};
5415 wakaba 1.16 } else {
5416 wakaba 1.54 my $pr = $self-><AG::DIS|DISResource.dynamicParentResource>;
5417 wakaba 1.48 $r = $pr-><AG::DISResource.disDataTypeValue> if $pr;
5418 wakaba 1.16 }
5419 wakaba 1.48 }__;
5420     unless ($r) {
5421     __EXCEPTION{NO_DIS_TYPE_ERR::
5422     DIS:uri => {$self-><AG::DISAnyResource.uri>},
5423     DIS:sourceNode => {$self-><AG::DISAnyResource.sourceElement>},
5424     }__;
5425     }
5426 wakaba 1.13
5427     @Attr:
5428 wakaba 1.48 @@Name: disActualDataTypeResource
5429 wakaba 1.13 @@enDesc:
5430 wakaba 1.48 <Q::dis:actualType> attribute value of this resource.
5431     @@Type: DISResource
5432     @@clsActualType: ManakaiDISResourceDefinition
5433 wakaba 1.13 @@Get:
5434 wakaba 1.48 @@@RaiseException:
5435     @@@@@:NO_DIS_TYPE_ERR
5436 wakaba 1.13 @@@@enDesc:
5437 wakaba 1.48 <Q::dis:actualType> attribute is not specified,
5438     and <Q::dis:Type> attribute, neigher.
5439 wakaba 1.13 @@@PerlDef:
5440 wakaba 1.48 __DEEP{
5441     if (UNIVERSAL::isa ($self->{<Q::dis:actualType>},
5442     <IFName::dv|DVURIValue>)) {
5443     $r = $self->{<Q::dis:actualType>}-><M::dv|DVURIValue.getResource>
5444     ($self-><AG::DISAnyResource.database>);
5445     } elsif (UNIVERSAL::isa ($self->{<Q::dis:Type>},
5446     <IFName::dv|DVURIValue>)) {
5447     $r = $self->{<Q::dis:Type>}-><M::dv|DVURIValue.getResource>
5448     ($self-><AG::DISAnyResource.database>);
5449     } else {
5450 wakaba 1.54 my $pr = $self-><AG::DIS|DISResource.dynamicParentResource>;
5451 wakaba 1.48 $r = $pr-><AG::DISResource.disActualDataTypeResource> if $pr;
5452     }
5453     }__;
5454     unless ($r) {
5455     __EXCEPTION{NO_DIS_TYPE_ERR::
5456     DIS:uri => {$self-><AG::DISAnyResource.uri>},
5457     DIS:sourceNode => {$self-><AG::DISAnyResource.sourceElement>},
5458 wakaba 1.13 }__;
5459     }
5460 wakaba 1.48
5461     @Attr:
5462     @@Name: disActualDataTypeValue
5463 wakaba 1.13 @@enDesc:
5464 wakaba 1.48 <Q::dis:actualType> node for this resource.
5465     @@Get:
5466     @@@Type: DISElement
5467     @@@clsActualType: ManakaiDISElement
5468 wakaba 1.13 @@@RaiseException:
5469 wakaba 1.48 @@@@@:NO_DIS_TYPE_ERR
5470 wakaba 1.13 @@@@enDesc:
5471 wakaba 1.48 <Q::dis:actualType> attribute is not specified,
5472     and <Q::dis:Type> attribute, neigher.
5473 wakaba 1.13 @@@PerlDef:
5474 wakaba 1.48 __DEEP{
5475     if (UNIVERSAL::isa ($self->{<Q::dis:actualType>},
5476     <IFName::dv|DVURIValue>)) {
5477     $r = $self->{<Q::dis:actualType>};
5478     } elsif (UNIVERSAL::isa ($self->{<Q::dis:Type>},
5479     <IFName::dv|DVURIValue>)) {
5480     $r = $self->{<Q::dis:Type>};
5481 wakaba 1.13 } else {
5482 wakaba 1.54 my $pr = $self-><AG::DIS|DISResource.dynamicParentResource>;
5483 wakaba 1.48 $r = $pr-><AG::DISResource.disActualDataTypeValue> if $pr;
5484 wakaba 1.13 }
5485 wakaba 1.48 }__;
5486     unless ($r) {
5487     __EXCEPTION{NO_DIS_TYPE_ERR::
5488     DIS:uri => {$self-><AG::DISAnyResource.uri>},
5489     DIS:sourceNode => {$self-><AG::DISAnyResource.sourceElement>},
5490 wakaba 1.13 }__;
5491     }
5492    
5493 wakaba 1.15 @IntMethod:
5494 wakaba 1.48 @@Operator:
5495     @@@@: <=>
5496     @@@ContentType:
5497     lang:Perl
5498 wakaba 1.15 @@enDesc:
5499 wakaba 1.54 Compares two resources. If the first character of the
5500     node in the source tree by which the resource is defined
5501     occures before the other resource's first character, then
5502     the former resource is <DFN::less> than the later resource.
5503     If two resources are the same resource, they are <DFN::equal>.
5504     Otherwise, the former resource is <DFN::greater> than
5505     the later resource.
5506    
5507     There are two exceptions. If two resources belongs to
5508     two different modules, i.e. their <A::DIS|DISAnyResource.ownerModule>s
5509     are different, the order is not defined. Also, if
5510     one of resources is not yet defined, i.e. one's
5511     <A::DIS|DISAnyResource.isDefined> takes <DOM::false> value,
5512     then the order is not defined. Even in these cases, two
5513     calls for the method with the same parameter would return
5514     the same result while the resources are left unchanged.
5515 wakaba 1.48 @@Param:
5516     @@@Name: anotherResource
5517     @@@Type: DISResource
5518     @@@enDesc: Another resource to compare.
5519 wakaba 1.15 @@Return:
5520     @@@Type:
5521 wakaba 1.48 DOMMain:unsigned-long::ManakaiDOM:all
5522 wakaba 1.15 @@@PerlDef:
5523 wakaba 1.48 if (UNIVERSAL::isa ($anotherResource,
5524     <ClassName::ManakaiDISResourceDefinition>)) {
5525     $r = $self->{seq} <=> $anotherResource->{seq};
5526     } else {
5527 wakaba 1.54 $r = $self->{uri} <=> $anotherResource;
5528 wakaba 1.48 }
5529 wakaba 1.15
5530     @Method:
5531 wakaba 1.54 @@ForCheck: ManakaiDOM|ForClass
5532     @@ManakaiDOM:isForInternal:1
5533     @@Name: addChildResource
5534     @@enDesc:
5535     Registers a resource as a static child of the resource.
5536     @@Param:
5537     @@@Name: disResource
5538     @@@Type: DIS|DISResource
5539     @@@enDesc:
5540     The resurce to add.
5541     @@Return:
5542     @@@PerlDef:
5543     __DEEP{
5544     push @{$self->{<H::DIS|childResource>}||=[]},
5545     $disResource-><AG::DIS|DISAnyResource.uriRef>;
5546     }__;
5547    
5548     @Method:
5549     @@ForCheck: ManakaiDOM|ForClass
5550     @@ManakaiDOM:isForInternal:1
5551     @@Name: addDynamicChildResource
5552     @@enDesc:
5553     Registers a resource as a dynamic child of the resource.
5554     @@Param:
5555     @@@Name: disResource
5556     @@@Type: DIS|DISResource
5557     @@@enDesc:
5558     The resurce to add.
5559     @@Return:
5560     @@@PerlDef:
5561     __DEEP{
5562     push @{$self->{<H::DIS|dynamicChildResource>}||=[]},
5563     $disResource-><AG::DIS|DISAnyResource.uriRef>;
5564     }__;
5565    
5566     @Method:
5567     @@Name: getChildResourceList
5568     @@enDesc:
5569     Returns the list of static child resources of the resource.
5570     @@Return:
5571     @@@Type: DIS|ResourceList
5572     @@@enDesc:
5573     The current snapshot of children.
5574     @@@PerlDef:
5575     __DEEP{
5576     my $db = $self-><AG::DIS|DISAnyResource.database>;
5577     $r = [map {
5578     $db-><M::DIS|DISDatabase.getResource> ($$_)
5579     } @{$self->{<H::DIS|childResource>}}];
5580     }__;
5581    
5582     @Method:
5583     @@Name: getDynamicChildResourceList
5584     @@enDesc:
5585     Returns the list of dynamic child resources of the resource.
5586     @@Return:
5587     @@@Type: DIS|ResourceList
5588     @@@enDesc:
5589     The current snapshot of children.
5590     @@@PerlDef:
5591     __DEEP{
5592     my $db = $self-><AG::DIS|DISAnyResource.database>;
5593     $r = [map {
5594     $db-><M::DIS|DISDatabase.getResource> ($$_)
5595     } @{$self->{<H::DIS|dynamicChildResource>}}];
5596     }__;
5597    
5598     @Method:
5599 wakaba 1.48 @@Name: getChildResourceByType
5600 wakaba 1.15 @@enDesc:
5601 wakaba 1.48 Gets a static child resource selected by its type.
5602     @@Param:
5603     @@@Name:typeURI
5604     @@@Type:ResourceURI
5605     @@@enDesc:
5606     A URI reference identifying a resource type.
5607     @@ImplNote:
5608     @@@lang:en
5609     @@@@:
5610 wakaba 1.54 {ISSUE:: Some inheritance tracing required for
5611 wakaba 1.48 e.g. <Q::DISLang:InputProcessor> and <Q::DOMMain:ReflectGet>?
5612 wakaba 1.54 }
5613 wakaba 1.15 @@Return:
5614 wakaba 1.47 @@@Type: DISResource
5615     @@@clsActualType: ManakaiDISResourceDefinition
5616 wakaba 1.15 @@@enDesc:
5617 wakaba 1.48 The first child resource (in document order) whose
5618     type matches with <P::typeURI>.
5619 wakaba 1.15 @@@nullCase:
5620     @@@@enDesc:
5621 wakaba 1.48 There is no resource whose type is <P::typeURI>.
5622 wakaba 1.15 @@@PerlDef:
5623 wakaba 1.48 __DEEP{
5624 wakaba 1.54 my $db = $self-><AG::DIS|DISAnyResource.database>;
5625     C: for my $cr_uri (@{$self->{<H::DIS:childResource>}||[]}) {
5626     my $cr = $db-><M::DIS|DISDatabase.getResource> ($$cr_uri);
5627     if ($cr-><M::DIS|DISResource.isTypeURI> ($typeURI)) {
5628 wakaba 1.48 $r = $cr;
5629 wakaba 1.54 last C;
5630 wakaba 1.48 }
5631 wakaba 1.15 }
5632 wakaba 1.48 }__;
5633 wakaba 1.15
5634 wakaba 1.48 @Method:
5635 wakaba 1.54 @@Name: getChildResourceListByType
5636     @@enDesc:
5637     Returns a list of child resources of a specific type.
5638     @@Param:
5639     @@@Name: typeURI
5640     @@@Type: DIS|AnyURI
5641     @@@enDesc:
5642     A URI of the type.
5643     @@Return:
5644     @@@Type: DIS|ResourceList
5645     @@@enDesc:
5646     The current snapshot of the child resources of type <P::typeURI>.
5647     @@@PerlDef:
5648     __DEEP{
5649     my $db = $self-><AG::DIS|DISAnyResource.database>;
5650     $r = [grep {
5651     $_-><M::DIS|DISResource.isTypeURI> ($typeURI)
5652     } map {
5653     $db-><M::DIS|DISDatabase.getResource> ($$_)
5654     } @{$self->{<H::DIS|childResource>}||[]}];
5655     }__;
5656    
5657     @Method:
5658 wakaba 1.48 @@Name: getChildResourceByNameAndType
5659 wakaba 1.15 @@enDesc:
5660 wakaba 1.48 Gets a static child resource selected by its local name and type.
5661 wakaba 1.15 @@Param:
5662 wakaba 1.48 @@@Name: localName
5663     @@@Type:
5664     DISCore:LocalName::ManakaiDOM:all
5665 wakaba 1.15 @@@enDesc:
5666 wakaba 1.48 A local name.
5667 wakaba 1.15 @@Param:
5668 wakaba 1.48 @@@Name:typeURI
5669     @@@Type:ResourceURI
5670 wakaba 1.15 @@@enDesc:
5671 wakaba 1.48 A URI reference identifying a resource type.
5672     @@Return:
5673 wakaba 1.47 @@@Type: DISResource
5674     @@@clsActualType: ManakaiDISResourceDefinition
5675 wakaba 1.15 @@@enDesc:
5676 wakaba 1.48 The first (by document order) child resource whose
5677     type matches for <P::localName> and <P::typeURI>.
5678 wakaba 1.15 @@@nullCase:
5679     @@@@enDesc:
5680 wakaba 1.48 There is no resource whose name is <P::localName> and
5681     whose type is <P::typeURI>.
5682     @@@PerlDef:
5683     __DEEP{
5684 wakaba 1.54 my $db = $self-><AG::DIS|DISAnyResource.database>;
5685     C: for my $cr_uri (@{$self->{<H::DIS:childResource>}||[]}) {
5686     my $cr = $db-><M::DIS|DISDatabase.getResource> ($$cr_uri);
5687     my $ln = $cr-><AG::DIS|DISAnyResource.localName>;
5688 wakaba 1.48 if (defined $ln and $ln eq $localName and
5689 wakaba 1.54 $cr-><M::DIS|DISResource.isTypeURI> ($typeURI)) {
5690 wakaba 1.48 $r = $cr;
5691 wakaba 1.54 last C;
5692 wakaba 1.48 }
5693     }
5694     }__;
5695    
5696     @Method:
5697     @@Name: getConstResourceByName
5698     @@enDesc:
5699     Gets a constant value resource by its local name.
5700 wakaba 1.15 @@Param:
5701 wakaba 1.48 @@@Name:localName
5702 wakaba 1.15 @@@Type:
5703 wakaba 1.48 DISLang:String::ManakaiDOM:all
5704 wakaba 1.15 @@@enDesc:
5705 wakaba 1.48 Constant name.
5706 wakaba 1.15 @@Return:
5707 wakaba 1.48 @@@Type: DISResource
5708     @@@clsActualType: ManakaiDISResourceDefinition
5709     @@@enDesc:
5710     The constant resource identified by <P::localName>.
5711     @@@nullCase:
5712 wakaba 1.16 @@@@enDesc:
5713 wakaba 1.48 There is no such constant resource.
5714 wakaba 1.15 @@@PerlDef:
5715 wakaba 1.48 __DEEP{
5716     my @constGroup;
5717 wakaba 1.54 my $db = $self-><AG::DIS|DISAnyResource.database>;
5718     C: for my $cr_uri (@{$self->{<H::DIS:childResource>}||[]}) {
5719     my $cr = $db-><M::DIS|DISDatabase.getResource> ($$cr_uri);
5720     my $ln = $cr-><AG::DIS|DISAnyResource.localName>;
5721 wakaba 1.48 if ($ln and $ln eq $localName and
5722 wakaba 1.54 $cr-><M::DIS|DISResource.isTypeURI> (<Q::DISLang:Const>)) {
5723 wakaba 1.48 $r = $cr;
5724 wakaba 1.54 last C;
5725     } elsif ($cr-><M::DIS|DISResource.isTypeURI>
5726     (<Q::DISLang:ConstGroup>)) {
5727 wakaba 1.48 push @constGroup, $cr;
5728     }
5729     }
5730     unless ($r) {
5731 wakaba 1.54 D: for my $cg (@constGroup) {
5732     $r = $cg-><M::DIS|DISResource.getChildResourceByNameAndType>
5733     ($localName, <Q::DISLang:Const>);
5734     last D if $r;
5735 wakaba 1.15 }
5736     }
5737 wakaba 1.48 }__;
5738 wakaba 1.15
5739 wakaba 1.18 @Attr:
5740 wakaba 1.54 @@Name: parentResource
5741     @@enDesc:
5742     The static parent resource of the resource.
5743     @@Type: DIS|DISResource
5744     @@nullCase:
5745     @@@enDesc: No parent resource.
5746     @@Get:
5747     @@@PerlDef:
5748     __DEEP{
5749     if ($self->{<H::DIS|parentResource>}) {
5750     $r = $self-><AG::DIS|DISAnyResource.database>
5751     -><M::DIS|DISDatabase.getResource>
5752     (${$self->{<H::DIS|parentResource>}});
5753     }
5754     }__;
5755     @@Set:
5756     @@@ForCheck: ManakaiDOM|ForClass
5757     @@@PerlDef:
5758     __DEEP{
5759     if ($given) {
5760     $self->{<H::DIS|parentResource>}
5761     = $given-><AG::DIS|DISAnyResource.uriRef>;
5762     } else {
5763     CORE::delete $self->{<H::DIS|parentResource>};
5764     }
5765     }__;
5766    
5767     @Attr:
5768     @@Name: dynamicParentResource
5769     @@enDesc:
5770     The dynamic parent resource of the resource.
5771     @@Type: DIS|DISResource
5772     @@nullCase:
5773     @@@enDesc: No parent resource.
5774     @@Get:
5775     @@@PerlDef:
5776     __DEEP{
5777     if ($self->{<H::DIS|dynamicParentResource>}) {
5778     $r = $self-><AG::DIS|DISAnyResource.database>
5779     -><M::DIS|DISDatabase.getResource>
5780     (${$self->{<H::DIS|dynamicParentResource>}});
5781     }
5782     }__;
5783     @@Set:
5784     @@@ForCheck: ManakaiDOM|ForClass
5785     @@@PerlDef:
5786     __DEEP{
5787     if ($given) {
5788     $self->{<H::DIS|dynamicParentResource>}
5789     = $given-><AG::DIS|DISAnyResource.uriRef>;
5790     } else {
5791     CORE::delete $self->{<H::DIS|dynamicParentResource>};
5792     }
5793     }__;
5794    
5795     @Attr:
5796 wakaba 1.48 @@Name: ownerClassNodeURI
5797 wakaba 1.18 @@enDesc:
5798 wakaba 1.48 The node URI reference of the class resource this resource
5799     belongs to.
5800     @@Type: ResourceURI
5801 wakaba 1.18 @@Get:
5802 wakaba 1.48 @@@enDesc:
5803     The URI reference of the <Q::ManakaiDOM:Class> resource.
5804     If this resource is a class, then the URI reference
5805     of this resource is returned.
5806     @@@nullCase:
5807 wakaba 1.18 @@@@enDesc:
5808 wakaba 1.48 This resource does not belong to any class.
5809 wakaba 1.18 @@@PerlDef:
5810 wakaba 1.53 if (exists $self->{<H::DIS:ownerClass>}) {
5811     $r = $self->{<H::DIS:ownerClass>};
5812 wakaba 1.48 } else {
5813     my $res = $self;
5814     __DEEP{
5815     RES: {
5816     if ($res-><M::ManakaiDISResourceDefinition.isTypeURI>
5817     (<Q::ManakaiDOM:Class>)) {
5818     $r = $res-><AG::DISAnyResource.sourceNodeID>;
5819     } else {
5820 wakaba 1.54 $res = $res-><AG::DIS|DISResource.parentResource>;
5821 wakaba 1.48 redo RES if $res;
5822     }
5823 wakaba 1.18 }
5824 wakaba 1.48 }__;
5825 wakaba 1.53 $self->{<H::DIS:ownerClass>} = $r;
5826 wakaba 1.48 }
5827 wakaba 1.18
5828     @Attr:
5829     @@Name: disIsNullValue
5830     @@enDesc:
5831     Whether this resource have <DOM::null> value or not.
5832     A resource have <DOM::null> value iff it has
5833     <Q::dis:Value> attribute node that in turn has
5834     <Q::dis:is-null> attribute whose value set to <DOM::true>.
5835     @@Type:
5836     DOMMain:boolean::ManakaiDOM:all
5837     @@Get:
5838     @@@PerlDef:
5839 wakaba 1.51 if ($self->{<Q::dis:Value>}) {
5840     $r = $self->{<Q::dis:Value>}-><AG::dv|DVValue.isNull>;
5841 wakaba 1.18 }
5842 wakaba 1.19
5843 wakaba 1.24 @Method:
5844     @@Name: isFeatureProvided
5845     @@enDesc:
5846     Whether a feature is provided by this resource or not.
5847     Note that the feature is actually available (implemented)
5848     or not is other thing (use <M::ManakaiDISPerlModuleDefinition
5849     .plIsFeatureImplemented> instead).
5850     @@Param:
5851     @@@Name: featureResourceURI
5852     @@@Type: ResourceURI
5853     @@@enDesc:
5854     The URI reference of the resource definition for the feature to test.
5855     @@Return:
5856     @@@Type:
5857     DOMMain:boolean::ManakaiDOM:all
5858     @@@enDesc:
5859     Whether the feature is provided or not.
5860     @@@PerlDef:
5861     __DEEP{
5862     my @f = @{$self-><M::ManakaiDISPropertyAccessor
5863     .getPropertyResourceList>
5864     (<Q::DOMMain:implementFeature>,
5865 wakaba 1.26 isa_recursive => true,
5866 wakaba 1.24 default_media_type => <Q::dis:TypeQName>)};
5867     if (@f) {
5868     for my $f (@f) {
5869     if ($f-><M::ManakaiDISResourceDefinition.isSubsetOfURI>
5870     ($featureResourceURI)) {
5871     $r = true;
5872     last;
5873     }
5874     }
5875     } else {
5876 wakaba 1.54 my $parent = $self-><AG::DIS|DISResource.parentResource>;
5877 wakaba 1.24 $r = $parent-><M::ManakaiDISResourceDefinition.isFeatureProvided>
5878     ($featureResourceURI)
5879     if $parent;
5880     }
5881     }__;
5882    
5883     @Attr:
5884     @@Name: featureNameList
5885     @@enDesc:
5886     The list of the names of the feature defined by this resource.
5887 wakaba 1.48
5888     = If the resource has one or more <Q::dis:AppName> attributes,
5889     their text values are feature names.
5890    
5891     = If there is no <Q::dis:AppName> attributes but the resource
5892     is a <Q::DOMFeature:instanceOf> another feature, then
5893     the set of the feature names of the resource is equal
5894     to the one of another feature's feature names.
5895    
5896     {OLI:: If two operation above does not result in one or more
5897     feature names,
5898    
5899     = and if the resource has a name (the <A::DISAnyResource
5900     .isAnonymous> attribute returns <DOM::false>), then
5901     the <A::DISAnyResource.nameURI> of the resource is
5902     a feature name.
5903    
5904     = otherwise, i.e. <A::DISAnyResource.isAnonymous> is
5905     <DOM::true>, then the <A::DISAnyResource.localName>
5906     of the resource, if non-<DOM::null>, is a feature name.
5907    
5908     }
5909    
5910 wakaba 1.24 @@Type:
5911 wakaba 1.60 DISPerl:ARRAY::ManakaiDOM:all
5912 wakaba 1.24 @@Get:
5913 wakaba 1.48 @@@enDesc:
5914     A reference to the array containing feature names.
5915     Note that the order in the array is <EM::not> significant.
5916     The array might be empty if the resource has no feature name.
5917     This array is dead.
5918    
5919     {NOTE:: The attribute value array might be non-empty
5920     even if the resource is not of type <Q::DOMFeature:Feature>
5921     as far as the algorithm defined above returns
5922     some feature names.
5923     }
5924 wakaba 1.24 @@@RaiseException:
5925     @@@@@:UNSUPPORTED_MEDIA_TYPE_ERR
5926     @@@@enDesc:
5927     There is an <Q::dis:AppName> attribute whose media
5928     type is not supported.
5929     @@@RaiseException:
5930     @@@@@: NO_SOURCE_NODE_ERR
5931     @@@@enDesc:
5932     This resource definition does not have associated node
5933     in the source tree.
5934     @@@PerlDef:
5935     __DEEP{
5936 wakaba 1.49 $r = [map {lc} @{$self-><M::DISResourceProp.getPropertyTextList>
5937 wakaba 1.52 (<Q::DOMFeature:name>)}];
5938 wakaba 1.24 unless (@$r) {
5939 wakaba 1.48 ## TODO: instance feature
5940 wakaba 1.54 my $pr = $self-><AG::DIS|DISResource.parentResource>;
5941 wakaba 1.28 if ($pr) {
5942 wakaba 1.52 if ($pr-><M::DISResource.isTypeURI> (<Q::DOMFeature:Feature>) and
5943 wakaba 1.48 not $pr-><AG::DISAnyResource.isAnonymous>) {
5944     push @$r, @{$pr-><AG::DISResource.featureNameList>};
5945 wakaba 1.28 }
5946     }
5947     }
5948     unless (@$r) {
5949 wakaba 1.48 if ($self-><AG::DISAnyResource.isAnonymous>) {
5950     my $ln = $self-><AG::DISAnyResource.localName>;
5951 wakaba 1.28 push @$r, lc $ln if defined $ln;
5952 wakaba 1.24 } else {
5953 wakaba 1.48 push @$r, lc $self-><AG::DISAnyResource.nameURI>;
5954     }
5955     }
5956     }__;
5957    
5958     @Method:
5959     @@ForCheck: ManakaiDOM|ForClass
5960     @@Name: getFeature
5961     @@Description:
5962     @@@lang:en
5963     @@@@:
5964     Returns a specialized object that implements the specialized
5965     interfaces of the specified feature and version.
5966     @@Param:
5967     @@@Name: feature
5968     @@@Type:
5969     DISLang:String::ManakaiDOM:all
5970     @@@actualType:
5971     ManakaiDOM:ManakaiDOMFeatureName::ManakaiDOM:ManakaiDOMLatest
5972     @@@Description:
5973     @@@@lang:en
5974     @@@@@:
5975     A feature name to request.
5976     @@Param:
5977     @@@Name: version
5978     @@@Type:
5979     DISLang:String::ManakaiDOM:all
5980     @@@actualType:
5981     ManakaiDOM:ManakaiDOMFeatureVersion::ManakaiDOM:ManakaiDOMLatest
5982     @@@Description:
5983     @@@@lang:en
5984     @@@@@:
5985     A feature version number to request.
5986     @@Return:
5987     @@@Type:
5988     DOMMain:Object::ManakaiDOM:all
5989     @@@Description:
5990     @@@@lang:en
5991     @@@@@:
5992     An object that implements the specialized APIs of the
5993     <P::feature> and <P::version>.
5994 wakaba 1.49 @@@nullCase:
5995     @@@@enDesc:
5996 wakaba 1.48 There is no object available that implements interfaces
5997     associated with the <P::feature> and <P::version>.
5998     @@@PerlDef:
5999     $feature =~ s/^\+//;
6000     CLASS: for my $class (grep {
6001     $Message::Util::DIS::ManakaiDISResourceDefinition::CompatClass{$_}
6002     } keys %Message::Util::DIS::ManakaiDISResourceDefinition::CompatClass){
6003     if ($Message::DOM::ClassFeature{$class}->{$feature}->{$version}) {
6004     $r = bless {o => $self}, $class;
6005     last CLASS;
6006 wakaba 1.24 }
6007     }
6008 wakaba 1.48
6009     @Attr:
6010     @@Name: multiplePropertiesURI
6011     @@enDesc:
6012     Whether the property allows multiple occurence of the attribute
6013     in the <QUOTE::dis> source tree.
6014     @@Type: DISLang|String||ManakaiDOM|all
6015     @@Get:
6016     @@@PerlDef:
6017     __DEEP{
6018     if ($self->{<Q::dis|multipleProperties>}) {
6019     $r = $self->{<Q::dis|multipleProperties>}
6020     -><M::dv|DVURIValue.getResource>
6021     ($self-><AG::DISAnyResource.database>)
6022     -><AG::DISAnyResource.uri>;
6023     } else {
6024     $r = <Q::DISCore|OrderedList>;
6025     }
6026     }__;
6027    
6028     @Attr:
6029     @@Name: defaultLextypeURI
6030     @@enDesc:
6031     The URI of the default lexical type for the <QUOTE::dis> attribute.
6032     @@Type: DISLang|String||ManakaiDOM|all
6033     @@Get:
6034     @@@PerlDef:
6035     __DEEP{
6036     if ($self->{<Q::dis:dataType>}) {
6037     $r = $self->{<Q::dis:dataType>}
6038     -><M::dv|DVURIValue.getResource>
6039     ($self-><AG::DISAnyResource.database>)
6040     -><AG::DISAnyResource.uri>;
6041     } else {
6042     $r = <Q::DISCore|String>;
6043     }
6044 wakaba 1.24 }__;
6045 wakaba 1.48 ##DISResource
6046    
6047     IFClsDef:
6048     @IFQName: DISResourceMV
6049     @ClsQName: ManakaiDISResourceMV
6050    
6051     @enDesc:
6052     The objects implementing the <IF::DISResourceMV> <kwd:MUST>
6053     also implement the <IF::DISResource> interface.
6054 wakaba 1.32
6055     @Attr:
6056     @@Name: mvLocalName
6057     @@enDesc:
6058     The local name of the markup vocabulary element defined by this
6059     resource.
6060     @@Type:
6061     DISLang:String::ManakaiDOM:all
6062     @@Get:
6063     @@@nullCase:
6064     @@@@enDesc:
6065     Either this resource does not define a markup vocabulary element
6066     or it does define an element but it does not have a local name.
6067     @@@PerlDef:
6068     __DEEP{
6069 wakaba 1.48 if (UNIVERSAL::isa ($self->{<Q::dis|AppName>},
6070     <IFName::dv|DVQNameValue>)) {
6071     $r = $self->{<Q::dis|AppName>}-><AG::dv|DVQNameValue.localName>;
6072 wakaba 1.43 } else {
6073 wakaba 1.59 $r = $self-><AG::DIS|DISAnyResource.localName>;
6074 wakaba 1.43 }
6075     }__;
6076    
6077     @Attr:
6078     @@Name: mvPrefix
6079     @@enDesc:
6080     A typical namespace prefix of the markup vocabulary element defined
6081     by this resource.
6082     @@Type:
6083     DISLang:String::ManakaiDOM:all
6084     @@Get:
6085     @@@nullCase:
6086     @@@@enDesc:
6087     Either this resource does not define a markup vocabulary element
6088     or it does define an element but it does not have a namespace URI.
6089     @@@PerlDef:
6090     __DEEP{
6091 wakaba 1.48 if (UNIVERSAL::isa ($self->{<Q::dis|AppName>},
6092     <IFName::dv|DVQNameValue>)) {
6093     $r = $self->{<Q::dis|AppName>}-><AG::dv|DVQNameValue.prefix>;
6094 wakaba 1.43 }
6095     unless (defined $r) {
6096 wakaba 1.48 my $nsuri = $self-><AG::DISResourceMV.mvNamespaceURI>;
6097 wakaba 1.43 if (defined $nsuri and $nsuri =~ /([A-Za-z]\w*)\W*$/) {
6098 wakaba 1.53 $r = $1;
6099 wakaba 1.43 } elsif (defined $nsuri) {
6100 wakaba 1.53 $r = 'ns';
6101 wakaba 1.43 }
6102 wakaba 1.32 }
6103     }__;
6104    
6105     @Attr:
6106     @@Name: mvNamespaceURI
6107     @@enDesc:
6108     The namespace URI of the markup vocabulary element defined by this
6109     resource.
6110     @@Type: AnyURI
6111     @@Get:
6112     @@@nullCase:
6113     @@@@enDesc:
6114     Either this resource does not define a markup vocabulary element
6115     or it does define an element but it does not have a namespace URI.
6116     @@@PerlDef:
6117     __DEEP{
6118 wakaba 1.48 if (UNIVERSAL::isa ($self->{<Q::dis|AppName>},
6119     <IFName::dv|DVQNameValue>)) {
6120     $r = $self->{<Q::dis|AppName>}-><AG::dv|DVQNameValue.namespaceURI>;
6121 wakaba 1.32 } else {
6122 wakaba 1.59 $r = $self-><AG::DIS|DISAnyResource.namespaceURI>;
6123 wakaba 1.32 }
6124     }__;
6125    
6126     @Attr:
6127     @@Name: mvOwnerElementResource
6128     @@enDesc:
6129     An <QUOTE::owner element> resource of the markup vocabulary
6130     element defined by this resource.
6131 wakaba 1.47 @@Type: DISResource
6132     @@clsActualType: ManakaiDISResourceDefinition
6133 wakaba 1.32 @@Get:
6134     @@@nullCase:
6135     @@@@enDesc:
6136     Either this resource does not define a markup vocabulary element
6137     or it does define an element but it does not have an owner.
6138     @@@PerlDef:
6139     __DEEP{
6140 wakaba 1.53 if (exists $self->{<H::DIS:mvOwnerElementURI>}) {
6141 wakaba 1.32 $r = $self->{db}-><M::ManakaiDISDatabase.getResource>
6142 wakaba 1.53 ($self->{<H::DIS:mvOwnerElementURI>})
6143     if defined $self->{<H::DIS:mvOwnerElementURI>};
6144 wakaba 1.54 } else {
6145     $r = $self-><AG::DIS|DISResource.parentResource>;
6146     undef $r unless $r-><M::DIS|DISResource
6147 wakaba 1.32 .isTypeURI> (<Q::s:AnyOwnerElement>);
6148 wakaba 1.53 $self->{<H::DIS:mvOwnerElementURI>} = $r->{uri} if $r;
6149 wakaba 1.32 }
6150 wakaba 1.48 }__;
6151     ##DISResourceMV
6152 wakaba 1.27
6153     PropDef:
6154 wakaba 1.32 @QName: mvLocalName
6155     @enDesc:
6156     <A::ManakaiDISResourceDefinition.mvLocalName>.
6157    
6158     PropDef:
6159 wakaba 1.43 @QName: mvPrefix
6160     @enDesc:
6161     <A::ManakaiDISResourceDefinition.mvPrerix>.
6162    
6163     PropDef:
6164 wakaba 1.32 @QName: mvNamespaceURI
6165     @enDesc:
6166     <A::ManakaiDISResourceDefinition.mvNamespaceURI>.
6167    
6168     PropDef:
6169     @QName: mvOwnerElementURI
6170     @enDesc:
6171     <A::ManakaiDISResourceDefinition.mvOwnerElementResource>
6172     (<QUOTE::dis> resource URI reference).
6173    
6174     PropDef:
6175 wakaba 1.13 @QName: ownerClass
6176     @enDesc:
6177     The class to which this resource belongs.
6178     @Type: ResourceURI
6179     @rdfs:range:
6180     rdf:Resource
6181     @rdfs:domain:
6182     ManakaiDOM:Class
6183    
6184 wakaba 1.12 ResourceDef:
6185     @QName: DOMMinImpl
6186     @AliasFor:
6187 wakaba 1.46 DOMFeature:GetFeature::ManakaiDOM:ManakaiDOMLatest
6188 wakaba 1.49 @For: DIS|ForEmpty
6189 wakaba 1.20
6190     ResourceDef:
6191 wakaba 1.12 @QName: SWCFGNode
6192     @AliasFor:
6193     swcfg21:SWCFGNode::swcfg21:ForLatest
6194 wakaba 1.49 @For: DIS|ForEmpty
6195 wakaba 1.12
6196     ResourceDef:
6197 wakaba 1.48 @QName: SWCFGElement
6198     @AliasFor:
6199     swcfg21:SWCFGElement::swcfg21:ForLatest
6200 wakaba 1.49 @For: DIS|ForEmpty
6201 wakaba 1.48
6202     ResourceDef:
6203 wakaba 1.12 @QName: SWCFGDoc
6204     @AliasFor:
6205     swcfg21:SWCFGDocument::swcfg21:ForLatest
6206 wakaba 1.49 @For: DIS|ForEmpty
6207 wakaba 1.12
6208     XParamDef:
6209 wakaba 1.48 @QName: sourceNodePath
6210     @enDesc:
6211     A node path string of the source node.
6212    
6213     XParamDef:
6214 wakaba 1.12 @QName: errResource
6215     @enDesc:
6216     A resource on which an error has occurred.
6217    
6218 wakaba 1.8 XParamDef:
6219     @QName: generatedName
6220     @enDesc:
6221     A generated name.
6222    
6223 wakaba 1.47 IFClsDef:
6224     @IFQName: DISResourceProp
6225 wakaba 1.2 @ClsQName: ManakaiDISPropertyAccessor
6226 wakaba 1.47
6227 wakaba 1.3 @enDesc:
6228 wakaba 1.2 Accessor methods for resource or module properties.
6229 wakaba 1.48
6230     @Method:
6231     @@Name: getPropertyValue
6232 wakaba 1.22 @@enDesc:
6233 wakaba 1.48 Returns a property value object.
6234     @@PropNameParam:
6235     @@Return:
6236     @@@Type: dv|DVValue
6237     @@@enDesc: The property value.
6238 wakaba 1.22 @@@nullCase:
6239     @@@@enDesc:
6240 wakaba 1.48 The property has no value.
6241 wakaba 1.22 @@@PerlDef:
6242 wakaba 1.52 if ($self->{$propName}) {
6243 wakaba 1.54 $r = $self->{$propName}->[0];
6244 wakaba 1.52 } else {
6245     my $pr = $self-><AG::DISAnyResource.database>
6246     -><M::DISDatabase.getResource> ($propName);
6247 wakaba 1.53 A: for (grep {$pr->{aliasURI}->{$_} or $pr->{supOf}->{$_}}
6248     (keys %{$pr->{aliasURI}}, keys %{$pr->{supOf}||{}})) {
6249 wakaba 1.52 my $v = $self->{$_};
6250     if ($v) {
6251     $r = $v->[0];
6252     last A;
6253     }
6254     }
6255     }
6256 wakaba 1.22
6257 wakaba 1.48 @Method:
6258     @@Name: getPropertyValueList
6259 wakaba 1.22 @@enDesc:
6260 wakaba 1.48 Returns a property value objects.
6261     @@PropNameParam:
6262     @@Return:
6263 wakaba 1.60 @@@Type: DISPerl|ARRAY||ManakaiDOM|all
6264 wakaba 1.48 @@@enDesc: The property value.
6265     @@@PerlDef:
6266     my $pr = $self-><AG::DISAnyResource.database>
6267     -><M::DISDatabase.getResource> ($propName);
6268     $r = [map {@$_}
6269 wakaba 1.49 grep {defined $_}
6270 wakaba 1.48 map {$self->{$_}}
6271 wakaba 1.53 grep {$pr->{aliasURI}->{$_} or $pr->{supOf}->{$_}}
6272     (keys %{$pr->{aliasURI}}, keys %{$pr->{supOf}||{}})];
6273 wakaba 1.22
6274 wakaba 1.2 @Method:
6275 wakaba 1.8 @@Name: getPropertyBoolean
6276     @@enDesc:
6277     Gets boolean property value.
6278     @@PropNameParam:
6279     @@Param:
6280     @@@Name:default
6281     @@@Type:
6282     DOMMain:boolean::ManakaiDOM:all
6283     @@@enDesc:
6284     The default value that is returned if no explicit property
6285     value specification found for this resource.
6286     @@Return:
6287     @@@Type:
6288     DOMMain:boolean::ManakaiDOM:all
6289     @@@enDesc:
6290     The property value.
6291     @@@PerlDef:
6292 wakaba 1.48 if (ref $self->{$propName}) {
6293     $r = $self->{$propName}-><AG::dv|DVValue.value> ? true : false;
6294 wakaba 1.8 $r = $default unless defined $r;
6295     } else {
6296 wakaba 1.48 my $pr = $self-><AG::DISAnyResource.database>
6297     -><M::DISDatabase.getResource> ($propName);
6298     C: {
6299     for (map {$self->{$_}}
6300 wakaba 1.53 grep {$pr->{aliasURI}->{$_} or $pr->{supOf}->{$_}}
6301     (keys %{$pr->{aliasURI}}, keys %{$pr->{supOf}||{}})) {
6302 wakaba 1.48 if (defined $_) {
6303     $r = $_-><AG::dv|DVValue.value> ? true : false;
6304     last C;
6305     }
6306     }
6307     $r = $default;
6308     } # C
6309 wakaba 1.8 }
6310    
6311     @Method:
6312 wakaba 1.2 @@Name: getPropertyText
6313     @@enDesc:
6314     Gets property value text.
6315     @@PropNameParam:
6316     @@Param:
6317     @@@Name:default
6318     @@@Type:
6319 wakaba 1.3 swcfg21:SWCFGString::swcfg21:ForLatest
6320 wakaba 1.2 @@@enDesc:
6321     The default value that is returned if no explicit property
6322     value specification found for this resource.
6323     @@@nullCase:
6324     @@@@enDesc:
6325     No default value supplied; <DOM::null> is returned if
6326     no value specified.
6327     @@Return:
6328     @@@Type:
6329 wakaba 1.3 swcfg21:SWCFGString::swcfg21:ForLatest
6330 wakaba 1.2 @@@enDesc:
6331     The property value string.
6332     @@@nullCase:
6333     @@@@enDesc:
6334     No value nor default value has specified.
6335     @@@PerlDef:
6336 wakaba 1.48 if (defined $self->{$propName}) {
6337     $r = $self->{$propName}-><AG::dv|DVValue.stringValue>;
6338     $r = $default unless defined $r;
6339     } else {
6340     my $pr = $self-><AG::DISAnyResource.database>
6341     -><M::DISDatabase.getResource> ($propName);
6342     C: {
6343     for (map {$self->{$_}}
6344 wakaba 1.53 grep {$pr->{aliasURI}->{$_} or $pr->{supOf}->{$_}}
6345     (keys %{$pr->{aliasURI}}, keys %{$pr->{supOf}||{}})) {
6346 wakaba 1.48 if (defined $_) {
6347     $r = $_-><AG::dv|DVValue.stringValue>;
6348     last C;
6349     }
6350     }
6351 wakaba 1.8 $r = $default;
6352 wakaba 1.48 } # C
6353 wakaba 1.2 }
6354    
6355     @Method:
6356 wakaba 1.48 @@Name: getPropertyTextList
6357     @@enDesc:
6358     Returns a list of property value text.
6359     @@PropNameParam:
6360     @@MediaTypeDefaultParam:
6361     @@Return:
6362 wakaba 1.60 @@@Type: DISPerl|ARRAY||ManakaiDOM|all
6363 wakaba 1.48 @@@enDesc:
6364     A list of the property value strings.
6365     @@@RaiseException:
6366     @@@@@:UNSUPPORTED_MEDIA_TYPE_ERR
6367     @@@@enDesc:
6368     There is an attribute whose media
6369     type is not supported.
6370     @@@PerlDef:
6371     my $pr = $self-><AG::DISAnyResource.database>
6372     -><M::DISDatabase.getResource> ($propName);
6373     $r = [map {$_-><AG::dv|DVValue.stringValue>}
6374     map {@$_}
6375     grep {$_}
6376     map {$self->{$_}}
6377 wakaba 1.53 grep {$pr->{aliasURI}->{$_} or $pr->{supOf}->{$_}}
6378     (keys %{$pr->{aliasURI}}, keys %{$pr->{supOf}||{}})];
6379 wakaba 1.48
6380     @Method:
6381 wakaba 1.2 @@Name: getPropertyResource
6382     @@enDesc:
6383     Gets property value resource.
6384     @@PropNameParam:
6385 wakaba 1.10 @@NamedParam:
6386     @@@Name: defaultMediaType
6387     @@@Type: ResourceURI
6388     @@@enDesc:
6389     The URI reference of the default media type which is used
6390     when the property value is retrieved from the source tree
6391     and the source tree element does not have its <Q::dis:ContentType>
6392     attribute specified.
6393     @@@nullCase:
6394     @@@@enDesc:
6395     Defaulted to <Q::dis:TypeQName>.
6396 wakaba 1.2 @@Return:
6397 wakaba 1.61 @@@Type: DIS|DISAnyResource
6398 wakaba 1.2 @@@enDesc:
6399     The property value resource.
6400     @@@nullCase:
6401     @@@@enDesc:
6402     No value has specified.
6403 wakaba 1.8 @@@UndeclaredPrefixException:
6404 wakaba 1.12 @@@RaiseException:
6405     @@@@@:UNSUPPORTED_MEDIA_TYPE_ERR
6406     @@@@enDesc:
6407     The media type of the attribute node in the source tree
6408     corresponding to this resource is not supported.
6409 wakaba 1.2 @@@PerlDef:
6410 wakaba 1.48 __DEEP{
6411     my $v = $self-><M::DISResourceProp.getPropertyValue>
6412     ($propName);
6413     if (UNIVERSAL::isa ($v, <IFName::dv|DVURIValue>)) {
6414 wakaba 1.62 $r = $v-><M::dv|DVURIValue.getResource>
6415 wakaba 1.48 ($self-><AG::DISAnyResource.database>);
6416     }
6417     }__;
6418 wakaba 1.2
6419     @Method:
6420 wakaba 1.10 @@Name: getPropertyResourceList
6421     @@enDesc:
6422     Gets property value resource list.
6423     @@PropNameParam:
6424     @@NamedParam:
6425 wakaba 1.24 @@@Name: recursive
6426     @@@Type:
6427     DOMMain:boolean::ManakaiDOM:all
6428     @@@enDesc:
6429     Whether property resource values of this resource
6430     should also be included to the returned list or not.
6431     @@NamedParam:
6432 wakaba 1.10 @@@Name: recursiveISA
6433     @@@Type:
6434 wakaba 1.18 DOMMain:boolean::ManakaiDOM:all
6435 wakaba 1.10 @@@enDesc:
6436 wakaba 1.26 Whether the <Q::dis:ISA> ancestors of the resources
6437     that are property values should also be included in the returned list
6438     or not.
6439     @@@TrueCase:
6440     @@@@enDesc:
6441     If a property value is a resource <VAR::R> and
6442     the resource <VAR::R> <Q::dis:ISA>'s (or inherits) <VAR::S>, then
6443     the resource <VAR::S> is also a value in the list.
6444     @@@FalseCase:
6445     @@@@enDesc:
6446     Only the resources directly specified as property values is returned.
6447     @@NamedParam:
6448     @@@Name: isaRecursive
6449     @@@Type:
6450     DOMMain:boolean::ManakaiDOM:all
6451     @@@enDesc:
6452     Whether property resource values of <Q::dis:ISA> resources
6453     of this resource should also be included to the returned list or not.
6454     @@@TrueCase:
6455     @@@@enDesc:
6456     If this resource <Q::dis:ISA>'s (or inherits) another resource
6457     <VAR::S> and the <VAR::S> resource has a <P::propName>
6458     property value of <VAR::R>, then the resource <VAR::R>
6459     is also a value in the list.
6460     @@@FalseCase:
6461     @@@@enDesc:
6462     Only the resource directly specified is the returned.
6463 wakaba 1.10 @@NamedParam:
6464     @@@Name: defaultMediaType
6465     @@@Type: ResourceURI
6466     @@@enDesc:
6467     The URI reference of the default media type which is used
6468     when the property value is retrieved from the source tree
6469     and the source tree element does not have its <Q::dis:ContentType>
6470     attribute specified.
6471     @@@nullCase:
6472     @@@@enDesc:
6473     Defaulted to <Q::dis:TypeQName>.
6474     @@Return:
6475     @@@Type: ResourceList
6476     @@@enDesc:
6477     An array reference of the property value resources.
6478     \
6479     {NOTE:: This list is <QUOTE::dead>.
6480     \
6481     }
6482     @@@UndeclaredPrefixException:
6483 wakaba 1.12 @@@RaiseException:
6484     @@@@@:UNSUPPORTED_MEDIA_TYPE_ERR
6485     @@@@enDesc:
6486     The media type of the attribute node in the source tree
6487     corresponding to this resource is not supported.
6488 wakaba 1.10 @@@PerlDef:
6489     $r = [];
6490 wakaba 1.48 __DEEP{
6491     my $v = $self-><M::DISResourceProp.getPropertyValueList> ($propName);
6492     my $db = $self-><AG::DISAnyResource.database>;
6493     for my $a (@$v) {
6494     if ($a->isa (<IFName::dv|DVURIValue>)) {
6495 wakaba 1.62 push @$r, $a-><M::dv|DVURIValue.getResource> ($db);
6496 wakaba 1.48 }
6497     if ($isaRecursive) {
6498     my $b = $a-><M::dv|DVValue.getProperty>
6499     (<Q::DISCore:stopISARecursive>);
6500     if ($b and $b-><AG::dv|DVValue.value>) {
6501     $isaRecursive = false;
6502 wakaba 1.32 }
6503 wakaba 1.10 }
6504 wakaba 1.48 }
6505     }__;
6506    
6507 wakaba 1.24 if ($recursive) {
6508     __DEEP{
6509     $opt{___recursive_isa_done} ||= {$self->{uri} => true};
6510     my @p_res = @$r;
6511     for my $p_res (@p_res) {
6512     next if $opt{___recursive_isa_done}->{$p_res->{uri}};
6513     $opt{___recursive_isa_done}->{$p_res->{uri}} = true;
6514 wakaba 1.48 push @$r, @{$p_res-><M::DISResourceProp.getPropertyResourceList>
6515 wakaba 1.24 ($propName, recursive => true,
6516     recursive_isa => $recursiveISA,
6517     ___recursive_isa_done => $opt{___recursive_isa_done},
6518     default_media_type => $defaultMediaType)};
6519     }
6520     }__;
6521     }
6522 wakaba 1.10 if ($recursiveISA) {
6523     __DEEP{
6524     $opt{___recursive_isa_done} ||= {$self->{uri} => true};
6525     my @p_res = @$r;
6526     for my $p_res (@p_res) {
6527     next if $opt{___recursive_isa_done}->{$p_res->{uri}};
6528     $opt{___recursive_isa_done}->{$p_res->{uri}} = true;
6529 wakaba 1.48 push @$r, @{$p_res-><M::DISResourceProp.getPropertyResourceList>
6530 wakaba 1.33 (<Q::dis:ISA>,
6531     recursive => true,
6532 wakaba 1.10 ___recursive_isa_done => $opt{___recursive_isa_done},
6533     default_media_type => $defaultMediaType)};
6534     }
6535     }__;
6536     }
6537 wakaba 1.26 if ($isaRecursive) {
6538 wakaba 1.25 __DEEP{
6539     $opt{___recursive_isa_done} ||= {$self->{uri} => true};
6540 wakaba 1.37 $opt{___isa_recursive_done} ||= {$self->{uri} => true};
6541 wakaba 1.48 my @p_res = @{$self-><M::DISResourceProp.getPropertyResourceList>
6542 wakaba 1.26 (<Q::dis:ISA>, recursive_isa => false,
6543 wakaba 1.37 recursive => false,
6544 wakaba 1.26 default_media_type => <Q::dis:TFQNames>)};
6545 wakaba 1.25 for my $p_res (@p_res) {
6546 wakaba 1.37 next if $opt{___isa_recursive_done}->{$p_res->{uri}};
6547     $opt{___isa_recursive_done}->{$p_res->{uri}} = true;
6548 wakaba 1.48 push @$r, @{$p_res-><M::DISResourceProp.getPropertyResourceList>
6549 wakaba 1.26 ($propName, recursive_isa => false,
6550     recursive => false,
6551 wakaba 1.37 isa_recursive => true,
6552     ___isa_recursive_done =>
6553     $opt{___isa_recursive_done},
6554 wakaba 1.26 default_media_type => $defaultMediaType)};
6555 wakaba 1.25 }
6556     }__;
6557     }
6558 wakaba 1.60
6559     @Method:
6560 wakaba 1.2 @@Name: addPropertyResourceList
6561     @@enDesc:
6562     Adds a resource to a resource-list property value.
6563     \
6564     {ISSUE:: Should an exception be thrown if the property is
6565     not of list?
6566     \
6567     }
6568 wakaba 1.10 \
6569     {NOTE:: If the property is not <QUOTE::get>ten ever, adding
6570     an item clears the list --- i.e. the property values
6571     in the source tree will be ignored. Call
6572     <M::ManakaiDISPropertyAccessor.getPropertyResourceList>
6573     before adding to avoid this behavior.
6574     \
6575     }
6576 wakaba 1.2 @@PropNameParam:
6577     @@Param:
6578     @@@Name: res
6579 wakaba 1.47 @@@Type: DISResource
6580     @@@clsActualType: ManakaiDISResourceDefinition
6581 wakaba 1.2 @@@enDesc:
6582     A resource to add.
6583     @@Return:
6584     @@@PerlDef:
6585 wakaba 1.48 if ($self->{$propName}) {
6586     my $uriv;
6587     __CODE{dv|createURI::
6588     $uri => {$res-><AG::DISAnyResource.uri>},
6589     $result => $uriv,
6590 wakaba 1.60 $name => $propName,
6591 wakaba 1.48 }__;
6592     $self->{$propName}-><M::dv|DVList.addItem> ($uriv);
6593     } else {
6594     __CODE{dv|createOrderedList::
6595     $result => {$self->{$propName}},
6596     $type => {<Q::DISCore:URI>},
6597     $base_type => {<Q::DISCore:URI>},
6598     }__;
6599     my $uriv;
6600     __CODE{dv|createURI::
6601     $uri => {$res-><AG::DISAnyResource.uri>},
6602     $result => $uriv,
6603 wakaba 1.60 $name => $propName,
6604 wakaba 1.48 }__;
6605     $self->{$propName}-><M::dv|DVList.addItem> ($uriv);
6606     }
6607    
6608     @Method:
6609     @@Name: addPropertyResourceUList
6610 wakaba 1.52 @@plMName: add_property_resource_ulist
6611 wakaba 1.48 @@enDesc:
6612     Adds a resource to a resource-list property value.
6613     \
6614     {ISSUE:: Should an exception be thrown if the property is
6615     not of list?
6616     \
6617     }
6618     \
6619     {NOTE:: If the property is not <QUOTE::get>ten ever, adding
6620     an item clears the list --- i.e. the property values
6621     in the source tree will be ignored. Call
6622     <M::ManakaiDISPropertyAccessor.getPropertyResourceList>
6623     before adding to avoid this behavior.
6624     \
6625     }
6626     @@PropNameParam:
6627     @@Param:
6628     @@@Name: res
6629     @@@Type: DISResource
6630     @@@clsActualType: ManakaiDISResourceDefinition
6631     @@@enDesc:
6632     A resource to add.
6633     @@Return:
6634     @@@PerlDef:
6635     if ($self->{$propName}) {
6636     my $uriv;
6637     __CODE{dv|createURI::
6638     $uri => {$res-><AG::DISAnyResource.uri>},
6639     $result => $uriv,
6640 wakaba 1.60 $name => $propName,
6641 wakaba 1.48 }__;
6642     $self->{$propName}-><M::dv|DVList.addItem> ($uriv);
6643 wakaba 1.25 } else {
6644 wakaba 1.48 __CODE{dv|createUnorderedList::
6645     $result => {$self->{$propName}},
6646     $type => {<Q::DISCore:URI>},
6647     $base_type => {<Q::DISCore:URI>},
6648     }__;
6649     my $uriv;
6650     __CODE{dv|createURI::
6651     $uri => {$res-><AG::DISAnyResource.uri>},
6652     $result => $uriv,
6653 wakaba 1.60 $name => $propName,
6654 wakaba 1.25 }__;
6655 wakaba 1.48 $self->{$propName}-><M::dv|DVList.addItem> ($uriv);
6656 wakaba 1.2 }
6657    
6658 wakaba 1.48 @Method:
6659     @@Name: addPropertyURIUList
6660 wakaba 1.52 @@plMName: add_peoperty_uri_ulist
6661 wakaba 1.48 @@enDesc:
6662     Adds a resource to a resource-list property value.
6663     \
6664     {ISSUE:: Should an exception be thrown if the property is
6665     not of list?
6666     \
6667     }
6668     \
6669     {NOTE:: If the property is not <QUOTE::get>ten ever, adding
6670     an item clears the list --- i.e. the property values
6671     in the source tree will be ignored. Call
6672     <M::ManakaiDISPropertyAccessor.getPropertyResourceList>
6673     before adding to avoid this behavior.
6674     \
6675     }
6676     @@PropNameParam:
6677     @@Param:
6678     @@@Name: uri
6679     @@@Type: AnyURI
6680     @@@enDesc:
6681     A resource to add.
6682     @@Return:
6683     @@@PerlDef:
6684     __DEEP{
6685     if ($self->{$propName}) {
6686     my $uriv;
6687     __CODE{dv|createURI::
6688     $uri => $uri,
6689     $result => $uriv,
6690 wakaba 1.60 $name => $propName,
6691 wakaba 1.48 }__;
6692     $self->{$propName}-><M::dv|DVList.addItem> ($uriv);
6693     } else {
6694     __CODE{dv|createUnorderedList::
6695     $result => {$self->{$propName}},
6696     $type => {<Q::DISCore|URI>},
6697     $base_type => {<Q::DISCore:URI>},
6698     }__;
6699     my $uriv;
6700     __CODE{dv|createURI::
6701     $uri => $uri,
6702     $result => $uriv,
6703 wakaba 1.60 $name => $propName,
6704 wakaba 1.48 }__;
6705     $self->{$propName}-><M::dv|DVList.addItem> ($uriv);
6706     }
6707     }__;
6708     ##DISResourceProp
6709    
6710 wakaba 1.3 ElementTypeBinding:
6711     @Name: PropNameParam
6712     @ElementType:
6713     dis:ResourceDef
6714     @ShadowContent:
6715     @@rdf:type:
6716     DISLang:MethodParameter
6717     @@Name: propName
6718     @@Type: ResourceURI
6719     @@Description:
6720     @@@lang:en
6721     @@@@:
6722     The name of the property.
6723    
6724 wakaba 1.2 PropDef:
6725     @QName:isAnon
6726     @Description:
6727     @@lang:en
6728     @@@:
6729     Whether the subject resource is anonymous or not.
6730     @Type:
6731 wakaba 1.18 DOMMain:boolean::ManakaiDOM:all
6732 wakaba 1.2
6733     PropDef:
6734     @QName:isDefined
6735     @Description:
6736     @@lang:en
6737     @@@:
6738     Whether the subject resource is defined or not.
6739    
6740     PropDef:
6741 wakaba 1.3 @QName:isReferred
6742 wakaba 1.2 @Description:
6743     @@lang:en
6744     @@@:
6745     Whether the subject resource is referred or not.
6746     @Type:
6747     DOMMain:any
6748    
6749     PropDef:
6750     @QName:definingModule
6751     @Description:
6752     @@lang:en
6753     @@@:
6754     The <QUOTE::dis> module in which the subject resource is defined.
6755 wakaba 1.22 \
6756     {NOTE:: The local name should have been <QUOTE::ownerModule> or some.
6757     \
6758     }
6759 wakaba 1.2 @rdfs:domain:
6760     DISCore:Module
6761 wakaba 1.1
6762     ## -- Datatypes
6763    
6764     URITypeDef:
6765 wakaba 1.3 @QName: AnyURI
6766     @Description:
6767     @@lang:en
6768     @@@:
6769     Any URI references.
6770    
6771     URITypeDef:
6772     @QName: FileURI
6773     @enDesc:
6774     URI references identifying file.
6775    
6776     URITypeDef:
6777 wakaba 1.1 @QName: ForURI
6778     @Description:
6779     @@lang:en
6780     @@@:
6781     <QUOTE::For> URI references.
6782    
6783     DataTypeDef:
6784     @QName: ForURIList
6785     @Description:
6786     @@lang:en
6787     @@@:
6788     References to the array containing <QUOTE::for> URI references.
6789    
6790     URITypeDef:
6791 wakaba 1.3 @QName: ResourceURI
6792     @Description:
6793     @@lang:en
6794     @@@:
6795     A URI reference for a <QUOTE::dis> resource.
6796    
6797     URITypeDef:
6798 wakaba 1.1 @QName: MediaTypeURI
6799     @Description:
6800     @@lang:en
6801     @@@:
6802     Media type URI references.
6803 wakaba 1.3 @rdfs:subClassOf: ResourceURI
6804    
6805     URITypeDef:
6806     @QName: ModuleURI
6807     @enDesc:
6808 wakaba 1.47 URI references for <QUOTE::dis> modules.
6809 wakaba 1.3 @rdfs:subClassOf: ResourceURI
6810    
6811     URITypeDef:
6812     @QName: NameURI
6813     @enDesc:
6814     URI references identifying a resource.
6815     @rdfs:subClassOf: ResourceURI
6816 wakaba 1.10
6817     DataTypeDef:
6818     @QName: ResourceList
6819     @enDesc:
6820     References to array containing resource definition objects.
6821     @rdfs:subClassOf:
6822 wakaba 1.60 DISPerl:ARRAY::ManakaiDOM:all
6823 wakaba 1.3
6824     ElementTypeBinding:
6825     @Name: DataTypeDef
6826     @ElementType:
6827     dis:ResourceDef
6828     @ShadowContent:
6829     @@rdf:type:
6830     ManakaiDOM:DataType
6831    
6832     ElementTypeBinding:
6833     @Name: URITypeDef
6834     @ElementType:
6835     dis:ResourceDef
6836     @ShadowContent:
6837     @@rdf:type:
6838     ManakaiDOM:DataType
6839     @@rdfs:subClassOf: AnyURI
6840 wakaba 1.1
6841     ## -- Exceptions
6842    
6843     XParamDef:
6844 wakaba 1.5 @QName: anotherSourceNode
6845     @enDesc:
6846     Another source node in which an error has occurred. In cases
6847     of <QUOTE::already defined> errors, it is the node that
6848     defines the resource first.
6849     @Type: ManakaiDISNode
6850 wakaba 1.3
6851 wakaba 1.12 ResourceDef:
6852     @QName: UNDECLARED_NS_PREFIX_ERR
6853 wakaba 1.49 @For: ForEmpty
6854 wakaba 1.12 @AliasFor:
6855     DIS:UNDECLARED_NS_PREFIX_ERR::swcfg21:ForLatest
6856    
6857 wakaba 1.47 ResourceDef:
6858     @rdf:type:
6859     @@@: dis|MultipleResource
6860     @@ForCheck: !ManakaiDOM|ForIF !ManakaiDOM|ForClass
6861     @resourceFor: ManakaiDOM|ForIF
6862     @resourceFor:
6863     @@@: ManakaiDOM|ForClass
6864     @@ForCheck: ForEmpty !=ForEmpty
6865     @For: ForLatest
6866     @For: =ForEmpty
6867    
6868     @rdf:type:
6869     @@@: ManakaiDOM|ExceptionIF
6870     @@ForCheck: ManakaiDOM|ForIF
6871    
6872     @rdf:type:
6873     @@@: ManakaiDOM|ExceptionClass
6874     @@ForCheck: ManakaiDOM|ForClass
6875    
6876     @Implement:
6877     @@@: ||ForEmpty||ManakaiDOM|ForIF
6878     @@ContentType: DISCore|TFPQNames
6879     @@ForCheck: ManakaiDOM|ForClass ForEmpty
6880     @Implement:
6881     @@@: ||ForLatest||ManakaiDOM|ForIF
6882     @@ContentType: DISCore|TFPQNames
6883     @@ForCheck: ManakaiDOM|ForClass ForLatest
6884    
6885     @DOMMain:implementFeature:
6886     @@@: CoreFeature10
6887     @@For: ForLatest
6888    
6889     @Implement:
6890     @@@: DOMMain|ManakaiDOMExceptionIF||ManakaiDOM|Perl
6891     @@ForCheck: ManakaiDOM|ForClass
6892    
6893     @ISA:
6894     @@@: ManakaiDOM|ManakaiDOMException||ManakaiDOM|Perl
6895     @@ForCheck: ManakaiDOM|ForClass
6896    
6897     @IFQName: DISException
6898 wakaba 1.3 @ClsQName: ManakaiDISException
6899 wakaba 1.47
6900     @Description:
6901     @@lang:en
6902     @@@:
6903     Exceptions for the <QUOTE::dis> operations.
6904    
6905     @ResourceDef:
6906     @@rdf:type: ManakaiDOM|ConstGroup
6907     @@ForCheck: !=ForEmpty
6908    
6909     @@IFQName: DISExceptionCode
6910 wakaba 1.3 @@ClsQName: ManakaiDISExceptionCode
6911 wakaba 1.52 @@plCName: DISExceptionCode
6912 wakaba 1.47
6913     @@rdfs:subClassOf:
6914     DOMMain:unsigned-short::ManakaiDOM:all
6915     @@Type:
6916     DOMMain:unsigned-short::ManakaiDOM:all
6917    
6918 wakaba 1.3 @@enDesc:
6919     Exception codes for <Class::ManakaiDISException>.
6920 wakaba 1.47
6921 wakaba 1.3 @@XConstDef:
6922 wakaba 1.11 @@@Name: HIERARCHY_REQUEST_ERR
6923 wakaba 1.49 @@@Value:
6924     @@@@@:3
6925     @@@@ContentType: DISCore|Integer
6926 wakaba 1.11 @@@enDesc:
6927     An attempt is made to break the hierarchy.
6928     @@@XSubTypeDef:
6929     @@@@QName: MERGE_ITSELF_ERR
6930     @@@@enDesc:
6931     An attempt is made to merge the resource to itself.
6932     @@@@XSourceNodeParam:
6933     @@@@XParam:
6934     @@@@@QName:uri
6935     @@@@@enDesc:
6936     The URI reference of the resource to merge.
6937     @@@@enMufDef:
6938     An attempt is made to merge the resource <%p (name => {<Q::DIS:uri>}
6939     );> to itself
6940     @@XConstDef:
6941 wakaba 1.8 @@@Name: NOT_SUPPORTED_ERR
6942 wakaba 1.49 @@@Value:
6943     @@@@@:9
6944     @@@@ContentType: DISCore|Integer
6945 wakaba 1.8 @@@enDesc:
6946     An attempt is made to do something the implementation does not support.
6947     @@@XSubTypeDef:
6948     @@@@QName: UNSUPPORTED_MEDIA_TYPE_ERR
6949     @@@@enDesc:
6950     The implementation does not support the media type.
6951     @@@@XParam:
6952     @@@@@QName: uri
6953     @@@@@enDesc:
6954     The URI reference of the media type that is not supported.
6955     @@@@XSourceNodeParam:
6956 wakaba 1.30 @@@@XParam:
6957     @@@@@QName:elementType
6958     @@@@@enDesc:
6959     The URI reference of the element type of the element
6960     in which the media type is referenced.
6961 wakaba 1.12 @@@@enMufDef:
6962 wakaba 1.30 %p (name => {<Q::DIS:sourceCode>}, prefix => {"}, suffix => {": }
6963     );%p (name => {<Q::DIS:elementType>}, prefix => { (Element type: <},
6964     suffix => {>) }
6965     );Media type <%p (name => {<Q::DIS:uri>});> is not supported
6966 wakaba 1.3 @@@XSubTypeDef:
6967 wakaba 1.13 @@@@QName: UNSUPPORTED_ELEMENT_TYPE_ERR
6968     @@@@enDesc:
6969     An unsupported type of element is encounted.
6970     @@@@XSourceNodeParam:
6971     @@@@XParam:
6972     @@@@@QName:elementType
6973     @@@@@enDesc:
6974     The element type URI reference of the element.
6975 wakaba 1.16 @@@@enMufDef:
6976     Element type "%p (name => {<Q::DIS:elementType>});" is not supported
6977 wakaba 1.13 @@@XSubTypeDef:
6978 wakaba 1.12 @@@@QName: NO_PERL_CODE_IMPL_ERR
6979 wakaba 1.3 @@@@enDesc:
6980 wakaba 1.12 There is no implementation that supports the
6981     <Feature::Util:PerlCode> feature, version
6982     <FeatureVer::1.0>.
6983 wakaba 1.3 @@XConstDef:
6984     @@@Name: INVALID_STATE_ERR
6985 wakaba 1.49 @@@Value:
6986     @@@@@:11
6987     @@@@ContentType: DISCore|Integer
6988 wakaba 1.3 @@@enDesc:
6989     An attempt is made to use an object that is not (or no longer) usable.
6990     @@@XSubTypeDef:
6991     @@@@QName: NO_ASSOCIATED_DB_ERR
6992     @@@@enDesc:
6993     No <QUOTE::dis> database has been associated with this document.
6994 wakaba 1.4 @@XConstDef:
6995     @@@Name: INVALID_SOURCE_ERR
6996 wakaba 1.49 @@@Value:
6997     @@@@@: 200
6998     @@@@ContentType: DISCore|Integer
6999 wakaba 1.4 @@@enDesc:
7000     The source input is well-formed but invalid.
7001     @@@XSubTypeDef:
7002     @@@@QName: NO_MODULE_QNAME_ERR
7003     @@@@enDesc:
7004     The <Q::dis:Module> element must have its <Q::dis:QName>
7005     attribute.
7006 wakaba 1.8 @@@@XSourceNodeParam:
7007     @@@XSubTypeDef:
7008     @@@@QName: NO_LOCAL_NAME_ERR
7009     @@@@enDesc:
7010     The resource does not have a local name.
7011     @@@@XSourceNodeParam:
7012 wakaba 1.4 @@@XSubTypeDef:
7013     @@@@QName: UNABLE_TO_GET_MODULE_ERR
7014     @@@@enDesc:
7015     The implementation is unable to get the module source.
7016     @@@@Def:
7017     @@@@@ContentType:
7018     lang:muf
7019     @@@@@lang:en
7020     @@@@@@:
7021     Unable to get the module source of <%p (name => {<Q::DIS:uri>});>
7022     @@@@XParam:
7023     @@@@@QName: uri
7024     @@@@@enDesc:
7025     The URI reference of the module.
7026     @@@@XParam:
7027     @@@@@QName: namespaceURI
7028     @@@@@enDesc:
7029     The namespace URI of the module name.
7030     @@@@XParam:
7031     @@@@@QName: localName
7032     @@@@@enDesc:
7033     The local name of the module name.
7034     @@@@XParam:
7035     @@@@@QName: for
7036     @@@@@enDesc:
7037     The <QUOTE::for> of the module.
7038 wakaba 1.5 @@@XSubTypeDef:
7039     @@@@QName: NO_FOR_QNAME_ERR
7040     @@@@enDesc:
7041     A <Q::dis:ForDef> element must have <Q::dis:QName> attribute.
7042     @@@@XSourceNodeParam:
7043     @@@XSubTypeDef:
7044     @@@@QName: FOR_ALREADY_DEFINED_ERR
7045     @@@@enDesc:
7046     The <QUOTE::for> named as the same URI reference has
7047     already defined.
7048     @@@@XSourceNodeParam:
7049     @@@@XParam:
7050     @@@@@QName: anotherSourceNode
7051     @@@@@enDesc:
7052     The node that defines the <QUOTE::for> URI reference before.
7053 wakaba 1.7 @@@@XParam:
7054     @@@@@Name: uri
7055     @@@@@enDesc:
7056     The URI reference of the <QUOTE::for> attempted to define.
7057     @@@@enMufDef:
7058     <QUOTE::For> <%p (name => {<Q::DIS:uri>});> is already defined
7059 wakaba 1.5 @@@XSubTypeDef:
7060     @@@@QName: RESOURCE_ALREADY_DEFINED_ERR
7061     @@@@enDesc:
7062     The <QUOTE::dis> resource named as the same URI reference has
7063     already defined.
7064     @@@@XSourceNodeParam:
7065     @@@@XParam:
7066 wakaba 1.54 @@@@@@: anotherSourceNode
7067 wakaba 1.5 @@@@@enDesc:
7068     The node that defines the <QUOTE::for> URI reference before.
7069 wakaba 1.7 @@@@XParam:
7070 wakaba 1.54 @@@@@@: uri
7071 wakaba 1.7 @@@@@enDesc:
7072     The URI reference of the resource attempted to define.
7073 wakaba 1.54 @@@@XParam:
7074     @@@@@@: moduleURI
7075     @@@@@enDesc:
7076     A URI of the module in which the <Q::DIS|uri> resource is
7077     defined.
7078 wakaba 1.7 @@@@enMufDef:
7079 wakaba 1.54 %p (name => {<Q::DIS:moduleURI>}, prefix => {Module <},
7080     suffix => {>: })
7081     ;Resource <%p (name => {<Q::DIS:uri>});> is already defined
7082 wakaba 1.5 @@@XSubTypeDef:
7083     @@@@QName: ELEMENT_NOT_ALLOWED_ERR
7084     @@@@enDesc:
7085     An element has occured where it is not allowed.
7086     @@@@enMufDef:
7087     Module <%p (name => {<Q::DIS:uri>});>:
7088     Element of type <%p (name => {<Q::DIS:elementType>});>
7089     is not allowed here
7090     @@@@XSourceNodeParam:
7091     @@@@XParam:
7092     @@@@@QName: elementType
7093     @@@@@enDesc:
7094     The expanded element type name of the element.
7095     @@@@XParam:
7096     @@@@@QName: uri
7097     @@@@@enDesc:
7098     The URI reference of the module.
7099 wakaba 1.7 @@@XSubTypeDef:
7100     @@@@QName: NO_REQUIRED_ATTR_ERR
7101     @@@@enDesc:
7102     A required attribute is not specified.
7103     @@@@XSourceNodeParam:
7104     @@@@XParam:
7105     @@@@@QName: elementType
7106     @@@@@enDesc:
7107     The expanded URI reference of the attribute name.
7108     @@@@enMufDef:
7109     Attribute <%p (name => {<Q::DIS:elementType>});> must be specified
7110 wakaba 1.8 @@@XSubTypeDef:
7111     @@@@QName: FOR_NOT_DEFINED_ERR
7112     @@@@enDesc:
7113     A <QUOTE::for> is referred but not defined.
7114     @@@@XSourceNodeParam:
7115     @@@@XParam:
7116     @@@@@QName: uri
7117     @@@@@enDesc:
7118     The URI reference of the <QUOTE::for> that is not defined.
7119     @@@@enMufDef:
7120     <QUOTE::For> <%p (name => {<Q::DIS:uri>});> is not defined
7121     @@@XSubTypeDef:
7122     @@@@QName: RESOURCE_NOT_DEFINED_ERR
7123     @@@@enDesc:
7124 wakaba 1.13 A <QUOTE::dis> resource is referred but not defined
7125     or the resource referred does not have the type expected.
7126 wakaba 1.8 @@@@XSourceNodeParam:
7127     @@@@XParam:
7128 wakaba 1.48 @@@@@@: sourceNodePath
7129     @@@@@enDesc:
7130     A node path string of the source node.
7131     @@@@XParam:
7132 wakaba 1.8 @@@@@QName: uri
7133     @@@@@enDesc:
7134     The URI reference of the resource that is not defined.
7135 wakaba 1.13 @@@@XParam:
7136     @@@@@QName: elementType
7137     @@@@@enDesc:
7138     <QUOTE::dis> element type (either tree element type
7139     or preprocessing element type) of the element
7140     in which a reference to the undefined resource is contained.
7141     @@@@XParam:
7142 wakaba 1.30 @@@@@QName:parentURI
7143     @@@@@enDesc:
7144     The URI reference of the resource from whose child resources
7145     a resource is tried to find.
7146     @@@@XParam:
7147 wakaba 1.54 @@@@@QName: moduleURI
7148     @@@@@enDesc:
7149     The URI of the module in which the resourece should be included.
7150     @@@@XParam:
7151 wakaba 1.13 @@@@@QName: localName
7152     @@@@@enDesc:
7153     The local name of the undefined resource.
7154     @@@@XParam:
7155     @@@@QName: sourceCode
7156     @@@@enDesc:
7157     Source code fragment that referres this resource.
7158     @@@@XParam:
7159     @@@@@QName:expectedType
7160     @@@@@enDesc:
7161     Expected resource type.
7162 wakaba 1.8 @@@@enMufDef:
7163 wakaba 1.54 %p (name => {<Q::DIS:moduleURI>}, prefix => {Module <},
7164     suffix => {>: })
7165     ;%p (name => {<Q::DIS:sourceNodePath>}, suffix => {: })
7166     ;%p (name => {<Q::DIS:sourceCode>}, prefix => {"}, suffix => {": })
7167     ;%p (name => {<Q::DIS:parentURI>}, prefix => {(In <}, suffix => {>) })
7168     ;Resource%p (name => {<Q::DIS:uri>}, prefix => { <},
7169 wakaba 1.13 suffix => {>});%p (name => {<Q::DIS:localName>},
7170     prefix => { "}, suffix => {"}); is not defined or wrong type%p
7171     (name => {<Q::DIS:expectedType>}, prefix => { (<},
7172     suffix => {> is expected)});
7173     @@@XSubTypeDef:
7174     @@@@QName: NO_SOURCE_NODE_ERR
7175     @@@@enDesc:
7176     A resource does not have associated node in the source tree.
7177     @@@@XSourceNodeParam:
7178     @@@@XParam:
7179     @@@@@QName:uri
7180     @@@@@enDesc:
7181     The URI reference of the resource.
7182 wakaba 1.8 @@@XSubTypeDef:
7183     @@@@QName: RESERVED_PERL_METHOD_NAME_ERR
7184     @@@@enDesc:
7185     A reserved Perl method name is used.
7186     @@@@XParam:
7187     @@@@@QName:uri
7188     @@@@@enDesc:
7189     The URI reference of the method resource.
7190     @@@@XSourceNodeParam:
7191     @@@@XParam:
7192     @@@@@QName: generatedName
7193     @@@@@enDesc:
7194     A reserved method name.
7195     @@@XSubTypeDef:
7196     @@@@QName: NO_DIS_TYPE_ERR
7197     @@@@enDesc:
7198     <Q::dis:Type> attribute is not found.
7199     @@@@XSourceNodeParam:
7200 wakaba 1.48 @@@@enMufDef:
7201     Resource "%t (name => {<Q::DIS:uri>});" has no "dis:Type" attribute
7202 wakaba 1.12 @@@XSubTypeDef:
7203     @@@@QName: NO_METHOD_RETURN_ERR
7204     @@@@enDesc:
7205     A <Q::DISLang:Method> resource does not have any
7206     <Q::DISLang:MethodReturn> child.
7207     @@@@XSourceNodeParam:
7208 wakaba 1.22 @@@@XParam:
7209     @@@@@QName:errResource
7210     @@@@@enDesc: The method resource.
7211     @@@@XParam:
7212     @@@@@QName:uri
7213     @@@@@enDesc:
7214     The URI reference of the method.
7215     @@@@XParam:
7216     @@@@@QName:localName
7217     @@@@@enDesc:
7218     The local name of the resource.
7219     @@@@enMufDef:
7220     Method "%p (name => {<Q::DIS:localName>});" does not have
7221     "Return" child
7222 wakaba 1.12 @@@XSubTypeDef:
7223     @@@@QName: NO_ATTR_GET_ERR
7224     @@@@enDesc:
7225     A <Q::DISLang:Attribute> resource does not have any
7226     <Q::DISLang:AttributeGet> child.
7227     @@@@XSourceNodeParam:
7228 wakaba 1.13 @@@XSubTypeDef:
7229     @@@@QName:INTERFACE_CLASS_METHOD_ERR
7230     @@@@enDesc:
7231     An attempt is made to call a static (class) method
7232     from an interface.
7233     @@@@XSourceNodeParam:
7234     @@@@XParam:
7235     @@@@@QName:uri
7236     @@@@@enDesc:
7237     The URI reference of the interface.
7238     @@@@XParam:
7239     @@@@@QName:sourceCode
7240     @@@@@enDesc:
7241     Source code fragment that calls a class method.
7242     @@@@XParam:
7243     @@@@@QName:elementType
7244     @@@@@enDesc:
7245     The element type URI reference of the element
7246     that calls a method.
7247     @@@XSubTypeDef:
7248     @@@@QName: BROKEN_PARAM_SPEC_ERR
7249     @@@@enDesc:
7250     A parameter specification is broken.
7251     @@@@XParam:
7252     @@@@@QName: sourceCode
7253     @@@@@enDesc:
7254     Source code fragment that contains the broken parameter
7255     specification.
7256     @@@@XSourceNodeParam:
7257 wakaba 1.15 @@@@enMufDef:
7258     %p (name => {<Q::DIS:sourceCode>}, prefix => {"},
7259     suffix => {": });Broken parameter specification
7260 wakaba 1.13 @@@XSubTypeDef:
7261     @@@@QName:PERL_PREPROCESS_NO_ELEMENT_TYPE_ERR
7262     @@@@enDesc:
7263     A preprocessing instruction does not have its element
7264     type.
7265     @@@@XSourceNodeParam:
7266     @@@@XParam:
7267     @@@@@QName:sourceCode
7268     @@@@@enDesc:
7269     Source code fragment.
7270 wakaba 1.16 @@@@enMufDef:
7271     %p (name => {<Q::DIS:sourceCode>}, prefix => {"},
7272     suffix => {": });Element type name is not specified
7273 wakaba 1.13 @@@XSubTypeDef:
7274 wakaba 1.15 @@@@QName: NO_PERL_PACKAGE_NAME_ERR
7275 wakaba 1.13 @@@@enDesc:
7276 wakaba 1.15 No Perl package name is defined for the resource referred.
7277 wakaba 1.13 @@@@XSourceNodeParam:
7278     @@@@XParam:
7279 wakaba 1.15 @@@@@QName:sourceCode
7280 wakaba 1.13 @@@@@enDesc:
7281     Source code fragment.
7282     @@@@XParam:
7283 wakaba 1.15 @@@@@QName:uri
7284     @@@@@enDesc:
7285     THe URI reference of the resource referred.
7286     @@@@XParam:
7287     @@@@@QName:elementType
7288     @@@@@enDesc:
7289     The element type of Perl preprocessing instruction
7290     in which the resource is referred.
7291     @@@@enMufDef:
7292     %p (name => {<Q::DIS:uri>}, prefix => {<}, suffix => {>: });Perl
7293     package name is not defined
7294     @@@XSubTypeDef:
7295     @@@@QName: PERL_PREPROCESS_NO_EXCEPTION_TYPE_ERR
7296     @@@@enDesc:
7297     An exception type specification is required.
7298     @@@@XSourceNodeParam:
7299     @@@@XSourceCodeParam:
7300     @@@@XParam:
7301     @@@@@QName:elementType
7302     @@@@@enDesc:
7303     The element type of the preprocessing instruction.
7304     @@@XSubTypeDef:
7305     @@@@QName: PERL_PREPROCESS_NO_CODE_NAME_ERR
7306     @@@@enDesc:
7307     A code name specification is required.
7308     @@@@XSourceNodeParam:
7309     @@@@XSourceCodeParam:
7310     @@@@XParam:
7311 wakaba 1.13 @@@@@QName:elementType
7312     @@@@@enDesc:
7313 wakaba 1.15 The element type of the preprocessing instruction.
7314 wakaba 1.13 @@@XSubTypeDef:
7315     @@@@QName: PERL_CODE_NOT_DEFINED_ERR
7316     @@@@enDesc:
7317 wakaba 1.15 The specified resource does not have its Perl definition.
7318 wakaba 1.13 @@@@XSourceNodeParam:
7319 wakaba 1.15 @@@@XSourceCodeParam:
7320 wakaba 1.13 @@@@XParam:
7321 wakaba 1.15 @@@@@QName:elementType
7322     @@@@@enDesc:
7323     The element type of the preprocessing instruction.
7324     @@@@XParam:
7325     @@@@@QName:uri
7326 wakaba 1.13 @@@@@enDesc:
7327 wakaba 1.15 The URI reference of the resource referred.
7328 wakaba 1.13 @@@@XParam:
7329     @@@@@QName:localName
7330     @@@@@enDesc:
7331     The local name of the resource referred.
7332 wakaba 1.51 @@@@enMufDef:
7333     Resource%p (name => {<Q::DIS:uri>}, prefix => { "}, suffix => {"});
7334     has no Perl code definition
7335 wakaba 1.15 @@@XSubTypeDef:
7336     @@@@QName: PERL_PREPROCESS_NO_METHOD_ERR
7337     @@@@enDesc:
7338     A preprocessing instruction which is only allowed in
7339     method definitions is used in a code which is not a method.
7340     @@@@XSourceNodeParam:
7341     @@@@XSourceCodeParam:
7342 wakaba 1.13 @@@@XParam:
7343 wakaba 1.15 @@@@@QName:elementType
7344 wakaba 1.13 @@@@@enDesc:
7345 wakaba 1.15 The element type of the preprocessing instruction.
7346 wakaba 1.14 @@@XSubTypeDef:
7347 wakaba 1.15 @@@@QName: PERL_PREPROCESS_NO_FOR_ERR
7348 wakaba 1.14 @@@@enDesc:
7349 wakaba 1.15 A <QUOTE::for> specification is required.
7350 wakaba 1.14 @@@@XSourceNodeParam:
7351 wakaba 1.15 @@@@XSourceCodeParam:
7352 wakaba 1.14 @@@@XParam:
7353 wakaba 1.15 @@@@@QName:elementType
7354 wakaba 1.14 @@@@@enDesc:
7355 wakaba 1.15 The element type of the preprocessing instruction.
7356     @@@XSubTypeDef:
7357     @@@@QName: PERL_PREPROCESS_NO_ASSERT_TYPE_ERR
7358     @@@@enDesc:
7359     An assertion type specification is required.
7360     @@@@XSourceNodeParam:
7361     @@@@XSourceCodeParam:
7362 wakaba 1.14 @@@@XParam:
7363 wakaba 1.15 @@@@@QName:elementType
7364 wakaba 1.14 @@@@@enDesc:
7365 wakaba 1.15 The element type of the preprocessing instruction.
7366     @@@XSubTypeDef:
7367     @@@@QName: PERL_PREPROCESS_BLOCK_NOT_ALLOWED_ERR
7368     @@@@enDesc:
7369     A preprocessing instruction block occurred with
7370     element type which does not allow it.
7371     @@@@XSourceNodeParam:
7372     @@@@XSourceCodeParam:
7373 wakaba 1.14 @@@@XParam:
7374     @@@@@QName:elementType
7375     @@@@@enDesc:
7376 wakaba 1.15 The element type of the preprocessing instruction.
7377 wakaba 1.18 @@@XSubTypeDef:
7378     @@@@QName: NON_NAMED_PARAMETER_AFTER_NAMED_ERR
7379     @@@@enDesc:
7380     A non-named method parameter following
7381     any named method parameter is occurred.
7382     @@@@XSourceNodeParam:
7383     @@@@XParam:
7384     @@@@@QName:uri
7385     @@@@@enDesc:
7386     The URI reference of the non-named method parameter resource.
7387     @@@@XParam:
7388     @@@@@QName:localName
7389     @@@@@enDesc:
7390     The local name of the non-named method parameter.
7391 wakaba 1.19 @@@XSubTypeDef:
7392     @@@@QName:DISPERL_NO_VALUE_ALLOWED_ERR
7393     @@@@enDesc:
7394     An element node have a value but the definition
7395     of that element type does not allow it.
7396     @@@@XSourceNodeParam:
7397     @@@@XParam:
7398     @@@@@QName:elementType
7399     @@@@@enDesc:
7400     The element type URI reference of the element.
7401     @@@XSubTypeDef:
7402     @@@@QName:NO_CONST_VALUE_ERR
7403     @@@@enDesc:
7404     The source element node for a constant value resource
7405     does not have <Q::dis:Value> attribute.
7406     @@@@XSourceNodeParam:
7407     @@@@XParam:
7408     @@@@@QName:elemntType
7409     @@@@@enDesc:
7410     The element type URI reference of the element from which
7411     a constant value resource is referred.
7412     @@@@XParam:
7413     @@@@@QName:uri
7414     @@@@@enDesc:
7415     The resource URI reference of the constant value resource.
7416     @@@@XParam:
7417     @@@@@QName:localName
7418     @@@@@enDesc:
7419     The local name of the constant value resource.
7420     @@@XSubTypeDef:
7421     @@@@QName:NO_ATTR_SET_ERR
7422     @@@@enDesc:
7423     An attribute setter is referred but the attribute
7424     does not define any setter.
7425     @@@@XSourceNodeParam:
7426     @@@@XParam:
7427     @@@@@QName:errResource
7428     @@@@@enDesc:
7429     The attribute resource.
7430     @@@@XParam:
7431     @@@@@QName:elementType
7432     @@@@@enDesc:
7433     The type of the element by which this attribute
7434     is referred.
7435 wakaba 1.20 @@@XSubTypeDef:
7436     @@@@QName: PERL_SUBROUTINE_ALREADY_DEFINED_ERR
7437     @@@@enDesc:
7438     A resource defines a Perl subroutine whose name is
7439     same as another subroutine.
7440     @@@@XSourceNodeParam:
7441     @@@@XParam:
7442     @@@@@QName:uri
7443     @@@@@enDesc:
7444     The URI reference of the resource that defines the Perl subroutine.
7445     @@@@XParam:
7446     @@@@@QName:
7447     PerlCode:localName
7448     @@@@@enDesc:
7449     The name of the Perl subroutine.
7450     @@@XSubTypeDef:
7451     @@@@QName: PERL_OPERATOR_ALREADY_OVERLOADED_ERR
7452     @@@@enDesc:
7453     A resource is defined to overload a Perl operator which
7454     is already overloaded by another resource.
7455     @@@@XSourceNodeParam:
7456     @@@@XParam:
7457     @@@@@QName:uri
7458     @@@@@enDesc:
7459     The URI reference of the resource that defines the overloading.
7460     @@@@XParam:
7461     @@@@@QName:
7462     PerlCode:operator
7463     @@@@@enDesc:
7464     The operator.
7465     @@@XSubTypeDef:
7466     @@@@QName: PERL_UNUSED_SUBROUTINE_ERR
7467     @@@@enDesc:
7468     A resource defines a Perl subroutine but it is not used.
7469     @@@@XSourceNodeParam:
7470     @@@@XParam:
7471     @@@@@QName:uri
7472     @@@@@enDesc:
7473     The URI reference of the resource.
7474 wakaba 1.22 @@@XSubTypeDef:
7475     @@@@QName: NO_LICENSE_ATTR_ERR
7476     @@@@enDesc:
7477     The <Q::dis:Module> element does not have the
7478     <Q::dis:License> attribute.
7479     @@@@XSourceNodeParam:
7480     @@@@XParam:
7481     @@@@@QName:uri
7482     @@@@@enDesc:
7483     The URI reference of the module.
7484 wakaba 1.25 @@@XSubTypeDef:
7485     @@@@QName: UNSUPPORTED_ROLE_ERR
7486     @@@@enDesc:
7487     A <Q::dis:Role> is not supported.
7488     @@@@XSourceNodeParam:
7489     @@@@XParam:
7490     @@@@@QName:uri
7491     @@@@@enDesc:
7492     The URI reference of the unsupported role.
7493     @@@@enMufDef:
7494     Role <%p (name => {<Q::DIS:uri>});> is not supported
7495 wakaba 1.37 @@@XSubTypeDef:
7496     @@@@QName: NO_REFLECT_GET_DEFINED_ERR
7497     @@@@enDesc:
7498     An attribute is defined to reflect an element attribute
7499     but no reflecting attribute getter template is defined.
7500     @@@@XSourceNodeParam:
7501     @@@@XParam:
7502     @@@@@QName:uri
7503     @@@@@enDesc:
7504     The URI reference of the datatype resource for which
7505     a getter template should have been defined.
7506     @@@XSubTypeDef:
7507     @@@@QName: NO_REFLECT_SET_DEFINED_ERR
7508     @@@@enDesc:
7509     An attribute is defined to reflect an element attribute
7510     but no reflecting attribute setter template is defined.
7511     @@@@XSourceNodeParam:
7512     @@@@XParam:
7513     @@@@@QName:uri
7514     @@@@@enDesc:
7515     The URI reference of the datatype resource for which
7516     a setter template should have been defined.
7517 wakaba 1.40 @@@XSubTypeDef:
7518 wakaba 1.43 @@@@QName: NO_END_TAG_ERR
7519     @@@@enDesc:
7520 wakaba 1.40 Close tag not found.
7521 wakaba 1.43 @@@@XSourceNodeParam:
7522     @@@@XParam:
7523 wakaba 1.49 @@@@@@: elementType
7524     @@@@@enDesc:
7525 wakaba 1.40 The type URI reference of the element that is not closed.
7526 wakaba 1.43 @@@@XParam:
7527 wakaba 1.49 @@@@@@: sourceCode
7528     @@@@@enDesc:
7529 wakaba 1.40 The source code fragment near the position where
7530     an end tag is required.
7531 wakaba 1.43 @@@@enMufDef:
7532 wakaba 1.40 End tag for element "%p (name => {<Q::DIS:elementType>});"
7533 wakaba 1.43 is required%p (name => {<Q::DIS:sourceCode>},
7534     prefix => { (}, suffix => {)});
7535 wakaba 1.49 @@@XSubTypeDef:
7536     @@@@QName: NO_RDF_TYPE_ERR
7537     @@@@enDesc:
7538     There is a resource definition element that does
7539     not have any <Q::rdf:type> attribute.
7540     @@@@XSourceNodeParam:
7541     @@@@XParam:
7542     @@@@@@: uri
7543     @@@@@enDesc:
7544     The URI of the resource which does not have <Q::rdf:type>.
7545     @@@@enMufDef:
7546     Resource%p (name => {<Q::DIS:uri>}, prefix => { "},
7547     suffix => {"}); does not have "rdf:type" attribute
7548 wakaba 1.53 @@@XSubTypeDef:
7549     @@@@QName: PERL_HASH_KEY_ALREADY_DEFINED_ERR
7550     @@@@enDesc:
7551     A hash key is already defined.
7552     @@@@XSourceNodeParam:
7553     @@@@XParam:
7554     @@@@@@:uri
7555     @@@@@enDesc:
7556     The URI of the resource tried to register.
7557     @@@@XParam:
7558     @@@@@@:anotherURI
7559     @@@@@enDesc:
7560     The URI of the already registered resource.
7561     @@@@XParam:
7562     @@@@@@:hashKeyName
7563     @@@@@enDesc:
7564     Hash key.
7565     @@@@XParam:
7566     @@@@@@:hashKeyScope
7567     @@@@@enDesc:
7568     Hash key scope.
7569     @@@@enMufDef:
7570     <%p (name => {<Q::DIS:uri>});>:
7571 wakaba 1.56 Hash key "%p (name => {<Q::DIS:hashKeyName>});" in
7572 wakaba 1.53 <%p (mame => {<Q::DIS:hashKeyScope>});> is already
7573 wakaba 1.54 defined for <%p (name => {<Q::DIS:anotherURI>});>
7574 wakaba 1.37 @ImplNote:
7575     @@lang:en
7576     @@@:
7577     ISSUE: Too many subtypes for a type! New type should be added?
7578 wakaba 1.4 ##DISException
7579 wakaba 1.53
7580     XParamDef:
7581     @QName: hashKeyName
7582     @Type: DISLang|String
7583     @enDesc:
7584     See <M::dp|DISDatabasePerl.plAddHashKey>.
7585    
7586     XParamDef:
7587     @QName: hashKeyScope
7588     @Type: AnyURI
7589     @enDesc:
7590     See <M::dp|DISDatabasePerl.plAddHashKey>.
7591    
7592     XParamDef:
7593     @QName: anotherURI
7594     @Type: ResourceURI
7595     @enDesc:
7596     A URI of another related resource.
7597 wakaba 1.13
7598     XParamDef:
7599     @QName:expectedType
7600     @Type: ResourceURI
7601     @enDesc:
7602     Expected resource type URI reference.
7603    
7604     XParamDef:
7605     @QName: sourceCode
7606     @Type:
7607     DISLang:String::ManakaiDOM:all
7608     @enDesc:
7609     The source code fragment in which an error occurred.
7610 wakaba 1.5
7611     XParamDef:
7612     @QName: elementType
7613     @Type: ResourceURI
7614     @enDesc:
7615     The name of the element type.
7616    
7617     XParamDef:
7618     @QName: uri
7619     @Type: ResourceURI
7620     @enDesc:
7621     The name of the resource, composed from <Q::namespaceURI>,
7622     <Q::localName> and <Q::for>.
7623    
7624     XParamDef:
7625     @QName: localName
7626     @Type:
7627 wakaba 1.18 DISCore:LocalName::ManakaiDOM:all
7628 wakaba 1.5 @enDesc:
7629     The local name of the resource, unique in <Q::namespaceURI> namespace.
7630    
7631     XParamDef:
7632     @QName: namespaceURI
7633     @Type: AnyURI
7634     @enDesc:
7635     The namespace URI reference of the resource name.
7636    
7637     XParamDef:
7638     @QName: for
7639     @Type: ForURI
7640     @enDesc:
7641     The <QUOTE::for> URI reference of the resource.
7642    
7643     ElementTypeBinding:
7644     @Name: XSourceNodeParam
7645     @ElementType:
7646     ManakaiDOM:exceptionOrWarningParameter
7647     @ShadowContent:
7648     @@QName: sourceNode
7649     @@Description:
7650     @@@lang:en
7651     @@@@:
7652     The node in which an error has occurred.
7653 wakaba 1.15
7654     ElementTypeBinding:
7655     @Name: XSourceCodeParam
7656     @ElementType:
7657     ManakaiDOM:exceptionOrWarningParameter
7658     @ShadowContent:
7659     @@QName: sourceCode
7660     @@Description:
7661     @@@lang:en
7662     @@@@:
7663     The source code in which an error has occurred.
7664 wakaba 1.4
7665 wakaba 1.52 ResourceDef:
7666     @QName: ManakaiDISExceptionTarget
7667     @AliasFor: dx|ManakaiDefaultExceptionHandler||ManakaiDOM|Perl
7668     @For: DIS|ForEmpty
7669 wakaba 1.4
7670 wakaba 1.52 ElementTypeBinding:
7671     @Name: plMName
7672     @ElementType:
7673     DISPerl:methodName
7674     @ShadowContent:
7675     @@ContentType: lang|Perl
7676     @@For: ManakaiDOM|Perl
7677 wakaba 1.4
7678     ElementTypeBinding:
7679 wakaba 1.52 @Name: plCName
7680 wakaba 1.4 @ElementType:
7681 wakaba 1.52 DISPerl:exportTagName
7682 wakaba 1.4 @ShadowContent:
7683 wakaba 1.47 @@ContentType: lang|Perl
7684     @@For: ManakaiDOM|Perl
7685 wakaba 1.3
7686     ElementTypeBinding:
7687     @Name: Method
7688     @ElementType:
7689     dis:ResourceDef
7690     @ShadowContent:
7691     @@rdf:type:
7692     DISLang:Method
7693 wakaba 1.52 @@For: !=ForEmpty
7694 wakaba 1.3
7695     ElementTypeBinding:
7696     @Name: IntMethod
7697     @ElementType:
7698     dis:ResourceDef
7699     @ShadowContent:
7700     @@rdf:type:
7701     DISLang:Method
7702     @@ManakaiDOM:isForInternal:1
7703 wakaba 1.52 @@ForCheck: ManakaiDOM|ForClass
7704 wakaba 1.3
7705     ElementTypeBinding:
7706     @Name: Attr
7707     @ElementType:
7708     dis:ResourceDef
7709     @ShadowContent:
7710     @@rdf:type:
7711     DISLang:Attribute
7712 wakaba 1.52 @@For: !=ForEmpty
7713 wakaba 1.3
7714     ElementTypeBinding:
7715     @Name: Return
7716     @ElementType:
7717     dis:ResourceDef
7718     @ShadowContent:
7719     @@rdf:type:
7720     DISLang:MethodReturn
7721    
7722     ElementTypeBinding:
7723     @Name: Get
7724     @ElementType:
7725     dis:ResourceDef
7726     @ShadowContent:
7727     @@rdf:type:
7728     DISLang:AttributeGet
7729    
7730     ElementTypeBinding:
7731     @Name: Set
7732     @ElementType:
7733     dis:ResourceDef
7734     @ShadowContent:
7735     @@rdf:type:
7736     DISLang:AttributeSet
7737    
7738     ElementTypeBinding:
7739     @Name: Param
7740     @ElementType:
7741     dis:ResourceDef
7742     @ShadowContent:
7743     @@rdf:type:
7744     DISLang:MethodParameter
7745    
7746     ElementTypeBinding:
7747     @Name: PerlDef
7748     @ElementType:
7749     dis:Def
7750     @ShadowContent:
7751     @@ContentType:
7752     lang:Perl
7753    
7754     ElementTypeBinding:
7755     @Name: InCase
7756     @ElementType:
7757     dis:ResourceDef
7758     @ShadowContent:
7759     @@rdf:type:
7760     ManakaiDOM:InCase
7761    
7762     ElementTypeBinding:
7763     @Name: nullCase
7764     @ElementType:
7765     dis:ResourceDef
7766     @ShadowContent:
7767     @@rdf:type:
7768     ManakaiDOM:InCase
7769     @@Value:
7770     @@@is-null:1
7771 wakaba 1.49 @@@ContentType: DISCore|String
7772 wakaba 1.3
7773     ElementTypeBinding:
7774     @Name: TrueCase
7775     @ElementType:
7776     dis:ResourceDef
7777     @ShadowContent:
7778     @@rdf:type:
7779     ManakaiDOM:InCase
7780 wakaba 1.49 @@Value:
7781     @@@@: 1
7782     @@@ContentType: DISCore|Boolean
7783 wakaba 1.3 @@Type:
7784 wakaba 1.18 DOMMain:boolean::ManakaiDOM:all
7785 wakaba 1.3
7786     ElementTypeBinding:
7787     @Name: FalseCase
7788     @ElementType:
7789     dis:ResourceDef
7790     @ShadowContent:
7791     @@rdf:type:
7792     ManakaiDOM:InCase
7793 wakaba 1.49 @@Value:
7794     @@@@: 0
7795     @@@ContentType: DISCore|Boolean
7796 wakaba 1.3 @@Type:
7797 wakaba 1.18 DOMMain:boolean::ManakaiDOM:all
7798 wakaba 1.3
7799     ElementTypeBinding:
7800     @Name: enDesc
7801     @ElementType:
7802     dis:Description
7803     @ShadowContent:
7804     @@lang:en
7805    
7806     ElementTypeBinding:
7807     @Name: PropDef
7808     @ElementType:
7809     dis:ResourceDef
7810     @ShadowContent:
7811     @@rdf:type:
7812     rdf:Property
7813 wakaba 1.49 @@For:
7814 wakaba 1.54 =ManakaiDOM|all
7815 wakaba 1.3
7816     ElementTypeBinding:
7817     @Name: MethodRedef
7818     @ElementType:
7819     dis:ResourceDef
7820     @ShadowContent:
7821     @@rdf:type:
7822     DISLang:Method
7823    
7824     ElementTypeBinding:
7825     @Name: NamedParam
7826     @ElementType:
7827     dis:ResourceDef
7828     @ShadowContent:
7829     @@rdf:type:
7830     DISLang:MethodParameter
7831     @@DISPerl:isNamedParameter:1
7832    
7833     ElementTypeBinding:
7834     @Name: NodeParam
7835     @ElementType:
7836     dis:ResourceDef
7837     @ShadowContent:
7838     @@rdf:type:
7839     DISLang:MethodParameter
7840     @@DISPerl:isNamedParameter:1
7841     @@Name: node
7842 wakaba 1.47 @@Type: DISNode
7843     @@actualType:
7844     @@@@: ManakaiDISNode
7845     @@@ForCheck: ManakaiDOM|ForClass
7846 wakaba 1.3 @@Description:
7847     @@@lang:en
7848     @@@@:
7849     The node in which the name has occurred. It is intended
7850     to be reported when an exception had been raised.
7851     @@ResourceDef:
7852     @@@rdf:type:
7853     ManakaiDOM:InCase
7854     @@@Value:
7855     @@@@is-null:1
7856 wakaba 1.49 @@@@ContentType: DISCore|String
7857 wakaba 1.3 @@@Description:
7858     @@@@lang:en
7859     @@@@@:
7860     The source of the name is not a node.
7861    
7862     ElementTypeBinding:
7863     @Name: ForParam
7864     @ElementType:
7865     dis:ResourceDef
7866     @ShadowContent:
7867     @@rdf:type:
7868     DISLang:MethodParameter
7869     @@DISPerl:isNamedParameter:1
7870     @@Name: forArg
7871     @@Type: ForURI
7872     @@Description:
7873     @@@lang:en
7874     @@@@:
7875     The <QUOTE::for> URI reference.
7876     @@ResourceDef:
7877     @@@rdf:type:
7878     ManakaiDOM:InCase
7879     @@@Value:
7880     @@@@is-null:1
7881 wakaba 1.49 @@@@ContentType: DISCore|String
7882 wakaba 1.3 @@@Description:
7883     @@@@lang:en
7884     @@@@@:
7885     Equivalent to <Q::ManakaiDOM:all>, i.e. <QUOTE::for all>.
7886    
7887     ElementTypeBinding:
7888     @Name: ForpParam
7889     @ElementType:
7890     dis:ResourceDef
7891     @ShadowContent:
7892     @@rdf:type:
7893     DISLang:MethodParameter
7894     @@DISPerl:isNamedParameter:1
7895     @@Name: forpArg
7896     @@Type: ForURIList
7897     @@Description:
7898     @@@lang:en
7899     @@@@:
7900     An array reference containing additional <QUOTE::for>
7901     constraints (<QUOTE::For+> list).
7902     @@ResourceDef:
7903     @@@rdf:type:
7904     ManakaiDOM:InCase
7905     @@@Value:
7906     @@@@is-null:1
7907 wakaba 1.49 @@@@ContentType: DISCore|String
7908 wakaba 1.3 @@@Description:
7909     @@@@lang:en
7910     @@@@@:
7911     Equivalent to the empty array reference.
7912    
7913     ElementTypeBinding:
7914     @Name: MediaTypeParam
7915     @ElementType:
7916     dis:ResourceDef
7917     @ShadowContent:
7918     @@rdf:type:
7919     DISLang:MethodParameter
7920     @@DISPerl:isNamedParameter:1
7921     @@Name: mediaType
7922     @@Type: MediaTypeURI
7923     @@Description:
7924     @@@lang:en
7925     @@@@:
7926     The URI reference identifying a media type.
7927     @@ResourceDef:
7928     @@@rdf:type:
7929     ManakaiDOM:InCase
7930     @@@Value:
7931     @@@@is-null:1
7932 wakaba 1.49 @@@@ContentType: DISCore|String
7933 wakaba 1.3 @@@Description:
7934     @@@@lang:en
7935     @@@@@:
7936     No media type specified.
7937    
7938     ElementTypeBinding:
7939     @Name: MediaTypeDefaultParam
7940     @ElementType:
7941     dis:ResourceDef
7942     @ShadowContent:
7943     @@rdf:type:
7944     DISLang:MethodParameter
7945     @@DISPerl:isNamedParameter:1
7946     @@Name: defaultMediaType
7947     @@Type: MediaTypeURI
7948     @@Description:
7949     @@@lang:en
7950     @@@@:
7951     The default media type, i.e. the type used when no explicit
7952     specification is not found in the source tree.
7953     @@ResourceDef:
7954     @@@rdf:type:
7955     ManakaiDOM:InCase
7956     @@@Value:
7957     @@@@is-null:1
7958 wakaba 1.49 @@@@ContentType: DISCore|String
7959 wakaba 1.3 @@@Description:
7960     @@@@lang:en
7961     @@@@@:
7962     Defaulted to <Q::DOMMain:any>.
7963    
7964     ElementTypeBinding:
7965     @Name: RaiseException
7966     @ElementType:
7967     ManakaiDOM:raises
7968    
7969     ElementTypeBinding:
7970     @Name: UndeclaredPrefixException
7971     @ElementType:
7972     ManakaiDOM:raises
7973     @ShadowContent:
7974     @@@: UNDECLARED_NS_PREFIX_ERR
7975     @@Description:
7976     @@@lang:en
7977     @@@@:
7978     The implementation has encounted an undeclared namespace prefix.
7979    
7980     ElementTypeBinding:
7981     @Name: NoDBException
7982     @ElementType:
7983     ManakaiDOM:raises
7984     @ShadowContent:
7985 wakaba 1.47 @@@: NO_ASSOCIATED_DB_ERR
7986 wakaba 1.3 @@Description:
7987     @@@lang:en
7988     @@@@:
7989     No <QUOTE::dis> database is associated to this document.
7990    
7991     ElementTypeBinding:
7992     @Name: XConstDef
7993     @ElementType:
7994     dis:ResourceDef
7995     @ShadowContent:
7996     @@rdf:type:
7997     ManakaiDOM:Const
7998    
7999     ElementTypeBinding:
8000     @Name: XSubTypeDef
8001     @ElementType:
8002     dis:ResourceDef
8003     @ShadowContent:
8004     @@rdf:type:
8005     ManakaiDOM:ExceptionOrWarningSubType
8006 wakaba 1.47 @@ForCheck: ManakaiDOM|ForClass
8007 wakaba 1.3
8008     ElementTypeBinding:
8009     @Name: XParam
8010     @ElementType:
8011     ManakaiDOM:exceptionOrWarningParameter
8012    
8013     ElementTypeBinding:
8014     @Name: XParamDef
8015     @ElementType:
8016     dis:ResourceDef
8017     @ShadowContent:
8018     @@rdf:type:
8019     DOMMain:XWParameter
8020 wakaba 1.12 @@For:
8021     =ManakaiDOM:all
8022 wakaba 1.54
8023     XParamDef:
8024     @QName: DIS|moduleURI
8025     @enDesc:
8026     A URI of the module in which the resource is defined.
8027 wakaba 1.3
8028     ElementTypeBinding:
8029     @Name: enMufDef
8030     @ElementType:
8031     dis:Def
8032     @ShadowContent:
8033     @@ContentType:
8034     lang:muf
8035     @@lang:en
8036 wakaba 1.21
8037 wakaba 1.3

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24