/[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.114 - (hide annotations) (download)
Sun Dec 31 00:55:05 2006 UTC (18 years, 6 months ago) by wakaba
Branch: MAIN
Changes since 1.113: +2 -54 lines
++ manakai/lib/Message/Util/ChangeLog	31 Dec 2006 00:49:10 -0000
2006-12-31  Wakaba  <wakaba@suika.fam.cx>

	* DIS.dis (forMatch, readProperties): Support for the |For|
	property is removed.

++ manakai/lib/Message/Util/DIS/ChangeLog	31 Dec 2006 00:50:06 -0000
2006-12-31  Wakaba  <wakaba@suika.fam.cx>

	* DNLite.dis (forMatch, convert...): Support for the |For|
	property is removed.

++ manakai/lib/manakai/ChangeLog	31 Dec 2006 00:53:00 -0000
2006-12-31  Wakaba  <wakaba@suika.fam.cx>

	* DISCore.dis (for): Removed.

	* DISSource.dis (For): Removed.

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

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24