/[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.12 - (hide annotations) (download)
Sun Mar 6 11:12:42 2005 UTC (20 years, 4 months ago) by wakaba
Branch: MAIN
Changes since 1.11: +328 -52 lines
lib/Message/Markup/SuikaWikiConfig21.dis: Throws an exception if prefix is not declared; lib/Message/Util/DIS.dis: ManakaiDISResourceDefinition.plCode added (but not completed)

1 wakaba 1.1 Module:
2     @QName:
3     Util:DIS
4     @FullName:
5     @@lang: en
6     @@@:
7     <QUOTE::DIS> Object Model
8     @Namespace:
9     http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/DIS#
10    
11     @Description:
12     @@lang:en
13     @@@:
14     This module provides an object model for <QUITE::dis> document format.
15    
16     @Author:
17     @@FullName: Wakaba
18     @@Mail: w@suika.fam.cx
19     @License:
20     @@@:
21     license:Perl+MPL
22     @@Original:
23     @@@FullName:
24     manakai <CODE::lib/manakai/dis.pl>
25     @@@Year:2004
26     @@@Author:
27     @@@@FullName:Wakaba
28     @@@@Mail:w@suika.fam.cx
29     @Date:
30     @@@:
31 wakaba 1.12 $Date: 2005/03/05 12:00:44 $
32 wakaba 1.1 @@ContentType:
33     dis:Date.RCS
34    
35     @Require:
36     @@Module:
37     @@@Name: SuikaWikiConfig21
38 wakaba 1.5 @@@QName:
39     Markup:SuikaWikiConfig21
40 wakaba 1.1 @@@WithFor:
41 wakaba 1.3 swcfg21:ForLatest
42     @@Module:
43     @@@Name: DIS
44     @@@WithFor:
45     DIS:ForLatest
46 wakaba 1.12 @@Module:
47     @@@Name: PerlCode
48     @@@WithFor:
49     ManakaiDOM:Perl
50 wakaba 1.3
51     @DefaultFor:
52     DIS:ForLatest
53 wakaba 1.1
54     Namespace:
55     @DIS:
56     http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/DIS#
57     @dis:
58     http://suika.fam.cx/~wakaba/archive/2004/8/18/lang#dis--
59     @dis2pm:
60     http://suika.fam.cx/~wakaba/archive/2004/11/8/dis2pm#
61 wakaba 1.5 @DISlib:
62     http://suika.fam.cx/~wakaba/archive/2004/dis/
63 wakaba 1.3 @DOMCore:
64     http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#
65     @DOMLS:
66     http://suika.fam.cx/~wakaba/archive/2004/dom/ls#
67     @DOMMain:
68     http://suika.fam.cx/~wakaba/archive/2004/dom/main#
69     @infoset:
70     http://www.w3.org/2001/04/infoset#
71 wakaba 1.1 @lang:
72     http://suika.fam.cx/~wakaba/archive/2004/8/18/lang#
73     @license:
74     http://suika.fam.cx/~wakaba/archive/2004/8/18/license#
75     @ManakaiDOM:
76     http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom#
77 wakaba 1.5 @Markup:
78     http://suika.fam.cx/~wakaba/archive/2005/manakai/Markup#
79 wakaba 1.3 @MDOMX:
80     http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#
81 wakaba 1.1 @owl:
82     http://www.w3.org/2002/07/owl#
83     @Perl:
84     http://suika.fam.cx/~wakaba/archive/2004/8/18/lang#Perl--
85     @rdf:
86     http://www.w3.org/1999/02/22-rdf-syntax-ns#
87     @rdfs:
88     http://www.w3.org/2000/01/rdf-schema#
89 wakaba 1.3 @swcfg21:
90     http://suika.fam.cx/~wakaba/archive/2005/swcfg21#
91 wakaba 1.1 @TreeCore:\
92     @Util:
93     http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/
94    
95     ## -- "For" definitions
96    
97     ForDef:
98     @QName:
99     DIS:ForLatest
100     @Description:
101     @@lang:en
102     @@@:
103     For latest version of the <Module::Util:DIS> module implementation
104     @ISA:
105     ManakaiDOM:Perl
106    
107     ## -- Features
108    
109     ElementTypeBinding:
110     @Name: FeatureDef
111     @ElementType:
112     dis:ResourceDef
113     @ShadowContent:
114     @@rdf:type:
115     DOMMain:DOMFeature
116     @@AliasFor:
117     @@@@:
118     ::ManakaiDOM:all
119     @@@For:
120     !=ManakaiDOM:all
121    
122     ElementTypeBinding:
123     @Name: FeatureVerDef
124     @ElementType:
125     dis:ResourceDef
126     @ShadowContent:
127     @@rdf:type:
128     DOMMain:DOMFeature
129    
130     ElementTypeBinding:
131     @Name: featureQName
132     @ElementType:
133     dis:AppName
134     @ShadowContent:
135     @@ContentType:
136     dis:TypeQName
137    
138     FeatureDef:
139     @QName: Core
140     @FeatureVerDef:
141     @@QName: CoreFeature10
142     @@Version: 1.0
143     @@ISA: Core
144     @@FullName:
145     @@@lang:en
146     @@@@:
147     The <QUOTE::dis> object model, version 1.0
148     @@Description:
149     @@@lang:en
150     @@@@:
151     The <QUOTE::dis> object model, version 1.0.
152     @@DOMMain:requireFeature:
153     swcfg21:CoreFeature21
154    
155     ## -- SuikaWikiConfig/2.1 extended classes
156    
157     ClsDef:
158     @ClsQName: ManakaiDISImplementation
159     @ClsISA:
160 wakaba 1.3 swcfg21:ManakaiSWCFGImplementation::swcfg21:ForLatest
161 wakaba 1.1 @Description:
162     @@lang:en
163     @@@:
164     A <QUOTE::dis> implementation object.
165    
166     @Method:
167     @@Name: createDISDocument
168     @@Description:
169     @@@lang:en
170     @@@@:
171     Creates an empty <Class::ManakaiDISDocument> object.
172     @@Return:
173     @@@Type:ManakaiDISDocument
174     @@@Description:
175     @@@@lang:en
176     @@@@@:
177     The newly created <QUOTE::dis> document object.
178     @@@PerlDef:
179 wakaba 1.3 $r = $self-><M::swcfg21:SWCFGImplementation::swcfg21:ForLatest
180     .createSWCFGDocument>;
181     $r-><AS::swcfg21:SWCFGDocument::swcfg21:ForLatest
182     .defaultElementTypeNamespaceURI>
183 wakaba 1.1 (<Q::dis:>);
184    
185     @Method:
186 wakaba 1.2 @@Name: createDISParser
187     @@Description:
188     @@@lang:en
189     @@@@:
190 wakaba 1.1 Creates a <Class::ManakaiDISParser> object.
191 wakaba 1.2 @@Return:
192     @@@Type: ManakaiDISParser
193     @@@Description:
194     @@@@lang:en
195     @@@@@:
196 wakaba 1.1 A newly created <QUOTE::dis> parser.
197 wakaba 1.2 @@@PerlDef:
198 wakaba 1.3 $r = bless $self-><M::swcfg21:SWCFGImplementation::swcfg21:ForLatest
199     .createSWCFGParser>,
200 wakaba 1.1 <ClassName::ManakaiDISParser>;
201    
202     @Method:
203 wakaba 1.2 @@Name: createDISDatabase
204 wakaba 1.1 @@Description:
205     @@@lang:en
206     @@@@:
207 wakaba 1.2 Creates a new <QUOTE::dis> database.
208 wakaba 1.1 @@Return:
209 wakaba 1.2 @@@Type:ManakaiDISDatabase
210 wakaba 1.4 @@@Description:
211     @@@@lang:en
212     @@@@@:
213 wakaba 1.2 A newly created <QUOTE::dis> parser.
214 wakaba 1.4 @@@PerlDef:
215 wakaba 1.2 $r = bless {
216     forDef => {
217 wakaba 1.5 <Q::ManakaiDOM:all> => bless ({
218 wakaba 1.2 uri => <Q::ManakaiDOM:all>,
219     isa => {<Q::ManakaiDOM:all> => 1},
220     revISA => {},
221 wakaba 1.5 }, <ClassName::ManakaiDISForDefinition>),
222 wakaba 1.2 },
223     resDef => {},
224 wakaba 1.9 modDef => {},
225     seq => 0,
226 wakaba 1.3 }, <ClassName::ManakaiDISDatabase>;
227    
228     @Method:
229     @@Name: tfurisToURI
230     @@Description:
231     @@@lang:en
232     @@@@:
233     Converts a pair of name URI reference and <QUOTE::for> URI reference
234     into a <TYPE::dis:TFQNames>-expanded URI reference.
235     @@Param:
236     @@@Name: typeURI
237     @@@Type: NameURI
238     @@@Description:
239     @@@@lang:en
240     @@@@@:
241     A URI reference to identify a resource.
242     @@@InCase:
243     @@@@Value:
244     @@@@@is-null:1
245     @@@@Description:
246     @@@@@lang:en
247     @@@@@@:
248     Equivalent to <Q::DOMMain:any> (for historical reason).
249     @@Param:
250     @@@Name: forURI
251     @@@Type: ForURI
252     @@@Description:
253     @@@@lang:en
254     @@@@@:
255     A <QUOTE::for> URI reference.
256     @@@InCase:
257     @@@@Value:
258     @@@@@is-null:1
259     @@@@Description:
260     @@@@@lang:en
261     @@@@@@:
262     Equivalent to <QUOTE::for all>, i.e. <Q::ManakaiDOM:all>.
263     @@Return:
264     @@@Type:
265     DISCore:TFURI::ManakaiDOM:all
266     @@@Description:
267     @@@@lang:en
268     @@@@@:
269     The <TYPE::dis:TFQNames>-expanded URI references.
270     @@@PerlDef:
271     $typeURI = <Q::DOMMain:any> unless defined $typeURI;
272     $forURI = <Q::ManakaiDOM:all> unless defined $forURI;
273 wakaba 1.4 __CODE{tfurisToURI:: $turi => $typeURI, $furi => $forURI, $uri => $r}__;
274    
275     @ResourceDef:
276     @@QName: tfurisToURI
277     @@rdf:type:
278     dis2pm:BlockCode
279     @@enDesc:
280     Converts a pair of name URI reference and <QUOTE::for> URI reference
281     into a <TYPE::dis:TFQNames>-expanded URI reference.
282     @@PerlDef:
283     if ($furi eq <Q::ManakaiDOM:all>) {
284     $uri = $turi;
285 wakaba 1.3 } else {
286     ## NOTE: [RFC 3986]
287     ## fragment := *(pchar / "/" / "?")
288     ## pchar := unreserved / pct-encoded / sub-delims / [:@]
289     ## unreserved := ALPHA / DIGIT / [._~-]
290     ## sub-delims := [!$&'()*+,;=]
291     ## NOTE: [XPointer Framework]
292     ## SchemeData := *EscapedData
293     ## EscapedData := NormalChar / "^(" / "^)" / "^^"
294     ## / "(" SchemeData ")"
295     ## NormalChar := UnicodeChar - [()^]
296 wakaba 1.5 my $__turi = $turi;
297     my $__furi = $furi;
298     for my $__uri ($__turi, $__furi) {
299 wakaba 1.4 $__uri =~ s{([^0-9A-Za-z:;?=_./-])}{sprintf '%%%02X', ord $1}ge;
300 wakaba 1.3 }
301 wakaba 1.4 $uri = qq<data:,200411tf#xmlns(t=data:,200411tf%23)>.
302 wakaba 1.5 qq<t:tf($__turi,$__furi)>;
303 wakaba 1.3 }
304 wakaba 1.2
305 wakaba 1.5 @ResourceDef:
306 wakaba 1.6 @@QName: tfpurisToURI
307     @@rdf:type:
308     dis2pm:BlockCode
309     @@enDesc:
310     Converts a set of name URI reference and <QUOTE::for> URI reference
311     and <QUOTE::for+> URI references into a URi reference.
312     @@PerlDef:
313     if ($furi eq <Q::ManakaiDOM:all> and @{$forp} == 0) {
314     $uri = $turi;
315     } elsif (@{$forp}) {
316     my $__turi = $turi;
317     my $__furi = $furi;
318     for my $__uri ($__turi, $__furi) {
319     $__uri =~ s{([^0-9A-Za-z:;?=_./~!&+-])}{sprintf '%%%02X', ord $1}ge;
320     }
321     my @__fp;
322     for my $__uri (@{$forp}) {
323     my $__fpuri = $__uri;
324     $__fpuri =~ s{([^0-9A-Za-z:;?=_./~!&+-])}
325     {sprintf '%%%02X', ord $1}ge;
326     push @__fp, $__fpuri;
327     }
328     $uri = qq<data:,200411tf#xmlns(t=data:,200411tf%23)>.
329     qq<t:tfp($__turi,$__furi,>.join (',', @__fp).q<)>;
330     } else {
331     my $__turi = $turi;
332     my $__furi = $furi;
333     for my $__uri ($__turi, $__furi) {
334     $__uri =~ s{([^0-9A-Za-z:;?=_./-])}{sprintf '%%%02X', ord $1}ge;
335     }
336     $uri = qq<data:,200411tf#xmlns(t=data:,200411tf%23)>.
337     qq<t:tf($__turi,$__furi)>;
338     }
339    
340     @ResourceDef:
341 wakaba 1.5 @@QName: getChildResourceURI
342     @@rdf:type:
343     dis2pm:BlockCode
344     @@enDesc:
345     Gets an anonymous URI reference of a child resource of another
346     resource.
347     @@PerlDef:
348     my $__parent = $parentURI;
349     my $__ln = $localName;
350     for my $__uri ($__parent, $__ln) {
351 wakaba 1.6 $__uri =~ s{([^0-9A-Za-z:;?=_./~!&+-])}{sprintf '%%%02X', ord $1}ge;
352 wakaba 1.5 }
353     $result = q<data:,200411tf#xmlns(t=data:,200411tf%23)>.
354     qq<t:child($__parent,$__ln)>;
355    
356 wakaba 1.8 @IntMethod:
357     @@Name: camelCaseToUnderscoreName
358     @@enDesc:
359     Converts a camelCase name to a underscored_name.
360     @@ManakaiDOM:isStatic:1
361     @@Param:
362     @@@Name: camelName
363     @@@Type:
364     DISLang:String
365     @@@enDesc:
366     The source name.
367     @@Return:
368     @@@Type:
369     DISLang:String
370     @@@enDesc:
371     The result name.
372     @@@PerlDef:
373     $r = $camelName;
374     $r =~ s/^([A-Z0-9]+)$/lc $1/ge;
375     $r =~ s/([A-Z][A-Z0-9]*)$/"_".lc $1/ge;
376     $r =~ s/([A-Z0-9])([A-Z0-9]*)([A-Z0-9])/$1.lc ($2)."_".lc $3/ge;
377     $r =~ s/([A-Z])/"_".lc $1/ge;
378     $r =~ s/(?=[0-9](?!$))/_/g;
379 wakaba 1.9
380     @Method:
381     @@Name: plLoadDISDatabase
382     @@enDesc:
383     Loads a database from a file that was saved by
384     <M::ManakaiDISDatabase.plStore>.
385     \
386     {NOTE:: <QUOTE::dis> documents restored from external file
387     would have different <A::ManakaiDISDocument.implementation>
388     than this <Class::ManakaiDISImplementation>, even if
389     it has been created by this implementation
390     and stored in the same session.
391     \
392     }
393     @@Param:
394     @@@Name:fileName
395     @@@Type:
396     DISLang:String
397     @@@enDesc:
398     An environment-dependent file name.
399     @@Return:
400     @@@Type: ManakaiDISDatabase
401     @@@SimpleException:
402     @@@PerlDef:
403     use Storable qw/retrieve/;
404     local $Carp::CarpLevel = $Carp::CarpLevel + 1;
405     $r = retrieve $fileName;
406    
407     ## Restores weak references
408     require Scalar::Util;
409     for my $doc (values %{$r->{<Q::DIS:sourceFile>}}) {
410     Scalar::Util::weaken ($doc->{<Q::TreeCore:node>}->{<Q::DIS:db>});
411     }
412     for my $def (values %{$r->{modDef}},
413     values %{$r->{forDef}},
414     values %{$r->{resDef}}) {
415     Scalar::Util::weaken ($def->{db});
416     }
417 wakaba 1.1 ##DISImplementation
418    
419 wakaba 1.9 ElementTypeBinding:
420     @Name: SimpleException
421     @ElementType:
422     dis:Description
423     @ShadowContent:
424     @@lang:en
425     @@@:
426     - Exception of type <PerlModule::Error::Simple>:::
427     I/O error or other error reported by <PerlModule::Storable>.
428    
429     ## TODO: Formal description required for simple exception
430    
431 wakaba 1.1 ClsDef:
432     @ClsQName: ManakaiDISParser
433     @ClsISA:
434 wakaba 1.3 swcfg21:ManakaiSWCFGParser::swcfg21:ForLatest
435 wakaba 1.1 @Description:
436     @@lang:en
437     @@@:
438     A SuikaWikiConfig/2.1 parser that returns <QUOTE::dis> object.
439     @Method:
440 wakaba 1.3 @@Name: parse
441     @@Description:
442     @@@lang:en
443     @@@@:
444 wakaba 1.1 Parses a <QUOTE::dis> document and returns it as an object tree.
445 wakaba 1.3 @@Param:
446     @@@Name: input
447     @@@Type:
448     DOMLS:LSInput::ManakaiDOM:ManakaiDOM3
449     @@@Description:
450     @@@@lang:en
451     @@@@@:
452 wakaba 1.1 The input source.
453 wakaba 1.3 @@Return:
454     @@@Type: ManakaiDISDocument
455     @@@Description:
456     @@@@lang:en
457     @@@@@:
458 wakaba 1.1 The <QUOTE::dis> document object created from the <P::input>.
459     @@@RaiseException:
460     @@@@@:
461     swcfg21:SWCFG_PARSE_ERR
462     @@@@Description:
463     @@@@@lang:en
464     @@@@@@:
465     The <IF::swcfg21:SWCFGParser> was unable to load the SuikaWikiConfig
466     document.
467     @@@PerlDef:
468     __DEEP{
469 wakaba 1.3 $r = $self-><M::swcfg21:ManakaiSWCFGParser
470     ::swcfg21:ForLatest.parse> ($input);
471 wakaba 1.1 }__;
472     if (defined $r) {
473     $r = bless $r, <ClassName::ManakaiDISDocument>;
474 wakaba 1.4 $r-><AS::swcfg21:SWCFGDocument::swcfg21:ForLatest
475     .defaultElementTypeNamespaceURI>
476     (<Q::dis:>);
477 wakaba 1.1 }
478     ##DISParser
479    
480     ClsDef:
481     @ClsQName: ManakaiDISNode
482     @Description:
483     @@lang:en
484     @@@:
485     <QUOTE::dis> node objects.
486 wakaba 1.7 @ImplNote:
487     @@lang:en
488     @@@:
489     This class does not inherit
490     <Class::swcfg21:ManakaiSWCFGNode::swcfg21:ForLatest>, since
491     inheriting classes such as <Class::ManakaiDISElement> indirectly
492     inherit it.
493 wakaba 1.1
494     @MethodRedef:
495     @@Name:lookupNamespacePrefix
496     @@Description:
497     @@@lang:en
498     @@@@:
499     Looks up the namespace prefix associated to the given
500     namespace URI. The default namespaces are ignored.
501     @@Param:
502     @@@Name:namespaceURI
503 wakaba 1.3 @@@Type: AnyURI
504 wakaba 1.1 @@@Description:
505     @@@@lang:en
506     @@@@@:
507     The namespace URI to look for.
508     @@@InCase:
509     @@@@Value:
510     @@@@@is-null:1
511     @@@@Description:
512     @@@@@lang:en
513     @@@@@@:
514     The <DOM::null> namespace.
515     @@NamedParam:
516     @@@Name: makeNewBinding
517     @@@Type:
518     DOMMain:boolean
519     @@@Description:
520     @@@@lang:en
521     @@@@@:
522     Whether a new namespace prefix should be bound when
523     no namespace URI has been associated yet.
524     @@@InCase:
525     @@@@Value:true
526     @@@@Description:
527     @@@@@lang:en
528     @@@@@@:
529     New binding is made if no prefix associated.
530     @@@InCase:
531     @@@@Value:false
532     @@@@Description:
533     @@@@@lang:en
534     @@@@@@:
535     Simply returns the <DOM::null> if no prefix associated.
536     @@Return:
537     @@@Type:
538 wakaba 1.3 DISCore:NamespacePrefix::ManakaiDOM:all
539 wakaba 1.1 @@@Description:
540     @@@@lang:en
541     @@@@@:
542     An associated namespace prefix. If more than one prefix
543     are associated to the namespace URI, the returned prefix
544     is implementation dependent.
545     @@@InCase:
546     @@@@Value:
547     @@@@@is-null:1
548     @@@@Description:
549     @@@@@lang:en
550     @@@@@@:
551     No associated namespace prefix found.
552     @@@PerlDef:
553     $r = null;
554 wakaba 1.3 my $od = $self-><AG::swcfg21:SWCFGNode::swcfg21:ForLatest
555     .ownerDocument> || $self;
556 wakaba 1.7 my $binds = $od->{<Q::TreeCore:node>}->{<Q::swcfg21:nsBinding>};
557 wakaba 1.1 if (defined $namespaceURI) {
558     FIND: {
559     for my $prefix (keys %$binds) {
560     if (defined $binds->{$prefix} and
561     $binds->{$prefix} eq $namespaceURI) {
562     $r = $prefix;
563     last FIND;
564     }
565     }
566 wakaba 1.7
567     ## From module list
568     try {
569     my $db = $self-><AG::ManakaiDISNode.ownerDISDocument>
570     -><AG::ManakaiDISDocument.disDatabase>;
571     for my $mod_uri (keys %{$db->{modDef}}) {
572     my $mod = $db-><M::ManakaiDISDatabase.getModule> ($mod_uri);
573     my $mod_ln = $mod-><AG::ManakaiDISModuleDefinition.localName>;
574     next if exists $binds->{$mod_ln};
575     my $ns_uri = $mod-><M::ManakaiDISPropertyAccessor
576     .getPropertyText>
577     (<Q::dis:Namespace>, '');
578     if ($ns_uri eq $namespaceURI) {
579     $r = $mod_ln;
580     last FIND;
581     }
582     }
583     } catch <Class::ManakaiDISException> with {
584     my $err = shift;
585     $err->throw
586     unless $err->{<Q::MDOMX:subtype>} eq <Q::NO_DB_ASSOCIATED_ERR>;
587     };
588    
589 wakaba 1.1 last FIND unless $makeNewBinding;
590     ## Not found
591     if ($namespaceURI =~ /(\w+)$/) {
592     my $prefix = $1;
593     unless (exists $binds->{$prefix}) {
594     $binds->{$prefix} = $namespaceURI;
595     $r = $prefix;
596     last FIND;
597     }
598     }
599     my $i = 1;
600     {
601     unless (exists $binds->{'ns'.$i}) {
602     $binds->{$r = 'ns'.$i} = $namespaceURI;
603     last FIND;
604     }
605     $i++;
606     redo;
607     }
608     } # FIND
609     } else { ## Null namespace
610     FIND: {
611     if (exists $binds->{'nu'.'ll'} and not defined $binds->{'nu'.'ll'}) {
612     $r = 'nu'.'ll';
613     last FIND;
614     }
615     for my $prefix (keys %$binds) {
616     if (not defined $prefix) {
617     $r = $prefix;
618     last FIND;
619     }
620     }
621     last FIND unless $makeNewBinding;
622     ## Not found
623     my $i = '';
624     {
625     unless (exists $binds->{'nu'.'ll'.$i}) {
626     $binds->{$r = 'nu'.'ll'.$i} = null;
627     last FIND;
628     }
629     $i++;
630     redo;
631     }
632     }
633     }
634    
635     @MethodRedef:
636     @@Name:lookupNamespaceURI
637     @@Description:
638     @@@lang:en
639     @@@@:
640     Looks up the namespace URI associated to the given prefix.
641     @@Param:
642     @@@Name:prefix
643     @@@Type:
644 wakaba 1.3 DISCore:NamespacePrefix::ManakaiDOM:all
645 wakaba 1.1 @@@Description:
646     @@@@lang:en
647     @@@@@:
648     The namespace URI to look for.
649     @@NamedParam:
650     @@@Name: makeNewBinding
651     @@@Type:
652     DOMMain:boolean
653     @@@Description:
654     @@@@lang:en
655     @@@@@:
656     Whether a new binding should be created if no namespace URI
657     is associated with the <P::prefix> or not.
658     @@@InCase:
659     @@@@Value:true
660     @@@@Description:
661     @@@@@lang:en
662     @@@@@@:
663     A new binding to the temporary namespace URI
664     exactly same as <P::prefix> is created
665     if no binding found.
666     @@@InCase:
667     @@@@Value:false
668     @@@@Description:
669     @@@@@lang:en
670     @@@@@@:
671     No new binding is created if no binding found. Note that
672     even if no association newly created, this method
673     returns the <DOM::null> value.
674 wakaba 1.12 @@NamedParam:
675     @@@Name: raisePrefixException
676     @@@Type:
677     DOMMain:boolean
678     @@@enDesc:
679     Whehter an exception should be thrown if <P::prefix>
680     is not declared or not.
681 wakaba 1.1 @@Return:
682 wakaba 1.3 @@@Type: AnyURI
683 wakaba 1.1 @@@Description:
684     @@@@lang:en
685     @@@@@:The associated namespace URI.
686     @@@InCase:
687     @@@@Value:
688     @@@@@is-null:1
689     @@@@Description:
690     @@@@@lang:en
691     @@@@@@:
692 wakaba 1.3 No namespace URI is associated to the prefix or
693 wakaba 1.1 the <DOM::null> namespace is associated.
694 wakaba 1.12 @@@UndeclaredPrefixException:
695 wakaba 1.1 @@@PerlDef:
696 wakaba 1.3 my $od = $self-><AG::swcfg21:SWCFGNode::swcfg21:ForLatest
697     .ownerDocument> || $self;
698 wakaba 1.7 my $binds = $od->{<Q::TreeCore:node>}->{<Q::swcfg21:nsBinding>};
699 wakaba 1.1 if (exists $binds->{$prefix}) {
700     $r = $binds->{$prefix};
701     } else {
702 wakaba 1.7 ## From module list
703     FIND: {
704     try {
705     my $db = $self-><AG::ManakaiDISNode.ownerDISDocument>
706     -><AG::ManakaiDISDocument.disDatabase>;
707     for my $mod_uri (keys %{$db->{modDef}}) {
708     my $mod = $db-><M::ManakaiDISDatabase.getModule> ($mod_uri);
709     if ($mod-><AG::ManakaiDISModuleDefinition.localName>
710     eq $prefix) {
711     $r = $mod-><M::ManakaiDISPropertyAccessor
712     .getPropertyText>
713     (<Q::dis:Namespace>, null);
714     last FIND;
715     }
716     }
717     } catch <Class::ManakaiDISException> with {
718     my $err = shift;
719     $err->throw
720     unless $err->{<Q::MDOMX:subtype>} eq <Q::NO_DB_ASSOCIATED_ERR>;
721     };
722     if ($makeNewBinding) {
723     $r = $binds->{$prefix} = $prefix;
724 wakaba 1.12 } elsif ($raisePrefixException) {
725     __EXCEPTION{DIS:UNDECLARED_NS_PREFIX_ERR::
726     infoset:prefix => {$prefix},
727     MDOMX:param-name => 'prefix',
728     DIS:sourceNode => {$self},
729     }__;
730 wakaba 1.7 } else {
731     $r = null;
732     }
733     } # FIND
734 wakaba 1.1 }
735    
736     @IntMethod:
737     @@Name:getNodeReference
738     @@Description:
739     @@@lang:en
740     @@@@:
741     Returns a new reference to the node object.
742     @@ManakaiDOM:isStatic:1
743     @@Param:
744     @@@Name:object
745     @@@Type:
746     ManakaiDOM:ManakaiDOMNodeObject::ManakaiDOM:Perl
747     @@@Description:
748     @@@@lang:en
749     @@@@@:
750     The node object to be referred.
751     @@Return:
752     @@@Type: ManakaiDISNode
753     @@@Description:
754     @@@@lang:en
755     @@@@@:
756     A newly created reference.
757     @@@PerlDef:
758     my $class;
759 wakaba 1.5 if ($object->{<Q::swcfg21:nodeType>} eq '#element') {
760 wakaba 1.1 $class = <ClassName::ManakaiDISElement>;
761 wakaba 1.5 } elsif ($object->{<Q::swcfg21:nodeType>} eq '#comment') {
762 wakaba 1.1 $class = <ClassName::ManakaiDISComment>;
763 wakaba 1.5 } elsif ($object->{<Q::swcfg21:nodeType>} eq '#document') {
764 wakaba 1.1 $class = <ClassName::ManakaiDISDocument>;
765 wakaba 1.5 } elsif ($object->{<Q::swcfg21:nodeType>} eq '#fragment') {
766 wakaba 1.1 $class = <ClassName::ManakaiDISDocumentFragment>;
767     } else {
768     __ASSERT{DISPerl:invariant::
769 wakaba 1.5 msg => {qq[Node type: "$object->{<Q::swcfg21:nodeType>}" ].
770 wakaba 1.1 qq[(ref: "@{[ref $object]}")]},
771     }__;
772     }
773     $r = $object-><M::ManakaiDOM:ManakaiDOMNodeObject::ManakaiDOM:Perl
774     .newReference> ($class);
775    
776 wakaba 1.2 @Attr:
777     @@Name:ownerDISDocument
778     @@Description:
779     @@@lang:en
780     @@@@:
781     The <QUOTE::dis> document object associated with this node.
782     @@Get:
783 wakaba 1.3 @@@Type:ManakaiDISDocument
784 wakaba 1.2 @@@Description:
785     @@@@lang:en
786     @@@@@:
787     The document object associated with this node.
788     @@@InCase:
789     @@@@Value:
790     @@@@@is-null:1
791     @@@@Description:
792     @@@@@lang:en
793     @@@@@@:
794     This node is a document node.
795     @@@PerlDef:
796     $r = <ClassM::ManakaiDISNode.getNodeReference>
797     ($self->{<Q::TreeCore:node>}->{<Q::DOMCore:ownerDocument>})
798     if $self->{<Q::TreeCore:node>}->{<Q::DOMCore:ownerDocument>};
799 wakaba 1.1 ##DISNode
800    
801     ClsDef:
802     @ClsQName: ManakaiDISElement
803 wakaba 1.7 @ClsISA: ManakaiDISNode
804 wakaba 1.1 @ClsISA:
805 wakaba 1.3 swcfg21:ManakaiSWCFGElement::swcfg21:ForLatest
806 wakaba 1.1 @Description:
807     @@lang:en
808     @@@:
809     <QUOTE::dis> element node objects.
810    
811     @Method:
812     @@Name: forMatch
813     @@Description:
814     @@@lang:en
815     @@@@:
816     Tests whether this element is for a <QUOTE::for> or not.
817     @@Param:
818     @@@Name: forArg
819     @@@Type: ForURI
820     @@@Description:
821     @@@@lang:en
822     @@@@@:
823     The <QUOTE::For> URI reference to test against.
824     @@Param:
825     @@@Name: forpArg
826     @@@Type: ForURIList
827     @@@Description:
828     @@@@lang:en
829     @@@@@:
830     The <QUOTE::For+> URI references to test against.
831     @@@InCase:
832     @@@@Value:
833     @@@@@is-null:1
834     @@@@Description:
835     @@@@@lang:en
836     @@@@@@:
837     No additional <QUOTE::For> URI reference.
838 wakaba 1.3 Equivalent to an empty array reference.
839 wakaba 1.1 @@Return:
840     @@@Type:
841     DOMMain:boolean
842     @@@Description:
843     @@@@lang:en
844     @@@@@:
845     Whether this element is for <P::forArg> and <P::forpArg> or not.
846 wakaba 1.2 @@@UndeclaredPrefixException:
847     @@@NoDBException:
848     @@@PerlDef:
849 wakaba 1.3 $forArg = <Q::ManakaiDOM:all> unless defined $forArg;
850     $forpArg ||= [];
851 wakaba 1.2
852     FORMATCH: {
853     __DEEP{
854 wakaba 1.10 my $for_res = $self-><AG::ManakaiDISNode.ownerDISDocument>
855     -><AG::ManakaiDISDocument.disDatabase>
856     -><M::ManakaiDISDatabase.getFor> ($forArg);
857     my $forp_res = [map {
858     $self-><AG::ManakaiDISNode.ownerDISDocument>
859     -><AG::ManakaiDISDocument.disDatabase>
860     -><M::ManakaiDISDatabase.getFor> ($_)
861     } @{$forpArg}];
862    
863     my @ce = @{$self-><M::ManakaiDISElement.disAllChildElements>};
864 wakaba 1.2 for my $ce (@ce) {
865 wakaba 1.3 my $et = $ce-><AG::swcfg21:SWCFGElement::swcfg21:ForLatest
866     .expandedURI>;
867 wakaba 1.2 if ($et eq <Q::dis:ForCheck>) {
868 wakaba 1.9 my $fors = [split /\s+/, $ce-><AG::swcfg21:SWCFGNode
869     ::swcfg21:ForLatest.value>];
870     FCs: for my $f (@$fors) {
871 wakaba 1.2 if ($f =~ /^!=(.+)$/) { ## -- NOT EQUAL TO
872     my $uri = $self-><AG::ManakaiDISElement.qnameToURI> ($1);
873 wakaba 1.9 my $for = $self-><AG::ManakaiDISNode.ownerDISDocument>
874     -><AG::ManakaiDISDocument.disDatabase>
875     -><M::ManakaiDISDatabase.getFor> ($uri);
876     $for-><AG::ManakaiDISForDefinition.isReferred> ($ce);
877 wakaba 1.10 for my $arg_res ($for_res, @{$forp_res}) {
878     if ($arg_res eq $for) {
879 wakaba 1.2 $r = false;
880     last FORMATCH;
881     }
882     }
883     } elsif ($f =~ /^!(.+)$/) { ## -- NOT ISA
884     my $uri = $self-><AG::ManakaiDISElement.qnameToURI> ($1);
885 wakaba 1.9 my $for = $self-><AG::ManakaiDISNode.ownerDISDocument>
886     -><AG::ManakaiDISDocument.disDatabase>
887     -><M::ManakaiDISDatabase.getFor> ($uri);
888     $for-><AG::ManakaiDISForDefinition.isReferred> ($ce);
889 wakaba 1.10 for my $arg_res ($for_res, @{$forp_res}) {
890     if ($arg_res-><M::ManakaiDISForDefinition.isaURI> ($uri)) {
891 wakaba 1.2 $r = false;
892     last FORMATCH;
893     }
894     }
895     } elsif ($f =~ /^=(.+)$/) { ## -- EQUAL TO
896     my $uri = $self-><AG::ManakaiDISElement.qnameToURI> ($1);
897 wakaba 1.9 my $for = $self-><AG::ManakaiDISNode.ownerDISDocument>
898     -><AG::ManakaiDISDocument.disDatabase>
899     -><M::ManakaiDISDatabase.getFor> ($uri);
900     $for-><AG::ManakaiDISForDefinition.isReferred> ($ce);
901 wakaba 1.10 for my $arg_res ($for_res, @{$forp_res}) {
902     if ($arg_res eq $for) {
903 wakaba 1.2 next FCs;
904     }
905     }
906     $r = false;
907     last FORMATCH;
908     } else { ## -- ISA
909 wakaba 1.9 my $uri = $self-><AG::ManakaiDISElement.qnameToURI> ($f);
910     my $for = $self-><AG::ManakaiDISNode.ownerDISDocument>
911     -><AG::ManakaiDISDocument.disDatabase>
912     -><M::ManakaiDISDatabase.getFor> ($uri);
913     $for-><AG::ManakaiDISForDefinition.isReferred> ($ce);
914 wakaba 1.10 for my $arg_res ($for_res, @{$forp_res}) {
915     if ($arg_res-><M::ManakaiDISForDefinition.isaURI> ($uri)) {
916 wakaba 1.2 next FCs;
917     }
918     }
919     $r = false;
920     last FORMATCH;
921     }
922     } # FCs
923     } # dis:ForCheck
924     } # children
925    
926     my $has_for = false;
927     for my $ce (@ce) {
928 wakaba 1.11 if ($ce-><AG::swcfg21:SWCFGElement::swcfg21:ForLatest
929 wakaba 1.3 .expandedURI> eq
930 wakaba 1.2 <Q::dis:For>) {
931 wakaba 1.9 my $fors = [split /\s+/, $ce-><AG::swcfg21:SWCFGNode
932     ::swcfg21:ForLatest.value>];
933 wakaba 1.2 my $ok = true;
934     $has_for = true;
935 wakaba 1.9 AFOR: for my $f (@$fors) {
936 wakaba 1.2 if ($f =~ /^!=(.+)$/) { ## -- NOT EQUAL TO
937     my $uri = $self-><AG::ManakaiDISElement.qnameToURI> ($1);
938 wakaba 1.9 my $for = $self-><AG::ManakaiDISNode.ownerDISDocument>
939     -><AG::ManakaiDISDocument.disDatabase>
940     -><M::ManakaiDISDatabase.getFor> ($uri);
941     $for-><AG::ManakaiDISForDefinition.isReferred> ($ce);
942 wakaba 1.10 if ($for eq $for_res) {
943 wakaba 1.2 $ok = false;
944     last AFOR;
945     }
946     } elsif ($f =~ /^!(.+)$/) { ## -- NOT ISA
947     my $uri = $self-><AG::ManakaiDISElement.qnameToURI> ($1);
948 wakaba 1.9 my $for = $self-><AG::ManakaiDISNode.ownerDISDocument>
949     -><AG::ManakaiDISDocument.disDatabase>
950     -><M::ManakaiDISDatabase.getFor> ($uri);
951     $for-><AG::ManakaiDISForDefinition.isReferred> ($ce);
952 wakaba 1.10 if ($for_res-><M::ManakaiDISForDefinition.isaURI> ($uri)) {
953 wakaba 1.2 $ok = false;
954     last AFOR;
955     }
956     } elsif ($f =~ /^=(.+)$/) { ## -- EQUAL TO
957     my $uri = $self-><AG::ManakaiDISElement.qnameToURI> ($1);
958 wakaba 1.9 my $for = $self-><AG::ManakaiDISNode.ownerDISDocument>
959     -><AG::ManakaiDISDocument.disDatabase>
960     -><M::ManakaiDISDatabase.getFor> ($uri);
961     $for-><AG::ManakaiDISForDefinition.isReferred> ($ce);
962 wakaba 1.10 unless ($for eq $for_res) {
963 wakaba 1.2 $ok = false;
964     last AFOR;
965     }
966     } else { ## -- ISA
967 wakaba 1.9 my $uri = $self-><AG::ManakaiDISElement.qnameToURI> ($f);
968     my $for = $self-><AG::ManakaiDISNode.ownerDISDocument>
969     -><AG::ManakaiDISDocument.disDatabase>
970     -><M::ManakaiDISDatabase.getFor> ($uri);
971     $for-><AG::ManakaiDISForDefinition.isReferred> ($ce);
972 wakaba 1.10 unless ($for_res-><M::ManakaiDISForDefinition.isaURI>($uri)){
973 wakaba 1.2 $ok = false;
974     last AFOR;
975     }
976     }
977     } # AFOR
978 wakaba 1.3 if ($ok) {
979     $r = true;
980     last FORMATCH;
981     }
982 wakaba 1.2 } # dis:For
983     } # $ce
984     $r = $has_for ? false : true;
985     }__;
986     } # FORMATCH
987 wakaba 1.1
988     @Method:
989     @@Name: mediaTypeMatch
990     @@Description:
991     @@@lang:en
992     @@@@:
993     Tests whether the content media type of this element matches to
994     a type or not.
995     @@Param:
996     @@@Name: mediaType
997     @@@Type: MediaTypeURI
998     @@@Description:
999     @@@@lang:en
1000     @@@@@:
1001     A media type URI reference to test against.
1002     @@Param:
1003 wakaba 1.3 @@@Name: defaultMediaType
1004 wakaba 1.1 @@@Type: MediaTypeURI
1005     @@@Description:
1006     @@@@lang:en
1007     @@@@@:
1008     The default media type for this element.
1009     @@@InCase:
1010     @@@@Value:
1011     @@@@@is-null:1
1012     @@@@Description:
1013     @@@@@lang:en
1014     @@@@@@:
1015     No default type provided. All <P::mediaType> will match.
1016 wakaba 1.12 @@ForParam:
1017     @@ForpParam:
1018 wakaba 1.1 @@Return:
1019     @@@Type:
1020     DOMMain:boolean
1021     @@@Description:
1022     @@@@lang:en
1023     @@@@@:
1024     Whether this element is of <P::mediaType> or not.
1025 wakaba 1.2 @@@PerlDef:
1026     if (defined $mediaType) {
1027     __DEEP{
1028     my $ctn = $self-><M::ManakaiDISElement.disGetAttribute>
1029 wakaba 1.12 (<Q::dis:ContentType>, for_arg => $forArg,
1030     forp_arg => $forpArg);
1031 wakaba 1.2 my $ct;
1032     $ct = $ctn-><AG::ManakaiDISElement.qnameValueURI> if $ctn;
1033     $ct = $defaultMediaType unless defined $ct;
1034     my $res = $self-><AG::ManakaiDISNode.ownerDISDocument>
1035     -><AG::ManakaiDISDocument.disDatabase>
1036     -><M::ManakaiDISDatabase.getResource> ($ct);
1037     $res-><AS::ManakaiDISResourceDefinition.isReferred> ($ctn or $self);
1038 wakaba 1.7 unless ($res-><M::ManakaiDISResourceDefinition
1039 wakaba 1.10 .isSubsetOfURI> ($mediaType)) {
1040 wakaba 1.2 $r = false;
1041     } else {
1042     $r = true;
1043     }
1044     }__;
1045     } else {
1046     $r = true;
1047     }
1048 wakaba 1.1
1049     @Method:
1050 wakaba 1.10 @@Name:mediaTypeURI
1051     @@enDesc:
1052     The URI reference of the media type of this element.
1053     @@Type: MediaTypeURI
1054     @@NamedParam:
1055     @@@Name:defaultMediaType
1056     @@@Type:MediaTypeURI
1057     @@@enDesc:
1058     The default media type URI reference.
1059     @@@nullCase:
1060     @@@@enDesc:
1061     No default is specified.
1062     @@ForParam:
1063     @@ForpParam:
1064     @@Return:
1065     @@@enDesc:
1066     The media type URI reference of this element.
1067     @@@nullCase:
1068     @@@@enDesc:
1069     This element has no media type information and
1070     <P::defaultMediaType> parameter is not provided.
1071     @@@UndeclaredPrefixException:
1072     @@@PerlDef:
1073     __DEEP{
1074     my $ctn = $self-><M::ManakaiDISElement.disGetAttribute>
1075     (<Q::dis:ContentType>, for_arg => $forArg,
1076     forp_arg => $forpArg);
1077     $r = $ctn-><AG::ManakaiDISElement.qnameValueURI> if $ctn;
1078     }__;
1079    
1080     @Method:
1081 wakaba 1.1 @@Name: prefixToURI
1082     @@Description:
1083     @@@lang:en
1084     @@@@:
1085     Converts a namespace prefix into associated URI reference.
1086     @@Param:
1087     @@@Name: prefix
1088     @@@Type:
1089 wakaba 1.3 DISCore:NamespacePrefix::ManakaiDOM:all
1090 wakaba 1.1 @@@Description:
1091     @@@@lang:en
1092     @@@@@:
1093     A namespace prefix to look for.
1094     @@@InCase:
1095     @@@@Value:
1096     @@@@@is-null:1
1097     @@@@Description:
1098     @@@@@lang:en
1099     @@@@@@:
1100     Returns the default namespace URI.
1101     @@NodeParam:
1102     @@Return:
1103 wakaba 1.3 @@@Type: AnyURI
1104 wakaba 1.1 @@@Description:
1105     @@@@lang:en
1106     @@@@@: The URI references associated.
1107     @@@UndeclaredPrefixException:
1108     @@@PerlDef:
1109 wakaba 1.3 if (defined $prefix) {
1110 wakaba 1.1 __DEEP{
1111 wakaba 1.3 $r = $self-><M::swcfg21:SWCFGNode::swcfg21:ForLatest
1112     .lookupNamespaceURI> ($prefix);
1113 wakaba 1.1 }__;
1114     unless (defined $r) {
1115     __EXCEPTION{UNDECLARED_NS_PREFIX_ERR::
1116     infoset:prefix => {$prefix},
1117     MDOMX:param-name => 'prefix',
1118     DIS:sourceNode => {$node},
1119     }__;
1120     }
1121 wakaba 1.7 } else { ## Default namespace
1122     __DEEP{
1123     $r = ($self-><AG::ManakaiDISNode.ownerDISDocument> || $self)
1124     -><AG::ManakaiDISDocument.moduleElement>
1125     -><AG::ManakaiDISModuleElement.definingNamespaceURI>;
1126     }__;
1127 wakaba 1.1 }
1128    
1129     @Method:
1130     @@QName: qnameToURI
1131     @@Description:
1132     @@@lang:en
1133     @@@@:
1134     Converts a qualified name (<TYPE::dis:TypeQName>) to
1135     an expanded URI reference.
1136     @@Param:
1137     @@@Name: qname
1138     @@@Type:
1139     dis:TypeQName
1140     @@@Description:
1141     @@@@lang:en
1142     @@@@@:
1143     A qualified name.
1144     @@NodeParam:
1145     @@Return:
1146     @@@Type: AnyURI
1147     @@@Description:
1148     @@@@lang:en
1149     @@@@@:
1150     The expanded URI reference.
1151     @@@UndeclaredPrefixException:
1152     @@@PerlDef:
1153     $qname =~ s/^\s+//; $qname =~ s/\s+$//;
1154 wakaba 1.9 my ($prefix, $lname) = split /:/, $qname, 2;
1155 wakaba 1.1 __DEEP{
1156     if (defined $lname) {
1157     $r = $self-><M::ManakaiDISElement.prefixToURI> ($prefix) . $lname;
1158     } else { ## In default namespace
1159     $r = $self-><M::ManakaiDISElement.prefixToURI> (null) . $prefix;
1160     }
1161 wakaba 1.4 }__;
1162 wakaba 1.1
1163     @Method:
1164     @@QName: qnameToPair
1165     @@Description:
1166     @@@lang:en
1167     @@@@:
1168     Converts a qualified name (<TYPE::dis:TypeQName>) to
1169     a pair of namespace URI and local name.
1170     @@Param:
1171     @@@Name: qname
1172     @@@Type:
1173     dis:TypeQName
1174     @@@Description:
1175     @@@@lang:en
1176     @@@@@:
1177     A qualified name.
1178     @@NodeParam:
1179     @@Return:
1180     @@@Type:
1181     Perl:ARRAY
1182     @@@Description:
1183     @@@@lang:en
1184     @@@@@:
1185     A list of namespace URI and local name.
1186     @@@UndeclaredPrefixException:
1187     @@@PerlDef:
1188     $qname =~ s/^\s+//; $qname =~ s/\s+$//;
1189 wakaba 1.9 my ($prefix, $lname) = split /:/, $qname, 2;
1190 wakaba 1.1 __DEEP{
1191     if (defined $lname) {
1192     $r = [$self-><M::ManakaiDISElement.prefixToURI> ($prefix), $lname];
1193     } else { ## In default namespace
1194     $r = [$self-><M::ManakaiDISElement.prefixToURI> (null), $prefix];
1195     }
1196 wakaba 1.4 }__;
1197 wakaba 1.1
1198     @Method:
1199 wakaba 1.3 @@Name: tfqnamesToURI
1200 wakaba 1.1 @@Description:
1201     @@@lang:en
1202     @@@@:
1203 wakaba 1.3 Converts a <TYPE::dis:TFQNames>
1204 wakaba 1.1 into an expanded URI reference.
1205     @@Param:
1206     @@@Name: tfqnames
1207     @@@Type:
1208 wakaba 1.3 dis:TFQNames
1209 wakaba 1.1 @@@Description:
1210     @@@@lang:en
1211     @@@@@:
1212 wakaba 1.3 A <TYPE::dis:TFQNames> to identify a resource.
1213 wakaba 1.1 @@Param:
1214     @@@Name: defaultTypeURI
1215     @@@Type: NameURI
1216     @@@Description:
1217     @@@@lang:en
1218     @@@@@:
1219     A name URI reference used if it is missing from
1220     <P::tfqnames>.
1221     @@@InCase:
1222     @@@@Value:
1223     @@@@@is-null:1
1224     @@@@Description:
1225     @@@@@lang:en
1226     @@@@@@:
1227     Equivalent to <Q::DOMMain:any>.
1228     @@Param:
1229     @@@Name: defaultForURI
1230     @@@Type: ForURI
1231     @@@Description:
1232     @@@@lang:en
1233     @@@@@:
1234     A <QUOTE::for> URI reference used if it is missing from
1235     <P::tfqnames>.
1236     @@@InCase:
1237     @@@@Value:
1238     @@@@@is-null:1
1239     @@@@Description:
1240     @@@@@lang:en
1241     @@@@@@:
1242     Equivalent to <QUOTE::for all>, i.e. <Q::ManakaiDOM:all>.
1243     @@NodeParam:
1244     @@Return:
1245     @@@Type:
1246 wakaba 1.3 DISCore:TFURI::ManakaiDOM:all
1247 wakaba 1.1 @@@Description:
1248     @@@@lang:en
1249     @@@@@:
1250 wakaba 1.3 The <TYPE::dis:TFQNames>-expanded URI references.
1251 wakaba 1.1 @@@UndeclaredPrefixException:
1252     @@@PerlDef:
1253     my ($typeq, $forq) = split /\s*::\s*/, $tfqnames, 2;
1254     my ($typeURI, $forURI);
1255     if (defined $forq) {
1256     __DEEP{
1257     $typeURI = $typeq eq ''
1258     ? defined $defaultTypeURI ? $defaultTypeURI
1259     : <Q::DOMMain:any>
1260     : $self-><M::ManakaiDISElement.qnameToURI> ($typeq, %opt);
1261     }__;
1262     if (length $forq) {
1263     $forURI = $self-><M::ManakaiDISElement.qnameToURI> ($forq, %opt);
1264     } else {
1265     $forURI = <Q::ManakaiDOM:all>;
1266     }
1267     } else { ## "For" omitted
1268     __DEEP{
1269     $typeURI = $typeq eq ''
1270     ? defined $defaultTypeURI ? $defaultTypeURI
1271     : <Q::DOMMain:any>
1272     : $self-><M::ManakaiDISElement.qnameToURI> ($typeq, %opt);
1273     }__;
1274 wakaba 1.3 $forURI = defined $defaultForURI ? $defaultForURI
1275     : <Q::ManakaiDOM:all>;
1276 wakaba 1.1 }
1277 wakaba 1.4 __CODE{tfurisToURI:: $turi => $typeURI, $furi => $forURI, $uri => $r}__;
1278 wakaba 1.2
1279     @Method:
1280     @@Name: disGetAttribute
1281     @@enDesc:
1282     Gets an attribute node.
1283     @@Param:
1284     @@@Name: attrName
1285     @@@Type: AnyURI
1286     @@@enDesc:
1287     The name expanded URI of the node to retrieve.
1288     @@ForParam:
1289     @@ForpParam:
1290     @@MediaTypeParam:
1291     @@MediaTypeDefaultParam:
1292     @@Return:
1293     @@@Type: ManakaiDISElement
1294     @@@enDesc:
1295     The attribute (property) element node.
1296     @@@nullCase:
1297     @@@@enDesc:
1298     No attribute node found.
1299     @@@PerlDef:
1300 wakaba 1.10 for my $c (@{$self-><M::ManakaiDISElement.disChildElements>
1301     (for_arg => $forArg, forp_arg => $forpArg)}) {
1302 wakaba 1.3 if ($c-><AG::swcfg21:SWCFGElement::swcfg21:ForLatest
1303     .expandedURI> eq $attrName and
1304 wakaba 1.12 $c-><M::ManakaiDISElement.mediaTypeMatch>
1305     ($mediaType, $defaultMediaType,
1306     for_arg => $forArg, forp_arg => $forpArg)) {
1307 wakaba 1.2 $r = $c;
1308     last;
1309     }
1310     }
1311    
1312     @Method:
1313     @@Name: disGetAttributeList
1314     @@enDesc:
1315     Gets attribute nodes.
1316 wakaba 1.3 @@Param:
1317     @@@Name: attrName
1318     @@@Type: AnyURI
1319     @@@enDesc:
1320     The name expanded URI of the node to retrieve.
1321 wakaba 1.2 @@ForParam:
1322     @@ForpParam:
1323     @@MediaTypeParam:
1324     @@MediaTypeDefaultParam:
1325     @@Return:
1326     @@@Type: ManakaiDISElementList
1327     @@@enDesc:
1328     The attribute (property) element nodes.
1329     @@@PerlDef:
1330     $r = bless [], <ClassName::ManakaiDISElementList>;
1331 wakaba 1.10 for my $c (@{$self-><M::ManakaiDISElement.disChildElements>
1332     (for_arg => $forArg, forp_arg => $forpArg)}) {
1333 wakaba 1.3 if ($c-><AG::swcfg21:SWCFGElement::swcfg21:ForLatest
1334     .expandedURI> eq $attrName and
1335 wakaba 1.12 $c-><M::ManakaiDISElement.mediaTypeMatch>
1336     ($mediaType, $defaultMediaType,
1337     for_arg => $forArg, forp_arg => $forpArg)) {
1338 wakaba 1.2 push @$r, $c;
1339     }
1340     }
1341    
1342 wakaba 1.4 @Method:
1343 wakaba 1.2 @@Name: disChildElements
1344     @@enDesc:
1345 wakaba 1.10 A list of child elements, with <QUOTE::for> check.
1346 wakaba 1.4 @@ForParam:
1347     @@ForpParam:
1348     @@Return:
1349     @@@Type: ManakaiDISElementList
1350 wakaba 1.2 @@@enDesc:
1351     The current snapshot of child nodes.
1352     @@@PerlDef:
1353 wakaba 1.4 $r = bless [], <ClassName::ManakaiDISElementList>;
1354     __DEEP{
1355     for my $cn (@{$self-><AG::swcfg21:SWCFGNode::swcfg21:ForLatest
1356     .childNodes>}) {
1357     ## $cn is an #element.
1358     my $dn = $cn->{<Q::TreeCore:node>}
1359     -><M::ManakaiDOM:ManakaiDOMNodeObject
1360     ::ManakaiDOM:Perl.newReference>
1361     (<ClassName::ManakaiDISElement>);
1362     next unless $dn-><M::ManakaiDISElement.forMatch> ($forArg, $forpArg);
1363     push @$r, $dn;
1364     }
1365     }__;
1366 wakaba 1.5
1367 wakaba 1.10 @Method:
1368     @@Name: disAllChildElements
1369     @@enDesc:
1370     A list of child elements, without <QUOTE::for> check.
1371     @@Return:
1372     @@@Type: ManakaiDISElementList
1373     @@@enDesc:
1374     The current snapshot of child nodes.
1375     @@@PerlDef:
1376     $r = bless [], <ClassName::ManakaiDISElementList>;
1377     __DEEP{
1378     for my $cn (@{$self-><AG::swcfg21:SWCFGNode::swcfg21:ForLatest
1379     .childNodes>}) {
1380     ## $cn is an #element.
1381     my $dn = $cn->{<Q::TreeCore:node>}
1382     -><M::ManakaiDOM:ManakaiDOMNodeObject
1383     ::ManakaiDOM:Perl.newReference>
1384     (<ClassName::ManakaiDISElement>);
1385     push @$r, $dn;
1386     }
1387     }__;
1388    
1389 wakaba 1.2 @Attr:
1390     @@Name: qnameValueURI
1391     @@enDesc:
1392     The element value (written as <TYPE::dis:TypeQName>), as URI reference.
1393     \
1394     {NOTE:: What should be if list value?
1395     \
1396     }
1397     @@Get:
1398     @@@Type:AnyURI
1399     @@@nullCase:
1400     @@@@enDesc:
1401     No value.
1402     @@@UndeclaredPrefixException:
1403 wakaba 1.3 @@@PerlDef:
1404 wakaba 1.4 __DEEP{
1405     my $v = $self-><AG::swcfg21:SWCFGNode::swcfg21:ForLatest.value>;
1406     if (defined $v and not ref $v eq 'ARRAY') {
1407     $r = $self-><AG::ManakaiDISElement.qnameToURI> ($v, node => $self);
1408     } else {
1409     $r = null;
1410     }
1411     }__;
1412    
1413     @Attr:
1414     @@Name: qnameValueLocalName
1415     @@enDesc:
1416     The local name part of the element value (assumed as
1417     written as <TYPE::dis:TypeQName>).
1418     \
1419     {NOTE:: What should be if list value?
1420     \
1421     }
1422     @@Get:
1423     @@@Type:
1424     DISCore:LocalName
1425     @@@nullCase:
1426     @@@@enDesc:
1427     No value.
1428     @@@PerlDef:
1429     __DEEP{
1430     my $v = $self-><AG::swcfg21:SWCFGNode::swcfg21:ForLatest.value>;
1431     if (defined $v and not ref $v eq 'ARRAY') {
1432     my ($n, $v) = split /:/, $v, 2;
1433     $r = defined $v ? $v : $n;
1434     } else {
1435     $r = null;
1436     }
1437     }__;
1438    
1439     @Attr:
1440     @@Name: qnameValueNamespaceURI
1441     @@enDesc:
1442     The namespace URI of the element value (assumed as written
1443     in <TYPE::dis:TypeQName>).
1444     \
1445     {NOTE:: What should be if list value?
1446     \
1447     }
1448     @@Get:
1449     @@@Type:AnyURI
1450     @@@nullCase:
1451     @@@@enDesc:
1452     No value.
1453     @@@UndeclaredPrefixException:
1454     @@@PerlDef:
1455     __DEEP{
1456     my $v = $self-><AG::swcfg21:SWCFGNode::swcfg21:ForLatest.value>;
1457     if (defined $v and not ref $v eq 'ARRAY') {
1458     my ($p, $v) = split /:/, $v, 2;
1459     $r = $self-><AG::ManakaiDISElement.prefixToURI>
1460     (defined $v ? $p : null);
1461     } else {
1462     $r = null;
1463     }
1464     }__;
1465 wakaba 1.2
1466 wakaba 1.6 @Method:
1467 wakaba 1.3 @@Name: tfqnamesValueURI
1468 wakaba 1.2 @@enDesc:
1469 wakaba 1.3 The element value (written as <TYPE::dis:TFQNames>),
1470 wakaba 1.2 as URI reference.
1471     \
1472     {NOTE:: What should be if list value?
1473     \
1474     }
1475 wakaba 1.6 @@Param:
1476     @@@Name: defaultTypeURI
1477     @@@Type: NameURI
1478     @@@Description:
1479     @@@@lang:en
1480     @@@@@:
1481     A name URI reference used if it is missing from
1482     <P::tfqnames>.
1483     @@@InCase:
1484     @@@@Value:
1485     @@@@@is-null:1
1486     @@@@Description:
1487     @@@@@lang:en
1488     @@@@@@:
1489     Equivalent to <Q::DOMMain:any>.
1490     @@Param:
1491     @@@Name: defaultForURI
1492     @@@Type: ForURI
1493     @@@Description:
1494     @@@@lang:en
1495     @@@@@:
1496     A <QUOTE::for> URI reference used if it is missing from
1497     <P::tfqnames>.
1498     @@@InCase:
1499     @@@@Value:
1500     @@@@@is-null:1
1501     @@@@Description:
1502     @@@@@lang:en
1503     @@@@@@:
1504     Equivalent to <QUOTE::for all>, i.e. <Q::ManakaiDOM:all>.
1505     @@Return:
1506 wakaba 1.2 @@@Type:ResourceURI
1507     @@@nullCase:
1508     @@@@enDesc:
1509     No value.
1510     @@@UndeclaredPrefixException:
1511 wakaba 1.3 @@@PerlDef:
1512     my $v = $self-><AG::swcfg21:SWCFGNode::swcfg21:ForLatest.value>;
1513 wakaba 1.2 if (defined $v and not ref $v eq 'ARRAY') {
1514     __DEEP{
1515 wakaba 1.6 $r = $self-><AG::ManakaiDISElement.tfqnamesToURI>
1516     ($v, $defaultTypeURI, $defaultForURI);
1517 wakaba 1.2 }__;
1518     } else {
1519     $r = null;
1520     }
1521 wakaba 1.7
1522     @Method:
1523     @@Name: elementTypeMatch
1524     @@enDesc:
1525     Returns whether the element type of this element matches
1526     with another element type (either the same element type or
1527     this type is a subtype of another type).
1528     @@Param:
1529     @@@Name: etype
1530     @@@Type: ResourceURI
1531     @@@enDesc:
1532     An element type name URI reference to test.
1533     @@Return:
1534     @@@Type:
1535     DOMMain:boolean
1536     @@@TrueCase:
1537     @@@@enDesc:
1538     Either the element type expanded URI reference of this element is
1539     same as <P::etype> or it is a sub-element type of <P::etype>.
1540     @@@FalseCase:
1541     @@@@enDesc:
1542     This element is not of <P::etype>.
1543     @@@NoDBException:
1544     @@@PerlDef:
1545     __DEEP{
1546     my $et = $self-><M::swcfg21:SWCFGElement::swcfg21:ForLatest
1547     .expandedURI>;
1548     my $rdef = $self-><AG::ManakaiDISNode.ownerDISDocument>
1549     -><AG::ManakaiDISDocument.disDatabase>
1550     -><M::ManakaiDISDatabase.getResource> ($et);
1551     $r = $rdef-><M::ManakaiDISResourceDefinition.isSubsetOfURI> ($etype);
1552     }__;
1553    
1554     @Attr:
1555     @@Name: isResourceElement
1556     @@enDesc:
1557     Whether this element defines a resource or not.
1558     \
1559     {NOTE:: An element defines a resource if its element type is
1560     <Q::dis:ResourceDef> or its subtype.
1561     \
1562     }
1563     @@Get:
1564     @@@Type:
1565     DOMMain:boolean
1566     @@@TrueCase:
1567     @@@@enDesc:
1568     This element defines a resource.
1569     @@@FalseCase:
1570     @@@@enDesc:
1571     This element does not define any resource.
1572     @@@NoDBException:
1573     @@@PerlDef:
1574     __DEEP{
1575     $r = $self-><M::ManakaiDISElement.elementTypeMatch>
1576     (<Q::dis:ResourceDef>);
1577     }__;
1578    
1579     @Attr:
1580     @@Name: isPropertyElement
1581     @@enDesc:
1582     Whether this element is a property or not.
1583     \
1584     {NOTE:: An element is a property if its element type is
1585     <Q::rdf:type> or if its element type's <Q::rdf:type>
1586     property is <Q::rdf:Property> or is <Q::dis:subsetOf>
1587     <Q::rdf:Property>.
1588     \
1589     }
1590     @@Get:
1591     @@@Type:
1592     DOMMain:boolean
1593     @@@TrueCase:
1594     @@@@enDesc:
1595     This element is a property.
1596     @@@FalseCase:
1597     @@@@enDesc:
1598     This element is not a property.
1599     @@@NoDBException:
1600     @@@PerlDef:
1601     __DEEP{
1602     my $xn = $self-><AG::swcfg21:SWCFGElement::swcfg21:ForLatest
1603     .expandedURI>;
1604     if ($xn eq <Q::rdf:type>) {
1605     $r = true;
1606     } else {
1607     my $rdef = $self-><AG::ManakaiDISNode.ownerDISDocument>
1608     -><AG::ManakaiDISDocument.disDatabase>
1609     -><M::ManakaiDISDatabase.getResource> ($xn);
1610     $r = $rdef-><M::ManakaiDISResourceDefinition.isTypeURI>
1611     (<Q::rdf:Resource>);
1612     }
1613     }__;
1614 wakaba 1.1 ##DISElement
1615    
1616     ClsDef:
1617 wakaba 1.4 @ClsQName: ManakaiDISModuleElement
1618     @ClsISA: ManakaiDISElement
1619     @enDesc:
1620     The <Q::dis:Module> elements.
1621    
1622     @Attr:
1623     @@Name: requireElement
1624     @@enDesc:
1625     The <Q::dis:Require> child element. The element is
1626     newly created if not exist.
1627     @@Type: ManakaiDISElement
1628     @@Get:
1629     @@@PerlDef:
1630     __DEEP{
1631     $r = $self-><M::swcfg21:SWCFGNode
1632     ::swcfg21:ForLatest.getAttributeNS>
1633     (<Q::dis:>, 'Require', make_new_node => true);
1634     }__;
1635    
1636     @Attr:
1637     @@Name: defaultForURI
1638     @@enDesc:
1639     The value of <Q::dis:DefaultFor> attribute.
1640     @@Type: ForURI
1641     @@Get:
1642     @@@enDesc:
1643     The value of <Q::dis:DefaultFor> child element. If missing,
1644     <Q::ManakaiDOM:all> is returned.
1645     @@@PerlDef:
1646     __DEEP{
1647     my $df = $self-><M::swcfg21:SWCFGNode::swcfg21:ForLatest
1648     .getAttributeNS>
1649     (<Q::dis:>, 'DefaultFor');
1650     if ($df) {
1651     $r = $df-><AG::ManakaiDISElement.qnameValueURI>
1652     || <Q::ManakaiDOM:all>;
1653     } else {
1654     $r = <Q::ManakaiDOM:all>;
1655     }
1656     }__;
1657     @@Set:
1658     @@@PerlDef:
1659     __DEEP{
1660     $self-><M::swcfg21:SWCFGNode::swcfg21:ForLatest.setAttributeNS>
1661     (<Q::dis:>, 'DefaultFor' => $given);
1662     }__;
1663 wakaba 1.7
1664     @Attr:
1665     @@Name: definingNamespaceURI
1666     @@enDesc:
1667     The value of <Q::dis:NamespaceURI> attribute, i.e.
1668     the URI reference of the namespace that this module primary
1669     defines.
1670     \
1671     {NOTE:: Defining namespace URI is <QUOTE::for> independent.
1672     \
1673     }
1674     @@Type: AnyURI
1675     @@Get:
1676     @@@PerlDef:
1677     __DEEP{
1678     my $df = $self-><M::swcfg21:SWCFGNode::swcfg21:ForLatest
1679     .getAttributeNS>
1680     (<Q::dis:>, 'Namespace');
1681     if ($df) {
1682     $r = $df-><AG::swcfg21:SWCFGNode::swcfg21:ForLatest.value>;
1683     } else {
1684     __ASSERT{DISPerl:invariant::
1685     msg => {qq["dis:Namespace" attribute not found]},
1686     }__;
1687     }
1688     }__;
1689     @@Set:
1690     @@@PerlDef:
1691     __DEEP{
1692     $self-><M::swcfg21:SWCFGNode::swcfg21:ForLatest.setAttributeNS>
1693     (<Q::dis:>, 'Namespace' => $given);
1694     }__;
1695 wakaba 1.4 ##DISModuleElement
1696    
1697     ClsDef:
1698 wakaba 1.2 @ClsQName: ManakaiDISElementList
1699     @enDesc:
1700     @@lang:en
1701     @@@:
1702     Lists of elements.
1703     \
1704     {NOTE:: <Class::ManakaiDISElementList> is <QUOTE::dead>;
1705     later changes to the tree does not affect this type of objects.
1706     \
1707     }
1708     ##DISElementList
1709    
1710     ClsDef:
1711 wakaba 1.1 @ClsQName: ManakaiDISComment
1712 wakaba 1.7 @ClsISA: ManakaiDISNode
1713 wakaba 1.1 @ClsISA:
1714 wakaba 1.3 swcfg21:ManakaiSWCFGComment::swcfg21:ForLatest
1715 wakaba 1.1 @Description:
1716     @@lang:en
1717     @@@:
1718     <QUOTE::dis> comment node objects.
1719     ##DISComment
1720    
1721     ClsDef:
1722     @ClsQName: ManakaiDISDocumentFragment
1723 wakaba 1.7 @ClsISA: ManakaiDISNode
1724 wakaba 1.1 @ClsISA:
1725 wakaba 1.3 swcfg21:ManakaiSWCFGDocumentFragment::swcfg21:ForLatest
1726 wakaba 1.1 @Description:
1727     @@lang:en
1728     @@@:
1729     <QUOTE::dis> document fragment node objects.
1730     ##DISDocumentFragment
1731    
1732     ClsDef:
1733     @ClsQName: ManakaiDISDocument
1734 wakaba 1.7 @ClsISA: ManakaiDISNode
1735 wakaba 1.1 @ClsISA:
1736 wakaba 1.3 swcfg21:ManakaiSWCFGDocument::swcfg21:ForLatest
1737 wakaba 1.1 @Description:
1738     @@lang:en
1739     @@@:
1740     <QUOTE::dis> document node objects.
1741 wakaba 1.2
1742     @Attr:
1743 wakaba 1.4 @@Name: moduleElement
1744     @@enDesc:
1745     The <Q::dis:Module> element in this document. The element is
1746     newly created if not exist.
1747     @@Type: ManakaiDISModuleElement
1748     @@Get:
1749     @@@PerlDef:
1750     __DEEP{
1751     $r = $self-><M::swcfg21:SWCFGNode
1752     ::swcfg21:ForLatest.getAttributeNS>
1753     (<Q::dis:>, 'Module', make_new_node => true);
1754     }__;
1755     $r = bless $r, <ClassName::ManakaiDISModuleElement>;
1756    
1757     @Attr:
1758 wakaba 1.2 @@Name: disDatabase
1759     @@enDesc:
1760     Associated <QUOTE::dis> database.
1761    
1762     @@Type: ManakaiDISDatabase
1763     @@Get:
1764     @@@NoDBException:
1765     @@@PerlDef:
1766     if ($self->{<Q::TreeCore:node>}->{<Q::db>}) {
1767 wakaba 1.5 $r = $self->{<Q::TreeCore:node>}->{<Q::db>};
1768 wakaba 1.2 } else {
1769     __EXCEPTION{NO_ASSOCIATED_DB_ERR}__;
1770     }
1771     @@Set:
1772     @@@PerlDef:
1773     $self->{<Q::TreeCore:node>}->{<Q::db>} = $given;
1774     require Scalar::Util;
1775     Scalar::Util::weaken ($self->{<Q::TreeCore:node>}->{<Q::db>});
1776 wakaba 1.5
1777     @Method:
1778     @@Name: disChildElements
1779     @@enDesc:
1780 wakaba 1.10 A list of child elements, with <QUOTE::for> checks.
1781 wakaba 1.5 @@ForParam:
1782     @@ForpParam:
1783     @@Return:
1784     @@@Type: ManakaiDISElementList
1785     @@@enDesc:
1786     The current snapshot of child nodes.
1787     @@@PerlDef:
1788     $r = bless [], <ClassName::ManakaiDISElementList>;
1789     __DEEP{
1790     for my $cn (@{$self-><AG::swcfg21:SWCFGNode::swcfg21:ForLatest
1791     .childNodes>}) {
1792     next unless $cn-><AG::swcfg21:SWCFGNode::swcfg21:ForLatest
1793     .nodeType> eq '#element';
1794     my $dn = $cn->{<Q::TreeCore:node>}
1795     -><M::ManakaiDOM:ManakaiDOMNodeObject
1796     ::ManakaiDOM:Perl.newReference>
1797     (<ClassName::ManakaiDISElement>);
1798     next unless $dn-><M::ManakaiDISElement.forMatch> ($forArg, $forpArg);
1799     push @$r, $dn;
1800     }
1801     }__;
1802 wakaba 1.10
1803     @Method:
1804     @@Name: disAllChildElements
1805     @@enDesc:
1806     A list of child elements, without <QUOTE::for> checks.
1807     @@Return:
1808     @@@Type: ManakaiDISElementList
1809     @@@enDesc:
1810     The current snapshot of child nodes.
1811     @@@PerlDef:
1812     $r = bless [], <ClassName::ManakaiDISElementList>;
1813     __DEEP{
1814     for my $cn (@{$self-><AG::swcfg21:SWCFGNode::swcfg21:ForLatest
1815     .childNodes>}) {
1816     next unless $cn-><AG::swcfg21:SWCFGNode::swcfg21:ForLatest
1817     .nodeType> eq '#element';
1818     my $dn = $cn->{<Q::TreeCore:node>}
1819     -><M::ManakaiDOM:ManakaiDOMNodeObject
1820     ::ManakaiDOM:Perl.newReference>
1821     (<ClassName::ManakaiDISElement>);
1822     push @$r, $dn;
1823     }
1824     }__;
1825 wakaba 1.1 ##DISDocument
1826 wakaba 1.2
1827     PropDef:
1828     @QName: db
1829     @enDesc:
1830     Associated <QUOTE::dis> database.
1831     @rdfs:domain: ManakaiDISDocument
1832     @rdfs:range: ManakaiDISDatabase
1833    
1834     ## -- Definition object database
1835    
1836     ClsDef:
1837     @ClsQName: ManakaiDISDatabase
1838     @enDesc:
1839     Resource database created from <QUOTE::dis> source data.
1840 wakaba 1.4 @ClsISA: ManakaiDISExceptionTarget
1841 wakaba 1.2
1842     @Method:
1843     @@Name: getModule
1844     @@Description:
1845     @@@lang:en
1846     @@@@:
1847     Returns a <QUOTE::dis> module definition.
1848     @@Param:
1849 wakaba 1.9 @@@Name: moduleURI
1850 wakaba 1.2 @@@Type: ModuleURI
1851     @@@Description:
1852     @@@@lang:en
1853     @@@@@:
1854     A <QUOTE::dis> module URI reference.
1855 wakaba 1.9 @@ForParam:
1856 wakaba 1.2 @@Return:
1857     @@@Type: ManakaiDISModuleDefinition
1858     @@@Description:
1859     @@@@lang:en
1860     @@@@@:
1861     The module definition.
1862     @@@PerlDef:
1863 wakaba 1.9 my $modURI;
1864     if (defined $forArg) {
1865     __CODE{tfurisToURI:: $turi => $moduleURI, $furi => $forArg,
1866     $uri => $modURI}__;
1867     } else {
1868     $modURI = $moduleURI;
1869     }
1870 wakaba 1.2 if (defined $self->{modDef}->{$modURI}) {
1871     $r = $self->{modDef}->{$modURI};
1872     } else {
1873     $r = $self->{modDef}->{$modURI}
1874     = bless {
1875     uri => $modURI,
1876     db => $self,
1877     for => <Q::ManakaiDOM:all>,
1878     forp => [],
1879     }, <ClassName::ManakaiDISModuleDefinition>;
1880     require Scalar::Util;
1881     Scalar::Util::weaken ($r->{db});
1882     }
1883    
1884     @Method:
1885     @@Name: getFor
1886     @@Description:
1887     @@@lang:en
1888     @@@@:
1889     Returns a <QUOTE::for> definition object.
1890     @@Param:
1891     @@@Name: forURI
1892     @@@Type: ForURI
1893     @@@Description:
1894     @@@@lang:en
1895     @@@@@:
1896     A <QUOTE::for> URI reference.
1897     @@@InCase:
1898     @@@@Value:
1899     @@@@@is-null:1
1900     @@@@Description:
1901     @@@@@lang:en
1902     @@@@@@:
1903     Defaulted to <Q::ManakaiDOM:all>.
1904     @@Return:
1905     @@@Type: ManakaiDISForDefinition
1906     @@@PerlDef:
1907     $forURI = <Q::ManakaiDOM:all> unless defined $forURI;
1908     if (defined $self->{forDef}->{$forURI}) {
1909     $r = $self->{forDef}->{$forURI};
1910     } else {
1911     $r = $self->{forDef}->{$forURI}
1912     = bless {
1913     uri => $forURI,
1914     isa => {<Q::ManakaiDOM:all> => true},
1915     revISA => {},
1916     db => $self,
1917     }, <ClassName::ManakaiDISForDefinition>;
1918     $self->{forDef}->{<Q::ManakaiDOM:all>}->{revISA}->{$forURI} = true;
1919     require Scalar::Util;
1920     Scalar::Util::weaken ($r->{db});
1921     }
1922    
1923     @Method:
1924     @@Name: getResource
1925     @@Description:
1926     @@@lang:en
1927     @@@@:
1928     Returns a <QUOTE::dis> resource definition.
1929     @@Param:
1930 wakaba 1.9 @@@Name: resourceURI
1931 wakaba 1.2 @@@Type: ResourceURI
1932     @@@Description:
1933     @@@@lang:en
1934     @@@@@:
1935     A <QUOTE::dis> resource URI reference.
1936 wakaba 1.3 @@@nullCase:
1937 wakaba 1.2 @@@@Description:
1938     @@@@@lang:en
1939     @@@@@@:
1940     Defaulted to <Q::DOMMain:any>.
1941 wakaba 1.9 @@ForParam:
1942 wakaba 1.2 @@Return:
1943     @@@Type: ManakaiDISResourceDefinition
1944     @@@Description:
1945     @@@@lang:en
1946     @@@@@:
1947     The resource definition.
1948     @@@PerlDef:
1949 wakaba 1.9 $resourceURI = <Q::DOMMain:any> unless defined $resourceURI;
1950     my $resURI;
1951     if (defined $forArg) {
1952     __CODE{tfurisToURI:: $turi => $resourceURI, $furi => $forArg,
1953     $uri => $resURI}__;
1954     } else {
1955     $resURI = $resourceURI;
1956     }
1957 wakaba 1.2 if (defined $self->{resDef}->{$resURI}) {
1958     $r = $self->{resDef}->{$resURI};
1959     } else {
1960     $r = $self->{resDef}->{$resURI}
1961     = bless {
1962     uri => $resURI,
1963 wakaba 1.6 aliasURI => {$resURI => true},
1964 wakaba 1.2 subOf => {},
1965     supOf => {},
1966     db => $self,
1967     for => <Q::ManakaiDOM:all>,
1968     forp => [],
1969 wakaba 1.9 seq => -1,
1970 wakaba 1.2 }, <ClassName::ManakaiDISResourceDefinition>;
1971     require Scalar::Util;
1972     Scalar::Util::weaken ($r->{db});
1973     }
1974 wakaba 1.3
1975     @Method:
1976     @@Name: getSourceFile
1977     @@enDesc:
1978     Gets <QUOTE::dis> source document.
1979     @@Param:
1980     @@@Name: fileName
1981     @@@Type: FileURI
1982     @@@enDesc:
1983     A URI reference identifying a file.
1984     @@Return:
1985     @@@Type: ManakaiDISDocument
1986     @@@enDesc:
1987     The <QUOTE::dis> source document.
1988     @@@nullCase:
1989     @@@@enDesc:
1990     No document associated with that <P::fileName>.
1991     @@@PerlDef:
1992     $r = $self->{<Q::sourceFile>}->{$fileName};
1993     @Method:
1994     @@Name: setSourceFile
1995     @@enDesc:
1996     Puts <QUOTE::dis> source document object.
1997     @@Param:
1998     @@@Name: fileName
1999     @@@Type: FileURI
2000     @@@enDesc:
2001 wakaba 1.4 A URI reference identifying a file. If there is already a
2002 wakaba 1.3 source document, then the association has been updated.
2003     @@Param:
2004     @@@Name: doc
2005     @@@Type: ManakaiDISDocument
2006     @@@enDesc:
2007     The document object to set.
2008     @@Return:
2009     @@@PerlDef:
2010     $self->{<Q::sourceFile>}->{$fileName} = $doc;
2011 wakaba 1.4
2012     @Method:
2013     @@Name: loadModule
2014     @@enDesc:
2015     Loads definitions from a <QUOTE::dis> document.
2016     @@Param:
2017     @@@Name: doc
2018     @@@Type:ManakaiDISDocument
2019     @@@enDesc:
2020     The source <QUOTE::dis> document object. Its
2021     <A::ManakaiDISDocument.disDatabase> must be this database.
2022     @@Param:
2023     @@@Name: resolver
2024     @@@Type: DISModuleResolver
2025     @@@enDesc:
2026     The resolver to convert module name into <QUOTE::dis> document object.
2027     @@ForParam:
2028     @@Return:
2029     @@@RaiseException:
2030     @@@@@: NO_MODULE_QNAME_ERR
2031     @@@@enDesc:
2032     The <Q::dis:Module> element must have a <Q::dis:QName> attribute.
2033     @@@RaiseException:
2034     @@@@@: UNABLE_TO_GET_MODULE_ERR
2035     @@@@enDesc:
2036     The implementation is unable to get a module source.
2037 wakaba 1.5 @@@ForDefDupException:
2038     @@@ForDefNoQNameException:
2039     @@@ResDefDupException:
2040     @@@ElementNotAllowedException:
2041 wakaba 1.7 @@@RaiseException:
2042     @@@@@:NO_REQUIRED_ATTR_ERR
2043     @@@@enDesc:
2044     The <Q::dis:Module> element does not have
2045     <Q::dis:Namespace> attribute.
2046 wakaba 1.4 @@@PerlDef:
2047     $resolver = bless $resolver, <ClassName::ManakaiDISModuleResolver>
2048     if ref $resolver eq 'CODE';
2049     ## -- Module Name, URI
2050     $forArg = <Q::ManakaiDOM:all> unless defined $forArg;
2051     my $mod_node;
2052     my $mod_name_node;
2053     __DEEP{
2054     $mod_node = $doc-><AG::ManakaiDISDocument.moduleElement>;
2055     $mod_name_node = $mod_node-><M::swcfg21:SWCFGNode
2056     ::swcfg21:ForLatest.getAttributeNS>
2057     (<Q::dis:>, 'QName');
2058     unless ($mod_name_node) {
2059     __UNDEEP{
2060     __EXCEPTION{NO_MODULE_QNAME_ERR::
2061     DIS:sourceNode => {$mod_node},
2062     }__;
2063     }__;
2064     }
2065 wakaba 1.5 my $mod_name_uri = $mod_name_node
2066     -><AG::ManakaiDISElement.qnameValueURI>;
2067 wakaba 1.9 my $mod = $self-><M::ManakaiDISDatabase.getModule>
2068     ($mod_name_uri, for_arg => $forArg);
2069 wakaba 1.4
2070     unless ($mod-><M::ManakaiDISModuleDefinition.isDefined>) {
2071     ## -- Initializes Module Definition Object
2072     $mod->{nameURI} = $mod_name_uri;
2073     $mod->{localName} = $mod_name_node-><AG::ManakaiDISElement
2074     .qnameValueLocalName>;
2075     $mod->{namespaceURI} = $mod_name_node-><AG::ManakaiDISElement
2076     .qnameValueNamespaceURI>;
2077     $mod->{for} = $forArg;
2078     $mod->{src} = $mod_node;
2079 wakaba 1.5 $mod->{<Q::isDefined>} = true;
2080 wakaba 1.4 $self-><M::ManakaiDISDatabase.setSourceFile>
2081 wakaba 1.5 ($mod->{nameURI} => $doc);
2082    
2083 wakaba 1.9 $mod->{<Q::DIS:sourceFile>}
2084     = $mod->{src}
2085     -><AG::swcfg21:SWCFGNode::swcfg21:ForLatest.ownerDocument>
2086     -><M::swcfg21:SWCFGNode::swcfg21:ForLatest.flag>
2087     (<Q::swcfg21:fileName>);
2088 wakaba 1.5
2089 wakaba 1.12 ## -- Loads "for" definition
2090     my $root_elements
2091     = $doc-><M::ManakaiDISDocument.disAllChildElements>;
2092     if ($mod->{for} eq <Q::ManakaiDOM:all>) {
2093     for my $el (@$root_elements) {
2094     next unless $el-><M::swcfg21:SWCFGElement::swcfg21:ForLatest
2095     .expandedURI> eq <Q::dis:ForDef>;
2096     $self-><M::ManakaiDISDatabase.loadFor> ($mod, $el);
2097     }
2098     }
2099    
2100 wakaba 1.5 ## -- Loads "for all"
2101 wakaba 1.9 my $rmod = $self-><M::ManakaiDISDatabase.getModule>
2102     ($mod->{nameURI}, for_arg => <Q::ManakaiDOM:all>);
2103 wakaba 1.5 unless ($rmod-><AG::ManakaiDISModuleDefinition.isDefined>) {
2104     my $rdoc = $resolver-><M::ManakaiDISModuleResolver.uriToDocument>
2105 wakaba 1.9 ($self, $rmod->{uri}, $mod->{namespaceURI},
2106     $mod->{localName}, <Q::ManakaiDOM:all>);
2107 wakaba 1.5 unless ($rdoc) {
2108     __UNDEEP{
2109     __EXCEPTION{UNABLE_TO_GET_MODULE_ERR::
2110 wakaba 1.9 DIS:uri => {$rmod->{uri}},
2111 wakaba 1.5 DIS:namespaceURI => {$mod->{namespaceURI}},
2112     DIS:localName => {$mod->{localName}},
2113 wakaba 1.9 DIS:for => {<Q::ManakaiDOM:all>},
2114 wakaba 1.5 DIS:sourceNode => {$mod->{src}},
2115     }__;
2116     }__;
2117     }
2118     $self-><M::ManakaiDISDatabase.loadModule>
2119 wakaba 1.9 ($rdoc, $resolver, for_arg => <Q::ManakaiDOM:all>);
2120 wakaba 1.5 } # Unless "for all" loaded
2121 wakaba 1.4
2122     ## -- Loads Required Modules
2123 wakaba 1.10 ## NOTE:: "dis:For" is not allowed since "dis:ForDef" is not read
2124 wakaba 1.4 my $req_node = $mod_node-><AG::ManakaiDISModuleElement
2125     .requireElement>;
2126 wakaba 1.10 for my $rm (@{$req_node-><M::ManakaiDISElement
2127     .disAllChildElements>}) {
2128 wakaba 1.4 next unless $rm-><AG::swcfg21:SWCFGElement::swcfg21:ForLatest
2129     .expandedURI> eq <Q::dis:Module>;
2130     my ($uri, $nuri, $ln, $for);
2131     my $mqn = $rm-><AG::swcfg21:SWCFGNode::swcfg21:ForLatest
2132     .getAttributeNS> (<Q::dis:>, 'QName');
2133     if ($mqn) {
2134     my $mqv = $mqn-><AG::swcfg21:SWCFGNode::swcfg21:ForLatest
2135     .value>;
2136     my $mqp = $mqn-><AG::ManakaiDISElement.qnameToPair>
2137     ($mqv, node => $mqn);
2138     ($nuri, $ln) = @$mqp;
2139     } else {
2140     my $mn = $rm-><AG::swcfg21:SWCFGNode::swcfg21:ForLatest
2141     .getAttributeNS> (<Q::dis:>, 'Name');
2142     if ($mn) {
2143     $nuri = $mod->{namespaceURI};
2144     $ln = $mn-><AG::swcfg21:SWCFGNode::swcfg21:ForLatest.value>;
2145     } else {
2146     $nuri = $mod->{namespaceURI};
2147     $ln = $mod->{localName};
2148     }
2149     }
2150     my $wfn = $rm-><AG::swcfg21:SWCFGNode::swcfg21:ForLatest
2151     .getAttributeNS> (<Q::dis:>, 'WithFor');
2152     if ($wfn) {
2153     $for = $wfn-><AG::ManakaiDISElement.qnameValueURI>;
2154     } else {
2155     $for = $mod->{for};
2156     }
2157 wakaba 1.9 my $rmod = $self-><M::ManakaiDISDatabase.getModule>
2158     ($nuri . $ln, for_arg => $for);
2159 wakaba 1.4 unless ($rmod-><AG::ManakaiDISModuleDefinition.isDefined>) {
2160     my $rdoc = $resolver-><M::ManakaiDISModuleResolver.uriToDocument>
2161 wakaba 1.9 ($self, $rmod->{uri}, $nuri, $ln, $for);
2162 wakaba 1.4 unless ($rdoc) {
2163     __UNDEEP{
2164     __EXCEPTION{UNABLE_TO_GET_MODULE_ERR::
2165 wakaba 1.9 DIS:uri => {$rmod->{uri}},
2166 wakaba 1.4 DIS:namespaceURI => {$nuri},
2167     DIS:localName => {$ln},
2168     DIS:for => {$for},
2169     DIS:sourceNode => {$rm},
2170     }__;
2171     }__;
2172     }
2173     $self-><M::ManakaiDISDatabase.loadModule>
2174     ($rdoc, $resolver, for_arg => $for);
2175     }
2176     } # Child Module elements
2177    
2178 wakaba 1.12 ## -- Loads child resources
2179 wakaba 1.10 $root_elements = $doc-><M::ManakaiDISDocument.disChildElements>
2180     (for_arg => $forArg);
2181 wakaba 1.5 for my $el (@$root_elements) {
2182 wakaba 1.11 if ($el-><AG::ManakaiDISElement.isResourceElement>) {
2183 wakaba 1.7 $self-><M::ManakaiDISDatabase.loadResource>
2184 wakaba 1.9 ($mod, null, null, $el,
2185 wakaba 1.7 for_arg => $forArg);
2186     } else {
2187     my $et = $el-><M::swcfg21:SWCFGElement::swcfg21:ForLatest
2188     .expandedURI>;
2189     if ({
2190 wakaba 1.5 <Q::dis:ForDef> => 1,
2191     <Q::dis:Module> => 1,
2192     <Q::dis:ImplNote> => 1,
2193 wakaba 1.7 }->{$et}) {
2194     #
2195     } else {
2196     __UNDEEP{
2197     __EXCEPTION{ELEMENT_NOT_ALLOWED_ERR::
2198     DIS:elementType => {$et},
2199     DIS:sourceNode => {$el},
2200     DIS:uri => {$mod->{uri}},
2201     }__;
2202 wakaba 1.5 }__;
2203 wakaba 1.7 }
2204     } # element types
2205     }
2206    
2207     my $dn = $mod_node-><M::swcfg21:SWCFGNode::swcfg21:ForLatest
2208     .getAttributeNS>
2209     (<Q::dis:>, 'Namespace');
2210     unless ($dn and defined $dn-><AG::swcfg21:SWCFGNode
2211     ::swcfg21:ForLatest.value>) {
2212     __UNDEEP{
2213     __EXCEPTION{NO_REQUIRED_ATTR_ERR::
2214     DIS:elementType => {<Q::dis:Namespace>},
2215     DIS:sourceNode => {$mod_node},
2216 wakaba 1.5 }__;
2217 wakaba 1.7 }__;
2218 wakaba 1.5 }
2219     } # Unless this module loaded
2220     }__; # Deep
2221    
2222     @Method:
2223     @@Name: loadFor
2224     @@enDesc:
2225     Loads definition of a <QUOTE::for> from a <Q::dis:ForDef> element.
2226     @@Param:
2227     @@@Name: mod
2228     @@@Type: ManakaiDISModuleDefinition
2229     @@@enDesc:
2230     The module in which the <QUOTE::for> to load is defined.
2231     @@Param:
2232     @@@Name: el
2233     @@@Type:ManakaiDISElement
2234     @@@enDesc:
2235     The source <QUOTE::dis> <Q::dis:ForDef> element object.
2236     @@Return:
2237     @@@ForDefDupException:
2238     @@@ForDefNoQNameException:
2239     @@@ElementNotAllowedException:
2240     @@@PerlDef:
2241     __DEEP{
2242     my $qn_node = $el-><M::swcfg21:SWCFGNode
2243     ::swcfg21:ForLatest.getAttributeNS>
2244     (<Q::dis:>, 'QName');
2245     unless ($qn_node) {
2246     __UNDEEP{
2247     __EXCEPTION{NO_FOR_QNAME_ERR::
2248     DIS:sourceNode => {$qn_node},
2249     }__;
2250     }__;
2251     }
2252     my $qn_uri = $qn_node-><AG::ManakaiDISElement.qnameValueURI>;
2253     my $for = $self-><M::ManakaiDISDatabase.getFor> ($qn_uri);
2254    
2255     unless ($for-><M::ManakaiDISForDefinition.isDefined>) {
2256 wakaba 1.10 ## -- Initializes "For" Definition Object
2257 wakaba 1.5 $for->{src} = $el;
2258     $for->{<Q::isDefined>} = true;
2259     $for->{<Q::definingModule>} = $mod->{uri};
2260    
2261 wakaba 1.10 for my $ce (@{$el-><M::ManakaiDISElement.disAllChildElements>}) {
2262 wakaba 1.5 my $xn = $ce-><AG::swcfg21:SWCFGElement::swcfg21:ForLatest
2263     .expandedURI>;
2264     if ($xn eq <Q::dis:ISA> or $xn eq <Q::dis:Implement>) {
2265     my $sfor = $self-><M::ManakaiDISDatabase.getFor>
2266 wakaba 1.7 ($ce-><AG::ManakaiDISElement.qnameValueURI>);
2267 wakaba 1.5 $for-><M::ManakaiDISForDefinition.addISA> ($sfor);
2268 wakaba 1.7 $sfor-><M::ManakaiDISForDefinition.isReferred> ($ce);
2269 wakaba 1.5 ## TODO: warn if dis:Implement
2270     } elsif ({
2271     <Q::dis:Description> => 1,
2272     <Q::dis:ImplNote> => 1,
2273     <Q::dis:FullName> => 1,
2274     <Q::dis:QName> => 1,
2275     }->{$xn}) {
2276     #
2277     } else {
2278     __UNDEEP{
2279     __EXCEPTION{ELEMENT_NOT_ALLOWED_ERR::
2280     DIS:elementType => {$xn},
2281     DIS:sourceNode => {$ce},
2282     DIS:uri => {$mod->{uri}},
2283     }__;
2284     }__;
2285     }
2286     }
2287     } else {
2288     __UNDEEP{
2289     __EXCEPTION{FOR_ALREADY_DEFINED_ERR::
2290     DIS:sourceNode => {$el},
2291     DIS:anotherSourceNode => {$for->{src}},
2292     }__;
2293     }__;
2294     } # isDefine?
2295     }__; # DEEP
2296    
2297     @Method:
2298     @@Name: loadResource
2299     @@enDesc:
2300     Loads definition of a <QUOTE::dis> resource from a
2301     <Q::dis:ResourceDef> element.
2302     @@Param:
2303     @@@Name: mod
2304     @@@Type: ManakaiDISModuleDefinition
2305     @@@enDesc:
2306     The module in which the resource to load is defined.
2307     @@Param:
2308     @@@Name: parentResource
2309     @@@Type: ManakaiDISResourceDefinition
2310     @@@enDesc:
2311 wakaba 1.7 The (static) parent resource in which the resource to load is defined.
2312 wakaba 1.5 @@@nullCase:
2313     @@@@enDesc:
2314     The resource to load is a root resource, i.e. <P::el> is
2315     a direct child of the document node.
2316     @@Param:
2317 wakaba 1.7 @@@Name: dynParent
2318 wakaba 1.9 @@@Type: ManakaiDISResourceDefinition
2319 wakaba 1.7 @@@enDesc:
2320     The dynamic parent resource of the resource to load.
2321 wakaba 1.9 @@@nullCase:
2322 wakaba 1.7 @@@@enDesc:
2323 wakaba 1.9 If this resource is a root resource, i.e. <P::el> is
2324     a direct child of the document node.
2325 wakaba 1.7 @@Param:
2326 wakaba 1.5 @@@Name: el
2327     @@@Type:ManakaiDISElement
2328     @@@enDesc:
2329     The source <QUOTE::dis> <Q::dis:ResourceDef> element object.
2330     @@ForParam:
2331     @@ForpParam:
2332     @@Return:
2333     @@@ResDefDupException:
2334     @@@ElementNotAllowedException:
2335     @@@PerlDef:
2336     $forArg = <Q::ManakaiDOM:all> unless defined $forArg;
2337     $forpArg ||= [];
2338     __DEEP{
2339 wakaba 1.6 ## -- Node names
2340    
2341     ## Unique resource identifier generated from node id
2342     my $node_id = $el-><AG::swcfg21:SWCFGNode::swcfg21:ForLatest.nodeID>;
2343     my $node_uri;
2344     __CODE{tfpurisToURI:: $turi => $node_id, $furi => $forArg,
2345     $forp => $forpArg, $uri => $node_uri}__;
2346    
2347     ## User defined resource identifiers
2348 wakaba 1.5 my $qn_node = $el-><M::ManakaiDISElement.disGetAttribute>
2349     (<Q::dis:QName>, for_arg => $forArg,
2350     forp_arg => $forpArg);
2351     my $res;
2352     if ($qn_node) {
2353     my $qn_uri = $qn_node-><AG::ManakaiDISElement.qnameValueURI>;
2354 wakaba 1.9 $res = $self-><M::ManakaiDISDatabase.getResource>
2355     ($qn_uri, for_arg => $forArg);
2356 wakaba 1.5 if ($res-><M::ManakaiDISForDefinition.isDefined>) {
2357     __UNDEEP{
2358     __EXCEPTION{RESOURCE_ALREADY_DEFINED_ERR::
2359 wakaba 1.9 DIS:uri => {$res->{uri}},
2360 wakaba 1.5 DIS:sourceNode => {$qn_node},
2361     DIS:anotherSourceNode => {$res->{src}},
2362     }__;
2363 wakaba 1.6 }__;
2364 wakaba 1.5 }
2365     $res->{nameURI} = $qn_uri;
2366     $res->{localName} = $qn_node-><AG::ManakaiDISElement
2367     .qnameValueLocalName>;
2368     $res->{namespaceURI} = $qn_node-><AG::ManakaiDISElement
2369     .qnameValueNamespaceURI>;
2370     } else { ## Anonymous or local
2371     my $n_node = $el-><M::ManakaiDISElement.disGetAttribute>
2372     (<Q::dis:Name>, for_arg => $forArg,
2373     forp_arg => $forpArg);
2374     if ($n_node) {
2375     if ($parentResource) {
2376     my $puri = $parentResource->{uri};
2377     my $ru;
2378 wakaba 1.11 my $ln = $n_node-><AG::swcfg21:SWCFGNode
2379     ::swcfg21:ForLatest.value>;
2380 wakaba 1.5 __CODE{getChildResourceURI:: $parentURI => $puri,
2381     $localName => $ln,
2382     $result => $ru}__;
2383 wakaba 1.9 $res = $self-><M::ManakaiDISDatabase.getResource>
2384     ($ru, for_arg => $forArg);
2385 wakaba 1.5 $res->{nameURI} = $ru;
2386 wakaba 1.6 $res->{localName} = $n_node-><AG::swcfg21:SWCFGNode
2387     ::swcfg21:ForLatest.value>;
2388 wakaba 1.5 $res->{<Q::isAnon>} = true;
2389     } else { ## Root local name resource
2390 wakaba 1.7 my $ln = $n_node-><AG::swcfg21:SWCFGNode
2391     ::swcfg21:ForLatest.value>;
2392     my $ns_uri = $mod-><M::ManakaiDISPropertyAccessor
2393     .getPropertyText>
2394     (<Q::dis:Namespace>, null);
2395     my $qn_uri = $ns_uri . $ln;
2396 wakaba 1.9 $res = $self-><M::ManakaiDISDatabase.getResource>
2397     ($qn_uri, for_arg => $forArg);
2398 wakaba 1.6 if ($res-><M::ManakaiDISForDefinition.isDefined>) {
2399     __UNDEEP{
2400     __EXCEPTION{RESOURCE_ALREADY_DEFINED_ERR::
2401 wakaba 1.9 DIS:uri => {$res->{uri}},
2402 wakaba 1.6 DIS:sourceNode => {$n_node},
2403     DIS:anotherSourceNode => {$res->{src}},
2404     }__;
2405     }__;
2406     }
2407     $res->{nameURI} = $qn_uri;
2408 wakaba 1.7 $res->{namespaceURI} = $ns_uri;
2409     $res->{localName} = $ln;
2410 wakaba 1.5 }
2411     } else {
2412 wakaba 1.6 $res = $self-><M::ManakaiDISDatabase.getResource> ($node_uri);
2413 wakaba 1.5 $res->{<Q::isAnon>} = true;
2414     }
2415 wakaba 1.6 } # anon
2416 wakaba 1.5 $res->{for} = $forArg;
2417     $res->{forp} = $forpArg;
2418     $res->{src} = $el;
2419     $res->{<Q::definingModule>} = $mod->{uri};
2420 wakaba 1.9 $mod-><M::ManakaiDISPropertyAccessor.addPropertyResourceList>
2421     (<Q::DIS:resource>, $res);
2422 wakaba 1.8 $res->{<Q::dis2pm:parentResource>}
2423     = $parentResource ? $parentResource->{uri} : null;
2424     $res->{<Q::dynamicParentResource>}
2425 wakaba 1.9 = $dynParent ? $dynParent->{uri} : null;
2426     unless ($res->{uri} eq $node_uri) {
2427     my $nu_res = $self-><M::ManakaiDISDatabase.getResource> ($node_uri);
2428     $res-><M::ManakaiDISResourceDefinition.mergeAsAlias> ($nu_res);
2429     }
2430 wakaba 1.7 $res->{<Q::isDefined>} = true;
2431 wakaba 1.9 $res->{seq} = $self->{seq}++;
2432    
2433 wakaba 1.6 ## -- Alias
2434     my $al_node = $el-><M::ManakaiDISElement.disGetAttribute>
2435     (<Q::dis:AliasFor>, for_arg => $forArg,
2436     forp_arg => $forpArg);
2437     if ($al_node) {
2438     my $canon_uri = $al_node-><M::ManakaiDISElement.tfqnamesValueURI>
2439     ($node_id, $forArg);
2440     my $canon_res = $self-><M::ManakaiDISDatabase.getResource>
2441     ($canon_uri);
2442     $canon_res-><M::ManakaiDISResourceDefinition.isReferred> ($al_node);
2443 wakaba 1.11 $canon_res-><M::ManakaiDISResourceDefinition.mergeAsAlias>
2444     ($res, node => $al_node);
2445 wakaba 1.6 $res = $canon_res;
2446     }
2447 wakaba 1.5
2448 wakaba 1.11 ## -- Registers as child
2449     $parentResource-><M::ManakaiDISPropertyAccessor
2450     .addPropertyResourceList>
2451     (<Q::DIS:childResource>, $res)
2452     if $parentResource;
2453     $dynParent-><M::ManakaiDISPropertyAccessor
2454     .addPropertyResourceList>
2455     (<Q::DIS:dynamicChildResource>, $res)
2456     if $dynParent;
2457    
2458 wakaba 1.7 my $is_multires = false;
2459     my @props;
2460     my @cres;
2461 wakaba 1.10 my @ce0 = @{$el-><M::ManakaiDISElement.disChildElements>
2462     (for_arg => $forArg, forp_arg => $forpArg)};
2463 wakaba 1.7 while (@ce0) {
2464     my $ce = shift @ce0;
2465     if ($ce-><M::ManakaiDISElement.elementTypeMatch> (<Q::rdf:type>)) {
2466     my $type_uri = $ce-><AG::ManakaiDISElement.qnameValueURI>;
2467     $res->{<Q::rdf:type>}->{$type_uri} = true;
2468     my $type = $self-><M::ManakaiDISDatabase.getResource> ($type_uri);
2469     $type-><M::ManakaiDISResourceDefinition.isReferred> ($ce);
2470     if ($type-><M::ManakaiDISResourceDefinition.isSubsetOfURI>
2471     (<Q::dis:MultipleResource>)) {
2472     $is_multires = true;
2473     }
2474     } elsif ($ce-><M::ManakaiDISElement.elementTypeMatch>
2475     (<Q::dis:subsetOf>)) {
2476     my $sres = $self-><M::ManakaiDISDatabase.getResource>
2477     ($ce-><M::ManakaiDISElement.tfqnamesValueURI>
2478     ($node_id, $forArg));
2479     $res-><M::ManakaiDISResourceDefinition.addSuperResource> ($sres);
2480 wakaba 1.11 } elsif ($ce-><AG::ManakaiDISElement.isResourceElement>) {
2481 wakaba 1.7 push @cres, $ce;
2482     } else {
2483     ## Property and invalid element is not checked, since not
2484     ## all property definitions has loaded at this stage.
2485     push @props, $ce;
2486     }
2487     } # @ce0
2488    
2489     ## -- Child resources
2490     unless ($is_multires) {
2491     for my $re (@cres) {
2492     unless ($al_node) {
2493     $self-><M::ManakaiDISDatabase.loadResource>
2494     ($mod, $res, $res, $re,
2495     for_arg => $forArg, forp_arg => $forpArg);
2496 wakaba 1.5 } else {
2497 wakaba 1.7 my $ac = $re-><M::ManakaiDISElement.disGetAttribute>
2498     (<Q::dis:aliasChild>, for_arg => $forArg,
2499     forp_arg => $forpArg);
2500     if ($ac and $ac-><M::swcfg21:SWCFGNode
2501     ::swcfg21:ForLatest.value>) {
2502     $self-><M::ManakaiDISDatabase.loadResource>
2503     ($mod, $res, $res, $re,
2504     for_arg => $forArg, forp_arg => $forpArg);
2505     }
2506 wakaba 1.4 }
2507     }
2508 wakaba 1.7 }
2509 wakaba 1.5
2510 wakaba 1.7 ## -- Multiple representations
2511     if ($is_multires) {
2512     for my $pe (@props) {
2513     if ($pe-><M::ManakaiDISElement.elementTypeMatch>
2514 wakaba 1.10 (<Q::dis:resourceFor>)) {
2515 wakaba 1.7 my $for_uri = $pe-><M::ManakaiDISElement.qnameValueURI>;
2516     my $for = $self-><M::ManakaiDISDatabase.getFor> ($for_uri);
2517     $for-><M::ManakaiDISForDefinition.isReferred> ($pe);
2518     $self-><M::ManakaiDISDatabase.loadResource>
2519     ($mod, $parentResource, $res, $el,
2520     for_arg => $forArg,
2521     forp_arg => [@{$forpArg}, $for_uri]);
2522     }
2523     }
2524     }
2525 wakaba 1.5 }__; # DEEP
2526 wakaba 1.8
2527     @Method:
2528     @@Name: checkUndefinedResource
2529     @@enDesc:
2530     Checks whether there is referred but undefined resource or not.
2531     @@Return:
2532     @@@RaiseException:
2533     @@@@@: FOR_NOT_DEFINED_ERR
2534     @@@@enDesc:
2535     There is a <QUOTE::for> that is referred but not defined.
2536     @@@RaiseException:
2537     @@@@@: RESOURCE_NOT_DEFINED_ERR
2538     @@@@enDesc:
2539     There is a resource that is referred but not defined.
2540     @@@PerlDef:
2541     for my $fd (values %{$self->{forDef}}) {
2542     if (my $ref = $fd-><AG::ManakaiDISForDefinition.isReferred> and
2543     not $fd-><AG::ManakaiDISForDefinition.isDefined>) {
2544     __EXCEPTION{FOR_NOT_DEFINED_ERR::
2545     DIS:uri => {$fd->{uri}},
2546     DIS:sourceNode => {$ref},
2547     }__;
2548     }
2549     }
2550     for my $fd (values %{$self->{resDef}}) {
2551     if (my $ref = $fd-><AG::ManakaiDISResourceDefinition.isReferred> and
2552     not $fd-><AG::ManakaiDISResourceDefinition.isDefined>) {
2553     __EXCEPTION{RESOURCE_NOT_DEFINED_ERR::
2554     DIS:uri => {$fd->{uri}},
2555     DIS:sourceNode => {$ref},
2556     }__;
2557     }
2558     }
2559 wakaba 1.5
2560 wakaba 1.9
2561     @Method:
2562     @@Name: plStore
2563     @@enDesc:
2564     Saves this database to an external file.
2565     \
2566     {NOTE:: Saved files can be loaded by
2567     <M::ManakaiDISImplementation.plLoadDISDatabase>.
2568     \
2569     }
2570     @@Param:
2571     @@@Name: fileName
2572     @@@Type:
2573     DISLang:String
2574     @@@enDesc:
2575     An environment-dependent file name of external database to save.
2576     \
2577     {NOTE:: If there is already a file named as <P::fileName>, then
2578     it is overwritten.
2579     \
2580     }
2581     @@Return:
2582     @@@SimpleException:
2583     @@@PerlDef:
2584     use Storable qw/nstore/;
2585     local $Carp::CarpLevel = $Carp::CarpLevel + 1;
2586     nstore $self, $fileName;
2587 wakaba 1.2 ##DISDatabase
2588    
2589 wakaba 1.8 PropDef:
2590 wakaba 1.9 @QName: resource
2591     @enDesc:
2592     Resources defined in a module.
2593     @rdfs:range: ManakaiDISResourceDefinition
2594     @rdfs:domain: ManakaiDISModuleDefinition
2595    
2596     PropDef:
2597 wakaba 1.8 @QName:
2598     dis2pm:parentResource
2599     @enDesc:
2600     Static parent resource. No parent for root resources.
2601    
2602     PropDef:
2603     @QName: dynamicParentResource
2604     @enDesc:
2605     Dynamic parent resource. No parent for root resources.
2606    
2607 wakaba 1.11 PropDef:
2608     @QName: childResource
2609     @enDesc:
2610     Static child resources.
2611    
2612     PropDef:
2613     @QName: dynamicChildResource
2614     @enDesc:
2615     Dynamic child resources.
2616    
2617 wakaba 1.5 ElementTypeBinding:
2618     @Name: ForDefDupException
2619     @ElementType:
2620     ManakaiDOM:raises
2621     @ShadowContent:
2622     @@@: FOR_ALREADY_DEFINED_ERR
2623     @@Description:
2624     @@@lang:en
2625     @@@@:
2626     The <QUOTE::for> is already defined elsewhere.
2627    
2628     ElementTypeBinding:
2629     @Name: ForDefNoQNameException
2630     @ElementType:
2631     ManakaiDOM:raises
2632     @ShadowContent:
2633     @@@: NO_FOR_QNAME_ERR
2634     @@Description:
2635     @@@lang:en
2636     @@@@:
2637     A <Q::dis:ForDef> element must have a <Q::dis:QName> attribute.
2638    
2639     ElementTypeBinding:
2640     @Name: ResDefDupException
2641     @ElementType:
2642     ManakaiDOM:raises
2643     @ShadowContent:
2644     @@@: RESOURCE_ALREADY_DEFINED_ERR
2645     @@Description:
2646     @@@lang:en
2647     @@@@:
2648     The <QUOTE::dis> resource is already defined elsewhere.
2649    
2650     ElementTypeBinding:
2651     @Name: ElementNotAllowedException
2652     @ElementType:
2653     ManakaiDOM:raises
2654     @ShadowContent:
2655     @@@: ELEMENT_NOT_ALLOWED_ERR
2656     @@Description:
2657     @@@lang:en
2658     @@@@:
2659     An element has found where it is not allowed.
2660    
2661 wakaba 1.4 IFClsDef:
2662     @QName:
2663     @@@: DISModuleResolver
2664     @@ForCheck: ForIF
2665     @QName:
2666     @@@: ManakaiDISModuleResolver
2667     @@ForCheck: ForClass
2668     @enDesc:
2669     Objects implementing <IF::DISModuleResolver> interface
2670     are used to convert module name into <QUOTE::dis> document object.
2671     \
2672     {NOTE:: It is also acceptable to pass a <Perl::CODE> reference
2673     as a method parameter where <IF::DISModuleResolver> is
2674     expected.
2675     \
2676     }
2677     @Method:
2678     @@Name: uriToDocument
2679     @@enDesc:
2680     Returns a <QUOTE::dis> document from module name information.
2681     @@Param:
2682     @@@Name: disDB
2683     @@@Type: ManakaiDISDatabase
2684     @@@enDesc:
2685     The <QUOTE::dis> database.
2686     @@Param:
2687     @@@Name: moduleURI
2688     @@@Type: ModuleURI
2689     @@@enDesc:
2690     The URI reference of the module.
2691     \
2692     {NOTE:: This parameter is redundant, since it can be
2693     composed from other three parameters.
2694     \
2695     }
2696     @@Param:
2697     @@@Name: moduleNamespaceURI
2698     @@@Type: AnyURI
2699     @@@enDesc:
2700     The namespace URI of the module name.
2701     @@Param:
2702     @@@Name: moduleLocalName
2703     @@@Type:
2704     DISCore:LocalName
2705     @@@enDesc:
2706     The local name of the module name.
2707     @@Param:
2708     @@@Name: moduleFor
2709     @@@Type: ForURI
2710     @@@enDesc:
2711     The <QUOTE::for> URI reference for which the module is defined.
2712     @@Return:
2713     @@@Type: ManakaiDISDocument
2714     @@@enDesc:
2715     The <QUOTE::dis> document. It don't have to be a newly created
2716     object.
2717     @@@nullCase:
2718     @@@@enDesc:
2719     The method is unable to resolve the reference.
2720     @@@PerlDef:
2721     $r = $self->(@_);
2722     @ManakaiDOM:inputNormalizer:
2723     @@ContentType:
2724     lang:Perl
2725     @@@:
2726     $INPUT = bless $INPUT, <ClassName::ManakaiDISModuleResolver>
2727     if ref $INPUT eq 'CODE';
2728     @@ImplNote:
2729     @@@lang:en
2730     @@@@:
2731     <FILE::cdis2pm.pl> does not support non-datatype input normalizers yet.
2732     ##DISModuleResolver
2733    
2734 wakaba 1.3 PropDef:
2735     @QName: sourceFile
2736     @enDesc:
2737     Source <QUOTE::dis> documents.
2738     @rdfs:domain: ManakaiDISDatabase
2739     @rdfs:range: ManakaiDISDocument
2740    
2741 wakaba 1.2 ClsDef:
2742     @ClsQName: ManakaiDISModuleDefinition
2743     @enDesc:
2744     <QUOTE::dis> module definitions.
2745     @ClsISA: ManakaiDISPropertyAccessor
2746 wakaba 1.4 @ClsISA: ManakaiDISExceptionTarget
2747 wakaba 1.2
2748     @Attr:
2749     @@Name: uri
2750     @@Type: ModuleURI
2751     @@Description:
2752     @@@lang:en
2753     @@@@:
2754     The URI reference of this <QUOTE::dis> module.
2755     @@Get:
2756     @@@PerlDef:
2757     $r = $self->{uri};
2758    
2759     @Attr:
2760     @@Name: nameURI
2761     @@Type: NameURI
2762     @@enDesc:
2763     The URI reference of this module, without
2764     <QUOTE::for> identifier.
2765     @@Get:
2766 wakaba 1.3 @@@PerlDef:
2767 wakaba 1.4 $r = $self->{nameURI};
2768 wakaba 1.2
2769     @Attr:
2770     @@Name: localName
2771     @@enDesc:
2772     The local name of this module.
2773     @@Type:
2774 wakaba 1.3 DISCore:LocalName::ManakaiDOM:all
2775 wakaba 1.2 @@Get:
2776     @@@PerlDef:
2777     $r = $self->{localName};
2778    
2779     @Attr:
2780     @@Name: namespaceURI
2781     @@Type: AnyURI
2782     @@enDesc:
2783     The namespace URI of the name of this resource.
2784     @@Get:
2785     @@@PerlDef:
2786     $r = $self->{namespaceURI};
2787    
2788     @Attr:
2789     @@Name: forURI
2790     @@Type: ForURI
2791     @@enDesc:
2792     The <QUOTE::for> URI reference for which this module is defined.
2793     @@Get:
2794     @@@PerlDef:
2795     $r = $self->{for};
2796    
2797     @Attr:
2798     @@Name: isDefined
2799     @@Description:
2800     @@@lang:en
2801     @@@@:
2802     Whether this module is defined or not.
2803     @@Type:
2804     DOMMain:boolean
2805     @@Get:
2806     @@@PerlDef:
2807     $r = $self->{<Q::isDefined>};
2808 wakaba 1.8
2809     @Attr:
2810     @@Name: plFullyQualifiedName
2811     @@enDesc:
2812     The fully-qualified Perl class package name.
2813     @@Type:
2814     Perl:package-name::ManakaiDOM:all
2815     @@Get:
2816     @@@NoPerlModuleNameException:
2817     @@@PerlDef:
2818     __DEEP{
2819     my $mg = $self->{db}-><M::ManakaiDISDatabase.getResource>
2820     ($self->{namespaceURI});
2821     unless ($self-><AG::ManakaiDISResourceDefinition.isDefined>) {
2822     __UNDEEP{
2823     __EXCEPTION{RESOURCE_NOT_DEFINED_ERR::
2824     DIS:uri => {$self->{namespaceURI}},
2825     DIS:sourceNode => {$self->{src}},
2826     }__;
2827     }__;
2828     }
2829     my $an = $mg->{src}-><M::ManakaiDISElement.disGetAttribute>
2830     (<Q::dis:AppName>, for_arg => $self->{for},
2831 wakaba 1.10 media_type => <Q::lang:Perl>,
2832     default_media_type => <Q::lang:Perl>);
2833 wakaba 1.8 if ($an) {
2834     $r = $an-><M::swcfg21:SWCFGNode::swcfg21:ForLatest.value>;
2835     $r =~ s/::$//g;
2836     $r .= '::' . $self->{localName};
2837     my $sf = $an-><M::ManakaiDISElement.disGetAttribute>
2838     (<Q::ManakaiDOM:moduleSuffix>,
2839     for_arg => $self->{for},
2840     media_type => <Q::lang:Perl>,
2841     default_media_type => <Q::lang:Perl>);
2842     if ($sf) {
2843     $r .= $sf-><M::swcfg21:SWCFGNode::swcfg21:ForLatest.value>;
2844     }
2845     } else {
2846 wakaba 1.10 $r = ($mg->{localName} || 'main') . '::' . $self->{localName};
2847 wakaba 1.8 }
2848     }__;
2849    
2850     @Attr:
2851     @@Name: plInterfaceName
2852     @@enDesc:
2853     The fully-qualified Perl interface package name.
2854     @@Type:
2855     Perl:package-name::ManakaiDOM:all
2856     @@Get:
2857     @@@NoPerlModuleNameException:
2858     @@@PerlDef:
2859     __DEEP{
2860     my $mg = $self->{db}-><M::ManakaiDISDatabase.getResource>
2861     ($self->{namespaceURI});
2862     unless ($self-><AG::ManakaiDISResourceDefinition.isDefined>) {
2863     __UNDEEP{
2864     __EXCEPTION{RESOURCE_NOT_DEFINED_ERR::
2865     DIS:uri => {$self->{namespaceURI}},
2866     DIS:sourceNode => {$self->{src}},
2867     }__;
2868     }__;
2869     }
2870     my $an = $mg->{src}-><M::ManakaiDISElement.disGetAttribute>
2871     (<Q::dis:AppName>, for_arg => $self->{for},
2872     forp_arg => [<Q::ManakaiDOM:ForIF>],
2873 wakaba 1.10 media_type => <Q::lang:Perl>,
2874     default_media_type => <Q::lang:Perl>);
2875 wakaba 1.8 if ($an) {
2876     $r = $an-><M::swcfg21:SWCFGNode::swcfg21:ForLatest.value>;
2877     $r =~ s/::$//g;
2878     my $sf = $an-><M::ManakaiDISElement.disGetAttribute>
2879     (<Q::ManakaiDOM:moduleSuffix>,
2880     for_arg => $self->{for},
2881     forp_arg => [<Q::ManakaiDOM:ForIF>],
2882     media_type => <Q::lang:Perl>,
2883     default_media_type => <Q::lang:Perl>);
2884     if ($sf) {
2885     $r .= $sf-><M::swcfg21:SWCFGNode::swcfg21:ForLatest.value>;
2886     }
2887     } else {
2888     $r = $self-><M::ManakaiDISModuleDefinition.plFullyQualifiedName>;
2889     }
2890     }__;
2891 wakaba 1.2 ##DISModuleDefinition
2892    
2893 wakaba 1.8 ElementTypeBinding:
2894     @Name: NoPerlModuleNameException
2895     @ElementType:
2896     ManakaiDOM:raises
2897     @ShadowContent:
2898     @@@: RESOURCE_NOT_DEFINED_ERR
2899     @@Description:
2900     @@@lang:en
2901     @@@@:
2902     The module group corresponding to the namespace URI
2903     of this module is not defined.
2904    
2905 wakaba 1.2 ClsDef:
2906     @ClsQName: ManakaiDISForDefinition
2907     @Description:
2908     @@lang:en
2909     @@@:
2910     <QUOTE::dis> <QUOTE::for> definitions.
2911 wakaba 1.4 @ClsISA: ManakaiDISExceptionTarget
2912 wakaba 1.2
2913     @Attr:
2914     @@Name: uri
2915     @@Type: ForURI
2916     @@Description:
2917     @@@lang:en
2918     @@@@:
2919     The URI reference of this <QUOTE::for>.
2920     @@Get:
2921     @@@PerlDef:
2922     $r = $self->{uri};
2923 wakaba 1.10
2924     @IntMethod:
2925     @@Operator:
2926     @@@@:eq
2927     @@@ContentType:
2928     lang:Perl
2929     @@enDesc:
2930     Whether two <QUOTE::for> definitions are equal or not.
2931     Two <QUOTE::for> definitions are equal iff one's URI reference
2932     is one of another's URI reference.
2933     \
2934     {NOTE:: Aliases for <QUOTE::for> is not allowed.
2935     \
2936     }
2937     @@ImplNote:
2938     @@@lang:en
2939     @@@@:
2940     In the current implementation, two are equal iff two are
2941     equal as reference.
2942     @@Param:
2943     @@@Name: anotherFor
2944     @@@Type: ManakaiDISForDefinition
2945     @@@enDesc:
2946     Another <QUOTE::for> definition to compare.
2947     @@Return:
2948     @@@Type:
2949     DOMMain:boolean
2950     @@@enDesc:
2951     Whether two resources are equal or not.
2952     @@@PerlDef:
2953     if (UNIVERSAL::isa ($anotherFor, <ClassName::ManakaiDISForDefinition>)) {
2954     $r = $self->{uri} eq $anotherFor->{uri};
2955     } else {
2956     $r = false;
2957     }
2958 wakaba 1.2
2959     @Method:
2960     @@Name: isaURI
2961     @@Description:
2962     @@@lang:en
2963     @@@@:
2964     Whether this <QUOTE::for> is-a another <QUOTE::for> or not.
2965     @@Param:
2966     @@@Name: superURI
2967     @@@Type: ForURI
2968     @@@Description:
2969     @@@@lang:en
2970     @@@@@:
2971     Another <QUOTE::for> URI reference to test.
2972     @@Return:
2973     @@@Type:
2974     DOMMain:boolean
2975     @@@TrueCase:
2976     @@@@enDesc:
2977     <P::superURI> is a super-<QUOTE::for> of this <QUOTE::for>.
2978     @@@FalseCase:
2979     @@@@enDesc:
2980     <P::superURI> is not a super-<QUOTE::for> of this <QUOTE::for>.
2981     @@@PerlDef:
2982     $r = $self->{uri} eq $superURI ? true : $self->{isa}->{$superURI};
2983    
2984     @Attr:
2985     @@Name: isDefined
2986     @@Description:
2987     @@@lang:en
2988     @@@@:
2989     Whether this <QUOTE::for> is already defined or not.
2990     @@Type:
2991     DOMMain:boolean
2992     @@Get:
2993     @@@TrueCase:
2994     This <QUOTE::for> is already defined.
2995     @@@FalseCase:
2996     This <QUOTE::for> is not defined.
2997     @@@PerlDef:
2998     $r = $self->{<Q::isDefined>};
2999    
3000     @Attr:
3001     @@Name: isReferred
3002     @@Description:
3003     @@@lang:en
3004     @@@@:
3005     Whether this <QUOTE::for> is referred somewhere or not.
3006 wakaba 1.9 @@Type: ManakaiDISElement
3007 wakaba 1.2 @@Get:
3008     @@@InCase:
3009     @@@@Type:ManakaiDISElement
3010     @@@@enDesc:
3011     This <QUOTE::for> is referred by the element.
3012     @@@nullCase:
3013     This <QUOTE::for> is not referred.
3014     @@@PerlDef:
3015     $r = $self->{<Q::isReferred>};
3016     @@Set:
3017     @@@InCase:
3018     @@@@Type:ManakaiDISElement
3019     @@@@enDesc:
3020     This <QUOTE::for> is referred by the element.
3021     @@@PerlDef:
3022 wakaba 1.9 $self->{<Q::isReferred>} = $given if $given;
3023 wakaba 1.2
3024     @Attr:
3025     @@Name: definingModule
3026     @@Description:
3027     @@@lang:en
3028     @@@@:
3029     The <QUOTE::dis> module in which this <QUOTE::for> is defined.
3030     @@Type: ManakaiDISModuleDefinition
3031     @@Get:
3032     @@@Description:
3033     @@@@lang:en
3034     @@@@@:
3035     The module object.
3036 wakaba 1.3 @@@nullCase:
3037 wakaba 1.2 @@@@Description:
3038     @@@@@lang:en
3039     @@@@@@:
3040     This <QUOTE::for> is not associated to any module.
3041     @@@PerlDef:
3042     $r = $self->{db}
3043     -><M::ManakaiDISDatabase.getResource>
3044     ($self->{<Q::definingModule>})
3045     if defined $self->{<Q::definingModule>};
3046 wakaba 1.5
3047 wakaba 1.2 @Method:
3048 wakaba 1.5 @@Name: addISA
3049 wakaba 1.2 @@enDesc:
3050 wakaba 1.5 Adds a <QUOTE::for> to the list of super-<QUOTE::for> of this
3051     <QUOTE::for>.
3052 wakaba 1.2 @@Param:
3053 wakaba 1.5 @@@Name: superFor
3054     @@@Type: ManakaiDISForDefinition
3055     @@@enDesc:
3056     A <QUOTE::for> definition object.
3057 wakaba 1.2 @@Return:
3058     @@@PerlDef:
3059 wakaba 1.5 my @from = ($self->{uri},
3060     grep {$self->{revISA}->{$_}} keys %{$self->{revISA}});
3061     my @to = ($superFor->{uri},
3062     grep {$superFor->{isa}->{$_}} keys %{$superFor->{isa}});
3063 wakaba 1.7 __DEEP{
3064     for my $from (@from) {
3065     for my $to (@to) {
3066     $self->{db}-><M::ManakaiDISDatabase.getFor>
3067     ($from)->{isa}->{$to} = true;
3068     $self->{db}-><M::ManakaiDISDatabase.getFor>
3069     ($to)->{revISA}->{$from} = true;
3070     }
3071 wakaba 1.5 }
3072 wakaba 1.7 }__;
3073 wakaba 1.5
3074 wakaba 1.2 ##DISForDefinition
3075    
3076     ClsDef:
3077     @ClsQName: ManakaiDISResourceDefinition
3078     @enDesc:
3079     <QUOTE::dis> resource definitions.
3080     @ClsISA: ManakaiDISPropertyAccessor
3081 wakaba 1.4 @ClsISA: ManakaiDISExceptionTarget
3082 wakaba 1.2
3083     @Attr:
3084     @@Name: uri
3085     @@Type: ResourceURI
3086     @@Description:
3087     @@@lang:en
3088     @@@@:
3089     The URI reference of this <QUOTE::dis> resource.
3090     @@Get:
3091     @@@PerlDef:
3092     $r = $self->{uri};
3093    
3094     @Attr:
3095     @@Name: nameURI
3096     @@Type: NameURI
3097     @@enDesc:
3098     The URI reference of this <QUOTE::dis> resource, without
3099     <QUOTE::for> identifier.
3100     @@Get:
3101     @@@nullCase:
3102     @@@@enDesc:
3103     This resource does not have its name URI reference.
3104 wakaba 1.3 @@@PerlDef:
3105 wakaba 1.4 $r = $self->{nameURI};
3106 wakaba 1.2
3107     @Attr:
3108     @@Name: localName
3109     @@enDesc:
3110     The local name of this resource.
3111     @@Type:
3112 wakaba 1.3 DISCore:LocalName::ManakaiDOM:all
3113 wakaba 1.2 @@Get:
3114     @@@nullCase:
3115     @@@@enDesc:
3116     This resource does not have its local name.
3117     @@@PerlDef:
3118     $r = $self->{localName};
3119    
3120     @Attr:
3121     @@Name: namespaceURI
3122     @@Type: AnyURI
3123     @@enDesc:
3124     The namespace URI of the name of this resource.
3125     @@Get:
3126     @@@nullCase:
3127     The name of this resource does not have its namespace
3128     or this resource does not have its name.
3129     @@@PerlDef:
3130     $r = $self->{namespaceURI};
3131    
3132     @Attr:
3133     @@Name: isAnonymous
3134     @@enDesc:
3135     Whether this <QUOTE::dis> resource has name or not.
3136     @@Type:
3137     DOMMain:boolean
3138     @@Get:
3139     @@@TrueCase:
3140     This resource does not have any global unique name.
3141     <A::ManakaiDISResourceDefinition.uri> is a temporary URI reference.
3142     @@@FalseCase:
3143     This resource does have its formal name.
3144     <A::ManakaiDISResourceDefinition.uri> is a URI reference
3145     generated from the name and the <QUOTE::for> URI reference
3146     of this resource.
3147     @@@PerlDef:
3148     $r = $self->{<Q::isAnon>};
3149    
3150     @Attr:
3151     @@Name: forURI
3152     @@enDesc:
3153     The <QUOTE::for> URI reference for which this resource is defined.
3154     @@Type:ForURI
3155     @@Get:
3156     @@@PerlDef:
3157     $r = $self->{for};
3158    
3159     @Attr:
3160     @@Name: forpURI
3161     @@enDesc:
3162     The <QUOTE::for+> URI references for which this resource is defined.
3163     @@Type: ForURIList
3164     @@Get:
3165 wakaba 1.3 @@@PerlDef:
3166 wakaba 1.2 $r = $self->{forp};
3167    
3168     @Method:
3169 wakaba 1.7 @@Name: isSubsetOfURI
3170 wakaba 1.2 @@Description:
3171     @@@lang:en
3172     @@@@:
3173     Whether this resource is a subset of another resource or not.
3174     @@Param:
3175     @@@Name: superURI
3176     @@@Type: ResourceURI
3177     @@@Description:
3178     @@@@lang:en
3179     @@@@@:
3180     Another resource URI reference to test.
3181     @@Return:
3182     @@@Type:
3183     DOMMain:boolean
3184     @@@TrueCase:
3185     @@@@enDesc:
3186     <P::superURI> is a super-resource of this resource.
3187     @@@FalseCase:
3188     @@@@enDesc:
3189     <P::superURI> is not a super-resource of this resource.
3190     @@@PerlDef:
3191 wakaba 1.6 $r = $self->{aliasURI}->{$superURI} || $self->{subOf}->{$superURI};
3192 wakaba 1.2
3193 wakaba 1.7 @Method:
3194     @@Name: addSuperResource
3195     @@enDesc:
3196     Adds a <QUOTE::dis> resource to the list of super-resource
3197     of this <QUOTE::dis> resource.
3198     @@Param:
3199     @@@Name: superRes
3200     @@@Type: ManakaiDISResourceDefinition
3201     @@@enDesc:
3202     A <QUOTE::dis> resource definition object.
3203     @@Return:
3204     @@@PerlDef:
3205     my @from = ($self->{uri},
3206     grep {$self->{supOf}->{$_}} keys %{$self->{supOf}});
3207     my @to = ($superRes->{uri},
3208     grep {$superRes->{subOf}->{$_}} keys %{$superRes->{subOf}});
3209     __DEEP{
3210     for my $from (@from) {
3211     for my $to (@to) {
3212     $self->{db}-><M::ManakaiDISDatabase.getResource>
3213     ($from)->{subOf}->{$to} = true;
3214     $self->{db}-><M::ManakaiDISDatabase.getResource>
3215     ($to)->{supOf}->{$from} = true;
3216     }
3217     }
3218     }__;
3219    
3220 wakaba 1.2 @Attr:
3221     @@Name: isDefined
3222     @@Description:
3223     @@@lang:en
3224     @@@@:
3225     Whether this resource is already defined or not.
3226     @@Type:
3227     DOMMain:boolean
3228     @@Get:
3229     @@@TrueCase:
3230     This resource is already defined.
3231     @@@FalseCase:
3232     This resource is not defined.
3233     @@@PerlDef:
3234     $r = $self->{<Q::isDefined>};
3235    
3236     @Attr:
3237     @@Name: isReferred
3238     @@Description:
3239     @@@lang:en
3240     @@@@:
3241     Whether this resource is referred or not.
3242 wakaba 1.7 @@Type: ManakaiDISElement
3243 wakaba 1.2 @@Get:
3244 wakaba 1.7 @@@enDesc:
3245 wakaba 1.9 An element that referres this resource.
3246 wakaba 1.2 @@@nullCase:
3247     This resource is not referred.
3248     @@@PerlDef:
3249     $r = $self->{<Q::isReferred>};
3250     @@Set:
3251 wakaba 1.7 @@@enDesc:
3252 wakaba 1.9 An element that referres this resource.
3253 wakaba 1.2 @@@PerlDef:
3254 wakaba 1.9 $self->{<Q::isReferred>} = $given if $given;
3255 wakaba 1.2
3256     @Attr:
3257     @@Name: definingModule
3258     @@Description:
3259     @@@lang:en
3260     @@@@:
3261     The <QUOTE::dis> module in which this resource is defined.
3262 wakaba 1.8 \
3263     {NOTE:: Method name should have been <CODE::ownerModule> or some.
3264     \
3265     }
3266 wakaba 1.2 @@Type: ManakaiDISModuleDefinition
3267     @@Get:
3268     @@@Description:
3269     @@@@lang:en
3270     @@@@@:
3271     The module object.
3272 wakaba 1.3 @@@nullCase:
3273 wakaba 1.2 @@@@Description:
3274     @@@@@lang:en
3275     @@@@@@:
3276     This resource is not associated to any module.
3277     @@@PerlDef:
3278     $r = $self->{db}
3279     -><M::ManakaiDISDatabase.getModule>
3280     ($self->{<Q::definingModule>})
3281     if defined $self->{<Q::definingModule>};
3282     @@Set:
3283     @@@Description:
3284     @@@@lang:en
3285     @@@@@:
3286     The module object to which the <QUOTE::defining module> is set.
3287     @@@PerlDef:
3288     $self->{<Q::defininingModule>}
3289     = $given-><AG::ManakaiDISModuleDefinition.uri>;
3290    
3291 wakaba 1.6 @Method:
3292     @@Name: mergeAsAlias
3293     @@enDesc:
3294     Merges another resource definition as an alias of this resource.
3295     @@Param:
3296     @@@Name: aliasResource
3297     @@@Type: ManakaiDISResourceDefinition
3298     @@@enDesc:
3299     A resource to merge.
3300     \
3301     {NOTE:: After merging all references to <P::aliasResource>
3302     should be discarded.
3303     \
3304     }
3305 wakaba 1.11 @@NodeParam:
3306 wakaba 1.6 @@Return:
3307 wakaba 1.11 @@@RaiseException:
3308     @@@@@:MERGE_ITSELF_ERR
3309     @@@@@@enDesc:
3310     An attempt is made to merge this resource itself.
3311     @@@PerlDef:
3312     if ($self eq $aliasResource) {
3313     __EXCEPTION{MERGE_ITSELF_ERR::
3314     DIS:uri => {$self->{uri}},
3315     DIS:sourceNode => {$node},
3316     }__;
3317     }
3318 wakaba 1.6 for my $uri ($aliasResource->{uri},
3319     grep {$aliasResource->{aliasURI}->{$_}}
3320     keys %{$aliasResource->{aliasURI}}) {
3321     $self->{aliasURI}->{$uri} = true;
3322     $self->{db}->{resDef}->{$uri} = $self;
3323     $self->{subOf}->{$uri} = true;
3324     $self->{supOf}->{$uri} = true;
3325     }
3326     for my $uri (grep {$aliasResource->{subOf}->{$_}}
3327     keys %{$aliasResource->{subOf}}) {
3328     $self->{subOf}->{$uri} = true;
3329     }
3330     for my $uri (grep {$aliasResource->{supOf}->{$_}}
3331     keys %{$aliasResource->{supOf}}) {
3332     $self->{supOf}->{$uri} = true;
3333     }
3334     my @from = grep {$self->{supOf}->{$_}} keys %{$self->{supOf}};
3335     my @to = grep {$self->{subOf}->{$_}} keys %{$self->{subOf}};
3336     __DEEP{
3337     for my $from (@from) {
3338     for my $to (@to) {
3339     $self->{db}-><M::ManakaiDISDatabase.getResource>
3340     ($from)->{subOf}->{$to} = true;
3341     $self->{db}-><M::ManakaiDISDatabase.getResource>
3342     ($to)->{supOf}->{$from} = true;
3343     }
3344     }
3345     }__;
3346 wakaba 1.7
3347     @Method:
3348     @@Name: isTypeURI
3349     @@enDesc:
3350     Tests whether this resource is of a type or not.
3351     @@Param:
3352     @@@Name: typeURI
3353     @@@Type: ResourceURI
3354     @@@enDesc:
3355     A type URI reference to test.
3356     @@Return:
3357     @@@Type:
3358     DOMMain:boolean
3359     @@@TrueCase:
3360     @@@@enDesc:
3361     This is a <P::typeURI> resource.
3362     @@@FalseCase:
3363     @@@@enDesc:
3364     This is not a <P::typeURI> resource.
3365     @@@PerlDef:
3366 wakaba 1.8 if ($self->{<Q::rdf:type>}->{$typeURI}) {
3367     $r = $self->{<Q::rdf:type>}->{$typeURI};
3368     } else {
3369     for my $t_type_uri (grep {$self->{<Q::rdf:type>}->{$_}}
3370     keys %{$self->{<Q::rdf:type>}}) {
3371     my $t_type = $self->{db}-><M::ManakaiDISDatabase.getResource>
3372     ($t_type_uri);
3373     if ($t_type-><M::ManakaiDISResourceDefinition.isSubsetOfURI>
3374     ($typeURI)) {
3375     $self->{<Q::rdf:type>}->{$typeURI} = $r = true;
3376     last;
3377     }
3378 wakaba 1.7 }
3379     }
3380 wakaba 1.8
3381     @Attr:
3382     @@Name: plName
3383     @@enDesc:
3384     The Perl name of this resource.
3385     @@Get:
3386     @@@Type:
3387     DISLang:String
3388     @@@enDesc:
3389     - <Q::ManakaiDOM:Const>::: Constant function (local) name.
3390     \
3391     - <Q::ManakaiDOM:ConstGroup>::: Export group name (without
3392     <CHAR::COLON> prefix).
3393     \
3394     - <Q::DISLang:Attribute>::: Method name.
3395     \
3396     - <Q::DISLang:Method>::: Method name.
3397     @@@nullCase:
3398     @@@@enDesc:
3399     Either the type of this resource is not listed above
3400     or this Perl constructure is anonymous.
3401     @@@RaiseException:
3402     @@@@@: NO_LOCAL_NAME_ERR
3403     @@@@enDesc:
3404     The type of this resource is either
3405     <Q::ManakaiDOM:Const> or <Q::ManakaiDOM:ConstGroup> and
3406     the local name of this resource is not defined.
3407     @@@RaiseException:
3408     @@@@@: RESERVED_PERL_METHOD_NAME_ERR
3409     @@@@enDesc:
3410     The Perl method name constructed from the source
3411     result in a reserved name.
3412     @@@PerlDef:
3413     __DEEP{
3414     if (exists $self->{<Q::dis2pm:name>}) {
3415     $r = $self->{<Q::dis2pm:name>};
3416     } elsif ($self-><M::ManakaiDISResourceDefinition.isTypeURI>
3417     (<Q::ManakaiDOM:Const>) or
3418     $self-><M::ManakaiDISResourceDefinition.isTypeURI>
3419     (<Q::ManakaiDOM:ConstGroup>)) {
3420     $r = $self->{localName};
3421     unless (defined $r) {
3422     __UNDEEP{
3423     __EXCEPTION{NO_LOCAL_NAME_ERR::
3424     DIS:sourceNode => {$self->{src}},
3425     }__;
3426     }__;
3427     }
3428     } elsif ($self-><M::ManakaiDISResourceDefinition.isTypeURI>
3429     (<Q::DISLang:Method>) or
3430     $self-><M::ManakaiDISResourceDefinition.isTypeURI>
3431     (<Q::DISLang:Attribute>)) {
3432     if (defined $self->{localName}) {
3433     $r = <ClassM::ManakaiDISImplementation.camelCaseToUnderscoreName>
3434     ($self->{localName});
3435     if ($self-><M::ManakaiDISPropertyAccessor.getPropertyBoolean>
3436     (<Q::ManakaiDOM:isForInternal>, false)) {
3437     $r = '_' . $r;
3438     }
3439     if ({
3440     import => 1,
3441     unimport => 1,
3442     isa => 1,
3443     can => 1,
3444     new => 1,
3445     as_string => 1,
3446     stringify => 1,
3447     clone => 1,
3448     }->{$r} or $r =~ /^___/) {
3449     __UNDEEP{
3450     __EXCEPTION{RESERVED_PERL_METHOD_NAME_ERR::
3451     DIS:uri => {$self->{uri}},
3452     DIS:soruceNode => {$self->{src}},
3453     DIS:generatedName => {$r},
3454     }__;
3455     }__;
3456 wakaba 1.11 }
3457     } elsif (my $op_uri = $self-><AG::ManakaiDISResourceDefinition
3458 wakaba 1.8 .plMethodOperator>) {
3459     $r = {
3460     <Q::ManakaiDOM:MUErrorHandler> => '___report_error',
3461     <Q::DISPerl:AsStringMethod> => 'as_string',
3462     <Q::DISPerl:AsNewMethod> => 'new',
3463     <Q::DISPerl:AsCloneMethod> => 'clone',
3464     }->{$op_uri};
3465     $r = $op_uri if $op_uri =~ /^[A-Z]+$/;
3466     } else {
3467     $r = null;
3468     }
3469     } else {
3470     $r = null;
3471     }
3472     $self->{<Q::dis2pm:name>} = $r;
3473     }__;
3474    
3475     @Attr:
3476     @@Name: plFullyQualifiedName
3477     @@enDesc:
3478     The fully-qualified Perl name of this resource.
3479     @@Type:
3480     DISLang:String::ManakaiDOM:all
3481     @@Get:
3482     @@@enDesc:
3483     Fully-qualified name.
3484     \
3485     - <Q::ManakaiDOM:Class>::: Class package name.
3486     \
3487     - <Q::ManakaiDOM:IF>::: Interface package name.
3488     \
3489     - <Q::DISPerl:ScalarVariable>::: Variable name (without variable
3490     type symbol such as <CODE::$>).
3491     @@@nullCase:
3492     @@@@enDesc:
3493     Otherwise.
3494     @@@NoPerlModuleNameException:
3495     @@@RaiseException:
3496     @@@@@: NO_LOCAL_NAME_ERR
3497     @@@@enDesc:
3498     The local name of this resource is not defined.
3499     @@@PerlDef:
3500     __DEEP{
3501     if (exists $self->{<Q::dis2pm:name>}) {
3502     $r = $self->{<Q::dis2pm:name>};
3503     } elsif ($self-><M::ManakaiDISResourceDefinition.isTypeURI>
3504     (<Q::ManakaiDOM:Class>) or
3505     $self-><M::ManakaiDISResourceDefinition.isTypeURI>
3506     (<Q::ManakaiDOM:IF>) or
3507     $self-><M::ManakaiDISResourceDefinition.isTypeURI>
3508     (<Q::DISPerl:ScalarVariable>)) {
3509     my $an_node = $self->{src}-><AG::ManakaiDISElement.disGetAttribute>
3510     (<Q::dis:AppName>, for_arg => $self->{for},
3511     forp_arg => $self->{forp},
3512     media_type => <Q::lang:Perl>);
3513     if ($an_node) {
3514     ## NOTE: "lang:Perl" is fully-qualified name by definition
3515     $r = $an_node-><AG::swcfg21:SWCFGNode::swcfg21:ForLatest.value>;
3516     } else {
3517 wakaba 1.10 unless (defined $self->{localName}) {
3518     __UNDEEP{
3519     __EXCEPTION{NO_LOCAL_NAME_ERR::
3520     DIS:sourceNode => {$self->{src}},
3521     }__;
3522     }__;
3523     }
3524 wakaba 1.8 if ($self-><M::ManakaiDISResourceDefinition.isTypeURI>
3525     (<Q::ManakaiDOM:IF>)) {
3526     $r = $self-><AG::ManakaiDISResourceDefinition.definingModule>
3527     -><M::ManakaiDISModuleDefinition.plInterfaceName>
3528     . '::' . $self->{localName};
3529     } else {
3530     $r = $self-><AG::ManakaiDISResourceDefinition.definingModule>
3531     -><M::ManakaiDISModuleDefinition.plFullyQualifiedName>
3532     . '::' . $self->{localName};
3533     }
3534     }
3535     } else {
3536     $r = null;
3537     }
3538     $self->{<Q::dis2pm:name>} = $r;
3539     }__;
3540    
3541     @Attr:
3542     @@Name: plMethodOperator
3543     @@enDesc:
3544     The operator to overload by this method.
3545     @@Type:
3546     DISLang:String::ManakaiDOM:all
3547     @@Get:
3548     @@@enDesc:
3549     The operator, either Perl <CODE::use operator> operator name
3550     of manakai operator URI reference.
3551     @@@nullCase:
3552     @@@@enDesc:
3553     Either this resource does not define a Perl method or
3554     this method does not overload any operator.
3555     @@@UndeclaredPrefixException:
3556     @@@RaiseException:
3557     @@@@@: UNSUPPORTED_MEDIA_TYPE_ERR
3558     @@@@enDesc:
3559     Media type of the <Q::dis:Operator> node is not supported.
3560     @@@PerlDef:
3561     __DEEP{
3562     if (exists $self->{<Q::dis:Operator>}) {
3563     $r = $self->{<Q::dis:Operator>};
3564     } else {
3565     my $op_node = $self->{src}-><M::ManakaiDISElement.disGetAttribute>
3566     (<Q::dis:Operator>, for_arg => $self->{for},
3567     forp_arg => $self->{forp});
3568     if ($op_node) {
3569     if ($op_node-><M::ManakaiDISElement.mediaTypeMatch>
3570 wakaba 1.12 (<Q::lang:Perl>, for_arg => $self->{for},
3571     for_arg => $self->{forp})) {
3572 wakaba 1.8 $r = $op_node-><AG::swcfg21:SWCFGNode::swcfg21:ForLatest.value>;
3573     } elsif ($op_node-><M::ManakaiDISElement.mediaTypeMatch>
3574 wakaba 1.12 (<Q::dis:TypeQName>, for_arg => $self->{for},
3575     for_arg => $self->{forp})) {
3576 wakaba 1.8 $r = $op_node-><AG::ManakaiDISElement.qnameValueURI>;
3577     } else {
3578 wakaba 1.10 my $ct_uri = $op_node-><M::ManakaiDISElement.mediaTypeURI>
3579     (for_arg => $self->{for},
3580     forp_arg => $self->{forp});
3581 wakaba 1.8 __UNDEEP{
3582     __EXCEPTION{UNSUPPORTED_MEDIA_TYPE_ERR::
3583     DIS:uri => {$ct_uri},
3584 wakaba 1.10 DIS:sourceNode => {$op_node},
3585 wakaba 1.8 }__;
3586     }__;
3587     }
3588     } else {
3589     $r = null;
3590     }
3591     $self->{<Q::dis:Operator>} = $r;
3592     }
3593     }__;
3594    
3595     @Attr:
3596     @@Name: disDataTypeResource
3597     @@enDesc:
3598     <Q::dis:Type> attribute value of this resource.
3599     @@Type: ManakaiDISResourceDefinition
3600     @@Get:
3601     @@@RaiseException:
3602     @@@@@:NO_DIS_TYPE_ERR
3603     @@@@enDesc:
3604     <Q::dis:Type> attribute is not specified.
3605     @@@PerlDef:
3606     __DEEP{
3607     if (defined $self->{<Q::dis:Type>}) {
3608     $r = $self->{<Q::dis:Type>};
3609     } else {
3610     $self->{<Q::dis2pm:TypeNode>}
3611     = $self->{src}-><M::ManakaiDISElement.disGetAttribute>
3612     (<Q::dis:Type>, for_arg => $self->{for},
3613     forp_arg => $self->{forp});
3614     if ($self->{<Q::dis2pm:TypeNode>}) {
3615     $r = $self->{<Q::dis:Type>}
3616     = $self->{<Q::dis2pm:TypeNode>}
3617     -><AG::ManakaiDISElement.qnameValueURI>;
3618     } else {
3619     my $pr = $self-><M::ManakaiDISPropertyAccessor
3620     .getPropertyResource>
3621     (<Q::DIS:dynamicParentResource>);
3622     if ($pr) {
3623     $r = $pr-><AG::ManakaiDISResourceDefinition
3624     .disDataTypeResource>;
3625     $self->{<Q::dis2pm:TypeNode>}
3626     = $pr->{<Q::dis2pm:TypeNode>};
3627     } else { ## No parent
3628     __UNDEEP{
3629     __EXCEPTION{NO_DIS_TYPE_ERR::
3630     DIS:sourceNode => {$self->{src}},
3631     }__;
3632     }__;
3633     }
3634     }
3635     }
3636     }__;
3637    
3638     @Attr:
3639     @@Name: disDataTypeNode
3640     @@enDesc:
3641     <Q::dis:Type> node for this resource.
3642     @@Get:
3643     @@@Type: ManakaiDISElement
3644     @@@RaiseException:
3645     @@@@@:NO_DIS_TYPE_ERR
3646     @@@@enDesc:
3647     <Q::dis:Type> attribute is not specified.
3648     @@@PerlDef:
3649     __DEEP{
3650     $self-><AG::ManakaiDISResourceDefinition.disDataTypeNode>;
3651     }__;
3652     $r = $self->{<Q::dis2pm:TypeNode>};
3653    
3654     @Attr:
3655     @@Name: disActualDataTypeResource
3656     @@enDesc:
3657     <Q::dis:actualType> attribute value of this resource.
3658     @@Type: ManakaiDISResourceDefinition
3659     @@Get:
3660     @@@RaiseException:
3661     @@@@@:NO_DIS_TYPE_ERR
3662     @@@@enDesc:
3663     <Q::dis:actualType> attribute is not specified,
3664     and <Q::dis:Type> attribute, neigher.
3665     @@@PerlDef:
3666     __DEEP{
3667     if (defined $self->{<Q::dis:actualType>}) {
3668     $r = $self->{<Q::dis:actualType>};
3669     } else {
3670     $self->{<Q::dis2pm:actualTypeNode>}
3671     = $self->{src}-><M::ManakaiDISElement.disGetAttribute>
3672     (<Q::dis:actualType>, for_arg => $self->{for},
3673     forp_arg => $self->{forp});
3674     if ($self->{<Q::dis2pm:actualTypeNode>}) {
3675     $r = $self->{<Q::dis:actualType>}
3676     = $self->{<Q::dis2pm:actualTypeNode>}
3677     -><AG::ManakaiDISElement.qnameValueURI>;
3678     } elsif (defined $self->{<Q::dis:Type>}) {
3679     $r = $self->{<Q::dis:actualType>} = $self->{<Q::dis:Type>};
3680     $self->{<Q::dis2pm:actualTypeNode>}
3681     = $self->{<Q::dis2pm:TypeNode>};
3682     } else {
3683     $self->{<Q::dis2pm:actualTypeNode>}
3684     = $self->{<Q::dis2pm:TypeNode>}
3685     = $self->{src}-><M::ManakaiDISElement.disGetAttribute>
3686     (<Q::dis:Type>, for_arg => $self->{for},
3687     forp_arg => $self->{forp});
3688     if ($self->{<Q::dis2pm:TypeNode>}) {
3689     $r = $self->{<Q::dis:actualType>}
3690     = $self->{<Q::dis:Type>}
3691     = $self->{<Q::dis2pm:TypeNode>}
3692     -><AG::ManakaiDISElement.qnameValueURI>;
3693     } else {
3694     my $pr = $self-><M::ManakaiDISPropertyAccessor
3695     .getPropertyResource>
3696     (<Q::DIS:dynamicParentResource>);
3697     if ($pr) {
3698     $r = $self->{<Q::dis:actualType>}
3699     = $pr-><AG::ManakaiDISResourceDefinition
3700     .disActualDataTypeResource>;
3701     $self->{<Q::dis2pm:actualTypeNode>}
3702     = $pr->{<Q::dis2pm:actualTypeNode>};
3703     } else { ## No parent
3704     __UNDEEP{
3705     __EXCEPTION{NO_DIS_TYPE_ERR::
3706     DIS:sourceNode => {$self->{src}},
3707     }__;
3708     }__;
3709     }
3710     }
3711     }
3712     }
3713     }__;
3714    
3715     @Attr:
3716     @@Name: disActualDataTypeNode
3717     @@enDesc:
3718     <Q::dis:actualType> node for this resource.
3719     @@Get:
3720     @@@Type: ManakaiDISElement
3721     @@@RaiseException:
3722     @@@@@:NO_DIS_TYPE_ERR
3723     @@@@enDesc:
3724     <Q::dis:actualType> attribute is not specified,
3725     and <Q::dis:Type> attribute, neigher.
3726     @@@PerlDef:
3727     __DEEP{
3728     $self-><AG::ManakaiDISResourceDefinition.disActualDataTypeNode>;
3729     }__;
3730     $r = $self->{<Q::dis2pm:actualTypeNode>};
3731 wakaba 1.9
3732     @IntMethod:
3733     @@Operator:
3734     @@@@: <=>
3735     @@@ContentType:
3736     lang:Perl
3737     @@enDesc:
3738     Which is greater (i.e. the spaceship operator).
3739     A resource is less than another if it is loaded by
3740     <M::ManakaiDISDatabase.loadResource> before another is loaded.
3741     Order for non-loaded resource definitions are not defined.
3742     \
3743     {NOTE:: In the current implementation, non-loaded resources
3744     are less than any loaded resource and the order in
3745     non-loaded resources is unknown.
3746     \
3747     }
3748     @@Param:
3749     @@@Name: anotherResource
3750     @@@Type: ManakaiDISResourceDefinition
3751     @@@enDesc: Another resource to compare.
3752     @@Return:
3753     @@@Type:
3754     DOMMain:unsigned-long
3755     @@@PerlDef:
3756     if (UNIVERSAL::isa ($anotherResource,
3757     <ClassName::ManakaiDISResourceDefinition>)) {
3758     $r = $self->{seq} <=> $anotherResource->{seq};
3759     } else {
3760     $r = overload::Overloaded ($self) <=> $anotherResource;
3761     }
3762 wakaba 1.12
3763     @Attr:
3764     @@Name: plCodeFragment
3765     @@enDesc:
3766     Perl code definition fragment of this resource.
3767     @@Type: MPLCodeFragment
3768     @@Get:
3769     @@@enDesc:
3770     Perl code.
3771     @@@nullCase:
3772     @@@@enDesc:
3773     This node does not have Perl code definition.
3774     @@@RaiseException:
3775     @@@@@:NO_METHOD_RETURN_ERR
3776     @@@@enDesc:
3777     This resource is a <Q::DISLang:Method> but it does not
3778     have <Q::DISLang:MethodReturn> child-resource.
3779     @@@RaiseException:
3780     @@@@@:NO_ATTR_GET_ERR
3781     @@@@enDesc:
3782     This resource is a <Q::DISLang:Attribute> but it does not
3783     have <Q::DISLang:AttributeGet> child-resource.
3784     @@@RaiseException:
3785     @@@@@:UNSUPPORTED_MEDIA_TYPE_ERR
3786     @@@@enDesc:
3787     The media type of <Q::dis:Def> element is not supported.
3788     @@@PerlDef:
3789     __DEEP{
3790     if (exists $self->{<Q::plCodeFragment>}) {
3791     $r = $self->{<Q::plCodeFragment>};
3792     } elsif (not $self->{src}) {
3793     $r = $self->{<Q::plCodeFragment>} = null;
3794     } elsif ($self-><M::ManakaiDISResourceDefinition.isTypeURI>
3795     (<Q::DISLang:MethodReturn>) or
3796     $self-><M::ManakaiDISResourceDefinition.isTypeURI>
3797     (<Q::DISLang:AttributeGet>) or
3798     $self-><M::ManakaiDISResourceDefinition.isTypeURI>
3799     (<Q::DISLang:AttrobuteSet>)) {
3800     my $def = $self->{src}-><M::ManakaiDISElement.disGetAttribute>
3801     (<Q::dis:Def>, for_arg => $self->{for},
3802     forp_arg => $self->{forp});
3803     if ($def-><M::ManakaiDISElement.mediaTypeMatch> (<Q::lang:Perl>)) {
3804     $r = $self->{<Q::plCodeFragment>}
3805     = $self-><M::ManakaiDISResourceDefinition.plImplementation>
3806     -><M::MPLImpl.createPerlUnparsedCode>
3807     ($def-><AG::swcfg21:SWCFGNode::swcfg21:ForLatest.value>);
3808     $r-><AS::MPLUnparsedCode.sourceFile>
3809     ($self->{src}-><M::swcfg21:SWCFGNode
3810     ::swcfg21:ForLatest.nodePath>
3811     (key => [qw/Name QName type Type/]));
3812     $r-><AS::MPLUnparsedCode.sourceLine> (1);
3813     } elsif ($def-><M::ManakaiDISElement.mediaTypeMatch>
3814     (<Q::lang:dis>)) {
3815     $r = $self->{<Q::plCodeFragment>}
3816     = $self-><M::ManakaiDISResourceDefinition.plImplementation>
3817     -><M::MPLImpl.createPerlUnparsedCode>
3818     ($def-><AG::swcfg21:SWCFGNode::swcfg21:ForLatest.value>);
3819     ## TODO: implement
3820     } else {
3821     my $mt = $def-><M::ManakaiDISElement.mediaTypeURI>
3822     (for_arg => $self->{for},
3823     forp_arg => $self->{forp});
3824     __UNDEEP{
3825     __EXCEPTION{UNSUPPORTED_MEDIA_TYPE_ERR::
3826     DIS:uri => {$mt},
3827     DIS:sourceNode => {$def},
3828     }__;
3829     }__;
3830     } # media type
3831     } elsif ($self-><M::ManakaiDISResourceDefinition.isTypeURI>
3832     (<Q::DISLang:Method>)) {
3833     my $ret = $self-><M::ManakaiDISResourceDefinition
3834     .getChildResourceByType> (<Q::DISLang:MethodReturn>);
3835     unless ($ret) {
3836     __UNDEEP{
3837     __EXCEPTION{NO_METHOD_RETURN_ERR::
3838     DIS:errResource => {$self},
3839     DIS:sourceNode => {$self->{src}},
3840     }__;
3841     }__;
3842     }
3843     $r = $self->{<Q::plCodeFragment>}
3844     = $self-><M::ManakaiDISResourceDefinition.plImplementation>
3845     -><M::MPLImpl.createPerlSub>
3846     ($self-><AG::ManakaiDISResourceDefinition.plName>);
3847    
3848    
3849     ## TODO: Parameter, sub, ...
3850     $r-><M::MPLSub.appendCodeFragment>
3851     ($ret-><AG::ManakaiDISResourceDefinition.plCodeFragment>);
3852    
3853     } elsif ($self-><M::ManakaiDISResourceDefinition.isTypeURI>
3854     (<Q::DISLang:Attribute>)) {
3855     my $get = $self-><M::ManakaiDISResourceDefinition
3856     .getChildResourceByType> (<Q::DISLang:AttributeGet>);
3857     unless ($get) {
3858     __UNDEEP{
3859     __EXCEPTION{NO_ATTR_GET_ERR::
3860     DIS:errResource => {$self},
3861     DIS:sourceNode => {$self->{src}},
3862     }__;
3863     }__;
3864     }
3865     $r = $self->{<Q::plCodeFragment>}
3866     = $self-><M::ManakaiDISResourceDefinition.plImplementation>
3867     -><M::MPLImpl.createPerlSub>
3868     ($self-><AG::ManakaiDISResourceDefinition.plName>);
3869    
3870    
3871     ## TODO: Parameter, sub, set, ...
3872     $r-><M::MPLSub.appendCodeFragment>
3873     ($get-><AG::ManakaiDISResourceDefinition.plCodeFragment>);
3874    
3875     } else {
3876     $r = $self->{<Q::plCodeFragment>} = null;
3877     } # rdf:type
3878     }__;
3879    
3880     @Attr:
3881     @@Name:plImplementation
3882     @@enDesc:
3883     The <Class::PerlCode:ManakaiPerlCodeImplementation> object.
3884     @@Type: MPLImpl
3885     @@Get:
3886     @@@enDesc:
3887     The Perl code implementation object.
3888     @@@nullCase:
3889     This resource has no source tree associated.
3890     @@@RaiseException:
3891     @@@@@:NO_PERL_CODE_IMPL_ERR
3892     @@@@enDesc:
3893     There is no implementation that implements
3894     the <Feature::Util:PerlCode> feature, version <FeatureVer::1.0>.
3895     @@@PerlDef:
3896     if ($self->{src}) {
3897     __DEEP{
3898     $r = ($self->{src}-><AG::SWCFGNode.ownerDocument> or
3899     $self->{src})-><AG::SWCFGDoc.implementation>
3900     -><M::DOMMinImpl.getFeature>
3901     (<Q::Util:PerlCode> => '1.0');
3902     }__;
3903     unless (defined $r) {
3904     __EXCEPTION{NO_PERL_CODE_IMPL_ERR::
3905    
3906     }__;
3907     }
3908     }
3909    
3910     @Method:
3911     @@Name: getChildResourceByType
3912     @@enDesc:
3913     Gets a static child resource selected by its type.
3914     @@Param:
3915     @@@Name:typeURI
3916     @@@Type:ResourceURI
3917     @@@enDesc:
3918     A URI reference identifying a resource type.
3919     @@Return:
3920     @@@Type: ManakaiDISResourceDefinition
3921     @@@enDesc:
3922     The first (by document order) child resource whose
3923     type matches with <P::resType>.
3924     @@@nullCase:
3925     @@@@enDesc:
3926     There is no resource whose type is <P::resType>.
3927     @@@PerlDef:
3928     __DEEP{
3929     for my $cr_uri (@{$self->{<Q::DIS:childResource>}}) {
3930     my $cr = $self->{db}-><M::ManakaiDISDatabase.getResource>
3931     ($cr_uri);
3932     if ($cr-><M::ManakaiDISResourceDefinition.isTypeURI> ($typeURI)) {
3933     $r = $cr;
3934     last;
3935     }
3936     }
3937     }__;
3938 wakaba 1.2 ##DISResourceDefinition
3939    
3940 wakaba 1.12 ResourceDef:
3941     @QName: DOMMinImpl
3942     @rdf:type:
3943     ManakaiDOM:IF
3944     @AliasFor:
3945     DOMMetaImpl:ManakaiDOMMinimumImplementationIF::ManakaiDOM:ManakaiDOMLatest
3946    
3947     ResourceDef:
3948     @QName: SWCFGNode
3949     @rdf:type:
3950     ManakaiDOM:IF
3951     @AliasFor:
3952     swcfg21:SWCFGNode::swcfg21:ForLatest
3953    
3954     ResourceDef:
3955     @QName: SWCFGDoc
3956     @rdf:type:
3957     ManakaiDOM:IF
3958     @AliasFor:
3959     swcfg21:SWCFGDocument::swcfg21:ForLatest
3960    
3961     ResourceDef:
3962     @QName: MPLImpl
3963     @rdf:type:
3964     ManakaiDOM:Class
3965     @AliasFor:
3966     PerlCode:ManakaiPerlCodeImplementation::ManakaiDOM:Perl
3967    
3968     ResourceDef:
3969     @QName: MPLCodeFragment
3970     @rdf:type:
3971     ManakaiDOM:Class
3972     @AliasFor:
3973     PerlCode:ManakaiPerlCodeFragment::ManakaiDOM:Perl
3974    
3975     ResourceDef:
3976     @QName: MPLSub
3977     @rdf:type:
3978     ManakaiDOM:Class
3979     @AliasFor:
3980     PerlCode:ManakaiPerlSub::ManakaiDOM:Perl
3981    
3982     ResourceDef:
3983     @QName: MPLUnparsedCode
3984     @rdf:type:
3985     ManakaiDOM:Class
3986     @AliasFor:
3987     PerlCode:ManakaiPerlUnparsedCode::ManakaiDOM:Perl
3988    
3989     PropDef:
3990     @QName: plCodeFragment
3991     @enDesc:
3992     Cache for <A::ManakaiDISResourceDefinition.plCodeFragment>.
3993    
3994     XParamDef:
3995     @QName: errResource
3996     @enDesc:
3997     A resource on which an error has occurred.
3998    
3999 wakaba 1.8 XParamDef:
4000     @QName: generatedName
4001     @enDesc:
4002     A generated name.
4003    
4004 wakaba 1.2 ClsDef:
4005     @ClsQName: ManakaiDISPropertyAccessor
4006 wakaba 1.3 @enDesc:
4007 wakaba 1.2 Accessor methods for resource or module properties.
4008    
4009     @Method:
4010 wakaba 1.8 @@Name: getPropertyBoolean
4011     @@enDesc:
4012     Gets boolean property value.
4013     @@PropNameParam:
4014     @@Param:
4015     @@@Name:default
4016     @@@Type:
4017     DOMMain:boolean::ManakaiDOM:all
4018     @@@enDesc:
4019     The default value that is returned if no explicit property
4020     value specification found for this resource.
4021     @@Return:
4022     @@@Type:
4023     DOMMain:boolean::ManakaiDOM:all
4024     @@@enDesc:
4025     The property value.
4026     @@@PerlDef:
4027     if (exists $self->{$propName}) {
4028     $r = defined $self->{$propName} ? $self->{$propName} : $default;
4029     } elsif ($self->{src}) {
4030     $r = $self->{src}-><M::ManakaiDISElement.disGetAttribute>
4031     ($propName, for_arg => $self->{for},
4032     forp_arg => $self->{forp});
4033     $self->{$propName} = $r;
4034     $r = $default unless defined $r;
4035     } else {
4036     $r = $default;
4037     }
4038    
4039     @Method:
4040 wakaba 1.2 @@Name: getPropertyText
4041     @@enDesc:
4042     Gets property value text.
4043     @@PropNameParam:
4044     @@Param:
4045     @@@Name:default
4046     @@@Type:
4047 wakaba 1.3 swcfg21:SWCFGString::swcfg21:ForLatest
4048 wakaba 1.2 @@@enDesc:
4049     The default value that is returned if no explicit property
4050     value specification found for this resource.
4051     @@@nullCase:
4052     @@@@enDesc:
4053     No default value supplied; <DOM::null> is returned if
4054     no value specified.
4055     @@Return:
4056     @@@Type:
4057 wakaba 1.3 swcfg21:SWCFGString::swcfg21:ForLatest
4058 wakaba 1.2 @@@enDesc:
4059     The property value string.
4060     @@@nullCase:
4061     @@@@enDesc:
4062     No value nor default value has specified.
4063     @@@PerlDef:
4064     if (exists $self->{$propName}) {
4065     $r = defined $self->{$propName} ? $self->{$propName} : $default;
4066     } elsif ($self->{src}) {
4067     $r = $self->{src}-><M::ManakaiDISElement.disGetAttribute>
4068     ($propName, for_arg => $self->{for},
4069     forp_arg => $self->{forp});
4070 wakaba 1.8 if ($r) {
4071     $r = $self->{$propName}
4072     = $r-><AG::swcfg21:SWCFGNode::swcfg21:ForLatest.value>;
4073     $r = $default unless defined $r;
4074     } else {
4075     $r = $default;
4076     $self->{$propName} = null;
4077     }
4078 wakaba 1.2 } else {
4079     $r = $default;
4080     }
4081    
4082     @Method:
4083     @@Name: getPropertyResource
4084     @@enDesc:
4085     Gets property value resource.
4086     @@PropNameParam:
4087 wakaba 1.10 @@NamedParam:
4088     @@@Name: defaultMediaType
4089     @@@Type: ResourceURI
4090     @@@enDesc:
4091     The URI reference of the default media type which is used
4092     when the property value is retrieved from the source tree
4093     and the source tree element does not have its <Q::dis:ContentType>
4094     attribute specified.
4095     @@@nullCase:
4096     @@@@enDesc:
4097     Defaulted to <Q::dis:TypeQName>.
4098 wakaba 1.2 @@Return:
4099     @@@Type: ManakaiDISResourceDefinition
4100     @@@enDesc:
4101     The property value resource.
4102     @@@nullCase:
4103     @@@@enDesc:
4104     No value has specified.
4105 wakaba 1.8 @@@UndeclaredPrefixException:
4106 wakaba 1.12 @@@RaiseException:
4107     @@@@@:UNSUPPORTED_MEDIA_TYPE_ERR
4108     @@@@enDesc:
4109     The media type of the attribute node in the source tree
4110     corresponding to this resource is not supported.
4111 wakaba 1.2 @@@PerlDef:
4112     if (defined $self->{$propName}) {
4113 wakaba 1.9 $r = $self->{db}-><M::ManakaiDISDatabase.getResource>
4114     ($self->{$propName});
4115 wakaba 1.8 } elsif ($self->{src}) {
4116     __DEEP{
4117     $r = $self->{src}-><M::ManakaiDISElement.disGetAttribute>
4118     ($propName, for_arg => $self->{for},
4119     forp_arg => $self->{forp});
4120     if ($r) {
4121 wakaba 1.10 $defaultMediaType = <Q::dis:TypeQName>
4122     unless defined $defaultMediaType;
4123     if ($r-><M::ManakaiDISElement.mediaTypeMatch>
4124 wakaba 1.12 (<Q::dis:TypeQName>, $defaultMediaType,
4125     for_arg => $self->{for},
4126     forp_arg => $self->{forp})) {
4127 wakaba 1.10 $self->{$propName}
4128     = $r-><AG::ManakaiDISElement.qnameValueURI>;
4129     } elsif ($r-><M::ManakaiDISElement.mediaTypeMatch>
4130 wakaba 1.12 (<Q::dis:TFQNames>, $defaultMediaType,
4131     for_arg => $self->{for},
4132     forp_arg => $self->{forp})) {
4133 wakaba 1.10 $self->{$propName}
4134     = $r-><M::ManakaiDISElement.tfqnamesValueURI>
4135     ($self->{src}-><AG::swcfg21:SWCFGNode
4136     ::swcfg21:ForLatest.nodeID>,
4137     $self->{for});
4138     } else {
4139     my $mt = $r-><M::ManakaiDISElement.mediaTypeURI>
4140     (for_arg => $self->{for},
4141     forp_arg => $self->{forp});
4142     __UNDEEP{
4143     __EXCEPTION{UNSUPPORTED_MEDIA_TYPE_ERR::
4144     DIS:uri => {$mt},
4145     DIS:sourceNode => {$r},
4146     }__;
4147     }__;
4148     }
4149 wakaba 1.9 $r = $self->{db}-><M::ManakaiDISDatabase.getResource>
4150     ($self->{$propName});
4151     $r-><M::ManakaiDISResourceDefinition.isReferred> ($self->{src});
4152 wakaba 1.8 }
4153     }__;
4154 wakaba 1.2 }
4155    
4156     @Method:
4157 wakaba 1.10 @@Name: getPropertyResourceList
4158     @@enDesc:
4159     Gets property value resource list.
4160     @@PropNameParam:
4161     @@NamedParam:
4162     @@@Name: recursiveISA
4163     @@@Type:
4164     DOMMain:boolean
4165     @@@enDesc:
4166     Whether property resource values of <Q::dis:ISA> resources
4167     of this resource should also be included to the returned list or not.
4168     @@NamedParam:
4169     @@@Name: defaultMediaType
4170     @@@Type: ResourceURI
4171     @@@enDesc:
4172     The URI reference of the default media type which is used
4173     when the property value is retrieved from the source tree
4174     and the source tree element does not have its <Q::dis:ContentType>
4175     attribute specified.
4176     @@@nullCase:
4177     @@@@enDesc:
4178     Defaulted to <Q::dis:TypeQName>.
4179     @@Return:
4180     @@@Type: ResourceList
4181     @@@enDesc:
4182     An array reference of the property value resources.
4183     \
4184     {NOTE:: This list is <QUOTE::dead>.
4185     \
4186     }
4187     @@@UndeclaredPrefixException:
4188 wakaba 1.12 @@@RaiseException:
4189     @@@@@:UNSUPPORTED_MEDIA_TYPE_ERR
4190     @@@@enDesc:
4191     The media type of the attribute node in the source tree
4192     corresponding to this resource is not supported.
4193 wakaba 1.10 @@@PerlDef:
4194     $r = [];
4195     if (defined $self->{$propName}) {
4196     for my $res_uri (@{ref $self->{$propName} eq 'ARRAY'
4197     ? $self->{$propName} : []}) {
4198     push @$r,
4199     $self->{db}-><M::ManakaiDISDatabase.getResource> ($res_uri);
4200     }
4201     } elsif ($self->{src}) {
4202     __DEEP{
4203     $self->{$propName} = [];
4204     $defaultMediaType = <Q::dis:TypeQName>
4205     unless defined $defaultMediaType;
4206     for my $res_name_node
4207     (@{$self->{src}-><M::ManakaiDISElement.disGetAttributeList>
4208     ($propName, for_arg => $self->{for},
4209     forp_arg => $self->{forp})}) {
4210     my $res_uri;
4211     if ($res_name_node-><M::ManakaiDISElement.mediaTypeMatch>
4212 wakaba 1.12 (<Q::dis:TypeQName>, $defaultMediaType,
4213     for_arg => $self->{for},
4214     forp_arg => $self->{forp})) {
4215 wakaba 1.10 $res_uri = $res_name_node-><AG::ManakaiDISElement.qnameValueURI>;
4216     } elsif ($res_name_node-><M::ManakaiDISElement.mediaTypeMatch>
4217 wakaba 1.12 (<Q::dis:TFQNames>, $defaultMediaType,
4218     for_arg => $self->{for},
4219     forp_arg => $self->{forp})) {
4220 wakaba 1.10 $res_uri =$res_name_node-><M::ManakaiDISElement.tfqnamesValueURI>
4221     ($self->{src}-><AG::swcfg21:SWCFGNode
4222     ::swcfg21:ForLatest.nodeID>,
4223     $self->{for});
4224     } else {
4225     my $mt = $res_name_node-><M::ManakaiDISElement.mediaTypeURI>
4226     (for_arg => $self->{for},
4227     forp_arg => $self->{forp});
4228     __UNDEEP{
4229     __EXCEPTION{UNSUPPORTED_MEDIA_TYPE_ERR::
4230     DIS:uri => {$mt},
4231     DIS:sourceNode => {$res_name_node},
4232     }__;
4233     }__;
4234     }
4235     push @{$self->{$propName}}, $res_uri;
4236     my $res = $self->{db}-><M::ManakaiDISDatabase.getResource>
4237     ($res_uri);
4238     push @$r, $res;
4239     $res-><M::ManakaiDISResourceDefinition.isReferred>
4240     ($res_name_node);
4241     }
4242     }__;
4243     }
4244     if ($recursiveISA) {
4245     __DEEP{
4246     $opt{___recursive_isa_done} ||= {$self->{uri} => true};
4247     my @p_res = @$r;
4248     for my $p_res (@p_res) {
4249     next if $opt{___recursive_isa_done}->{$p_res->{uri}};
4250     $opt{___recursive_isa_done}->{$p_res->{uri}} = true;
4251     push @$r, @{$p_res-><M::ManakaiDISPropertyAccessor
4252     .getPropertyResourceList>
4253     (<Q::dis:ISA>, recursive_isa => true,
4254     ___recursive_isa_done => $opt{___recursive_isa_done},
4255     default_media_type => $defaultMediaType)};
4256     }
4257     }__;
4258     }
4259    
4260     @Method:
4261 wakaba 1.2 @@Name: addPropertyResourceList
4262     @@enDesc:
4263     Adds a resource to a resource-list property value.
4264     \
4265     {ISSUE:: Should an exception be thrown if the property is
4266     not of list?
4267     \
4268     }
4269 wakaba 1.10 \
4270     {NOTE:: If the property is not <QUOTE::get>ten ever, adding
4271     an item clears the list --- i.e. the property values
4272     in the source tree will be ignored. Call
4273     <M::ManakaiDISPropertyAccessor.getPropertyResourceList>
4274     before adding to avoid this behavior.
4275     \
4276     }
4277 wakaba 1.2 @@PropNameParam:
4278     @@Param:
4279     @@@Name: res
4280     @@@Type: ManakaiDISResourceDefinition
4281     @@@enDesc:
4282     A resource to add.
4283     @@Return:
4284     @@@PerlDef:
4285     if (ref $self->{$propName} eq 'ARRAY') {
4286     push @{$self->{$propName}}, $res->{uri};
4287     } elsif (not defined $self->{$propName}) {
4288     $self->{$propName} = [$res->{uri}];
4289     }
4290    
4291 wakaba 1.3 ElementTypeBinding:
4292     @Name: PropNameParam
4293     @ElementType:
4294     dis:ResourceDef
4295     @ShadowContent:
4296     @@rdf:type:
4297     DISLang:MethodParameter
4298     @@Name: propName
4299     @@Type: ResourceURI
4300     @@Description:
4301     @@@lang:en
4302     @@@@:
4303     The name of the property.
4304    
4305 wakaba 1.2 ##DISPropertyAccessor
4306    
4307     PropDef:
4308     @QName:isAnon
4309     @Description:
4310     @@lang:en
4311     @@@:
4312     Whether the subject resource is anonymous or not.
4313     @Type:
4314     DOMMain:boolean
4315    
4316     PropDef:
4317     @QName:isDefined
4318     @Description:
4319     @@lang:en
4320     @@@:
4321     Whether the subject resource is defined or not.
4322    
4323     PropDef:
4324 wakaba 1.3 @QName:isReferred
4325 wakaba 1.2 @Description:
4326     @@lang:en
4327     @@@:
4328     Whether the subject resource is referred or not.
4329     @Type:
4330     DOMMain:any
4331    
4332     PropDef:
4333     @QName:definingModule
4334     @Description:
4335     @@lang:en
4336     @@@:
4337     The <QUOTE::dis> module in which the subject resource is defined.
4338     @rdfs:domain:
4339     DISCore:Module
4340 wakaba 1.1
4341     ## -- Datatypes
4342    
4343     URITypeDef:
4344 wakaba 1.3 @QName: AnyURI
4345     @Description:
4346     @@lang:en
4347     @@@:
4348     Any URI references.
4349    
4350     URITypeDef:
4351     @QName: FileURI
4352     @enDesc:
4353     URI references identifying file.
4354    
4355     URITypeDef:
4356 wakaba 1.1 @QName: ForURI
4357     @Description:
4358     @@lang:en
4359     @@@:
4360     <QUOTE::For> URI references.
4361    
4362     DataTypeDef:
4363     @QName: ForURIList
4364     @Description:
4365     @@lang:en
4366     @@@:
4367     References to the array containing <QUOTE::for> URI references.
4368    
4369     URITypeDef:
4370 wakaba 1.3 @QName: ResourceURI
4371     @Description:
4372     @@lang:en
4373     @@@:
4374     A URI reference for a <QUOTE::dis> resource.
4375    
4376     URITypeDef:
4377 wakaba 1.1 @QName: MediaTypeURI
4378     @Description:
4379     @@lang:en
4380     @@@:
4381     Media type URI references.
4382 wakaba 1.3 @rdfs:subClassOf: ResourceURI
4383    
4384     URITypeDef:
4385     @QName: ModuleURI
4386     @enDesc:
4387     URI references for <QUOET::dis> modules.
4388     @rdfs:subClassOf: ResourceURI
4389    
4390     URITypeDef:
4391     @QName: NameURI
4392     @enDesc:
4393     URI references identifying a resource.
4394     @rdfs:subClassOf: ResourceURI
4395 wakaba 1.10
4396     DataTypeDef:
4397     @QName: ResourceList
4398     @enDesc:
4399     References to array containing resource definition objects.
4400     @rdfs:subClassOf:
4401     Perl:ARRAY::ManakaiDOM:all
4402 wakaba 1.3
4403     ElementTypeBinding:
4404     @Name: DataTypeDef
4405     @ElementType:
4406     dis:ResourceDef
4407     @ShadowContent:
4408     @@rdf:type:
4409     ManakaiDOM:DataType
4410    
4411     ElementTypeBinding:
4412     @Name: URITypeDef
4413     @ElementType:
4414     dis:ResourceDef
4415     @ShadowContent:
4416     @@rdf:type:
4417     ManakaiDOM:DataType
4418     @@rdfs:subClassOf: AnyURI
4419 wakaba 1.1
4420     ## -- Exceptions
4421    
4422     XParamDef:
4423 wakaba 1.5 @QName: anotherSourceNode
4424     @enDesc:
4425     Another source node in which an error has occurred. In cases
4426     of <QUOTE::already defined> errors, it is the node that
4427     defines the resource first.
4428     @Type: ManakaiDISNode
4429 wakaba 1.3
4430 wakaba 1.12 ResourceDef:
4431     @QName: UNDECLARED_NS_PREFIX_ERR
4432     @For: ForLatest
4433     @AliasFor:
4434     DIS:UNDECLARED_NS_PREFIX_ERR::swcfg21:ForLatest
4435    
4436 wakaba 1.3 ExceptionDef:
4437     @ClsQName: ManakaiDISException
4438     @enDesc:
4439     Exceptions for the <QUOTE::dis> operations.
4440 wakaba 1.4 @ClsISA:
4441     ManakaiDOM:ManakaiDOMException::ManakaiDOM:Perl
4442 wakaba 1.3 @XConstGroupDef:
4443     @@ClsQName: ManakaiDISExceptionCode
4444     @@enDesc:
4445     Exception codes for <Class::ManakaiDISException>.
4446     @@XConstDef:
4447 wakaba 1.11 @@@Name: HIERARCHY_REQUEST_ERR
4448     @@@Value:3
4449     @@@enDesc:
4450     An attempt is made to break the hierarchy.
4451     @@@XSubTypeDef:
4452     @@@@QName: MERGE_ITSELF_ERR
4453     @@@@enDesc:
4454     An attempt is made to merge the resource to itself.
4455     @@@@XSourceNodeParam:
4456     @@@@XParam:
4457     @@@@@QName:uri
4458     @@@@@enDesc:
4459     The URI reference of the resource to merge.
4460     @@@@enMufDef:
4461     An attempt is made to merge the resource <%p (name => {<Q::DIS:uri>}
4462     );> to itself
4463     @@XConstDef:
4464 wakaba 1.8 @@@Name: NOT_SUPPORTED_ERR
4465     @@@Value:9
4466     @@@enDesc:
4467     An attempt is made to do something the implementation does not support.
4468     @@@XSubTypeDef:
4469     @@@@QName: UNSUPPORTED_MEDIA_TYPE_ERR
4470     @@@@enDesc:
4471     The implementation does not support the media type.
4472     @@@@XParam:
4473     @@@@@QName: uri
4474     @@@@@enDesc:
4475     The URI reference of the media type that is not supported.
4476     @@@@XSourceNodeParam:
4477 wakaba 1.12 @@@@enMufDef:
4478     Media type <%p (name => {<Q::DIS:uri>});> is not supported
4479 wakaba 1.3 @@@XSubTypeDef:
4480 wakaba 1.12 @@@@QName: NO_PERL_CODE_IMPL_ERR
4481 wakaba 1.3 @@@@enDesc:
4482 wakaba 1.12 There is no implementation that supports the
4483     <Feature::Util:PerlCode> feature, version
4484     <FeatureVer::1.0>.
4485 wakaba 1.3 @@XConstDef:
4486     @@@Name: INVALID_STATE_ERR
4487     @@@Value:11
4488     @@@enDesc:
4489     An attempt is made to use an object that is not (or no longer) usable.
4490     @@@XSubTypeDef:
4491     @@@@QName: NO_ASSOCIATED_DB_ERR
4492     @@@@enDesc:
4493     No <QUOTE::dis> database has been associated with this document.
4494 wakaba 1.4 @@XConstDef:
4495     @@@Name: INVALID_SOURCE_ERR
4496     @@@Value: 200
4497     @@@enDesc:
4498     The source input is well-formed but invalid.
4499     @@@XSubTypeDef:
4500     @@@@QName: NO_MODULE_QNAME_ERR
4501     @@@@enDesc:
4502     The <Q::dis:Module> element must have its <Q::dis:QName>
4503     attribute.
4504 wakaba 1.8 @@@@XSourceNodeParam:
4505     @@@XSubTypeDef:
4506     @@@@QName: NO_LOCAL_NAME_ERR
4507     @@@@enDesc:
4508     The resource does not have a local name.
4509     @@@@XSourceNodeParam:
4510 wakaba 1.4 @@@XSubTypeDef:
4511     @@@@QName: UNABLE_TO_GET_MODULE_ERR
4512     @@@@enDesc:
4513     The implementation is unable to get the module source.
4514     @@@@Def:
4515     @@@@@ContentType:
4516     lang:muf
4517     @@@@@lang:en
4518     @@@@@@:
4519     Unable to get the module source of <%p (name => {<Q::DIS:uri>});>
4520     @@@@XParam:
4521     @@@@@QName: uri
4522     @@@@@enDesc:
4523     The URI reference of the module.
4524     @@@@XParam:
4525     @@@@@QName: namespaceURI
4526     @@@@@enDesc:
4527     The namespace URI of the module name.
4528     @@@@XParam:
4529     @@@@@QName: localName
4530     @@@@@enDesc:
4531     The local name of the module name.
4532     @@@@XParam:
4533     @@@@@QName: for
4534     @@@@@enDesc:
4535     The <QUOTE::for> of the module.
4536 wakaba 1.5 @@@XSubTypeDef:
4537     @@@@QName: NO_FOR_QNAME_ERR
4538     @@@@enDesc:
4539     A <Q::dis:ForDef> element must have <Q::dis:QName> attribute.
4540     @@@@XSourceNodeParam:
4541     @@@XSubTypeDef:
4542     @@@@QName: FOR_ALREADY_DEFINED_ERR
4543     @@@@enDesc:
4544     The <QUOTE::for> named as the same URI reference has
4545     already defined.
4546     @@@@XSourceNodeParam:
4547     @@@@XParam:
4548     @@@@@QName: anotherSourceNode
4549     @@@@@enDesc:
4550     The node that defines the <QUOTE::for> URI reference before.
4551 wakaba 1.7 @@@@XParam:
4552     @@@@@Name: uri
4553     @@@@@enDesc:
4554     The URI reference of the <QUOTE::for> attempted to define.
4555     @@@@enMufDef:
4556     <QUOTE::For> <%p (name => {<Q::DIS:uri>});> is already defined
4557 wakaba 1.5 @@@XSubTypeDef:
4558     @@@@QName: RESOURCE_ALREADY_DEFINED_ERR
4559     @@@@enDesc:
4560     The <QUOTE::dis> resource named as the same URI reference has
4561     already defined.
4562     @@@@XSourceNodeParam:
4563     @@@@XParam:
4564     @@@@@QName: anotherSourceNode
4565     @@@@@enDesc:
4566     The node that defines the <QUOTE::for> URI reference before.
4567 wakaba 1.7 @@@@XParam:
4568     @@@@@Name: uri
4569     @@@@@enDesc:
4570     The URI reference of the resource attempted to define.
4571     @@@@enMufDef:
4572     Resource <%p (name => {<Q::DIS:uri>});> is already defined
4573 wakaba 1.5 @@@XSubTypeDef:
4574     @@@@QName: ELEMENT_NOT_ALLOWED_ERR
4575     @@@@enDesc:
4576     An element has occured where it is not allowed.
4577     @@@@enMufDef:
4578     Module <%p (name => {<Q::DIS:uri>});>:
4579     Element of type <%p (name => {<Q::DIS:elementType>});>
4580     is not allowed here
4581     @@@@XSourceNodeParam:
4582     @@@@XParam:
4583     @@@@@QName: elementType
4584     @@@@@enDesc:
4585     The expanded element type name of the element.
4586     @@@@XParam:
4587     @@@@@QName: uri
4588     @@@@@enDesc:
4589     The URI reference of the module.
4590 wakaba 1.7 @@@XSubTypeDef:
4591     @@@@QName: NO_REQUIRED_ATTR_ERR
4592     @@@@enDesc:
4593     A required attribute is not specified.
4594     @@@@XSourceNodeParam:
4595     @@@@XParam:
4596     @@@@@QName: elementType
4597     @@@@@enDesc:
4598     The expanded URI reference of the attribute name.
4599     @@@@enMufDef:
4600     Attribute <%p (name => {<Q::DIS:elementType>});> must be specified
4601 wakaba 1.8 @@@XSubTypeDef:
4602     @@@@QName: FOR_NOT_DEFINED_ERR
4603     @@@@enDesc:
4604     A <QUOTE::for> is referred but not defined.
4605     @@@@XSourceNodeParam:
4606     @@@@XParam:
4607     @@@@@QName: uri
4608     @@@@@enDesc:
4609     The URI reference of the <QUOTE::for> that is not defined.
4610     @@@@enMufDef:
4611     <QUOTE::For> <%p (name => {<Q::DIS:uri>});> is not defined
4612     @@@XSubTypeDef:
4613     @@@@QName: RESOURCE_NOT_DEFINED_ERR
4614     @@@@enDesc:
4615     A <QUOTE::dis> resource is referred but not defined.
4616     @@@@XSourceNodeParam:
4617     @@@@XParam:
4618     @@@@@QName: uri
4619     @@@@@enDesc:
4620     The URI reference of the resource that is not defined.
4621     @@@@enMufDef:
4622     Resource <%p (name => {<Q::DIS:uri>});> is not defined
4623     @@@XSubTypeDef:
4624     @@@@QName: RESERVED_PERL_METHOD_NAME_ERR
4625     @@@@enDesc:
4626     A reserved Perl method name is used.
4627     @@@@XParam:
4628     @@@@@QName:uri
4629     @@@@@enDesc:
4630     The URI reference of the method resource.
4631     @@@@XSourceNodeParam:
4632     @@@@XParam:
4633     @@@@@QName: generatedName
4634     @@@@@enDesc:
4635     A reserved method name.
4636     @@@XSubTypeDef:
4637     @@@@QName: NO_DIS_TYPE_ERR
4638     @@@@enDesc:
4639     <Q::dis:Type> attribute is not found.
4640     @@@@XSourceNodeParam:
4641 wakaba 1.12 @@@XSubTypeDef:
4642     @@@@QName: NO_METHOD_RETURN_ERR
4643     @@@@enDesc:
4644     A <Q::DISLang:Method> resource does not have any
4645     <Q::DISLang:MethodReturn> child.
4646     @@@@XSourceNodeParam:
4647     @@@XSubTypeDef:
4648     @@@@QName: NO_ATTR_GET_ERR
4649     @@@@enDesc:
4650     A <Q::DISLang:Attribute> resource does not have any
4651     <Q::DISLang:AttributeGet> child.
4652     @@@@XSourceNodeParam:
4653 wakaba 1.4 ##DISException
4654 wakaba 1.5
4655     XParamDef:
4656     @QName: elementType
4657     @Type: ResourceURI
4658     @enDesc:
4659     The name of the element type.
4660    
4661     XParamDef:
4662     @QName: uri
4663     @Type: ResourceURI
4664     @enDesc:
4665     The name of the resource, composed from <Q::namespaceURI>,
4666     <Q::localName> and <Q::for>.
4667    
4668     XParamDef:
4669     @QName: localName
4670     @Type:
4671     DISCore:LocalName
4672     @enDesc:
4673     The local name of the resource, unique in <Q::namespaceURI> namespace.
4674    
4675     XParamDef:
4676     @QName: namespaceURI
4677     @Type: AnyURI
4678     @enDesc:
4679     The namespace URI reference of the resource name.
4680    
4681     XParamDef:
4682     @QName: for
4683     @Type: ForURI
4684     @enDesc:
4685     The <QUOTE::for> URI reference of the resource.
4686    
4687     ElementTypeBinding:
4688     @Name: XSourceNodeParam
4689     @ElementType:
4690     ManakaiDOM:exceptionOrWarningParameter
4691     @ShadowContent:
4692     @@QName: sourceNode
4693     @@Description:
4694     @@@lang:en
4695     @@@@:
4696     The node in which an error has occurred.
4697 wakaba 1.4
4698     ClsDef:
4699     @ClsQName: ManakaiDISExceptionTarget
4700     @enDesc:
4701     Objects that is able to be the target of an exception.
4702     @IntMethod:
4703     @@Operator:
4704     @@@@:
4705     ManakaiDOM:MUErrorHandler
4706     @@@ContentType:
4707     dis:TypeQName
4708     @@Description:
4709     @@@lang:en
4710     @@@@:
4711     This method is a generic error handler; all manakai exceptions
4712     and warnings associated to an object are once reported to this method
4713     and then delivered to appropriate entities.
4714     \
4715     If the error is an exception (such as <X::DOMCore:DOMException> or
4716     <X::ManakaiDOM:ManakaiDOMImplementationException>), it is
4717     simply thrown. If the error is only a warning, it is reported
4718     via the <IF::DOMCore:DOMError> interface.
4719     \
4720     See <PerlModule::Message::Util::Error> documentation for more
4721     information on the error reporting mechanism.
4722     \
4723     {NOTE:: This kind of methods are named as <Perl::___report_error>
4724     in the convention of <PerlModule::Message::Util::Error>.
4725     \
4726     }
4727     @@Param:
4728     @@@Name:err
4729     @@@Type:
4730     ManakaiDOM:ManakaiDOMExceptionOrWarning::ManakaiDOM:Perl
4731     @@@Description:
4732     @@@@lang:en
4733     @@@@@:
4734     An exception object that describes what kind of error it is
4735     and how it should be recovered.
4736     \
4737     {NOTE:: Exception objects in manakai implementation
4738     inherit the class <PerlModule::Message::Util::Error>,
4739     that in turn inherits <PerlModule::Error>.
4740     \
4741     }
4742     @@Return:
4743     @@@PerlDef:
4744     if ($err->isa (<ClassName::ManakaiDOM:ManakaiDOMException
4745     ::ManakaiDOM:Perl>)) {
4746     $err->throw;
4747     } else {
4748     \## TODO: Implement warning reporting
4749     warn $err->stringify;
4750     }
4751     ##DISExceptionTarget
4752    
4753     ForDef:
4754     @QName:
4755     DIS:ForIF
4756     ForDef:
4757     @QName:
4758     DIS:ForClass
4759    
4760     ElementTypeBinding:
4761     @Name: IFClsDef
4762     @ElementType:
4763     dis:ResourceDef
4764     @ShadowContent:
4765     @@rdf:type:
4766     @@@@:
4767     dis:MultipleResource
4768     @@@ForCheck: !ForClass !ForIF
4769     @@rdf:type:
4770     @@@@:
4771     ManakaiDOM:IF
4772     @@@ForCheck: ForIF
4773     @@rdf:type:
4774     @@@@:
4775     ManakaiDOM:Class
4776     @@@ForCheck: ForClass
4777     @@resourceFor: ForIF
4778     @@resourceFor:
4779     @@@@: ForClass
4780     @@@ForCheck: ForLatest
4781     @@DOMMain:implementFeature:
4782     @@@@:CoreFeature10
4783     @@@ForCheck: ForClass
4784     @@ForCheck:
4785     ManakaiDOM:Perl
4786 wakaba 1.3
4787     ElementTypeBinding:
4788     @Name: ClsDef
4789     @ElementType:
4790     dis:ResourceDef
4791     @ShadowContent:
4792     @@rdf:type:
4793     ManakaiDOM:Class
4794     @@AliasFor:
4795     @@@@:
4796 wakaba 1.11 ::DIS:ForLatest
4797 wakaba 1.3 @@@For:
4798 wakaba 1.11 !=DIS:ForLatest
4799 wakaba 1.3 @@ForCheck:
4800     ManakaiDOM:Perl
4801     @@DOMMain:implementFeature: CoreFeature10
4802    
4803     ElementTypeBinding:
4804     @Name: ExceptionDef
4805     @ElementType:
4806     dis:ResourceDef
4807     @ShadowContent:
4808     @@rdf:type:
4809     ManakaiDOM:ExceptionClass
4810     @@AliasFor:
4811     @@@@:
4812     ::ForLatest
4813     @@@For:
4814     !=ForLatest
4815     @@ForCheck:
4816     ManakaiDOM:Perl
4817     @@DOMMain:implementFeature: CoreFeature10
4818    
4819     ElementTypeBinding:
4820     @Name: ClsQName
4821     @ElementType:
4822     dis:QName
4823    
4824     ElementTypeBinding:
4825     @Name: ClsISA
4826     @ElementType:
4827     dis:ISA
4828    
4829     ElementTypeBinding:
4830     @Name: Method
4831     @ElementType:
4832     dis:ResourceDef
4833     @ShadowContent:
4834     @@rdf:type:
4835     DISLang:Method
4836    
4837     ElementTypeBinding:
4838     @Name: IntMethod
4839     @ElementType:
4840     dis:ResourceDef
4841     @ShadowContent:
4842     @@rdf:type:
4843     DISLang:Method
4844     @@ManakaiDOM:isForInternal:1
4845    
4846     ElementTypeBinding:
4847     @Name: Attr
4848     @ElementType:
4849     dis:ResourceDef
4850     @ShadowContent:
4851     @@rdf:type:
4852     DISLang:Attribute
4853    
4854     ElementTypeBinding:
4855     @Name: Return
4856     @ElementType:
4857     dis:ResourceDef
4858     @ShadowContent:
4859     @@rdf:type:
4860     DISLang:MethodReturn
4861    
4862     ElementTypeBinding:
4863     @Name: Get
4864     @ElementType:
4865     dis:ResourceDef
4866     @ShadowContent:
4867     @@rdf:type:
4868     DISLang:AttributeGet
4869    
4870     ElementTypeBinding:
4871     @Name: Set
4872     @ElementType:
4873     dis:ResourceDef
4874     @ShadowContent:
4875     @@rdf:type:
4876     DISLang:AttributeSet
4877    
4878     ElementTypeBinding:
4879     @Name: Param
4880     @ElementType:
4881     dis:ResourceDef
4882     @ShadowContent:
4883     @@rdf:type:
4884     DISLang:MethodParameter
4885    
4886     ElementTypeBinding:
4887     @Name: PerlDef
4888     @ElementType:
4889     dis:Def
4890     @ShadowContent:
4891     @@ContentType:
4892     lang:Perl
4893    
4894     ElementTypeBinding:
4895     @Name: disDef
4896     @ElementType:
4897     dis:Def
4898     @ShadowContent:
4899     @@ContentType:
4900     lang:dis
4901    
4902     ElementTypeBinding:
4903     @Name: InCase
4904     @ElementType:
4905     dis:ResourceDef
4906     @ShadowContent:
4907     @@rdf:type:
4908     ManakaiDOM:InCase
4909    
4910     ElementTypeBinding:
4911     @Name: nullCase
4912     @ElementType:
4913     dis:ResourceDef
4914     @ShadowContent:
4915     @@rdf:type:
4916     ManakaiDOM:InCase
4917     @@Value:
4918     @@@is-null:1
4919    
4920     ElementTypeBinding:
4921     @Name: TrueCase
4922     @ElementType:
4923     dis:ResourceDef
4924     @ShadowContent:
4925     @@rdf:type:
4926     ManakaiDOM:InCase
4927     @@Value:true
4928     @@Type:
4929     DOMMain:boolean
4930    
4931    
4932     ElementTypeBinding:
4933     @Name: FalseCase
4934     @ElementType:
4935     dis:ResourceDef
4936     @ShadowContent:
4937     @@rdf:type:
4938     ManakaiDOM:InCase
4939     @@Value:false
4940     @@Type:
4941     DOMMain:boolean
4942    
4943     ElementTypeBinding:
4944     @Name: enDesc
4945     @ElementType:
4946     dis:Description
4947     @ShadowContent:
4948     @@lang:en
4949    
4950     ElementTypeBinding:
4951     @Name: PropDef
4952     @ElementType:
4953     dis:ResourceDef
4954     @ShadowContent:
4955     @@rdf:type:
4956     rdf:Property
4957     @@AliasFor:
4958     @@@@:
4959     ::ManakaiDOM:all
4960     @@@For:
4961     !=ManakaiDOM:all
4962    
4963     ElementTypeBinding:
4964     @Name: MethodRedef
4965     @ElementType:
4966     dis:ResourceDef
4967     @ShadowContent:
4968     @@rdf:type:
4969     DISLang:Method
4970     @@ManakaiDOM:isRedefining:1
4971    
4972     ElementTypeBinding:
4973     @Name: NamedParam
4974     @ElementType:
4975     dis:ResourceDef
4976     @ShadowContent:
4977     @@rdf:type:
4978     DISLang:MethodParameter
4979     @@DISPerl:isNamedParameter:1
4980    
4981     ElementTypeBinding:
4982     @Name: NodeParam
4983     @ElementType:
4984     dis:ResourceDef
4985     @ShadowContent:
4986     @@rdf:type:
4987     DISLang:MethodParameter
4988     @@DISPerl:isNamedParameter:1
4989     @@Name: node
4990     @@Type: ManakaiDISNode
4991     @@Description:
4992     @@@lang:en
4993     @@@@:
4994     The node in which the name has occurred. It is intended
4995     to be reported when an exception had been raised.
4996     @@ResourceDef:
4997     @@@rdf:type:
4998     ManakaiDOM:InCase
4999     @@@Value:
5000     @@@@is-null:1
5001     @@@Description:
5002     @@@@lang:en
5003     @@@@@:
5004     The source of the name is not a node.
5005    
5006     ElementTypeBinding:
5007     @Name: ForParam
5008     @ElementType:
5009     dis:ResourceDef
5010     @ShadowContent:
5011     @@rdf:type:
5012     DISLang:MethodParameter
5013     @@DISPerl:isNamedParameter:1
5014     @@Name: forArg
5015     @@Type: ForURI
5016     @@Description:
5017     @@@lang:en
5018     @@@@:
5019     The <QUOTE::for> URI reference.
5020     @@ResourceDef:
5021     @@@rdf:type:
5022     ManakaiDOM:InCase
5023     @@@Value:
5024     @@@@is-null:1
5025     @@@Description:
5026     @@@@lang:en
5027     @@@@@:
5028     Equivalent to <Q::ManakaiDOM:all>, i.e. <QUOTE::for all>.
5029    
5030     ElementTypeBinding:
5031     @Name: ForpParam
5032     @ElementType:
5033     dis:ResourceDef
5034     @ShadowContent:
5035     @@rdf:type:
5036     DISLang:MethodParameter
5037     @@DISPerl:isNamedParameter:1
5038     @@Name: forpArg
5039     @@Type: ForURIList
5040     @@Description:
5041     @@@lang:en
5042     @@@@:
5043     An array reference containing additional <QUOTE::for>
5044     constraints (<QUOTE::For+> list).
5045     @@ResourceDef:
5046     @@@rdf:type:
5047     ManakaiDOM:InCase
5048     @@@Value:
5049     @@@@is-null:1
5050     @@@Description:
5051     @@@@lang:en
5052     @@@@@:
5053     Equivalent to the empty array reference.
5054    
5055     ElementTypeBinding:
5056     @Name: MediaTypeParam
5057     @ElementType:
5058     dis:ResourceDef
5059     @ShadowContent:
5060     @@rdf:type:
5061     DISLang:MethodParameter
5062     @@DISPerl:isNamedParameter:1
5063     @@Name: mediaType
5064     @@Type: MediaTypeURI
5065     @@Description:
5066     @@@lang:en
5067     @@@@:
5068     The URI reference identifying a media type.
5069     @@ResourceDef:
5070     @@@rdf:type:
5071     ManakaiDOM:InCase
5072     @@@Value:
5073     @@@@is-null:1
5074     @@@Description:
5075     @@@@lang:en
5076     @@@@@:
5077     No media type specified.
5078    
5079     ElementTypeBinding:
5080     @Name: MediaTypeDefaultParam
5081     @ElementType:
5082     dis:ResourceDef
5083     @ShadowContent:
5084     @@rdf:type:
5085     DISLang:MethodParameter
5086     @@DISPerl:isNamedParameter:1
5087     @@Name: defaultMediaType
5088     @@Type: MediaTypeURI
5089     @@Description:
5090     @@@lang:en
5091     @@@@:
5092     The default media type, i.e. the type used when no explicit
5093     specification is not found in the source tree.
5094     @@ResourceDef:
5095     @@@rdf:type:
5096     ManakaiDOM:InCase
5097     @@@Value:
5098     @@@@is-null:1
5099     @@@Description:
5100     @@@@lang:en
5101     @@@@@:
5102     Defaulted to <Q::DOMMain:any>.
5103    
5104     ElementTypeBinding:
5105     @Name: RaiseException
5106     @ElementType:
5107     ManakaiDOM:raises
5108    
5109     ElementTypeBinding:
5110     @Name: UndeclaredPrefixException
5111     @ElementType:
5112     ManakaiDOM:raises
5113     @ShadowContent:
5114     @@@: UNDECLARED_NS_PREFIX_ERR
5115     @@Description:
5116     @@@lang:en
5117     @@@@:
5118     The implementation has encounted an undeclared namespace prefix.
5119    
5120     ElementTypeBinding:
5121     @Name: NoDBException
5122     @ElementType:
5123     ManakaiDOM:raises
5124     @ShadowContent:
5125     @@@: NO_DB_ASSOCIATED_ERR
5126     @@Description:
5127     @@@lang:en
5128     @@@@:
5129     No <QUOTE::dis> database is associated to this document.
5130    
5131     ElementTypeBinding:
5132     @Name: XConstGroupDef
5133     @ElementType:
5134     dis:ResourceDef
5135     @ShadowContent:
5136     @@rdf:type:
5137     ManakaiDOM:ConstGroup
5138     @@Type:
5139     DOMMain:unsigned-short::ManakaiDOM:all
5140     @@rdfs:subClassOf:
5141     DOMMain:unsigned-short::ManakaiDOM:all
5142    
5143     ElementTypeBinding:
5144     @Name: XConstDef
5145     @ElementType:
5146     dis:ResourceDef
5147     @ShadowContent:
5148     @@rdf:type:
5149     ManakaiDOM:Const
5150    
5151     ElementTypeBinding:
5152     @Name: XSubTypeDef
5153     @ElementType:
5154     dis:ResourceDef
5155     @ShadowContent:
5156     @@rdf:type:
5157     ManakaiDOM:ExceptionOrWarningSubType
5158    
5159     ElementTypeBinding:
5160     @Name: XParam
5161     @ElementType:
5162     ManakaiDOM:exceptionOrWarningParameter
5163    
5164     ElementTypeBinding:
5165     @Name: XParamDef
5166     @ElementType:
5167     dis:ResourceDef
5168     @ShadowContent:
5169     @@rdf:type:
5170     DOMMain:XWParameter
5171 wakaba 1.12 @@For:
5172     =ManakaiDOM:all
5173 wakaba 1.3
5174     ElementTypeBinding:
5175     @Name: enMufDef
5176     @ElementType:
5177     dis:Def
5178     @ShadowContent:
5179     @@ContentType:
5180     lang:muf
5181     @@lang:en
5182    

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24