/[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.86 - (hide annotations) (download)
Thu Feb 23 17:51:49 2006 UTC (19 years, 4 months ago) by wakaba
Branch: MAIN
Changes since 1.85: +55 -15 lines
++ manakai/lib/Message/Util/ChangeLog	23 Feb 2006 17:23:56 -0000
2006-02-24  Wakaba  <wakaba@suika.fam.cx>

	* DIS.dis (loadResource): URI registration by |addResourceList|
	was incorrect for aliases.
	(unloadResource): It did not support resources with
	no e.g. |{subOf}| hash.
	(addResourceURI): New method.
	(getResourceURIList): New method.

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

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24