375a0955386de6854d46467dada4741d39d647d5
[pspp] / src / output / spv / vizml.grammar
1 // PSPP - a program for statistical analysis.
2 // Copyright (C) 2017, 2018, 2019, 2020 Free Software Foundation, Inc.
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
17 visualization
18    :creator?
19    :date
20    :description
21    :lang
22    :name
23    :style[style_ref]=ref style
24    :type
25    :version
26    :schemaLocation?
27    :clip?
28 => (visualization_extension | location)*
29    userSource+
30    (sourceVariable | derivedVariable | expressionVariable
31     | intervalDomain | categoricalDomain)+
32    graph
33    labelFrame[lf1]*
34    container*
35    legend?
36    labelFrame[lf2]*
37    style+
38    layerController?
39    styleCycle*
40    style[s2]*
41
42 extension[visualization_extension]
43    :numRows=int?
44    :showGridline=bool?
45    :minWidthSet=(true)?
46    :maxWidthSet=(true)?
47    :legend1?
48    :legend2?
49    :styleCycleRepository?
50    :title#?
51    :subtitle?
52    :footnote#?
53    :textbox#?
54    :statisticsSummary[statisticsSummary_]?
55    :statisticsSummary#?
56    :dataSetHandle_#?
57    :dataSetName_#?
58    :percentDomain=(percentDomain)?
59    :regionStatistic_#?
60    :smoothStatistic_%?
61    :originLineX?
62    :originLineY?
63    :boxplotLinkWidth=bool?
64    :line_%?
65    :preserveLocations=bool?
66    :creator?
67    :template?
68    :accelerator=bool?
69    :certified=bool?
70 => EMPTY
71
72 userSource :missing=(listwise | pairwise)? => EMPTY   // Related to omit_empty?
73
74 categoricalDomain
75    :date=bool?
76 => (categories | variableReference | domainReference)+ simpleSort?
77
78 domainReference
79    :ref=ref categoricalDomain
80 => EMPTY
81
82 intervalDomain
83    :date=bool?
84 => (variableReference | range)*
85
86 range
87    :exact=bool?
88    :max=real
89    :min=real
90 => EMPTY
91
92 categories
93    :remove=bool?
94 => ETC
95
96 simpleSort
97    :method[sort_method]=(custom | natural | percent)
98    :descending=bool?
99 => categoryOrder?
100
101 sourceVariable
102    :id
103    :categorical=bool
104    :source
105    :domain=ref categoricalDomain?
106    :sourceName
107    :dependsOn=ref sourceVariable?
108    :label?
109    :labelVariable=ref sourceVariable?
110    :creator?
111    :key=bool?
112    :weight=bool?
113    :shortLabel?
114    :description?
115    :inputDateFormatPattern?
116    :measurementLevel=(ratio)?
117 => variable_extension* (format | stringFormat | numberFormat)?
118
119 derivedVariable
120    :id
121    :categorical=(true)
122    :value
123    :dependsOn=ref sourceVariable?
124    :creator?
125    :key=bool?
126    :label?
127    :source?
128    :weight=bool?
129 => variable_extension* (format | stringFormat)? valueMapEntry*
130
131 extension[variable_extension]
132    :from?
133    :helpId?
134    :statistic?
135    :valuesAreGroupedMidpoints=bool?
136    :max?
137    :min?
138 => EMPTY
139
140 expressionVariable
141    :categorical=bool?
142    :creator?
143    :expression?
144    :shortLabel?
145    :label?
146    :source?
147 => ETC
148
149 valueMapEntry :from :to => EMPTY
150
151 categoryOrder => TEXT
152
153 graph
154    :cellStyle=ref style
155    :style=ref style
156    :axesOutside=bool?
157 => (location | coordinates | faceting | point | facetLayout
158     | line | schema | interval | lineGuide | functionGuide | edge | path
159     | planeGuide | frameGuide)*
160
161 location
162    :part=(height | width | top | bottom | left | right)
163    :method=(sizeToContent | attach | fixed | same)
164    :min?
165    :max?
166    :target=ref (labelFrame | graph | container | legend)?
167    :value?
168    :specifiedByUser=bool?
169 => EMPTY
170
171 coordinates
172 => (dimension | transposeTransform | reflectionTransform | polarTransform
173     | sameRatioTransform | insetTransform | rectangularTransform
174     | obliqueTransform)*
175
176 dimension
177    :domain?
178    :lowerMargin?
179    :upperMargin?
180    :niceLowerMapping=bool?
181    :niceUpperMapping=bool?
182    :unionDomain=bool?
183    :clusterGap?
184    :clusterVariable?
185 => scale? axis*
186
187 scale
188    :invert=bool
189    :method[scale_method] // linear | log.safe
190    :origin=real
191    :base=int?
192 => EMPTY
193
194 transposeTransform => ETC
195
196 reflectionTransform
197    :alternating=bool?
198    :dimension?
199 => ETC
200
201 polarTransform
202    :counterClockwise=bool?
203    :cycles=int?
204    :startAngle=real?
205 => ETC
206
207 sameRatioTransform
208    :center=bool
209 => EMPTY
210
211 insetTransform
212    :x-min=real
213    :x-max=real
214    :y-min=real
215    :y-max=real
216 => EMPTY
217
218 rectangularTransform
219    :distance=real
220    :phi=real
221    :theta=real
222    :zeta=real
223 => EMPTY
224
225 obliqueTransform
226    :distance=real
227    :foreShortening=real
228    :theta=real
229    :xscale=real
230 => EMPTY
231
232 faceting
233    :method[faceting_method]=(nest | cross | dot)?
234 => layer[layers1]* cross layer[layers2]* | dot
235
236 cross => (unity | nest | cross | variableReference)+
237
238 dot => unity variableReference
239
240 nest => variableReference[vars]+
241
242 unity => EMPTY
243
244 variableReference
245    :ref=ref (sourceVariable | derivedVariable | expressionVariable)
246 => EMPTY
247
248 layer
249    :variable=ref (sourceVariable | derivedVariable | expressionVariable)
250    :value
251    :visible=bool?
252    :method[layer_method]=(nest)?
253    :titleVisible=bool?
254 => EMPTY
255
256 facetLayout
257    :topDown=bool?
258    :method[facetLayout_method]=(structured)?
259    :cellAspect=int?
260 => tableLayout? setCellProperties[scp1]*
261    facetLevel* setCellProperties[scp2]*
262
263 tableLayout
264    :verticalTitlesInCorner=bool
265    :style=ref style?
266    :fitCells=(ticks both)?
267 => EMPTY
268
269 facetLevel
270    :level=int
271    :gap?
272    :style=ref style?
273 => axis?
274
275 point
276    :dot=bool?
277    :name?
278    :showCollidingLabels=bool?
279    :labelCollisionHandling=(none | normal)?
280    :style=ref style?
281    :positionModifier=(none | stack | pile)?
282    :zOrder=int?
283    :clip=(none)?
284 => styleBy? color? labeling* split? x y z?
285 // labeling*3 x y z
286
287 split
288    :split=bool
289    :variable=ref (sourceVariable | derivedVariable | expressionVariable)
290 => ETC
291
292 line
293    :breakRepresentation?
294    :labelCollisionHandling=(none | normal)?
295    :showCollidingLabels=bool?
296    :name?
297    :style=ref style?
298    :dot=bool?
299    :positionModifier=(none | stack | pile)?
300    :showDiscontinuity=bool?
301    :zOrder=int?
302    :coordinates?
303 => summaryStatistic? smoothStatistic? styleBy? regionStatistic? distributionStatistic? color? x y?
304
305 smoothStatistic
306    :method[smoothStatistic_method]=(step-left | linear)
307    :bounded=bool?
308    :degree=int?
309    :kernel=(uniform)?
310 => EMPTY
311
312 regionStatistic
313    :alpha=real
314    :degree=int
315    :predictIndividuals=bool
316    :regionType=(linear)
317 => EMPTY
318
319 distributionStatistic
320    :distribution=(normal)
321 => EMPTY
322
323 lineGuide
324    :style=ref style?
325    :x=int?
326    :y=int?
327 => ETC
328
329 functionGuide
330    :name
331    :segments=int?
332    :style=ref style?
333    :value?
334    :zOrder=int?
335 => ETC
336
337 edge
338    :dot=bool
339    :positionModifier=(none | stack | pile)
340    :style=ref style
341 => attach? position_element? linkStatistic? x? y? z?
342
343 linkStatistic
344    :y=(base)
345 => EMPTY
346
347 path
348    :breakRepresentation=(wings)
349    :dot=bool
350    :labelCollisionHandling=(none | normal)
351    :name
352    :showCollidingLabels=bool
353    :style=ref style
354 => styleBy x y
355
356 planeGuide
357    :normal=(x | y | z)
358    :style=ref style
359 => EMPTY
360
361 frameGuide
362    :complete=bool?
363    :style=ref style
364    :zOrder=int?
365 => EMPTY
366
367 attach
368    :target=(point)
369    :targetKey=ref (sourceVariable | derivedVariable | expressionVariable)
370 => EMPTY
371
372 position[position_element]
373    :variable=ref expressionVariable
374 => EMPTY
375
376 schema
377    :dot=bool?
378    :extremeStyle?
379    :fenceStyle=ref style?
380    :hingeStyle=ref style?
381    :medianStyle=ref style?
382    :name?
383    :outlierStyle=ref style?
384    :showCollidingLabels=bool?
385    :labelCollisionHandling=(none | normal)?
386    :style=ref style?
387    :positionModifier=(none | stack | pile)?
388    :zOrder=int?
389 => ETC
390
391 axis
392    :style=ref style
393    :opposite=bool?
394    :repeat=(never)?
395    :combineAxisLabels=bool?
396    :maxSize=dimension?
397    :zOrder=int?
398    :transform=(linear)?
399 => label? majorTicks minorTicks? axisTransformParameter*
400
401 label
402    :style=ref style
403    :textFrameStyle=ref style?
404    :purpose=(title | subTitle | subSubTitle | layer | footnote | auto)?
405 => text+ | descriptionGroup
406
407 descriptionGroup
408    :target=ref (faceting | interval | sourceVariable | line)
409    :separator?
410 => (description | text)+
411
412 description
413    :name?
414 => (format | numberFormat)*
415
416 majorTicks
417    :labelAngle=int
418    :length=dimension
419    :style=ref style
420    :tickFrameStyle=ref style
421    :labelFrequency=int?
422    :stagger=bool?
423    :markStyle=ref style?
424    :base=real?
425    :delta=int?
426    :position[majorTicks_position]=(outside)?
427 => gridline? format?
428
429 minorTicks
430    :markStyle=ref style
431    :number=int
432    :position[minorTicks_position]=(outside)?
433 => gridline? format?
434
435 gridline
436    :style=ref style
437    :zOrder=int
438 => EMPTY
439
440 axisTransformParameter
441    :parameterName=(base-ratio | base-match | derived-ratio | derived-match)
442    :parameterValue=real
443 => EMPTY
444
445 setCellProperties
446    :applyToConverse=bool?
447 => (setStyle | setFrameStyle | setFormat | setMetaData)* union[union_]?
448
449 setStyle
450    :target=ref (labeling | graph | interval | majorTicks)
451    :style=ref style
452 => EMPTY
453
454 setMetaData
455    :target=ref graph
456    :key
457    :value
458 => EMPTY
459
460 setFormat
461    :target=ref (majorTicks | labeling)
462    :reset=bool?
463 => format | numberFormat | stringFormat+ | dateTimeFormat | elapsedTimeFormat
464
465 setFrameStyle
466    :style=ref style
467    :target=ref majorTicks
468 => EMPTY
469
470 format
471    :baseFormat[f_base_format]=(date | time | dateTime | elapsedTime)?
472    :errorCharacter?
473    :separatorChars?
474    :mdyOrder=(dayMonthYear | monthDayYear | yearMonthDay)?
475    :showYear=bool?
476    :showQuarter=bool?
477    :quarterPrefix?
478    :quarterSuffix?
479    :yearAbbreviation=bool?
480    :showMonth=bool?
481    :monthFormat=(long | short | number | paddedNumber)?
482    :dayPadding=bool?
483    :dayOfMonthPadding=bool?
484    :showWeek=bool?
485    :weekPadding=bool?
486    :weekSuffix?
487    :showDayOfWeek=bool?
488    :dayOfWeekAbbreviation=bool?
489    :hourPadding=bool?
490    :minutePadding=bool?
491    :secondPadding=bool?
492    :showDay=bool?
493    :showHour=bool?
494    :showMinute=bool?
495    :showSecond=bool?
496    :showMillis=bool?
497    :dayType=(month | year)?
498    :hourFormat=(AMPM | AS_24 | AS_12)?
499    :minimumIntegerDigits?
500    :maximumFractionDigits=int?
501    :minimumFractionDigits?
502    :useGrouping=bool?
503    :scientific=(onlyForSmall | whenNeeded | true | false)?
504    :small=real?
505    :prefix?
506    :suffix?
507    :tryStringsAsNumbers=bool?
508    :negativesOutside=bool?
509    :hiddenseparator=bool?
510    :scalingFactor=real?
511 => relabel* affix*
512
513 numberFormat
514    :minimumIntegerDigits?
515    :maximumFractionDigits=int?
516    :minimumFractionDigits=int?
517    :useGrouping=bool?
518    :scientific=(onlyForSmall | whenNeeded | true | false)?
519    :small=real?
520    :prefix?
521    :suffix?
522    :hiddenseparator=bool?
523 => affix*
524
525 stringFormat => relabel* affix*
526
527 dateTimeFormat
528    :baseFormat[dt_base_format]=(date | time | dateTime)
529    :separatorChars?
530    :mdyOrder=(dayMonthYear | monthDayYear | yearMonthDay)?
531    :showYear=bool?
532    :yearAbbreviation=bool?
533    :showQuarter=bool?
534    :quarterPrefix?
535    :quarterSuffix?
536    :showMonth=bool?
537    :monthFormat=(long | short | number | paddedNumber)?
538    :showWeek=bool?
539    :weekPadding=bool?
540    :weekSuffix?
541    :showDayOfWeek=bool?
542    :dayOfWeekAbbreviation=bool?
543    :dayPadding=bool?
544    :dayOfMonthPadding=bool?
545    :hourPadding=bool?
546    :minutePadding=bool?
547    :secondPadding=bool?
548    :showDay=bool?
549    :showHour=bool?
550    :showMinute=bool?
551    :showSecond=bool?
552    :showMillis=bool?
553    :dayType=(month | year)?
554    :hourFormat=(AMPM | AS_24 | AS_12)?
555 => affix*
556
557 elapsedTimeFormat
558    :baseFormat[dt_base_format]=(date | time | dateTime)
559    :dayPadding=bool?
560    :hourPadding=bool?
561    :minutePadding=bool?
562    :secondPadding=bool?
563    :showYear=bool?
564    :showDay=bool?
565    :showHour=bool?
566    :showMinute=bool?
567    :showSecond=bool?
568    :showMillis=bool?
569 => affix*
570
571 affix
572    :definesReference=int
573    :position=(subscript | superscript)
574    :suffix=bool
575    :value
576 => EMPTY
577
578 relabel
579    :from
580    :to
581 => EMPTY
582
583 union => intersect+
584
585 intersect => where+ | intersectWhere | alternating | EMPTY
586
587 where
588    :variable=ref (sourceVariable | derivedVariable | expressionVariable)
589    :include
590 => EMPTY
591
592 intersectWhere
593    :variable=ref (sourceVariable | derivedVariable | expressionVariable)
594    :variable2=ref (sourceVariable | derivedVariable | expressionVariable)
595 => EMPTY
596
597 alternating => EMPTY
598
599 text
600    :usesReference=int?
601    :definesReference=int?
602    :position=(subscript | superscript)?
603    :style=ref style
604 => TEXT
605
606 interval
607    :style=ref style
608    :dot=bool?
609    :labelCollisionHandling=(none | normal)?
610    :showCollidingLabels=bool?
611    :name?
612    :positionModifier=(none | stack | pile)?
613    :zOrder=int?
614    :zLocation=real?
615 => binStatistic? summaryStatistic* (styleBy | labeling | color | offset)* x? y? footnotes?
616 // styleBy                  labeling         x
617 //                          labeling styleBy x y
618 // summaryStatistic   color labeling         x
619 // styleBy                  labeling offset  x
620 // summaryStatistic*2 color labeling
621
622 labeling
623    :style=ref style?
624    :variable=ref (sourceVariable | derivedVariable | expressionVariable)
625    :connectingLines=bool?
626    :textFrameStyle=ref style?
627    :clamp=bool?
628 => (formatting | format | summaryStatistic | numberFormat | transparency | footnotes | labelLocation)*
629
630 offset
631    :domain=ref categoricalDomain
632    :high
633    :low
634    :variable=ref (sourceVariable | derivedVariable | expressionVariable)
635 => EMPTY
636
637 transparency
638    :affect=(both | main)
639    :domain=ref intervalDomain
640    :low=real
641    :high=real
642    :variable=ref (sourceVariable | derivedVariable | expressionVariable)
643 => EMPTY
644
645 labelLocation
646    :domain=ref intervalDomain
647    :role=(x | y)
648    :variable=ref (sourceVariable | derivedVariable | expressionVariable)
649 => EMPTY
650
651 formatting :variable=ref (sourceVariable | derivedVariable | expressionVariable) => formatMapping*
652
653 formatMapping :from=int => format?
654
655 color
656    :affect=(both | main)?
657    :cycle=ref styleCycle?
658    :variable?
659    :clamp=bool?
660    :dimension=int?
661    :domain=ref categoricalDomain?
662 => ETC
663
664 x
665    :variable=ref (sourceVariable | derivedVariable | expressionVariable)
666 => EMPTY
667
668 y
669    :variable=ref (sourceVariable | derivedVariable | expressionVariable)
670 => EMPTY
671
672 z
673    :variable=ref (sourceVariable | derivedVariable | expressionVariable)
674 => EMPTY
675
676 styleBy
677    :styleCycle?
678    :variable?
679    :dimension=int?
680 => EMPTY
681
682 binStatistic
683    :gridType=(square)?
684    :binWidth=real?
685    :binCount=int?
686 => ETC
687
688 summaryStatistic
689    :method[summaryStatistic_method]=(count | range | percent | sum | mean | percentCount)?
690    :symbol[summaryStatistic_symbol]=(circle | square)?
691    :summaryBase=(coordinate)?
692    :convertIntervalToSingleValue=bool?
693    :summaryIndex=int?
694    :augment=(missing)?
695 => ETC
696
697 footnotes
698    :superscript=bool?
699    :variable=ref (sourceVariable | derivedVariable | expressionVariable)
700 => footnoteMapping*
701
702 footnoteMapping
703    :definesReference=int
704    :from=int
705    :to
706 => EMPTY
707
708 legend
709    :style=ref style
710    :tickFrameStyle=ref style
711    :tickTextStyle=ref style
712 => location+ label? legendTarget+
713
714 legendTarget
715    :target=ref (styleBy | color | line | point)
716    :domain=ref categoricalDomain?
717 => EMPTY
718
719 style
720    :color=color?
721    :color2=color?
722    :labelAngle=real?
723    :border-bottom=(solid | thick | thin | double | none)?
724    :border-top=(solid | thick | thin | double | none)?
725    :border-left=(solid | thick | thin | double | none)?
726    :border-right=(solid | thick | thin | double | none)?
727    :border-bottom-color?
728    :border-top-color?
729    :border-left-color?
730    :border-right-color?
731    :font-family?
732    :font-size?
733    :font-weight=(regular | bold)?
734    :font-style=(regular | italic)?
735    :font-underline=(none | underline)?
736    :margin-bottom=dimension?
737    :margin-left=dimension?
738    :margin-right=dimension?
739    :margin-top=dimension?
740    :textAlignment=(left | right | center | decimal | mixed)?
741    :labelLocationHorizontal=(positive | negative | center)?
742    :labelLocationVertical=(positive | negative | center)?
743    :decimal-offset=dimension?
744    :size?
745    :width?
746    :visible=bool?
747    :pattern=int?
748    :stroke-linecap=(butt | round)?
749    :stroke-width=dimension?
750    :stroke-dasharray?
751    :text-fit=bool?
752    :depth?
753    :symbol=(circle | ibeam | flower | square | line | acrossDown | cross
754             | polygon | plus | bowtie | star | arrow | none)?
755    :margin=dimension?
756    :padding=dimension?
757    :padding-left=dimension?
758    :padding-right=dimension?
759    :padding-top=dimension?
760    :padding-bottom=dimension?
761    :maxAttachedTextHeight=dimension?
762    :opacity=int?
763    :opacity2=int?
764    :labelInside=(preferred | false)?
765    :glyph-sides=int?
766    :glyph-angle=real?
767    :glyph-aspect=real?
768 => style*
769
770 layerController
771    :source=(tableData)
772    :target=ref label?
773 => EMPTY
774
775 container
776    :style=ref style
777    :clip=bool?
778 => container_extension? location+ labelFrame* legend?
779
780 extension[container_extension] :combinedFootnotes=(true) => EMPTY
781
782 labelFrame
783    :style=ref style
784 => labelFrame_extension* location+ label? paragraph?
785
786 extension[labelFrame_extension]
787    :graphId=ref graph
788    :position[labelFrame_position]=(title | footnote)
789 => EMPTY
790
791 paragraph :hangingIndent=dimension? => EMPTY
792
793 styleCycle => cycle+ styleCycle_extension*
794
795 cycle => style+
796
797 extension[styleCycle_extension]
798    :aesthetic=(color)?
799    :immutables=int?
800 => EMPTY