/[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.95 - (hide annotations) (download)
Wed Mar 15 13:45:00 2006 UTC (19 years, 4 months ago) by wakaba
Branch: MAIN
Changes since 1.94: +79 -8 lines
++ manakai/lib/Message/Util/ChangeLog	15 Mar 2006 13:43:14 -0000
2006-03-15  Wakaba  <wakaba@suika.fam.cx>

	* DIS.dis (getMethodForType): Parameter |$resource|
	is changed to |$type_resource|.
	(getDOMConfigurationParameterName): New method.

++ manakai/lib/Message/Util/DIS/ChangeLog	15 Mar 2006 13:44:52 -0000
2006-03-15  Wakaba  <wakaba@suika.fam.cx>

	* Value.dis (getPerlCode): New method.

	* Perl.dis (plValueCodeFragment): Deprecated.
	(getPerlCodeFromDVValue): New method.
	(plCodeFragment): The implementation for |dis:SetParam|
	properties was incorrect.

++ manakai/lib/Message/DOM/ChangeLog	15 Mar 2006 13:42:31 -0000
2006-03-15  Wakaba  <wakaba@suika.fam.cx>

	* DOMCore.dis (c:DOMConfigurationParameter): Now it is
	a |DISSource:ResourceProperty|.
	(c:anyDOMConfigurationParameter): New property.
	(CParam, boolCParam): Now they are all |dis:subsetOf|
	the |c:anyDOMConfigurationParameter| property.
	(ForDocument, ForParser, ForSerializer): Removed.

	* DOMLS.dis, XMLParser.dis: Likewise.

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

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24