/[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.54 - (hide annotations) (download)
Sun Sep 25 14:53:03 2005 UTC (19 years, 9 months ago) by wakaba
Branch: MAIN
Changes since 1.53: +355 -117 lines
++ manakai/bin/ChangeLog	25 Sep 2005 14:45:44 -0000
2005-09-25  Wakaba  <wakaba@suika.fam.cx>

	* dac.pl, dac2pm.pl, mkdisdump.pl: Parameters "--dis-file-suffix",
	"--daem-file-suffix", "--search-path-catalog-file-name", and
	"--search-path" added.  New dae and daem database format support.
	(dac_search_file_stem): New function.

++ manakai/lib/Message/Markup/ChangeLog	25 Sep 2005 14:47:09 -0000
2005-09-25  Wakaba  <wakaba@suika.fam.cx>

	* Makefile (DAC_SUFFIX): Changed to ".dae".
	(DAEM_SUFFIX): New.

++ manakai/lib/Message/Util/ChangeLog	25 Sep 2005 14:50:33 -0000
2005-09-25  Wakaba  <wakaba@suika.fam.cx>

	* DIS.dis (RESOURCE_NOT_DEFINED_ERR): New error code.
	(getResource): New "dae" and "daem" database format support.
	(DISResourceList): New type.
	(uriRef, ownerModuleURI, ownerModuleURIRef): New attributes.
	(addChildResource, addDynamicChildResource): New methods.
	(getChildResourceList, getDynamicChildResourceList): New method.
	(getChildResourceListByType): New method.
	(parentResource, dynamicParentResource): New attributes.

	* Makefile (DAC_SUFFIX): Changed to ".dae".
	(DAEM_SUFFIX): New.

++ manakai/lib/Message/Util/DIS/ChangeLog	25 Sep 2005 14:52:26 -0000
2005-09-25  Wakaba  <wakaba@suika.fam.cx>

	* Perl.dis (plLoadDISDatabase): New "moduleResolver" parameter
	added.
	(plStore): New "moduleResolver" parameter added.
	(plLoadDISDatabaseModule): New method.

++ manakai/lib/Message/DOM/ChangeLog	25 Sep 2005 14:47:15 -0000
2005-09-25  Wakaba  <wakaba@suika.fam.cx>

	* Makefile (DAC_SUFFIX): Changed to ".dae".
	(DAEM_SUFFIX): New.

++ manakai/lib/manakai/ChangeLog	25 Sep 2005 14:46:50 -0000
2005-09-25  Wakaba  <wakaba@suika.fam.cx>

	* Makefile (DAC_SUFFIX): Changed to ".dae".
	(DAEM_SUFFIX): New.

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

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24