/[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.58 - (hide annotations) (download)
Wed Sep 28 09:49:10 2005 UTC (19 years, 9 months ago) by wakaba
Branch: MAIN
Changes since 1.57: +10 -14 lines
++ manakai/lib/Message/Util/ChangeLog	28 Sep 2005 09:48:33 -0000
2005-09-28  Wakaba  <wakaba@suika.fam.cx>

	* DIS.dis: Use "tag:" URI for internal URIs.

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

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24