/[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.99 - (hide annotations) (download)
Tue Apr 4 14:30:29 2006 UTC (19 years, 3 months ago) by wakaba
Branch: MAIN
CVS Tags: manakai-release-0-3-1
Changes since 1.98: +118 -2 lines
++ manakai/bin/ChangeLog	4 Apr 2006 14:28:32 -0000
2006-04-04  Wakaba  <wakaba@suika.fam.cx>

	* daf.pl (--dafs-suffix): New option.
	(daf_resolve_db_module_file): The |dp:ModuleNodeStorageFile|
	type support.

++ manakai/lib/Message/Util/ChangeLog	4 Apr 2006 14:29:09 -0000
	* DIS.dis (Require): Requires the |MDOM:TreeStore| module.
	(getNodeFromStorage, setNodeToStorage): New methods.

2006-04-04  Wakaba  <wakaba@suika.fam.cx>

++ manakai/lib/Message/Util/DIS/ChangeLog	4 Apr 2006 14:30:17 -0000
2006-04-04  Wakaba  <wakaba@suika.fam.cx>

	* Perl.dis (plStore): The |mainDatabase| parameter is removed.
	(plStoreNodeStorage): New method.
	(plLoadNodeStorage): New method.

1 wakaba 1.1 Module:
2 wakaba 1.51 @QName: Util|DIS
3 wakaba 1.1 @FullName:
4     @@lang: en
5     @@@:
6     <QUOTE::DIS> Object Model
7     @Namespace:
8     http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/DIS#
9    
10     @Description:
11     @@lang:en
12     @@@:
13 wakaba 1.14 This module provides an object model for <QUOTE::dis> document format.
14 wakaba 1.1
15 wakaba 1.53 @DISCore:author: DISCore|Wakaba
16 wakaba 1.1 @License:
17     @@@:
18     license:Perl+MPL
19     @@Original:
20     @@@FullName:
21 wakaba 1.19 manakai <CODE::lib/manakai/dis.pl> and <CODE::bin/cdis2pm.pl>
22 wakaba 1.1 @@@Year:2004
23 wakaba 1.53 @@@DISCore:author: DISCore|Wakaba
24 wakaba 1.1 @Date:
25     @@@:
26 wakaba 1.99 $Date: 2006/04/03 16:13:15 $
27 wakaba 1.1 @@ContentType:
28     dis:Date.RCS
29    
30     @Require:
31     @@Module:
32 wakaba 1.51 @@@QName: Markup|SuikaWikiConfig21
33     @@@WithFor: swcfg21|ForLatest
34 wakaba 1.3 @@Module:
35 wakaba 1.51 @@@QName: Util|DIS
36     @@@WithFor: DIS|ForLatest
37 wakaba 1.12 @@Module:
38 wakaba 1.51 @@@QName: Util|DIS
39     @@@WithFor: DIS|ForEmpty
40 wakaba 1.47 @@Module:
41     @@@QName: MDOM|DOMFeature
42     @@@WithFor: ManakaiDOM|all
43 wakaba 1.48 @@Module:
44     @@@QName: DIS|Perl
45     @@@WithFor: DIS|ForLatest
46     @@Module:
47     @@@QName: DIS|Value
48     @@@WithFor: DIS|ForLatest
49 wakaba 1.99 @@Module:
50     @@@QName: MDOM|TreeStore
51     @@@WithFor: DIS|ForLatest
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     } elsif ($el-><M::DISElement.mediaTypeMatch>
4993 wakaba 1.49 (<Q::lang:dis>, $mtopt{default_media_type},
4994     %mtopt)) {
4995     $copy_tree = true;
4996 wakaba 1.48 $el-><M::DISElement.preserveNodePath>;
4997     my $elc = $el->clone;
4998     __CODE{dv|createValue::
4999     $value => {$elc},
5000 wakaba 1.49 $base_type => {$base_type = <Q::lang:dis>},
5001 wakaba 1.50 $type => $new_value_type,
5002 wakaba 1.48 $result => $new_value,
5003 wakaba 1.60 $name => $prop_uri,
5004 wakaba 1.48 }__;
5005 wakaba 1.49 $elc-><M::DISElement.unlinkFromDocument> ($db);
5006 wakaba 1.64 } elsif ($el-><M::DISElement.mediaTypeMatch>
5007     (<Q::DISCore:Integer>,
5008     $mtopt{default_media_type}, %mtopt)) {
5009     my $v = $el-><M::SWCFGNode.value>;
5010     if ($v =~ /^0x/) {
5011     $v = hex $v;
5012     } else {
5013     $v += 0;
5014     }
5015     __CODE{dv|createValue::
5016     $value => $v,
5017 wakaba 1.78 $base_type => {$base_type = <Q::DISCore:Integer>},
5018     $type => $new_value_type,
5019     $result => $new_value,
5020     $name => $prop_uri,
5021     }__;
5022     } elsif ($el-><M::DISElement.mediaTypeMatch>
5023     (<Q::DISCore:UString>,
5024     $mtopt{default_media_type}, %mtopt)) {
5025     my $v = $el-><M::SWCFGNode.value>;
5026     $v =~ s/\$\x0D?\x0A//gs;
5027     $v =~ s/\$\z//;
5028     warn 'String |'.$el-><M::SWCFGNode.value>.'| contains '.
5029     'illegal |$| character' if $v =~ /\$(?![uU])/;
5030     ## TODO: Use error-handler
5031     $v =~ s{\$(u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})}{
5032     chr hex substr $1, 1
5033     }ge;
5034     __CODE{dv|createValue::
5035     $value => $v,
5036 wakaba 1.64 $base_type => {$base_type = <Q::DISCore:String>},
5037 wakaba 1.78 $type => {<Q::DISCore:String>},
5038 wakaba 1.64 $result => $new_value,
5039     $name => $prop_uri,
5040     }__;
5041 wakaba 1.78 ## NOTE: Since |type| is set to |DISCore:String|,
5042     ## what subtype of |DISCore:UString| it was originally
5043     ## is not preserved.
5044 wakaba 1.48 } else {
5045     __CODE{dv|createValue::
5046     $value => {$el-><M::SWCFGNode.value>},
5047     $base_type => {$base_type = <Q::DISCore:String>},
5048 wakaba 1.50 $type => $new_value_type,
5049 wakaba 1.48 $result => $new_value,
5050 wakaba 1.60 $name => $prop_uri,
5051 wakaba 1.48 }__;
5052     }
5053    
5054     unless ($copy_tree) {
5055     for my $ce (@{$el-><M::DISElement.disChildElements>
5056 wakaba 1.49 (for_arg => $for,
5057     forp_arg => $forp,
5058     database_arg => $db)}) {
5059 wakaba 1.48 my $xu = $ce-><AG::SWCFGElement.expandedURI>;
5060     if ({
5061     <Q::dis:AliasFor> => true,
5062     <Q::dis:For> => true,
5063     <Q::dis:ForCheck> => true,
5064     <Q::dis:ContentType> => true,
5065     <Q::dis:resourceFor> => true,
5066     }->{$xu}) {
5067     #
5068 wakaba 1.49 } elsif ($ce-><M::DISElement.isPropertyElement>
5069     (database_arg => $db)) {
5070 wakaba 1.48 my $pr;
5071     __DEEP{
5072     $pr = $add_prop->($self, $ce, $db);
5073     }__;
5074     if ($pr->{prop_mult} eq <Q::DISCore|OrderedList>) {
5075     my $cpv = $new_value-><M::dv|DVValue.getProperty> ($xu);
5076     if (not $cpv) {
5077     __CODE{dv|createOrderedList::
5078     $result => {$cpv},
5079     $type => {$mtopt{default_media_type}},
5080     $base_type => {<Q::DISCore:String>},
5081     }__;
5082     $new_value-><M::dv|DVValue.setProperty> ($xu => $cpv);
5083     }
5084     $cpv-><M::dv|DVList.addItem> ($pr->{new_value});
5085     } elsif ($pr->{prop_mult} eq <Q::DISCore|UnorderedList>) {
5086     my $cpv = $new_value-><M::dv|DVValue.getProperty> ($xu);
5087     if (not $cpv) {
5088     __CODE{dv|createUnorderedList::
5089     $result => {$cpv},
5090     $type => {$mtopt{default_media_type}},
5091     $base_type => {<Q::DISCore:String>},
5092     }__;
5093     $new_value-><M::dv|DVValue.setProperty> ($xu => $cpv);
5094     }
5095     $cpv-><M::dv|DVList.addItem> ($pr->{new_value});
5096     } else {
5097     $new_value-><M::dv|DVValue.setProperty>
5098     ($xu => $pr->{new_value});
5099     }
5100     } else {
5101     __UNDEEP{__EXCEPTION{UNSUPPORTED_ELEMENT_TYPE_ERR::
5102     DIS:elementType => {$xu},
5103     DIS:sourceNode => {$ce},
5104     }__}__;
5105     }
5106     }} # copy_tree
5107    
5108     {new_value => $new_value, base_type => $base_type,
5109 wakaba 1.50 prop_uri => $prop_uri, prop_mult => $prop_mult,
5110     new_value_type => $new_value_type};
5111 wakaba 1.48 };
5112    
5113     my $pr;
5114     __DEEP{
5115 wakaba 1.49 $pr = $add_prop->($self, $el, $db);
5116 wakaba 1.48 }__;
5117     if ($pr->{prop_mult} eq <Q::DISCore|OrderedList>) {
5118     if (not $self->{$pr->{prop_uri}}) {
5119     __CODE{dv|createOrderedList::
5120     $result => {$self->{$pr->{prop_uri}}},
5121 wakaba 1.50 $type => {$pr->{new_value_type}},
5122 wakaba 1.48 $base_type => {$pr->{base_type} || <Q::DISCore:String>},
5123     }__;
5124     }
5125     $self->{$pr->{prop_uri}}-><M::dv|DVList.addItem>
5126     ($pr->{new_value});
5127     } elsif ($pr->{prop_mult} eq <Q::DISCore|UnorderedList>) {
5128     if (not $self->{$pr->{prop_uri}}) {
5129     __CODE{dv|createUnorderedList::
5130     $result => {$self->{$pr->{prop_uri}}},
5131 wakaba 1.50 $type => {$pr->{new_value_type}},
5132 wakaba 1.48 $base_type => {$pr->{base_type} || <Q::DISCore:String>},
5133     }__;
5134     }
5135     $self->{$pr->{prop_uri}}-><M::dv|DVList.addItem>
5136     ($pr->{new_value});
5137     } else {
5138     $self->{$pr->{prop_uri}} = $pr->{new_value};
5139     }
5140 wakaba 1.53
5141     if ($el-><M::DISElement.elementTypeMatch>
5142     (<Q::DISPerl:propHashKey>, database_arg => $db)) {
5143     $db-><M::dp|DISDatabasePerl.plAddHashKey>
5144     ($xu => $pr->{new_value}-><AG::dv|DVValue.stringValue>
5145     => $self);
5146     }
5147 wakaba 1.48 } elsif ($el-><AG::DISElement.isResourceElement>) {
5148     ## TODO: Should rdf:type be validated?
5149     } else {
5150     __UNDEEP{__EXCEPTION{UNSUPPORTED_ELEMENT_TYPE_ERR::
5151     DIS:elementType => {$xu},
5152     DIS:sourceNode => {$el},
5153     }__}__;
5154     }
5155 wakaba 1.6 }
5156 wakaba 1.48 CORE::delete $self->{src};
5157     ($onResourceRead or sub () {})->($self, $self);
5158 wakaba 1.6 }
5159     }__;
5160 wakaba 1.61
5161     @Method:
5162     @@Name: isTypeURI
5163     @@enDesc:
5164     Tests whether this resource is of a type or not.
5165     @@Param:
5166     @@@Name: typeURI
5167     @@@Type: ResourceURI
5168     @@@enDesc:
5169     A type URI reference to test.
5170     @@Return:
5171     @@@Type:
5172     DOMMain:boolean::ManakaiDOM:all
5173     @@@TrueCase:
5174     @@@@enDesc:
5175     This is a <P::typeURI> resource.
5176     @@@FalseCase:
5177     @@@@enDesc:
5178     This is not a <P::typeURI> resource.
5179 wakaba 1.79 @@@PerlDef:
5180     __DEEP{
5181     $r = $self-><AG::DISAnyResource.typeResource>
5182     -><M::DISResource.isSubsetOfURI> ($typeURI);
5183     }__;
5184    
5185     @Attr:
5186     @@Name: revision
5187     @@enDesc:
5188     The revision number of the resource.
5189    
5190     {ISSUE::
5191     Is it necessary for revision numbers to hold some
5192     kind of globality?
5193     }
5194     @@Type: RevisionNumber
5195     @@Get:
5196     @@@PerlDef:
5197     $r = $self->{<H::DIS|revision>};
5198    
5199     @CODE:
5200     @@QName: setRevision
5201     @@enDesc:
5202     Sets new revision number to a resource.
5203     @@PerlDef:
5204     $resource->{<H::DIS|revision>} = time;
5205    
5206     @CODE:
5207     @@QName: updateRevision
5208     @@enDesc:
5209     Updates revision number of a resource.
5210    
5211     {ISSUE::
5212     How revision number should be increased?
5213     }
5214     @@PerlDef:
5215     $resource->{<H::DIS|revision>}++;
5216    
5217     @Method:
5218     @@Name: getTypeURIList
5219     @@enDesc:
5220     Returns a snapshot list of resource type URIs of the resource.
5221     @@Return:
5222     @@@Type: URIList
5223     @@@enDesc:
5224     A snapshot list of URIs.
5225     @@@PerlDef:
5226     __DEEP{
5227     $r = $self-><AG::DISAnyResource.typeResource>
5228     -><M::DISAnyResource.getSuperResourceURIList>;
5229     }__;
5230    
5231     @@Test:
5232     @@@QName: DISAnyResource.getTypeURIList.test
5233     @@@PerlDef:
5234     my $db;
5235     __CODE{createDISDBForTest:: $db => $db}__;
5236    
5237     $test->id ('module');
5238     my $mod1 = $db-><M::DISDatabase.getModule> ('about:module1');
5239     my %lm1 = map {$_ => true} @{$mod1-><M::DISAnyResource.getTypeURIList>};
5240    
5241     $test->assert_true ($lm1{<Q::DISCore|Module>});
5242     $test->assert_true ($lm1{<Q::DISCore|AnyResource>});
5243    
5244     $test->id ('for');
5245     my $for1 = $db-><M::DISDatabase.getFor> ('about:for1');
5246     my %lf1 = map {$_ => true} @{$for1-><M::DISAnyResource.getTypeURIList>};
5247    
5248     $test->assert_true ($lf1{<Q::DISCore|For>});
5249     $test->assert_true ($lf1{<Q::DISCore|AnyResource>});
5250    
5251     @@Test:
5252     @@@QName: DISAnyResource.resource.getTypeURIList.test
5253     @@@PerlDef:
5254     my $db;
5255     __CODE{createDISDBForTest:: $db => $db}__;
5256    
5257     $test->id ('resource');
5258     my $res1 = $db-><M::DISDatabase.getResource> ('about:resource1');
5259     my %lr1 = map {$_ => true} @{$res1-><M::DISAnyResource.getTypeURIList>};
5260    
5261     $test->assert_true ($lr1{<Q::DISCore|Resource>});
5262     $test->assert_true ($lr1{<Q::DISCore|AnyResource>});
5263    
5264     @Method:
5265     @@ForCheck: ManakaiDOM|ForIF
5266     @@Name: getSuperResourceURIList
5267     @@enDesc:
5268     Returns a snapshot list of super-resources URIs of the resource,
5269     including canonical and alias URIs of the resource itself.
5270     @@Return:
5271     @@@Type: URIList
5272     @@@enDesc:
5273     A snapshot list of URIs.
5274    
5275     @Attr:
5276     @@Name: typeResource
5277     @@enDesc:
5278     The most specific type of the resource.
5279     @@Type: DISResource
5280     @@Get:
5281     @@@PerlDef:
5282     __DEEP{
5283     $r = $self-><AG::DISAnyResource.database>
5284     -><M::DISDatabase.getResource> ($self->{<H::DIS|typeURI>});
5285     }__;
5286    
5287     @Method:
5288     @@Name: addTypeURI
5289     @@enDesc:
5290     Adds a URI to the list of types of the resource.
5291     @@Param:
5292     @@@Name: uri
5293     @@@Type: AnyResourceURI
5294     @@@enDesc:
5295     A URI to add.
5296 wakaba 1.93 @@NamedParam:
5297     @@@Name: srinfo
5298     @@@Type: DISPerl|HASH||ManakaiDOM|all
5299     @@@enDesc:
5300     A hash returned by <M::DISDatabase.unloadModule>, to
5301     restore super-resource relationship.
5302     @@@nullCase:
5303     @@@@enDesc:
5304     If it is not the updating.
5305 wakaba 1.79 @@Return:
5306     @@@PerlDef:
5307     __DEEP{
5308     my $current_type = $self-><AG::DISAnyResource.typeResource>;
5309 wakaba 1.93 unless ($current_type-><M::DISResource.isSubsetOfURI>
5310     ($uri, srinfo => $srinfo)) {
5311 wakaba 1.79 my $db = $self-><AG::DISAnyResource.database>;
5312     my $res = $db-><M::DISDatabase.getResource> ($uri);
5313 wakaba 1.80 my $current_uri = $current_type-><AG::DISAnyResource.uri>;
5314 wakaba 1.93 if ($res-><M::DISResource.isSubsetOfURI>
5315     ($current_uri, srinfo => $srinfo)) {
5316 wakaba 1.80 $self->{<H::DIS|typeURI>} = $uri;
5317 wakaba 1.79 } else {
5318 wakaba 1.80 my $new_uri;
5319     __CODE{composeSubsetURI:: $input1 => $current_uri,
5320     $input2 => $uri,
5321     $output => $new_uri}__;
5322 wakaba 1.79 my $new_res = $db-><M::DISDatabase.getResource> ($new_uri);
5323 wakaba 1.80 unless ($new_res-><AG::DISAnyResource.isDefined>) {
5324     $new_res-><AS::DISAnyResource.isAnonymous> (true);
5325     $new_res-><AS::DISAnyResource.isDefined> (true);
5326 wakaba 1.93 $new_res-><M::DISResource.addSuperResource>
5327     ($current_type, srinfo => $srinfo);
5328     $new_res-><M::DISResource.addSuperResource>
5329     ($res, srinfo => $srinfo);
5330 wakaba 1.80 }
5331 wakaba 1.88 unless ($new_res-><AG::DISAnyResource.ownerModuleURIRef>) {
5332     $new_res-><AS::DISAnyResource.ownerModuleURIRef>
5333     ($res-><AG::DISAnyResource.ownerModuleURIRef>);
5334     }
5335 wakaba 1.79 $self->{<H::DIS|typeURI>} = $new_uri;
5336     }
5337     }
5338     }__;
5339    
5340     @@Test:
5341     @@@QName: DISAnyResource.addTypeURI.test
5342     @@@PerlDef:
5343     my $db;
5344     __CODE{createDISDBForTest:: $db => $db}__;
5345    
5346     my $res = $db-><M::DISDatabase.getResource> ('about:1');
5347     my $res2 = $db-><M::DISDatabase.getResource> ('about:2');
5348     $test->id ('initial.resource');
5349     $test->assert_true
5350     ($res-><M::DISAnyResource.isTypeURI> (<Q::DISCore|Resource>));
5351     $test->id ('initial.anyresource');
5352     $test->assert_true
5353     ($res-><M::DISAnyResource.isTypeURI>
5354     (<Q::DISCore|AnyResource>));
5355     $test->id ('initial.type1');
5356     $test->assert_false
5357     ($res-><M::DISAnyResource.isTypeURI> ('about:type1'));
5358    
5359     $res-><M::DISAnyResource.addTypeURI> ('about:type1');
5360    
5361     $test->id ('added.resource');
5362     $test->assert_true
5363     ($res-><M::DISAnyResource.isTypeURI> (<Q::DISCore|Resource>));
5364     $test->id ('added.anyresource');
5365     $test->assert_true
5366     ($res-><M::DISAnyResource.isTypeURI>
5367     (<Q::DISCore|AnyResource>));
5368     $test->id ('added.type1');
5369     $test->assert_true
5370     ($res-><M::DISAnyResource.isTypeURI> ('about:type1'));
5371    
5372     $test->id ('added2.resource');
5373     $test->assert_true
5374     ($res2-><M::DISAnyResource.isTypeURI>
5375     (<Q::DISCore|Resource>));
5376     $test->id ('added2.anyresource');
5377     $test->assert_true
5378     ($res2-><M::DISAnyResource.isTypeURI>
5379     (<Q::DISCore|AnyResource>));
5380     $test->id ('added2.type1');
5381     $test->assert_false
5382     ($res2-><M::DISAnyResource.isTypeURI> ('about:type1'));
5383 wakaba 1.81
5384     @CODE:
5385     @@QName: getMethodForType
5386     @@enDesc:
5387     Returns a method for a particular resource type.
5388    
5389 wakaba 1.95 In: <Perl::$type_resource>, <Perl::$method_name>
5390 wakaba 1.81
5391     Out: <Perl::$method>
5392     @@PerlDef:
5393 wakaba 1.95 my $__type_uri = $type_resource-><AG::DISAnyResource.uri>;
5394 wakaba 1.81 $method = $Message::Util::DIS::Method{$__type_uri}->{$method_name};
5395     unless ($method) {
5396     my %__methods;
5397 wakaba 1.95 for (@{$type_resource-><M::DISAnyResource.getSuperResourceURIList>}) {
5398 wakaba 1.81 $__methods{$_} = $Message::Util::DIS::Method{$_}->{$method_name}
5399     if $Message::Util::DIS::Method{$_}->{$method_name};
5400     }
5401 wakaba 1.95 my $__db = $type_resource-><AG::DISAnyResource.database>;
5402 wakaba 1.81 T1: for my $__t1_uri (keys %__methods) {
5403 wakaba 1.82 next T1 unless $__methods{$__t1_uri};
5404 wakaba 1.81 my $__t1 = $__db-><M::DISDatabase.getResource> ($__t1_uri);
5405     T2: for my $__t2_uri (keys %__methods) {
5406     next T2 if $__t1_uri eq $__t2_uri;
5407     if ($__t1-><M::DISResource.isSubsetOfURI> ($__t2_uri)) {
5408     delete $__methods{$__t2_uri};
5409 wakaba 1.82 next T2;
5410 wakaba 1.81 }
5411     if ($Message::Util::DIS::Method{$__t1_uri}->{$method_name}
5412     eq $Message::Util::DIS::Method{$__t2_uri}->{$method_name}) {
5413     delete $__methods{$__t2_uri};
5414 wakaba 1.82 next T2;
5415 wakaba 1.81 }
5416     }
5417     }
5418     if (keys %__methods > 1) {
5419     __c|ERROR{DIS|more-than-one-methods-for-a-type::
5420     DIS|uri => {$__type_uri},
5421     DIS|method-name => {$method_name},
5422     DIS|method-resource-types => {[keys %__methods]},
5423     }__;
5424     }
5425     $Message::Util::DIS::Method{$__type_uri}->{$method_name} =
5426     $method = $__methods{[keys %__methods]->[0]} if %__methods;
5427     }
5428    
5429     @IntMethod:
5430     @@Operator: ManakaiDOM|MUErrorHandler
5431     @@enDesc:
5432     When a <IF::ecore|ErrorInterface||ManakaiDOM|Perl> is <Perl::report>ed
5433     with an <Perl::-object> of <IF::Node>, then this method is invoked.
5434    
5435     The method calls the <cfg::error-handler> if the error is of
5436     <IF::c|DOMError>. Otherwise, including the cases of <IF::c|DOMException>s,
5437     the error is rethrown so that appropriate <Perl::catch> clause
5438     can catch the error.
5439     @@enImplNote:
5440     For implementations which does not have the
5441     <IF::c|DOMError||ManakaiDOM|ManakaiDOM3> interface, the method
5442     is defined in the <Class::ManakaiDOM|ManakaiDOMObject> class
5443     and it is not overridden here.
5444     @@Param:
5445     @@@Name: err
5446     @@@Type: ecore|ErrorInterface||ManakaiDOM|Perl
5447     @@@enDesc:
5448     The reported error object.
5449     @@Return:
5450     @@@Type: DISPerl|Any||ManakaiDOM|Perl
5451     @@@enDesc:
5452     If the <P::err> is a <IF::c|DOMError>, then the return value
5453     of the error handler.
5454    
5455     {NOTE:: If the error is thrown, the method never returns.
5456     }
5457     @@@nullCase:
5458     @@@@enDesc:
5459     No error handler.
5460     @@@PerlDef:
5461     if ($err->isa (<IFName::c|DOMError||ManakaiDOM|ManakaiDOM>)) {
5462     __DEEP{
5463     my $cfg = $self-><AG::DISAnyResource.database>
5464     -><AG::DISDatabase.domConfig>;
5465     my $h = $cfg-><M::DOMConfig.getParameter> ('error-handler');
5466 wakaba 1.83 $r = $h-><M::DOMCore|DOMErrorHandler||ManakaiDOM|ManakaiDOMLatest
5467     .handleError> ($err);
5468 wakaba 1.81 }__;
5469     } else {
5470     $err-><M::ecore|ErrorInterface||ManakaiDOM|Perl.throw>;
5471     }
5472 wakaba 1.84
5473     @Method:
5474     @@Name: getErrorInterfaceResource
5475     @@enDesc:
5476     Returns the <Q::ecore|ErrorInterface> resource
5477     to which the resource belongs.
5478     @@Return:
5479     @@@Type: DISAnyResource
5480     @@@enDesc:
5481     The interface resource.
5482     @@@nullCase:
5483     @@@@enDesc:
5484     If no resource found.
5485     @@@PerlDef:
5486     my $method;
5487 wakaba 1.95 my $tr = $self-><AG::DISAnyResource.typeResource>;
5488 wakaba 1.84 __CODE{DIS|getMethodForType::
5489 wakaba 1.95 $type_resource => $tr,
5490 wakaba 1.84 $method_name => 'get_error_interface_resource',
5491     $method => $method,
5492     }__;
5493     if ($method) {
5494     __DEEP{
5495     $r = $method->(@_);
5496     }__;
5497     } else {
5498     $r = null;
5499     }
5500    
5501     @Method:
5502     @@Name: getErrorCodeResource
5503     @@enDesc:
5504     Returns the <Q::dx|ErrorCode> resource
5505     to which the resource belongs.
5506     @@Return:
5507     @@@Type: DISAnyResource
5508     @@@enDesc:
5509     The interface resource.
5510     @@@nullCase:
5511     @@@@enDesc:
5512     If no resource found.
5513     @@@PerlDef:
5514     my $method;
5515 wakaba 1.95 my $tr = $self-><AG::DISAnyResource.typeResource>;
5516 wakaba 1.84 __CODE{DIS|getMethodForType::
5517 wakaba 1.95 $type_resource => $tr,
5518 wakaba 1.84 $method_name => 'get_error_code_resource',
5519     $method => $method,
5520     }__;
5521     if ($method) {
5522     __DEEP{
5523     $r = $method->(@_);
5524     }__;
5525     } else {
5526     $r = null;
5527     }
5528 wakaba 1.95
5529     @Method:
5530     @@Name: getDOMConfigurationParameterName
5531     @@enDesc:
5532     Returns the name of the DOM configuration parameter represented
5533     by the resource.
5534     @@Return:
5535     @@@Type: DISString
5536     @@@enDesc:
5537     The name.
5538     @@@nullCase:
5539     @@@@enDesc:
5540     If it is not a DOM configuration parameter or
5541     if it is an invalid configuration parameter and
5542     it has no name.
5543     @@@PerlDef:
5544     my $method;
5545     my $tr = $self-><AG::DISAnyResource.typeResource>;
5546     __CODE{DIS|getMethodForType::
5547     $type_resource => $tr,
5548     $method_name => 'get_dom_configuration_parameter_name',
5549     $method => $method,
5550     }__;
5551     if ($method) {
5552     __DEEP{
5553     $r = $method->(@_);
5554     }__;
5555     } else {
5556     $r = null;
5557     }
5558 wakaba 1.99
5559     @Method:
5560     @@Name: getNodeFromStorage
5561     @@enDesc:
5562     Returns a <IF::Node> from the storage associated
5563     to the resource.
5564     @@Param:
5565     @@@Name: key
5566     @@@Type: DISString
5567     @@@enDesc:
5568     A DOM URI that identifies the kind of the node.
5569     @@Param:
5570     @@@Name: hash
5571     @@@Type: DISString
5572     @@@enDesc:
5573     A short string that identifies the content of the node
5574     to retrieve. If it does not match to the one associated
5575     to the node in the storage, no node is returned.
5576     @@Param:
5577     @@@Name: factory
5578     @@@Type: Document
5579     @@@enDesc:
5580     The document to which the retrieved node belongs.
5581     @@Return:
5582     @@@Type: Node
5583     @@@enDesc:
5584     The retrieved node.
5585     @@@nullCase:
5586     @@@@enDesc:
5587     If no node is found.
5588     @@@PerlDef:
5589     require Message::DOM::TreeStore;
5590     my $mod = $self-><AG::DISAnyResource.ownerModule>;
5591     $mod-><M::dp|DISModulePerl.plLoadNodeStorage>
5592     unless defined $mod->{<H::DIS|nodeStorage>};
5593     my $st = $mod->{<H::DIS|nodeStorage>};
5594     if (defined $st->{$key} and $st->{$key}->[1] eq $hash) {
5595     $r = $factory->implementation
5596     ->get_feature (<Q::fe|TreeStore>)
5597     ->create_node_from_storable_object
5598     ($st->{$key}->[0], $factory);
5599     }
5600    
5601     @Method:
5602     @@Name: setNodeToStorage
5603     @@enDesc:
5604     Saves a copy of the <IF::Node> to the storage. Exactly
5605     when the physical storage is updated is implementation dependent.
5606     @@Param:
5607     @@@Name: key
5608     @@@Type: DISString
5609     @@@enDesc:
5610     A DOM URI that identifies the kind of the node.
5611     @@Param:
5612     @@@Name: hash
5613     @@@Type: DISString
5614     @@@enDesc:
5615     A short string that identifies the content of the node.
5616     If the <P::node> parameter is set to <DOM::null>,
5617     this value is ignored.
5618     @@Param:
5619     @@@Name: node
5620     @@@Type: Node
5621     @@@enDesc:
5622     The node to store. If there is already a node
5623     with the <P::key>, it is discarded.
5624     @@@nullCase:
5625     @@@@enDesc:
5626     The stored node, if any, is removed from the storage.
5627     @@Return:
5628     @@@PerlDef:
5629     require Message::DOM::TreeStore;
5630     my $mod = $self-><AG::DISAnyResource.ownerModule>;
5631     $mod-><M::dp|DISModulePerl.plLoadNodeStorage>
5632     unless defined $mod->{<H::DIS|nodeStorage>};
5633     my $st = $mod->{<H::DIS|nodeStorage>};
5634     if (defined $node) {
5635     $st->{$key}->[0] = [$node->owner_document
5636     ->implementation
5637     ->get_feature (<Q::fe|TreeStore>)
5638     ->create_storable_object_from_node
5639     ($node), $hash];
5640     } else {
5641     delete $st->{$key};
5642     }
5643     $mod->{<H::DIS|nodeStorageModified>} = true;
5644 wakaba 1.48 ##DISAnyResource
5645 wakaba 1.99
5646     PropDef:
5647     @QName: DIS|nodeStorage
5648     @DIS:key: nst
5649    
5650     PropDef:
5651     @QName: DIS|nodeStorageModified
5652     @DIS:key: nstmod
5653    
5654     ResourceDef:
5655     @QName: Node
5656     @AliasFor: tc|Node||ManakaiDOM|ManakaiDOMLatest
5657     @For: DIS|ForLatest
5658    
5659     ResourceDef:
5660     @QName: Document
5661     @AliasFor: tc|Document||ManakaiDOM|ManakaiDOMLatest
5662     @For: DIS|ForLatest
5663 wakaba 1.48
5664 wakaba 1.81 ResourceDef:
5665     @QName: DOMConfig
5666     @AliasFor: DOMCore|DOMConfiguration||ManakaiDOM|ManakaiDOMLatest
5667     @For: DIS|ForLatest
5668    
5669     ErrDef:
5670     @QName: DIS|more-than-one-methods-for-a-type
5671     @enDesc:
5672     If more than one different method implementations are defined
5673     for a resource type.
5674     @enMufDef:
5675     Method |%p (name => {<Q::DIS|method-name>});| for
5676     resource <%p (name => {<Q::DIS|uri>});> has multiple definitions
5677     @c:severity: DOMCore|SEVERITY_WARNING||ManakaiDOM|ManakaiDOMLatest
5678     @ecore:hasParameter:
5679     @@@: DIS|uri
5680     @@enDesc:
5681     A URI of the type.
5682     @ecore:hasParameter:
5683     @@@: DIS|method-name
5684     @@enDesc:
5685     The name of the method.
5686     @ecore:hasParameter:
5687     @@@: DIS|method-resource-types
5688     @@enDesc:
5689     The snapshot list of types for which methods are defined.
5690    
5691     XParamDef:
5692 wakaba 1.88 @QName: DIS|fileName
5693     @enDesc:
5694     The name of the file.
5695    
5696     XParamDef:
5697 wakaba 1.81 @QName: DIS|method-name
5698     @enDesc:
5699     The name of the method in question.
5700    
5701     XParamDef:
5702     @QName: DIS|method-resource-types
5703     @enDesc:
5704     The snapshot list of types for which methods are defined.
5705    
5706 wakaba 1.87 XParamDef:
5707     @QName: DIS|forURI
5708    
5709 wakaba 1.81 ElementTypeBinding:
5710     @Name: ErrDef
5711     @ElementType:
5712     dis:ResourceDef
5713     @ShadowContent:
5714     @@DISCore:resourceType: DOMCore|DOMErrorType
5715     @@For: DIS|ForLatest
5716     @@ecore:textFormatter: ecore|MUErrorFormatter||ManakaiDOM|Perl
5717    
5718 wakaba 1.79 URITypeDef:
5719     @QName: AnyResourceURI
5720     @enDesc:
5721     A URI that identifies a <Q::DISCore|AnyResource>.
5722    
5723     DataTypeDef:
5724     @QName: AnyResourceURIList
5725     @enDesc:
5726     A snapshot list of URIs that identify <Q::DISCore|AnyResource>s.
5727     @rdfs:subClassOf: DISPerl|ARRAY
5728    
5729     PropDef:
5730     @QName: DIS|typeURI
5731     @enDesc:
5732     The URI of the most specific type of the resource.
5733     @DIS:key: tu
5734    
5735 wakaba 1.48 IFClsDef:
5736     @IFQName: DISModule
5737     @ClsQName: ManakaiDISModuleDefinition
5738    
5739     @ClsISA: ManakaiDISPropertyAccessor
5740     @ClsISA: ManakaiDISPerlModuleDefinition
5741     @ClsISA: dp|ManakaiDISModulePerl
5742     @ClsISA: dp|ManakaiDISAnyResourcePerl
5743     @ClsISA: ManakaiDISAnyResource
5744    
5745     @Implement: DOMMinImpl
5746    
5747     @enDesc:
5748     <QUOTE::dis> module definitions.
5749    
5750     @enDesc:
5751     @@ForCheck: ManakaiDOM|ForIF
5752     @@@:
5753     The objects implementing the <IF::DISModule> interface <kwd:MUST>
5754     also implement the <IF::DISAnyResource> interface.
5755 wakaba 1.7
5756 wakaba 1.48 @DISLang:role: ModuleRole
5757    
5758     @Attr:
5759     @@ForCheck: ManakaiDOM|ForClass
5760     @@Name: uris
5761     @@Type:
5762 wakaba 1.60 DISPerl:Array::ManakaiDOM:all
5763 wakaba 1.7 @@enDesc:
5764 wakaba 1.48 A reference to the snapshot array containing the URI reference
5765     of the module.
5766     @@Get:
5767 wakaba 1.7 @@@PerlDef:
5768 wakaba 1.48 $r = [$self->{uri}];
5769 wakaba 1.8
5770     @Attr:
5771 wakaba 1.48 @@ForCheck: ManakaiDOM|ForClass
5772     @@Name: ownerModule
5773     @@ManakaiDOM:isRedefining:1
5774 wakaba 1.8 @@enDesc:
5775 wakaba 1.48 This module itself.
5776     @@Get:
5777     @@@Type: DISModule
5778     @@@clsActualType: ManakaiDISModuleDefinition
5779     @@@nullCase:
5780     @@@@enDesc:
5781     The resource is not part of any module since
5782     its definition is not read (<IF::DISModule.isDefined> is <DOM::false>).
5783     @@@PerlDef: $r = $self;
5784    
5785     @Method:
5786     @@ForCheck: ManakaiDOM|ForClass
5787     @@Name: getFeature
5788     @@Description:
5789     @@@lang:en
5790     @@@@:
5791     Returns a specialized object that implements the specialized
5792     interfaces of the specified feature and version.
5793     @@Param:
5794     @@@Name: feature
5795     @@@Type:
5796     DISLang:String::ManakaiDOM:all
5797     @@@actualType: DOMFeature|FeatureNameString||ManakaiDOM|ManakaiDOMLatest
5798     @@@Description:
5799     @@@@lang:en
5800     @@@@@:
5801     A feature name to request.
5802     @@Param:
5803     @@@Name: version
5804     @@@Type:
5805     DISLang:String::ManakaiDOM:all
5806     @@@actualType:
5807     DOMFeature|FeatureVersionString||ManakaiDOM|ManakaiDOMLatest
5808     @@@Description:
5809     @@@@lang:en
5810     @@@@@:
5811     A feature version number to request.
5812     @@Return:
5813     @@@Type:
5814     DOMMain:Object::ManakaiDOM:all
5815     @@@Description:
5816     @@@@lang:en
5817     @@@@@:
5818     An object that implements the specialized APIs of the
5819     <P::feature> and <P::version>.
5820 wakaba 1.49 @@@nullCase:
5821     @@@@enDesc:
5822 wakaba 1.48 There is no object available that implements interfaces
5823     associated with the <P::feature> and <P::version>.
5824     @@@PerlDef:
5825     $feature =~ s/^\+//;
5826     CLASS: for my $class (grep {
5827     $Message::Util::DIS::ManakaiDISModuleDefinition::CompatClass{$_}
5828     } keys %Message::Util::DIS::ManakaiDISModuleDefinition::CompatClass) {
5829     if ($Message::DOM::ClassFeature{$class}->{$feature}->{$version}) {
5830     $r = bless {o => $self}, $class;
5831     last CLASS;
5832 wakaba 1.27 }
5833 wakaba 1.8 }
5834    
5835 wakaba 1.55 @Method:
5836     @@Name: addResourceList
5837     @@enDesc:
5838     Adds a resource to the list of resources belongs to the module.
5839     @@Param:
5840     @@@Name: disResource
5841     @@@Type: DIS|DISResource
5842     @@@enDesc: The resource to add.
5843     @@Return:
5844     @@@PerlDef:
5845     __DEEP{
5846     push @{$self->{<H::DIS|resource>}||=[]},
5847 wakaba 1.85 map {\$_} @{$disResource-><AG::DIS|DISAnyResource.uris>};
5848 wakaba 1.55 }__;
5849 wakaba 1.86
5850     @Method:
5851     @@Name: addResourceURI
5852     @@enDesc:
5853     Adds a resource URI to the list of resources belongs to the module.
5854     @@Param:
5855     @@@Name: uri
5856     @@@Type: DISString
5857     @@@enDesc:
5858     The URI to add.
5859     @@Return:
5860     @@@PerlDef:
5861     push @{$self->{<H::DIS|resource>}||=[]}, \$uri;
5862    
5863     @Method:
5864     @@Name: getResourceURIList
5865     @@enDesc:
5866     Returns the list of URIs of resources belongs to the module.
5867     @@Return:
5868     @@@Type: AnyResourceURIList
5869     @@@enDesc:
5870     The snapshot list of URIs.
5871     @@@PerlDef:
5872     $r = [map {$$_} @{$self->{<H::DIS|resource>} or []}];
5873 wakaba 1.55
5874     @Method:
5875     @@Name: getResourceList
5876     @@enDesc:
5877     Returns the list of resources belongs to the module.
5878     @@Return:
5879     @@@Type: DIS|ResourceList
5880     @@@enDesc:
5881     The current snapshot of children.
5882     @@@PerlDef:
5883     __DEEP{
5884     my $db = $self-><AG::DIS|DISAnyResource.database>;
5885     $r = [map {
5886     $db-><M::DIS|DISDatabase.getResource> ($$_)
5887     } @{$self->{<H::DIS|resource>}}];
5888     }__;
5889 wakaba 1.57
5890 wakaba 1.85 @Method:
5891     @@Name: addForResource
5892     @@enDesc:
5893     Adds a <QUOTE::for> resource to the list of <QUOTE::for>
5894     resources belongs to the module.
5895     @@Param:
5896     @@@Name: disResource
5897     @@@Type: DISFor
5898     @@@enDesc: The resource to add.
5899     @@Return:
5900     @@@PerlDef:
5901     __DEEP{
5902     push @{$self->{<H::DIS|forList>}||=[]},
5903     $disResource-><AG::DISAnyResource.uriRef>;
5904     }__;
5905    
5906     @Method:
5907     @@Name: getForResourceList
5908     @@enDesc:
5909     Returns the list of <QUOTE::for> resources belongs to the module.
5910     @@Return:
5911     @@@Type: ResourceList
5912     @@@enDesc:
5913     The current snapshot list of <QUOTE::for> resources,
5914     which may or may not contains dupulications.
5915     @@@PerlDef:
5916     __DEEP{
5917     my $db = $self-><AG::DIS|DISAnyResource.database>;
5918     $r = [map {
5919     $db-><M::DIS|DISDatabase.getFor> ($$_)
5920     } @{$self->{<H::DIS|forList>}}];
5921     }__;
5922    
5923 wakaba 1.57 @Attr:
5924     @@Name: targetNamespaceURI
5925     @@enDesc:
5926     The default namespace URI of the resources defined in the module.
5927     @@Type: DIS|AnyURI
5928     @@Get:
5929     @@@PerlDef:
5930     $r = defined $self->{<H::DIS|defaultNamespaceURI>}
5931     ? ${$self->{<H::DIS|defaultNamespaceURI>}} : null;
5932     @@Set:
5933     @@@ForCheck: ManakaiDOM|ForClass
5934     @@@PerlDef:
5935     if (defined $given) {
5936     $self->{<H::DIS|defaultNamespaceURI>} = \$given;
5937     } else {
5938     CORE::delete $self->{<H::DIS|defaultNamespaceURI>};
5939     }
5940 wakaba 1.61
5941 wakaba 1.79 @CMethod:
5942     @@Name: getSuperResourceURIList
5943 wakaba 1.61 @@enDesc:
5944 wakaba 1.79 Returns a snapshot list of super-resources URIs of the resource,
5945     including canonical and alias URIs of the resource itself.
5946     @@Return:
5947     @@@Type: URIList
5948 wakaba 1.61 @@@enDesc:
5949 wakaba 1.79 A snapshot list of URIs.
5950     @@@PerlDef:
5951     $r = [$self->{uri}];
5952    
5953     @@Test:
5954     @@@QName: DISModule.getSuperResourceURIList.test
5955 wakaba 1.61 @@@PerlDef:
5956 wakaba 1.79 my $db;
5957     __CODE{createDISDBForTest:: $db => $db}__;
5958    
5959     my $res = $db-><M::DISDatabase.getModule> ('about:1');
5960    
5961     my %list = map {$_ => true} @{$res-><M::DISAnyResource
5962     .getSuperResourceURIList>};
5963    
5964     $test->assert_true ($list{'about:1'});
5965     $test->assert_false ($list{'about:2'});
5966 wakaba 1.87
5967     @Method:
5968     @@Name: getReferringModuleURIList
5969     @@enDesc:
5970     Reurns a snapshot list of the name URIs of modules referenced
5971     from the module.
5972     @@Return:
5973     @@@Type: URIList
5974     @@@enDesc:
5975     The snapshot list of URIs.
5976     @@@PerlDef:
5977     $r = [grep {$self->{<H::DIS|referringModule>}->{$_}}
5978     keys %{$self->{<H::DIS|referringModule>} or {}}];
5979    
5980     @Method:
5981     @@Name: addReferringModuleURI
5982     @@enDesc:
5983     Adds a URI to the list of modules referenced from the module.
5984     @@Param:
5985     @@@Name: uri
5986     @@@Type: DISString
5987     @@@enDesc:
5988     The URI to add.
5989     @@Return:
5990     @@@PerlDef:
5991     $self->{<H::DIS|referringModule>}->{$uri} = true;
5992 wakaba 1.48 ##DISModule
5993 wakaba 1.87
5994     PropDef:
5995     @QName: DIS|referringModule
5996     @DIS:key: ref
5997 wakaba 1.55
5998 wakaba 1.85 PropDef:
5999     @QName: DIS|forList
6000     @enDesc:
6001     A list of references to URIs of <QUOTE::for> resources
6002     belongs to the module.
6003    
6004 wakaba 1.55 ClsDef:
6005     @ClsQName: ManakaiDISModuleLite
6006    
6007     @Implement: DOMMinImpl
6008     @Implement: DIS|DISResourceProp
6009     @Implement: dp|DISAnyResourcePerl
6010     @Implement: dp|DISModulePerl
6011     @Implement: dp|DISResourcePerlModule
6012    
6013     @enDesc:
6014     The <Class::ManakaiDISModuleLite> class provides very small
6015     subset of <Class::ManakaiDISModuleDefinition> class. If a
6016     method or attribute which is not implemented by the class, then
6017     the object is updated to the <Class::ManakaiDISModuleDefinition>
6018     by reading additional properties from the <QUOTE::dis> database.
6019    
6020     @Attr:
6021 wakaba 1.88 @@Name: uri
6022     @@Type: AnyURI
6023     @@Description:
6024     @@@lang:en
6025     @@@@:
6026     The URI reference of the resource.
6027     @@Get:
6028     @@@enDesc:
6029     The representive URI reference of the resource.
6030    
6031     {NOTE:: The URI might be non-persistent if the
6032     resource is not assigned a URI in <QUOTE::dis> source file,
6033     in which case a URI is randomly-generated at the
6034     time of object generation.
6035     }
6036     @@@PerlDef:
6037     $r = $self->{uri};
6038    
6039     @Attr:
6040     @@Name: uriRef
6041     @@Type: DISPerl|SCALAR||ManakaiDOM|all
6042     @@enDesc:
6043     A reference to the URI of the resource.
6044    
6045     {NOTE:: Applications <kwd:MUST-NOT> modify the referenced
6046     value directly.
6047     }
6048     @@Get:
6049     @@@PerlDef: $r = \ ($self->{uri});
6050    
6051     @Attr:
6052 wakaba 1.55 @@ForCheck: ManakaiDOM|ForClass
6053     @@Name: uris
6054     @@Type:
6055 wakaba 1.60 DISPerl:Array::ManakaiDOM:all
6056 wakaba 1.55 @@enDesc:
6057     A reference to the snapshot array containing the URI reference
6058     of the module.
6059     @@Get:
6060     @@@PerlDef:
6061     $r = [$self->{uri}];
6062    
6063 wakaba 1.88 @Method:
6064     @@Name: isSameResource
6065     @@Operator:
6066     @@@@:eq
6067     @@@ContentType:
6068     lang:Perl
6069     @@enDesc:
6070     Whether two resources are same or not. Two resources are
6071     same if and only if their <A::DISAnyResource.uri> are
6072     equivalent as strings (i.e. in character-by-character based matching).
6073     @@Param:
6074     @@@Name: anotherResource
6075     @@@Type: DISAnyResource
6076     @@@enDesc:
6077     Another resource object to compare.
6078     @@Return:
6079     @@@Type:
6080     DOMMain:boolean::ManakaiDOM:all
6081     @@@enDesc:
6082     Whether two resources are same or not.
6083     @@@TrueCase:
6084     @@@@enDesc: Two resources are same.
6085     @@@FalseCase:
6086     @@@@enDesc: Two resources are different.
6087     @@@PerlDef:
6088     if (UNIVERSAL::isa ($anotherResource,
6089     <ClassName::ManakaiDISAnyResource>)) {
6090     $r = $self->{uri} eq $anotherResource->{uri};
6091     }
6092    
6093     @Attr:
6094     @@Name: nameURI
6095     @@Type: NameURI
6096     @@enDesc:
6097     The URI reference of this module, without
6098     <QUOTE::for> identifier.
6099     @@Get:
6100     @@@enDesc:
6101     The name URI of the resource.
6102     @@@nullCase:
6103     @@@@enDesc:
6104     The resource has no name URI.
6105    
6106     {NOTE:: A resource has no URI if and only if the resource
6107     has no local name.
6108     }
6109     @@@PerlDef:
6110     if (defined $self->{localName}) {
6111     $r = defined $self->{namespaceURI}
6112     ? ${$self->{namespaceURI}} . ${$self->{localName}}
6113     : ${$self->{localName}};
6114     }
6115    
6116     @Attr:
6117     @@Name: localName
6118     @@enDesc:
6119     The local name of this module.
6120    
6121     {NOTE:: <QUOTE::for> resources has no local name.
6122     }
6123     @@Type:
6124     DISCore:LocalName::ManakaiDOM:all
6125     @@Get:
6126     @@@PerlDef:
6127     $r = defined $self->{localName} ? ${$self->{localName}} : null;
6128    
6129     @Attr:
6130     @@Name: namespaceURI
6131     @@Type: AnyURI
6132     @@enDesc:
6133     The namespace URI of the name of this resource.
6134    
6135     {NOTE:: <QUOTE::for> resources has no namespace URI.
6136     }
6137     @@Get:
6138     @@@PerlDef:
6139     $r = defined $self->{namespaceURI} ? ${$self->{namespaceURI}} : null;
6140    
6141     @Attr:
6142     @@Name: forURI
6143     @@Type: ForURI
6144     @@enDesc:
6145     The <QUOTE::for> URI reference for which this module is defined.
6146     @@Get:
6147     @@@PerlDef:
6148     $r = defined $self->{for} ? ${$self->{for}} : null;
6149    
6150     @Attr:
6151     @@Name: forpURI
6152     @@enDesc:
6153     The <QUOTE::for+> URI references for which this resource is defined.
6154    
6155     {NOTE:: <QUOTE::for> resources has no <QUOTE::for+> URI.
6156     }
6157     @@Type: ForURIList
6158     @@Get:
6159     @@@enDesc:
6160     List of <QUOTE::for> URI references. Note that this list is
6161     <QUOTE::dead>.
6162     @@@PerlDef:
6163     $r = [@{$self->{forp}}];
6164    
6165     @Method:
6166     @@Name: isForURI
6167     @@enDesc:
6168     Tests whether this resource is defined for a <QUOTE::for>
6169     or <QUOTE::for+> URI reference or not.
6170     @@Param:
6171     @@@Name:forURI
6172     @@@Type:ForURI
6173     @@@enDesc:
6174     A <QUOTE::for> URI reference to test.
6175     @@Return:
6176     @@@Type:
6177     DOMMain:boolean::ManakaiDOM:all
6178     @@@TrueCase:
6179     @@@@enDesc:
6180     This resource is for <P::forURI>.
6181     @@@FalseCase:
6182     @@@@enDesc:
6183     This resource is not for <P::forURI>.
6184     @@@PerlDef:
6185     __DEEP{
6186     C: for my $this_for_uri (${$self->{for}||\''}, @{$self->{forp}||[]}) {
6187     if ($this_for_uri eq $forURI) { ## Shortcut
6188     $r = true;
6189     last C;
6190     }
6191 wakaba 1.98 my $this_for = $self-><AG::DISAnyResource.database>
6192     -><M::DIS|DISDatabase.getFor>
6193 wakaba 1.88 ($this_for_uri);
6194     if ($this_for-><M::DIS|DISFor.isaURI> ($forURI)) {
6195     $r = true;
6196     last C;
6197     }
6198     }
6199     }__;
6200    
6201     @Attr:
6202     @@Name: isDefined
6203     @@Description:
6204     @@@lang:en
6205     @@@@:
6206     Whether this module is defined or not.
6207     @@Type:
6208     DOMMain:boolean::ManakaiDOM:all
6209     @@Get:
6210     @@@PerlDef:
6211     $r = $self->{<H::DIS|isDefined>};
6212     @@Set:
6213     @@@PerlDef:
6214     $self->{<H::DIS|isDefined>} = $given;
6215    
6216 wakaba 1.55 @Attr:
6217     @@ForCheck: ManakaiDOM|ForClass
6218     @@Name: ownerModule
6219     @@ManakaiDOM:isRedefining:1
6220     @@enDesc:
6221     This module itself.
6222     @@Get:
6223     @@@Type: DISModule
6224     @@@clsActualType: ManakaiDISModuleDefinition
6225     @@@nullCase:
6226     @@@@enDesc:
6227     The resource is not part of any module since
6228     its definition is not read (<IF::DISModule.isDefined> is <DOM::false>).
6229     @@@PerlDef: $r = $self;
6230    
6231 wakaba 1.88 @Attr:
6232     @@Name: ownerModuleURI
6233     @@enDesc:
6234     A URI of the owner module of the resource.
6235     @@Type: DIS|AnyURI
6236     @@nullCase:
6237     @@@enDesc:
6238     The resource does not belong to any module since the
6239     resource definition is not read yet or since
6240     it is created in memory.
6241     @@Get:
6242     @@@PerlDef:
6243     $r = $self->{uri};
6244    
6245     @Attr:
6246     @@Name: ownerModuleURIRef
6247     @@enDesc:
6248     A reference to a URI of the owner module of the resource.
6249     @@Type: DISPerl|SCALAR||ManakaiDOM|Perl
6250     @@nullCase:
6251     @@@enDesc:
6252     The resource does not belong to any module since the
6253     resource definition is not read yet or since
6254     it is created in memory.
6255     @@Get:
6256     @@@PerlDef:
6257     $r = \ ($self->{uri});
6258     @@Set:
6259     @@@PerlDef: # no effect
6260    
6261     @Attr:
6262     @@Name: database
6263     @@enDesc:
6264     The <QUOTE::dis> database to which the resource belongs.
6265     @@Type: DISDatabase
6266     @@clsActualType: ManakaiDISDatabase
6267     @@Get:
6268     @@@PerlDef:
6269     $r = $self->{db};
6270    
6271 wakaba 1.55 @Method:
6272     @@Operator:
6273     @@@@: AUTOLOAD
6274     @@@ContentType: lang|Perl
6275     @@Return:
6276     @@@PerlDef:
6277 wakaba 1.57 my $al = our $AUTOLOAD;
6278     $al =~ s/.+:://;
6279     if ($al ne 'DESTROY') {
6280    
6281 wakaba 1.55 __DEEP{
6282     $self-><AG::DIS|DISAnyResource.database>
6283     -><M::dp|ManakaiDISDatabasePerl.plLoadDISDatabaseModule> ($self);
6284     }__;
6285     if (ref $self eq <ClassName::ManakaiDISModuleLite>) {
6286     __EXCEPTION{DIS|RESOURCE_NOT_DEFINED_ERR::
6287     DIS:uri => {$self-><AG::DIS|DISAnyResource.uri>},
6288     DIS:moduleURI => {$self-><AG::DIS|DISAnyResource.uri>},
6289     }__;
6290     }
6291    
6292     my $code = $self->can ($al);
6293     if ($code) {
6294     goto &$code;
6295     } else {
6296     require Carp;
6297 wakaba 1.67 local $Carp::CarpLevel = $Error::Depth;
6298 wakaba 1.55 Carp::croak (qq<Can't locate method "$AUTOLOAD">);
6299     }
6300 wakaba 1.57
6301     } # $al
6302    
6303     @Attr:
6304     @@Name: targetNamespaceURI
6305     @@enDesc:
6306     The default namespace URI of the resources defined in the module.
6307     @@Type: DIS|AnyURI
6308     @@Get:
6309     @@@PerlDef:
6310     $r = defined $self->{<H::DIS|defaultNamespaceURI>}
6311     ? ${$self->{<H::DIS|defaultNamespaceURI>}} : null;
6312 wakaba 1.55 ##DISModuleLite
6313 wakaba 1.48
6314     IFClsDef:
6315     @IFQName: DISFor
6316     @ClsQName: ManakaiDISForDefinition
6317    
6318     @ClsISA: dp|ManakaiDISAnyResourcePerl
6319 wakaba 1.79 @ClsISA: ManakaiDISPropertyAccessor
6320 wakaba 1.48 @ClsISA: ManakaiDISAnyResource
6321    
6322     @DISLang:role: ForRole
6323    
6324     @Description:
6325     @@lang:en
6326     @@@:
6327     <QUOTE::dis> <QUOTE::for> definitions.
6328 wakaba 1.8
6329     @Attr:
6330 wakaba 1.48 @@ForCheck: ManakaiDOM|ForClass
6331     @@Name: uris
6332     @@Type:
6333 wakaba 1.60 DISPerl:Array::ManakaiDOM:all
6334 wakaba 1.48 @@actualType: ForURIList
6335 wakaba 1.15 @@enDesc:
6336 wakaba 1.48 A reference to the snapshot array containing the URI reference
6337     of the <QUOTE::for>.
6338 wakaba 1.15 @@Get:
6339     @@@PerlDef:
6340 wakaba 1.48 $r = [$self->{uri}];
6341 wakaba 1.18
6342 wakaba 1.48 @Method:
6343     @@Name: isaURI
6344     @@Description:
6345     @@@lang:en
6346     @@@@:
6347     Whether this <QUOTE::for> is-a another <QUOTE::for> or not.
6348     @@Param:
6349     @@@Name: superURI
6350     @@@Type: ForURI
6351     @@@Description:
6352     @@@@lang:en
6353     @@@@@:
6354     Another <QUOTE::for> URI reference to test.
6355     @@Return:
6356     @@@Type:
6357     DOMMain:boolean::ManakaiDOM:all
6358     @@@TrueCase:
6359     @@@@enDesc:
6360     <P::superURI> is a super-<QUOTE::for> of this <QUOTE::for>.
6361     @@@FalseCase:
6362     @@@@enDesc:
6363     <P::superURI> is not a super-<QUOTE::for> of this <QUOTE::for>.
6364 wakaba 1.18 @@@PerlDef:
6365 wakaba 1.48 $r = $self->{uri} eq $superURI ? true : $self->{isa}->{$superURI};
6366 wakaba 1.15
6367 wakaba 1.48 @Method:
6368     @@Name: addISA
6369 wakaba 1.8 @@enDesc:
6370 wakaba 1.48 Adds a <QUOTE::for> to the list of super-<QUOTE::for> of this
6371     <QUOTE::for>.
6372     @@Param:
6373     @@@Name: superFor
6374     @@@Type: DISFor
6375     @@@clsActualType: ManakaiDISForDefinition
6376 wakaba 1.8 @@@enDesc:
6377 wakaba 1.48 A <QUOTE::for> definition object.
6378     @@Return:
6379 wakaba 1.8 @@@PerlDef:
6380 wakaba 1.48 my @from = ($self->{uri},
6381     grep {$self->{revISA}->{$_}} keys %{$self->{revISA}});
6382     my @to = ($superFor->{uri},
6383     grep {$superFor->{isa}->{$_}} keys %{$superFor->{isa}});
6384 wakaba 1.8 __DEEP{
6385 wakaba 1.48 for my $from (@from) {
6386     for my $to (@to) {
6387     $self->{db}-><M::ManakaiDISDatabase.getFor>
6388     ($from)->{isa}->{$to} = true;
6389     $self->{db}-><M::ManakaiDISDatabase.getFor>
6390     ($to)->{revISA}->{$from} = true;
6391 wakaba 1.8 }
6392     }
6393     }__;
6394    
6395 wakaba 1.48 @Method:
6396     @@Name: getFeature
6397     @@Description:
6398     @@@lang:en
6399     @@@@:
6400     Returns a specialized object that implements the specialized
6401     interfaces of the specified feature and version.
6402     @@Param:
6403     @@@Name: feature
6404     @@@Type:
6405     DISLang:String::ManakaiDOM:all
6406     @@@actualType:
6407     ManakaiDOM:ManakaiDOMFeatureName::ManakaiDOM:ManakaiDOMLatest
6408     @@@Description:
6409     @@@@lang:en
6410     @@@@@:
6411     A feature name to request.
6412     @@Param:
6413     @@@Name: version
6414     @@@Type:
6415     DISLang:String::ManakaiDOM:all
6416     @@@actualType:
6417     ManakaiDOM:ManakaiDOMFeatureVersion::ManakaiDOM:ManakaiDOMLatest
6418     @@@Description:
6419     @@@@lang:en
6420     @@@@@:
6421     A feature version number to request.
6422     @@Return:
6423     @@@Type:
6424     DOMMain:Object::ManakaiDOM:all
6425     @@@Description:
6426     @@@@lang:en
6427     @@@@@:
6428     An object that implements the specialized APIs of the
6429     <P::feature> and <P::version>.
6430 wakaba 1.49 @@@nullCase:
6431     @@@@enDesc:
6432 wakaba 1.48 There is no object available that implements interfaces
6433     associated with the <P::feature> and <P::version>.
6434     @@@PerlDef:
6435     $feature =~ s/^\+//;
6436     CLASS: for my $class (grep {
6437     $Message::Util::DIS::ManakaiDISForDefinition::CompatClass{$_}
6438     } keys %Message::Util::DIS::ManakaiDISForDefinition::CompatClass) {
6439     if ($Message::DOM::ClassFeature{$class}->{$feature}->{$version}) {
6440     $r = bless {o => $self}, $class;
6441     last CLASS;
6442 wakaba 1.8 }
6443     }
6444    
6445     @Attr:
6446 wakaba 1.48 @@ForCheck: ManakaiDOM|ForClass
6447     @@Name: forURI
6448     @@Type: ForURI
6449 wakaba 1.8 @@enDesc:
6450 wakaba 1.48 The <QUOTE::for> URI reference for which this module is defined.
6451 wakaba 1.8 @@Get:
6452 wakaba 1.48 @@@InCase:
6453     @@@@Value:
6454     @@@@@@: ManakaiDOM|all
6455 wakaba 1.68 @@@@@ContentType: DISCore|QName
6456 wakaba 1.8 @@@@enDesc:
6457 wakaba 1.48 The attribute value is always <Q::ManakaiDOM|all> for a
6458     <QUOTE::for> resource.
6459 wakaba 1.8 @@@PerlDef:
6460 wakaba 1.48 $r = <Q::ManakaiDOM|all>;
6461 wakaba 1.8
6462     @Attr:
6463 wakaba 1.48 @@Name: forpURI
6464 wakaba 1.8 @@enDesc:
6465 wakaba 1.48 The <QUOTE::for+> URI references for which this resource is defined.
6466     @@Type: ForURIList
6467 wakaba 1.8 @@Get:
6468 wakaba 1.48 @@@enDesc:
6469     List of <QUOTE::for> URI references. Note that this list is
6470     <QUOTE::dead>.
6471     @@@InCase:
6472     @@@@Value:
6473     @@@@@@: []
6474     @@@@@ContentType: lang|Perl
6475 wakaba 1.8 @@@@enDesc:
6476 wakaba 1.48 The attribute value is always an empty array reference
6477     for a <QUOTE::for> resource.
6478     @@@PerlDef: $r = [];
6479 wakaba 1.9
6480 wakaba 1.48 @Method:
6481     @@Name: isForURI
6482 wakaba 1.9 @@enDesc:
6483 wakaba 1.48 Tests whether this resource is defined for a <QUOTE::for>
6484     or <QUOTE::for+> URI reference or not.
6485 wakaba 1.9 @@Param:
6486 wakaba 1.48 @@@Name:forURI
6487     @@@Type:ForURI
6488     @@@enDesc:
6489     A <QUOTE::for> URI reference to test.
6490 wakaba 1.9 @@Return:
6491     @@@Type:
6492 wakaba 1.48 DOMMain:boolean::ManakaiDOM:all
6493     @@@TrueCase:
6494     @@@@enDesc:
6495     This resource is for <P::forURI>. The attribute
6496     always takes this value for <QUOTE::for> resources.
6497     @@@PerlDef: $r = true;
6498 wakaba 1.12
6499     @Attr:
6500 wakaba 1.48 @@ForCheck: ManakaiDOM|ForClass
6501     @@Name: nameURI
6502     @@Type: NameURI
6503 wakaba 1.12 @@enDesc:
6504 wakaba 1.48 The URI reference of this module, without
6505     <QUOTE::for> identifier.
6506 wakaba 1.12 @@Get:
6507 wakaba 1.49 @@@enDesc:
6508     The attribute value is always equals to
6509     <A::DISAnyResource.uri> for <QUOTE::for> resources.
6510     @@@PerlDef: $r = $self->{uri};
6511 wakaba 1.61
6512 wakaba 1.79 @CMethod:
6513     @@Name: getSuperResourceURIList
6514 wakaba 1.61 @@enDesc:
6515 wakaba 1.79 Returns a snapshot list of super-resources URIs of the resource,
6516     including canonical and alias URIs of the resource itself.
6517     @@Return:
6518     @@@Type: URIList
6519 wakaba 1.61 @@@enDesc:
6520 wakaba 1.79 A snapshot list of URIs.
6521     @@@PerlDef:
6522     $r = [
6523     (grep {$self->{isa}->{$_}} keys %{$self->{isa}}),
6524     (grep {$self->{aliasURI}->{$_}} keys %{$self->{aliasURI}}),
6525     ($self->{uri}),
6526     ];
6527    
6528     @@Test:
6529     @@@QName: DISFor.getSuperResourceURIList.test
6530 wakaba 1.61 @@@PerlDef:
6531 wakaba 1.79 my $db;
6532     __CODE{createDISDBForTest:: $db => $db}__;
6533    
6534     my $res1 = $db-><M::DISDatabase.getFor> ('about:1');
6535    
6536     my %list1 = map {$_ => true} @{$res1-><M::DISAnyResource
6537     .getSuperResourceURIList>};
6538    
6539     $test->assert_true ($list1{'about:1'});
6540     $test->assert_false ($list1{'about:2'});
6541     $test->assert_true ($list1{<Q::ManakaiDOM:all>});
6542    
6543     my $res2 = $db-><M::DISDatabase.getFor> ('about:2');
6544     $res1-><M::DISFor.addISA> ($res2);
6545    
6546     my %list1_2 = map {$_ => true} @{$res1-><M::DISAnyResource
6547     .getSuperResourceURIList>};
6548    
6549     $test->assert_true ($list1_2{'about:1'});
6550     $test->assert_true ($list1_2{'about:2'});
6551     $test->assert_true ($list1_2{<Q::ManakaiDOM:all>});
6552    
6553     my %list2 = map {$_ => true} @{$res2-><M::DISAnyResource
6554     .getSuperResourceURIList>};
6555    
6556     $test->assert_false ($list2{'about:1'});
6557     $test->assert_true ($list2{'about:2'});
6558     $test->assert_true ($list2{<Q::ManakaiDOM:all>});
6559 wakaba 1.48 ##DISFor
6560 wakaba 1.18
6561 wakaba 1.48 IFClsDef:
6562     @IFQName: DISResource
6563     @ClsQName: ManakaiDISResourceDefinition
6564 wakaba 1.19
6565 wakaba 1.48 @ClsISA: ManakaiDISResourceMV
6566     @ClsISA: dp|ManakaiDISResourcePerl
6567     @ClsISA: ManakaiDISPerlModuleDefinition
6568     @ClsISA: dp|ManakaiDISAnyResourcePerl
6569     @ClsISA: ManakaiDISPropertyAccessor
6570     @ClsISA: ManakaiDISAnyResource
6571 wakaba 1.19
6572 wakaba 1.48 @DISLang:role: ResourceRole
6573 wakaba 1.19
6574 wakaba 1.48 @enDesc:
6575     <QUOTE::dis> resource definitions.
6576 wakaba 1.19
6577 wakaba 1.48 @enDesc:
6578     @@ForCheck: ManakaiDOM|ForIF
6579     @@@:
6580     The objects implementing the <IF::DISResource> interface
6581     <kwd:MUST> also implement the <IF::DISAnyResource> interface.
6582 wakaba 1.12
6583 wakaba 1.46 @Attr:
6584 wakaba 1.48 @@ForCheck: ManakaiDOM|ForClass
6585     @@Name: uris
6586     @@Type:
6587 wakaba 1.60 DISPerl:Array::ManakaiDOM:all
6588 wakaba 1.46 @@enDesc:
6589 wakaba 1.48 Returns the current <EM::snapshot> of the URI references
6590     for this resource, including the alias URI references.
6591 wakaba 1.46 @@Get:
6592     @@@PerlDef:
6593 wakaba 1.48 $r = [grep {$self->{aliasURI}->{$_}} keys %{$self->{aliasURI}}];
6594 wakaba 1.46
6595 wakaba 1.12 @Method:
6596 wakaba 1.48 @@Name: isSubsetOfURI
6597     @@Description:
6598 wakaba 1.37 @@@lang:en
6599     @@@@:
6600 wakaba 1.48 Whether this resource is a subset of another resource or not.
6601     @@Param:
6602     @@@Name: superURI
6603     @@@Type: ResourceURI
6604     @@@Description:
6605     @@@@lang:en
6606     @@@@@:
6607     Another resource URI reference to test.
6608 wakaba 1.89 @@NamedParam:
6609     @@@Name: srinfo
6610     @@@Type: DISPerl|HASH||ManakaiDOM|all
6611     @@@enDesc:
6612     The <CODE::srinfo> hash.
6613     @@@nullCase:
6614     @@@@enDesc:
6615     No <CODE::srinfo>.
6616 wakaba 1.12 @@Return:
6617 wakaba 1.48 @@@Type:
6618     DOMMain:boolean::ManakaiDOM:all
6619     @@@TrueCase:
6620     @@@@enDesc:
6621     <P::superURI> is a super-resource of this resource.
6622     @@@FalseCase:
6623 wakaba 1.12 @@@@enDesc:
6624 wakaba 1.48 <P::superURI> is not a super-resource of this resource.
6625 wakaba 1.12 @@@PerlDef:
6626 wakaba 1.48 $r = $self->{aliasURI}->{$superURI} || $self->{subOf}->{$superURI};
6627 wakaba 1.89 if (not $r and $srinfo) {
6628     A: {
6629     if ($srinfo->{resource}->{$superURI}) {
6630     for my $this_uri (grep {$self->{aliasURI}->{$_}}
6631     keys %{$self->{aliasURI}}) {
6632     if ($srinfo->{resource}->{$superURI}->{aliasURI}->{$this_uri}) {
6633     $r = true;
6634     last A;
6635     }
6636     if ($srinfo->{resource}->{$superURI}->{supOf}->{$this_uri}) {
6637     $r = true;
6638     last A;
6639     }
6640     }
6641     }
6642     for my $this_uri (grep {$self->{aliasURI}->{$_}}
6643     keys %{$self->{aliasURI}}) {
6644     if ($srinfo->{resource}->{$this_uri}) {
6645     if ($srinfo->{resource}->{$this_uri}->{aliasURI}->{$superURI}) {
6646     $r = true;
6647     last A;
6648     }
6649     }
6650     }
6651     } # A
6652     }
6653 wakaba 1.13
6654     @Method:
6655 wakaba 1.48 @@Name: addSuperResource
6656 wakaba 1.13 @@enDesc:
6657 wakaba 1.48 Adds a <QUOTE::dis> resource to the list of super-resource
6658     of this <QUOTE::dis> resource.
6659 wakaba 1.13 @@Param:
6660 wakaba 1.48 @@@Name: superRes
6661 wakaba 1.47 @@@Type: DISResource
6662     @@@clsActualType: ManakaiDISResourceDefinition
6663 wakaba 1.13 @@@enDesc:
6664 wakaba 1.48 A <QUOTE::dis> resource definition object.
6665 wakaba 1.89 @@NamedParam:
6666     @@@Name: srinfo
6667     @@@Type: DISPerl|HASH||ManakaiDOM|all
6668     @@@enDesc:
6669     The <CODE::srinfo> hash.
6670     @@@nullCase:
6671     @@@@enDesc:
6672     No <CODE::srinfo>.
6673 wakaba 1.48 @@Return:
6674 wakaba 1.13 @@@PerlDef:
6675 wakaba 1.48 my @from = ($self->{uri},
6676 wakaba 1.50 grep {$self->{supOf}->{$_}} keys %{$self->{supOf}||{}});
6677 wakaba 1.48 my @to = ($superRes->{uri},
6678 wakaba 1.50 grep {$superRes->{subOf}->{$_}} keys %{$superRes->{subOf}||{}});
6679 wakaba 1.13 __DEEP{
6680 wakaba 1.48 for my $from (@from) {
6681     for my $to (@to) {
6682     $self->{db}-><M::ManakaiDISDatabase.getResource>
6683     ($from)->{subOf}->{$to} = true;
6684 wakaba 1.89 $srinfo->{resource}->{$from}->{subOf}->{$to} = true;
6685 wakaba 1.48 $self->{db}-><M::ManakaiDISDatabase.getResource>
6686     ($to)->{supOf}->{$from} = true;
6687 wakaba 1.89 $srinfo->{resource}->{$to}->{supOf}->{$from} = true;
6688 wakaba 1.13 }
6689     }
6690     }__;
6691 wakaba 1.48
6692 wakaba 1.13 @Method:
6693 wakaba 1.48 @@Name: mergeAsAlias
6694 wakaba 1.13 @@enDesc:
6695 wakaba 1.48 Merges another resource definition as an alias of this resource.
6696 wakaba 1.13 @@Param:
6697 wakaba 1.48 @@@Name: aliasResource
6698 wakaba 1.47 @@@Type: DISResource
6699     @@@clsActualType: ManakaiDISResourceDefinition
6700 wakaba 1.13 @@@enDesc:
6701 wakaba 1.48 A resource to merge.
6702     \
6703     {NOTE:: After merging all references to <P::aliasResource>
6704     should be discarded.
6705     \
6706     }
6707     @@NodeParam:
6708 wakaba 1.88 @@NamedParam:
6709     @@@Name: noEqualityCheck
6710     @@@Type: idl|boolean||ManakaiDOM|all
6711     @@@enDesc:
6712     Don't throw <X::MERGE_ITSELF_ERR> exception.
6713 wakaba 1.89 @@NamedParam:
6714     @@@Name: srinfo
6715     @@@Type: DISPerl|HASH||ManakaiDOM|all
6716     @@@enDesc:
6717     The <CODE::srinfo> hash.
6718     @@@nullCase:
6719     @@@@enDesc:
6720     No <CODE::srinfo>.
6721 wakaba 1.48 @@Return:
6722     @@@RaiseException:
6723     @@@@@:MERGE_ITSELF_ERR
6724     @@@@@@enDesc:
6725     An attempt is made to merge this resource itself.
6726 wakaba 1.13 @@@PerlDef:
6727 wakaba 1.88 if (not $noEqualityCheck and $self eq $aliasResource) {
6728 wakaba 1.48 __EXCEPTION{MERGE_ITSELF_ERR::
6729 wakaba 1.89 DIS:uri => {$self-><AG::DISAnyResource.uri>},
6730 wakaba 1.48 DIS:sourceNode => {$node},
6731     }__;
6732     }
6733     for my $uri ($aliasResource->{uri},
6734     grep {$aliasResource->{aliasURI}->{$_}}
6735     keys %{$aliasResource->{aliasURI}}) {
6736     $self->{aliasURI}->{$uri} = true;
6737     $self->{db}->{resDef}->{$uri} = $self;
6738     $self->{subOf}->{$uri} = true;
6739     $self->{supOf}->{$uri} = true;
6740     }
6741     for my $uri (grep {$aliasResource->{subOf}->{$_}}
6742 wakaba 1.50 keys %{$aliasResource->{subOf}||{}}) {
6743 wakaba 1.48 $self->{subOf}->{$uri} = true;
6744     }
6745     for my $uri (grep {$aliasResource->{supOf}->{$_}}
6746 wakaba 1.50 keys %{$aliasResource->{supOf}||{}}) {
6747 wakaba 1.48 $self->{supOf}->{$uri} = true;
6748     }
6749 wakaba 1.50 my @from = grep {$self->{supOf}->{$_}} keys %{$self->{supOf}||{}};
6750     my @to = grep {$self->{subOf}->{$_}} keys %{$self->{subOf}||{}};
6751 wakaba 1.13 __DEEP{
6752 wakaba 1.48 for my $from (@from) {
6753     for my $to (@to) {
6754     $self->{db}-><M::ManakaiDISDatabase.getResource>
6755     ($from)->{subOf}->{$to} = true;
6756 wakaba 1.89 $srinfo->{resource}->{$from}->{subOf}->{$to} = true;
6757 wakaba 1.48 $self->{db}-><M::ManakaiDISDatabase.getResource>
6758     ($to)->{supOf}->{$from} = true;
6759 wakaba 1.89 $srinfo->{resource}->{$to}->{supOf}->{$from} = true;
6760 wakaba 1.13 }
6761     }
6762     }__;
6763 wakaba 1.15
6764 wakaba 1.48 @Attr:
6765     @@Name: disDataTypeResource
6766     @@enDesc:
6767     The resource referenced by <Q::dis:Type> property.
6768 wakaba 1.15
6769 wakaba 1.48 = If the resource has the <Q::dis:Type> property,
6770     then its value references the data type resource.
6771 wakaba 1.15
6772 wakaba 1.48 = If the resource has no <Q::dis:Type> property but
6773     the dynamic parent resource has the <Q::dis:Type> property,
6774     then its value references the data type resource.
6775    
6776     = Otherwise, the resource has no associated data type resoruce;
6777     this method throws a <X::NO_DIS_TYPE_ERR> exception.
6778     @@Type: DISResource
6779     @@clsActualType: ManakaiDISResourceDefinition
6780     @@Get:
6781     @@@RaiseException:
6782     @@@@@:NO_DIS_TYPE_ERR
6783 wakaba 1.16 @@@@enDesc:
6784 wakaba 1.48 <Q::dis:Type> attribute is not specified.
6785 wakaba 1.13 @@@PerlDef:
6786 wakaba 1.48 __DEEP{
6787     if (UNIVERSAL::isa ($self->{<Q::dis:Type>}, <IFName::dv|DVURIValue>)) {
6788     $r = $self->{<Q::dis:Type>}-><M::dv|DVURIValue.getResource>
6789     ($self-><AG::DISAnyResource.database>);
6790     } else {
6791 wakaba 1.54 my $pr = $self-><AG::DIS|DISResource.dynamicParentResource>;
6792 wakaba 1.48 $r = $pr-><AG::DISResource.disDataTypeResource> if $pr;
6793     }
6794     }__;
6795     unless ($r) {
6796     __EXCEPTION{NO_DIS_TYPE_ERR::
6797     DIS:uri => {$self-><AG::DISAnyResource.uri>},
6798     DIS:sourceNode => {$self-><AG::DISAnyResource.sourceElement>},
6799 wakaba 1.13 }__;
6800     }
6801 wakaba 1.48
6802     @Attr:
6803     @@Name: disDataTypeValue
6804     @@enDesc:
6805     The <Q::dis:Type> property value for the resource.
6806     @@Get:
6807     @@@Type: dv|DVURIValue
6808     @@@clsActualType: dv|ManakaiDVURIValue
6809     @@@RaiseException:
6810     @@@@@:NO_DIS_TYPE_ERR
6811     @@@@enDesc:
6812     <Q::dis:Type> attribute is not specified.
6813     @@@PerlDef:
6814 wakaba 1.13 __DEEP{
6815 wakaba 1.48 if (UNIVERSAL::isa ($self->{<Q::dis:Type>}, <IFName::dv|DVURIValue>)) {
6816     $r = $self->{<Q::dis:Type>};
6817 wakaba 1.16 } else {
6818 wakaba 1.54 my $pr = $self-><AG::DIS|DISResource.dynamicParentResource>;
6819 wakaba 1.48 $r = $pr-><AG::DISResource.disDataTypeValue> if $pr;
6820 wakaba 1.16 }
6821 wakaba 1.48 }__;
6822     unless ($r) {
6823     __EXCEPTION{NO_DIS_TYPE_ERR::
6824     DIS:uri => {$self-><AG::DISAnyResource.uri>},
6825     DIS:sourceNode => {$self-><AG::DISAnyResource.sourceElement>},
6826     }__;
6827     }
6828 wakaba 1.13
6829     @Attr:
6830 wakaba 1.48 @@Name: disActualDataTypeResource
6831 wakaba 1.13 @@enDesc:
6832 wakaba 1.48 <Q::dis:actualType> attribute value of this resource.
6833     @@Type: DISResource
6834     @@clsActualType: ManakaiDISResourceDefinition
6835 wakaba 1.13 @@Get:
6836 wakaba 1.48 @@@RaiseException:
6837     @@@@@:NO_DIS_TYPE_ERR
6838 wakaba 1.13 @@@@enDesc:
6839 wakaba 1.48 <Q::dis:actualType> attribute is not specified,
6840     and <Q::dis:Type> attribute, neigher.
6841 wakaba 1.13 @@@PerlDef:
6842 wakaba 1.48 __DEEP{
6843     if (UNIVERSAL::isa ($self->{<Q::dis:actualType>},
6844     <IFName::dv|DVURIValue>)) {
6845     $r = $self->{<Q::dis:actualType>}-><M::dv|DVURIValue.getResource>
6846     ($self-><AG::DISAnyResource.database>);
6847     } elsif (UNIVERSAL::isa ($self->{<Q::dis:Type>},
6848     <IFName::dv|DVURIValue>)) {
6849     $r = $self->{<Q::dis:Type>}-><M::dv|DVURIValue.getResource>
6850     ($self-><AG::DISAnyResource.database>);
6851     } else {
6852 wakaba 1.54 my $pr = $self-><AG::DIS|DISResource.dynamicParentResource>;
6853 wakaba 1.48 $r = $pr-><AG::DISResource.disActualDataTypeResource> if $pr;
6854     }
6855     }__;
6856     unless ($r) {
6857     __EXCEPTION{NO_DIS_TYPE_ERR::
6858     DIS:uri => {$self-><AG::DISAnyResource.uri>},
6859     DIS:sourceNode => {$self-><AG::DISAnyResource.sourceElement>},
6860 wakaba 1.13 }__;
6861     }
6862 wakaba 1.48
6863     @Attr:
6864     @@Name: disActualDataTypeValue
6865 wakaba 1.13 @@enDesc:
6866 wakaba 1.48 <Q::dis:actualType> node for this resource.
6867     @@Get:
6868     @@@Type: DISElement
6869     @@@clsActualType: ManakaiDISElement
6870 wakaba 1.13 @@@RaiseException:
6871 wakaba 1.48 @@@@@:NO_DIS_TYPE_ERR
6872 wakaba 1.13 @@@@enDesc:
6873 wakaba 1.48 <Q::dis:actualType> attribute is not specified,
6874     and <Q::dis:Type> attribute, neigher.
6875 wakaba 1.13 @@@PerlDef:
6876 wakaba 1.48 __DEEP{
6877     if (UNIVERSAL::isa ($self->{<Q::dis:actualType>},
6878     <IFName::dv|DVURIValue>)) {
6879     $r = $self->{<Q::dis:actualType>};
6880     } elsif (UNIVERSAL::isa ($self->{<Q::dis:Type>},
6881     <IFName::dv|DVURIValue>)) {
6882     $r = $self->{<Q::dis:Type>};
6883 wakaba 1.13 } else {
6884 wakaba 1.54 my $pr = $self-><AG::DIS|DISResource.dynamicParentResource>;
6885 wakaba 1.48 $r = $pr-><AG::DISResource.disActualDataTypeValue> if $pr;
6886 wakaba 1.13 }
6887 wakaba 1.48 }__;
6888     unless ($r) {
6889     __EXCEPTION{NO_DIS_TYPE_ERR::
6890     DIS:uri => {$self-><AG::DISAnyResource.uri>},
6891     DIS:sourceNode => {$self-><AG::DISAnyResource.sourceElement>},
6892 wakaba 1.13 }__;
6893     }
6894    
6895 wakaba 1.15 @IntMethod:
6896 wakaba 1.48 @@Operator:
6897     @@@@: <=>
6898     @@@ContentType:
6899     lang:Perl
6900 wakaba 1.15 @@enDesc:
6901 wakaba 1.54 Compares two resources. If the first character of the
6902     node in the source tree by which the resource is defined
6903     occures before the other resource's first character, then
6904     the former resource is <DFN::less> than the later resource.
6905     If two resources are the same resource, they are <DFN::equal>.
6906     Otherwise, the former resource is <DFN::greater> than
6907     the later resource.
6908    
6909     There are two exceptions. If two resources belongs to
6910     two different modules, i.e. their <A::DIS|DISAnyResource.ownerModule>s
6911     are different, the order is not defined. Also, if
6912     one of resources is not yet defined, i.e. one's
6913     <A::DIS|DISAnyResource.isDefined> takes <DOM::false> value,
6914     then the order is not defined. Even in these cases, two
6915     calls for the method with the same parameter would return
6916     the same result while the resources are left unchanged.
6917 wakaba 1.48 @@Param:
6918     @@@Name: anotherResource
6919     @@@Type: DISResource
6920     @@@enDesc: Another resource to compare.
6921 wakaba 1.15 @@Return:
6922     @@@Type:
6923 wakaba 1.48 DOMMain:unsigned-long::ManakaiDOM:all
6924 wakaba 1.15 @@@PerlDef:
6925 wakaba 1.48 if (UNIVERSAL::isa ($anotherResource,
6926     <ClassName::ManakaiDISResourceDefinition>)) {
6927     $r = $self->{seq} <=> $anotherResource->{seq};
6928     } else {
6929 wakaba 1.54 $r = $self->{uri} <=> $anotherResource;
6930 wakaba 1.48 }
6931 wakaba 1.15
6932     @Method:
6933 wakaba 1.54 @@ForCheck: ManakaiDOM|ForClass
6934     @@ManakaiDOM:isForInternal:1
6935     @@Name: addChildResource
6936     @@enDesc:
6937     Registers a resource as a static child of the resource.
6938     @@Param:
6939     @@@Name: disResource
6940     @@@Type: DIS|DISResource
6941     @@@enDesc:
6942     The resurce to add.
6943     @@Return:
6944     @@@PerlDef:
6945     __DEEP{
6946     push @{$self->{<H::DIS|childResource>}||=[]},
6947     $disResource-><AG::DIS|DISAnyResource.uriRef>;
6948     }__;
6949    
6950     @Method:
6951     @@ForCheck: ManakaiDOM|ForClass
6952     @@ManakaiDOM:isForInternal:1
6953     @@Name: addDynamicChildResource
6954     @@enDesc:
6955     Registers a resource as a dynamic child of the resource.
6956     @@Param:
6957     @@@Name: disResource
6958     @@@Type: DIS|DISResource
6959     @@@enDesc:
6960     The resurce to add.
6961     @@Return:
6962     @@@PerlDef:
6963     __DEEP{
6964     push @{$self->{<H::DIS|dynamicChildResource>}||=[]},
6965     $disResource-><AG::DIS|DISAnyResource.uriRef>;
6966     }__;
6967    
6968     @Method:
6969     @@Name: getChildResourceList
6970     @@enDesc:
6971     Returns the list of static child resources of the resource.
6972     @@Return:
6973     @@@Type: DIS|ResourceList
6974     @@@enDesc:
6975     The current snapshot of children.
6976     @@@PerlDef:
6977     __DEEP{
6978     my $db = $self-><AG::DIS|DISAnyResource.database>;
6979     $r = [map {
6980     $db-><M::DIS|DISDatabase.getResource> ($$_)
6981     } @{$self->{<H::DIS|childResource>}}];
6982     }__;
6983    
6984     @Method:
6985     @@Name: getDynamicChildResourceList
6986     @@enDesc:
6987     Returns the list of dynamic child resources of the resource.
6988     @@Return:
6989     @@@Type: DIS|ResourceList
6990     @@@enDesc:
6991     The current snapshot of children.
6992     @@@PerlDef:
6993     __DEEP{
6994     my $db = $self-><AG::DIS|DISAnyResource.database>;
6995     $r = [map {
6996     $db-><M::DIS|DISDatabase.getResource> ($$_)
6997     } @{$self->{<H::DIS|dynamicChildResource>}}];
6998     }__;
6999    
7000     @Method:
7001 wakaba 1.48 @@Name: getChildResourceByType
7002 wakaba 1.15 @@enDesc:
7003 wakaba 1.48 Gets a static child resource selected by its type.
7004     @@Param:
7005     @@@Name:typeURI
7006     @@@Type:ResourceURI
7007     @@@enDesc:
7008     A URI reference identifying a resource type.
7009     @@ImplNote:
7010     @@@lang:en
7011     @@@@:
7012 wakaba 1.54 {ISSUE:: Some inheritance tracing required for
7013 wakaba 1.48 e.g. <Q::DISLang:InputProcessor> and <Q::DOMMain:ReflectGet>?
7014 wakaba 1.54 }
7015 wakaba 1.15 @@Return:
7016 wakaba 1.47 @@@Type: DISResource
7017     @@@clsActualType: ManakaiDISResourceDefinition
7018 wakaba 1.15 @@@enDesc:
7019 wakaba 1.48 The first child resource (in document order) whose
7020     type matches with <P::typeURI>.
7021 wakaba 1.15 @@@nullCase:
7022     @@@@enDesc:
7023 wakaba 1.48 There is no resource whose type is <P::typeURI>.
7024 wakaba 1.15 @@@PerlDef:
7025 wakaba 1.48 __DEEP{
7026 wakaba 1.54 my $db = $self-><AG::DIS|DISAnyResource.database>;
7027     C: for my $cr_uri (@{$self->{<H::DIS:childResource>}||[]}) {
7028     my $cr = $db-><M::DIS|DISDatabase.getResource> ($$cr_uri);
7029 wakaba 1.79 if ($cr-><M::DIS|DISAnyResource.isTypeURI> ($typeURI)) {
7030 wakaba 1.48 $r = $cr;
7031 wakaba 1.54 last C;
7032 wakaba 1.48 }
7033 wakaba 1.15 }
7034 wakaba 1.48 }__;
7035 wakaba 1.15
7036 wakaba 1.48 @Method:
7037 wakaba 1.54 @@Name: getChildResourceListByType
7038     @@enDesc:
7039     Returns a list of child resources of a specific type.
7040     @@Param:
7041     @@@Name: typeURI
7042     @@@Type: DIS|AnyURI
7043     @@@enDesc:
7044     A URI of the type.
7045     @@Return:
7046     @@@Type: DIS|ResourceList
7047     @@@enDesc:
7048     The current snapshot of the child resources of type <P::typeURI>.
7049     @@@PerlDef:
7050     __DEEP{
7051     my $db = $self-><AG::DIS|DISAnyResource.database>;
7052     $r = [grep {
7053 wakaba 1.79 $_-><M::DIS|DISAnyResource.isTypeURI> ($typeURI)
7054 wakaba 1.54 } map {
7055     $db-><M::DIS|DISDatabase.getResource> ($$_)
7056     } @{$self->{<H::DIS|childResource>}||[]}];
7057     }__;
7058    
7059     @Method:
7060 wakaba 1.48 @@Name: getChildResourceByNameAndType
7061 wakaba 1.15 @@enDesc:
7062 wakaba 1.48 Gets a static child resource selected by its local name and type.
7063 wakaba 1.15 @@Param:
7064 wakaba 1.48 @@@Name: localName
7065     @@@Type:
7066     DISCore:LocalName::ManakaiDOM:all
7067 wakaba 1.15 @@@enDesc:
7068 wakaba 1.48 A local name.
7069 wakaba 1.15 @@Param:
7070 wakaba 1.48 @@@Name:typeURI
7071     @@@Type:ResourceURI
7072 wakaba 1.15 @@@enDesc:
7073 wakaba 1.48 A URI reference identifying a resource type.
7074     @@Return:
7075 wakaba 1.47 @@@Type: DISResource
7076     @@@clsActualType: ManakaiDISResourceDefinition
7077 wakaba 1.15 @@@enDesc:
7078 wakaba 1.48 The first (by document order) child resource whose
7079     type matches for <P::localName> and <P::typeURI>.
7080 wakaba 1.15 @@@nullCase:
7081     @@@@enDesc:
7082 wakaba 1.48 There is no resource whose name is <P::localName> and
7083     whose type is <P::typeURI>.
7084     @@@PerlDef:
7085     __DEEP{
7086 wakaba 1.54 my $db = $self-><AG::DIS|DISAnyResource.database>;
7087     C: for my $cr_uri (@{$self->{<H::DIS:childResource>}||[]}) {
7088     my $cr = $db-><M::DIS|DISDatabase.getResource> ($$cr_uri);
7089     my $ln = $cr-><AG::DIS|DISAnyResource.localName>;
7090 wakaba 1.48 if (defined $ln and $ln eq $localName and
7091 wakaba 1.79 $cr-><M::DIS|DISAnyResource.isTypeURI> ($typeURI)) {
7092 wakaba 1.48 $r = $cr;
7093 wakaba 1.54 last C;
7094 wakaba 1.48 }
7095     }
7096     }__;
7097    
7098     @Method:
7099     @@Name: getConstResourceByName
7100     @@enDesc:
7101     Gets a constant value resource by its local name.
7102 wakaba 1.15 @@Param:
7103 wakaba 1.48 @@@Name:localName
7104 wakaba 1.15 @@@Type:
7105 wakaba 1.48 DISLang:String::ManakaiDOM:all
7106 wakaba 1.15 @@@enDesc:
7107 wakaba 1.48 Constant name.
7108 wakaba 1.15 @@Return:
7109 wakaba 1.48 @@@Type: DISResource
7110     @@@clsActualType: ManakaiDISResourceDefinition
7111     @@@enDesc:
7112     The constant resource identified by <P::localName>.
7113     @@@nullCase:
7114 wakaba 1.16 @@@@enDesc:
7115 wakaba 1.48 There is no such constant resource.
7116 wakaba 1.15 @@@PerlDef:
7117 wakaba 1.48 __DEEP{
7118     my @constGroup;
7119 wakaba 1.54 my $db = $self-><AG::DIS|DISAnyResource.database>;
7120     C: for my $cr_uri (@{$self->{<H::DIS:childResource>}||[]}) {
7121     my $cr = $db-><M::DIS|DISDatabase.getResource> ($$cr_uri);
7122     my $ln = $cr-><AG::DIS|DISAnyResource.localName>;
7123 wakaba 1.48 if ($ln and $ln eq $localName and
7124 wakaba 1.79 $cr-><M::DIS|DISAnyResource.isTypeURI> (<Q::DISLang:Const>)) {
7125 wakaba 1.48 $r = $cr;
7126 wakaba 1.54 last C;
7127 wakaba 1.79 } elsif ($cr-><M::DIS|DISAnyResource.isTypeURI>
7128 wakaba 1.54 (<Q::DISLang:ConstGroup>)) {
7129 wakaba 1.48 push @constGroup, $cr;
7130     }
7131     }
7132     unless ($r) {
7133 wakaba 1.54 D: for my $cg (@constGroup) {
7134     $r = $cg-><M::DIS|DISResource.getChildResourceByNameAndType>
7135     ($localName, <Q::DISLang:Const>);
7136     last D if $r;
7137 wakaba 1.15 }
7138     }
7139 wakaba 1.48 }__;
7140 wakaba 1.15
7141 wakaba 1.18 @Attr:
7142 wakaba 1.54 @@Name: parentResource
7143     @@enDesc:
7144     The static parent resource of the resource.
7145     @@Type: DIS|DISResource
7146     @@nullCase:
7147     @@@enDesc: No parent resource.
7148     @@Get:
7149     @@@PerlDef:
7150     __DEEP{
7151     if ($self->{<H::DIS|parentResource>}) {
7152     $r = $self-><AG::DIS|DISAnyResource.database>
7153     -><M::DIS|DISDatabase.getResource>
7154     (${$self->{<H::DIS|parentResource>}});
7155     }
7156     }__;
7157     @@Set:
7158     @@@ForCheck: ManakaiDOM|ForClass
7159     @@@PerlDef:
7160     __DEEP{
7161     if ($given) {
7162     $self->{<H::DIS|parentResource>}
7163     = $given-><AG::DIS|DISAnyResource.uriRef>;
7164     } else {
7165     CORE::delete $self->{<H::DIS|parentResource>};
7166     }
7167     }__;
7168    
7169     @Attr:
7170     @@Name: dynamicParentResource
7171     @@enDesc:
7172     The dynamic parent resource of the resource.
7173     @@Type: DIS|DISResource
7174     @@nullCase:
7175     @@@enDesc: No parent resource.
7176     @@Get:
7177     @@@PerlDef:
7178     __DEEP{
7179     if ($self->{<H::DIS|dynamicParentResource>}) {
7180     $r = $self-><AG::DIS|DISAnyResource.database>
7181     -><M::DIS|DISDatabase.getResource>
7182     (${$self->{<H::DIS|dynamicParentResource>}});
7183     }
7184     }__;
7185     @@Set:
7186     @@@ForCheck: ManakaiDOM|ForClass
7187     @@@PerlDef:
7188     __DEEP{
7189     if ($given) {
7190     $self->{<H::DIS|dynamicParentResource>}
7191     = $given-><AG::DIS|DISAnyResource.uriRef>;
7192     } else {
7193     CORE::delete $self->{<H::DIS|dynamicParentResource>};
7194     }
7195     }__;
7196    
7197     @Attr:
7198 wakaba 1.48 @@Name: ownerClassNodeURI
7199 wakaba 1.18 @@enDesc:
7200 wakaba 1.48 The node URI reference of the class resource this resource
7201     belongs to.
7202     @@Type: ResourceURI
7203 wakaba 1.18 @@Get:
7204 wakaba 1.48 @@@enDesc:
7205     The URI reference of the <Q::ManakaiDOM:Class> resource.
7206     If this resource is a class, then the URI reference
7207     of this resource is returned.
7208     @@@nullCase:
7209 wakaba 1.18 @@@@enDesc:
7210 wakaba 1.48 This resource does not belong to any class.
7211 wakaba 1.18 @@@PerlDef:
7212 wakaba 1.53 if (exists $self->{<H::DIS:ownerClass>}) {
7213     $r = $self->{<H::DIS:ownerClass>};
7214 wakaba 1.48 } else {
7215     my $res = $self;
7216     __DEEP{
7217     RES: {
7218 wakaba 1.79 if ($res-><M::DISAnyResource.isTypeURI>
7219 wakaba 1.48 (<Q::ManakaiDOM:Class>)) {
7220     $r = $res-><AG::DISAnyResource.sourceNodeID>;
7221     } else {
7222 wakaba 1.54 $res = $res-><AG::DIS|DISResource.parentResource>;
7223 wakaba 1.48 redo RES if $res;
7224     }
7225 wakaba 1.18 }
7226 wakaba 1.48 }__;
7227 wakaba 1.53 $self->{<H::DIS:ownerClass>} = $r;
7228 wakaba 1.48 }
7229 wakaba 1.18
7230     @Attr:
7231     @@Name: disIsNullValue
7232     @@enDesc:
7233     Whether this resource have <DOM::null> value or not.
7234     A resource have <DOM::null> value iff it has
7235     <Q::dis:Value> attribute node that in turn has
7236     <Q::dis:is-null> attribute whose value set to <DOM::true>.
7237     @@Type:
7238     DOMMain:boolean::ManakaiDOM:all
7239     @@Get:
7240     @@@PerlDef:
7241 wakaba 1.51 if ($self->{<Q::dis:Value>}) {
7242     $r = $self->{<Q::dis:Value>}-><AG::dv|DVValue.isNull>;
7243 wakaba 1.18 }
7244 wakaba 1.24
7245     @Attr:
7246     @@Name: featureNameList
7247     @@enDesc:
7248     The list of the names of the feature defined by this resource.
7249 wakaba 1.48
7250     = If the resource has one or more <Q::dis:AppName> attributes,
7251     their text values are feature names.
7252    
7253     = If there is no <Q::dis:AppName> attributes but the resource
7254     is a <Q::DOMFeature:instanceOf> another feature, then
7255     the set of the feature names of the resource is equal
7256     to the one of another feature's feature names.
7257    
7258     {OLI:: If two operation above does not result in one or more
7259     feature names,
7260    
7261     = and if the resource has a name (the <A::DISAnyResource
7262     .isAnonymous> attribute returns <DOM::false>), then
7263     the <A::DISAnyResource.nameURI> of the resource is
7264     a feature name.
7265    
7266     = otherwise, i.e. <A::DISAnyResource.isAnonymous> is
7267     <DOM::true>, then the <A::DISAnyResource.localName>
7268     of the resource, if non-<DOM::null>, is a feature name.
7269    
7270     }
7271    
7272 wakaba 1.24 @@Type:
7273 wakaba 1.60 DISPerl:ARRAY::ManakaiDOM:all
7274 wakaba 1.24 @@Get:
7275 wakaba 1.48 @@@enDesc:
7276     A reference to the array containing feature names.
7277     Note that the order in the array is <EM::not> significant.
7278     The array might be empty if the resource has no feature name.
7279     This array is dead.
7280    
7281     {NOTE:: The attribute value array might be non-empty
7282     even if the resource is not of type <Q::DOMFeature:Feature>
7283     as far as the algorithm defined above returns
7284     some feature names.
7285     }
7286 wakaba 1.24 @@@RaiseException:
7287     @@@@@:UNSUPPORTED_MEDIA_TYPE_ERR
7288     @@@@enDesc:
7289     There is an <Q::dis:AppName> attribute whose media
7290     type is not supported.
7291     @@@RaiseException:
7292     @@@@@: NO_SOURCE_NODE_ERR
7293     @@@@enDesc:
7294     This resource definition does not have associated node
7295     in the source tree.
7296     @@@PerlDef:
7297     __DEEP{
7298 wakaba 1.49 $r = [map {lc} @{$self-><M::DISResourceProp.getPropertyTextList>
7299 wakaba 1.52 (<Q::DOMFeature:name>)}];
7300 wakaba 1.24 unless (@$r) {
7301 wakaba 1.48 ## TODO: instance feature
7302 wakaba 1.54 my $pr = $self-><AG::DIS|DISResource.parentResource>;
7303 wakaba 1.28 if ($pr) {
7304 wakaba 1.79 if ($pr-><M::DISAnyResource.isTypeURI> (<Q::DOMFeature:Feature>) and
7305 wakaba 1.48 not $pr-><AG::DISAnyResource.isAnonymous>) {
7306     push @$r, @{$pr-><AG::DISResource.featureNameList>};
7307 wakaba 1.28 }
7308     }
7309     }
7310     unless (@$r) {
7311 wakaba 1.48 if ($self-><AG::DISAnyResource.isAnonymous>) {
7312     my $ln = $self-><AG::DISAnyResource.localName>;
7313 wakaba 1.28 push @$r, lc $ln if defined $ln;
7314 wakaba 1.24 } else {
7315 wakaba 1.48 push @$r, lc $self-><AG::DISAnyResource.nameURI>;
7316     }
7317     }
7318     }__;
7319    
7320     @Method:
7321     @@ForCheck: ManakaiDOM|ForClass
7322     @@Name: getFeature
7323     @@Description:
7324     @@@lang:en
7325     @@@@:
7326     Returns a specialized object that implements the specialized
7327     interfaces of the specified feature and version.
7328     @@Param:
7329     @@@Name: feature
7330     @@@Type:
7331     DISLang:String::ManakaiDOM:all
7332     @@@actualType:
7333     ManakaiDOM:ManakaiDOMFeatureName::ManakaiDOM:ManakaiDOMLatest
7334     @@@Description:
7335     @@@@lang:en
7336     @@@@@:
7337     A feature name to request.
7338     @@Param:
7339     @@@Name: version
7340     @@@Type:
7341     DISLang:String::ManakaiDOM:all
7342     @@@actualType:
7343     ManakaiDOM:ManakaiDOMFeatureVersion::ManakaiDOM:ManakaiDOMLatest
7344     @@@Description:
7345     @@@@lang:en
7346     @@@@@:
7347     A feature version number to request.
7348     @@Return:
7349     @@@Type:
7350     DOMMain:Object::ManakaiDOM:all
7351     @@@Description:
7352     @@@@lang:en
7353     @@@@@:
7354     An object that implements the specialized APIs of the
7355     <P::feature> and <P::version>.
7356 wakaba 1.49 @@@nullCase:
7357     @@@@enDesc:
7358 wakaba 1.48 There is no object available that implements interfaces
7359     associated with the <P::feature> and <P::version>.
7360     @@@PerlDef:
7361     $feature =~ s/^\+//;
7362     CLASS: for my $class (grep {
7363     $Message::Util::DIS::ManakaiDISResourceDefinition::CompatClass{$_}
7364     } keys %Message::Util::DIS::ManakaiDISResourceDefinition::CompatClass){
7365     if ($Message::DOM::ClassFeature{$class}->{$feature}->{$version}) {
7366     $r = bless {o => $self}, $class;
7367     last CLASS;
7368 wakaba 1.24 }
7369     }
7370 wakaba 1.48
7371     @Attr:
7372     @@Name: multiplePropertiesURI
7373     @@enDesc:
7374     Whether the property allows multiple occurence of the attribute
7375     in the <QUOTE::dis> source tree.
7376     @@Type: DISLang|String||ManakaiDOM|all
7377     @@Get:
7378     @@@PerlDef:
7379     __DEEP{
7380     if ($self->{<Q::dis|multipleProperties>}) {
7381     $r = $self->{<Q::dis|multipleProperties>}
7382     -><M::dv|DVURIValue.getResource>
7383     ($self-><AG::DISAnyResource.database>)
7384     -><AG::DISAnyResource.uri>;
7385     } else {
7386     $r = <Q::DISCore|OrderedList>;
7387     }
7388     }__;
7389    
7390     @Attr:
7391     @@Name: defaultLextypeURI
7392     @@enDesc:
7393     The URI of the default lexical type for the <QUOTE::dis> attribute.
7394     @@Type: DISLang|String||ManakaiDOM|all
7395     @@Get:
7396     @@@PerlDef:
7397     __DEEP{
7398     if ($self->{<Q::dis:dataType>}) {
7399     $r = $self->{<Q::dis:dataType>}
7400     -><M::dv|DVURIValue.getResource>
7401     ($self-><AG::DISAnyResource.database>)
7402     -><AG::DISAnyResource.uri>;
7403     } else {
7404     $r = <Q::DISCore|String>;
7405     }
7406 wakaba 1.24 }__;
7407 wakaba 1.79
7408     @CMethod:
7409     @@Name: getSuperResourceURIList
7410     @@enDesc:
7411     Returns a snapshot list of super-resources URIs of the resource,
7412     including canonical and alias URIs of the resource itself.
7413     @@Return:
7414     @@@Type: URIList
7415     @@@enDesc:
7416     A snapshot list of URIs.
7417     @@@PerlDef:
7418     $r = [
7419     (grep {$self->{subOf}->{$_}} keys %{$self->{subOf}}),
7420     (grep {$self->{aliasURI}->{$_}} keys %{$self->{aliasURI}}),
7421     ];
7422    
7423     @@Test:
7424     @@@QName: DISResource.getSuperResourceURIList.test
7425     @@@PerlDef:
7426     my $db;
7427     __CODE{createDISDBForTest:: $db => $db}__;
7428    
7429     my $res1 = $db->get_resource ('about:test1');
7430     my $res2 = $db->get_resource ('about:test2');
7431     $res1->add_super_resource ($res2);
7432    
7433     my %list1 = map {$_ => true} @{$res1->get_super_resource_uri_list};
7434     $test->id ('res1.itself');
7435     $test->assert_true ($list1{'about:test1'});
7436     $test->id ('res1.res2');
7437     $test->assert_true ($list1{'about:test2'});
7438    
7439     my %list2 = map {$_ => true} @{$res2->get_super_resource_uri_list};
7440     $test->id ('res2.itself');
7441     $test->assert_true ($list2{'about:test2'});
7442     $test->id ('res2.res1');
7443     $test->assert_false ($list2{'about:test1'});
7444    
7445     @Method:
7446     @@ForCheck: ManakaiDOM|ForIF
7447     @@Name: isTypeURI
7448     @@enImplNote: For compatibility with old code.
7449 wakaba 1.48 ##DISResource
7450    
7451 wakaba 1.79 ResourceDef:
7452     @QName: String
7453     @AliasFor: DISLang|String||ManakaiDOM|all
7454     @For: DIS|ForEmpty
7455    
7456     ResourceDef:
7457     @QName: RevisionNumber
7458     @AliasFor: idl|unsignedLong||ManakaiDOM|all
7459     @For: DIS|ForEmpty
7460     @enImplNote:
7461     {ISSUE::
7462     Should be <Q::idl|unsignedLongLong||ManakaiDOM|all>?
7463     }
7464    
7465     PropDef:
7466     @QName: DIS|revision
7467     @DIS:key: r
7468    
7469     ElementTypeBinding:
7470     @Name: Test
7471     @ElementType:
7472     dis:ResourceDef
7473     @ShadowContent:
7474     @@rdf:type: test|StandaloneTest
7475     @@ForCheck: ManakaiDOM|ForClass
7476    
7477     DataTypeDef:
7478     @QName: URIList
7479     @rdfs:subClassOf: DISPerl|ARRAY||ManakaiDOM|all
7480    
7481 wakaba 1.48 IFClsDef:
7482     @IFQName: DISResourceMV
7483     @ClsQName: ManakaiDISResourceMV
7484    
7485     @enDesc:
7486     The objects implementing the <IF::DISResourceMV> <kwd:MUST>
7487     also implement the <IF::DISResource> interface.
7488 wakaba 1.32
7489     @Attr:
7490     @@Name: mvLocalName
7491     @@enDesc:
7492     The local name of the markup vocabulary element defined by this
7493     resource.
7494     @@Type:
7495     DISLang:String::ManakaiDOM:all
7496     @@Get:
7497     @@@nullCase:
7498     @@@@enDesc:
7499     Either this resource does not define a markup vocabulary element
7500     or it does define an element but it does not have a local name.
7501     @@@PerlDef:
7502     __DEEP{
7503 wakaba 1.48 if (UNIVERSAL::isa ($self->{<Q::dis|AppName>},
7504     <IFName::dv|DVQNameValue>)) {
7505     $r = $self->{<Q::dis|AppName>}-><AG::dv|DVQNameValue.localName>;
7506 wakaba 1.96 } elsif (defined $self->{<Q::dis|AppName>}) {
7507     $r = $self->{<Q::dis|AppName>}-><AG::dv|DVValue.stringValue>;
7508 wakaba 1.43 } else {
7509 wakaba 1.59 $r = $self-><AG::DIS|DISAnyResource.localName>;
7510 wakaba 1.43 }
7511     }__;
7512    
7513     @Attr:
7514     @@Name: mvPrefix
7515     @@enDesc:
7516     A typical namespace prefix of the markup vocabulary element defined
7517     by this resource.
7518     @@Type:
7519     DISLang:String::ManakaiDOM:all
7520     @@Get:
7521     @@@nullCase:
7522     @@@@enDesc:
7523     Either this resource does not define a markup vocabulary element
7524     or it does define an element but it does not have a namespace URI.
7525     @@@PerlDef:
7526     __DEEP{
7527 wakaba 1.48 if (UNIVERSAL::isa ($self->{<Q::dis|AppName>},
7528     <IFName::dv|DVQNameValue>)) {
7529     $r = $self->{<Q::dis|AppName>}-><AG::dv|DVQNameValue.prefix>;
7530 wakaba 1.43 }
7531     unless (defined $r) {
7532 wakaba 1.48 my $nsuri = $self-><AG::DISResourceMV.mvNamespaceURI>;
7533 wakaba 1.43 if (defined $nsuri and $nsuri =~ /([A-Za-z]\w*)\W*$/) {
7534 wakaba 1.53 $r = $1;
7535 wakaba 1.43 } elsif (defined $nsuri) {
7536 wakaba 1.53 $r = 'ns';
7537 wakaba 1.43 }
7538 wakaba 1.32 }
7539     }__;
7540    
7541     @Attr:
7542     @@Name: mvNamespaceURI
7543     @@enDesc:
7544     The namespace URI of the markup vocabulary element defined by this
7545     resource.
7546     @@Type: AnyURI
7547     @@Get:
7548     @@@nullCase:
7549     @@@@enDesc:
7550     Either this resource does not define a markup vocabulary element
7551     or it does define an element but it does not have a namespace URI.
7552     @@@PerlDef:
7553     __DEEP{
7554 wakaba 1.48 if (UNIVERSAL::isa ($self->{<Q::dis|AppName>},
7555     <IFName::dv|DVQNameValue>)) {
7556     $r = $self->{<Q::dis|AppName>}-><AG::dv|DVQNameValue.namespaceURI>;
7557 wakaba 1.96 } elsif (defined $self->{<Q::dis|AppName>}) {
7558     $r = null;
7559 wakaba 1.32 } else {
7560 wakaba 1.59 $r = $self-><AG::DIS|DISAnyResource.namespaceURI>;
7561 wakaba 1.32 }
7562     }__;
7563    
7564     @Attr:
7565     @@Name: mvOwnerElementResource
7566     @@enDesc:
7567     An <QUOTE::owner element> resource of the markup vocabulary
7568     element defined by this resource.
7569 wakaba 1.47 @@Type: DISResource
7570     @@clsActualType: ManakaiDISResourceDefinition
7571 wakaba 1.32 @@Get:
7572     @@@nullCase:
7573     @@@@enDesc:
7574     Either this resource does not define a markup vocabulary element
7575     or it does define an element but it does not have an owner.
7576     @@@PerlDef:
7577     __DEEP{
7578 wakaba 1.53 if (exists $self->{<H::DIS:mvOwnerElementURI>}) {
7579 wakaba 1.98 $r = $self-><AG::DISAnyResource.database>
7580     -><M::DISDatabase.getResource>
7581 wakaba 1.53 ($self->{<H::DIS:mvOwnerElementURI>})
7582     if defined $self->{<H::DIS:mvOwnerElementURI>};
7583 wakaba 1.54 } else {
7584     $r = $self-><AG::DIS|DISResource.parentResource>;
7585 wakaba 1.90 undef $r if $r and not $r-><M::DIS|DISAnyResource
7586 wakaba 1.32 .isTypeURI> (<Q::s:AnyOwnerElement>);
7587 wakaba 1.98 $self->{<H::DIS:mvOwnerElementURI>} = $r-><AG::DISAnyResource.uri>
7588     if $r;
7589 wakaba 1.32 }
7590 wakaba 1.48 }__;
7591     ##DISResourceMV
7592 wakaba 1.27
7593     PropDef:
7594 wakaba 1.32 @QName: mvLocalName
7595     @enDesc:
7596     <A::ManakaiDISResourceDefinition.mvLocalName>.
7597    
7598     PropDef:
7599 wakaba 1.43 @QName: mvPrefix
7600     @enDesc:
7601     <A::ManakaiDISResourceDefinition.mvPrerix>.
7602    
7603     PropDef:
7604 wakaba 1.32 @QName: mvNamespaceURI
7605     @enDesc:
7606     <A::ManakaiDISResourceDefinition.mvNamespaceURI>.
7607    
7608     PropDef:
7609     @QName: mvOwnerElementURI
7610     @enDesc:
7611     <A::ManakaiDISResourceDefinition.mvOwnerElementResource>
7612     (<QUOTE::dis> resource URI reference).
7613    
7614     PropDef:
7615 wakaba 1.13 @QName: ownerClass
7616     @enDesc:
7617     The class to which this resource belongs.
7618     @Type: ResourceURI
7619     @rdfs:range:
7620     rdf:Resource
7621     @rdfs:domain:
7622     ManakaiDOM:Class
7623    
7624 wakaba 1.12 ResourceDef:
7625     @QName: DOMMinImpl
7626     @AliasFor:
7627 wakaba 1.46 DOMFeature:GetFeature::ManakaiDOM:ManakaiDOMLatest
7628 wakaba 1.49 @For: DIS|ForEmpty
7629 wakaba 1.20
7630     ResourceDef:
7631 wakaba 1.12 @QName: SWCFGNode
7632     @AliasFor:
7633     swcfg21:SWCFGNode::swcfg21:ForLatest
7634 wakaba 1.49 @For: DIS|ForEmpty
7635 wakaba 1.12
7636     ResourceDef:
7637 wakaba 1.48 @QName: SWCFGElement
7638     @AliasFor:
7639     swcfg21:SWCFGElement::swcfg21:ForLatest
7640 wakaba 1.49 @For: DIS|ForEmpty
7641 wakaba 1.48
7642     ResourceDef:
7643 wakaba 1.12 @QName: SWCFGDoc
7644     @AliasFor:
7645     swcfg21:SWCFGDocument::swcfg21:ForLatest
7646 wakaba 1.49 @For: DIS|ForEmpty
7647 wakaba 1.12
7648     XParamDef:
7649 wakaba 1.48 @QName: sourceNodePath
7650     @enDesc:
7651     A node path string of the source node.
7652    
7653     XParamDef:
7654 wakaba 1.12 @QName: errResource
7655     @enDesc:
7656     A resource on which an error has occurred.
7657    
7658 wakaba 1.8 XParamDef:
7659     @QName: generatedName
7660     @enDesc:
7661     A generated name.
7662    
7663 wakaba 1.47 IFClsDef:
7664     @IFQName: DISResourceProp
7665 wakaba 1.2 @ClsQName: ManakaiDISPropertyAccessor
7666 wakaba 1.47
7667 wakaba 1.3 @enDesc:
7668 wakaba 1.2 Accessor methods for resource or module properties.
7669 wakaba 1.48
7670     @Method:
7671     @@Name: getPropertyValue
7672 wakaba 1.22 @@enDesc:
7673 wakaba 1.48 Returns a property value object.
7674     @@PropNameParam:
7675     @@Return:
7676     @@@Type: dv|DVValue
7677     @@@enDesc: The property value.
7678 wakaba 1.22 @@@nullCase:
7679     @@@@enDesc:
7680 wakaba 1.48 The property has no value.
7681 wakaba 1.22 @@@PerlDef:
7682 wakaba 1.52 if ($self->{$propName}) {
7683 wakaba 1.54 $r = $self->{$propName}->[0];
7684 wakaba 1.52 } else {
7685     my $pr = $self-><AG::DISAnyResource.database>
7686     -><M::DISDatabase.getResource> ($propName);
7687 wakaba 1.53 A: for (grep {$pr->{aliasURI}->{$_} or $pr->{supOf}->{$_}}
7688     (keys %{$pr->{aliasURI}}, keys %{$pr->{supOf}||{}})) {
7689 wakaba 1.52 my $v = $self->{$_};
7690     if ($v) {
7691     $r = $v->[0];
7692     last A;
7693     }
7694     }
7695     }
7696 wakaba 1.22
7697 wakaba 1.48 @Method:
7698     @@Name: getPropertyValueList
7699 wakaba 1.22 @@enDesc:
7700 wakaba 1.48 Returns a property value objects.
7701     @@PropNameParam:
7702     @@Return:
7703 wakaba 1.60 @@@Type: DISPerl|ARRAY||ManakaiDOM|all
7704 wakaba 1.48 @@@enDesc: The property value.
7705     @@@PerlDef:
7706     my $pr = $self-><AG::DISAnyResource.database>
7707     -><M::DISDatabase.getResource> ($propName);
7708     $r = [map {@$_}
7709 wakaba 1.49 grep {defined $_}
7710 wakaba 1.48 map {$self->{$_}}
7711 wakaba 1.53 grep {$pr->{aliasURI}->{$_} or $pr->{supOf}->{$_}}
7712     (keys %{$pr->{aliasURI}}, keys %{$pr->{supOf}||{}})];
7713 wakaba 1.22
7714 wakaba 1.2 @Method:
7715 wakaba 1.8 @@Name: getPropertyBoolean
7716     @@enDesc:
7717     Gets boolean property value.
7718     @@PropNameParam:
7719     @@Param:
7720     @@@Name:default
7721     @@@Type:
7722     DOMMain:boolean::ManakaiDOM:all
7723     @@@enDesc:
7724     The default value that is returned if no explicit property
7725     value specification found for this resource.
7726     @@Return:
7727     @@@Type:
7728     DOMMain:boolean::ManakaiDOM:all
7729     @@@enDesc:
7730     The property value.
7731     @@@PerlDef:
7732 wakaba 1.48 if (ref $self->{$propName}) {
7733     $r = $self->{$propName}-><AG::dv|DVValue.value> ? true : false;
7734 wakaba 1.8 $r = $default unless defined $r;
7735     } else {
7736 wakaba 1.48 my $pr = $self-><AG::DISAnyResource.database>
7737     -><M::DISDatabase.getResource> ($propName);
7738     C: {
7739     for (map {$self->{$_}}
7740 wakaba 1.53 grep {$pr->{aliasURI}->{$_} or $pr->{supOf}->{$_}}
7741     (keys %{$pr->{aliasURI}}, keys %{$pr->{supOf}||{}})) {
7742 wakaba 1.48 if (defined $_) {
7743     $r = $_-><AG::dv|DVValue.value> ? true : false;
7744     last C;
7745     }
7746     }
7747     $r = $default;
7748     } # C
7749 wakaba 1.8 }
7750    
7751     @Method:
7752 wakaba 1.2 @@Name: getPropertyText
7753     @@enDesc:
7754     Gets property value text.
7755     @@PropNameParam:
7756     @@Param:
7757     @@@Name:default
7758     @@@Type:
7759 wakaba 1.3 swcfg21:SWCFGString::swcfg21:ForLatest
7760 wakaba 1.2 @@@enDesc:
7761     The default value that is returned if no explicit property
7762     value specification found for this resource.
7763     @@@nullCase:
7764     @@@@enDesc:
7765     No default value supplied; <DOM::null> is returned if
7766     no value specified.
7767     @@Return:
7768     @@@Type:
7769 wakaba 1.3 swcfg21:SWCFGString::swcfg21:ForLatest
7770 wakaba 1.2 @@@enDesc:
7771     The property value string.
7772     @@@nullCase:
7773     @@@@enDesc:
7774     No value nor default value has specified.
7775     @@@PerlDef:
7776 wakaba 1.48 if (defined $self->{$propName}) {
7777     $r = $self->{$propName}-><AG::dv|DVValue.stringValue>;
7778     $r = $default unless defined $r;
7779     } else {
7780     my $pr = $self-><AG::DISAnyResource.database>
7781     -><M::DISDatabase.getResource> ($propName);
7782     C: {
7783     for (map {$self->{$_}}
7784 wakaba 1.53 grep {$pr->{aliasURI}->{$_} or $pr->{supOf}->{$_}}
7785     (keys %{$pr->{aliasURI}}, keys %{$pr->{supOf}||{}})) {
7786 wakaba 1.48 if (defined $_) {
7787     $r = $_-><AG::dv|DVValue.stringValue>;
7788     last C;
7789     }
7790     }
7791 wakaba 1.8 $r = $default;
7792 wakaba 1.48 } # C
7793 wakaba 1.2 }
7794    
7795     @Method:
7796 wakaba 1.48 @@Name: getPropertyTextList
7797     @@enDesc:
7798     Returns a list of property value text.
7799     @@PropNameParam:
7800     @@MediaTypeDefaultParam:
7801     @@Return:
7802 wakaba 1.60 @@@Type: DISPerl|ARRAY||ManakaiDOM|all
7803 wakaba 1.48 @@@enDesc:
7804     A list of the property value strings.
7805     @@@RaiseException:
7806     @@@@@:UNSUPPORTED_MEDIA_TYPE_ERR
7807     @@@@enDesc:
7808     There is an attribute whose media
7809     type is not supported.
7810     @@@PerlDef:
7811     my $pr = $self-><AG::DISAnyResource.database>
7812     -><M::DISDatabase.getResource> ($propName);
7813     $r = [map {$_-><AG::dv|DVValue.stringValue>}
7814     map {@$_}
7815     grep {$_}
7816     map {$self->{$_}}
7817 wakaba 1.53 grep {$pr->{aliasURI}->{$_} or $pr->{supOf}->{$_}}
7818     (keys %{$pr->{aliasURI}}, keys %{$pr->{supOf}||{}})];
7819 wakaba 1.48
7820     @Method:
7821 wakaba 1.2 @@Name: getPropertyResource
7822     @@enDesc:
7823     Gets property value resource.
7824     @@PropNameParam:
7825 wakaba 1.10 @@NamedParam:
7826     @@@Name: defaultMediaType
7827     @@@Type: ResourceURI
7828     @@@enDesc:
7829     The URI reference of the default media type which is used
7830     when the property value is retrieved from the source tree
7831     and the source tree element does not have its <Q::dis:ContentType>
7832     attribute specified.
7833     @@@nullCase:
7834     @@@@enDesc:
7835 wakaba 1.68 Defaulted to <Q::DISCore:QName>.
7836 wakaba 1.2 @@Return:
7837 wakaba 1.61 @@@Type: DIS|DISAnyResource
7838 wakaba 1.2 @@@enDesc:
7839     The property value resource.
7840     @@@nullCase:
7841     @@@@enDesc:
7842     No value has specified.
7843 wakaba 1.8 @@@UndeclaredPrefixException:
7844 wakaba 1.12 @@@RaiseException:
7845     @@@@@:UNSUPPORTED_MEDIA_TYPE_ERR
7846     @@@@enDesc:
7847     The media type of the attribute node in the source tree
7848     corresponding to this resource is not supported.
7849 wakaba 1.2 @@@PerlDef:
7850 wakaba 1.48 __DEEP{
7851     my $v = $self-><M::DISResourceProp.getPropertyValue>
7852     ($propName);
7853     if (UNIVERSAL::isa ($v, <IFName::dv|DVURIValue>)) {
7854 wakaba 1.62 $r = $v-><M::dv|DVURIValue.getResource>
7855 wakaba 1.48 ($self-><AG::DISAnyResource.database>);
7856     }
7857     }__;
7858 wakaba 1.2
7859     @Method:
7860 wakaba 1.10 @@Name: getPropertyResourceList
7861     @@enDesc:
7862     Gets property value resource list.
7863     @@PropNameParam:
7864     @@NamedParam:
7865 wakaba 1.24 @@@Name: recursive
7866     @@@Type:
7867     DOMMain:boolean::ManakaiDOM:all
7868     @@@enDesc:
7869     Whether property resource values of this resource
7870     should also be included to the returned list or not.
7871     @@NamedParam:
7872 wakaba 1.10 @@@Name: recursiveISA
7873     @@@Type:
7874 wakaba 1.18 DOMMain:boolean::ManakaiDOM:all
7875 wakaba 1.10 @@@enDesc:
7876 wakaba 1.26 Whether the <Q::dis:ISA> ancestors of the resources
7877     that are property values should also be included in the returned list
7878     or not.
7879     @@@TrueCase:
7880     @@@@enDesc:
7881     If a property value is a resource <VAR::R> and
7882     the resource <VAR::R> <Q::dis:ISA>'s (or inherits) <VAR::S>, then
7883     the resource <VAR::S> is also a value in the list.
7884     @@@FalseCase:
7885     @@@@enDesc:
7886     Only the resources directly specified as property values is returned.
7887     @@NamedParam:
7888     @@@Name: isaRecursive
7889     @@@Type:
7890     DOMMain:boolean::ManakaiDOM:all
7891     @@@enDesc:
7892     Whether property resource values of <Q::dis:ISA> resources
7893     of this resource should also be included to the returned list or not.
7894     @@@TrueCase:
7895     @@@@enDesc:
7896     If this resource <Q::dis:ISA>'s (or inherits) another resource
7897     <VAR::S> and the <VAR::S> resource has a <P::propName>
7898     property value of <VAR::R>, then the resource <VAR::R>
7899     is also a value in the list.
7900     @@@FalseCase:
7901     @@@@enDesc:
7902     Only the resource directly specified is the returned.
7903 wakaba 1.10 @@NamedParam:
7904     @@@Name: defaultMediaType
7905     @@@Type: ResourceURI
7906     @@@enDesc:
7907     The URI reference of the default media type which is used
7908     when the property value is retrieved from the source tree
7909     and the source tree element does not have its <Q::dis:ContentType>
7910     attribute specified.
7911     @@@nullCase:
7912     @@@@enDesc:
7913 wakaba 1.68 Defaulted to <Q::DISCore:QName>.
7914 wakaba 1.10 @@Return:
7915     @@@Type: ResourceList
7916     @@@enDesc:
7917     An array reference of the property value resources.
7918     \
7919     {NOTE:: This list is <QUOTE::dead>.
7920     \
7921     }
7922     @@@UndeclaredPrefixException:
7923 wakaba 1.12 @@@RaiseException:
7924     @@@@@:UNSUPPORTED_MEDIA_TYPE_ERR
7925     @@@@enDesc:
7926     The media type of the attribute node in the source tree
7927     corresponding to this resource is not supported.
7928 wakaba 1.10 @@@PerlDef:
7929     $r = [];
7930 wakaba 1.48 __DEEP{
7931     my $v = $self-><M::DISResourceProp.getPropertyValueList> ($propName);
7932     my $db = $self-><AG::DISAnyResource.database>;
7933     for my $a (@$v) {
7934     if ($a->isa (<IFName::dv|DVURIValue>)) {
7935 wakaba 1.62 push @$r, $a-><M::dv|DVURIValue.getResource> ($db);
7936 wakaba 1.48 }
7937     if ($isaRecursive) {
7938     my $b = $a-><M::dv|DVValue.getProperty>
7939     (<Q::DISCore:stopISARecursive>);
7940     if ($b and $b-><AG::dv|DVValue.value>) {
7941     $isaRecursive = false;
7942 wakaba 1.32 }
7943 wakaba 1.10 }
7944 wakaba 1.48 }
7945     }__;
7946    
7947 wakaba 1.24 if ($recursive) {
7948     __DEEP{
7949 wakaba 1.98 $opt{___recursive_isa_done} ||= {$self-><AG::anyres.uri> => true};
7950 wakaba 1.24 my @p_res = @$r;
7951     for my $p_res (@p_res) {
7952 wakaba 1.98 my $p_res_uri = $p_res-><AG::anyres.uri>;
7953     next if $opt{___recursive_isa_done}->{$p_res_uri};
7954     $opt{___recursive_isa_done}->{$p_res_uri} = true;
7955 wakaba 1.48 push @$r, @{$p_res-><M::DISResourceProp.getPropertyResourceList>
7956 wakaba 1.24 ($propName, recursive => true,
7957     recursive_isa => $recursiveISA,
7958     ___recursive_isa_done => $opt{___recursive_isa_done},
7959     default_media_type => $defaultMediaType)};
7960     }
7961     }__;
7962     }
7963 wakaba 1.10 if ($recursiveISA) {
7964     __DEEP{
7965 wakaba 1.98 $opt{___recursive_isa_done} ||= {$self-><AG::anyres.uri> => true};
7966 wakaba 1.10 my @p_res = @$r;
7967     for my $p_res (@p_res) {
7968 wakaba 1.98 my $p_res_uri = $p_res-><AG::anyres.uri>;
7969     next if $opt{___recursive_isa_done}->{$p_res_uri};
7970     $opt{___recursive_isa_done}->{$p_res_uri} = true;
7971 wakaba 1.48 push @$r, @{$p_res-><M::DISResourceProp.getPropertyResourceList>
7972 wakaba 1.33 (<Q::dis:ISA>,
7973     recursive => true,
7974 wakaba 1.10 ___recursive_isa_done => $opt{___recursive_isa_done},
7975     default_media_type => $defaultMediaType)};
7976     }
7977     }__;
7978     }
7979 wakaba 1.26 if ($isaRecursive) {
7980 wakaba 1.25 __DEEP{
7981 wakaba 1.98 my $self_uri = $self-><AG::anyres.uri>;
7982     $opt{___recursive_isa_done} ||= {$self_uri => true};
7983     $opt{___isa_recursive_done} ||= {$self_uri => true};
7984 wakaba 1.48 my @p_res = @{$self-><M::DISResourceProp.getPropertyResourceList>
7985 wakaba 1.26 (<Q::dis:ISA>, recursive_isa => false,
7986 wakaba 1.37 recursive => false,
7987 wakaba 1.26 default_media_type => <Q::dis:TFQNames>)};
7988 wakaba 1.25 for my $p_res (@p_res) {
7989 wakaba 1.98 my $p_res_uri = $p_res-><AG::anyres.uri>;
7990     next if $opt{___isa_recursive_done}->{$p_res_uri};
7991     $opt{___isa_recursive_done}->{$p_res_uri} = true;
7992 wakaba 1.48 push @$r, @{$p_res-><M::DISResourceProp.getPropertyResourceList>
7993 wakaba 1.26 ($propName, recursive_isa => false,
7994     recursive => false,
7995 wakaba 1.37 isa_recursive => true,
7996     ___isa_recursive_done =>
7997     $opt{___isa_recursive_done},
7998 wakaba 1.26 default_media_type => $defaultMediaType)};
7999 wakaba 1.25 }
8000     }__;
8001     }
8002 wakaba 1.60
8003     @Method:
8004 wakaba 1.2 @@Name: addPropertyResourceList
8005     @@enDesc:
8006     Adds a resource to a resource-list property value.
8007     \
8008     {ISSUE:: Should an exception be thrown if the property is
8009     not of list?
8010     \
8011     }
8012 wakaba 1.10 \
8013     {NOTE:: If the property is not <QUOTE::get>ten ever, adding
8014     an item clears the list --- i.e. the property values
8015     in the source tree will be ignored. Call
8016     <M::ManakaiDISPropertyAccessor.getPropertyResourceList>
8017     before adding to avoid this behavior.
8018     \
8019     }
8020 wakaba 1.2 @@PropNameParam:
8021     @@Param:
8022     @@@Name: res
8023 wakaba 1.47 @@@Type: DISResource
8024     @@@clsActualType: ManakaiDISResourceDefinition
8025 wakaba 1.2 @@@enDesc:
8026     A resource to add.
8027     @@Return:
8028     @@@PerlDef:
8029 wakaba 1.48 if ($self->{$propName}) {
8030     my $uriv;
8031     __CODE{dv|createURI::
8032     $uri => {$res-><AG::DISAnyResource.uri>},
8033     $result => $uriv,
8034 wakaba 1.60 $name => $propName,
8035 wakaba 1.48 }__;
8036     $self->{$propName}-><M::dv|DVList.addItem> ($uriv);
8037     } else {
8038     __CODE{dv|createOrderedList::
8039     $result => {$self->{$propName}},
8040     $type => {<Q::DISCore:URI>},
8041     $base_type => {<Q::DISCore:URI>},
8042     }__;
8043     my $uriv;
8044     __CODE{dv|createURI::
8045     $uri => {$res-><AG::DISAnyResource.uri>},
8046     $result => $uriv,
8047 wakaba 1.60 $name => $propName,
8048 wakaba 1.48 }__;
8049     $self->{$propName}-><M::dv|DVList.addItem> ($uriv);
8050     }
8051    
8052     @Method:
8053     @@Name: addPropertyResourceUList
8054 wakaba 1.52 @@plMName: add_property_resource_ulist
8055 wakaba 1.48 @@enDesc:
8056     Adds a resource to a resource-list property value.
8057     \
8058     {ISSUE:: Should an exception be thrown if the property is
8059     not of list?
8060     \
8061     }
8062     \
8063     {NOTE:: If the property is not <QUOTE::get>ten ever, adding
8064     an item clears the list --- i.e. the property values
8065     in the source tree will be ignored. Call
8066     <M::ManakaiDISPropertyAccessor.getPropertyResourceList>
8067     before adding to avoid this behavior.
8068     \
8069     }
8070     @@PropNameParam:
8071     @@Param:
8072     @@@Name: res
8073     @@@Type: DISResource
8074     @@@clsActualType: ManakaiDISResourceDefinition
8075     @@@enDesc:
8076     A resource to add.
8077     @@Return:
8078     @@@PerlDef:
8079     if ($self->{$propName}) {
8080     my $uriv;
8081     __CODE{dv|createURI::
8082     $uri => {$res-><AG::DISAnyResource.uri>},
8083     $result => $uriv,
8084 wakaba 1.60 $name => $propName,
8085 wakaba 1.48 }__;
8086     $self->{$propName}-><M::dv|DVList.addItem> ($uriv);
8087 wakaba 1.25 } else {
8088 wakaba 1.48 __CODE{dv|createUnorderedList::
8089     $result => {$self->{$propName}},
8090     $type => {<Q::DISCore:URI>},
8091     $base_type => {<Q::DISCore:URI>},
8092     }__;
8093     my $uriv;
8094     __CODE{dv|createURI::
8095     $uri => {$res-><AG::DISAnyResource.uri>},
8096     $result => $uriv,
8097 wakaba 1.60 $name => $propName,
8098 wakaba 1.25 }__;
8099 wakaba 1.48 $self->{$propName}-><M::dv|DVList.addItem> ($uriv);
8100 wakaba 1.2 }
8101    
8102 wakaba 1.48 @Method:
8103     @@Name: addPropertyURIUList
8104 wakaba 1.52 @@plMName: add_peoperty_uri_ulist
8105 wakaba 1.48 @@enDesc:
8106     Adds a resource to a resource-list property value.
8107     \
8108     {ISSUE:: Should an exception be thrown if the property is
8109     not of list?
8110     \
8111     }
8112     \
8113     {NOTE:: If the property is not <QUOTE::get>ten ever, adding
8114     an item clears the list --- i.e. the property values
8115     in the source tree will be ignored. Call
8116     <M::ManakaiDISPropertyAccessor.getPropertyResourceList>
8117     before adding to avoid this behavior.
8118     \
8119     }
8120     @@PropNameParam:
8121     @@Param:
8122     @@@Name: uri
8123     @@@Type: AnyURI
8124     @@@enDesc:
8125     A resource to add.
8126     @@Return:
8127     @@@PerlDef:
8128     __DEEP{
8129     if ($self->{$propName}) {
8130     my $uriv;
8131     __CODE{dv|createURI::
8132     $uri => $uri,
8133     $result => $uriv,
8134 wakaba 1.60 $name => $propName,
8135 wakaba 1.48 }__;
8136     $self->{$propName}-><M::dv|DVList.addItem> ($uriv);
8137     } else {
8138     __CODE{dv|createUnorderedList::
8139     $result => {$self->{$propName}},
8140     $type => {<Q::DISCore|URI>},
8141     $base_type => {<Q::DISCore:URI>},
8142     }__;
8143     my $uriv;
8144     __CODE{dv|createURI::
8145     $uri => $uri,
8146     $result => $uriv,
8147 wakaba 1.60 $name => $propName,
8148 wakaba 1.48 }__;
8149     $self->{$propName}-><M::dv|DVList.addItem> ($uriv);
8150     }
8151     }__;
8152     ##DISResourceProp
8153 wakaba 1.84
8154    
8155     ElementTypeBinding:
8156     @Name: TMethods
8157     @ElementType:
8158     dis:ResourceDef
8159     @ShadowContent:
8160     @@DISCore:resourceType:
8161     @@@@: dis|MultipleResource
8162     @@@ForCheck: !ManakaiDOM|ForClass
8163     @@resourceFor: ManakaiDOM|ForClass
8164     @@DISCore:resourceType: DISCore|Resource
8165     @@For: DIS|ForLatest
8166    
8167     ElementTypeBinding:
8168     @Name: TMethod
8169     @ElementType:
8170     dis:ResourceDef
8171     @ShadowContent:
8172     @@ForCheck: ManakaiDOM|ForClass
8173     @@DISCore:resourceType: DIS|Method
8174    
8175     ElementTypeBinding:
8176     @Name: TAttr
8177     @ElementType:
8178     dis:ResourceDef
8179     @ShadowContent:
8180     @@ForCheck: ManakaiDOM|ForClass
8181     @@DISCore:resourceType: DIS|Attribute
8182 wakaba 1.85
8183    
8184     TMethods:
8185     @TMethod:
8186     @@Name: getErrorInterfaceResource
8187     @@DIS:targetType: dx|Interface
8188     @@Return:
8189     @@@Type: DISAnyResource
8190     @@@PerlDef:
8191     __DEEP{
8192     $r = $self;
8193     }__;
8194     ##dx:Interface
8195 wakaba 1.84
8196     TMethods:
8197     @TMethod:
8198     @@Name: getErrorInterfaceResource
8199     @@DIS:targetType: DISLang|ConstGroup
8200     @@Return:
8201     @@@Type: DISAnyResource
8202     @@@PerlDef:
8203     __DEEP{
8204     my $parent = $self-><AG::DISResource.parentResource>;
8205     if ($parent and
8206     $parent-><M::DISAnyResource.isTypeURI> (<Q::Err|ErrorAny>)) {
8207     $r = $parent;
8208     }
8209     }__;
8210     ##DISLang:ConstGroup
8211 wakaba 1.95
8212     TMethods:
8213     @TMethod:
8214     @@Name: getDOMConfigurationParameterName
8215     @@DIS:targetType: DOMCore|DOMConfigurationParameter
8216     @@Return:
8217     @@@Type: DISString
8218     @@@PerlDef:
8219     __DEEP{
8220     $r = $self-><M::DIS|DISResourceProp.getPropertyText>
8221     (<Q::DOMCore:domConfigurationParameterName>);
8222     unless (defined $r) {
8223     $r = $self-><AG::DISAnyResource.nameURI>;
8224     }
8225     $r = lc $r if defined $r;
8226     }__;
8227     ##DOMCore|DOMConfigurationParameter
8228    
8229     TMethods:
8230     @TMethod:
8231     @@Name: getDOMConfigurationParameterName
8232     @@DIS:targetType: DOMCore|DOMConfigurationParameterApplication
8233     @@Return:
8234     @@@Type: DISString
8235     @@@PerlDef:
8236     __DEEP{
8237     my $cp = $self-><M::DISResourceProp.getPropertyResource>
8238     (<Q::DOMCore:domConfigurationParameter>);
8239     if (defined $cp) {
8240     $r = $cp-><M::DIS|DISResourceProp.getPropertyText>
8241     (<Q::DOMCore:domConfigurationParameterName>);
8242     unless (defined $r) {
8243     $r = $cp-><AG::DISAnyResource.nameURI>;
8244     }
8245     $r = lc $r if defined $r;
8246     } else {
8247     $r = null; # error
8248     }
8249     }__;
8250     ##DOMCore|DOMConfigurationParameterApplication
8251 wakaba 1.84
8252     TMethods:
8253     @TMethod:
8254     @@Name: getErrorInterfaceResource
8255     @@DIS:targetType: dx|ErrorCode
8256     @@Return:
8257     @@@Type: DISAnyResource
8258     @@@PerlDef:
8259     __DEEP{
8260     my $parent = $self-><AG::DISResource.parentResource>;
8261     if ($parent) {
8262     $r = $parent-><M::DISAnyResource.getErrorInterfaceResource>;
8263     }
8264     }__;
8265     ##dx:ErrorCode
8266    
8267     TMethods:
8268     @TMethod:
8269     @@Name: getErrorInterfaceResource
8270     @@DIS:targetType: dx|ErrorSubCode
8271     @@Return:
8272     @@@Type: DISAnyResource
8273     @@@PerlDef:
8274     __DEEP{
8275     my $parent = $self-><M::DISAnyResource.getErrorCodeResource>;
8276     if ($parent) {
8277     $r = $parent-><M::DISAnyResource.getErrorInterfaceResource>;
8278     }
8279     }__;
8280    
8281     @TMethod:
8282     @@Name: getErrorCodeResource
8283     @@DIS:targetType: dx|ErrorSubCode
8284     @@Return:
8285     @@@Type: DISAnyResource
8286     @@@PerlDef:
8287     __DEEP{
8288     my $parent = $self-><AG::DISResource.parentResource>;
8289     if ($parent and $parent-><M::DISAnyResource.isTypeURI>
8290     (<Q::dx|ErrorCode>)) {
8291     $r = $parent;
8292     }
8293     }__;
8294     ##dx:ErrorSubCode
8295 wakaba 1.48
8296 wakaba 1.3 ElementTypeBinding:
8297     @Name: PropNameParam
8298     @ElementType:
8299     dis:ResourceDef
8300     @ShadowContent:
8301     @@rdf:type:
8302     DISLang:MethodParameter
8303     @@Name: propName
8304     @@Type: ResourceURI
8305     @@Description:
8306     @@@lang:en
8307     @@@@:
8308     The name of the property.
8309    
8310 wakaba 1.2 PropDef:
8311     @QName:isAnon
8312     @Description:
8313     @@lang:en
8314     @@@:
8315     Whether the subject resource is anonymous or not.
8316     @Type:
8317 wakaba 1.18 DOMMain:boolean::ManakaiDOM:all
8318 wakaba 1.2
8319     PropDef:
8320     @QName:isDefined
8321     @Description:
8322     @@lang:en
8323     @@@:
8324     Whether the subject resource is defined or not.
8325    
8326     PropDef:
8327 wakaba 1.3 @QName:isReferred
8328 wakaba 1.2 @Description:
8329     @@lang:en
8330     @@@:
8331     Whether the subject resource is referred or not.
8332     @Type:
8333     DOMMain:any
8334    
8335     PropDef:
8336     @QName:definingModule
8337     @Description:
8338     @@lang:en
8339     @@@:
8340     The <QUOTE::dis> module in which the subject resource is defined.
8341 wakaba 1.22 \
8342     {NOTE:: The local name should have been <QUOTE::ownerModule> or some.
8343     \
8344     }
8345 wakaba 1.2 @rdfs:domain:
8346     DISCore:Module
8347 wakaba 1.1
8348     ## -- Datatypes
8349    
8350     URITypeDef:
8351 wakaba 1.3 @QName: AnyURI
8352     @Description:
8353     @@lang:en
8354     @@@:
8355     Any URI references.
8356    
8357     URITypeDef:
8358     @QName: FileURI
8359     @enDesc:
8360     URI references identifying file.
8361    
8362     URITypeDef:
8363 wakaba 1.1 @QName: ForURI
8364     @Description:
8365     @@lang:en
8366     @@@:
8367     <QUOTE::For> URI references.
8368    
8369     DataTypeDef:
8370     @QName: ForURIList
8371     @Description:
8372     @@lang:en
8373     @@@:
8374     References to the array containing <QUOTE::for> URI references.
8375    
8376     URITypeDef:
8377 wakaba 1.3 @QName: ResourceURI
8378     @Description:
8379     @@lang:en
8380     @@@:
8381     A URI reference for a <QUOTE::dis> resource.
8382    
8383     URITypeDef:
8384 wakaba 1.1 @QName: MediaTypeURI
8385     @Description:
8386     @@lang:en
8387     @@@:
8388     Media type URI references.
8389 wakaba 1.3 @rdfs:subClassOf: ResourceURI
8390    
8391     URITypeDef:
8392     @QName: ModuleURI
8393     @enDesc:
8394 wakaba 1.47 URI references for <QUOTE::dis> modules.
8395 wakaba 1.3 @rdfs:subClassOf: ResourceURI
8396    
8397     URITypeDef:
8398     @QName: NameURI
8399     @enDesc:
8400     URI references identifying a resource.
8401     @rdfs:subClassOf: ResourceURI
8402 wakaba 1.10
8403     DataTypeDef:
8404     @QName: ResourceList
8405     @enDesc:
8406     References to array containing resource definition objects.
8407     @rdfs:subClassOf:
8408 wakaba 1.60 DISPerl:ARRAY::ManakaiDOM:all
8409 wakaba 1.3
8410     ElementTypeBinding:
8411     @Name: DataTypeDef
8412     @ElementType:
8413     dis:ResourceDef
8414     @ShadowContent:
8415     @@rdf:type:
8416     ManakaiDOM:DataType
8417    
8418     ElementTypeBinding:
8419     @Name: URITypeDef
8420     @ElementType:
8421     dis:ResourceDef
8422     @ShadowContent:
8423     @@rdf:type:
8424     ManakaiDOM:DataType
8425     @@rdfs:subClassOf: AnyURI
8426 wakaba 1.1
8427     ## -- Exceptions
8428    
8429     XParamDef:
8430 wakaba 1.5 @QName: anotherSourceNode
8431     @enDesc:
8432     Another source node in which an error has occurred. In cases
8433     of <QUOTE::already defined> errors, it is the node that
8434     defines the resource first.
8435     @Type: ManakaiDISNode
8436 wakaba 1.3
8437 wakaba 1.12 ResourceDef:
8438     @QName: UNDECLARED_NS_PREFIX_ERR
8439 wakaba 1.49 @For: ForEmpty
8440 wakaba 1.12 @AliasFor:
8441     DIS:UNDECLARED_NS_PREFIX_ERR::swcfg21:ForLatest
8442    
8443 wakaba 1.47 ResourceDef:
8444 wakaba 1.98 @QName: anyres
8445     @AliasFor: DISAnyResource
8446     @For: DIS|ForLatest
8447    
8448     ResourceDef:
8449 wakaba 1.47 @rdf:type:
8450     @@@: dis|MultipleResource
8451     @@ForCheck: !ManakaiDOM|ForIF !ManakaiDOM|ForClass
8452     @resourceFor: ManakaiDOM|ForIF
8453     @resourceFor:
8454     @@@: ManakaiDOM|ForClass
8455     @@ForCheck: ForEmpty !=ForEmpty
8456     @For: ForLatest
8457     @For: =ForEmpty
8458    
8459     @rdf:type:
8460 wakaba 1.63 @@@: dx|Interface
8461 wakaba 1.47 @@ForCheck: ManakaiDOM|ForIF
8462    
8463     @rdf:type:
8464 wakaba 1.63 @@@: dx|Class
8465 wakaba 1.47 @@ForCheck: ManakaiDOM|ForClass
8466    
8467     @Implement:
8468     @@@: ||ForEmpty||ManakaiDOM|ForIF
8469     @@ContentType: DISCore|TFPQNames
8470     @@ForCheck: ManakaiDOM|ForClass ForEmpty
8471     @Implement:
8472     @@@: ||ForLatest||ManakaiDOM|ForIF
8473     @@ContentType: DISCore|TFPQNames
8474     @@ForCheck: ManakaiDOM|ForClass ForLatest
8475 wakaba 1.63 @dx:implementedBy: ||DIS|ForLatest||ManakaiDOM|ForClass
8476 wakaba 1.47
8477 wakaba 1.63 @f:implements:
8478 wakaba 1.47 @@@: CoreFeature10
8479     @@For: ForLatest
8480    
8481     @ISA:
8482 wakaba 1.63 @@@: dx|Exception||ManakaiDOM|Perl
8483 wakaba 1.47 @@ForCheck: ManakaiDOM|ForClass
8484    
8485     @IFQName: DISException
8486 wakaba 1.3 @ClsQName: ManakaiDISException
8487 wakaba 1.47
8488     @Description:
8489     @@lang:en
8490     @@@:
8491     Exceptions for the <QUOTE::dis> operations.
8492    
8493     @ResourceDef:
8494 wakaba 1.63 @@rdf:type: DISLang|ConstGroup
8495     @@ForCheck: ManakaiDOM|ForIF !=DIS|ForEmpty
8496 wakaba 1.47
8497     @@IFQName: DISExceptionCode
8498    
8499 wakaba 1.63 @@rdfs:subClassOf: idl|unsignedShort||ManakaiDOM|all
8500     @@Type: idl|unsignedShort||ManakaiDOM|all
8501 wakaba 1.47
8502 wakaba 1.3 @@enDesc:
8503 wakaba 1.63 Exception codes for <Class::DISException>.
8504 wakaba 1.47
8505 wakaba 1.3 @@XConstDef:
8506 wakaba 1.11 @@@Name: HIERARCHY_REQUEST_ERR
8507 wakaba 1.49 @@@Value:
8508     @@@@@:3
8509     @@@@ContentType: DISCore|Integer
8510 wakaba 1.11 @@@enDesc:
8511     An attempt is made to break the hierarchy.
8512     @@@XSubTypeDef:
8513     @@@@QName: MERGE_ITSELF_ERR
8514     @@@@enDesc:
8515     An attempt is made to merge the resource to itself.
8516     @@@@XSourceNodeParam:
8517     @@@@XParam:
8518     @@@@@QName:uri
8519     @@@@@enDesc:
8520     The URI reference of the resource to merge.
8521     @@@@enMufDef:
8522     An attempt is made to merge the resource <%p (name => {<Q::DIS:uri>}
8523     );> to itself
8524     @@XConstDef:
8525 wakaba 1.8 @@@Name: NOT_SUPPORTED_ERR
8526 wakaba 1.49 @@@Value:
8527     @@@@@:9
8528     @@@@ContentType: DISCore|Integer
8529 wakaba 1.8 @@@enDesc:
8530     An attempt is made to do something the implementation does not support.
8531     @@@XSubTypeDef:
8532     @@@@QName: UNSUPPORTED_MEDIA_TYPE_ERR
8533     @@@@enDesc:
8534     The implementation does not support the media type.
8535     @@@@XParam:
8536     @@@@@QName: uri
8537     @@@@@enDesc:
8538     The URI reference of the media type that is not supported.
8539     @@@@XSourceNodeParam:
8540 wakaba 1.30 @@@@XParam:
8541     @@@@@QName:elementType
8542     @@@@@enDesc:
8543     The URI reference of the element type of the element
8544     in which the media type is referenced.
8545 wakaba 1.12 @@@@enMufDef:
8546 wakaba 1.30 %p (name => {<Q::DIS:sourceCode>}, prefix => {"}, suffix => {": }
8547     );%p (name => {<Q::DIS:elementType>}, prefix => { (Element type: <},
8548     suffix => {>) }
8549     );Media type <%p (name => {<Q::DIS:uri>});> is not supported
8550 wakaba 1.3 @@@XSubTypeDef:
8551 wakaba 1.13 @@@@QName: UNSUPPORTED_ELEMENT_TYPE_ERR
8552     @@@@enDesc:
8553     An unsupported type of element is encounted.
8554     @@@@XSourceNodeParam:
8555     @@@@XParam:
8556     @@@@@QName:elementType
8557     @@@@@enDesc:
8558     The element type URI reference of the element.
8559 wakaba 1.16 @@@@enMufDef:
8560     Element type "%p (name => {<Q::DIS:elementType>});" is not supported
8561 wakaba 1.3 @@XConstDef:
8562     @@@Name: INVALID_STATE_ERR
8563 wakaba 1.49 @@@Value:
8564     @@@@@:11
8565     @@@@ContentType: DISCore|Integer
8566 wakaba 1.3 @@@enDesc:
8567     An attempt is made to use an object that is not (or no longer) usable.
8568     @@@XSubTypeDef:
8569     @@@@QName: NO_ASSOCIATED_DB_ERR
8570     @@@@enDesc:
8571     No <QUOTE::dis> database has been associated with this document.
8572 wakaba 1.4 @@XConstDef:
8573     @@@Name: INVALID_SOURCE_ERR
8574 wakaba 1.49 @@@Value:
8575 wakaba 1.63 @@@@@: 501
8576 wakaba 1.49 @@@@ContentType: DISCore|Integer
8577 wakaba 1.4 @@@enDesc:
8578     The source input is well-formed but invalid.
8579     @@@XSubTypeDef:
8580     @@@@QName: NO_MODULE_QNAME_ERR
8581     @@@@enDesc:
8582     The <Q::dis:Module> element must have its <Q::dis:QName>
8583     attribute.
8584 wakaba 1.8 @@@@XSourceNodeParam:
8585     @@@XSubTypeDef:
8586     @@@@QName: NO_LOCAL_NAME_ERR
8587     @@@@enDesc:
8588     The resource does not have a local name.
8589     @@@@XSourceNodeParam:
8590 wakaba 1.4 @@@XSubTypeDef:
8591     @@@@QName: UNABLE_TO_GET_MODULE_ERR
8592     @@@@enDesc:
8593     The implementation is unable to get the module source.
8594 wakaba 1.68 @@@@enMufDef:
8595 wakaba 1.4 Unable to get the module source of <%p (name => {<Q::DIS:uri>});>
8596     @@@@XParam:
8597     @@@@@QName: uri
8598     @@@@@enDesc:
8599     The URI reference of the module.
8600     @@@@XParam:
8601     @@@@@QName: namespaceURI
8602     @@@@@enDesc:
8603     The namespace URI of the module name.
8604     @@@@XParam:
8605     @@@@@QName: localName
8606     @@@@@enDesc:
8607     The local name of the module name.
8608     @@@@XParam:
8609     @@@@@QName: for
8610     @@@@@enDesc:
8611     The <QUOTE::for> of the module.
8612 wakaba 1.5 @@@XSubTypeDef:
8613     @@@@QName: NO_FOR_QNAME_ERR
8614     @@@@enDesc:
8615     A <Q::dis:ForDef> element must have <Q::dis:QName> attribute.
8616     @@@@XSourceNodeParam:
8617     @@@XSubTypeDef:
8618     @@@@QName: FOR_ALREADY_DEFINED_ERR
8619     @@@@enDesc:
8620     The <QUOTE::for> named as the same URI reference has
8621     already defined.
8622     @@@@XSourceNodeParam:
8623     @@@@XParam:
8624     @@@@@QName: anotherSourceNode
8625     @@@@@enDesc:
8626     The node that defines the <QUOTE::for> URI reference before.
8627 wakaba 1.7 @@@@XParam:
8628     @@@@@Name: uri
8629     @@@@@enDesc:
8630     The URI reference of the <QUOTE::for> attempted to define.
8631     @@@@enMufDef:
8632     <QUOTE::For> <%p (name => {<Q::DIS:uri>});> is already defined
8633 wakaba 1.5 @@@XSubTypeDef:
8634     @@@@QName: RESOURCE_ALREADY_DEFINED_ERR
8635     @@@@enDesc:
8636     The <QUOTE::dis> resource named as the same URI reference has
8637     already defined.
8638     @@@@XSourceNodeParam:
8639     @@@@XParam:
8640 wakaba 1.54 @@@@@@: anotherSourceNode
8641 wakaba 1.5 @@@@@enDesc:
8642     The node that defines the <QUOTE::for> URI reference before.
8643 wakaba 1.7 @@@@XParam:
8644 wakaba 1.54 @@@@@@: uri
8645 wakaba 1.7 @@@@@enDesc:
8646     The URI reference of the resource attempted to define.
8647 wakaba 1.54 @@@@XParam:
8648     @@@@@@: moduleURI
8649     @@@@@enDesc:
8650     A URI of the module in which the <Q::DIS|uri> resource is
8651     defined.
8652 wakaba 1.7 @@@@enMufDef:
8653 wakaba 1.54 %p (name => {<Q::DIS:moduleURI>}, prefix => {Module <},
8654     suffix => {>: })
8655     ;Resource <%p (name => {<Q::DIS:uri>});> is already defined
8656 wakaba 1.5 @@@XSubTypeDef:
8657     @@@@QName: ELEMENT_NOT_ALLOWED_ERR
8658     @@@@enDesc:
8659     An element has occured where it is not allowed.
8660     @@@@enMufDef:
8661     Module <%p (name => {<Q::DIS:uri>});>:
8662     Element of type <%p (name => {<Q::DIS:elementType>});>
8663     is not allowed here
8664     @@@@XSourceNodeParam:
8665     @@@@XParam:
8666     @@@@@QName: elementType
8667     @@@@@enDesc:
8668     The expanded element type name of the element.
8669     @@@@XParam:
8670     @@@@@QName: uri
8671     @@@@@enDesc:
8672     The URI reference of the module.
8673 wakaba 1.7 @@@XSubTypeDef:
8674     @@@@QName: NO_REQUIRED_ATTR_ERR
8675     @@@@enDesc:
8676     A required attribute is not specified.
8677     @@@@XSourceNodeParam:
8678     @@@@XParam:
8679     @@@@@QName: elementType
8680     @@@@@enDesc:
8681     The expanded URI reference of the attribute name.
8682     @@@@enMufDef:
8683     Attribute <%p (name => {<Q::DIS:elementType>});> must be specified
8684 wakaba 1.8 @@@XSubTypeDef:
8685     @@@@QName: FOR_NOT_DEFINED_ERR
8686     @@@@enDesc:
8687     A <QUOTE::for> is referred but not defined.
8688     @@@@XSourceNodeParam:
8689     @@@@XParam:
8690     @@@@@QName: uri
8691     @@@@@enDesc:
8692     The URI reference of the <QUOTE::for> that is not defined.
8693     @@@@enMufDef:
8694     <QUOTE::For> <%p (name => {<Q::DIS:uri>});> is not defined
8695     @@@XSubTypeDef:
8696     @@@@QName: RESOURCE_NOT_DEFINED_ERR
8697     @@@@enDesc:
8698 wakaba 1.13 A <QUOTE::dis> resource is referred but not defined
8699     or the resource referred does not have the type expected.
8700 wakaba 1.8 @@@@XSourceNodeParam:
8701     @@@@XParam:
8702 wakaba 1.48 @@@@@@: sourceNodePath
8703     @@@@@enDesc:
8704     A node path string of the source node.
8705     @@@@XParam:
8706 wakaba 1.8 @@@@@QName: uri
8707     @@@@@enDesc:
8708     The URI reference of the resource that is not defined.
8709 wakaba 1.13 @@@@XParam:
8710     @@@@@QName: elementType
8711     @@@@@enDesc:
8712     <QUOTE::dis> element type (either tree element type
8713     or preprocessing element type) of the element
8714     in which a reference to the undefined resource is contained.
8715     @@@@XParam:
8716 wakaba 1.30 @@@@@QName:parentURI
8717     @@@@@enDesc:
8718     The URI reference of the resource from whose child resources
8719     a resource is tried to find.
8720     @@@@XParam:
8721 wakaba 1.54 @@@@@QName: moduleURI
8722     @@@@@enDesc:
8723     The URI of the module in which the resourece should be included.
8724     @@@@XParam:
8725 wakaba 1.13 @@@@@QName: localName
8726     @@@@@enDesc:
8727     The local name of the undefined resource.
8728     @@@@XParam:
8729     @@@@QName: sourceCode
8730     @@@@enDesc:
8731     Source code fragment that referres this resource.
8732     @@@@XParam:
8733     @@@@@QName:expectedType
8734     @@@@@enDesc:
8735     Expected resource type.
8736 wakaba 1.8 @@@@enMufDef:
8737 wakaba 1.54 %p (name => {<Q::DIS:moduleURI>}, prefix => {Module <},
8738     suffix => {>: })
8739     ;%p (name => {<Q::DIS:sourceNodePath>}, suffix => {: })
8740     ;%p (name => {<Q::DIS:sourceCode>}, prefix => {"}, suffix => {": })
8741     ;%p (name => {<Q::DIS:parentURI>}, prefix => {(In <}, suffix => {>) })
8742     ;Resource%p (name => {<Q::DIS:uri>}, prefix => { <},
8743 wakaba 1.13 suffix => {>});%p (name => {<Q::DIS:localName>},
8744     prefix => { "}, suffix => {"}); is not defined or wrong type%p
8745     (name => {<Q::DIS:expectedType>}, prefix => { (<},
8746     suffix => {> is expected)});
8747     @@@XSubTypeDef:
8748     @@@@QName: NO_SOURCE_NODE_ERR
8749     @@@@enDesc:
8750     A resource does not have associated node in the source tree.
8751     @@@@XSourceNodeParam:
8752     @@@@XParam:
8753     @@@@@QName:uri
8754     @@@@@enDesc:
8755     The URI reference of the resource.
8756 wakaba 1.8 @@@XSubTypeDef:
8757     @@@@QName: RESERVED_PERL_METHOD_NAME_ERR
8758     @@@@enDesc:
8759     A reserved Perl method name is used.
8760     @@@@XParam:
8761     @@@@@QName:uri
8762     @@@@@enDesc:
8763     The URI reference of the method resource.
8764     @@@@XSourceNodeParam:
8765     @@@@XParam:
8766     @@@@@QName: generatedName
8767     @@@@@enDesc:
8768     A reserved method name.
8769     @@@XSubTypeDef:
8770     @@@@QName: NO_DIS_TYPE_ERR
8771     @@@@enDesc:
8772     <Q::dis:Type> attribute is not found.
8773     @@@@XSourceNodeParam:
8774 wakaba 1.48 @@@@enMufDef:
8775     Resource "%t (name => {<Q::DIS:uri>});" has no "dis:Type" attribute
8776 wakaba 1.12 @@@XSubTypeDef:
8777     @@@@QName: NO_METHOD_RETURN_ERR
8778     @@@@enDesc:
8779     A <Q::DISLang:Method> resource does not have any
8780     <Q::DISLang:MethodReturn> child.
8781     @@@@XSourceNodeParam:
8782 wakaba 1.22 @@@@XParam:
8783     @@@@@QName:errResource
8784     @@@@@enDesc: The method resource.
8785     @@@@XParam:
8786     @@@@@QName:uri
8787     @@@@@enDesc:
8788     The URI reference of the method.
8789     @@@@XParam:
8790     @@@@@QName:localName
8791     @@@@@enDesc:
8792     The local name of the resource.
8793     @@@@enMufDef:
8794     Method "%p (name => {<Q::DIS:localName>});" does not have
8795     "Return" child
8796 wakaba 1.12 @@@XSubTypeDef:
8797     @@@@QName: NO_ATTR_GET_ERR
8798     @@@@enDesc:
8799     A <Q::DISLang:Attribute> resource does not have any
8800     <Q::DISLang:AttributeGet> child.
8801     @@@@XSourceNodeParam:
8802 wakaba 1.13 @@@XSubTypeDef:
8803     @@@@QName:INTERFACE_CLASS_METHOD_ERR
8804     @@@@enDesc:
8805     An attempt is made to call a static (class) method
8806     from an interface.
8807     @@@@XSourceNodeParam:
8808     @@@@XParam:
8809     @@@@@QName:uri
8810     @@@@@enDesc:
8811     The URI reference of the interface.
8812     @@@@XParam:
8813     @@@@@QName:sourceCode
8814     @@@@@enDesc:
8815     Source code fragment that calls a class method.
8816     @@@@XParam:
8817     @@@@@QName:elementType
8818     @@@@@enDesc:
8819     The element type URI reference of the element
8820     that calls a method.
8821     @@@XSubTypeDef:
8822     @@@@QName: BROKEN_PARAM_SPEC_ERR
8823     @@@@enDesc:
8824     A parameter specification is broken.
8825     @@@@XParam:
8826     @@@@@QName: sourceCode
8827     @@@@@enDesc:
8828     Source code fragment that contains the broken parameter
8829     specification.
8830     @@@@XSourceNodeParam:
8831 wakaba 1.15 @@@@enMufDef:
8832     %p (name => {<Q::DIS:sourceCode>}, prefix => {"},
8833     suffix => {": });Broken parameter specification
8834 wakaba 1.13 @@@XSubTypeDef:
8835     @@@@QName:PERL_PREPROCESS_NO_ELEMENT_TYPE_ERR
8836     @@@@enDesc:
8837     A preprocessing instruction does not have its element
8838     type.
8839     @@@@XSourceNodeParam:
8840     @@@@XParam:
8841     @@@@@QName:sourceCode
8842     @@@@@enDesc:
8843     Source code fragment.
8844 wakaba 1.16 @@@@enMufDef:
8845     %p (name => {<Q::DIS:sourceCode>}, prefix => {"},
8846     suffix => {": });Element type name is not specified
8847 wakaba 1.13 @@@XSubTypeDef:
8848 wakaba 1.15 @@@@QName: NO_PERL_PACKAGE_NAME_ERR
8849 wakaba 1.13 @@@@enDesc:
8850 wakaba 1.15 No Perl package name is defined for the resource referred.
8851 wakaba 1.13 @@@@XSourceNodeParam:
8852     @@@@XParam:
8853 wakaba 1.15 @@@@@QName:sourceCode
8854 wakaba 1.13 @@@@@enDesc:
8855     Source code fragment.
8856     @@@@XParam:
8857 wakaba 1.15 @@@@@QName:uri
8858     @@@@@enDesc:
8859     THe URI reference of the resource referred.
8860     @@@@XParam:
8861     @@@@@QName:elementType
8862     @@@@@enDesc:
8863     The element type of Perl preprocessing instruction
8864     in which the resource is referred.
8865     @@@@enMufDef:
8866     %p (name => {<Q::DIS:uri>}, prefix => {<}, suffix => {>: });Perl
8867     package name is not defined
8868     @@@XSubTypeDef:
8869     @@@@QName: PERL_PREPROCESS_NO_EXCEPTION_TYPE_ERR
8870     @@@@enDesc:
8871     An exception type specification is required.
8872     @@@@XSourceNodeParam:
8873     @@@@XSourceCodeParam:
8874     @@@@XParam:
8875     @@@@@QName:elementType
8876     @@@@@enDesc:
8877     The element type of the preprocessing instruction.
8878     @@@XSubTypeDef:
8879     @@@@QName: PERL_PREPROCESS_NO_CODE_NAME_ERR
8880     @@@@enDesc:
8881     A code name specification is required.
8882     @@@@XSourceNodeParam:
8883     @@@@XSourceCodeParam:
8884     @@@@XParam:
8885 wakaba 1.13 @@@@@QName:elementType
8886     @@@@@enDesc:
8887 wakaba 1.15 The element type of the preprocessing instruction.
8888 wakaba 1.13 @@@XSubTypeDef:
8889     @@@@QName: PERL_CODE_NOT_DEFINED_ERR
8890     @@@@enDesc:
8891 wakaba 1.15 The specified resource does not have its Perl definition.
8892 wakaba 1.13 @@@@XSourceNodeParam:
8893 wakaba 1.15 @@@@XSourceCodeParam:
8894 wakaba 1.13 @@@@XParam:
8895 wakaba 1.15 @@@@@QName:elementType
8896     @@@@@enDesc:
8897     The element type of the preprocessing instruction.
8898     @@@@XParam:
8899     @@@@@QName:uri
8900 wakaba 1.13 @@@@@enDesc:
8901 wakaba 1.15 The URI reference of the resource referred.
8902 wakaba 1.13 @@@@XParam:
8903     @@@@@QName:localName
8904     @@@@@enDesc:
8905     The local name of the resource referred.
8906 wakaba 1.51 @@@@enMufDef:
8907     Resource%p (name => {<Q::DIS:uri>}, prefix => { "}, suffix => {"});
8908     has no Perl code definition
8909 wakaba 1.15 @@@XSubTypeDef:
8910     @@@@QName: PERL_PREPROCESS_NO_METHOD_ERR
8911     @@@@enDesc:
8912     A preprocessing instruction which is only allowed in
8913     method definitions is used in a code which is not a method.
8914     @@@@XSourceNodeParam:
8915     @@@@XSourceCodeParam:
8916 wakaba 1.13 @@@@XParam:
8917 wakaba 1.15 @@@@@QName:elementType
8918 wakaba 1.13 @@@@@enDesc:
8919 wakaba 1.15 The element type of the preprocessing instruction.
8920 wakaba 1.14 @@@XSubTypeDef:
8921 wakaba 1.15 @@@@QName: PERL_PREPROCESS_NO_FOR_ERR
8922 wakaba 1.14 @@@@enDesc:
8923 wakaba 1.15 A <QUOTE::for> specification is required.
8924 wakaba 1.14 @@@@XSourceNodeParam:
8925 wakaba 1.15 @@@@XSourceCodeParam:
8926 wakaba 1.14 @@@@XParam:
8927 wakaba 1.15 @@@@@QName:elementType
8928 wakaba 1.14 @@@@@enDesc:
8929 wakaba 1.15 The element type of the preprocessing instruction.
8930     @@@XSubTypeDef:
8931     @@@@QName: PERL_PREPROCESS_NO_ASSERT_TYPE_ERR
8932     @@@@enDesc:
8933     An assertion type specification is required.
8934     @@@@XSourceNodeParam:
8935     @@@@XSourceCodeParam:
8936 wakaba 1.14 @@@@XParam:
8937 wakaba 1.15 @@@@@QName:elementType
8938 wakaba 1.14 @@@@@enDesc:
8939 wakaba 1.15 The element type of the preprocessing instruction.
8940     @@@XSubTypeDef:
8941     @@@@QName: PERL_PREPROCESS_BLOCK_NOT_ALLOWED_ERR
8942     @@@@enDesc:
8943     A preprocessing instruction block occurred with
8944     element type which does not allow it.
8945     @@@@XSourceNodeParam:
8946     @@@@XSourceCodeParam:
8947 wakaba 1.14 @@@@XParam:
8948     @@@@@QName:elementType
8949     @@@@@enDesc:
8950 wakaba 1.15 The element type of the preprocessing instruction.
8951 wakaba 1.18 @@@XSubTypeDef:
8952     @@@@QName: NON_NAMED_PARAMETER_AFTER_NAMED_ERR
8953     @@@@enDesc:
8954     A non-named method parameter following
8955     any named method parameter is occurred.
8956     @@@@XSourceNodeParam:
8957     @@@@XParam:
8958     @@@@@QName:uri
8959     @@@@@enDesc:
8960     The URI reference of the non-named method parameter resource.
8961     @@@@XParam:
8962     @@@@@QName:localName
8963     @@@@@enDesc:
8964     The local name of the non-named method parameter.
8965 wakaba 1.19 @@@XSubTypeDef:
8966     @@@@QName:DISPERL_NO_VALUE_ALLOWED_ERR
8967     @@@@enDesc:
8968     An element node have a value but the definition
8969     of that element type does not allow it.
8970     @@@@XSourceNodeParam:
8971     @@@@XParam:
8972     @@@@@QName:elementType
8973     @@@@@enDesc:
8974     The element type URI reference of the element.
8975     @@@XSubTypeDef:
8976     @@@@QName:NO_CONST_VALUE_ERR
8977     @@@@enDesc:
8978     The source element node for a constant value resource
8979     does not have <Q::dis:Value> attribute.
8980     @@@@XSourceNodeParam:
8981     @@@@XParam:
8982     @@@@@QName:elemntType
8983     @@@@@enDesc:
8984     The element type URI reference of the element from which
8985     a constant value resource is referred.
8986     @@@@XParam:
8987     @@@@@QName:uri
8988     @@@@@enDesc:
8989     The resource URI reference of the constant value resource.
8990     @@@@XParam:
8991     @@@@@QName:localName
8992     @@@@@enDesc:
8993     The local name of the constant value resource.
8994     @@@XSubTypeDef:
8995     @@@@QName:NO_ATTR_SET_ERR
8996     @@@@enDesc:
8997     An attribute setter is referred but the attribute
8998     does not define any setter.
8999     @@@@XSourceNodeParam:
9000     @@@@XParam:
9001     @@@@@QName:errResource
9002     @@@@@enDesc:
9003     The attribute resource.
9004     @@@@XParam:
9005     @@@@@QName:elementType
9006     @@@@@enDesc:
9007     The type of the element by which this attribute
9008     is referred.
9009 wakaba 1.20 @@@XSubTypeDef:
9010     @@@@QName: PERL_SUBROUTINE_ALREADY_DEFINED_ERR
9011     @@@@enDesc:
9012     A resource defines a Perl subroutine whose name is
9013     same as another subroutine.
9014     @@@@XSourceNodeParam:
9015     @@@@XParam:
9016     @@@@@QName:uri
9017     @@@@@enDesc:
9018     The URI reference of the resource that defines the Perl subroutine.
9019     @@@@XParam:
9020     @@@@@QName:
9021     PerlCode:localName
9022     @@@@@enDesc:
9023     The name of the Perl subroutine.
9024     @@@XSubTypeDef:
9025     @@@@QName: PERL_OPERATOR_ALREADY_OVERLOADED_ERR
9026     @@@@enDesc:
9027     A resource is defined to overload a Perl operator which
9028     is already overloaded by another resource.
9029     @@@@XSourceNodeParam:
9030     @@@@XParam:
9031     @@@@@QName:uri
9032     @@@@@enDesc:
9033     The URI reference of the resource that defines the overloading.
9034     @@@@XParam:
9035     @@@@@QName:
9036     PerlCode:operator
9037     @@@@@enDesc:
9038     The operator.
9039     @@@XSubTypeDef:
9040     @@@@QName: PERL_UNUSED_SUBROUTINE_ERR
9041     @@@@enDesc:
9042     A resource defines a Perl subroutine but it is not used.
9043     @@@@XSourceNodeParam:
9044     @@@@XParam:
9045     @@@@@QName:uri
9046     @@@@@enDesc:
9047     The URI reference of the resource.
9048 wakaba 1.22 @@@XSubTypeDef:
9049     @@@@QName: NO_LICENSE_ATTR_ERR
9050     @@@@enDesc:
9051     The <Q::dis:Module> element does not have the
9052     <Q::dis:License> attribute.
9053     @@@@XSourceNodeParam:
9054     @@@@XParam:
9055     @@@@@QName:uri
9056     @@@@@enDesc:
9057     The URI reference of the module.
9058 wakaba 1.25 @@@XSubTypeDef:
9059     @@@@QName: UNSUPPORTED_ROLE_ERR
9060     @@@@enDesc:
9061     A <Q::dis:Role> is not supported.
9062     @@@@XSourceNodeParam:
9063     @@@@XParam:
9064     @@@@@QName:uri
9065     @@@@@enDesc:
9066     The URI reference of the unsupported role.
9067     @@@@enMufDef:
9068     Role <%p (name => {<Q::DIS:uri>});> is not supported
9069 wakaba 1.37 @@@XSubTypeDef:
9070     @@@@QName: NO_REFLECT_GET_DEFINED_ERR
9071     @@@@enDesc:
9072     An attribute is defined to reflect an element attribute
9073     but no reflecting attribute getter template is defined.
9074     @@@@XSourceNodeParam:
9075     @@@@XParam:
9076     @@@@@QName:uri
9077     @@@@@enDesc:
9078     The URI reference of the datatype resource for which
9079     a getter template should have been defined.
9080     @@@XSubTypeDef:
9081     @@@@QName: NO_REFLECT_SET_DEFINED_ERR
9082     @@@@enDesc:
9083     An attribute is defined to reflect an element attribute
9084     but no reflecting attribute setter template is defined.
9085     @@@@XSourceNodeParam:
9086     @@@@XParam:
9087     @@@@@QName:uri
9088     @@@@@enDesc:
9089     The URI reference of the datatype resource for which
9090     a setter template should have been defined.
9091 wakaba 1.40 @@@XSubTypeDef:
9092 wakaba 1.43 @@@@QName: NO_END_TAG_ERR
9093     @@@@enDesc:
9094 wakaba 1.40 Close tag not found.
9095 wakaba 1.43 @@@@XSourceNodeParam:
9096     @@@@XParam:
9097 wakaba 1.49 @@@@@@: elementType
9098     @@@@@enDesc:
9099 wakaba 1.40 The type URI reference of the element that is not closed.
9100 wakaba 1.43 @@@@XParam:
9101 wakaba 1.49 @@@@@@: sourceCode
9102     @@@@@enDesc:
9103 wakaba 1.40 The source code fragment near the position where
9104     an end tag is required.
9105 wakaba 1.43 @@@@enMufDef:
9106 wakaba 1.40 End tag for element "%p (name => {<Q::DIS:elementType>});"
9107 wakaba 1.43 is required%p (name => {<Q::DIS:sourceCode>},
9108     prefix => { (}, suffix => {)});
9109 wakaba 1.49 @@@XSubTypeDef:
9110     @@@@QName: NO_RDF_TYPE_ERR
9111     @@@@enDesc:
9112     There is a resource definition element that does
9113     not have any <Q::rdf:type> attribute.
9114     @@@@XSourceNodeParam:
9115     @@@@XParam:
9116     @@@@@@: uri
9117     @@@@@enDesc:
9118     The URI of the resource which does not have <Q::rdf:type>.
9119     @@@@enMufDef:
9120     Resource%p (name => {<Q::DIS:uri>}, prefix => { "},
9121     suffix => {"}); does not have "rdf:type" attribute
9122 wakaba 1.53 @@@XSubTypeDef:
9123     @@@@QName: PERL_HASH_KEY_ALREADY_DEFINED_ERR
9124     @@@@enDesc:
9125     A hash key is already defined.
9126     @@@@XSourceNodeParam:
9127     @@@@XParam:
9128     @@@@@@:uri
9129     @@@@@enDesc:
9130     The URI of the resource tried to register.
9131     @@@@XParam:
9132     @@@@@@:anotherURI
9133     @@@@@enDesc:
9134     The URI of the already registered resource.
9135     @@@@XParam:
9136     @@@@@@:hashKeyName
9137     @@@@@enDesc:
9138     Hash key.
9139     @@@@XParam:
9140     @@@@@@:hashKeyScope
9141     @@@@@enDesc:
9142     Hash key scope.
9143     @@@@enMufDef:
9144     <%p (name => {<Q::DIS:uri>});>:
9145 wakaba 1.56 Hash key "%p (name => {<Q::DIS:hashKeyName>});" in
9146 wakaba 1.53 <%p (mame => {<Q::DIS:hashKeyScope>});> is already
9147 wakaba 1.54 defined for <%p (name => {<Q::DIS:anotherURI>});>
9148 wakaba 1.63 @@@XSubTypeDef:
9149     @@@@QName: DIS|NO_EXCEPTION_CLASS_ERR
9150     @@@@enDesc:
9151     The exception interface has no class that implements the interface.
9152     @@@@enMufDef:
9153     Exception interface <%p (name => {<Q::DIS:uri>});>:
9154     There is no class that implements this interface
9155     @@@@XParam:
9156     @@@@@@: DIS|uri
9157     @@@@@enDesc:
9158     The URI of the interface.
9159 wakaba 1.37 @ImplNote:
9160     @@lang:en
9161     @@@:
9162     ISSUE: Too many subtypes for a type! New type should be added?
9163 wakaba 1.71
9164     @Attr:
9165     @@Name: text
9166     @@enDesc:
9167     The description of the error, in <LANG::i-default> language.
9168     @@enImplNote:
9169     See <A::dx|Exception.text> for super definition.
9170     @@Type: DISLang|String
9171     @@Get:
9172     @@@PerlDef:
9173     $r = $self->SUPER::text;
9174 wakaba 1.73 if (defined $self->{<H::DIS:uri>}) {
9175     $r = '<' . $self->{<H::DIS:uri>} . '>: ' . $r;
9176     }
9177 wakaba 1.71 if (defined $self->{<H::DIS:sourceNode>}) {
9178     $r = 'Node ' . $self->{<H::DIS:sourceNode>}-><M::SWCFGNode.nodePath>
9179     . ': ' . $r;
9180     }
9181 wakaba 1.4 ##DISException
9182 wakaba 1.71
9183     ElementTypeBinding:
9184     @Name: enImplNote
9185     @ElementType:
9186     dis:ImplNote
9187     @ShadowContent:
9188     @@lang:en
9189 wakaba 1.53
9190     XParamDef:
9191     @QName: hashKeyName
9192     @Type: DISLang|String
9193     @enDesc:
9194     See <M::dp|DISDatabasePerl.plAddHashKey>.
9195    
9196     XParamDef:
9197     @QName: hashKeyScope
9198     @Type: AnyURI
9199     @enDesc:
9200     See <M::dp|DISDatabasePerl.plAddHashKey>.
9201    
9202     XParamDef:
9203     @QName: anotherURI
9204     @Type: ResourceURI
9205     @enDesc:
9206     A URI of another related resource.
9207 wakaba 1.13
9208     XParamDef:
9209     @QName:expectedType
9210     @Type: ResourceURI
9211     @enDesc:
9212     Expected resource type URI reference.
9213    
9214     XParamDef:
9215     @QName: sourceCode
9216     @Type:
9217     DISLang:String::ManakaiDOM:all
9218     @enDesc:
9219     The source code fragment in which an error occurred.
9220 wakaba 1.5
9221     XParamDef:
9222     @QName: elementType
9223     @Type: ResourceURI
9224     @enDesc:
9225     The name of the element type.
9226    
9227     XParamDef:
9228     @QName: uri
9229     @Type: ResourceURI
9230     @enDesc:
9231     The name of the resource, composed from <Q::namespaceURI>,
9232     <Q::localName> and <Q::for>.
9233    
9234     XParamDef:
9235     @QName: localName
9236     @Type:
9237 wakaba 1.18 DISCore:LocalName::ManakaiDOM:all
9238 wakaba 1.5 @enDesc:
9239     The local name of the resource, unique in <Q::namespaceURI> namespace.
9240    
9241     XParamDef:
9242     @QName: namespaceURI
9243     @Type: AnyURI
9244     @enDesc:
9245     The namespace URI reference of the resource name.
9246    
9247     XParamDef:
9248     @QName: for
9249     @Type: ForURI
9250     @enDesc:
9251     The <QUOTE::for> URI reference of the resource.
9252    
9253     ElementTypeBinding:
9254     @Name: XSourceNodeParam
9255     @ElementType:
9256 wakaba 1.64 ecore:hasParameter
9257 wakaba 1.5 @ShadowContent:
9258     @@QName: sourceNode
9259     @@Description:
9260     @@@lang:en
9261     @@@@:
9262     The node in which an error has occurred.
9263 wakaba 1.15
9264     ElementTypeBinding:
9265     @Name: XSourceCodeParam
9266     @ElementType:
9267 wakaba 1.64 ecore:hasParameter
9268 wakaba 1.15 @ShadowContent:
9269     @@QName: sourceCode
9270     @@Description:
9271     @@@lang:en
9272     @@@@:
9273     The source code in which an error has occurred.
9274 wakaba 1.4
9275 wakaba 1.52 ElementTypeBinding:
9276     @Name: plMName
9277     @ElementType:
9278     DISPerl:methodName
9279     @ShadowContent:
9280     @@ContentType: lang|Perl
9281     @@For: ManakaiDOM|Perl
9282 wakaba 1.4
9283     ElementTypeBinding:
9284 wakaba 1.52 @Name: plCName
9285 wakaba 1.4 @ElementType:
9286 wakaba 1.52 DISPerl:exportTagName
9287 wakaba 1.4 @ShadowContent:
9288 wakaba 1.47 @@ContentType: lang|Perl
9289     @@For: ManakaiDOM|Perl
9290 wakaba 1.3
9291     ElementTypeBinding:
9292     @Name: Method
9293     @ElementType:
9294     dis:ResourceDef
9295     @ShadowContent:
9296     @@rdf:type:
9297     DISLang:Method
9298 wakaba 1.52 @@For: !=ForEmpty
9299 wakaba 1.3
9300     ElementTypeBinding:
9301 wakaba 1.79 @Name: CMethod
9302     @ElementType:
9303     dis:ResourceDef
9304     @ShadowContent:
9305     @@rdf:type:
9306     DISLang:Method
9307     @@ForCheck: !=ForEmpty ManakaiDOM|ForClass
9308    
9309     ElementTypeBinding:
9310 wakaba 1.3 @Name: IntMethod
9311     @ElementType:
9312     dis:ResourceDef
9313     @ShadowContent:
9314     @@rdf:type:
9315     DISLang:Method
9316     @@ManakaiDOM:isForInternal:1
9317 wakaba 1.52 @@ForCheck: ManakaiDOM|ForClass
9318 wakaba 1.3
9319     ElementTypeBinding:
9320     @Name: Attr
9321     @ElementType:
9322     dis:ResourceDef
9323     @ShadowContent:
9324     @@rdf:type:
9325     DISLang:Attribute
9326 wakaba 1.52 @@For: !=ForEmpty
9327 wakaba 1.79
9328     ElementTypeBinding:
9329     @Name: CAttr
9330     @ElementType:
9331     dis:ResourceDef
9332     @ShadowContent:
9333     @@rdf:type:
9334     DISLang:Attribute
9335     @@ForCheck: !=ForEmpty ManakaiDOM|ForClass
9336 wakaba 1.3
9337     ElementTypeBinding:
9338     @Name: Return
9339     @ElementType:
9340     dis:ResourceDef
9341     @ShadowContent:
9342     @@rdf:type:
9343     DISLang:MethodReturn
9344    
9345     ElementTypeBinding:
9346     @Name: Get
9347     @ElementType:
9348     dis:ResourceDef
9349     @ShadowContent:
9350     @@rdf:type:
9351     DISLang:AttributeGet
9352    
9353     ElementTypeBinding:
9354     @Name: Set
9355     @ElementType:
9356     dis:ResourceDef
9357     @ShadowContent:
9358     @@rdf:type:
9359     DISLang:AttributeSet
9360    
9361     ElementTypeBinding:
9362     @Name: Param
9363     @ElementType:
9364     dis:ResourceDef
9365     @ShadowContent:
9366     @@rdf:type:
9367     DISLang:MethodParameter
9368    
9369     ElementTypeBinding:
9370     @Name: PerlDef
9371     @ElementType:
9372     dis:Def
9373     @ShadowContent:
9374     @@ContentType:
9375     lang:Perl
9376    
9377     ElementTypeBinding:
9378     @Name: InCase
9379     @ElementType:
9380     dis:ResourceDef
9381     @ShadowContent:
9382     @@rdf:type:
9383     ManakaiDOM:InCase
9384    
9385     ElementTypeBinding:
9386     @Name: nullCase
9387     @ElementType:
9388     dis:ResourceDef
9389     @ShadowContent:
9390     @@rdf:type:
9391     ManakaiDOM:InCase
9392     @@Value:
9393     @@@is-null:1
9394 wakaba 1.49 @@@ContentType: DISCore|String
9395 wakaba 1.3
9396     ElementTypeBinding:
9397     @Name: TrueCase
9398     @ElementType:
9399     dis:ResourceDef
9400     @ShadowContent:
9401     @@rdf:type:
9402     ManakaiDOM:InCase
9403 wakaba 1.49 @@Value:
9404     @@@@: 1
9405     @@@ContentType: DISCore|Boolean
9406 wakaba 1.3 @@Type:
9407 wakaba 1.18 DOMMain:boolean::ManakaiDOM:all
9408 wakaba 1.3
9409     ElementTypeBinding:
9410     @Name: FalseCase
9411     @ElementType:
9412     dis:ResourceDef
9413     @ShadowContent:
9414     @@rdf:type:
9415     ManakaiDOM:InCase
9416 wakaba 1.49 @@Value:
9417     @@@@: 0
9418     @@@ContentType: DISCore|Boolean
9419 wakaba 1.3 @@Type:
9420 wakaba 1.18 DOMMain:boolean::ManakaiDOM:all
9421 wakaba 1.3
9422     ElementTypeBinding:
9423     @Name: enDesc
9424     @ElementType:
9425     dis:Description
9426     @ShadowContent:
9427     @@lang:en
9428    
9429     ElementTypeBinding:
9430     @Name: PropDef
9431     @ElementType:
9432     dis:ResourceDef
9433     @ShadowContent:
9434 wakaba 1.81 @@DISCore:resourceType: DISCore|Property
9435     @@For: =ManakaiDOM|all
9436    
9437     ElementTypeBinding:
9438     @Name: RPropDef
9439     @ElementType:
9440     dis:ResourceDef
9441     @ShadowContent:
9442     @@DISCore:resourceType: DISSource|ResourceProperty
9443     @@For: =ManakaiDOM|all
9444 wakaba 1.3
9445     ElementTypeBinding:
9446     @Name: MethodRedef
9447     @ElementType:
9448     dis:ResourceDef
9449     @ShadowContent:
9450     @@rdf:type:
9451     DISLang:Method
9452    
9453     ElementTypeBinding:
9454     @Name: NamedParam
9455     @ElementType:
9456     dis:ResourceDef
9457     @ShadowContent:
9458     @@rdf:type:
9459     DISLang:MethodParameter
9460     @@DISPerl:isNamedParameter:1
9461    
9462     ElementTypeBinding:
9463     @Name: NodeParam
9464     @ElementType:
9465     dis:ResourceDef
9466     @ShadowContent:
9467     @@rdf:type:
9468     DISLang:MethodParameter
9469     @@DISPerl:isNamedParameter:1
9470     @@Name: node
9471 wakaba 1.47 @@Type: DISNode
9472     @@actualType:
9473     @@@@: ManakaiDISNode
9474     @@@ForCheck: ManakaiDOM|ForClass
9475 wakaba 1.3 @@Description:
9476     @@@lang:en
9477     @@@@:
9478     The node in which the name has occurred. It is intended
9479     to be reported when an exception had been raised.
9480     @@ResourceDef:
9481     @@@rdf:type:
9482     ManakaiDOM:InCase
9483     @@@Value:
9484     @@@@is-null:1
9485 wakaba 1.49 @@@@ContentType: DISCore|String
9486 wakaba 1.3 @@@Description:
9487     @@@@lang:en
9488     @@@@@:
9489     The source of the name is not a node.
9490    
9491     ElementTypeBinding:
9492     @Name: ForParam
9493     @ElementType:
9494     dis:ResourceDef
9495     @ShadowContent:
9496     @@rdf:type:
9497     DISLang:MethodParameter
9498     @@DISPerl:isNamedParameter:1
9499     @@Name: forArg
9500     @@Type: ForURI
9501     @@Description:
9502     @@@lang:en
9503     @@@@:
9504     The <QUOTE::for> URI reference.
9505     @@ResourceDef:
9506     @@@rdf:type:
9507     ManakaiDOM:InCase
9508     @@@Value:
9509     @@@@is-null:1
9510 wakaba 1.49 @@@@ContentType: DISCore|String
9511 wakaba 1.3 @@@Description:
9512     @@@@lang:en
9513     @@@@@:
9514     Equivalent to <Q::ManakaiDOM:all>, i.e. <QUOTE::for all>.
9515    
9516     ElementTypeBinding:
9517     @Name: ForpParam
9518     @ElementType:
9519     dis:ResourceDef
9520     @ShadowContent:
9521     @@rdf:type:
9522     DISLang:MethodParameter
9523     @@DISPerl:isNamedParameter:1
9524     @@Name: forpArg
9525     @@Type: ForURIList
9526     @@Description:
9527     @@@lang:en
9528     @@@@:
9529     An array reference containing additional <QUOTE::for>
9530     constraints (<QUOTE::For+> list).
9531     @@ResourceDef:
9532     @@@rdf:type:
9533     ManakaiDOM:InCase
9534     @@@Value:
9535     @@@@is-null:1
9536 wakaba 1.49 @@@@ContentType: DISCore|String
9537 wakaba 1.3 @@@Description:
9538     @@@@lang:en
9539     @@@@@:
9540     Equivalent to the empty array reference.
9541    
9542     ElementTypeBinding:
9543     @Name: MediaTypeParam
9544     @ElementType:
9545     dis:ResourceDef
9546     @ShadowContent:
9547     @@rdf:type:
9548     DISLang:MethodParameter
9549     @@DISPerl:isNamedParameter:1
9550     @@Name: mediaType
9551     @@Type: MediaTypeURI
9552     @@Description:
9553     @@@lang:en
9554     @@@@:
9555     The URI reference identifying a media type.
9556     @@ResourceDef:
9557     @@@rdf:type:
9558     ManakaiDOM:InCase
9559     @@@Value:
9560     @@@@is-null:1
9561 wakaba 1.49 @@@@ContentType: DISCore|String
9562 wakaba 1.3 @@@Description:
9563     @@@@lang:en
9564     @@@@@:
9565     No media type specified.
9566    
9567     ElementTypeBinding:
9568     @Name: MediaTypeDefaultParam
9569     @ElementType:
9570     dis:ResourceDef
9571     @ShadowContent:
9572     @@rdf:type:
9573     DISLang:MethodParameter
9574     @@DISPerl:isNamedParameter:1
9575     @@Name: defaultMediaType
9576     @@Type: MediaTypeURI
9577     @@Description:
9578     @@@lang:en
9579     @@@@:
9580     The default media type, i.e. the type used when no explicit
9581     specification is not found in the source tree.
9582     @@ResourceDef:
9583     @@@rdf:type:
9584     ManakaiDOM:InCase
9585     @@@Value:
9586     @@@@is-null:1
9587 wakaba 1.49 @@@@ContentType: DISCore|String
9588 wakaba 1.3 @@@Description:
9589     @@@@lang:en
9590     @@@@@:
9591     Defaulted to <Q::DOMMain:any>.
9592    
9593     ElementTypeBinding:
9594     @Name: RaiseException
9595     @ElementType:
9596     ManakaiDOM:raises
9597    
9598     ElementTypeBinding:
9599     @Name: UndeclaredPrefixException
9600     @ElementType:
9601     ManakaiDOM:raises
9602     @ShadowContent:
9603     @@@: UNDECLARED_NS_PREFIX_ERR
9604     @@Description:
9605     @@@lang:en
9606     @@@@:
9607     The implementation has encounted an undeclared namespace prefix.
9608    
9609     ElementTypeBinding:
9610     @Name: NoDBException
9611     @ElementType:
9612     ManakaiDOM:raises
9613     @ShadowContent:
9614 wakaba 1.47 @@@: NO_ASSOCIATED_DB_ERR
9615 wakaba 1.3 @@Description:
9616     @@@lang:en
9617     @@@@:
9618     No <QUOTE::dis> database is associated to this document.
9619    
9620     ElementTypeBinding:
9621     @Name: XConstDef
9622     @ElementType:
9623     dis:ResourceDef
9624     @ShadowContent:
9625 wakaba 1.63 @@rdf:type: dx|ErrorCode
9626 wakaba 1.3
9627     ElementTypeBinding:
9628     @Name: XSubTypeDef
9629     @ElementType:
9630     dis:ResourceDef
9631     @ShadowContent:
9632 wakaba 1.63 @@rdf:type: dx|ErrorSubCode
9633 wakaba 1.3
9634     ElementTypeBinding:
9635     @Name: XParam
9636     @ElementType:
9637 wakaba 1.63 ecore:hasParameter
9638 wakaba 1.3
9639     ElementTypeBinding:
9640     @Name: XParamDef
9641     @ElementType:
9642     dis:ResourceDef
9643     @ShadowContent:
9644 wakaba 1.63 @@rdf:type: ecore|Parameter
9645     @@For: =ManakaiDOM|all
9646 wakaba 1.54
9647     XParamDef:
9648     @QName: DIS|moduleURI
9649     @enDesc:
9650     A URI of the module in which the resource is defined.
9651 wakaba 1.3
9652     ElementTypeBinding:
9653     @Name: enMufDef
9654     @ElementType:
9655 wakaba 1.68 ecore:defaultMessage
9656 wakaba 1.3 @ShadowContent:
9657     @@ContentType:
9658     lang:muf
9659     @@lang:en

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24