I have seen in Tikz that multiple properties can be assigned and retrieved from a key, unless I am misinterpreting it. The pgfkeys documentation always mentions a pair of key=value to set or to get but never mentions multiple values for the same key. Assuming I define keys for "State" and want to assign "state_name", "capital", and population as properties. Then I want to retrieve either the name of the state or population using the key (for example AZ). Here is sample code to start:
\documentclass[12pt,twoside]{article}
\RequirePackage{filecontents}% write the data file
\usepackage{pgfkeys}
\begin{filecontents}{states.csv}
AZ = { Arizona,Phoenix, 6931071}
CA = { California,Sacramento, 39250017}
FL = { Florida,Tallahassee, 20612439}
GA = { Georgia,Atlanta, 10310371}
MS = { Massachusetts,Boston, 6811779}
NY = { New York,Albany, 19745289}
TX = { Texas,Austin, 27862596}
\end{filecontents}
% BEGIN Read US States Definitions
\pgfkeys{/state/.is family, state,
% allow arbitrary unknown keys and set with \pgfkeyssetvalue
.unknown/.code={\pgfkeyssetvalue{\pgfkeyscurrentpath/\pgfkeyscurrentname}{#1}},
}
\newcommand\printstate[1]{% print the key if it is defined and ???Otherwise
\pgfkeysifdefined{/state/#1}{\pgfkeysvalueof{/state/#1}}{???}%
}
\newcommand\AddState[1]{\expandafter\pgfkeys\expandafter{/state, #1}}
\newread\statefile% file handler
\def\apar{\par}% \ifx\par won't work but \ifx\apar will
\newcommand\ReadStates[1]{% read file into [\pgfkeys{/state}
\openin\statefile=#1% open file for reading
\loop\unless\ifeof\statefile% loop until end of file
\read\statefile to \stateline% read line from file
\ifx\stateline\apar% test for \par
\else%
\ifx\stateline\empty\relax% skip over empty lines/comments
\else\expandafter\AddState\expandafter{\stateline}%
\fi%
\fi%
\repeat% end of file reading loop
\closein\statefile% close input file
}
\ReadStates{states.csv}% read the file
% END Read US States Definitions
\begin{document}
Hello:
\printstate{TX}
\\
\\ How to print The capital of Texas is "Austin" and
\\ total population is "27862596"
\\ Using "properties" of the key AZ?
\\ Prefer to use pgfkeys with out using packages to split the content of the value of the key
\end{document}