EntityValue

Listing of Entity Types »

EntityValue[entity,property]

gives the value of the specified property for the given entity.

EntityValue[{entity1,entity2,},property]

gives the list of values of the specified property for each of the entityi.

EntityValue[class,property]

gives the list of values of the specified property for all entities in the specified class.

EntityValue[entity,{property1,property2,}]

gives the list of values of the propertyi for the specified entity.

EntityValue[ents,{property1,property2,}]

gives the list of values of the propertyi for each of the entities represented by ents.

Details

  • ent[property] is equivalent to EntityValue[ent,property] when ent is a valid entity or entity class construct.
  • property[ent] is equivalent to EntityValue[ent,property] when property is a valid EntityProperty, EntityPropertyClass or EntityFunction.
  • A property is specified either by a standard name string or by EntityProperty[type,name,options], where the options can include property qualifiers.
  • In EntityValue[ent,property], the following forms for ent can be used:
  • Entity[]a single entity
    EntityClass[]a named or implicit entity class
    SortedEntityClass[]a class sorted by one or more properties
    SampledEntityClass[]a class containing only the first few entities
    FilteredEntityClass[]a class filtered by a predicate
    ExtendedEntityClass[]a class with one or more properties added
    AggregatedEntityClass[]a class obtained by aggregating over one or more properties
    CombinedEntityClass[]a class obtained by combining the properties of two classes
    {Entity[],Entity[],}a list of individual entities
    "type"all entities of the specified type
  • In EntityValue[ent,prop], prop can be any of the following:
  • "name"named property for the entity type given
    EntityProperty[type,"name"]fully qualified property
    EntityFunction[]a computed property
    EntityPropertyClass[]a named class of properties
    {EntityProperty[], }a list of properties
  • Certain properties are available generically for an entity type, so an entity argument of form Entity["type"] or just "type" can be used:
  • "Properties"the list of available properties
    "SampleEntities"a sample list of available entities (typically of length 10)
    "SampleEntityClasses"a sample list of available entity classes (typically of length 10)
    "EntityCount"number of entities available
    "Entities"the list of available entities
    "EntityClasses"the list of available entity classes
    "PropertyClasses"the list of available property classes
    "PropertyCount"number of properties available
  • The following modifiers can be used in EntityValue[entity,property,"modifier"]:
  • "EntityAssociation"an association of entities and entity-property values
    "PropertyAssociation"an association of properties and entity-property values
    "EntityPropertyAssociation"an association in which the specified entities are keys, and values are a nested association of properties and entity-property values
    "PropertyEntityAssociation"an association in which the specified properties are keys, and values are a nested association of entities and entity-property values
    "Dataset"a dataset in which the specified entities are keys, and values are an association of property names and entity-property values
    "Association"a nested association with entity keys on the first level and property keys on the second level
    "NonMissingPropertyAssociation"an association of properties and entity-property values with the missing values dropped
    "NonMissingEntityAssociation"an association of entities and entity-property values with the missing values dropped
  • The short form EntityValue[entity,"modifier"] is equivalent to EntityValue[entity,EntityProperties[entity],"modifier"].
  • The following annotations can be used in EntityValue[entity,property,"annotation"]:
  • "Source"source information associated with the entity-property value
    "Date"the date associated with the entity-property value
  • EntityValue[EntityProperty[],"property"] can be used to look up property metadata. Metadata properties include the following:
  • "Qualifiers"the list of possible qualifiers for the property
    "QualifierValues"the list of possible values that can be given to each qualifier
    "Label"the label of the property
    "Definition"a detailed textual definition of the property
    "Source"source information for the property
    "PhysicalQuantity"the physical quantity associated with entity-property values
    "Unit"the common unit associated with entity-property values
  • A qualifier value of Automatic indicates that an applicable format of values can be used, e.g. for the "Date" qualifier; this includes a proper date or date span.
  • EntityValue caches results between sessions when able.
  • EntityValue fetches related knowledgebase data in the background based on previously requested data.
  • EntityValue[] returns a list of all available entity types.

Examples

open allclose all

Basic Examples  (5)

Get the property "LongestSpan" of the bridge entity "GoldenGate":

Use to discover names of entities and properties:

Find out how many entities are available in a given type:

Extract properties from an EntityClass:

Use EntityValue to query an external database:

Scope  (17)

Extract multiple properties at once:

Extract a property from multiple entities:

Extract all properties as an association:

Apply an EntityFunction to a single Entity:

Extract properties from a complex entity class:

Extract properties from an EntityInstance:

Use Dated to extract values at a specified time:

Use property qualifiers to specify the date of a property:

Discover available qualifiers and values for a property:

Use for discovery:

When the output of EntityValue involves other entities, these can be fed back into EntityValue:

Use the lists of entities and properties to get multiple results:

The output from time series data can typically be fed directly to DateListPlot:

Get a list of sample entities for an entity type:

List the available properties for an entity type:

List entity classes:

List sample entity classes:

Get an Association for a list of entities:

Get an Association for all properties of an entity:

Get an Association for a list of properties:

Get an Association for lists of entities and/or properties:

Properties & Relations  (4)

EntityValue will cache results for many property values:

These cached values persist across Wolfram System sessions:

Caching parameters can be customized using SystemOptions:

Setting "FileBackedCaching" -> False will disable file-backed caching on the system:

Setting the value to True will restore file-backed caching:

Setting "UpdateCheck" to False will indicate that EntityValue should not check for data updates when reading from the file-backed caches:

Setting the value to True will ensure that cached values are up-to-date:

Possible Issues  (1)

When dealing with external databases, one might encounter a database where the primary key was not set for some tables:

When this happens, EntityStore will emit a message. This means that some functionality involving single entities will be disabled:

But EntityValue will generally keep working:

The only way around this problem is to set the primary key constraint in the external database.

Introduced in 2014
 (10.0)
 |
Updated in 2016
 (10.4)
2018
 (11.3)
2019
 (12.0)