/[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.110 - (hide annotations) (download)
Sat Dec 30 12:00:42 2006 UTC (18 years, 6 months ago) by wakaba
Branch: MAIN
Changes since 1.109: +204 -319 lines
++ manakai/lib/Message/Markup/ChangeLog	30 Dec 2006 11:55:48 -0000
	* Atom.dis, SuikaWiki.dis, H2H.dis, SuikaWikiConfig21.dis: |For|
	specifications are removed.

	* SuikaWikiConfig21.dis: |WithFor| and |DefaultFor|
	specifications are removed.
	(ForEmpty, ForLatest): Removed.

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

++ manakai/lib/Message/Util/ChangeLog	30 Dec 2006 11:57:42 -0000
	* PerlCode.dis, DIS.dis, ManakaiNode.dis,
	ManakaiNodeTest.dis: |For| specifications are removed.

	* common.dis: New module.

	* DIS.dis, PerlCode.dis, ManakaiNode.dis: |Util:| resource
	definitions are removed (and moved to |common.dis|).

	* DIS.dis (ForEmpty, ForLatest): Removed.

	* DIS.dis: |WithFor| and |DefaultFor| are removed.

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

++ manakai/lib/Message/Util/Error/ChangeLog	30 Dec 2006 11:59:28 -0000
2006-12-30  Wakaba  <wakaba@suika.fam.cx>

	* Core.dis, DOMException.dis: |WithFor|, |DefaultFor|,
	and |For| specificaitons are removed.

++ manakai/lib/Message/Util/Formatter/ChangeLog	30 Dec 2006 11:59:59 -0000
2006-12-30  Wakaba  <wakaba@suika.fam.cx>

	* Muf2003.dis: |WithFor|, |DefaultFor|, and |For|
	specifications are removed.

++ manakai/lib/Message/Util/DIS/ChangeLog	30 Dec 2006 11:58:54 -0000
	* Perl.dis, Value.dis, DNLite.dis,
	DPG.dis, Test.dis: |WithFor|, |For|, and |DefaultFor|
	specifications are removed.

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

++ manakai/lib/Message/DOM/ChangeLog	30 Dec 2006 11:53:43 -0000
        SimpleLS.dis, DOMMain.dis, XDP.dis: |For| specifications
	are removed.

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

	* CharacterData.dis, DOMCore.dis, DOMFeature.dis,
        GenericLS.dis, TreeCore.dis, DOMString.dis,
        XML.dis, Element.dis, Document.dis, TreeStore,dis,
        Traversal.dis, XDoctype.dis, XMLParser.dis, DOMLS.dis,
++ manakai/lib/Message/URI/ChangeLog	30 Dec 2006 11:54:30 -0000
	* Generic.dis: |For| specifications are removed.

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

++ manakai/lib/Message/Charset/ChangeLog	30 Dec 2006 11:54:10 -0000
	* Encode.dis: |For| specifications are removed.

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

++ manakai/lib/manakai/ChangeLog	30 Dec 2006 12:00:29 -0000
	* XML.dis: |DefaultFor| specification is removed.

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

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

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24