/[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.87 - (hide annotations) (download)
Fri Feb 24 11:28:33 2006 UTC (19 years, 4 months ago) by wakaba
Branch: MAIN
Changes since 1.86: +35 -1 lines
++ manakai/lib/Message/Util/ChangeLog	24 Feb 2006 11:27:47 -0000
	* DIS.dis (loadModule): Adds name URIs of |Require|d
	modules to the list of such modules.
	(DIS:forURI): New property.
	(getReferringModuleURIList, addReferringModuleURI): New methods.
	(DIS:referringModule): New property.

2006-02-24  Wakaba  <wakaba@suika.fam.cx>

++ manakai/lib/Message/Util/DIS/ChangeLog	24 Feb 2006 11:28:23 -0000
	* Perl.dis (plUpdateModule): New method.
	(plLoadDISDatabaseIndex): New method.

2006-02-24  Wakaba  <wakaba@suika.fam.cx>

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

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24