/[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.83 - (hide annotations) (download)
Mon Feb 20 14:52:44 2006 UTC (19 years, 4 months ago) by wakaba
Branch: MAIN
Changes since 1.82: +5 -3 lines
++ manakai/lib/Message/Util/ChangeLog	20 Feb 2006 14:50:03 -0000
	* DIS.dis (MUErrorHandler): Missing |For| specification is added.

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

	* DIS.dis (getMethodForType): Bug fixed.

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

++ manakai/lib/Message/Util/DIS/ChangeLog	20 Feb 2006 14:51:08 -0000
	* Perl.dis (plGeneratePerlModule): Some part split
	to |getPerlModuleMemberCode| method.
	(getPerlModuleMemberCode): New method.

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

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

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24