/[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.113 - (hide annotations) (download)
Sat Dec 30 15:43:01 2006 UTC (18 years, 6 months ago) by wakaba
Branch: MAIN
Changes since 1.112: +1 -3 lines
*** empty log message ***

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

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24