Skip to content

Instantly share code, notes, and snippets.

@markdstafford
Created March 15, 2013 21:18
Show Gist options
  • Save markdstafford/5173167 to your computer and use it in GitHub Desktop.
Save markdstafford/5173167 to your computer and use it in GitHub Desktop.
<Schema Namespace="com.tableau.visualization.v1" Alias="tv1">
<Using Namespace="org.odata.data.visualization.v1" Alias="odv" />
<!--The range of supported trend line types.-->
<EnumType Name="TrendLineType">
<Member Name="Linear" />
<Member Name="Logarithmic" />
</EnumType>
<!--A type that represents a trend line on a vizualization.-->
<ComplexType Name="TrendLine">
<Property Name="Type" Type="tv1.TrendLineType"/>
<Property Name="ReferenceFields" Type="Collection(Edm.Property)" />
</ComplexType>
<!--A custom type of line chart that adds value to Tableau vizualizations (the default OData.org line chart does not support all of the Tableau bells and whistles).-->
<ComplexType Name="TableauLineChart" BaseType="odv.LineChart">
<Property Name="TrendLines" Type="Collection(tv1.TrendLine)" />
<!--ReferenceLines etc.-->
</ComplexType>
</Schema>
<!--A marked-up model available from some $metadata endpoint-->
<Schema>
<Using Namespace="org.odata.v1" Alias="odata" />
<Using Namespace="com.microsoft.geoflow.v1" Alias="geoflow" />
<Using Namespace="org.odata.data.visualization.v1" Alias="dataViz" />
<Using Namespace="com.tableau.visualization.v1" Alias="tableau" />
<!--Crimes (e.g., robbery, arson, etc.) that occurred in the past. This entity type can be queried
via "normal" OData by using the Incidents entity set, but it is also marked up with visualization
annotations that allow visualization agents to put together several different pre-fab reports.-->
<EntityType Name="Incident">
<Key>
<PropertyRef Name="Id" />
</Key>
<!--The key; we will aggregate over this value by counting it (since summing an id is a very bad idea).-->
<Property Name="Id" Type="Int32" />
<!--The category of the incident (robbery/arson/...); we will use this as a dimension.-->
<Property Name="Type" Type="String" />
<!--The time/date the incident occurred. We cannot use this value as is but will apply a function
in order to get the year as an integral value.-->
<Property Name="OccurredAt" Type="DateTimeOffset" />
<!--The place where the incident occurred. We will use this value as a geography discriminator for GeoFlow.-->
<Property Name="Location" Type="GeographyPoint" />
<Property Name="Description" Type="String" />
<!--Converts OccurredAt to a year (Int32); will be used in the charts below.-->
<Annotation Term="YearOccurred">
<Apply Function="odata.year">
<Path>OccurredAt</Path>
</Apply>
</Annotation>
<!--Converts Location to a state (String); will be used by the GeoFlow chart below.-->
<Annotation Term="GeoFlowState">
<Apply Function="geoflow.state">
<Path>Location</Path>
</Apply>
</Annotation>
<!--Populates "measure" and "dimension" shelves-->
<Annotation Term="Measure">
<PropertyValue Property="AggregationType" Enum="dataViz.AggregationType.Count" />
<PropertyValue Property="Member" PropertyPath="Id" />
</Annotation>
<Annotation Term="Dimension">
<!--DOES THIS WORK?-->
<PropertyValue Property="Member" PropertyPath="YearOccurred" />
</Annotation>
<Annotation Term="Dimension">
<PropertyValue Property="Member" PropertyPath="Type" />
</Annotation>
<Annotation Term="GeoDimension">
<PropertyValue Property="Type" Enum="dataViz.GeoType.Point" />
<PropertyValue Property="Member" PropertyPath="Location" />
</Annotation>
<Annotation Term="GeoDimension">
<PropertyValue Property="Type" Enum="dataViz.GeoType.State" />
<PropertyValue Property="Member" PropertyPath="GeoFlowState" />
</Annotation>
<!--Provides predefined charts-->
<Annotation Term="LineCharts">
<Collection>
<!--Vendor-agnostic report-->
<Record>
<PropertyValue Property="Title" String="Burglaries by state and year" />
<PropertyValue Property="VisualizationAgents">
<Collection>
<String>Excel 13.0.123456</String>
<String>Tableau Public 7.0.8</String>
<String>DataExplorer 1.0</String>
</Collection>
</PropertyValue>
<PropertyValue Property="Columns">
<Collection>
<Record Type="Series">
<PropertyValue Property="Member" PropertyPath="YearOccurred" />
</Record>
</Collection>
</PropertyValue>
<PropertyValue Property="Rows">
<Collection>
<Record Type="Aggregation">
<PropertyValue Property="Type" Enum="dataViz.AggregationType.Count" />
<PropertyValue Property="Member" PropertyPath="Id" />
</Record>
</Collection>
</PropertyValue>
<PropertyValue Property="Color">
<Collection>
<Record Type="Series">
<PropertyValue Property="Member" PropertyPath="Type" />
</Record>
</Collection>
</PropertyValue>
</Record>
<!--GeoFlow report-->
<Record>
<PropertyValue Property="Title" String="Burglaries by state and year" />
<PropertyValue Property="VisualizationAgents">
<Collection>
<String>GeoFlow 0.7.1</String>
</Collection>
</PropertyValue>
<PropertyValue Property="Columns">
<Collection>
<Record Type="Series">
<PropertyValue Property="Member" PropertyPath="GeoFlowState" />
</Record>
</Collection>
</PropertyValue>
<!--This would draw a flat (2D) circle on the globe with larger sizes representing more incidents.
Were we to use Property="Rows" instead, the size wouldn't vary but the height would. Similarly, we
could use Property="Rows" (with the measure) and Property="Colors" to get multiple lines of varying
heights for the various types of incidents.-->
<PropertyValue Property="Size">
<Collection>
<Record Type="Aggregation">
<PropertyValue Property="Type" Enum="dataViz.AggregationType.Count" />
<PropertyValue Property="Member" PropertyPath="Type" />
</Record>
</Collection>
</PropertyValue>
</Record>
<!--Tableau report-->
<Record Type="tableau.TableauLineChart">
<PropertyValue Property="Description" String="Optimized for Tableau!" />
<PropertyValue Property="Title" String="Burglaries by state and year" />
<PropertyValue Property="VisualizationAgents">
<Collection>
<String>Tableau Public 7.0.8</String>
<String>Tableau Desktop 7.0.8</String>
</Collection>
</PropertyValue>
<PropertyValue Property="Columns">
<Collection>
<Record Type="Series">
<PropertyValue Property="Member" PropertyPath="YearOccurred" />
</Record>
</Collection>
</PropertyValue>
<PropertyValue Property="Rows">
<Collection>
<Record Type="Aggregation">
<PropertyValue Property="Type" Enum="dataViz.AggregationType.Count" />
<PropertyValue Property="Member" PropertyPath="Id" />
</Record>
</Collection>
</PropertyValue>
<PropertyValue Property="Color">
<Collection>
<Record Type="Series">
<PropertyValue Property="Member" PropertyPath="Type" />
</Record>
</Collection>
</PropertyValue>
<!--Note that this property does not exist on a normal chart type.-->
<PropertyValue Property="TrendLines">
<Collection>
<Record>
<PropertyValue Property="Type" Enum="tableau.TrendLineType.Linear" />
<PropertyValue Property="ReferenceFields">
<Collection>
<Record>
<PropertyPath>Id</PropertyPath>
</Record>
</Collection>
</PropertyValue>
</Record>
</Collection>
</PropertyValue>
</Record>
</Collection>
</Annotation>
</EntityType>
<Term Name="YearOccurred" Type="Int32" />
<EntityContainer>
<EntitySet Name="Incidents" EntityType="Incident" />
</EntityContainer>
</Schema>
<!--This vocabulary contains terms and types for marking up models with visualization hints.-->
<Schema Namespace="org.odata.data.visualization.v1" Alias="viz">
<!--Server-driven data visualizations that create a line chart.-->
<Term Name="LineCharts" Type="Collection(viz.LineChart)" />
<!--Indicates that this member should be treated as a measure by visualization agents.-->
<Term Name="Measure" Type="viz.Aggregation" />
<!--Indicates that this member should be treated as a dimension by visualization agents.-->
<Term Name="Dimension" Type="viz.Series" />
<!--Indicates that this member has geographical data and can be treated as a dimension by visualization agents.-->
<Term Name="GeoDimension" Type="viz.GeoSeries" />
<!--The range of supported modes of aggregation.-->
<EnumType Name="AggregationType">
<Member Name="Sum" />
<Member Name="Count" />
</EnumType>
<!--The range of supported geographical types.-->
<EnumType Name="GeoType">
<Member Name="Country" />
<Member Name="State" />
<Member Name="Point" />
</EnumType>
<!--A base type for Aggregation and Series; types that differentiate members as measures or dimensions.-->
<ComplexType Name="MemberRef">
<Property Name="Member" Type="Edm.Property" />
</ComplexType>
<!--A type that indicates that a member is aggregatable (i.e., a measure).-->
<ComplexType Name="Aggregation" BaseType="viz.MemberRef">
<Property Name="Type" Type="viz.AggregationType" />
</ComplexType>
<!--A type that indicates that a member is not aggregatable (i.e., a dimension).-->
<ComplexType Name="Series" BaseType="viz.MemberRef" />
<!--A subtype of Series that indicates that a member contains geographic information.-->
<ComplexType Name="GeoSeries" BaseType="viz.Series">
<!--Do we need the format here?-->
<Member Name="Type" Type="viz.GeoType" />
</ComplexType>
<!--A base type used to define common elements to a chart.-->
<ComplexType Name="Chart">
<Property Name="Title" Type="String" />
<Property Name="Subtitle" Type="String" />
<Property Name="Description" Type="String" />
<Property Name="VisualizationAgents" Type="Collection(String)" />
<Property Name="MeasureShelf" Type="Collection(viz.MemberRef)" />
<Property Name="DimensionShelf" Type="Collection(viz.MemberRef)" />
</ComplexType>
<!--A type used to define a line chart.-->
<ComplexType Name="LineChart" BaseType="viz.Chart">
<!--The value to be used on the Y axis; typically this is an Aggregation.-->
<Property Name="Columns" Type="Collection(viz.MemberRef)" />
<!--The value to be used on the X axis; typically this is a Dimension.-->
<Property Name="Rows" Type="Collection(viz.MemberRef)" />
<!--The value to be used to generate different color series; typically this is a Dimension.-->
<Property Name="Color" Type="Collection(viz.MemberRef)" />
</ComplexType>
</Schema>
<!--This vocabulary contains terms and types for marking up models with visualization hints.-->
<Schema Namespace="org.odata.documentation.v1" Alias="doc">
<Term Name="FunctionDoc" Type="doc.FunctionDocumentation" />
<ComplexType Name="Documentation">
<Property Name="Summary" Type="String" />
<Property Name="LongDescription" Type="String" />
</ComplexType>
<ComplexType Name="FunctionDocumentation" BaseType="Documentation">
<Property Name="Parameters" Type="Collection(doc.ParameterDocumentation)" />
<Property Name="ReturnValue" Type="doc.ParameterDocumentation" />
</ComplexType>
<ComplexType Name="ParameterDocumentation" BaseType="Documentation">
<Property Name="Name" Type="String" />
<Property Name="SampleValues" Type="Collection(Edm.String)" />
</ComplexType>
</Schema>
<?xml version="1.0" encoding="utf-8" ?>
<Schema Namespace="Org.OData.Validation.V1" xmlns="http://schemas.microsoft.com/ado/2009/11/edm" Alias="Self">
<!-- TERMS -->
<ValueTerm Name="NumericRange" Type="Self.NumericRangeType" />
<ValueTerm Name="DateRange" Type="Self.DateRangeType" />
<ValueTerm Name="StringLength" Type="Self.StringLengthType" />
<ValueTerm Name="Required" Type="Edm.Boolean" />
<ValueTerm Name="RegularExpression" Type="Self.RegularExpressionType" />
<!-- TYPES FOR TERM VALUES -->
<!-- Range is always inclusive -->
<ComplexType Name="NumericRangeType">
<Property Name="Minimum" Type="Edm.Decimal"/>
<Property Name="Maximum" Type="Edm.Decimal"/>
</ComplexType>
<ComplexType Name="DateRangeType">
<Property Name="Minimum" Type="Edm.DateTimeOffset"/>
<Property Name="Maximum" Type="Edm.DateTimeOffset"/>
</ComplexType>
<!-- String Length -->
<ComplexType Name="StringLengthType">
<Property Name="MinLength" Type="Edm.Int64" />
<Property Name="MaxLength" Type="Edm.Int64" />
</ComplexType>
<!-- Regex -->
<ComplexType Name="RegularExpressionType">
<Property Name="Expression" Type="Edm.String" />
<Property Name="Multiline" Type="Edm.Boolean" />
<Property Name="IgnoreCase" Type="Edm.Boolean" />
</ComplexType>
</Schema>
<Schema Namespace="org.odata.validation.v2" Alias="v">
<ValueTerm Name="LessThan" Type="Edm.PrimitiveType" />
<ValueTerm Name="GreaterThan" Type="Edm.PrimitiveType" />
<ValueTerm Name="MinLength" Type="Edm.Int32" />
<ValueTerm Name="MaxLength" Type="Edm.Int32" />
<ValueTerm Name="Required" Type="Edm.Boolean" />
<ValueTerm Name="RegularExpression" Type="v.RegularExpression" />
<ComplexType Name="RegularExpression">
<Property Name="Expression" Type="Edm.String" />
<Property Name="Multiline" Type="Edm.Boolean" />
<Property Name="IgnoreCase" Type="Edm.Boolean" />
</ComplexType>
</Schema>
<?xml version="1.0" encoding="utf-8" ?>
<Schema>
<Using Namespace="org.odata.validation.v1" Alias="v" />
<EntityType Name="Customer">
<Property Name="FirstName" Type="String">
<Annotation Term="v.Required" Bool="true" />
<Annotation Term="v.StringLength">
<Record>
<PropertyValue Property="MaxLength" Int64="50" />
</Record>
</Annotation>
</Property>
<Property Name="LastName" Type="String">
<Annotation Term="v.Required" Bool="true" />
<Annotation Term="v.StringLength">
<Record>
<PropertyValue Property="MaxLength" Int64="50" />
</Record>
</Annotation>
</Property>
<Property Name="Age" Type="String">
<Annotation Term="v.Required" Bool="true" />
<Annotation Term="v.NumericRange">
<Record>
<PropertyValue Property="Maximum" Decimal="140" />
</Record>
</Annotation>
</Property>
<Property Name="Gender" Type="String">
<Annotation Term="v.Required" Bool="true" />
<Annotation Term="v.RegularExpression">
<Record>
<PropertyValue Property="Expression" String="M|F|male|female" />
<PropertyValue Property="IgnoreCase" Bool="true" />
<PropertyValue Property="Multiline" Bool="true" />
</Record>
</Annotation>
</Property>
</EntityType>
</Schema>
<?xml version="1.0" encoding="utf-8" ?>
<Schema>
<Using Namespace="org.odata.validation.v1" Alias="v" />
<EntityType Name="Customer">
<Property Name="FirstName" Type="String">
<Annotation Term="v.Required" Bool="true" />
<Annotation Term="v.MaxLength" Int32="50" />
</Property>
<Property Name="LastName" Type="String">
<Annotation Term="v.Required" Bool="true" />
<Annotation Term="v.MaxLength" Int32="50" />
</Property>
<Property Name="Age" Type="String">
<Annotation Term="v.Required" Bool="true" />
<Annotation Term="v.LessThan" Int32="130" />
<Annotation Term="v.GreaterThan" Int32="-1" />
</Property>
<Property Name="Gender" Type="String">
<Annotation Term="v.Required" Bool="true" />
<Annotation Term="v.RegularExpression">
<Record>
<PropertyValue Property="Expression" String="M|F|male|female" />
<PropertyValue Property="IgnoreCase" Bool="true" />
<PropertyValue Property="Multiline" Bool="true" />
</Record>
</Annotation>
</Property>
</EntityType>
</Schema>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment