/[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.53 - (hide annotations) (download)
Sat Sep 24 11:57:23 2005 UTC (19 years, 9 months ago) by wakaba
Branch: MAIN
Changes since 1.52: +142 -94 lines
++ manakai/bin/ChangeLog	24 Sep 2005 10:49:30 -0000
	(dac_load_module_file): Allow "|" as qname prefix separator.
++ manakai/lib/Message/Markup/ChangeLog	24 Sep 2005 11:11:32 -0000
2005-09-24  Wakaba  <wakaba@suika.fam.cx>

	* SuikaWikiConfig21.dis: Use "disPerl:H" instead
	of "disPerl:Q" for hash keys.
	(expandQName): Removed the "g" option from the "s///",
	which was very serious and difficult bug.

++ manakai/lib/Message/Util/ChangeLog	24 Sep 2005 11:01:40 -0000
2005-09-24  Wakaba  <wakaba@suika.fam.cx>

	* ManakaiNode.dis (mn:node, mn:nodeID, mn:treeID): New
	properties.
	(mn:stemName, mn:refName): New properties.

	* Makefile (.discore-all.pm): New rule to create dis-related
	Perl module files at once.

	* DIS.dis (PERL_HASH_KEY_ALREADY_DEFINED_ERR): New error code.
	(hashKeyName, hashKeyScope, anotherURI): New error parameters.

	* ManakaiNode.dis, DIS.dis, PerlCode.dis: Use "disPerl:H" instead
	of "disPerl:Q" for hash keys.

++ manakai/lib/Message/Util/Error/ChangeLog	24 Sep 2005 10:58:31 -0000
2005-09-24  Wakaba  <wakaba@suika.fam.cx>

	* ManakaiNode.dis: Use "disPerl:H" instead
	of "disPerl:Q" for hash keys.

++ manakai/lib/Message/Util/DIS/ChangeLog	24 Sep 2005 11:06:19 -0000
2005-09-24  Wakaba  <wakaba@suika.fam.cx>

	* Perl.dis (plCodeFragment): Takes hash key name
	from the database for "mn:node" and "DOMCore:read-only",
	where they were hardcoded.  For GetProp and SetProp
	dis tree element instructions, hash key name
	is shorten if shorter version is defined by "DISPerl:propHashKey"
	property of the corresponding resource in the database.
	(plAddHashKey): New method to check hash key name dupulication.
	(dp:plHashKey): New property.

	* Perl.dis, DNLite.dis, DISDoc.dis, DISDump.dis:
	Use "disPerl:H" instead of "disPerl:Q" for hash keys.

++ manakai/lib/Message/DOM/ChangeLog	24 Sep 2005 10:55:11 -0000
2005-09-24  Wakaba  <wakaba@suika.fam.cx>

	* DOMMain.dis (MDOM:): Reintroduced for "ManakaiDOM:ManakaiDOM1"
	and "ManakaiDOM:ManakaiDOM2".

	* DOMFeature.dis, DOMMain.dis, DOMCore.dis, DOMXML.dis,
	DOMLS.dis, SimpleLS.dis, GenericLS.dis: Use disPerl:H
	instead of disPerl:Q for internal property hash keys.

	* DOMFeature.dis, DOMCore.dis, DOMXML.dis: Missing property
	definitions added.

	* DOMCore.dis (DOMCore:TextNode, DOMCore:DocumentFragmentNode):
	New resources.

	* DOMXML.dis (DOMXML:EntityNode, DOMXML:EntityReferenceNode): New
	resources.

++ manakai/lib/manakai/ChangeLog	24 Sep 2005 11:08:14 -0000
2005-09-24  Wakaba  <wakaba@suika.fam.cx>

	* XML.dis: The "DISPerl:propHashKey" property
	added to properties.  Now the module depends on the DISPerl
	module.

	* DISPerl.dis (DISPerl:propHashKey): New property.

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

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24