vizml now accepts the whole corpus
authorBen Pfaff <blp@cs.stanford.edu>
Sun, 26 Jan 2020 22:21:45 +0000 (22:21 +0000)
committerBen Pfaff <blp@cs.stanford.edu>
Sun, 26 Jan 2020 22:21:45 +0000 (22:21 +0000)
src/output/spv/spv-legacy-data.c
src/output/spv/spv.c
src/output/spv/vizml.grammar

index da9293ce4826055d02113801f95c710e7ff03ae8..055e7e3a87ba0710ec964a13a872de8f739a976f 100644 (file)
@@ -336,6 +336,9 @@ spv_legacy_data_decode (const uint8_t *in, size_t size, struct spv_data *out)
   char *error = NULL;
   memset (out, 0, sizeof *out);
 
+  if (!size)
+    return NULL;
+
   struct spvbin_input input;
   spvbin_input_init (&input, in, size);
 
index ecb008c9911fd5027f6a7f363889c0a850ac19a6..1d347fd1ad981ad0c83f278a2a5393328471cded 100644 (file)
@@ -665,7 +665,11 @@ spv_item_get_raw_legacy_data (const struct spv_item *item,
     return xstrdup ("not a graph or legacy table object");
 
   if (!item->bin_member)
-    return xstrdup ("graph or legacy table lacks legacy data");
+    {
+      *data = NULL;
+      *size = 0;
+      return NULL;
+    }
 
   return zip_member_read_all (item->spv->zip, item->bin_member, data, size);
 }
@@ -999,7 +1003,8 @@ spv_decode_container (const struct spvsx_container *c,
       item->type = SPV_ITEM_GRAPH;
 
       struct spvsx_graph *graph = spvsx_cast_graph (content);
-      item->bin_member = xstrdup_if_nonempty (graph->data_path->text);
+      if (graph->data_path)
+        item->bin_member = xstrdup_if_nonempty (graph->data_path->text);
       item->command_id = xstrdup_if_nonempty (graph->command_name);
       item->xml_member = xstrdup_if_nonempty (graph->path->text);
     }
index 375a0955386de6854d46467dada4741d39d647d5..7457776f3f5770fb686b0135231c8d82aeeb2fd5 100644 (file)
@@ -26,18 +26,14 @@ visualization
    :schemaLocation?
    :clip?
 => (visualization_extension | location)*
-   userSource+
+   (userSource | delimitedFileSource | embeddedSource)+
    (sourceVariable | derivedVariable | expressionVariable
     | intervalDomain | categoricalDomain)+
-   graph
-   labelFrame[lf1]*
-   container*
-   legend?
-   labelFrame[lf2]*
-   style+
-   layerController?
-   styleCycle*
-   style[s2]*
+   (graph | labelFrame | container | legend)+
+   (style | layerController | styleCycle)+
+   popup*
+   resources?
+   facetSortController?
 
 extension[visualization_extension]
    :numRows=int?
@@ -69,11 +65,37 @@ extension[visualization_extension]
    :certified=bool?
 => EMPTY
 
-userSource :missing=(listwise | pairwise)? => EMPTY   // Related to omit_empty?
+userSource
+   :missing=(listwise | pairwise)?   // Related to omit_empty?
+=> filter?
+
+filter
+   :domain=ref categoricalDomain
+   :exclude=bool
+   :sourceName
+=> EMPTY
+
+delimitedFileSource
+   :encoding
+   :fileName
+   :missing[delimitedFileSource_missing]=(pairwise)
+=> EMPTY
+
+embeddedSource => names types labels? labelColumns? row+
+
+names => TEXT
+
+types => TEXT
+
+labels => TEXT
+
+labelColumns => TEXT
+
+row => TEXT
 
 categoricalDomain
    :date=bool?
-=> (categories | variableReference | domainReference)+ simpleSort?
+=> (categories | variableReference | domainReference)+ (simpleSort | statisticSort)?
 
 domainReference
    :ref=ref categoricalDomain
@@ -91,17 +113,28 @@ range
 
 categories
    :remove=bool?
-=> ETC
+=> TEXT
 
 simpleSort
-   :method[sort_method]=(custom | natural | percent)
+   :method[sort_method]=(custom | natural | percent | naturalUsingLabel | data)
    :descending=bool?
-=> categoryOrder?
+=> (categoryOrder | sortMove)?
+
+sortMove
+   :category
+   :first=bool
+=> EMPTY
+
+statisticSort
+   :descending=bool
+   :method[statisticSort_method]=(mean | sum)
+   :sourceVariable=ref (sourceVariable | derivedVariable | expressionVariable)
+   :statVariable=ref (sourceVariable | derivedVariable | expressionVariable)
+=> EMPTY
 
 sourceVariable
-   :id
-   :categorical=bool
-   :source
+   :categorical=bool?
+   :source=ref (userSource | delimitedFileSource | embeddedSource)
    :domain=ref categoricalDomain?
    :sourceName
    :dependsOn=ref sourceVariable?
@@ -113,19 +146,19 @@ sourceVariable
    :shortLabel?
    :description?
    :inputDateFormatPattern?
-   :measurementLevel=(ratio)?
+   :measurementLevel=(ratio | nominal)?
 => variable_extension* (format | stringFormat | numberFormat)?
 
 derivedVariable
-   :id
-   :categorical=(true)
+   :categorical=bool?
    :value
    :dependsOn=ref sourceVariable?
    :creator?
    :key=bool?
    :label?
-   :source?
+   :source=ref (userSource | delimitedFileSource | embeddedSource)
    :weight=bool?
+   :domain=ref categoricalDomain?
 => variable_extension* (format | stringFormat)? valueMapEntry*
 
 extension[variable_extension]
@@ -144,7 +177,7 @@ expressionVariable
    :shortLabel?
    :label?
    :source?
-=> ETC
+=> EMPTY
 
 valueMapEntry :from :to => EMPTY
 
@@ -154,24 +187,25 @@ graph
    :cellStyle=ref style
    :style=ref style
    :axesOutside=bool?
+   :clip=bool?
 => (location | coordinates | faceting | point | facetLayout
     | line | schema | interval | lineGuide | functionGuide | edge | path
-    | planeGuide | frameGuide)*
+    | planeGuide | frameGuide | area | polygon | pointGuide)*
 
 location
    :part=(height | width | top | bottom | left | right)
    :method=(sizeToContent | attach | fixed | same)
    :min?
    :max?
-   :target=ref (labelFrame | graph | container | legend)?
+   :target=ref (labelFrame | graph | container | legend | visualization)?
    :value?
    :specifiedByUser=bool?
 => EMPTY
 
 coordinates
-=> (dimension | transposeTransform | reflectionTransform | polarTransform
-    | sameRatioTransform | insetTransform | rectangularTransform
-    | obliqueTransform)*
+=> (dimension | dimensionReference | transposeTransform | reflectionTransform
+    | polarTransform | sameRatioTransform | insetTransform
+    | rectangularTransform | obliqueTransform)*
 
 dimension
    :domain?
@@ -182,8 +216,13 @@ dimension
    :unionDomain=bool?
    :clusterGap?
    :clusterVariable?
+   :facetsShareScale=bool?
 => scale? axis*
 
+dimensionReference
+   :ref=ref dimension
+=> EMPTY
+
 scale
    :invert=bool
    :method[scale_method] // linear | log.safe
@@ -191,18 +230,18 @@ scale
    :base=int?
 => EMPTY
 
-transposeTransform => ETC
+transposeTransform => EMPTY
 
 reflectionTransform
    :alternating=bool?
    :dimension?
-=> ETC
+=> EMPTY
 
 polarTransform
    :counterClockwise=bool?
    :cycles=int?
    :startAngle=real?
-=> ETC
+=> EMPTY
 
 sameRatioTransform
    :center=bool
@@ -231,11 +270,11 @@ obliqueTransform
 
 faceting
    :method[faceting_method]=(nest | cross | dot)?
-=> layer[layers1]* cross layer[layers2]* | dot
+=> layer[layers1]* cross layer[layers2]* | dot | variableReference
 
 cross => (unity | nest | cross | variableReference)+
 
-dot => unity variableReference
+dot => unity? variableReference
 
 nest => variableReference[vars]+
 
@@ -255,8 +294,10 @@ layer
 
 facetLayout
    :topDown=bool?
-   :method[facetLayout_method]=(structured)?
+   :method[facetLayout_method]=(structured | unstructured)?
    :cellAspect=int?
+   :alternatingColor=color?
+   :cellSize?
 => tableLayout? setCellProperties[scp1]*
    facetLevel* setCellProperties[scp2]*
 
@@ -264,49 +305,105 @@ tableLayout
    :verticalTitlesInCorner=bool
    :style=ref style?
    :fitCells=(ticks both)?
-=> EMPTY
+=> label?
 
 facetLevel
    :level=int
    :gap?
    :style=ref style?
-=> axis?
+=> axis*
 
 point
    :dot=bool?
    :name?
    :showCollidingLabels=bool?
-   :labelCollisionHandling=(none | normal)?
+   :labelCollisionHandling=(none | normal | outside | quality)?
    :style=ref style?
-   :positionModifier=(none | stack | pile)?
+   :positionModifier=(none | stack | pile | dodge | stackInterpolating)?
    :zOrder=int?
    :clip=(none)?
-=> styleBy? color? labeling* split? x y z?
+   :coordinates=ref coordinates?
+=> binStatistic? graphLayoutStatistic?
+   (color | size | shape | labeling | styleBy | image)*
+   split? conditionalStyle? x? y? z?
 // labeling*3 x y z
+// binStatistic x
+// conditionalStyle x y
+// graphLayoutStatistic labeling
+// color shape x y
+// color*2 size shape x y
+// color size shape color x y
+// labeling styleBy x y
+
+graphLayoutStatistic
+   :from=ref (sourceVariable | derivedVariable | expressionVariable)
+   :to=ref (sourceVariable | derivedVariable | expressionVariable)
+   :nodes=ref (sourceVariable | derivedVariable | expressionVariable)
+=> initial (move | swap)?
+
+shape
+   :cycle=ref styleCycle
+   :variable=ref (sourceVariable | derivedVariable | expressionVariable)
+   :clamp=bool?
+   :domain=ref categoricalDomain?
+=> symbolMapping*
+
+symbolMapping
+   :from
+   :to
+=> EMPTY
+
+image
+   :variable=ref (sourceVariable | derivedVariable | expressionVariable)
+=> stringMapping+
+
+stringMapping
+   :from
+   :to
+=> EMPTY
+
+initial
+   :type=(grid | circle | data)
+=> EMPTY
+
+move => EMPTY
+
+swap => EMPTY
 
 split
    :split=bool
    :variable=ref (sourceVariable | derivedVariable | expressionVariable)
-=> ETC
+=> EMPTY
+
+conditionalStyle
+   :style=ref style
+   :when
+=> EMPTY
 
 line
    :breakRepresentation?
-   :labelCollisionHandling=(none | normal)?
+   :labelCollisionHandling=(none | normal | outside | quality)?
    :showCollidingLabels=bool?
    :name?
    :style=ref style?
    :dot=bool?
-   :positionModifier=(none | stack | pile)?
+   :positionModifier=(none | stack | pile | dodge | stackInterpolating)?
    :showDiscontinuity=bool?
    :zOrder=int?
    :coordinates?
-=> summaryStatistic? smoothStatistic? styleBy? regionStatistic? distributionStatistic? color? x y?
+   :clip=(none)?
+=> (conditionalStyle | smoothStatistic | summaryStatistic | styleBy | regionStatistic | binStatistic | distributionStatistic | attach | color | labeling | size | dash | position_element)* x? y?
+// smoothStatistic summaryStatistic color dash x y
+// summaryStatistic smoothStatistic color x y
+// binStatistic distributionStatistic x
+// binStatistic summaryStatistic x y
 
 smoothStatistic
-   :method[smoothStatistic_method]=(step-left | linear)
+   :method[smoothStatistic_method]=(step-left | step-center | linear | polynomial | loess | spline)
    :bounded=bool?
    :degree=int?
-   :kernel=(uniform)?
+   :kernel=(uniform | epanechnikov)?
+   :proportion=real?
 => EMPTY
 
 regionStatistic
@@ -317,14 +414,32 @@ regionStatistic
 => EMPTY
 
 distributionStatistic
-   :distribution=(normal)
+   :distribution=(normal | poisson)
+=> EMPTY
+
+size
+   :cycle=ref styleCycle?
+   :domain=ref (categoricalDomain | intervalDomain)
+   :variable=ref (sourceVariable | derivedVariable | expressionVariable)
+   :low?
+   :high?
+   :clamp=bool?
+=> scale?
+
+dash
+   :cycle=ref styleCycle
+   :domain=ref categoricalDomain
+   :variable=ref (sourceVariable | derivedVariable | expressionVariable)
+   :clamp=bool?
 => EMPTY
 
 lineGuide
    :style=ref style?
-   :x=int?
-   :y=int?
-=> ETC
+   :x=real?
+   :y=real?
+   :coordinates=ref coordinates?
+   :name?
+=> (label | conditionalStyle)?
 
 functionGuide
    :name
@@ -332,26 +447,30 @@ functionGuide
    :style=ref style?
    :value?
    :zOrder=int?
-=> ETC
+   :coordinates=ref coordinates?
+=> (label | conditionalStyle)?
 
 edge
    :dot=bool
-   :positionModifier=(none | stack | pile)
+   :positionModifier=(none | stack | pile | dodge | stackInterpolating)
    :style=ref style
-=> attach? position_element? linkStatistic? x? y? z?
+   :zOrder=int?
+=> (attach | color | size | position_element | linkStatistic)* x? y? z?
+// attach color size position
+// size color x y
 
 linkStatistic
    :y=(base)
 => EMPTY
 
 path
-   :breakRepresentation=(wings)
+   :breakRepresentation=(wings)?
    :dot=bool
-   :labelCollisionHandling=(none | normal)
+   :labelCollisionHandling=(none | normal | outside | quality)?
    :name
    :showCollidingLabels=bool
    :style=ref style
-=> styleBy x y
+=> (styleBy | color)* x y
 
 planeGuide
    :normal=(x | y | z)
@@ -364,8 +483,34 @@ frameGuide
    :zOrder=int?
 => EMPTY
 
+area
+   :dot=bool
+   :positionModifier=(none | stack | pile | dodge | stackInterpolating)?
+   :showDiscontinuity=bool
+   :style=ref style
+   :zOrder=int
+   :breakRepresentation=(wings)?
+   :labelCollisionHandling=(none | normal | outside | quality)?
+   :showCollidingLabels=bool?
+   :name?
+=> binStatistic? summaryStatistic? color? x y?
+// binStatistic summaryStatistic x
+// color x y
+
+polygon
+   :dot=bool
+   :positionModifier=(none | stack | pile | dodge | stackInterpolating)?
+   :style=ref style
+=> color x y
+
+pointGuide
+   :style=ref style
+   :x=real
+   :y=real
+=> label
+
 attach
-   :target=(point)
+   :target=ref point
    :targetKey=ref (sourceVariable | derivedVariable | expressionVariable)
 => EMPTY
 
@@ -382,11 +527,20 @@ schema
    :name?
    :outlierStyle=ref style?
    :showCollidingLabels=bool?
-   :labelCollisionHandling=(none | normal)?
+   :labelCollisionHandling=(none | normal | outside | quality)?
    :style=ref style?
-   :positionModifier=(none | stack | pile)?
+   :positionModifier=(none | stack | pile | dodge | stackInterpolating)?
    :zOrder=int?
-=> ETC
+=> tukeyStatistic (color | split | labeling | pattern | styleBy)* x? y?
+// tukeyStatistic color labeling x y
+// tukeyStatistic labeling y
+// tukeyStatistic labeling*2 x y
+// tukeyStatistic x
+// tukeyStatistic labeling styleBy x y
+// tukeyStatistic split styleBy labeling x y
+// tukeyStatistic labeling pattern x y
+
+tukeyStatistic => EMPTY
 
 axis
    :style=ref style
@@ -395,17 +549,17 @@ axis
    :combineAxisLabels=bool?
    :maxSize=dimension?
    :zOrder=int?
-   :transform=(linear)?
-=> label? majorTicks minorTicks? axisTransformParameter*
+   :transform=(linear | percent)?
+=> label? majorTicks? minorTicks? axisTransformParameter*
 
 label
    :style=ref style
    :textFrameStyle=ref style?
-   :purpose=(title | subTitle | subSubTitle | layer | footnote | auto)?
-=> text+ | descriptionGroup
+   :purpose=(title | subTitle | subSubTitle | layer | footnote | subFootnote | auto)?
+=> (text | descriptionGroup)*
 
 descriptionGroup
-   :target=ref (faceting | interval | sourceVariable | line)
+   :target=ref (faceting | interval | sourceVariable | line | area)
    :separator?
 => (description | text)+
 
@@ -422,15 +576,16 @@ majorTicks
    :stagger=bool?
    :markStyle=ref style?
    :base=real?
-   :delta=int?
-   :position[majorTicks_position]=(outside)?
-=> gridline? format?
+   :delta=real?
+   :position[majorTicks_position]=(outside | cross)?
+=> gridline? (format | numberFormat)?
 
 minorTicks
    :markStyle=ref style
    :number=int
-   :position[minorTicks_position]=(outside)?
-=> gridline? format?
+   :position[minorTicks_position]=(outside | cross)?
+   :style=ref style?
+=> gridline? (format | numberFormat)?
 
 gridline
    :style=ref style
@@ -506,8 +661,10 @@ format
    :suffix?
    :tryStringsAsNumbers=bool?
    :negativesOutside=bool?
+   :negativesInParentheses=bool?
    :hiddenseparator=bool?
    :scalingFactor=real?
+   :hideNegatives=bool?
 => relabel* affix*
 
 numberFormat
@@ -606,18 +763,24 @@ text
 interval
    :style=ref style
    :dot=bool?
-   :labelCollisionHandling=(none | normal)?
+   :labelCollisionHandling=(none | normal | outside | quality)?
    :showCollidingLabels=bool?
    :name?
-   :positionModifier=(none | stack | pile)?
+   :positionModifier=(none | stack | pile | dodge | stackInterpolating)?
    :zOrder=int?
    :zLocation=real?
-=> binStatistic? summaryStatistic* (styleBy | labeling | color | offset)* x? y? footnotes?
+   :coordinates=ref coordinates?
+=> conditionalStyle? binStatistic? summaryStatistic* (styleBy | labeling | color | offset | pattern | size | dash)* x? y? z? footnotes?
 // styleBy                  labeling         x
 //                          labeling styleBy x y
 // summaryStatistic   color labeling         x
 // styleBy                  labeling offset  x
 // summaryStatistic*2 color labeling
+// color pattern color x y
+// summaryStatistic color size x y
+// summaryStatistic dash x y
+// conditionalStyle binStatistic summaryStatistic x y
+// x y z
 
 labeling
    :style=ref style?
@@ -625,7 +788,10 @@ labeling
    :connectingLines=bool?
    :textFrameStyle=ref style?
    :clamp=bool?
-=> (formatting | format | summaryStatistic | numberFormat | transparency | footnotes | labelLocation)*
+   :dimension=int?
+   :part[labeling_part]=(median)?
+=> (formatting | format | summaryStatistic | numberFormat | transparency | footnotes | labelLocation | styleBy)*
+// summaryStatistic styleBy format
 
 offset
    :domain=ref categoricalDomain
@@ -634,8 +800,15 @@ offset
    :variable=ref (sourceVariable | derivedVariable | expressionVariable)
 => EMPTY
 
+pattern
+   :cycle=ref styleCycle
+   :domain=ref categoricalDomain
+   :variable=ref (sourceVariable | derivedVariable | expressionVariable)
+   :clamp=bool?
+=> EMPTY
+
 transparency
-   :affect=(both | main)
+   :affect=(both | main | secondary)
    :domain=ref intervalDomain
    :low=real
    :high=real
@@ -653,13 +826,21 @@ formatting :variable=ref (sourceVariable | derivedVariable | expressionVariable)
 formatMapping :from=int => format?
 
 color
-   :affect=(both | main)?
+   :affect=(both | main | secondary)?
    :cycle=ref styleCycle?
    :variable?
    :clamp=bool?
    :dimension=int?
    :domain=ref categoricalDomain?
-=> ETC
+   :missing=color?
+   :high=color?
+   :low=color?
+=> colorMapping*
+
+colorMapping
+   :from=int
+   :to=color
+=> EMPTY
 
 x
    :variable=ref (sourceVariable | derivedVariable | expressionVariable)
@@ -677,22 +858,26 @@ styleBy
    :styleCycle?
    :variable?
    :dimension=int?
+   :affects=(hingeStyle)?
 => EMPTY
 
 binStatistic
-   :gridType=(square)?
+   :gridType=(square | dot)?
    :binWidth=real?
    :binCount=int?
-=> ETC
+   :binStart=real?
+   :dimensions=int?
+=> EMPTY
 
 summaryStatistic
-   :method[summaryStatistic_method]=(count | range | percent | sum | mean | percentCount)?
+   :method[summaryStatistic_method]=(count | range | percent | sum | mean | percentCount | fraction | median | first | mode | cumulativePercent)?
    :symbol[summaryStatistic_symbol]=(circle | square)?
-   :summaryBase=(coordinate)?
+   :summaryBase=(coordinate | global | aesthetic)?
    :convertIntervalToSingleValue=bool?
    :summaryIndex=int?
    :augment=(missing)?
-=> ETC
+   :summaryAcrossPanels=bool?
+=> EMPTY
 
 footnotes
    :superscript=bool?
@@ -709,11 +894,11 @@ legend
    :style=ref style
    :tickFrameStyle=ref style
    :tickTextStyle=ref style
-=> location+ label? legendTarget+
+=> location+ label? legendTarget*
 
 legendTarget
-   :target=ref (styleBy | color | line | point)
-   :domain=ref categoricalDomain?
+   :target=ref (styleBy | color | line | point | functionGuide | pattern | size | dash | interval | shape | lineGuide)
+   :domain=ref (categoricalDomain | intervalDomain)?
 => EMPTY
 
 style
@@ -743,9 +928,10 @@ style
    :decimal-offset=dimension?
    :size?
    :width?
+   :height?
    :visible=bool?
    :pattern=int?
-   :stroke-linecap=(butt | round)?
+   :stroke-linecap=(butt | round | square)?
    :stroke-width=dimension?
    :stroke-dasharray?
    :text-fit=bool?
@@ -759,12 +945,20 @@ style
    :padding-top=dimension?
    :padding-bottom=dimension?
    :maxAttachedTextHeight=dimension?
-   :opacity=int?
-   :opacity2=int?
-   :labelInside=(preferred | false)?
+   :maxAttachedTextWidth=dimension?
+   :opacity=real?
+   :opacity2=real?
+   :labelInside=(preferred | false | true)?
    :glyph-sides=int?
    :glyph-angle=real?
    :glyph-aspect=real?
+   :gradient-angle=real?
+   :gradient-focus=real?
+   :gradient-method=(linear)?
+   :shadow-color=color?
+   :shadow-dx=dimension?
+   :shadow-dy=dimension?
+   :background-method=(center)?
 => style*
 
 layerController
@@ -775,7 +969,7 @@ layerController
 container
    :style=ref style
    :clip=bool?
-=> container_extension? location+ labelFrame* legend?
+=> container_extension? location* (labelFrame | legend | container | graph)*
 
 extension[container_extension] :combinedFootnotes=(true) => EMPTY
 
@@ -785,7 +979,7 @@ labelFrame
 
 extension[labelFrame_extension]
    :graphId=ref graph
-   :position[labelFrame_position]=(title | footnote)
+   :position[labelFrame_position]=(title | footnote | subfootnote)
 => EMPTY
 
 paragraph :hangingIndent=dimension? => EMPTY
@@ -798,3 +992,25 @@ extension[styleCycle_extension]
    :aesthetic=(color)?
    :immutables=int?
 => EMPTY
+
+popup
+   :style=ref style
+   :target=ref
+   :tokenTemplate
+   :part[labeling_part]=(median)?
+=> tokenMapping+
+
+tokenMapping
+   :valueToken
+   :variable=ref (sourceVariable | derivedVariable | expressionVariable)
+=> summaryStatistic?
+
+resources => imageResource*
+
+imageResource
+   :name
+=> TEXT
+
+facetSortController
+   :target=ref graph
+=> EMPTY