/[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.49 - (hide annotations) (download)
Mon Sep 19 16:17:51 2005 UTC (19 years, 9 months ago) by wakaba
Branch: MAIN
Changes since 1.48: +400 -369 lines
++ ./bin/ChangeLog	19 Sep 2005 12:05:15 -0000
2005-09-19  Wakaba  <wakaba@suika.fam.cx>

	* mkdisdump.pl (progress_inc, progress_reset): New functions.

++ ./lib/Message/Util/ChangeLog	19 Sep 2005 12:14:55 -0000
2005-09-19  Wakaba  <wakaba@suika.fam.cx>

	* DIS.dis: Parameter "databaseArg" added to various
	methods to support objects that have no associated
	database.
	(getNamespaceBindingList, getDefaultNamespaceURIRef): New
	methods.
	(NO_RDF_TYPE_ERR): New error type.
	(loadResource): Throws NO_RDF_TYPE_ERR if no rdf:type
	attribute specified for a resource definition.

++ ./lib/Message/Util/Error/ChangeLog	19 Sep 2005 12:21:57 -0000
2005-09-19  Wakaba  <wakaba@suika.fam.cx>

	* Core.dis: Missing rdf:type attribute added to classes.

++ ./lib/Message/Util/DIS/ChangeLog	19 Sep 2005 12:23:54 -0000
2005-09-19  Wakaba  <wakaba@suika.fam.cx>

	* Value.dis (sourceNodePath): New attribute.
	(DVNSValue, DVNSOrderedList): New interfaces and classes.

	* Perl.dis: Some alias definitions moved from ../DIS.dis.
	The "namespaceContext" parameters added to some methods.
	(plCodeFragment): Now Perl'ize new DISCore:Integer typed string.
	(plImplementation): Directly instantiates PCImplementation
	to reduce overheads to find an implementation by ImplementationRegistry.

++ ./lib/Message/DOM/ChangeLog	19 Sep 2005 12:08:55 -0000
2005-09-19  Wakaba  <wakaba@suika.fam.cx>

	* DOMMain.dis (ManakaiDOM:DOMMethod, ManakaiDOM:DOMMethodReturn,
	ManakaiDOM:DOMAttribute, ManakaiDOM:DOMAttrGet,
	ManakaiDOM:DOMAttrSet, ManakaiDOM:DOMMethodParam): Removed.
	(ManakaiDOMTimeStamp): Removed.

	* DOMBoot.dis, DOMMetaImpl.dis, DOMMetaImpl.pm: Removed (they are no
	longer in use).

2005-09-18  Wakaba  <wakaba@suika.fam.cx>

	* DOMMain.dis (StringOutOfBoundsException): New exception.

++ ./lib/manakai/ChangeLog	19 Sep 2005 12:23:20 -0000
2005-09-19  Wakaba  <wakaba@suika.fam.cx>

	* DISCore.dis (DISCore:Boolean): New preferred name
	to dis:Boolean.
	(DISCore:Integer): New type.
	(dis:Value): Default type is changed to DISCore:String.

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

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24