/[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.103 - (hide annotations) (download)
Fri Nov 3 17:53:33 2006 UTC (18 years, 8 months ago) by wakaba
Branch: MAIN
Changes since 1.102: +26 -38 lines
++ manakai/bin/ChangeLog	3 Nov 2006 11:50:21 -0000
2006-11-03  Wakaba  <wakaba@suika.fam.cx>

	* grep-dis.pl: New script.

++ manakai/lib/Message/Util/ChangeLog	3 Nov 2006 17:49:43 -0000
2006-11-03  Wakaba  <wakaba@suika.fam.cx>

	* autoload/: New directory.

	* DIS.dis (getPropertyResourceList): Unused |defaultMediaType|
	parameter is deleted.  New |isaRecursivePropName|
	and |recursiveISAPropName| parameters are added.

	* PerlCode.dis (addRevISAPackageName, getRevISAPackageName):
	New methods.
	(stringify): Support for the rev-ISA packages is added.
	(getAutoloadDefinitionList): New method.

++ manakai/lib/Message/Util/DIS/ChangeLog	3 Nov 2006 17:51:23 -0000
2006-11-03  Wakaba  <wakaba@suika.fam.cx>

	* Perl.dis (plCodeFragment): Don't generate
	method parameter code if |DISPerl:noParameterModification|
	property is set.  Support for the |domperl:classExtends|
	and |domperl:classImplementedByObjectsOf| property
	is added.

++ manakai/lib/Message/DOM/ChangeLog	3 Nov 2006 17:47:28 -0000
2006-11-04  Wakaba  <wakaba@suika.fam.cx>

	* DOMCore.dis (ManakaiDOMImplementation): No longer
	explicitly inherits |tc:ManakaiDOMImplementationTC|.
	(ManakaiDOMImplementation.AUTOLOAD): New method definition.

	* TreeCore.dis (ManakaiDOMImplementationTC): Extends
	the |ManakaiDOMImplementation| class.

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

	* DOMFeature.dis: Definitions for various concepts
	are added.

	* GenericLS.dis (GLSImplementation): It no
	longer inherits the |MinimumImplementation|; rather,
	any |ManakaiMinimumImplementation| object also
	implements |GLSImplementation| methods.

	* TreeStore.dis (DOMImplementationTreeStore): It no
	longer inherits the |DOMImplementation|; rather,
	any |ManakaiDOMImplementation| object also
	implements |DOMImplementationTreeStore| methods.

++ manakai/lib/manakai/ChangeLog	3 Nov 2006 17:53:26 -0000
2006-11-03  Wakaba  <wakaba@suika.fam.cx>

	* DISLang.dis (DISLang:AnyObject): New.
	(DISLang:extends, DISLang:implements): New.

	* DISPerl.dis (p:revISA): New.
	(p:noParameterModification): New.

	* daf-perl-pm.pl (daf_perl_pm): Update
	the |Message::Util::AutoLoad::Registry| module
	after the Perl module is generated.

++ manakai/lib/ChangeLog	3 Nov 2006 17:42:27 -0000
2006-11-04  Wakaba  <wakaba@suika.fam.cx>

	* Makefile (all): Make |Message/Util/AutoLoad/Registry.pm|.

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

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24