Package Usage and Development » Higher-Level Features
Special Paclet Formats
Mathematica uses a number of specially constructed paclets to drive some of its frameworks. We'll briefly talk about these frameworks and how they showcase what paclets can do.
Curated Data
The curated data framework has been in Mathematica since version 6. As I understand it, it is the Ur-usage for paclets. These paclets drive almost all the functions ending in Data
, like ChemicalData
, ElementData
, and ExampleData
.
A curated data function is in some sense a paclet is a divided into 3 chunks.
There is a code paclet that looks like:
<DataType>Data
+ PacletInfo.m
Kernel
+ init.m
<DataType>Data.m
which configures a function <DataType>Data
that acts as a router to two resource paclets.
The first resource paclet is looks like
<DataType>Data_Index
+ PacletInfo.m
Data
+ Index.wdx
+ Functions.wdx
+ Names.wdx
+ Groups.wdx
+ Properties.wdx
+ PrivateGroups.wdx
And the raw data distributes over a number of paclets that look like
<DataType>Data_Part01
+ PacletInfo.m
Data
+ Part01.wdx
ExampleData
The ExampleData
system works in a similar way to the bulk curated data, but since it provides more specialized resources it serves them in a slightly different way. Each of its resources looks like:
ExampleData_<DataName>
+ PacletInfo.m
Data
+ <DataName>.wdx
You can leverage this to make it serve your own resources with a bit of work.
Service Connections
The Service Connections Framework
is a good example of the flexibility of the paclet system. It provides a general set of high-level functions ServiceConnect
, ServiceExecute
, ServiceDisconnect
, and low-level infrastructure that allow paclets to provide flexible connections to APIs with little effort.
Every service in the $Services
list provides a paclet which looks like:
ServiceConnection_<ServiceName>
+ PacletInfo.m
Kernel
+ load.m
+ <ServiceName>.m
+ <ServiceName>Load.m
+ <ServiceName>Functions.m
The framework first calls load.m
which then loads the other packages. In the end a single set of functions is returned that encapsulates all the API parameters that the service provides.