EntityFunction
EntityFunction [x,body]
is a function with a single formal parameter x, to be used in EntityValue and related functions.
EntityFunction [{x1,x2,…},body]
is an EntityFunction with a list of formal parameters.
Details
- EntityFunction [x, body] behaves exactly like an EntityProperty and can be used directly in EntityValue .
- In EntityFunction [x,body], x is usually bound to a single Entity at a time. The second argument of AggregatedEntityClass is an exception to this rule, since the formal parameter will bind to each group of entities.
- In the context of the second argument of AggregatedEntityClass for relational-database-backed entities, the following aggregation functions are supported:
-
Min minimum of valuesMax maximum of valuesLength number of valuesTotal sum of valuesMean the mean valueStandardDeviation sample standard deviationVariance sample variance
- EntityFunction [{left,right},body] can appear as the condition for CombinedEntityClass . Here, left will bind to each Entity in the first argument of CombinedEntityClass and right to each Entity in the second argument.
- When dealing with entities registered in a relational-database-backed EntityStore , only the following forms can be compiled to SQL:
-
a+b additions between numbers, dates and time quantitiesa-b differences between numbers or datesa*b multiplications between numbersa/b ratios between numbersa^b powers between numbersab,a>b,a≠b,… comparisons between numbers, dates, stringsa&&b,a||b,!a,… Boolean algebraInterpreter ["StructuredDate" ][a],Interpreter ["StructuredTime" ][a],Interpreter ["StructuredDateTime" ][a] convert a string to date or time object
- In the context of relational-database-backed entities, the functions above might have limited functionality with respect to their Wolfram Language counterpart. For example, SQL lacks support for complex numbers; because of this, the domains of numerical functions are limited to regions where they are real valued. Symbolic evaluation is generally not available. Precision-tracking semantics may also vary.
Examples
open allclose allBasic Examples (3)
Compute the ratio between atomic mass and atomic number for all noble gases:
EntityFunction can be applied directly to a single entity, like EntityProperty :
Use EntityFunction as a condition for FilteredEntityClass :
Properties & Relations (6)
Use in ExtendedEntityClass to add a new computed property:
Use in FilteredEntityClass as a predicate to select certain entities:
Use in SortedEntityClass as a sorting criterion:
Use in the second argument of AggregatedEntityClass as an aggregator:
Use in the third argument of AggregatedEntityClass as a grouping criterion:
Use in CombinedEntityClass as a combining criterion:
Possible Issues (1)
SQL doesn't support all operations supported by the Wolfram Language:
Mathematical operations in SQL only support real numbers; performing operations that would return a complex number might result in Missing or a runtime error, depending on the backend:
SQL doesn't support returning anything but scalars from properties or EntityFunction :
Tech Notes
Related Guides
-
▪
- Knowledge Representation & Access ▪
- Database Connectivity ▪
- Engineering Data ▪
- Working with Information in Relational Databases ▪
- Life Sciences & Medicine: Data & Computation ▪
- People & History ▪
- Cultural Data ▪
- Transportation Data ▪
- Internet and Computer Systems Data ▪
- Physics & Chemistry: Data and Computation ▪
- Astronomical Computation & Data
Text
Wolfram Research (2019), EntityFunction, Wolfram Language function, https://reference.wolfram.com/language/ref/EntityFunction.html (updated 2020).
CMS
Wolfram Language. 2019. "EntityFunction." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2020. https://reference.wolfram.com/language/ref/EntityFunction.html.
APA
Wolfram Language. (2019). EntityFunction. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/EntityFunction.html
BibTeX
@misc{reference.wolfram_2025_entityfunction, author="Wolfram Research", title="{EntityFunction}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/EntityFunction.html}", note=[Accessed: 27-April-2025 ]}
BibLaTeX
@online{reference.wolfram_2025_entityfunction, organization={Wolfram Research}, title={EntityFunction}, year={2020}, url={https://reference.wolfram.com/language/ref/EntityFunction.html}, note=[Accessed: 27-April-2025 ]}