/[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.101 - (hide annotations) (download)
Tue Aug 15 10:59:24 2006 UTC (18 years, 11 months ago) by wakaba
Branch: MAIN
Changes since 1.100: +166 -13 lines
++ manakai/bin/ChangeLog	15 Aug 2006 10:57:55 -0000
2006-08-15  Wakaba  <wakaba@suika.fam.cx>

	* daf.pl: Passes the |implementation| parameter
	to the |read_properties| method.

++ manakai/lib/Message/Util/ChangeLog	15 Aug 2006 10:59:04 -0000
	* DIS.dis (readProperties): New |implementation| parameters
	are added.  Support for the |lang:dcmodel| lexical
	type is added.
	(parseString): New method.

2006-08-15  Wakaba  <wakaba@suika.fam.cx>

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

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24