The Freebase Type Provider Sample: Static Parameters


 [ Update: the Freebase type provider is now available as part of the FSharp.Data NuGet package and library. The namespace has changed from “Samples.DataStore.Freebase” to “FSharp.Data”. Find out more about F# at  ]

Part 1 – The Freebase Type Provider Sample – Integrating Internet-Scale Data Sources into a Strongly Typed Language
Part 2 – The Freebase Type Provider Sample – Static Parameters
Part 3 – The Freebase Type Provider Sample – Sample Queries for Presidents,  Books and Stars
Part 4 – The Freebase Type Provider Sample – Some Info On Queries

The Freebase Type Provider Sample in the F# 3.0 Sample Pack supports a number of interesting static parameters to the type provider which control how Freebase is integrated into the F# programming language.

These parameters are as follows:


The API key for the Freebase service

default: none

ServiceUrl       The service URL for the Freebase service default:
NumIndividuals The maximum number of sample individuals for each Freebase type, e.g. data.Arts and Entertainment.Music.Musicians.Individuals.Bruce Springsteen   default: 1000

Use the unit-of-measure annotations from the data source metadata

default: true


Use adhoc rules to pluralize the names of types when forming names of collections

default: true


Use a snapshot of both the data and the metadata for the web data store at the given date and/or time in ISO8601 format, e.g., 2012-01-18, 2012-09-15T21:11:32. A value of ‘now’ indicates the compile time of the code. Dates before ~2009 are unlikely to work very well.

default: none


Use a persistent local cache for schema requests at design-time. Also provides the default for whether a persistent local cache is used at runtime, which can be controlled by setting data.DataContext.UseLocalCache. A per-session cache is always used for schema data but it will not persist if this is set to ‘false’.

default: true


Allow local evalution of some parts of a query. If false, then an exception will be raised if a query can’t be evaluated fully on the server. If true, data sets may be implicitly brought to the client for processing.

default: true


By default, the data context returned by

    let data = Samples.DataStore.Freebase.FreebaseData.GetDataContext()

uses the default instantiation for all these parameters (including NO api key!). You can switch to a data connection that uses particular values for the parameters by using FreebaseDataProvider instead of FreebaseData. For example:

    type ServiceAt2009 = Samples.DataStore.Freebase.FreebaseDataProvider<SnapshotDate=”2009-09-21″>

    let data = ServiceAt2009.GetDataContext()




No Comments.