/[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.84 - (hide annotations) (download)
Wed Feb 22 11:22:06 2006 UTC (19 years, 4 months ago) by wakaba
Branch: MAIN
Changes since 1.83: +146 -1 lines
++ manakai/lib/Message/Util/ChangeLog	22 Feb 2006 11:00:33 -0000
2006-02-22  Wakaba  <wakaba@suika.fam.cx>

	* PerlCode.dis (PCVariable.stringify): The |hashKey|
	attribute was not reflected to the stringified representation.

	* DIS.dis (getErrorInterfaceResource): New method.
	(getErrorCodeResource): New method.

++ manakai/lib/Message/Util/Error/ChangeLog	22 Feb 2006 11:06:19 -0000
2006-02-22  Wakaba  <wakaba@suika.fam.cx>

	* DOMException.dis (c:code): Definition was missing.
	(dx:Exception): The |ISA| property was not updated
	at 2006-02-06 change.

++ manakai/lib/Message/Util/DIS/ChangeLog	22 Feb 2006 11:05:01 -0000
2006-02-22  Wakaba  <wakaba@suika.fam.cx>

	* Perl.dis (getPerlNameList): The |DISPerl:methodName|
	properties are not returned if it is specified more than once.
	(plFullyQualifiedName): Cacheing is reintroduced.
	(getPerlClassMemberCode): The |const| parameter is removed.
	(getPerlErrorInterfaceMemberCode): New method.
	(getPerlDefinitionHashNamespace): New method.
	(getPerlErrorCodeName): New method.
	(plCodeFragment): Error definition list is now generated
	as a set of assignments rather than one large subroutine.

	* DPG.dis, Test.dis: Error code constants are typed as so.

++ manakai/lib/Message/DOM/ChangeLog	22 Feb 2006 10:58:59 -0000
2006-02-22  Wakaba  <wakaba@suika.fam.cx>

	* DOMLS.dis: Constants were typed as |dx:ErrorCode|
	by mistake.

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

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24