/[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.105 - (hide annotations) (download)
Sun Nov 5 09:16:31 2006 UTC (18 years, 8 months ago) by wakaba
Branch: MAIN
Changes since 1.104: +1 -11 lines
++ manakai/lib/Message/Util/ChangeLog	5 Nov 2006 09:15:59 -0000
2006-11-05  Wakaba  <wakaba@suika.fam.cx>

	* Grove.dis (mg:nodeRefClass, mg:nodeRefInterfaces): Removed.

++ manakai/lib/Message/DOM/ChangeLog	5 Nov 2006 09:15:04 -0000
	* CharacterData.dis (ManakaiDOMDocumentCharacterData): New
	class.  Factory methods |createTextNode| and |createComment|
	are moved from |ManakaiDOMDocument|.

	* DOMCore.dis: References to |ManakaiDOMObject|
	are removed.
	(tc:createImplForTest): Moved from |TreeCore.dis|.
	(DOMImplementation.___create_node_ref): Support
	for the |mg:nodeRefClass| option is removed.
	(ManakaiDOMConfiguration.___report_error): Moved
	from |ManakaiDOMObject| class.

	* DOMFeature.dis (domidl:extends): New property.
	(f:getFeatureImpl): Support for |+| classes is removed.

	* DOMMain.dis (DOMMain:docSupportsXMLFeature): Removed.
	(ManakaiDOM:ManakaiDOMObject): Removed.
	(DOMDataType): Removed.

	* Document.dis (ManakaiDOMImplementationDocument):
	The |createDocument| method is moved from
	the |ManakaiDOMImplementationTC| in |TreeCore.dis|.
	(ManakaiDOMDocument.___create_node_ref): Removed.
	(createElement, createElementNS, createAttribute,
	createAttributeNS, createTextNode, createComment,
	createCDATASection, createEntityReference,
	createProcessingInstruction): Class implementations
	are moved to each module.

	* Element.dis (ManakaiDOMImplementationElement): Factory
	methods are moved from |Document.dis|.
	(ManakaiDOMElement.___create_node_ref): Support
	for old class registry is removed.
	(ManakaiDOMAttr.___create_node_ref): Removed.
	(Attr.baseURI): Implementation
	for |xml:base| attribute is merged.
	(Attr.nodeValue, Attr.value): Implementation
	for |xml:id| attribute is merged.

	* TreeCore.dis (ManakaiDOMImplementationTC): Removed.

	* XDoctype.dis (ManakaiDOMImplementationXDoctype): The
	definition for |createDocumentType| method
	is moved from |TreeCore.dis|.

	* XML.dis (ManakaiDOMXMLDocument): Factory
	methods are moved from |Document.dis|.
	(ManakaiDOMXMLBaseAttr, ManakaiDOMXMLIdAttr): Removed (merged
	into |ManakaiDOMAttr| in |Element.dis|).

2006-11-05  Wakaba  <wakaba@suika.fam.cx>

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

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24