/[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.94 - (hide annotations) (download)
Sun Mar 12 14:16:53 2006 UTC (19 years, 4 months ago) by wakaba
Branch: MAIN
Changes since 1.93: +3 -17 lines
++ manakai/t/ChangeLog	12 Mar 2006 14:16:45 -0000
2006-03-12  Wakaba  <wakaba@suika.fam.cx>

	* Makefile: Creates |../lib/Message/Util/DIS/Test.pm|
	before try to create test scripts.

++ manakai/lib/Message/Util/ChangeLog	12 Mar 2006 14:15:37 -0000
	* DIS.dis (loadResource): Support for the |dis:aliasChild|
	property has been removed.

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

++ manakai/lib/Message/DOM/ChangeLog	12 Mar 2006 14:14:43 -0000
2006-03-12  Wakaba  <wakaba@suika.fam.cx>

	* DOMMain.dis, Tree.dis: Unused |dis:aliasChild| properties
	are removed.

	* GenericLS.pm: Added to the CVS repository since
	it is necessary to create the |Message::Util::DIS::DPG| module.

++ manakai/lib/manakai/ChangeLog	12 Mar 2006 14:16:08 -0000
	* DISSource.dis (dis:aliasChild): Removed.

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

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

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24