/[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.72 - (hide annotations) (download)
Wed Nov 23 11:21:20 2005 UTC (19 years, 7 months ago) by wakaba
Branch: MAIN
Changes since 1.71: +4 -2 lines
++ manakai/bin/ChangeLog	23 Nov 2005 11:08:32 -0000
2005-11-23  Wakaba  <wakaba@suika.fam.cx>

	* dac.pl, dac2pm.pl, dac2test.pl: |--verbose| or |--debug|
	option turns verbose or debug mode of |Message::Util::Error|
	module respectively.

++ manakai/lib/Message/Markup/ChangeLog	23 Nov 2005 11:09:11 -0000
	* SuikaWikiConfig21.dis: Bugs on error depth fixed.

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

++ manakai/lib/Message/Util/ChangeLog	23 Nov 2005 11:19:31 -0000
	* Error.pm (new): Sets |-stacktrace_| property if debug
	or verbose mode.
	(stringify): Appends longer trace if debug or verbose mode.
	($VERBOSE): New flag.

	* DIS.dis: Bugs on error depth fixed.

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

++ manakai/lib/Message/Util/Error/ChangeLog	23 Nov 2005 11:20:41 -0000
2005-11-23  Wakaba  <wakaba@suika.fam.cx>

	* DOMException.dis (stringify): Prepends only local name part
	of class package name where an exception is thrown.

	* Core.dis: Sync with revised |Message::Util::Error| implemetnation.

++ manakai/lib/Message/Util/DIS/ChangeLog	23 Nov 2005 11:12:18 -0000
	* DNLite.dis: Bug on error depth fixed.

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

1 wakaba 1.1 Module:
2 wakaba 1.51 @QName: Util|DIS
3 wakaba 1.1 @FullName:
4     @@lang: en
5     @@@:
6     <QUOTE::DIS> Object Model
7     @Namespace:
8     http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/DIS#
9    
10     @Description:
11     @@lang:en
12     @@@:
13 wakaba 1.14 This module provides an object model for <QUOTE::dis> document format.
14 wakaba 1.1
15 wakaba 1.53 @DISCore:author: DISCore|Wakaba
16 wakaba 1.1 @License:
17     @@@:
18     license:Perl+MPL
19     @@Original:
20     @@@FullName:
21 wakaba 1.19 manakai <CODE::lib/manakai/dis.pl> and <CODE::bin/cdis2pm.pl>
22 wakaba 1.1 @@@Year:2004
23 wakaba 1.53 @@@DISCore:author: DISCore|Wakaba
24 wakaba 1.1 @Date:
25     @@@:
26 wakaba 1.72 $Date: 2005/11/23 07:58:20 $
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.72 goto &$self;
3790 wakaba 1.48
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.72 __DEEP{
4104 wakaba 1.50 if ($given->isa (<IFName::dv|DVValue>)) {
4105     $given = $given-><AG::dv|DVValue.sourceNodePath>;
4106     } else {
4107     $given = $given-><M::SWCFGNode.flag> ('nodePath') ||
4108     $given-><M::SWCFGNode.nodePath>
4109 wakaba 1.52 (key => [qw/QName Name type Type/]);
4110 wakaba 1.50 }
4111 wakaba 1.72 }__;
4112 wakaba 1.48 }
4113 wakaba 1.53 $self->{<H::DIS|isReferred>} = $given;
4114 wakaba 1.48 }
4115    
4116     @Attr:
4117     @@Name: sourceNodeID
4118     @@enDesc:
4119     The identifier URI reference of the source node.
4120     @@enDesc:
4121     @@@ForCheck: ManakaiDOM|ForClass
4122     @@@@:
4123     Modules and <QUOTE::for>s does not have source node identifier
4124     in the current implementation.
4125     @@Type: AnyURI
4126     @@Get:
4127     @@@nullCase:
4128     @@@@enDesc:
4129     The resource is not (yet) associated with any source node.
4130     @@@PerlDef:
4131 wakaba 1.53 if (defined $self->{<H::DIS:sourceNodeID>}) {
4132     $r = ${$self->{<H::DIS:sourceNodeID>}};
4133 wakaba 1.50 } else {
4134     $r = null;
4135     }
4136     @@Set:
4137     @@@PerlDef:
4138     if (defined $given) {
4139 wakaba 1.53 $self->{<H::DIS:sourceNodeID>} = \$given;
4140 wakaba 1.50 } else {
4141 wakaba 1.53 CORE::delete $self->{<H::DIS:sourceNodeID>};
4142 wakaba 1.50 }
4143    
4144     @Attr:
4145     @@Name: sourceNodeIDRef
4146     @@enDesc:
4147     The identifier URI reference of the source node.
4148     @@enDesc:
4149     @@@ForCheck: ManakaiDOM|ForClass
4150     @@@@:
4151     Modules and <QUOTE::for>s does not have source node identifier
4152     in the current implementation.
4153 wakaba 1.60 @@Type: DISPerl|SCALAR||ManakaiDOM|all
4154 wakaba 1.50 @@Get:
4155     @@@nullCase:
4156     @@@@enDesc:
4157     The resource is not (yet) associated with any source node.
4158     @@@PerlDef:
4159 wakaba 1.53 $r = $self->{<H::DIS:sourceNodeID>};
4160 wakaba 1.48 @@Set:
4161 wakaba 1.7 @@@PerlDef:
4162 wakaba 1.50 if (defined $given) {
4163 wakaba 1.53 $self->{<H::DIS:sourceNodeID>} = $given;
4164 wakaba 1.50 } else {
4165 wakaba 1.53 CORE::delete $self->{<H::DIS:sourceNodeID>};
4166 wakaba 1.50 }
4167 wakaba 1.7
4168 wakaba 1.2 @Attr:
4169 wakaba 1.48 @@Name: isAnonymous
4170     @@enDesc:
4171     Whether the resource has persistent name or not.
4172     @@Type:
4173 wakaba 1.18 DOMMain:boolean::ManakaiDOM:all
4174 wakaba 1.2 @@Get:
4175     @@@TrueCase:
4176 wakaba 1.48 This resource does <EM::not> have any globally unique name.
4177     <A::DISAnyResource.uri> is a temporary URI reference.
4178 wakaba 1.2 @@@FalseCase:
4179 wakaba 1.48 This resource does have its formal name.
4180     <A::DISAnyResource.uri> is a URI reference
4181     generated from the name and the <QUOTE::for> URI reference
4182     of this resource.
4183 wakaba 1.2 @@@PerlDef:
4184 wakaba 1.53 $r = $self->{<H::DIS|isAnon>};
4185 wakaba 1.2
4186     @Attr:
4187 wakaba 1.48 @@Name: sourceElement
4188     @@enDesc:
4189     The source <QUOTE::dis> element node from which this
4190     definition is read.
4191 wakaba 1.2 @@Get:
4192 wakaba 1.48 @@@Type: DISElement
4193     @@@clsActualType: ManakaiDISElement
4194     @@@InCase:
4195     @@@@Type: DISModuleElement
4196     @@@@clsActualType: ManakaiDISModuleElement
4197     @@@@enDesc: If this resource is a module.
4198     @@@PerlDef: $r = $self->{src};
4199 wakaba 1.2 @@@nullCase:
4200 wakaba 1.48 @@@@enDesc:
4201     The definition is not yet read.
4202 wakaba 1.2
4203     @Attr:
4204 wakaba 1.48 @@Name: database
4205     @@enDesc:
4206     The <QUOTE::dis> database to which the resource belongs.
4207     @@Type: DISDatabase
4208     @@clsActualType: ManakaiDISDatabase
4209 wakaba 1.2 @@Get:
4210     @@@PerlDef:
4211 wakaba 1.48 $r = $self->{db};
4212    
4213 wakaba 1.6 @Method:
4214 wakaba 1.48 @@Name: readProperties
4215 wakaba 1.6 @@enDesc:
4216 wakaba 1.48 Reads property values in the source tree and
4217     removes reference to the source node.
4218     @@NamedParam:
4219     @@@Name: onResourceRead
4220     @@@Type:
4221 wakaba 1.60 DISPerl:CODE::ManakaiDOM:all
4222 wakaba 1.6 @@@enDesc:
4223 wakaba 1.48 An event handler called when a resource is read.
4224     @@@nullCase:
4225     @@@@enDesc:
4226     No event handler is read.
4227 wakaba 1.6 @@Return:
4228 wakaba 1.11 @@@RaiseException:
4229 wakaba 1.48 @@@@@: UNSUPPORTED_ELEMENT_TYPE_ERR
4230     @@@@enDesc:
4231     There is an element whose element type is not supported.
4232 wakaba 1.11 @@@PerlDef:
4233 wakaba 1.6 __DEEP{
4234 wakaba 1.48 if (my $src = $self->{src}) {
4235 wakaba 1.49 my $for = $self-><AG::DISAnyResource.forURI>;
4236     my $forp = $self-><AG::DISAnyResource.forpURI>;
4237     my $db = $self-><AG::DISAnyResource.database>;
4238 wakaba 1.48 for my $el (@{$src-><M::DISElement.disChildElements>
4239 wakaba 1.49 (for_arg => $for,
4240     forp_arg => $forp,
4241     database_arg => $db)}) {
4242 wakaba 1.48 my $xu = $el-><AG::SWCFGElement.expandedURI>;
4243     if ({
4244     <Q::dis:AliasFor> => true,
4245     <Q::dis:ContentType> => true,
4246     <Q::dis:dataType> => true,
4247     <Q::dis:For> => true,
4248     <Q::dis:ForCheck> => true,
4249     <Q::dis:Name> => true,
4250     <Q::dis:Namespace> => true,
4251     <Q::dis:multipleProperties> => true,
4252     <Q::rdf:type> => true,
4253     <Q::dis:QName> => true,
4254     <Q::dis:Require> => true,
4255     <Q::dis:resourceFor> => true,
4256     }->{$xu}) {
4257     #
4258 wakaba 1.49 } elsif ($el-><M::DISElement.isPropertyElement>
4259     (database_arg => $db)) {
4260 wakaba 1.48 my $add_prop;
4261     $add_prop = sub ($$$) {
4262     my ($self, $el, $db) = @_;
4263     my $prop = $db-><M::DISDatabase.getResource>
4264     ($el-><AG::SWCFGElement.expandedURI>);
4265     my $prop_uri = $prop-><AG::DISAnyResource.uri>;
4266     my $prop_mult = $prop-><AG::DISResource.multiplePropertiesURI>;
4267     my $new_value;
4268     my $base_type;
4269     my $copy_tree = false;
4270    
4271 wakaba 1.49 my %mtopt = (for_arg => $for,
4272     forp_arg => $forp,
4273 wakaba 1.48 default_media_type => $prop-><AG::DISResource
4274 wakaba 1.49 .defaultLextypeURI>,
4275     database_arg => $db);
4276 wakaba 1.51 my $new_value_type = $el-><M::DISElement.mediaTypeURI>(%mtopt);
4277    
4278 wakaba 1.48 if ($el-><M::DISElement.mediaTypeMatch>
4279 wakaba 1.68 (<Q::DISCore:QName>, $mtopt{default_media_type}, %mtopt)) {
4280 wakaba 1.48 __CODE{dv|createValue::
4281     $value => {null},
4282 wakaba 1.68 $base_type => {$base_type = <Q::DISCore:QName>},
4283 wakaba 1.50 $type => {$new_value_type},
4284 wakaba 1.48 $result => $new_value,
4285 wakaba 1.60 $name => {$prop_uri},
4286 wakaba 1.48 }__;
4287     $new_value-><AS::dv|DVQNameValue.localName>
4288     ($el-><AG::DISElement.qnameValueLocalName>);
4289     $new_value-><AS::dv|DVQNameValue.prefix>
4290 wakaba 1.49 (my $prefix = $el-><AG::DISElement.qnameValuePrefix>);
4291     if (not defined $prefix) {
4292     if ($el-><M::DISElement.mediaTypeMatch>
4293     (<Q::DISCore:LanguageTag>,
4294     $mtopt{default_media_type}, %mtopt)) {
4295     $new_value-><AS::dv|DVQNameValue.namespaceURI>
4296     ('urn:x-suika-fam-cx:lang:');
4297     } elsif ($el-><M::DISElement.mediaTypeMatch>
4298     (<Q::DISCore:ScriptTag>,
4299     $mtopt{default_media_type}, %mtopt)) {
4300     $new_value-><AS::dv|DVQNameValue.namespaceURI>
4301     ('http://suika.fam.cx/~wakaba/archive/2005/5/script#');
4302     } else {
4303     $new_value-><AS::dv|DVQNameValue.namespaceURI>
4304     ($el-><AG::DISElement.qnameValueNamespaceURI>);
4305     }
4306     } else {
4307     $new_value-><AS::dv|DVQNameValue.namespaceURI>
4308     ($el-><AG::DISElement.qnameValueNamespaceURI>);
4309     }
4310 wakaba 1.48 ## TODO: Check whether defined
4311     } elsif ($el-><M::DISElement.mediaTypeMatch>
4312     (<Q::dis:TFQNames>, $mtopt{default_media_type}, %mtopt) or
4313     $el-><M::DISElement.mediaTypeMatch>
4314     (<Q::DISCore:TFPQNames>, $mtopt{default_media_type}, %mtopt)) {
4315     __CODE{dv|createURI::
4316     $uri => {$el-><M::DISElement.tfqnamesValueURI>
4317     ($self-><AG::DISAnyResource.sourceNodeID>,
4318     $self-><AG::DISAnyResource.forURI>,
4319     for_arg => $self-><AG::DISAnyResource.forURI>,
4320 wakaba 1.49 forp_arg => $self-><AG::DISAnyResource.forpURI>,
4321     database_arg => $db)},
4322 wakaba 1.48 $result => $new_value,
4323 wakaba 1.60 $name => {$prop_uri},
4324 wakaba 1.48 }__;
4325     ## TODO: Check whether defined
4326 wakaba 1.50 $new_value_type = <Q::DISCore:URI>;
4327 wakaba 1.48 } elsif ($el-><M::DISElement.mediaTypeMatch>
4328     (<Q::lang:Perl>, $mtopt{default_media_type},
4329     %mtopt)) {
4330     $el-><M::DISElement.preserveNodePath>;
4331 wakaba 1.50 __CODE{dv|createValueRef::
4332     $value_ref => {$el-><AG::SWCFGNode.valueRef>},
4333 wakaba 1.49 $base_type => {$base_type = <Q::lang:Perl>},
4334 wakaba 1.50 $type => {$new_value_type},
4335 wakaba 1.48 $result => $new_value,
4336 wakaba 1.60 $name => $prop_uri,
4337 wakaba 1.48 }__;
4338     for my $p (<Q::dis:Type>, <Q::dis:actualType>) {
4339     if (UNIVERSAL::isa ($self->{$p},<IFName::dv|DVURIValue>)) {
4340     my $v;
4341     __CODE{dv|createURI::
4342     $uri => {$self->{$p}-><AG::dv|DVURIValue.uri>},
4343     $result => $v,
4344 wakaba 1.60 $name => $prop_uri,
4345 wakaba 1.48 }__;
4346     $new_value-><M::dv|DVValue.setProperty> ($p => $v);
4347     }
4348     }
4349 wakaba 1.49 $new_value-><AS::dv|DVNSValue.defaultNamespaceURIRef>
4350     ($el-><M::DISElement.getDefaultNamespaceURIRef>);
4351     $new_value-><AS::dv|DVNSValue.namespaceBindingList>
4352     ($el-><M::DISElement.getNamespaceBindingList> ($db));
4353     $new_value-><AS::dv|DVValue.sourceNodePath>
4354     ($el-><M::SWCFGNode.flag> ('nodePath'));
4355 wakaba 1.48 } elsif ($el-><M::DISElement.mediaTypeMatch>
4356     (<Q::lang:disdoc>, $mtopt{default_media_type},
4357     %mtopt) or
4358     $el-><M::DISElement.mediaTypeMatch>
4359     (<Q::lang:disdocInline>, $mtopt{default_media_type},
4360 wakaba 1.49 %mtopt) or
4361     $el-><M::DISElement.mediaTypeMatch>
4362     (<Q::lang:muf>, $mtopt{default_media_type},
4363     %mtopt)) {
4364     $el-><M::DISElement.preserveNodePath>;
4365 wakaba 1.50 __CODE{dv|createValueRef::
4366     $value_ref => {$el-><AG::SWCFGNode.valueRef>},
4367 wakaba 1.49 $base_type => {$base_type = <Q::lang:disdoc>},
4368 wakaba 1.50 $type => $new_value_type,
4369 wakaba 1.49 $result => $new_value,
4370 wakaba 1.60 $name => $prop_uri,
4371 wakaba 1.49 }__;
4372     $new_value-><AS::dv|DVNSValue.defaultNamespaceURIRef>
4373     ($el-><M::DISElement.getDefaultNamespaceURIRef>);
4374     $new_value-><AS::dv|DVNSValue.namespaceBindingList>
4375     ($el-><M::DISElement.getNamespaceBindingList> ($db));
4376     $new_value-><AS::dv|DVValue.sourceNodePath>
4377     ($el-><M::SWCFGNode.flag> ('nodePath'));
4378     } elsif ($el-><M::DISElement.mediaTypeMatch>
4379 wakaba 1.52 (<Q::dx|XCRef>,
4380     $mtopt{default_media_type}, %mtopt)) {
4381     my $x = $db-><M::DISDatabase.xcrefToResource>
4382     ($el-><M::SWCFGNode.value>,
4383 wakaba 1.59 $el, node => $el,
4384     for_arg => $self-><AG::DIS|DISAnyResource.forURI>);
4385 wakaba 1.52 __CODE{dv|createURI::
4386     $uri => {($x->[2] or $x->[1] or $x->[0])
4387     -><AG::DISAnyResource.uri>},
4388     $result => $new_value,
4389 wakaba 1.60 $name => $prop_uri,
4390 wakaba 1.52 }__;
4391     $new_value-><M::dv|DVURIValue.getResource> ($db)
4392     -><AS::DISAnyResource.isReferred> ($el);
4393     $new_value_type = <Q::DISCore:URI>;
4394     } elsif ($el-><M::DISElement.mediaTypeMatch>
4395     (<Q::DISLang|MemberRef>,
4396     $mtopt{default_media_type}, %mtopt)) {
4397     my $v = $el-><M::SWCFGNode.value>;
4398     $v =~ s/^\s+//; $v =~ s/\s+$//;
4399     my ($clsq, $mem, $gs) = split /\s*\.\s*/, $v, 3;
4400     my $res;
4401     if (defined $mem) {
4402     my $cls = $db-><M::DISDatabase.getResource>
4403     ($el-><M::DISElement.tfqnamesValueURI>
4404     ($clsq, $self-><AG::DISAnyResource.sourceNodeID>,
4405     $self-><AG::DISAnyResource.forURI>, node => $el));
4406     $cls-><AS::DISAnyResource.isReferred> ($el);
4407     $res = $cls-><M::DISResource.getChildResourceByNameAndType>
4408     ($mem, <Q::DISLang:AnyMethod>);
4409     unless ($res) {
4410     __UNDEEP{__EXCEPTION{DIS|RESOURCE_NOT_DEFINED_ERR::
4411     DIS:localName => {$mem},
4412     DIS:parentURI => {$cls-><AG::DISAnyResource.uri>},
4413     DIS:elementType => {$el-><AG::SWCFGElement
4414     .expandedURI>},
4415     DIS:sourceNode => {$el},
4416     DIS:sourceCode => {$v},
4417     DIS:expectedType => {
4418     defined $gs ? <Q::DISLang:Attribute>
4419     : <Q::DISLang:Method>
4420     },
4421     }__}__;
4422     }
4423     if (defined $gs) {
4424     $res = $res-><M::DISResource.getChildResourceByType>
4425     ($gs eq 'get' ? <Q::DISLang|AttributeGet>
4426     : <Q::DISLang|AttributeSet>);
4427     unless ($res) {
4428     __UNDEEP{__EXCEPTION{DIS|RESOURCE_NOT_DEFINED_ERR::
4429     DIS:parentURI => {$res-><AG::DISAnyResource.uri>},
4430     DIS:elementType => {$el-><AG::SWCFGElement
4431     .expandedURI>},
4432     DIS:sourceNode => {$el},
4433     DIS:sourceCode => {$v},
4434     DIS:expectedType => {
4435     $gs eq 'get' ? <Q::DISLang:AttributeGet>
4436     : <Q::DISLang:AttributeSet>
4437     },
4438     }__}__;
4439     }
4440     }
4441     } else {
4442     $res = $db-><M::DISDatabase.getResource>
4443     ($el-><M::DISElement.tfqnamesValueURI>
4444     ($clsq, $self-><AG::DISAnyResource.sourceNodeID>,
4445     $self-><AG::DISAnyResource.forURI>, node => $el));
4446     }
4447     $res-><AS::DISAnyResource.isReferred> ($el);
4448     __CODE{dv|createURI::
4449     $uri => {$el-><AG::DISAnyResource.uri>},
4450     $result => $new_value,
4451 wakaba 1.60 $name => $prop_uri,
4452 wakaba 1.52 }__;
4453     $new_value_type = <Q::DISCore:URI>;
4454     } elsif ($el-><M::DISElement.mediaTypeMatch>
4455 wakaba 1.49 (<Q::lang:dis>, $mtopt{default_media_type},
4456     %mtopt)) {
4457     $copy_tree = true;
4458 wakaba 1.48 $el-><M::DISElement.preserveNodePath>;
4459     my $elc = $el->clone;
4460     __CODE{dv|createValue::
4461     $value => {$elc},
4462 wakaba 1.49 $base_type => {$base_type = <Q::lang:dis>},
4463 wakaba 1.50 $type => $new_value_type,
4464 wakaba 1.48 $result => $new_value,
4465 wakaba 1.60 $name => $prop_uri,
4466 wakaba 1.48 }__;
4467 wakaba 1.49 $elc-><M::DISElement.unlinkFromDocument> ($db);
4468 wakaba 1.64 } elsif ($el-><M::DISElement.mediaTypeMatch>
4469     (<Q::DISCore:Integer>,
4470     $mtopt{default_media_type}, %mtopt)) {
4471     my $v = $el-><M::SWCFGNode.value>;
4472     if ($v =~ /^0x/) {
4473     $v = hex $v;
4474     } else {
4475     $v += 0;
4476     }
4477     __CODE{dv|createValue::
4478     $value => $v,
4479     $base_type => {$base_type = <Q::DISCore:String>},
4480     $type => $new_value_type,
4481     $result => $new_value,
4482     $name => $prop_uri,
4483     }__;
4484 wakaba 1.48 } else {
4485     __CODE{dv|createValue::
4486     $value => {$el-><M::SWCFGNode.value>},
4487     $base_type => {$base_type = <Q::DISCore:String>},
4488 wakaba 1.50 $type => $new_value_type,
4489 wakaba 1.48 $result => $new_value,
4490 wakaba 1.60 $name => $prop_uri,
4491 wakaba 1.48 }__;
4492     }
4493    
4494     unless ($copy_tree) {
4495     for my $ce (@{$el-><M::DISElement.disChildElements>
4496 wakaba 1.49 (for_arg => $for,
4497     forp_arg => $forp,
4498     database_arg => $db)}) {
4499 wakaba 1.48 my $xu = $ce-><AG::SWCFGElement.expandedURI>;
4500     if ({
4501     <Q::dis:AliasFor> => true,
4502     <Q::dis:For> => true,
4503     <Q::dis:ForCheck> => true,
4504     <Q::dis:ContentType> => true,
4505     <Q::dis:resourceFor> => true,
4506     }->{$xu}) {
4507     #
4508 wakaba 1.49 } elsif ($ce-><M::DISElement.isPropertyElement>
4509     (database_arg => $db)) {
4510 wakaba 1.48 my $pr;
4511     __DEEP{
4512     $pr = $add_prop->($self, $ce, $db);
4513     }__;
4514     if ($pr->{prop_mult} eq <Q::DISCore|OrderedList>) {
4515     my $cpv = $new_value-><M::dv|DVValue.getProperty> ($xu);
4516     if (not $cpv) {
4517     __CODE{dv|createOrderedList::
4518     $result => {$cpv},
4519     $type => {$mtopt{default_media_type}},
4520     $base_type => {<Q::DISCore:String>},
4521     }__;
4522     $new_value-><M::dv|DVValue.setProperty> ($xu => $cpv);
4523     }
4524     $cpv-><M::dv|DVList.addItem> ($pr->{new_value});
4525     } elsif ($pr->{prop_mult} eq <Q::DISCore|UnorderedList>) {
4526     my $cpv = $new_value-><M::dv|DVValue.getProperty> ($xu);
4527     if (not $cpv) {
4528     __CODE{dv|createUnorderedList::
4529     $result => {$cpv},
4530     $type => {$mtopt{default_media_type}},
4531     $base_type => {<Q::DISCore:String>},
4532     }__;
4533     $new_value-><M::dv|DVValue.setProperty> ($xu => $cpv);
4534     }
4535     $cpv-><M::dv|DVList.addItem> ($pr->{new_value});
4536     } else {
4537     $new_value-><M::dv|DVValue.setProperty>
4538     ($xu => $pr->{new_value});
4539     }
4540     } else {
4541     __UNDEEP{__EXCEPTION{UNSUPPORTED_ELEMENT_TYPE_ERR::
4542     DIS:elementType => {$xu},
4543     DIS:sourceNode => {$ce},
4544     }__}__;
4545     }
4546     }} # copy_tree
4547    
4548     {new_value => $new_value, base_type => $base_type,
4549 wakaba 1.50 prop_uri => $prop_uri, prop_mult => $prop_mult,
4550     new_value_type => $new_value_type};
4551 wakaba 1.48 };
4552    
4553     my $pr;
4554     __DEEP{
4555 wakaba 1.49 $pr = $add_prop->($self, $el, $db);
4556 wakaba 1.48 }__;
4557     if ($pr->{prop_mult} eq <Q::DISCore|OrderedList>) {
4558     if (not $self->{$pr->{prop_uri}}) {
4559     __CODE{dv|createOrderedList::
4560     $result => {$self->{$pr->{prop_uri}}},
4561 wakaba 1.50 $type => {$pr->{new_value_type}},
4562 wakaba 1.48 $base_type => {$pr->{base_type} || <Q::DISCore:String>},
4563     }__;
4564     }
4565     $self->{$pr->{prop_uri}}-><M::dv|DVList.addItem>
4566     ($pr->{new_value});
4567     } elsif ($pr->{prop_mult} eq <Q::DISCore|UnorderedList>) {
4568     if (not $self->{$pr->{prop_uri}}) {
4569     __CODE{dv|createUnorderedList::
4570     $result => {$self->{$pr->{prop_uri}}},
4571 wakaba 1.50 $type => {$pr->{new_value_type}},
4572 wakaba 1.48 $base_type => {$pr->{base_type} || <Q::DISCore:String>},
4573     }__;
4574     }
4575     $self->{$pr->{prop_uri}}-><M::dv|DVList.addItem>
4576     ($pr->{new_value});
4577     } else {
4578     $self->{$pr->{prop_uri}} = $pr->{new_value};
4579     }
4580 wakaba 1.53
4581     if ($el-><M::DISElement.elementTypeMatch>
4582     (<Q::DISPerl:propHashKey>, database_arg => $db)) {
4583     $db-><M::dp|DISDatabasePerl.plAddHashKey>
4584     ($xu => $pr->{new_value}-><AG::dv|DVValue.stringValue>
4585     => $self);
4586     }
4587 wakaba 1.48 } elsif ($el-><AG::DISElement.isResourceElement>) {
4588     ## TODO: Should rdf:type be validated?
4589     } else {
4590     __UNDEEP{__EXCEPTION{UNSUPPORTED_ELEMENT_TYPE_ERR::
4591     DIS:elementType => {$xu},
4592     DIS:sourceNode => {$el},
4593     }__}__;
4594     }
4595 wakaba 1.6 }
4596 wakaba 1.48 CORE::delete $self->{src};
4597     ($onResourceRead or sub () {})->($self, $self);
4598 wakaba 1.6 }
4599     }__;
4600 wakaba 1.61
4601     @Method:
4602     @@ForCheck: ManakaiDOM|ForIF
4603     @@Name: isTypeURI
4604     @@enDesc:
4605     Tests whether this resource is of a type or not.
4606     @@Param:
4607     @@@Name: typeURI
4608     @@@Type: ResourceURI
4609     @@@enDesc:
4610     A type URI reference to test.
4611     @@Return:
4612     @@@Type:
4613     DOMMain:boolean::ManakaiDOM:all
4614     @@@TrueCase:
4615     @@@@enDesc:
4616     This is a <P::typeURI> resource.
4617     @@@FalseCase:
4618     @@@@enDesc:
4619     This is not a <P::typeURI> resource.
4620 wakaba 1.48 ##DISAnyResource
4621    
4622     IFClsDef:
4623     @IFQName: DISModule
4624     @ClsQName: ManakaiDISModuleDefinition
4625    
4626     @ClsISA: ManakaiDISPropertyAccessor
4627     @ClsISA: ManakaiDISExceptionTarget
4628     @ClsISA: ManakaiDISPerlModuleDefinition
4629     @ClsISA: dp|ManakaiDISModulePerl
4630     @ClsISA: dp|ManakaiDISAnyResourcePerl
4631     @ClsISA: ManakaiDISAnyResource
4632    
4633     @Implement: DOMMinImpl
4634    
4635     @enDesc:
4636     <QUOTE::dis> module definitions.
4637    
4638     @enDesc:
4639     @@ForCheck: ManakaiDOM|ForIF
4640     @@@:
4641     The objects implementing the <IF::DISModule> interface <kwd:MUST>
4642     also implement the <IF::DISAnyResource> interface.
4643 wakaba 1.7
4644 wakaba 1.48 @DISLang:role: ModuleRole
4645    
4646     @Attr:
4647     @@ForCheck: ManakaiDOM|ForClass
4648     @@Name: uris
4649     @@Type:
4650 wakaba 1.60 DISPerl:Array::ManakaiDOM:all
4651 wakaba 1.7 @@enDesc:
4652 wakaba 1.48 A reference to the snapshot array containing the URI reference
4653     of the module.
4654     @@Get:
4655 wakaba 1.7 @@@PerlDef:
4656 wakaba 1.48 $r = [$self->{uri}];
4657 wakaba 1.8
4658     @Attr:
4659 wakaba 1.48 @@ForCheck: ManakaiDOM|ForClass
4660     @@Name: ownerModule
4661     @@ManakaiDOM:isRedefining:1
4662 wakaba 1.8 @@enDesc:
4663 wakaba 1.48 This module itself.
4664     @@Get:
4665     @@@Type: DISModule
4666     @@@clsActualType: ManakaiDISModuleDefinition
4667     @@@nullCase:
4668     @@@@enDesc:
4669     The resource is not part of any module since
4670     its definition is not read (<IF::DISModule.isDefined> is <DOM::false>).
4671     @@@PerlDef: $r = $self;
4672    
4673     @Method:
4674     @@ForCheck: ManakaiDOM|ForClass
4675     @@Name: getFeature
4676     @@Description:
4677     @@@lang:en
4678     @@@@:
4679     Returns a specialized object that implements the specialized
4680     interfaces of the specified feature and version.
4681     @@Param:
4682     @@@Name: feature
4683     @@@Type:
4684     DISLang:String::ManakaiDOM:all
4685     @@@actualType: DOMFeature|FeatureNameString||ManakaiDOM|ManakaiDOMLatest
4686     @@@Description:
4687     @@@@lang:en
4688     @@@@@:
4689     A feature name to request.
4690     @@Param:
4691     @@@Name: version
4692     @@@Type:
4693     DISLang:String::ManakaiDOM:all
4694     @@@actualType:
4695     DOMFeature|FeatureVersionString||ManakaiDOM|ManakaiDOMLatest
4696     @@@Description:
4697     @@@@lang:en
4698     @@@@@:
4699     A feature version number to request.
4700     @@Return:
4701     @@@Type:
4702     DOMMain:Object::ManakaiDOM:all
4703     @@@Description:
4704     @@@@lang:en
4705     @@@@@:
4706     An object that implements the specialized APIs of the
4707     <P::feature> and <P::version>.
4708 wakaba 1.49 @@@nullCase:
4709     @@@@enDesc:
4710 wakaba 1.48 There is no object available that implements interfaces
4711     associated with the <P::feature> and <P::version>.
4712     @@@PerlDef:
4713     $feature =~ s/^\+//;
4714     CLASS: for my $class (grep {
4715     $Message::Util::DIS::ManakaiDISModuleDefinition::CompatClass{$_}
4716     } keys %Message::Util::DIS::ManakaiDISModuleDefinition::CompatClass) {
4717     if ($Message::DOM::ClassFeature{$class}->{$feature}->{$version}) {
4718     $r = bless {o => $self}, $class;
4719     last CLASS;
4720 wakaba 1.27 }
4721 wakaba 1.8 }
4722    
4723     @Attr:
4724 wakaba 1.48 @@Name: isAnonymous
4725 wakaba 1.8 @@enDesc:
4726 wakaba 1.48 Whether the resource has persistent name or not.
4727     @@Type:
4728     DOMMain:boolean::ManakaiDOM:all
4729     @@ForCheck: ManakaiDOM|ForClass
4730 wakaba 1.8 @@Get:
4731 wakaba 1.48 @@@TrueCase:
4732 wakaba 1.8 @@@@enDesc:
4733 wakaba 1.48 A module <kwd:MUST> have a name.
4734 wakaba 1.55 @@@PerlDef: $r = false;
4735    
4736     @Method:
4737     @@Name: addResourceList
4738     @@ForCheck: ManakaiDOM|ForClass
4739     @@enDesc:
4740     Adds a resource to the list of resources belongs to the module.
4741     @@Param:
4742     @@@Name: disResource
4743     @@@Type: DIS|DISResource
4744     @@@enDesc: The resource to add.
4745     @@Return:
4746     @@@PerlDef:
4747     __DEEP{
4748     push @{$self->{<H::DIS|resource>}||=[]},
4749     $disResource-><AG::DIS|DISAnyResource.uriRef>;
4750     }__;
4751    
4752     @Method:
4753     @@Name: getResourceList
4754     @@enDesc:
4755     Returns the list of resources belongs to the module.
4756     @@Return:
4757     @@@Type: DIS|ResourceList
4758     @@@enDesc:
4759     The current snapshot of children.
4760     @@@PerlDef:
4761     __DEEP{
4762     my $db = $self-><AG::DIS|DISAnyResource.database>;
4763     $r = [map {
4764     $db-><M::DIS|DISDatabase.getResource> ($$_)
4765     } @{$self->{<H::DIS|resource>}}];
4766     }__;
4767 wakaba 1.57
4768     @Attr:
4769     @@Name: targetNamespaceURI
4770     @@enDesc:
4771     The default namespace URI of the resources defined in the module.
4772     @@Type: DIS|AnyURI
4773     @@Get:
4774     @@@PerlDef:
4775     $r = defined $self->{<H::DIS|defaultNamespaceURI>}
4776     ? ${$self->{<H::DIS|defaultNamespaceURI>}} : null;
4777     @@Set:
4778     @@@ForCheck: ManakaiDOM|ForClass
4779     @@@PerlDef:
4780     if (defined $given) {
4781     $self->{<H::DIS|defaultNamespaceURI>} = \$given;
4782     } else {
4783     CORE::delete $self->{<H::DIS|defaultNamespaceURI>};
4784     }
4785 wakaba 1.61
4786     @Method:
4787     @@ForCheck: ManakaiDOM|ForClass
4788     @@Name: isTypeURI
4789     @@enDesc:
4790     Tests whether this resource is of a type or not.
4791     @@Param:
4792     @@@Name: typeURI
4793     @@@Type: ResourceURI
4794     @@@enDesc:
4795     A type URI reference to test.
4796     @@Return:
4797     @@@Type:
4798     DOMMain:boolean::ManakaiDOM:all
4799     @@@TrueCase:
4800     @@@@enDesc:
4801     This is a <P::typeURI> resource.
4802     @@@FalseCase:
4803     @@@@enDesc:
4804     This is not a <P::typeURI> resource.
4805     @@@PerlDef:
4806     __DEEP{
4807     $r = $self-><AG::DIS|DISAnyResource.database>
4808     -><M::DIS|DISDatabase.getResource> (<Q::DISCore:Module>)
4809     -><M::DIS|DISAnyResource.isTypeURI> ($typeURI);
4810     }__;
4811 wakaba 1.48 ##DISModule
4812 wakaba 1.55
4813     ClsDef:
4814     @ClsQName: ManakaiDISModuleLite
4815    
4816     @ClsISA: DIS|ManakaiDISAnyResource
4817 wakaba 1.70 @ClsISA: dx|ManakaiDefaultExceptionHandler||ManakaiDOM|Perl
4818 wakaba 1.55
4819     @Implement: DOMMinImpl
4820     @Implement: DIS|DISResourceProp
4821     @Implement: dp|DISAnyResourcePerl
4822     @Implement: dp|DISModulePerl
4823     @Implement: dp|DISResourcePerlModule
4824    
4825     @enDesc:
4826     The <Class::ManakaiDISModuleLite> class provides very small
4827     subset of <Class::ManakaiDISModuleDefinition> class. If a
4828     method or attribute which is not implemented by the class, then
4829     the object is updated to the <Class::ManakaiDISModuleDefinition>
4830     by reading additional properties from the <QUOTE::dis> database.
4831    
4832     @Attr:
4833     @@ForCheck: ManakaiDOM|ForClass
4834     @@Name: uris
4835     @@Type:
4836 wakaba 1.60 DISPerl:Array::ManakaiDOM:all
4837 wakaba 1.55 @@enDesc:
4838     A reference to the snapshot array containing the URI reference
4839     of the module.
4840     @@Get:
4841     @@@PerlDef:
4842     $r = [$self->{uri}];
4843    
4844     @Attr:
4845     @@ForCheck: ManakaiDOM|ForClass
4846     @@Name: ownerModule
4847     @@ManakaiDOM:isRedefining:1
4848     @@enDesc:
4849     This module itself.
4850     @@Get:
4851     @@@Type: DISModule
4852     @@@clsActualType: ManakaiDISModuleDefinition
4853     @@@nullCase:
4854     @@@@enDesc:
4855     The resource is not part of any module since
4856     its definition is not read (<IF::DISModule.isDefined> is <DOM::false>).
4857     @@@PerlDef: $r = $self;
4858    
4859     @Attr:
4860     @@Name: isAnonymous
4861     @@enDesc:
4862     Whether the resource has persistent name or not.
4863     @@Type:
4864     DOMMain:boolean::ManakaiDOM:all
4865     @@ForCheck: ManakaiDOM|ForClass
4866     @@Get:
4867     @@@TrueCase:
4868     @@@@enDesc:
4869     A module <kwd:MUST> have a name.
4870     @@@PerlDef: $r = false;
4871    
4872     @Method:
4873     @@Operator:
4874     @@@@: AUTOLOAD
4875     @@@ContentType: lang|Perl
4876     @@Return:
4877     @@@PerlDef:
4878 wakaba 1.57 my $al = our $AUTOLOAD;
4879     $al =~ s/.+:://;
4880     if ($al ne 'DESTROY') {
4881    
4882 wakaba 1.55 __DEEP{
4883     $self-><AG::DIS|DISAnyResource.database>
4884     -><M::dp|ManakaiDISDatabasePerl.plLoadDISDatabaseModule> ($self);
4885     }__;
4886     if (ref $self eq <ClassName::ManakaiDISModuleLite>) {
4887     __EXCEPTION{DIS|RESOURCE_NOT_DEFINED_ERR::
4888     DIS:uri => {$self-><AG::DIS|DISAnyResource.uri>},
4889     DIS:moduleURI => {$self-><AG::DIS|DISAnyResource.uri>},
4890     }__;
4891     }
4892    
4893     my $code = $self->can ($al);
4894     if ($code) {
4895     goto &$code;
4896     } else {
4897     require Carp;
4898 wakaba 1.67 local $Carp::CarpLevel = $Error::Depth;
4899 wakaba 1.55 Carp::croak (qq<Can't locate method "$AUTOLOAD">);
4900     }
4901 wakaba 1.57
4902     } # $al
4903    
4904     @Attr:
4905     @@Name: targetNamespaceURI
4906     @@enDesc:
4907     The default namespace URI of the resources defined in the module.
4908     @@Type: DIS|AnyURI
4909     @@Get:
4910     @@@PerlDef:
4911     $r = defined $self->{<H::DIS|defaultNamespaceURI>}
4912     ? ${$self->{<H::DIS|defaultNamespaceURI>}} : null;
4913 wakaba 1.61
4914     @Method:
4915     @@ForCheck: ManakaiDOM|ForClass
4916     @@Name: isTypeURI
4917     @@enDesc:
4918     Tests whether this resource is of a type or not.
4919     @@Param:
4920     @@@Name: typeURI
4921     @@@Type: ResourceURI
4922     @@@enDesc:
4923     A type URI reference to test.
4924     @@Return:
4925     @@@Type:
4926     DOMMain:boolean::ManakaiDOM:all
4927     @@@TrueCase:
4928     @@@@enDesc:
4929     This is a <P::typeURI> resource.
4930     @@@FalseCase:
4931     @@@@enDesc:
4932     This is not a <P::typeURI> resource.
4933     @@@PerlDef:
4934     __DEEP{
4935     $r = $self-><AG::DIS|DISAnyResource.database>
4936     -><M::DIS|DISDatabase.getResource> (<Q::DISCore:Module>)
4937     -><M::DIS|DISAnyResource.isTypeURI> ($typeURI);
4938     }__;
4939 wakaba 1.55 ##DISModuleLite
4940 wakaba 1.48
4941     IFClsDef:
4942     @IFQName: DISFor
4943     @ClsQName: ManakaiDISForDefinition
4944    
4945     @ClsISA: dp|ManakaiDISAnyResourcePerl
4946     @ClsISA: ManakaiDISAnyResource
4947     @ClsISA: ManakaiDISExceptionTarget
4948    
4949     @DISLang:role: ForRole
4950    
4951     @Description:
4952     @@lang:en
4953     @@@:
4954     <QUOTE::dis> <QUOTE::for> definitions.
4955 wakaba 1.8
4956     @Attr:
4957 wakaba 1.48 @@ForCheck: ManakaiDOM|ForClass
4958     @@Name: uris
4959     @@Type:
4960 wakaba 1.60 DISPerl:Array::ManakaiDOM:all
4961 wakaba 1.48 @@actualType: ForURIList
4962 wakaba 1.15 @@enDesc:
4963 wakaba 1.48 A reference to the snapshot array containing the URI reference
4964     of the <QUOTE::for>.
4965 wakaba 1.15 @@Get:
4966     @@@PerlDef:
4967 wakaba 1.48 $r = [$self->{uri}];
4968 wakaba 1.18
4969 wakaba 1.48 @Method:
4970     @@Name: isaURI
4971     @@Description:
4972     @@@lang:en
4973     @@@@:
4974     Whether this <QUOTE::for> is-a another <QUOTE::for> or not.
4975     @@Param:
4976     @@@Name: superURI
4977     @@@Type: ForURI
4978     @@@Description:
4979     @@@@lang:en
4980     @@@@@:
4981     Another <QUOTE::for> URI reference to test.
4982     @@Return:
4983     @@@Type:
4984     DOMMain:boolean::ManakaiDOM:all
4985     @@@TrueCase:
4986     @@@@enDesc:
4987     <P::superURI> is a super-<QUOTE::for> of this <QUOTE::for>.
4988     @@@FalseCase:
4989     @@@@enDesc:
4990     <P::superURI> is not a super-<QUOTE::for> of this <QUOTE::for>.
4991 wakaba 1.18 @@@PerlDef:
4992 wakaba 1.48 $r = $self->{uri} eq $superURI ? true : $self->{isa}->{$superURI};
4993 wakaba 1.15
4994 wakaba 1.48 @Method:
4995     @@Name: addISA
4996 wakaba 1.8 @@enDesc:
4997 wakaba 1.48 Adds a <QUOTE::for> to the list of super-<QUOTE::for> of this
4998     <QUOTE::for>.
4999     @@Param:
5000     @@@Name: superFor
5001     @@@Type: DISFor
5002     @@@clsActualType: ManakaiDISForDefinition
5003 wakaba 1.8 @@@enDesc:
5004 wakaba 1.48 A <QUOTE::for> definition object.
5005     @@Return:
5006 wakaba 1.8 @@@PerlDef:
5007 wakaba 1.48 my @from = ($self->{uri},
5008     grep {$self->{revISA}->{$_}} keys %{$self->{revISA}});
5009     my @to = ($superFor->{uri},
5010     grep {$superFor->{isa}->{$_}} keys %{$superFor->{isa}});
5011 wakaba 1.8 __DEEP{
5012 wakaba 1.48 for my $from (@from) {
5013     for my $to (@to) {
5014     $self->{db}-><M::ManakaiDISDatabase.getFor>
5015     ($from)->{isa}->{$to} = true;
5016     $self->{db}-><M::ManakaiDISDatabase.getFor>
5017     ($to)->{revISA}->{$from} = true;
5018 wakaba 1.8 }
5019     }
5020     }__;
5021    
5022 wakaba 1.48 @Method:
5023     @@Name: getFeature
5024     @@Description:
5025     @@@lang:en
5026     @@@@:
5027     Returns a specialized object that implements the specialized
5028     interfaces of the specified feature and version.
5029     @@Param:
5030     @@@Name: feature
5031     @@@Type:
5032     DISLang:String::ManakaiDOM:all
5033     @@@actualType:
5034     ManakaiDOM:ManakaiDOMFeatureName::ManakaiDOM:ManakaiDOMLatest
5035     @@@Description:
5036     @@@@lang:en
5037     @@@@@:
5038     A feature name to request.
5039     @@Param:
5040     @@@Name: version
5041     @@@Type:
5042     DISLang:String::ManakaiDOM:all
5043     @@@actualType:
5044     ManakaiDOM:ManakaiDOMFeatureVersion::ManakaiDOM:ManakaiDOMLatest
5045     @@@Description:
5046     @@@@lang:en
5047     @@@@@:
5048     A feature version number to request.
5049     @@Return:
5050     @@@Type:
5051     DOMMain:Object::ManakaiDOM:all
5052     @@@Description:
5053     @@@@lang:en
5054     @@@@@:
5055     An object that implements the specialized APIs of the
5056     <P::feature> and <P::version>.
5057 wakaba 1.49 @@@nullCase:
5058     @@@@enDesc:
5059 wakaba 1.48 There is no object available that implements interfaces
5060     associated with the <P::feature> and <P::version>.
5061     @@@PerlDef:
5062     $feature =~ s/^\+//;
5063     CLASS: for my $class (grep {
5064     $Message::Util::DIS::ManakaiDISForDefinition::CompatClass{$_}
5065     } keys %Message::Util::DIS::ManakaiDISForDefinition::CompatClass) {
5066     if ($Message::DOM::ClassFeature{$class}->{$feature}->{$version}) {
5067     $r = bless {o => $self}, $class;
5068     last CLASS;
5069 wakaba 1.8 }
5070     }
5071    
5072     @Attr:
5073 wakaba 1.48 @@Name: isAnonymous
5074 wakaba 1.8 @@enDesc:
5075 wakaba 1.48 Whether the resource has persistent name or not.
5076     @@Type:
5077     DOMMain:boolean::ManakaiDOM:all
5078     @@ForCheck: ManakaiDOM|ForClass
5079 wakaba 1.8 @@Get:
5080 wakaba 1.48 @@@TrueCase:
5081 wakaba 1.8 @@@@enDesc:
5082 wakaba 1.48 A <QUOTE::for> <kwd:MUST> have a name.
5083     @@@PerlDef: $r = true;
5084 wakaba 1.8
5085     @Attr:
5086 wakaba 1.48 @@ForCheck: ManakaiDOM|ForClass
5087     @@Name: forURI
5088     @@Type: ForURI
5089 wakaba 1.8 @@enDesc:
5090 wakaba 1.48 The <QUOTE::for> URI reference for which this module is defined.
5091 wakaba 1.8 @@Get:
5092 wakaba 1.48 @@@InCase:
5093     @@@@Value:
5094     @@@@@@: ManakaiDOM|all
5095 wakaba 1.68 @@@@@ContentType: DISCore|QName
5096 wakaba 1.8 @@@@enDesc:
5097 wakaba 1.48 The attribute value is always <Q::ManakaiDOM|all> for a
5098     <QUOTE::for> resource.
5099 wakaba 1.8 @@@PerlDef:
5100 wakaba 1.48 $r = <Q::ManakaiDOM|all>;
5101 wakaba 1.8
5102     @Attr:
5103 wakaba 1.48 @@Name: forpURI
5104 wakaba 1.8 @@enDesc:
5105 wakaba 1.48 The <QUOTE::for+> URI references for which this resource is defined.
5106     @@Type: ForURIList
5107 wakaba 1.8 @@Get:
5108 wakaba 1.48 @@@enDesc:
5109     List of <QUOTE::for> URI references. Note that this list is
5110     <QUOTE::dead>.
5111     @@@InCase:
5112     @@@@Value:
5113     @@@@@@: []
5114     @@@@@ContentType: lang|Perl
5115 wakaba 1.8 @@@@enDesc:
5116 wakaba 1.48 The attribute value is always an empty array reference
5117     for a <QUOTE::for> resource.
5118     @@@PerlDef: $r = [];
5119 wakaba 1.9
5120 wakaba 1.48 @Method:
5121     @@Name: isForURI
5122 wakaba 1.9 @@enDesc:
5123 wakaba 1.48 Tests whether this resource is defined for a <QUOTE::for>
5124     or <QUOTE::for+> URI reference or not.
5125 wakaba 1.9 @@Param:
5126 wakaba 1.48 @@@Name:forURI
5127     @@@Type:ForURI
5128     @@@enDesc:
5129     A <QUOTE::for> URI reference to test.
5130 wakaba 1.9 @@Return:
5131     @@@Type:
5132 wakaba 1.48 DOMMain:boolean::ManakaiDOM:all
5133     @@@TrueCase:
5134     @@@@enDesc:
5135     This resource is for <P::forURI>. The attribute
5136     always takes this value for <QUOTE::for> resources.
5137     @@@PerlDef: $r = true;
5138 wakaba 1.12
5139     @Attr:
5140 wakaba 1.48 @@ForCheck: ManakaiDOM|ForClass
5141     @@Name: nameURI
5142     @@Type: NameURI
5143 wakaba 1.12 @@enDesc:
5144 wakaba 1.48 The URI reference of this module, without
5145     <QUOTE::for> identifier.
5146 wakaba 1.12 @@Get:
5147 wakaba 1.49 @@@enDesc:
5148     The attribute value is always equals to
5149     <A::DISAnyResource.uri> for <QUOTE::for> resources.
5150     @@@PerlDef: $r = $self->{uri};
5151 wakaba 1.61
5152     @Method:
5153     @@ForCheck: ManakaiDOM|ForClass
5154     @@Name: isTypeURI
5155     @@enDesc:
5156     Tests whether this resource is of a type or not.
5157     @@Param:
5158     @@@Name: typeURI
5159     @@@Type: ResourceURI
5160     @@@enDesc:
5161     A type URI reference to test.
5162     @@Return:
5163     @@@Type:
5164     DOMMain:boolean::ManakaiDOM:all
5165     @@@TrueCase:
5166     @@@@enDesc:
5167     This is a <P::typeURI> resource.
5168     @@@FalseCase:
5169     @@@@enDesc:
5170     This is not a <P::typeURI> resource.
5171     @@@PerlDef:
5172     __DEEP{
5173     $r = $self-><AG::DIS|DISAnyResource.database>
5174     -><M::DIS|DISDatabase.getResource> (<Q::DISCore:For>)
5175     -><M::DIS|DISAnyResource.isTypeURI> ($typeURI);
5176     }__;
5177 wakaba 1.48 ##DISFor
5178 wakaba 1.18
5179 wakaba 1.48 PropDef:
5180     @QName: isFeatureImplemented
5181     @enDesc:
5182     The list of whether a feature is implemented or not.
5183 wakaba 1.18
5184 wakaba 1.48 IFClsDef:
5185     @IFQName: DISResource
5186     @ClsQName: ManakaiDISResourceDefinition
5187 wakaba 1.19
5188 wakaba 1.48 @ClsISA: ManakaiDISResourceMV
5189     @ClsISA: dp|ManakaiDISResourcePerl
5190     @ClsISA: ManakaiDISPerlModuleDefinition
5191     @ClsISA: dp|ManakaiDISAnyResourcePerl
5192     @ClsISA: ManakaiDISPropertyAccessor
5193     @ClsISA: ManakaiDISAnyResource
5194     @ClsISA: ManakaiDISExceptionTarget
5195 wakaba 1.19
5196 wakaba 1.48 @DISLang:role: ResourceRole
5197 wakaba 1.19
5198 wakaba 1.48 @enDesc:
5199     <QUOTE::dis> resource definitions.
5200 wakaba 1.19
5201 wakaba 1.48 @enDesc:
5202     @@ForCheck: ManakaiDOM|ForIF
5203     @@@:
5204     The objects implementing the <IF::DISResource> interface
5205     <kwd:MUST> also implement the <IF::DISAnyResource> interface.
5206 wakaba 1.12
5207 wakaba 1.46 @Attr:
5208 wakaba 1.48 @@ForCheck: ManakaiDOM|ForClass
5209     @@Name: uris
5210     @@Type:
5211 wakaba 1.60 DISPerl:Array::ManakaiDOM:all
5212 wakaba 1.46 @@enDesc:
5213 wakaba 1.48 Returns the current <EM::snapshot> of the URI references
5214     for this resource, including the alias URI references.
5215 wakaba 1.46 @@Get:
5216     @@@PerlDef:
5217 wakaba 1.48 $r = [grep {$self->{aliasURI}->{$_}} keys %{$self->{aliasURI}}];
5218 wakaba 1.46
5219 wakaba 1.12 @Method:
5220 wakaba 1.48 @@Name: isSubsetOfURI
5221     @@Description:
5222 wakaba 1.37 @@@lang:en
5223     @@@@:
5224 wakaba 1.48 Whether this resource is a subset of another resource or not.
5225     @@Param:
5226     @@@Name: superURI
5227     @@@Type: ResourceURI
5228     @@@Description:
5229     @@@@lang:en
5230     @@@@@:
5231     Another resource URI reference to test.
5232 wakaba 1.12 @@Return:
5233 wakaba 1.48 @@@Type:
5234     DOMMain:boolean::ManakaiDOM:all
5235     @@@TrueCase:
5236     @@@@enDesc:
5237     <P::superURI> is a super-resource of this resource.
5238     @@@FalseCase:
5239 wakaba 1.12 @@@@enDesc:
5240 wakaba 1.48 <P::superURI> is not a super-resource of this resource.
5241 wakaba 1.12 @@@PerlDef:
5242 wakaba 1.48 $r = $self->{aliasURI}->{$superURI} || $self->{subOf}->{$superURI};
5243 wakaba 1.13
5244     @Method:
5245 wakaba 1.48 @@Name: addSuperResource
5246 wakaba 1.13 @@enDesc:
5247 wakaba 1.48 Adds a <QUOTE::dis> resource to the list of super-resource
5248     of this <QUOTE::dis> resource.
5249 wakaba 1.13 @@Param:
5250 wakaba 1.48 @@@Name: superRes
5251 wakaba 1.47 @@@Type: DISResource
5252     @@@clsActualType: ManakaiDISResourceDefinition
5253 wakaba 1.13 @@@enDesc:
5254 wakaba 1.48 A <QUOTE::dis> resource definition object.
5255     @@Return:
5256 wakaba 1.13 @@@PerlDef:
5257 wakaba 1.48 my @from = ($self->{uri},
5258 wakaba 1.50 grep {$self->{supOf}->{$_}} keys %{$self->{supOf}||{}});
5259 wakaba 1.48 my @to = ($superRes->{uri},
5260 wakaba 1.50 grep {$superRes->{subOf}->{$_}} keys %{$superRes->{subOf}||{}});
5261 wakaba 1.13 __DEEP{
5262 wakaba 1.48 for my $from (@from) {
5263     for my $to (@to) {
5264     $self->{db}-><M::ManakaiDISDatabase.getResource>
5265     ($from)->{subOf}->{$to} = true;
5266     $self->{db}-><M::ManakaiDISDatabase.getResource>
5267     ($to)->{supOf}->{$from} = true;
5268 wakaba 1.13 }
5269     }
5270     }__;
5271 wakaba 1.48
5272 wakaba 1.13 @Method:
5273 wakaba 1.48 @@Name: mergeAsAlias
5274 wakaba 1.13 @@enDesc:
5275 wakaba 1.48 Merges another resource definition as an alias of this resource.
5276 wakaba 1.13 @@Param:
5277 wakaba 1.48 @@@Name: aliasResource
5278 wakaba 1.47 @@@Type: DISResource
5279     @@@clsActualType: ManakaiDISResourceDefinition
5280 wakaba 1.13 @@@enDesc:
5281 wakaba 1.48 A resource to merge.
5282     \
5283     {NOTE:: After merging all references to <P::aliasResource>
5284     should be discarded.
5285     \
5286     }
5287     @@NodeParam:
5288     @@Return:
5289     @@@RaiseException:
5290     @@@@@:MERGE_ITSELF_ERR
5291     @@@@@@enDesc:
5292     An attempt is made to merge this resource itself.
5293 wakaba 1.13 @@@PerlDef:
5294 wakaba 1.48 if ($self eq $aliasResource) {
5295     __EXCEPTION{MERGE_ITSELF_ERR::
5296     DIS:uri => {$self->{uri}},
5297     DIS:sourceNode => {$node},
5298     }__;
5299     }
5300     for my $uri ($aliasResource->{uri},
5301     grep {$aliasResource->{aliasURI}->{$_}}
5302     keys %{$aliasResource->{aliasURI}}) {
5303     $self->{aliasURI}->{$uri} = true;
5304     $self->{db}->{resDef}->{$uri} = $self;
5305     $self->{subOf}->{$uri} = true;
5306     $self->{supOf}->{$uri} = true;
5307     }
5308     for my $uri (grep {$aliasResource->{subOf}->{$_}}
5309 wakaba 1.50 keys %{$aliasResource->{subOf}||{}}) {
5310 wakaba 1.48 $self->{subOf}->{$uri} = true;
5311     }
5312     for my $uri (grep {$aliasResource->{supOf}->{$_}}
5313 wakaba 1.50 keys %{$aliasResource->{supOf}||{}}) {
5314 wakaba 1.48 $self->{supOf}->{$uri} = true;
5315     }
5316 wakaba 1.50 my @from = grep {$self->{supOf}->{$_}} keys %{$self->{supOf}||{}};
5317     my @to = grep {$self->{subOf}->{$_}} keys %{$self->{subOf}||{}};
5318 wakaba 1.13 __DEEP{
5319 wakaba 1.48 for my $from (@from) {
5320     for my $to (@to) {
5321     $self->{db}-><M::ManakaiDISDatabase.getResource>
5322     ($from)->{subOf}->{$to} = true;
5323     $self->{db}-><M::ManakaiDISDatabase.getResource>
5324     ($to)->{supOf}->{$from} = true;
5325 wakaba 1.13 }
5326     }
5327     }__;
5328    
5329     @Method:
5330 wakaba 1.48 @@Name: isTypeURI
5331 wakaba 1.13 @@enDesc:
5332 wakaba 1.48 Tests whether this resource is of a type or not.
5333 wakaba 1.13 @@Param:
5334 wakaba 1.48 @@@Name: typeURI
5335     @@@Type: ResourceURI
5336 wakaba 1.13 @@@enDesc:
5337 wakaba 1.48 A type URI reference to test.
5338     @@Return:
5339 wakaba 1.17 @@@Type:
5340 wakaba 1.48 DOMMain:boolean::ManakaiDOM:all
5341     @@@TrueCase:
5342 wakaba 1.17 @@@@enDesc:
5343 wakaba 1.48 This is a <P::typeURI> resource.
5344     @@@FalseCase:
5345 wakaba 1.17 @@@@enDesc:
5346 wakaba 1.48 This is not a <P::typeURI> resource.
5347 wakaba 1.13 @@@PerlDef:
5348 wakaba 1.48 if (not $self->{<Q::rdf:type>}) {
5349     #
5350     } elsif ($self->{<Q::rdf:type>}->{$typeURI}) {
5351     $r = true;
5352     } else {
5353     __DEEP{
5354     C: for my $t_type_uri (grep {$self->{<Q::rdf:type>}->{$_}}
5355     keys %{$self->{<Q::rdf:type>}}) {
5356     my $t_type = $self-><AG::DISAnyResource.database>
5357     -><M::DISDatabase.getResource> ($t_type_uri);
5358     if ($t_type-><M::DISResource.isSubsetOfURI> ($typeURI)) {
5359     $self-><M::DISResourceProp.addPropertyURIUList>
5360     (<Q::rdf:type>, $typeURI);
5361     $r = true;
5362     last C;
5363     }
5364     }
5365 wakaba 1.15 }__;
5366     }
5367    
5368 wakaba 1.48 @Attr:
5369     @@Name: disDataTypeResource
5370     @@enDesc:
5371     The resource referenced by <Q::dis:Type> property.
5372 wakaba 1.15
5373 wakaba 1.48 = If the resource has the <Q::dis:Type> property,
5374     then its value references the data type resource.
5375 wakaba 1.15
5376 wakaba 1.48 = If the resource has no <Q::dis:Type> property but
5377     the dynamic parent resource has the <Q::dis:Type> property,
5378     then its value references the data type resource.
5379    
5380     = Otherwise, the resource has no associated data type resoruce;
5381     this method throws a <X::NO_DIS_TYPE_ERR> exception.
5382     @@Type: DISResource
5383     @@clsActualType: ManakaiDISResourceDefinition
5384     @@Get:
5385     @@@RaiseException:
5386     @@@@@:NO_DIS_TYPE_ERR
5387 wakaba 1.16 @@@@enDesc:
5388 wakaba 1.48 <Q::dis:Type> attribute is not specified.
5389 wakaba 1.13 @@@PerlDef:
5390 wakaba 1.48 __DEEP{
5391     if (UNIVERSAL::isa ($self->{<Q::dis:Type>}, <IFName::dv|DVURIValue>)) {
5392     $r = $self->{<Q::dis:Type>}-><M::dv|DVURIValue.getResource>
5393     ($self-><AG::DISAnyResource.database>);
5394     } else {
5395 wakaba 1.54 my $pr = $self-><AG::DIS|DISResource.dynamicParentResource>;
5396 wakaba 1.48 $r = $pr-><AG::DISResource.disDataTypeResource> if $pr;
5397     }
5398     }__;
5399     unless ($r) {
5400     __EXCEPTION{NO_DIS_TYPE_ERR::
5401     DIS:uri => {$self-><AG::DISAnyResource.uri>},
5402     DIS:sourceNode => {$self-><AG::DISAnyResource.sourceElement>},
5403 wakaba 1.13 }__;
5404     }
5405 wakaba 1.48
5406     @Attr:
5407     @@Name: disDataTypeValue
5408     @@enDesc:
5409     The <Q::dis:Type> property value for the resource.
5410     @@Get:
5411     @@@Type: dv|DVURIValue
5412     @@@clsActualType: dv|ManakaiDVURIValue
5413     @@@RaiseException:
5414     @@@@@:NO_DIS_TYPE_ERR
5415     @@@@enDesc:
5416     <Q::dis:Type> attribute is not specified.
5417     @@@PerlDef:
5418 wakaba 1.13 __DEEP{
5419 wakaba 1.48 if (UNIVERSAL::isa ($self->{<Q::dis:Type>}, <IFName::dv|DVURIValue>)) {
5420     $r = $self->{<Q::dis:Type>};
5421 wakaba 1.16 } else {
5422 wakaba 1.54 my $pr = $self-><AG::DIS|DISResource.dynamicParentResource>;
5423 wakaba 1.48 $r = $pr-><AG::DISResource.disDataTypeValue> if $pr;
5424 wakaba 1.16 }
5425 wakaba 1.48 }__;
5426     unless ($r) {
5427     __EXCEPTION{NO_DIS_TYPE_ERR::
5428     DIS:uri => {$self-><AG::DISAnyResource.uri>},
5429     DIS:sourceNode => {$self-><AG::DISAnyResource.sourceElement>},
5430     }__;
5431     }
5432 wakaba 1.13
5433     @Attr:
5434 wakaba 1.48 @@Name: disActualDataTypeResource
5435 wakaba 1.13 @@enDesc:
5436 wakaba 1.48 <Q::dis:actualType> attribute value of this resource.
5437     @@Type: DISResource
5438     @@clsActualType: ManakaiDISResourceDefinition
5439 wakaba 1.13 @@Get:
5440 wakaba 1.48 @@@RaiseException:
5441     @@@@@:NO_DIS_TYPE_ERR
5442 wakaba 1.13 @@@@enDesc:
5443 wakaba 1.48 <Q::dis:actualType> attribute is not specified,
5444     and <Q::dis:Type> attribute, neigher.
5445 wakaba 1.13 @@@PerlDef:
5446 wakaba 1.48 __DEEP{
5447     if (UNIVERSAL::isa ($self->{<Q::dis:actualType>},
5448     <IFName::dv|DVURIValue>)) {
5449     $r = $self->{<Q::dis:actualType>}-><M::dv|DVURIValue.getResource>
5450     ($self-><AG::DISAnyResource.database>);
5451     } elsif (UNIVERSAL::isa ($self->{<Q::dis:Type>},
5452     <IFName::dv|DVURIValue>)) {
5453     $r = $self->{<Q::dis:Type>}-><M::dv|DVURIValue.getResource>
5454     ($self-><AG::DISAnyResource.database>);
5455     } else {
5456 wakaba 1.54 my $pr = $self-><AG::DIS|DISResource.dynamicParentResource>;
5457 wakaba 1.48 $r = $pr-><AG::DISResource.disActualDataTypeResource> if $pr;
5458     }
5459     }__;
5460     unless ($r) {
5461     __EXCEPTION{NO_DIS_TYPE_ERR::
5462     DIS:uri => {$self-><AG::DISAnyResource.uri>},
5463     DIS:sourceNode => {$self-><AG::DISAnyResource.sourceElement>},
5464 wakaba 1.13 }__;
5465     }
5466 wakaba 1.48
5467     @Attr:
5468     @@Name: disActualDataTypeValue
5469 wakaba 1.13 @@enDesc:
5470 wakaba 1.48 <Q::dis:actualType> node for this resource.
5471     @@Get:
5472     @@@Type: DISElement
5473     @@@clsActualType: ManakaiDISElement
5474 wakaba 1.13 @@@RaiseException:
5475 wakaba 1.48 @@@@@:NO_DIS_TYPE_ERR
5476 wakaba 1.13 @@@@enDesc:
5477 wakaba 1.48 <Q::dis:actualType> attribute is not specified,
5478     and <Q::dis:Type> attribute, neigher.
5479 wakaba 1.13 @@@PerlDef:
5480 wakaba 1.48 __DEEP{
5481     if (UNIVERSAL::isa ($self->{<Q::dis:actualType>},
5482     <IFName::dv|DVURIValue>)) {
5483     $r = $self->{<Q::dis:actualType>};
5484     } elsif (UNIVERSAL::isa ($self->{<Q::dis:Type>},
5485     <IFName::dv|DVURIValue>)) {
5486     $r = $self->{<Q::dis:Type>};
5487 wakaba 1.13 } else {
5488 wakaba 1.54 my $pr = $self-><AG::DIS|DISResource.dynamicParentResource>;
5489 wakaba 1.48 $r = $pr-><AG::DISResource.disActualDataTypeValue> if $pr;
5490 wakaba 1.13 }
5491 wakaba 1.48 }__;
5492     unless ($r) {
5493     __EXCEPTION{NO_DIS_TYPE_ERR::
5494     DIS:uri => {$self-><AG::DISAnyResource.uri>},
5495     DIS:sourceNode => {$self-><AG::DISAnyResource.sourceElement>},
5496 wakaba 1.13 }__;
5497     }
5498    
5499 wakaba 1.15 @IntMethod:
5500 wakaba 1.48 @@Operator:
5501     @@@@: <=>
5502     @@@ContentType:
5503     lang:Perl
5504 wakaba 1.15 @@enDesc:
5505 wakaba 1.54 Compares two resources. If the first character of the
5506     node in the source tree by which the resource is defined
5507     occures before the other resource's first character, then
5508     the former resource is <DFN::less> than the later resource.
5509     If two resources are the same resource, they are <DFN::equal>.
5510     Otherwise, the former resource is <DFN::greater> than
5511     the later resource.
5512    
5513     There are two exceptions. If two resources belongs to
5514     two different modules, i.e. their <A::DIS|DISAnyResource.ownerModule>s
5515     are different, the order is not defined. Also, if
5516     one of resources is not yet defined, i.e. one's
5517     <A::DIS|DISAnyResource.isDefined> takes <DOM::false> value,
5518     then the order is not defined. Even in these cases, two
5519     calls for the method with the same parameter would return
5520     the same result while the resources are left unchanged.
5521 wakaba 1.48 @@Param:
5522     @@@Name: anotherResource
5523     @@@Type: DISResource
5524     @@@enDesc: Another resource to compare.
5525 wakaba 1.15 @@Return:
5526     @@@Type:
5527 wakaba 1.48 DOMMain:unsigned-long::ManakaiDOM:all
5528 wakaba 1.15 @@@PerlDef:
5529 wakaba 1.48 if (UNIVERSAL::isa ($anotherResource,
5530     <ClassName::ManakaiDISResourceDefinition>)) {
5531     $r = $self->{seq} <=> $anotherResource->{seq};
5532     } else {
5533 wakaba 1.54 $r = $self->{uri} <=> $anotherResource;
5534 wakaba 1.48 }
5535 wakaba 1.15
5536     @Method:
5537 wakaba 1.54 @@ForCheck: ManakaiDOM|ForClass
5538     @@ManakaiDOM:isForInternal:1
5539     @@Name: addChildResource
5540     @@enDesc:
5541     Registers a resource as a static child of the resource.
5542     @@Param:
5543     @@@Name: disResource
5544     @@@Type: DIS|DISResource
5545     @@@enDesc:
5546     The resurce to add.
5547     @@Return:
5548     @@@PerlDef:
5549     __DEEP{
5550     push @{$self->{<H::DIS|childResource>}||=[]},
5551     $disResource-><AG::DIS|DISAnyResource.uriRef>;
5552     }__;
5553    
5554     @Method:
5555     @@ForCheck: ManakaiDOM|ForClass
5556     @@ManakaiDOM:isForInternal:1
5557     @@Name: addDynamicChildResource
5558     @@enDesc:
5559     Registers a resource as a dynamic child of the resource.
5560     @@Param:
5561     @@@Name: disResource
5562     @@@Type: DIS|DISResource
5563     @@@enDesc:
5564     The resurce to add.
5565     @@Return:
5566     @@@PerlDef:
5567     __DEEP{
5568     push @{$self->{<H::DIS|dynamicChildResource>}||=[]},
5569     $disResource-><AG::DIS|DISAnyResource.uriRef>;
5570     }__;
5571    
5572     @Method:
5573     @@Name: getChildResourceList
5574     @@enDesc:
5575     Returns the list of static child resources of the resource.
5576     @@Return:
5577     @@@Type: DIS|ResourceList
5578     @@@enDesc:
5579     The current snapshot of children.
5580     @@@PerlDef:
5581     __DEEP{
5582     my $db = $self-><AG::DIS|DISAnyResource.database>;
5583     $r = [map {
5584     $db-><M::DIS|DISDatabase.getResource> ($$_)
5585     } @{$self->{<H::DIS|childResource>}}];
5586     }__;
5587    
5588     @Method:
5589     @@Name: getDynamicChildResourceList
5590     @@enDesc:
5591     Returns the list of dynamic child resources of the resource.
5592     @@Return:
5593     @@@Type: DIS|ResourceList
5594     @@@enDesc:
5595     The current snapshot of children.
5596     @@@PerlDef:
5597     __DEEP{
5598     my $db = $self-><AG::DIS|DISAnyResource.database>;
5599     $r = [map {
5600     $db-><M::DIS|DISDatabase.getResource> ($$_)
5601     } @{$self->{<H::DIS|dynamicChildResource>}}];
5602     }__;
5603    
5604     @Method:
5605 wakaba 1.48 @@Name: getChildResourceByType
5606 wakaba 1.15 @@enDesc:
5607 wakaba 1.48 Gets a static child resource selected by its type.
5608     @@Param:
5609     @@@Name:typeURI
5610     @@@Type:ResourceURI
5611     @@@enDesc:
5612     A URI reference identifying a resource type.
5613     @@ImplNote:
5614     @@@lang:en
5615     @@@@:
5616 wakaba 1.54 {ISSUE:: Some inheritance tracing required for
5617 wakaba 1.48 e.g. <Q::DISLang:InputProcessor> and <Q::DOMMain:ReflectGet>?
5618 wakaba 1.54 }
5619 wakaba 1.15 @@Return:
5620 wakaba 1.47 @@@Type: DISResource
5621     @@@clsActualType: ManakaiDISResourceDefinition
5622 wakaba 1.15 @@@enDesc:
5623 wakaba 1.48 The first child resource (in document order) whose
5624     type matches with <P::typeURI>.
5625 wakaba 1.15 @@@nullCase:
5626     @@@@enDesc:
5627 wakaba 1.48 There is no resource whose type is <P::typeURI>.
5628 wakaba 1.15 @@@PerlDef:
5629 wakaba 1.48 __DEEP{
5630 wakaba 1.54 my $db = $self-><AG::DIS|DISAnyResource.database>;
5631     C: for my $cr_uri (@{$self->{<H::DIS:childResource>}||[]}) {
5632     my $cr = $db-><M::DIS|DISDatabase.getResource> ($$cr_uri);
5633     if ($cr-><M::DIS|DISResource.isTypeURI> ($typeURI)) {
5634 wakaba 1.48 $r = $cr;
5635 wakaba 1.54 last C;
5636 wakaba 1.48 }
5637 wakaba 1.15 }
5638 wakaba 1.48 }__;
5639 wakaba 1.15
5640 wakaba 1.48 @Method:
5641 wakaba 1.54 @@Name: getChildResourceListByType
5642     @@enDesc:
5643     Returns a list of child resources of a specific type.
5644     @@Param:
5645     @@@Name: typeURI
5646     @@@Type: DIS|AnyURI
5647     @@@enDesc:
5648     A URI of the type.
5649     @@Return:
5650     @@@Type: DIS|ResourceList
5651     @@@enDesc:
5652     The current snapshot of the child resources of type <P::typeURI>.
5653     @@@PerlDef:
5654     __DEEP{
5655     my $db = $self-><AG::DIS|DISAnyResource.database>;
5656     $r = [grep {
5657     $_-><M::DIS|DISResource.isTypeURI> ($typeURI)
5658     } map {
5659     $db-><M::DIS|DISDatabase.getResource> ($$_)
5660     } @{$self->{<H::DIS|childResource>}||[]}];
5661     }__;
5662    
5663     @Method:
5664 wakaba 1.48 @@Name: getChildResourceByNameAndType
5665 wakaba 1.15 @@enDesc:
5666 wakaba 1.48 Gets a static child resource selected by its local name and type.
5667 wakaba 1.15 @@Param:
5668 wakaba 1.48 @@@Name: localName
5669     @@@Type:
5670     DISCore:LocalName::ManakaiDOM:all
5671 wakaba 1.15 @@@enDesc:
5672 wakaba 1.48 A local name.
5673 wakaba 1.15 @@Param:
5674 wakaba 1.48 @@@Name:typeURI
5675     @@@Type:ResourceURI
5676 wakaba 1.15 @@@enDesc:
5677 wakaba 1.48 A URI reference identifying a resource type.
5678     @@Return:
5679 wakaba 1.47 @@@Type: DISResource
5680     @@@clsActualType: ManakaiDISResourceDefinition
5681 wakaba 1.15 @@@enDesc:
5682 wakaba 1.48 The first (by document order) child resource whose
5683     type matches for <P::localName> and <P::typeURI>.
5684 wakaba 1.15 @@@nullCase:
5685     @@@@enDesc:
5686 wakaba 1.48 There is no resource whose name is <P::localName> and
5687     whose type is <P::typeURI>.
5688     @@@PerlDef:
5689     __DEEP{
5690 wakaba 1.54 my $db = $self-><AG::DIS|DISAnyResource.database>;
5691     C: for my $cr_uri (@{$self->{<H::DIS:childResource>}||[]}) {
5692     my $cr = $db-><M::DIS|DISDatabase.getResource> ($$cr_uri);
5693     my $ln = $cr-><AG::DIS|DISAnyResource.localName>;
5694 wakaba 1.48 if (defined $ln and $ln eq $localName and
5695 wakaba 1.54 $cr-><M::DIS|DISResource.isTypeURI> ($typeURI)) {
5696 wakaba 1.48 $r = $cr;
5697 wakaba 1.54 last C;
5698 wakaba 1.48 }
5699     }
5700     }__;
5701    
5702     @Method:
5703     @@Name: getConstResourceByName
5704     @@enDesc:
5705     Gets a constant value resource by its local name.
5706 wakaba 1.15 @@Param:
5707 wakaba 1.48 @@@Name:localName
5708 wakaba 1.15 @@@Type:
5709 wakaba 1.48 DISLang:String::ManakaiDOM:all
5710 wakaba 1.15 @@@enDesc:
5711 wakaba 1.48 Constant name.
5712 wakaba 1.15 @@Return:
5713 wakaba 1.48 @@@Type: DISResource
5714     @@@clsActualType: ManakaiDISResourceDefinition
5715     @@@enDesc:
5716     The constant resource identified by <P::localName>.
5717     @@@nullCase:
5718 wakaba 1.16 @@@@enDesc:
5719 wakaba 1.48 There is no such constant resource.
5720 wakaba 1.15 @@@PerlDef:
5721 wakaba 1.48 __DEEP{
5722     my @constGroup;
5723 wakaba 1.54 my $db = $self-><AG::DIS|DISAnyResource.database>;
5724     C: for my $cr_uri (@{$self->{<H::DIS:childResource>}||[]}) {
5725     my $cr = $db-><M::DIS|DISDatabase.getResource> ($$cr_uri);
5726     my $ln = $cr-><AG::DIS|DISAnyResource.localName>;
5727 wakaba 1.48 if ($ln and $ln eq $localName and
5728 wakaba 1.54 $cr-><M::DIS|DISResource.isTypeURI> (<Q::DISLang:Const>)) {
5729 wakaba 1.48 $r = $cr;
5730 wakaba 1.54 last C;
5731     } elsif ($cr-><M::DIS|DISResource.isTypeURI>
5732     (<Q::DISLang:ConstGroup>)) {
5733 wakaba 1.48 push @constGroup, $cr;
5734     }
5735     }
5736     unless ($r) {
5737 wakaba 1.54 D: for my $cg (@constGroup) {
5738     $r = $cg-><M::DIS|DISResource.getChildResourceByNameAndType>
5739     ($localName, <Q::DISLang:Const>);
5740     last D if $r;
5741 wakaba 1.15 }
5742     }
5743 wakaba 1.48 }__;
5744 wakaba 1.15
5745 wakaba 1.18 @Attr:
5746 wakaba 1.54 @@Name: parentResource
5747     @@enDesc:
5748     The static parent resource of the resource.
5749     @@Type: DIS|DISResource
5750     @@nullCase:
5751     @@@enDesc: No parent resource.
5752     @@Get:
5753     @@@PerlDef:
5754     __DEEP{
5755     if ($self->{<H::DIS|parentResource>}) {
5756     $r = $self-><AG::DIS|DISAnyResource.database>
5757     -><M::DIS|DISDatabase.getResource>
5758     (${$self->{<H::DIS|parentResource>}});
5759     }
5760     }__;
5761     @@Set:
5762     @@@ForCheck: ManakaiDOM|ForClass
5763     @@@PerlDef:
5764     __DEEP{
5765     if ($given) {
5766     $self->{<H::DIS|parentResource>}
5767     = $given-><AG::DIS|DISAnyResource.uriRef>;
5768     } else {
5769     CORE::delete $self->{<H::DIS|parentResource>};
5770     }
5771     }__;
5772    
5773     @Attr:
5774     @@Name: dynamicParentResource
5775     @@enDesc:
5776     The dynamic parent resource of the resource.
5777     @@Type: DIS|DISResource
5778     @@nullCase:
5779     @@@enDesc: No parent resource.
5780     @@Get:
5781     @@@PerlDef:
5782     __DEEP{
5783     if ($self->{<H::DIS|dynamicParentResource>}) {
5784     $r = $self-><AG::DIS|DISAnyResource.database>
5785     -><M::DIS|DISDatabase.getResource>
5786     (${$self->{<H::DIS|dynamicParentResource>}});
5787     }
5788     }__;
5789     @@Set:
5790     @@@ForCheck: ManakaiDOM|ForClass
5791     @@@PerlDef:
5792     __DEEP{
5793     if ($given) {
5794     $self->{<H::DIS|dynamicParentResource>}
5795     = $given-><AG::DIS|DISAnyResource.uriRef>;
5796     } else {
5797     CORE::delete $self->{<H::DIS|dynamicParentResource>};
5798     }
5799     }__;
5800    
5801     @Attr:
5802 wakaba 1.48 @@Name: ownerClassNodeURI
5803 wakaba 1.18 @@enDesc:
5804 wakaba 1.48 The node URI reference of the class resource this resource
5805     belongs to.
5806     @@Type: ResourceURI
5807 wakaba 1.18 @@Get:
5808 wakaba 1.48 @@@enDesc:
5809     The URI reference of the <Q::ManakaiDOM:Class> resource.
5810     If this resource is a class, then the URI reference
5811     of this resource is returned.
5812     @@@nullCase:
5813 wakaba 1.18 @@@@enDesc:
5814 wakaba 1.48 This resource does not belong to any class.
5815 wakaba 1.18 @@@PerlDef:
5816 wakaba 1.53 if (exists $self->{<H::DIS:ownerClass>}) {
5817     $r = $self->{<H::DIS:ownerClass>};
5818 wakaba 1.48 } else {
5819     my $res = $self;
5820     __DEEP{
5821     RES: {
5822     if ($res-><M::ManakaiDISResourceDefinition.isTypeURI>
5823     (<Q::ManakaiDOM:Class>)) {
5824     $r = $res-><AG::DISAnyResource.sourceNodeID>;
5825     } else {
5826 wakaba 1.54 $res = $res-><AG::DIS|DISResource.parentResource>;
5827 wakaba 1.48 redo RES if $res;
5828     }
5829 wakaba 1.18 }
5830 wakaba 1.48 }__;
5831 wakaba 1.53 $self->{<H::DIS:ownerClass>} = $r;
5832 wakaba 1.48 }
5833 wakaba 1.18
5834     @Attr:
5835     @@Name: disIsNullValue
5836     @@enDesc:
5837     Whether this resource have <DOM::null> value or not.
5838     A resource have <DOM::null> value iff it has
5839     <Q::dis:Value> attribute node that in turn has
5840     <Q::dis:is-null> attribute whose value set to <DOM::true>.
5841     @@Type:
5842     DOMMain:boolean::ManakaiDOM:all
5843     @@Get:
5844     @@@PerlDef:
5845 wakaba 1.51 if ($self->{<Q::dis:Value>}) {
5846     $r = $self->{<Q::dis:Value>}-><AG::dv|DVValue.isNull>;
5847 wakaba 1.18 }
5848 wakaba 1.19
5849 wakaba 1.24 @Method:
5850     @@Name: isFeatureProvided
5851     @@enDesc:
5852     Whether a feature is provided by this resource or not.
5853     Note that the feature is actually available (implemented)
5854     or not is other thing (use <M::ManakaiDISPerlModuleDefinition
5855     .plIsFeatureImplemented> instead).
5856     @@Param:
5857     @@@Name: featureResourceURI
5858     @@@Type: ResourceURI
5859     @@@enDesc:
5860     The URI reference of the resource definition for the feature to test.
5861     @@Return:
5862     @@@Type:
5863     DOMMain:boolean::ManakaiDOM:all
5864     @@@enDesc:
5865     Whether the feature is provided or not.
5866     @@@PerlDef:
5867     __DEEP{
5868     my @f = @{$self-><M::ManakaiDISPropertyAccessor
5869     .getPropertyResourceList>
5870     (<Q::DOMMain:implementFeature>,
5871 wakaba 1.26 isa_recursive => true,
5872 wakaba 1.68 default_media_type => <Q::DISCore:QName>)};
5873 wakaba 1.24 if (@f) {
5874     for my $f (@f) {
5875     if ($f-><M::ManakaiDISResourceDefinition.isSubsetOfURI>
5876     ($featureResourceURI)) {
5877     $r = true;
5878     last;
5879     }
5880     }
5881     } else {
5882 wakaba 1.54 my $parent = $self-><AG::DIS|DISResource.parentResource>;
5883 wakaba 1.24 $r = $parent-><M::ManakaiDISResourceDefinition.isFeatureProvided>
5884     ($featureResourceURI)
5885     if $parent;
5886     }
5887     }__;
5888    
5889     @Attr:
5890     @@Name: featureNameList
5891     @@enDesc:
5892     The list of the names of the feature defined by this resource.
5893 wakaba 1.48
5894     = If the resource has one or more <Q::dis:AppName> attributes,
5895     their text values are feature names.
5896    
5897     = If there is no <Q::dis:AppName> attributes but the resource
5898     is a <Q::DOMFeature:instanceOf> another feature, then
5899     the set of the feature names of the resource is equal
5900     to the one of another feature's feature names.
5901    
5902     {OLI:: If two operation above does not result in one or more
5903     feature names,
5904    
5905     = and if the resource has a name (the <A::DISAnyResource
5906     .isAnonymous> attribute returns <DOM::false>), then
5907     the <A::DISAnyResource.nameURI> of the resource is
5908     a feature name.
5909    
5910     = otherwise, i.e. <A::DISAnyResource.isAnonymous> is
5911     <DOM::true>, then the <A::DISAnyResource.localName>
5912     of the resource, if non-<DOM::null>, is a feature name.
5913    
5914     }
5915    
5916 wakaba 1.24 @@Type:
5917 wakaba 1.60 DISPerl:ARRAY::ManakaiDOM:all
5918 wakaba 1.24 @@Get:
5919 wakaba 1.48 @@@enDesc:
5920     A reference to the array containing feature names.
5921     Note that the order in the array is <EM::not> significant.
5922     The array might be empty if the resource has no feature name.
5923     This array is dead.
5924    
5925     {NOTE:: The attribute value array might be non-empty
5926     even if the resource is not of type <Q::DOMFeature:Feature>
5927     as far as the algorithm defined above returns
5928     some feature names.
5929     }
5930 wakaba 1.24 @@@RaiseException:
5931     @@@@@:UNSUPPORTED_MEDIA_TYPE_ERR
5932     @@@@enDesc:
5933     There is an <Q::dis:AppName> attribute whose media
5934     type is not supported.
5935     @@@RaiseException:
5936     @@@@@: NO_SOURCE_NODE_ERR
5937     @@@@enDesc:
5938     This resource definition does not have associated node
5939     in the source tree.
5940     @@@PerlDef:
5941     __DEEP{
5942 wakaba 1.49 $r = [map {lc} @{$self-><M::DISResourceProp.getPropertyTextList>
5943 wakaba 1.52 (<Q::DOMFeature:name>)}];
5944 wakaba 1.24 unless (@$r) {
5945 wakaba 1.48 ## TODO: instance feature
5946 wakaba 1.54 my $pr = $self-><AG::DIS|DISResource.parentResource>;
5947 wakaba 1.28 if ($pr) {
5948 wakaba 1.52 if ($pr-><M::DISResource.isTypeURI> (<Q::DOMFeature:Feature>) and
5949 wakaba 1.48 not $pr-><AG::DISAnyResource.isAnonymous>) {
5950     push @$r, @{$pr-><AG::DISResource.featureNameList>};
5951 wakaba 1.28 }
5952     }
5953     }
5954     unless (@$r) {
5955 wakaba 1.48 if ($self-><AG::DISAnyResource.isAnonymous>) {
5956     my $ln = $self-><AG::DISAnyResource.localName>;
5957 wakaba 1.28 push @$r, lc $ln if defined $ln;
5958 wakaba 1.24 } else {
5959 wakaba 1.48 push @$r, lc $self-><AG::DISAnyResource.nameURI>;
5960     }
5961     }
5962     }__;
5963    
5964     @Method:
5965     @@ForCheck: ManakaiDOM|ForClass
5966     @@Name: getFeature
5967     @@Description:
5968     @@@lang:en
5969     @@@@:
5970     Returns a specialized object that implements the specialized
5971     interfaces of the specified feature and version.
5972     @@Param:
5973     @@@Name: feature
5974     @@@Type:
5975     DISLang:String::ManakaiDOM:all
5976     @@@actualType:
5977     ManakaiDOM:ManakaiDOMFeatureName::ManakaiDOM:ManakaiDOMLatest
5978     @@@Description:
5979     @@@@lang:en
5980     @@@@@:
5981     A feature name to request.
5982     @@Param:
5983     @@@Name: version
5984     @@@Type:
5985     DISLang:String::ManakaiDOM:all
5986     @@@actualType:
5987     ManakaiDOM:ManakaiDOMFeatureVersion::ManakaiDOM:ManakaiDOMLatest
5988     @@@Description:
5989     @@@@lang:en
5990     @@@@@:
5991     A feature version number to request.
5992     @@Return:
5993     @@@Type:
5994     DOMMain:Object::ManakaiDOM:all
5995     @@@Description:
5996     @@@@lang:en
5997     @@@@@:
5998     An object that implements the specialized APIs of the
5999     <P::feature> and <P::version>.
6000 wakaba 1.49 @@@nullCase:
6001     @@@@enDesc:
6002 wakaba 1.48 There is no object available that implements interfaces
6003     associated with the <P::feature> and <P::version>.
6004     @@@PerlDef:
6005     $feature =~ s/^\+//;
6006     CLASS: for my $class (grep {
6007     $Message::Util::DIS::ManakaiDISResourceDefinition::CompatClass{$_}
6008     } keys %Message::Util::DIS::ManakaiDISResourceDefinition::CompatClass){
6009     if ($Message::DOM::ClassFeature{$class}->{$feature}->{$version}) {
6010     $r = bless {o => $self}, $class;
6011     last CLASS;
6012 wakaba 1.24 }
6013     }
6014 wakaba 1.48
6015     @Attr:
6016     @@Name: multiplePropertiesURI
6017     @@enDesc:
6018     Whether the property allows multiple occurence of the attribute
6019     in the <QUOTE::dis> source tree.
6020     @@Type: DISLang|String||ManakaiDOM|all
6021     @@Get:
6022     @@@PerlDef:
6023     __DEEP{
6024     if ($self->{<Q::dis|multipleProperties>}) {
6025     $r = $self->{<Q::dis|multipleProperties>}
6026     -><M::dv|DVURIValue.getResource>
6027     ($self-><AG::DISAnyResource.database>)
6028     -><AG::DISAnyResource.uri>;
6029     } else {
6030     $r = <Q::DISCore|OrderedList>;
6031     }
6032     }__;
6033    
6034     @Attr:
6035     @@Name: defaultLextypeURI
6036     @@enDesc:
6037     The URI of the default lexical type for the <QUOTE::dis> attribute.
6038     @@Type: DISLang|String||ManakaiDOM|all
6039     @@Get:
6040     @@@PerlDef:
6041     __DEEP{
6042     if ($self->{<Q::dis:dataType>}) {
6043     $r = $self->{<Q::dis:dataType>}
6044     -><M::dv|DVURIValue.getResource>
6045     ($self-><AG::DISAnyResource.database>)
6046     -><AG::DISAnyResource.uri>;
6047     } else {
6048     $r = <Q::DISCore|String>;
6049     }
6050 wakaba 1.24 }__;
6051 wakaba 1.48 ##DISResource
6052    
6053     IFClsDef:
6054     @IFQName: DISResourceMV
6055     @ClsQName: ManakaiDISResourceMV
6056    
6057     @enDesc:
6058     The objects implementing the <IF::DISResourceMV> <kwd:MUST>
6059     also implement the <IF::DISResource> interface.
6060 wakaba 1.32
6061     @Attr:
6062     @@Name: mvLocalName
6063     @@enDesc:
6064     The local name of the markup vocabulary element defined by this
6065     resource.
6066     @@Type:
6067     DISLang:String::ManakaiDOM:all
6068     @@Get:
6069     @@@nullCase:
6070     @@@@enDesc:
6071     Either this resource does not define a markup vocabulary element
6072     or it does define an element but it does not have a local name.
6073     @@@PerlDef:
6074     __DEEP{
6075 wakaba 1.48 if (UNIVERSAL::isa ($self->{<Q::dis|AppName>},
6076     <IFName::dv|DVQNameValue>)) {
6077     $r = $self->{<Q::dis|AppName>}-><AG::dv|DVQNameValue.localName>;
6078 wakaba 1.43 } else {
6079 wakaba 1.59 $r = $self-><AG::DIS|DISAnyResource.localName>;
6080 wakaba 1.43 }
6081     }__;
6082    
6083     @Attr:
6084     @@Name: mvPrefix
6085     @@enDesc:
6086     A typical namespace prefix of the markup vocabulary element defined
6087     by this resource.
6088     @@Type:
6089     DISLang:String::ManakaiDOM:all
6090     @@Get:
6091     @@@nullCase:
6092     @@@@enDesc:
6093     Either this resource does not define a markup vocabulary element
6094     or it does define an element but it does not have a namespace URI.
6095     @@@PerlDef:
6096     __DEEP{
6097 wakaba 1.48 if (UNIVERSAL::isa ($self->{<Q::dis|AppName>},
6098     <IFName::dv|DVQNameValue>)) {
6099     $r = $self->{<Q::dis|AppName>}-><AG::dv|DVQNameValue.prefix>;
6100 wakaba 1.43 }
6101     unless (defined $r) {
6102 wakaba 1.48 my $nsuri = $self-><AG::DISResourceMV.mvNamespaceURI>;
6103 wakaba 1.43 if (defined $nsuri and $nsuri =~ /([A-Za-z]\w*)\W*$/) {
6104 wakaba 1.53 $r = $1;
6105 wakaba 1.43 } elsif (defined $nsuri) {
6106 wakaba 1.53 $r = 'ns';
6107 wakaba 1.43 }
6108 wakaba 1.32 }
6109     }__;
6110    
6111     @Attr:
6112     @@Name: mvNamespaceURI
6113     @@enDesc:
6114     The namespace URI of the markup vocabulary element defined by this
6115     resource.
6116     @@Type: AnyURI
6117     @@Get:
6118     @@@nullCase:
6119     @@@@enDesc:
6120     Either this resource does not define a markup vocabulary element
6121     or it does define an element but it does not have a namespace URI.
6122     @@@PerlDef:
6123     __DEEP{
6124 wakaba 1.48 if (UNIVERSAL::isa ($self->{<Q::dis|AppName>},
6125     <IFName::dv|DVQNameValue>)) {
6126     $r = $self->{<Q::dis|AppName>}-><AG::dv|DVQNameValue.namespaceURI>;
6127 wakaba 1.32 } else {
6128 wakaba 1.59 $r = $self-><AG::DIS|DISAnyResource.namespaceURI>;
6129 wakaba 1.32 }
6130     }__;
6131    
6132     @Attr:
6133     @@Name: mvOwnerElementResource
6134     @@enDesc:
6135     An <QUOTE::owner element> resource of the markup vocabulary
6136     element defined by this resource.
6137 wakaba 1.47 @@Type: DISResource
6138     @@clsActualType: ManakaiDISResourceDefinition
6139 wakaba 1.32 @@Get:
6140     @@@nullCase:
6141     @@@@enDesc:
6142     Either this resource does not define a markup vocabulary element
6143     or it does define an element but it does not have an owner.
6144     @@@PerlDef:
6145     __DEEP{
6146 wakaba 1.53 if (exists $self->{<H::DIS:mvOwnerElementURI>}) {
6147 wakaba 1.32 $r = $self->{db}-><M::ManakaiDISDatabase.getResource>
6148 wakaba 1.53 ($self->{<H::DIS:mvOwnerElementURI>})
6149     if defined $self->{<H::DIS:mvOwnerElementURI>};
6150 wakaba 1.54 } else {
6151     $r = $self-><AG::DIS|DISResource.parentResource>;
6152     undef $r unless $r-><M::DIS|DISResource
6153 wakaba 1.32 .isTypeURI> (<Q::s:AnyOwnerElement>);
6154 wakaba 1.53 $self->{<H::DIS:mvOwnerElementURI>} = $r->{uri} if $r;
6155 wakaba 1.32 }
6156 wakaba 1.48 }__;
6157     ##DISResourceMV
6158 wakaba 1.27
6159     PropDef:
6160 wakaba 1.32 @QName: mvLocalName
6161     @enDesc:
6162     <A::ManakaiDISResourceDefinition.mvLocalName>.
6163    
6164     PropDef:
6165 wakaba 1.43 @QName: mvPrefix
6166     @enDesc:
6167     <A::ManakaiDISResourceDefinition.mvPrerix>.
6168    
6169     PropDef:
6170 wakaba 1.32 @QName: mvNamespaceURI
6171     @enDesc:
6172     <A::ManakaiDISResourceDefinition.mvNamespaceURI>.
6173    
6174     PropDef:
6175     @QName: mvOwnerElementURI
6176     @enDesc:
6177     <A::ManakaiDISResourceDefinition.mvOwnerElementResource>
6178     (<QUOTE::dis> resource URI reference).
6179    
6180     PropDef:
6181 wakaba 1.13 @QName: ownerClass
6182     @enDesc:
6183     The class to which this resource belongs.
6184     @Type: ResourceURI
6185     @rdfs:range:
6186     rdf:Resource
6187     @rdfs:domain:
6188     ManakaiDOM:Class
6189    
6190 wakaba 1.12 ResourceDef:
6191     @QName: DOMMinImpl
6192     @AliasFor:
6193 wakaba 1.46 DOMFeature:GetFeature::ManakaiDOM:ManakaiDOMLatest
6194 wakaba 1.49 @For: DIS|ForEmpty
6195 wakaba 1.20
6196     ResourceDef:
6197 wakaba 1.12 @QName: SWCFGNode
6198     @AliasFor:
6199     swcfg21:SWCFGNode::swcfg21:ForLatest
6200 wakaba 1.49 @For: DIS|ForEmpty
6201 wakaba 1.12
6202     ResourceDef:
6203 wakaba 1.48 @QName: SWCFGElement
6204     @AliasFor:
6205     swcfg21:SWCFGElement::swcfg21:ForLatest
6206 wakaba 1.49 @For: DIS|ForEmpty
6207 wakaba 1.48
6208     ResourceDef:
6209 wakaba 1.12 @QName: SWCFGDoc
6210     @AliasFor:
6211     swcfg21:SWCFGDocument::swcfg21:ForLatest
6212 wakaba 1.49 @For: DIS|ForEmpty
6213 wakaba 1.12
6214     XParamDef:
6215 wakaba 1.48 @QName: sourceNodePath
6216     @enDesc:
6217     A node path string of the source node.
6218    
6219     XParamDef:
6220 wakaba 1.12 @QName: errResource
6221     @enDesc:
6222     A resource on which an error has occurred.
6223    
6224 wakaba 1.8 XParamDef:
6225     @QName: generatedName
6226     @enDesc:
6227     A generated name.
6228    
6229 wakaba 1.47 IFClsDef:
6230     @IFQName: DISResourceProp
6231 wakaba 1.2 @ClsQName: ManakaiDISPropertyAccessor
6232 wakaba 1.47
6233 wakaba 1.3 @enDesc:
6234 wakaba 1.2 Accessor methods for resource or module properties.
6235 wakaba 1.48
6236     @Method:
6237     @@Name: getPropertyValue
6238 wakaba 1.22 @@enDesc:
6239 wakaba 1.48 Returns a property value object.
6240     @@PropNameParam:
6241     @@Return:
6242     @@@Type: dv|DVValue
6243     @@@enDesc: The property value.
6244 wakaba 1.22 @@@nullCase:
6245     @@@@enDesc:
6246 wakaba 1.48 The property has no value.
6247 wakaba 1.22 @@@PerlDef:
6248 wakaba 1.52 if ($self->{$propName}) {
6249 wakaba 1.54 $r = $self->{$propName}->[0];
6250 wakaba 1.52 } else {
6251     my $pr = $self-><AG::DISAnyResource.database>
6252     -><M::DISDatabase.getResource> ($propName);
6253 wakaba 1.53 A: for (grep {$pr->{aliasURI}->{$_} or $pr->{supOf}->{$_}}
6254     (keys %{$pr->{aliasURI}}, keys %{$pr->{supOf}||{}})) {
6255 wakaba 1.52 my $v = $self->{$_};
6256     if ($v) {
6257     $r = $v->[0];
6258     last A;
6259     }
6260     }
6261     }
6262 wakaba 1.22
6263 wakaba 1.48 @Method:
6264     @@Name: getPropertyValueList
6265 wakaba 1.22 @@enDesc:
6266 wakaba 1.48 Returns a property value objects.
6267     @@PropNameParam:
6268     @@Return:
6269 wakaba 1.60 @@@Type: DISPerl|ARRAY||ManakaiDOM|all
6270 wakaba 1.48 @@@enDesc: The property value.
6271     @@@PerlDef:
6272     my $pr = $self-><AG::DISAnyResource.database>
6273     -><M::DISDatabase.getResource> ($propName);
6274     $r = [map {@$_}
6275 wakaba 1.49 grep {defined $_}
6276 wakaba 1.48 map {$self->{$_}}
6277 wakaba 1.53 grep {$pr->{aliasURI}->{$_} or $pr->{supOf}->{$_}}
6278     (keys %{$pr->{aliasURI}}, keys %{$pr->{supOf}||{}})];
6279 wakaba 1.22
6280 wakaba 1.2 @Method:
6281 wakaba 1.8 @@Name: getPropertyBoolean
6282     @@enDesc:
6283     Gets boolean property value.
6284     @@PropNameParam:
6285     @@Param:
6286     @@@Name:default
6287     @@@Type:
6288     DOMMain:boolean::ManakaiDOM:all
6289     @@@enDesc:
6290     The default value that is returned if no explicit property
6291     value specification found for this resource.
6292     @@Return:
6293     @@@Type:
6294     DOMMain:boolean::ManakaiDOM:all
6295     @@@enDesc:
6296     The property value.
6297     @@@PerlDef:
6298 wakaba 1.48 if (ref $self->{$propName}) {
6299     $r = $self->{$propName}-><AG::dv|DVValue.value> ? true : false;
6300 wakaba 1.8 $r = $default unless defined $r;
6301     } else {
6302 wakaba 1.48 my $pr = $self-><AG::DISAnyResource.database>
6303     -><M::DISDatabase.getResource> ($propName);
6304     C: {
6305     for (map {$self->{$_}}
6306 wakaba 1.53 grep {$pr->{aliasURI}->{$_} or $pr->{supOf}->{$_}}
6307     (keys %{$pr->{aliasURI}}, keys %{$pr->{supOf}||{}})) {
6308 wakaba 1.48 if (defined $_) {
6309     $r = $_-><AG::dv|DVValue.value> ? true : false;
6310     last C;
6311     }
6312     }
6313     $r = $default;
6314     } # C
6315 wakaba 1.8 }
6316    
6317     @Method:
6318 wakaba 1.2 @@Name: getPropertyText
6319     @@enDesc:
6320     Gets property value text.
6321     @@PropNameParam:
6322     @@Param:
6323     @@@Name:default
6324     @@@Type:
6325 wakaba 1.3 swcfg21:SWCFGString::swcfg21:ForLatest
6326 wakaba 1.2 @@@enDesc:
6327     The default value that is returned if no explicit property
6328     value specification found for this resource.
6329     @@@nullCase:
6330     @@@@enDesc:
6331     No default value supplied; <DOM::null> is returned if
6332     no value specified.
6333     @@Return:
6334     @@@Type:
6335 wakaba 1.3 swcfg21:SWCFGString::swcfg21:ForLatest
6336 wakaba 1.2 @@@enDesc:
6337     The property value string.
6338     @@@nullCase:
6339     @@@@enDesc:
6340     No value nor default value has specified.
6341     @@@PerlDef:
6342 wakaba 1.48 if (defined $self->{$propName}) {
6343     $r = $self->{$propName}-><AG::dv|DVValue.stringValue>;
6344     $r = $default unless defined $r;
6345     } else {
6346     my $pr = $self-><AG::DISAnyResource.database>
6347     -><M::DISDatabase.getResource> ($propName);
6348     C: {
6349     for (map {$self->{$_}}
6350 wakaba 1.53 grep {$pr->{aliasURI}->{$_} or $pr->{supOf}->{$_}}
6351     (keys %{$pr->{aliasURI}}, keys %{$pr->{supOf}||{}})) {
6352 wakaba 1.48 if (defined $_) {
6353     $r = $_-><AG::dv|DVValue.stringValue>;
6354     last C;
6355     }
6356     }
6357 wakaba 1.8 $r = $default;
6358 wakaba 1.48 } # C
6359 wakaba 1.2 }
6360    
6361     @Method:
6362 wakaba 1.48 @@Name: getPropertyTextList
6363     @@enDesc:
6364     Returns a list of property value text.
6365     @@PropNameParam:
6366     @@MediaTypeDefaultParam:
6367     @@Return:
6368 wakaba 1.60 @@@Type: DISPerl|ARRAY||ManakaiDOM|all
6369 wakaba 1.48 @@@enDesc:
6370     A list of the property value strings.
6371     @@@RaiseException:
6372     @@@@@:UNSUPPORTED_MEDIA_TYPE_ERR
6373     @@@@enDesc:
6374     There is an attribute whose media
6375     type is not supported.
6376     @@@PerlDef:
6377     my $pr = $self-><AG::DISAnyResource.database>
6378     -><M::DISDatabase.getResource> ($propName);
6379     $r = [map {$_-><AG::dv|DVValue.stringValue>}
6380     map {@$_}
6381     grep {$_}
6382     map {$self->{$_}}
6383 wakaba 1.53 grep {$pr->{aliasURI}->{$_} or $pr->{supOf}->{$_}}
6384     (keys %{$pr->{aliasURI}}, keys %{$pr->{supOf}||{}})];
6385 wakaba 1.48
6386     @Method:
6387 wakaba 1.2 @@Name: getPropertyResource
6388     @@enDesc:
6389     Gets property value resource.
6390     @@PropNameParam:
6391 wakaba 1.10 @@NamedParam:
6392     @@@Name: defaultMediaType
6393     @@@Type: ResourceURI
6394     @@@enDesc:
6395     The URI reference of the default media type which is used
6396     when the property value is retrieved from the source tree
6397     and the source tree element does not have its <Q::dis:ContentType>
6398     attribute specified.
6399     @@@nullCase:
6400     @@@@enDesc:
6401 wakaba 1.68 Defaulted to <Q::DISCore:QName>.
6402 wakaba 1.2 @@Return:
6403 wakaba 1.61 @@@Type: DIS|DISAnyResource
6404 wakaba 1.2 @@@enDesc:
6405     The property value resource.
6406     @@@nullCase:
6407     @@@@enDesc:
6408     No value has specified.
6409 wakaba 1.8 @@@UndeclaredPrefixException:
6410 wakaba 1.12 @@@RaiseException:
6411     @@@@@:UNSUPPORTED_MEDIA_TYPE_ERR
6412     @@@@enDesc:
6413     The media type of the attribute node in the source tree
6414     corresponding to this resource is not supported.
6415 wakaba 1.2 @@@PerlDef:
6416 wakaba 1.48 __DEEP{
6417     my $v = $self-><M::DISResourceProp.getPropertyValue>
6418     ($propName);
6419     if (UNIVERSAL::isa ($v, <IFName::dv|DVURIValue>)) {
6420 wakaba 1.62 $r = $v-><M::dv|DVURIValue.getResource>
6421 wakaba 1.48 ($self-><AG::DISAnyResource.database>);
6422     }
6423     }__;
6424 wakaba 1.2
6425     @Method:
6426 wakaba 1.10 @@Name: getPropertyResourceList
6427     @@enDesc:
6428     Gets property value resource list.
6429     @@PropNameParam:
6430     @@NamedParam:
6431 wakaba 1.24 @@@Name: recursive
6432     @@@Type:
6433     DOMMain:boolean::ManakaiDOM:all
6434     @@@enDesc:
6435     Whether property resource values of this resource
6436     should also be included to the returned list or not.
6437     @@NamedParam:
6438 wakaba 1.10 @@@Name: recursiveISA
6439     @@@Type:
6440 wakaba 1.18 DOMMain:boolean::ManakaiDOM:all
6441 wakaba 1.10 @@@enDesc:
6442 wakaba 1.26 Whether the <Q::dis:ISA> ancestors of the resources
6443     that are property values should also be included in the returned list
6444     or not.
6445     @@@TrueCase:
6446     @@@@enDesc:
6447     If a property value is a resource <VAR::R> and
6448     the resource <VAR::R> <Q::dis:ISA>'s (or inherits) <VAR::S>, then
6449     the resource <VAR::S> is also a value in the list.
6450     @@@FalseCase:
6451     @@@@enDesc:
6452     Only the resources directly specified as property values is returned.
6453     @@NamedParam:
6454     @@@Name: isaRecursive
6455     @@@Type:
6456     DOMMain:boolean::ManakaiDOM:all
6457     @@@enDesc:
6458     Whether property resource values of <Q::dis:ISA> resources
6459     of this resource should also be included to the returned list or not.
6460     @@@TrueCase:
6461     @@@@enDesc:
6462     If this resource <Q::dis:ISA>'s (or inherits) another resource
6463     <VAR::S> and the <VAR::S> resource has a <P::propName>
6464     property value of <VAR::R>, then the resource <VAR::R>
6465     is also a value in the list.
6466     @@@FalseCase:
6467     @@@@enDesc:
6468     Only the resource directly specified is the returned.
6469 wakaba 1.10 @@NamedParam:
6470     @@@Name: defaultMediaType
6471     @@@Type: ResourceURI
6472     @@@enDesc:
6473     The URI reference of the default media type which is used
6474     when the property value is retrieved from the source tree
6475     and the source tree element does not have its <Q::dis:ContentType>
6476     attribute specified.
6477     @@@nullCase:
6478     @@@@enDesc:
6479 wakaba 1.68 Defaulted to <Q::DISCore:QName>.
6480 wakaba 1.10 @@Return:
6481     @@@Type: ResourceList
6482     @@@enDesc:
6483     An array reference of the property value resources.
6484     \
6485     {NOTE:: This list is <QUOTE::dead>.
6486     \
6487     }
6488     @@@UndeclaredPrefixException:
6489 wakaba 1.12 @@@RaiseException:
6490     @@@@@:UNSUPPORTED_MEDIA_TYPE_ERR
6491     @@@@enDesc:
6492     The media type of the attribute node in the source tree
6493     corresponding to this resource is not supported.
6494 wakaba 1.10 @@@PerlDef:
6495     $r = [];
6496 wakaba 1.48 __DEEP{
6497     my $v = $self-><M::DISResourceProp.getPropertyValueList> ($propName);
6498     my $db = $self-><AG::DISAnyResource.database>;
6499     for my $a (@$v) {
6500     if ($a->isa (<IFName::dv|DVURIValue>)) {
6501 wakaba 1.62 push @$r, $a-><M::dv|DVURIValue.getResource> ($db);
6502 wakaba 1.48 }
6503     if ($isaRecursive) {
6504     my $b = $a-><M::dv|DVValue.getProperty>
6505     (<Q::DISCore:stopISARecursive>);
6506     if ($b and $b-><AG::dv|DVValue.value>) {
6507     $isaRecursive = false;
6508 wakaba 1.32 }
6509 wakaba 1.10 }
6510 wakaba 1.48 }
6511     }__;
6512    
6513 wakaba 1.24 if ($recursive) {
6514     __DEEP{
6515     $opt{___recursive_isa_done} ||= {$self->{uri} => true};
6516     my @p_res = @$r;
6517     for my $p_res (@p_res) {
6518     next if $opt{___recursive_isa_done}->{$p_res->{uri}};
6519     $opt{___recursive_isa_done}->{$p_res->{uri}} = true;
6520 wakaba 1.48 push @$r, @{$p_res-><M::DISResourceProp.getPropertyResourceList>
6521 wakaba 1.24 ($propName, recursive => true,
6522     recursive_isa => $recursiveISA,
6523     ___recursive_isa_done => $opt{___recursive_isa_done},
6524     default_media_type => $defaultMediaType)};
6525     }
6526     }__;
6527     }
6528 wakaba 1.10 if ($recursiveISA) {
6529     __DEEP{
6530     $opt{___recursive_isa_done} ||= {$self->{uri} => true};
6531     my @p_res = @$r;
6532     for my $p_res (@p_res) {
6533     next if $opt{___recursive_isa_done}->{$p_res->{uri}};
6534     $opt{___recursive_isa_done}->{$p_res->{uri}} = true;
6535 wakaba 1.48 push @$r, @{$p_res-><M::DISResourceProp.getPropertyResourceList>
6536 wakaba 1.33 (<Q::dis:ISA>,
6537     recursive => true,
6538 wakaba 1.10 ___recursive_isa_done => $opt{___recursive_isa_done},
6539     default_media_type => $defaultMediaType)};
6540     }
6541     }__;
6542     }
6543 wakaba 1.26 if ($isaRecursive) {
6544 wakaba 1.25 __DEEP{
6545     $opt{___recursive_isa_done} ||= {$self->{uri} => true};
6546 wakaba 1.37 $opt{___isa_recursive_done} ||= {$self->{uri} => true};
6547 wakaba 1.48 my @p_res = @{$self-><M::DISResourceProp.getPropertyResourceList>
6548 wakaba 1.26 (<Q::dis:ISA>, recursive_isa => false,
6549 wakaba 1.37 recursive => false,
6550 wakaba 1.26 default_media_type => <Q::dis:TFQNames>)};
6551 wakaba 1.25 for my $p_res (@p_res) {
6552 wakaba 1.37 next if $opt{___isa_recursive_done}->{$p_res->{uri}};
6553     $opt{___isa_recursive_done}->{$p_res->{uri}} = true;
6554 wakaba 1.48 push @$r, @{$p_res-><M::DISResourceProp.getPropertyResourceList>
6555 wakaba 1.26 ($propName, recursive_isa => false,
6556     recursive => false,
6557 wakaba 1.37 isa_recursive => true,
6558     ___isa_recursive_done =>
6559     $opt{___isa_recursive_done},
6560 wakaba 1.26 default_media_type => $defaultMediaType)};
6561 wakaba 1.25 }
6562     }__;
6563     }
6564 wakaba 1.60
6565     @Method:
6566 wakaba 1.2 @@Name: addPropertyResourceList
6567     @@enDesc:
6568     Adds a resource to a resource-list property value.
6569     \
6570     {ISSUE:: Should an exception be thrown if the property is
6571     not of list?
6572     \
6573     }
6574 wakaba 1.10 \
6575     {NOTE:: If the property is not <QUOTE::get>ten ever, adding
6576     an item clears the list --- i.e. the property values
6577     in the source tree will be ignored. Call
6578     <M::ManakaiDISPropertyAccessor.getPropertyResourceList>
6579     before adding to avoid this behavior.
6580     \
6581     }
6582 wakaba 1.2 @@PropNameParam:
6583     @@Param:
6584     @@@Name: res
6585 wakaba 1.47 @@@Type: DISResource
6586     @@@clsActualType: ManakaiDISResourceDefinition
6587 wakaba 1.2 @@@enDesc:
6588     A resource to add.
6589     @@Return:
6590     @@@PerlDef:
6591 wakaba 1.48 if ($self->{$propName}) {
6592     my $uriv;
6593     __CODE{dv|createURI::
6594     $uri => {$res-><AG::DISAnyResource.uri>},
6595     $result => $uriv,
6596 wakaba 1.60 $name => $propName,
6597 wakaba 1.48 }__;
6598     $self->{$propName}-><M::dv|DVList.addItem> ($uriv);
6599     } else {
6600     __CODE{dv|createOrderedList::
6601     $result => {$self->{$propName}},
6602     $type => {<Q::DISCore:URI>},
6603     $base_type => {<Q::DISCore:URI>},
6604     }__;
6605     my $uriv;
6606     __CODE{dv|createURI::
6607     $uri => {$res-><AG::DISAnyResource.uri>},
6608     $result => $uriv,
6609 wakaba 1.60 $name => $propName,
6610 wakaba 1.48 }__;
6611     $self->{$propName}-><M::dv|DVList.addItem> ($uriv);
6612     }
6613    
6614     @Method:
6615     @@Name: addPropertyResourceUList
6616 wakaba 1.52 @@plMName: add_property_resource_ulist
6617 wakaba 1.48 @@enDesc:
6618     Adds a resource to a resource-list property value.
6619     \
6620     {ISSUE:: Should an exception be thrown if the property is
6621     not of list?
6622     \
6623     }
6624     \
6625     {NOTE:: If the property is not <QUOTE::get>ten ever, adding
6626     an item clears the list --- i.e. the property values
6627     in the source tree will be ignored. Call
6628     <M::ManakaiDISPropertyAccessor.getPropertyResourceList>
6629     before adding to avoid this behavior.
6630     \
6631     }
6632     @@PropNameParam:
6633     @@Param:
6634     @@@Name: res
6635     @@@Type: DISResource
6636     @@@clsActualType: ManakaiDISResourceDefinition
6637     @@@enDesc:
6638     A resource to add.
6639     @@Return:
6640     @@@PerlDef:
6641     if ($self->{$propName}) {
6642     my $uriv;
6643     __CODE{dv|createURI::
6644     $uri => {$res-><AG::DISAnyResource.uri>},
6645     $result => $uriv,
6646 wakaba 1.60 $name => $propName,
6647 wakaba 1.48 }__;
6648     $self->{$propName}-><M::dv|DVList.addItem> ($uriv);
6649 wakaba 1.25 } else {
6650 wakaba 1.48 __CODE{dv|createUnorderedList::
6651     $result => {$self->{$propName}},
6652     $type => {<Q::DISCore:URI>},
6653     $base_type => {<Q::DISCore:URI>},
6654     }__;
6655     my $uriv;
6656     __CODE{dv|createURI::
6657     $uri => {$res-><AG::DISAnyResource.uri>},
6658     $result => $uriv,
6659 wakaba 1.60 $name => $propName,
6660 wakaba 1.25 }__;
6661 wakaba 1.48 $self->{$propName}-><M::dv|DVList.addItem> ($uriv);
6662 wakaba 1.2 }
6663    
6664 wakaba 1.48 @Method:
6665     @@Name: addPropertyURIUList
6666 wakaba 1.52 @@plMName: add_peoperty_uri_ulist
6667 wakaba 1.48 @@enDesc:
6668     Adds a resource to a resource-list property value.
6669     \
6670     {ISSUE:: Should an exception be thrown if the property is
6671     not of list?
6672     \
6673     }
6674     \
6675     {NOTE:: If the property is not <QUOTE::get>ten ever, adding
6676     an item clears the list --- i.e. the property values
6677     in the source tree will be ignored. Call
6678     <M::ManakaiDISPropertyAccessor.getPropertyResourceList>
6679     before adding to avoid this behavior.
6680     \
6681     }
6682     @@PropNameParam:
6683     @@Param:
6684     @@@Name: uri
6685     @@@Type: AnyURI
6686     @@@enDesc:
6687     A resource to add.
6688     @@Return:
6689     @@@PerlDef:
6690     __DEEP{
6691     if ($self->{$propName}) {
6692     my $uriv;
6693     __CODE{dv|createURI::
6694     $uri => $uri,
6695     $result => $uriv,
6696 wakaba 1.60 $name => $propName,
6697 wakaba 1.48 }__;
6698     $self->{$propName}-><M::dv|DVList.addItem> ($uriv);
6699     } else {
6700     __CODE{dv|createUnorderedList::
6701     $result => {$self->{$propName}},
6702     $type => {<Q::DISCore|URI>},
6703     $base_type => {<Q::DISCore:URI>},
6704     }__;
6705     my $uriv;
6706     __CODE{dv|createURI::
6707     $uri => $uri,
6708     $result => $uriv,
6709 wakaba 1.60 $name => $propName,
6710 wakaba 1.48 }__;
6711     $self->{$propName}-><M::dv|DVList.addItem> ($uriv);
6712     }
6713     }__;
6714     ##DISResourceProp
6715    
6716 wakaba 1.3 ElementTypeBinding:
6717     @Name: PropNameParam
6718     @ElementType:
6719     dis:ResourceDef
6720     @ShadowContent:
6721     @@rdf:type:
6722     DISLang:MethodParameter
6723     @@Name: propName
6724     @@Type: ResourceURI
6725     @@Description:
6726     @@@lang:en
6727     @@@@:
6728     The name of the property.
6729    
6730 wakaba 1.2 PropDef:
6731     @QName:isAnon
6732     @Description:
6733     @@lang:en
6734     @@@:
6735     Whether the subject resource is anonymous or not.
6736     @Type:
6737 wakaba 1.18 DOMMain:boolean::ManakaiDOM:all
6738 wakaba 1.2
6739     PropDef:
6740     @QName:isDefined
6741     @Description:
6742     @@lang:en
6743     @@@:
6744     Whether the subject resource is defined or not.
6745    
6746     PropDef:
6747 wakaba 1.3 @QName:isReferred
6748 wakaba 1.2 @Description:
6749     @@lang:en
6750     @@@:
6751     Whether the subject resource is referred or not.
6752     @Type:
6753     DOMMain:any
6754    
6755     PropDef:
6756     @QName:definingModule
6757     @Description:
6758     @@lang:en
6759     @@@:
6760     The <QUOTE::dis> module in which the subject resource is defined.
6761 wakaba 1.22 \
6762     {NOTE:: The local name should have been <QUOTE::ownerModule> or some.
6763     \
6764     }
6765 wakaba 1.2 @rdfs:domain:
6766     DISCore:Module
6767 wakaba 1.1
6768     ## -- Datatypes
6769    
6770     URITypeDef:
6771 wakaba 1.3 @QName: AnyURI
6772     @Description:
6773     @@lang:en
6774     @@@:
6775     Any URI references.
6776    
6777     URITypeDef:
6778     @QName: FileURI
6779     @enDesc:
6780     URI references identifying file.
6781    
6782     URITypeDef:
6783 wakaba 1.1 @QName: ForURI
6784     @Description:
6785     @@lang:en
6786     @@@:
6787     <QUOTE::For> URI references.
6788    
6789     DataTypeDef:
6790     @QName: ForURIList
6791     @Description:
6792     @@lang:en
6793     @@@:
6794     References to the array containing <QUOTE::for> URI references.
6795    
6796     URITypeDef:
6797 wakaba 1.3 @QName: ResourceURI
6798     @Description:
6799     @@lang:en
6800     @@@:
6801     A URI reference for a <QUOTE::dis> resource.
6802    
6803     URITypeDef:
6804 wakaba 1.1 @QName: MediaTypeURI
6805     @Description:
6806     @@lang:en
6807     @@@:
6808     Media type URI references.
6809 wakaba 1.3 @rdfs:subClassOf: ResourceURI
6810    
6811     URITypeDef:
6812     @QName: ModuleURI
6813     @enDesc:
6814 wakaba 1.47 URI references for <QUOTE::dis> modules.
6815 wakaba 1.3 @rdfs:subClassOf: ResourceURI
6816    
6817     URITypeDef:
6818     @QName: NameURI
6819     @enDesc:
6820     URI references identifying a resource.
6821     @rdfs:subClassOf: ResourceURI
6822 wakaba 1.10
6823     DataTypeDef:
6824     @QName: ResourceList
6825     @enDesc:
6826     References to array containing resource definition objects.
6827     @rdfs:subClassOf:
6828 wakaba 1.60 DISPerl:ARRAY::ManakaiDOM:all
6829 wakaba 1.3
6830     ElementTypeBinding:
6831     @Name: DataTypeDef
6832     @ElementType:
6833     dis:ResourceDef
6834     @ShadowContent:
6835     @@rdf:type:
6836     ManakaiDOM:DataType
6837    
6838     ElementTypeBinding:
6839     @Name: URITypeDef
6840     @ElementType:
6841     dis:ResourceDef
6842     @ShadowContent:
6843     @@rdf:type:
6844     ManakaiDOM:DataType
6845     @@rdfs:subClassOf: AnyURI
6846 wakaba 1.1
6847     ## -- Exceptions
6848    
6849     XParamDef:
6850 wakaba 1.5 @QName: anotherSourceNode
6851     @enDesc:
6852     Another source node in which an error has occurred. In cases
6853     of <QUOTE::already defined> errors, it is the node that
6854     defines the resource first.
6855     @Type: ManakaiDISNode
6856 wakaba 1.3
6857 wakaba 1.12 ResourceDef:
6858     @QName: UNDECLARED_NS_PREFIX_ERR
6859 wakaba 1.49 @For: ForEmpty
6860 wakaba 1.12 @AliasFor:
6861     DIS:UNDECLARED_NS_PREFIX_ERR::swcfg21:ForLatest
6862    
6863 wakaba 1.47 ResourceDef:
6864     @rdf:type:
6865     @@@: dis|MultipleResource
6866     @@ForCheck: !ManakaiDOM|ForIF !ManakaiDOM|ForClass
6867     @resourceFor: ManakaiDOM|ForIF
6868     @resourceFor:
6869     @@@: ManakaiDOM|ForClass
6870     @@ForCheck: ForEmpty !=ForEmpty
6871     @For: ForLatest
6872     @For: =ForEmpty
6873    
6874     @rdf:type:
6875 wakaba 1.63 @@@: dx|Interface
6876 wakaba 1.47 @@ForCheck: ManakaiDOM|ForIF
6877    
6878     @rdf:type:
6879 wakaba 1.63 @@@: dx|Class
6880 wakaba 1.47 @@ForCheck: ManakaiDOM|ForClass
6881    
6882     @Implement:
6883     @@@: ||ForEmpty||ManakaiDOM|ForIF
6884     @@ContentType: DISCore|TFPQNames
6885     @@ForCheck: ManakaiDOM|ForClass ForEmpty
6886     @Implement:
6887     @@@: ||ForLatest||ManakaiDOM|ForIF
6888     @@ContentType: DISCore|TFPQNames
6889     @@ForCheck: ManakaiDOM|ForClass ForLatest
6890 wakaba 1.63 @dx:implementedBy: ||DIS|ForLatest||ManakaiDOM|ForClass
6891 wakaba 1.47
6892 wakaba 1.63 @f:implements:
6893 wakaba 1.47 @@@: CoreFeature10
6894     @@For: ForLatest
6895    
6896     @ISA:
6897 wakaba 1.63 @@@: dx|Exception||ManakaiDOM|Perl
6898 wakaba 1.47 @@ForCheck: ManakaiDOM|ForClass
6899    
6900     @IFQName: DISException
6901 wakaba 1.3 @ClsQName: ManakaiDISException
6902 wakaba 1.47
6903     @Description:
6904     @@lang:en
6905     @@@:
6906     Exceptions for the <QUOTE::dis> operations.
6907    
6908     @ResourceDef:
6909 wakaba 1.63 @@rdf:type: DISLang|ConstGroup
6910     @@ForCheck: ManakaiDOM|ForIF !=DIS|ForEmpty
6911 wakaba 1.47
6912     @@IFQName: DISExceptionCode
6913    
6914 wakaba 1.63 @@rdfs:subClassOf: idl|unsignedShort||ManakaiDOM|all
6915     @@Type: idl|unsignedShort||ManakaiDOM|all
6916 wakaba 1.47
6917 wakaba 1.3 @@enDesc:
6918 wakaba 1.63 Exception codes for <Class::DISException>.
6919 wakaba 1.47
6920 wakaba 1.3 @@XConstDef:
6921 wakaba 1.11 @@@Name: HIERARCHY_REQUEST_ERR
6922 wakaba 1.49 @@@Value:
6923     @@@@@:3
6924     @@@@ContentType: DISCore|Integer
6925 wakaba 1.11 @@@enDesc:
6926     An attempt is made to break the hierarchy.
6927     @@@XSubTypeDef:
6928     @@@@QName: MERGE_ITSELF_ERR
6929     @@@@enDesc:
6930     An attempt is made to merge the resource to itself.
6931     @@@@XSourceNodeParam:
6932     @@@@XParam:
6933     @@@@@QName:uri
6934     @@@@@enDesc:
6935     The URI reference of the resource to merge.
6936     @@@@enMufDef:
6937     An attempt is made to merge the resource <%p (name => {<Q::DIS:uri>}
6938     );> to itself
6939     @@XConstDef:
6940 wakaba 1.8 @@@Name: NOT_SUPPORTED_ERR
6941 wakaba 1.49 @@@Value:
6942     @@@@@:9
6943     @@@@ContentType: DISCore|Integer
6944 wakaba 1.8 @@@enDesc:
6945     An attempt is made to do something the implementation does not support.
6946     @@@XSubTypeDef:
6947     @@@@QName: UNSUPPORTED_MEDIA_TYPE_ERR
6948     @@@@enDesc:
6949     The implementation does not support the media type.
6950     @@@@XParam:
6951     @@@@@QName: uri
6952     @@@@@enDesc:
6953     The URI reference of the media type that is not supported.
6954     @@@@XSourceNodeParam:
6955 wakaba 1.30 @@@@XParam:
6956     @@@@@QName:elementType
6957     @@@@@enDesc:
6958     The URI reference of the element type of the element
6959     in which the media type is referenced.
6960 wakaba 1.12 @@@@enMufDef:
6961 wakaba 1.30 %p (name => {<Q::DIS:sourceCode>}, prefix => {"}, suffix => {": }
6962     );%p (name => {<Q::DIS:elementType>}, prefix => { (Element type: <},
6963     suffix => {>) }
6964     );Media type <%p (name => {<Q::DIS:uri>});> is not supported
6965 wakaba 1.3 @@@XSubTypeDef:
6966 wakaba 1.13 @@@@QName: UNSUPPORTED_ELEMENT_TYPE_ERR
6967     @@@@enDesc:
6968     An unsupported type of element is encounted.
6969     @@@@XSourceNodeParam:
6970     @@@@XParam:
6971     @@@@@QName:elementType
6972     @@@@@enDesc:
6973     The element type URI reference of the element.
6974 wakaba 1.16 @@@@enMufDef:
6975     Element type "%p (name => {<Q::DIS:elementType>});" is not supported
6976 wakaba 1.13 @@@XSubTypeDef:
6977 wakaba 1.12 @@@@QName: NO_PERL_CODE_IMPL_ERR
6978 wakaba 1.3 @@@@enDesc:
6979 wakaba 1.12 There is no implementation that supports the
6980     <Feature::Util:PerlCode> feature, version
6981     <FeatureVer::1.0>.
6982 wakaba 1.3 @@XConstDef:
6983     @@@Name: INVALID_STATE_ERR
6984 wakaba 1.49 @@@Value:
6985     @@@@@:11
6986     @@@@ContentType: DISCore|Integer
6987 wakaba 1.3 @@@enDesc:
6988     An attempt is made to use an object that is not (or no longer) usable.
6989     @@@XSubTypeDef:
6990     @@@@QName: NO_ASSOCIATED_DB_ERR
6991     @@@@enDesc:
6992     No <QUOTE::dis> database has been associated with this document.
6993 wakaba 1.4 @@XConstDef:
6994     @@@Name: INVALID_SOURCE_ERR
6995 wakaba 1.49 @@@Value:
6996 wakaba 1.63 @@@@@: 501
6997 wakaba 1.49 @@@@ContentType: DISCore|Integer
6998 wakaba 1.4 @@@enDesc:
6999     The source input is well-formed but invalid.
7000     @@@XSubTypeDef:
7001     @@@@QName: NO_MODULE_QNAME_ERR
7002     @@@@enDesc:
7003     The <Q::dis:Module> element must have its <Q::dis:QName>
7004     attribute.
7005 wakaba 1.8 @@@@XSourceNodeParam:
7006     @@@XSubTypeDef:
7007     @@@@QName: NO_LOCAL_NAME_ERR
7008     @@@@enDesc:
7009     The resource does not have a local name.
7010     @@@@XSourceNodeParam:
7011 wakaba 1.4 @@@XSubTypeDef:
7012     @@@@QName: UNABLE_TO_GET_MODULE_ERR
7013     @@@@enDesc:
7014     The implementation is unable to get the module source.
7015 wakaba 1.68 @@@@enMufDef:
7016 wakaba 1.4 Unable to get the module source of <%p (name => {<Q::DIS:uri>});>
7017     @@@@XParam:
7018     @@@@@QName: uri
7019     @@@@@enDesc:
7020     The URI reference of the module.
7021     @@@@XParam:
7022     @@@@@QName: namespaceURI
7023     @@@@@enDesc:
7024     The namespace URI of the module name.
7025     @@@@XParam:
7026     @@@@@QName: localName
7027     @@@@@enDesc:
7028     The local name of the module name.
7029     @@@@XParam:
7030     @@@@@QName: for
7031     @@@@@enDesc:
7032     The <QUOTE::for> of the module.
7033 wakaba 1.5 @@@XSubTypeDef:
7034     @@@@QName: NO_FOR_QNAME_ERR
7035     @@@@enDesc:
7036     A <Q::dis:ForDef> element must have <Q::dis:QName> attribute.
7037     @@@@XSourceNodeParam:
7038     @@@XSubTypeDef:
7039     @@@@QName: FOR_ALREADY_DEFINED_ERR
7040     @@@@enDesc:
7041     The <QUOTE::for> named as the same URI reference has
7042     already defined.
7043     @@@@XSourceNodeParam:
7044     @@@@XParam:
7045     @@@@@QName: anotherSourceNode
7046     @@@@@enDesc:
7047     The node that defines the <QUOTE::for> URI reference before.
7048 wakaba 1.7 @@@@XParam:
7049     @@@@@Name: uri
7050     @@@@@enDesc:
7051     The URI reference of the <QUOTE::for> attempted to define.
7052     @@@@enMufDef:
7053     <QUOTE::For> <%p (name => {<Q::DIS:uri>});> is already defined
7054 wakaba 1.5 @@@XSubTypeDef:
7055     @@@@QName: RESOURCE_ALREADY_DEFINED_ERR
7056     @@@@enDesc:
7057     The <QUOTE::dis> resource named as the same URI reference has
7058     already defined.
7059     @@@@XSourceNodeParam:
7060     @@@@XParam:
7061 wakaba 1.54 @@@@@@: anotherSourceNode
7062 wakaba 1.5 @@@@@enDesc:
7063     The node that defines the <QUOTE::for> URI reference before.
7064 wakaba 1.7 @@@@XParam:
7065 wakaba 1.54 @@@@@@: uri
7066 wakaba 1.7 @@@@@enDesc:
7067     The URI reference of the resource attempted to define.
7068 wakaba 1.54 @@@@XParam:
7069     @@@@@@: moduleURI
7070     @@@@@enDesc:
7071     A URI of the module in which the <Q::DIS|uri> resource is
7072     defined.
7073 wakaba 1.7 @@@@enMufDef:
7074 wakaba 1.54 %p (name => {<Q::DIS:moduleURI>}, prefix => {Module <},
7075     suffix => {>: })
7076     ;Resource <%p (name => {<Q::DIS:uri>});> is already defined
7077 wakaba 1.5 @@@XSubTypeDef:
7078     @@@@QName: ELEMENT_NOT_ALLOWED_ERR
7079     @@@@enDesc:
7080     An element has occured where it is not allowed.
7081     @@@@enMufDef:
7082     Module <%p (name => {<Q::DIS:uri>});>:
7083     Element of type <%p (name => {<Q::DIS:elementType>});>
7084     is not allowed here
7085     @@@@XSourceNodeParam:
7086     @@@@XParam:
7087     @@@@@QName: elementType
7088     @@@@@enDesc:
7089     The expanded element type name of the element.
7090     @@@@XParam:
7091     @@@@@QName: uri
7092     @@@@@enDesc:
7093     The URI reference of the module.
7094 wakaba 1.7 @@@XSubTypeDef:
7095     @@@@QName: NO_REQUIRED_ATTR_ERR
7096     @@@@enDesc:
7097     A required attribute is not specified.
7098     @@@@XSourceNodeParam:
7099     @@@@XParam:
7100     @@@@@QName: elementType
7101     @@@@@enDesc:
7102     The expanded URI reference of the attribute name.
7103     @@@@enMufDef:
7104     Attribute <%p (name => {<Q::DIS:elementType>});> must be specified
7105 wakaba 1.8 @@@XSubTypeDef:
7106     @@@@QName: FOR_NOT_DEFINED_ERR
7107     @@@@enDesc:
7108     A <QUOTE::for> is referred but not defined.
7109     @@@@XSourceNodeParam:
7110     @@@@XParam:
7111     @@@@@QName: uri
7112     @@@@@enDesc:
7113     The URI reference of the <QUOTE::for> that is not defined.
7114     @@@@enMufDef:
7115     <QUOTE::For> <%p (name => {<Q::DIS:uri>});> is not defined
7116     @@@XSubTypeDef:
7117     @@@@QName: RESOURCE_NOT_DEFINED_ERR
7118     @@@@enDesc:
7119 wakaba 1.13 A <QUOTE::dis> resource is referred but not defined
7120     or the resource referred does not have the type expected.
7121 wakaba 1.8 @@@@XSourceNodeParam:
7122     @@@@XParam:
7123 wakaba 1.48 @@@@@@: sourceNodePath
7124     @@@@@enDesc:
7125     A node path string of the source node.
7126     @@@@XParam:
7127 wakaba 1.8 @@@@@QName: uri
7128     @@@@@enDesc:
7129     The URI reference of the resource that is not defined.
7130 wakaba 1.13 @@@@XParam:
7131     @@@@@QName: elementType
7132     @@@@@enDesc:
7133     <QUOTE::dis> element type (either tree element type
7134     or preprocessing element type) of the element
7135     in which a reference to the undefined resource is contained.
7136     @@@@XParam:
7137 wakaba 1.30 @@@@@QName:parentURI
7138     @@@@@enDesc:
7139     The URI reference of the resource from whose child resources
7140     a resource is tried to find.
7141     @@@@XParam:
7142 wakaba 1.54 @@@@@QName: moduleURI
7143     @@@@@enDesc:
7144     The URI of the module in which the resourece should be included.
7145     @@@@XParam:
7146 wakaba 1.13 @@@@@QName: localName
7147     @@@@@enDesc:
7148     The local name of the undefined resource.
7149     @@@@XParam:
7150     @@@@QName: sourceCode
7151     @@@@enDesc:
7152     Source code fragment that referres this resource.
7153     @@@@XParam:
7154     @@@@@QName:expectedType
7155     @@@@@enDesc:
7156     Expected resource type.
7157 wakaba 1.8 @@@@enMufDef:
7158 wakaba 1.54 %p (name => {<Q::DIS:moduleURI>}, prefix => {Module <},
7159     suffix => {>: })
7160     ;%p (name => {<Q::DIS:sourceNodePath>}, suffix => {: })
7161     ;%p (name => {<Q::DIS:sourceCode>}, prefix => {"}, suffix => {": })
7162     ;%p (name => {<Q::DIS:parentURI>}, prefix => {(In <}, suffix => {>) })
7163     ;Resource%p (name => {<Q::DIS:uri>}, prefix => { <},
7164 wakaba 1.13 suffix => {>});%p (name => {<Q::DIS:localName>},
7165     prefix => { "}, suffix => {"}); is not defined or wrong type%p
7166     (name => {<Q::DIS:expectedType>}, prefix => { (<},
7167     suffix => {> is expected)});
7168     @@@XSubTypeDef:
7169     @@@@QName: NO_SOURCE_NODE_ERR
7170     @@@@enDesc:
7171     A resource does not have associated node in the source tree.
7172     @@@@XSourceNodeParam:
7173     @@@@XParam:
7174     @@@@@QName:uri
7175     @@@@@enDesc:
7176     The URI reference of the resource.
7177 wakaba 1.8 @@@XSubTypeDef:
7178     @@@@QName: RESERVED_PERL_METHOD_NAME_ERR
7179     @@@@enDesc:
7180     A reserved Perl method name is used.
7181     @@@@XParam:
7182     @@@@@QName:uri
7183     @@@@@enDesc:
7184     The URI reference of the method resource.
7185     @@@@XSourceNodeParam:
7186     @@@@XParam:
7187     @@@@@QName: generatedName
7188     @@@@@enDesc:
7189     A reserved method name.
7190     @@@XSubTypeDef:
7191     @@@@QName: NO_DIS_TYPE_ERR
7192     @@@@enDesc:
7193     <Q::dis:Type> attribute is not found.
7194     @@@@XSourceNodeParam:
7195 wakaba 1.48 @@@@enMufDef:
7196     Resource "%t (name => {<Q::DIS:uri>});" has no "dis:Type" attribute
7197 wakaba 1.12 @@@XSubTypeDef:
7198     @@@@QName: NO_METHOD_RETURN_ERR
7199     @@@@enDesc:
7200     A <Q::DISLang:Method> resource does not have any
7201     <Q::DISLang:MethodReturn> child.
7202     @@@@XSourceNodeParam:
7203 wakaba 1.22 @@@@XParam:
7204     @@@@@QName:errResource
7205     @@@@@enDesc: The method resource.
7206     @@@@XParam:
7207     @@@@@QName:uri
7208     @@@@@enDesc:
7209     The URI reference of the method.
7210     @@@@XParam:
7211     @@@@@QName:localName
7212     @@@@@enDesc:
7213     The local name of the resource.
7214     @@@@enMufDef:
7215     Method "%p (name => {<Q::DIS:localName>});" does not have
7216     "Return" child
7217 wakaba 1.12 @@@XSubTypeDef:
7218     @@@@QName: NO_ATTR_GET_ERR
7219     @@@@enDesc:
7220     A <Q::DISLang:Attribute> resource does not have any
7221     <Q::DISLang:AttributeGet> child.
7222     @@@@XSourceNodeParam:
7223 wakaba 1.13 @@@XSubTypeDef:
7224     @@@@QName:INTERFACE_CLASS_METHOD_ERR
7225     @@@@enDesc:
7226     An attempt is made to call a static (class) method
7227     from an interface.
7228     @@@@XSourceNodeParam:
7229     @@@@XParam:
7230     @@@@@QName:uri
7231     @@@@@enDesc:
7232     The URI reference of the interface.
7233     @@@@XParam:
7234     @@@@@QName:sourceCode
7235     @@@@@enDesc:
7236     Source code fragment that calls a class method.
7237     @@@@XParam:
7238     @@@@@QName:elementType
7239     @@@@@enDesc:
7240     The element type URI reference of the element
7241     that calls a method.
7242     @@@XSubTypeDef:
7243     @@@@QName: BROKEN_PARAM_SPEC_ERR
7244     @@@@enDesc:
7245     A parameter specification is broken.
7246     @@@@XParam:
7247     @@@@@QName: sourceCode
7248     @@@@@enDesc:
7249     Source code fragment that contains the broken parameter
7250     specification.
7251     @@@@XSourceNodeParam:
7252 wakaba 1.15 @@@@enMufDef:
7253     %p (name => {<Q::DIS:sourceCode>}, prefix => {"},
7254     suffix => {": });Broken parameter specification
7255 wakaba 1.13 @@@XSubTypeDef:
7256     @@@@QName:PERL_PREPROCESS_NO_ELEMENT_TYPE_ERR
7257     @@@@enDesc:
7258     A preprocessing instruction does not have its element
7259     type.
7260     @@@@XSourceNodeParam:
7261     @@@@XParam:
7262     @@@@@QName:sourceCode
7263     @@@@@enDesc:
7264     Source code fragment.
7265 wakaba 1.16 @@@@enMufDef:
7266     %p (name => {<Q::DIS:sourceCode>}, prefix => {"},
7267     suffix => {": });Element type name is not specified
7268 wakaba 1.13 @@@XSubTypeDef:
7269 wakaba 1.15 @@@@QName: NO_PERL_PACKAGE_NAME_ERR
7270 wakaba 1.13 @@@@enDesc:
7271 wakaba 1.15 No Perl package name is defined for the resource referred.
7272 wakaba 1.13 @@@@XSourceNodeParam:
7273     @@@@XParam:
7274 wakaba 1.15 @@@@@QName:sourceCode
7275 wakaba 1.13 @@@@@enDesc:
7276     Source code fragment.
7277     @@@@XParam:
7278 wakaba 1.15 @@@@@QName:uri
7279     @@@@@enDesc:
7280     THe URI reference of the resource referred.
7281     @@@@XParam:
7282     @@@@@QName:elementType
7283     @@@@@enDesc:
7284     The element type of Perl preprocessing instruction
7285     in which the resource is referred.
7286     @@@@enMufDef:
7287     %p (name => {<Q::DIS:uri>}, prefix => {<}, suffix => {>: });Perl
7288     package name is not defined
7289     @@@XSubTypeDef:
7290     @@@@QName: PERL_PREPROCESS_NO_EXCEPTION_TYPE_ERR
7291     @@@@enDesc:
7292     An exception type specification is required.
7293     @@@@XSourceNodeParam:
7294     @@@@XSourceCodeParam:
7295     @@@@XParam:
7296     @@@@@QName:elementType
7297     @@@@@enDesc:
7298     The element type of the preprocessing instruction.
7299     @@@XSubTypeDef:
7300     @@@@QName: PERL_PREPROCESS_NO_CODE_NAME_ERR
7301     @@@@enDesc:
7302     A code name specification is required.
7303     @@@@XSourceNodeParam:
7304     @@@@XSourceCodeParam:
7305     @@@@XParam:
7306 wakaba 1.13 @@@@@QName:elementType
7307     @@@@@enDesc:
7308 wakaba 1.15 The element type of the preprocessing instruction.
7309 wakaba 1.13 @@@XSubTypeDef:
7310     @@@@QName: PERL_CODE_NOT_DEFINED_ERR
7311     @@@@enDesc:
7312 wakaba 1.15 The specified resource does not have its Perl definition.
7313 wakaba 1.13 @@@@XSourceNodeParam:
7314 wakaba 1.15 @@@@XSourceCodeParam:
7315 wakaba 1.13 @@@@XParam:
7316 wakaba 1.15 @@@@@QName:elementType
7317     @@@@@enDesc:
7318     The element type of the preprocessing instruction.
7319     @@@@XParam:
7320     @@@@@QName:uri
7321 wakaba 1.13 @@@@@enDesc:
7322 wakaba 1.15 The URI reference of the resource referred.
7323 wakaba 1.13 @@@@XParam:
7324     @@@@@QName:localName
7325     @@@@@enDesc:
7326     The local name of the resource referred.
7327 wakaba 1.51 @@@@enMufDef:
7328     Resource%p (name => {<Q::DIS:uri>}, prefix => { "}, suffix => {"});
7329     has no Perl code definition
7330 wakaba 1.15 @@@XSubTypeDef:
7331     @@@@QName: PERL_PREPROCESS_NO_METHOD_ERR
7332     @@@@enDesc:
7333     A preprocessing instruction which is only allowed in
7334     method definitions is used in a code which is not a method.
7335     @@@@XSourceNodeParam:
7336     @@@@XSourceCodeParam:
7337 wakaba 1.13 @@@@XParam:
7338 wakaba 1.15 @@@@@QName:elementType
7339 wakaba 1.13 @@@@@enDesc:
7340 wakaba 1.15 The element type of the preprocessing instruction.
7341 wakaba 1.14 @@@XSubTypeDef:
7342 wakaba 1.15 @@@@QName: PERL_PREPROCESS_NO_FOR_ERR
7343 wakaba 1.14 @@@@enDesc:
7344 wakaba 1.15 A <QUOTE::for> specification is required.
7345 wakaba 1.14 @@@@XSourceNodeParam:
7346 wakaba 1.15 @@@@XSourceCodeParam:
7347 wakaba 1.14 @@@@XParam:
7348 wakaba 1.15 @@@@@QName:elementType
7349 wakaba 1.14 @@@@@enDesc:
7350 wakaba 1.15 The element type of the preprocessing instruction.
7351     @@@XSubTypeDef:
7352     @@@@QName: PERL_PREPROCESS_NO_ASSERT_TYPE_ERR
7353     @@@@enDesc:
7354     An assertion type specification is required.
7355     @@@@XSourceNodeParam:
7356     @@@@XSourceCodeParam:
7357 wakaba 1.14 @@@@XParam:
7358 wakaba 1.15 @@@@@QName:elementType
7359 wakaba 1.14 @@@@@enDesc:
7360 wakaba 1.15 The element type of the preprocessing instruction.
7361     @@@XSubTypeDef:
7362     @@@@QName: PERL_PREPROCESS_BLOCK_NOT_ALLOWED_ERR
7363     @@@@enDesc:
7364     A preprocessing instruction block occurred with
7365     element type which does not allow it.
7366     @@@@XSourceNodeParam:
7367     @@@@XSourceCodeParam:
7368 wakaba 1.14 @@@@XParam:
7369     @@@@@QName:elementType
7370     @@@@@enDesc:
7371 wakaba 1.15 The element type of the preprocessing instruction.
7372 wakaba 1.18 @@@XSubTypeDef:
7373     @@@@QName: NON_NAMED_PARAMETER_AFTER_NAMED_ERR
7374     @@@@enDesc:
7375     A non-named method parameter following
7376     any named method parameter is occurred.
7377     @@@@XSourceNodeParam:
7378     @@@@XParam:
7379     @@@@@QName:uri
7380     @@@@@enDesc:
7381     The URI reference of the non-named method parameter resource.
7382     @@@@XParam:
7383     @@@@@QName:localName
7384     @@@@@enDesc:
7385     The local name of the non-named method parameter.
7386 wakaba 1.19 @@@XSubTypeDef:
7387     @@@@QName:DISPERL_NO_VALUE_ALLOWED_ERR
7388     @@@@enDesc:
7389     An element node have a value but the definition
7390     of that element type does not allow it.
7391     @@@@XSourceNodeParam:
7392     @@@@XParam:
7393     @@@@@QName:elementType
7394     @@@@@enDesc:
7395     The element type URI reference of the element.
7396     @@@XSubTypeDef:
7397     @@@@QName:NO_CONST_VALUE_ERR
7398     @@@@enDesc:
7399     The source element node for a constant value resource
7400     does not have <Q::dis:Value> attribute.
7401     @@@@XSourceNodeParam:
7402     @@@@XParam:
7403     @@@@@QName:elemntType
7404     @@@@@enDesc:
7405     The element type URI reference of the element from which
7406     a constant value resource is referred.
7407     @@@@XParam:
7408     @@@@@QName:uri
7409     @@@@@enDesc:
7410     The resource URI reference of the constant value resource.
7411     @@@@XParam:
7412     @@@@@QName:localName
7413     @@@@@enDesc:
7414     The local name of the constant value resource.
7415     @@@XSubTypeDef:
7416     @@@@QName:NO_ATTR_SET_ERR
7417     @@@@enDesc:
7418     An attribute setter is referred but the attribute
7419     does not define any setter.
7420     @@@@XSourceNodeParam:
7421     @@@@XParam:
7422     @@@@@QName:errResource
7423     @@@@@enDesc:
7424     The attribute resource.
7425     @@@@XParam:
7426     @@@@@QName:elementType
7427     @@@@@enDesc:
7428     The type of the element by which this attribute
7429     is referred.
7430 wakaba 1.20 @@@XSubTypeDef:
7431     @@@@QName: PERL_SUBROUTINE_ALREADY_DEFINED_ERR
7432     @@@@enDesc:
7433     A resource defines a Perl subroutine whose name is
7434     same as another subroutine.
7435     @@@@XSourceNodeParam:
7436     @@@@XParam:
7437     @@@@@QName:uri
7438     @@@@@enDesc:
7439     The URI reference of the resource that defines the Perl subroutine.
7440     @@@@XParam:
7441     @@@@@QName:
7442     PerlCode:localName
7443     @@@@@enDesc:
7444     The name of the Perl subroutine.
7445     @@@XSubTypeDef:
7446     @@@@QName: PERL_OPERATOR_ALREADY_OVERLOADED_ERR
7447     @@@@enDesc:
7448     A resource is defined to overload a Perl operator which
7449     is already overloaded by another resource.
7450     @@@@XSourceNodeParam:
7451     @@@@XParam:
7452     @@@@@QName:uri
7453     @@@@@enDesc:
7454     The URI reference of the resource that defines the overloading.
7455     @@@@XParam:
7456     @@@@@QName:
7457     PerlCode:operator
7458     @@@@@enDesc:
7459     The operator.
7460     @@@XSubTypeDef:
7461     @@@@QName: PERL_UNUSED_SUBROUTINE_ERR
7462     @@@@enDesc:
7463     A resource defines a Perl subroutine but it is not used.
7464     @@@@XSourceNodeParam:
7465     @@@@XParam:
7466     @@@@@QName:uri
7467     @@@@@enDesc:
7468     The URI reference of the resource.
7469 wakaba 1.22 @@@XSubTypeDef:
7470     @@@@QName: NO_LICENSE_ATTR_ERR
7471     @@@@enDesc:
7472     The <Q::dis:Module> element does not have the
7473     <Q::dis:License> attribute.
7474     @@@@XSourceNodeParam:
7475     @@@@XParam:
7476     @@@@@QName:uri
7477     @@@@@enDesc:
7478     The URI reference of the module.
7479 wakaba 1.25 @@@XSubTypeDef:
7480     @@@@QName: UNSUPPORTED_ROLE_ERR
7481     @@@@enDesc:
7482     A <Q::dis:Role> is not supported.
7483     @@@@XSourceNodeParam:
7484     @@@@XParam:
7485     @@@@@QName:uri
7486     @@@@@enDesc:
7487     The URI reference of the unsupported role.
7488     @@@@enMufDef:
7489     Role <%p (name => {<Q::DIS:uri>});> is not supported
7490 wakaba 1.37 @@@XSubTypeDef:
7491     @@@@QName: NO_REFLECT_GET_DEFINED_ERR
7492     @@@@enDesc:
7493     An attribute is defined to reflect an element attribute
7494     but no reflecting attribute getter template is defined.
7495     @@@@XSourceNodeParam:
7496     @@@@XParam:
7497     @@@@@QName:uri
7498     @@@@@enDesc:
7499     The URI reference of the datatype resource for which
7500     a getter template should have been defined.
7501     @@@XSubTypeDef:
7502     @@@@QName: NO_REFLECT_SET_DEFINED_ERR
7503     @@@@enDesc:
7504     An attribute is defined to reflect an element attribute
7505     but no reflecting attribute setter template is defined.
7506     @@@@XSourceNodeParam:
7507     @@@@XParam:
7508     @@@@@QName:uri
7509     @@@@@enDesc:
7510     The URI reference of the datatype resource for which
7511     a setter template should have been defined.
7512 wakaba 1.40 @@@XSubTypeDef:
7513 wakaba 1.43 @@@@QName: NO_END_TAG_ERR
7514     @@@@enDesc:
7515 wakaba 1.40 Close tag not found.
7516 wakaba 1.43 @@@@XSourceNodeParam:
7517     @@@@XParam:
7518 wakaba 1.49 @@@@@@: elementType
7519     @@@@@enDesc:
7520 wakaba 1.40 The type URI reference of the element that is not closed.
7521 wakaba 1.43 @@@@XParam:
7522 wakaba 1.49 @@@@@@: sourceCode
7523     @@@@@enDesc:
7524 wakaba 1.40 The source code fragment near the position where
7525     an end tag is required.
7526 wakaba 1.43 @@@@enMufDef:
7527 wakaba 1.40 End tag for element "%p (name => {<Q::DIS:elementType>});"
7528 wakaba 1.43 is required%p (name => {<Q::DIS:sourceCode>},
7529     prefix => { (}, suffix => {)});
7530 wakaba 1.49 @@@XSubTypeDef:
7531     @@@@QName: NO_RDF_TYPE_ERR
7532     @@@@enDesc:
7533     There is a resource definition element that does
7534     not have any <Q::rdf:type> attribute.
7535     @@@@XSourceNodeParam:
7536     @@@@XParam:
7537     @@@@@@: uri
7538     @@@@@enDesc:
7539     The URI of the resource which does not have <Q::rdf:type>.
7540     @@@@enMufDef:
7541     Resource%p (name => {<Q::DIS:uri>}, prefix => { "},
7542     suffix => {"}); does not have "rdf:type" attribute
7543 wakaba 1.53 @@@XSubTypeDef:
7544     @@@@QName: PERL_HASH_KEY_ALREADY_DEFINED_ERR
7545     @@@@enDesc:
7546     A hash key is already defined.
7547     @@@@XSourceNodeParam:
7548     @@@@XParam:
7549     @@@@@@:uri
7550     @@@@@enDesc:
7551     The URI of the resource tried to register.
7552     @@@@XParam:
7553     @@@@@@:anotherURI
7554     @@@@@enDesc:
7555     The URI of the already registered resource.
7556     @@@@XParam:
7557     @@@@@@:hashKeyName
7558     @@@@@enDesc:
7559     Hash key.
7560     @@@@XParam:
7561     @@@@@@:hashKeyScope
7562     @@@@@enDesc:
7563     Hash key scope.
7564     @@@@enMufDef:
7565     <%p (name => {<Q::DIS:uri>});>:
7566 wakaba 1.56 Hash key "%p (name => {<Q::DIS:hashKeyName>});" in
7567 wakaba 1.53 <%p (mame => {<Q::DIS:hashKeyScope>});> is already
7568 wakaba 1.54 defined for <%p (name => {<Q::DIS:anotherURI>});>
7569 wakaba 1.63 @@@XSubTypeDef:
7570     @@@@QName: DIS|NO_EXCEPTION_CLASS_ERR
7571     @@@@enDesc:
7572     The exception interface has no class that implements the interface.
7573     @@@@enMufDef:
7574     Exception interface <%p (name => {<Q::DIS:uri>});>:
7575     There is no class that implements this interface
7576     @@@@XParam:
7577     @@@@@@: DIS|uri
7578     @@@@@enDesc:
7579     The URI of the interface.
7580 wakaba 1.37 @ImplNote:
7581     @@lang:en
7582     @@@:
7583     ISSUE: Too many subtypes for a type! New type should be added?
7584 wakaba 1.71
7585     @Attr:
7586     @@Name: text
7587     @@enDesc:
7588     The description of the error, in <LANG::i-default> language.
7589     @@enImplNote:
7590     See <A::dx|Exception.text> for super definition.
7591     @@Type: DISLang|String
7592     @@Get:
7593     @@@PerlDef:
7594     $r = $self->SUPER::text;
7595     if (defined $self->{<H::DIS:sourceNode>}) {
7596     $r = 'Node ' . $self->{<H::DIS:sourceNode>}-><M::SWCFGNode.nodePath>
7597     . ': ' . $r;
7598     }
7599 wakaba 1.4 ##DISException
7600 wakaba 1.71
7601     ElementTypeBinding:
7602     @Name: enImplNote
7603     @ElementType:
7604     dis:ImplNote
7605     @ShadowContent:
7606     @@lang:en
7607 wakaba 1.53
7608     XParamDef:
7609     @QName: hashKeyName
7610     @Type: DISLang|String
7611     @enDesc:
7612     See <M::dp|DISDatabasePerl.plAddHashKey>.
7613    
7614     XParamDef:
7615     @QName: hashKeyScope
7616     @Type: AnyURI
7617     @enDesc:
7618     See <M::dp|DISDatabasePerl.plAddHashKey>.
7619    
7620     XParamDef:
7621     @QName: anotherURI
7622     @Type: ResourceURI
7623     @enDesc:
7624     A URI of another related resource.
7625 wakaba 1.13
7626     XParamDef:
7627     @QName:expectedType
7628     @Type: ResourceURI
7629     @enDesc:
7630     Expected resource type URI reference.
7631    
7632     XParamDef:
7633     @QName: sourceCode
7634     @Type:
7635     DISLang:String::ManakaiDOM:all
7636     @enDesc:
7637     The source code fragment in which an error occurred.
7638 wakaba 1.5
7639     XParamDef:
7640     @QName: elementType
7641     @Type: ResourceURI
7642     @enDesc:
7643     The name of the element type.
7644    
7645     XParamDef:
7646     @QName: uri
7647     @Type: ResourceURI
7648     @enDesc:
7649     The name of the resource, composed from <Q::namespaceURI>,
7650     <Q::localName> and <Q::for>.
7651    
7652     XParamDef:
7653     @QName: localName
7654     @Type:
7655 wakaba 1.18 DISCore:LocalName::ManakaiDOM:all
7656 wakaba 1.5 @enDesc:
7657     The local name of the resource, unique in <Q::namespaceURI> namespace.
7658    
7659     XParamDef:
7660     @QName: namespaceURI
7661     @Type: AnyURI
7662     @enDesc:
7663     The namespace URI reference of the resource name.
7664    
7665     XParamDef:
7666     @QName: for
7667     @Type: ForURI
7668     @enDesc:
7669     The <QUOTE::for> URI reference of the resource.
7670    
7671     ElementTypeBinding:
7672     @Name: XSourceNodeParam
7673     @ElementType:
7674 wakaba 1.64 ecore:hasParameter
7675 wakaba 1.5 @ShadowContent:
7676     @@QName: sourceNode
7677     @@Description:
7678     @@@lang:en
7679     @@@@:
7680     The node in which an error has occurred.
7681 wakaba 1.15
7682     ElementTypeBinding:
7683     @Name: XSourceCodeParam
7684     @ElementType:
7685 wakaba 1.64 ecore:hasParameter
7686 wakaba 1.15 @ShadowContent:
7687     @@QName: sourceCode
7688     @@Description:
7689     @@@lang:en
7690     @@@@:
7691     The source code in which an error has occurred.
7692 wakaba 1.4
7693 wakaba 1.52 ResourceDef:
7694     @QName: ManakaiDISExceptionTarget
7695     @AliasFor: dx|ManakaiDefaultExceptionHandler||ManakaiDOM|Perl
7696     @For: DIS|ForEmpty
7697 wakaba 1.4
7698 wakaba 1.52 ElementTypeBinding:
7699     @Name: plMName
7700     @ElementType:
7701     DISPerl:methodName
7702     @ShadowContent:
7703     @@ContentType: lang|Perl
7704     @@For: ManakaiDOM|Perl
7705 wakaba 1.4
7706     ElementTypeBinding:
7707 wakaba 1.52 @Name: plCName
7708 wakaba 1.4 @ElementType:
7709 wakaba 1.52 DISPerl:exportTagName
7710 wakaba 1.4 @ShadowContent:
7711 wakaba 1.47 @@ContentType: lang|Perl
7712     @@For: ManakaiDOM|Perl
7713 wakaba 1.3
7714     ElementTypeBinding:
7715     @Name: Method
7716     @ElementType:
7717     dis:ResourceDef
7718     @ShadowContent:
7719     @@rdf:type:
7720     DISLang:Method
7721 wakaba 1.52 @@For: !=ForEmpty
7722 wakaba 1.3
7723     ElementTypeBinding:
7724     @Name: IntMethod
7725     @ElementType:
7726     dis:ResourceDef
7727     @ShadowContent:
7728     @@rdf:type:
7729     DISLang:Method
7730     @@ManakaiDOM:isForInternal:1
7731 wakaba 1.52 @@ForCheck: ManakaiDOM|ForClass
7732 wakaba 1.3
7733     ElementTypeBinding:
7734     @Name: Attr
7735     @ElementType:
7736     dis:ResourceDef
7737     @ShadowContent:
7738     @@rdf:type:
7739     DISLang:Attribute
7740 wakaba 1.52 @@For: !=ForEmpty
7741 wakaba 1.3
7742     ElementTypeBinding:
7743     @Name: Return
7744     @ElementType:
7745     dis:ResourceDef
7746     @ShadowContent:
7747     @@rdf:type:
7748     DISLang:MethodReturn
7749    
7750     ElementTypeBinding:
7751     @Name: Get
7752     @ElementType:
7753     dis:ResourceDef
7754     @ShadowContent:
7755     @@rdf:type:
7756     DISLang:AttributeGet
7757    
7758     ElementTypeBinding:
7759     @Name: Set
7760     @ElementType:
7761     dis:ResourceDef
7762     @ShadowContent:
7763     @@rdf:type:
7764     DISLang:AttributeSet
7765    
7766     ElementTypeBinding:
7767     @Name: Param
7768     @ElementType:
7769     dis:ResourceDef
7770     @ShadowContent:
7771     @@rdf:type:
7772     DISLang:MethodParameter
7773    
7774     ElementTypeBinding:
7775     @Name: PerlDef
7776     @ElementType:
7777     dis:Def
7778     @ShadowContent:
7779     @@ContentType:
7780     lang:Perl
7781    
7782     ElementTypeBinding:
7783     @Name: InCase
7784     @ElementType:
7785     dis:ResourceDef
7786     @ShadowContent:
7787     @@rdf:type:
7788     ManakaiDOM:InCase
7789    
7790     ElementTypeBinding:
7791     @Name: nullCase
7792     @ElementType:
7793     dis:ResourceDef
7794     @ShadowContent:
7795     @@rdf:type:
7796     ManakaiDOM:InCase
7797     @@Value:
7798     @@@is-null:1
7799 wakaba 1.49 @@@ContentType: DISCore|String
7800 wakaba 1.3
7801     ElementTypeBinding:
7802     @Name: TrueCase
7803     @ElementType:
7804     dis:ResourceDef
7805     @ShadowContent:
7806     @@rdf:type:
7807     ManakaiDOM:InCase
7808 wakaba 1.49 @@Value:
7809     @@@@: 1
7810     @@@ContentType: DISCore|Boolean
7811 wakaba 1.3 @@Type:
7812 wakaba 1.18 DOMMain:boolean::ManakaiDOM:all
7813 wakaba 1.3
7814     ElementTypeBinding:
7815     @Name: FalseCase
7816     @ElementType:
7817     dis:ResourceDef
7818     @ShadowContent:
7819     @@rdf:type:
7820     ManakaiDOM:InCase
7821 wakaba 1.49 @@Value:
7822     @@@@: 0
7823     @@@ContentType: DISCore|Boolean
7824 wakaba 1.3 @@Type:
7825 wakaba 1.18 DOMMain:boolean::ManakaiDOM:all
7826 wakaba 1.3
7827     ElementTypeBinding:
7828     @Name: enDesc
7829     @ElementType:
7830     dis:Description
7831     @ShadowContent:
7832     @@lang:en
7833    
7834     ElementTypeBinding:
7835     @Name: PropDef
7836     @ElementType:
7837     dis:ResourceDef
7838     @ShadowContent:
7839     @@rdf:type:
7840     rdf:Property
7841 wakaba 1.49 @@For:
7842 wakaba 1.54 =ManakaiDOM|all
7843 wakaba 1.3
7844     ElementTypeBinding:
7845     @Name: MethodRedef
7846     @ElementType:
7847     dis:ResourceDef
7848     @ShadowContent:
7849     @@rdf:type:
7850     DISLang:Method
7851    
7852     ElementTypeBinding:
7853     @Name: NamedParam
7854     @ElementType:
7855     dis:ResourceDef
7856     @ShadowContent:
7857     @@rdf:type:
7858     DISLang:MethodParameter
7859     @@DISPerl:isNamedParameter:1
7860    
7861     ElementTypeBinding:
7862     @Name: NodeParam
7863     @ElementType:
7864     dis:ResourceDef
7865     @ShadowContent:
7866     @@rdf:type:
7867     DISLang:MethodParameter
7868     @@DISPerl:isNamedParameter:1
7869     @@Name: node
7870 wakaba 1.47 @@Type: DISNode
7871     @@actualType:
7872     @@@@: ManakaiDISNode
7873     @@@ForCheck: ManakaiDOM|ForClass
7874 wakaba 1.3 @@Description:
7875     @@@lang:en
7876     @@@@:
7877     The node in which the name has occurred. It is intended
7878     to be reported when an exception had been raised.
7879     @@ResourceDef:
7880     @@@rdf:type:
7881     ManakaiDOM:InCase
7882     @@@Value:
7883     @@@@is-null:1
7884 wakaba 1.49 @@@@ContentType: DISCore|String
7885 wakaba 1.3 @@@Description:
7886     @@@@lang:en
7887     @@@@@:
7888     The source of the name is not a node.
7889    
7890     ElementTypeBinding:
7891     @Name: ForParam
7892     @ElementType:
7893     dis:ResourceDef
7894     @ShadowContent:
7895     @@rdf:type:
7896     DISLang:MethodParameter
7897     @@DISPerl:isNamedParameter:1
7898     @@Name: forArg
7899     @@Type: ForURI
7900     @@Description:
7901     @@@lang:en
7902     @@@@:
7903     The <QUOTE::for> URI reference.
7904     @@ResourceDef:
7905     @@@rdf:type:
7906     ManakaiDOM:InCase
7907     @@@Value:
7908     @@@@is-null:1
7909 wakaba 1.49 @@@@ContentType: DISCore|String
7910 wakaba 1.3 @@@Description:
7911     @@@@lang:en
7912     @@@@@:
7913     Equivalent to <Q::ManakaiDOM:all>, i.e. <QUOTE::for all>.
7914    
7915     ElementTypeBinding:
7916     @Name: ForpParam
7917     @ElementType:
7918     dis:ResourceDef
7919     @ShadowContent:
7920     @@rdf:type:
7921     DISLang:MethodParameter
7922     @@DISPerl:isNamedParameter:1
7923     @@Name: forpArg
7924     @@Type: ForURIList
7925     @@Description:
7926     @@@lang:en
7927     @@@@:
7928     An array reference containing additional <QUOTE::for>
7929     constraints (<QUOTE::For+> list).
7930     @@ResourceDef:
7931     @@@rdf:type:
7932     ManakaiDOM:InCase
7933     @@@Value:
7934     @@@@is-null:1
7935 wakaba 1.49 @@@@ContentType: DISCore|String
7936 wakaba 1.3 @@@Description:
7937     @@@@lang:en
7938     @@@@@:
7939     Equivalent to the empty array reference.
7940    
7941     ElementTypeBinding:
7942     @Name: MediaTypeParam
7943     @ElementType:
7944     dis:ResourceDef
7945     @ShadowContent:
7946     @@rdf:type:
7947     DISLang:MethodParameter
7948     @@DISPerl:isNamedParameter:1
7949     @@Name: mediaType
7950     @@Type: MediaTypeURI
7951     @@Description:
7952     @@@lang:en
7953     @@@@:
7954     The URI reference identifying a media type.
7955     @@ResourceDef:
7956     @@@rdf:type:
7957     ManakaiDOM:InCase
7958     @@@Value:
7959     @@@@is-null:1
7960 wakaba 1.49 @@@@ContentType: DISCore|String
7961 wakaba 1.3 @@@Description:
7962     @@@@lang:en
7963     @@@@@:
7964     No media type specified.
7965    
7966     ElementTypeBinding:
7967     @Name: MediaTypeDefaultParam
7968     @ElementType:
7969     dis:ResourceDef
7970     @ShadowContent:
7971     @@rdf:type:
7972     DISLang:MethodParameter
7973     @@DISPerl:isNamedParameter:1
7974     @@Name: defaultMediaType
7975     @@Type: MediaTypeURI
7976     @@Description:
7977     @@@lang:en
7978     @@@@:
7979     The default media type, i.e. the type used when no explicit
7980     specification is not found in the source tree.
7981     @@ResourceDef:
7982     @@@rdf:type:
7983     ManakaiDOM:InCase
7984     @@@Value:
7985     @@@@is-null:1
7986 wakaba 1.49 @@@@ContentType: DISCore|String
7987 wakaba 1.3 @@@Description:
7988     @@@@lang:en
7989     @@@@@:
7990     Defaulted to <Q::DOMMain:any>.
7991    
7992     ElementTypeBinding:
7993     @Name: RaiseException
7994     @ElementType:
7995     ManakaiDOM:raises
7996    
7997     ElementTypeBinding:
7998     @Name: UndeclaredPrefixException
7999     @ElementType:
8000     ManakaiDOM:raises
8001     @ShadowContent:
8002     @@@: UNDECLARED_NS_PREFIX_ERR
8003     @@Description:
8004     @@@lang:en
8005     @@@@:
8006     The implementation has encounted an undeclared namespace prefix.
8007    
8008     ElementTypeBinding:
8009     @Name: NoDBException
8010     @ElementType:
8011     ManakaiDOM:raises
8012     @ShadowContent:
8013 wakaba 1.47 @@@: NO_ASSOCIATED_DB_ERR
8014 wakaba 1.3 @@Description:
8015     @@@lang:en
8016     @@@@:
8017     No <QUOTE::dis> database is associated to this document.
8018    
8019     ElementTypeBinding:
8020     @Name: XConstDef
8021     @ElementType:
8022     dis:ResourceDef
8023     @ShadowContent:
8024 wakaba 1.63 @@rdf:type: dx|ErrorCode
8025 wakaba 1.3
8026     ElementTypeBinding:
8027     @Name: XSubTypeDef
8028     @ElementType:
8029     dis:ResourceDef
8030     @ShadowContent:
8031 wakaba 1.63 @@rdf:type: dx|ErrorSubCode
8032 wakaba 1.3
8033     ElementTypeBinding:
8034     @Name: XParam
8035     @ElementType:
8036 wakaba 1.63 ecore:hasParameter
8037 wakaba 1.3
8038     ElementTypeBinding:
8039     @Name: XParamDef
8040     @ElementType:
8041     dis:ResourceDef
8042     @ShadowContent:
8043 wakaba 1.63 @@rdf:type: ecore|Parameter
8044     @@For: =ManakaiDOM|all
8045 wakaba 1.54
8046     XParamDef:
8047     @QName: DIS|moduleURI
8048     @enDesc:
8049     A URI of the module in which the resource is defined.
8050 wakaba 1.3
8051     ElementTypeBinding:
8052     @Name: enMufDef
8053     @ElementType:
8054 wakaba 1.68 ecore:defaultMessage
8055 wakaba 1.3 @ShadowContent:
8056     @@ContentType:
8057     lang:muf
8058     @@lang:en

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24