/[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.81 - (hide annotations) (download)
Mon Feb 20 09:03:13 2006 UTC (19 years, 5 months ago) by wakaba
Branch: MAIN
Changes since 1.80: +270 -23 lines
++ manakai/lib/Message/Util/ChangeLog	20 Feb 2006 08:59:54 -0000
2006-02-20  Wakaba  <wakaba@suika.fam.cx>

	* DIS.dis (isPropertyElement): The |DISCore:resourceType|
	element type is now recognized as a property.  In addition,
	element types that are a |DISSource:Property| are
	properties.
	(DIS:AnyMethod, DIS:Method, DIS:Attribute): New types.
	(DIS:targetType): New property.
	(DISModule, DISFor, DISResource, DISDatabase): These
	classes no longer inherits |ManakaiDISExceptionTarget|.
	(DISDatabase.loadResource): Reads |DISCore:resourceType| property
	as well as |rdf:type| property.
	(DISAnyResource.MUErrorHandler, DISDatabase.MUErrorHandler): New
	methods.
	(DISDatabase.domConfig): New attribute.
	(error-handler): New configuration parameter.
	(getMethodForType): New code fragment.
	(DIS:more-than-one-methods-for-a-type): New error.
	(ManakaiDISExceptionTarget): Removed.

++ manakai/lib/Message/Util/DIS/ChangeLog	20 Feb 2006 09:01:28 -0000
2006-02-20  Wakaba  <wakaba@suika.fam.cx>

	* Perl.dis (plStore): Don't store |error-handler| configuration
	parameter value.
	(plGeneratePerlModule): The |DIS:AnyMethod| type support
	is added.
	(plName): Split by resource types.

	* DNLite.dis (isPropertyElement): The |DISCore:resourceType|
	element type is now recognized as a property.  In addition,
	element types that are a |DISSource:Property| are
	properties.

++ manakai/lib/manakai/ChangeLog	20 Feb 2006 09:02:52 -0000
2006-02-20  Wakaba  <wakaba@suika.fam.cx>

	* DISRDF.dis: The |DISCore:resourceType| property
	is added to resource definitions.

	* DISCore.dis: The |rdf:type| properties are
	replaced by new |DISCore:resourceType| property type.

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

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24