/[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.77 - (hide annotations) (download)
Wed Feb 8 08:18:29 2006 UTC (19 years, 5 months ago) by wakaba
Branch: MAIN
Changes since 1.76: +10 -2 lines
++ manakai/bin/ChangeLog	8 Feb 2006 07:59:04 -0000
2006-02-08  Wakaba  <wakaba@suika.fam.cx>

	* dac2test.pl (|test:ParserTest| converter): |c:erred| is supported.

++ manakai/lib/Message/Util/ChangeLog	8 Feb 2006 08:07:42 -0000
2006-02-08  Wakaba  <wakaba@suika.fam.cx>

	* PerlCode.dis (getNameListAttrR): Non-|pc:|-namespace elements
	and their descendants were ignored.
	(getNameListAttrRM): New variant derived from |getNameListAttrR|,
	for |getUsePerlModuleNameList| and |getUseCharClassNameList|.
	(getUsePerlModuleNameList, getUseCharClassNameList): Don't
	include |pc:package| and their descendants to the target.
	(PerlFile.stringify): Outputs |use| statements
	for Perl modules and character classes not part of any package,
	if any.

	* DIS.dis: |lang:tdterr|'s |DVNSValue| convertion is supported.

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

	* DIS.dis (loadModule): Loads a "daem" submodule file
	if exists.

++ manakai/lib/Message/Util/Error/ChangeLog	8 Feb 2006 08:17:54 -0000
2006-02-06  Wakaba  <wakaba@suika.fam.cx>

	* DOMException.dis (ManakaiDOM:WarningClass): Removed.
	(ManakaiDOM:alwaysWarns): Removed.
	(disPerl:WARNING): Removed.
	(ManakaiDOM:ManakaiDOMExceptionOrWarning): Removed.
	(ManakaiDOM:ManakaiDOMWarning): Removed.

++ manakai/lib/Message/Util/DIS/ChangeLog	8 Feb 2006 08:16:38 -0000
2006-02-08  Wakaba  <wakaba@suika.fam.cx>

	* Value.dis: |lang:tdterr| type support is added.

	* Test.dis (failureComment): New method.
	(TFQNames): New token type.
	(rule node): It now accepts empty declaration.

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

	* Test.dis (assertTypedValueEquals): New code fragment
	extracted from |assertDOMTreeEquals| method.
	(assertErrorEquals): New method.

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

	* Test.dis (Require): Requires |Util:DIS| module.
	(parseTDTErrorString): New method.
	(URI, QName): New token types.
	(rule tdterr): New parser rule.
	(dtest:undeclared-namespace-prefix-error): New error.
	(dtest:bad-error-resource-error): New error.

++ manakai/lib/Message/DOM/ChangeLog	8 Feb 2006 08:01:24 -0000
2006-02-08  Wakaba  <wakaba@suika.fam.cx>

	* XMLParser.dis (XMLTests): Tests for |c:erred| is supported.

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

	* DOMCore.dis (c:erred): New property.
	(c:DOMErrorType): It should have been a subset
	of |ecore:AnyErrorCode|.

	* XMLParser.dis (XMLTests): Empty input tests added.

++ manakai/lib/manakai/ChangeLog	8 Feb 2006 08:18:20 -0000
2006-02-06  Wakaba  <wakaba@suika.fam.cx>

	* Test.dis (lang:tdterr): New type.

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

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24