/[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.68 - (hide annotations) (download)
Sun Nov 13 04:45:05 2005 UTC (19 years, 8 months ago) by wakaba
Branch: MAIN
Changes since 1.67: +18 -25 lines
++ manakai/lib/Message/Util/Error/ChangeLog	13 Nov 2005 04:42:35 -0000
2005-11-13  Wakaba  <wakaba@suika.fam.cx>

	* Core.dis (ecore:message, ecore:defaultMessage): New
	properties.
	(lang:muf): Definition moved from |DOMException.dis|.

++ manakai/lib/Message/Util/DIS/ChangeLog	13 Nov 2005 04:41:51 -0000
2005-11-13  Wakaba  <wakaba@suika.fam.cx>

	* Perl.dis (plMufDescriptionText): Source property name
	is changed from |dis:Def| to |ecore:defaultMessage|.

++ manakai/lib/Message/DOM/ChangeLog	13 Nov 2005 04:44:51 -0000
2005-10-26  Wakaba  <wakaba@suika.fam.cx>

	* SimpleLS.dis (writeToString): Don't stop serializing
	when an |false| value appears in |@src|.

++ manakai/lib/manakai/ChangeLog	13 Nov 2005 04:44:42 -0000
2005-11-13  Wakaba  <wakaba@suika.fam.cx>

	* DISCore.dis (DISCore:DISString): New type.

	* DISLang.dis (dis:is-null): Definition moved
	from |DISCore.dis|.
	(DISLang:Undefined, DISLang:Null, DISLang:Boolean,
	DISLang:True, DISLang:False): New resources.

	* DISSource.dis (DISSource:domainProperty): New property.

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

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24