/[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.98 - (hide annotations) (download)
Mon Apr 3 16:13:15 2006 UTC (19 years, 3 months ago) by wakaba
Branch: MAIN
Changes since 1.97: +32 -26 lines
++ manakai/lib/Message/Markup/ChangeLog	3 Apr 2006 15:57:38 -0000
2006-04-03  Wakaba  <wakaba@suika.fam.cx>

	* Makefile: Typo fixed.

	* SuikaWikiConfig21.dis: The |dis:GetProp| and |swcfg21:GetPropNode|
	elements are replaced by Perl code.
	(swcfg21:GetPropNode): Removed.

++ manakai/lib/Message/Util/ChangeLog	3 Apr 2006 15:59:07 -0000
2006-04-04  Wakaba  <wakaba@suika.fam.cx>

	* Grove.dis (collectGarbage): Exit loops by |undef| from |each|.

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

	* DIS.dis (NO_PERL_CODE_IMPL_ERR): Removed.

	* ManakaiNode.dis (GetProp, SetProp): Removed.

++ manakai/lib/Message/Util/Error/ChangeLog	3 Apr 2006 16:11:27 -0000
2006-04-04  Wakaba  <wakaba@suika.fam.cx>

	* DOMException.dis (DOMMain:raiseException): Removed.
	(DOMMain:XCodeRef): The alias name is removed.
	(MDOM_DEBUG_BUG, ASSERTION_ERR): Removed.

++ manakai/lib/Message/Util/DIS/ChangeLog	3 Apr 2006 16:00:34 -0000
	* Perl.dis, DPG.dis: The |appendCodeFragment| method calls
	are replaced by |appendChild|s.

	* Perl.dis (dis:GetProp, swcfg21:GetPropNode): They are no
	longer supported.
	(DOMMain:raiseException): It is no longer supported.

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

++ manakai/lib/Message/DOM/ChangeLog	3 Apr 2006 15:56:46 -0000
2006-04-04  Wakaba  <wakaba@suika.fam.cx>

	* TreeCore.dis: The |DOMMain:raiseException| elements
	are replaced by |disPerl:EXCEPTION|s.

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

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24