/[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.60 - (hide annotations) (download)
Fri Sep 30 13:06:17 2005 UTC (19 years, 9 months ago) by wakaba
Branch: MAIN
Changes since 1.59: +77 -45 lines
++ manakai/bin/ChangeLog	30 Sep 2005 12:38:36 -0000
2005-09-30  Wakaba  <wakaba@suika.fam.cx>

	* mkdisdump.pl (append_module_group_documentation,
	append_document_documentation): New functions.
	(append_class_documentation, append_interface_documentation):
	Generates method/attribute/constgroup information (in partial mode)
	even if "is_partial" option is true to compute inheriting
	class member information correctly.
	(--resource-uri): New option.

	* Makefile (error.xml, minimpl.xml): New rules.

++ manakai/lib/Message/Util/ChangeLog	30 Sep 2005 12:50:16 -0000
2005-09-30  Wakaba  <wakaba@suika.fam.cx>

	* DIS.dis (readProperties): Saves property name to values.
	(getPropertyModuleList): New method.


	* ManakaiNode.dis: Use "disPerl:H" instead
	of "disPerl:Q" for hash keys.
	(NodeStem): Property value "mn:treeID"
	has changed to scalar reference.
++ manakai/lib/Message/Util/Error/ChangeLog	30 Sep 2005 12:49:59 -0000
2005-09-30  Wakaba  <wakaba@suika.fam.cx>
	* DOMException.dis (dx:ManakaiErrorModules): New documentation.
++ manakai/lib/Message/Util/DIS/ChangeLog	30 Sep 2005 12:48:08 -0000
2005-09-30  Wakaba  <wakaba@suika.fam.cx>

	* Value.dis (name): New attribute.

	* Perl.dis (plFullyQualifiedName): Use module's package
	name properties if available.

++ manakai/lib/Message/DOM/ChangeLog	30 Sep 2005 12:40:49 -0000
2005-09-30  Wakaba  <wakaba@suika.fam.cx>

	* DOMCore.dis, SimpleLS.dis: Shares namespace URIs and local
	names where possible.

	* DOMFeature.dis: Documentation for DOM Minimum Implementation
	added (still work in progress).

	* Makefile (feature.dae, feature-spec.dae): New rules.

++ manakai/lib/manakai/ChangeLog	30 Sep 2005 12:53:24 -0000
2005-09-30  Wakaba  <wakaba@suika.fam.cx>

	* DISCore.dis: Documentation-related and meta-informational
	resoruces are moved to new "Document.dis" module.  The
	module now references "Document.dis".
	(DISCore:module, DISCore:resource): New properties.

	* DISRDF.dis: Some resources added from FOAF vocabulary.

	* Document.dis: New module.

	* DISIDL.dis: Some IDL comcepts added.  New name
	given to IDL datatypes.

	* DISLang.dis (dis:prefix): Removed.  (Moved to "DISIDL.dis"
	and it is now obsolete.)

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

	* DISPerl.dis (DISPerl:HashStringRef, DISPerl:StringRef): New.

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

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24