Function Repository Resource:

InformationAssociation

Source Notebook

Return Information on an object as an Association between properties and values

Contributed by: Seth J. Chandler

ResourceFunction["InformationAssociation"][obj]

returns an Association between all named properties of obj and their values.

ResourceFunction["InformationAssociation"][obj,prop]

returns an Association between the property specified in prop and its value.

ResourceFunction["InformationAssociation"][obj,{prop1,prop2,,propn}]

returns an Association between a list of properties, {prop1,prop2,,propn} and their values.

Details

ResourceFunction["InformationAssociation"] supports all objects that Information supports.
Properties are typically specified as strings.
If Information does not work on a particular Entity or other object, ResourceFunction["InformationAssociation"] will fail as well.
ResourceFunction["InformationAssociation"][obj, "ExceptProperties"] returns all properties except the "Properties" property.
ResourceFunction["InformationAssociation"][obj] is equivalent to ResourceFunction["InformationAssociation"][obj, All].

Examples

Basic Examples (4) 

Get an association of information about a system symbol:

In[1]:=
ResourceFunction["InformationAssociation"][Sin]
Out[1]=

Restrict the set of properties retrieved:

In[2]:=
ResourceFunction[
 "InformationAssociation"][Cos, {"Attributes", "Documentation"}]
Out[2]=

Get a list of associations of information about a list of system symbols determined by a RegularExpression pattern:

In[3]:=
ResourceFunction["InformationAssociation"][RegularExpression["Sin."]]
Out[3]=

Get a list of associations of information about a list of system symbols determined by a StringExpression pattern:

In[4]:=
ResourceFunction["InformationAssociation"][
 StringExpression["Map", __, "d"]]
Out[4]=

Scope (8) 

Get a single property:

In[5]:=
ResourceFunction["InformationAssociation"][FoldList, "Attributes"]
Out[5]=

An association of information about an image:

In[6]:=
ResourceFunction["InformationAssociation"][
 Entity["Species", "Species:BosTaurus"][
  EntityProperty["Species", "Image"]]]
Out[6]=

An association of information about a machine learning object, but excluding the "Properties" property:

In[7]:=
trainingset = {1 -> "A", 2 -> "A", 3.5 -> "B", 4 -> "B"};
c = Classify[trainingset];
ResourceFunction["InformationAssociation"][c, "ExceptProperties"]
Out[9]=

Information on a PacletObject returned as an Association:

In[10]:=
ResourceFunction["InformationAssociation"][PacletObject["WebSearch"]]
Out[10]=

Information on a ChannelListener object returned as an Association:

In[11]:=
CreateChannel["example"];
listener = ChannelListener["example"];
ResourceFunction["InformationAssociation"][listener]
Out[11]=

Information on a LibraryFunction returned as an Association:

In[12]:=
ResourceFunction["InformationAssociation"][
 LibraryFunctionLoad["demo", "demo_I_I", {Integer}, Integer]]
Out[12]=

Information on an Entity:

In[13]:=
ResourceFunction["InformationAssociation"][
 Entity["Country", "Estonia"]]
Out[13]=

Information on a QuantityVariable:

In[14]:=
ResourceFunction["InformationAssociation"][
 QuantityVariable["d", "Distance"]]
Out[14]=

Possible Issues (3) 

If running Information on the first argument produces no useful information, a message will be issued and $Failed will be returned:

In[15]:=
ResourceFunction["InformationAssociation"][
 NumericArray[{3, 4, 5}, "UnsignedInteger8"]]
Out[15]=

InformationAssociation on a string for which there is no associated symbol produces a message and returns $Failed:

In[16]:=
ResourceFunction["InformationAssociation"]["zebra"]
Out[16]=

If the second argument contains a property that does not exist, InformationAssociation will return Missing:

In[17]:=
ResourceFunction[
 "InformationAssociation"][Sin, {"Attributes", "Periodic"}]
Out[17]=

Publisher

Seth J. Chandler

Version History

  • 1.0.0 – 29 March 2021

Related Resources

Author Notes

Information does not appear to work on some entities. If Information does not work, then InformationAssociation will not work either.

License Information