/[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.71 - (hide annotations) (download)
Wed Nov 23 07:58:20 2005 UTC (19 years, 7 months ago) by wakaba
Branch: MAIN
Changes since 1.70: +23 -1 lines
++ manakai/t/ChangeLog	21 Nov 2005 12:14:17 -0000
2005-11-21  Wakaba  <wakaba@suika.fam.cx>

	* Makefile, .cvsignore: |dom-tree.t| added.

++ manakai/lib/Message/Markup/ChangeLog	23 Nov 2005 07:56:10 -0000
2005-11-23  Wakaba  <wakaba@suika.fam.cx>

	* SuikaWikiConfig21.dis (text): New attribute implementation.

++ manakai/lib/Message/Util/ChangeLog	23 Nov 2005 07:56:52 -0000
2005-11-23  Wakaba  <wakaba@suika.fam.cx>

	* DIS.dis (text): New attribute implementation.

	* ManakaiNode.dis (destroyNodeStem): New method.

++ manakai/lib/Message/Util/DIS/ChangeLog	23 Nov 2005 07:57:18 -0000
2005-11-23  Wakaba  <wakaba@suika.fam.cx>

	* Test.dis (setTestData): New method.

++ manakai/lib/Message/DOM/ChangeLog	23 Nov 2005 07:55:33 -0000
2005-11-23  Wakaba  <wakaba@suika.fam.cx>

	* DOMCore.dis: Error codes added.

	* Tree.dis (destroyNodeStem): New method implementation.

2005-11-22  Wakaba  <wakaba@suika.fam.cx>

	* Tree.dis (cloneNode): User data handlers implemented.
	(adoptNode): User data handlers implemented.

2005-11-21  Wakaba  <wakaba@suika.fam.cx>

	* DOMCore.dis (UserDataHandler): A constraint for Perl binding
	added.

	* Tree.dis (cloneNode): Invoking of |UserDataHandler|s are implemented.
	(getUserData, setUserData): Implemented.

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

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24