/[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.88 - (hide annotations) (download)
Sat Feb 25 16:49:56 2006 UTC (19 years, 4 months ago) by wakaba
Branch: MAIN
Changes since 1.87: +265 -6 lines
++ manakai/bin/ChangeLog	25 Feb 2006 16:31:38 -0000
2006-02-26  Wakaba  <wakaba@suika.fam.cx>

	* dac2pm.pl (--dafx-file-suffix): New dummy option.

	* daf.pl: New script.

++ manakai/lib/Message/Util/ChangeLog	25 Feb 2006 16:40:55 -0000
2006-02-26  Wakaba  <wakaba@suika.fam.cx>

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

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

	* DIS.dis (lookupNamespacePrefix): Resolves prefix by
	namespace resolver if available.
	(disNamespaceResolver): New attribute.
	(loadModule): Sets |revision| attribute of the created module.
	(ownerModuleRef): Setter is added.
	(addTypeURI): Set |ownerModule| attribute if possible.
	(ManakaiDISModuleLite): The class no longer inherits |DISAnyResource|
	class and |ManakaiDefaultExceptionHandler| class.
	(mergeAsAlias): New |noEqualityCheck| parameter is added.

	* Makefile: New variables for |DAF| are added.

++ manakai/lib/Message/Util/DIS/ChangeLog	25 Feb 2006 16:45:17 -0000
2006-02-26  Wakaba  <wakaba@suika.fam.cx>

	* Perl.dis (plLoadDISDatabaseModule): Do nothing if the
	module is already loaded.
	(plUpdateModule): Parameter |moduleURI| is changed
	to |modules| so that multiple modules can be updated once.
	Don't try to read index file if it is not exist.

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

	* DNLite.dis (convertDISDocumentToDNLDocument): New
	|baseNamespaceBinding| parameter is added.

	* Perl.dis (plLoadDISDatabase): Removes |c:error-handler|
	property (it is |null| if specified).
	(plStore): New |noMainDatabase| parameter is added.  Don't
	write resources that are not |isDefined|.  Copies |DIS:revision|
	property of modules to database index file.
	(plLoadDISDatabaseModule): Notify before and after
	a file is read.  Don't throw |DIS:RESOURCE_ALREADY_DEFINED_ERR|
	if the resource already in the database is not |isDefined|.
	(plLoadDISDatabaseIndex): Notify before and after
        a file is read.
	(plDatabaseModuleResolver): New attribute accessor.

++ manakai/lib/Message/DOM/ChangeLog	25 Feb 2006 16:33:00 -0000
2006-02-25  Wakaba  <wakaba@suika.fam.cx>

	* DOMFeature.dis (Require): Missing reference to |DISlib:Test|
	module is added.

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.88 $Date: 2006/02/24 11:28:33 $
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     @@Return:
1939     @@@Type:
1940 wakaba 1.18 DOMMain:boolean::ManakaiDOM:all
1941 wakaba 1.7 @@@TrueCase:
1942     @@@@enDesc:
1943     Either the element type expanded URI reference of this element is
1944     same as <P::etype> or it is a sub-element type of <P::etype>.
1945     @@@FalseCase:
1946     @@@@enDesc:
1947     This element is not of <P::etype>.
1948     @@@NoDBException:
1949     @@@PerlDef:
1950     __DEEP{
1951 wakaba 1.14 my $et = $self-><AG::swcfg21:SWCFGElement::swcfg21:ForLatest
1952 wakaba 1.7 .expandedURI>;
1953     my $rdef = $self-><AG::ManakaiDISNode.ownerDISDocument>
1954     -><AG::ManakaiDISDocument.disDatabase>
1955     -><M::ManakaiDISDatabase.getResource> ($et);
1956     $r = $rdef-><M::ManakaiDISResourceDefinition.isSubsetOfURI> ($etype);
1957     }__;
1958    
1959     @Attr:
1960     @@Name: isResourceElement
1961     @@enDesc:
1962     Whether this element defines a resource or not.
1963     \
1964     {NOTE:: An element defines a resource if its element type is
1965     <Q::dis:ResourceDef> or its subtype.
1966     \
1967     }
1968     @@Get:
1969     @@@Type:
1970 wakaba 1.18 DOMMain:boolean::ManakaiDOM:all
1971 wakaba 1.7 @@@TrueCase:
1972     @@@@enDesc:
1973     This element defines a resource.
1974     @@@FalseCase:
1975     @@@@enDesc:
1976     This element does not define any resource.
1977     @@@NoDBException:
1978     @@@PerlDef:
1979     __DEEP{
1980 wakaba 1.49 $r = ($self-><AG::SWCFGElement.expandedURI> eq <Q::dis:ResourceDef>);
1981 wakaba 1.7 }__;
1982    
1983 wakaba 1.49 @Method:
1984 wakaba 1.7 @@Name: isPropertyElement
1985     @@enDesc:
1986     Whether this element is a property or not.
1987     \
1988 wakaba 1.81 {NOTE:: An element is a property if the resource whose
1989     URI is equal to the element type name is a property,
1990     i.e. whose type is <Q::DISSource|Property>.
1991 wakaba 1.7 }
1992 wakaba 1.49 @@NamedParam:
1993     @@@Name: databaseArg
1994     @@@Type: DIS|DISDatabase
1995     @@@nullCase:
1996     @@Return:
1997 wakaba 1.7 @@@Type:
1998 wakaba 1.18 DOMMain:boolean::ManakaiDOM:all
1999 wakaba 1.7 @@@TrueCase:
2000     @@@@enDesc:
2001     This element is a property.
2002     @@@FalseCase:
2003     @@@@enDesc:
2004     This element is not a property.
2005     @@@NoDBException:
2006     @@@PerlDef:
2007     __DEEP{
2008 wakaba 1.48 my $xn = $self-><AG::SWCFGElement.expandedURI>;
2009 wakaba 1.81 if ($xn eq <Q::DISCore|resourceType> or $xn eq <Q::rdf:type>) {
2010 wakaba 1.7 $r = true;
2011     } else {
2012 wakaba 1.49 my $rdef = ($databaseArg or
2013     $self-><AG::DISNode.ownerDISDocument>
2014     -><AG::DISDocument.disDatabase>)
2015     -><M::DISDatabase.getResource> ($xn);
2016 wakaba 1.81 $r = $rdef-><M::DISAnyResource.isTypeURI>
2017     (<Q::DISSource|Property>) ||
2018     $rdef-><M::DISAnyResource.isTypeURI> (<Q::rdf:Property>);
2019     ## TODO: Remove this.
2020 wakaba 1.18 }
2021     }__;
2022 wakaba 1.19
2023     @Method:
2024 wakaba 1.38 @@Name: getFeature
2025     @@Description:
2026     @@@lang:en
2027     @@@@:
2028     Returns a specialized object that implements the specialized
2029     interfaces of the specified feature and version.
2030     @@Param:
2031     @@@Name: feature
2032 wakaba 1.47 @@@Type: swcfg21|SWCFGString||swcfg21|ForLatest
2033     @@@actualType: DOMFeature|FeatureNameString||ManakaiDOM|ManakaiDOMLatest
2034 wakaba 1.38 @@@Description:
2035     @@@@lang:en
2036     @@@@@:
2037     A feature name to request.
2038     @@Param:
2039     @@@Name: version
2040 wakaba 1.47 @@@Type: swcfg21|SWCFGString||swcfg21|ForLatest
2041 wakaba 1.38 @@@actualType:
2042 wakaba 1.47 DOMFeature|FeatureVersionString||ManakaiDOM|ManakaiDOMLatest
2043 wakaba 1.38 @@@Description:
2044     @@@@lang:en
2045     @@@@@:
2046     A feature version number to request.
2047     @@Return:
2048     @@@Type:
2049     DOMMain:Object::ManakaiDOM:all
2050     @@@Description:
2051     @@@@lang:en
2052     @@@@@:
2053     An object that implements the specialized APIs of the
2054     <P::feature> and <P::version>.
2055 wakaba 1.49 @@@nullCase:
2056     @@@@enDesc:
2057 wakaba 1.38 There is no object available that implements interfaces
2058     associated with the <P::feature> and <P::version>.
2059     @@@PerlDef:
2060     $feature =~ s/^\+//;
2061     CLASS: for my $class (grep {
2062     $Message::Util::DIS::ManakaiDISElement::CompatClass{$_}
2063     } keys %Message::Util::DIS::ManakaiDISElement::CompatClass) {
2064     if ($Message::DOM::ClassFeature{$class}->{$feature}->{$version}) {
2065 wakaba 1.47 __CODE{ManakaiNode|getNewReference||ManakaiDOM|Perl::
2066 wakaba 1.53 $object => {$self->{<H::mn:node>}},
2067 wakaba 1.47 $ref => $r,
2068     $class => $class,
2069     }__;
2070 wakaba 1.38 last CLASS;
2071     }
2072     }
2073 wakaba 1.1
2074 wakaba 1.48 @Method:
2075     @@Name: unlinkFromDocument
2076     @@enDesc:
2077     Removes any relationship to this node from the owner document tree.
2078     In addition, namespace bindings are copied from the document.
2079     The node <kwd:MUST> be a cloned one (or just newly created one)
2080     so that it does not have any parent-child relationship.
2081    
2082     {NOTE:: Once a subtree has removed from the document, the nodes
2083     belongs to the subtree can't be part of any document anymore.
2084     }
2085 wakaba 1.49 @@Param:
2086     @@@Name: databaseArg
2087     @@@Type: DISDatabase
2088     @@@enDesc:
2089     The <QUOTE::dis> database.
2090 wakaba 1.48 @@Return:
2091     @@@PerlDef:
2092     __DEEP{
2093 wakaba 1.53 my $ods = $self->{<H::mn:node>}->{<H::swcfg21:ownerDocument>};
2094     $self->{<H::mn:node>}->{<H::swcfg21:nsBinding>}
2095 wakaba 1.49 = $self-><M::DISElement.getNamespaceBindingList> ($databaseArg);
2096 wakaba 1.53 $self->{<H::mn:node>}->{<H::DIS|defaultNamespaceURI>}
2097 wakaba 1.49 = ${$self-><M::DISElement.getDefaultNamespaceURIRef>};
2098 wakaba 1.53 my @nodes = ($self->{<H::mn:node>});
2099 wakaba 1.49 while (defined (my $node = shift @nodes)) {
2100 wakaba 1.53 CORE::delete $node->{<H::swcfg21:ownerDocument>};
2101     push @nodes, grep {$_} @{$node->{<H::swcfg21:childNodes>}},
2102     $node->{<H::swcfg21:shadowContent>},
2103     $node->{<H::swcfg21:shadowSibling>};
2104 wakaba 1.49 }
2105 wakaba 1.53 $self->{<H::mn:node>}
2106 wakaba 1.49 -><M::ManakaiNode|NodeStem||ManakaiDOM|Perl.orphanate>;
2107     }__;
2108    
2109     @Method:
2110     @@Name: getNamespaceBindingList
2111     @@enDesc:
2112     Returns the <QUOTE::live> hash reference of namespace bindings.
2113 wakaba 1.51 @@Type: DISPerl|HASH||ManakaiDOM|all
2114 wakaba 1.49 @@Param:
2115     @@@Name: databaseArg
2116     @@@Type: DISDatabase
2117     @@@enDesc:
2118     The <QUOTE::dis> database.
2119     @@Return:
2120     @@@PerlDef:
2121 wakaba 1.53 my $ods = $self->{<H::mn:node>}->{<H::swcfg21:ownerDocument>};
2122     if ($ods->{<H::DIS|allNSBindings>}) {
2123     $r = $ods->{<H::DIS|allNSBindings>};
2124 wakaba 1.49 } else {
2125     if ($databaseArg) {
2126     for my $mod_uri (keys %{$databaseArg->{modDef}}) {
2127     my $mod = $databaseArg-><M::DISDatabase.getModule> ($mod_uri);
2128 wakaba 1.53 $ods->{<H::DIS|allNSBindings>}
2129 wakaba 1.49 ->{$mod-><AG::DISAnyResource.localName>}
2130 wakaba 1.57 = $mod-><AG::DIS|DISModule.targetNamespaceURI>;
2131 wakaba 1.48 }
2132     }
2133 wakaba 1.53 for my $prefix (keys %{$ods->{<H::swcfg21:nsBinding>}}) {
2134     $ods->{<H::DIS|allNSBindings>}->{$prefix}
2135     = $ods->{<H::swcfg21:nsBinding>}->{$prefix};
2136 wakaba 1.48 }
2137 wakaba 1.53 $r = $ods->{<H::DIS|allNSBindings>};
2138 wakaba 1.49 }
2139    
2140     @Method:
2141     @@Name: getDefaultNamespaceURIRef
2142     @@enDesc: A reference to the URI of the default namespace.
2143 wakaba 1.51 @@Type: DISPerl|SCALAR||ManakaiDOM|all
2144 wakaba 1.49 @@Return:
2145     @@@PerlDef:
2146 wakaba 1.53 my $ods = $self->{<H::mn:node>}->{<H::swcfg21:ownerDocument>};
2147     if ($ods->{<H::DIS|defaultNamespaceURI>}) {
2148     $r = \ ($ods->{<H::DIS|defaultNamespaceURI>});
2149 wakaba 1.49 } else {
2150     __DEEP{
2151 wakaba 1.53 $r = \($ods->{<H::DIS|defaultNamespaceURI>}
2152 wakaba 1.49 = $self-><AG::DISNode.ownerDISDocument>
2153     -><AG::DISDocument.moduleElement>
2154     -><AG::DISModuleElement.definingNamespaceURI>);
2155     }__;
2156     }
2157    
2158 wakaba 1.48
2159     @Method:
2160     @@Name: preserveNodePath
2161     @@enDesc:
2162     Saves a copy of node path string.
2163     @@Return:
2164     @@@PerlDef:
2165     __DEEP{
2166     $self-><M::SWCFGNode.flag> (nodePath => $self-><M::SWCFGNode.nodePath>
2167     (key => [qw/QName Name Type type/]));
2168     }__;
2169    
2170     @Method:
2171     @@Operator:
2172 wakaba 1.68 @@@ContentType: DISCore|QName
2173 wakaba 1.48 @@@@:
2174     DISPerl:CloneMethod
2175 wakaba 1.19 @@Description:
2176     @@@lang:en
2177     @@@@:
2178 wakaba 1.48 Makes a copy of this node. All child nodes are cloned and
2179     all flags and options are copied (rather than cloned).
2180     The new node does not have any parent.
2181     @@Return:
2182     @@@Type: DISElement
2183 wakaba 1.19 @@@Description:
2184     @@@@lang:en
2185     @@@@@:
2186 wakaba 1.48 The cloned node.
2187     \
2188     If this node is a document node, then the another document is made.
2189     @@@PerlDef:
2190     $r = bless $self->SUPER::clone, <ClassName::ManakaiDISElement>;
2191     ##DISElement
2192 wakaba 1.19
2193 wakaba 1.49 PropDef:
2194     @QName: allNSBindings
2195     @enDesc:
2196     Collected set of namespace bindings for a node.
2197    
2198 wakaba 1.81 ResourceTypeDef:
2199     @QName: DIS|AnyMethod
2200     @enDesc:
2201     A method or attribute for particular resource types.
2202     @subsetOf: DISLang|AnyMethod
2203    
2204     ResourceTypeDef:
2205     @QName: DIS|Method
2206     @enDesc:
2207     A method for particular resource types.
2208     @subsetOf: DISLang|Method
2209     @subsetOf: DIS|AnyMethod
2210    
2211     ResourceTypeDef:
2212     @QName: DIS|Attribute
2213     @enDesc:
2214     A attribute for particular resource types.
2215     @subsetOf: DISLang|Attribute
2216     @subsetOf: DIS|AnyMethod
2217    
2218     RPropDef:
2219     @QName: DIS|targetType
2220     @enDesc:
2221     A resource type for which the method is applied.
2222     @rdfs:range: DISCore|ResourceType
2223     @rdfs:domain: DIS|Method
2224     @dataType: DISCore|QName
2225     @multipleProperties: DISCore|UnorderedList
2226    
2227     ResourceDef:
2228     @QName: DISString
2229     @AliasFor: DISLang|String||ManakaiDOM|all
2230     @For: DIS|ForEmpty
2231    
2232     ElementTypeBinding:
2233     @Name: ResourceTypeDef
2234     @ElementType:
2235     dis:ResourceDef
2236     @ShadowContent:
2237     @@DISCore:resourceType: DISCore|ResourceType
2238    
2239 wakaba 1.47 IFClsDef:
2240     @IFQName: DISModuleElement
2241     @ClsQName: ManakaiDISModuleElement
2242 wakaba 1.19
2243 wakaba 1.47 @IFISA: DISElement
2244 wakaba 1.4 @ClsISA: ManakaiDISElement
2245 wakaba 1.47
2246 wakaba 1.4 @enDesc:
2247     The <Q::dis:Module> elements.
2248    
2249 wakaba 1.38 @DISLang:role:
2250     @@@:
2251     DISLang:NullRole
2252     @@DISCore:stopISARecursive:1
2253    
2254 wakaba 1.4 @Attr:
2255     @@Name: requireElement
2256     @@enDesc:
2257     The <Q::dis:Require> child element. The element is
2258     newly created if not exist.
2259 wakaba 1.47 @@Type: DISElement
2260     @@clsActualType: ManakaiDISElement
2261 wakaba 1.4 @@Get:
2262     @@@PerlDef:
2263     __DEEP{
2264 wakaba 1.29 $r = bless $self-><M::swcfg21:SWCFGNode
2265 wakaba 1.4 ::swcfg21:ForLatest.getAttributeNS>
2266 wakaba 1.29 (<Q::dis:>, 'Require', make_new_node => true),
2267     <ClassName::ManakaiDISElement>;
2268 wakaba 1.4 }__;
2269    
2270     @Attr:
2271     @@Name: defaultForURI
2272     @@enDesc:
2273     The value of <Q::dis:DefaultFor> attribute.
2274     @@Type: ForURI
2275     @@Get:
2276     @@@enDesc:
2277     The value of <Q::dis:DefaultFor> child element. If missing,
2278     <Q::ManakaiDOM:all> is returned.
2279     @@@PerlDef:
2280     __DEEP{
2281     my $df = $self-><M::swcfg21:SWCFGNode::swcfg21:ForLatest
2282     .getAttributeNS>
2283     (<Q::dis:>, 'DefaultFor');
2284     if ($df) {
2285 wakaba 1.29 $r = (bless $df, <ClassName::ManakaiDISElement>)
2286 wakaba 1.48 -><AG::DISElement.qnameValueURI>
2287 wakaba 1.4 || <Q::ManakaiDOM:all>;
2288     } else {
2289     $r = <Q::ManakaiDOM:all>;
2290     }
2291     }__;
2292     @@Set:
2293     @@@PerlDef:
2294     __DEEP{
2295     $self-><M::swcfg21:SWCFGNode::swcfg21:ForLatest.setAttributeNS>
2296     (<Q::dis:>, 'DefaultFor' => $given);
2297     }__;
2298 wakaba 1.7
2299     @Attr:
2300     @@Name: definingNamespaceURI
2301     @@enDesc:
2302 wakaba 1.48 The value of <Q::dis:Namespace> attribute, i.e.
2303 wakaba 1.7 the URI reference of the namespace that this module primary
2304     defines.
2305     \
2306     {NOTE:: Defining namespace URI is <QUOTE::for> independent.
2307     \
2308     }
2309     @@Type: AnyURI
2310     @@Get:
2311     @@@PerlDef:
2312     __DEEP{
2313     my $df = $self-><M::swcfg21:SWCFGNode::swcfg21:ForLatest
2314     .getAttributeNS>
2315     (<Q::dis:>, 'Namespace');
2316     if ($df) {
2317 wakaba 1.14 $r = $df-><M::swcfg21:SWCFGNode::swcfg21:ForLatest.value>;
2318 wakaba 1.7 } else {
2319     __ASSERT{DISPerl:invariant::
2320     msg => {qq["dis:Namespace" attribute not found]},
2321     }__;
2322     }
2323     }__;
2324     @@Set:
2325     @@@PerlDef:
2326     __DEEP{
2327     $self-><M::swcfg21:SWCFGNode::swcfg21:ForLatest.setAttributeNS>
2328     (<Q::dis:>, 'Namespace' => $given);
2329     }__;
2330 wakaba 1.4 ##DISModuleElement
2331    
2332 wakaba 1.47 IFClsDef:
2333     @IFQName: DISElementList
2334 wakaba 1.2 @ClsQName: ManakaiDISElementList
2335 wakaba 1.47
2336 wakaba 1.2 @enDesc:
2337     @@lang:en
2338     @@@:
2339     Lists of elements.
2340     \
2341     {NOTE:: <Class::ManakaiDISElementList> is <QUOTE::dead>;
2342     later changes to the tree does not affect this type of objects.
2343     \
2344     }
2345     ##DISElementList
2346    
2347 wakaba 1.47 IFClsDef:
2348     @IFQName: DISComment
2349 wakaba 1.1 @ClsQName: ManakaiDISComment
2350 wakaba 1.47
2351 wakaba 1.7 @ClsISA: ManakaiDISNode
2352 wakaba 1.1 @ClsISA:
2353 wakaba 1.3 swcfg21:ManakaiSWCFGComment::swcfg21:ForLatest
2354 wakaba 1.47
2355 wakaba 1.1 @Description:
2356     @@lang:en
2357     @@@:
2358     <QUOTE::dis> comment node objects.
2359     ##DISComment
2360    
2361 wakaba 1.47 IFClsDef:
2362     @IFQName: DISDocumentFragment
2363 wakaba 1.1 @ClsQName: ManakaiDISDocumentFragment
2364 wakaba 1.47
2365 wakaba 1.7 @ClsISA: ManakaiDISNode
2366 wakaba 1.1 @ClsISA:
2367 wakaba 1.3 swcfg21:ManakaiSWCFGDocumentFragment::swcfg21:ForLatest
2368 wakaba 1.47
2369 wakaba 1.1 @Description:
2370     @@lang:en
2371     @@@:
2372     <QUOTE::dis> document fragment node objects.
2373     ##DISDocumentFragment
2374    
2375 wakaba 1.47 IFClsDef:
2376     @IFQName: DISDocument
2377 wakaba 1.1 @ClsQName: ManakaiDISDocument
2378 wakaba 1.47
2379 wakaba 1.7 @ClsISA: ManakaiDISNode
2380 wakaba 1.1 @ClsISA:
2381 wakaba 1.3 swcfg21:ManakaiSWCFGDocument::swcfg21:ForLatest
2382 wakaba 1.47
2383 wakaba 1.1 @Description:
2384     @@lang:en
2385     @@@:
2386     <QUOTE::dis> document node objects.
2387 wakaba 1.2
2388     @Attr:
2389 wakaba 1.4 @@Name: moduleElement
2390     @@enDesc:
2391     The <Q::dis:Module> element in this document. The element is
2392     newly created if not exist.
2393 wakaba 1.47 @@Type: DISModuleElement
2394     @@clsActualType: ManakaiDISModuleElement
2395 wakaba 1.4 @@Get:
2396     @@@PerlDef:
2397     __DEEP{
2398     $r = $self-><M::swcfg21:SWCFGNode
2399     ::swcfg21:ForLatest.getAttributeNS>
2400     (<Q::dis:>, 'Module', make_new_node => true);
2401     }__;
2402     $r = bless $r, <ClassName::ManakaiDISModuleElement>;
2403    
2404     @Attr:
2405 wakaba 1.2 @@Name: disDatabase
2406     @@enDesc:
2407     Associated <QUOTE::dis> database.
2408    
2409 wakaba 1.47 @@Type: DISDatabase
2410     @@clsActualType: ManakaiDISDatabase
2411 wakaba 1.2 @@Get:
2412     @@@NoDBException:
2413     @@@PerlDef:
2414 wakaba 1.53 if ($self->{<H::mn:node>}->{<H::DIS|db>}) {
2415     $r = $self->{<H::mn:node>}->{<H::DIS|db>};
2416 wakaba 1.2 } else {
2417     __EXCEPTION{NO_ASSOCIATED_DB_ERR}__;
2418     }
2419     @@Set:
2420     @@@PerlDef:
2421 wakaba 1.53 $self->{<H::mn:node>}->{<H::DIS|db>} = $given;
2422 wakaba 1.2 require Scalar::Util;
2423 wakaba 1.53 Scalar::Util::weaken ($self->{<H::mn:node>}->{<H::DIS|db>});
2424 wakaba 1.5
2425     @Method:
2426     @@Name: disChildElements
2427     @@enDesc:
2428 wakaba 1.10 A list of child elements, with <QUOTE::for> checks.
2429 wakaba 1.5 @@ForParam:
2430     @@ForpParam:
2431 wakaba 1.49 @@NamedParam:
2432     @@@Name: databaseArg
2433     @@@Type: DISDatabase
2434     @@@enDesc:
2435     A <QUOTE::dis> database.
2436     @@@nullCase:
2437     @@@@enDesc:
2438     The database associated to the document is used.
2439 wakaba 1.5 @@Return:
2440 wakaba 1.47 @@@Type: DISElementList
2441     @@@clsActualType: ManakaiDISElementList
2442 wakaba 1.5 @@@enDesc:
2443     The current snapshot of child nodes.
2444     @@@PerlDef:
2445     $r = bless [], <ClassName::ManakaiDISElementList>;
2446     __DEEP{
2447 wakaba 1.47 C: for my $cn (@{$self-><AG::swcfg21:SWCFGNode::swcfg21:ForLatest
2448 wakaba 1.5 .childNodes>}) {
2449 wakaba 1.47 next C unless $cn-><AG::swcfg21:SWCFGNode::swcfg21:ForLatest
2450 wakaba 1.5 .nodeType> eq '#element';
2451 wakaba 1.47 my $dn;
2452     __CODE{ManakaiNode|getNewReference||ManakaiDOM|Perl::
2453 wakaba 1.53 $object => {$cn->{<H::mn:node>}},
2454 wakaba 1.47 $ref => $dn,
2455     $class => {<ClassName::ManakaiDISElement>},
2456     }__;
2457     next C unless $dn-><M::ManakaiDISElement.forMatch>
2458 wakaba 1.49 ($forArg, $forpArg,
2459     database_arg => $databaseArg);
2460 wakaba 1.5 push @$r, $dn;
2461     }
2462     }__;
2463 wakaba 1.10
2464     @Method:
2465     @@Name: disAllChildElements
2466     @@enDesc:
2467     A list of child elements, without <QUOTE::for> checks.
2468     @@Return:
2469 wakaba 1.47 @@@Type: DISElementList
2470     @@@clsActualType: ManakaiDISElementList
2471 wakaba 1.10 @@@enDesc:
2472     The current snapshot of child nodes.
2473     @@@PerlDef:
2474     $r = bless [], <ClassName::ManakaiDISElementList>;
2475     __DEEP{
2476 wakaba 1.47 C: for my $cn (@{$self-><AG::swcfg21:SWCFGNode::swcfg21:ForLatest
2477 wakaba 1.10 .childNodes>}) {
2478 wakaba 1.47 next C unless $cn-><AG::swcfg21:SWCFGNode::swcfg21:ForLatest
2479 wakaba 1.10 .nodeType> eq '#element';
2480 wakaba 1.47 my $dn;
2481     __CODE{ManakaiNode|getNewReference||ManakaiDOM|Perl::
2482 wakaba 1.53 $object => {$cn->{<H::mn:node>}},
2483 wakaba 1.47 $ref => $dn,
2484     $class => {<ClassName::ManakaiDISElement>},
2485     }__;
2486 wakaba 1.10 push @$r, $dn;
2487     }
2488     }__;
2489 wakaba 1.51
2490     @Method:
2491     @@Name: addNamespaceBinding
2492     @@Param:
2493     @@@Name: prefix
2494     @@@Type: DISLang|String||ManakaiDOM|all
2495     @@Param:
2496     @@@Name: namespaceURI
2497     @@@Type: DISLang|String||ManakaiDOM|all
2498     @@@nullCase:
2499     @@Return:
2500     @@@PerlDef:
2501     if (defined $namespaceURI) {
2502 wakaba 1.53 $self->{<H::mn:node>}->{<H::swcfg21:nsBinding>}->{$prefix}
2503 wakaba 1.51 = $namespaceURI;
2504     } else {
2505 wakaba 1.53 CORE::delete $self->{<H::mn:node>}->{<H::swcfg21:nsBinding>}
2506 wakaba 1.51 ->{$prefix};
2507     }
2508 wakaba 1.88
2509     @Attr:
2510     @@Name: disNamespaceResolver
2511     @@enDesc:
2512     A namespace resolver code that is called by
2513     <M::swcfg21|SWCFGNode||swcfg21|ForLatest.lookupNamesopaceURI> method
2514     when in-document namespace binding information is not sufficient.
2515     @@Type: DISPerl|CODE||ManakaiDOM|Perl
2516     @@Get:
2517     @@@PerlDef:
2518     $r = $self->{<H::mn:node>}->{<H::DIS|disNamespaceResolver>};
2519     @@Set:
2520     @@@PerlDef:
2521     $self->{<H::mn:node>}->{<H::DIS|disNamespaceResolver>} = $given;
2522 wakaba 1.1 ##DISDocument
2523 wakaba 1.2
2524     PropDef:
2525 wakaba 1.88 @QName: DIS|disNamespaceResolver
2526    
2527     PropDef:
2528 wakaba 1.2 @QName: db
2529     @enDesc:
2530     Associated <QUOTE::dis> database.
2531     @rdfs:domain: ManakaiDISDocument
2532     @rdfs:range: ManakaiDISDatabase
2533    
2534     ## -- Definition object database
2535    
2536 wakaba 1.47 IFClsDef:
2537     @IFQName: DISDatabase
2538 wakaba 1.2 @ClsQName: ManakaiDISDatabase
2539 wakaba 1.47
2540 wakaba 1.48 @ClsISA: dp|ManakaiDISDatabasePerl
2541 wakaba 1.47
2542 wakaba 1.2 @enDesc:
2543     Resource database created from <QUOTE::dis> source data.
2544    
2545 wakaba 1.38 @DISLang:role: DatabaseRole
2546    
2547 wakaba 1.2 @Method:
2548     @@Name: getModule
2549     @@Description:
2550     @@@lang:en
2551     @@@@:
2552     Returns a <QUOTE::dis> module definition.
2553     @@Param:
2554 wakaba 1.9 @@@Name: moduleURI
2555 wakaba 1.2 @@@Type: ModuleURI
2556     @@@Description:
2557     @@@@lang:en
2558     @@@@@:
2559     A <QUOTE::dis> module URI reference.
2560 wakaba 1.9 @@ForParam:
2561 wakaba 1.2 @@Return:
2562 wakaba 1.47 @@@Type: DISModule
2563     @@@clsActualType: ManakaiDISModuleDefinition
2564 wakaba 1.2 @@@Description:
2565     @@@@lang:en
2566     @@@@@:
2567     The module definition.
2568     @@@PerlDef:
2569 wakaba 1.9 my $modURI;
2570     if (defined $forArg) {
2571     __CODE{tfurisToURI:: $turi => $moduleURI, $furi => $forArg,
2572     $uri => $modURI}__;
2573     } else {
2574     $modURI = $moduleURI;
2575     }
2576 wakaba 1.2 if (defined $self->{modDef}->{$modURI}) {
2577     $r = $self->{modDef}->{$modURI};
2578     } else {
2579     $r = $self->{modDef}->{$modURI}
2580     = bless {
2581     uri => $modURI,
2582     db => $self,
2583     for => <Q::ManakaiDOM:all>,
2584     forp => [],
2585 wakaba 1.79 <H::DIS|typeURI> => <Q::DISCore|Module>,
2586     <H::DIS|revision> => 0,
2587 wakaba 1.2 }, <ClassName::ManakaiDISModuleDefinition>;
2588     require Scalar::Util;
2589     Scalar::Util::weaken ($r->{db});
2590     }
2591    
2592 wakaba 1.79 @@Test:
2593     @@@QName: DISDB.getModule.test
2594     @@@PerlDef:
2595     my $db;
2596     __CODE{createDISDBForTest:: $db => $db}__;
2597    
2598     my $res = $db-><M::DISDatabase.getModule> ('about:1');
2599    
2600     $test->id ('is.type.uri');
2601     $test->assert_true ($res-><M::DISAnyResource.isTypeURI>
2602     (<Q::DISCore|Module>));
2603     $test->assert_true ($res-><M::DISAnyResource.isTypeURI>
2604     (<Q::DISCore|AnyResource>));
2605    
2606     $test->id ('revision');
2607     $test->assert_num_equals
2608     (actual_value => $res-><AG::DISAnyResource.revision>,
2609     expected_value => 0);
2610    
2611 wakaba 1.2 @Method:
2612     @@Name: getFor
2613     @@Description:
2614     @@@lang:en
2615     @@@@:
2616     Returns a <QUOTE::for> definition object.
2617     @@Param:
2618     @@@Name: forURI
2619     @@@Type: ForURI
2620     @@@Description:
2621     @@@@lang:en
2622     @@@@@:
2623     A <QUOTE::for> URI reference.
2624 wakaba 1.49 @@@nullCase:
2625 wakaba 1.2 @@@@Description:
2626     @@@@@lang:en
2627     @@@@@@:
2628     Defaulted to <Q::ManakaiDOM:all>.
2629     @@Return:
2630 wakaba 1.47 @@@Type: DISFor
2631     @@@clsActualType: ManakaiDISForDefinition
2632 wakaba 1.2 @@@PerlDef:
2633     $forURI = <Q::ManakaiDOM:all> unless defined $forURI;
2634     if (defined $self->{forDef}->{$forURI}) {
2635     $r = $self->{forDef}->{$forURI};
2636 wakaba 1.55 } elsif (defined $self->{<H::DIS|resourceModuleMap>}->{$forURI}) {
2637     __DEEP{
2638     $self-><M::dp|ManakaiDISDatabasePerl.plLoadDISDatabaseModule>
2639     ($self-><M::DIS|DISDatabase.getModule>
2640     (${$self->{<H::DIS|resourceModuleMap>}->{$forURI}}));
2641     }__;
2642     unless (defined $self->{forDef}->{$forURI}) {
2643     __EXCEPTION{DIS|RESOURCE_NOT_DEFINED_ERR::
2644     DIS:uri => {$forURI},
2645     DIS:moduleURI => {${$self->{<H::DIS|resourceModuleMap>}
2646     ->{$forURI}}},
2647     }__;
2648     }
2649     $r = $self->{forDef}->{$forURI};
2650 wakaba 1.2 } else {
2651     $r = $self->{forDef}->{$forURI}
2652     = bless {
2653     uri => $forURI,
2654     isa => {<Q::ManakaiDOM:all> => true},
2655     revISA => {},
2656     db => $self,
2657 wakaba 1.79 <H::DIS|typeURI> => <Q::DISCore|For>,
2658     <H::DIS|revision> => 0,
2659 wakaba 1.2 }, <ClassName::ManakaiDISForDefinition>;
2660     $self->{forDef}->{<Q::ManakaiDOM:all>}->{revISA}->{$forURI} = true;
2661     require Scalar::Util;
2662     Scalar::Util::weaken ($r->{db});
2663     }
2664    
2665 wakaba 1.79 @@Test:
2666     @@@QName: DISDB.getFor.test
2667     @@@PerlDef:
2668     my $db;
2669     __CODE{createDISDBForTest:: $db => $db}__;
2670    
2671     my $res = $db-><M::DISDatabase.getFor> ('about:1');
2672    
2673     $test->id ('is.type.uri');
2674     $test->assert_true ($res-><M::DISAnyResource.isTypeURI>
2675     (<Q::DISCore|For>));
2676     $test->assert_true ($res-><M::DISAnyResource.isTypeURI>
2677     (<Q::DISCore|AnyResource>));
2678    
2679     $test->id ('revision');
2680     $test->assert_num_equals
2681     (actual_value => $res-><AG::DISAnyResource.revision>,
2682     expected_value => 0);
2683    
2684 wakaba 1.2 @Method:
2685     @@Name: getResource
2686     @@Description:
2687     @@@lang:en
2688     @@@@:
2689     Returns a <QUOTE::dis> resource definition.
2690     @@Param:
2691 wakaba 1.9 @@@Name: resourceURI
2692 wakaba 1.2 @@@Type: ResourceURI
2693     @@@Description:
2694     @@@@lang:en
2695     @@@@@:
2696     A <QUOTE::dis> resource URI reference.
2697 wakaba 1.3 @@@nullCase:
2698 wakaba 1.2 @@@@Description:
2699     @@@@@lang:en
2700     @@@@@@:
2701     Defaulted to <Q::DOMMain:any>.
2702 wakaba 1.9 @@ForParam:
2703 wakaba 1.2 @@Return:
2704 wakaba 1.47 @@@Type: DISResource
2705     @@@clsActualType: ManakaiDISResourceDefinition
2706 wakaba 1.2 @@@Description:
2707     @@@@lang:en
2708     @@@@@:
2709     The resource definition.
2710 wakaba 1.54 @@@RaiseException:
2711     @@@@@: DIS|RESOURCE_NOT_DEFINED_ERR
2712     @@@@enDesc:
2713     The resource should be included in database submodule but
2714     it is not.
2715 wakaba 1.2 @@@PerlDef:
2716 wakaba 1.9 $resourceURI = <Q::DOMMain:any> unless defined $resourceURI;
2717     my $resURI;
2718     if (defined $forArg) {
2719     __CODE{tfurisToURI:: $turi => $resourceURI, $furi => $forArg,
2720     $uri => $resURI}__;
2721     } else {
2722     $resURI = $resourceURI;
2723     }
2724 wakaba 1.54
2725 wakaba 1.2 if (defined $self->{resDef}->{$resURI}) {
2726     $r = $self->{resDef}->{$resURI};
2727 wakaba 1.54 } elsif (defined $self->{<H::DIS|resourceModuleMap>}->{$resURI}) {
2728     __DEEP{
2729     $self-><M::dp|ManakaiDISDatabasePerl.plLoadDISDatabaseModule>
2730     ($self-><M::DIS|DISDatabase.getModule>
2731     (${$self->{<H::DIS|resourceModuleMap>}->{$resURI}}));
2732     }__;
2733     unless (defined $self->{resDef}->{$resURI}) {
2734     __EXCEPTION{DIS|RESOURCE_NOT_DEFINED_ERR::
2735     DIS:uri => {$resURI},
2736     DIS:moduleURI => {${$self->{<H::DIS|resourceModuleMap>}
2737     ->{$resURI}}},
2738     }__;
2739     }
2740     $r = $self->{resDef}->{$resURI};
2741 wakaba 1.2 } else {
2742     $r = $self->{resDef}->{$resURI}
2743     = bless {
2744     uri => $resURI,
2745 wakaba 1.6 aliasURI => {$resURI => true},
2746 wakaba 1.2 db => $self,
2747     for => <Q::ManakaiDOM:all>,
2748     forp => [],
2749 wakaba 1.9 seq => -1,
2750 wakaba 1.79 <H::DIS|typeURI> => <Q::DISCore|Resource>,
2751     <H::DIS|revision> => 0,
2752 wakaba 1.2 }, <ClassName::ManakaiDISResourceDefinition>;
2753     require Scalar::Util;
2754     Scalar::Util::weaken ($r->{db});
2755     }
2756 wakaba 1.3
2757 wakaba 1.79 @@Test:
2758     @@@QName: DISDB.getResource.test
2759     @@@PerlDef:
2760     my $db;
2761     __CODE{createDISDBForTest:: $db => $db}__;
2762    
2763     my $res = $db-><M::DISDatabase.getResource> ('about:1');
2764    
2765    
2766     $test->id ('is.type.uri');
2767     $test->assert_true ($res-><M::DISAnyResource.isTypeURI>
2768     (<Q::DISCore|Resource>));
2769     $test->assert_true ($res-><M::DISAnyResource.isTypeURI>
2770     (<Q::DISCore|AnyResource>));
2771    
2772     $test->id ('revision');
2773     $test->assert_num_equals
2774     (actual_value => $res-><AG::DISAnyResource.revision>,
2775     expected_value => 0);
2776    
2777 wakaba 1.3 @Method:
2778 wakaba 1.61 @@Name: getAnyResource
2779     @@enDesc:
2780     Returns a resource object, either module, <Q::for>, or resource.
2781     @@Param:
2782     @@@Name: resourceURI
2783     @@@Type: ResourceURI
2784     @@@Description:
2785     @@@@lang:en
2786     @@@@@:
2787     A resource URI.
2788     @@@nullCase:
2789     @@@@Description:
2790     @@@@@lang:en
2791     @@@@@@:
2792     Defaulted to <Q::DOMMain:any>.
2793     @@ForParam:
2794     @@Return:
2795     @@@Type: DIS|DISAnyResource
2796     @@@Description:
2797     @@@@lang:en
2798     @@@@@:
2799     The resource definition.
2800     @@@RaiseException:
2801     @@@@@: DIS|RESOURCE_NOT_DEFINED_ERR
2802     @@@@enDesc:
2803     The resource should be included in database submodule but
2804     it is not.
2805     @@@PerlDef:
2806     $resourceURI = <Q::DOMMain:any> unless defined $resourceURI;
2807     my $resURI;
2808     if (defined $forArg) {
2809     __CODE{tfurisToURI:: $turi => $resourceURI, $furi => $forArg,
2810     $uri => $resURI}__;
2811     } else {
2812     $resURI = $resourceURI;
2813     }
2814    
2815     if (defined $self->{resDef}->{$resURI}) {
2816     $r = $self->{resDef}->{$resURI};
2817     } elsif (defined $self->{modDef}->{$resURI}) {
2818     $r = $self->{modDef}->{$resURI};
2819     } elsif (defined $self->{forDef}->{$resURI}) {
2820     $r = $self->{forDef}->{$resURI};
2821     } elsif (defined $self->{<H::DIS|resourceModuleMap>}->{$resURI}) {
2822     __DEEP{
2823     $self-><M::dp|ManakaiDISDatabasePerl.plLoadDISDatabaseModule>
2824     ($self-><M::DIS|DISDatabase.getModule>
2825     (${$self->{<H::DIS|resourceModuleMap>}->{$resURI}}));
2826     }__;
2827     if (defined $self->{resDef}->{$resURI}) {
2828     $r = $self->{resDef}->{$resURI};
2829     } elsif (defined $self->{forDef}->{$resURI}) {
2830     $r = $self->{forDef}->{$resURI};
2831     } else {
2832     __EXCEPTION{DIS|RESOURCE_NOT_DEFINED_ERR::
2833     DIS:uri => {$resURI},
2834     DIS:moduleURI => {${$self->{<H::DIS|resourceModuleMap>}
2835     ->{$resURI}}},
2836     }__;
2837     }
2838     } else {
2839     __DEEP{
2840 wakaba 1.62 $r = $self-><M::DIS|DISDatabase.getResource> ($resURI);
2841 wakaba 1.61 }__;
2842     }
2843    
2844     @Method:
2845 wakaba 1.3 @@Name: getSourceFile
2846     @@enDesc:
2847     Gets <QUOTE::dis> source document.
2848     @@Param:
2849     @@@Name: fileName
2850     @@@Type: FileURI
2851     @@@enDesc:
2852     A URI reference identifying a file.
2853     @@Return:
2854 wakaba 1.47 @@@Type: DISDocument
2855     @@@clsActualType: ManakaiDISDocument
2856 wakaba 1.3 @@@enDesc:
2857     The <QUOTE::dis> source document.
2858     @@@nullCase:
2859     @@@@enDesc:
2860     No document associated with that <P::fileName>.
2861     @@@PerlDef:
2862 wakaba 1.53 $r = $self->{<H::DIS|sourceFile>}->{$fileName};
2863 wakaba 1.3 @Method:
2864     @@Name: setSourceFile
2865     @@enDesc:
2866     Puts <QUOTE::dis> source document object.
2867     @@Param:
2868     @@@Name: fileName
2869     @@@Type: FileURI
2870     @@@enDesc:
2871 wakaba 1.4 A URI reference identifying a file. If there is already a
2872 wakaba 1.3 source document, then the association has been updated.
2873     @@Param:
2874     @@@Name: doc
2875 wakaba 1.47 @@@Type: DISDocument
2876     @@@clsActualType: ManakaiDISDocument
2877 wakaba 1.3 @@@enDesc:
2878     The document object to set.
2879     @@Return:
2880     @@@PerlDef:
2881 wakaba 1.53 $self->{<H::DIS|sourceFile>}->{$fileName} = $doc;
2882 wakaba 1.4
2883     @Method:
2884     @@Name: loadModule
2885     @@enDesc:
2886     Loads definitions from a <QUOTE::dis> document.
2887     @@Param:
2888     @@@Name: doc
2889 wakaba 1.47 @@@Type: DISDocument
2890     @@@clsActualType: ManakaiDISDocument
2891 wakaba 1.4 @@@enDesc:
2892     The source <QUOTE::dis> document object. Its
2893     <A::ManakaiDISDocument.disDatabase> must be this database.
2894     @@Param:
2895     @@@Name: resolver
2896     @@@Type: DISModuleResolver
2897     @@@enDesc:
2898     The resolver to convert module name into <QUOTE::dis> document object.
2899     @@ForParam:
2900 wakaba 1.32 @@NamedParam:
2901     @@@Name: onResourceRead
2902     @@@Type:
2903 wakaba 1.60 DISPerl:CODE::ManakaiDOM:all
2904 wakaba 1.32 @@@enDesc:
2905     An event handler called when a resource is read.
2906     @@@nullCase:
2907     @@@@enDesc:
2908     No event handler is read.
2909 wakaba 1.85 @@NamedParam:
2910     @@@Name: srinfo
2911     @@@Type: DISPerl|HASH||ManakaiDOM|all
2912     @@@enDesc:
2913     A hash returned by <M::DISDatabase.unloadModule>, to
2914     restore super-resource relationship.
2915     @@@nullCase:
2916     @@@@enDesc:
2917     If it is not the updating.
2918 wakaba 1.4 @@Return:
2919     @@@RaiseException:
2920     @@@@@: NO_MODULE_QNAME_ERR
2921     @@@@enDesc:
2922     The <Q::dis:Module> element must have a <Q::dis:QName> attribute.
2923     @@@RaiseException:
2924     @@@@@: UNABLE_TO_GET_MODULE_ERR
2925     @@@@enDesc:
2926     The implementation is unable to get a module source.
2927 wakaba 1.5 @@@ForDefDupException:
2928     @@@ForDefNoQNameException:
2929     @@@ResDefDupException:
2930     @@@ElementNotAllowedException:
2931 wakaba 1.7 @@@RaiseException:
2932     @@@@@:NO_REQUIRED_ATTR_ERR
2933     @@@@enDesc:
2934     The <Q::dis:Module> element does not have
2935     <Q::dis:Namespace> attribute.
2936 wakaba 1.4 @@@PerlDef:
2937     $resolver = bless $resolver, <ClassName::ManakaiDISModuleResolver>
2938     if ref $resolver eq 'CODE';
2939     ## -- Module Name, URI
2940     $forArg = <Q::ManakaiDOM:all> unless defined $forArg;
2941     my $mod_node;
2942     my $mod_name_node;
2943     __DEEP{
2944 wakaba 1.48 $mod_node = $doc-><AG::DISDocument.moduleElement>;
2945     $mod_name_node = $mod_node-><M::SWCFGNode.getAttributeNS>
2946 wakaba 1.4 (<Q::dis:>, 'QName');
2947     unless ($mod_name_node) {
2948     __UNDEEP{
2949     __EXCEPTION{NO_MODULE_QNAME_ERR::
2950     DIS:sourceNode => {$mod_node},
2951     }__;
2952     }__;
2953     }
2954 wakaba 1.51 $mod_name_node = bless $mod_name_node, <ClassName::ManakaiDISElement>
2955     if $mod_name_node->isa (<ClassName::swcfg21:ManakaiSWCFGElement
2956     ::swcfg21:ForLatest>);
2957 wakaba 1.5 my $mod_name_uri = $mod_name_node
2958 wakaba 1.48 -><AG::DISElement.qnameValueURI>;
2959     my $mod = $self-><M::DISDatabase.getModule>
2960 wakaba 1.9 ($mod_name_uri, for_arg => $forArg);
2961 wakaba 1.4
2962 wakaba 1.48 unless ($mod-><AG::DISAnyResource.isDefined>) {
2963 wakaba 1.4 ## -- Initializes Module Definition Object
2964 wakaba 1.59 my $v = $mod_name_node-><AG::DISElement.qnameValueLocalName>;
2965     __CODE{DISPerl|HashStringRef||ManakaiDOM|all::
2966     $result => {$mod->{localName}},
2967     $given => {$v},
2968     }__;
2969     my $ns = $mod_name_node-><AG::DISElement.qnameValueNamespaceURI>;
2970     __CODE{DISPerl|HashStringRef||ManakaiDOM|all::
2971     $result => {$mod->{namespaceURI}},
2972     $given => {$ns},
2973     }__;
2974     __CODE{DISPerl|HashStringRef||ManakaiDOM|all::
2975     $result => {$mod->{for}},
2976     $given => {$forArg},
2977     }__;
2978 wakaba 1.4 $mod->{src} = $mod_node;
2979 wakaba 1.48 $mod->{<Q::DIS|isDefined>} = true;
2980 wakaba 1.49 $self-><M::DISDatabase.setSourceFile> ($mod_name_uri => $doc);
2981 wakaba 1.48
2982 wakaba 1.57 $mod-><AS::DIS|ManakaiDISModuleDefinition.targetNamespaceURI>
2983     ($mod_node-><AG::DISModuleElement.definingNamespaceURI>);
2984 wakaba 1.48
2985     __CODE{dv:createValue::
2986     $result => {$mod->{<Q::DIS:sourceFile>}},
2987 wakaba 1.49 $value => {$doc-><M::SWCFGNode.flag> (<Q::swcfg21:fileName>)},
2988 wakaba 1.48 $base_type => {<Q::DISCore:String>},
2989     $type => {<Q::DISCore:String>},
2990 wakaba 1.60 $name => {<Q::DIS:sourceFile>},
2991 wakaba 1.48 }__;
2992 wakaba 1.88 __CODE{setRevision:: $resource => $mod}__;
2993 wakaba 1.5
2994 wakaba 1.12 ## -- Loads "for" definition
2995     my $root_elements
2996 wakaba 1.48 = $doc-><M::DISDocument.disAllChildElements>;
2997     if ($mod-><AG::DISAnyResource.forURI> eq <Q::ManakaiDOM:all>) {
2998     R: for my $el (@$root_elements) {
2999     next R unless $el-><AG::SWCFGElement
3000 wakaba 1.12 .expandedURI> eq <Q::dis:ForDef>;
3001 wakaba 1.85 $self-><M::DISDatabase.loadFor>
3002     ($mod, $el, srinfo => $srinfo);
3003 wakaba 1.12 }
3004     }
3005    
3006 wakaba 1.5 ## -- Loads "for all"
3007 wakaba 1.48 my $rmod = $self-><M::DISDatabase.getModule>
3008 wakaba 1.51 ($mod_name_uri,
3009 wakaba 1.48 for_arg => <Q::ManakaiDOM:all>);
3010     unless ($rmod-><AG::DISAnyResource.isDefined>) {
3011     my $rdoc = $resolver-><M::DISModuleResolver.uriToDocument>
3012     ($self, $rmod-><AG::DISAnyResource.uri>,
3013     $mod-><AG::DISAnyResource.namespaceURI>,
3014     $mod-><AG::DISAnyResource.localName>,
3015     <Q::ManakaiDOM:all>);
3016 wakaba 1.5 unless ($rdoc) {
3017     __UNDEEP{
3018     __EXCEPTION{UNABLE_TO_GET_MODULE_ERR::
3019 wakaba 1.48 DIS:uri => {$rmod-><AG::DISAnyResource.uri>},
3020     DIS:namespaceURI =>
3021     {$mod-><AG::DISAnyResource.namespaceURI>},
3022     DIS:localName => {$mod-><AG::DISAnyResource.localName>},
3023 wakaba 1.9 DIS:for => {<Q::ManakaiDOM:all>},
3024 wakaba 1.48 DIS:sourceNode => {$mod-><AG::DISAnyResource.sourceElement>},
3025 wakaba 1.5 }__;
3026     }__;
3027     }
3028 wakaba 1.48 $self-><M::DISDatabase.loadModule>
3029 wakaba 1.32 ($rdoc, $resolver, for_arg => <Q::ManakaiDOM:all>,
3030 wakaba 1.85 on_resource_read => $onResourceRead,
3031     srinfo => $srinfo);
3032 wakaba 1.77 } else { # if "for all" loaded
3033     $rmod-><M::DIS|DISResourceProp.getPropertyBoolean>
3034     (<Q::dis:In>);
3035     ## Dummy to ensure the module is loaded
3036     }
3037 wakaba 1.4
3038     ## -- Loads Required Modules
3039 wakaba 1.10 ## NOTE:: "dis:For" is not allowed since "dis:ForDef" is not read
3040 wakaba 1.48 my $req_node = $mod_node-><AG::DISModuleElement.requireElement>;
3041     for my $rm (@{$req_node-><M::DISElement.disAllChildElements>}) {
3042     next unless $rm-><AG::SWCFGElement.expandedURI> eq <Q::dis:Module>;
3043 wakaba 1.4 my ($uri, $nuri, $ln, $for);
3044 wakaba 1.48 my $mqn = $rm-><M::SWCFGNode.getAttributeNS> (<Q::dis:>, 'QName');
3045 wakaba 1.4 if ($mqn) {
3046 wakaba 1.48 my $mqv = $mqn-><M::SWCFGNode.value>;
3047 wakaba 1.51 my $mqp = ($mqn->isa (<ClassName::swcfg21:ManakaiSWCFGElement
3048     ::swcfg21:ForLatest>)
3049     ? (bless $mqn, <ClassName::ManakaiDISElement>) : $mqn)
3050 wakaba 1.48 -><M::NSResolverDIS.qnameToPair> ($mqv, node => $mqn);
3051 wakaba 1.4 ($nuri, $ln) = @$mqp;
3052     } else {
3053 wakaba 1.48 my $mn = $rm-><M::SWCFGNode.getAttributeNS> (<Q::dis:>, 'Name');
3054 wakaba 1.4 if ($mn) {
3055 wakaba 1.48 $nuri = $mod-><AG::DISAnyResource.namespaceURI>;
3056     $ln = $mn-><M::SWCFGNode.value>;
3057 wakaba 1.4 } else {
3058 wakaba 1.48 $nuri = $mod-><AG::DISAnyResource.namespaceURI>;
3059     $ln = $mod-><AG::DISAnyResource.localName>;
3060 wakaba 1.4 }
3061     }
3062 wakaba 1.48 my $wfn = $rm-><M::SWCFGNode.getAttributeNS>
3063     (<Q::dis:>, 'WithFor');
3064 wakaba 1.4 if ($wfn) {
3065 wakaba 1.51 $for = ($wfn->isa (<ClassName::swcfg21:ManakaiSWCFGElement
3066     ::swcfg21:ForLatest>)
3067     ? (bless $wfn, <ClassName::ManakaiDISElement>) : $wfn)
3068 wakaba 1.48 -><AG::DISElement.qnameValueURI>;
3069 wakaba 1.4 } else {
3070 wakaba 1.48 $for = $mod-><AG::DISAnyResource.forURI>;
3071 wakaba 1.4 }
3072 wakaba 1.48 my $rmod = $self-><M::DISDatabase.getModule>
3073 wakaba 1.9 ($nuri . $ln, for_arg => $for);
3074 wakaba 1.87 $mod-><M::DISModule.addReferringModuleURI> ($nuri.$ln);
3075 wakaba 1.48 unless ($rmod-><AG::DISAnyResource.isDefined>) {
3076     my $rdoc = $resolver-><M::DISModuleResolver.uriToDocument>
3077     ($self, $rmod-><AG::DISAnyResource.uri>,
3078     $nuri, $ln, $for);
3079 wakaba 1.4 unless ($rdoc) {
3080     __UNDEEP{
3081     __EXCEPTION{UNABLE_TO_GET_MODULE_ERR::
3082 wakaba 1.48 DIS:uri => {$rmod-><AG::DISAnyResource.uri>},
3083 wakaba 1.4 DIS:namespaceURI => {$nuri},
3084     DIS:localName => {$ln},
3085     DIS:for => {$for},
3086     DIS:sourceNode => {$rm},
3087     }__;
3088     }__;
3089     }
3090 wakaba 1.48 $self-><M::DISDatabase.loadModule>
3091 wakaba 1.32 ($rdoc, $resolver, for_arg => $for,
3092 wakaba 1.85 on_resource_read => $onResourceRead,
3093     srinfo => $srinfo);
3094 wakaba 1.4 }
3095     } # Child Module elements
3096    
3097 wakaba 1.12 ## -- Loads child resources
3098 wakaba 1.48 $root_elements = $doc-><M::DISDocument.disChildElements>
3099 wakaba 1.49 (for_arg => $forArg,
3100     database_arg => $self);
3101 wakaba 1.5 for my $el (@$root_elements) {
3102 wakaba 1.48 if ($el-><AG::DISElement.isResourceElement>) {
3103     $self-><M::DISDatabase.loadResource>
3104 wakaba 1.9 ($mod, null, null, $el,
3105 wakaba 1.32 for_arg => $forArg,
3106 wakaba 1.85 on_resource_read => $onResourceRead,
3107     srinfo => $srinfo);
3108 wakaba 1.7 } else {
3109 wakaba 1.48 my $et = $el-><AG::SWCFGElement.expandedURI>;
3110 wakaba 1.7 if ({
3111 wakaba 1.5 <Q::dis:ForDef> => 1,
3112     <Q::dis:Module> => 1,
3113     <Q::dis:ImplNote> => 1,
3114 wakaba 1.7 }->{$et}) {
3115     #
3116     } else {
3117     __UNDEEP{
3118     __EXCEPTION{ELEMENT_NOT_ALLOWED_ERR::
3119     DIS:elementType => {$et},
3120     DIS:sourceNode => {$el},
3121     DIS:uri => {$mod->{uri}},
3122     }__;
3123 wakaba 1.5 }__;
3124 wakaba 1.7 }
3125     } # element types
3126     }
3127    
3128 wakaba 1.48 my $dn = $mod_node-><M::SWCFGNode.getAttributeNS>
3129     (<Q::dis:>, 'Namespace');
3130     unless ($dn and defined $dn-><M::SWCFGNode.value>) {
3131 wakaba 1.7 __UNDEEP{
3132     __EXCEPTION{NO_REQUIRED_ATTR_ERR::
3133     DIS:elementType => {<Q::dis:Namespace>},
3134     DIS:sourceNode => {$mod_node},
3135 wakaba 1.5 }__;
3136 wakaba 1.7 }__;
3137 wakaba 1.5 }
3138     } # Unless this module loaded
3139     }__; # Deep
3140    
3141     @Method:
3142     @@Name: loadFor
3143     @@enDesc:
3144     Loads definition of a <QUOTE::for> from a <Q::dis:ForDef> element.
3145     @@Param:
3146     @@@Name: mod
3147 wakaba 1.47 @@@Type: DISModule
3148     @@@clsActualType: ManakaiDISModuleDefinition
3149 wakaba 1.5 @@@enDesc:
3150     The module in which the <QUOTE::for> to load is defined.
3151     @@Param:
3152     @@@Name: el
3153 wakaba 1.47 @@@Type: DISElement
3154 wakaba 1.5 @@@enDesc:
3155     The source <QUOTE::dis> <Q::dis:ForDef> element object.
3156 wakaba 1.85 @@NamedParam:
3157     @@@Name: srinfo
3158     @@@Type: DISPerl|HASH||ManakaiDOM|all
3159     @@@enDesc:
3160     A hash returned by <M::DISDatabase.unloadModule>, to
3161     restore super-resource relationship.
3162     @@@nullCase:
3163     @@@@enDesc:
3164     If it is not the updating.
3165 wakaba 1.5 @@Return:
3166     @@@ForDefDupException:
3167     @@@ForDefNoQNameException:
3168     @@@ElementNotAllowedException:
3169     @@@PerlDef:
3170     __DEEP{
3171 wakaba 1.48 my $qn_node = $el-><M::SWCFGNode.getAttributeNS> (<Q::dis:>, 'QName');
3172 wakaba 1.5 unless ($qn_node) {
3173     __UNDEEP{
3174     __EXCEPTION{NO_FOR_QNAME_ERR::
3175 wakaba 1.48 DIS:sourceNode => {$el},
3176 wakaba 1.5 }__;
3177     }__;
3178     }
3179 wakaba 1.51 $qn_node = bless $qn_node, <ClassName::ManakaiDISElement>
3180     if $qn_node->isa (<ClassName::swcfg21:ManakaiSWCFGElement
3181     ::swcfg21:ForLatest>);
3182 wakaba 1.48 my $qn_uri = $qn_node-><AG::DISElement.qnameValueURI>;
3183     my $for = $self-><M::DISDatabase.getFor> ($qn_uri);
3184 wakaba 1.5
3185 wakaba 1.48 unless ($for-><AG::DISAnyResource.isDefined>) {
3186 wakaba 1.10 ## -- Initializes "For" Definition Object
3187 wakaba 1.5 $for->{src} = $el;
3188 wakaba 1.53 $for->{<H::DIS|isDefined>} = true;
3189     $for->{<H::DIS|definingModule>} = \ ($mod->{uri});
3190 wakaba 1.85 $mod-><M::DISModule.addForResource> ($for);
3191 wakaba 1.5
3192 wakaba 1.10 for my $ce (@{$el-><M::ManakaiDISElement.disAllChildElements>}) {
3193 wakaba 1.48 my $xn = $ce-><AG::SWCFGElement.expandedURI>;
3194 wakaba 1.5 if ($xn eq <Q::dis:ISA> or $xn eq <Q::dis:Implement>) {
3195 wakaba 1.48 my $sfor = $self-><M::DISDatabase.getFor>
3196     ($ce-><AG::DISElement.qnameValueURI>);
3197     $for-><M::DISFor.addISA> ($sfor);
3198     $sfor-><AS::DISAnyResource.isReferred> ($ce);
3199 wakaba 1.5 ## TODO: warn if dis:Implement
3200     } elsif ({
3201     <Q::dis:Description> => 1,
3202     <Q::dis:ImplNote> => 1,
3203     <Q::dis:FullName> => 1,
3204     <Q::dis:QName> => 1,
3205     }->{$xn}) {
3206     #
3207     } else {
3208     __UNDEEP{
3209     __EXCEPTION{ELEMENT_NOT_ALLOWED_ERR::
3210     DIS:elementType => {$xn},
3211     DIS:sourceNode => {$ce},
3212 wakaba 1.48 DIS:uri => {$qn_uri},
3213 wakaba 1.5 }__;
3214     }__;
3215     }
3216     }
3217 wakaba 1.85
3218     for (keys %{$srinfo->{for}->{$qn_uri}->{supOf} or {}}) {
3219     my $subfor = $self-><M::DISDatabase.getFor> ($_);
3220     $subfor-><M::DISFor.addISA> ($for);
3221     }
3222 wakaba 1.5 } else {
3223     __UNDEEP{
3224     __EXCEPTION{FOR_ALREADY_DEFINED_ERR::
3225     DIS:sourceNode => {$el},
3226 wakaba 1.48 DIS:anotherSourceNode => {$el},
3227     DIS:uri => {$qn_uri},
3228 wakaba 1.5 }__;
3229     }__;
3230     } # isDefine?
3231     }__; # DEEP
3232    
3233     @Method:
3234     @@Name: loadResource
3235     @@enDesc:
3236     Loads definition of a <QUOTE::dis> resource from a
3237     <Q::dis:ResourceDef> element.
3238     @@Param:
3239     @@@Name: mod
3240 wakaba 1.47 @@@Type: DISModule
3241     @@@clsActualType: ManakaiDISModuleDefinition
3242 wakaba 1.5 @@@enDesc:
3243     The module in which the resource to load is defined.
3244     @@Param:
3245     @@@Name: parentResource
3246 wakaba 1.47 @@@Type: DISResource
3247     @@@clsActualType: ManakaiDISResourceDefinition
3248 wakaba 1.5 @@@enDesc:
3249 wakaba 1.7 The (static) parent resource in which the resource to load is defined.
3250 wakaba 1.5 @@@nullCase:
3251     @@@@enDesc:
3252     The resource to load is a root resource, i.e. <P::el> is
3253     a direct child of the document node.
3254     @@Param:
3255 wakaba 1.7 @@@Name: dynParent
3256 wakaba 1.47 @@@Type: DISResource
3257     @@@clsActualType: ManakaiDISResourceDefinition
3258 wakaba 1.7 @@@enDesc:
3259     The dynamic parent resource of the resource to load.
3260 wakaba 1.9 @@@nullCase:
3261 wakaba 1.7 @@@@enDesc:
3262 wakaba 1.9 If this resource is a root resource, i.e. <P::el> is
3263     a direct child of the document node.
3264 wakaba 1.7 @@Param:
3265 wakaba 1.5 @@@Name: el
3266 wakaba 1.47 @@@Type: DISElement
3267     @@@clsActualType: ManakaiDISElement
3268 wakaba 1.5 @@@enDesc:
3269     The source <QUOTE::dis> <Q::dis:ResourceDef> element object.
3270     @@ForParam:
3271     @@ForpParam:
3272 wakaba 1.32 @@NamedParam:
3273     @@@Name: onResourceRead
3274     @@@Type:
3275 wakaba 1.60 DISPerl:CODE::ManakaiDOM:all
3276 wakaba 1.32 @@@enDesc:
3277     An event handler called when a resource is read.
3278     @@@nullCase:
3279     @@@@enDesc:
3280     No event handler is read.
3281 wakaba 1.85 @@NamedParam:
3282     @@@Name: srinfo
3283     @@@Type: DISPerl|HASH||ManakaiDOM|all
3284     @@@enDesc:
3285     A hash returned by <M::DISDatabase.unloadModule>, to
3286     restore super-resource relationship.
3287     @@@nullCase:
3288     @@@@enDesc:
3289     If it is not the updating.
3290 wakaba 1.5 @@Return:
3291     @@@ResDefDupException:
3292     @@@ElementNotAllowedException:
3293 wakaba 1.49 @@@RaiseException:
3294     @@@@@: NO_RDF_TYPE_ERR
3295     @@@@enDesc:
3296     There is a resorce that does not have any <Q::rdf:type>
3297     attribute.
3298 wakaba 1.5 @@@PerlDef:
3299     $forArg = <Q::ManakaiDOM:all> unless defined $forArg;
3300     $forpArg ||= [];
3301     __DEEP{
3302 wakaba 1.6 ## -- Node names
3303 wakaba 1.86 my @res_uri;
3304 wakaba 1.6
3305     ## Unique resource identifier generated from node id
3306 wakaba 1.50 my $node_id = $el-><AG::SWCFGNode.nodeIDRef>;
3307 wakaba 1.6 my $node_uri;
3308 wakaba 1.50 __CODE{tfpurisToURI:: $turi => {$$node_id}, $furi => $forArg,
3309 wakaba 1.6 $forp => $forpArg, $uri => $node_uri}__;
3310    
3311 wakaba 1.54 my $al_node = $el-><M::DISElement.disGetAttribute>
3312     (<Q::dis:AliasFor>, for_arg => $forArg,
3313     forp_arg => $forpArg,
3314     database_arg => $self);
3315     my $al_canon_uri;
3316     if ($al_node) {
3317     $al_canon_uri = $al_node-><M::DISElement.tfqnamesValueURI>
3318 wakaba 1.59 ($$node_id, $forArg,
3319     for_arg => $forArg,
3320     forp_arg => $forpArg,
3321     database_arg => $self);
3322 wakaba 1.54 }
3323    
3324 wakaba 1.6 ## User defined resource identifiers
3325 wakaba 1.5 my $qn_node = $el-><M::ManakaiDISElement.disGetAttribute>
3326     (<Q::dis:QName>, for_arg => $forArg,
3327 wakaba 1.49 forp_arg => $forpArg,
3328     database_arg => $self);
3329 wakaba 1.5 my $res;
3330 wakaba 1.54 ALD: {
3331 wakaba 1.5 if ($qn_node) {
3332     my $qn_uri = $qn_node-><AG::ManakaiDISElement.qnameValueURI>;
3333 wakaba 1.86 my $qn_urif;
3334     __CODE{tfurisToURI:: $turi => $qn_uri, $furi => $forArg,
3335     $uri => $qn_urif}__;
3336     push @res_uri, $qn_urif;
3337     $res = $self-><M::DISDatabase.getResource> ($qn_urif);
3338 wakaba 1.48 if ($res-><AG::DISAnyResource.isDefined>) {
3339 wakaba 1.54 last ALD if defined $al_canon_uri and
3340     $res->{aliasURI}->{$al_canon_uri};
3341 wakaba 1.5 __UNDEEP{
3342     __EXCEPTION{RESOURCE_ALREADY_DEFINED_ERR::
3343 wakaba 1.54 DIS:uri => {$qn_uri},
3344 wakaba 1.5 DIS:sourceNode => {$qn_node},
3345     DIS:anotherSourceNode => {$res->{src}},
3346     }__;
3347 wakaba 1.6 }__;
3348 wakaba 1.5 }
3349 wakaba 1.59 my $v = $qn_node-><AG::DIS|DISElement.qnameValueLocalName>;
3350     __CODE{DISPerl|HashStringRef||ManakaiDOM|all::
3351     $result => {$res->{localName}},
3352     $given => {$v},
3353     }__;
3354     my $ns = $qn_node-><AG::DIS|DISElement.qnameValueNamespaceURI>;
3355     __CODE{DISPerl|HashStringRef||ManakaiDOM|all::
3356     $result => {$res->{namespaceURI}},
3357     $given => {$ns},
3358     }__;
3359 wakaba 1.5 } else { ## Anonymous or local
3360     my $n_node = $el-><M::ManakaiDISElement.disGetAttribute>
3361     (<Q::dis:Name>, for_arg => $forArg,
3362 wakaba 1.49 forp_arg => $forpArg,
3363     database_arg => $self);
3364 wakaba 1.5 if ($n_node) {
3365     if ($parentResource) {
3366     my $puri = $parentResource->{uri};
3367     my $ru;
3368 wakaba 1.86 my $ruf;
3369 wakaba 1.14 my $ln = $n_node-><M::swcfg21:SWCFGNode
3370     ::swcfg21:ForLatest.value>;
3371 wakaba 1.5 __CODE{getChildResourceURI:: $parentURI => $puri,
3372     $localName => $ln,
3373     $result => $ru}__;
3374 wakaba 1.86 __CODE{tfurisToURI:: $turi => $ru, $furi => $forArg,
3375     $uri => $ruf}__;
3376     push @res_uri, $ruf;
3377     $res = $self-><M::DISDatabase.getResource> ($ruf);
3378 wakaba 1.59 my $v = $n_node-><M::SWCFGNode.value>;
3379     __CODE{DISPerl|HashStringRef||ManakaiDOM|all::
3380     $result => {$res->{localName}},
3381     $given => {$v},
3382     }__;
3383 wakaba 1.53 $res->{<H::DIS|isAnon>} = true;
3384 wakaba 1.5 } else { ## Root local name resource
3385 wakaba 1.48 my $ln = $n_node-><M::SWCFGNode.value>;
3386     my $ns_uri = $mod-><AG::DISAnyResource.sourceElement>
3387     -><AG::DISModuleElement.definingNamespaceURI>;
3388 wakaba 1.7 my $qn_uri = $ns_uri . $ln;
3389 wakaba 1.86 my $qn_urif;
3390     __CODE{tfurisToURI:: $turi => $qn_uri, $furi => $forArg,
3391     $uri => $qn_urif}__;
3392     push @res_uri, $qn_urif;
3393     $res = $self-><M::DISDatabase.getResource> ($qn_urif);
3394 wakaba 1.48 if ($res-><AG::DISAnyResource.isDefined>) {
3395 wakaba 1.65 last ALD if defined $al_canon_uri and
3396     $res->{aliasURI}->{$al_canon_uri};
3397 wakaba 1.6 __UNDEEP{
3398     __EXCEPTION{RESOURCE_ALREADY_DEFINED_ERR::
3399 wakaba 1.48 DIS:uri => {$res-><AG::DISAnyResource.uri>},
3400 wakaba 1.6 DIS:sourceNode => {$n_node},
3401 wakaba 1.48 DIS:anotherSourceNode
3402     => {$res-><AG::DISAnyResource.sourceElement>},
3403 wakaba 1.6 }__;
3404     }__;
3405     }
3406 wakaba 1.59 __CODE{DISPerl|HashStringRef||ManakaiDOM|all::
3407     $result => {$res->{namespaceURI}},
3408     $given => {$ns_uri},
3409     }__;
3410     __CODE{DISPerl|HashStringRef||ManakaiDOM|all::
3411     $result => {$res->{localName}},
3412     $given => {$ln},
3413     }__;
3414 wakaba 1.5 }
3415     } else {
3416 wakaba 1.86 push @res_uri, $node_uri;
3417 wakaba 1.48 $res = $self-><M::DISDatabase.getResource> ($node_uri);
3418 wakaba 1.53 $res->{<H::DIS|isAnon>} = true;
3419 wakaba 1.5 }
3420 wakaba 1.6 } # anon
3421 wakaba 1.59 __CODE{DISPerl|HashStringRef||ManakaiDOM|all::
3422     $result => {$res->{for}},
3423     $given => {$forArg},
3424     }__;
3425 wakaba 1.5 $res->{forp} = $forpArg;
3426     $res->{src} = $el;
3427 wakaba 1.53 $res->{<H::DIS|definingModule>} = \ ($mod->{uri});
3428 wakaba 1.54 $res-><AS::DIS|ManakaiDISResourceDefinition.parentResource>
3429     ($parentResource) if $parentResource;
3430     $res-><AS::DIS|ManakaiDISResourceDefinition.dynamicParentResource>
3431     ($dynParent) if $dynParent;
3432 wakaba 1.9 unless ($res->{uri} eq $node_uri) {
3433 wakaba 1.86 push @res_uri, $node_uri;
3434 wakaba 1.48 my $nu_res = $self-><M::DISDatabase.getResource> ($node_uri);
3435     $res-><M::DISResource.mergeAsAlias> ($nu_res);
3436 wakaba 1.9 }
3437 wakaba 1.53 $res->{<H::DIS|isDefined>} = true;
3438 wakaba 1.9 $res->{seq} = $self->{seq}++;
3439 wakaba 1.50 $res-><AS::DISAnyResource.sourceNodeIDRef> ($node_id);
3440 wakaba 1.79 __CODE{setRevision:: $resource => $res}__;
3441 wakaba 1.86 $mod-><M::DISModule.addResourceURI> ($_) for @res_uri;
3442 wakaba 1.9
3443 wakaba 1.6 ## -- Alias
3444     if ($al_node) {
3445 wakaba 1.54 my $canon_res = $self-><M::DISDatabase.getResource> ($al_canon_uri);
3446 wakaba 1.48 $canon_res-><AS::DISAnyResource.isReferred> ($al_node);
3447     $canon_res-><M::DISResource.mergeAsAlias> ($res, node => $al_node);
3448 wakaba 1.6 $res = $canon_res;
3449     }
3450 wakaba 1.54 } # ALD
3451 wakaba 1.5
3452 wakaba 1.11 ## -- Registers as child
3453 wakaba 1.54 $parentResource-><M::DIS|ManakaiDISResourceDefinition
3454     .addChildResource> ($res)
3455 wakaba 1.11 if $parentResource;
3456 wakaba 1.54 $dynParent-><M::DIS|ManakaiDISResourceDefinition
3457     .addDynamicChildResource> ($res)
3458 wakaba 1.11 if $dynParent;
3459    
3460 wakaba 1.7 my $is_multires = false;
3461     my @props;
3462     my @cres;
3463 wakaba 1.48 my @ce0 = @{$el-><M::DISElement.disChildElements>
3464 wakaba 1.49 (for_arg => $forArg, forp_arg => $forpArg,
3465     database_arg => $self)};
3466     my $has_type = $al_node;
3467 wakaba 1.7 while (@ce0) {
3468     my $ce = shift @ce0;
3469 wakaba 1.81 if ($ce-><M::DISElement.elementTypeMatch>
3470     (<Q::DISCore|resourceType>, database_arg => $self) or
3471     $ce-><M::DISElement.elementTypeMatch> (<Q::rdf:type>,
3472 wakaba 1.49 database_arg => $self)) {
3473 wakaba 1.81 ## TODO: Remove this.
3474 wakaba 1.49 $has_type = true;
3475 wakaba 1.48 my $type_uri = $ce-><AG::DISElement.qnameValueURI>;
3476     my $type = $self-><M::DISDatabase.getResource> ($type_uri);
3477 wakaba 1.80 $res-><M::DISAnyResource.addTypeURI> ($type_uri);
3478 wakaba 1.48 $type-><AS::DISAnyResource.isReferred> ($ce);
3479     if ($type-><M::DISResource.isSubsetOfURI>
3480 wakaba 1.7 (<Q::dis:MultipleResource>)) {
3481     $is_multires = true;
3482     }
3483 wakaba 1.48 } elsif ($ce-><M::DISElement.elementTypeMatch>
3484 wakaba 1.49 (<Q::dis:subsetOf>,
3485     database_arg => $self)) {
3486 wakaba 1.48 my $sres = $self-><M::DISDatabase.getResource>
3487     ($ce-><M::DISElement.tfqnamesValueURI>
3488 wakaba 1.50 ($$node_id, $forArg,
3489 wakaba 1.49 for_arg => $forArg, forp_arg => $forpArg,
3490     database_arg => $self));
3491 wakaba 1.48 $res-><M::DISResource.addSuperResource> ($sres);
3492     } elsif ($ce-><AG::DISElement.isResourceElement>) {
3493 wakaba 1.7 push @cres, $ce;
3494 wakaba 1.48 } elsif ($ce-><M::DISElement.elementTypeMatch>
3495 wakaba 1.49 (<Q::dis:dataType>,
3496     database_arg => $self)) {
3497 wakaba 1.48 my $uri = $ce-><AG::DISElement.qnameValueURI>;
3498     __CODE{dv:createURI::
3499     $uri => $uri,
3500     $result => {$res->{<Q::dis:dataType>}},
3501 wakaba 1.60 $name => {$ce-><AG::SWCFGElement.expandedURI>},
3502 wakaba 1.48 }__;
3503     my $type = $self-><M::DISDatabase.getResource> ($uri);
3504     $type-><AS::DISAnyResource.isReferred> ($ce);
3505     } elsif ($ce-><M::DISElement.elementTypeMatch>
3506 wakaba 1.49 (<Q::dis:multipleProperties>,
3507     database_arg => $self)) {
3508 wakaba 1.48 my $uri = $ce-><AG::DISElement.qnameValueURI>;
3509     __CODE{dv:createURI::
3510     $uri => $uri,
3511     $result => {$res->{<Q::dis:multipleProperties>}},
3512 wakaba 1.60 $name => {$ce-><AG::SWCFGElement.expandedURI>},
3513 wakaba 1.48 }__;
3514     my $type = $self-><M::DISDatabase.getResource> ($uri);
3515     $type-><AS::DISAnyResource.isReferred> ($ce);
3516 wakaba 1.7 } else {
3517     ## Property and invalid element is not checked, since not
3518     ## all property definitions has loaded at this stage.
3519     push @props, $ce;
3520     }
3521     } # @ce0
3522    
3523 wakaba 1.49 unless ($has_type) {
3524     __UNDEEP{__EXCEPTION{NO_RDF_TYPE_ERR::
3525     DIS:uri => {$res->{uri}},
3526     DIS:sourceNode => {$el},
3527     }__}__;
3528     }
3529    
3530 wakaba 1.85 my $srres = $srinfo->{resource}->{$res-><AG::DISAnyResource.uri>};
3531     F: for my $auri (%{$srres->{aliasURI} or {}}) {
3532     next F unless $srres->{aliasURI}->{$auri};
3533     $res->{aliasURI}->{$auri} = true;
3534     A: for (keys %{$res->{subOf} or {}}) {
3535     next A unless $res->{subOf}->{$_};
3536     my $s = $self-><M::DISDatabase.getResource> ($_);
3537     $s->{supOf}->{$auri} = true;
3538     }
3539     A: for (keys %{$res->{supOf} or {}}) {
3540     next A unless $res->{supOf}->{$_};
3541     my $s = $self-><M::DISDatabase.getResource> ($_);
3542     $s->{subOf}->{$auri} = true;
3543     }
3544     }
3545     F: for my $suri (keys %{$srres->{supOf} or {}}) {
3546     next F unless $srres->{supOf}->{$suri};
3547     my $sres = $self-><M::DISDatabase.getResource> ($suri);
3548     $sres-><M::DISResource.addSuperResource> ($res);
3549     }
3550    
3551 wakaba 1.7 ## -- Child resources
3552     unless ($is_multires) {
3553     for my $re (@cres) {
3554     unless ($al_node) {
3555     $self-><M::ManakaiDISDatabase.loadResource>
3556     ($mod, $res, $res, $re,
3557 wakaba 1.32 for_arg => $forArg, forp_arg => $forpArg,
3558 wakaba 1.85 on_resource_read => $onResourceRead,
3559     srinfo => $srinfo);
3560 wakaba 1.5 } else {
3561 wakaba 1.7 my $ac = $re-><M::ManakaiDISElement.disGetAttribute>
3562     (<Q::dis:aliasChild>, for_arg => $forArg,
3563 wakaba 1.49 forp_arg => $forpArg,
3564     database_arg => $self);
3565 wakaba 1.48 if ($ac and $ac-><M::SWCFGNode.value>) {
3566 wakaba 1.7 $self-><M::ManakaiDISDatabase.loadResource>
3567     ($mod, $res, $res, $re,
3568 wakaba 1.32 for_arg => $forArg, forp_arg => $forpArg,
3569 wakaba 1.85 on_resource_read => $onResourceRead,
3570     srinfo => $srinfo);
3571 wakaba 1.7 }
3572 wakaba 1.4 }
3573     }
3574 wakaba 1.7 }
3575 wakaba 1.5
3576 wakaba 1.7 ## -- Multiple representations
3577     if ($is_multires) {
3578     for my $pe (@props) {
3579     if ($pe-><M::ManakaiDISElement.elementTypeMatch>
3580 wakaba 1.49 (<Q::dis:resourceFor>,
3581     database_arg => $self)) {
3582 wakaba 1.14 my $for_uri = $pe-><AG::ManakaiDISElement.qnameValueURI>;
3583 wakaba 1.7 my $for = $self-><M::ManakaiDISDatabase.getFor> ($for_uri);
3584 wakaba 1.48 $for-><AS::DISAnyResource.isReferred> ($pe);
3585 wakaba 1.7 $self-><M::ManakaiDISDatabase.loadResource>
3586     ($mod, $parentResource, $res, $el,
3587     for_arg => $forArg,
3588 wakaba 1.32 forp_arg => [@{$forpArg}, $for_uri],
3589 wakaba 1.85 on_resource_read => $onResourceRead,
3590     srinfo => $srinfo);
3591 wakaba 1.7 }
3592     }
3593     }
3594 wakaba 1.48 ($onResourceRead or sub {})->($self, $res);
3595     }__; # DEEP
3596 wakaba 1.2
3597 wakaba 1.48 @Method:
3598     @@Name: readProperties
3599     @@enDesc:
3600     Reads property values in the source tree and
3601     removes the source tree from the database.
3602     @@NamedParam:
3603     @@@Name: onResourceRead
3604     @@@Type:
3605 wakaba 1.60 DISPerl:CODE::ManakaiDOM:all
3606 wakaba 1.48 @@@enDesc:
3607     An event handler called when a resource is read.
3608     @@@nullCase:
3609     @@@@enDesc:
3610     No event handler is read.
3611     @@Return:
3612     @@@RaiseException:
3613     @@@@@: UNSUPPORTED_ELEMENT_TYPE_ERR
3614     @@@@enDesc:
3615     There is an element whose element type is not supported.
3616 wakaba 1.2 @@@PerlDef:
3617 wakaba 1.48 __DEEP{
3618     for my $fd (values %{$self->{modDef}},
3619     values %{$self->{forDef}},
3620     values %{$self->{resDef}}) {
3621     if ($fd-><AG::DISAnyResource.isDefined>) {
3622     $fd-><M::DISAnyResource.readProperties>
3623     (on_resource_read => $onResourceRead);
3624     }
3625     }
3626 wakaba 1.53 CORE::delete $self->{<H::DIS|sourceFile>};
3627 wakaba 1.48 }__;
3628 wakaba 1.10
3629 wakaba 1.48 @Method:
3630     @@Name: checkUndefinedResource
3631 wakaba 1.44 @@enDesc:
3632 wakaba 1.48 Checks whether there is referred but undefined resource or not.
3633     @@Return:
3634     @@@RaiseException:
3635     @@@@@: FOR_NOT_DEFINED_ERR
3636     @@@@enDesc:
3637     There is a <QUOTE::for> that is referred but not defined.
3638     @@@RaiseException:
3639     @@@@@: RESOURCE_NOT_DEFINED_ERR
3640     @@@@enDesc:
3641     There is a resource that is referred but not defined.
3642 wakaba 1.44 @@@PerlDef:
3643 wakaba 1.48 for my $fd (values %{$self->{forDef}}) {
3644     if (my $ref = $fd-><AG::DISAnyResource.isReferred> and
3645     not $fd-><AG::DISAnyResource.isDefined>) {
3646     __EXCEPTION{FOR_NOT_DEFINED_ERR::
3647     DIS:uri => {$fd-><AG::DISAnyResource.uri>},
3648     DIS:sourceNodePath => {$ref},
3649     }__;
3650     }
3651     }
3652     for my $fd (values %{$self->{resDef}}) {
3653     if (my $ref = $fd-><AG::DISAnyResource.isReferred> and
3654     not $fd-><AG::DISAnyResource.isDefined>) {
3655     __EXCEPTION{RESOURCE_NOT_DEFINED_ERR::
3656     DIS:uri => {$fd-><AG::DISAnyResource.uri>},
3657     DIS:sourceNodePath => {$ref},
3658     }__;
3659     }
3660     }
3661 wakaba 1.85
3662     @Method:
3663     @@Name: unloadModule
3664     @@enDesc:
3665     Removes a module and resources defined in the module
3666     from the database.
3667     @@Param:
3668     @@@Name: module
3669     @@@Type: DISModule
3670     @@@enDesc:
3671     The module to remove.
3672     @@NamedParam:
3673     @@@Name: srinfo
3674     @@@Type: DISPerl|HASH||ManakaiDOM|all
3675     @@@enDesc:
3676     A hash returned by <M::DISDatabase.unloadModule>, to
3677     restore super-resource relationship later. The hash
3678     returned by the method is built based on this value.
3679     @@@nullCase:
3680     @@@@enDesc:
3681     If it is not the updating.
3682     @@Return:
3683     @@@Type: DISPerl|HASH||ManakaiDOM|all
3684     @@@enDesc:
3685     {LI:: <CODE::resource> or <CODE::for>:::
3686    
3687     {LI:: <VAR::Resource URI>:::
3688    
3689     {LI:: <CODE::supOf>:::
3690    
3691     - <VAR::Superset URI>::: A <DOM::true> value
3692    
3693     where <VAR::resource URI> is a URI of the resource
3694     (either canonical URI or an alias URI defined within
3695     the module) and <VAR::superset URI> is a URI
3696     from the list of superset URI of the resource minus
3697     the list of alias URIs (including the canonical URI)
3698     of the resource.
3699    
3700     }
3701    
3702     {LI:: <CODE::aliasURI>:::
3703    
3704     - <VAR::Alias URI>::: A <DOM::true> value
3705    
3706     where <VAR::alias URI> is an alias URI of the resource
3707     defined by other module.
3708    
3709     }
3710     }
3711     }
3712     @@@PerlDef:
3713     __DEEP{
3714     $r = $srinfo || {};
3715    
3716     ## -- |For|s
3717     F: for my $for (@{$module-><M::DISModule.getForResourceList>}) {
3718     my $uri = $for-><AG::DISAnyResource.uri>;
3719     A: for (%{$for->{ISA} or {}}) {
3720     next A unless $for->{ISA}->{$_};
3721     my $sfor = $self-><M::DISDatabase.getFor> ($_);
3722     next A unless $sfor;
3723     delete $sfor->{revISA}->{$uri};
3724     }
3725     A: for (%{$for->{revISA} or {}}) {
3726     next A unless $for->{revISA}->{$_};
3727     my $sfor = $self-><M::DISDatabase.getFor> ($_);
3728     next A unless $sfor;
3729     delete $sfor->{ISA}->{$uri};
3730     $r->{for}->{$uri}->{supOf}->{$_} = true;
3731     }
3732     delete $self->{forDef}->{$uri};
3733     delete $self->{<H::DIS|resourceModuleMap>}->{$uri};
3734     } # F
3735    
3736     ## -- Resources
3737 wakaba 1.86 my @res_list = map {
3738     [$_, $self-><M::DISDatabase.getResource> ($_)]
3739     } @{$module-><M::DISModule.getResourceURIList>};
3740     my %res_list = map {$_->[0] => true} @res_list;
3741     for my $ur (@res_list) {
3742     my $uri = $ur->[0];
3743     my $res = $ur->[1];
3744     my $owner = $res-><AG::DISAnyResource.ownerModule>;
3745     if (defined $owner and $owner eq $module) {
3746 wakaba 1.85 ## Non-alias
3747     my %alias;
3748     my %sub = %{$res->{supOf} or {}};
3749     A: for (keys %{$res->{aliasURI} or {}}) {
3750     next A unless $res->{aliasURI}->{$_};
3751     $alias{$_} = true;
3752     delete $sub{$_} if $res->{aliasURI}->{$_};
3753     $r->{resource}->{$uri}->{supOf} = \%sub;
3754     unless ($res_list{$_}) {
3755     ## Defined by other module
3756     $r->{resource}->{$uri}->{aliasURI}->{$_} = true;
3757     }
3758     }
3759     A: for (keys %{$res->{subOf} or {}}) {
3760     next A unless $res->{aliasURI}->{$_};
3761     my $sres = $self-><M::DISDatabase.getResource> ($_);
3762     next A unless $sres;
3763     delete $res->{supOf}->{$_} for keys %alias;
3764     }
3765     A: for (keys %{$res->{supOf} or {}}) {
3766     next A unless $res->{aliasURI}->{$_};
3767     my $sres = $self-><M::DISDatabase.getResource> ($_);
3768     next A unless $sres;
3769     delete $res->{subOf}->{$_} for keys %alias;
3770     }
3771     A: for (keys %alias) {
3772     delete $self->{resDef}->{$_};
3773     delete $self->{<H::DIS|resourceModuleMap>}->{$_};
3774     }
3775     } else {
3776     ## Alias
3777     delete $res->{aliasURI}->{$uri};
3778     delete $res->{subOf}->{$uri};
3779     delete $res->{supOf}->{$uri};
3780 wakaba 1.86 A: for (keys %{$res->{subOf} or {}}) {
3781 wakaba 1.85 next A unless $res->{subOf}->{$_};
3782     my $sres = $self-><M::DISDatabase.getResource> ($_);
3783     next A unless $sres;
3784     delete $sres->{supOf}->{$uri};
3785     }
3786 wakaba 1.86 A: for (keys %{$res->{supOf} or {}}) {
3787 wakaba 1.85 next A unless $res->{supOf}->{$_};
3788     my $sres = $self-><M::DISDatabase.getResource> ($_);
3789     next A unless $sres;
3790     delete $sres->{subOf}->{$uri};
3791     }
3792     delete $self->{resDef}->{$uri};
3793     delete $self->{<H::DIS|resourceModuleMap>}->{$uri};
3794     }
3795     }
3796    
3797     ## -- Keys
3798     my $v = $module->{<H::dp|plHashKey>};
3799     K: for my $scope (keys %{$v or {}}) {
3800     L: for my $key (keys %{$v->{$scope} or {}}) {
3801     next L unless $v->{$scope}->{$key};
3802     delete $self->{<H::dp|plHashKey>}->{$scope}->{$key};
3803     }
3804     }
3805    
3806     ## -- Module itself
3807     for (@{$module-><AG::DISAnyResource.uris>}) {
3808     delete $self->{modDef}->{$_};
3809     }
3810     }__;
3811 wakaba 1.48
3812     @Method:
3813     @@Name: xcrefToResource
3814 wakaba 1.10 @@enDesc:
3815 wakaba 1.48 Returns a resource object selected by an exception code
3816     reference (<Q::DOMMain:XCodeRef>).
3817 wakaba 1.10 @@Param:
3818 wakaba 1.48 @@@Name: xcref
3819 wakaba 1.10 @@@Type:
3820 wakaba 1.48 DOMMain:XCodeRef::ManakaiDOM:all
3821 wakaba 1.10 @@@enDesc:
3822 wakaba 1.48 Exception code to select.
3823 wakaba 1.2 @@Param:
3824 wakaba 1.48 @@@Name: contextNode
3825 wakaba 1.50 @@@Type: NSResolverDIS
3826 wakaba 1.48 @@@enDesc:
3827     A context element node. Namespace prefixes in
3828     <P::xcref> are resolved against this node.
3829     @@ForParam:
3830     @@NodeParam:
3831 wakaba 1.2 @@Return:
3832     @@@Type:
3833 wakaba 1.60 DISPerl:ARRAY::ManakaiDOM:all
3834 wakaba 1.48 @@@enDesc:
3835     A reference to the array containing two or three
3836     resource definitions (<Class::ManakaiDISResourceDefinition>).
3837     The first (index <CODE::0>) resource is an exception class.
3838     The second (index <CODE::1>) resource is an exception code
3839     constant. The third (index <CODE::2>) resource
3840     is an exception subtype or <DOM::null> if the reference identifies
3841     no subtype.
3842     @@@RaiseException:
3843     @@@@@: RESOURCE_NOT_DEFINED_ERR
3844 wakaba 1.2 @@@@enDesc:
3845 wakaba 1.48 The resource identified by the <P::xcref> is not defined
3846     or not an exception.
3847 wakaba 1.2 @@@PerlDef:
3848 wakaba 1.48 my ($q1, $q2, $q3) = split /\s*\.\s*/, $xcref, 3;
3849     __DEEP{
3850     if (defined $q3) {
3851     $r->[2] = $self-><M::ManakaiDISDatabase.getResource>
3852     ($contextNode-><M::NSResolverDIS.tfqnamesToURI>
3853     ($q3, null, $forArg, node => $node));
3854 wakaba 1.54 $r->[1] = $r->[2]-><AG::DIS|DISResource.parentResource>;
3855 wakaba 1.48 } elsif (defined $q2) {
3856     if ($q2 =~ /:/) {
3857     $r->[1] = $self-><M::ManakaiDISDatabase.getResource>
3858     ($contextNode-><M::NSResolverDIS.tfqnamesToURI>
3859     ($q2, null, $forArg, node => $node));
3860     } else {
3861     $r->[0] = $self-><M::ManakaiDISDatabase.getResource>
3862     ($contextNode-><M::NSResolverDIS.tfqnamesToURI>
3863     ($q1, null, $forArg, node => $node));
3864     $r->[1] = $r->[0]-><M::ManakaiDISResourceDefinition
3865     .getConstResourceByName> ($q2);
3866     }
3867     } else { ## $q1 only
3868     $r->[2] = $self-><M::ManakaiDISDatabase.getResource>
3869     ($contextNode-><M::NSResolverDIS.tfqnamesToURI>
3870     ($q1, null, $forArg, node => $node));
3871 wakaba 1.79 if ($r->[2]-><M::DISAnyResource.isTypeURI> (<Q::dx:ErrorSubCode>)) {
3872 wakaba 1.54 $r->[1] = $r->[2]-><AG::DIS|DISResource.parentResource>;
3873 wakaba 1.48 } else {
3874     $r->[1] = $r->[2]; CORE::delete $r->[2];
3875     }
3876     }
3877 wakaba 1.2
3878 wakaba 1.48 if ($r->[2] and
3879 wakaba 1.79 not $r->[2]-><M::DISAnyResource
3880 wakaba 1.64 .isTypeURI> (<Q::dx:ErrorSubCode>)) {
3881 wakaba 1.48 __UNDEEP{__EXCEPTION{RESOURCE_NOT_DEFINED_ERR::
3882     DIS:uri => {$r->[2]->{uri}},
3883 wakaba 1.64 DIS:expectedType => {<Q::dx:ErrorSubCode>},
3884 wakaba 1.48 DIS:sourceNode => {$node},
3885     DIS:sourceCode => {$xcref},
3886     }__}__;
3887     }
3888     $r->[2]-><AS::DISAnyResource.isReferred>
3889     ($node or $contextNode)
3890     if $r->[2];
3891    
3892     if (not $r->[1] or
3893 wakaba 1.79 not $r->[1]-><M::DISAnyResource
3894 wakaba 1.48 .isTypeURI> (<Q::ManakaiDOM:Const>)) {
3895     __UNDEEP{__EXCEPTION{RESOURCE_NOT_DEFINED_ERR::
3896 wakaba 1.63 DIS:uri => {($r->[1] ? $r->[1]-><AG::DIS|DISAnyResource.uri>
3897     : null)},
3898     DIS:localName => {($r->[1] ? $r->[1]-><AG::DIS|DISAnyResource
3899     .localName> : null)},
3900 wakaba 1.48 DIS:expectedType => {<Q::ManakaiDOM:Const>},
3901     DIS:sourceNode => {$node},
3902     DIS:sourceCode => {$xcref},
3903     }__}__;
3904     }
3905     $r->[1]-><AS::DISAnyResource.isReferred>
3906     ($node or $contextNode);
3907 wakaba 1.5
3908 wakaba 1.48 unless ($r->[0]) {
3909 wakaba 1.54 my $cg = $r->[1]-><AG::DIS|DISResource.parentResource>;
3910     $r->[0] = $cg-><AG::DIS|DISResource.parentResource> if $cg;
3911 wakaba 1.48 }
3912     if (not $r->[0] or
3913 wakaba 1.79 not $r->[0]-><M::DISAnyResource
3914 wakaba 1.60 .isTypeURI> (<Q::dx:AnyExceptionAnyClass>)) {
3915 wakaba 1.48 __UNDEEP{__EXCEPTION{RESOURCE_NOT_DEFINED_ERR::
3916     DIS:uri => {$r->[0]->{uri}},
3917 wakaba 1.59 DIS:localName => {$r->[0]-><AG::DIS|DISAnyResource.localName>},
3918 wakaba 1.60 DIS:expectedType => {<Q::dx:AnyExceptionAnyClass>},
3919 wakaba 1.48 DIS:sourceNode => {$node},
3920     DIS:sourceCode => {$xcref},
3921     }__}__;
3922 wakaba 1.5 }
3923 wakaba 1.48 $r->[0]-><AS::DISAnyResource.isReferred>
3924     ($node or $contextNode);
3925 wakaba 1.7 }__;
3926 wakaba 1.5
3927 wakaba 1.38 @Method:
3928     @@Name: getFeature
3929     @@Description:
3930     @@@lang:en
3931     @@@@:
3932     Returns a specialized object that implements the specialized
3933     interfaces of the specified feature and version.
3934     @@Param:
3935     @@@Name: feature
3936     @@@Type:
3937     DISLang:String::ManakaiDOM:all
3938     @@@actualType:
3939     ManakaiDOM:ManakaiDOMFeatureName::ManakaiDOM:ManakaiDOMLatest
3940     @@@Description:
3941     @@@@lang:en
3942     @@@@@:
3943     A feature name to request.
3944     @@Param:
3945     @@@Name: version
3946     @@@Type:
3947     DISLang:String::ManakaiDOM:all
3948     @@@actualType:
3949     ManakaiDOM:ManakaiDOMFeatureVersion::ManakaiDOM:ManakaiDOMLatest
3950     @@@Description:
3951     @@@@lang:en
3952     @@@@@:
3953     A feature version number to request.
3954     @@Return:
3955 wakaba 1.39 @@@Type:
3956     DOMMain:Object::ManakaiDOM:all
3957 wakaba 1.38 @@@Description:
3958     @@@@lang:en
3959     @@@@@:
3960     An object that implements the specialized APIs of the
3961     <P::feature> and <P::version>.
3962 wakaba 1.49 @@@nullCase:
3963     @@@@enDesc:
3964 wakaba 1.38 There is no object available that implements interfaces
3965     associated with the <P::feature> and <P::version>.
3966     @@@PerlDef:
3967     $feature =~ s/^\+//;
3968     CLASS: for my $class (grep {
3969 wakaba 1.48 $Message::Util::DIS::ManakaiDISDatabase::CompatClass{$_}
3970     } keys %Message::Util::DIS::ManakaiDISDatabase::CompatClass) {
3971 wakaba 1.38 if ($Message::DOM::ClassFeature{$class}->{$feature}->{$version}) {
3972 wakaba 1.39 $r = bless {o => $self}, $class;
3973 wakaba 1.38 last CLASS;
3974     }
3975     }
3976    
3977 wakaba 1.22 @Method:
3978 wakaba 1.48 @@Name: free
3979 wakaba 1.22 @@enDesc:
3980 wakaba 1.48 Marks the database, resources in the database, and source
3981     <QUOTE::dis> document trees in the database as no longer used.
3982     @@ForCheck: ManakaiDOM|ForClass
3983 wakaba 1.22 @@Return:
3984     @@@PerlDef:
3985 wakaba 1.53 for my $file (values %{$self->{<H::DIS|sourceFile>}}) {
3986 wakaba 1.48 $file-><M::ManakaiNode|ManakaiNodeRef||ManakaiDOM|Perl.free>
3987     if $file;
3988     }
3989     CORE::delete $self->{modDef};
3990     CORE::delete $self->{forDef};
3991     CORE::delete $self->{resDef};
3992 wakaba 1.62
3993     @Method:
3994     @@Name: getModuleURIList
3995     @@enDesc:
3996     Returns a snapshot list of URIs of modules in the database.
3997     @@Return:
3998     @@@Type: DISPerl|ARRAY||ManakaiDOM|all
3999     @@@enDesc:
4000     A snapshot list of URIs.
4001     @@@PerlDef:
4002     $r = [map {$_-><AG::DIS|DISAnyResource.uri>} values %{$self->{modDef}}];
4003    
4004     @Method:
4005     @@Name: getAnyResourceURIList
4006     @@enDesc:
4007     Returns a snapshot list of URIs of resources in the database.
4008     @@Return:
4009     @@@Type: DISPerl|ARRAY||ManakaiDOM|all
4010     @@@enDesc:
4011     A snapshot list of URIs.
4012     @@@PerlDef:
4013     $r = [keys %{$self->{<H::DIS|resourceModuleMap>}},
4014     map {$_-><AG::DIS|DISAnyResource.uri>} values %{$self->{modDef}}];
4015 wakaba 1.81
4016     @IntMethod:
4017     @@Operator: ManakaiDOM|MUErrorHandler
4018     @@enDesc:
4019     When a <IF::ecore|ErrorInterface||ManakaiDOM|Perl> is <Perl::report>ed
4020     with an <Perl::-object> of <IF::Node>, then this method is invoked.
4021    
4022     The method calls the <cfg::error-handler> if the error is of
4023     <IF::c|DOMError>. Otherwise, including the cases of
4024     <IF::DOMCore|DOMException>s,
4025     the error is rethrown so that appropriate <Perl::catch> clause
4026     can catch the error.
4027     @@enImplNote:
4028     For implementations which does not have the
4029     <IF::c|DOMError||ManakaiDOM|ManakaiDOM3> interface, the method
4030     is defined in the <Class::ManakaiDOM|ManakaiDOMObject> class
4031     and it is not overridden here.
4032     @@Param:
4033     @@@Name: err
4034     @@@Type: ecore|ErrorInterface||ManakaiDOM|Perl
4035     @@@enDesc:
4036     The reported error object.
4037     @@Return:
4038     @@@Type: DISPerl|Any||ManakaiDOM|Perl
4039     @@@enDesc:
4040     If the <P::err> is a <IF::c|DOMError>, then the return value
4041     of the error handler.
4042    
4043     {NOTE:: If the error is thrown, the method never returns.
4044     }
4045     @@@nullCase:
4046     @@@@enDesc:
4047     No error handler.
4048     @@@PerlDef:
4049     if ($err->isa (<IFName::c|DOMError||ManakaiDOM|ManakaiDOM>)) {
4050     __DEEP{
4051     my $cfg = $self-><AG::DISDatabase.domConfig>;
4052     my $h = $cfg-><M::DOMConfig.getParameter> ('error-handler');
4053 wakaba 1.83 $r = $h-><M::DOMCore|DOMErrorHandler||ManakaiDOM|ManakaiDOMLatest
4054     .handleError> ($err);
4055 wakaba 1.81 }__;
4056     } else {
4057     $err-><M::ecore|ErrorInterface||ManakaiDOM|Perl.throw>;
4058     }
4059    
4060     @Attr:
4061     @@Name: domConfig
4062     @@enDesc:
4063     The configuration of the document.
4064     @@Get:
4065     @@@Type: DOMConfig
4066     @@@enDesc: The DOM configuration object.
4067     @@@PerlDef:
4068     __CODE{c|getConfigObject||ManakaiDOM|ManakaiDOMLatest::
4069     $target => $self,
4070     $targetHash => {$self},
4071     $targetType => {<IFName::DISDatabase>},
4072     $result => $r,
4073     }__;
4074 wakaba 1.85
4075     @Method:
4076     @@Name: getModuleResourceList
4077     @@enDesc:
4078     Returns a snapshot list of modules contained in the database.
4079     @@Return:
4080     @@@Type: ResourceList
4081     @@@enDesc:
4082     A snapshot list of the modules.
4083     @@@PerlDef:
4084     $r = [map {$self->{modDef}->{$_}}
4085     grep {defined $self->{modDef}->{$_}}
4086     keys %{$self->{modDef}}];
4087 wakaba 1.48 ##DISDatabase
4088    
4089 wakaba 1.81 CParamApp:
4090     @c:domConfigurationParameter: c|error-handler||ManakaiDOM|ManakaiDOMLatest
4091     @c:targetType: DISDatabase
4092    
4093     ElementTypeBinding:
4094     @Name: CParamApp
4095     @ElementType:
4096     dis:ResourceDef
4097     @ShadowContent:
4098     @@rdf:type: c|DOMConfigurationParameterApplication
4099     @@For: DIS|ForLatest
4100    
4101 wakaba 1.48 PropDef:
4102 wakaba 1.54 @QName: DIS|resourceModuleMap
4103     @enDesc:
4104     Resource-module mapping table.
4105     @DIS:key: rm
4106     @Type: DISPerl|HASH
4107    
4108     PropDef:
4109 wakaba 1.48 @QName: sourceNodeID
4110     @enDesc:
4111     The URI reference of the source node identifier.
4112 wakaba 1.55 @rdfs:domain: DIS|DISResource||DIS|ForEmpty
4113     @DIS:key: snid
4114     @Type: DISPerl|SCALAR
4115 wakaba 1.24
4116 wakaba 1.48 PropDef:
4117 wakaba 1.55 @QName: DIS|resource
4118     @enDesc:
4119 wakaba 1.48 Resources defined in a module.
4120 wakaba 1.55 @rdfs:range: DIS|DISResource||DIS|ForEmpty
4121     @rdfs:domain: DIS|DISModule||DIS|ForEmpty
4122     @DIS:key: mres
4123     @Type: DISPerl|ARRAY
4124 wakaba 1.22
4125 wakaba 1.48 PropDef:
4126 wakaba 1.54 @QName: DIS|parentResource
4127 wakaba 1.48 @enDesc:
4128     Static parent resource. No parent for root resources.
4129 wakaba 1.54 @DIS:key: puri
4130 wakaba 1.27
4131 wakaba 1.48 PropDef:
4132 wakaba 1.54 @QName: DIS|dynamicParentResource
4133 wakaba 1.48 @enDesc:
4134     Dynamic parent resource. No parent for root resources.
4135 wakaba 1.54 @DIS:key: dpuri
4136 wakaba 1.25
4137 wakaba 1.48 PropDef:
4138 wakaba 1.54 @QName: DIS|childResource
4139 wakaba 1.48 @enDesc:
4140     Static child resources.
4141 wakaba 1.54 @DIS:key: curis
4142 wakaba 1.35
4143 wakaba 1.48 PropDef:
4144 wakaba 1.54 @QName: DIS|dynamicChildResource
4145 wakaba 1.48 @enDesc:
4146     Dynamic child resources.
4147 wakaba 1.54 @DIS:key: dcuris
4148    
4149     PropDef:
4150     @QName: DIS|key
4151     @enDesc:
4152     Property name in resource objects.
4153     @rdfs:subPropertyOf: DISPerl|propHashKey
4154     @dataType: DISCore|String
4155     @multipleProperties: DISCore|Single
4156    
4157     ResourceDef:
4158     @QName: DIS|DISResourceList
4159     @enDesc:
4160     A reference to array whose items are resource
4161     (<IF::DIS|DISAnyResource||DIS|ForEmpty>) objects.
4162     @rdfs:subClassOf: DISPerl|ARRAY
4163     @For: =ManakaiDOM|all
4164     @rdf:type: DISLang|DataType
4165     @For: DIS|ForEmpty !=DIS|ForEmpty
4166     @AliasFor:
4167     @@@@: ||ManakaiDOM|all
4168     @@@For: DIS|ForEmpty
4169 wakaba 1.38
4170 wakaba 1.48 ElementTypeBinding:
4171     @Name: ForDefDupException
4172     @ElementType:
4173     ManakaiDOM:raises
4174     @ShadowContent:
4175     @@@: FOR_ALREADY_DEFINED_ERR
4176     @@Description:
4177     @@@lang:en
4178     @@@@:
4179     The <QUOTE::for> is already defined elsewhere.
4180 wakaba 1.27
4181 wakaba 1.48 ElementTypeBinding:
4182     @Name: ForDefNoQNameException
4183     @ElementType:
4184     ManakaiDOM:raises
4185     @ShadowContent:
4186     @@@: NO_FOR_QNAME_ERR
4187     @@Description:
4188     @@@lang:en
4189     @@@@:
4190     A <Q::dis:ForDef> element must have a <Q::dis:QName> attribute.
4191 wakaba 1.22
4192 wakaba 1.48 ElementTypeBinding:
4193     @Name: ResDefDupException
4194     @ElementType:
4195     ManakaiDOM:raises
4196     @ShadowContent:
4197     @@@: RESOURCE_ALREADY_DEFINED_ERR
4198     @@Description:
4199     @@@lang:en
4200     @@@@:
4201     The <QUOTE::dis> resource is already defined elsewhere.
4202 wakaba 1.24
4203 wakaba 1.48 ElementTypeBinding:
4204     @Name: ElementNotAllowedException
4205     @ElementType:
4206     ManakaiDOM:raises
4207     @ShadowContent:
4208     @@@: ELEMENT_NOT_ALLOWED_ERR
4209     @@Description:
4210     @@@lang:en
4211     @@@@:
4212     An element has found where it is not allowed.
4213 wakaba 1.24
4214 wakaba 1.48 IFClsDef:
4215     @IFQName: DISModuleResolver
4216     @ClsQName: ManakaiDISModuleResolver
4217 wakaba 1.22
4218 wakaba 1.48 @enDesc:
4219     Objects implementing <IF::DISModuleResolver> interface
4220     are used to convert module name into <QUOTE::dis> document object.
4221     \
4222     {NOTE:: It is also acceptable to pass a <Perl::CODE> reference
4223     as a method parameter where <IF::DISModuleResolver> is
4224     expected.
4225     \
4226     }
4227 wakaba 1.24 @Method:
4228 wakaba 1.48 @@Name: uriToDocument
4229 wakaba 1.32 @@enDesc:
4230 wakaba 1.48 Returns a <QUOTE::dis> document from module name information.
4231     @@Param:
4232     @@@Name: disDB
4233     @@@Type: DISDatabase
4234     @@@clsActualType: ManakaiDISDatabase
4235     @@@enDesc:
4236     The <QUOTE::dis> database.
4237     @@Param:
4238     @@@Name: moduleURI
4239     @@@Type: ModuleURI
4240     @@@enDesc:
4241     The URI reference of the module.
4242     \
4243     {NOTE:: This parameter is redundant, since it can be
4244     composed from other three parameters.
4245     \
4246     }
4247     @@Param:
4248     @@@Name: moduleNamespaceURI
4249     @@@Type: AnyURI
4250     @@@enDesc:
4251     The namespace URI of the module name.
4252     @@Param:
4253     @@@Name: moduleLocalName
4254     @@@Type:
4255     DISCore:LocalName::ManakaiDOM:all
4256     @@@enDesc:
4257     The local name of the module name.
4258 wakaba 1.24 @@Param:
4259 wakaba 1.48 @@@Name: moduleFor
4260     @@@Type: ForURI
4261 wakaba 1.24 @@@enDesc:
4262 wakaba 1.48 The <QUOTE::for> URI reference for which the module is defined.
4263 wakaba 1.24 @@Return:
4264 wakaba 1.48 @@@Type: DISDocument
4265     @@@clsActualType: ManakaiDISDocument
4266 wakaba 1.24 @@@enDesc:
4267 wakaba 1.48 The <QUOTE::dis> document. It don't have to be a newly created
4268     object.
4269     @@@nullCase:
4270     @@@@enDesc:
4271     The method is unable to resolve the reference.
4272 wakaba 1.24 @@@PerlDef:
4273 wakaba 1.72 goto &$self;
4274 wakaba 1.48
4275     @ResourceDef:
4276     @@rdf:type: DISLang|InputProcessor
4277     @@PerlDef:
4278     $INPUT = bless $INPUT, <ClassName::ManakaiDISModuleResolver>
4279     if ref $INPUT eq 'CODE';
4280     ##DISModuleResolver
4281 wakaba 1.22
4282 wakaba 1.24 PropDef:
4283 wakaba 1.48 @QName: sourceFile
4284     @enDesc:
4285     Source <QUOTE::dis> documents.
4286     @rdfs:domain: DISDatabase
4287     @rdfs:range: DISDocument
4288    
4289     IFClsDef:
4290     @IFQName: DISAnyResource
4291     @ClsQName: ManakaiDISAnyResource
4292    
4293 wakaba 1.52 @ClsISA: DOMFeature|ManakaiHasFeatureByGetFeature||ManakaiDOM|ManakaiDOMLatest
4294    
4295 wakaba 1.24 @enDesc:
4296 wakaba 1.48 {P:: A <IF::DISAnyResource> object represents a resource defined
4297     in <QUOTE::dis> files. In <QUOTE::dis> model, resources are
4298     categorized as:
4299    
4300     - Module::: A <QUOTE::dis> module is a file entity.
4301     This kind of objects <kwd:MUST> implement the
4302     <IF::DISModule> interface.
4303    
4304     - <QUOTE::For>::: A <QUOTE::for> is a target for which
4305     resources are defined. This kind of objects
4306     <kwd:MUST> implement the <IF::DISFor> interface.
4307    
4308     - <QUOTE::dis> Resource::: Something described in <QUOTE::dis>.
4309     This kind of objects <kwd:MUST> implement the
4310     <IF::DISModule> interface.
4311 wakaba 1.24
4312 wakaba 1.48 }
4313 wakaba 1.22
4314 wakaba 1.48 The objects implementing this interface <kwd:MUST> also implement
4315     the <IF::DOMMinImpl> interface.
4316 wakaba 1.47
4317 wakaba 1.48 @Attr:
4318     @@Name: uri
4319     @@Type: AnyURI
4320     @@Description:
4321     @@@lang:en
4322     @@@@:
4323     The URI reference of the resource.
4324     @@Get:
4325     @@@enDesc:
4326     The representive URI reference of the resource.
4327 wakaba 1.21
4328 wakaba 1.48 {NOTE:: The URI might be non-persistent if the
4329     resource is not assigned a URI in <QUOTE::dis> source file,
4330     in which case a URI is randomly-generated at the
4331     time of object generation.
4332     }
4333     @@@PerlDef:
4334     $r = $self->{uri};
4335 wakaba 1.54
4336     @Attr:
4337     @@Name: uriRef
4338     @@Type: DISPerl|SCALAR||ManakaiDOM|all
4339     @@enDesc:
4340     A reference to the URI of the resource.
4341    
4342     {NOTE:: Applications <kwd:MUST-NOT> modify the referenced
4343     value directly.
4344     }
4345     @@Get:
4346     @@@PerlDef: $r = \ ($self->{uri});
4347 wakaba 1.48
4348     @Attr:
4349     @@Name: uris
4350     @@Type:
4351 wakaba 1.60 DISPerl:Array::ManakaiDOM:all
4352 wakaba 1.48 @@enDesc:
4353     A set of URIs that identifies the resource.
4354     @@Get:
4355     @@@enDesc:
4356     A reference to array in which the URIs are contained
4357     in undefined order.
4358 wakaba 1.38
4359 wakaba 1.48 {NOTE:: The array is <EM::not> live; it is only a snapshot.
4360     }
4361 wakaba 1.47
4362 wakaba 1.48 @Method:
4363     @@Name: isSameResource
4364 wakaba 1.21 @@Operator:
4365     @@@@:eq
4366     @@@ContentType:
4367     lang:Perl
4368     @@enDesc:
4369 wakaba 1.48 Whether two resources are same or not. Two resources are
4370     same if and only if their <A::DISAnyResource.uri> are
4371     equivalent as strings (i.e. in character-by-character based matching).
4372 wakaba 1.21 @@Param:
4373     @@@Name: anotherResource
4374 wakaba 1.48 @@@Type: DISAnyResource
4375 wakaba 1.21 @@@enDesc:
4376 wakaba 1.48 Another resource object to compare.
4377 wakaba 1.21 @@Return:
4378     @@@Type:
4379     DOMMain:boolean::ManakaiDOM:all
4380     @@@enDesc:
4381 wakaba 1.48 Whether two resources are same or not.
4382     @@@TrueCase:
4383     @@@@enDesc: Two resources are same.
4384     @@@FalseCase:
4385     @@@@enDesc: Two resources are different.
4386 wakaba 1.21 @@@PerlDef:
4387     if (UNIVERSAL::isa ($anotherResource,
4388 wakaba 1.48 <ClassName::ManakaiDISAnyResource>)) {
4389 wakaba 1.21 $r = $self->{uri} eq $anotherResource->{uri};
4390     }
4391 wakaba 1.2
4392     @Attr:
4393     @@Name: nameURI
4394     @@Type: NameURI
4395     @@enDesc:
4396 wakaba 1.48 The URI reference of this module, without
4397 wakaba 1.2 <QUOTE::for> identifier.
4398     @@Get:
4399 wakaba 1.49 @@@enDesc:
4400     The name URI of the resource.
4401     @@@nullCase:
4402     @@@@enDesc:
4403     The resource has no name URI.
4404    
4405     {NOTE:: A resource has no URI if and only if the resource
4406     has no local name.
4407     }
4408 wakaba 1.3 @@@PerlDef:
4409 wakaba 1.49 if (defined $self->{localName}) {
4410     $r = defined $self->{namespaceURI}
4411 wakaba 1.59 ? ${$self->{namespaceURI}} . ${$self->{localName}}
4412     : ${$self->{localName}};
4413 wakaba 1.49 }
4414 wakaba 1.2
4415     @Attr:
4416 wakaba 1.48 @@Name: localName
4417 wakaba 1.32 @@enDesc:
4418 wakaba 1.48 The local name of this module.
4419 wakaba 1.32
4420 wakaba 1.48 {NOTE:: <QUOTE::for> resources has no local name.
4421     }
4422 wakaba 1.2 @@Type:
4423 wakaba 1.3 DISCore:LocalName::ManakaiDOM:all
4424 wakaba 1.2 @@Get:
4425     @@@PerlDef:
4426 wakaba 1.59 $r = defined $self->{localName} ? ${$self->{localName}} : null;
4427 wakaba 1.2
4428     @Attr:
4429     @@Name: namespaceURI
4430     @@Type: AnyURI
4431     @@enDesc:
4432     The namespace URI of the name of this resource.
4433 wakaba 1.48
4434     {NOTE:: <QUOTE::for> resources has no namespace URI.
4435     }
4436 wakaba 1.2 @@Get:
4437     @@@PerlDef:
4438 wakaba 1.59 $r = defined $self->{namespaceURI} ? ${$self->{namespaceURI}} : null;
4439 wakaba 1.2
4440     @Attr:
4441     @@Name: forURI
4442 wakaba 1.48 @@Type: ForURI
4443 wakaba 1.2 @@enDesc:
4444 wakaba 1.48 The <QUOTE::for> URI reference for which this module is defined.
4445 wakaba 1.2 @@Get:
4446     @@@PerlDef:
4447 wakaba 1.59 $r = defined $self->{for} ? ${$self->{for}} : null;
4448 wakaba 1.2
4449     @Attr:
4450     @@Name: forpURI
4451     @@enDesc:
4452     The <QUOTE::for+> URI references for which this resource is defined.
4453 wakaba 1.48
4454     {NOTE:: <QUOTE::for> resources has no <QUOTE::for+> URI.
4455     }
4456 wakaba 1.2 @@Type: ForURIList
4457     @@Get:
4458 wakaba 1.15 @@@enDesc:
4459     List of <QUOTE::for> URI references. Note that this list is
4460     <QUOTE::dead>.
4461 wakaba 1.3 @@@PerlDef:
4462 wakaba 1.15 $r = [@{$self->{forp}}];
4463    
4464     @Method:
4465     @@Name: isForURI
4466     @@enDesc:
4467     Tests whether this resource is defined for a <QUOTE::for>
4468     or <QUOTE::for+> URI reference or not.
4469     @@Param:
4470     @@@Name:forURI
4471     @@@Type:ForURI
4472     @@@enDesc:
4473     A <QUOTE::for> URI reference to test.
4474     @@Return:
4475     @@@Type:
4476     DOMMain:boolean::ManakaiDOM:all
4477     @@@TrueCase:
4478     @@@@enDesc:
4479     This resource is for <P::forURI>.
4480     @@@FalseCase:
4481     @@@@enDesc:
4482     This resource is not for <P::forURI>.
4483     @@@PerlDef:
4484     __DEEP{
4485 wakaba 1.59 C: for my $this_for_uri (${$self->{for}||\''}, @{$self->{forp}||[]}) {
4486 wakaba 1.15 if ($this_for_uri eq $forURI) { ## Shortcut
4487     $r = true;
4488 wakaba 1.48 last C;
4489 wakaba 1.15 }
4490 wakaba 1.48 my $this_for = $self->{db}-><M::DIS|DISDatabase.getFor>
4491 wakaba 1.15 ($this_for_uri);
4492 wakaba 1.48 if ($this_for-><M::DIS|DISFor.isaURI> ($forURI)) {
4493 wakaba 1.15 $r = true;
4494 wakaba 1.48 last C;
4495 wakaba 1.15 }
4496     }
4497     }__;
4498 wakaba 1.48
4499     @Attr:
4500     @@Name: isDefined
4501 wakaba 1.2 @@Description:
4502     @@@lang:en
4503     @@@@:
4504 wakaba 1.48 Whether this module is defined or not.
4505     @@Type:
4506     DOMMain:boolean::ManakaiDOM:all
4507     @@Get:
4508     @@@PerlDef:
4509 wakaba 1.53 $r = $self->{<H::DIS|isDefined>};
4510 wakaba 1.79 @@Set:
4511     @@@PerlDef:
4512     $self->{<H::DIS|isDefined>} = $given;
4513 wakaba 1.48
4514     @Attr:
4515     @@Name: ownerModule
4516     @@enDesc:
4517     The module in which the resource is defined. If the resource
4518     is a module, the module itself is the attribute value.
4519     @@Get:
4520     @@@Type: DISModule
4521     @@@clsActualType: ManakaiDISModuleDefinition
4522     @@@enDesc:
4523     The owner module object.
4524     @@@nullCase:
4525 wakaba 1.2 @@@@enDesc:
4526 wakaba 1.48 The resource is not part of any module since
4527     its definition is not read (i.e. <A::DISAnyResource.isDefined> is
4528 wakaba 1.79 <DOM::false>) or since it is created in memory.
4529 wakaba 1.2 @@@PerlDef:
4530 wakaba 1.48 $r = $self->{db}
4531     -><M::DISDatabase.getModule>
4532 wakaba 1.53 (${$self->{<H::DIS|definingModule>}})
4533     if defined $self->{<H::DIS|definingModule>};
4534 wakaba 1.2
4535 wakaba 1.48 @Attr:
4536 wakaba 1.54 @@Name: ownerModuleURI
4537     @@enDesc:
4538     A URI of the owner module of the resource.
4539     @@Type: DIS|AnyURI
4540     @@nullCase:
4541     @@@enDesc:
4542     The resource does not belong to any module since the
4543 wakaba 1.79 resource definition is not read yet or since
4544     it is created in memory.
4545 wakaba 1.54 @@Get:
4546     @@@PerlDef:
4547     if (defined $self->{<H::DIS|definingModule>}) {
4548     $r = ${$self->{<H::DIS|definingModule>}};
4549     }
4550    
4551     @Attr:
4552     @@Name: ownerModuleURIRef
4553     @@enDesc:
4554     A reference to a URI of the owner module of the resource.
4555     @@Type: DISPerl|SCALAR||ManakaiDOM|Perl
4556     @@nullCase:
4557     @@@enDesc:
4558     The resource does not belong to any module since the
4559 wakaba 1.79 resource definition is not read yet or since
4560     it is created in memory.
4561 wakaba 1.54 @@Get:
4562     @@@PerlDef:
4563     $r = $self->{<H::DIS|definingModule>};
4564 wakaba 1.88 @@Set:
4565     @@@PerlDef:
4566     $self->{<H::DIS|definingModule>} = $given;
4567 wakaba 1.54
4568     @Attr:
4569 wakaba 1.48 @@Name: isReferred
4570     @@Description:
4571     @@@lang:en
4572     @@@@:
4573     Whether the resource is referenced somewhere or not.
4574     @@Type: DISLang|String||ManakaiDOM|all
4575     @@Get:
4576     @@@enDesc:
4577     A node path string that identifies the node from
4578     which the resource is referenced.
4579     @@@nullCase:
4580     The resource is not referred.
4581     @@@PerlDef:
4582 wakaba 1.53 $r = $self->{<H::DIS|isReferred>};
4583 wakaba 1.48 @@Set:
4584 wakaba 1.7 @@@enDesc:
4585 wakaba 1.48 A node path string that identifies the node from
4586     which the resource is referenced.
4587     @@@InCase:
4588     @@@@Type: DISElement
4589     @@@@enDesc:
4590     The resource is referenced by the element. It's node path
4591     string is set as the attribute value.
4592     @@@PerlDef:
4593     if (defined $given) {
4594     if (ref $given) {
4595 wakaba 1.72 __DEEP{
4596 wakaba 1.50 if ($given->isa (<IFName::dv|DVValue>)) {
4597     $given = $given-><AG::dv|DVValue.sourceNodePath>;
4598     } else {
4599     $given = $given-><M::SWCFGNode.flag> ('nodePath') ||
4600     $given-><M::SWCFGNode.nodePath>
4601 wakaba 1.52 (key => [qw/QName Name type Type/]);
4602 wakaba 1.50 }
4603 wakaba 1.72 }__;
4604 wakaba 1.48 }
4605 wakaba 1.53 $self->{<H::DIS|isReferred>} = $given;
4606 wakaba 1.48 }
4607    
4608     @Attr:
4609     @@Name: sourceNodeID
4610     @@enDesc:
4611     The identifier URI reference of the source node.
4612     @@enDesc:
4613     @@@ForCheck: ManakaiDOM|ForClass
4614     @@@@:
4615     Modules and <QUOTE::for>s does not have source node identifier
4616     in the current implementation.
4617     @@Type: AnyURI
4618     @@Get:
4619     @@@nullCase:
4620     @@@@enDesc:
4621     The resource is not (yet) associated with any source node.
4622     @@@PerlDef:
4623 wakaba 1.53 if (defined $self->{<H::DIS:sourceNodeID>}) {
4624     $r = ${$self->{<H::DIS:sourceNodeID>}};
4625 wakaba 1.50 } else {
4626     $r = null;
4627     }
4628     @@Set:
4629     @@@PerlDef:
4630     if (defined $given) {
4631 wakaba 1.53 $self->{<H::DIS:sourceNodeID>} = \$given;
4632 wakaba 1.50 } else {
4633 wakaba 1.53 CORE::delete $self->{<H::DIS:sourceNodeID>};
4634 wakaba 1.50 }
4635    
4636     @Attr:
4637     @@Name: sourceNodeIDRef
4638     @@enDesc:
4639     The identifier URI reference of the source node.
4640     @@enDesc:
4641     @@@ForCheck: ManakaiDOM|ForClass
4642     @@@@:
4643     Modules and <QUOTE::for>s does not have source node identifier
4644     in the current implementation.
4645 wakaba 1.60 @@Type: DISPerl|SCALAR||ManakaiDOM|all
4646 wakaba 1.50 @@Get:
4647     @@@nullCase:
4648     @@@@enDesc:
4649     The resource is not (yet) associated with any source node.
4650     @@@PerlDef:
4651 wakaba 1.53 $r = $self->{<H::DIS:sourceNodeID>};
4652 wakaba 1.48 @@Set:
4653 wakaba 1.7 @@@PerlDef:
4654 wakaba 1.50 if (defined $given) {
4655 wakaba 1.53 $self->{<H::DIS:sourceNodeID>} = $given;
4656 wakaba 1.50 } else {
4657 wakaba 1.53 CORE::delete $self->{<H::DIS:sourceNodeID>};
4658 wakaba 1.50 }
4659 wakaba 1.7
4660 wakaba 1.2 @Attr:
4661 wakaba 1.48 @@Name: isAnonymous
4662     @@enDesc:
4663     Whether the resource has persistent name or not.
4664     @@Type:
4665 wakaba 1.18 DOMMain:boolean::ManakaiDOM:all
4666 wakaba 1.2 @@Get:
4667     @@@TrueCase:
4668 wakaba 1.48 This resource does <EM::not> have any globally unique name.
4669     <A::DISAnyResource.uri> is a temporary URI reference.
4670 wakaba 1.2 @@@FalseCase:
4671 wakaba 1.48 This resource does have its formal name.
4672     <A::DISAnyResource.uri> is a URI reference
4673     generated from the name and the <QUOTE::for> URI reference
4674     of this resource.
4675 wakaba 1.2 @@@PerlDef:
4676 wakaba 1.53 $r = $self->{<H::DIS|isAnon>};
4677 wakaba 1.79 @@Set:
4678     @@@PerlDef:
4679     $self->{<H::DIS|isAnon>} = $given;
4680 wakaba 1.2
4681     @Attr:
4682 wakaba 1.48 @@Name: sourceElement
4683     @@enDesc:
4684     The source <QUOTE::dis> element node from which this
4685     definition is read.
4686 wakaba 1.2 @@Get:
4687 wakaba 1.48 @@@Type: DISElement
4688     @@@clsActualType: ManakaiDISElement
4689     @@@InCase:
4690     @@@@Type: DISModuleElement
4691     @@@@clsActualType: ManakaiDISModuleElement
4692     @@@@enDesc: If this resource is a module.
4693     @@@PerlDef: $r = $self->{src};
4694 wakaba 1.2 @@@nullCase:
4695 wakaba 1.48 @@@@enDesc:
4696     The definition is not yet read.
4697 wakaba 1.2
4698     @Attr:
4699 wakaba 1.48 @@Name: database
4700     @@enDesc:
4701     The <QUOTE::dis> database to which the resource belongs.
4702     @@Type: DISDatabase
4703     @@clsActualType: ManakaiDISDatabase
4704 wakaba 1.2 @@Get:
4705     @@@PerlDef:
4706 wakaba 1.48 $r = $self->{db};
4707    
4708 wakaba 1.6 @Method:
4709 wakaba 1.48 @@Name: readProperties
4710 wakaba 1.6 @@enDesc:
4711 wakaba 1.48 Reads property values in the source tree and
4712     removes reference to the source node.
4713     @@NamedParam:
4714     @@@Name: onResourceRead
4715     @@@Type:
4716 wakaba 1.60 DISPerl:CODE::ManakaiDOM:all
4717 wakaba 1.6 @@@enDesc:
4718 wakaba 1.48 An event handler called when a resource is read.
4719     @@@nullCase:
4720     @@@@enDesc:
4721     No event handler is read.
4722 wakaba 1.6 @@Return:
4723 wakaba 1.11 @@@RaiseException:
4724 wakaba 1.48 @@@@@: UNSUPPORTED_ELEMENT_TYPE_ERR
4725     @@@@enDesc:
4726     There is an element whose element type is not supported.
4727 wakaba 1.11 @@@PerlDef:
4728 wakaba 1.6 __DEEP{
4729 wakaba 1.48 if (my $src = $self->{src}) {
4730 wakaba 1.49 my $for = $self-><AG::DISAnyResource.forURI>;
4731     my $forp = $self-><AG::DISAnyResource.forpURI>;
4732     my $db = $self-><AG::DISAnyResource.database>;
4733 wakaba 1.48 for my $el (@{$src-><M::DISElement.disChildElements>
4734 wakaba 1.49 (for_arg => $for,
4735     forp_arg => $forp,
4736     database_arg => $db)}) {
4737 wakaba 1.48 my $xu = $el-><AG::SWCFGElement.expandedURI>;
4738     if ({
4739     <Q::dis:AliasFor> => true,
4740     <Q::dis:ContentType> => true,
4741     <Q::dis:dataType> => true,
4742     <Q::dis:For> => true,
4743     <Q::dis:ForCheck> => true,
4744     <Q::dis:Name> => true,
4745     <Q::dis:Namespace> => true,
4746     <Q::dis:multipleProperties> => true,
4747 wakaba 1.81 <Q::DISCore|resourceType> => true,
4748     <Q::rdf:type> => true, ## TODO: Remove this.
4749 wakaba 1.48 <Q::dis:QName> => true,
4750     <Q::dis:Require> => true,
4751     <Q::dis:resourceFor> => true,
4752     }->{$xu}) {
4753     #
4754 wakaba 1.49 } elsif ($el-><M::DISElement.isPropertyElement>
4755     (database_arg => $db)) {
4756 wakaba 1.48 my $add_prop;
4757     $add_prop = sub ($$$) {
4758     my ($self, $el, $db) = @_;
4759     my $prop = $db-><M::DISDatabase.getResource>
4760     ($el-><AG::SWCFGElement.expandedURI>);
4761     my $prop_uri = $prop-><AG::DISAnyResource.uri>;
4762     my $prop_mult = $prop-><AG::DISResource.multiplePropertiesURI>;
4763     my $new_value;
4764     my $base_type;
4765     my $copy_tree = false;
4766    
4767 wakaba 1.49 my %mtopt = (for_arg => $for,
4768     forp_arg => $forp,
4769 wakaba 1.48 default_media_type => $prop-><AG::DISResource
4770 wakaba 1.49 .defaultLextypeURI>,
4771     database_arg => $db);
4772 wakaba 1.51 my $new_value_type = $el-><M::DISElement.mediaTypeURI>(%mtopt);
4773    
4774 wakaba 1.48 if ($el-><M::DISElement.mediaTypeMatch>
4775 wakaba 1.68 (<Q::DISCore:QName>, $mtopt{default_media_type}, %mtopt)) {
4776 wakaba 1.48 __CODE{dv|createValue::
4777     $value => {null},
4778 wakaba 1.68 $base_type => {$base_type = <Q::DISCore:QName>},
4779 wakaba 1.50 $type => {$new_value_type},
4780 wakaba 1.48 $result => $new_value,
4781 wakaba 1.60 $name => {$prop_uri},
4782 wakaba 1.48 }__;
4783     $new_value-><AS::dv|DVQNameValue.localName>
4784     ($el-><AG::DISElement.qnameValueLocalName>);
4785     $new_value-><AS::dv|DVQNameValue.prefix>
4786 wakaba 1.49 (my $prefix = $el-><AG::DISElement.qnameValuePrefix>);
4787     if (not defined $prefix) {
4788     if ($el-><M::DISElement.mediaTypeMatch>
4789     (<Q::DISCore:LanguageTag>,
4790     $mtopt{default_media_type}, %mtopt)) {
4791     $new_value-><AS::dv|DVQNameValue.namespaceURI>
4792     ('urn:x-suika-fam-cx:lang:');
4793     } elsif ($el-><M::DISElement.mediaTypeMatch>
4794     (<Q::DISCore:ScriptTag>,
4795     $mtopt{default_media_type}, %mtopt)) {
4796     $new_value-><AS::dv|DVQNameValue.namespaceURI>
4797     ('http://suika.fam.cx/~wakaba/archive/2005/5/script#');
4798     } else {
4799     $new_value-><AS::dv|DVQNameValue.namespaceURI>
4800     ($el-><AG::DISElement.qnameValueNamespaceURI>);
4801     }
4802     } else {
4803     $new_value-><AS::dv|DVQNameValue.namespaceURI>
4804     ($el-><AG::DISElement.qnameValueNamespaceURI>);
4805     }
4806 wakaba 1.48 ## TODO: Check whether defined
4807     } elsif ($el-><M::DISElement.mediaTypeMatch>
4808     (<Q::dis:TFQNames>, $mtopt{default_media_type}, %mtopt) or
4809     $el-><M::DISElement.mediaTypeMatch>
4810     (<Q::DISCore:TFPQNames>, $mtopt{default_media_type}, %mtopt)) {
4811     __CODE{dv|createURI::
4812     $uri => {$el-><M::DISElement.tfqnamesValueURI>
4813     ($self-><AG::DISAnyResource.sourceNodeID>,
4814     $self-><AG::DISAnyResource.forURI>,
4815     for_arg => $self-><AG::DISAnyResource.forURI>,
4816 wakaba 1.49 forp_arg => $self-><AG::DISAnyResource.forpURI>,
4817     database_arg => $db)},
4818 wakaba 1.48 $result => $new_value,
4819 wakaba 1.60 $name => {$prop_uri},
4820 wakaba 1.48 }__;
4821     ## TODO: Check whether defined
4822 wakaba 1.50 $new_value_type = <Q::DISCore:URI>;
4823 wakaba 1.48 } elsif ($el-><M::DISElement.mediaTypeMatch>
4824     (<Q::lang:Perl>, $mtopt{default_media_type},
4825     %mtopt)) {
4826     $el-><M::DISElement.preserveNodePath>;
4827 wakaba 1.50 __CODE{dv|createValueRef::
4828     $value_ref => {$el-><AG::SWCFGNode.valueRef>},
4829 wakaba 1.49 $base_type => {$base_type = <Q::lang:Perl>},
4830 wakaba 1.50 $type => {$new_value_type},
4831 wakaba 1.48 $result => $new_value,
4832 wakaba 1.60 $name => $prop_uri,
4833 wakaba 1.48 }__;
4834     for my $p (<Q::dis:Type>, <Q::dis:actualType>) {
4835     if (UNIVERSAL::isa ($self->{$p},<IFName::dv|DVURIValue>)) {
4836     my $v;
4837     __CODE{dv|createURI::
4838     $uri => {$self->{$p}-><AG::dv|DVURIValue.uri>},
4839     $result => $v,
4840 wakaba 1.60 $name => $prop_uri,
4841 wakaba 1.48 }__;
4842     $new_value-><M::dv|DVValue.setProperty> ($p => $v);
4843     }
4844     }
4845 wakaba 1.49 $new_value-><AS::dv|DVNSValue.defaultNamespaceURIRef>
4846     ($el-><M::DISElement.getDefaultNamespaceURIRef>);
4847     $new_value-><AS::dv|DVNSValue.namespaceBindingList>
4848     ($el-><M::DISElement.getNamespaceBindingList> ($db));
4849     $new_value-><AS::dv|DVValue.sourceNodePath>
4850     ($el-><M::SWCFGNode.flag> ('nodePath'));
4851 wakaba 1.48 } elsif ($el-><M::DISElement.mediaTypeMatch>
4852     (<Q::lang:disdoc>, $mtopt{default_media_type},
4853     %mtopt) or
4854     $el-><M::DISElement.mediaTypeMatch>
4855     (<Q::lang:disdocInline>, $mtopt{default_media_type},
4856 wakaba 1.49 %mtopt) or
4857     $el-><M::DISElement.mediaTypeMatch>
4858     (<Q::lang:muf>, $mtopt{default_media_type},
4859 wakaba 1.74 %mtopt) or
4860     $el-><M::DISElement.mediaTypeMatch>
4861     (<Q::lang:dpg>, $mtopt{default_media_type},
4862 wakaba 1.77 %mtopt) or
4863     $el-><M::DISElement.mediaTypeMatch>
4864     (<Q::lang:tdterr>,
4865     $mtopt{default_media_type},
4866 wakaba 1.49 %mtopt)) {
4867     $el-><M::DISElement.preserveNodePath>;
4868 wakaba 1.50 __CODE{dv|createValueRef::
4869     $value_ref => {$el-><AG::SWCFGNode.valueRef>},
4870 wakaba 1.49 $base_type => {$base_type = <Q::lang:disdoc>},
4871 wakaba 1.50 $type => $new_value_type,
4872 wakaba 1.49 $result => $new_value,
4873 wakaba 1.60 $name => $prop_uri,
4874 wakaba 1.49 }__;
4875     $new_value-><AS::dv|DVNSValue.defaultNamespaceURIRef>
4876     ($el-><M::DISElement.getDefaultNamespaceURIRef>);
4877     $new_value-><AS::dv|DVNSValue.namespaceBindingList>
4878     ($el-><M::DISElement.getNamespaceBindingList> ($db));
4879     $new_value-><AS::dv|DVValue.sourceNodePath>
4880     ($el-><M::SWCFGNode.flag> ('nodePath'));
4881     } elsif ($el-><M::DISElement.mediaTypeMatch>
4882 wakaba 1.52 (<Q::dx|XCRef>,
4883     $mtopt{default_media_type}, %mtopt)) {
4884     my $x = $db-><M::DISDatabase.xcrefToResource>
4885     ($el-><M::SWCFGNode.value>,
4886 wakaba 1.59 $el, node => $el,
4887     for_arg => $self-><AG::DIS|DISAnyResource.forURI>);
4888 wakaba 1.52 __CODE{dv|createURI::
4889     $uri => {($x->[2] or $x->[1] or $x->[0])
4890     -><AG::DISAnyResource.uri>},
4891     $result => $new_value,
4892 wakaba 1.60 $name => $prop_uri,
4893 wakaba 1.52 }__;
4894     $new_value-><M::dv|DVURIValue.getResource> ($db)
4895     -><AS::DISAnyResource.isReferred> ($el);
4896     $new_value_type = <Q::DISCore:URI>;
4897     } elsif ($el-><M::DISElement.mediaTypeMatch>
4898     (<Q::DISLang|MemberRef>,
4899     $mtopt{default_media_type}, %mtopt)) {
4900     my $v = $el-><M::SWCFGNode.value>;
4901     $v =~ s/^\s+//; $v =~ s/\s+$//;
4902     my ($clsq, $mem, $gs) = split /\s*\.\s*/, $v, 3;
4903     my $res;
4904     if (defined $mem) {
4905     my $cls = $db-><M::DISDatabase.getResource>
4906     ($el-><M::DISElement.tfqnamesValueURI>
4907     ($clsq, $self-><AG::DISAnyResource.sourceNodeID>,
4908     $self-><AG::DISAnyResource.forURI>, node => $el));
4909     $cls-><AS::DISAnyResource.isReferred> ($el);
4910     $res = $cls-><M::DISResource.getChildResourceByNameAndType>
4911     ($mem, <Q::DISLang:AnyMethod>);
4912     unless ($res) {
4913     __UNDEEP{__EXCEPTION{DIS|RESOURCE_NOT_DEFINED_ERR::
4914     DIS:localName => {$mem},
4915     DIS:parentURI => {$cls-><AG::DISAnyResource.uri>},
4916     DIS:elementType => {$el-><AG::SWCFGElement
4917     .expandedURI>},
4918     DIS:sourceNode => {$el},
4919     DIS:sourceCode => {$v},
4920     DIS:expectedType => {
4921     defined $gs ? <Q::DISLang:Attribute>
4922     : <Q::DISLang:Method>
4923     },
4924     }__}__;
4925     }
4926     if (defined $gs) {
4927     $res = $res-><M::DISResource.getChildResourceByType>
4928     ($gs eq 'get' ? <Q::DISLang|AttributeGet>
4929     : <Q::DISLang|AttributeSet>);
4930     unless ($res) {
4931     __UNDEEP{__EXCEPTION{DIS|RESOURCE_NOT_DEFINED_ERR::
4932     DIS:parentURI => {$res-><AG::DISAnyResource.uri>},
4933     DIS:elementType => {$el-><AG::SWCFGElement
4934     .expandedURI>},
4935     DIS:sourceNode => {$el},
4936     DIS:sourceCode => {$v},
4937     DIS:expectedType => {
4938     $gs eq 'get' ? <Q::DISLang:AttributeGet>
4939     : <Q::DISLang:AttributeSet>
4940     },
4941     }__}__;
4942     }
4943     }
4944     } else {
4945     $res = $db-><M::DISDatabase.getResource>
4946     ($el-><M::DISElement.tfqnamesValueURI>
4947     ($clsq, $self-><AG::DISAnyResource.sourceNodeID>,
4948     $self-><AG::DISAnyResource.forURI>, node => $el));
4949     }
4950     $res-><AS::DISAnyResource.isReferred> ($el);
4951     __CODE{dv|createURI::
4952     $uri => {$el-><AG::DISAnyResource.uri>},
4953     $result => $new_value,
4954 wakaba 1.60 $name => $prop_uri,
4955 wakaba 1.52 }__;
4956     $new_value_type = <Q::DISCore:URI>;
4957     } elsif ($el-><M::DISElement.mediaTypeMatch>
4958 wakaba 1.49 (<Q::lang:dis>, $mtopt{default_media_type},
4959     %mtopt)) {
4960     $copy_tree = true;
4961 wakaba 1.48 $el-><M::DISElement.preserveNodePath>;
4962     my $elc = $el->clone;
4963     __CODE{dv|createValue::
4964     $value => {$elc},
4965 wakaba 1.49 $base_type => {$base_type = <Q::lang:dis>},
4966 wakaba 1.50 $type => $new_value_type,
4967 wakaba 1.48 $result => $new_value,
4968 wakaba 1.60 $name => $prop_uri,
4969 wakaba 1.48 }__;
4970 wakaba 1.49 $elc-><M::DISElement.unlinkFromDocument> ($db);
4971 wakaba 1.64 } elsif ($el-><M::DISElement.mediaTypeMatch>
4972     (<Q::DISCore:Integer>,
4973     $mtopt{default_media_type}, %mtopt)) {
4974     my $v = $el-><M::SWCFGNode.value>;
4975     if ($v =~ /^0x/) {
4976     $v = hex $v;
4977     } else {
4978     $v += 0;
4979     }
4980     __CODE{dv|createValue::
4981     $value => $v,
4982 wakaba 1.78 $base_type => {$base_type = <Q::DISCore:Integer>},
4983     $type => $new_value_type,
4984     $result => $new_value,
4985     $name => $prop_uri,
4986     }__;
4987     } elsif ($el-><M::DISElement.mediaTypeMatch>
4988     (<Q::DISCore:UString>,
4989     $mtopt{default_media_type}, %mtopt)) {
4990     my $v = $el-><M::SWCFGNode.value>;
4991     $v =~ s/\$\x0D?\x0A//gs;
4992     $v =~ s/\$\z//;
4993     warn 'String |'.$el-><M::SWCFGNode.value>.'| contains '.
4994     'illegal |$| character' if $v =~ /\$(?![uU])/;
4995     ## TODO: Use error-handler
4996     $v =~ s{\$(u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})}{
4997     chr hex substr $1, 1
4998     }ge;
4999     __CODE{dv|createValue::
5000     $value => $v,
5001 wakaba 1.64 $base_type => {$base_type = <Q::DISCore:String>},
5002 wakaba 1.78 $type => {<Q::DISCore:String>},
5003 wakaba 1.64 $result => $new_value,
5004     $name => $prop_uri,
5005     }__;
5006 wakaba 1.78 ## NOTE: Since |type| is set to |DISCore:String|,
5007     ## what subtype of |DISCore:UString| it was originally
5008     ## is not preserved.
5009 wakaba 1.48 } else {
5010     __CODE{dv|createValue::
5011     $value => {$el-><M::SWCFGNode.value>},
5012     $base_type => {$base_type = <Q::DISCore:String>},
5013 wakaba 1.50 $type => $new_value_type,
5014 wakaba 1.48 $result => $new_value,
5015 wakaba 1.60 $name => $prop_uri,
5016 wakaba 1.48 }__;
5017     }
5018    
5019     unless ($copy_tree) {
5020     for my $ce (@{$el-><M::DISElement.disChildElements>
5021 wakaba 1.49 (for_arg => $for,
5022     forp_arg => $forp,
5023     database_arg => $db)}) {
5024 wakaba 1.48 my $xu = $ce-><AG::SWCFGElement.expandedURI>;
5025     if ({
5026     <Q::dis:AliasFor> => true,
5027     <Q::dis:For> => true,
5028     <Q::dis:ForCheck> => true,
5029     <Q::dis:ContentType> => true,
5030     <Q::dis:resourceFor> => true,
5031     }->{$xu}) {
5032     #
5033 wakaba 1.49 } elsif ($ce-><M::DISElement.isPropertyElement>
5034     (database_arg => $db)) {
5035 wakaba 1.48 my $pr;
5036     __DEEP{
5037     $pr = $add_prop->($self, $ce, $db);
5038     }__;
5039     if ($pr->{prop_mult} eq <Q::DISCore|OrderedList>) {
5040     my $cpv = $new_value-><M::dv|DVValue.getProperty> ($xu);
5041     if (not $cpv) {
5042     __CODE{dv|createOrderedList::
5043     $result => {$cpv},
5044     $type => {$mtopt{default_media_type}},
5045     $base_type => {<Q::DISCore:String>},
5046     }__;
5047     $new_value-><M::dv|DVValue.setProperty> ($xu => $cpv);
5048     }
5049     $cpv-><M::dv|DVList.addItem> ($pr->{new_value});
5050     } elsif ($pr->{prop_mult} eq <Q::DISCore|UnorderedList>) {
5051     my $cpv = $new_value-><M::dv|DVValue.getProperty> ($xu);
5052     if (not $cpv) {
5053     __CODE{dv|createUnorderedList::
5054     $result => {$cpv},
5055     $type => {$mtopt{default_media_type}},
5056     $base_type => {<Q::DISCore:String>},
5057     }__;
5058     $new_value-><M::dv|DVValue.setProperty> ($xu => $cpv);
5059     }
5060     $cpv-><M::dv|DVList.addItem> ($pr->{new_value});
5061     } else {
5062     $new_value-><M::dv|DVValue.setProperty>
5063     ($xu => $pr->{new_value});
5064     }
5065     } else {
5066     __UNDEEP{__EXCEPTION{UNSUPPORTED_ELEMENT_TYPE_ERR::
5067     DIS:elementType => {$xu},
5068     DIS:sourceNode => {$ce},
5069     }__}__;
5070     }
5071     }} # copy_tree
5072    
5073     {new_value => $new_value, base_type => $base_type,
5074 wakaba 1.50 prop_uri => $prop_uri, prop_mult => $prop_mult,
5075     new_value_type => $new_value_type};
5076 wakaba 1.48 };
5077    
5078     my $pr;
5079     __DEEP{
5080 wakaba 1.49 $pr = $add_prop->($self, $el, $db);
5081 wakaba 1.48 }__;
5082     if ($pr->{prop_mult} eq <Q::DISCore|OrderedList>) {
5083     if (not $self->{$pr->{prop_uri}}) {
5084     __CODE{dv|createOrderedList::
5085     $result => {$self->{$pr->{prop_uri}}},
5086 wakaba 1.50 $type => {$pr->{new_value_type}},
5087 wakaba 1.48 $base_type => {$pr->{base_type} || <Q::DISCore:String>},
5088     }__;
5089     }
5090     $self->{$pr->{prop_uri}}-><M::dv|DVList.addItem>
5091     ($pr->{new_value});
5092     } elsif ($pr->{prop_mult} eq <Q::DISCore|UnorderedList>) {
5093     if (not $self->{$pr->{prop_uri}}) {
5094     __CODE{dv|createUnorderedList::
5095     $result => {$self->{$pr->{prop_uri}}},
5096 wakaba 1.50 $type => {$pr->{new_value_type}},
5097 wakaba 1.48 $base_type => {$pr->{base_type} || <Q::DISCore:String>},
5098     }__;
5099     }
5100     $self->{$pr->{prop_uri}}-><M::dv|DVList.addItem>
5101     ($pr->{new_value});
5102     } else {
5103     $self->{$pr->{prop_uri}} = $pr->{new_value};
5104     }
5105 wakaba 1.53
5106     if ($el-><M::DISElement.elementTypeMatch>
5107     (<Q::DISPerl:propHashKey>, database_arg => $db)) {
5108     $db-><M::dp|DISDatabasePerl.plAddHashKey>
5109     ($xu => $pr->{new_value}-><AG::dv|DVValue.stringValue>
5110     => $self);
5111     }
5112 wakaba 1.48 } elsif ($el-><AG::DISElement.isResourceElement>) {
5113     ## TODO: Should rdf:type be validated?
5114     } else {
5115     __UNDEEP{__EXCEPTION{UNSUPPORTED_ELEMENT_TYPE_ERR::
5116     DIS:elementType => {$xu},
5117     DIS:sourceNode => {$el},
5118     }__}__;
5119     }
5120 wakaba 1.6 }
5121 wakaba 1.48 CORE::delete $self->{src};
5122     ($onResourceRead or sub () {})->($self, $self);
5123 wakaba 1.6 }
5124     }__;
5125 wakaba 1.61
5126     @Method:
5127     @@Name: isTypeURI
5128     @@enDesc:
5129     Tests whether this resource is of a type or not.
5130     @@Param:
5131     @@@Name: typeURI
5132     @@@Type: ResourceURI
5133     @@@enDesc:
5134     A type URI reference to test.
5135     @@Return:
5136     @@@Type:
5137     DOMMain:boolean::ManakaiDOM:all
5138     @@@TrueCase:
5139     @@@@enDesc:
5140     This is a <P::typeURI> resource.
5141     @@@FalseCase:
5142     @@@@enDesc:
5143     This is not a <P::typeURI> resource.
5144 wakaba 1.79 @@@PerlDef:
5145     __DEEP{
5146     $r = $self-><AG::DISAnyResource.typeResource>
5147     -><M::DISResource.isSubsetOfURI> ($typeURI);
5148     }__;
5149    
5150     @Attr:
5151     @@Name: revision
5152     @@enDesc:
5153     The revision number of the resource.
5154    
5155     {ISSUE::
5156     Is it necessary for revision numbers to hold some
5157     kind of globality?
5158     }
5159     @@Type: RevisionNumber
5160     @@Get:
5161     @@@PerlDef:
5162     $r = $self->{<H::DIS|revision>};
5163    
5164     @CODE:
5165     @@QName: setRevision
5166     @@enDesc:
5167     Sets new revision number to a resource.
5168     @@PerlDef:
5169     $resource->{<H::DIS|revision>} = time;
5170    
5171     @CODE:
5172     @@QName: updateRevision
5173     @@enDesc:
5174     Updates revision number of a resource.
5175    
5176     {ISSUE::
5177     How revision number should be increased?
5178     }
5179     @@PerlDef:
5180     $resource->{<H::DIS|revision>}++;
5181    
5182     @Method:
5183     @@Name: getTypeURIList
5184     @@enDesc:
5185     Returns a snapshot list of resource type URIs of the resource.
5186     @@Return:
5187     @@@Type: URIList
5188     @@@enDesc:
5189     A snapshot list of URIs.
5190     @@@PerlDef:
5191     __DEEP{
5192     $r = $self-><AG::DISAnyResource.typeResource>
5193     -><M::DISAnyResource.getSuperResourceURIList>;
5194     }__;
5195    
5196     @@Test:
5197     @@@QName: DISAnyResource.getTypeURIList.test
5198     @@@PerlDef:
5199     my $db;
5200     __CODE{createDISDBForTest:: $db => $db}__;
5201    
5202     $test->id ('module');
5203     my $mod1 = $db-><M::DISDatabase.getModule> ('about:module1');
5204     my %lm1 = map {$_ => true} @{$mod1-><M::DISAnyResource.getTypeURIList>};
5205    
5206     $test->assert_true ($lm1{<Q::DISCore|Module>});
5207     $test->assert_true ($lm1{<Q::DISCore|AnyResource>});
5208    
5209     $test->id ('for');
5210     my $for1 = $db-><M::DISDatabase.getFor> ('about:for1');
5211     my %lf1 = map {$_ => true} @{$for1-><M::DISAnyResource.getTypeURIList>};
5212    
5213     $test->assert_true ($lf1{<Q::DISCore|For>});
5214     $test->assert_true ($lf1{<Q::DISCore|AnyResource>});
5215    
5216     @@Test:
5217     @@@QName: DISAnyResource.resource.getTypeURIList.test
5218     @@@PerlDef:
5219     my $db;
5220     __CODE{createDISDBForTest:: $db => $db}__;
5221    
5222     $test->id ('resource');
5223     my $res1 = $db-><M::DISDatabase.getResource> ('about:resource1');
5224     my %lr1 = map {$_ => true} @{$res1-><M::DISAnyResource.getTypeURIList>};
5225    
5226     $test->assert_true ($lr1{<Q::DISCore|Resource>});
5227     $test->assert_true ($lr1{<Q::DISCore|AnyResource>});
5228    
5229     @Method:
5230     @@ForCheck: ManakaiDOM|ForIF
5231     @@Name: getSuperResourceURIList
5232     @@enDesc:
5233     Returns a snapshot list of super-resources URIs of the resource,
5234     including canonical and alias URIs of the resource itself.
5235     @@Return:
5236     @@@Type: URIList
5237     @@@enDesc:
5238     A snapshot list of URIs.
5239    
5240     @Attr:
5241     @@Name: typeResource
5242     @@enDesc:
5243     The most specific type of the resource.
5244     @@Type: DISResource
5245     @@Get:
5246     @@@PerlDef:
5247     __DEEP{
5248     $r = $self-><AG::DISAnyResource.database>
5249     -><M::DISDatabase.getResource> ($self->{<H::DIS|typeURI>});
5250     }__;
5251    
5252     @Method:
5253     @@Name: addTypeURI
5254     @@enDesc:
5255     Adds a URI to the list of types of the resource.
5256     @@Param:
5257     @@@Name: uri
5258     @@@Type: AnyResourceURI
5259     @@@enDesc:
5260     A URI to add.
5261     @@Return:
5262     @@@PerlDef:
5263     __DEEP{
5264     my $current_type = $self-><AG::DISAnyResource.typeResource>;
5265     unless ($current_type-><M::DISResource.isSubsetOfURI> ($uri)) {
5266     my $db = $self-><AG::DISAnyResource.database>;
5267     my $res = $db-><M::DISDatabase.getResource> ($uri);
5268 wakaba 1.80 my $current_uri = $current_type-><AG::DISAnyResource.uri>;
5269 wakaba 1.79 if ($res-><M::DISResource.isSubsetOfURI> ($current_uri)) {
5270 wakaba 1.80 $self->{<H::DIS|typeURI>} = $uri;
5271 wakaba 1.79 } else {
5272 wakaba 1.80 my $new_uri;
5273     __CODE{composeSubsetURI:: $input1 => $current_uri,
5274     $input2 => $uri,
5275     $output => $new_uri}__;
5276 wakaba 1.79 my $new_res = $db-><M::DISDatabase.getResource> ($new_uri);
5277 wakaba 1.80 unless ($new_res-><AG::DISAnyResource.isDefined>) {
5278     $new_res-><AS::DISAnyResource.isAnonymous> (true);
5279     $new_res-><AS::DISAnyResource.isDefined> (true);
5280     $new_res-><M::DISResource.addSuperResource> ($current_type);
5281     $new_res-><M::DISResource.addSuperResource> ($res);
5282     }
5283 wakaba 1.88 unless ($new_res-><AG::DISAnyResource.ownerModuleURIRef>) {
5284     $new_res-><AS::DISAnyResource.ownerModuleURIRef>
5285     ($res-><AG::DISAnyResource.ownerModuleURIRef>);
5286     }
5287 wakaba 1.79 $self->{<H::DIS|typeURI>} = $new_uri;
5288     }
5289     }
5290     }__;
5291    
5292     @@Test:
5293     @@@QName: DISAnyResource.addTypeURI.test
5294     @@@PerlDef:
5295     my $db;
5296     __CODE{createDISDBForTest:: $db => $db}__;
5297    
5298     my $res = $db-><M::DISDatabase.getResource> ('about:1');
5299     my $res2 = $db-><M::DISDatabase.getResource> ('about:2');
5300     $test->id ('initial.resource');
5301     $test->assert_true
5302     ($res-><M::DISAnyResource.isTypeURI> (<Q::DISCore|Resource>));
5303     $test->id ('initial.anyresource');
5304     $test->assert_true
5305     ($res-><M::DISAnyResource.isTypeURI>
5306     (<Q::DISCore|AnyResource>));
5307     $test->id ('initial.type1');
5308     $test->assert_false
5309     ($res-><M::DISAnyResource.isTypeURI> ('about:type1'));
5310    
5311     $res-><M::DISAnyResource.addTypeURI> ('about:type1');
5312    
5313     $test->id ('added.resource');
5314     $test->assert_true
5315     ($res-><M::DISAnyResource.isTypeURI> (<Q::DISCore|Resource>));
5316     $test->id ('added.anyresource');
5317     $test->assert_true
5318     ($res-><M::DISAnyResource.isTypeURI>
5319     (<Q::DISCore|AnyResource>));
5320     $test->id ('added.type1');
5321     $test->assert_true
5322     ($res-><M::DISAnyResource.isTypeURI> ('about:type1'));
5323    
5324     $test->id ('added2.resource');
5325     $test->assert_true
5326     ($res2-><M::DISAnyResource.isTypeURI>
5327     (<Q::DISCore|Resource>));
5328     $test->id ('added2.anyresource');
5329     $test->assert_true
5330     ($res2-><M::DISAnyResource.isTypeURI>
5331     (<Q::DISCore|AnyResource>));
5332     $test->id ('added2.type1');
5333     $test->assert_false
5334     ($res2-><M::DISAnyResource.isTypeURI> ('about:type1'));
5335 wakaba 1.81
5336     @CODE:
5337     @@QName: getMethodForType
5338     @@enDesc:
5339     Returns a method for a particular resource type.
5340    
5341     In: <Perl::$resource>, <Perl::$method_name>
5342    
5343     Out: <Perl::$method>
5344     @@PerlDef:
5345     my $__type = $resource-><AG::DISAnyResource.typeResource>;
5346     my $__type_uri = $__type-><AG::DISAnyResource.uri>;
5347     $method = $Message::Util::DIS::Method{$__type_uri}->{$method_name};
5348     unless ($method) {
5349     my %__methods;
5350     for (@{$__type-><M::DISAnyResource.getSuperResourceURIList>}) {
5351     $__methods{$_} = $Message::Util::DIS::Method{$_}->{$method_name}
5352     if $Message::Util::DIS::Method{$_}->{$method_name};
5353     }
5354     my $__db = $resource-><AG::DISAnyResource.database>;
5355     T1: for my $__t1_uri (keys %__methods) {
5356 wakaba 1.82 next T1 unless $__methods{$__t1_uri};
5357 wakaba 1.81 my $__t1 = $__db-><M::DISDatabase.getResource> ($__t1_uri);
5358     T2: for my $__t2_uri (keys %__methods) {
5359     next T2 if $__t1_uri eq $__t2_uri;
5360     if ($__t1-><M::DISResource.isSubsetOfURI> ($__t2_uri)) {
5361     delete $__methods{$__t2_uri};
5362 wakaba 1.82 next T2;
5363 wakaba 1.81 }
5364     if ($Message::Util::DIS::Method{$__t1_uri}->{$method_name}
5365     eq $Message::Util::DIS::Method{$__t2_uri}->{$method_name}) {
5366     delete $__methods{$__t2_uri};
5367 wakaba 1.82 next T2;
5368 wakaba 1.81 }
5369     }
5370     }
5371     if (keys %__methods > 1) {
5372     __c|ERROR{DIS|more-than-one-methods-for-a-type::
5373     DIS|uri => {$__type_uri},
5374     DIS|method-name => {$method_name},
5375     DIS|method-resource-types => {[keys %__methods]},
5376     }__;
5377     }
5378     $Message::Util::DIS::Method{$__type_uri}->{$method_name} =
5379     $method = $__methods{[keys %__methods]->[0]} if %__methods;
5380     }
5381    
5382     @IntMethod:
5383     @@Operator: ManakaiDOM|MUErrorHandler
5384     @@enDesc:
5385     When a <IF::ecore|ErrorInterface||ManakaiDOM|Perl> is <Perl::report>ed
5386     with an <Perl::-object> of <IF::Node>, then this method is invoked.
5387    
5388     The method calls the <cfg::error-handler> if the error is of
5389     <IF::c|DOMError>. Otherwise, including the cases of <IF::c|DOMException>s,
5390     the error is rethrown so that appropriate <Perl::catch> clause
5391     can catch the error.
5392     @@enImplNote:
5393     For implementations which does not have the
5394     <IF::c|DOMError||ManakaiDOM|ManakaiDOM3> interface, the method
5395     is defined in the <Class::ManakaiDOM|ManakaiDOMObject> class
5396     and it is not overridden here.
5397     @@Param:
5398     @@@Name: err
5399     @@@Type: ecore|ErrorInterface||ManakaiDOM|Perl
5400     @@@enDesc:
5401     The reported error object.
5402     @@Return:
5403     @@@Type: DISPerl|Any||ManakaiDOM|Perl
5404     @@@enDesc:
5405     If the <P::err> is a <IF::c|DOMError>, then the return value
5406     of the error handler.
5407    
5408     {NOTE:: If the error is thrown, the method never returns.
5409     }
5410     @@@nullCase:
5411     @@@@enDesc:
5412     No error handler.
5413     @@@PerlDef:
5414     if ($err->isa (<IFName::c|DOMError||ManakaiDOM|ManakaiDOM>)) {
5415     __DEEP{
5416     my $cfg = $self-><AG::DISAnyResource.database>
5417     -><AG::DISDatabase.domConfig>;
5418     my $h = $cfg-><M::DOMConfig.getParameter> ('error-handler');
5419 wakaba 1.83 $r = $h-><M::DOMCore|DOMErrorHandler||ManakaiDOM|ManakaiDOMLatest
5420     .handleError> ($err);
5421 wakaba 1.81 }__;
5422     } else {
5423     $err-><M::ecore|ErrorInterface||ManakaiDOM|Perl.throw>;
5424     }
5425 wakaba 1.84
5426     @Method:
5427     @@Name: getErrorInterfaceResource
5428     @@enDesc:
5429     Returns the <Q::ecore|ErrorInterface> resource
5430     to which the resource belongs.
5431     @@Return:
5432     @@@Type: DISAnyResource
5433     @@@enDesc:
5434     The interface resource.
5435     @@@nullCase:
5436     @@@@enDesc:
5437     If no resource found.
5438     @@@PerlDef:
5439     my $method;
5440     __CODE{DIS|getMethodForType::
5441     $resource => $self,
5442     $method_name => 'get_error_interface_resource',
5443     $method => $method,
5444     }__;
5445     if ($method) {
5446     __DEEP{
5447     $r = $method->(@_);
5448     }__;
5449     } else {
5450     $r = null;
5451     }
5452    
5453     @Method:
5454     @@Name: getErrorCodeResource
5455     @@enDesc:
5456     Returns the <Q::dx|ErrorCode> resource
5457     to which the resource belongs.
5458     @@Return:
5459     @@@Type: DISAnyResource
5460     @@@enDesc:
5461     The interface resource.
5462     @@@nullCase:
5463     @@@@enDesc:
5464     If no resource found.
5465     @@@PerlDef:
5466     my $method;
5467     __CODE{DIS|getMethodForType::
5468     $resource => $self,
5469     $method_name => 'get_error_code_resource',
5470     $method => $method,
5471     }__;
5472     if ($method) {
5473     __DEEP{
5474     $r = $method->(@_);
5475     }__;
5476     } else {
5477     $r = null;
5478     }
5479 wakaba 1.48 ##DISAnyResource
5480    
5481 wakaba 1.81 ResourceDef:
5482     @QName: DOMConfig
5483     @AliasFor: DOMCore|DOMConfiguration||ManakaiDOM|ManakaiDOMLatest
5484     @For: DIS|ForLatest
5485    
5486     ErrDef:
5487     @QName: DIS|more-than-one-methods-for-a-type
5488     @enDesc:
5489     If more than one different method implementations are defined
5490     for a resource type.
5491     @enMufDef:
5492     Method |%p (name => {<Q::DIS|method-name>});| for
5493     resource <%p (name => {<Q::DIS|uri>});> has multiple definitions
5494     @c:severity: DOMCore|SEVERITY_WARNING||ManakaiDOM|ManakaiDOMLatest
5495     @ecore:hasParameter:
5496     @@@: DIS|uri
5497     @@enDesc:
5498     A URI of the type.
5499     @ecore:hasParameter:
5500     @@@: DIS|method-name
5501     @@enDesc:
5502     The name of the method.
5503     @ecore:hasParameter:
5504     @@@: DIS|method-resource-types
5505     @@enDesc:
5506     The snapshot list of types for which methods are defined.
5507    
5508     XParamDef:
5509 wakaba 1.88 @QName: DIS|fileName
5510     @enDesc:
5511     The name of the file.
5512    
5513     XParamDef:
5514 wakaba 1.81 @QName: DIS|method-name
5515     @enDesc:
5516     The name of the method in question.
5517    
5518     XParamDef:
5519     @QName: DIS|method-resource-types
5520     @enDesc:
5521     The snapshot list of types for which methods are defined.
5522    
5523 wakaba 1.87 XParamDef:
5524     @QName: DIS|forURI
5525    
5526 wakaba 1.81 ElementTypeBinding:
5527     @Name: ErrDef
5528     @ElementType:
5529     dis:ResourceDef
5530     @ShadowContent:
5531     @@DISCore:resourceType: DOMCore|DOMErrorType
5532     @@For: DIS|ForLatest
5533     @@ecore:textFormatter: ecore|MUErrorFormatter||ManakaiDOM|Perl
5534    
5535 wakaba 1.79 URITypeDef:
5536     @QName: AnyResourceURI
5537     @enDesc:
5538     A URI that identifies a <Q::DISCore|AnyResource>.
5539    
5540     DataTypeDef:
5541     @QName: AnyResourceURIList
5542     @enDesc:
5543     A snapshot list of URIs that identify <Q::DISCore|AnyResource>s.
5544     @rdfs:subClassOf: DISPerl|ARRAY
5545    
5546     PropDef:
5547     @QName: DIS|typeURI
5548     @enDesc:
5549     The URI of the most specific type of the resource.
5550     @DIS:key: tu
5551    
5552 wakaba 1.48 IFClsDef:
5553     @IFQName: DISModule
5554     @ClsQName: ManakaiDISModuleDefinition
5555    
5556     @ClsISA: ManakaiDISPropertyAccessor
5557     @ClsISA: ManakaiDISPerlModuleDefinition
5558     @ClsISA: dp|ManakaiDISModulePerl
5559     @ClsISA: dp|ManakaiDISAnyResourcePerl
5560     @ClsISA: ManakaiDISAnyResource
5561    
5562     @Implement: DOMMinImpl
5563    
5564     @enDesc:
5565     <QUOTE::dis> module definitions.
5566    
5567     @enDesc:
5568     @@ForCheck: ManakaiDOM|ForIF
5569     @@@:
5570     The objects implementing the <IF::DISModule> interface <kwd:MUST>
5571     also implement the <IF::DISAnyResource> interface.
5572 wakaba 1.7
5573 wakaba 1.48 @DISLang:role: ModuleRole
5574    
5575     @Attr:
5576     @@ForCheck: ManakaiDOM|ForClass
5577     @@Name: uris
5578     @@Type:
5579 wakaba 1.60 DISPerl:Array::ManakaiDOM:all
5580 wakaba 1.7 @@enDesc:
5581 wakaba 1.48 A reference to the snapshot array containing the URI reference
5582     of the module.
5583     @@Get:
5584 wakaba 1.7 @@@PerlDef:
5585 wakaba 1.48 $r = [$self->{uri}];
5586 wakaba 1.8
5587     @Attr:
5588 wakaba 1.48 @@ForCheck: ManakaiDOM|ForClass
5589     @@Name: ownerModule
5590     @@ManakaiDOM:isRedefining:1
5591 wakaba 1.8 @@enDesc:
5592 wakaba 1.48 This module itself.
5593     @@Get:
5594     @@@Type: DISModule
5595     @@@clsActualType: ManakaiDISModuleDefinition
5596     @@@nullCase:
5597     @@@@enDesc:
5598     The resource is not part of any module since
5599     its definition is not read (<IF::DISModule.isDefined> is <DOM::false>).
5600     @@@PerlDef: $r = $self;
5601    
5602     @Method:
5603     @@ForCheck: ManakaiDOM|ForClass
5604     @@Name: getFeature
5605     @@Description:
5606     @@@lang:en
5607     @@@@:
5608     Returns a specialized object that implements the specialized
5609     interfaces of the specified feature and version.
5610     @@Param:
5611     @@@Name: feature
5612     @@@Type:
5613     DISLang:String::ManakaiDOM:all
5614     @@@actualType: DOMFeature|FeatureNameString||ManakaiDOM|ManakaiDOMLatest
5615     @@@Description:
5616     @@@@lang:en
5617     @@@@@:
5618     A feature name to request.
5619     @@Param:
5620     @@@Name: version
5621     @@@Type:
5622     DISLang:String::ManakaiDOM:all
5623     @@@actualType:
5624     DOMFeature|FeatureVersionString||ManakaiDOM|ManakaiDOMLatest
5625     @@@Description:
5626     @@@@lang:en
5627     @@@@@:
5628     A feature version number to request.
5629     @@Return:
5630     @@@Type:
5631     DOMMain:Object::ManakaiDOM:all
5632     @@@Description:
5633     @@@@lang:en
5634     @@@@@:
5635     An object that implements the specialized APIs of the
5636     <P::feature> and <P::version>.
5637 wakaba 1.49 @@@nullCase:
5638     @@@@enDesc:
5639 wakaba 1.48 There is no object available that implements interfaces
5640     associated with the <P::feature> and <P::version>.
5641     @@@PerlDef:
5642     $feature =~ s/^\+//;
5643     CLASS: for my $class (grep {
5644     $Message::Util::DIS::ManakaiDISModuleDefinition::CompatClass{$_}
5645     } keys %Message::Util::DIS::ManakaiDISModuleDefinition::CompatClass) {
5646     if ($Message::DOM::ClassFeature{$class}->{$feature}->{$version}) {
5647     $r = bless {o => $self}, $class;
5648     last CLASS;
5649 wakaba 1.27 }
5650 wakaba 1.8 }
5651    
5652 wakaba 1.55 @Method:
5653     @@Name: addResourceList
5654     @@enDesc:
5655     Adds a resource to the list of resources belongs to the module.
5656     @@Param:
5657     @@@Name: disResource
5658     @@@Type: DIS|DISResource
5659     @@@enDesc: The resource to add.
5660     @@Return:
5661     @@@PerlDef:
5662     __DEEP{
5663     push @{$self->{<H::DIS|resource>}||=[]},
5664 wakaba 1.85 map {\$_} @{$disResource-><AG::DIS|DISAnyResource.uris>};
5665 wakaba 1.55 }__;
5666 wakaba 1.86
5667     @Method:
5668     @@Name: addResourceURI
5669     @@enDesc:
5670     Adds a resource URI to the list of resources belongs to the module.
5671     @@Param:
5672     @@@Name: uri
5673     @@@Type: DISString
5674     @@@enDesc:
5675     The URI to add.
5676     @@Return:
5677     @@@PerlDef:
5678     push @{$self->{<H::DIS|resource>}||=[]}, \$uri;
5679    
5680     @Method:
5681     @@Name: getResourceURIList
5682     @@enDesc:
5683     Returns the list of URIs of resources belongs to the module.
5684     @@Return:
5685     @@@Type: AnyResourceURIList
5686     @@@enDesc:
5687     The snapshot list of URIs.
5688     @@@PerlDef:
5689     $r = [map {$$_} @{$self->{<H::DIS|resource>} or []}];
5690 wakaba 1.55
5691     @Method:
5692     @@Name: getResourceList
5693     @@enDesc:
5694     Returns the list of resources belongs to the module.
5695     @@Return:
5696     @@@Type: DIS|ResourceList
5697     @@@enDesc:
5698     The current snapshot of children.
5699     @@@PerlDef:
5700     __DEEP{
5701     my $db = $self-><AG::DIS|DISAnyResource.database>;
5702     $r = [map {
5703     $db-><M::DIS|DISDatabase.getResource> ($$_)
5704     } @{$self->{<H::DIS|resource>}}];
5705     }__;
5706 wakaba 1.57
5707 wakaba 1.85 @Method:
5708     @@Name: addForResource
5709     @@enDesc:
5710     Adds a <QUOTE::for> resource to the list of <QUOTE::for>
5711     resources belongs to the module.
5712     @@Param:
5713     @@@Name: disResource
5714     @@@Type: DISFor
5715     @@@enDesc: The resource to add.
5716     @@Return:
5717     @@@PerlDef:
5718     __DEEP{
5719     push @{$self->{<H::DIS|forList>}||=[]},
5720     $disResource-><AG::DISAnyResource.uriRef>;
5721     }__;
5722    
5723     @Method:
5724     @@Name: getForResourceList
5725     @@enDesc:
5726     Returns the list of <QUOTE::for> resources belongs to the module.
5727     @@Return:
5728     @@@Type: ResourceList
5729     @@@enDesc:
5730     The current snapshot list of <QUOTE::for> resources,
5731     which may or may not contains dupulications.
5732     @@@PerlDef:
5733     __DEEP{
5734     my $db = $self-><AG::DIS|DISAnyResource.database>;
5735     $r = [map {
5736     $db-><M::DIS|DISDatabase.getFor> ($$_)
5737     } @{$self->{<H::DIS|forList>}}];
5738     }__;
5739    
5740 wakaba 1.57 @Attr:
5741     @@Name: targetNamespaceURI
5742     @@enDesc:
5743     The default namespace URI of the resources defined in the module.
5744     @@Type: DIS|AnyURI
5745     @@Get:
5746     @@@PerlDef:
5747     $r = defined $self->{<H::DIS|defaultNamespaceURI>}
5748     ? ${$self->{<H::DIS|defaultNamespaceURI>}} : null;
5749     @@Set:
5750     @@@ForCheck: ManakaiDOM|ForClass
5751     @@@PerlDef:
5752     if (defined $given) {
5753     $self->{<H::DIS|defaultNamespaceURI>} = \$given;
5754     } else {
5755     CORE::delete $self->{<H::DIS|defaultNamespaceURI>};
5756     }
5757 wakaba 1.61
5758 wakaba 1.79 @CMethod:
5759     @@Name: getSuperResourceURIList
5760 wakaba 1.61 @@enDesc:
5761 wakaba 1.79 Returns a snapshot list of super-resources URIs of the resource,
5762     including canonical and alias URIs of the resource itself.
5763     @@Return:
5764     @@@Type: URIList
5765 wakaba 1.61 @@@enDesc:
5766 wakaba 1.79 A snapshot list of URIs.
5767     @@@PerlDef:
5768     $r = [$self->{uri}];
5769    
5770     @@Test:
5771     @@@QName: DISModule.getSuperResourceURIList.test
5772 wakaba 1.61 @@@PerlDef:
5773 wakaba 1.79 my $db;
5774     __CODE{createDISDBForTest:: $db => $db}__;
5775    
5776     my $res = $db-><M::DISDatabase.getModule> ('about:1');
5777    
5778     my %list = map {$_ => true} @{$res-><M::DISAnyResource
5779     .getSuperResourceURIList>};
5780    
5781     $test->assert_true ($list{'about:1'});
5782     $test->assert_false ($list{'about:2'});
5783 wakaba 1.87
5784     @Method:
5785     @@Name: getReferringModuleURIList
5786     @@enDesc:
5787     Reurns a snapshot list of the name URIs of modules referenced
5788     from the module.
5789     @@Return:
5790     @@@Type: URIList
5791     @@@enDesc:
5792     The snapshot list of URIs.
5793     @@@PerlDef:
5794     $r = [grep {$self->{<H::DIS|referringModule>}->{$_}}
5795     keys %{$self->{<H::DIS|referringModule>} or {}}];
5796    
5797     @Method:
5798     @@Name: addReferringModuleURI
5799     @@enDesc:
5800     Adds a URI to the list of modules referenced from the module.
5801     @@Param:
5802     @@@Name: uri
5803     @@@Type: DISString
5804     @@@enDesc:
5805     The URI to add.
5806     @@Return:
5807     @@@PerlDef:
5808     $self->{<H::DIS|referringModule>}->{$uri} = true;
5809 wakaba 1.48 ##DISModule
5810 wakaba 1.87
5811     PropDef:
5812     @QName: DIS|referringModule
5813     @DIS:key: ref
5814 wakaba 1.55
5815 wakaba 1.85 PropDef:
5816     @QName: DIS|forList
5817     @enDesc:
5818     A list of references to URIs of <QUOTE::for> resources
5819     belongs to the module.
5820    
5821 wakaba 1.55 ClsDef:
5822     @ClsQName: ManakaiDISModuleLite
5823    
5824     @Implement: DOMMinImpl
5825     @Implement: DIS|DISResourceProp
5826     @Implement: dp|DISAnyResourcePerl
5827     @Implement: dp|DISModulePerl
5828     @Implement: dp|DISResourcePerlModule
5829    
5830     @enDesc:
5831     The <Class::ManakaiDISModuleLite> class provides very small
5832     subset of <Class::ManakaiDISModuleDefinition> class. If a
5833     method or attribute which is not implemented by the class, then
5834     the object is updated to the <Class::ManakaiDISModuleDefinition>
5835     by reading additional properties from the <QUOTE::dis> database.
5836    
5837     @Attr:
5838 wakaba 1.88 @@Name: uri
5839     @@Type: AnyURI
5840     @@Description:
5841     @@@lang:en
5842     @@@@:
5843     The URI reference of the resource.
5844     @@Get:
5845     @@@enDesc:
5846     The representive URI reference of the resource.
5847    
5848     {NOTE:: The URI might be non-persistent if the
5849     resource is not assigned a URI in <QUOTE::dis> source file,
5850     in which case a URI is randomly-generated at the
5851     time of object generation.
5852     }
5853     @@@PerlDef:
5854     $r = $self->{uri};
5855    
5856     @Attr:
5857     @@Name: uriRef
5858     @@Type: DISPerl|SCALAR||ManakaiDOM|all
5859     @@enDesc:
5860     A reference to the URI of the resource.
5861    
5862     {NOTE:: Applications <kwd:MUST-NOT> modify the referenced
5863     value directly.
5864     }
5865     @@Get:
5866     @@@PerlDef: $r = \ ($self->{uri});
5867    
5868     @Attr:
5869 wakaba 1.55 @@ForCheck: ManakaiDOM|ForClass
5870     @@Name: uris
5871     @@Type:
5872 wakaba 1.60 DISPerl:Array::ManakaiDOM:all
5873 wakaba 1.55 @@enDesc:
5874     A reference to the snapshot array containing the URI reference
5875     of the module.
5876     @@Get:
5877     @@@PerlDef:
5878     $r = [$self->{uri}];
5879    
5880 wakaba 1.88 @Method:
5881     @@Name: isSameResource
5882     @@Operator:
5883     @@@@:eq
5884     @@@ContentType:
5885     lang:Perl
5886     @@enDesc:
5887     Whether two resources are same or not. Two resources are
5888     same if and only if their <A::DISAnyResource.uri> are
5889     equivalent as strings (i.e. in character-by-character based matching).
5890     @@Param:
5891     @@@Name: anotherResource
5892     @@@Type: DISAnyResource
5893     @@@enDesc:
5894     Another resource object to compare.
5895     @@Return:
5896     @@@Type:
5897     DOMMain:boolean::ManakaiDOM:all
5898     @@@enDesc:
5899     Whether two resources are same or not.
5900     @@@TrueCase:
5901     @@@@enDesc: Two resources are same.
5902     @@@FalseCase:
5903     @@@@enDesc: Two resources are different.
5904     @@@PerlDef:
5905     if (UNIVERSAL::isa ($anotherResource,
5906     <ClassName::ManakaiDISAnyResource>)) {
5907     $r = $self->{uri} eq $anotherResource->{uri};
5908     }
5909    
5910     @Attr:
5911     @@Name: nameURI
5912     @@Type: NameURI
5913     @@enDesc:
5914     The URI reference of this module, without
5915     <QUOTE::for> identifier.
5916     @@Get:
5917     @@@enDesc:
5918     The name URI of the resource.
5919     @@@nullCase:
5920     @@@@enDesc:
5921     The resource has no name URI.
5922    
5923     {NOTE:: A resource has no URI if and only if the resource
5924     has no local name.
5925     }
5926     @@@PerlDef:
5927     if (defined $self->{localName}) {
5928     $r = defined $self->{namespaceURI}
5929     ? ${$self->{namespaceURI}} . ${$self->{localName}}
5930     : ${$self->{localName}};
5931     }
5932    
5933     @Attr:
5934     @@Name: localName
5935     @@enDesc:
5936     The local name of this module.
5937    
5938     {NOTE:: <QUOTE::for> resources has no local name.
5939     }
5940     @@Type:
5941     DISCore:LocalName::ManakaiDOM:all
5942     @@Get:
5943     @@@PerlDef:
5944     $r = defined $self->{localName} ? ${$self->{localName}} : null;
5945    
5946     @Attr:
5947     @@Name: namespaceURI
5948     @@Type: AnyURI
5949     @@enDesc:
5950     The namespace URI of the name of this resource.
5951    
5952     {NOTE:: <QUOTE::for> resources has no namespace URI.
5953     }
5954     @@Get:
5955     @@@PerlDef:
5956     $r = defined $self->{namespaceURI} ? ${$self->{namespaceURI}} : null;
5957    
5958     @Attr:
5959     @@Name: forURI
5960     @@Type: ForURI
5961     @@enDesc:
5962     The <QUOTE::for> URI reference for which this module is defined.
5963     @@Get:
5964     @@@PerlDef:
5965     $r = defined $self->{for} ? ${$self->{for}} : null;
5966    
5967     @Attr:
5968     @@Name: forpURI
5969     @@enDesc:
5970     The <QUOTE::for+> URI references for which this resource is defined.
5971    
5972     {NOTE:: <QUOTE::for> resources has no <QUOTE::for+> URI.
5973     }
5974     @@Type: ForURIList
5975     @@Get:
5976     @@@enDesc:
5977     List of <QUOTE::for> URI references. Note that this list is
5978     <QUOTE::dead>.
5979     @@@PerlDef:
5980     $r = [@{$self->{forp}}];
5981    
5982     @Method:
5983     @@Name: isForURI
5984     @@enDesc:
5985     Tests whether this resource is defined for a <QUOTE::for>
5986     or <QUOTE::for+> URI reference or not.
5987     @@Param:
5988     @@@Name:forURI
5989     @@@Type:ForURI
5990     @@@enDesc:
5991     A <QUOTE::for> URI reference to test.
5992     @@Return:
5993     @@@Type:
5994     DOMMain:boolean::ManakaiDOM:all
5995     @@@TrueCase:
5996     @@@@enDesc:
5997     This resource is for <P::forURI>.
5998     @@@FalseCase:
5999     @@@@enDesc:
6000     This resource is not for <P::forURI>.
6001     @@@PerlDef:
6002     __DEEP{
6003     C: for my $this_for_uri (${$self->{for}||\''}, @{$self->{forp}||[]}) {
6004     if ($this_for_uri eq $forURI) { ## Shortcut
6005     $r = true;
6006     last C;
6007     }
6008     my $this_for = $self->{db}-><M::DIS|DISDatabase.getFor>
6009     ($this_for_uri);
6010     if ($this_for-><M::DIS|DISFor.isaURI> ($forURI)) {
6011     $r = true;
6012     last C;
6013     }
6014     }
6015     }__;
6016    
6017     @Attr:
6018     @@Name: isDefined
6019     @@Description:
6020     @@@lang:en
6021     @@@@:
6022     Whether this module is defined or not.
6023     @@Type:
6024     DOMMain:boolean::ManakaiDOM:all
6025     @@Get:
6026     @@@PerlDef:
6027     $r = $self->{<H::DIS|isDefined>};
6028     @@Set:
6029     @@@PerlDef:
6030     $self->{<H::DIS|isDefined>} = $given;
6031    
6032 wakaba 1.55 @Attr:
6033     @@ForCheck: ManakaiDOM|ForClass
6034     @@Name: ownerModule
6035     @@ManakaiDOM:isRedefining:1
6036     @@enDesc:
6037     This module itself.
6038     @@Get:
6039     @@@Type: DISModule
6040     @@@clsActualType: ManakaiDISModuleDefinition
6041     @@@nullCase:
6042     @@@@enDesc:
6043     The resource is not part of any module since
6044     its definition is not read (<IF::DISModule.isDefined> is <DOM::false>).
6045     @@@PerlDef: $r = $self;
6046    
6047 wakaba 1.88 @Attr:
6048     @@Name: ownerModuleURI
6049     @@enDesc:
6050     A URI of the owner module of the resource.
6051     @@Type: DIS|AnyURI
6052     @@nullCase:
6053     @@@enDesc:
6054     The resource does not belong to any module since the
6055     resource definition is not read yet or since
6056     it is created in memory.
6057     @@Get:
6058     @@@PerlDef:
6059     $r = $self->{uri};
6060    
6061     @Attr:
6062     @@Name: ownerModuleURIRef
6063     @@enDesc:
6064     A reference to a URI of the owner module of the resource.
6065     @@Type: DISPerl|SCALAR||ManakaiDOM|Perl
6066     @@nullCase:
6067     @@@enDesc:
6068     The resource does not belong to any module since the
6069     resource definition is not read yet or since
6070     it is created in memory.
6071     @@Get:
6072     @@@PerlDef:
6073     $r = \ ($self->{uri});
6074     @@Set:
6075     @@@PerlDef: # no effect
6076    
6077     @Attr:
6078     @@Name: database
6079     @@enDesc:
6080     The <QUOTE::dis> database to which the resource belongs.
6081     @@Type: DISDatabase
6082     @@clsActualType: ManakaiDISDatabase
6083     @@Get:
6084     @@@PerlDef:
6085     $r = $self->{db};
6086    
6087 wakaba 1.55 @Method:
6088     @@Operator:
6089     @@@@: AUTOLOAD
6090     @@@ContentType: lang|Perl
6091     @@Return:
6092     @@@PerlDef:
6093 wakaba 1.57 my $al = our $AUTOLOAD;
6094     $al =~ s/.+:://;
6095     if ($al ne 'DESTROY') {
6096    
6097 wakaba 1.55 __DEEP{
6098     $self-><AG::DIS|DISAnyResource.database>
6099     -><M::dp|ManakaiDISDatabasePerl.plLoadDISDatabaseModule> ($self);
6100     }__;
6101     if (ref $self eq <ClassName::ManakaiDISModuleLite>) {
6102     __EXCEPTION{DIS|RESOURCE_NOT_DEFINED_ERR::
6103     DIS:uri => {$self-><AG::DIS|DISAnyResource.uri>},
6104     DIS:moduleURI => {$self-><AG::DIS|DISAnyResource.uri>},
6105     }__;
6106     }
6107    
6108     my $code = $self->can ($al);
6109     if ($code) {
6110     goto &$code;
6111     } else {
6112     require Carp;
6113 wakaba 1.67 local $Carp::CarpLevel = $Error::Depth;
6114 wakaba 1.55 Carp::croak (qq<Can't locate method "$AUTOLOAD">);
6115     }
6116 wakaba 1.57
6117     } # $al
6118    
6119     @Attr:
6120     @@Name: targetNamespaceURI
6121     @@enDesc:
6122     The default namespace URI of the resources defined in the module.
6123     @@Type: DIS|AnyURI
6124     @@Get:
6125     @@@PerlDef:
6126     $r = defined $self->{<H::DIS|defaultNamespaceURI>}
6127     ? ${$self->{<H::DIS|defaultNamespaceURI>}} : null;
6128 wakaba 1.55 ##DISModuleLite
6129 wakaba 1.48
6130     IFClsDef:
6131     @IFQName: DISFor
6132     @ClsQName: ManakaiDISForDefinition
6133    
6134     @ClsISA: dp|ManakaiDISAnyResourcePerl
6135 wakaba 1.79 @ClsISA: ManakaiDISPropertyAccessor
6136 wakaba 1.48 @ClsISA: ManakaiDISAnyResource
6137    
6138     @DISLang:role: ForRole
6139    
6140     @Description:
6141     @@lang:en
6142     @@@:
6143     <QUOTE::dis> <QUOTE::for> definitions.
6144 wakaba 1.8
6145     @Attr:
6146 wakaba 1.48 @@ForCheck: ManakaiDOM|ForClass
6147     @@Name: uris
6148     @@Type:
6149 wakaba 1.60 DISPerl:Array::ManakaiDOM:all
6150 wakaba 1.48 @@actualType: ForURIList
6151 wakaba 1.15 @@enDesc:
6152 wakaba 1.48 A reference to the snapshot array containing the URI reference
6153     of the <QUOTE::for>.
6154 wakaba 1.15 @@Get:
6155     @@@PerlDef:
6156 wakaba 1.48 $r = [$self->{uri}];
6157 wakaba 1.18
6158 wakaba 1.48 @Method:
6159     @@Name: isaURI
6160     @@Description:
6161     @@@lang:en
6162     @@@@:
6163     Whether this <QUOTE::for> is-a another <QUOTE::for> or not.
6164     @@Param:
6165     @@@Name: superURI
6166     @@@Type: ForURI
6167     @@@Description:
6168     @@@@lang:en
6169     @@@@@:
6170     Another <QUOTE::for> URI reference to test.
6171     @@Return:
6172     @@@Type:
6173     DOMMain:boolean::ManakaiDOM:all
6174     @@@TrueCase:
6175     @@@@enDesc:
6176     <P::superURI> is a super-<QUOTE::for> of this <QUOTE::for>.
6177     @@@FalseCase:
6178     @@@@enDesc:
6179     <P::superURI> is not a super-<QUOTE::for> of this <QUOTE::for>.
6180 wakaba 1.18 @@@PerlDef:
6181 wakaba 1.48 $r = $self->{uri} eq $superURI ? true : $self->{isa}->{$superURI};
6182 wakaba 1.15
6183 wakaba 1.48 @Method:
6184     @@Name: addISA
6185 wakaba 1.8 @@enDesc:
6186 wakaba 1.48 Adds a <QUOTE::for> to the list of super-<QUOTE::for> of this
6187     <QUOTE::for>.
6188     @@Param:
6189     @@@Name: superFor
6190     @@@Type: DISFor
6191     @@@clsActualType: ManakaiDISForDefinition
6192 wakaba 1.8 @@@enDesc:
6193 wakaba 1.48 A <QUOTE::for> definition object.
6194     @@Return:
6195 wakaba 1.8 @@@PerlDef:
6196 wakaba 1.48 my @from = ($self->{uri},
6197     grep {$self->{revISA}->{$_}} keys %{$self->{revISA}});
6198     my @to = ($superFor->{uri},
6199     grep {$superFor->{isa}->{$_}} keys %{$superFor->{isa}});
6200 wakaba 1.8 __DEEP{
6201 wakaba 1.48 for my $from (@from) {
6202     for my $to (@to) {
6203     $self->{db}-><M::ManakaiDISDatabase.getFor>
6204     ($from)->{isa}->{$to} = true;
6205     $self->{db}-><M::ManakaiDISDatabase.getFor>
6206     ($to)->{revISA}->{$from} = true;
6207 wakaba 1.8 }
6208     }
6209     }__;
6210    
6211 wakaba 1.48 @Method:
6212     @@Name: getFeature
6213     @@Description:
6214     @@@lang:en
6215     @@@@:
6216     Returns a specialized object that implements the specialized
6217     interfaces of the specified feature and version.
6218     @@Param:
6219     @@@Name: feature
6220     @@@Type:
6221     DISLang:String::ManakaiDOM:all
6222     @@@actualType:
6223     ManakaiDOM:ManakaiDOMFeatureName::ManakaiDOM:ManakaiDOMLatest
6224     @@@Description:
6225     @@@@lang:en
6226     @@@@@:
6227     A feature name to request.
6228     @@Param:
6229     @@@Name: version
6230     @@@Type:
6231     DISLang:String::ManakaiDOM:all
6232     @@@actualType:
6233     ManakaiDOM:ManakaiDOMFeatureVersion::ManakaiDOM:ManakaiDOMLatest
6234     @@@Description:
6235     @@@@lang:en
6236     @@@@@:
6237     A feature version number to request.
6238     @@Return:
6239     @@@Type:
6240     DOMMain:Object::ManakaiDOM:all
6241     @@@Description:
6242     @@@@lang:en
6243     @@@@@:
6244     An object that implements the specialized APIs of the
6245     <P::feature> and <P::version>.
6246 wakaba 1.49 @@@nullCase:
6247     @@@@enDesc:
6248 wakaba 1.48 There is no object available that implements interfaces
6249     associated with the <P::feature> and <P::version>.
6250     @@@PerlDef:
6251     $feature =~ s/^\+//;
6252     CLASS: for my $class (grep {
6253     $Message::Util::DIS::ManakaiDISForDefinition::CompatClass{$_}
6254     } keys %Message::Util::DIS::ManakaiDISForDefinition::CompatClass) {
6255     if ($Message::DOM::ClassFeature{$class}->{$feature}->{$version}) {
6256     $r = bless {o => $self}, $class;
6257     last CLASS;
6258 wakaba 1.8 }
6259     }
6260    
6261     @Attr:
6262 wakaba 1.48 @@ForCheck: ManakaiDOM|ForClass
6263     @@Name: forURI
6264     @@Type: ForURI
6265 wakaba 1.8 @@enDesc:
6266 wakaba 1.48 The <QUOTE::for> URI reference for which this module is defined.
6267 wakaba 1.8 @@Get:
6268 wakaba 1.48 @@@InCase:
6269     @@@@Value:
6270     @@@@@@: ManakaiDOM|all
6271 wakaba 1.68 @@@@@ContentType: DISCore|QName
6272 wakaba 1.8 @@@@enDesc:
6273 wakaba 1.48 The attribute value is always <Q::ManakaiDOM|all> for a
6274     <QUOTE::for> resource.
6275 wakaba 1.8 @@@PerlDef:
6276 wakaba 1.48 $r = <Q::ManakaiDOM|all>;
6277 wakaba 1.8
6278     @Attr:
6279 wakaba 1.48 @@Name: forpURI
6280 wakaba 1.8 @@enDesc:
6281 wakaba 1.48 The <QUOTE::for+> URI references for which this resource is defined.
6282     @@Type: ForURIList
6283 wakaba 1.8 @@Get:
6284 wakaba 1.48 @@@enDesc:
6285     List of <QUOTE::for> URI references. Note that this list is
6286     <QUOTE::dead>.
6287     @@@InCase:
6288     @@@@Value:
6289     @@@@@@: []
6290     @@@@@ContentType: lang|Perl
6291 wakaba 1.8 @@@@enDesc:
6292 wakaba 1.48 The attribute value is always an empty array reference
6293     for a <QUOTE::for> resource.
6294     @@@PerlDef: $r = [];
6295 wakaba 1.9
6296 wakaba 1.48 @Method:
6297     @@Name: isForURI
6298 wakaba 1.9 @@enDesc:
6299 wakaba 1.48 Tests whether this resource is defined for a <QUOTE::for>
6300     or <QUOTE::for+> URI reference or not.
6301 wakaba 1.9 @@Param:
6302 wakaba 1.48 @@@Name:forURI
6303     @@@Type:ForURI
6304     @@@enDesc:
6305     A <QUOTE::for> URI reference to test.
6306 wakaba 1.9 @@Return:
6307     @@@Type:
6308 wakaba 1.48 DOMMain:boolean::ManakaiDOM:all
6309     @@@TrueCase:
6310     @@@@enDesc:
6311     This resource is for <P::forURI>. The attribute
6312     always takes this value for <QUOTE::for> resources.
6313     @@@PerlDef: $r = true;
6314 wakaba 1.12
6315     @Attr:
6316 wakaba 1.48 @@ForCheck: ManakaiDOM|ForClass
6317     @@Name: nameURI
6318     @@Type: NameURI
6319 wakaba 1.12 @@enDesc:
6320 wakaba 1.48 The URI reference of this module, without
6321     <QUOTE::for> identifier.
6322 wakaba 1.12 @@Get:
6323 wakaba 1.49 @@@enDesc:
6324     The attribute value is always equals to
6325     <A::DISAnyResource.uri> for <QUOTE::for> resources.
6326     @@@PerlDef: $r = $self->{uri};
6327 wakaba 1.61
6328 wakaba 1.79 @CMethod:
6329     @@Name: getSuperResourceURIList
6330 wakaba 1.61 @@enDesc:
6331 wakaba 1.79 Returns a snapshot list of super-resources URIs of the resource,
6332     including canonical and alias URIs of the resource itself.
6333     @@Return:
6334     @@@Type: URIList
6335 wakaba 1.61 @@@enDesc:
6336 wakaba 1.79 A snapshot list of URIs.
6337     @@@PerlDef:
6338     $r = [
6339     (grep {$self->{isa}->{$_}} keys %{$self->{isa}}),
6340     (grep {$self->{aliasURI}->{$_}} keys %{$self->{aliasURI}}),
6341     ($self->{uri}),
6342     ];
6343    
6344     @@Test:
6345     @@@QName: DISFor.getSuperResourceURIList.test
6346 wakaba 1.61 @@@PerlDef:
6347 wakaba 1.79 my $db;
6348     __CODE{createDISDBForTest:: $db => $db}__;
6349    
6350     my $res1 = $db-><M::DISDatabase.getFor> ('about:1');
6351    
6352     my %list1 = map {$_ => true} @{$res1-><M::DISAnyResource
6353     .getSuperResourceURIList>};
6354    
6355     $test->assert_true ($list1{'about:1'});
6356     $test->assert_false ($list1{'about:2'});
6357     $test->assert_true ($list1{<Q::ManakaiDOM:all>});
6358    
6359     my $res2 = $db-><M::DISDatabase.getFor> ('about:2');
6360     $res1-><M::DISFor.addISA> ($res2);
6361    
6362     my %list1_2 = map {$_ => true} @{$res1-><M::DISAnyResource
6363     .getSuperResourceURIList>};
6364    
6365     $test->assert_true ($list1_2{'about:1'});
6366     $test->assert_true ($list1_2{'about:2'});
6367     $test->assert_true ($list1_2{<Q::ManakaiDOM:all>});
6368    
6369     my %list2 = map {$_ => true} @{$res2-><M::DISAnyResource
6370     .getSuperResourceURIList>};
6371    
6372     $test->assert_false ($list2{'about:1'});
6373     $test->assert_true ($list2{'about:2'});
6374     $test->assert_true ($list2{<Q::ManakaiDOM:all>});
6375 wakaba 1.48 ##DISFor
6376 wakaba 1.18
6377 wakaba 1.48 PropDef:
6378     @QName: isFeatureImplemented
6379     @enDesc:
6380     The list of whether a feature is implemented or not.
6381 wakaba 1.18
6382 wakaba 1.48 IFClsDef:
6383     @IFQName: DISResource
6384     @ClsQName: ManakaiDISResourceDefinition
6385 wakaba 1.19
6386 wakaba 1.48 @ClsISA: ManakaiDISResourceMV
6387     @ClsISA: dp|ManakaiDISResourcePerl
6388     @ClsISA: ManakaiDISPerlModuleDefinition
6389     @ClsISA: dp|ManakaiDISAnyResourcePerl
6390     @ClsISA: ManakaiDISPropertyAccessor
6391     @ClsISA: ManakaiDISAnyResource
6392 wakaba 1.19
6393 wakaba 1.48 @DISLang:role: ResourceRole
6394 wakaba 1.19
6395 wakaba 1.48 @enDesc:
6396     <QUOTE::dis> resource definitions.
6397 wakaba 1.19
6398 wakaba 1.48 @enDesc:
6399     @@ForCheck: ManakaiDOM|ForIF
6400     @@@:
6401     The objects implementing the <IF::DISResource> interface
6402     <kwd:MUST> also implement the <IF::DISAnyResource> interface.
6403 wakaba 1.12
6404 wakaba 1.46 @Attr:
6405 wakaba 1.48 @@ForCheck: ManakaiDOM|ForClass
6406     @@Name: uris
6407     @@Type:
6408 wakaba 1.60 DISPerl:Array::ManakaiDOM:all
6409 wakaba 1.46 @@enDesc:
6410 wakaba 1.48 Returns the current <EM::snapshot> of the URI references
6411     for this resource, including the alias URI references.
6412 wakaba 1.46 @@Get:
6413     @@@PerlDef:
6414 wakaba 1.48 $r = [grep {$self->{aliasURI}->{$_}} keys %{$self->{aliasURI}}];
6415 wakaba 1.46
6416 wakaba 1.12 @Method:
6417 wakaba 1.48 @@Name: isSubsetOfURI
6418     @@Description:
6419 wakaba 1.37 @@@lang:en
6420     @@@@:
6421 wakaba 1.48 Whether this resource is a subset of another resource or not.
6422     @@Param:
6423     @@@Name: superURI
6424     @@@Type: ResourceURI
6425     @@@Description:
6426     @@@@lang:en
6427     @@@@@:
6428     Another resource URI reference to test.
6429 wakaba 1.12 @@Return:
6430 wakaba 1.48 @@@Type:
6431     DOMMain:boolean::ManakaiDOM:all
6432     @@@TrueCase:
6433     @@@@enDesc:
6434     <P::superURI> is a super-resource of this resource.
6435     @@@FalseCase:
6436 wakaba 1.12 @@@@enDesc:
6437 wakaba 1.48 <P::superURI> is not a super-resource of this resource.
6438 wakaba 1.12 @@@PerlDef:
6439 wakaba 1.48 $r = $self->{aliasURI}->{$superURI} || $self->{subOf}->{$superURI};
6440 wakaba 1.13
6441     @Method:
6442 wakaba 1.48 @@Name: addSuperResource
6443 wakaba 1.13 @@enDesc:
6444 wakaba 1.48 Adds a <QUOTE::dis> resource to the list of super-resource
6445     of this <QUOTE::dis> resource.
6446 wakaba 1.13 @@Param:
6447 wakaba 1.48 @@@Name: superRes
6448 wakaba 1.47 @@@Type: DISResource
6449     @@@clsActualType: ManakaiDISResourceDefinition
6450 wakaba 1.13 @@@enDesc:
6451 wakaba 1.48 A <QUOTE::dis> resource definition object.
6452     @@Return:
6453 wakaba 1.13 @@@PerlDef:
6454 wakaba 1.48 my @from = ($self->{uri},
6455 wakaba 1.50 grep {$self->{supOf}->{$_}} keys %{$self->{supOf}||{}});
6456 wakaba 1.48 my @to = ($superRes->{uri},
6457 wakaba 1.50 grep {$superRes->{subOf}->{$_}} keys %{$superRes->{subOf}||{}});
6458 wakaba 1.13 __DEEP{
6459 wakaba 1.48 for my $from (@from) {
6460     for my $to (@to) {
6461     $self->{db}-><M::ManakaiDISDatabase.getResource>
6462     ($from)->{subOf}->{$to} = true;
6463     $self->{db}-><M::ManakaiDISDatabase.getResource>
6464     ($to)->{supOf}->{$from} = true;
6465 wakaba 1.13 }
6466     }
6467     }__;
6468 wakaba 1.48
6469 wakaba 1.13 @Method:
6470 wakaba 1.48 @@Name: mergeAsAlias
6471 wakaba 1.13 @@enDesc:
6472 wakaba 1.48 Merges another resource definition as an alias of this resource.
6473 wakaba 1.13 @@Param:
6474 wakaba 1.48 @@@Name: aliasResource
6475 wakaba 1.47 @@@Type: DISResource
6476     @@@clsActualType: ManakaiDISResourceDefinition
6477 wakaba 1.13 @@@enDesc:
6478 wakaba 1.48 A resource to merge.
6479     \
6480     {NOTE:: After merging all references to <P::aliasResource>
6481     should be discarded.
6482     \
6483     }
6484     @@NodeParam:
6485 wakaba 1.88 @@NamedParam:
6486     @@@Name: noEqualityCheck
6487     @@@Type: idl|boolean||ManakaiDOM|all
6488     @@@enDesc:
6489     Don't throw <X::MERGE_ITSELF_ERR> exception.
6490 wakaba 1.48 @@Return:
6491     @@@RaiseException:
6492     @@@@@:MERGE_ITSELF_ERR
6493     @@@@@@enDesc:
6494     An attempt is made to merge this resource itself.
6495 wakaba 1.13 @@@PerlDef:
6496 wakaba 1.88 if (not $noEqualityCheck and $self eq $aliasResource) {
6497 wakaba 1.48 __EXCEPTION{MERGE_ITSELF_ERR::
6498     DIS:uri => {$self->{uri}},
6499     DIS:sourceNode => {$node},
6500     }__;
6501     }
6502     for my $uri ($aliasResource->{uri},
6503     grep {$aliasResource->{aliasURI}->{$_}}
6504     keys %{$aliasResource->{aliasURI}}) {
6505     $self->{aliasURI}->{$uri} = true;
6506     $self->{db}->{resDef}->{$uri} = $self;
6507     $self->{subOf}->{$uri} = true;
6508     $self->{supOf}->{$uri} = true;
6509     }
6510     for my $uri (grep {$aliasResource->{subOf}->{$_}}
6511 wakaba 1.50 keys %{$aliasResource->{subOf}||{}}) {
6512 wakaba 1.48 $self->{subOf}->{$uri} = true;
6513     }
6514     for my $uri (grep {$aliasResource->{supOf}->{$_}}
6515 wakaba 1.50 keys %{$aliasResource->{supOf}||{}}) {
6516 wakaba 1.48 $self->{supOf}->{$uri} = true;
6517     }
6518 wakaba 1.50 my @from = grep {$self->{supOf}->{$_}} keys %{$self->{supOf}||{}};
6519     my @to = grep {$self->{subOf}->{$_}} keys %{$self->{subOf}||{}};
6520 wakaba 1.13 __DEEP{
6521 wakaba 1.48 for my $from (@from) {
6522     for my $to (@to) {
6523     $self->{db}-><M::ManakaiDISDatabase.getResource>
6524     ($from)->{subOf}->{$to} = true;
6525     $self->{db}-><M::ManakaiDISDatabase.getResource>
6526     ($to)->{supOf}->{$from} = true;
6527 wakaba 1.13 }
6528     }
6529     }__;
6530 wakaba 1.15
6531 wakaba 1.48 @Attr:
6532     @@Name: disDataTypeResource
6533     @@enDesc:
6534     The resource referenced by <Q::dis:Type> property.
6535 wakaba 1.15
6536 wakaba 1.48 = If the resource has the <Q::dis:Type> property,
6537     then its value references the data type resource.
6538 wakaba 1.15
6539 wakaba 1.48 = If the resource has no <Q::dis:Type> property but
6540     the dynamic parent resource has the <Q::dis:Type> property,
6541     then its value references the data type resource.
6542    
6543     = Otherwise, the resource has no associated data type resoruce;
6544     this method throws a <X::NO_DIS_TYPE_ERR> exception.
6545     @@Type: DISResource
6546     @@clsActualType: ManakaiDISResourceDefinition
6547     @@Get:
6548     @@@RaiseException:
6549     @@@@@:NO_DIS_TYPE_ERR
6550 wakaba 1.16 @@@@enDesc:
6551 wakaba 1.48 <Q::dis:Type> attribute is not specified.
6552 wakaba 1.13 @@@PerlDef:
6553 wakaba 1.48 __DEEP{
6554     if (UNIVERSAL::isa ($self->{<Q::dis:Type>}, <IFName::dv|DVURIValue>)) {
6555     $r = $self->{<Q::dis:Type>}-><M::dv|DVURIValue.getResource>
6556     ($self-><AG::DISAnyResource.database>);
6557     } else {
6558 wakaba 1.54 my $pr = $self-><AG::DIS|DISResource.dynamicParentResource>;
6559 wakaba 1.48 $r = $pr-><AG::DISResource.disDataTypeResource> if $pr;
6560     }
6561     }__;
6562     unless ($r) {
6563     __EXCEPTION{NO_DIS_TYPE_ERR::
6564     DIS:uri => {$self-><AG::DISAnyResource.uri>},
6565     DIS:sourceNode => {$self-><AG::DISAnyResource.sourceElement>},
6566 wakaba 1.13 }__;
6567     }
6568 wakaba 1.48
6569     @Attr:
6570     @@Name: disDataTypeValue
6571     @@enDesc:
6572     The <Q::dis:Type> property value for the resource.
6573     @@Get:
6574     @@@Type: dv|DVURIValue
6575     @@@clsActualType: dv|ManakaiDVURIValue
6576     @@@RaiseException:
6577     @@@@@:NO_DIS_TYPE_ERR
6578     @@@@enDesc:
6579     <Q::dis:Type> attribute is not specified.
6580     @@@PerlDef:
6581 wakaba 1.13 __DEEP{
6582 wakaba 1.48 if (UNIVERSAL::isa ($self->{<Q::dis:Type>}, <IFName::dv|DVURIValue>)) {
6583     $r = $self->{<Q::dis:Type>};
6584 wakaba 1.16 } else {
6585 wakaba 1.54 my $pr = $self-><AG::DIS|DISResource.dynamicParentResource>;
6586 wakaba 1.48 $r = $pr-><AG::DISResource.disDataTypeValue> if $pr;
6587 wakaba 1.16 }
6588 wakaba 1.48 }__;
6589     unless ($r) {
6590     __EXCEPTION{NO_DIS_TYPE_ERR::
6591     DIS:uri => {$self-><AG::DISAnyResource.uri>},
6592     DIS:sourceNode => {$self-><AG::DISAnyResource.sourceElement>},
6593     }__;
6594     }
6595 wakaba 1.13
6596     @Attr:
6597 wakaba 1.48 @@Name: disActualDataTypeResource
6598 wakaba 1.13 @@enDesc:
6599 wakaba 1.48 <Q::dis:actualType> attribute value of this resource.
6600     @@Type: DISResource
6601     @@clsActualType: ManakaiDISResourceDefinition
6602 wakaba 1.13 @@Get:
6603 wakaba 1.48 @@@RaiseException:
6604     @@@@@:NO_DIS_TYPE_ERR
6605 wakaba 1.13 @@@@enDesc:
6606 wakaba 1.48 <Q::dis:actualType> attribute is not specified,
6607     and <Q::dis:Type> attribute, neigher.
6608 wakaba 1.13 @@@PerlDef:
6609 wakaba 1.48 __DEEP{
6610     if (UNIVERSAL::isa ($self->{<Q::dis:actualType>},
6611     <IFName::dv|DVURIValue>)) {
6612     $r = $self->{<Q::dis:actualType>}-><M::dv|DVURIValue.getResource>
6613     ($self-><AG::DISAnyResource.database>);
6614     } elsif (UNIVERSAL::isa ($self->{<Q::dis:Type>},
6615     <IFName::dv|DVURIValue>)) {
6616     $r = $self->{<Q::dis:Type>}-><M::dv|DVURIValue.getResource>
6617     ($self-><AG::DISAnyResource.database>);
6618     } else {
6619 wakaba 1.54 my $pr = $self-><AG::DIS|DISResource.dynamicParentResource>;
6620 wakaba 1.48 $r = $pr-><AG::DISResource.disActualDataTypeResource> if $pr;
6621     }
6622     }__;
6623     unless ($r) {
6624     __EXCEPTION{NO_DIS_TYPE_ERR::
6625     DIS:uri => {$self-><AG::DISAnyResource.uri>},
6626     DIS:sourceNode => {$self-><AG::DISAnyResource.sourceElement>},
6627 wakaba 1.13 }__;
6628     }
6629 wakaba 1.48
6630     @Attr:
6631     @@Name: disActualDataTypeValue
6632 wakaba 1.13 @@enDesc:
6633 wakaba 1.48 <Q::dis:actualType> node for this resource.
6634     @@Get:
6635     @@@Type: DISElement
6636     @@@clsActualType: ManakaiDISElement
6637 wakaba 1.13 @@@RaiseException:
6638 wakaba 1.48 @@@@@:NO_DIS_TYPE_ERR
6639 wakaba 1.13 @@@@enDesc:
6640 wakaba 1.48 <Q::dis:actualType> attribute is not specified,
6641     and <Q::dis:Type> attribute, neigher.
6642 wakaba 1.13 @@@PerlDef:
6643 wakaba 1.48 __DEEP{
6644     if (UNIVERSAL::isa ($self->{<Q::dis:actualType>},
6645     <IFName::dv|DVURIValue>)) {
6646     $r = $self->{<Q::dis:actualType>};
6647     } elsif (UNIVERSAL::isa ($self->{<Q::dis:Type>},
6648     <IFName::dv|DVURIValue>)) {
6649     $r = $self->{<Q::dis:Type>};
6650 wakaba 1.13 } else {
6651 wakaba 1.54 my $pr = $self-><AG::DIS|DISResource.dynamicParentResource>;
6652 wakaba 1.48 $r = $pr-><AG::DISResource.disActualDataTypeValue> if $pr;
6653 wakaba 1.13 }
6654 wakaba 1.48 }__;
6655     unless ($r) {
6656     __EXCEPTION{NO_DIS_TYPE_ERR::
6657     DIS:uri => {$self-><AG::DISAnyResource.uri>},
6658     DIS:sourceNode => {$self-><AG::DISAnyResource.sourceElement>},
6659 wakaba 1.13 }__;
6660     }
6661    
6662 wakaba 1.15 @IntMethod:
6663 wakaba 1.48 @@Operator:
6664     @@@@: <=>
6665     @@@ContentType:
6666     lang:Perl
6667 wakaba 1.15 @@enDesc:
6668 wakaba 1.54 Compares two resources. If the first character of the
6669     node in the source tree by which the resource is defined
6670     occures before the other resource's first character, then
6671     the former resource is <DFN::less> than the later resource.
6672     If two resources are the same resource, they are <DFN::equal>.
6673     Otherwise, the former resource is <DFN::greater> than
6674     the later resource.
6675    
6676     There are two exceptions. If two resources belongs to
6677     two different modules, i.e. their <A::DIS|DISAnyResource.ownerModule>s
6678     are different, the order is not defined. Also, if
6679     one of resources is not yet defined, i.e. one's
6680     <A::DIS|DISAnyResource.isDefined> takes <DOM::false> value,
6681     then the order is not defined. Even in these cases, two
6682     calls for the method with the same parameter would return
6683     the same result while the resources are left unchanged.
6684 wakaba 1.48 @@Param:
6685     @@@Name: anotherResource
6686     @@@Type: DISResource
6687     @@@enDesc: Another resource to compare.
6688 wakaba 1.15 @@Return:
6689     @@@Type:
6690 wakaba 1.48 DOMMain:unsigned-long::ManakaiDOM:all
6691 wakaba 1.15 @@@PerlDef:
6692 wakaba 1.48 if (UNIVERSAL::isa ($anotherResource,
6693     <ClassName::ManakaiDISResourceDefinition>)) {
6694     $r = $self->{seq} <=> $anotherResource->{seq};
6695     } else {
6696 wakaba 1.54 $r = $self->{uri} <=> $anotherResource;
6697 wakaba 1.48 }
6698 wakaba 1.15
6699     @Method:
6700 wakaba 1.54 @@ForCheck: ManakaiDOM|ForClass
6701     @@ManakaiDOM:isForInternal:1
6702     @@Name: addChildResource
6703     @@enDesc:
6704     Registers a resource as a static child of the resource.
6705     @@Param:
6706     @@@Name: disResource
6707     @@@Type: DIS|DISResource
6708     @@@enDesc:
6709     The resurce to add.
6710     @@Return:
6711     @@@PerlDef:
6712     __DEEP{
6713     push @{$self->{<H::DIS|childResource>}||=[]},
6714     $disResource-><AG::DIS|DISAnyResource.uriRef>;
6715     }__;
6716    
6717     @Method:
6718     @@ForCheck: ManakaiDOM|ForClass
6719     @@ManakaiDOM:isForInternal:1
6720     @@Name: addDynamicChildResource
6721     @@enDesc:
6722     Registers a resource as a dynamic child of the resource.
6723     @@Param:
6724     @@@Name: disResource
6725     @@@Type: DIS|DISResource
6726     @@@enDesc:
6727     The resurce to add.
6728     @@Return:
6729     @@@PerlDef:
6730     __DEEP{
6731     push @{$self->{<H::DIS|dynamicChildResource>}||=[]},
6732     $disResource-><AG::DIS|DISAnyResource.uriRef>;
6733     }__;
6734    
6735     @Method:
6736     @@Name: getChildResourceList
6737     @@enDesc:
6738     Returns the list of static child resources of the resource.
6739     @@Return:
6740     @@@Type: DIS|ResourceList
6741     @@@enDesc:
6742     The current snapshot of children.
6743     @@@PerlDef:
6744     __DEEP{
6745     my $db = $self-><AG::DIS|DISAnyResource.database>;
6746     $r = [map {
6747     $db-><M::DIS|DISDatabase.getResource> ($$_)
6748     } @{$self->{<H::DIS|childResource>}}];
6749     }__;
6750    
6751     @Method:
6752     @@Name: getDynamicChildResourceList
6753     @@enDesc:
6754     Returns the list of dynamic child resources of the resource.
6755     @@Return:
6756     @@@Type: DIS|ResourceList
6757     @@@enDesc:
6758     The current snapshot of children.
6759     @@@PerlDef:
6760     __DEEP{
6761     my $db = $self-><AG::DIS|DISAnyResource.database>;
6762     $r = [map {
6763     $db-><M::DIS|DISDatabase.getResource> ($$_)
6764     } @{$self->{<H::DIS|dynamicChildResource>}}];
6765     }__;
6766    
6767     @Method:
6768 wakaba 1.48 @@Name: getChildResourceByType
6769 wakaba 1.15 @@enDesc:
6770 wakaba 1.48 Gets a static child resource selected by its type.
6771     @@Param:
6772     @@@Name:typeURI
6773     @@@Type:ResourceURI
6774     @@@enDesc:
6775     A URI reference identifying a resource type.
6776     @@ImplNote:
6777     @@@lang:en
6778     @@@@:
6779 wakaba 1.54 {ISSUE:: Some inheritance tracing required for
6780 wakaba 1.48 e.g. <Q::DISLang:InputProcessor> and <Q::DOMMain:ReflectGet>?
6781 wakaba 1.54 }
6782 wakaba 1.15 @@Return:
6783 wakaba 1.47 @@@Type: DISResource
6784     @@@clsActualType: ManakaiDISResourceDefinition
6785 wakaba 1.15 @@@enDesc:
6786 wakaba 1.48 The first child resource (in document order) whose
6787     type matches with <P::typeURI>.
6788 wakaba 1.15 @@@nullCase:
6789     @@@@enDesc:
6790 wakaba 1.48 There is no resource whose type is <P::typeURI>.
6791 wakaba 1.15 @@@PerlDef:
6792 wakaba 1.48 __DEEP{
6793 wakaba 1.54 my $db = $self-><AG::DIS|DISAnyResource.database>;
6794     C: for my $cr_uri (@{$self->{<H::DIS:childResource>}||[]}) {
6795     my $cr = $db-><M::DIS|DISDatabase.getResource> ($$cr_uri);
6796 wakaba 1.79 if ($cr-><M::DIS|DISAnyResource.isTypeURI> ($typeURI)) {
6797 wakaba 1.48 $r = $cr;
6798 wakaba 1.54 last C;
6799 wakaba 1.48 }
6800 wakaba 1.15 }
6801 wakaba 1.48 }__;
6802 wakaba 1.15
6803 wakaba 1.48 @Method:
6804 wakaba 1.54 @@Name: getChildResourceListByType
6805     @@enDesc:
6806     Returns a list of child resources of a specific type.
6807     @@Param:
6808     @@@Name: typeURI
6809     @@@Type: DIS|AnyURI
6810     @@@enDesc:
6811     A URI of the type.
6812     @@Return:
6813     @@@Type: DIS|ResourceList
6814     @@@enDesc:
6815     The current snapshot of the child resources of type <P::typeURI>.
6816     @@@PerlDef:
6817     __DEEP{
6818     my $db = $self-><AG::DIS|DISAnyResource.database>;
6819     $r = [grep {
6820 wakaba 1.79 $_-><M::DIS|DISAnyResource.isTypeURI> ($typeURI)
6821 wakaba 1.54 } map {
6822     $db-><M::DIS|DISDatabase.getResource> ($$_)
6823     } @{$self->{<H::DIS|childResource>}||[]}];
6824     }__;
6825    
6826     @Method:
6827 wakaba 1.48 @@Name: getChildResourceByNameAndType
6828 wakaba 1.15 @@enDesc:
6829 wakaba 1.48 Gets a static child resource selected by its local name and type.
6830 wakaba 1.15 @@Param:
6831 wakaba 1.48 @@@Name: localName
6832     @@@Type:
6833     DISCore:LocalName::ManakaiDOM:all
6834 wakaba 1.15 @@@enDesc:
6835 wakaba 1.48 A local name.
6836 wakaba 1.15 @@Param:
6837 wakaba 1.48 @@@Name:typeURI
6838     @@@Type:ResourceURI
6839 wakaba 1.15 @@@enDesc:
6840 wakaba 1.48 A URI reference identifying a resource type.
6841     @@Return:
6842 wakaba 1.47 @@@Type: DISResource
6843     @@@clsActualType: ManakaiDISResourceDefinition
6844 wakaba 1.15 @@@enDesc:
6845 wakaba 1.48 The first (by document order) child resource whose
6846     type matches for <P::localName> and <P::typeURI>.
6847 wakaba 1.15 @@@nullCase:
6848     @@@@enDesc:
6849 wakaba 1.48 There is no resource whose name is <P::localName> and
6850     whose type is <P::typeURI>.
6851     @@@PerlDef:
6852     __DEEP{
6853 wakaba 1.54 my $db = $self-><AG::DIS|DISAnyResource.database>;
6854     C: for my $cr_uri (@{$self->{<H::DIS:childResource>}||[]}) {
6855     my $cr = $db-><M::DIS|DISDatabase.getResource> ($$cr_uri);
6856     my $ln = $cr-><AG::DIS|DISAnyResource.localName>;
6857 wakaba 1.48 if (defined $ln and $ln eq $localName and
6858 wakaba 1.79 $cr-><M::DIS|DISAnyResource.isTypeURI> ($typeURI)) {
6859 wakaba 1.48 $r = $cr;
6860 wakaba 1.54 last C;
6861 wakaba 1.48 }
6862     }
6863     }__;
6864    
6865     @Method:
6866     @@Name: getConstResourceByName
6867     @@enDesc:
6868     Gets a constant value resource by its local name.
6869 wakaba 1.15 @@Param:
6870 wakaba 1.48 @@@Name:localName
6871 wakaba 1.15 @@@Type:
6872 wakaba 1.48 DISLang:String::ManakaiDOM:all
6873 wakaba 1.15 @@@enDesc:
6874 wakaba 1.48 Constant name.
6875 wakaba 1.15 @@Return:
6876 wakaba 1.48 @@@Type: DISResource
6877     @@@clsActualType: ManakaiDISResourceDefinition
6878     @@@enDesc:
6879     The constant resource identified by <P::localName>.
6880     @@@nullCase:
6881 wakaba 1.16 @@@@enDesc:
6882 wakaba 1.48 There is no such constant resource.
6883 wakaba 1.15 @@@PerlDef:
6884 wakaba 1.48 __DEEP{
6885     my @constGroup;
6886 wakaba 1.54 my $db = $self-><AG::DIS|DISAnyResource.database>;
6887     C: for my $cr_uri (@{$self->{<H::DIS:childResource>}||[]}) {
6888     my $cr = $db-><M::DIS|DISDatabase.getResource> ($$cr_uri);
6889     my $ln = $cr-><AG::DIS|DISAnyResource.localName>;
6890 wakaba 1.48 if ($ln and $ln eq $localName and
6891 wakaba 1.79 $cr-><M::DIS|DISAnyResource.isTypeURI> (<Q::DISLang:Const>)) {
6892 wakaba 1.48 $r = $cr;
6893 wakaba 1.54 last C;
6894 wakaba 1.79 } elsif ($cr-><M::DIS|DISAnyResource.isTypeURI>
6895 wakaba 1.54 (<Q::DISLang:ConstGroup>)) {
6896 wakaba 1.48 push @constGroup, $cr;
6897     }
6898     }
6899     unless ($r) {
6900 wakaba 1.54 D: for my $cg (@constGroup) {
6901     $r = $cg-><M::DIS|DISResource.getChildResourceByNameAndType>
6902     ($localName, <Q::DISLang:Const>);
6903     last D if $r;
6904 wakaba 1.15 }
6905     }
6906 wakaba 1.48 }__;
6907 wakaba 1.15
6908 wakaba 1.18 @Attr:
6909 wakaba 1.54 @@Name: parentResource
6910     @@enDesc:
6911     The static parent resource of the resource.
6912     @@Type: DIS|DISResource
6913     @@nullCase:
6914     @@@enDesc: No parent resource.
6915     @@Get:
6916     @@@PerlDef:
6917     __DEEP{
6918     if ($self->{<H::DIS|parentResource>}) {
6919     $r = $self-><AG::DIS|DISAnyResource.database>
6920     -><M::DIS|DISDatabase.getResource>
6921     (${$self->{<H::DIS|parentResource>}});
6922     }
6923     }__;
6924     @@Set:
6925     @@@ForCheck: ManakaiDOM|ForClass
6926     @@@PerlDef:
6927     __DEEP{
6928     if ($given) {
6929     $self->{<H::DIS|parentResource>}
6930     = $given-><AG::DIS|DISAnyResource.uriRef>;
6931     } else {
6932     CORE::delete $self->{<H::DIS|parentResource>};
6933     }
6934     }__;
6935    
6936     @Attr:
6937     @@Name: dynamicParentResource
6938     @@enDesc:
6939     The dynamic parent resource of the resource.
6940     @@Type: DIS|DISResource
6941     @@nullCase:
6942     @@@enDesc: No parent resource.
6943     @@Get:
6944     @@@PerlDef:
6945     __DEEP{
6946     if ($self->{<H::DIS|dynamicParentResource>}) {
6947     $r = $self-><AG::DIS|DISAnyResource.database>
6948     -><M::DIS|DISDatabase.getResource>
6949     (${$self->{<H::DIS|dynamicParentResource>}});
6950     }
6951     }__;
6952     @@Set:
6953     @@@ForCheck: ManakaiDOM|ForClass
6954     @@@PerlDef:
6955     __DEEP{
6956     if ($given) {
6957     $self->{<H::DIS|dynamicParentResource>}
6958     = $given-><AG::DIS|DISAnyResource.uriRef>;
6959     } else {
6960     CORE::delete $self->{<H::DIS|dynamicParentResource>};
6961     }
6962     }__;
6963    
6964     @Attr:
6965 wakaba 1.48 @@Name: ownerClassNodeURI
6966 wakaba 1.18 @@enDesc:
6967 wakaba 1.48 The node URI reference of the class resource this resource
6968     belongs to.
6969     @@Type: ResourceURI
6970 wakaba 1.18 @@Get:
6971 wakaba 1.48 @@@enDesc:
6972     The URI reference of the <Q::ManakaiDOM:Class> resource.
6973     If this resource is a class, then the URI reference
6974     of this resource is returned.
6975     @@@nullCase:
6976 wakaba 1.18 @@@@enDesc:
6977 wakaba 1.48 This resource does not belong to any class.
6978 wakaba 1.18 @@@PerlDef:
6979 wakaba 1.53 if (exists $self->{<H::DIS:ownerClass>}) {
6980     $r = $self->{<H::DIS:ownerClass>};
6981 wakaba 1.48 } else {
6982     my $res = $self;
6983     __DEEP{
6984     RES: {
6985 wakaba 1.79 if ($res-><M::DISAnyResource.isTypeURI>
6986 wakaba 1.48 (<Q::ManakaiDOM:Class>)) {
6987     $r = $res-><AG::DISAnyResource.sourceNodeID>;
6988     } else {
6989 wakaba 1.54 $res = $res-><AG::DIS|DISResource.parentResource>;
6990 wakaba 1.48 redo RES if $res;
6991     }
6992 wakaba 1.18 }
6993 wakaba 1.48 }__;
6994 wakaba 1.53 $self->{<H::DIS:ownerClass>} = $r;
6995 wakaba 1.48 }
6996 wakaba 1.18
6997     @Attr:
6998     @@Name: disIsNullValue
6999     @@enDesc:
7000     Whether this resource have <DOM::null> value or not.
7001     A resource have <DOM::null> value iff it has
7002     <Q::dis:Value> attribute node that in turn has
7003     <Q::dis:is-null> attribute whose value set to <DOM::true>.
7004     @@Type:
7005     DOMMain:boolean::ManakaiDOM:all
7006     @@Get:
7007     @@@PerlDef:
7008 wakaba 1.51 if ($self->{<Q::dis:Value>}) {
7009     $r = $self->{<Q::dis:Value>}-><AG::dv|DVValue.isNull>;
7010 wakaba 1.18 }
7011 wakaba 1.19
7012 wakaba 1.24 @Method:
7013     @@Name: isFeatureProvided
7014     @@enDesc:
7015     Whether a feature is provided by this resource or not.
7016     Note that the feature is actually available (implemented)
7017     or not is other thing (use <M::ManakaiDISPerlModuleDefinition
7018     .plIsFeatureImplemented> instead).
7019     @@Param:
7020     @@@Name: featureResourceURI
7021     @@@Type: ResourceURI
7022     @@@enDesc:
7023     The URI reference of the resource definition for the feature to test.
7024     @@Return:
7025     @@@Type:
7026     DOMMain:boolean::ManakaiDOM:all
7027     @@@enDesc:
7028     Whether the feature is provided or not.
7029     @@@PerlDef:
7030     __DEEP{
7031     my @f = @{$self-><M::ManakaiDISPropertyAccessor
7032     .getPropertyResourceList>
7033     (<Q::DOMMain:implementFeature>,
7034 wakaba 1.26 isa_recursive => true,
7035 wakaba 1.68 default_media_type => <Q::DISCore:QName>)};
7036 wakaba 1.24 if (@f) {
7037     for my $f (@f) {
7038     if ($f-><M::ManakaiDISResourceDefinition.isSubsetOfURI>
7039     ($featureResourceURI)) {
7040     $r = true;
7041     last;
7042     }
7043     }
7044     } else {
7045 wakaba 1.54 my $parent = $self-><AG::DIS|DISResource.parentResource>;
7046 wakaba 1.24 $r = $parent-><M::ManakaiDISResourceDefinition.isFeatureProvided>
7047     ($featureResourceURI)
7048     if $parent;
7049     }
7050     }__;
7051    
7052     @Attr:
7053     @@Name: featureNameList
7054     @@enDesc:
7055     The list of the names of the feature defined by this resource.
7056 wakaba 1.48
7057     = If the resource has one or more <Q::dis:AppName> attributes,
7058     their text values are feature names.
7059    
7060     = If there is no <Q::dis:AppName> attributes but the resource
7061     is a <Q::DOMFeature:instanceOf> another feature, then
7062     the set of the feature names of the resource is equal
7063     to the one of another feature's feature names.
7064    
7065     {OLI:: If two operation above does not result in one or more
7066     feature names,
7067    
7068     = and if the resource has a name (the <A::DISAnyResource
7069     .isAnonymous> attribute returns <DOM::false>), then
7070     the <A::DISAnyResource.nameURI> of the resource is
7071     a feature name.
7072    
7073     = otherwise, i.e. <A::DISAnyResource.isAnonymous> is
7074     <DOM::true>, then the <A::DISAnyResource.localName>
7075     of the resource, if non-<DOM::null>, is a feature name.
7076    
7077     }
7078    
7079 wakaba 1.24 @@Type:
7080 wakaba 1.60 DISPerl:ARRAY::ManakaiDOM:all
7081 wakaba 1.24 @@Get:
7082 wakaba 1.48 @@@enDesc:
7083     A reference to the array containing feature names.
7084     Note that the order in the array is <EM::not> significant.
7085     The array might be empty if the resource has no feature name.
7086     This array is dead.
7087    
7088     {NOTE:: The attribute value array might be non-empty
7089     even if the resource is not of type <Q::DOMFeature:Feature>
7090     as far as the algorithm defined above returns
7091     some feature names.
7092     }
7093 wakaba 1.24 @@@RaiseException:
7094     @@@@@:UNSUPPORTED_MEDIA_TYPE_ERR
7095     @@@@enDesc:
7096     There is an <Q::dis:AppName> attribute whose media
7097     type is not supported.
7098     @@@RaiseException:
7099     @@@@@: NO_SOURCE_NODE_ERR
7100     @@@@enDesc:
7101     This resource definition does not have associated node
7102     in the source tree.
7103     @@@PerlDef:
7104     __DEEP{
7105 wakaba 1.49 $r = [map {lc} @{$self-><M::DISResourceProp.getPropertyTextList>
7106 wakaba 1.52 (<Q::DOMFeature:name>)}];
7107 wakaba 1.24 unless (@$r) {
7108 wakaba 1.48 ## TODO: instance feature
7109 wakaba 1.54 my $pr = $self-><AG::DIS|DISResource.parentResource>;
7110 wakaba 1.28 if ($pr) {
7111 wakaba 1.79 if ($pr-><M::DISAnyResource.isTypeURI> (<Q::DOMFeature:Feature>) and
7112 wakaba 1.48 not $pr-><AG::DISAnyResource.isAnonymous>) {
7113     push @$r, @{$pr-><AG::DISResource.featureNameList>};
7114 wakaba 1.28 }
7115     }
7116     }
7117     unless (@$r) {
7118 wakaba 1.48 if ($self-><AG::DISAnyResource.isAnonymous>) {
7119     my $ln = $self-><AG::DISAnyResource.localName>;
7120 wakaba 1.28 push @$r, lc $ln if defined $ln;
7121 wakaba 1.24 } else {
7122 wakaba 1.48 push @$r, lc $self-><AG::DISAnyResource.nameURI>;
7123     }
7124     }
7125     }__;
7126    
7127     @Method:
7128     @@ForCheck: ManakaiDOM|ForClass
7129     @@Name: getFeature
7130     @@Description:
7131     @@@lang:en
7132     @@@@:
7133     Returns a specialized object that implements the specialized
7134     interfaces of the specified feature and version.
7135     @@Param:
7136     @@@Name: feature
7137     @@@Type:
7138     DISLang:String::ManakaiDOM:all
7139     @@@actualType:
7140     ManakaiDOM:ManakaiDOMFeatureName::ManakaiDOM:ManakaiDOMLatest
7141     @@@Description:
7142     @@@@lang:en
7143     @@@@@:
7144     A feature name to request.
7145     @@Param:
7146     @@@Name: version
7147     @@@Type:
7148     DISLang:String::ManakaiDOM:all
7149     @@@actualType:
7150     ManakaiDOM:ManakaiDOMFeatureVersion::ManakaiDOM:ManakaiDOMLatest
7151     @@@Description:
7152     @@@@lang:en
7153     @@@@@:
7154     A feature version number to request.
7155     @@Return:
7156     @@@Type:
7157     DOMMain:Object::ManakaiDOM:all
7158     @@@Description:
7159     @@@@lang:en
7160     @@@@@:
7161     An object that implements the specialized APIs of the
7162     <P::feature> and <P::version>.
7163 wakaba 1.49 @@@nullCase:
7164     @@@@enDesc:
7165 wakaba 1.48 There is no object available that implements interfaces
7166     associated with the <P::feature> and <P::version>.
7167     @@@PerlDef:
7168     $feature =~ s/^\+//;
7169     CLASS: for my $class (grep {
7170     $Message::Util::DIS::ManakaiDISResourceDefinition::CompatClass{$_}
7171     } keys %Message::Util::DIS::ManakaiDISResourceDefinition::CompatClass){
7172     if ($Message::DOM::ClassFeature{$class}->{$feature}->{$version}) {
7173     $r = bless {o => $self}, $class;
7174     last CLASS;
7175 wakaba 1.24 }
7176     }
7177 wakaba 1.48
7178     @Attr:
7179     @@Name: multiplePropertiesURI
7180     @@enDesc:
7181     Whether the property allows multiple occurence of the attribute
7182     in the <QUOTE::dis> source tree.
7183     @@Type: DISLang|String||ManakaiDOM|all
7184     @@Get:
7185     @@@PerlDef:
7186     __DEEP{
7187     if ($self->{<Q::dis|multipleProperties>}) {
7188     $r = $self->{<Q::dis|multipleProperties>}
7189     -><M::dv|DVURIValue.getResource>
7190     ($self-><AG::DISAnyResource.database>)
7191     -><AG::DISAnyResource.uri>;
7192     } else {
7193     $r = <Q::DISCore|OrderedList>;
7194     }
7195     }__;
7196    
7197     @Attr:
7198     @@Name: defaultLextypeURI
7199     @@enDesc:
7200     The URI of the default lexical type for the <QUOTE::dis> attribute.
7201     @@Type: DISLang|String||ManakaiDOM|all
7202     @@Get:
7203     @@@PerlDef:
7204     __DEEP{
7205     if ($self->{<Q::dis:dataType>}) {
7206     $r = $self->{<Q::dis:dataType>}
7207     -><M::dv|DVURIValue.getResource>
7208     ($self-><AG::DISAnyResource.database>)
7209     -><AG::DISAnyResource.uri>;
7210     } else {
7211     $r = <Q::DISCore|String>;
7212     }
7213 wakaba 1.24 }__;
7214 wakaba 1.79
7215     @CMethod:
7216     @@Name: getSuperResourceURIList
7217     @@enDesc:
7218     Returns a snapshot list of super-resources URIs of the resource,
7219     including canonical and alias URIs of the resource itself.
7220     @@Return:
7221     @@@Type: URIList
7222     @@@enDesc:
7223     A snapshot list of URIs.
7224     @@@PerlDef:
7225     $r = [
7226     (grep {$self->{subOf}->{$_}} keys %{$self->{subOf}}),
7227     (grep {$self->{aliasURI}->{$_}} keys %{$self->{aliasURI}}),
7228     ];
7229    
7230     @@Test:
7231     @@@QName: DISResource.getSuperResourceURIList.test
7232     @@@PerlDef:
7233     my $db;
7234     __CODE{createDISDBForTest:: $db => $db}__;
7235    
7236     my $res1 = $db->get_resource ('about:test1');
7237     my $res2 = $db->get_resource ('about:test2');
7238     $res1->add_super_resource ($res2);
7239    
7240     my %list1 = map {$_ => true} @{$res1->get_super_resource_uri_list};
7241     $test->id ('res1.itself');
7242     $test->assert_true ($list1{'about:test1'});
7243     $test->id ('res1.res2');
7244     $test->assert_true ($list1{'about:test2'});
7245    
7246     my %list2 = map {$_ => true} @{$res2->get_super_resource_uri_list};
7247     $test->id ('res2.itself');
7248     $test->assert_true ($list2{'about:test2'});
7249     $test->id ('res2.res1');
7250     $test->assert_false ($list2{'about:test1'});
7251    
7252     @Method:
7253     @@ForCheck: ManakaiDOM|ForIF
7254     @@Name: isTypeURI
7255     @@enImplNote: For compatibility with old code.
7256 wakaba 1.48 ##DISResource
7257    
7258 wakaba 1.79 ResourceDef:
7259     @QName: String
7260     @AliasFor: DISLang|String||ManakaiDOM|all
7261     @For: DIS|ForEmpty
7262    
7263     ResourceDef:
7264     @QName: RevisionNumber
7265     @AliasFor: idl|unsignedLong||ManakaiDOM|all
7266     @For: DIS|ForEmpty
7267     @enImplNote:
7268     {ISSUE::
7269     Should be <Q::idl|unsignedLongLong||ManakaiDOM|all>?
7270     }
7271    
7272     PropDef:
7273     @QName: DIS|revision
7274     @DIS:key: r
7275    
7276     ElementTypeBinding:
7277     @Name: Test
7278     @ElementType:
7279     dis:ResourceDef
7280     @ShadowContent:
7281     @@rdf:type: test|StandaloneTest
7282     @@ForCheck: ManakaiDOM|ForClass
7283    
7284     DataTypeDef:
7285     @QName: URIList
7286     @rdfs:subClassOf: DISPerl|ARRAY||ManakaiDOM|all
7287    
7288 wakaba 1.48 IFClsDef:
7289     @IFQName: DISResourceMV
7290     @ClsQName: ManakaiDISResourceMV
7291    
7292     @enDesc:
7293     The objects implementing the <IF::DISResourceMV> <kwd:MUST>
7294     also implement the <IF::DISResource> interface.
7295 wakaba 1.32
7296     @Attr:
7297     @@Name: mvLocalName
7298     @@enDesc:
7299     The local name of the markup vocabulary element defined by this
7300     resource.
7301     @@Type:
7302     DISLang:String::ManakaiDOM:all
7303     @@Get:
7304     @@@nullCase:
7305     @@@@enDesc:
7306     Either this resource does not define a markup vocabulary element
7307     or it does define an element but it does not have a local name.
7308     @@@PerlDef:
7309     __DEEP{
7310 wakaba 1.48 if (UNIVERSAL::isa ($self->{<Q::dis|AppName>},
7311     <IFName::dv|DVQNameValue>)) {
7312     $r = $self->{<Q::dis|AppName>}-><AG::dv|DVQNameValue.localName>;
7313 wakaba 1.43 } else {
7314 wakaba 1.59 $r = $self-><AG::DIS|DISAnyResource.localName>;
7315 wakaba 1.43 }
7316     }__;
7317    
7318     @Attr:
7319     @@Name: mvPrefix
7320     @@enDesc:
7321     A typical namespace prefix of the markup vocabulary element defined
7322     by this resource.
7323     @@Type:
7324     DISLang:String::ManakaiDOM:all
7325     @@Get:
7326     @@@nullCase:
7327     @@@@enDesc:
7328     Either this resource does not define a markup vocabulary element
7329     or it does define an element but it does not have a namespace URI.
7330     @@@PerlDef:
7331     __DEEP{
7332 wakaba 1.48 if (UNIVERSAL::isa ($self->{<Q::dis|AppName>},
7333     <IFName::dv|DVQNameValue>)) {
7334     $r = $self->{<Q::dis|AppName>}-><AG::dv|DVQNameValue.prefix>;
7335 wakaba 1.43 }
7336     unless (defined $r) {
7337 wakaba 1.48 my $nsuri = $self-><AG::DISResourceMV.mvNamespaceURI>;
7338 wakaba 1.43 if (defined $nsuri and $nsuri =~ /([A-Za-z]\w*)\W*$/) {
7339 wakaba 1.53 $r = $1;
7340 wakaba 1.43 } elsif (defined $nsuri) {
7341 wakaba 1.53 $r = 'ns';
7342 wakaba 1.43 }
7343 wakaba 1.32 }
7344     }__;
7345    
7346     @Attr:
7347     @@Name: mvNamespaceURI
7348     @@enDesc:
7349     The namespace URI of the markup vocabulary element defined by this
7350     resource.
7351     @@Type: AnyURI
7352     @@Get:
7353     @@@nullCase:
7354     @@@@enDesc:
7355     Either this resource does not define a markup vocabulary element
7356     or it does define an element but it does not have a namespace URI.
7357     @@@PerlDef:
7358     __DEEP{
7359 wakaba 1.48 if (UNIVERSAL::isa ($self->{<Q::dis|AppName>},
7360     <IFName::dv|DVQNameValue>)) {
7361     $r = $self->{<Q::dis|AppName>}-><AG::dv|DVQNameValue.namespaceURI>;
7362 wakaba 1.32 } else {
7363 wakaba 1.59 $r = $self-><AG::DIS|DISAnyResource.namespaceURI>;
7364 wakaba 1.32 }
7365     }__;
7366    
7367     @Attr:
7368     @@Name: mvOwnerElementResource
7369     @@enDesc:
7370     An <QUOTE::owner element> resource of the markup vocabulary
7371     element defined by this resource.
7372 wakaba 1.47 @@Type: DISResource
7373     @@clsActualType: ManakaiDISResourceDefinition
7374 wakaba 1.32 @@Get:
7375     @@@nullCase:
7376     @@@@enDesc:
7377     Either this resource does not define a markup vocabulary element
7378     or it does define an element but it does not have an owner.
7379     @@@PerlDef:
7380     __DEEP{
7381 wakaba 1.53 if (exists $self->{<H::DIS:mvOwnerElementURI>}) {
7382 wakaba 1.32 $r = $self->{db}-><M::ManakaiDISDatabase.getResource>
7383 wakaba 1.53 ($self->{<H::DIS:mvOwnerElementURI>})
7384     if defined $self->{<H::DIS:mvOwnerElementURI>};
7385 wakaba 1.54 } else {
7386     $r = $self-><AG::DIS|DISResource.parentResource>;
7387 wakaba 1.79 undef $r unless $r-><M::DIS|DISAnyResource
7388 wakaba 1.32 .isTypeURI> (<Q::s:AnyOwnerElement>);
7389 wakaba 1.53 $self->{<H::DIS:mvOwnerElementURI>} = $r->{uri} if $r;
7390 wakaba 1.32 }
7391 wakaba 1.48 }__;
7392     ##DISResourceMV
7393 wakaba 1.27
7394     PropDef:
7395 wakaba 1.32 @QName: mvLocalName
7396     @enDesc:
7397     <A::ManakaiDISResourceDefinition.mvLocalName>.
7398    
7399     PropDef:
7400 wakaba 1.43 @QName: mvPrefix
7401     @enDesc:
7402     <A::ManakaiDISResourceDefinition.mvPrerix>.
7403    
7404     PropDef:
7405 wakaba 1.32 @QName: mvNamespaceURI
7406     @enDesc:
7407     <A::ManakaiDISResourceDefinition.mvNamespaceURI>.
7408    
7409     PropDef:
7410     @QName: mvOwnerElementURI
7411     @enDesc:
7412     <A::ManakaiDISResourceDefinition.mvOwnerElementResource>
7413     (<QUOTE::dis> resource URI reference).
7414    
7415     PropDef:
7416 wakaba 1.13 @QName: ownerClass
7417     @enDesc:
7418     The class to which this resource belongs.
7419     @Type: ResourceURI
7420     @rdfs:range:
7421     rdf:Resource
7422     @rdfs:domain:
7423     ManakaiDOM:Class
7424    
7425 wakaba 1.12 ResourceDef:
7426     @QName: DOMMinImpl
7427     @AliasFor:
7428 wakaba 1.46 DOMFeature:GetFeature::ManakaiDOM:ManakaiDOMLatest
7429 wakaba 1.49 @For: DIS|ForEmpty
7430 wakaba 1.20
7431     ResourceDef:
7432 wakaba 1.12 @QName: SWCFGNode
7433     @AliasFor:
7434     swcfg21:SWCFGNode::swcfg21:ForLatest
7435 wakaba 1.49 @For: DIS|ForEmpty
7436 wakaba 1.12
7437     ResourceDef:
7438 wakaba 1.48 @QName: SWCFGElement
7439     @AliasFor:
7440     swcfg21:SWCFGElement::swcfg21:ForLatest
7441 wakaba 1.49 @For: DIS|ForEmpty
7442 wakaba 1.48
7443     ResourceDef:
7444 wakaba 1.12 @QName: SWCFGDoc
7445     @AliasFor:
7446     swcfg21:SWCFGDocument::swcfg21:ForLatest
7447 wakaba 1.49 @For: DIS|ForEmpty
7448 wakaba 1.12
7449     XParamDef:
7450 wakaba 1.48 @QName: sourceNodePath
7451     @enDesc:
7452     A node path string of the source node.
7453    
7454     XParamDef:
7455 wakaba 1.12 @QName: errResource
7456     @enDesc:
7457     A resource on which an error has occurred.
7458    
7459 wakaba 1.8 XParamDef:
7460     @QName: generatedName
7461     @enDesc:
7462     A generated name.
7463    
7464 wakaba 1.47 IFClsDef:
7465     @IFQName: DISResourceProp
7466 wakaba 1.2 @ClsQName: ManakaiDISPropertyAccessor
7467 wakaba 1.47
7468 wakaba 1.3 @enDesc:
7469 wakaba 1.2 Accessor methods for resource or module properties.
7470 wakaba 1.48
7471     @Method:
7472     @@Name: getPropertyValue
7473 wakaba 1.22 @@enDesc:
7474 wakaba 1.48 Returns a property value object.
7475     @@PropNameParam:
7476     @@Return:
7477     @@@Type: dv|DVValue
7478     @@@enDesc: The property value.
7479 wakaba 1.22 @@@nullCase:
7480     @@@@enDesc:
7481 wakaba 1.48 The property has no value.
7482 wakaba 1.22 @@@PerlDef:
7483 wakaba 1.52 if ($self->{$propName}) {
7484 wakaba 1.54 $r = $self->{$propName}->[0];
7485 wakaba 1.52 } else {
7486     my $pr = $self-><AG::DISAnyResource.database>
7487     -><M::DISDatabase.getResource> ($propName);
7488 wakaba 1.53 A: for (grep {$pr->{aliasURI}->{$_} or $pr->{supOf}->{$_}}
7489     (keys %{$pr->{aliasURI}}, keys %{$pr->{supOf}||{}})) {
7490 wakaba 1.52 my $v = $self->{$_};
7491     if ($v) {
7492     $r = $v->[0];
7493     last A;
7494     }
7495     }
7496     }
7497 wakaba 1.22
7498 wakaba 1.48 @Method:
7499     @@Name: getPropertyValueList
7500 wakaba 1.22 @@enDesc:
7501 wakaba 1.48 Returns a property value objects.
7502     @@PropNameParam:
7503     @@Return:
7504 wakaba 1.60 @@@Type: DISPerl|ARRAY||ManakaiDOM|all
7505 wakaba 1.48 @@@enDesc: The property value.
7506     @@@PerlDef:
7507     my $pr = $self-><AG::DISAnyResource.database>
7508     -><M::DISDatabase.getResource> ($propName);
7509     $r = [map {@$_}
7510 wakaba 1.49 grep {defined $_}
7511 wakaba 1.48 map {$self->{$_}}
7512 wakaba 1.53 grep {$pr->{aliasURI}->{$_} or $pr->{supOf}->{$_}}
7513     (keys %{$pr->{aliasURI}}, keys %{$pr->{supOf}||{}})];
7514 wakaba 1.22
7515 wakaba 1.2 @Method:
7516 wakaba 1.8 @@Name: getPropertyBoolean
7517     @@enDesc:
7518     Gets boolean property value.
7519     @@PropNameParam:
7520     @@Param:
7521     @@@Name:default
7522     @@@Type:
7523     DOMMain:boolean::ManakaiDOM:all
7524     @@@enDesc:
7525     The default value that is returned if no explicit property
7526     value specification found for this resource.
7527     @@Return:
7528     @@@Type:
7529     DOMMain:boolean::ManakaiDOM:all
7530     @@@enDesc:
7531     The property value.
7532     @@@PerlDef:
7533 wakaba 1.48 if (ref $self->{$propName}) {
7534     $r = $self->{$propName}-><AG::dv|DVValue.value> ? true : false;
7535 wakaba 1.8 $r = $default unless defined $r;
7536     } else {
7537 wakaba 1.48 my $pr = $self-><AG::DISAnyResource.database>
7538     -><M::DISDatabase.getResource> ($propName);
7539     C: {
7540     for (map {$self->{$_}}
7541 wakaba 1.53 grep {$pr->{aliasURI}->{$_} or $pr->{supOf}->{$_}}
7542     (keys %{$pr->{aliasURI}}, keys %{$pr->{supOf}||{}})) {
7543 wakaba 1.48 if (defined $_) {
7544     $r = $_-><AG::dv|DVValue.value> ? true : false;
7545     last C;
7546     }
7547     }
7548     $r = $default;
7549     } # C
7550 wakaba 1.8 }
7551    
7552     @Method:
7553 wakaba 1.2 @@Name: getPropertyText
7554     @@enDesc:
7555     Gets property value text.
7556     @@PropNameParam:
7557     @@Param:
7558     @@@Name:default
7559     @@@Type:
7560 wakaba 1.3 swcfg21:SWCFGString::swcfg21:ForLatest
7561 wakaba 1.2 @@@enDesc:
7562     The default value that is returned if no explicit property
7563     value specification found for this resource.
7564     @@@nullCase:
7565     @@@@enDesc:
7566     No default value supplied; <DOM::null> is returned if
7567     no value specified.
7568     @@Return:
7569     @@@Type:
7570 wakaba 1.3 swcfg21:SWCFGString::swcfg21:ForLatest
7571 wakaba 1.2 @@@enDesc:
7572     The property value string.
7573     @@@nullCase:
7574     @@@@enDesc:
7575     No value nor default value has specified.
7576     @@@PerlDef:
7577 wakaba 1.48 if (defined $self->{$propName}) {
7578     $r = $self->{$propName}-><AG::dv|DVValue.stringValue>;
7579     $r = $default unless defined $r;
7580     } else {
7581     my $pr = $self-><AG::DISAnyResource.database>
7582     -><M::DISDatabase.getResource> ($propName);
7583     C: {
7584     for (map {$self->{$_}}
7585 wakaba 1.53 grep {$pr->{aliasURI}->{$_} or $pr->{supOf}->{$_}}
7586     (keys %{$pr->{aliasURI}}, keys %{$pr->{supOf}||{}})) {
7587 wakaba 1.48 if (defined $_) {
7588     $r = $_-><AG::dv|DVValue.stringValue>;
7589     last C;
7590     }
7591     }
7592 wakaba 1.8 $r = $default;
7593 wakaba 1.48 } # C
7594 wakaba 1.2 }
7595    
7596     @Method:
7597 wakaba 1.48 @@Name: getPropertyTextList
7598     @@enDesc:
7599     Returns a list of property value text.
7600     @@PropNameParam:
7601     @@MediaTypeDefaultParam:
7602     @@Return:
7603 wakaba 1.60 @@@Type: DISPerl|ARRAY||ManakaiDOM|all
7604 wakaba 1.48 @@@enDesc:
7605     A list of the property value strings.
7606     @@@RaiseException:
7607     @@@@@:UNSUPPORTED_MEDIA_TYPE_ERR
7608     @@@@enDesc:
7609     There is an attribute whose media
7610     type is not supported.
7611     @@@PerlDef:
7612     my $pr = $self-><AG::DISAnyResource.database>
7613     -><M::DISDatabase.getResource> ($propName);
7614     $r = [map {$_-><AG::dv|DVValue.stringValue>}
7615     map {@$_}
7616     grep {$_}
7617     map {$self->{$_}}
7618 wakaba 1.53 grep {$pr->{aliasURI}->{$_} or $pr->{supOf}->{$_}}
7619     (keys %{$pr->{aliasURI}}, keys %{$pr->{supOf}||{}})];
7620 wakaba 1.48
7621     @Method:
7622 wakaba 1.2 @@Name: getPropertyResource
7623     @@enDesc:
7624     Gets property value resource.
7625     @@PropNameParam:
7626 wakaba 1.10 @@NamedParam:
7627     @@@Name: defaultMediaType
7628     @@@Type: ResourceURI
7629     @@@enDesc:
7630     The URI reference of the default media type which is used
7631     when the property value is retrieved from the source tree
7632     and the source tree element does not have its <Q::dis:ContentType>
7633     attribute specified.
7634     @@@nullCase:
7635     @@@@enDesc:
7636 wakaba 1.68 Defaulted to <Q::DISCore:QName>.
7637 wakaba 1.2 @@Return:
7638 wakaba 1.61 @@@Type: DIS|DISAnyResource
7639 wakaba 1.2 @@@enDesc:
7640     The property value resource.
7641     @@@nullCase:
7642     @@@@enDesc:
7643     No value has specified.
7644 wakaba 1.8 @@@UndeclaredPrefixException:
7645 wakaba 1.12 @@@RaiseException:
7646     @@@@@:UNSUPPORTED_MEDIA_TYPE_ERR
7647     @@@@enDesc:
7648     The media type of the attribute node in the source tree
7649     corresponding to this resource is not supported.
7650 wakaba 1.2 @@@PerlDef:
7651 wakaba 1.48 __DEEP{
7652     my $v = $self-><M::DISResourceProp.getPropertyValue>
7653     ($propName);
7654     if (UNIVERSAL::isa ($v, <IFName::dv|DVURIValue>)) {
7655 wakaba 1.62 $r = $v-><M::dv|DVURIValue.getResource>
7656 wakaba 1.48 ($self-><AG::DISAnyResource.database>);
7657     }
7658     }__;
7659 wakaba 1.2
7660     @Method:
7661 wakaba 1.10 @@Name: getPropertyResourceList
7662     @@enDesc:
7663     Gets property value resource list.
7664     @@PropNameParam:
7665     @@NamedParam:
7666 wakaba 1.24 @@@Name: recursive
7667     @@@Type:
7668     DOMMain:boolean::ManakaiDOM:all
7669     @@@enDesc:
7670     Whether property resource values of this resource
7671     should also be included to the returned list or not.
7672     @@NamedParam:
7673 wakaba 1.10 @@@Name: recursiveISA
7674     @@@Type:
7675 wakaba 1.18 DOMMain:boolean::ManakaiDOM:all
7676 wakaba 1.10 @@@enDesc:
7677 wakaba 1.26 Whether the <Q::dis:ISA> ancestors of the resources
7678     that are property values should also be included in the returned list
7679     or not.
7680     @@@TrueCase:
7681     @@@@enDesc:
7682     If a property value is a resource <VAR::R> and
7683     the resource <VAR::R> <Q::dis:ISA>'s (or inherits) <VAR::S>, then
7684     the resource <VAR::S> is also a value in the list.
7685     @@@FalseCase:
7686     @@@@enDesc:
7687     Only the resources directly specified as property values is returned.
7688     @@NamedParam:
7689     @@@Name: isaRecursive
7690     @@@Type:
7691     DOMMain:boolean::ManakaiDOM:all
7692     @@@enDesc:
7693     Whether property resource values of <Q::dis:ISA> resources
7694     of this resource should also be included to the returned list or not.
7695     @@@TrueCase:
7696     @@@@enDesc:
7697     If this resource <Q::dis:ISA>'s (or inherits) another resource
7698     <VAR::S> and the <VAR::S> resource has a <P::propName>
7699     property value of <VAR::R>, then the resource <VAR::R>
7700     is also a value in the list.
7701     @@@FalseCase:
7702     @@@@enDesc:
7703     Only the resource directly specified is the returned.
7704 wakaba 1.10 @@NamedParam:
7705     @@@Name: defaultMediaType
7706     @@@Type: ResourceURI
7707     @@@enDesc:
7708     The URI reference of the default media type which is used
7709     when the property value is retrieved from the source tree
7710     and the source tree element does not have its <Q::dis:ContentType>
7711     attribute specified.
7712     @@@nullCase:
7713     @@@@enDesc:
7714 wakaba 1.68 Defaulted to <Q::DISCore:QName>.
7715 wakaba 1.10 @@Return:
7716     @@@Type: ResourceList
7717     @@@enDesc:
7718     An array reference of the property value resources.
7719     \
7720     {NOTE:: This list is <QUOTE::dead>.
7721     \
7722     }
7723     @@@UndeclaredPrefixException:
7724 wakaba 1.12 @@@RaiseException:
7725     @@@@@:UNSUPPORTED_MEDIA_TYPE_ERR
7726     @@@@enDesc:
7727     The media type of the attribute node in the source tree
7728     corresponding to this resource is not supported.
7729 wakaba 1.10 @@@PerlDef:
7730     $r = [];
7731 wakaba 1.48 __DEEP{
7732     my $v = $self-><M::DISResourceProp.getPropertyValueList> ($propName);
7733     my $db = $self-><AG::DISAnyResource.database>;
7734     for my $a (@$v) {
7735     if ($a->isa (<IFName::dv|DVURIValue>)) {
7736 wakaba 1.62 push @$r, $a-><M::dv|DVURIValue.getResource> ($db);
7737 wakaba 1.48 }
7738     if ($isaRecursive) {
7739     my $b = $a-><M::dv|DVValue.getProperty>
7740     (<Q::DISCore:stopISARecursive>);
7741     if ($b and $b-><AG::dv|DVValue.value>) {
7742     $isaRecursive = false;
7743 wakaba 1.32 }
7744 wakaba 1.10 }
7745 wakaba 1.48 }
7746     }__;
7747    
7748 wakaba 1.24 if ($recursive) {
7749     __DEEP{
7750     $opt{___recursive_isa_done} ||= {$self->{uri} => true};
7751     my @p_res = @$r;
7752     for my $p_res (@p_res) {
7753     next if $opt{___recursive_isa_done}->{$p_res->{uri}};
7754     $opt{___recursive_isa_done}->{$p_res->{uri}} = true;
7755 wakaba 1.48 push @$r, @{$p_res-><M::DISResourceProp.getPropertyResourceList>
7756 wakaba 1.24 ($propName, recursive => true,
7757     recursive_isa => $recursiveISA,
7758     ___recursive_isa_done => $opt{___recursive_isa_done},
7759     default_media_type => $defaultMediaType)};
7760     }
7761     }__;
7762     }
7763 wakaba 1.10 if ($recursiveISA) {
7764     __DEEP{
7765     $opt{___recursive_isa_done} ||= {$self->{uri} => true};
7766     my @p_res = @$r;
7767     for my $p_res (@p_res) {
7768     next if $opt{___recursive_isa_done}->{$p_res->{uri}};
7769     $opt{___recursive_isa_done}->{$p_res->{uri}} = true;
7770 wakaba 1.48 push @$r, @{$p_res-><M::DISResourceProp.getPropertyResourceList>
7771 wakaba 1.33 (<Q::dis:ISA>,
7772     recursive => true,
7773 wakaba 1.10 ___recursive_isa_done => $opt{___recursive_isa_done},
7774     default_media_type => $defaultMediaType)};
7775     }
7776     }__;
7777     }
7778 wakaba 1.26 if ($isaRecursive) {
7779 wakaba 1.25 __DEEP{
7780     $opt{___recursive_isa_done} ||= {$self->{uri} => true};
7781 wakaba 1.37 $opt{___isa_recursive_done} ||= {$self->{uri} => true};
7782 wakaba 1.48 my @p_res = @{$self-><M::DISResourceProp.getPropertyResourceList>
7783 wakaba 1.26 (<Q::dis:ISA>, recursive_isa => false,
7784 wakaba 1.37 recursive => false,
7785 wakaba 1.26 default_media_type => <Q::dis:TFQNames>)};
7786 wakaba 1.25 for my $p_res (@p_res) {
7787 wakaba 1.37 next if $opt{___isa_recursive_done}->{$p_res->{uri}};
7788     $opt{___isa_recursive_done}->{$p_res->{uri}} = true;
7789 wakaba 1.48 push @$r, @{$p_res-><M::DISResourceProp.getPropertyResourceList>
7790 wakaba 1.26 ($propName, recursive_isa => false,
7791     recursive => false,
7792 wakaba 1.37 isa_recursive => true,
7793     ___isa_recursive_done =>
7794     $opt{___isa_recursive_done},
7795 wakaba 1.26 default_media_type => $defaultMediaType)};
7796 wakaba 1.25 }
7797     }__;
7798     }
7799 wakaba 1.60
7800     @Method:
7801 wakaba 1.2 @@Name: addPropertyResourceList
7802     @@enDesc:
7803     Adds a resource to a resource-list property value.
7804     \
7805     {ISSUE:: Should an exception be thrown if the property is
7806     not of list?
7807     \
7808     }
7809 wakaba 1.10 \
7810     {NOTE:: If the property is not <QUOTE::get>ten ever, adding
7811     an item clears the list --- i.e. the property values
7812     in the source tree will be ignored. Call
7813     <M::ManakaiDISPropertyAccessor.getPropertyResourceList>
7814     before adding to avoid this behavior.
7815     \
7816     }
7817 wakaba 1.2 @@PropNameParam:
7818     @@Param:
7819     @@@Name: res
7820 wakaba 1.47 @@@Type: DISResource
7821     @@@clsActualType: ManakaiDISResourceDefinition
7822 wakaba 1.2 @@@enDesc:
7823     A resource to add.
7824     @@Return:
7825     @@@PerlDef:
7826 wakaba 1.48 if ($self->{$propName}) {
7827     my $uriv;
7828     __CODE{dv|createURI::
7829     $uri => {$res-><AG::DISAnyResource.uri>},
7830     $result => $uriv,
7831 wakaba 1.60 $name => $propName,
7832 wakaba 1.48 }__;
7833     $self->{$propName}-><M::dv|DVList.addItem> ($uriv);
7834     } else {
7835     __CODE{dv|createOrderedList::
7836     $result => {$self->{$propName}},
7837     $type => {<Q::DISCore:URI>},
7838     $base_type => {<Q::DISCore:URI>},
7839     }__;
7840     my $uriv;
7841     __CODE{dv|createURI::
7842     $uri => {$res-><AG::DISAnyResource.uri>},
7843     $result => $uriv,
7844 wakaba 1.60 $name => $propName,
7845 wakaba 1.48 }__;
7846     $self->{$propName}-><M::dv|DVList.addItem> ($uriv);
7847     }
7848    
7849     @Method:
7850     @@Name: addPropertyResourceUList
7851 wakaba 1.52 @@plMName: add_property_resource_ulist
7852 wakaba 1.48 @@enDesc:
7853     Adds a resource to a resource-list property value.
7854     \
7855     {ISSUE:: Should an exception be thrown if the property is
7856     not of list?
7857     \
7858     }
7859     \
7860     {NOTE:: If the property is not <QUOTE::get>ten ever, adding
7861     an item clears the list --- i.e. the property values
7862     in the source tree will be ignored. Call
7863     <M::ManakaiDISPropertyAccessor.getPropertyResourceList>
7864     before adding to avoid this behavior.
7865     \
7866     }
7867     @@PropNameParam:
7868     @@Param:
7869     @@@Name: res
7870     @@@Type: DISResource
7871     @@@clsActualType: ManakaiDISResourceDefinition
7872     @@@enDesc:
7873     A resource to add.
7874     @@Return:
7875     @@@PerlDef:
7876     if ($self->{$propName}) {
7877     my $uriv;
7878     __CODE{dv|createURI::
7879     $uri => {$res-><AG::DISAnyResource.uri>},
7880     $result => $uriv,
7881 wakaba 1.60 $name => $propName,
7882 wakaba 1.48 }__;
7883     $self->{$propName}-><M::dv|DVList.addItem> ($uriv);
7884 wakaba 1.25 } else {
7885 wakaba 1.48 __CODE{dv|createUnorderedList::
7886     $result => {$self->{$propName}},
7887     $type => {<Q::DISCore:URI>},
7888     $base_type => {<Q::DISCore:URI>},
7889     }__;
7890     my $uriv;
7891     __CODE{dv|createURI::
7892     $uri => {$res-><AG::DISAnyResource.uri>},
7893     $result => $uriv,
7894 wakaba 1.60 $name => $propName,
7895 wakaba 1.25 }__;
7896 wakaba 1.48 $self->{$propName}-><M::dv|DVList.addItem> ($uriv);
7897 wakaba 1.2 }
7898    
7899 wakaba 1.48 @Method:
7900     @@Name: addPropertyURIUList
7901 wakaba 1.52 @@plMName: add_peoperty_uri_ulist
7902 wakaba 1.48 @@enDesc:
7903     Adds a resource to a resource-list property value.
7904     \
7905     {ISSUE:: Should an exception be thrown if the property is
7906     not of list?
7907     \
7908     }
7909     \
7910     {NOTE:: If the property is not <QUOTE::get>ten ever, adding
7911     an item clears the list --- i.e. the property values
7912     in the source tree will be ignored. Call
7913     <M::ManakaiDISPropertyAccessor.getPropertyResourceList>
7914     before adding to avoid this behavior.
7915     \
7916     }
7917     @@PropNameParam:
7918     @@Param:
7919     @@@Name: uri
7920     @@@Type: AnyURI
7921     @@@enDesc:
7922     A resource to add.
7923     @@Return:
7924     @@@PerlDef:
7925     __DEEP{
7926     if ($self->{$propName}) {
7927     my $uriv;
7928     __CODE{dv|createURI::
7929     $uri => $uri,
7930     $result => $uriv,
7931 wakaba 1.60 $name => $propName,
7932 wakaba 1.48 }__;
7933     $self->{$propName}-><M::dv|DVList.addItem> ($uriv);
7934     } else {
7935     __CODE{dv|createUnorderedList::
7936     $result => {$self->{$propName}},
7937     $type => {<Q::DISCore|URI>},
7938     $base_type => {<Q::DISCore:URI>},
7939     }__;
7940     my $uriv;
7941     __CODE{dv|createURI::
7942     $uri => $uri,
7943     $result => $uriv,
7944 wakaba 1.60 $name => $propName,
7945 wakaba 1.48 }__;
7946     $self->{$propName}-><M::dv|DVList.addItem> ($uriv);
7947     }
7948     }__;
7949     ##DISResourceProp
7950 wakaba 1.84
7951    
7952     ElementTypeBinding:
7953     @Name: TMethods
7954     @ElementType:
7955     dis:ResourceDef
7956     @ShadowContent:
7957     @@DISCore:resourceType:
7958     @@@@: dis|MultipleResource
7959     @@@ForCheck: !ManakaiDOM|ForClass
7960     @@resourceFor: ManakaiDOM|ForClass
7961     @@DISCore:resourceType: DISCore|Resource
7962     @@For: DIS|ForLatest
7963    
7964     ElementTypeBinding:
7965     @Name: TMethod
7966     @ElementType:
7967     dis:ResourceDef
7968     @ShadowContent:
7969     @@ForCheck: ManakaiDOM|ForClass
7970     @@DISCore:resourceType: DIS|Method
7971    
7972     ElementTypeBinding:
7973     @Name: TAttr
7974     @ElementType:
7975     dis:ResourceDef
7976     @ShadowContent:
7977     @@ForCheck: ManakaiDOM|ForClass
7978     @@DISCore:resourceType: DIS|Attribute
7979 wakaba 1.85
7980    
7981     TMethods:
7982     @TMethod:
7983     @@Name: getErrorInterfaceResource
7984     @@DIS:targetType: dx|Interface
7985     @@Return:
7986     @@@Type: DISAnyResource
7987     @@@PerlDef:
7988     __DEEP{
7989     $r = $self;
7990     }__;
7991     ##dx:Interface
7992 wakaba 1.84
7993     TMethods:
7994     @TMethod:
7995     @@Name: getErrorInterfaceResource
7996     @@DIS:targetType: DISLang|ConstGroup
7997     @@Return:
7998     @@@Type: DISAnyResource
7999     @@@PerlDef:
8000     __DEEP{
8001     my $parent = $self-><AG::DISResource.parentResource>;
8002     if ($parent and
8003     $parent-><M::DISAnyResource.isTypeURI> (<Q::Err|ErrorAny>)) {
8004     $r = $parent;
8005     }
8006     }__;
8007     ##DISLang:ConstGroup
8008    
8009     TMethods:
8010     @TMethod:
8011     @@Name: getErrorInterfaceResource
8012     @@DIS:targetType: dx|ErrorCode
8013     @@Return:
8014     @@@Type: DISAnyResource
8015     @@@PerlDef:
8016     __DEEP{
8017     my $parent = $self-><AG::DISResource.parentResource>;
8018     if ($parent) {
8019     $r = $parent-><M::DISAnyResource.getErrorInterfaceResource>;
8020     }
8021     }__;
8022     ##dx:ErrorCode
8023    
8024     TMethods:
8025     @TMethod:
8026     @@Name: getErrorInterfaceResource
8027     @@DIS:targetType: dx|ErrorSubCode
8028     @@Return:
8029     @@@Type: DISAnyResource
8030     @@@PerlDef:
8031     __DEEP{
8032     my $parent = $self-><M::DISAnyResource.getErrorCodeResource>;
8033     if ($parent) {
8034     $r = $parent-><M::DISAnyResource.getErrorInterfaceResource>;
8035     }
8036     }__;
8037    
8038     @TMethod:
8039     @@Name: getErrorCodeResource
8040     @@DIS:targetType: dx|ErrorSubCode
8041     @@Return:
8042     @@@Type: DISAnyResource
8043     @@@PerlDef:
8044     __DEEP{
8045     my $parent = $self-><AG::DISResource.parentResource>;
8046     if ($parent and $parent-><M::DISAnyResource.isTypeURI>
8047     (<Q::dx|ErrorCode>)) {
8048     $r = $parent;
8049     }
8050     }__;
8051     ##dx:ErrorSubCode
8052 wakaba 1.48
8053 wakaba 1.3 ElementTypeBinding:
8054     @Name: PropNameParam
8055     @ElementType:
8056     dis:ResourceDef
8057     @ShadowContent:
8058     @@rdf:type:
8059     DISLang:MethodParameter
8060     @@Name: propName
8061     @@Type: ResourceURI
8062     @@Description:
8063     @@@lang:en
8064     @@@@:
8065     The name of the property.
8066    
8067 wakaba 1.2 PropDef:
8068     @QName:isAnon
8069     @Description:
8070     @@lang:en
8071     @@@:
8072     Whether the subject resource is anonymous or not.
8073     @Type:
8074 wakaba 1.18 DOMMain:boolean::ManakaiDOM:all
8075 wakaba 1.2
8076     PropDef:
8077     @QName:isDefined
8078     @Description:
8079     @@lang:en
8080     @@@:
8081     Whether the subject resource is defined or not.
8082    
8083     PropDef:
8084 wakaba 1.3 @QName:isReferred
8085 wakaba 1.2 @Description:
8086     @@lang:en
8087     @@@:
8088     Whether the subject resource is referred or not.
8089     @Type:
8090     DOMMain:any
8091    
8092     PropDef:
8093     @QName:definingModule
8094     @Description:
8095     @@lang:en
8096     @@@:
8097     The <QUOTE::dis> module in which the subject resource is defined.
8098 wakaba 1.22 \
8099     {NOTE:: The local name should have been <QUOTE::ownerModule> or some.
8100     \
8101     }
8102 wakaba 1.2 @rdfs:domain:
8103     DISCore:Module
8104 wakaba 1.1
8105     ## -- Datatypes
8106    
8107     URITypeDef:
8108 wakaba 1.3 @QName: AnyURI
8109     @Description:
8110     @@lang:en
8111     @@@:
8112     Any URI references.
8113    
8114     URITypeDef:
8115     @QName: FileURI
8116     @enDesc:
8117     URI references identifying file.
8118    
8119     URITypeDef:
8120 wakaba 1.1 @QName: ForURI
8121     @Description:
8122     @@lang:en
8123     @@@:
8124     <QUOTE::For> URI references.
8125    
8126     DataTypeDef:
8127     @QName: ForURIList
8128     @Description:
8129     @@lang:en
8130     @@@:
8131     References to the array containing <QUOTE::for> URI references.
8132    
8133     URITypeDef:
8134 wakaba 1.3 @QName: ResourceURI
8135     @Description:
8136     @@lang:en
8137     @@@:
8138     A URI reference for a <QUOTE::dis> resource.
8139    
8140     URITypeDef:
8141 wakaba 1.1 @QName: MediaTypeURI
8142     @Description:
8143     @@lang:en
8144     @@@:
8145     Media type URI references.
8146 wakaba 1.3 @rdfs:subClassOf: ResourceURI
8147    
8148     URITypeDef:
8149     @QName: ModuleURI
8150     @enDesc:
8151 wakaba 1.47 URI references for <QUOTE::dis> modules.
8152 wakaba 1.3 @rdfs:subClassOf: ResourceURI
8153    
8154     URITypeDef:
8155     @QName: NameURI
8156     @enDesc:
8157     URI references identifying a resource.
8158     @rdfs:subClassOf: ResourceURI
8159 wakaba 1.10
8160     DataTypeDef:
8161     @QName: ResourceList
8162     @enDesc:
8163     References to array containing resource definition objects.
8164     @rdfs:subClassOf:
8165 wakaba 1.60 DISPerl:ARRAY::ManakaiDOM:all
8166 wakaba 1.3
8167     ElementTypeBinding:
8168     @Name: DataTypeDef
8169     @ElementType:
8170     dis:ResourceDef
8171     @ShadowContent:
8172     @@rdf:type:
8173     ManakaiDOM:DataType
8174    
8175     ElementTypeBinding:
8176     @Name: URITypeDef
8177     @ElementType:
8178     dis:ResourceDef
8179     @ShadowContent:
8180     @@rdf:type:
8181     ManakaiDOM:DataType
8182     @@rdfs:subClassOf: AnyURI
8183 wakaba 1.1
8184     ## -- Exceptions
8185    
8186     XParamDef:
8187 wakaba 1.5 @QName: anotherSourceNode
8188     @enDesc:
8189     Another source node in which an error has occurred. In cases
8190     of <QUOTE::already defined> errors, it is the node that
8191     defines the resource first.
8192     @Type: ManakaiDISNode
8193 wakaba 1.3
8194 wakaba 1.12 ResourceDef:
8195     @QName: UNDECLARED_NS_PREFIX_ERR
8196 wakaba 1.49 @For: ForEmpty
8197 wakaba 1.12 @AliasFor:
8198     DIS:UNDECLARED_NS_PREFIX_ERR::swcfg21:ForLatest
8199    
8200 wakaba 1.47 ResourceDef:
8201     @rdf:type:
8202     @@@: dis|MultipleResource
8203     @@ForCheck: !ManakaiDOM|ForIF !ManakaiDOM|ForClass
8204     @resourceFor: ManakaiDOM|ForIF
8205     @resourceFor:
8206     @@@: ManakaiDOM|ForClass
8207     @@ForCheck: ForEmpty !=ForEmpty
8208     @For: ForLatest
8209     @For: =ForEmpty
8210    
8211     @rdf:type:
8212 wakaba 1.63 @@@: dx|Interface
8213 wakaba 1.47 @@ForCheck: ManakaiDOM|ForIF
8214    
8215     @rdf:type:
8216 wakaba 1.63 @@@: dx|Class
8217 wakaba 1.47 @@ForCheck: ManakaiDOM|ForClass
8218    
8219     @Implement:
8220     @@@: ||ForEmpty||ManakaiDOM|ForIF
8221     @@ContentType: DISCore|TFPQNames
8222     @@ForCheck: ManakaiDOM|ForClass ForEmpty
8223     @Implement:
8224     @@@: ||ForLatest||ManakaiDOM|ForIF
8225     @@ContentType: DISCore|TFPQNames
8226     @@ForCheck: ManakaiDOM|ForClass ForLatest
8227 wakaba 1.63 @dx:implementedBy: ||DIS|ForLatest||ManakaiDOM|ForClass
8228 wakaba 1.47
8229 wakaba 1.63 @f:implements:
8230 wakaba 1.47 @@@: CoreFeature10
8231     @@For: ForLatest
8232    
8233     @ISA:
8234 wakaba 1.63 @@@: dx|Exception||ManakaiDOM|Perl
8235 wakaba 1.47 @@ForCheck: ManakaiDOM|ForClass
8236    
8237     @IFQName: DISException
8238 wakaba 1.3 @ClsQName: ManakaiDISException
8239 wakaba 1.47
8240     @Description:
8241     @@lang:en
8242     @@@:
8243     Exceptions for the <QUOTE::dis> operations.
8244    
8245     @ResourceDef:
8246 wakaba 1.63 @@rdf:type: DISLang|ConstGroup
8247     @@ForCheck: ManakaiDOM|ForIF !=DIS|ForEmpty
8248 wakaba 1.47
8249     @@IFQName: DISExceptionCode
8250    
8251 wakaba 1.63 @@rdfs:subClassOf: idl|unsignedShort||ManakaiDOM|all
8252     @@Type: idl|unsignedShort||ManakaiDOM|all
8253 wakaba 1.47
8254 wakaba 1.3 @@enDesc:
8255 wakaba 1.63 Exception codes for <Class::DISException>.
8256 wakaba 1.47
8257 wakaba 1.3 @@XConstDef:
8258 wakaba 1.11 @@@Name: HIERARCHY_REQUEST_ERR
8259 wakaba 1.49 @@@Value:
8260     @@@@@:3
8261     @@@@ContentType: DISCore|Integer
8262 wakaba 1.11 @@@enDesc:
8263     An attempt is made to break the hierarchy.
8264     @@@XSubTypeDef:
8265     @@@@QName: MERGE_ITSELF_ERR
8266     @@@@enDesc:
8267     An attempt is made to merge the resource to itself.
8268     @@@@XSourceNodeParam:
8269     @@@@XParam:
8270     @@@@@QName:uri
8271     @@@@@enDesc:
8272     The URI reference of the resource to merge.
8273     @@@@enMufDef:
8274     An attempt is made to merge the resource <%p (name => {<Q::DIS:uri>}
8275     );> to itself
8276     @@XConstDef:
8277 wakaba 1.8 @@@Name: NOT_SUPPORTED_ERR
8278 wakaba 1.49 @@@Value:
8279     @@@@@:9
8280     @@@@ContentType: DISCore|Integer
8281 wakaba 1.8 @@@enDesc:
8282     An attempt is made to do something the implementation does not support.
8283     @@@XSubTypeDef:
8284     @@@@QName: UNSUPPORTED_MEDIA_TYPE_ERR
8285     @@@@enDesc:
8286     The implementation does not support the media type.
8287     @@@@XParam:
8288     @@@@@QName: uri
8289     @@@@@enDesc:
8290     The URI reference of the media type that is not supported.
8291     @@@@XSourceNodeParam:
8292 wakaba 1.30 @@@@XParam:
8293     @@@@@QName:elementType
8294     @@@@@enDesc:
8295     The URI reference of the element type of the element
8296     in which the media type is referenced.
8297 wakaba 1.12 @@@@enMufDef:
8298 wakaba 1.30 %p (name => {<Q::DIS:sourceCode>}, prefix => {"}, suffix => {": }
8299     );%p (name => {<Q::DIS:elementType>}, prefix => { (Element type: <},
8300     suffix => {>) }
8301     );Media type <%p (name => {<Q::DIS:uri>});> is not supported
8302 wakaba 1.3 @@@XSubTypeDef:
8303 wakaba 1.13 @@@@QName: UNSUPPORTED_ELEMENT_TYPE_ERR
8304     @@@@enDesc:
8305     An unsupported type of element is encounted.
8306     @@@@XSourceNodeParam:
8307     @@@@XParam:
8308     @@@@@QName:elementType
8309     @@@@@enDesc:
8310     The element type URI reference of the element.
8311 wakaba 1.16 @@@@enMufDef:
8312     Element type "%p (name => {<Q::DIS:elementType>});" is not supported
8313 wakaba 1.13 @@@XSubTypeDef:
8314 wakaba 1.12 @@@@QName: NO_PERL_CODE_IMPL_ERR
8315 wakaba 1.3 @@@@enDesc:
8316 wakaba 1.12 There is no implementation that supports the
8317     <Feature::Util:PerlCode> feature, version
8318     <FeatureVer::1.0>.
8319 wakaba 1.3 @@XConstDef:
8320     @@@Name: INVALID_STATE_ERR
8321 wakaba 1.49 @@@Value:
8322     @@@@@:11
8323     @@@@ContentType: DISCore|Integer
8324 wakaba 1.3 @@@enDesc:
8325     An attempt is made to use an object that is not (or no longer) usable.
8326     @@@XSubTypeDef:
8327     @@@@QName: NO_ASSOCIATED_DB_ERR
8328     @@@@enDesc:
8329     No <QUOTE::dis> database has been associated with this document.
8330 wakaba 1.4 @@XConstDef:
8331     @@@Name: INVALID_SOURCE_ERR
8332 wakaba 1.49 @@@Value:
8333 wakaba 1.63 @@@@@: 501
8334 wakaba 1.49 @@@@ContentType: DISCore|Integer
8335 wakaba 1.4 @@@enDesc:
8336     The source input is well-formed but invalid.
8337     @@@XSubTypeDef:
8338     @@@@QName: NO_MODULE_QNAME_ERR
8339     @@@@enDesc:
8340     The <Q::dis:Module> element must have its <Q::dis:QName>
8341     attribute.
8342 wakaba 1.8 @@@@XSourceNodeParam:
8343     @@@XSubTypeDef:
8344     @@@@QName: NO_LOCAL_NAME_ERR
8345     @@@@enDesc:
8346     The resource does not have a local name.
8347     @@@@XSourceNodeParam:
8348 wakaba 1.4 @@@XSubTypeDef:
8349     @@@@QName: UNABLE_TO_GET_MODULE_ERR
8350     @@@@enDesc:
8351     The implementation is unable to get the module source.
8352 wakaba 1.68 @@@@enMufDef:
8353 wakaba 1.4 Unable to get the module source of <%p (name => {<Q::DIS:uri>});>
8354     @@@@XParam:
8355     @@@@@QName: uri
8356     @@@@@enDesc:
8357     The URI reference of the module.
8358     @@@@XParam:
8359     @@@@@QName: namespaceURI
8360     @@@@@enDesc:
8361     The namespace URI of the module name.
8362     @@@@XParam:
8363     @@@@@QName: localName
8364     @@@@@enDesc:
8365     The local name of the module name.
8366     @@@@XParam:
8367     @@@@@QName: for
8368     @@@@@enDesc:
8369     The <QUOTE::for> of the module.
8370 wakaba 1.5 @@@XSubTypeDef:
8371     @@@@QName: NO_FOR_QNAME_ERR
8372     @@@@enDesc:
8373     A <Q::dis:ForDef> element must have <Q::dis:QName> attribute.
8374     @@@@XSourceNodeParam:
8375     @@@XSubTypeDef:
8376     @@@@QName: FOR_ALREADY_DEFINED_ERR
8377     @@@@enDesc:
8378     The <QUOTE::for> named as the same URI reference has
8379     already defined.
8380     @@@@XSourceNodeParam:
8381     @@@@XParam:
8382     @@@@@QName: anotherSourceNode
8383     @@@@@enDesc:
8384     The node that defines the <QUOTE::for> URI reference before.
8385 wakaba 1.7 @@@@XParam:
8386     @@@@@Name: uri
8387     @@@@@enDesc:
8388     The URI reference of the <QUOTE::for> attempted to define.
8389     @@@@enMufDef:
8390     <QUOTE::For> <%p (name => {<Q::DIS:uri>});> is already defined
8391 wakaba 1.5 @@@XSubTypeDef:
8392     @@@@QName: RESOURCE_ALREADY_DEFINED_ERR
8393     @@@@enDesc:
8394     The <QUOTE::dis> resource named as the same URI reference has
8395     already defined.
8396     @@@@XSourceNodeParam:
8397     @@@@XParam:
8398 wakaba 1.54 @@@@@@: anotherSourceNode
8399 wakaba 1.5 @@@@@enDesc:
8400     The node that defines the <QUOTE::for> URI reference before.
8401 wakaba 1.7 @@@@XParam:
8402 wakaba 1.54 @@@@@@: uri
8403 wakaba 1.7 @@@@@enDesc:
8404     The URI reference of the resource attempted to define.
8405 wakaba 1.54 @@@@XParam:
8406     @@@@@@: moduleURI
8407     @@@@@enDesc:
8408     A URI of the module in which the <Q::DIS|uri> resource is
8409     defined.
8410 wakaba 1.7 @@@@enMufDef:
8411 wakaba 1.54 %p (name => {<Q::DIS:moduleURI>}, prefix => {Module <},
8412     suffix => {>: })
8413     ;Resource <%p (name => {<Q::DIS:uri>});> is already defined
8414 wakaba 1.5 @@@XSubTypeDef:
8415     @@@@QName: ELEMENT_NOT_ALLOWED_ERR
8416     @@@@enDesc:
8417     An element has occured where it is not allowed.
8418     @@@@enMufDef:
8419     Module <%p (name => {<Q::DIS:uri>});>:
8420     Element of type <%p (name => {<Q::DIS:elementType>});>
8421     is not allowed here
8422     @@@@XSourceNodeParam:
8423     @@@@XParam:
8424     @@@@@QName: elementType
8425     @@@@@enDesc:
8426     The expanded element type name of the element.
8427     @@@@XParam:
8428     @@@@@QName: uri
8429     @@@@@enDesc:
8430     The URI reference of the module.
8431 wakaba 1.7 @@@XSubTypeDef:
8432     @@@@QName: NO_REQUIRED_ATTR_ERR
8433     @@@@enDesc:
8434     A required attribute is not specified.
8435     @@@@XSourceNodeParam:
8436     @@@@XParam:
8437     @@@@@QName: elementType
8438     @@@@@enDesc:
8439     The expanded URI reference of the attribute name.
8440     @@@@enMufDef:
8441     Attribute <%p (name => {<Q::DIS:elementType>});> must be specified
8442 wakaba 1.8 @@@XSubTypeDef:
8443     @@@@QName: FOR_NOT_DEFINED_ERR
8444     @@@@enDesc:
8445     A <QUOTE::for> is referred but not defined.
8446     @@@@XSourceNodeParam:
8447     @@@@XParam:
8448     @@@@@QName: uri
8449     @@@@@enDesc:
8450     The URI reference of the <QUOTE::for> that is not defined.
8451     @@@@enMufDef:
8452     <QUOTE::For> <%p (name => {<Q::DIS:uri>});> is not defined
8453     @@@XSubTypeDef:
8454     @@@@QName: RESOURCE_NOT_DEFINED_ERR
8455     @@@@enDesc:
8456 wakaba 1.13 A <QUOTE::dis> resource is referred but not defined
8457     or the resource referred does not have the type expected.
8458 wakaba 1.8 @@@@XSourceNodeParam:
8459     @@@@XParam:
8460 wakaba 1.48 @@@@@@: sourceNodePath
8461     @@@@@enDesc:
8462     A node path string of the source node.
8463     @@@@XParam:
8464 wakaba 1.8 @@@@@QName: uri
8465     @@@@@enDesc:
8466     The URI reference of the resource that is not defined.
8467 wakaba 1.13 @@@@XParam:
8468     @@@@@QName: elementType
8469     @@@@@enDesc:
8470     <QUOTE::dis> element type (either tree element type
8471     or preprocessing element type) of the element
8472     in which a reference to the undefined resource is contained.
8473     @@@@XParam:
8474 wakaba 1.30 @@@@@QName:parentURI
8475     @@@@@enDesc:
8476     The URI reference of the resource from whose child resources
8477     a resource is tried to find.
8478     @@@@XParam:
8479 wakaba 1.54 @@@@@QName: moduleURI
8480     @@@@@enDesc:
8481     The URI of the module in which the resourece should be included.
8482     @@@@XParam:
8483 wakaba 1.13 @@@@@QName: localName
8484     @@@@@enDesc:
8485     The local name of the undefined resource.
8486     @@@@XParam:
8487     @@@@QName: sourceCode
8488     @@@@enDesc:
8489     Source code fragment that referres this resource.
8490     @@@@XParam:
8491     @@@@@QName:expectedType
8492     @@@@@enDesc:
8493     Expected resource type.
8494 wakaba 1.8 @@@@enMufDef:
8495 wakaba 1.54 %p (name => {<Q::DIS:moduleURI>}, prefix => {Module <},
8496     suffix => {>: })
8497     ;%p (name => {<Q::DIS:sourceNodePath>}, suffix => {: })
8498     ;%p (name => {<Q::DIS:sourceCode>}, prefix => {"}, suffix => {": })
8499     ;%p (name => {<Q::DIS:parentURI>}, prefix => {(In <}, suffix => {>) })
8500     ;Resource%p (name => {<Q::DIS:uri>}, prefix => { <},
8501 wakaba 1.13 suffix => {>});%p (name => {<Q::DIS:localName>},
8502     prefix => { "}, suffix => {"}); is not defined or wrong type%p
8503     (name => {<Q::DIS:expectedType>}, prefix => { (<},
8504     suffix => {> is expected)});
8505     @@@XSubTypeDef:
8506     @@@@QName: NO_SOURCE_NODE_ERR
8507     @@@@enDesc:
8508     A resource does not have associated node in the source tree.
8509     @@@@XSourceNodeParam:
8510     @@@@XParam:
8511     @@@@@QName:uri
8512     @@@@@enDesc:
8513     The URI reference of the resource.
8514 wakaba 1.8 @@@XSubTypeDef:
8515     @@@@QName: RESERVED_PERL_METHOD_NAME_ERR
8516     @@@@enDesc:
8517     A reserved Perl method name is used.
8518     @@@@XParam:
8519     @@@@@QName:uri
8520     @@@@@enDesc:
8521     The URI reference of the method resource.
8522     @@@@XSourceNodeParam:
8523     @@@@XParam:
8524     @@@@@QName: generatedName
8525     @@@@@enDesc:
8526     A reserved method name.
8527     @@@XSubTypeDef:
8528     @@@@QName: NO_DIS_TYPE_ERR
8529     @@@@enDesc:
8530     <Q::dis:Type> attribute is not found.
8531     @@@@XSourceNodeParam:
8532 wakaba 1.48 @@@@enMufDef:
8533     Resource "%t (name => {<Q::DIS:uri>});" has no "dis:Type" attribute
8534 wakaba 1.12 @@@XSubTypeDef:
8535     @@@@QName: NO_METHOD_RETURN_ERR
8536     @@@@enDesc:
8537     A <Q::DISLang:Method> resource does not have any
8538     <Q::DISLang:MethodReturn> child.
8539     @@@@XSourceNodeParam:
8540 wakaba 1.22 @@@@XParam:
8541     @@@@@QName:errResource
8542     @@@@@enDesc: The method resource.
8543     @@@@XParam:
8544     @@@@@QName:uri
8545     @@@@@enDesc:
8546     The URI reference of the method.
8547     @@@@XParam:
8548     @@@@@QName:localName
8549     @@@@@enDesc:
8550     The local name of the resource.
8551     @@@@enMufDef:
8552     Method "%p (name => {<Q::DIS:localName>});" does not have
8553     "Return" child
8554 wakaba 1.12 @@@XSubTypeDef:
8555     @@@@QName: NO_ATTR_GET_ERR
8556     @@@@enDesc:
8557     A <Q::DISLang:Attribute> resource does not have any
8558     <Q::DISLang:AttributeGet> child.
8559     @@@@XSourceNodeParam:
8560 wakaba 1.13 @@@XSubTypeDef:
8561     @@@@QName:INTERFACE_CLASS_METHOD_ERR
8562     @@@@enDesc:
8563     An attempt is made to call a static (class) method
8564     from an interface.
8565     @@@@XSourceNodeParam:
8566     @@@@XParam:
8567     @@@@@QName:uri
8568     @@@@@enDesc:
8569     The URI reference of the interface.
8570     @@@@XParam:
8571     @@@@@QName:sourceCode
8572     @@@@@enDesc:
8573     Source code fragment that calls a class method.
8574     @@@@XParam:
8575     @@@@@QName:elementType
8576     @@@@@enDesc:
8577     The element type URI reference of the element
8578     that calls a method.
8579     @@@XSubTypeDef:
8580     @@@@QName: BROKEN_PARAM_SPEC_ERR
8581     @@@@enDesc:
8582     A parameter specification is broken.
8583     @@@@XParam:
8584     @@@@@QName: sourceCode
8585     @@@@@enDesc:
8586     Source code fragment that contains the broken parameter
8587     specification.
8588     @@@@XSourceNodeParam:
8589 wakaba 1.15 @@@@enMufDef:
8590     %p (name => {<Q::DIS:sourceCode>}, prefix => {"},
8591     suffix => {": });Broken parameter specification
8592 wakaba 1.13 @@@XSubTypeDef:
8593     @@@@QName:PERL_PREPROCESS_NO_ELEMENT_TYPE_ERR
8594     @@@@enDesc:
8595     A preprocessing instruction does not have its element
8596     type.
8597     @@@@XSourceNodeParam:
8598     @@@@XParam:
8599     @@@@@QName:sourceCode
8600     @@@@@enDesc:
8601     Source code fragment.
8602 wakaba 1.16 @@@@enMufDef:
8603     %p (name => {<Q::DIS:sourceCode>}, prefix => {"},
8604     suffix => {": });Element type name is not specified
8605 wakaba 1.13 @@@XSubTypeDef:
8606 wakaba 1.15 @@@@QName: NO_PERL_PACKAGE_NAME_ERR
8607 wakaba 1.13 @@@@enDesc:
8608 wakaba 1.15 No Perl package name is defined for the resource referred.
8609 wakaba 1.13 @@@@XSourceNodeParam:
8610     @@@@XParam:
8611 wakaba 1.15 @@@@@QName:sourceCode
8612 wakaba 1.13 @@@@@enDesc:
8613     Source code fragment.
8614     @@@@XParam:
8615 wakaba 1.15 @@@@@QName:uri
8616     @@@@@enDesc:
8617     THe URI reference of the resource referred.
8618     @@@@XParam:
8619     @@@@@QName:elementType
8620     @@@@@enDesc:
8621     The element type of Perl preprocessing instruction
8622     in which the resource is referred.
8623     @@@@enMufDef:
8624     %p (name => {<Q::DIS:uri>}, prefix => {<}, suffix => {>: });Perl
8625     package name is not defined
8626     @@@XSubTypeDef:
8627     @@@@QName: PERL_PREPROCESS_NO_EXCEPTION_TYPE_ERR
8628     @@@@enDesc:
8629     An exception type specification is required.
8630     @@@@XSourceNodeParam:
8631     @@@@XSourceCodeParam:
8632     @@@@XParam:
8633     @@@@@QName:elementType
8634     @@@@@enDesc:
8635     The element type of the preprocessing instruction.
8636     @@@XSubTypeDef:
8637     @@@@QName: PERL_PREPROCESS_NO_CODE_NAME_ERR
8638     @@@@enDesc:
8639     A code name specification is required.
8640     @@@@XSourceNodeParam:
8641     @@@@XSourceCodeParam:
8642     @@@@XParam:
8643 wakaba 1.13 @@@@@QName:elementType
8644     @@@@@enDesc:
8645 wakaba 1.15 The element type of the preprocessing instruction.
8646 wakaba 1.13 @@@XSubTypeDef:
8647     @@@@QName: PERL_CODE_NOT_DEFINED_ERR
8648     @@@@enDesc:
8649 wakaba 1.15 The specified resource does not have its Perl definition.
8650 wakaba 1.13 @@@@XSourceNodeParam:
8651 wakaba 1.15 @@@@XSourceCodeParam:
8652 wakaba 1.13 @@@@XParam:
8653 wakaba 1.15 @@@@@QName:elementType
8654     @@@@@enDesc:
8655     The element type of the preprocessing instruction.
8656     @@@@XParam:
8657     @@@@@QName:uri
8658 wakaba 1.13 @@@@@enDesc:
8659 wakaba 1.15 The URI reference of the resource referred.
8660 wakaba 1.13 @@@@XParam:
8661     @@@@@QName:localName
8662     @@@@@enDesc:
8663     The local name of the resource referred.
8664 wakaba 1.51 @@@@enMufDef:
8665     Resource%p (name => {<Q::DIS:uri>}, prefix => { "}, suffix => {"});
8666     has no Perl code definition
8667 wakaba 1.15 @@@XSubTypeDef:
8668     @@@@QName: PERL_PREPROCESS_NO_METHOD_ERR
8669     @@@@enDesc:
8670     A preprocessing instruction which is only allowed in
8671     method definitions is used in a code which is not a method.
8672     @@@@XSourceNodeParam:
8673     @@@@XSourceCodeParam:
8674 wakaba 1.13 @@@@XParam:
8675 wakaba 1.15 @@@@@QName:elementType
8676 wakaba 1.13 @@@@@enDesc:
8677 wakaba 1.15 The element type of the preprocessing instruction.
8678 wakaba 1.14 @@@XSubTypeDef:
8679 wakaba 1.15 @@@@QName: PERL_PREPROCESS_NO_FOR_ERR
8680 wakaba 1.14 @@@@enDesc:
8681 wakaba 1.15 A <QUOTE::for> specification is required.
8682 wakaba 1.14 @@@@XSourceNodeParam:
8683 wakaba 1.15 @@@@XSourceCodeParam:
8684 wakaba 1.14 @@@@XParam:
8685 wakaba 1.15 @@@@@QName:elementType
8686 wakaba 1.14 @@@@@enDesc:
8687 wakaba 1.15 The element type of the preprocessing instruction.
8688     @@@XSubTypeDef:
8689     @@@@QName: PERL_PREPROCESS_NO_ASSERT_TYPE_ERR
8690     @@@@enDesc:
8691     An assertion type specification is required.
8692     @@@@XSourceNodeParam:
8693     @@@@XSourceCodeParam:
8694 wakaba 1.14 @@@@XParam:
8695 wakaba 1.15 @@@@@QName:elementType
8696 wakaba 1.14 @@@@@enDesc:
8697 wakaba 1.15 The element type of the preprocessing instruction.
8698     @@@XSubTypeDef:
8699     @@@@QName: PERL_PREPROCESS_BLOCK_NOT_ALLOWED_ERR
8700     @@@@enDesc:
8701     A preprocessing instruction block occurred with
8702     element type which does not allow it.
8703     @@@@XSourceNodeParam:
8704     @@@@XSourceCodeParam:
8705 wakaba 1.14 @@@@XParam:
8706     @@@@@QName:elementType
8707     @@@@@enDesc:
8708 wakaba 1.15 The element type of the preprocessing instruction.
8709 wakaba 1.18 @@@XSubTypeDef:
8710     @@@@QName: NON_NAMED_PARAMETER_AFTER_NAMED_ERR
8711     @@@@enDesc:
8712     A non-named method parameter following
8713     any named method parameter is occurred.
8714     @@@@XSourceNodeParam:
8715     @@@@XParam:
8716     @@@@@QName:uri
8717     @@@@@enDesc:
8718     The URI reference of the non-named method parameter resource.
8719     @@@@XParam:
8720     @@@@@QName:localName
8721     @@@@@enDesc:
8722     The local name of the non-named method parameter.
8723 wakaba 1.19 @@@XSubTypeDef:
8724     @@@@QName:DISPERL_NO_VALUE_ALLOWED_ERR
8725     @@@@enDesc:
8726     An element node have a value but the definition
8727     of that element type does not allow it.
8728     @@@@XSourceNodeParam:
8729     @@@@XParam:
8730     @@@@@QName:elementType
8731     @@@@@enDesc:
8732     The element type URI reference of the element.
8733     @@@XSubTypeDef:
8734     @@@@QName:NO_CONST_VALUE_ERR
8735     @@@@enDesc:
8736     The source element node for a constant value resource
8737     does not have <Q::dis:Value> attribute.
8738     @@@@XSourceNodeParam:
8739     @@@@XParam:
8740     @@@@@QName:elemntType
8741     @@@@@enDesc:
8742     The element type URI reference of the element from which
8743     a constant value resource is referred.
8744     @@@@XParam:
8745     @@@@@QName:uri
8746     @@@@@enDesc:
8747     The resource URI reference of the constant value resource.
8748     @@@@XParam:
8749     @@@@@QName:localName
8750     @@@@@enDesc:
8751     The local name of the constant value resource.
8752     @@@XSubTypeDef:
8753     @@@@QName:NO_ATTR_SET_ERR
8754     @@@@enDesc:
8755     An attribute setter is referred but the attribute
8756     does not define any setter.
8757     @@@@XSourceNodeParam:
8758     @@@@XParam:
8759     @@@@@QName:errResource
8760     @@@@@enDesc:
8761     The attribute resource.
8762     @@@@XParam:
8763     @@@@@QName:elementType
8764     @@@@@enDesc:
8765     The type of the element by which this attribute
8766     is referred.
8767 wakaba 1.20 @@@XSubTypeDef:
8768     @@@@QName: PERL_SUBROUTINE_ALREADY_DEFINED_ERR
8769     @@@@enDesc:
8770     A resource defines a Perl subroutine whose name is
8771     same as another subroutine.
8772     @@@@XSourceNodeParam:
8773     @@@@XParam:
8774     @@@@@QName:uri
8775     @@@@@enDesc:
8776     The URI reference of the resource that defines the Perl subroutine.
8777     @@@@XParam:
8778     @@@@@QName:
8779     PerlCode:localName
8780     @@@@@enDesc:
8781     The name of the Perl subroutine.
8782     @@@XSubTypeDef:
8783     @@@@QName: PERL_OPERATOR_ALREADY_OVERLOADED_ERR
8784     @@@@enDesc:
8785     A resource is defined to overload a Perl operator which
8786     is already overloaded by another resource.
8787     @@@@XSourceNodeParam:
8788     @@@@XParam:
8789     @@@@@QName:uri
8790     @@@@@enDesc:
8791     The URI reference of the resource that defines the overloading.
8792     @@@@XParam:
8793     @@@@@QName:
8794     PerlCode:operator
8795     @@@@@enDesc:
8796     The operator.
8797     @@@XSubTypeDef:
8798     @@@@QName: PERL_UNUSED_SUBROUTINE_ERR
8799     @@@@enDesc:
8800     A resource defines a Perl subroutine but it is not used.
8801     @@@@XSourceNodeParam:
8802     @@@@XParam:
8803     @@@@@QName:uri
8804     @@@@@enDesc:
8805     The URI reference of the resource.
8806 wakaba 1.22 @@@XSubTypeDef:
8807     @@@@QName: NO_LICENSE_ATTR_ERR
8808     @@@@enDesc:
8809     The <Q::dis:Module> element does not have the
8810     <Q::dis:License> attribute.
8811     @@@@XSourceNodeParam:
8812     @@@@XParam:
8813     @@@@@QName:uri
8814     @@@@@enDesc:
8815     The URI reference of the module.
8816 wakaba 1.25 @@@XSubTypeDef:
8817     @@@@QName: UNSUPPORTED_ROLE_ERR
8818     @@@@enDesc:
8819     A <Q::dis:Role> is not supported.
8820     @@@@XSourceNodeParam:
8821     @@@@XParam:
8822     @@@@@QName:uri
8823     @@@@@enDesc:
8824     The URI reference of the unsupported role.
8825     @@@@enMufDef:
8826     Role <%p (name => {<Q::DIS:uri>});> is not supported
8827 wakaba 1.37 @@@XSubTypeDef:
8828     @@@@QName: NO_REFLECT_GET_DEFINED_ERR
8829     @@@@enDesc:
8830     An attribute is defined to reflect an element attribute
8831     but no reflecting attribute getter template is defined.
8832     @@@@XSourceNodeParam:
8833     @@@@XParam:
8834     @@@@@QName:uri
8835     @@@@@enDesc:
8836     The URI reference of the datatype resource for which
8837     a getter template should have been defined.
8838     @@@XSubTypeDef:
8839     @@@@QName: NO_REFLECT_SET_DEFINED_ERR
8840     @@@@enDesc:
8841     An attribute is defined to reflect an element attribute
8842     but no reflecting attribute setter template is defined.
8843     @@@@XSourceNodeParam:
8844     @@@@XParam:
8845     @@@@@QName:uri
8846     @@@@@enDesc:
8847     The URI reference of the datatype resource for which
8848     a setter template should have been defined.
8849 wakaba 1.40 @@@XSubTypeDef:
8850 wakaba 1.43 @@@@QName: NO_END_TAG_ERR
8851     @@@@enDesc:
8852 wakaba 1.40 Close tag not found.
8853 wakaba 1.43 @@@@XSourceNodeParam:
8854     @@@@XParam:
8855 wakaba 1.49 @@@@@@: elementType
8856     @@@@@enDesc:
8857 wakaba 1.40 The type URI reference of the element that is not closed.
8858 wakaba 1.43 @@@@XParam:
8859 wakaba 1.49 @@@@@@: sourceCode
8860     @@@@@enDesc:
8861 wakaba 1.40 The source code fragment near the position where
8862     an end tag is required.
8863 wakaba 1.43 @@@@enMufDef:
8864 wakaba 1.40 End tag for element "%p (name => {<Q::DIS:elementType>});"
8865 wakaba 1.43 is required%p (name => {<Q::DIS:sourceCode>},
8866     prefix => { (}, suffix => {)});
8867 wakaba 1.49 @@@XSubTypeDef:
8868     @@@@QName: NO_RDF_TYPE_ERR
8869     @@@@enDesc:
8870     There is a resource definition element that does
8871     not have any <Q::rdf:type> attribute.
8872     @@@@XSourceNodeParam:
8873     @@@@XParam:
8874     @@@@@@: uri
8875     @@@@@enDesc:
8876     The URI of the resource which does not have <Q::rdf:type>.
8877     @@@@enMufDef:
8878     Resource%p (name => {<Q::DIS:uri>}, prefix => { "},
8879     suffix => {"}); does not have "rdf:type" attribute
8880 wakaba 1.53 @@@XSubTypeDef:
8881     @@@@QName: PERL_HASH_KEY_ALREADY_DEFINED_ERR
8882     @@@@enDesc:
8883     A hash key is already defined.
8884     @@@@XSourceNodeParam:
8885     @@@@XParam:
8886     @@@@@@:uri
8887     @@@@@enDesc:
8888     The URI of the resource tried to register.
8889     @@@@XParam:
8890     @@@@@@:anotherURI
8891     @@@@@enDesc:
8892     The URI of the already registered resource.
8893     @@@@XParam:
8894     @@@@@@:hashKeyName
8895     @@@@@enDesc:
8896     Hash key.
8897     @@@@XParam:
8898     @@@@@@:hashKeyScope
8899     @@@@@enDesc:
8900     Hash key scope.
8901     @@@@enMufDef:
8902     <%p (name => {<Q::DIS:uri>});>:
8903 wakaba 1.56 Hash key "%p (name => {<Q::DIS:hashKeyName>});" in
8904 wakaba 1.53 <%p (mame => {<Q::DIS:hashKeyScope>});> is already
8905 wakaba 1.54 defined for <%p (name => {<Q::DIS:anotherURI>});>
8906 wakaba 1.63 @@@XSubTypeDef:
8907     @@@@QName: DIS|NO_EXCEPTION_CLASS_ERR
8908     @@@@enDesc:
8909     The exception interface has no class that implements the interface.
8910     @@@@enMufDef:
8911     Exception interface <%p (name => {<Q::DIS:uri>});>:
8912     There is no class that implements this interface
8913     @@@@XParam:
8914     @@@@@@: DIS|uri
8915     @@@@@enDesc:
8916     The URI of the interface.
8917 wakaba 1.37 @ImplNote:
8918     @@lang:en
8919     @@@:
8920     ISSUE: Too many subtypes for a type! New type should be added?
8921 wakaba 1.71
8922     @Attr:
8923     @@Name: text
8924     @@enDesc:
8925     The description of the error, in <LANG::i-default> language.
8926     @@enImplNote:
8927     See <A::dx|Exception.text> for super definition.
8928     @@Type: DISLang|String
8929     @@Get:
8930     @@@PerlDef:
8931     $r = $self->SUPER::text;
8932 wakaba 1.73 if (defined $self->{<H::DIS:uri>}) {
8933     $r = '<' . $self->{<H::DIS:uri>} . '>: ' . $r;
8934     }
8935 wakaba 1.71 if (defined $self->{<H::DIS:sourceNode>}) {
8936     $r = 'Node ' . $self->{<H::DIS:sourceNode>}-><M::SWCFGNode.nodePath>
8937     . ': ' . $r;
8938     }
8939 wakaba 1.4 ##DISException
8940 wakaba 1.71
8941     ElementTypeBinding:
8942     @Name: enImplNote
8943     @ElementType:
8944     dis:ImplNote
8945     @ShadowContent:
8946     @@lang:en
8947 wakaba 1.53
8948     XParamDef:
8949     @QName: hashKeyName
8950     @Type: DISLang|String
8951     @enDesc:
8952     See <M::dp|DISDatabasePerl.plAddHashKey>.
8953    
8954     XParamDef:
8955     @QName: hashKeyScope
8956     @Type: AnyURI
8957     @enDesc:
8958     See <M::dp|DISDatabasePerl.plAddHashKey>.
8959    
8960     XParamDef:
8961     @QName: anotherURI
8962     @Type: ResourceURI
8963     @enDesc:
8964     A URI of another related resource.
8965 wakaba 1.13
8966     XParamDef:
8967     @QName:expectedType
8968     @Type: ResourceURI
8969     @enDesc:
8970     Expected resource type URI reference.
8971    
8972     XParamDef:
8973     @QName: sourceCode
8974     @Type:
8975     DISLang:String::ManakaiDOM:all
8976     @enDesc:
8977     The source code fragment in which an error occurred.
8978 wakaba 1.5
8979     XParamDef:
8980     @QName: elementType
8981     @Type: ResourceURI
8982     @enDesc:
8983     The name of the element type.
8984    
8985     XParamDef:
8986     @QName: uri
8987     @Type: ResourceURI
8988     @enDesc:
8989     The name of the resource, composed from <Q::namespaceURI>,
8990     <Q::localName> and <Q::for>.
8991    
8992     XParamDef:
8993     @QName: localName
8994     @Type:
8995 wakaba 1.18 DISCore:LocalName::ManakaiDOM:all
8996 wakaba 1.5 @enDesc:
8997     The local name of the resource, unique in <Q::namespaceURI> namespace.
8998    
8999     XParamDef:
9000     @QName: namespaceURI
9001     @Type: AnyURI
9002     @enDesc:
9003     The namespace URI reference of the resource name.
9004    
9005     XParamDef:
9006     @QName: for
9007     @Type: ForURI
9008     @enDesc:
9009     The <QUOTE::for> URI reference of the resource.
9010    
9011     ElementTypeBinding:
9012     @Name: XSourceNodeParam
9013     @ElementType:
9014 wakaba 1.64 ecore:hasParameter
9015 wakaba 1.5 @ShadowContent:
9016     @@QName: sourceNode
9017     @@Description:
9018     @@@lang:en
9019     @@@@:
9020     The node in which an error has occurred.
9021 wakaba 1.15
9022     ElementTypeBinding:
9023     @Name: XSourceCodeParam
9024     @ElementType:
9025 wakaba 1.64 ecore:hasParameter
9026 wakaba 1.15 @ShadowContent:
9027     @@QName: sourceCode
9028     @@Description:
9029     @@@lang:en
9030     @@@@:
9031     The source code in which an error has occurred.
9032 wakaba 1.4
9033 wakaba 1.52 ElementTypeBinding:
9034     @Name: plMName
9035     @ElementType:
9036     DISPerl:methodName
9037     @ShadowContent:
9038     @@ContentType: lang|Perl
9039     @@For: ManakaiDOM|Perl
9040 wakaba 1.4
9041     ElementTypeBinding:
9042 wakaba 1.52 @Name: plCName
9043 wakaba 1.4 @ElementType:
9044 wakaba 1.52 DISPerl:exportTagName
9045 wakaba 1.4 @ShadowContent:
9046 wakaba 1.47 @@ContentType: lang|Perl
9047     @@For: ManakaiDOM|Perl
9048 wakaba 1.3
9049     ElementTypeBinding:
9050     @Name: Method
9051     @ElementType:
9052     dis:ResourceDef
9053     @ShadowContent:
9054     @@rdf:type:
9055     DISLang:Method
9056 wakaba 1.52 @@For: !=ForEmpty
9057 wakaba 1.3
9058     ElementTypeBinding:
9059 wakaba 1.79 @Name: CMethod
9060     @ElementType:
9061     dis:ResourceDef
9062     @ShadowContent:
9063     @@rdf:type:
9064     DISLang:Method
9065     @@ForCheck: !=ForEmpty ManakaiDOM|ForClass
9066    
9067     ElementTypeBinding:
9068 wakaba 1.3 @Name: IntMethod
9069     @ElementType:
9070     dis:ResourceDef
9071     @ShadowContent:
9072     @@rdf:type:
9073     DISLang:Method
9074     @@ManakaiDOM:isForInternal:1
9075 wakaba 1.52 @@ForCheck: ManakaiDOM|ForClass
9076 wakaba 1.3
9077     ElementTypeBinding:
9078     @Name: Attr
9079     @ElementType:
9080     dis:ResourceDef
9081     @ShadowContent:
9082     @@rdf:type:
9083     DISLang:Attribute
9084 wakaba 1.52 @@For: !=ForEmpty
9085 wakaba 1.79
9086     ElementTypeBinding:
9087     @Name: CAttr
9088     @ElementType:
9089     dis:ResourceDef
9090     @ShadowContent:
9091     @@rdf:type:
9092     DISLang:Attribute
9093     @@ForCheck: !=ForEmpty ManakaiDOM|ForClass
9094 wakaba 1.3
9095     ElementTypeBinding:
9096     @Name: Return
9097     @ElementType:
9098     dis:ResourceDef
9099     @ShadowContent:
9100     @@rdf:type:
9101     DISLang:MethodReturn
9102    
9103     ElementTypeBinding:
9104     @Name: Get
9105     @ElementType:
9106     dis:ResourceDef
9107     @ShadowContent:
9108     @@rdf:type:
9109     DISLang:AttributeGet
9110    
9111     ElementTypeBinding:
9112     @Name: Set
9113     @ElementType:
9114     dis:ResourceDef
9115     @ShadowContent:
9116     @@rdf:type:
9117     DISLang:AttributeSet
9118    
9119     ElementTypeBinding:
9120     @Name: Param
9121     @ElementType:
9122     dis:ResourceDef
9123     @ShadowContent:
9124     @@rdf:type:
9125     DISLang:MethodParameter
9126    
9127     ElementTypeBinding:
9128     @Name: PerlDef
9129     @ElementType:
9130     dis:Def
9131     @ShadowContent:
9132     @@ContentType:
9133     lang:Perl
9134    
9135     ElementTypeBinding:
9136     @Name: InCase
9137     @ElementType:
9138     dis:ResourceDef
9139     @ShadowContent:
9140     @@rdf:type:
9141     ManakaiDOM:InCase
9142    
9143     ElementTypeBinding:
9144     @Name: nullCase
9145     @ElementType:
9146     dis:ResourceDef
9147     @ShadowContent:
9148     @@rdf:type:
9149     ManakaiDOM:InCase
9150     @@Value:
9151     @@@is-null:1
9152 wakaba 1.49 @@@ContentType: DISCore|String
9153 wakaba 1.3
9154     ElementTypeBinding:
9155     @Name: TrueCase
9156     @ElementType:
9157     dis:ResourceDef
9158     @ShadowContent:
9159     @@rdf:type:
9160     ManakaiDOM:InCase
9161 wakaba 1.49 @@Value:
9162     @@@@: 1
9163     @@@ContentType: DISCore|Boolean
9164 wakaba 1.3 @@Type:
9165 wakaba 1.18 DOMMain:boolean::ManakaiDOM:all
9166 wakaba 1.3
9167     ElementTypeBinding:
9168     @Name: FalseCase
9169     @ElementType:
9170     dis:ResourceDef
9171     @ShadowContent:
9172     @@rdf:type:
9173     ManakaiDOM:InCase
9174 wakaba 1.49 @@Value:
9175     @@@@: 0
9176     @@@ContentType: DISCore|Boolean
9177 wakaba 1.3 @@Type:
9178 wakaba 1.18 DOMMain:boolean::ManakaiDOM:all
9179 wakaba 1.3
9180     ElementTypeBinding:
9181     @Name: enDesc
9182     @ElementType:
9183     dis:Description
9184     @ShadowContent:
9185     @@lang:en
9186    
9187     ElementTypeBinding:
9188     @Name: PropDef
9189     @ElementType:
9190     dis:ResourceDef
9191     @ShadowContent:
9192 wakaba 1.81 @@DISCore:resourceType: DISCore|Property
9193     @@For: =ManakaiDOM|all
9194    
9195     ElementTypeBinding:
9196     @Name: RPropDef
9197     @ElementType:
9198     dis:ResourceDef
9199     @ShadowContent:
9200     @@DISCore:resourceType: DISSource|ResourceProperty
9201     @@For: =ManakaiDOM|all
9202 wakaba 1.3
9203     ElementTypeBinding:
9204     @Name: MethodRedef
9205     @ElementType:
9206     dis:ResourceDef
9207     @ShadowContent:
9208     @@rdf:type:
9209     DISLang:Method
9210    
9211     ElementTypeBinding:
9212     @Name: NamedParam
9213     @ElementType:
9214     dis:ResourceDef
9215     @ShadowContent:
9216     @@rdf:type:
9217     DISLang:MethodParameter
9218     @@DISPerl:isNamedParameter:1
9219    
9220     ElementTypeBinding:
9221     @Name: NodeParam
9222     @ElementType:
9223     dis:ResourceDef
9224     @ShadowContent:
9225     @@rdf:type:
9226     DISLang:MethodParameter
9227     @@DISPerl:isNamedParameter:1
9228     @@Name: node
9229 wakaba 1.47 @@Type: DISNode
9230     @@actualType:
9231     @@@@: ManakaiDISNode
9232     @@@ForCheck: ManakaiDOM|ForClass
9233 wakaba 1.3 @@Description:
9234     @@@lang:en
9235     @@@@:
9236     The node in which the name has occurred. It is intended
9237     to be reported when an exception had been raised.
9238     @@ResourceDef:
9239     @@@rdf:type:
9240     ManakaiDOM:InCase
9241     @@@Value:
9242     @@@@is-null:1
9243 wakaba 1.49 @@@@ContentType: DISCore|String
9244 wakaba 1.3 @@@Description:
9245     @@@@lang:en
9246     @@@@@:
9247     The source of the name is not a node.
9248    
9249     ElementTypeBinding:
9250     @Name: ForParam
9251     @ElementType:
9252     dis:ResourceDef
9253     @ShadowContent:
9254     @@rdf:type:
9255     DISLang:MethodParameter
9256     @@DISPerl:isNamedParameter:1
9257     @@Name: forArg
9258     @@Type: ForURI
9259     @@Description:
9260     @@@lang:en
9261     @@@@:
9262     The <QUOTE::for> URI reference.
9263     @@ResourceDef:
9264     @@@rdf:type:
9265     ManakaiDOM:InCase
9266     @@@Value:
9267     @@@@is-null:1
9268 wakaba 1.49 @@@@ContentType: DISCore|String
9269 wakaba 1.3 @@@Description:
9270     @@@@lang:en
9271     @@@@@:
9272     Equivalent to <Q::ManakaiDOM:all>, i.e. <QUOTE::for all>.
9273    
9274     ElementTypeBinding:
9275     @Name: ForpParam
9276     @ElementType:
9277     dis:ResourceDef
9278     @ShadowContent:
9279     @@rdf:type:
9280     DISLang:MethodParameter
9281     @@DISPerl:isNamedParameter:1
9282     @@Name: forpArg
9283     @@Type: ForURIList
9284     @@Description:
9285     @@@lang:en
9286     @@@@:
9287     An array reference containing additional <QUOTE::for>
9288     constraints (<QUOTE::For+> list).
9289     @@ResourceDef:
9290     @@@rdf:type:
9291     ManakaiDOM:InCase
9292     @@@Value:
9293     @@@@is-null:1
9294 wakaba 1.49 @@@@ContentType: DISCore|String
9295 wakaba 1.3 @@@Description:
9296     @@@@lang:en
9297     @@@@@:
9298     Equivalent to the empty array reference.
9299    
9300     ElementTypeBinding:
9301     @Name: MediaTypeParam
9302     @ElementType:
9303     dis:ResourceDef
9304     @ShadowContent:
9305     @@rdf:type:
9306     DISLang:MethodParameter
9307     @@DISPerl:isNamedParameter:1
9308     @@Name: mediaType
9309     @@Type: MediaTypeURI
9310     @@Description:
9311     @@@lang:en
9312     @@@@:
9313     The URI reference identifying a media type.
9314     @@ResourceDef:
9315     @@@rdf:type:
9316     ManakaiDOM:InCase
9317     @@@Value:
9318     @@@@is-null:1
9319 wakaba 1.49 @@@@ContentType: DISCore|String
9320 wakaba 1.3 @@@Description:
9321     @@@@lang:en
9322     @@@@@:
9323     No media type specified.
9324    
9325     ElementTypeBinding:
9326     @Name: MediaTypeDefaultParam
9327     @ElementType:
9328     dis:ResourceDef
9329     @ShadowContent:
9330     @@rdf:type:
9331     DISLang:MethodParameter
9332     @@DISPerl:isNamedParameter:1
9333     @@Name: defaultMediaType
9334     @@Type: MediaTypeURI
9335     @@Description:
9336     @@@lang:en
9337     @@@@:
9338     The default media type, i.e. the type used when no explicit
9339     specification is not found in the source tree.
9340     @@ResourceDef:
9341     @@@rdf:type:
9342     ManakaiDOM:InCase
9343     @@@Value:
9344     @@@@is-null:1
9345 wakaba 1.49 @@@@ContentType: DISCore|String
9346 wakaba 1.3 @@@Description:
9347     @@@@lang:en
9348     @@@@@:
9349     Defaulted to <Q::DOMMain:any>.
9350    
9351     ElementTypeBinding:
9352     @Name: RaiseException
9353     @ElementType:
9354     ManakaiDOM:raises
9355    
9356     ElementTypeBinding:
9357     @Name: UndeclaredPrefixException
9358     @ElementType:
9359     ManakaiDOM:raises
9360     @ShadowContent:
9361     @@@: UNDECLARED_NS_PREFIX_ERR
9362     @@Description:
9363     @@@lang:en
9364     @@@@:
9365     The implementation has encounted an undeclared namespace prefix.
9366    
9367     ElementTypeBinding:
9368     @Name: NoDBException
9369     @ElementType:
9370     ManakaiDOM:raises
9371     @ShadowContent:
9372 wakaba 1.47 @@@: NO_ASSOCIATED_DB_ERR
9373 wakaba 1.3 @@Description:
9374     @@@lang:en
9375     @@@@:
9376     No <QUOTE::dis> database is associated to this document.
9377    
9378     ElementTypeBinding:
9379     @Name: XConstDef
9380     @ElementType:
9381     dis:ResourceDef
9382     @ShadowContent:
9383 wakaba 1.63 @@rdf:type: dx|ErrorCode
9384 wakaba 1.3
9385     ElementTypeBinding:
9386     @Name: XSubTypeDef
9387     @ElementType:
9388     dis:ResourceDef
9389     @ShadowContent:
9390 wakaba 1.63 @@rdf:type: dx|ErrorSubCode
9391 wakaba 1.3
9392     ElementTypeBinding:
9393     @Name: XParam
9394     @ElementType:
9395 wakaba 1.63 ecore:hasParameter
9396 wakaba 1.3
9397     ElementTypeBinding:
9398     @Name: XParamDef
9399     @ElementType:
9400     dis:ResourceDef
9401     @ShadowContent:
9402 wakaba 1.63 @@rdf:type: ecore|Parameter
9403     @@For: =ManakaiDOM|all
9404 wakaba 1.54
9405     XParamDef:
9406     @QName: DIS|moduleURI
9407     @enDesc:
9408     A URI of the module in which the resource is defined.
9409 wakaba 1.3
9410     ElementTypeBinding:
9411     @Name: enMufDef
9412     @ElementType:
9413 wakaba 1.68 ecore:defaultMessage
9414 wakaba 1.3 @ShadowContent:
9415     @@ContentType:
9416     lang:muf
9417     @@lang:en

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24