/[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.109 - (hide annotations) (download)
Sat Dec 30 08:27:50 2006 UTC (18 years, 6 months ago) by wakaba
Branch: MAIN
Changes since 1.108: +2 -2 lines
++ manakai/bin/ChangeLog	30 Dec 2006 06:47:17 -0000
2006-12-30  Wakaba  <wakaba@suika.fam.cx>

	* idl2dis.pl: Removed.

++ manakai/lib/Message/Markup/ChangeLog	30 Dec 2006 08:26:03 -0000
	* Atom.dis, SuikaWiki.dis, H2H.dis: |WithFor|
	and |DefaultFor| properties are removed.

2006-12-30  Wakaba  <wakaba@suika.fam.cx>

++ manakai/lib/Message/Util/ChangeLog	30 Dec 2006 08:26:59 -0000
	* PerlCode.dis: |WithFor| and |DefaultFor| are removed.

2006-12-30  Wakaba  <wakaba@suika.fam.cx>

++ manakai/lib/Message/DOM/ChangeLog	30 Dec 2006 08:25:38 -0000
        GenericLS.dis, TreeCore.dis, DOMString.dis,
        XML.dis, Element.dis, Document.dis, TreeStore,dis,
        Traversal.dis, XDoctype.dis, XMLParser.dis, DOMLS.dis,
        SimpleLS.dis, DOMMain.dis, XDP.dis: |WithFor| specifications
	and |DefaultFor|s are removed.

2006-12-30  Wakaba  <wakaba@suika.fam.cx>

	* CharacterData.dis, DOMCore.dis, DOMFeature.dis,
++ manakai/lib/Message/URI/ChangeLog	30 Dec 2006 08:26:32 -0000
	* Generic.dis: |WithFor| and |DefaultFor| are removed.

2006-12-30  Wakaba  <wakaba@suika.fam.cx>

++ manakai/lib/Message/Charset/ChangeLog	30 Dec 2006 08:24:04 -0000
	* Encode.dis (Require): |WithFor| specifications are removed.
	(DefaultFor): Removed.

2006-12-30  Wakaba  <wakaba@suika.fam.cx>

++ manakai/lib/manakai/ChangeLog	30 Dec 2006 07:46:56 -0000
2006-12-30  Wakaba  <wakaba@suika.fam.cx>

	* dis.pl: Removed.

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

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24