/[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.67 - (hide annotations) (download)
Wed Oct 12 14:46:02 2005 UTC (19 years, 9 months ago) by wakaba
Branch: MAIN
Changes since 1.66: +2 -2 lines
++ manakai/lib/Message/Util/ChangeLog	12 Oct 2005 14:38:20 -0000
2005-10-12  Wakaba  <wakaba@suika.fam.cx>

	* PerlCode.dis (ForClassCompat): Removed.

	* ManakaiNode.dis (ManakaiDOMNodeObject, ManakaiDOMNodeReference):
	Removed.
	(newNode): New method.
	(generateUniqueID): Algorithm has changed to save random
	string generation time.

	* DIS.dis (AUTOLOAD): "$Error::Level" fixed to "$Error::Depth".

++ manakai/lib/Message/DOM/ChangeLog	12 Oct 2005 14:30:20 -0000
2005-10-12  Wakaba  <wakaba@suika.fam.cx>

	* DOMCore.dis: Don't set "infoset:prefix" internal
	property unless it has non-null value.
	(newObject): "refNode" parameter introduced.
	(ManakaiDOMNode.newObject): Calls "NodeStem.newNode"
	method if "refNode" parameter is specified.
	(cloneNode): Don't set "read-only" flag.
	(getNodeReference): Caches the result.
	(selectAttributeNodeForRemove): Don't removes any other
	non-namespace-aware attribute nodes.

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

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24