/[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.74 - (hide annotations) (download)
Tue Dec 20 12:16:49 2005 UTC (19 years, 6 months ago) by wakaba
Branch: MAIN
Changes since 1.73: +4 -1 lines
++ manakai/bin/ChangeLog	20 Dec 2005 12:03:40 -0000
2005-12-20  Wakaba  <wakaba@suika.fam.cx>

	* dac2pm.pl: Now requires GenericLS module.

++ manakai/lib/Message/Markup/ChangeLog	20 Dec 2005 12:04:20 -0000
2005-12-20  Wakaba  <wakaba@suika.fam.cx>

	* Makefile: |PERL_OPTIONS| variables updated to new definition.

++ manakai/lib/Message/Util/ChangeLog	20 Dec 2005 12:04:47 -0000
2005-12-20  Wakaba  <wakaba@suika.fam.cx>

	* DIS.dis: DPG format support added.

++ manakai/lib/Message/Util/DIS/ChangeLog	20 Dec 2005 12:14:00 -0000
2005-12-20  Wakaba  <wakaba@suika.fam.cx>

	* DPG.dis (plCodeFragment): Output code to check lower bound
	of range even if it is zero (U+0000) since an negative value
	might occur to indicate end of file.  Code to generate |redo|
	statement is missing.  Embed statement with type |lang:Perl|
	support added.  Return value of |$next_token_required| was
	missing in some cases.  Ruleref cache now takes |$next_token_required|
	values into acount.  Parameter (for parser subroutine) support
	was missing.
	(DPGParser.DISPerl:dpgDef): DPG definition for the DPG textual
	syntax merged.

	* Perl.dis: Now requires |DPG| module.
	(plGeneratePerlModule): Obsolete property name
	|DOMMetaImpl:providedThrough| changed into |f:through| so
	that |f:through|s in "dis" modules now works.  In addition,
	its default code was misplaced.  |DISPerl:dpgDef| attribute
	is supported so that DPG code are converted into a set of
	methods.

	* Value.dis: DPG (|lang:dpg|) support added.

2005-12-19  Wakaba  <wakaba@suika.fam.cx>

	* DPG.dis (pg:lAssignmentStatement): Typo in element type name
	fixed.
	(DPGParser): New interface.

++ manakai/lib/manakai/ChangeLog	20 Dec 2005 12:16:38 -0000
2005-12-20  Wakaba  <wakaba@suika.fam.cx>

	* Makefile: Definitions for |PERL_OPTIONS| family updated.

	* DISPerl.dis (DISPerl:dpgDef): New property.

2005-12-19  Wakaba  <wakaba@suika.fam.cx>

	* DISPerl.dis (lang:dpg): New format.
	(lang:Perl): Now it is a subclass of |DISCore:DISString|
	rather than |DISCore:NSString| (since it depends on various
	"dis" contexts not only namespaces).

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

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24