/[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.64 - (hide annotations) (download)
Sat Oct 8 15:05:45 2005 UTC (19 years, 9 months ago) by wakaba
Branch: MAIN
Changes since 1.63: +22 -6 lines
++ manakai/lib/Message/Markup/ChangeLog	8 Oct 2005 14:01:45 -0000
	* SuikaWikiConfig21.dis (MUErrorHandler): Removed.
	(ManakaiSWCFGNode): Extends ManakaiDefaultErrorHandler.

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

++ manakai/lib/Message/Util/ChangeLog	8 Oct 2005 15:01:39 -0000
	* DIS.dis (readProperties): Recognizes hexdecimal
	in "DISCore:Integer" (prefixed by "0x").

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

++ manakai/lib/Message/Util/Error/ChangeLog	8 Oct 2005 14:04:28 -0000
	* DOMException.dis: Old long alias names removed.

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

++ manakai/lib/Message/Util/DIS/ChangeLog	8 Oct 2005 15:03:27 -0000
	* Perl.dis (plCodeFragment): Ignores method name if it is a URI.

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

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

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24