/[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.100 - (hide annotations) (download)
Sun May 28 10:33:24 2006 UTC (19 years, 1 month ago) by wakaba
Branch: MAIN
CVS Tags: manakai-release-0-3-2
Changes since 1.99: +23 -6 lines
++ manakai/lib/Message/Util/ChangeLog	28 May 2006 10:31:30 -0000
2006-05-28  Wakaba  <wakaba@suika.fam.cx>

	* DIS.dis (Require): An explicit reference to the |MDOM:DOMCore|
	module is added.
	(readProperties): The support for the |DISCore:NSString| type
	is added.

++ manakai/lib/Message/Util/DIS/ChangeLog	28 May 2006 10:32:11 -0000
2006-05-28  Wakaba  <wakaba@suika.fam.cx>

	* Value.dis (createDVValue, createDVValueRef, createDVUnorderedList):
	The support for the |DISCore:NSString| type is added.

++ manakai/lib/manakai/ChangeLog	28 May 2006 10:33:18 -0000
	* DISMarkup.dis (lang:dcmodel): New type.

2006-05-28  Wakaba  <wakaba@suika.fam.cx>

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

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24