/[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.89 - (hide annotations) (download)
Sun Feb 26 06:42:56 2006 UTC (19 years, 4 months ago) by wakaba
Branch: MAIN
Changes since 1.88: +107 -20 lines
++ manakai/t/ChangeLog	26 Feb 2006 06:42:43 -0000
2006-02-26  Wakaba  <wakaba@suika.fam.cx>

	* Makefile: Revised for new |daf| database format.

++ manakai/bin/ChangeLog	26 Feb 2006 06:36:16 -0000
	* daf.pl: Perl test file generation support from |dac2test.pl|
	is added.  Exits the program before any generation
	if the database constrution process has error.

2006-02-26  Wakaba  <wakaba@suika.fam.cx>

++ manakai/lib/Message/Markup/ChangeLog	26 Feb 2006 06:37:11 -0000
2006-02-26  Wakaba  <wakaba@suika.fam.cx>

	* Makefile: Revised for new |daf| database format.

++ manakai/lib/Message/Util/ChangeLog	26 Feb 2006 06:40:09 -0000
	* ManakaiNodeTest.dis (Require): Missing reference
	to the |DISlib:Test| module is added.

	* Makefile: Revised for new |daf| database format.

	* DIS.dis (elementTypeMatch, isSubsetOfURI): The |srinfo|
	parameter is added.
	(getFor, getModule): Set reference rather than string
	itself to the |{for}| property.
	(loadResource): Passes |srinfo| parameter
	to |isSubsetOfURI|-calling methods.
	(mergeAsAlias): The |srinfo| parameter is added.

2006-02-26  Wakaba  <wakaba@suika.fam.cx>

++ manakai/lib/Message/Util/DIS/ChangeLog	26 Feb 2006 06:41:53 -0000
	* Perl.dis (addHashKey): Revised to register keys to
	each key scope resource rather than database.

	* DNLite.dis (elementTypeMatch): The |srinfo| parameter is added.

	* DISDump.dis (Require): Missing reference to the |DISlib:DISMarkup|
	module is added.

2006-02-26  Wakaba  <wakaba@suika.fam.cx>

++ manakai/lib/Message/DOM/ChangeLog	26 Feb 2006 06:36:55 -0000
2006-02-26  Wakaba  <wakaba@suika.fam.cx>

	* Makefile: Revised for new |daf| database format.

++ manakai/lib/manakai/ChangeLog	26 Feb 2006 06:42:23 -0000
2006-02-26  Wakaba  <wakaba@suika.fam.cx>

	* Makefile: Rules to construct old |dae| database are removed.

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.89 $Date: 2006/02/25 16:49:56 $
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     DIS:uri => {$mod->{uri}},
3137     }__;
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.54 DIS:uri => {$qn_uri},
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 wakaba 1.53 $res->{<H::DIS|isDefined>} = true;
3457 wakaba 1.9 $res->{seq} = $self->{seq}++;
3458 wakaba 1.50 $res-><AS::DISAnyResource.sourceNodeIDRef> ($node_id);
3459 wakaba 1.79 __CODE{setRevision:: $resource => $res}__;
3460 wakaba 1.86 $mod-><M::DISModule.addResourceURI> ($_) for @res_uri;
3461 wakaba 1.9
3462 wakaba 1.6 ## -- Alias
3463     if ($al_node) {
3464 wakaba 1.54 my $canon_res = $self-><M::DISDatabase.getResource> ($al_canon_uri);
3465 wakaba 1.48 $canon_res-><AS::DISAnyResource.isReferred> ($al_node);
3466     $canon_res-><M::DISResource.mergeAsAlias> ($res, node => $al_node);
3467 wakaba 1.6 $res = $canon_res;
3468     }
3469 wakaba 1.54 } # ALD
3470 wakaba 1.5
3471 wakaba 1.11 ## -- Registers as child
3472 wakaba 1.54 $parentResource-><M::DIS|ManakaiDISResourceDefinition
3473     .addChildResource> ($res)
3474 wakaba 1.11 if $parentResource;
3475 wakaba 1.54 $dynParent-><M::DIS|ManakaiDISResourceDefinition
3476     .addDynamicChildResource> ($res)
3477 wakaba 1.11 if $dynParent;
3478    
3479 wakaba 1.7 my $is_multires = false;
3480     my @props;
3481     my @cres;
3482 wakaba 1.48 my @ce0 = @{$el-><M::DISElement.disChildElements>
3483 wakaba 1.49 (for_arg => $forArg, forp_arg => $forpArg,
3484     database_arg => $self)};
3485     my $has_type = $al_node;
3486 wakaba 1.7 while (@ce0) {
3487     my $ce = shift @ce0;
3488 wakaba 1.81 if ($ce-><M::DISElement.elementTypeMatch>
3489 wakaba 1.89 (<Q::DISCore|resourceType>, database_arg => $self,
3490     srinfo => $srinfo) or
3491 wakaba 1.81 $ce-><M::DISElement.elementTypeMatch> (<Q::rdf:type>,
3492 wakaba 1.89 database_arg => $self,
3493     srinfo => $srinfo)) {
3494 wakaba 1.81 ## TODO: Remove this.
3495 wakaba 1.49 $has_type = true;
3496 wakaba 1.48 my $type_uri = $ce-><AG::DISElement.qnameValueURI>;
3497     my $type = $self-><M::DISDatabase.getResource> ($type_uri);
3498 wakaba 1.80 $res-><M::DISAnyResource.addTypeURI> ($type_uri);
3499 wakaba 1.48 $type-><AS::DISAnyResource.isReferred> ($ce);
3500     if ($type-><M::DISResource.isSubsetOfURI>
3501 wakaba 1.89 (<Q::dis:MultipleResource>,
3502     srinfo => $srinfo)) {
3503 wakaba 1.7 $is_multires = true;
3504     }
3505 wakaba 1.48 } elsif ($ce-><M::DISElement.elementTypeMatch>
3506 wakaba 1.49 (<Q::dis:subsetOf>,
3507 wakaba 1.89 database_arg => $self,
3508     srinfo => $srinfo)) {
3509 wakaba 1.48 my $sres = $self-><M::DISDatabase.getResource>
3510     ($ce-><M::DISElement.tfqnamesValueURI>
3511 wakaba 1.50 ($$node_id, $forArg,
3512 wakaba 1.49 for_arg => $forArg, forp_arg => $forpArg,
3513     database_arg => $self));
3514 wakaba 1.89 $res-><M::DISResource.addSuperResource> ($sres, srinfo => $srinfo);
3515 wakaba 1.48 } elsif ($ce-><AG::DISElement.isResourceElement>) {
3516 wakaba 1.7 push @cres, $ce;
3517 wakaba 1.48 } elsif ($ce-><M::DISElement.elementTypeMatch>
3518 wakaba 1.49 (<Q::dis:dataType>,
3519 wakaba 1.89 database_arg => $self,
3520     srinfo => $srinfo)) {
3521 wakaba 1.48 my $uri = $ce-><AG::DISElement.qnameValueURI>;
3522     __CODE{dv:createURI::
3523     $uri => $uri,
3524     $result => {$res->{<Q::dis:dataType>}},
3525 wakaba 1.60 $name => {$ce-><AG::SWCFGElement.expandedURI>},
3526 wakaba 1.48 }__;
3527     my $type = $self-><M::DISDatabase.getResource> ($uri);
3528     $type-><AS::DISAnyResource.isReferred> ($ce);
3529     } elsif ($ce-><M::DISElement.elementTypeMatch>
3530 wakaba 1.89 (<Q::dis:multipleProperties>,
3531     database_arg => $self,
3532     srinfo => $srinfo)) {
3533 wakaba 1.48 my $uri = $ce-><AG::DISElement.qnameValueURI>;
3534     __CODE{dv:createURI::
3535     $uri => $uri,
3536     $result => {$res->{<Q::dis:multipleProperties>}},
3537 wakaba 1.60 $name => {$ce-><AG::SWCFGElement.expandedURI>},
3538 wakaba 1.48 }__;
3539     my $type = $self-><M::DISDatabase.getResource> ($uri);
3540     $type-><AS::DISAnyResource.isReferred> ($ce);
3541 wakaba 1.7 } else {
3542     ## Property and invalid element is not checked, since not
3543     ## all property definitions has loaded at this stage.
3544     push @props, $ce;
3545     }
3546     } # @ce0
3547    
3548 wakaba 1.49 unless ($has_type) {
3549     __UNDEEP{__EXCEPTION{NO_RDF_TYPE_ERR::
3550     DIS:uri => {$res->{uri}},
3551     DIS:sourceNode => {$el},
3552     }__}__;
3553     }
3554    
3555 wakaba 1.85 my $srres = $srinfo->{resource}->{$res-><AG::DISAnyResource.uri>};
3556     F: for my $auri (%{$srres->{aliasURI} or {}}) {
3557     next F unless $srres->{aliasURI}->{$auri};
3558     $res->{aliasURI}->{$auri} = true;
3559     A: for (keys %{$res->{subOf} or {}}) {
3560     next A unless $res->{subOf}->{$_};
3561     my $s = $self-><M::DISDatabase.getResource> ($_);
3562     $s->{supOf}->{$auri} = true;
3563     }
3564     A: for (keys %{$res->{supOf} or {}}) {
3565     next A unless $res->{supOf}->{$_};
3566     my $s = $self-><M::DISDatabase.getResource> ($_);
3567     $s->{subOf}->{$auri} = true;
3568     }
3569     }
3570     F: for my $suri (keys %{$srres->{supOf} or {}}) {
3571     next F unless $srres->{supOf}->{$suri};
3572     my $sres = $self-><M::DISDatabase.getResource> ($suri);
3573 wakaba 1.89 $sres-><M::DISResource.addSuperResource> ($res, srinfo => $srinfo);
3574     }
3575     F: for my $suri (keys %{$srres->{subOf} or {}}) {
3576     next F unless $srres->{subOf}->{$suri};
3577     my $sres = $self-><M::DISDatabase.getResource> ($suri);
3578     $res-><M::DISResource.addSuperResource> ($sres, srinfo => $srinfo);
3579 wakaba 1.85 }
3580    
3581 wakaba 1.7 ## -- Child resources
3582     unless ($is_multires) {
3583     for my $re (@cres) {
3584     unless ($al_node) {
3585     $self-><M::ManakaiDISDatabase.loadResource>
3586     ($mod, $res, $res, $re,
3587 wakaba 1.32 for_arg => $forArg, forp_arg => $forpArg,
3588 wakaba 1.85 on_resource_read => $onResourceRead,
3589     srinfo => $srinfo);
3590 wakaba 1.5 } else {
3591 wakaba 1.7 my $ac = $re-><M::ManakaiDISElement.disGetAttribute>
3592     (<Q::dis:aliasChild>, for_arg => $forArg,
3593 wakaba 1.49 forp_arg => $forpArg,
3594     database_arg => $self);
3595 wakaba 1.48 if ($ac and $ac-><M::SWCFGNode.value>) {
3596 wakaba 1.7 $self-><M::ManakaiDISDatabase.loadResource>
3597     ($mod, $res, $res, $re,
3598 wakaba 1.32 for_arg => $forArg, forp_arg => $forpArg,
3599 wakaba 1.85 on_resource_read => $onResourceRead,
3600     srinfo => $srinfo);
3601 wakaba 1.7 }
3602 wakaba 1.4 }
3603     }
3604 wakaba 1.7 }
3605 wakaba 1.5
3606 wakaba 1.7 ## -- Multiple representations
3607     if ($is_multires) {
3608     for my $pe (@props) {
3609     if ($pe-><M::ManakaiDISElement.elementTypeMatch>
3610 wakaba 1.49 (<Q::dis:resourceFor>,
3611 wakaba 1.89 database_arg => $self,
3612     srinfo => $srinfo)) {
3613 wakaba 1.14 my $for_uri = $pe-><AG::ManakaiDISElement.qnameValueURI>;
3614 wakaba 1.7 my $for = $self-><M::ManakaiDISDatabase.getFor> ($for_uri);
3615 wakaba 1.48 $for-><AS::DISAnyResource.isReferred> ($pe);
3616 wakaba 1.7 $self-><M::ManakaiDISDatabase.loadResource>
3617     ($mod, $parentResource, $res, $el,
3618     for_arg => $forArg,
3619 wakaba 1.32 forp_arg => [@{$forpArg}, $for_uri],
3620 wakaba 1.85 on_resource_read => $onResourceRead,
3621     srinfo => $srinfo);
3622 wakaba 1.7 }
3623     }
3624     }
3625 wakaba 1.48 ($onResourceRead or sub {})->($self, $res);
3626     }__; # DEEP
3627 wakaba 1.2
3628 wakaba 1.48 @Method:
3629     @@Name: readProperties
3630     @@enDesc:
3631     Reads property values in the source tree and
3632     removes the source tree from the database.
3633     @@NamedParam:
3634     @@@Name: onResourceRead
3635     @@@Type:
3636 wakaba 1.60 DISPerl:CODE::ManakaiDOM:all
3637 wakaba 1.48 @@@enDesc:
3638     An event handler called when a resource is read.
3639     @@@nullCase:
3640     @@@@enDesc:
3641     No event handler is read.
3642     @@Return:
3643     @@@RaiseException:
3644     @@@@@: UNSUPPORTED_ELEMENT_TYPE_ERR
3645     @@@@enDesc:
3646     There is an element whose element type is not supported.
3647 wakaba 1.2 @@@PerlDef:
3648 wakaba 1.48 __DEEP{
3649 wakaba 1.89 F: for my $fd (values %{$self->{modDef}},
3650     values %{$self->{forDef}},
3651     values %{$self->{resDef}}) {
3652     next F if $fd->isa (<ClassName::ManakaiDISModuleLite>);
3653 wakaba 1.48 if ($fd-><AG::DISAnyResource.isDefined>) {
3654     $fd-><M::DISAnyResource.readProperties>
3655     (on_resource_read => $onResourceRead);
3656     }
3657     }
3658 wakaba 1.53 CORE::delete $self->{<H::DIS|sourceFile>};
3659 wakaba 1.48 }__;
3660 wakaba 1.10
3661 wakaba 1.48 @Method:
3662     @@Name: checkUndefinedResource
3663 wakaba 1.44 @@enDesc:
3664 wakaba 1.48 Checks whether there is referred but undefined resource or not.
3665     @@Return:
3666     @@@RaiseException:
3667     @@@@@: FOR_NOT_DEFINED_ERR
3668     @@@@enDesc:
3669     There is a <QUOTE::for> that is referred but not defined.
3670     @@@RaiseException:
3671     @@@@@: RESOURCE_NOT_DEFINED_ERR
3672     @@@@enDesc:
3673     There is a resource that is referred but not defined.
3674 wakaba 1.44 @@@PerlDef:
3675 wakaba 1.48 for my $fd (values %{$self->{forDef}}) {
3676     if (my $ref = $fd-><AG::DISAnyResource.isReferred> and
3677     not $fd-><AG::DISAnyResource.isDefined>) {
3678     __EXCEPTION{FOR_NOT_DEFINED_ERR::
3679     DIS:uri => {$fd-><AG::DISAnyResource.uri>},
3680     DIS:sourceNodePath => {$ref},
3681     }__;
3682     }
3683     }
3684     for my $fd (values %{$self->{resDef}}) {
3685     if (my $ref = $fd-><AG::DISAnyResource.isReferred> and
3686     not $fd-><AG::DISAnyResource.isDefined>) {
3687     __EXCEPTION{RESOURCE_NOT_DEFINED_ERR::
3688     DIS:uri => {$fd-><AG::DISAnyResource.uri>},
3689     DIS:sourceNodePath => {$ref},
3690     }__;
3691     }
3692     }
3693 wakaba 1.85
3694     @Method:
3695     @@Name: unloadModule
3696     @@enDesc:
3697     Removes a module and resources defined in the module
3698     from the database.
3699     @@Param:
3700     @@@Name: module
3701     @@@Type: DISModule
3702     @@@enDesc:
3703     The module to remove.
3704     @@NamedParam:
3705     @@@Name: srinfo
3706     @@@Type: DISPerl|HASH||ManakaiDOM|all
3707     @@@enDesc:
3708     A hash returned by <M::DISDatabase.unloadModule>, to
3709     restore super-resource relationship later. The hash
3710     returned by the method is built based on this value.
3711     @@@nullCase:
3712     @@@@enDesc:
3713     If it is not the updating.
3714     @@Return:
3715     @@@Type: DISPerl|HASH||ManakaiDOM|all
3716     @@@enDesc:
3717     {LI:: <CODE::resource> or <CODE::for>:::
3718    
3719     {LI:: <VAR::Resource URI>:::
3720    
3721     {LI:: <CODE::supOf>:::
3722    
3723     - <VAR::Superset URI>::: A <DOM::true> value
3724    
3725     where <VAR::resource URI> is a URI of the resource
3726     (either canonical URI or an alias URI defined within
3727     the module) and <VAR::superset URI> is a URI
3728     from the list of superset URI of the resource minus
3729     the list of alias URIs (including the canonical URI)
3730     of the resource.
3731    
3732     }
3733    
3734     {LI:: <CODE::aliasURI>:::
3735    
3736     - <VAR::Alias URI>::: A <DOM::true> value
3737    
3738     where <VAR::alias URI> is an alias URI of the resource
3739     defined by other module.
3740    
3741     }
3742     }
3743     }
3744     @@@PerlDef:
3745     __DEEP{
3746     $r = $srinfo || {};
3747    
3748     ## -- |For|s
3749     F: for my $for (@{$module-><M::DISModule.getForResourceList>}) {
3750     my $uri = $for-><AG::DISAnyResource.uri>;
3751     A: for (%{$for->{ISA} or {}}) {
3752     next A unless $for->{ISA}->{$_};
3753     my $sfor = $self-><M::DISDatabase.getFor> ($_);
3754     next A unless $sfor;
3755     delete $sfor->{revISA}->{$uri};
3756     }
3757     A: for (%{$for->{revISA} or {}}) {
3758     next A unless $for->{revISA}->{$_};
3759     my $sfor = $self-><M::DISDatabase.getFor> ($_);
3760     next A unless $sfor;
3761     delete $sfor->{ISA}->{$uri};
3762     $r->{for}->{$uri}->{supOf}->{$_} = true;
3763     }
3764     delete $self->{forDef}->{$uri};
3765     delete $self->{<H::DIS|resourceModuleMap>}->{$uri};
3766     } # F
3767    
3768     ## -- Resources
3769 wakaba 1.86 my @res_list = map {
3770     [$_, $self-><M::DISDatabase.getResource> ($_)]
3771     } @{$module-><M::DISModule.getResourceURIList>};
3772     my %res_list = map {$_->[0] => true} @res_list;
3773     for my $ur (@res_list) {
3774     my $uri = $ur->[0];
3775     my $res = $ur->[1];
3776     my $owner = $res-><AG::DISAnyResource.ownerModule>;
3777     if (defined $owner and $owner eq $module) {
3778 wakaba 1.85 ## Non-alias
3779     my %alias;
3780     my %sub = %{$res->{supOf} or {}};
3781     A: for (keys %{$res->{aliasURI} or {}}) {
3782     next A unless $res->{aliasURI}->{$_};
3783     $alias{$_} = true;
3784     delete $sub{$_} if $res->{aliasURI}->{$_};
3785     $r->{resource}->{$uri}->{supOf} = \%sub;
3786     unless ($res_list{$_}) {
3787     ## Defined by other module
3788     $r->{resource}->{$uri}->{aliasURI}->{$_} = true;
3789     }
3790     }
3791     A: for (keys %{$res->{subOf} or {}}) {
3792     next A unless $res->{aliasURI}->{$_};
3793     my $sres = $self-><M::DISDatabase.getResource> ($_);
3794     next A unless $sres;
3795     delete $res->{supOf}->{$_} for keys %alias;
3796     }
3797     A: for (keys %{$res->{supOf} or {}}) {
3798     next A unless $res->{aliasURI}->{$_};
3799     my $sres = $self-><M::DISDatabase.getResource> ($_);
3800     next A unless $sres;
3801     delete $res->{subOf}->{$_} for keys %alias;
3802     }
3803     A: for (keys %alias) {
3804     delete $self->{resDef}->{$_};
3805     delete $self->{<H::DIS|resourceModuleMap>}->{$_};
3806     }
3807     } else {
3808     ## Alias
3809     delete $res->{aliasURI}->{$uri};
3810     delete $res->{subOf}->{$uri};
3811     delete $res->{supOf}->{$uri};
3812 wakaba 1.86 A: for (keys %{$res->{subOf} or {}}) {
3813 wakaba 1.85 next A unless $res->{subOf}->{$_};
3814     my $sres = $self-><M::DISDatabase.getResource> ($_);
3815     next A unless $sres;
3816     delete $sres->{supOf}->{$uri};
3817     }
3818 wakaba 1.86 A: for (keys %{$res->{supOf} or {}}) {
3819 wakaba 1.85 next A unless $res->{supOf}->{$_};
3820     my $sres = $self-><M::DISDatabase.getResource> ($_);
3821     next A unless $sres;
3822     delete $sres->{subOf}->{$uri};
3823     }
3824     delete $self->{resDef}->{$uri};
3825     delete $self->{<H::DIS|resourceModuleMap>}->{$uri};
3826     }
3827     }
3828    
3829     ## -- Keys
3830     my $v = $module->{<H::dp|plHashKey>};
3831     K: for my $scope (keys %{$v or {}}) {
3832 wakaba 1.89 my $ks = $self-><M::DISDatabase.getResource> ($scope);
3833 wakaba 1.85 L: for my $key (keys %{$v->{$scope} or {}}) {
3834     next L unless $v->{$scope}->{$key};
3835 wakaba 1.89 delete $ks->{<H::dp|plHashKey>}->{$key};
3836 wakaba 1.85 }
3837     }
3838    
3839     ## -- Module itself
3840     for (@{$module-><AG::DISAnyResource.uris>}) {
3841     delete $self->{modDef}->{$_};
3842     }
3843     }__;
3844 wakaba 1.48
3845     @Method:
3846     @@Name: xcrefToResource
3847 wakaba 1.10 @@enDesc:
3848 wakaba 1.48 Returns a resource object selected by an exception code
3849     reference (<Q::DOMMain:XCodeRef>).
3850 wakaba 1.10 @@Param:
3851 wakaba 1.48 @@@Name: xcref
3852 wakaba 1.10 @@@Type:
3853 wakaba 1.48 DOMMain:XCodeRef::ManakaiDOM:all
3854 wakaba 1.10 @@@enDesc:
3855 wakaba 1.48 Exception code to select.
3856 wakaba 1.2 @@Param:
3857 wakaba 1.48 @@@Name: contextNode
3858 wakaba 1.50 @@@Type: NSResolverDIS
3859 wakaba 1.48 @@@enDesc:
3860     A context element node. Namespace prefixes in
3861     <P::xcref> are resolved against this node.
3862     @@ForParam:
3863     @@NodeParam:
3864 wakaba 1.2 @@Return:
3865     @@@Type:
3866 wakaba 1.60 DISPerl:ARRAY::ManakaiDOM:all
3867 wakaba 1.48 @@@enDesc:
3868     A reference to the array containing two or three
3869     resource definitions (<Class::ManakaiDISResourceDefinition>).
3870     The first (index <CODE::0>) resource is an exception class.
3871     The second (index <CODE::1>) resource is an exception code
3872     constant. The third (index <CODE::2>) resource
3873     is an exception subtype or <DOM::null> if the reference identifies
3874     no subtype.
3875     @@@RaiseException:
3876     @@@@@: RESOURCE_NOT_DEFINED_ERR
3877 wakaba 1.2 @@@@enDesc:
3878 wakaba 1.48 The resource identified by the <P::xcref> is not defined
3879     or not an exception.
3880 wakaba 1.2 @@@PerlDef:
3881 wakaba 1.48 my ($q1, $q2, $q3) = split /\s*\.\s*/, $xcref, 3;
3882     __DEEP{
3883     if (defined $q3) {
3884     $r->[2] = $self-><M::ManakaiDISDatabase.getResource>
3885     ($contextNode-><M::NSResolverDIS.tfqnamesToURI>
3886     ($q3, null, $forArg, node => $node));
3887 wakaba 1.54 $r->[1] = $r->[2]-><AG::DIS|DISResource.parentResource>;
3888 wakaba 1.48 } elsif (defined $q2) {
3889     if ($q2 =~ /:/) {
3890     $r->[1] = $self-><M::ManakaiDISDatabase.getResource>
3891     ($contextNode-><M::NSResolverDIS.tfqnamesToURI>
3892     ($q2, null, $forArg, node => $node));
3893     } else {
3894     $r->[0] = $self-><M::ManakaiDISDatabase.getResource>
3895     ($contextNode-><M::NSResolverDIS.tfqnamesToURI>
3896     ($q1, null, $forArg, node => $node));
3897     $r->[1] = $r->[0]-><M::ManakaiDISResourceDefinition
3898     .getConstResourceByName> ($q2);
3899     }
3900     } else { ## $q1 only
3901     $r->[2] = $self-><M::ManakaiDISDatabase.getResource>
3902     ($contextNode-><M::NSResolverDIS.tfqnamesToURI>
3903     ($q1, null, $forArg, node => $node));
3904 wakaba 1.79 if ($r->[2]-><M::DISAnyResource.isTypeURI> (<Q::dx:ErrorSubCode>)) {
3905 wakaba 1.54 $r->[1] = $r->[2]-><AG::DIS|DISResource.parentResource>;
3906 wakaba 1.48 } else {
3907     $r->[1] = $r->[2]; CORE::delete $r->[2];
3908     }
3909     }
3910 wakaba 1.2
3911 wakaba 1.48 if ($r->[2] and
3912 wakaba 1.79 not $r->[2]-><M::DISAnyResource
3913 wakaba 1.64 .isTypeURI> (<Q::dx:ErrorSubCode>)) {
3914 wakaba 1.48 __UNDEEP{__EXCEPTION{RESOURCE_NOT_DEFINED_ERR::
3915     DIS:uri => {$r->[2]->{uri}},
3916 wakaba 1.64 DIS:expectedType => {<Q::dx:ErrorSubCode>},
3917 wakaba 1.48 DIS:sourceNode => {$node},
3918     DIS:sourceCode => {$xcref},
3919     }__}__;
3920     }
3921     $r->[2]-><AS::DISAnyResource.isReferred>
3922     ($node or $contextNode)
3923     if $r->[2];
3924    
3925     if (not $r->[1] or
3926 wakaba 1.79 not $r->[1]-><M::DISAnyResource
3927 wakaba 1.48 .isTypeURI> (<Q::ManakaiDOM:Const>)) {
3928     __UNDEEP{__EXCEPTION{RESOURCE_NOT_DEFINED_ERR::
3929 wakaba 1.63 DIS:uri => {($r->[1] ? $r->[1]-><AG::DIS|DISAnyResource.uri>
3930     : null)},
3931     DIS:localName => {($r->[1] ? $r->[1]-><AG::DIS|DISAnyResource
3932     .localName> : null)},
3933 wakaba 1.48 DIS:expectedType => {<Q::ManakaiDOM:Const>},
3934     DIS:sourceNode => {$node},
3935     DIS:sourceCode => {$xcref},
3936     }__}__;
3937     }
3938     $r->[1]-><AS::DISAnyResource.isReferred>
3939     ($node or $contextNode);
3940 wakaba 1.5
3941 wakaba 1.48 unless ($r->[0]) {
3942 wakaba 1.54 my $cg = $r->[1]-><AG::DIS|DISResource.parentResource>;
3943     $r->[0] = $cg-><AG::DIS|DISResource.parentResource> if $cg;
3944 wakaba 1.48 }
3945     if (not $r->[0] or
3946 wakaba 1.79 not $r->[0]-><M::DISAnyResource
3947 wakaba 1.60 .isTypeURI> (<Q::dx:AnyExceptionAnyClass>)) {
3948 wakaba 1.48 __UNDEEP{__EXCEPTION{RESOURCE_NOT_DEFINED_ERR::
3949     DIS:uri => {$r->[0]->{uri}},
3950 wakaba 1.59 DIS:localName => {$r->[0]-><AG::DIS|DISAnyResource.localName>},
3951 wakaba 1.60 DIS:expectedType => {<Q::dx:AnyExceptionAnyClass>},
3952 wakaba 1.48 DIS:sourceNode => {$node},
3953     DIS:sourceCode => {$xcref},
3954     }__}__;
3955 wakaba 1.5 }
3956 wakaba 1.48 $r->[0]-><AS::DISAnyResource.isReferred>
3957     ($node or $contextNode);
3958 wakaba 1.7 }__;
3959 wakaba 1.5
3960 wakaba 1.38 @Method:
3961     @@Name: getFeature
3962     @@Description:
3963     @@@lang:en
3964     @@@@:
3965     Returns a specialized object that implements the specialized
3966     interfaces of the specified feature and version.
3967     @@Param:
3968     @@@Name: feature
3969     @@@Type:
3970     DISLang:String::ManakaiDOM:all
3971     @@@actualType:
3972     ManakaiDOM:ManakaiDOMFeatureName::ManakaiDOM:ManakaiDOMLatest
3973     @@@Description:
3974     @@@@lang:en
3975     @@@@@:
3976     A feature name to request.
3977     @@Param:
3978     @@@Name: version
3979     @@@Type:
3980     DISLang:String::ManakaiDOM:all
3981     @@@actualType:
3982     ManakaiDOM:ManakaiDOMFeatureVersion::ManakaiDOM:ManakaiDOMLatest
3983     @@@Description:
3984     @@@@lang:en
3985     @@@@@:
3986     A feature version number to request.
3987     @@Return:
3988 wakaba 1.39 @@@Type:
3989     DOMMain:Object::ManakaiDOM:all
3990 wakaba 1.38 @@@Description:
3991     @@@@lang:en
3992     @@@@@:
3993     An object that implements the specialized APIs of the
3994     <P::feature> and <P::version>.
3995 wakaba 1.49 @@@nullCase:
3996     @@@@enDesc:
3997 wakaba 1.38 There is no object available that implements interfaces
3998     associated with the <P::feature> and <P::version>.
3999     @@@PerlDef:
4000     $feature =~ s/^\+//;
4001     CLASS: for my $class (grep {
4002 wakaba 1.48 $Message::Util::DIS::ManakaiDISDatabase::CompatClass{$_}
4003     } keys %Message::Util::DIS::ManakaiDISDatabase::CompatClass) {
4004 wakaba 1.38 if ($Message::DOM::ClassFeature{$class}->{$feature}->{$version}) {
4005 wakaba 1.39 $r = bless {o => $self}, $class;
4006 wakaba 1.38 last CLASS;
4007     }
4008     }
4009    
4010 wakaba 1.22 @Method:
4011 wakaba 1.48 @@Name: free
4012 wakaba 1.22 @@enDesc:
4013 wakaba 1.48 Marks the database, resources in the database, and source
4014     <QUOTE::dis> document trees in the database as no longer used.
4015     @@ForCheck: ManakaiDOM|ForClass
4016 wakaba 1.22 @@Return:
4017     @@@PerlDef:
4018 wakaba 1.53 for my $file (values %{$self->{<H::DIS|sourceFile>}}) {
4019 wakaba 1.48 $file-><M::ManakaiNode|ManakaiNodeRef||ManakaiDOM|Perl.free>
4020     if $file;
4021     }
4022     CORE::delete $self->{modDef};
4023     CORE::delete $self->{forDef};
4024     CORE::delete $self->{resDef};
4025 wakaba 1.62
4026     @Method:
4027     @@Name: getModuleURIList
4028     @@enDesc:
4029     Returns a snapshot list of URIs of modules in the database.
4030     @@Return:
4031     @@@Type: DISPerl|ARRAY||ManakaiDOM|all
4032     @@@enDesc:
4033     A snapshot list of URIs.
4034     @@@PerlDef:
4035     $r = [map {$_-><AG::DIS|DISAnyResource.uri>} values %{$self->{modDef}}];
4036    
4037     @Method:
4038     @@Name: getAnyResourceURIList
4039     @@enDesc:
4040     Returns a snapshot list of URIs of resources in the database.
4041     @@Return:
4042     @@@Type: DISPerl|ARRAY||ManakaiDOM|all
4043     @@@enDesc:
4044     A snapshot list of URIs.
4045     @@@PerlDef:
4046     $r = [keys %{$self->{<H::DIS|resourceModuleMap>}},
4047     map {$_-><AG::DIS|DISAnyResource.uri>} values %{$self->{modDef}}];
4048 wakaba 1.81
4049     @IntMethod:
4050     @@Operator: ManakaiDOM|MUErrorHandler
4051     @@enDesc:
4052     When a <IF::ecore|ErrorInterface||ManakaiDOM|Perl> is <Perl::report>ed
4053     with an <Perl::-object> of <IF::Node>, then this method is invoked.
4054    
4055     The method calls the <cfg::error-handler> if the error is of
4056     <IF::c|DOMError>. Otherwise, including the cases of
4057     <IF::DOMCore|DOMException>s,
4058     the error is rethrown so that appropriate <Perl::catch> clause
4059     can catch the error.
4060     @@enImplNote:
4061     For implementations which does not have the
4062     <IF::c|DOMError||ManakaiDOM|ManakaiDOM3> interface, the method
4063     is defined in the <Class::ManakaiDOM|ManakaiDOMObject> class
4064     and it is not overridden here.
4065     @@Param:
4066     @@@Name: err
4067     @@@Type: ecore|ErrorInterface||ManakaiDOM|Perl
4068     @@@enDesc:
4069     The reported error object.
4070     @@Return:
4071     @@@Type: DISPerl|Any||ManakaiDOM|Perl
4072     @@@enDesc:
4073     If the <P::err> is a <IF::c|DOMError>, then the return value
4074     of the error handler.
4075    
4076     {NOTE:: If the error is thrown, the method never returns.
4077     }
4078     @@@nullCase:
4079     @@@@enDesc:
4080     No error handler.
4081     @@@PerlDef:
4082     if ($err->isa (<IFName::c|DOMError||ManakaiDOM|ManakaiDOM>)) {
4083     __DEEP{
4084     my $cfg = $self-><AG::DISDatabase.domConfig>;
4085     my $h = $cfg-><M::DOMConfig.getParameter> ('error-handler');
4086 wakaba 1.83 $r = $h-><M::DOMCore|DOMErrorHandler||ManakaiDOM|ManakaiDOMLatest
4087     .handleError> ($err);
4088 wakaba 1.81 }__;
4089     } else {
4090     $err-><M::ecore|ErrorInterface||ManakaiDOM|Perl.throw>;
4091     }
4092    
4093     @Attr:
4094     @@Name: domConfig
4095     @@enDesc:
4096     The configuration of the document.
4097     @@Get:
4098     @@@Type: DOMConfig
4099     @@@enDesc: The DOM configuration object.
4100     @@@PerlDef:
4101     __CODE{c|getConfigObject||ManakaiDOM|ManakaiDOMLatest::
4102     $target => $self,
4103     $targetHash => {$self},
4104     $targetType => {<IFName::DISDatabase>},
4105     $result => $r,
4106     }__;
4107 wakaba 1.85
4108     @Method:
4109     @@Name: getModuleResourceList
4110     @@enDesc:
4111     Returns a snapshot list of modules contained in the database.
4112     @@Return:
4113     @@@Type: ResourceList
4114     @@@enDesc:
4115     A snapshot list of the modules.
4116     @@@PerlDef:
4117     $r = [map {$self->{modDef}->{$_}}
4118     grep {defined $self->{modDef}->{$_}}
4119     keys %{$self->{modDef}}];
4120 wakaba 1.48 ##DISDatabase
4121    
4122 wakaba 1.81 CParamApp:
4123     @c:domConfigurationParameter: c|error-handler||ManakaiDOM|ManakaiDOMLatest
4124     @c:targetType: DISDatabase
4125    
4126     ElementTypeBinding:
4127     @Name: CParamApp
4128     @ElementType:
4129     dis:ResourceDef
4130     @ShadowContent:
4131     @@rdf:type: c|DOMConfigurationParameterApplication
4132     @@For: DIS|ForLatest
4133    
4134 wakaba 1.48 PropDef:
4135 wakaba 1.54 @QName: DIS|resourceModuleMap
4136     @enDesc:
4137     Resource-module mapping table.
4138     @DIS:key: rm
4139     @Type: DISPerl|HASH
4140    
4141     PropDef:
4142 wakaba 1.48 @QName: sourceNodeID
4143     @enDesc:
4144     The URI reference of the source node identifier.
4145 wakaba 1.55 @rdfs:domain: DIS|DISResource||DIS|ForEmpty
4146     @DIS:key: snid
4147     @Type: DISPerl|SCALAR
4148 wakaba 1.24
4149 wakaba 1.48 PropDef:
4150 wakaba 1.55 @QName: DIS|resource
4151     @enDesc:
4152 wakaba 1.48 Resources defined in a module.
4153 wakaba 1.55 @rdfs:range: DIS|DISResource||DIS|ForEmpty
4154     @rdfs:domain: DIS|DISModule||DIS|ForEmpty
4155     @DIS:key: mres
4156     @Type: DISPerl|ARRAY
4157 wakaba 1.22
4158 wakaba 1.48 PropDef:
4159 wakaba 1.54 @QName: DIS|parentResource
4160 wakaba 1.48 @enDesc:
4161     Static parent resource. No parent for root resources.
4162 wakaba 1.54 @DIS:key: puri
4163 wakaba 1.27
4164 wakaba 1.48 PropDef:
4165 wakaba 1.54 @QName: DIS|dynamicParentResource
4166 wakaba 1.48 @enDesc:
4167     Dynamic parent resource. No parent for root resources.
4168 wakaba 1.54 @DIS:key: dpuri
4169 wakaba 1.25
4170 wakaba 1.48 PropDef:
4171 wakaba 1.54 @QName: DIS|childResource
4172 wakaba 1.48 @enDesc:
4173     Static child resources.
4174 wakaba 1.54 @DIS:key: curis
4175 wakaba 1.35
4176 wakaba 1.48 PropDef:
4177 wakaba 1.54 @QName: DIS|dynamicChildResource
4178 wakaba 1.48 @enDesc:
4179     Dynamic child resources.
4180 wakaba 1.54 @DIS:key: dcuris
4181    
4182     PropDef:
4183     @QName: DIS|key
4184     @enDesc:
4185     Property name in resource objects.
4186     @rdfs:subPropertyOf: DISPerl|propHashKey
4187     @dataType: DISCore|String
4188     @multipleProperties: DISCore|Single
4189    
4190     ResourceDef:
4191     @QName: DIS|DISResourceList
4192     @enDesc:
4193     A reference to array whose items are resource
4194     (<IF::DIS|DISAnyResource||DIS|ForEmpty>) objects.
4195     @rdfs:subClassOf: DISPerl|ARRAY
4196     @For: =ManakaiDOM|all
4197     @rdf:type: DISLang|DataType
4198     @For: DIS|ForEmpty !=DIS|ForEmpty
4199     @AliasFor:
4200     @@@@: ||ManakaiDOM|all
4201     @@@For: DIS|ForEmpty
4202 wakaba 1.38
4203 wakaba 1.48 ElementTypeBinding:
4204     @Name: ForDefDupException
4205     @ElementType:
4206     ManakaiDOM:raises
4207     @ShadowContent:
4208     @@@: FOR_ALREADY_DEFINED_ERR
4209     @@Description:
4210     @@@lang:en
4211     @@@@:
4212     The <QUOTE::for> is already defined elsewhere.
4213 wakaba 1.27
4214 wakaba 1.48 ElementTypeBinding:
4215     @Name: ForDefNoQNameException
4216     @ElementType:
4217     ManakaiDOM:raises
4218     @ShadowContent:
4219     @@@: NO_FOR_QNAME_ERR
4220     @@Description:
4221     @@@lang:en
4222     @@@@:
4223     A <Q::dis:ForDef> element must have a <Q::dis:QName> attribute.
4224 wakaba 1.22
4225 wakaba 1.48 ElementTypeBinding:
4226     @Name: ResDefDupException
4227     @ElementType:
4228     ManakaiDOM:raises
4229     @ShadowContent:
4230     @@@: RESOURCE_ALREADY_DEFINED_ERR
4231     @@Description:
4232     @@@lang:en
4233     @@@@:
4234     The <QUOTE::dis> resource is already defined elsewhere.
4235 wakaba 1.24
4236 wakaba 1.48 ElementTypeBinding:
4237     @Name: ElementNotAllowedException
4238     @ElementType:
4239     ManakaiDOM:raises
4240     @ShadowContent:
4241     @@@: ELEMENT_NOT_ALLOWED_ERR
4242     @@Description:
4243     @@@lang:en
4244     @@@@:
4245     An element has found where it is not allowed.
4246 wakaba 1.24
4247 wakaba 1.48 IFClsDef:
4248     @IFQName: DISModuleResolver
4249     @ClsQName: ManakaiDISModuleResolver
4250 wakaba 1.22
4251 wakaba 1.48 @enDesc:
4252     Objects implementing <IF::DISModuleResolver> interface
4253     are used to convert module name into <QUOTE::dis> document object.
4254     \
4255     {NOTE:: It is also acceptable to pass a <Perl::CODE> reference
4256     as a method parameter where <IF::DISModuleResolver> is
4257     expected.
4258     \
4259     }
4260 wakaba 1.24 @Method:
4261 wakaba 1.48 @@Name: uriToDocument
4262 wakaba 1.32 @@enDesc:
4263 wakaba 1.48 Returns a <QUOTE::dis> document from module name information.
4264     @@Param:
4265     @@@Name: disDB
4266     @@@Type: DISDatabase
4267     @@@clsActualType: ManakaiDISDatabase
4268     @@@enDesc:
4269     The <QUOTE::dis> database.
4270     @@Param:
4271     @@@Name: moduleURI
4272     @@@Type: ModuleURI
4273     @@@enDesc:
4274     The URI reference of the module.
4275     \
4276     {NOTE:: This parameter is redundant, since it can be
4277     composed from other three parameters.
4278     \
4279     }
4280     @@Param:
4281     @@@Name: moduleNamespaceURI
4282     @@@Type: AnyURI
4283     @@@enDesc:
4284     The namespace URI of the module name.
4285     @@Param:
4286     @@@Name: moduleLocalName
4287     @@@Type:
4288     DISCore:LocalName::ManakaiDOM:all
4289     @@@enDesc:
4290     The local name of the module name.
4291 wakaba 1.24 @@Param:
4292 wakaba 1.48 @@@Name: moduleFor
4293     @@@Type: ForURI
4294 wakaba 1.24 @@@enDesc:
4295 wakaba 1.48 The <QUOTE::for> URI reference for which the module is defined.
4296 wakaba 1.24 @@Return:
4297 wakaba 1.48 @@@Type: DISDocument
4298     @@@clsActualType: ManakaiDISDocument
4299 wakaba 1.24 @@@enDesc:
4300 wakaba 1.48 The <QUOTE::dis> document. It don't have to be a newly created
4301     object.
4302     @@@nullCase:
4303     @@@@enDesc:
4304     The method is unable to resolve the reference.
4305 wakaba 1.24 @@@PerlDef:
4306 wakaba 1.72 goto &$self;
4307 wakaba 1.48
4308     @ResourceDef:
4309     @@rdf:type: DISLang|InputProcessor
4310     @@PerlDef:
4311     $INPUT = bless $INPUT, <ClassName::ManakaiDISModuleResolver>
4312     if ref $INPUT eq 'CODE';
4313     ##DISModuleResolver
4314 wakaba 1.22
4315 wakaba 1.24 PropDef:
4316 wakaba 1.48 @QName: sourceFile
4317     @enDesc:
4318     Source <QUOTE::dis> documents.
4319     @rdfs:domain: DISDatabase
4320     @rdfs:range: DISDocument
4321    
4322     IFClsDef:
4323     @IFQName: DISAnyResource
4324     @ClsQName: ManakaiDISAnyResource
4325    
4326 wakaba 1.52 @ClsISA: DOMFeature|ManakaiHasFeatureByGetFeature||ManakaiDOM|ManakaiDOMLatest
4327    
4328 wakaba 1.24 @enDesc:
4329 wakaba 1.48 {P:: A <IF::DISAnyResource> object represents a resource defined
4330     in <QUOTE::dis> files. In <QUOTE::dis> model, resources are
4331     categorized as:
4332    
4333     - Module::: A <QUOTE::dis> module is a file entity.
4334     This kind of objects <kwd:MUST> implement the
4335     <IF::DISModule> interface.
4336    
4337     - <QUOTE::For>::: A <QUOTE::for> is a target for which
4338     resources are defined. This kind of objects
4339     <kwd:MUST> implement the <IF::DISFor> interface.
4340    
4341     - <QUOTE::dis> Resource::: Something described in <QUOTE::dis>.
4342     This kind of objects <kwd:MUST> implement the
4343     <IF::DISModule> interface.
4344 wakaba 1.24
4345 wakaba 1.48 }
4346 wakaba 1.22
4347 wakaba 1.48 The objects implementing this interface <kwd:MUST> also implement
4348     the <IF::DOMMinImpl> interface.
4349 wakaba 1.47
4350 wakaba 1.48 @Attr:
4351     @@Name: uri
4352     @@Type: AnyURI
4353     @@Description:
4354     @@@lang:en
4355     @@@@:
4356     The URI reference of the resource.
4357     @@Get:
4358     @@@enDesc:
4359     The representive URI reference of the resource.
4360 wakaba 1.21
4361 wakaba 1.48 {NOTE:: The URI might be non-persistent if the
4362     resource is not assigned a URI in <QUOTE::dis> source file,
4363     in which case a URI is randomly-generated at the
4364     time of object generation.
4365     }
4366     @@@PerlDef:
4367     $r = $self->{uri};
4368 wakaba 1.54
4369     @Attr:
4370     @@Name: uriRef
4371     @@Type: DISPerl|SCALAR||ManakaiDOM|all
4372     @@enDesc:
4373     A reference to the URI of the resource.
4374    
4375     {NOTE:: Applications <kwd:MUST-NOT> modify the referenced
4376     value directly.
4377     }
4378     @@Get:
4379     @@@PerlDef: $r = \ ($self->{uri});
4380 wakaba 1.48
4381     @Attr:
4382     @@Name: uris
4383     @@Type:
4384 wakaba 1.60 DISPerl:Array::ManakaiDOM:all
4385 wakaba 1.48 @@enDesc:
4386     A set of URIs that identifies the resource.
4387     @@Get:
4388     @@@enDesc:
4389     A reference to array in which the URIs are contained
4390     in undefined order.
4391 wakaba 1.38
4392 wakaba 1.48 {NOTE:: The array is <EM::not> live; it is only a snapshot.
4393     }
4394 wakaba 1.47
4395 wakaba 1.48 @Method:
4396     @@Name: isSameResource
4397 wakaba 1.21 @@Operator:
4398     @@@@:eq
4399     @@@ContentType:
4400     lang:Perl
4401     @@enDesc:
4402 wakaba 1.48 Whether two resources are same or not. Two resources are
4403     same if and only if their <A::DISAnyResource.uri> are
4404     equivalent as strings (i.e. in character-by-character based matching).
4405 wakaba 1.21 @@Param:
4406     @@@Name: anotherResource
4407 wakaba 1.48 @@@Type: DISAnyResource
4408 wakaba 1.21 @@@enDesc:
4409 wakaba 1.48 Another resource object to compare.
4410 wakaba 1.21 @@Return:
4411     @@@Type:
4412     DOMMain:boolean::ManakaiDOM:all
4413     @@@enDesc:
4414 wakaba 1.48 Whether two resources are same or not.
4415     @@@TrueCase:
4416     @@@@enDesc: Two resources are same.
4417     @@@FalseCase:
4418     @@@@enDesc: Two resources are different.
4419 wakaba 1.21 @@@PerlDef:
4420     if (UNIVERSAL::isa ($anotherResource,
4421 wakaba 1.48 <ClassName::ManakaiDISAnyResource>)) {
4422 wakaba 1.21 $r = $self->{uri} eq $anotherResource->{uri};
4423     }
4424 wakaba 1.2
4425     @Attr:
4426     @@Name: nameURI
4427     @@Type: NameURI
4428     @@enDesc:
4429 wakaba 1.48 The URI reference of this module, without
4430 wakaba 1.2 <QUOTE::for> identifier.
4431     @@Get:
4432 wakaba 1.49 @@@enDesc:
4433     The name URI of the resource.
4434     @@@nullCase:
4435     @@@@enDesc:
4436     The resource has no name URI.
4437    
4438     {NOTE:: A resource has no URI if and only if the resource
4439     has no local name.
4440     }
4441 wakaba 1.3 @@@PerlDef:
4442 wakaba 1.49 if (defined $self->{localName}) {
4443     $r = defined $self->{namespaceURI}
4444 wakaba 1.59 ? ${$self->{namespaceURI}} . ${$self->{localName}}
4445     : ${$self->{localName}};
4446 wakaba 1.49 }
4447 wakaba 1.2
4448     @Attr:
4449 wakaba 1.48 @@Name: localName
4450 wakaba 1.32 @@enDesc:
4451 wakaba 1.48 The local name of this module.
4452 wakaba 1.32
4453 wakaba 1.48 {NOTE:: <QUOTE::for> resources has no local name.
4454     }
4455 wakaba 1.2 @@Type:
4456 wakaba 1.3 DISCore:LocalName::ManakaiDOM:all
4457 wakaba 1.2 @@Get:
4458     @@@PerlDef:
4459 wakaba 1.59 $r = defined $self->{localName} ? ${$self->{localName}} : null;
4460 wakaba 1.2
4461     @Attr:
4462     @@Name: namespaceURI
4463     @@Type: AnyURI
4464     @@enDesc:
4465     The namespace URI of the name of this resource.
4466 wakaba 1.48
4467     {NOTE:: <QUOTE::for> resources has no namespace URI.
4468     }
4469 wakaba 1.2 @@Get:
4470     @@@PerlDef:
4471 wakaba 1.59 $r = defined $self->{namespaceURI} ? ${$self->{namespaceURI}} : null;
4472 wakaba 1.2
4473     @Attr:
4474     @@Name: forURI
4475 wakaba 1.48 @@Type: ForURI
4476 wakaba 1.2 @@enDesc:
4477 wakaba 1.48 The <QUOTE::for> URI reference for which this module is defined.
4478 wakaba 1.2 @@Get:
4479     @@@PerlDef:
4480 wakaba 1.59 $r = defined $self->{for} ? ${$self->{for}} : null;
4481 wakaba 1.2
4482     @Attr:
4483     @@Name: forpURI
4484     @@enDesc:
4485     The <QUOTE::for+> URI references for which this resource is defined.
4486 wakaba 1.48
4487     {NOTE:: <QUOTE::for> resources has no <QUOTE::for+> URI.
4488     }
4489 wakaba 1.2 @@Type: ForURIList
4490     @@Get:
4491 wakaba 1.15 @@@enDesc:
4492     List of <QUOTE::for> URI references. Note that this list is
4493     <QUOTE::dead>.
4494 wakaba 1.3 @@@PerlDef:
4495 wakaba 1.15 $r = [@{$self->{forp}}];
4496    
4497     @Method:
4498     @@Name: isForURI
4499     @@enDesc:
4500     Tests whether this resource is defined for a <QUOTE::for>
4501     or <QUOTE::for+> URI reference or not.
4502     @@Param:
4503     @@@Name:forURI
4504     @@@Type:ForURI
4505     @@@enDesc:
4506     A <QUOTE::for> URI reference to test.
4507     @@Return:
4508     @@@Type:
4509     DOMMain:boolean::ManakaiDOM:all
4510     @@@TrueCase:
4511     @@@@enDesc:
4512     This resource is for <P::forURI>.
4513     @@@FalseCase:
4514     @@@@enDesc:
4515     This resource is not for <P::forURI>.
4516     @@@PerlDef:
4517     __DEEP{
4518 wakaba 1.59 C: for my $this_for_uri (${$self->{for}||\''}, @{$self->{forp}||[]}) {
4519 wakaba 1.15 if ($this_for_uri eq $forURI) { ## Shortcut
4520     $r = true;
4521 wakaba 1.48 last C;
4522 wakaba 1.15 }
4523 wakaba 1.48 my $this_for = $self->{db}-><M::DIS|DISDatabase.getFor>
4524 wakaba 1.15 ($this_for_uri);
4525 wakaba 1.48 if ($this_for-><M::DIS|DISFor.isaURI> ($forURI)) {
4526 wakaba 1.15 $r = true;
4527 wakaba 1.48 last C;
4528 wakaba 1.15 }
4529     }
4530     }__;
4531 wakaba 1.48
4532     @Attr:
4533     @@Name: isDefined
4534 wakaba 1.2 @@Description:
4535     @@@lang:en
4536     @@@@:
4537 wakaba 1.48 Whether this module is defined or not.
4538     @@Type:
4539     DOMMain:boolean::ManakaiDOM:all
4540     @@Get:
4541     @@@PerlDef:
4542 wakaba 1.53 $r = $self->{<H::DIS|isDefined>};
4543 wakaba 1.79 @@Set:
4544     @@@PerlDef:
4545     $self->{<H::DIS|isDefined>} = $given;
4546 wakaba 1.48
4547     @Attr:
4548     @@Name: ownerModule
4549     @@enDesc:
4550     The module in which the resource is defined. If the resource
4551     is a module, the module itself is the attribute value.
4552     @@Get:
4553     @@@Type: DISModule
4554     @@@clsActualType: ManakaiDISModuleDefinition
4555     @@@enDesc:
4556     The owner module object.
4557     @@@nullCase:
4558 wakaba 1.2 @@@@enDesc:
4559 wakaba 1.48 The resource is not part of any module since
4560     its definition is not read (i.e. <A::DISAnyResource.isDefined> is
4561 wakaba 1.79 <DOM::false>) or since it is created in memory.
4562 wakaba 1.2 @@@PerlDef:
4563 wakaba 1.48 $r = $self->{db}
4564     -><M::DISDatabase.getModule>
4565 wakaba 1.53 (${$self->{<H::DIS|definingModule>}})
4566     if defined $self->{<H::DIS|definingModule>};
4567 wakaba 1.2
4568 wakaba 1.48 @Attr:
4569 wakaba 1.54 @@Name: ownerModuleURI
4570     @@enDesc:
4571     A URI of the owner module of the resource.
4572     @@Type: DIS|AnyURI
4573     @@nullCase:
4574     @@@enDesc:
4575     The resource does not belong to any module since the
4576 wakaba 1.79 resource definition is not read yet or since
4577     it is created in memory.
4578 wakaba 1.54 @@Get:
4579     @@@PerlDef:
4580     if (defined $self->{<H::DIS|definingModule>}) {
4581     $r = ${$self->{<H::DIS|definingModule>}};
4582     }
4583    
4584     @Attr:
4585     @@Name: ownerModuleURIRef
4586     @@enDesc:
4587     A reference to a URI of the owner module of the resource.
4588     @@Type: DISPerl|SCALAR||ManakaiDOM|Perl
4589     @@nullCase:
4590     @@@enDesc:
4591     The resource does not belong to any module since the
4592 wakaba 1.79 resource definition is not read yet or since
4593     it is created in memory.
4594 wakaba 1.54 @@Get:
4595     @@@PerlDef:
4596     $r = $self->{<H::DIS|definingModule>};
4597 wakaba 1.88 @@Set:
4598     @@@PerlDef:
4599     $self->{<H::DIS|definingModule>} = $given;
4600 wakaba 1.54
4601     @Attr:
4602 wakaba 1.48 @@Name: isReferred
4603     @@Description:
4604     @@@lang:en
4605     @@@@:
4606     Whether the resource is referenced somewhere or not.
4607     @@Type: DISLang|String||ManakaiDOM|all
4608     @@Get:
4609     @@@enDesc:
4610     A node path string that identifies the node from
4611     which the resource is referenced.
4612     @@@nullCase:
4613     The resource is not referred.
4614     @@@PerlDef:
4615 wakaba 1.53 $r = $self->{<H::DIS|isReferred>};
4616 wakaba 1.48 @@Set:
4617 wakaba 1.7 @@@enDesc:
4618 wakaba 1.48 A node path string that identifies the node from
4619     which the resource is referenced.
4620     @@@InCase:
4621     @@@@Type: DISElement
4622     @@@@enDesc:
4623     The resource is referenced by the element. It's node path
4624     string is set as the attribute value.
4625     @@@PerlDef:
4626     if (defined $given) {
4627     if (ref $given) {
4628 wakaba 1.72 __DEEP{
4629 wakaba 1.50 if ($given->isa (<IFName::dv|DVValue>)) {
4630     $given = $given-><AG::dv|DVValue.sourceNodePath>;
4631     } else {
4632     $given = $given-><M::SWCFGNode.flag> ('nodePath') ||
4633     $given-><M::SWCFGNode.nodePath>
4634 wakaba 1.52 (key => [qw/QName Name type Type/]);
4635 wakaba 1.50 }
4636 wakaba 1.72 }__;
4637 wakaba 1.48 }
4638 wakaba 1.53 $self->{<H::DIS|isReferred>} = $given;
4639 wakaba 1.48 }
4640    
4641     @Attr:
4642     @@Name: sourceNodeID
4643     @@enDesc:
4644     The identifier URI reference of the source node.
4645     @@enDesc:
4646     @@@ForCheck: ManakaiDOM|ForClass
4647     @@@@:
4648     Modules and <QUOTE::for>s does not have source node identifier
4649     in the current implementation.
4650     @@Type: AnyURI
4651     @@Get:
4652     @@@nullCase:
4653     @@@@enDesc:
4654     The resource is not (yet) associated with any source node.
4655     @@@PerlDef:
4656 wakaba 1.53 if (defined $self->{<H::DIS:sourceNodeID>}) {
4657     $r = ${$self->{<H::DIS:sourceNodeID>}};
4658 wakaba 1.50 } else {
4659     $r = null;
4660     }
4661     @@Set:
4662     @@@PerlDef:
4663     if (defined $given) {
4664 wakaba 1.53 $self->{<H::DIS:sourceNodeID>} = \$given;
4665 wakaba 1.50 } else {
4666 wakaba 1.53 CORE::delete $self->{<H::DIS:sourceNodeID>};
4667 wakaba 1.50 }
4668    
4669     @Attr:
4670     @@Name: sourceNodeIDRef
4671     @@enDesc:
4672     The identifier URI reference of the source node.
4673     @@enDesc:
4674     @@@ForCheck: ManakaiDOM|ForClass
4675     @@@@:
4676     Modules and <QUOTE::for>s does not have source node identifier
4677     in the current implementation.
4678 wakaba 1.60 @@Type: DISPerl|SCALAR||ManakaiDOM|all
4679 wakaba 1.50 @@Get:
4680     @@@nullCase:
4681     @@@@enDesc:
4682     The resource is not (yet) associated with any source node.
4683     @@@PerlDef:
4684 wakaba 1.53 $r = $self->{<H::DIS:sourceNodeID>};
4685 wakaba 1.48 @@Set:
4686 wakaba 1.7 @@@PerlDef:
4687 wakaba 1.50 if (defined $given) {
4688 wakaba 1.53 $self->{<H::DIS:sourceNodeID>} = $given;
4689 wakaba 1.50 } else {
4690 wakaba 1.53 CORE::delete $self->{<H::DIS:sourceNodeID>};
4691 wakaba 1.50 }
4692 wakaba 1.7
4693 wakaba 1.2 @Attr:
4694 wakaba 1.48 @@Name: isAnonymous
4695     @@enDesc:
4696     Whether the resource has persistent name or not.
4697     @@Type:
4698 wakaba 1.18 DOMMain:boolean::ManakaiDOM:all
4699 wakaba 1.2 @@Get:
4700     @@@TrueCase:
4701 wakaba 1.48 This resource does <EM::not> have any globally unique name.
4702     <A::DISAnyResource.uri> is a temporary URI reference.
4703 wakaba 1.2 @@@FalseCase:
4704 wakaba 1.48 This resource does have its formal name.
4705     <A::DISAnyResource.uri> is a URI reference
4706     generated from the name and the <QUOTE::for> URI reference
4707     of this resource.
4708 wakaba 1.2 @@@PerlDef:
4709 wakaba 1.53 $r = $self->{<H::DIS|isAnon>};
4710 wakaba 1.79 @@Set:
4711     @@@PerlDef:
4712     $self->{<H::DIS|isAnon>} = $given;
4713 wakaba 1.2
4714     @Attr:
4715 wakaba 1.48 @@Name: sourceElement
4716     @@enDesc:
4717     The source <QUOTE::dis> element node from which this
4718     definition is read.
4719 wakaba 1.2 @@Get:
4720 wakaba 1.48 @@@Type: DISElement
4721     @@@clsActualType: ManakaiDISElement
4722     @@@InCase:
4723     @@@@Type: DISModuleElement
4724     @@@@clsActualType: ManakaiDISModuleElement
4725     @@@@enDesc: If this resource is a module.
4726     @@@PerlDef: $r = $self->{src};
4727 wakaba 1.2 @@@nullCase:
4728 wakaba 1.48 @@@@enDesc:
4729     The definition is not yet read.
4730 wakaba 1.2
4731     @Attr:
4732 wakaba 1.48 @@Name: database
4733     @@enDesc:
4734     The <QUOTE::dis> database to which the resource belongs.
4735     @@Type: DISDatabase
4736     @@clsActualType: ManakaiDISDatabase
4737 wakaba 1.2 @@Get:
4738     @@@PerlDef:
4739 wakaba 1.48 $r = $self->{db};
4740    
4741 wakaba 1.6 @Method:
4742 wakaba 1.48 @@Name: readProperties
4743 wakaba 1.6 @@enDesc:
4744 wakaba 1.48 Reads property values in the source tree and
4745     removes reference to the source node.
4746     @@NamedParam:
4747     @@@Name: onResourceRead
4748     @@@Type:
4749 wakaba 1.60 DISPerl:CODE::ManakaiDOM:all
4750 wakaba 1.6 @@@enDesc:
4751 wakaba 1.48 An event handler called when a resource is read.
4752     @@@nullCase:
4753     @@@@enDesc:
4754     No event handler is read.
4755 wakaba 1.6 @@Return:
4756 wakaba 1.11 @@@RaiseException:
4757 wakaba 1.48 @@@@@: UNSUPPORTED_ELEMENT_TYPE_ERR
4758     @@@@enDesc:
4759     There is an element whose element type is not supported.
4760 wakaba 1.11 @@@PerlDef:
4761 wakaba 1.6 __DEEP{
4762 wakaba 1.48 if (my $src = $self->{src}) {
4763 wakaba 1.49 my $for = $self-><AG::DISAnyResource.forURI>;
4764     my $forp = $self-><AG::DISAnyResource.forpURI>;
4765     my $db = $self-><AG::DISAnyResource.database>;
4766 wakaba 1.48 for my $el (@{$src-><M::DISElement.disChildElements>
4767 wakaba 1.49 (for_arg => $for,
4768     forp_arg => $forp,
4769     database_arg => $db)}) {
4770 wakaba 1.48 my $xu = $el-><AG::SWCFGElement.expandedURI>;
4771     if ({
4772     <Q::dis:AliasFor> => true,
4773     <Q::dis:ContentType> => true,
4774     <Q::dis:dataType> => true,
4775     <Q::dis:For> => true,
4776     <Q::dis:ForCheck> => true,
4777     <Q::dis:Name> => true,
4778     <Q::dis:Namespace> => true,
4779     <Q::dis:multipleProperties> => true,
4780 wakaba 1.81 <Q::DISCore|resourceType> => true,
4781     <Q::rdf:type> => true, ## TODO: Remove this.
4782 wakaba 1.48 <Q::dis:QName> => true,
4783     <Q::dis:Require> => true,
4784     <Q::dis:resourceFor> => true,
4785     }->{$xu}) {
4786     #
4787 wakaba 1.49 } elsif ($el-><M::DISElement.isPropertyElement>
4788     (database_arg => $db)) {
4789 wakaba 1.48 my $add_prop;
4790     $add_prop = sub ($$$) {
4791     my ($self, $el, $db) = @_;
4792     my $prop = $db-><M::DISDatabase.getResource>
4793     ($el-><AG::SWCFGElement.expandedURI>);
4794     my $prop_uri = $prop-><AG::DISAnyResource.uri>;
4795     my $prop_mult = $prop-><AG::DISResource.multiplePropertiesURI>;
4796     my $new_value;
4797     my $base_type;
4798     my $copy_tree = false;
4799    
4800 wakaba 1.49 my %mtopt = (for_arg => $for,
4801     forp_arg => $forp,
4802 wakaba 1.48 default_media_type => $prop-><AG::DISResource
4803 wakaba 1.49 .defaultLextypeURI>,
4804     database_arg => $db);
4805 wakaba 1.51 my $new_value_type = $el-><M::DISElement.mediaTypeURI>(%mtopt);
4806    
4807 wakaba 1.48 if ($el-><M::DISElement.mediaTypeMatch>
4808 wakaba 1.68 (<Q::DISCore:QName>, $mtopt{default_media_type}, %mtopt)) {
4809 wakaba 1.48 __CODE{dv|createValue::
4810     $value => {null},
4811 wakaba 1.68 $base_type => {$base_type = <Q::DISCore:QName>},
4812 wakaba 1.50 $type => {$new_value_type},
4813 wakaba 1.48 $result => $new_value,
4814 wakaba 1.60 $name => {$prop_uri},
4815 wakaba 1.48 }__;
4816     $new_value-><AS::dv|DVQNameValue.localName>
4817     ($el-><AG::DISElement.qnameValueLocalName>);
4818     $new_value-><AS::dv|DVQNameValue.prefix>
4819 wakaba 1.49 (my $prefix = $el-><AG::DISElement.qnameValuePrefix>);
4820     if (not defined $prefix) {
4821     if ($el-><M::DISElement.mediaTypeMatch>
4822     (<Q::DISCore:LanguageTag>,
4823     $mtopt{default_media_type}, %mtopt)) {
4824     $new_value-><AS::dv|DVQNameValue.namespaceURI>
4825     ('urn:x-suika-fam-cx:lang:');
4826     } elsif ($el-><M::DISElement.mediaTypeMatch>
4827     (<Q::DISCore:ScriptTag>,
4828     $mtopt{default_media_type}, %mtopt)) {
4829     $new_value-><AS::dv|DVQNameValue.namespaceURI>
4830     ('http://suika.fam.cx/~wakaba/archive/2005/5/script#');
4831     } else {
4832     $new_value-><AS::dv|DVQNameValue.namespaceURI>
4833     ($el-><AG::DISElement.qnameValueNamespaceURI>);
4834     }
4835     } else {
4836     $new_value-><AS::dv|DVQNameValue.namespaceURI>
4837     ($el-><AG::DISElement.qnameValueNamespaceURI>);
4838     }
4839 wakaba 1.48 ## TODO: Check whether defined
4840     } elsif ($el-><M::DISElement.mediaTypeMatch>
4841     (<Q::dis:TFQNames>, $mtopt{default_media_type}, %mtopt) or
4842     $el-><M::DISElement.mediaTypeMatch>
4843     (<Q::DISCore:TFPQNames>, $mtopt{default_media_type}, %mtopt)) {
4844     __CODE{dv|createURI::
4845     $uri => {$el-><M::DISElement.tfqnamesValueURI>
4846     ($self-><AG::DISAnyResource.sourceNodeID>,
4847     $self-><AG::DISAnyResource.forURI>,
4848     for_arg => $self-><AG::DISAnyResource.forURI>,
4849 wakaba 1.49 forp_arg => $self-><AG::DISAnyResource.forpURI>,
4850     database_arg => $db)},
4851 wakaba 1.48 $result => $new_value,
4852 wakaba 1.60 $name => {$prop_uri},
4853 wakaba 1.48 }__;
4854     ## TODO: Check whether defined
4855 wakaba 1.50 $new_value_type = <Q::DISCore:URI>;
4856 wakaba 1.48 } elsif ($el-><M::DISElement.mediaTypeMatch>
4857     (<Q::lang:Perl>, $mtopt{default_media_type},
4858     %mtopt)) {
4859     $el-><M::DISElement.preserveNodePath>;
4860 wakaba 1.50 __CODE{dv|createValueRef::
4861     $value_ref => {$el-><AG::SWCFGNode.valueRef>},
4862 wakaba 1.49 $base_type => {$base_type = <Q::lang:Perl>},
4863 wakaba 1.50 $type => {$new_value_type},
4864 wakaba 1.48 $result => $new_value,
4865 wakaba 1.60 $name => $prop_uri,
4866 wakaba 1.48 }__;
4867     for my $p (<Q::dis:Type>, <Q::dis:actualType>) {
4868     if (UNIVERSAL::isa ($self->{$p},<IFName::dv|DVURIValue>)) {
4869     my $v;
4870     __CODE{dv|createURI::
4871     $uri => {$self->{$p}-><AG::dv|DVURIValue.uri>},
4872     $result => $v,
4873 wakaba 1.60 $name => $prop_uri,
4874 wakaba 1.48 }__;
4875     $new_value-><M::dv|DVValue.setProperty> ($p => $v);
4876     }
4877     }
4878 wakaba 1.49 $new_value-><AS::dv|DVNSValue.defaultNamespaceURIRef>
4879     ($el-><M::DISElement.getDefaultNamespaceURIRef>);
4880     $new_value-><AS::dv|DVNSValue.namespaceBindingList>
4881     ($el-><M::DISElement.getNamespaceBindingList> ($db));
4882     $new_value-><AS::dv|DVValue.sourceNodePath>
4883     ($el-><M::SWCFGNode.flag> ('nodePath'));
4884 wakaba 1.48 } elsif ($el-><M::DISElement.mediaTypeMatch>
4885     (<Q::lang:disdoc>, $mtopt{default_media_type},
4886     %mtopt) or
4887     $el-><M::DISElement.mediaTypeMatch>
4888     (<Q::lang:disdocInline>, $mtopt{default_media_type},
4889 wakaba 1.49 %mtopt) or
4890     $el-><M::DISElement.mediaTypeMatch>
4891     (<Q::lang:muf>, $mtopt{default_media_type},
4892 wakaba 1.74 %mtopt) or
4893     $el-><M::DISElement.mediaTypeMatch>
4894     (<Q::lang:dpg>, $mtopt{default_media_type},
4895 wakaba 1.77 %mtopt) or
4896     $el-><M::DISElement.mediaTypeMatch>
4897     (<Q::lang:tdterr>,
4898     $mtopt{default_media_type},
4899 wakaba 1.49 %mtopt)) {
4900     $el-><M::DISElement.preserveNodePath>;
4901 wakaba 1.50 __CODE{dv|createValueRef::
4902     $value_ref => {$el-><AG::SWCFGNode.valueRef>},
4903 wakaba 1.49 $base_type => {$base_type = <Q::lang:disdoc>},
4904 wakaba 1.50 $type => $new_value_type,
4905 wakaba 1.49 $result => $new_value,
4906 wakaba 1.60 $name => $prop_uri,
4907 wakaba 1.49 }__;
4908     $new_value-><AS::dv|DVNSValue.defaultNamespaceURIRef>
4909     ($el-><M::DISElement.getDefaultNamespaceURIRef>);
4910     $new_value-><AS::dv|DVNSValue.namespaceBindingList>
4911     ($el-><M::DISElement.getNamespaceBindingList> ($db));
4912     $new_value-><AS::dv|DVValue.sourceNodePath>
4913     ($el-><M::SWCFGNode.flag> ('nodePath'));
4914     } elsif ($el-><M::DISElement.mediaTypeMatch>
4915 wakaba 1.52 (<Q::dx|XCRef>,
4916     $mtopt{default_media_type}, %mtopt)) {
4917     my $x = $db-><M::DISDatabase.xcrefToResource>
4918     ($el-><M::SWCFGNode.value>,
4919 wakaba 1.59 $el, node => $el,
4920     for_arg => $self-><AG::DIS|DISAnyResource.forURI>);
4921 wakaba 1.52 __CODE{dv|createURI::
4922     $uri => {($x->[2] or $x->[1] or $x->[0])
4923     -><AG::DISAnyResource.uri>},
4924     $result => $new_value,
4925 wakaba 1.60 $name => $prop_uri,
4926 wakaba 1.52 }__;
4927     $new_value-><M::dv|DVURIValue.getResource> ($db)
4928     -><AS::DISAnyResource.isReferred> ($el);
4929     $new_value_type = <Q::DISCore:URI>;
4930     } elsif ($el-><M::DISElement.mediaTypeMatch>
4931     (<Q::DISLang|MemberRef>,
4932     $mtopt{default_media_type}, %mtopt)) {
4933     my $v = $el-><M::SWCFGNode.value>;
4934     $v =~ s/^\s+//; $v =~ s/\s+$//;
4935     my ($clsq, $mem, $gs) = split /\s*\.\s*/, $v, 3;
4936     my $res;
4937     if (defined $mem) {
4938     my $cls = $db-><M::DISDatabase.getResource>
4939     ($el-><M::DISElement.tfqnamesValueURI>
4940     ($clsq, $self-><AG::DISAnyResource.sourceNodeID>,
4941     $self-><AG::DISAnyResource.forURI>, node => $el));
4942     $cls-><AS::DISAnyResource.isReferred> ($el);
4943     $res = $cls-><M::DISResource.getChildResourceByNameAndType>
4944     ($mem, <Q::DISLang:AnyMethod>);
4945     unless ($res) {
4946     __UNDEEP{__EXCEPTION{DIS|RESOURCE_NOT_DEFINED_ERR::
4947     DIS:localName => {$mem},
4948     DIS:parentURI => {$cls-><AG::DISAnyResource.uri>},
4949     DIS:elementType => {$el-><AG::SWCFGElement
4950     .expandedURI>},
4951     DIS:sourceNode => {$el},
4952     DIS:sourceCode => {$v},
4953     DIS:expectedType => {
4954     defined $gs ? <Q::DISLang:Attribute>
4955     : <Q::DISLang:Method>
4956     },
4957     }__}__;
4958     }
4959     if (defined $gs) {
4960     $res = $res-><M::DISResource.getChildResourceByType>
4961     ($gs eq 'get' ? <Q::DISLang|AttributeGet>
4962     : <Q::DISLang|AttributeSet>);
4963     unless ($res) {
4964     __UNDEEP{__EXCEPTION{DIS|RESOURCE_NOT_DEFINED_ERR::
4965     DIS:parentURI => {$res-><AG::DISAnyResource.uri>},
4966     DIS:elementType => {$el-><AG::SWCFGElement
4967     .expandedURI>},
4968     DIS:sourceNode => {$el},
4969     DIS:sourceCode => {$v},
4970     DIS:expectedType => {
4971     $gs eq 'get' ? <Q::DISLang:AttributeGet>
4972     : <Q::DISLang:AttributeSet>
4973     },
4974     }__}__;
4975     }
4976     }
4977     } else {
4978     $res = $db-><M::DISDatabase.getResource>
4979     ($el-><M::DISElement.tfqnamesValueURI>
4980     ($clsq, $self-><AG::DISAnyResource.sourceNodeID>,
4981     $self-><AG::DISAnyResource.forURI>, node => $el));
4982     }
4983     $res-><AS::DISAnyResource.isReferred> ($el);
4984     __CODE{dv|createURI::
4985     $uri => {$el-><AG::DISAnyResource.uri>},
4986     $result => $new_value,
4987 wakaba 1.60 $name => $prop_uri,
4988 wakaba 1.52 }__;
4989     $new_value_type = <Q::DISCore:URI>;
4990     } elsif ($el-><M::DISElement.mediaTypeMatch>
4991 wakaba 1.49 (<Q::lang:dis>, $mtopt{default_media_type},
4992     %mtopt)) {
4993     $copy_tree = true;
4994 wakaba 1.48 $el-><M::DISElement.preserveNodePath>;
4995     my $elc = $el->clone;
4996     __CODE{dv|createValue::
4997     $value => {$elc},
4998 wakaba 1.49 $base_type => {$base_type = <Q::lang:dis>},
4999 wakaba 1.50 $type => $new_value_type,
5000 wakaba 1.48 $result => $new_value,
5001 wakaba 1.60 $name => $prop_uri,
5002 wakaba 1.48 }__;
5003 wakaba 1.49 $elc-><M::DISElement.unlinkFromDocument> ($db);
5004 wakaba 1.64 } elsif ($el-><M::DISElement.mediaTypeMatch>
5005     (<Q::DISCore:Integer>,
5006     $mtopt{default_media_type}, %mtopt)) {
5007     my $v = $el-><M::SWCFGNode.value>;
5008     if ($v =~ /^0x/) {
5009     $v = hex $v;
5010     } else {
5011     $v += 0;
5012     }
5013     __CODE{dv|createValue::
5014     $value => $v,
5015 wakaba 1.78 $base_type => {$base_type = <Q::DISCore:Integer>},
5016     $type => $new_value_type,
5017     $result => $new_value,
5018     $name => $prop_uri,
5019     }__;
5020     } elsif ($el-><M::DISElement.mediaTypeMatch>
5021     (<Q::DISCore:UString>,
5022     $mtopt{default_media_type}, %mtopt)) {
5023     my $v = $el-><M::SWCFGNode.value>;
5024     $v =~ s/\$\x0D?\x0A//gs;
5025     $v =~ s/\$\z//;
5026     warn 'String |'.$el-><M::SWCFGNode.value>.'| contains '.
5027     'illegal |$| character' if $v =~ /\$(?![uU])/;
5028     ## TODO: Use error-handler
5029     $v =~ s{\$(u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})}{
5030     chr hex substr $1, 1
5031     }ge;
5032     __CODE{dv|createValue::
5033     $value => $v,
5034 wakaba 1.64 $base_type => {$base_type = <Q::DISCore:String>},
5035 wakaba 1.78 $type => {<Q::DISCore:String>},
5036 wakaba 1.64 $result => $new_value,
5037     $name => $prop_uri,
5038     }__;
5039 wakaba 1.78 ## NOTE: Since |type| is set to |DISCore:String|,
5040     ## what subtype of |DISCore:UString| it was originally
5041     ## is not preserved.
5042 wakaba 1.48 } else {
5043     __CODE{dv|createValue::
5044     $value => {$el-><M::SWCFGNode.value>},
5045     $base_type => {$base_type = <Q::DISCore:String>},
5046 wakaba 1.50 $type => $new_value_type,
5047 wakaba 1.48 $result => $new_value,
5048 wakaba 1.60 $name => $prop_uri,
5049 wakaba 1.48 }__;
5050     }
5051    
5052     unless ($copy_tree) {
5053     for my $ce (@{$el-><M::DISElement.disChildElements>
5054 wakaba 1.49 (for_arg => $for,
5055     forp_arg => $forp,
5056     database_arg => $db)}) {
5057 wakaba 1.48 my $xu = $ce-><AG::SWCFGElement.expandedURI>;
5058     if ({
5059     <Q::dis:AliasFor> => true,
5060     <Q::dis:For> => true,
5061     <Q::dis:ForCheck> => true,
5062     <Q::dis:ContentType> => true,
5063     <Q::dis:resourceFor> => true,
5064     }->{$xu}) {
5065     #
5066 wakaba 1.49 } elsif ($ce-><M::DISElement.isPropertyElement>
5067     (database_arg => $db)) {
5068 wakaba 1.48 my $pr;
5069     __DEEP{
5070     $pr = $add_prop->($self, $ce, $db);
5071     }__;
5072     if ($pr->{prop_mult} eq <Q::DISCore|OrderedList>) {
5073     my $cpv = $new_value-><M::dv|DVValue.getProperty> ($xu);
5074     if (not $cpv) {
5075     __CODE{dv|createOrderedList::
5076     $result => {$cpv},
5077     $type => {$mtopt{default_media_type}},
5078     $base_type => {<Q::DISCore:String>},
5079     }__;
5080     $new_value-><M::dv|DVValue.setProperty> ($xu => $cpv);
5081     }
5082     $cpv-><M::dv|DVList.addItem> ($pr->{new_value});
5083     } elsif ($pr->{prop_mult} eq <Q::DISCore|UnorderedList>) {
5084     my $cpv = $new_value-><M::dv|DVValue.getProperty> ($xu);
5085     if (not $cpv) {
5086     __CODE{dv|createUnorderedList::
5087     $result => {$cpv},
5088     $type => {$mtopt{default_media_type}},
5089     $base_type => {<Q::DISCore:String>},
5090     }__;
5091     $new_value-><M::dv|DVValue.setProperty> ($xu => $cpv);
5092     }
5093     $cpv-><M::dv|DVList.addItem> ($pr->{new_value});
5094     } else {
5095     $new_value-><M::dv|DVValue.setProperty>
5096     ($xu => $pr->{new_value});
5097     }
5098     } else {
5099     __UNDEEP{__EXCEPTION{UNSUPPORTED_ELEMENT_TYPE_ERR::
5100     DIS:elementType => {$xu},
5101     DIS:sourceNode => {$ce},
5102     }__}__;
5103     }
5104     }} # copy_tree
5105    
5106     {new_value => $new_value, base_type => $base_type,
5107 wakaba 1.50 prop_uri => $prop_uri, prop_mult => $prop_mult,
5108     new_value_type => $new_value_type};
5109 wakaba 1.48 };
5110    
5111     my $pr;
5112     __DEEP{
5113 wakaba 1.49 $pr = $add_prop->($self, $el, $db);
5114 wakaba 1.48 }__;
5115     if ($pr->{prop_mult} eq <Q::DISCore|OrderedList>) {
5116     if (not $self->{$pr->{prop_uri}}) {
5117     __CODE{dv|createOrderedList::
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     } elsif ($pr->{prop_mult} eq <Q::DISCore|UnorderedList>) {
5126     if (not $self->{$pr->{prop_uri}}) {
5127     __CODE{dv|createUnorderedList::
5128     $result => {$self->{$pr->{prop_uri}}},
5129 wakaba 1.50 $type => {$pr->{new_value_type}},
5130 wakaba 1.48 $base_type => {$pr->{base_type} || <Q::DISCore:String>},
5131     }__;
5132     }
5133     $self->{$pr->{prop_uri}}-><M::dv|DVList.addItem>
5134     ($pr->{new_value});
5135     } else {
5136     $self->{$pr->{prop_uri}} = $pr->{new_value};
5137     }
5138 wakaba 1.53
5139     if ($el-><M::DISElement.elementTypeMatch>
5140     (<Q::DISPerl:propHashKey>, database_arg => $db)) {
5141     $db-><M::dp|DISDatabasePerl.plAddHashKey>
5142     ($xu => $pr->{new_value}-><AG::dv|DVValue.stringValue>
5143     => $self);
5144     }
5145 wakaba 1.48 } elsif ($el-><AG::DISElement.isResourceElement>) {
5146     ## TODO: Should rdf:type be validated?
5147     } else {
5148     __UNDEEP{__EXCEPTION{UNSUPPORTED_ELEMENT_TYPE_ERR::
5149     DIS:elementType => {$xu},
5150     DIS:sourceNode => {$el},
5151     }__}__;
5152     }
5153 wakaba 1.6 }
5154 wakaba 1.48 CORE::delete $self->{src};
5155     ($onResourceRead or sub () {})->($self, $self);
5156 wakaba 1.6 }
5157     }__;
5158 wakaba 1.61
5159     @Method:
5160     @@Name: isTypeURI
5161     @@enDesc:
5162     Tests whether this resource is of a type or not.
5163     @@Param:
5164     @@@Name: typeURI
5165     @@@Type: ResourceURI
5166     @@@enDesc:
5167     A type URI reference to test.
5168     @@Return:
5169     @@@Type:
5170     DOMMain:boolean::ManakaiDOM:all
5171     @@@TrueCase:
5172     @@@@enDesc:
5173     This is a <P::typeURI> resource.
5174     @@@FalseCase:
5175     @@@@enDesc:
5176     This is not a <P::typeURI> resource.
5177 wakaba 1.79 @@@PerlDef:
5178     __DEEP{
5179     $r = $self-><AG::DISAnyResource.typeResource>
5180     -><M::DISResource.isSubsetOfURI> ($typeURI);
5181     }__;
5182    
5183     @Attr:
5184     @@Name: revision
5185     @@enDesc:
5186     The revision number of the resource.
5187    
5188     {ISSUE::
5189     Is it necessary for revision numbers to hold some
5190     kind of globality?
5191     }
5192     @@Type: RevisionNumber
5193     @@Get:
5194     @@@PerlDef:
5195     $r = $self->{<H::DIS|revision>};
5196    
5197     @CODE:
5198     @@QName: setRevision
5199     @@enDesc:
5200     Sets new revision number to a resource.
5201     @@PerlDef:
5202     $resource->{<H::DIS|revision>} = time;
5203    
5204     @CODE:
5205     @@QName: updateRevision
5206     @@enDesc:
5207     Updates revision number of a resource.
5208    
5209     {ISSUE::
5210     How revision number should be increased?
5211     }
5212     @@PerlDef:
5213     $resource->{<H::DIS|revision>}++;
5214    
5215     @Method:
5216     @@Name: getTypeURIList
5217     @@enDesc:
5218     Returns a snapshot list of resource type URIs of the resource.
5219     @@Return:
5220     @@@Type: URIList
5221     @@@enDesc:
5222     A snapshot list of URIs.
5223     @@@PerlDef:
5224     __DEEP{
5225     $r = $self-><AG::DISAnyResource.typeResource>
5226     -><M::DISAnyResource.getSuperResourceURIList>;
5227     }__;
5228    
5229     @@Test:
5230     @@@QName: DISAnyResource.getTypeURIList.test
5231     @@@PerlDef:
5232     my $db;
5233     __CODE{createDISDBForTest:: $db => $db}__;
5234    
5235     $test->id ('module');
5236     my $mod1 = $db-><M::DISDatabase.getModule> ('about:module1');
5237     my %lm1 = map {$_ => true} @{$mod1-><M::DISAnyResource.getTypeURIList>};
5238    
5239     $test->assert_true ($lm1{<Q::DISCore|Module>});
5240     $test->assert_true ($lm1{<Q::DISCore|AnyResource>});
5241    
5242     $test->id ('for');
5243     my $for1 = $db-><M::DISDatabase.getFor> ('about:for1');
5244     my %lf1 = map {$_ => true} @{$for1-><M::DISAnyResource.getTypeURIList>};
5245    
5246     $test->assert_true ($lf1{<Q::DISCore|For>});
5247     $test->assert_true ($lf1{<Q::DISCore|AnyResource>});
5248    
5249     @@Test:
5250     @@@QName: DISAnyResource.resource.getTypeURIList.test
5251     @@@PerlDef:
5252     my $db;
5253     __CODE{createDISDBForTest:: $db => $db}__;
5254    
5255     $test->id ('resource');
5256     my $res1 = $db-><M::DISDatabase.getResource> ('about:resource1');
5257     my %lr1 = map {$_ => true} @{$res1-><M::DISAnyResource.getTypeURIList>};
5258    
5259     $test->assert_true ($lr1{<Q::DISCore|Resource>});
5260     $test->assert_true ($lr1{<Q::DISCore|AnyResource>});
5261    
5262     @Method:
5263     @@ForCheck: ManakaiDOM|ForIF
5264     @@Name: getSuperResourceURIList
5265     @@enDesc:
5266     Returns a snapshot list of super-resources URIs of the resource,
5267     including canonical and alias URIs of the resource itself.
5268     @@Return:
5269     @@@Type: URIList
5270     @@@enDesc:
5271     A snapshot list of URIs.
5272    
5273     @Attr:
5274     @@Name: typeResource
5275     @@enDesc:
5276     The most specific type of the resource.
5277     @@Type: DISResource
5278     @@Get:
5279     @@@PerlDef:
5280     __DEEP{
5281     $r = $self-><AG::DISAnyResource.database>
5282     -><M::DISDatabase.getResource> ($self->{<H::DIS|typeURI>});
5283     }__;
5284    
5285     @Method:
5286     @@Name: addTypeURI
5287     @@enDesc:
5288     Adds a URI to the list of types of the resource.
5289     @@Param:
5290     @@@Name: uri
5291     @@@Type: AnyResourceURI
5292     @@@enDesc:
5293     A URI to add.
5294     @@Return:
5295     @@@PerlDef:
5296     __DEEP{
5297     my $current_type = $self-><AG::DISAnyResource.typeResource>;
5298     unless ($current_type-><M::DISResource.isSubsetOfURI> ($uri)) {
5299     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.79 if ($res-><M::DISResource.isSubsetOfURI> ($current_uri)) {
5303 wakaba 1.80 $self->{<H::DIS|typeURI>} = $uri;
5304 wakaba 1.79 } else {
5305 wakaba 1.80 my $new_uri;
5306     __CODE{composeSubsetURI:: $input1 => $current_uri,
5307     $input2 => $uri,
5308     $output => $new_uri}__;
5309 wakaba 1.79 my $new_res = $db-><M::DISDatabase.getResource> ($new_uri);
5310 wakaba 1.80 unless ($new_res-><AG::DISAnyResource.isDefined>) {
5311     $new_res-><AS::DISAnyResource.isAnonymous> (true);
5312     $new_res-><AS::DISAnyResource.isDefined> (true);
5313     $new_res-><M::DISResource.addSuperResource> ($current_type);
5314     $new_res-><M::DISResource.addSuperResource> ($res);
5315     }
5316 wakaba 1.88 unless ($new_res-><AG::DISAnyResource.ownerModuleURIRef>) {
5317     $new_res-><AS::DISAnyResource.ownerModuleURIRef>
5318     ($res-><AG::DISAnyResource.ownerModuleURIRef>);
5319     }
5320 wakaba 1.79 $self->{<H::DIS|typeURI>} = $new_uri;
5321     }
5322     }
5323     }__;
5324    
5325     @@Test:
5326     @@@QName: DISAnyResource.addTypeURI.test
5327     @@@PerlDef:
5328     my $db;
5329     __CODE{createDISDBForTest:: $db => $db}__;
5330    
5331     my $res = $db-><M::DISDatabase.getResource> ('about:1');
5332     my $res2 = $db-><M::DISDatabase.getResource> ('about:2');
5333     $test->id ('initial.resource');
5334     $test->assert_true
5335     ($res-><M::DISAnyResource.isTypeURI> (<Q::DISCore|Resource>));
5336     $test->id ('initial.anyresource');
5337     $test->assert_true
5338     ($res-><M::DISAnyResource.isTypeURI>
5339     (<Q::DISCore|AnyResource>));
5340     $test->id ('initial.type1');
5341     $test->assert_false
5342     ($res-><M::DISAnyResource.isTypeURI> ('about:type1'));
5343    
5344     $res-><M::DISAnyResource.addTypeURI> ('about:type1');
5345    
5346     $test->id ('added.resource');
5347     $test->assert_true
5348     ($res-><M::DISAnyResource.isTypeURI> (<Q::DISCore|Resource>));
5349     $test->id ('added.anyresource');
5350     $test->assert_true
5351     ($res-><M::DISAnyResource.isTypeURI>
5352     (<Q::DISCore|AnyResource>));
5353     $test->id ('added.type1');
5354     $test->assert_true
5355     ($res-><M::DISAnyResource.isTypeURI> ('about:type1'));
5356    
5357     $test->id ('added2.resource');
5358     $test->assert_true
5359     ($res2-><M::DISAnyResource.isTypeURI>
5360     (<Q::DISCore|Resource>));
5361     $test->id ('added2.anyresource');
5362     $test->assert_true
5363     ($res2-><M::DISAnyResource.isTypeURI>
5364     (<Q::DISCore|AnyResource>));
5365     $test->id ('added2.type1');
5366     $test->assert_false
5367     ($res2-><M::DISAnyResource.isTypeURI> ('about:type1'));
5368 wakaba 1.81
5369     @CODE:
5370     @@QName: getMethodForType
5371     @@enDesc:
5372     Returns a method for a particular resource type.
5373    
5374     In: <Perl::$resource>, <Perl::$method_name>
5375    
5376     Out: <Perl::$method>
5377     @@PerlDef:
5378     my $__type = $resource-><AG::DISAnyResource.typeResource>;
5379     my $__type_uri = $__type-><AG::DISAnyResource.uri>;
5380     $method = $Message::Util::DIS::Method{$__type_uri}->{$method_name};
5381     unless ($method) {
5382     my %__methods;
5383     for (@{$__type-><M::DISAnyResource.getSuperResourceURIList>}) {
5384     $__methods{$_} = $Message::Util::DIS::Method{$_}->{$method_name}
5385     if $Message::Util::DIS::Method{$_}->{$method_name};
5386     }
5387     my $__db = $resource-><AG::DISAnyResource.database>;
5388     T1: for my $__t1_uri (keys %__methods) {
5389 wakaba 1.82 next T1 unless $__methods{$__t1_uri};
5390 wakaba 1.81 my $__t1 = $__db-><M::DISDatabase.getResource> ($__t1_uri);
5391     T2: for my $__t2_uri (keys %__methods) {
5392     next T2 if $__t1_uri eq $__t2_uri;
5393     if ($__t1-><M::DISResource.isSubsetOfURI> ($__t2_uri)) {
5394     delete $__methods{$__t2_uri};
5395 wakaba 1.82 next T2;
5396 wakaba 1.81 }
5397     if ($Message::Util::DIS::Method{$__t1_uri}->{$method_name}
5398     eq $Message::Util::DIS::Method{$__t2_uri}->{$method_name}) {
5399     delete $__methods{$__t2_uri};
5400 wakaba 1.82 next T2;
5401 wakaba 1.81 }
5402     }
5403     }
5404     if (keys %__methods > 1) {
5405     __c|ERROR{DIS|more-than-one-methods-for-a-type::
5406     DIS|uri => {$__type_uri},
5407     DIS|method-name => {$method_name},
5408     DIS|method-resource-types => {[keys %__methods]},
5409     }__;
5410     }
5411     $Message::Util::DIS::Method{$__type_uri}->{$method_name} =
5412     $method = $__methods{[keys %__methods]->[0]} if %__methods;
5413     }
5414    
5415     @IntMethod:
5416     @@Operator: ManakaiDOM|MUErrorHandler
5417     @@enDesc:
5418     When a <IF::ecore|ErrorInterface||ManakaiDOM|Perl> is <Perl::report>ed
5419     with an <Perl::-object> of <IF::Node>, then this method is invoked.
5420    
5421     The method calls the <cfg::error-handler> if the error is of
5422     <IF::c|DOMError>. Otherwise, including the cases of <IF::c|DOMException>s,
5423     the error is rethrown so that appropriate <Perl::catch> clause
5424     can catch the error.
5425     @@enImplNote:
5426     For implementations which does not have the
5427     <IF::c|DOMError||ManakaiDOM|ManakaiDOM3> interface, the method
5428     is defined in the <Class::ManakaiDOM|ManakaiDOMObject> class
5429     and it is not overridden here.
5430     @@Param:
5431     @@@Name: err
5432     @@@Type: ecore|ErrorInterface||ManakaiDOM|Perl
5433     @@@enDesc:
5434     The reported error object.
5435     @@Return:
5436     @@@Type: DISPerl|Any||ManakaiDOM|Perl
5437     @@@enDesc:
5438     If the <P::err> is a <IF::c|DOMError>, then the return value
5439     of the error handler.
5440    
5441     {NOTE:: If the error is thrown, the method never returns.
5442     }
5443     @@@nullCase:
5444     @@@@enDesc:
5445     No error handler.
5446     @@@PerlDef:
5447     if ($err->isa (<IFName::c|DOMError||ManakaiDOM|ManakaiDOM>)) {
5448     __DEEP{
5449     my $cfg = $self-><AG::DISAnyResource.database>
5450     -><AG::DISDatabase.domConfig>;
5451     my $h = $cfg-><M::DOMConfig.getParameter> ('error-handler');
5452 wakaba 1.83 $r = $h-><M::DOMCore|DOMErrorHandler||ManakaiDOM|ManakaiDOMLatest
5453     .handleError> ($err);
5454 wakaba 1.81 }__;
5455     } else {
5456     $err-><M::ecore|ErrorInterface||ManakaiDOM|Perl.throw>;
5457     }
5458 wakaba 1.84
5459     @Method:
5460     @@Name: getErrorInterfaceResource
5461     @@enDesc:
5462     Returns the <Q::ecore|ErrorInterface> resource
5463     to which the resource belongs.
5464     @@Return:
5465     @@@Type: DISAnyResource
5466     @@@enDesc:
5467     The interface resource.
5468     @@@nullCase:
5469     @@@@enDesc:
5470     If no resource found.
5471     @@@PerlDef:
5472     my $method;
5473     __CODE{DIS|getMethodForType::
5474     $resource => $self,
5475     $method_name => 'get_error_interface_resource',
5476     $method => $method,
5477     }__;
5478     if ($method) {
5479     __DEEP{
5480     $r = $method->(@_);
5481     }__;
5482     } else {
5483     $r = null;
5484     }
5485    
5486     @Method:
5487     @@Name: getErrorCodeResource
5488     @@enDesc:
5489     Returns the <Q::dx|ErrorCode> resource
5490     to which the resource belongs.
5491     @@Return:
5492     @@@Type: DISAnyResource
5493     @@@enDesc:
5494     The interface resource.
5495     @@@nullCase:
5496     @@@@enDesc:
5497     If no resource found.
5498     @@@PerlDef:
5499     my $method;
5500     __CODE{DIS|getMethodForType::
5501     $resource => $self,
5502     $method_name => 'get_error_code_resource',
5503     $method => $method,
5504     }__;
5505     if ($method) {
5506     __DEEP{
5507     $r = $method->(@_);
5508     }__;
5509     } else {
5510     $r = null;
5511     }
5512 wakaba 1.48 ##DISAnyResource
5513    
5514 wakaba 1.81 ResourceDef:
5515     @QName: DOMConfig
5516     @AliasFor: DOMCore|DOMConfiguration||ManakaiDOM|ManakaiDOMLatest
5517     @For: DIS|ForLatest
5518    
5519     ErrDef:
5520     @QName: DIS|more-than-one-methods-for-a-type
5521     @enDesc:
5522     If more than one different method implementations are defined
5523     for a resource type.
5524     @enMufDef:
5525     Method |%p (name => {<Q::DIS|method-name>});| for
5526     resource <%p (name => {<Q::DIS|uri>});> has multiple definitions
5527     @c:severity: DOMCore|SEVERITY_WARNING||ManakaiDOM|ManakaiDOMLatest
5528     @ecore:hasParameter:
5529     @@@: DIS|uri
5530     @@enDesc:
5531     A URI of the type.
5532     @ecore:hasParameter:
5533     @@@: DIS|method-name
5534     @@enDesc:
5535     The name of the method.
5536     @ecore:hasParameter:
5537     @@@: DIS|method-resource-types
5538     @@enDesc:
5539     The snapshot list of types for which methods are defined.
5540    
5541     XParamDef:
5542 wakaba 1.88 @QName: DIS|fileName
5543     @enDesc:
5544     The name of the file.
5545    
5546     XParamDef:
5547 wakaba 1.81 @QName: DIS|method-name
5548     @enDesc:
5549     The name of the method in question.
5550    
5551     XParamDef:
5552     @QName: DIS|method-resource-types
5553     @enDesc:
5554     The snapshot list of types for which methods are defined.
5555    
5556 wakaba 1.87 XParamDef:
5557     @QName: DIS|forURI
5558    
5559 wakaba 1.81 ElementTypeBinding:
5560     @Name: ErrDef
5561     @ElementType:
5562     dis:ResourceDef
5563     @ShadowContent:
5564     @@DISCore:resourceType: DOMCore|DOMErrorType
5565     @@For: DIS|ForLatest
5566     @@ecore:textFormatter: ecore|MUErrorFormatter||ManakaiDOM|Perl
5567    
5568 wakaba 1.79 URITypeDef:
5569     @QName: AnyResourceURI
5570     @enDesc:
5571     A URI that identifies a <Q::DISCore|AnyResource>.
5572    
5573     DataTypeDef:
5574     @QName: AnyResourceURIList
5575     @enDesc:
5576     A snapshot list of URIs that identify <Q::DISCore|AnyResource>s.
5577     @rdfs:subClassOf: DISPerl|ARRAY
5578    
5579     PropDef:
5580     @QName: DIS|typeURI
5581     @enDesc:
5582     The URI of the most specific type of the resource.
5583     @DIS:key: tu
5584    
5585 wakaba 1.48 IFClsDef:
5586     @IFQName: DISModule
5587     @ClsQName: ManakaiDISModuleDefinition
5588    
5589     @ClsISA: ManakaiDISPropertyAccessor
5590     @ClsISA: ManakaiDISPerlModuleDefinition
5591     @ClsISA: dp|ManakaiDISModulePerl
5592     @ClsISA: dp|ManakaiDISAnyResourcePerl
5593     @ClsISA: ManakaiDISAnyResource
5594    
5595     @Implement: DOMMinImpl
5596    
5597     @enDesc:
5598     <QUOTE::dis> module definitions.
5599    
5600     @enDesc:
5601     @@ForCheck: ManakaiDOM|ForIF
5602     @@@:
5603     The objects implementing the <IF::DISModule> interface <kwd:MUST>
5604     also implement the <IF::DISAnyResource> interface.
5605 wakaba 1.7
5606 wakaba 1.48 @DISLang:role: ModuleRole
5607    
5608     @Attr:
5609     @@ForCheck: ManakaiDOM|ForClass
5610     @@Name: uris
5611     @@Type:
5612 wakaba 1.60 DISPerl:Array::ManakaiDOM:all
5613 wakaba 1.7 @@enDesc:
5614 wakaba 1.48 A reference to the snapshot array containing the URI reference
5615     of the module.
5616     @@Get:
5617 wakaba 1.7 @@@PerlDef:
5618 wakaba 1.48 $r = [$self->{uri}];
5619 wakaba 1.8
5620     @Attr:
5621 wakaba 1.48 @@ForCheck: ManakaiDOM|ForClass
5622     @@Name: ownerModule
5623     @@ManakaiDOM:isRedefining:1
5624 wakaba 1.8 @@enDesc:
5625 wakaba 1.48 This module itself.
5626     @@Get:
5627     @@@Type: DISModule
5628     @@@clsActualType: ManakaiDISModuleDefinition
5629     @@@nullCase:
5630     @@@@enDesc:
5631     The resource is not part of any module since
5632     its definition is not read (<IF::DISModule.isDefined> is <DOM::false>).
5633     @@@PerlDef: $r = $self;
5634    
5635     @Method:
5636     @@ForCheck: ManakaiDOM|ForClass
5637     @@Name: getFeature
5638     @@Description:
5639     @@@lang:en
5640     @@@@:
5641     Returns a specialized object that implements the specialized
5642     interfaces of the specified feature and version.
5643     @@Param:
5644     @@@Name: feature
5645     @@@Type:
5646     DISLang:String::ManakaiDOM:all
5647     @@@actualType: DOMFeature|FeatureNameString||ManakaiDOM|ManakaiDOMLatest
5648     @@@Description:
5649     @@@@lang:en
5650     @@@@@:
5651     A feature name to request.
5652     @@Param:
5653     @@@Name: version
5654     @@@Type:
5655     DISLang:String::ManakaiDOM:all
5656     @@@actualType:
5657     DOMFeature|FeatureVersionString||ManakaiDOM|ManakaiDOMLatest
5658     @@@Description:
5659     @@@@lang:en
5660     @@@@@:
5661     A feature version number to request.
5662     @@Return:
5663     @@@Type:
5664     DOMMain:Object::ManakaiDOM:all
5665     @@@Description:
5666     @@@@lang:en
5667     @@@@@:
5668     An object that implements the specialized APIs of the
5669     <P::feature> and <P::version>.
5670 wakaba 1.49 @@@nullCase:
5671     @@@@enDesc:
5672 wakaba 1.48 There is no object available that implements interfaces
5673     associated with the <P::feature> and <P::version>.
5674     @@@PerlDef:
5675     $feature =~ s/^\+//;
5676     CLASS: for my $class (grep {
5677     $Message::Util::DIS::ManakaiDISModuleDefinition::CompatClass{$_}
5678     } keys %Message::Util::DIS::ManakaiDISModuleDefinition::CompatClass) {
5679     if ($Message::DOM::ClassFeature{$class}->{$feature}->{$version}) {
5680     $r = bless {o => $self}, $class;
5681     last CLASS;
5682 wakaba 1.27 }
5683 wakaba 1.8 }
5684    
5685 wakaba 1.55 @Method:
5686     @@Name: addResourceList
5687     @@enDesc:
5688     Adds a resource to the list of resources belongs to the module.
5689     @@Param:
5690     @@@Name: disResource
5691     @@@Type: DIS|DISResource
5692     @@@enDesc: The resource to add.
5693     @@Return:
5694     @@@PerlDef:
5695     __DEEP{
5696     push @{$self->{<H::DIS|resource>}||=[]},
5697 wakaba 1.85 map {\$_} @{$disResource-><AG::DIS|DISAnyResource.uris>};
5698 wakaba 1.55 }__;
5699 wakaba 1.86
5700     @Method:
5701     @@Name: addResourceURI
5702     @@enDesc:
5703     Adds a resource URI to the list of resources belongs to the module.
5704     @@Param:
5705     @@@Name: uri
5706     @@@Type: DISString
5707     @@@enDesc:
5708     The URI to add.
5709     @@Return:
5710     @@@PerlDef:
5711     push @{$self->{<H::DIS|resource>}||=[]}, \$uri;
5712    
5713     @Method:
5714     @@Name: getResourceURIList
5715     @@enDesc:
5716     Returns the list of URIs of resources belongs to the module.
5717     @@Return:
5718     @@@Type: AnyResourceURIList
5719     @@@enDesc:
5720     The snapshot list of URIs.
5721     @@@PerlDef:
5722     $r = [map {$$_} @{$self->{<H::DIS|resource>} or []}];
5723 wakaba 1.55
5724     @Method:
5725     @@Name: getResourceList
5726     @@enDesc:
5727     Returns the list of resources belongs to the module.
5728     @@Return:
5729     @@@Type: DIS|ResourceList
5730     @@@enDesc:
5731     The current snapshot of children.
5732     @@@PerlDef:
5733     __DEEP{
5734     my $db = $self-><AG::DIS|DISAnyResource.database>;
5735     $r = [map {
5736     $db-><M::DIS|DISDatabase.getResource> ($$_)
5737     } @{$self->{<H::DIS|resource>}}];
5738     }__;
5739 wakaba 1.57
5740 wakaba 1.85 @Method:
5741     @@Name: addForResource
5742     @@enDesc:
5743     Adds a <QUOTE::for> resource to the list of <QUOTE::for>
5744     resources belongs to the module.
5745     @@Param:
5746     @@@Name: disResource
5747     @@@Type: DISFor
5748     @@@enDesc: The resource to add.
5749     @@Return:
5750     @@@PerlDef:
5751     __DEEP{
5752     push @{$self->{<H::DIS|forList>}||=[]},
5753     $disResource-><AG::DISAnyResource.uriRef>;
5754     }__;
5755    
5756     @Method:
5757     @@Name: getForResourceList
5758     @@enDesc:
5759     Returns the list of <QUOTE::for> resources belongs to the module.
5760     @@Return:
5761     @@@Type: ResourceList
5762     @@@enDesc:
5763     The current snapshot list of <QUOTE::for> resources,
5764     which may or may not contains dupulications.
5765     @@@PerlDef:
5766     __DEEP{
5767     my $db = $self-><AG::DIS|DISAnyResource.database>;
5768     $r = [map {
5769     $db-><M::DIS|DISDatabase.getFor> ($$_)
5770     } @{$self->{<H::DIS|forList>}}];
5771     }__;
5772    
5773 wakaba 1.57 @Attr:
5774     @@Name: targetNamespaceURI
5775     @@enDesc:
5776     The default namespace URI of the resources defined in the module.
5777     @@Type: DIS|AnyURI
5778     @@Get:
5779     @@@PerlDef:
5780     $r = defined $self->{<H::DIS|defaultNamespaceURI>}
5781     ? ${$self->{<H::DIS|defaultNamespaceURI>}} : null;
5782     @@Set:
5783     @@@ForCheck: ManakaiDOM|ForClass
5784     @@@PerlDef:
5785     if (defined $given) {
5786     $self->{<H::DIS|defaultNamespaceURI>} = \$given;
5787     } else {
5788     CORE::delete $self->{<H::DIS|defaultNamespaceURI>};
5789     }
5790 wakaba 1.61
5791 wakaba 1.79 @CMethod:
5792     @@Name: getSuperResourceURIList
5793 wakaba 1.61 @@enDesc:
5794 wakaba 1.79 Returns a snapshot list of super-resources URIs of the resource,
5795     including canonical and alias URIs of the resource itself.
5796     @@Return:
5797     @@@Type: URIList
5798 wakaba 1.61 @@@enDesc:
5799 wakaba 1.79 A snapshot list of URIs.
5800     @@@PerlDef:
5801     $r = [$self->{uri}];
5802    
5803     @@Test:
5804     @@@QName: DISModule.getSuperResourceURIList.test
5805 wakaba 1.61 @@@PerlDef:
5806 wakaba 1.79 my $db;
5807     __CODE{createDISDBForTest:: $db => $db}__;
5808    
5809     my $res = $db-><M::DISDatabase.getModule> ('about:1');
5810    
5811     my %list = map {$_ => true} @{$res-><M::DISAnyResource
5812     .getSuperResourceURIList>};
5813    
5814     $test->assert_true ($list{'about:1'});
5815     $test->assert_false ($list{'about:2'});
5816 wakaba 1.87
5817     @Method:
5818     @@Name: getReferringModuleURIList
5819     @@enDesc:
5820     Reurns a snapshot list of the name URIs of modules referenced
5821     from the module.
5822     @@Return:
5823     @@@Type: URIList
5824     @@@enDesc:
5825     The snapshot list of URIs.
5826     @@@PerlDef:
5827     $r = [grep {$self->{<H::DIS|referringModule>}->{$_}}
5828     keys %{$self->{<H::DIS|referringModule>} or {}}];
5829    
5830     @Method:
5831     @@Name: addReferringModuleURI
5832     @@enDesc:
5833     Adds a URI to the list of modules referenced from the module.
5834     @@Param:
5835     @@@Name: uri
5836     @@@Type: DISString
5837     @@@enDesc:
5838     The URI to add.
5839     @@Return:
5840     @@@PerlDef:
5841     $self->{<H::DIS|referringModule>}->{$uri} = true;
5842 wakaba 1.48 ##DISModule
5843 wakaba 1.87
5844     PropDef:
5845     @QName: DIS|referringModule
5846     @DIS:key: ref
5847 wakaba 1.55
5848 wakaba 1.85 PropDef:
5849     @QName: DIS|forList
5850     @enDesc:
5851     A list of references to URIs of <QUOTE::for> resources
5852     belongs to the module.
5853    
5854 wakaba 1.55 ClsDef:
5855     @ClsQName: ManakaiDISModuleLite
5856    
5857     @Implement: DOMMinImpl
5858     @Implement: DIS|DISResourceProp
5859     @Implement: dp|DISAnyResourcePerl
5860     @Implement: dp|DISModulePerl
5861     @Implement: dp|DISResourcePerlModule
5862    
5863     @enDesc:
5864     The <Class::ManakaiDISModuleLite> class provides very small
5865     subset of <Class::ManakaiDISModuleDefinition> class. If a
5866     method or attribute which is not implemented by the class, then
5867     the object is updated to the <Class::ManakaiDISModuleDefinition>
5868     by reading additional properties from the <QUOTE::dis> database.
5869    
5870     @Attr:
5871 wakaba 1.88 @@Name: uri
5872     @@Type: AnyURI
5873     @@Description:
5874     @@@lang:en
5875     @@@@:
5876     The URI reference of the resource.
5877     @@Get:
5878     @@@enDesc:
5879     The representive URI reference of the resource.
5880    
5881     {NOTE:: The URI might be non-persistent if the
5882     resource is not assigned a URI in <QUOTE::dis> source file,
5883     in which case a URI is randomly-generated at the
5884     time of object generation.
5885     }
5886     @@@PerlDef:
5887     $r = $self->{uri};
5888    
5889     @Attr:
5890     @@Name: uriRef
5891     @@Type: DISPerl|SCALAR||ManakaiDOM|all
5892     @@enDesc:
5893     A reference to the URI of the resource.
5894    
5895     {NOTE:: Applications <kwd:MUST-NOT> modify the referenced
5896     value directly.
5897     }
5898     @@Get:
5899     @@@PerlDef: $r = \ ($self->{uri});
5900    
5901     @Attr:
5902 wakaba 1.55 @@ForCheck: ManakaiDOM|ForClass
5903     @@Name: uris
5904     @@Type:
5905 wakaba 1.60 DISPerl:Array::ManakaiDOM:all
5906 wakaba 1.55 @@enDesc:
5907     A reference to the snapshot array containing the URI reference
5908     of the module.
5909     @@Get:
5910     @@@PerlDef:
5911     $r = [$self->{uri}];
5912    
5913 wakaba 1.88 @Method:
5914     @@Name: isSameResource
5915     @@Operator:
5916     @@@@:eq
5917     @@@ContentType:
5918     lang:Perl
5919     @@enDesc:
5920     Whether two resources are same or not. Two resources are
5921     same if and only if their <A::DISAnyResource.uri> are
5922     equivalent as strings (i.e. in character-by-character based matching).
5923     @@Param:
5924     @@@Name: anotherResource
5925     @@@Type: DISAnyResource
5926     @@@enDesc:
5927     Another resource object to compare.
5928     @@Return:
5929     @@@Type:
5930     DOMMain:boolean::ManakaiDOM:all
5931     @@@enDesc:
5932     Whether two resources are same or not.
5933     @@@TrueCase:
5934     @@@@enDesc: Two resources are same.
5935     @@@FalseCase:
5936     @@@@enDesc: Two resources are different.
5937     @@@PerlDef:
5938     if (UNIVERSAL::isa ($anotherResource,
5939     <ClassName::ManakaiDISAnyResource>)) {
5940     $r = $self->{uri} eq $anotherResource->{uri};
5941     }
5942    
5943     @Attr:
5944     @@Name: nameURI
5945     @@Type: NameURI
5946     @@enDesc:
5947     The URI reference of this module, without
5948     <QUOTE::for> identifier.
5949     @@Get:
5950     @@@enDesc:
5951     The name URI of the resource.
5952     @@@nullCase:
5953     @@@@enDesc:
5954     The resource has no name URI.
5955    
5956     {NOTE:: A resource has no URI if and only if the resource
5957     has no local name.
5958     }
5959     @@@PerlDef:
5960     if (defined $self->{localName}) {
5961     $r = defined $self->{namespaceURI}
5962     ? ${$self->{namespaceURI}} . ${$self->{localName}}
5963     : ${$self->{localName}};
5964     }
5965    
5966     @Attr:
5967     @@Name: localName
5968     @@enDesc:
5969     The local name of this module.
5970    
5971     {NOTE:: <QUOTE::for> resources has no local name.
5972     }
5973     @@Type:
5974     DISCore:LocalName::ManakaiDOM:all
5975     @@Get:
5976     @@@PerlDef:
5977     $r = defined $self->{localName} ? ${$self->{localName}} : null;
5978    
5979     @Attr:
5980     @@Name: namespaceURI
5981     @@Type: AnyURI
5982     @@enDesc:
5983     The namespace URI of the name of this resource.
5984    
5985     {NOTE:: <QUOTE::for> resources has no namespace URI.
5986     }
5987     @@Get:
5988     @@@PerlDef:
5989     $r = defined $self->{namespaceURI} ? ${$self->{namespaceURI}} : null;
5990    
5991     @Attr:
5992     @@Name: forURI
5993     @@Type: ForURI
5994     @@enDesc:
5995     The <QUOTE::for> URI reference for which this module is defined.
5996     @@Get:
5997     @@@PerlDef:
5998     $r = defined $self->{for} ? ${$self->{for}} : null;
5999    
6000     @Attr:
6001     @@Name: forpURI
6002     @@enDesc:
6003     The <QUOTE::for+> URI references for which this resource is defined.
6004    
6005     {NOTE:: <QUOTE::for> resources has no <QUOTE::for+> URI.
6006     }
6007     @@Type: ForURIList
6008     @@Get:
6009     @@@enDesc:
6010     List of <QUOTE::for> URI references. Note that this list is
6011     <QUOTE::dead>.
6012     @@@PerlDef:
6013     $r = [@{$self->{forp}}];
6014    
6015     @Method:
6016     @@Name: isForURI
6017     @@enDesc:
6018     Tests whether this resource is defined for a <QUOTE::for>
6019     or <QUOTE::for+> URI reference or not.
6020     @@Param:
6021     @@@Name:forURI
6022     @@@Type:ForURI
6023     @@@enDesc:
6024     A <QUOTE::for> URI reference to test.
6025     @@Return:
6026     @@@Type:
6027     DOMMain:boolean::ManakaiDOM:all
6028     @@@TrueCase:
6029     @@@@enDesc:
6030     This resource is for <P::forURI>.
6031     @@@FalseCase:
6032     @@@@enDesc:
6033     This resource is not for <P::forURI>.
6034     @@@PerlDef:
6035     __DEEP{
6036     C: for my $this_for_uri (${$self->{for}||\''}, @{$self->{forp}||[]}) {
6037     if ($this_for_uri eq $forURI) { ## Shortcut
6038     $r = true;
6039     last C;
6040     }
6041     my $this_for = $self->{db}-><M::DIS|DISDatabase.getFor>
6042     ($this_for_uri);
6043     if ($this_for-><M::DIS|DISFor.isaURI> ($forURI)) {
6044     $r = true;
6045     last C;
6046     }
6047     }
6048     }__;
6049    
6050     @Attr:
6051     @@Name: isDefined
6052     @@Description:
6053     @@@lang:en
6054     @@@@:
6055     Whether this module is defined or not.
6056     @@Type:
6057     DOMMain:boolean::ManakaiDOM:all
6058     @@Get:
6059     @@@PerlDef:
6060     $r = $self->{<H::DIS|isDefined>};
6061     @@Set:
6062     @@@PerlDef:
6063     $self->{<H::DIS|isDefined>} = $given;
6064    
6065 wakaba 1.55 @Attr:
6066     @@ForCheck: ManakaiDOM|ForClass
6067     @@Name: ownerModule
6068     @@ManakaiDOM:isRedefining:1
6069     @@enDesc:
6070     This module itself.
6071     @@Get:
6072     @@@Type: DISModule
6073     @@@clsActualType: ManakaiDISModuleDefinition
6074     @@@nullCase:
6075     @@@@enDesc:
6076     The resource is not part of any module since
6077     its definition is not read (<IF::DISModule.isDefined> is <DOM::false>).
6078     @@@PerlDef: $r = $self;
6079    
6080 wakaba 1.88 @Attr:
6081     @@Name: ownerModuleURI
6082     @@enDesc:
6083     A URI of the owner module of the resource.
6084     @@Type: DIS|AnyURI
6085     @@nullCase:
6086     @@@enDesc:
6087     The resource does not belong to any module since the
6088     resource definition is not read yet or since
6089     it is created in memory.
6090     @@Get:
6091     @@@PerlDef:
6092     $r = $self->{uri};
6093    
6094     @Attr:
6095     @@Name: ownerModuleURIRef
6096     @@enDesc:
6097     A reference to a URI of the owner module of the resource.
6098     @@Type: DISPerl|SCALAR||ManakaiDOM|Perl
6099     @@nullCase:
6100     @@@enDesc:
6101     The resource does not belong to any module since the
6102     resource definition is not read yet or since
6103     it is created in memory.
6104     @@Get:
6105     @@@PerlDef:
6106     $r = \ ($self->{uri});
6107     @@Set:
6108     @@@PerlDef: # no effect
6109    
6110     @Attr:
6111     @@Name: database
6112     @@enDesc:
6113     The <QUOTE::dis> database to which the resource belongs.
6114     @@Type: DISDatabase
6115     @@clsActualType: ManakaiDISDatabase
6116     @@Get:
6117     @@@PerlDef:
6118     $r = $self->{db};
6119    
6120 wakaba 1.55 @Method:
6121     @@Operator:
6122     @@@@: AUTOLOAD
6123     @@@ContentType: lang|Perl
6124     @@Return:
6125     @@@PerlDef:
6126 wakaba 1.57 my $al = our $AUTOLOAD;
6127     $al =~ s/.+:://;
6128     if ($al ne 'DESTROY') {
6129    
6130 wakaba 1.55 __DEEP{
6131     $self-><AG::DIS|DISAnyResource.database>
6132     -><M::dp|ManakaiDISDatabasePerl.plLoadDISDatabaseModule> ($self);
6133     }__;
6134     if (ref $self eq <ClassName::ManakaiDISModuleLite>) {
6135     __EXCEPTION{DIS|RESOURCE_NOT_DEFINED_ERR::
6136     DIS:uri => {$self-><AG::DIS|DISAnyResource.uri>},
6137     DIS:moduleURI => {$self-><AG::DIS|DISAnyResource.uri>},
6138     }__;
6139     }
6140    
6141     my $code = $self->can ($al);
6142     if ($code) {
6143     goto &$code;
6144     } else {
6145     require Carp;
6146 wakaba 1.67 local $Carp::CarpLevel = $Error::Depth;
6147 wakaba 1.55 Carp::croak (qq<Can't locate method "$AUTOLOAD">);
6148     }
6149 wakaba 1.57
6150     } # $al
6151    
6152     @Attr:
6153     @@Name: targetNamespaceURI
6154     @@enDesc:
6155     The default namespace URI of the resources defined in the module.
6156     @@Type: DIS|AnyURI
6157     @@Get:
6158     @@@PerlDef:
6159     $r = defined $self->{<H::DIS|defaultNamespaceURI>}
6160     ? ${$self->{<H::DIS|defaultNamespaceURI>}} : null;
6161 wakaba 1.55 ##DISModuleLite
6162 wakaba 1.48
6163     IFClsDef:
6164     @IFQName: DISFor
6165     @ClsQName: ManakaiDISForDefinition
6166    
6167     @ClsISA: dp|ManakaiDISAnyResourcePerl
6168 wakaba 1.79 @ClsISA: ManakaiDISPropertyAccessor
6169 wakaba 1.48 @ClsISA: ManakaiDISAnyResource
6170    
6171     @DISLang:role: ForRole
6172    
6173     @Description:
6174     @@lang:en
6175     @@@:
6176     <QUOTE::dis> <QUOTE::for> definitions.
6177 wakaba 1.8
6178     @Attr:
6179 wakaba 1.48 @@ForCheck: ManakaiDOM|ForClass
6180     @@Name: uris
6181     @@Type:
6182 wakaba 1.60 DISPerl:Array::ManakaiDOM:all
6183 wakaba 1.48 @@actualType: ForURIList
6184 wakaba 1.15 @@enDesc:
6185 wakaba 1.48 A reference to the snapshot array containing the URI reference
6186     of the <QUOTE::for>.
6187 wakaba 1.15 @@Get:
6188     @@@PerlDef:
6189 wakaba 1.48 $r = [$self->{uri}];
6190 wakaba 1.18
6191 wakaba 1.48 @Method:
6192     @@Name: isaURI
6193     @@Description:
6194     @@@lang:en
6195     @@@@:
6196     Whether this <QUOTE::for> is-a another <QUOTE::for> or not.
6197     @@Param:
6198     @@@Name: superURI
6199     @@@Type: ForURI
6200     @@@Description:
6201     @@@@lang:en
6202     @@@@@:
6203     Another <QUOTE::for> URI reference to test.
6204     @@Return:
6205     @@@Type:
6206     DOMMain:boolean::ManakaiDOM:all
6207     @@@TrueCase:
6208     @@@@enDesc:
6209     <P::superURI> is a super-<QUOTE::for> of this <QUOTE::for>.
6210     @@@FalseCase:
6211     @@@@enDesc:
6212     <P::superURI> is not a super-<QUOTE::for> of this <QUOTE::for>.
6213 wakaba 1.18 @@@PerlDef:
6214 wakaba 1.48 $r = $self->{uri} eq $superURI ? true : $self->{isa}->{$superURI};
6215 wakaba 1.15
6216 wakaba 1.48 @Method:
6217     @@Name: addISA
6218 wakaba 1.8 @@enDesc:
6219 wakaba 1.48 Adds a <QUOTE::for> to the list of super-<QUOTE::for> of this
6220     <QUOTE::for>.
6221     @@Param:
6222     @@@Name: superFor
6223     @@@Type: DISFor
6224     @@@clsActualType: ManakaiDISForDefinition
6225 wakaba 1.8 @@@enDesc:
6226 wakaba 1.48 A <QUOTE::for> definition object.
6227     @@Return:
6228 wakaba 1.8 @@@PerlDef:
6229 wakaba 1.48 my @from = ($self->{uri},
6230     grep {$self->{revISA}->{$_}} keys %{$self->{revISA}});
6231     my @to = ($superFor->{uri},
6232     grep {$superFor->{isa}->{$_}} keys %{$superFor->{isa}});
6233 wakaba 1.8 __DEEP{
6234 wakaba 1.48 for my $from (@from) {
6235     for my $to (@to) {
6236     $self->{db}-><M::ManakaiDISDatabase.getFor>
6237     ($from)->{isa}->{$to} = true;
6238     $self->{db}-><M::ManakaiDISDatabase.getFor>
6239     ($to)->{revISA}->{$from} = true;
6240 wakaba 1.8 }
6241     }
6242     }__;
6243    
6244 wakaba 1.48 @Method:
6245     @@Name: getFeature
6246     @@Description:
6247     @@@lang:en
6248     @@@@:
6249     Returns a specialized object that implements the specialized
6250     interfaces of the specified feature and version.
6251     @@Param:
6252     @@@Name: feature
6253     @@@Type:
6254     DISLang:String::ManakaiDOM:all
6255     @@@actualType:
6256     ManakaiDOM:ManakaiDOMFeatureName::ManakaiDOM:ManakaiDOMLatest
6257     @@@Description:
6258     @@@@lang:en
6259     @@@@@:
6260     A feature name to request.
6261     @@Param:
6262     @@@Name: version
6263     @@@Type:
6264     DISLang:String::ManakaiDOM:all
6265     @@@actualType:
6266     ManakaiDOM:ManakaiDOMFeatureVersion::ManakaiDOM:ManakaiDOMLatest
6267     @@@Description:
6268     @@@@lang:en
6269     @@@@@:
6270     A feature version number to request.
6271     @@Return:
6272     @@@Type:
6273     DOMMain:Object::ManakaiDOM:all
6274     @@@Description:
6275     @@@@lang:en
6276     @@@@@:
6277     An object that implements the specialized APIs of the
6278     <P::feature> and <P::version>.
6279 wakaba 1.49 @@@nullCase:
6280     @@@@enDesc:
6281 wakaba 1.48 There is no object available that implements interfaces
6282     associated with the <P::feature> and <P::version>.
6283     @@@PerlDef:
6284     $feature =~ s/^\+//;
6285     CLASS: for my $class (grep {
6286     $Message::Util::DIS::ManakaiDISForDefinition::CompatClass{$_}
6287     } keys %Message::Util::DIS::ManakaiDISForDefinition::CompatClass) {
6288     if ($Message::DOM::ClassFeature{$class}->{$feature}->{$version}) {
6289     $r = bless {o => $self}, $class;
6290     last CLASS;
6291 wakaba 1.8 }
6292     }
6293    
6294     @Attr:
6295 wakaba 1.48 @@ForCheck: ManakaiDOM|ForClass
6296     @@Name: forURI
6297     @@Type: ForURI
6298 wakaba 1.8 @@enDesc:
6299 wakaba 1.48 The <QUOTE::for> URI reference for which this module is defined.
6300 wakaba 1.8 @@Get:
6301 wakaba 1.48 @@@InCase:
6302     @@@@Value:
6303     @@@@@@: ManakaiDOM|all
6304 wakaba 1.68 @@@@@ContentType: DISCore|QName
6305 wakaba 1.8 @@@@enDesc:
6306 wakaba 1.48 The attribute value is always <Q::ManakaiDOM|all> for a
6307     <QUOTE::for> resource.
6308 wakaba 1.8 @@@PerlDef:
6309 wakaba 1.48 $r = <Q::ManakaiDOM|all>;
6310 wakaba 1.8
6311     @Attr:
6312 wakaba 1.48 @@Name: forpURI
6313 wakaba 1.8 @@enDesc:
6314 wakaba 1.48 The <QUOTE::for+> URI references for which this resource is defined.
6315     @@Type: ForURIList
6316 wakaba 1.8 @@Get:
6317 wakaba 1.48 @@@enDesc:
6318     List of <QUOTE::for> URI references. Note that this list is
6319     <QUOTE::dead>.
6320     @@@InCase:
6321     @@@@Value:
6322     @@@@@@: []
6323     @@@@@ContentType: lang|Perl
6324 wakaba 1.8 @@@@enDesc:
6325 wakaba 1.48 The attribute value is always an empty array reference
6326     for a <QUOTE::for> resource.
6327     @@@PerlDef: $r = [];
6328 wakaba 1.9
6329 wakaba 1.48 @Method:
6330     @@Name: isForURI
6331 wakaba 1.9 @@enDesc:
6332 wakaba 1.48 Tests whether this resource is defined for a <QUOTE::for>
6333     or <QUOTE::for+> URI reference or not.
6334 wakaba 1.9 @@Param:
6335 wakaba 1.48 @@@Name:forURI
6336     @@@Type:ForURI
6337     @@@enDesc:
6338     A <QUOTE::for> URI reference to test.
6339 wakaba 1.9 @@Return:
6340     @@@Type:
6341 wakaba 1.48 DOMMain:boolean::ManakaiDOM:all
6342     @@@TrueCase:
6343     @@@@enDesc:
6344     This resource is for <P::forURI>. The attribute
6345     always takes this value for <QUOTE::for> resources.
6346     @@@PerlDef: $r = true;
6347 wakaba 1.12
6348     @Attr:
6349 wakaba 1.48 @@ForCheck: ManakaiDOM|ForClass
6350     @@Name: nameURI
6351     @@Type: NameURI
6352 wakaba 1.12 @@enDesc:
6353 wakaba 1.48 The URI reference of this module, without
6354     <QUOTE::for> identifier.
6355 wakaba 1.12 @@Get:
6356 wakaba 1.49 @@@enDesc:
6357     The attribute value is always equals to
6358     <A::DISAnyResource.uri> for <QUOTE::for> resources.
6359     @@@PerlDef: $r = $self->{uri};
6360 wakaba 1.61
6361 wakaba 1.79 @CMethod:
6362     @@Name: getSuperResourceURIList
6363 wakaba 1.61 @@enDesc:
6364 wakaba 1.79 Returns a snapshot list of super-resources URIs of the resource,
6365     including canonical and alias URIs of the resource itself.
6366     @@Return:
6367     @@@Type: URIList
6368 wakaba 1.61 @@@enDesc:
6369 wakaba 1.79 A snapshot list of URIs.
6370     @@@PerlDef:
6371     $r = [
6372     (grep {$self->{isa}->{$_}} keys %{$self->{isa}}),
6373     (grep {$self->{aliasURI}->{$_}} keys %{$self->{aliasURI}}),
6374     ($self->{uri}),
6375     ];
6376    
6377     @@Test:
6378     @@@QName: DISFor.getSuperResourceURIList.test
6379 wakaba 1.61 @@@PerlDef:
6380 wakaba 1.79 my $db;
6381     __CODE{createDISDBForTest:: $db => $db}__;
6382    
6383     my $res1 = $db-><M::DISDatabase.getFor> ('about:1');
6384    
6385     my %list1 = map {$_ => true} @{$res1-><M::DISAnyResource
6386     .getSuperResourceURIList>};
6387    
6388     $test->assert_true ($list1{'about:1'});
6389     $test->assert_false ($list1{'about:2'});
6390     $test->assert_true ($list1{<Q::ManakaiDOM:all>});
6391    
6392     my $res2 = $db-><M::DISDatabase.getFor> ('about:2');
6393     $res1-><M::DISFor.addISA> ($res2);
6394    
6395     my %list1_2 = map {$_ => true} @{$res1-><M::DISAnyResource
6396     .getSuperResourceURIList>};
6397    
6398     $test->assert_true ($list1_2{'about:1'});
6399     $test->assert_true ($list1_2{'about:2'});
6400     $test->assert_true ($list1_2{<Q::ManakaiDOM:all>});
6401    
6402     my %list2 = map {$_ => true} @{$res2-><M::DISAnyResource
6403     .getSuperResourceURIList>};
6404    
6405     $test->assert_false ($list2{'about:1'});
6406     $test->assert_true ($list2{'about:2'});
6407     $test->assert_true ($list2{<Q::ManakaiDOM:all>});
6408 wakaba 1.48 ##DISFor
6409 wakaba 1.18
6410 wakaba 1.48 PropDef:
6411     @QName: isFeatureImplemented
6412     @enDesc:
6413     The list of whether a feature is implemented or not.
6414 wakaba 1.18
6415 wakaba 1.48 IFClsDef:
6416     @IFQName: DISResource
6417     @ClsQName: ManakaiDISResourceDefinition
6418 wakaba 1.19
6419 wakaba 1.48 @ClsISA: ManakaiDISResourceMV
6420     @ClsISA: dp|ManakaiDISResourcePerl
6421     @ClsISA: ManakaiDISPerlModuleDefinition
6422     @ClsISA: dp|ManakaiDISAnyResourcePerl
6423     @ClsISA: ManakaiDISPropertyAccessor
6424     @ClsISA: ManakaiDISAnyResource
6425 wakaba 1.19
6426 wakaba 1.48 @DISLang:role: ResourceRole
6427 wakaba 1.19
6428 wakaba 1.48 @enDesc:
6429     <QUOTE::dis> resource definitions.
6430 wakaba 1.19
6431 wakaba 1.48 @enDesc:
6432     @@ForCheck: ManakaiDOM|ForIF
6433     @@@:
6434     The objects implementing the <IF::DISResource> interface
6435     <kwd:MUST> also implement the <IF::DISAnyResource> interface.
6436 wakaba 1.12
6437 wakaba 1.46 @Attr:
6438 wakaba 1.48 @@ForCheck: ManakaiDOM|ForClass
6439     @@Name: uris
6440     @@Type:
6441 wakaba 1.60 DISPerl:Array::ManakaiDOM:all
6442 wakaba 1.46 @@enDesc:
6443 wakaba 1.48 Returns the current <EM::snapshot> of the URI references
6444     for this resource, including the alias URI references.
6445 wakaba 1.46 @@Get:
6446     @@@PerlDef:
6447 wakaba 1.48 $r = [grep {$self->{aliasURI}->{$_}} keys %{$self->{aliasURI}}];
6448 wakaba 1.46
6449 wakaba 1.12 @Method:
6450 wakaba 1.48 @@Name: isSubsetOfURI
6451     @@Description:
6452 wakaba 1.37 @@@lang:en
6453     @@@@:
6454 wakaba 1.48 Whether this resource is a subset of another resource or not.
6455     @@Param:
6456     @@@Name: superURI
6457     @@@Type: ResourceURI
6458     @@@Description:
6459     @@@@lang:en
6460     @@@@@:
6461     Another resource URI reference to test.
6462 wakaba 1.89 @@NamedParam:
6463     @@@Name: srinfo
6464     @@@Type: DISPerl|HASH||ManakaiDOM|all
6465     @@@enDesc:
6466     The <CODE::srinfo> hash.
6467     @@@nullCase:
6468     @@@@enDesc:
6469     No <CODE::srinfo>.
6470 wakaba 1.12 @@Return:
6471 wakaba 1.48 @@@Type:
6472     DOMMain:boolean::ManakaiDOM:all
6473     @@@TrueCase:
6474     @@@@enDesc:
6475     <P::superURI> is a super-resource of this resource.
6476     @@@FalseCase:
6477 wakaba 1.12 @@@@enDesc:
6478 wakaba 1.48 <P::superURI> is not a super-resource of this resource.
6479 wakaba 1.12 @@@PerlDef:
6480 wakaba 1.48 $r = $self->{aliasURI}->{$superURI} || $self->{subOf}->{$superURI};
6481 wakaba 1.89 if (not $r and $srinfo) {
6482     A: {
6483     if ($srinfo->{resource}->{$superURI}) {
6484     for my $this_uri (grep {$self->{aliasURI}->{$_}}
6485     keys %{$self->{aliasURI}}) {
6486     if ($srinfo->{resource}->{$superURI}->{aliasURI}->{$this_uri}) {
6487     $r = true;
6488     last A;
6489     }
6490     if ($srinfo->{resource}->{$superURI}->{supOf}->{$this_uri}) {
6491     $r = true;
6492     last A;
6493     }
6494     }
6495     }
6496     for my $this_uri (grep {$self->{aliasURI}->{$_}}
6497     keys %{$self->{aliasURI}}) {
6498     if ($srinfo->{resource}->{$this_uri}) {
6499     if ($srinfo->{resource}->{$this_uri}->{aliasURI}->{$superURI}) {
6500     $r = true;
6501     last A;
6502     }
6503     }
6504     }
6505     } # A
6506     }
6507 wakaba 1.13
6508     @Method:
6509 wakaba 1.48 @@Name: addSuperResource
6510 wakaba 1.13 @@enDesc:
6511 wakaba 1.48 Adds a <QUOTE::dis> resource to the list of super-resource
6512     of this <QUOTE::dis> resource.
6513 wakaba 1.13 @@Param:
6514 wakaba 1.48 @@@Name: superRes
6515 wakaba 1.47 @@@Type: DISResource
6516     @@@clsActualType: ManakaiDISResourceDefinition
6517 wakaba 1.13 @@@enDesc:
6518 wakaba 1.48 A <QUOTE::dis> resource definition object.
6519 wakaba 1.89 @@NamedParam:
6520     @@@Name: srinfo
6521     @@@Type: DISPerl|HASH||ManakaiDOM|all
6522     @@@enDesc:
6523     The <CODE::srinfo> hash.
6524     @@@nullCase:
6525     @@@@enDesc:
6526     No <CODE::srinfo>.
6527 wakaba 1.48 @@Return:
6528 wakaba 1.13 @@@PerlDef:
6529 wakaba 1.48 my @from = ($self->{uri},
6530 wakaba 1.50 grep {$self->{supOf}->{$_}} keys %{$self->{supOf}||{}});
6531 wakaba 1.48 my @to = ($superRes->{uri},
6532 wakaba 1.50 grep {$superRes->{subOf}->{$_}} keys %{$superRes->{subOf}||{}});
6533 wakaba 1.13 __DEEP{
6534 wakaba 1.48 for my $from (@from) {
6535     for my $to (@to) {
6536     $self->{db}-><M::ManakaiDISDatabase.getResource>
6537     ($from)->{subOf}->{$to} = true;
6538 wakaba 1.89 $srinfo->{resource}->{$from}->{subOf}->{$to} = true;
6539 wakaba 1.48 $self->{db}-><M::ManakaiDISDatabase.getResource>
6540     ($to)->{supOf}->{$from} = true;
6541 wakaba 1.89 $srinfo->{resource}->{$to}->{supOf}->{$from} = true;
6542 wakaba 1.13 }
6543     }
6544     }__;
6545 wakaba 1.48
6546 wakaba 1.13 @Method:
6547 wakaba 1.48 @@Name: mergeAsAlias
6548 wakaba 1.13 @@enDesc:
6549 wakaba 1.48 Merges another resource definition as an alias of this resource.
6550 wakaba 1.13 @@Param:
6551 wakaba 1.48 @@@Name: aliasResource
6552 wakaba 1.47 @@@Type: DISResource
6553     @@@clsActualType: ManakaiDISResourceDefinition
6554 wakaba 1.13 @@@enDesc:
6555 wakaba 1.48 A resource to merge.
6556     \
6557     {NOTE:: After merging all references to <P::aliasResource>
6558     should be discarded.
6559     \
6560     }
6561     @@NodeParam:
6562 wakaba 1.88 @@NamedParam:
6563     @@@Name: noEqualityCheck
6564     @@@Type: idl|boolean||ManakaiDOM|all
6565     @@@enDesc:
6566     Don't throw <X::MERGE_ITSELF_ERR> exception.
6567 wakaba 1.89 @@NamedParam:
6568     @@@Name: srinfo
6569     @@@Type: DISPerl|HASH||ManakaiDOM|all
6570     @@@enDesc:
6571     The <CODE::srinfo> hash.
6572     @@@nullCase:
6573     @@@@enDesc:
6574     No <CODE::srinfo>.
6575 wakaba 1.48 @@Return:
6576     @@@RaiseException:
6577     @@@@@:MERGE_ITSELF_ERR
6578     @@@@@@enDesc:
6579     An attempt is made to merge this resource itself.
6580 wakaba 1.13 @@@PerlDef:
6581 wakaba 1.88 if (not $noEqualityCheck and $self eq $aliasResource) {
6582 wakaba 1.48 __EXCEPTION{MERGE_ITSELF_ERR::
6583 wakaba 1.89 DIS:uri => {$self-><AG::DISAnyResource.uri>},
6584 wakaba 1.48 DIS:sourceNode => {$node},
6585     }__;
6586     }
6587     for my $uri ($aliasResource->{uri},
6588     grep {$aliasResource->{aliasURI}->{$_}}
6589     keys %{$aliasResource->{aliasURI}}) {
6590     $self->{aliasURI}->{$uri} = true;
6591     $self->{db}->{resDef}->{$uri} = $self;
6592     $self->{subOf}->{$uri} = true;
6593     $self->{supOf}->{$uri} = true;
6594     }
6595     for my $uri (grep {$aliasResource->{subOf}->{$_}}
6596 wakaba 1.50 keys %{$aliasResource->{subOf}||{}}) {
6597 wakaba 1.48 $self->{subOf}->{$uri} = true;
6598     }
6599     for my $uri (grep {$aliasResource->{supOf}->{$_}}
6600 wakaba 1.50 keys %{$aliasResource->{supOf}||{}}) {
6601 wakaba 1.48 $self->{supOf}->{$uri} = true;
6602     }
6603 wakaba 1.50 my @from = grep {$self->{supOf}->{$_}} keys %{$self->{supOf}||{}};
6604     my @to = grep {$self->{subOf}->{$_}} keys %{$self->{subOf}||{}};
6605 wakaba 1.13 __DEEP{
6606 wakaba 1.48 for my $from (@from) {
6607     for my $to (@to) {
6608     $self->{db}-><M::ManakaiDISDatabase.getResource>
6609     ($from)->{subOf}->{$to} = true;
6610 wakaba 1.89 $srinfo->{resource}->{$from}->{subOf}->{$to} = true;
6611 wakaba 1.48 $self->{db}-><M::ManakaiDISDatabase.getResource>
6612     ($to)->{supOf}->{$from} = true;
6613 wakaba 1.89 $srinfo->{resource}->{$to}->{supOf}->{$from} = true;
6614 wakaba 1.13 }
6615     }
6616     }__;
6617 wakaba 1.15
6618 wakaba 1.48 @Attr:
6619     @@Name: disDataTypeResource
6620     @@enDesc:
6621     The resource referenced by <Q::dis:Type> property.
6622 wakaba 1.15
6623 wakaba 1.48 = If the resource has the <Q::dis:Type> property,
6624     then its value references the data type resource.
6625 wakaba 1.15
6626 wakaba 1.48 = If the resource has no <Q::dis:Type> property but
6627     the dynamic parent resource has the <Q::dis:Type> property,
6628     then its value references the data type resource.
6629    
6630     = Otherwise, the resource has no associated data type resoruce;
6631     this method throws a <X::NO_DIS_TYPE_ERR> exception.
6632     @@Type: DISResource
6633     @@clsActualType: ManakaiDISResourceDefinition
6634     @@Get:
6635     @@@RaiseException:
6636     @@@@@:NO_DIS_TYPE_ERR
6637 wakaba 1.16 @@@@enDesc:
6638 wakaba 1.48 <Q::dis:Type> attribute is not specified.
6639 wakaba 1.13 @@@PerlDef:
6640 wakaba 1.48 __DEEP{
6641     if (UNIVERSAL::isa ($self->{<Q::dis:Type>}, <IFName::dv|DVURIValue>)) {
6642     $r = $self->{<Q::dis:Type>}-><M::dv|DVURIValue.getResource>
6643     ($self-><AG::DISAnyResource.database>);
6644     } else {
6645 wakaba 1.54 my $pr = $self-><AG::DIS|DISResource.dynamicParentResource>;
6646 wakaba 1.48 $r = $pr-><AG::DISResource.disDataTypeResource> if $pr;
6647     }
6648     }__;
6649     unless ($r) {
6650     __EXCEPTION{NO_DIS_TYPE_ERR::
6651     DIS:uri => {$self-><AG::DISAnyResource.uri>},
6652     DIS:sourceNode => {$self-><AG::DISAnyResource.sourceElement>},
6653 wakaba 1.13 }__;
6654     }
6655 wakaba 1.48
6656     @Attr:
6657     @@Name: disDataTypeValue
6658     @@enDesc:
6659     The <Q::dis:Type> property value for the resource.
6660     @@Get:
6661     @@@Type: dv|DVURIValue
6662     @@@clsActualType: dv|ManakaiDVURIValue
6663     @@@RaiseException:
6664     @@@@@:NO_DIS_TYPE_ERR
6665     @@@@enDesc:
6666     <Q::dis:Type> attribute is not specified.
6667     @@@PerlDef:
6668 wakaba 1.13 __DEEP{
6669 wakaba 1.48 if (UNIVERSAL::isa ($self->{<Q::dis:Type>}, <IFName::dv|DVURIValue>)) {
6670     $r = $self->{<Q::dis:Type>};
6671 wakaba 1.16 } else {
6672 wakaba 1.54 my $pr = $self-><AG::DIS|DISResource.dynamicParentResource>;
6673 wakaba 1.48 $r = $pr-><AG::DISResource.disDataTypeValue> if $pr;
6674 wakaba 1.16 }
6675 wakaba 1.48 }__;
6676     unless ($r) {
6677     __EXCEPTION{NO_DIS_TYPE_ERR::
6678     DIS:uri => {$self-><AG::DISAnyResource.uri>},
6679     DIS:sourceNode => {$self-><AG::DISAnyResource.sourceElement>},
6680     }__;
6681     }
6682 wakaba 1.13
6683     @Attr:
6684 wakaba 1.48 @@Name: disActualDataTypeResource
6685 wakaba 1.13 @@enDesc:
6686 wakaba 1.48 <Q::dis:actualType> attribute value of this resource.
6687     @@Type: DISResource
6688     @@clsActualType: ManakaiDISResourceDefinition
6689 wakaba 1.13 @@Get:
6690 wakaba 1.48 @@@RaiseException:
6691     @@@@@:NO_DIS_TYPE_ERR
6692 wakaba 1.13 @@@@enDesc:
6693 wakaba 1.48 <Q::dis:actualType> attribute is not specified,
6694     and <Q::dis:Type> attribute, neigher.
6695 wakaba 1.13 @@@PerlDef:
6696 wakaba 1.48 __DEEP{
6697     if (UNIVERSAL::isa ($self->{<Q::dis:actualType>},
6698     <IFName::dv|DVURIValue>)) {
6699     $r = $self->{<Q::dis:actualType>}-><M::dv|DVURIValue.getResource>
6700     ($self-><AG::DISAnyResource.database>);
6701     } elsif (UNIVERSAL::isa ($self->{<Q::dis:Type>},
6702     <IFName::dv|DVURIValue>)) {
6703     $r = $self->{<Q::dis:Type>}-><M::dv|DVURIValue.getResource>
6704     ($self-><AG::DISAnyResource.database>);
6705     } else {
6706 wakaba 1.54 my $pr = $self-><AG::DIS|DISResource.dynamicParentResource>;
6707 wakaba 1.48 $r = $pr-><AG::DISResource.disActualDataTypeResource> if $pr;
6708     }
6709     }__;
6710     unless ($r) {
6711     __EXCEPTION{NO_DIS_TYPE_ERR::
6712     DIS:uri => {$self-><AG::DISAnyResource.uri>},
6713     DIS:sourceNode => {$self-><AG::DISAnyResource.sourceElement>},
6714 wakaba 1.13 }__;
6715     }
6716 wakaba 1.48
6717     @Attr:
6718     @@Name: disActualDataTypeValue
6719 wakaba 1.13 @@enDesc:
6720 wakaba 1.48 <Q::dis:actualType> node for this resource.
6721     @@Get:
6722     @@@Type: DISElement
6723     @@@clsActualType: ManakaiDISElement
6724 wakaba 1.13 @@@RaiseException:
6725 wakaba 1.48 @@@@@:NO_DIS_TYPE_ERR
6726 wakaba 1.13 @@@@enDesc:
6727 wakaba 1.48 <Q::dis:actualType> attribute is not specified,
6728     and <Q::dis:Type> attribute, neigher.
6729 wakaba 1.13 @@@PerlDef:
6730 wakaba 1.48 __DEEP{
6731     if (UNIVERSAL::isa ($self->{<Q::dis:actualType>},
6732     <IFName::dv|DVURIValue>)) {
6733     $r = $self->{<Q::dis:actualType>};
6734     } elsif (UNIVERSAL::isa ($self->{<Q::dis:Type>},
6735     <IFName::dv|DVURIValue>)) {
6736     $r = $self->{<Q::dis:Type>};
6737 wakaba 1.13 } else {
6738 wakaba 1.54 my $pr = $self-><AG::DIS|DISResource.dynamicParentResource>;
6739 wakaba 1.48 $r = $pr-><AG::DISResource.disActualDataTypeValue> if $pr;
6740 wakaba 1.13 }
6741 wakaba 1.48 }__;
6742     unless ($r) {
6743     __EXCEPTION{NO_DIS_TYPE_ERR::
6744     DIS:uri => {$self-><AG::DISAnyResource.uri>},
6745     DIS:sourceNode => {$self-><AG::DISAnyResource.sourceElement>},
6746 wakaba 1.13 }__;
6747     }
6748    
6749 wakaba 1.15 @IntMethod:
6750 wakaba 1.48 @@Operator:
6751     @@@@: <=>
6752     @@@ContentType:
6753     lang:Perl
6754 wakaba 1.15 @@enDesc:
6755 wakaba 1.54 Compares two resources. If the first character of the
6756     node in the source tree by which the resource is defined
6757     occures before the other resource's first character, then
6758     the former resource is <DFN::less> than the later resource.
6759     If two resources are the same resource, they are <DFN::equal>.
6760     Otherwise, the former resource is <DFN::greater> than
6761     the later resource.
6762    
6763     There are two exceptions. If two resources belongs to
6764     two different modules, i.e. their <A::DIS|DISAnyResource.ownerModule>s
6765     are different, the order is not defined. Also, if
6766     one of resources is not yet defined, i.e. one's
6767     <A::DIS|DISAnyResource.isDefined> takes <DOM::false> value,
6768     then the order is not defined. Even in these cases, two
6769     calls for the method with the same parameter would return
6770     the same result while the resources are left unchanged.
6771 wakaba 1.48 @@Param:
6772     @@@Name: anotherResource
6773     @@@Type: DISResource
6774     @@@enDesc: Another resource to compare.
6775 wakaba 1.15 @@Return:
6776     @@@Type:
6777 wakaba 1.48 DOMMain:unsigned-long::ManakaiDOM:all
6778 wakaba 1.15 @@@PerlDef:
6779 wakaba 1.48 if (UNIVERSAL::isa ($anotherResource,
6780     <ClassName::ManakaiDISResourceDefinition>)) {
6781     $r = $self->{seq} <=> $anotherResource->{seq};
6782     } else {
6783 wakaba 1.54 $r = $self->{uri} <=> $anotherResource;
6784 wakaba 1.48 }
6785 wakaba 1.15
6786     @Method:
6787 wakaba 1.54 @@ForCheck: ManakaiDOM|ForClass
6788     @@ManakaiDOM:isForInternal:1
6789     @@Name: addChildResource
6790     @@enDesc:
6791     Registers a resource as a static child of the resource.
6792     @@Param:
6793     @@@Name: disResource
6794     @@@Type: DIS|DISResource
6795     @@@enDesc:
6796     The resurce to add.
6797     @@Return:
6798     @@@PerlDef:
6799     __DEEP{
6800     push @{$self->{<H::DIS|childResource>}||=[]},
6801     $disResource-><AG::DIS|DISAnyResource.uriRef>;
6802     }__;
6803    
6804     @Method:
6805     @@ForCheck: ManakaiDOM|ForClass
6806     @@ManakaiDOM:isForInternal:1
6807     @@Name: addDynamicChildResource
6808     @@enDesc:
6809     Registers a resource as a dynamic child of the resource.
6810     @@Param:
6811     @@@Name: disResource
6812     @@@Type: DIS|DISResource
6813     @@@enDesc:
6814     The resurce to add.
6815     @@Return:
6816     @@@PerlDef:
6817     __DEEP{
6818     push @{$self->{<H::DIS|dynamicChildResource>}||=[]},
6819     $disResource-><AG::DIS|DISAnyResource.uriRef>;
6820     }__;
6821    
6822     @Method:
6823     @@Name: getChildResourceList
6824     @@enDesc:
6825     Returns the list of static child resources of the resource.
6826     @@Return:
6827     @@@Type: DIS|ResourceList
6828     @@@enDesc:
6829     The current snapshot of children.
6830     @@@PerlDef:
6831     __DEEP{
6832     my $db = $self-><AG::DIS|DISAnyResource.database>;
6833     $r = [map {
6834     $db-><M::DIS|DISDatabase.getResource> ($$_)
6835     } @{$self->{<H::DIS|childResource>}}];
6836     }__;
6837    
6838     @Method:
6839     @@Name: getDynamicChildResourceList
6840     @@enDesc:
6841     Returns the list of dynamic child resources of the resource.
6842     @@Return:
6843     @@@Type: DIS|ResourceList
6844     @@@enDesc:
6845     The current snapshot of children.
6846     @@@PerlDef:
6847     __DEEP{
6848     my $db = $self-><AG::DIS|DISAnyResource.database>;
6849     $r = [map {
6850     $db-><M::DIS|DISDatabase.getResource> ($$_)
6851     } @{$self->{<H::DIS|dynamicChildResource>}}];
6852     }__;
6853    
6854     @Method:
6855 wakaba 1.48 @@Name: getChildResourceByType
6856 wakaba 1.15 @@enDesc:
6857 wakaba 1.48 Gets a static child resource selected by its type.
6858     @@Param:
6859     @@@Name:typeURI
6860     @@@Type:ResourceURI
6861     @@@enDesc:
6862     A URI reference identifying a resource type.
6863     @@ImplNote:
6864     @@@lang:en
6865     @@@@:
6866 wakaba 1.54 {ISSUE:: Some inheritance tracing required for
6867 wakaba 1.48 e.g. <Q::DISLang:InputProcessor> and <Q::DOMMain:ReflectGet>?
6868 wakaba 1.54 }
6869 wakaba 1.15 @@Return:
6870 wakaba 1.47 @@@Type: DISResource
6871     @@@clsActualType: ManakaiDISResourceDefinition
6872 wakaba 1.15 @@@enDesc:
6873 wakaba 1.48 The first child resource (in document order) whose
6874     type matches with <P::typeURI>.
6875 wakaba 1.15 @@@nullCase:
6876     @@@@enDesc:
6877 wakaba 1.48 There is no resource whose type is <P::typeURI>.
6878 wakaba 1.15 @@@PerlDef:
6879 wakaba 1.48 __DEEP{
6880 wakaba 1.54 my $db = $self-><AG::DIS|DISAnyResource.database>;
6881     C: for my $cr_uri (@{$self->{<H::DIS:childResource>}||[]}) {
6882     my $cr = $db-><M::DIS|DISDatabase.getResource> ($$cr_uri);
6883 wakaba 1.79 if ($cr-><M::DIS|DISAnyResource.isTypeURI> ($typeURI)) {
6884 wakaba 1.48 $r = $cr;
6885 wakaba 1.54 last C;
6886 wakaba 1.48 }
6887 wakaba 1.15 }
6888 wakaba 1.48 }__;
6889 wakaba 1.15
6890 wakaba 1.48 @Method:
6891 wakaba 1.54 @@Name: getChildResourceListByType
6892     @@enDesc:
6893     Returns a list of child resources of a specific type.
6894     @@Param:
6895     @@@Name: typeURI
6896     @@@Type: DIS|AnyURI
6897     @@@enDesc:
6898     A URI of the type.
6899     @@Return:
6900     @@@Type: DIS|ResourceList
6901     @@@enDesc:
6902     The current snapshot of the child resources of type <P::typeURI>.
6903     @@@PerlDef:
6904     __DEEP{
6905     my $db = $self-><AG::DIS|DISAnyResource.database>;
6906     $r = [grep {
6907 wakaba 1.79 $_-><M::DIS|DISAnyResource.isTypeURI> ($typeURI)
6908 wakaba 1.54 } map {
6909     $db-><M::DIS|DISDatabase.getResource> ($$_)
6910     } @{$self->{<H::DIS|childResource>}||[]}];
6911     }__;
6912    
6913     @Method:
6914 wakaba 1.48 @@Name: getChildResourceByNameAndType
6915 wakaba 1.15 @@enDesc:
6916 wakaba 1.48 Gets a static child resource selected by its local name and type.
6917 wakaba 1.15 @@Param:
6918 wakaba 1.48 @@@Name: localName
6919     @@@Type:
6920     DISCore:LocalName::ManakaiDOM:all
6921 wakaba 1.15 @@@enDesc:
6922 wakaba 1.48 A local name.
6923 wakaba 1.15 @@Param:
6924 wakaba 1.48 @@@Name:typeURI
6925     @@@Type:ResourceURI
6926 wakaba 1.15 @@@enDesc:
6927 wakaba 1.48 A URI reference identifying a resource type.
6928     @@Return:
6929 wakaba 1.47 @@@Type: DISResource
6930     @@@clsActualType: ManakaiDISResourceDefinition
6931 wakaba 1.15 @@@enDesc:
6932 wakaba 1.48 The first (by document order) child resource whose
6933     type matches for <P::localName> and <P::typeURI>.
6934 wakaba 1.15 @@@nullCase:
6935     @@@@enDesc:
6936 wakaba 1.48 There is no resource whose name is <P::localName> and
6937     whose type is <P::typeURI>.
6938     @@@PerlDef:
6939     __DEEP{
6940 wakaba 1.54 my $db = $self-><AG::DIS|DISAnyResource.database>;
6941     C: for my $cr_uri (@{$self->{<H::DIS:childResource>}||[]}) {
6942     my $cr = $db-><M::DIS|DISDatabase.getResource> ($$cr_uri);
6943     my $ln = $cr-><AG::DIS|DISAnyResource.localName>;
6944 wakaba 1.48 if (defined $ln and $ln eq $localName and
6945 wakaba 1.79 $cr-><M::DIS|DISAnyResource.isTypeURI> ($typeURI)) {
6946 wakaba 1.48 $r = $cr;
6947 wakaba 1.54 last C;
6948 wakaba 1.48 }
6949     }
6950     }__;
6951    
6952     @Method:
6953     @@Name: getConstResourceByName
6954     @@enDesc:
6955     Gets a constant value resource by its local name.
6956 wakaba 1.15 @@Param:
6957 wakaba 1.48 @@@Name:localName
6958 wakaba 1.15 @@@Type:
6959 wakaba 1.48 DISLang:String::ManakaiDOM:all
6960 wakaba 1.15 @@@enDesc:
6961 wakaba 1.48 Constant name.
6962 wakaba 1.15 @@Return:
6963 wakaba 1.48 @@@Type: DISResource
6964     @@@clsActualType: ManakaiDISResourceDefinition
6965     @@@enDesc:
6966     The constant resource identified by <P::localName>.
6967     @@@nullCase:
6968 wakaba 1.16 @@@@enDesc:
6969 wakaba 1.48 There is no such constant resource.
6970 wakaba 1.15 @@@PerlDef:
6971 wakaba 1.48 __DEEP{
6972     my @constGroup;
6973 wakaba 1.54 my $db = $self-><AG::DIS|DISAnyResource.database>;
6974     C: for my $cr_uri (@{$self->{<H::DIS:childResource>}||[]}) {
6975     my $cr = $db-><M::DIS|DISDatabase.getResource> ($$cr_uri);
6976     my $ln = $cr-><AG::DIS|DISAnyResource.localName>;
6977 wakaba 1.48 if ($ln and $ln eq $localName and
6978 wakaba 1.79 $cr-><M::DIS|DISAnyResource.isTypeURI> (<Q::DISLang:Const>)) {
6979 wakaba 1.48 $r = $cr;
6980 wakaba 1.54 last C;
6981 wakaba 1.79 } elsif ($cr-><M::DIS|DISAnyResource.isTypeURI>
6982 wakaba 1.54 (<Q::DISLang:ConstGroup>)) {
6983 wakaba 1.48 push @constGroup, $cr;
6984     }
6985     }
6986     unless ($r) {
6987 wakaba 1.54 D: for my $cg (@constGroup) {
6988     $r = $cg-><M::DIS|DISResource.getChildResourceByNameAndType>
6989     ($localName, <Q::DISLang:Const>);
6990     last D if $r;
6991 wakaba 1.15 }
6992     }
6993 wakaba 1.48 }__;
6994 wakaba 1.15
6995 wakaba 1.18 @Attr:
6996 wakaba 1.54 @@Name: parentResource
6997     @@enDesc:
6998     The static parent resource of the resource.
6999     @@Type: DIS|DISResource
7000     @@nullCase:
7001     @@@enDesc: No parent resource.
7002     @@Get:
7003     @@@PerlDef:
7004     __DEEP{
7005     if ($self->{<H::DIS|parentResource>}) {
7006     $r = $self-><AG::DIS|DISAnyResource.database>
7007     -><M::DIS|DISDatabase.getResource>
7008     (${$self->{<H::DIS|parentResource>}});
7009     }
7010     }__;
7011     @@Set:
7012     @@@ForCheck: ManakaiDOM|ForClass
7013     @@@PerlDef:
7014     __DEEP{
7015     if ($given) {
7016     $self->{<H::DIS|parentResource>}
7017     = $given-><AG::DIS|DISAnyResource.uriRef>;
7018     } else {
7019     CORE::delete $self->{<H::DIS|parentResource>};
7020     }
7021     }__;
7022    
7023     @Attr:
7024     @@Name: dynamicParentResource
7025     @@enDesc:
7026     The dynamic parent resource of the resource.
7027     @@Type: DIS|DISResource
7028     @@nullCase:
7029     @@@enDesc: No parent resource.
7030     @@Get:
7031     @@@PerlDef:
7032     __DEEP{
7033     if ($self->{<H::DIS|dynamicParentResource>}) {
7034     $r = $self-><AG::DIS|DISAnyResource.database>
7035     -><M::DIS|DISDatabase.getResource>
7036     (${$self->{<H::DIS|dynamicParentResource>}});
7037     }
7038     }__;
7039     @@Set:
7040     @@@ForCheck: ManakaiDOM|ForClass
7041     @@@PerlDef:
7042     __DEEP{
7043     if ($given) {
7044     $self->{<H::DIS|dynamicParentResource>}
7045     = $given-><AG::DIS|DISAnyResource.uriRef>;
7046     } else {
7047     CORE::delete $self->{<H::DIS|dynamicParentResource>};
7048     }
7049     }__;
7050    
7051     @Attr:
7052 wakaba 1.48 @@Name: ownerClassNodeURI
7053 wakaba 1.18 @@enDesc:
7054 wakaba 1.48 The node URI reference of the class resource this resource
7055     belongs to.
7056     @@Type: ResourceURI
7057 wakaba 1.18 @@Get:
7058 wakaba 1.48 @@@enDesc:
7059     The URI reference of the <Q::ManakaiDOM:Class> resource.
7060     If this resource is a class, then the URI reference
7061     of this resource is returned.
7062     @@@nullCase:
7063 wakaba 1.18 @@@@enDesc:
7064 wakaba 1.48 This resource does not belong to any class.
7065 wakaba 1.18 @@@PerlDef:
7066 wakaba 1.53 if (exists $self->{<H::DIS:ownerClass>}) {
7067     $r = $self->{<H::DIS:ownerClass>};
7068 wakaba 1.48 } else {
7069     my $res = $self;
7070     __DEEP{
7071     RES: {
7072 wakaba 1.79 if ($res-><M::DISAnyResource.isTypeURI>
7073 wakaba 1.48 (<Q::ManakaiDOM:Class>)) {
7074     $r = $res-><AG::DISAnyResource.sourceNodeID>;
7075     } else {
7076 wakaba 1.54 $res = $res-><AG::DIS|DISResource.parentResource>;
7077 wakaba 1.48 redo RES if $res;
7078     }
7079 wakaba 1.18 }
7080 wakaba 1.48 }__;
7081 wakaba 1.53 $self->{<H::DIS:ownerClass>} = $r;
7082 wakaba 1.48 }
7083 wakaba 1.18
7084     @Attr:
7085     @@Name: disIsNullValue
7086     @@enDesc:
7087     Whether this resource have <DOM::null> value or not.
7088     A resource have <DOM::null> value iff it has
7089     <Q::dis:Value> attribute node that in turn has
7090     <Q::dis:is-null> attribute whose value set to <DOM::true>.
7091     @@Type:
7092     DOMMain:boolean::ManakaiDOM:all
7093     @@Get:
7094     @@@PerlDef:
7095 wakaba 1.51 if ($self->{<Q::dis:Value>}) {
7096     $r = $self->{<Q::dis:Value>}-><AG::dv|DVValue.isNull>;
7097 wakaba 1.18 }
7098 wakaba 1.19
7099 wakaba 1.24 @Method:
7100     @@Name: isFeatureProvided
7101     @@enDesc:
7102     Whether a feature is provided by this resource or not.
7103     Note that the feature is actually available (implemented)
7104     or not is other thing (use <M::ManakaiDISPerlModuleDefinition
7105     .plIsFeatureImplemented> instead).
7106     @@Param:
7107     @@@Name: featureResourceURI
7108     @@@Type: ResourceURI
7109     @@@enDesc:
7110     The URI reference of the resource definition for the feature to test.
7111     @@Return:
7112     @@@Type:
7113     DOMMain:boolean::ManakaiDOM:all
7114     @@@enDesc:
7115     Whether the feature is provided or not.
7116     @@@PerlDef:
7117     __DEEP{
7118     my @f = @{$self-><M::ManakaiDISPropertyAccessor
7119     .getPropertyResourceList>
7120     (<Q::DOMMain:implementFeature>,
7121 wakaba 1.26 isa_recursive => true,
7122 wakaba 1.68 default_media_type => <Q::DISCore:QName>)};
7123 wakaba 1.24 if (@f) {
7124     for my $f (@f) {
7125     if ($f-><M::ManakaiDISResourceDefinition.isSubsetOfURI>
7126     ($featureResourceURI)) {
7127     $r = true;
7128     last;
7129     }
7130     }
7131     } else {
7132 wakaba 1.54 my $parent = $self-><AG::DIS|DISResource.parentResource>;
7133 wakaba 1.24 $r = $parent-><M::ManakaiDISResourceDefinition.isFeatureProvided>
7134     ($featureResourceURI)
7135     if $parent;
7136     }
7137     }__;
7138    
7139     @Attr:
7140     @@Name: featureNameList
7141     @@enDesc:
7142     The list of the names of the feature defined by this resource.
7143 wakaba 1.48
7144     = If the resource has one or more <Q::dis:AppName> attributes,
7145     their text values are feature names.
7146    
7147     = If there is no <Q::dis:AppName> attributes but the resource
7148     is a <Q::DOMFeature:instanceOf> another feature, then
7149     the set of the feature names of the resource is equal
7150     to the one of another feature's feature names.
7151    
7152     {OLI:: If two operation above does not result in one or more
7153     feature names,
7154    
7155     = and if the resource has a name (the <A::DISAnyResource
7156     .isAnonymous> attribute returns <DOM::false>), then
7157     the <A::DISAnyResource.nameURI> of the resource is
7158     a feature name.
7159    
7160     = otherwise, i.e. <A::DISAnyResource.isAnonymous> is
7161     <DOM::true>, then the <A::DISAnyResource.localName>
7162     of the resource, if non-<DOM::null>, is a feature name.
7163    
7164     }
7165    
7166 wakaba 1.24 @@Type:
7167 wakaba 1.60 DISPerl:ARRAY::ManakaiDOM:all
7168 wakaba 1.24 @@Get:
7169 wakaba 1.48 @@@enDesc:
7170     A reference to the array containing feature names.
7171     Note that the order in the array is <EM::not> significant.
7172     The array might be empty if the resource has no feature name.
7173     This array is dead.
7174    
7175     {NOTE:: The attribute value array might be non-empty
7176     even if the resource is not of type <Q::DOMFeature:Feature>
7177     as far as the algorithm defined above returns
7178     some feature names.
7179     }
7180 wakaba 1.24 @@@RaiseException:
7181     @@@@@:UNSUPPORTED_MEDIA_TYPE_ERR
7182     @@@@enDesc:
7183     There is an <Q::dis:AppName> attribute whose media
7184     type is not supported.
7185     @@@RaiseException:
7186     @@@@@: NO_SOURCE_NODE_ERR
7187     @@@@enDesc:
7188     This resource definition does not have associated node
7189     in the source tree.
7190     @@@PerlDef:
7191     __DEEP{
7192 wakaba 1.49 $r = [map {lc} @{$self-><M::DISResourceProp.getPropertyTextList>
7193 wakaba 1.52 (<Q::DOMFeature:name>)}];
7194 wakaba 1.24 unless (@$r) {
7195 wakaba 1.48 ## TODO: instance feature
7196 wakaba 1.54 my $pr = $self-><AG::DIS|DISResource.parentResource>;
7197 wakaba 1.28 if ($pr) {
7198 wakaba 1.79 if ($pr-><M::DISAnyResource.isTypeURI> (<Q::DOMFeature:Feature>) and
7199 wakaba 1.48 not $pr-><AG::DISAnyResource.isAnonymous>) {
7200     push @$r, @{$pr-><AG::DISResource.featureNameList>};
7201 wakaba 1.28 }
7202     }
7203     }
7204     unless (@$r) {
7205 wakaba 1.48 if ($self-><AG::DISAnyResource.isAnonymous>) {
7206     my $ln = $self-><AG::DISAnyResource.localName>;
7207 wakaba 1.28 push @$r, lc $ln if defined $ln;
7208 wakaba 1.24 } else {
7209 wakaba 1.48 push @$r, lc $self-><AG::DISAnyResource.nameURI>;
7210     }
7211     }
7212     }__;
7213    
7214     @Method:
7215     @@ForCheck: ManakaiDOM|ForClass
7216     @@Name: getFeature
7217     @@Description:
7218     @@@lang:en
7219     @@@@:
7220     Returns a specialized object that implements the specialized
7221     interfaces of the specified feature and version.
7222     @@Param:
7223     @@@Name: feature
7224     @@@Type:
7225     DISLang:String::ManakaiDOM:all
7226     @@@actualType:
7227     ManakaiDOM:ManakaiDOMFeatureName::ManakaiDOM:ManakaiDOMLatest
7228     @@@Description:
7229     @@@@lang:en
7230     @@@@@:
7231     A feature name to request.
7232     @@Param:
7233     @@@Name: version
7234     @@@Type:
7235     DISLang:String::ManakaiDOM:all
7236     @@@actualType:
7237     ManakaiDOM:ManakaiDOMFeatureVersion::ManakaiDOM:ManakaiDOMLatest
7238     @@@Description:
7239     @@@@lang:en
7240     @@@@@:
7241     A feature version number to request.
7242     @@Return:
7243     @@@Type:
7244     DOMMain:Object::ManakaiDOM:all
7245     @@@Description:
7246     @@@@lang:en
7247     @@@@@:
7248     An object that implements the specialized APIs of the
7249     <P::feature> and <P::version>.
7250 wakaba 1.49 @@@nullCase:
7251     @@@@enDesc:
7252 wakaba 1.48 There is no object available that implements interfaces
7253     associated with the <P::feature> and <P::version>.
7254     @@@PerlDef:
7255     $feature =~ s/^\+//;
7256     CLASS: for my $class (grep {
7257     $Message::Util::DIS::ManakaiDISResourceDefinition::CompatClass{$_}
7258     } keys %Message::Util::DIS::ManakaiDISResourceDefinition::CompatClass){
7259     if ($Message::DOM::ClassFeature{$class}->{$feature}->{$version}) {
7260     $r = bless {o => $self}, $class;
7261     last CLASS;
7262 wakaba 1.24 }
7263     }
7264 wakaba 1.48
7265     @Attr:
7266     @@Name: multiplePropertiesURI
7267     @@enDesc:
7268     Whether the property allows multiple occurence of the attribute
7269     in the <QUOTE::dis> source tree.
7270     @@Type: DISLang|String||ManakaiDOM|all
7271     @@Get:
7272     @@@PerlDef:
7273     __DEEP{
7274     if ($self->{<Q::dis|multipleProperties>}) {
7275     $r = $self->{<Q::dis|multipleProperties>}
7276     -><M::dv|DVURIValue.getResource>
7277     ($self-><AG::DISAnyResource.database>)
7278     -><AG::DISAnyResource.uri>;
7279     } else {
7280     $r = <Q::DISCore|OrderedList>;
7281     }
7282     }__;
7283    
7284     @Attr:
7285     @@Name: defaultLextypeURI
7286     @@enDesc:
7287     The URI of the default lexical type for the <QUOTE::dis> attribute.
7288     @@Type: DISLang|String||ManakaiDOM|all
7289     @@Get:
7290     @@@PerlDef:
7291     __DEEP{
7292     if ($self->{<Q::dis:dataType>}) {
7293     $r = $self->{<Q::dis:dataType>}
7294     -><M::dv|DVURIValue.getResource>
7295     ($self-><AG::DISAnyResource.database>)
7296     -><AG::DISAnyResource.uri>;
7297     } else {
7298     $r = <Q::DISCore|String>;
7299     }
7300 wakaba 1.24 }__;
7301 wakaba 1.79
7302     @CMethod:
7303     @@Name: getSuperResourceURIList
7304     @@enDesc:
7305     Returns a snapshot list of super-resources URIs of the resource,
7306     including canonical and alias URIs of the resource itself.
7307     @@Return:
7308     @@@Type: URIList
7309     @@@enDesc:
7310     A snapshot list of URIs.
7311     @@@PerlDef:
7312     $r = [
7313     (grep {$self->{subOf}->{$_}} keys %{$self->{subOf}}),
7314     (grep {$self->{aliasURI}->{$_}} keys %{$self->{aliasURI}}),
7315     ];
7316    
7317     @@Test:
7318     @@@QName: DISResource.getSuperResourceURIList.test
7319     @@@PerlDef:
7320     my $db;
7321     __CODE{createDISDBForTest:: $db => $db}__;
7322    
7323     my $res1 = $db->get_resource ('about:test1');
7324     my $res2 = $db->get_resource ('about:test2');
7325     $res1->add_super_resource ($res2);
7326    
7327     my %list1 = map {$_ => true} @{$res1->get_super_resource_uri_list};
7328     $test->id ('res1.itself');
7329     $test->assert_true ($list1{'about:test1'});
7330     $test->id ('res1.res2');
7331     $test->assert_true ($list1{'about:test2'});
7332    
7333     my %list2 = map {$_ => true} @{$res2->get_super_resource_uri_list};
7334     $test->id ('res2.itself');
7335     $test->assert_true ($list2{'about:test2'});
7336     $test->id ('res2.res1');
7337     $test->assert_false ($list2{'about:test1'});
7338    
7339     @Method:
7340     @@ForCheck: ManakaiDOM|ForIF
7341     @@Name: isTypeURI
7342     @@enImplNote: For compatibility with old code.
7343 wakaba 1.48 ##DISResource
7344    
7345 wakaba 1.79 ResourceDef:
7346     @QName: String
7347     @AliasFor: DISLang|String||ManakaiDOM|all
7348     @For: DIS|ForEmpty
7349    
7350     ResourceDef:
7351     @QName: RevisionNumber
7352     @AliasFor: idl|unsignedLong||ManakaiDOM|all
7353     @For: DIS|ForEmpty
7354     @enImplNote:
7355     {ISSUE::
7356     Should be <Q::idl|unsignedLongLong||ManakaiDOM|all>?
7357     }
7358    
7359     PropDef:
7360     @QName: DIS|revision
7361     @DIS:key: r
7362    
7363     ElementTypeBinding:
7364     @Name: Test
7365     @ElementType:
7366     dis:ResourceDef
7367     @ShadowContent:
7368     @@rdf:type: test|StandaloneTest
7369     @@ForCheck: ManakaiDOM|ForClass
7370    
7371     DataTypeDef:
7372     @QName: URIList
7373     @rdfs:subClassOf: DISPerl|ARRAY||ManakaiDOM|all
7374    
7375 wakaba 1.48 IFClsDef:
7376     @IFQName: DISResourceMV
7377     @ClsQName: ManakaiDISResourceMV
7378    
7379     @enDesc:
7380     The objects implementing the <IF::DISResourceMV> <kwd:MUST>
7381     also implement the <IF::DISResource> interface.
7382 wakaba 1.32
7383     @Attr:
7384     @@Name: mvLocalName
7385     @@enDesc:
7386     The local name of the markup vocabulary element defined by this
7387     resource.
7388     @@Type:
7389     DISLang:String::ManakaiDOM:all
7390     @@Get:
7391     @@@nullCase:
7392     @@@@enDesc:
7393     Either this resource does not define a markup vocabulary element
7394     or it does define an element but it does not have a local name.
7395     @@@PerlDef:
7396     __DEEP{
7397 wakaba 1.48 if (UNIVERSAL::isa ($self->{<Q::dis|AppName>},
7398     <IFName::dv|DVQNameValue>)) {
7399     $r = $self->{<Q::dis|AppName>}-><AG::dv|DVQNameValue.localName>;
7400 wakaba 1.43 } else {
7401 wakaba 1.59 $r = $self-><AG::DIS|DISAnyResource.localName>;
7402 wakaba 1.43 }
7403     }__;
7404    
7405     @Attr:
7406     @@Name: mvPrefix
7407     @@enDesc:
7408     A typical namespace prefix of the markup vocabulary element defined
7409     by this resource.
7410     @@Type:
7411     DISLang:String::ManakaiDOM:all
7412     @@Get:
7413     @@@nullCase:
7414     @@@@enDesc:
7415     Either this resource does not define a markup vocabulary element
7416     or it does define an element but it does not have a namespace URI.
7417     @@@PerlDef:
7418     __DEEP{
7419 wakaba 1.48 if (UNIVERSAL::isa ($self->{<Q::dis|AppName>},
7420     <IFName::dv|DVQNameValue>)) {
7421     $r = $self->{<Q::dis|AppName>}-><AG::dv|DVQNameValue.prefix>;
7422 wakaba 1.43 }
7423     unless (defined $r) {
7424 wakaba 1.48 my $nsuri = $self-><AG::DISResourceMV.mvNamespaceURI>;
7425 wakaba 1.43 if (defined $nsuri and $nsuri =~ /([A-Za-z]\w*)\W*$/) {
7426 wakaba 1.53 $r = $1;
7427 wakaba 1.43 } elsif (defined $nsuri) {
7428 wakaba 1.53 $r = 'ns';
7429 wakaba 1.43 }
7430 wakaba 1.32 }
7431     }__;
7432    
7433     @Attr:
7434     @@Name: mvNamespaceURI
7435     @@enDesc:
7436     The namespace URI of the markup vocabulary element defined by this
7437     resource.
7438     @@Type: AnyURI
7439     @@Get:
7440     @@@nullCase:
7441     @@@@enDesc:
7442     Either this resource does not define a markup vocabulary element
7443     or it does define an element but it does not have a namespace URI.
7444     @@@PerlDef:
7445     __DEEP{
7446 wakaba 1.48 if (UNIVERSAL::isa ($self->{<Q::dis|AppName>},
7447     <IFName::dv|DVQNameValue>)) {
7448     $r = $self->{<Q::dis|AppName>}-><AG::dv|DVQNameValue.namespaceURI>;
7449 wakaba 1.32 } else {
7450 wakaba 1.59 $r = $self-><AG::DIS|DISAnyResource.namespaceURI>;
7451 wakaba 1.32 }
7452     }__;
7453    
7454     @Attr:
7455     @@Name: mvOwnerElementResource
7456     @@enDesc:
7457     An <QUOTE::owner element> resource of the markup vocabulary
7458     element defined by this resource.
7459 wakaba 1.47 @@Type: DISResource
7460     @@clsActualType: ManakaiDISResourceDefinition
7461 wakaba 1.32 @@Get:
7462     @@@nullCase:
7463     @@@@enDesc:
7464     Either this resource does not define a markup vocabulary element
7465     or it does define an element but it does not have an owner.
7466     @@@PerlDef:
7467     __DEEP{
7468 wakaba 1.53 if (exists $self->{<H::DIS:mvOwnerElementURI>}) {
7469 wakaba 1.32 $r = $self->{db}-><M::ManakaiDISDatabase.getResource>
7470 wakaba 1.53 ($self->{<H::DIS:mvOwnerElementURI>})
7471     if defined $self->{<H::DIS:mvOwnerElementURI>};
7472 wakaba 1.54 } else {
7473     $r = $self-><AG::DIS|DISResource.parentResource>;
7474 wakaba 1.79 undef $r unless $r-><M::DIS|DISAnyResource
7475 wakaba 1.32 .isTypeURI> (<Q::s:AnyOwnerElement>);
7476 wakaba 1.53 $self->{<H::DIS:mvOwnerElementURI>} = $r->{uri} if $r;
7477 wakaba 1.32 }
7478 wakaba 1.48 }__;
7479     ##DISResourceMV
7480 wakaba 1.27
7481     PropDef:
7482 wakaba 1.32 @QName: mvLocalName
7483     @enDesc:
7484     <A::ManakaiDISResourceDefinition.mvLocalName>.
7485    
7486     PropDef:
7487 wakaba 1.43 @QName: mvPrefix
7488     @enDesc:
7489     <A::ManakaiDISResourceDefinition.mvPrerix>.
7490    
7491     PropDef:
7492 wakaba 1.32 @QName: mvNamespaceURI
7493     @enDesc:
7494     <A::ManakaiDISResourceDefinition.mvNamespaceURI>.
7495    
7496     PropDef:
7497     @QName: mvOwnerElementURI
7498     @enDesc:
7499     <A::ManakaiDISResourceDefinition.mvOwnerElementResource>
7500     (<QUOTE::dis> resource URI reference).
7501    
7502     PropDef:
7503 wakaba 1.13 @QName: ownerClass
7504     @enDesc:
7505     The class to which this resource belongs.
7506     @Type: ResourceURI
7507     @rdfs:range:
7508     rdf:Resource
7509     @rdfs:domain:
7510     ManakaiDOM:Class
7511    
7512 wakaba 1.12 ResourceDef:
7513     @QName: DOMMinImpl
7514     @AliasFor:
7515 wakaba 1.46 DOMFeature:GetFeature::ManakaiDOM:ManakaiDOMLatest
7516 wakaba 1.49 @For: DIS|ForEmpty
7517 wakaba 1.20
7518     ResourceDef:
7519 wakaba 1.12 @QName: SWCFGNode
7520     @AliasFor:
7521     swcfg21:SWCFGNode::swcfg21:ForLatest
7522 wakaba 1.49 @For: DIS|ForEmpty
7523 wakaba 1.12
7524     ResourceDef:
7525 wakaba 1.48 @QName: SWCFGElement
7526     @AliasFor:
7527     swcfg21:SWCFGElement::swcfg21:ForLatest
7528 wakaba 1.49 @For: DIS|ForEmpty
7529 wakaba 1.48
7530     ResourceDef:
7531 wakaba 1.12 @QName: SWCFGDoc
7532     @AliasFor:
7533     swcfg21:SWCFGDocument::swcfg21:ForLatest
7534 wakaba 1.49 @For: DIS|ForEmpty
7535 wakaba 1.12
7536     XParamDef:
7537 wakaba 1.48 @QName: sourceNodePath
7538     @enDesc:
7539     A node path string of the source node.
7540    
7541     XParamDef:
7542 wakaba 1.12 @QName: errResource
7543     @enDesc:
7544     A resource on which an error has occurred.
7545    
7546 wakaba 1.8 XParamDef:
7547     @QName: generatedName
7548     @enDesc:
7549     A generated name.
7550    
7551 wakaba 1.47 IFClsDef:
7552     @IFQName: DISResourceProp
7553 wakaba 1.2 @ClsQName: ManakaiDISPropertyAccessor
7554 wakaba 1.47
7555 wakaba 1.3 @enDesc:
7556 wakaba 1.2 Accessor methods for resource or module properties.
7557 wakaba 1.48
7558     @Method:
7559     @@Name: getPropertyValue
7560 wakaba 1.22 @@enDesc:
7561 wakaba 1.48 Returns a property value object.
7562     @@PropNameParam:
7563     @@Return:
7564     @@@Type: dv|DVValue
7565     @@@enDesc: The property value.
7566 wakaba 1.22 @@@nullCase:
7567     @@@@enDesc:
7568 wakaba 1.48 The property has no value.
7569 wakaba 1.22 @@@PerlDef:
7570 wakaba 1.52 if ($self->{$propName}) {
7571 wakaba 1.54 $r = $self->{$propName}->[0];
7572 wakaba 1.52 } else {
7573     my $pr = $self-><AG::DISAnyResource.database>
7574     -><M::DISDatabase.getResource> ($propName);
7575 wakaba 1.53 A: for (grep {$pr->{aliasURI}->{$_} or $pr->{supOf}->{$_}}
7576     (keys %{$pr->{aliasURI}}, keys %{$pr->{supOf}||{}})) {
7577 wakaba 1.52 my $v = $self->{$_};
7578     if ($v) {
7579     $r = $v->[0];
7580     last A;
7581     }
7582     }
7583     }
7584 wakaba 1.22
7585 wakaba 1.48 @Method:
7586     @@Name: getPropertyValueList
7587 wakaba 1.22 @@enDesc:
7588 wakaba 1.48 Returns a property value objects.
7589     @@PropNameParam:
7590     @@Return:
7591 wakaba 1.60 @@@Type: DISPerl|ARRAY||ManakaiDOM|all
7592 wakaba 1.48 @@@enDesc: The property value.
7593     @@@PerlDef:
7594     my $pr = $self-><AG::DISAnyResource.database>
7595     -><M::DISDatabase.getResource> ($propName);
7596     $r = [map {@$_}
7597 wakaba 1.49 grep {defined $_}
7598 wakaba 1.48 map {$self->{$_}}
7599 wakaba 1.53 grep {$pr->{aliasURI}->{$_} or $pr->{supOf}->{$_}}
7600     (keys %{$pr->{aliasURI}}, keys %{$pr->{supOf}||{}})];
7601 wakaba 1.22
7602 wakaba 1.2 @Method:
7603 wakaba 1.8 @@Name: getPropertyBoolean
7604     @@enDesc:
7605     Gets boolean property value.
7606     @@PropNameParam:
7607     @@Param:
7608     @@@Name:default
7609     @@@Type:
7610     DOMMain:boolean::ManakaiDOM:all
7611     @@@enDesc:
7612     The default value that is returned if no explicit property
7613     value specification found for this resource.
7614     @@Return:
7615     @@@Type:
7616     DOMMain:boolean::ManakaiDOM:all
7617     @@@enDesc:
7618     The property value.
7619     @@@PerlDef:
7620 wakaba 1.48 if (ref $self->{$propName}) {
7621     $r = $self->{$propName}-><AG::dv|DVValue.value> ? true : false;
7622 wakaba 1.8 $r = $default unless defined $r;
7623     } else {
7624 wakaba 1.48 my $pr = $self-><AG::DISAnyResource.database>
7625     -><M::DISDatabase.getResource> ($propName);
7626     C: {
7627     for (map {$self->{$_}}
7628 wakaba 1.53 grep {$pr->{aliasURI}->{$_} or $pr->{supOf}->{$_}}
7629     (keys %{$pr->{aliasURI}}, keys %{$pr->{supOf}||{}})) {
7630 wakaba 1.48 if (defined $_) {
7631     $r = $_-><AG::dv|DVValue.value> ? true : false;
7632     last C;
7633     }
7634     }
7635     $r = $default;
7636     } # C
7637 wakaba 1.8 }
7638    
7639     @Method:
7640 wakaba 1.2 @@Name: getPropertyText
7641     @@enDesc:
7642     Gets property value text.
7643     @@PropNameParam:
7644     @@Param:
7645     @@@Name:default
7646     @@@Type:
7647 wakaba 1.3 swcfg21:SWCFGString::swcfg21:ForLatest
7648 wakaba 1.2 @@@enDesc:
7649     The default value that is returned if no explicit property
7650     value specification found for this resource.
7651     @@@nullCase:
7652     @@@@enDesc:
7653     No default value supplied; <DOM::null> is returned if
7654     no value specified.
7655     @@Return:
7656     @@@Type:
7657 wakaba 1.3 swcfg21:SWCFGString::swcfg21:ForLatest
7658 wakaba 1.2 @@@enDesc:
7659     The property value string.
7660     @@@nullCase:
7661     @@@@enDesc:
7662     No value nor default value has specified.
7663     @@@PerlDef:
7664 wakaba 1.48 if (defined $self->{$propName}) {
7665     $r = $self->{$propName}-><AG::dv|DVValue.stringValue>;
7666     $r = $default unless defined $r;
7667     } else {
7668     my $pr = $self-><AG::DISAnyResource.database>
7669     -><M::DISDatabase.getResource> ($propName);
7670     C: {
7671     for (map {$self->{$_}}
7672 wakaba 1.53 grep {$pr->{aliasURI}->{$_} or $pr->{supOf}->{$_}}
7673     (keys %{$pr->{aliasURI}}, keys %{$pr->{supOf}||{}})) {
7674 wakaba 1.48 if (defined $_) {
7675     $r = $_-><AG::dv|DVValue.stringValue>;
7676     last C;
7677     }
7678     }
7679 wakaba 1.8 $r = $default;
7680 wakaba 1.48 } # C
7681 wakaba 1.2 }
7682    
7683     @Method:
7684 wakaba 1.48 @@Name: getPropertyTextList
7685     @@enDesc:
7686     Returns a list of property value text.
7687     @@PropNameParam:
7688     @@MediaTypeDefaultParam:
7689     @@Return:
7690 wakaba 1.60 @@@Type: DISPerl|ARRAY||ManakaiDOM|all
7691 wakaba 1.48 @@@enDesc:
7692     A list of the property value strings.
7693     @@@RaiseException:
7694     @@@@@:UNSUPPORTED_MEDIA_TYPE_ERR
7695     @@@@enDesc:
7696     There is an attribute whose media
7697     type is not supported.
7698     @@@PerlDef:
7699     my $pr = $self-><AG::DISAnyResource.database>
7700     -><M::DISDatabase.getResource> ($propName);
7701     $r = [map {$_-><AG::dv|DVValue.stringValue>}
7702     map {@$_}
7703     grep {$_}
7704     map {$self->{$_}}
7705 wakaba 1.53 grep {$pr->{aliasURI}->{$_} or $pr->{supOf}->{$_}}
7706     (keys %{$pr->{aliasURI}}, keys %{$pr->{supOf}||{}})];
7707 wakaba 1.48
7708     @Method:
7709 wakaba 1.2 @@Name: getPropertyResource
7710     @@enDesc:
7711     Gets property value resource.
7712     @@PropNameParam:
7713 wakaba 1.10 @@NamedParam:
7714     @@@Name: defaultMediaType
7715     @@@Type: ResourceURI
7716     @@@enDesc:
7717     The URI reference of the default media type which is used
7718     when the property value is retrieved from the source tree
7719     and the source tree element does not have its <Q::dis:ContentType>
7720     attribute specified.
7721     @@@nullCase:
7722     @@@@enDesc:
7723 wakaba 1.68 Defaulted to <Q::DISCore:QName>.
7724 wakaba 1.2 @@Return:
7725 wakaba 1.61 @@@Type: DIS|DISAnyResource
7726 wakaba 1.2 @@@enDesc:
7727     The property value resource.
7728     @@@nullCase:
7729     @@@@enDesc:
7730     No value has specified.
7731 wakaba 1.8 @@@UndeclaredPrefixException:
7732 wakaba 1.12 @@@RaiseException:
7733     @@@@@:UNSUPPORTED_MEDIA_TYPE_ERR
7734     @@@@enDesc:
7735     The media type of the attribute node in the source tree
7736     corresponding to this resource is not supported.
7737 wakaba 1.2 @@@PerlDef:
7738 wakaba 1.48 __DEEP{
7739     my $v = $self-><M::DISResourceProp.getPropertyValue>
7740     ($propName);
7741     if (UNIVERSAL::isa ($v, <IFName::dv|DVURIValue>)) {
7742 wakaba 1.62 $r = $v-><M::dv|DVURIValue.getResource>
7743 wakaba 1.48 ($self-><AG::DISAnyResource.database>);
7744     }
7745     }__;
7746 wakaba 1.2
7747     @Method:
7748 wakaba 1.10 @@Name: getPropertyResourceList
7749     @@enDesc:
7750     Gets property value resource list.
7751     @@PropNameParam:
7752     @@NamedParam:
7753 wakaba 1.24 @@@Name: recursive
7754     @@@Type:
7755     DOMMain:boolean::ManakaiDOM:all
7756     @@@enDesc:
7757     Whether property resource values of this resource
7758     should also be included to the returned list or not.
7759     @@NamedParam:
7760 wakaba 1.10 @@@Name: recursiveISA
7761     @@@Type:
7762 wakaba 1.18 DOMMain:boolean::ManakaiDOM:all
7763 wakaba 1.10 @@@enDesc:
7764 wakaba 1.26 Whether the <Q::dis:ISA> ancestors of the resources
7765     that are property values should also be included in the returned list
7766     or not.
7767     @@@TrueCase:
7768     @@@@enDesc:
7769     If a property value is a resource <VAR::R> and
7770     the resource <VAR::R> <Q::dis:ISA>'s (or inherits) <VAR::S>, then
7771     the resource <VAR::S> is also a value in the list.
7772     @@@FalseCase:
7773     @@@@enDesc:
7774     Only the resources directly specified as property values is returned.
7775     @@NamedParam:
7776     @@@Name: isaRecursive
7777     @@@Type:
7778     DOMMain:boolean::ManakaiDOM:all
7779     @@@enDesc:
7780     Whether property resource values of <Q::dis:ISA> resources
7781     of this resource should also be included to the returned list or not.
7782     @@@TrueCase:
7783     @@@@enDesc:
7784     If this resource <Q::dis:ISA>'s (or inherits) another resource
7785     <VAR::S> and the <VAR::S> resource has a <P::propName>
7786     property value of <VAR::R>, then the resource <VAR::R>
7787     is also a value in the list.
7788     @@@FalseCase:
7789     @@@@enDesc:
7790     Only the resource directly specified is the returned.
7791 wakaba 1.10 @@NamedParam:
7792     @@@Name: defaultMediaType
7793     @@@Type: ResourceURI
7794     @@@enDesc:
7795     The URI reference of the default media type which is used
7796     when the property value is retrieved from the source tree
7797     and the source tree element does not have its <Q::dis:ContentType>
7798     attribute specified.
7799     @@@nullCase:
7800     @@@@enDesc:
7801 wakaba 1.68 Defaulted to <Q::DISCore:QName>.
7802 wakaba 1.10 @@Return:
7803     @@@Type: ResourceList
7804     @@@enDesc:
7805     An array reference of the property value resources.
7806     \
7807     {NOTE:: This list is <QUOTE::dead>.
7808     \
7809     }
7810     @@@UndeclaredPrefixException:
7811 wakaba 1.12 @@@RaiseException:
7812     @@@@@:UNSUPPORTED_MEDIA_TYPE_ERR
7813     @@@@enDesc:
7814     The media type of the attribute node in the source tree
7815     corresponding to this resource is not supported.
7816 wakaba 1.10 @@@PerlDef:
7817     $r = [];
7818 wakaba 1.48 __DEEP{
7819     my $v = $self-><M::DISResourceProp.getPropertyValueList> ($propName);
7820     my $db = $self-><AG::DISAnyResource.database>;
7821     for my $a (@$v) {
7822     if ($a->isa (<IFName::dv|DVURIValue>)) {
7823 wakaba 1.62 push @$r, $a-><M::dv|DVURIValue.getResource> ($db);
7824 wakaba 1.48 }
7825     if ($isaRecursive) {
7826     my $b = $a-><M::dv|DVValue.getProperty>
7827     (<Q::DISCore:stopISARecursive>);
7828     if ($b and $b-><AG::dv|DVValue.value>) {
7829     $isaRecursive = false;
7830 wakaba 1.32 }
7831 wakaba 1.10 }
7832 wakaba 1.48 }
7833     }__;
7834    
7835 wakaba 1.24 if ($recursive) {
7836     __DEEP{
7837     $opt{___recursive_isa_done} ||= {$self->{uri} => true};
7838     my @p_res = @$r;
7839     for my $p_res (@p_res) {
7840     next if $opt{___recursive_isa_done}->{$p_res->{uri}};
7841     $opt{___recursive_isa_done}->{$p_res->{uri}} = true;
7842 wakaba 1.48 push @$r, @{$p_res-><M::DISResourceProp.getPropertyResourceList>
7843 wakaba 1.24 ($propName, recursive => true,
7844     recursive_isa => $recursiveISA,
7845     ___recursive_isa_done => $opt{___recursive_isa_done},
7846     default_media_type => $defaultMediaType)};
7847     }
7848     }__;
7849     }
7850 wakaba 1.10 if ($recursiveISA) {
7851     __DEEP{
7852     $opt{___recursive_isa_done} ||= {$self->{uri} => true};
7853     my @p_res = @$r;
7854     for my $p_res (@p_res) {
7855     next if $opt{___recursive_isa_done}->{$p_res->{uri}};
7856     $opt{___recursive_isa_done}->{$p_res->{uri}} = true;
7857 wakaba 1.48 push @$r, @{$p_res-><M::DISResourceProp.getPropertyResourceList>
7858 wakaba 1.33 (<Q::dis:ISA>,
7859     recursive => true,
7860 wakaba 1.10 ___recursive_isa_done => $opt{___recursive_isa_done},
7861     default_media_type => $defaultMediaType)};
7862     }
7863     }__;
7864     }
7865 wakaba 1.26 if ($isaRecursive) {
7866 wakaba 1.25 __DEEP{
7867     $opt{___recursive_isa_done} ||= {$self->{uri} => true};
7868 wakaba 1.37 $opt{___isa_recursive_done} ||= {$self->{uri} => true};
7869 wakaba 1.48 my @p_res = @{$self-><M::DISResourceProp.getPropertyResourceList>
7870 wakaba 1.26 (<Q::dis:ISA>, recursive_isa => false,
7871 wakaba 1.37 recursive => false,
7872 wakaba 1.26 default_media_type => <Q::dis:TFQNames>)};
7873 wakaba 1.25 for my $p_res (@p_res) {
7874 wakaba 1.37 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    
8096     TMethods:
8097     @TMethod:
8098     @@Name: getErrorInterfaceResource
8099     @@DIS:targetType: dx|ErrorCode
8100     @@Return:
8101     @@@Type: DISAnyResource
8102     @@@PerlDef:
8103     __DEEP{
8104     my $parent = $self-><AG::DISResource.parentResource>;
8105     if ($parent) {
8106     $r = $parent-><M::DISAnyResource.getErrorInterfaceResource>;
8107     }
8108     }__;
8109     ##dx:ErrorCode
8110    
8111     TMethods:
8112     @TMethod:
8113     @@Name: getErrorInterfaceResource
8114     @@DIS:targetType: dx|ErrorSubCode
8115     @@Return:
8116     @@@Type: DISAnyResource
8117     @@@PerlDef:
8118     __DEEP{
8119     my $parent = $self-><M::DISAnyResource.getErrorCodeResource>;
8120     if ($parent) {
8121     $r = $parent-><M::DISAnyResource.getErrorInterfaceResource>;
8122     }
8123     }__;
8124    
8125     @TMethod:
8126     @@Name: getErrorCodeResource
8127     @@DIS:targetType: dx|ErrorSubCode
8128     @@Return:
8129     @@@Type: DISAnyResource
8130     @@@PerlDef:
8131     __DEEP{
8132     my $parent = $self-><AG::DISResource.parentResource>;
8133     if ($parent and $parent-><M::DISAnyResource.isTypeURI>
8134     (<Q::dx|ErrorCode>)) {
8135     $r = $parent;
8136     }
8137     }__;
8138     ##dx:ErrorSubCode
8139 wakaba 1.48
8140 wakaba 1.3 ElementTypeBinding:
8141     @Name: PropNameParam
8142     @ElementType:
8143     dis:ResourceDef
8144     @ShadowContent:
8145     @@rdf:type:
8146     DISLang:MethodParameter
8147     @@Name: propName
8148     @@Type: ResourceURI
8149     @@Description:
8150     @@@lang:en
8151     @@@@:
8152     The name of the property.
8153    
8154 wakaba 1.2 PropDef:
8155     @QName:isAnon
8156     @Description:
8157     @@lang:en
8158     @@@:
8159     Whether the subject resource is anonymous or not.
8160     @Type:
8161 wakaba 1.18 DOMMain:boolean::ManakaiDOM:all
8162 wakaba 1.2
8163     PropDef:
8164     @QName:isDefined
8165     @Description:
8166     @@lang:en
8167     @@@:
8168     Whether the subject resource is defined or not.
8169    
8170     PropDef:
8171 wakaba 1.3 @QName:isReferred
8172 wakaba 1.2 @Description:
8173     @@lang:en
8174     @@@:
8175     Whether the subject resource is referred or not.
8176     @Type:
8177     DOMMain:any
8178    
8179     PropDef:
8180     @QName:definingModule
8181     @Description:
8182     @@lang:en
8183     @@@:
8184     The <QUOTE::dis> module in which the subject resource is defined.
8185 wakaba 1.22 \
8186     {NOTE:: The local name should have been <QUOTE::ownerModule> or some.
8187     \
8188     }
8189 wakaba 1.2 @rdfs:domain:
8190     DISCore:Module
8191 wakaba 1.1
8192     ## -- Datatypes
8193    
8194     URITypeDef:
8195 wakaba 1.3 @QName: AnyURI
8196     @Description:
8197     @@lang:en
8198     @@@:
8199     Any URI references.
8200    
8201     URITypeDef:
8202     @QName: FileURI
8203     @enDesc:
8204     URI references identifying file.
8205    
8206     URITypeDef:
8207 wakaba 1.1 @QName: ForURI
8208     @Description:
8209     @@lang:en
8210     @@@:
8211     <QUOTE::For> URI references.
8212    
8213     DataTypeDef:
8214     @QName: ForURIList
8215     @Description:
8216     @@lang:en
8217     @@@:
8218     References to the array containing <QUOTE::for> URI references.
8219    
8220     URITypeDef:
8221 wakaba 1.3 @QName: ResourceURI
8222     @Description:
8223     @@lang:en
8224     @@@:
8225     A URI reference for a <QUOTE::dis> resource.
8226    
8227     URITypeDef:
8228 wakaba 1.1 @QName: MediaTypeURI
8229     @Description:
8230     @@lang:en
8231     @@@:
8232     Media type URI references.
8233 wakaba 1.3 @rdfs:subClassOf: ResourceURI
8234    
8235     URITypeDef:
8236     @QName: ModuleURI
8237     @enDesc:
8238 wakaba 1.47 URI references for <QUOTE::dis> modules.
8239 wakaba 1.3 @rdfs:subClassOf: ResourceURI
8240    
8241     URITypeDef:
8242     @QName: NameURI
8243     @enDesc:
8244     URI references identifying a resource.
8245     @rdfs:subClassOf: ResourceURI
8246 wakaba 1.10
8247     DataTypeDef:
8248     @QName: ResourceList
8249     @enDesc:
8250     References to array containing resource definition objects.
8251     @rdfs:subClassOf:
8252 wakaba 1.60 DISPerl:ARRAY::ManakaiDOM:all
8253 wakaba 1.3
8254     ElementTypeBinding:
8255     @Name: DataTypeDef
8256     @ElementType:
8257     dis:ResourceDef
8258     @ShadowContent:
8259     @@rdf:type:
8260     ManakaiDOM:DataType
8261    
8262     ElementTypeBinding:
8263     @Name: URITypeDef
8264     @ElementType:
8265     dis:ResourceDef
8266     @ShadowContent:
8267     @@rdf:type:
8268     ManakaiDOM:DataType
8269     @@rdfs:subClassOf: AnyURI
8270 wakaba 1.1
8271     ## -- Exceptions
8272    
8273     XParamDef:
8274 wakaba 1.5 @QName: anotherSourceNode
8275     @enDesc:
8276     Another source node in which an error has occurred. In cases
8277     of <QUOTE::already defined> errors, it is the node that
8278     defines the resource first.
8279     @Type: ManakaiDISNode
8280 wakaba 1.3
8281 wakaba 1.12 ResourceDef:
8282     @QName: UNDECLARED_NS_PREFIX_ERR
8283 wakaba 1.49 @For: ForEmpty
8284 wakaba 1.12 @AliasFor:
8285     DIS:UNDECLARED_NS_PREFIX_ERR::swcfg21:ForLatest
8286    
8287 wakaba 1.47 ResourceDef:
8288     @rdf:type:
8289     @@@: dis|MultipleResource
8290     @@ForCheck: !ManakaiDOM|ForIF !ManakaiDOM|ForClass
8291     @resourceFor: ManakaiDOM|ForIF
8292     @resourceFor:
8293     @@@: ManakaiDOM|ForClass
8294     @@ForCheck: ForEmpty !=ForEmpty
8295     @For: ForLatest
8296     @For: =ForEmpty
8297    
8298     @rdf:type:
8299 wakaba 1.63 @@@: dx|Interface
8300 wakaba 1.47 @@ForCheck: ManakaiDOM|ForIF
8301    
8302     @rdf:type:
8303 wakaba 1.63 @@@: dx|Class
8304 wakaba 1.47 @@ForCheck: ManakaiDOM|ForClass
8305    
8306     @Implement:
8307     @@@: ||ForEmpty||ManakaiDOM|ForIF
8308     @@ContentType: DISCore|TFPQNames
8309     @@ForCheck: ManakaiDOM|ForClass ForEmpty
8310     @Implement:
8311     @@@: ||ForLatest||ManakaiDOM|ForIF
8312     @@ContentType: DISCore|TFPQNames
8313     @@ForCheck: ManakaiDOM|ForClass ForLatest
8314 wakaba 1.63 @dx:implementedBy: ||DIS|ForLatest||ManakaiDOM|ForClass
8315 wakaba 1.47
8316 wakaba 1.63 @f:implements:
8317 wakaba 1.47 @@@: CoreFeature10
8318     @@For: ForLatest
8319    
8320     @ISA:
8321 wakaba 1.63 @@@: dx|Exception||ManakaiDOM|Perl
8322 wakaba 1.47 @@ForCheck: ManakaiDOM|ForClass
8323    
8324     @IFQName: DISException
8325 wakaba 1.3 @ClsQName: ManakaiDISException
8326 wakaba 1.47
8327     @Description:
8328     @@lang:en
8329     @@@:
8330     Exceptions for the <QUOTE::dis> operations.
8331    
8332     @ResourceDef:
8333 wakaba 1.63 @@rdf:type: DISLang|ConstGroup
8334     @@ForCheck: ManakaiDOM|ForIF !=DIS|ForEmpty
8335 wakaba 1.47
8336     @@IFQName: DISExceptionCode
8337    
8338 wakaba 1.63 @@rdfs:subClassOf: idl|unsignedShort||ManakaiDOM|all
8339     @@Type: idl|unsignedShort||ManakaiDOM|all
8340 wakaba 1.47
8341 wakaba 1.3 @@enDesc:
8342 wakaba 1.63 Exception codes for <Class::DISException>.
8343 wakaba 1.47
8344 wakaba 1.3 @@XConstDef:
8345 wakaba 1.11 @@@Name: HIERARCHY_REQUEST_ERR
8346 wakaba 1.49 @@@Value:
8347     @@@@@:3
8348     @@@@ContentType: DISCore|Integer
8349 wakaba 1.11 @@@enDesc:
8350     An attempt is made to break the hierarchy.
8351     @@@XSubTypeDef:
8352     @@@@QName: MERGE_ITSELF_ERR
8353     @@@@enDesc:
8354     An attempt is made to merge the resource to itself.
8355     @@@@XSourceNodeParam:
8356     @@@@XParam:
8357     @@@@@QName:uri
8358     @@@@@enDesc:
8359     The URI reference of the resource to merge.
8360     @@@@enMufDef:
8361     An attempt is made to merge the resource <%p (name => {<Q::DIS:uri>}
8362     );> to itself
8363     @@XConstDef:
8364 wakaba 1.8 @@@Name: NOT_SUPPORTED_ERR
8365 wakaba 1.49 @@@Value:
8366     @@@@@:9
8367     @@@@ContentType: DISCore|Integer
8368 wakaba 1.8 @@@enDesc:
8369     An attempt is made to do something the implementation does not support.
8370     @@@XSubTypeDef:
8371     @@@@QName: UNSUPPORTED_MEDIA_TYPE_ERR
8372     @@@@enDesc:
8373     The implementation does not support the media type.
8374     @@@@XParam:
8375     @@@@@QName: uri
8376     @@@@@enDesc:
8377     The URI reference of the media type that is not supported.
8378     @@@@XSourceNodeParam:
8379 wakaba 1.30 @@@@XParam:
8380     @@@@@QName:elementType
8381     @@@@@enDesc:
8382     The URI reference of the element type of the element
8383     in which the media type is referenced.
8384 wakaba 1.12 @@@@enMufDef:
8385 wakaba 1.30 %p (name => {<Q::DIS:sourceCode>}, prefix => {"}, suffix => {": }
8386     );%p (name => {<Q::DIS:elementType>}, prefix => { (Element type: <},
8387     suffix => {>) }
8388     );Media type <%p (name => {<Q::DIS:uri>});> is not supported
8389 wakaba 1.3 @@@XSubTypeDef:
8390 wakaba 1.13 @@@@QName: UNSUPPORTED_ELEMENT_TYPE_ERR
8391     @@@@enDesc:
8392     An unsupported type of element is encounted.
8393     @@@@XSourceNodeParam:
8394     @@@@XParam:
8395     @@@@@QName:elementType
8396     @@@@@enDesc:
8397     The element type URI reference of the element.
8398 wakaba 1.16 @@@@enMufDef:
8399     Element type "%p (name => {<Q::DIS:elementType>});" is not supported
8400 wakaba 1.13 @@@XSubTypeDef:
8401 wakaba 1.12 @@@@QName: NO_PERL_CODE_IMPL_ERR
8402 wakaba 1.3 @@@@enDesc:
8403 wakaba 1.12 There is no implementation that supports the
8404     <Feature::Util:PerlCode> feature, version
8405     <FeatureVer::1.0>.
8406 wakaba 1.3 @@XConstDef:
8407     @@@Name: INVALID_STATE_ERR
8408 wakaba 1.49 @@@Value:
8409     @@@@@:11
8410     @@@@ContentType: DISCore|Integer
8411 wakaba 1.3 @@@enDesc:
8412     An attempt is made to use an object that is not (or no longer) usable.
8413     @@@XSubTypeDef:
8414     @@@@QName: NO_ASSOCIATED_DB_ERR
8415     @@@@enDesc:
8416     No <QUOTE::dis> database has been associated with this document.
8417 wakaba 1.4 @@XConstDef:
8418     @@@Name: INVALID_SOURCE_ERR
8419 wakaba 1.49 @@@Value:
8420 wakaba 1.63 @@@@@: 501
8421 wakaba 1.49 @@@@ContentType: DISCore|Integer
8422 wakaba 1.4 @@@enDesc:
8423     The source input is well-formed but invalid.
8424     @@@XSubTypeDef:
8425     @@@@QName: NO_MODULE_QNAME_ERR
8426     @@@@enDesc:
8427     The <Q::dis:Module> element must have its <Q::dis:QName>
8428     attribute.
8429 wakaba 1.8 @@@@XSourceNodeParam:
8430     @@@XSubTypeDef:
8431     @@@@QName: NO_LOCAL_NAME_ERR
8432     @@@@enDesc:
8433     The resource does not have a local name.
8434     @@@@XSourceNodeParam:
8435 wakaba 1.4 @@@XSubTypeDef:
8436     @@@@QName: UNABLE_TO_GET_MODULE_ERR
8437     @@@@enDesc:
8438     The implementation is unable to get the module source.
8439 wakaba 1.68 @@@@enMufDef:
8440 wakaba 1.4 Unable to get the module source of <%p (name => {<Q::DIS:uri>});>
8441     @@@@XParam:
8442     @@@@@QName: uri
8443     @@@@@enDesc:
8444     The URI reference of the module.
8445     @@@@XParam:
8446     @@@@@QName: namespaceURI
8447     @@@@@enDesc:
8448     The namespace URI of the module name.
8449     @@@@XParam:
8450     @@@@@QName: localName
8451     @@@@@enDesc:
8452     The local name of the module name.
8453     @@@@XParam:
8454     @@@@@QName: for
8455     @@@@@enDesc:
8456     The <QUOTE::for> of the module.
8457 wakaba 1.5 @@@XSubTypeDef:
8458     @@@@QName: NO_FOR_QNAME_ERR
8459     @@@@enDesc:
8460     A <Q::dis:ForDef> element must have <Q::dis:QName> attribute.
8461     @@@@XSourceNodeParam:
8462     @@@XSubTypeDef:
8463     @@@@QName: FOR_ALREADY_DEFINED_ERR
8464     @@@@enDesc:
8465     The <QUOTE::for> named as the same URI reference has
8466     already defined.
8467     @@@@XSourceNodeParam:
8468     @@@@XParam:
8469     @@@@@QName: anotherSourceNode
8470     @@@@@enDesc:
8471     The node that defines the <QUOTE::for> URI reference before.
8472 wakaba 1.7 @@@@XParam:
8473     @@@@@Name: uri
8474     @@@@@enDesc:
8475     The URI reference of the <QUOTE::for> attempted to define.
8476     @@@@enMufDef:
8477     <QUOTE::For> <%p (name => {<Q::DIS:uri>});> is already defined
8478 wakaba 1.5 @@@XSubTypeDef:
8479     @@@@QName: RESOURCE_ALREADY_DEFINED_ERR
8480     @@@@enDesc:
8481     The <QUOTE::dis> resource named as the same URI reference has
8482     already defined.
8483     @@@@XSourceNodeParam:
8484     @@@@XParam:
8485 wakaba 1.54 @@@@@@: anotherSourceNode
8486 wakaba 1.5 @@@@@enDesc:
8487     The node that defines the <QUOTE::for> URI reference before.
8488 wakaba 1.7 @@@@XParam:
8489 wakaba 1.54 @@@@@@: uri
8490 wakaba 1.7 @@@@@enDesc:
8491     The URI reference of the resource attempted to define.
8492 wakaba 1.54 @@@@XParam:
8493     @@@@@@: moduleURI
8494     @@@@@enDesc:
8495     A URI of the module in which the <Q::DIS|uri> resource is
8496     defined.
8497 wakaba 1.7 @@@@enMufDef:
8498 wakaba 1.54 %p (name => {<Q::DIS:moduleURI>}, prefix => {Module <},
8499     suffix => {>: })
8500     ;Resource <%p (name => {<Q::DIS:uri>});> is already defined
8501 wakaba 1.5 @@@XSubTypeDef:
8502     @@@@QName: ELEMENT_NOT_ALLOWED_ERR
8503     @@@@enDesc:
8504     An element has occured where it is not allowed.
8505     @@@@enMufDef:
8506     Module <%p (name => {<Q::DIS:uri>});>:
8507     Element of type <%p (name => {<Q::DIS:elementType>});>
8508     is not allowed here
8509     @@@@XSourceNodeParam:
8510     @@@@XParam:
8511     @@@@@QName: elementType
8512     @@@@@enDesc:
8513     The expanded element type name of the element.
8514     @@@@XParam:
8515     @@@@@QName: uri
8516     @@@@@enDesc:
8517     The URI reference of the module.
8518 wakaba 1.7 @@@XSubTypeDef:
8519     @@@@QName: NO_REQUIRED_ATTR_ERR
8520     @@@@enDesc:
8521     A required attribute is not specified.
8522     @@@@XSourceNodeParam:
8523     @@@@XParam:
8524     @@@@@QName: elementType
8525     @@@@@enDesc:
8526     The expanded URI reference of the attribute name.
8527     @@@@enMufDef:
8528     Attribute <%p (name => {<Q::DIS:elementType>});> must be specified
8529 wakaba 1.8 @@@XSubTypeDef:
8530     @@@@QName: FOR_NOT_DEFINED_ERR
8531     @@@@enDesc:
8532     A <QUOTE::for> is referred but not defined.
8533     @@@@XSourceNodeParam:
8534     @@@@XParam:
8535     @@@@@QName: uri
8536     @@@@@enDesc:
8537     The URI reference of the <QUOTE::for> that is not defined.
8538     @@@@enMufDef:
8539     <QUOTE::For> <%p (name => {<Q::DIS:uri>});> is not defined
8540     @@@XSubTypeDef:
8541     @@@@QName: RESOURCE_NOT_DEFINED_ERR
8542     @@@@enDesc:
8543 wakaba 1.13 A <QUOTE::dis> resource is referred but not defined
8544     or the resource referred does not have the type expected.
8545 wakaba 1.8 @@@@XSourceNodeParam:
8546     @@@@XParam:
8547 wakaba 1.48 @@@@@@: sourceNodePath
8548     @@@@@enDesc:
8549     A node path string of the source node.
8550     @@@@XParam:
8551 wakaba 1.8 @@@@@QName: uri
8552     @@@@@enDesc:
8553     The URI reference of the resource that is not defined.
8554 wakaba 1.13 @@@@XParam:
8555     @@@@@QName: elementType
8556     @@@@@enDesc:
8557     <QUOTE::dis> element type (either tree element type
8558     or preprocessing element type) of the element
8559     in which a reference to the undefined resource is contained.
8560     @@@@XParam:
8561 wakaba 1.30 @@@@@QName:parentURI
8562     @@@@@enDesc:
8563     The URI reference of the resource from whose child resources
8564     a resource is tried to find.
8565     @@@@XParam:
8566 wakaba 1.54 @@@@@QName: moduleURI
8567     @@@@@enDesc:
8568     The URI of the module in which the resourece should be included.
8569     @@@@XParam:
8570 wakaba 1.13 @@@@@QName: localName
8571     @@@@@enDesc:
8572     The local name of the undefined resource.
8573     @@@@XParam:
8574     @@@@QName: sourceCode
8575     @@@@enDesc:
8576     Source code fragment that referres this resource.
8577     @@@@XParam:
8578     @@@@@QName:expectedType
8579     @@@@@enDesc:
8580     Expected resource type.
8581 wakaba 1.8 @@@@enMufDef:
8582 wakaba 1.54 %p (name => {<Q::DIS:moduleURI>}, prefix => {Module <},
8583     suffix => {>: })
8584     ;%p (name => {<Q::DIS:sourceNodePath>}, suffix => {: })
8585     ;%p (name => {<Q::DIS:sourceCode>}, prefix => {"}, suffix => {": })
8586     ;%p (name => {<Q::DIS:parentURI>}, prefix => {(In <}, suffix => {>) })
8587     ;Resource%p (name => {<Q::DIS:uri>}, prefix => { <},
8588 wakaba 1.13 suffix => {>});%p (name => {<Q::DIS:localName>},
8589     prefix => { "}, suffix => {"}); is not defined or wrong type%p
8590     (name => {<Q::DIS:expectedType>}, prefix => { (<},
8591     suffix => {> is expected)});
8592     @@@XSubTypeDef:
8593     @@@@QName: NO_SOURCE_NODE_ERR
8594     @@@@enDesc:
8595     A resource does not have associated node in the source tree.
8596     @@@@XSourceNodeParam:
8597     @@@@XParam:
8598     @@@@@QName:uri
8599     @@@@@enDesc:
8600     The URI reference of the resource.
8601 wakaba 1.8 @@@XSubTypeDef:
8602     @@@@QName: RESERVED_PERL_METHOD_NAME_ERR
8603     @@@@enDesc:
8604     A reserved Perl method name is used.
8605     @@@@XParam:
8606     @@@@@QName:uri
8607     @@@@@enDesc:
8608     The URI reference of the method resource.
8609     @@@@XSourceNodeParam:
8610     @@@@XParam:
8611     @@@@@QName: generatedName
8612     @@@@@enDesc:
8613     A reserved method name.
8614     @@@XSubTypeDef:
8615     @@@@QName: NO_DIS_TYPE_ERR
8616     @@@@enDesc:
8617     <Q::dis:Type> attribute is not found.
8618     @@@@XSourceNodeParam:
8619 wakaba 1.48 @@@@enMufDef:
8620     Resource "%t (name => {<Q::DIS:uri>});" has no "dis:Type" attribute
8621 wakaba 1.12 @@@XSubTypeDef:
8622     @@@@QName: NO_METHOD_RETURN_ERR
8623     @@@@enDesc:
8624     A <Q::DISLang:Method> resource does not have any
8625     <Q::DISLang:MethodReturn> child.
8626     @@@@XSourceNodeParam:
8627 wakaba 1.22 @@@@XParam:
8628     @@@@@QName:errResource
8629     @@@@@enDesc: The method resource.
8630     @@@@XParam:
8631     @@@@@QName:uri
8632     @@@@@enDesc:
8633     The URI reference of the method.
8634     @@@@XParam:
8635     @@@@@QName:localName
8636     @@@@@enDesc:
8637     The local name of the resource.
8638     @@@@enMufDef:
8639     Method "%p (name => {<Q::DIS:localName>});" does not have
8640     "Return" child
8641 wakaba 1.12 @@@XSubTypeDef:
8642     @@@@QName: NO_ATTR_GET_ERR
8643     @@@@enDesc:
8644     A <Q::DISLang:Attribute> resource does not have any
8645     <Q::DISLang:AttributeGet> child.
8646     @@@@XSourceNodeParam:
8647 wakaba 1.13 @@@XSubTypeDef:
8648     @@@@QName:INTERFACE_CLASS_METHOD_ERR
8649     @@@@enDesc:
8650     An attempt is made to call a static (class) method
8651     from an interface.
8652     @@@@XSourceNodeParam:
8653     @@@@XParam:
8654     @@@@@QName:uri
8655     @@@@@enDesc:
8656     The URI reference of the interface.
8657     @@@@XParam:
8658     @@@@@QName:sourceCode
8659     @@@@@enDesc:
8660     Source code fragment that calls a class method.
8661     @@@@XParam:
8662     @@@@@QName:elementType
8663     @@@@@enDesc:
8664     The element type URI reference of the element
8665     that calls a method.
8666     @@@XSubTypeDef:
8667     @@@@QName: BROKEN_PARAM_SPEC_ERR
8668     @@@@enDesc:
8669     A parameter specification is broken.
8670     @@@@XParam:
8671     @@@@@QName: sourceCode
8672     @@@@@enDesc:
8673     Source code fragment that contains the broken parameter
8674     specification.
8675     @@@@XSourceNodeParam:
8676 wakaba 1.15 @@@@enMufDef:
8677     %p (name => {<Q::DIS:sourceCode>}, prefix => {"},
8678     suffix => {": });Broken parameter specification
8679 wakaba 1.13 @@@XSubTypeDef:
8680     @@@@QName:PERL_PREPROCESS_NO_ELEMENT_TYPE_ERR
8681     @@@@enDesc:
8682     A preprocessing instruction does not have its element
8683     type.
8684     @@@@XSourceNodeParam:
8685     @@@@XParam:
8686     @@@@@QName:sourceCode
8687     @@@@@enDesc:
8688     Source code fragment.
8689 wakaba 1.16 @@@@enMufDef:
8690     %p (name => {<Q::DIS:sourceCode>}, prefix => {"},
8691     suffix => {": });Element type name is not specified
8692 wakaba 1.13 @@@XSubTypeDef:
8693 wakaba 1.15 @@@@QName: NO_PERL_PACKAGE_NAME_ERR
8694 wakaba 1.13 @@@@enDesc:
8695 wakaba 1.15 No Perl package name is defined for the resource referred.
8696 wakaba 1.13 @@@@XSourceNodeParam:
8697     @@@@XParam:
8698 wakaba 1.15 @@@@@QName:sourceCode
8699 wakaba 1.13 @@@@@enDesc:
8700     Source code fragment.
8701     @@@@XParam:
8702 wakaba 1.15 @@@@@QName:uri
8703     @@@@@enDesc:
8704     THe URI reference of the resource referred.
8705     @@@@XParam:
8706     @@@@@QName:elementType
8707     @@@@@enDesc:
8708     The element type of Perl preprocessing instruction
8709     in which the resource is referred.
8710     @@@@enMufDef:
8711     %p (name => {<Q::DIS:uri>}, prefix => {<}, suffix => {>: });Perl
8712     package name is not defined
8713     @@@XSubTypeDef:
8714     @@@@QName: PERL_PREPROCESS_NO_EXCEPTION_TYPE_ERR
8715     @@@@enDesc:
8716     An exception type specification is required.
8717     @@@@XSourceNodeParam:
8718     @@@@XSourceCodeParam:
8719     @@@@XParam:
8720     @@@@@QName:elementType
8721     @@@@@enDesc:
8722     The element type of the preprocessing instruction.
8723     @@@XSubTypeDef:
8724     @@@@QName: PERL_PREPROCESS_NO_CODE_NAME_ERR
8725     @@@@enDesc:
8726     A code name specification is required.
8727     @@@@XSourceNodeParam:
8728     @@@@XSourceCodeParam:
8729     @@@@XParam:
8730 wakaba 1.13 @@@@@QName:elementType
8731     @@@@@enDesc:
8732 wakaba 1.15 The element type of the preprocessing instruction.
8733 wakaba 1.13 @@@XSubTypeDef:
8734     @@@@QName: PERL_CODE_NOT_DEFINED_ERR
8735     @@@@enDesc:
8736 wakaba 1.15 The specified resource does not have its Perl definition.
8737 wakaba 1.13 @@@@XSourceNodeParam:
8738 wakaba 1.15 @@@@XSourceCodeParam:
8739 wakaba 1.13 @@@@XParam:
8740 wakaba 1.15 @@@@@QName:elementType
8741     @@@@@enDesc:
8742     The element type of the preprocessing instruction.
8743     @@@@XParam:
8744     @@@@@QName:uri
8745 wakaba 1.13 @@@@@enDesc:
8746 wakaba 1.15 The URI reference of the resource referred.
8747 wakaba 1.13 @@@@XParam:
8748     @@@@@QName:localName
8749     @@@@@enDesc:
8750     The local name of the resource referred.
8751 wakaba 1.51 @@@@enMufDef:
8752     Resource%p (name => {<Q::DIS:uri>}, prefix => { "}, suffix => {"});
8753     has no Perl code definition
8754 wakaba 1.15 @@@XSubTypeDef:
8755     @@@@QName: PERL_PREPROCESS_NO_METHOD_ERR
8756     @@@@enDesc:
8757     A preprocessing instruction which is only allowed in
8758     method definitions is used in a code which is not a method.
8759     @@@@XSourceNodeParam:
8760     @@@@XSourceCodeParam:
8761 wakaba 1.13 @@@@XParam:
8762 wakaba 1.15 @@@@@QName:elementType
8763 wakaba 1.13 @@@@@enDesc:
8764 wakaba 1.15 The element type of the preprocessing instruction.
8765 wakaba 1.14 @@@XSubTypeDef:
8766 wakaba 1.15 @@@@QName: PERL_PREPROCESS_NO_FOR_ERR
8767 wakaba 1.14 @@@@enDesc:
8768 wakaba 1.15 A <QUOTE::for> specification is required.
8769 wakaba 1.14 @@@@XSourceNodeParam:
8770 wakaba 1.15 @@@@XSourceCodeParam:
8771 wakaba 1.14 @@@@XParam:
8772 wakaba 1.15 @@@@@QName:elementType
8773 wakaba 1.14 @@@@@enDesc:
8774 wakaba 1.15 The element type of the preprocessing instruction.
8775     @@@XSubTypeDef:
8776     @@@@QName: PERL_PREPROCESS_NO_ASSERT_TYPE_ERR
8777     @@@@enDesc:
8778     An assertion type specification is required.
8779     @@@@XSourceNodeParam:
8780     @@@@XSourceCodeParam:
8781 wakaba 1.14 @@@@XParam:
8782 wakaba 1.15 @@@@@QName:elementType
8783 wakaba 1.14 @@@@@enDesc:
8784 wakaba 1.15 The element type of the preprocessing instruction.
8785     @@@XSubTypeDef:
8786     @@@@QName: PERL_PREPROCESS_BLOCK_NOT_ALLOWED_ERR
8787     @@@@enDesc:
8788     A preprocessing instruction block occurred with
8789     element type which does not allow it.
8790     @@@@XSourceNodeParam:
8791     @@@@XSourceCodeParam:
8792 wakaba 1.14 @@@@XParam:
8793     @@@@@QName:elementType
8794     @@@@@enDesc:
8795 wakaba 1.15 The element type of the preprocessing instruction.
8796 wakaba 1.18 @@@XSubTypeDef:
8797     @@@@QName: NON_NAMED_PARAMETER_AFTER_NAMED_ERR
8798     @@@@enDesc:
8799     A non-named method parameter following
8800     any named method parameter is occurred.
8801     @@@@XSourceNodeParam:
8802     @@@@XParam:
8803     @@@@@QName:uri
8804     @@@@@enDesc:
8805     The URI reference of the non-named method parameter resource.
8806     @@@@XParam:
8807     @@@@@QName:localName
8808     @@@@@enDesc:
8809     The local name of the non-named method parameter.
8810 wakaba 1.19 @@@XSubTypeDef:
8811     @@@@QName:DISPERL_NO_VALUE_ALLOWED_ERR
8812     @@@@enDesc:
8813     An element node have a value but the definition
8814     of that element type does not allow it.
8815     @@@@XSourceNodeParam:
8816     @@@@XParam:
8817     @@@@@QName:elementType
8818     @@@@@enDesc:
8819     The element type URI reference of the element.
8820     @@@XSubTypeDef:
8821     @@@@QName:NO_CONST_VALUE_ERR
8822     @@@@enDesc:
8823     The source element node for a constant value resource
8824     does not have <Q::dis:Value> attribute.
8825     @@@@XSourceNodeParam:
8826     @@@@XParam:
8827     @@@@@QName:elemntType
8828     @@@@@enDesc:
8829     The element type URI reference of the element from which
8830     a constant value resource is referred.
8831     @@@@XParam:
8832     @@@@@QName:uri
8833     @@@@@enDesc:
8834     The resource URI reference of the constant value resource.
8835     @@@@XParam:
8836     @@@@@QName:localName
8837     @@@@@enDesc:
8838     The local name of the constant value resource.
8839     @@@XSubTypeDef:
8840     @@@@QName:NO_ATTR_SET_ERR
8841     @@@@enDesc:
8842     An attribute setter is referred but the attribute
8843     does not define any setter.
8844     @@@@XSourceNodeParam:
8845     @@@@XParam:
8846     @@@@@QName:errResource
8847     @@@@@enDesc:
8848     The attribute resource.
8849     @@@@XParam:
8850     @@@@@QName:elementType
8851     @@@@@enDesc:
8852     The type of the element by which this attribute
8853     is referred.
8854 wakaba 1.20 @@@XSubTypeDef:
8855     @@@@QName: PERL_SUBROUTINE_ALREADY_DEFINED_ERR
8856     @@@@enDesc:
8857     A resource defines a Perl subroutine whose name is
8858     same as another subroutine.
8859     @@@@XSourceNodeParam:
8860     @@@@XParam:
8861     @@@@@QName:uri
8862     @@@@@enDesc:
8863     The URI reference of the resource that defines the Perl subroutine.
8864     @@@@XParam:
8865     @@@@@QName:
8866     PerlCode:localName
8867     @@@@@enDesc:
8868     The name of the Perl subroutine.
8869     @@@XSubTypeDef:
8870     @@@@QName: PERL_OPERATOR_ALREADY_OVERLOADED_ERR
8871     @@@@enDesc:
8872     A resource is defined to overload a Perl operator which
8873     is already overloaded by another resource.
8874     @@@@XSourceNodeParam:
8875     @@@@XParam:
8876     @@@@@QName:uri
8877     @@@@@enDesc:
8878     The URI reference of the resource that defines the overloading.
8879     @@@@XParam:
8880     @@@@@QName:
8881     PerlCode:operator
8882     @@@@@enDesc:
8883     The operator.
8884     @@@XSubTypeDef:
8885     @@@@QName: PERL_UNUSED_SUBROUTINE_ERR
8886     @@@@enDesc:
8887     A resource defines a Perl subroutine but it is not used.
8888     @@@@XSourceNodeParam:
8889     @@@@XParam:
8890     @@@@@QName:uri
8891     @@@@@enDesc:
8892     The URI reference of the resource.
8893 wakaba 1.22 @@@XSubTypeDef:
8894     @@@@QName: NO_LICENSE_ATTR_ERR
8895     @@@@enDesc:
8896     The <Q::dis:Module> element does not have the
8897     <Q::dis:License> attribute.
8898     @@@@XSourceNodeParam:
8899     @@@@XParam:
8900     @@@@@QName:uri
8901     @@@@@enDesc:
8902     The URI reference of the module.
8903 wakaba 1.25 @@@XSubTypeDef:
8904     @@@@QName: UNSUPPORTED_ROLE_ERR
8905     @@@@enDesc:
8906     A <Q::dis:Role> is not supported.
8907     @@@@XSourceNodeParam:
8908     @@@@XParam:
8909     @@@@@QName:uri
8910     @@@@@enDesc:
8911     The URI reference of the unsupported role.
8912     @@@@enMufDef:
8913     Role <%p (name => {<Q::DIS:uri>});> is not supported
8914 wakaba 1.37 @@@XSubTypeDef:
8915     @@@@QName: NO_REFLECT_GET_DEFINED_ERR
8916     @@@@enDesc:
8917     An attribute is defined to reflect an element attribute
8918     but no reflecting attribute getter template is defined.
8919     @@@@XSourceNodeParam:
8920     @@@@XParam:
8921     @@@@@QName:uri
8922     @@@@@enDesc:
8923     The URI reference of the datatype resource for which
8924     a getter template should have been defined.
8925     @@@XSubTypeDef:
8926     @@@@QName: NO_REFLECT_SET_DEFINED_ERR
8927     @@@@enDesc:
8928     An attribute is defined to reflect an element attribute
8929     but no reflecting attribute setter template is defined.
8930     @@@@XSourceNodeParam:
8931     @@@@XParam:
8932     @@@@@QName:uri
8933     @@@@@enDesc:
8934     The URI reference of the datatype resource for which
8935     a setter template should have been defined.
8936 wakaba 1.40 @@@XSubTypeDef:
8937 wakaba 1.43 @@@@QName: NO_END_TAG_ERR
8938     @@@@enDesc:
8939 wakaba 1.40 Close tag not found.
8940 wakaba 1.43 @@@@XSourceNodeParam:
8941     @@@@XParam:
8942 wakaba 1.49 @@@@@@: elementType
8943     @@@@@enDesc:
8944 wakaba 1.40 The type URI reference of the element that is not closed.
8945 wakaba 1.43 @@@@XParam:
8946 wakaba 1.49 @@@@@@: sourceCode
8947     @@@@@enDesc:
8948 wakaba 1.40 The source code fragment near the position where
8949     an end tag is required.
8950 wakaba 1.43 @@@@enMufDef:
8951 wakaba 1.40 End tag for element "%p (name => {<Q::DIS:elementType>});"
8952 wakaba 1.43 is required%p (name => {<Q::DIS:sourceCode>},
8953     prefix => { (}, suffix => {)});
8954 wakaba 1.49 @@@XSubTypeDef:
8955     @@@@QName: NO_RDF_TYPE_ERR
8956     @@@@enDesc:
8957     There is a resource definition element that does
8958     not have any <Q::rdf:type> attribute.
8959     @@@@XSourceNodeParam:
8960     @@@@XParam:
8961     @@@@@@: uri
8962     @@@@@enDesc:
8963     The URI of the resource which does not have <Q::rdf:type>.
8964     @@@@enMufDef:
8965     Resource%p (name => {<Q::DIS:uri>}, prefix => { "},
8966     suffix => {"}); does not have "rdf:type" attribute
8967 wakaba 1.53 @@@XSubTypeDef:
8968     @@@@QName: PERL_HASH_KEY_ALREADY_DEFINED_ERR
8969     @@@@enDesc:
8970     A hash key is already defined.
8971     @@@@XSourceNodeParam:
8972     @@@@XParam:
8973     @@@@@@:uri
8974     @@@@@enDesc:
8975     The URI of the resource tried to register.
8976     @@@@XParam:
8977     @@@@@@:anotherURI
8978     @@@@@enDesc:
8979     The URI of the already registered resource.
8980     @@@@XParam:
8981     @@@@@@:hashKeyName
8982     @@@@@enDesc:
8983     Hash key.
8984     @@@@XParam:
8985     @@@@@@:hashKeyScope
8986     @@@@@enDesc:
8987     Hash key scope.
8988     @@@@enMufDef:
8989     <%p (name => {<Q::DIS:uri>});>:
8990 wakaba 1.56 Hash key "%p (name => {<Q::DIS:hashKeyName>});" in
8991 wakaba 1.53 <%p (mame => {<Q::DIS:hashKeyScope>});> is already
8992 wakaba 1.54 defined for <%p (name => {<Q::DIS:anotherURI>});>
8993 wakaba 1.63 @@@XSubTypeDef:
8994     @@@@QName: DIS|NO_EXCEPTION_CLASS_ERR
8995     @@@@enDesc:
8996     The exception interface has no class that implements the interface.
8997     @@@@enMufDef:
8998     Exception interface <%p (name => {<Q::DIS:uri>});>:
8999     There is no class that implements this interface
9000     @@@@XParam:
9001     @@@@@@: DIS|uri
9002     @@@@@enDesc:
9003     The URI of the interface.
9004 wakaba 1.37 @ImplNote:
9005     @@lang:en
9006     @@@:
9007     ISSUE: Too many subtypes for a type! New type should be added?
9008 wakaba 1.71
9009     @Attr:
9010     @@Name: text
9011     @@enDesc:
9012     The description of the error, in <LANG::i-default> language.
9013     @@enImplNote:
9014     See <A::dx|Exception.text> for super definition.
9015     @@Type: DISLang|String
9016     @@Get:
9017     @@@PerlDef:
9018     $r = $self->SUPER::text;
9019 wakaba 1.73 if (defined $self->{<H::DIS:uri>}) {
9020     $r = '<' . $self->{<H::DIS:uri>} . '>: ' . $r;
9021     }
9022 wakaba 1.71 if (defined $self->{<H::DIS:sourceNode>}) {
9023     $r = 'Node ' . $self->{<H::DIS:sourceNode>}-><M::SWCFGNode.nodePath>
9024     . ': ' . $r;
9025     }
9026 wakaba 1.4 ##DISException
9027 wakaba 1.71
9028     ElementTypeBinding:
9029     @Name: enImplNote
9030     @ElementType:
9031     dis:ImplNote
9032     @ShadowContent:
9033     @@lang:en
9034 wakaba 1.53
9035     XParamDef:
9036     @QName: hashKeyName
9037     @Type: DISLang|String
9038     @enDesc:
9039     See <M::dp|DISDatabasePerl.plAddHashKey>.
9040    
9041     XParamDef:
9042     @QName: hashKeyScope
9043     @Type: AnyURI
9044     @enDesc:
9045     See <M::dp|DISDatabasePerl.plAddHashKey>.
9046    
9047     XParamDef:
9048     @QName: anotherURI
9049     @Type: ResourceURI
9050     @enDesc:
9051     A URI of another related resource.
9052 wakaba 1.13
9053     XParamDef:
9054     @QName:expectedType
9055     @Type: ResourceURI
9056     @enDesc:
9057     Expected resource type URI reference.
9058    
9059     XParamDef:
9060     @QName: sourceCode
9061     @Type:
9062     DISLang:String::ManakaiDOM:all
9063     @enDesc:
9064     The source code fragment in which an error occurred.
9065 wakaba 1.5
9066     XParamDef:
9067     @QName: elementType
9068     @Type: ResourceURI
9069     @enDesc:
9070     The name of the element type.
9071    
9072     XParamDef:
9073     @QName: uri
9074     @Type: ResourceURI
9075     @enDesc:
9076     The name of the resource, composed from <Q::namespaceURI>,
9077     <Q::localName> and <Q::for>.
9078    
9079     XParamDef:
9080     @QName: localName
9081     @Type:
9082 wakaba 1.18 DISCore:LocalName::ManakaiDOM:all
9083 wakaba 1.5 @enDesc:
9084     The local name of the resource, unique in <Q::namespaceURI> namespace.
9085    
9086     XParamDef:
9087     @QName: namespaceURI
9088     @Type: AnyURI
9089     @enDesc:
9090     The namespace URI reference of the resource name.
9091    
9092     XParamDef:
9093     @QName: for
9094     @Type: ForURI
9095     @enDesc:
9096     The <QUOTE::for> URI reference of the resource.
9097    
9098     ElementTypeBinding:
9099     @Name: XSourceNodeParam
9100     @ElementType:
9101 wakaba 1.64 ecore:hasParameter
9102 wakaba 1.5 @ShadowContent:
9103     @@QName: sourceNode
9104     @@Description:
9105     @@@lang:en
9106     @@@@:
9107     The node in which an error has occurred.
9108 wakaba 1.15
9109     ElementTypeBinding:
9110     @Name: XSourceCodeParam
9111     @ElementType:
9112 wakaba 1.64 ecore:hasParameter
9113 wakaba 1.15 @ShadowContent:
9114     @@QName: sourceCode
9115     @@Description:
9116     @@@lang:en
9117     @@@@:
9118     The source code in which an error has occurred.
9119 wakaba 1.4
9120 wakaba 1.52 ElementTypeBinding:
9121     @Name: plMName
9122     @ElementType:
9123     DISPerl:methodName
9124     @ShadowContent:
9125     @@ContentType: lang|Perl
9126     @@For: ManakaiDOM|Perl
9127 wakaba 1.4
9128     ElementTypeBinding:
9129 wakaba 1.52 @Name: plCName
9130 wakaba 1.4 @ElementType:
9131 wakaba 1.52 DISPerl:exportTagName
9132 wakaba 1.4 @ShadowContent:
9133 wakaba 1.47 @@ContentType: lang|Perl
9134     @@For: ManakaiDOM|Perl
9135 wakaba 1.3
9136     ElementTypeBinding:
9137     @Name: Method
9138     @ElementType:
9139     dis:ResourceDef
9140     @ShadowContent:
9141     @@rdf:type:
9142     DISLang:Method
9143 wakaba 1.52 @@For: !=ForEmpty
9144 wakaba 1.3
9145     ElementTypeBinding:
9146 wakaba 1.79 @Name: CMethod
9147     @ElementType:
9148     dis:ResourceDef
9149     @ShadowContent:
9150     @@rdf:type:
9151     DISLang:Method
9152     @@ForCheck: !=ForEmpty ManakaiDOM|ForClass
9153    
9154     ElementTypeBinding:
9155 wakaba 1.3 @Name: IntMethod
9156     @ElementType:
9157     dis:ResourceDef
9158     @ShadowContent:
9159     @@rdf:type:
9160     DISLang:Method
9161     @@ManakaiDOM:isForInternal:1
9162 wakaba 1.52 @@ForCheck: ManakaiDOM|ForClass
9163 wakaba 1.3
9164     ElementTypeBinding:
9165     @Name: Attr
9166     @ElementType:
9167     dis:ResourceDef
9168     @ShadowContent:
9169     @@rdf:type:
9170     DISLang:Attribute
9171 wakaba 1.52 @@For: !=ForEmpty
9172 wakaba 1.79
9173     ElementTypeBinding:
9174     @Name: CAttr
9175     @ElementType:
9176     dis:ResourceDef
9177     @ShadowContent:
9178     @@rdf:type:
9179     DISLang:Attribute
9180     @@ForCheck: !=ForEmpty ManakaiDOM|ForClass
9181 wakaba 1.3
9182     ElementTypeBinding:
9183     @Name: Return
9184     @ElementType:
9185     dis:ResourceDef
9186     @ShadowContent:
9187     @@rdf:type:
9188     DISLang:MethodReturn
9189    
9190     ElementTypeBinding:
9191     @Name: Get
9192     @ElementType:
9193     dis:ResourceDef
9194     @ShadowContent:
9195     @@rdf:type:
9196     DISLang:AttributeGet
9197    
9198     ElementTypeBinding:
9199     @Name: Set
9200     @ElementType:
9201     dis:ResourceDef
9202     @ShadowContent:
9203     @@rdf:type:
9204     DISLang:AttributeSet
9205    
9206     ElementTypeBinding:
9207     @Name: Param
9208     @ElementType:
9209     dis:ResourceDef
9210     @ShadowContent:
9211     @@rdf:type:
9212     DISLang:MethodParameter
9213    
9214     ElementTypeBinding:
9215     @Name: PerlDef
9216     @ElementType:
9217     dis:Def
9218     @ShadowContent:
9219     @@ContentType:
9220     lang:Perl
9221    
9222     ElementTypeBinding:
9223     @Name: InCase
9224     @ElementType:
9225     dis:ResourceDef
9226     @ShadowContent:
9227     @@rdf:type:
9228     ManakaiDOM:InCase
9229    
9230     ElementTypeBinding:
9231     @Name: nullCase
9232     @ElementType:
9233     dis:ResourceDef
9234     @ShadowContent:
9235     @@rdf:type:
9236     ManakaiDOM:InCase
9237     @@Value:
9238     @@@is-null:1
9239 wakaba 1.49 @@@ContentType: DISCore|String
9240 wakaba 1.3
9241     ElementTypeBinding:
9242     @Name: TrueCase
9243     @ElementType:
9244     dis:ResourceDef
9245     @ShadowContent:
9246     @@rdf:type:
9247     ManakaiDOM:InCase
9248 wakaba 1.49 @@Value:
9249     @@@@: 1
9250     @@@ContentType: DISCore|Boolean
9251 wakaba 1.3 @@Type:
9252 wakaba 1.18 DOMMain:boolean::ManakaiDOM:all
9253 wakaba 1.3
9254     ElementTypeBinding:
9255     @Name: FalseCase
9256     @ElementType:
9257     dis:ResourceDef
9258     @ShadowContent:
9259     @@rdf:type:
9260     ManakaiDOM:InCase
9261 wakaba 1.49 @@Value:
9262     @@@@: 0
9263     @@@ContentType: DISCore|Boolean
9264 wakaba 1.3 @@Type:
9265 wakaba 1.18 DOMMain:boolean::ManakaiDOM:all
9266 wakaba 1.3
9267     ElementTypeBinding:
9268     @Name: enDesc
9269     @ElementType:
9270     dis:Description
9271     @ShadowContent:
9272     @@lang:en
9273    
9274     ElementTypeBinding:
9275     @Name: PropDef
9276     @ElementType:
9277     dis:ResourceDef
9278     @ShadowContent:
9279 wakaba 1.81 @@DISCore:resourceType: DISCore|Property
9280     @@For: =ManakaiDOM|all
9281    
9282     ElementTypeBinding:
9283     @Name: RPropDef
9284     @ElementType:
9285     dis:ResourceDef
9286     @ShadowContent:
9287     @@DISCore:resourceType: DISSource|ResourceProperty
9288     @@For: =ManakaiDOM|all
9289 wakaba 1.3
9290     ElementTypeBinding:
9291     @Name: MethodRedef
9292     @ElementType:
9293     dis:ResourceDef
9294     @ShadowContent:
9295     @@rdf:type:
9296     DISLang:Method
9297    
9298     ElementTypeBinding:
9299     @Name: NamedParam
9300     @ElementType:
9301     dis:ResourceDef
9302     @ShadowContent:
9303     @@rdf:type:
9304     DISLang:MethodParameter
9305     @@DISPerl:isNamedParameter:1
9306    
9307     ElementTypeBinding:
9308     @Name: NodeParam
9309     @ElementType:
9310     dis:ResourceDef
9311     @ShadowContent:
9312     @@rdf:type:
9313     DISLang:MethodParameter
9314     @@DISPerl:isNamedParameter:1
9315     @@Name: node
9316 wakaba 1.47 @@Type: DISNode
9317     @@actualType:
9318     @@@@: ManakaiDISNode
9319     @@@ForCheck: ManakaiDOM|ForClass
9320 wakaba 1.3 @@Description:
9321     @@@lang:en
9322     @@@@:
9323     The node in which the name has occurred. It is intended
9324     to be reported when an exception had been raised.
9325     @@ResourceDef:
9326     @@@rdf:type:
9327     ManakaiDOM:InCase
9328     @@@Value:
9329     @@@@is-null:1
9330 wakaba 1.49 @@@@ContentType: DISCore|String
9331 wakaba 1.3 @@@Description:
9332     @@@@lang:en
9333     @@@@@:
9334     The source of the name is not a node.
9335    
9336     ElementTypeBinding:
9337     @Name: ForParam
9338     @ElementType:
9339     dis:ResourceDef
9340     @ShadowContent:
9341     @@rdf:type:
9342     DISLang:MethodParameter
9343     @@DISPerl:isNamedParameter:1
9344     @@Name: forArg
9345     @@Type: ForURI
9346     @@Description:
9347     @@@lang:en
9348     @@@@:
9349     The <QUOTE::for> URI reference.
9350     @@ResourceDef:
9351     @@@rdf:type:
9352     ManakaiDOM:InCase
9353     @@@Value:
9354     @@@@is-null:1
9355 wakaba 1.49 @@@@ContentType: DISCore|String
9356 wakaba 1.3 @@@Description:
9357     @@@@lang:en
9358     @@@@@:
9359     Equivalent to <Q::ManakaiDOM:all>, i.e. <QUOTE::for all>.
9360    
9361     ElementTypeBinding:
9362     @Name: ForpParam
9363     @ElementType:
9364     dis:ResourceDef
9365     @ShadowContent:
9366     @@rdf:type:
9367     DISLang:MethodParameter
9368     @@DISPerl:isNamedParameter:1
9369     @@Name: forpArg
9370     @@Type: ForURIList
9371     @@Description:
9372     @@@lang:en
9373     @@@@:
9374     An array reference containing additional <QUOTE::for>
9375     constraints (<QUOTE::For+> list).
9376     @@ResourceDef:
9377     @@@rdf:type:
9378     ManakaiDOM:InCase
9379     @@@Value:
9380     @@@@is-null:1
9381 wakaba 1.49 @@@@ContentType: DISCore|String
9382 wakaba 1.3 @@@Description:
9383     @@@@lang:en
9384     @@@@@:
9385     Equivalent to the empty array reference.
9386    
9387     ElementTypeBinding:
9388     @Name: MediaTypeParam
9389     @ElementType:
9390     dis:ResourceDef
9391     @ShadowContent:
9392     @@rdf:type:
9393     DISLang:MethodParameter
9394     @@DISPerl:isNamedParameter:1
9395     @@Name: mediaType
9396     @@Type: MediaTypeURI
9397     @@Description:
9398     @@@lang:en
9399     @@@@:
9400     The URI reference identifying a media type.
9401     @@ResourceDef:
9402     @@@rdf:type:
9403     ManakaiDOM:InCase
9404     @@@Value:
9405     @@@@is-null:1
9406 wakaba 1.49 @@@@ContentType: DISCore|String
9407 wakaba 1.3 @@@Description:
9408     @@@@lang:en
9409     @@@@@:
9410     No media type specified.
9411    
9412     ElementTypeBinding:
9413     @Name: MediaTypeDefaultParam
9414     @ElementType:
9415     dis:ResourceDef
9416     @ShadowContent:
9417     @@rdf:type:
9418     DISLang:MethodParameter
9419     @@DISPerl:isNamedParameter:1
9420     @@Name: defaultMediaType
9421     @@Type: MediaTypeURI
9422     @@Description:
9423     @@@lang:en
9424     @@@@:
9425     The default media type, i.e. the type used when no explicit
9426     specification is not found in the source tree.
9427     @@ResourceDef:
9428     @@@rdf:type:
9429     ManakaiDOM:InCase
9430     @@@Value:
9431     @@@@is-null:1
9432 wakaba 1.49 @@@@ContentType: DISCore|String
9433 wakaba 1.3 @@@Description:
9434     @@@@lang:en
9435     @@@@@:
9436     Defaulted to <Q::DOMMain:any>.
9437    
9438     ElementTypeBinding:
9439     @Name: RaiseException
9440     @ElementType:
9441     ManakaiDOM:raises
9442    
9443     ElementTypeBinding:
9444     @Name: UndeclaredPrefixException
9445     @ElementType:
9446     ManakaiDOM:raises
9447     @ShadowContent:
9448     @@@: UNDECLARED_NS_PREFIX_ERR
9449     @@Description:
9450     @@@lang:en
9451     @@@@:
9452     The implementation has encounted an undeclared namespace prefix.
9453    
9454     ElementTypeBinding:
9455     @Name: NoDBException
9456     @ElementType:
9457     ManakaiDOM:raises
9458     @ShadowContent:
9459 wakaba 1.47 @@@: NO_ASSOCIATED_DB_ERR
9460 wakaba 1.3 @@Description:
9461     @@@lang:en
9462     @@@@:
9463     No <QUOTE::dis> database is associated to this document.
9464    
9465     ElementTypeBinding:
9466     @Name: XConstDef
9467     @ElementType:
9468     dis:ResourceDef
9469     @ShadowContent:
9470 wakaba 1.63 @@rdf:type: dx|ErrorCode
9471 wakaba 1.3
9472     ElementTypeBinding:
9473     @Name: XSubTypeDef
9474     @ElementType:
9475     dis:ResourceDef
9476     @ShadowContent:
9477 wakaba 1.63 @@rdf:type: dx|ErrorSubCode
9478 wakaba 1.3
9479     ElementTypeBinding:
9480     @Name: XParam
9481     @ElementType:
9482 wakaba 1.63 ecore:hasParameter
9483 wakaba 1.3
9484     ElementTypeBinding:
9485     @Name: XParamDef
9486     @ElementType:
9487     dis:ResourceDef
9488     @ShadowContent:
9489 wakaba 1.63 @@rdf:type: ecore|Parameter
9490     @@For: =ManakaiDOM|all
9491 wakaba 1.54
9492     XParamDef:
9493     @QName: DIS|moduleURI
9494     @enDesc:
9495     A URI of the module in which the resource is defined.
9496 wakaba 1.3
9497     ElementTypeBinding:
9498     @Name: enMufDef
9499     @ElementType:
9500 wakaba 1.68 ecore:defaultMessage
9501 wakaba 1.3 @ShadowContent:
9502     @@ContentType:
9503     lang:muf
9504     @@lang:en

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24