Yes, it can be done, but it isn’t easy.
This is all of the DeviceNames of the entries:
strings "DeviceName" of dictionaries "Interface" of dictionaries of values of entries of dictionaries "NetworkServices" of dictionaries of files "/Library/Preferences/SystemConfiguration/preferences.plist"
Here is how you get the “en0” dictionary specifically so that any subkeys can be queried:
dictionaries whose("en0" = string "DeviceName" of dictionary "Interface" of it) of values of entries of dictionaries "NetworkServices" of dictionaries of files "/Library/Preferences/SystemConfiguration/preferences.plist"
Here is how you get that same dictionary, but by first getting the name of the primary internet connection dynamically instead of always getting en0:
dictionaries whose((name of primary internet connection) = string "DeviceName" of dictionary "Interface" of it) of values of entries of dictionaries "NetworkServices" of dictionaries of files "/Library/Preferences/SystemConfiguration/preferences.plist"
It is possible to query the Sets dictionary the same way, by using either the current set or by using name of primary internet connection or both.
This will give the value of the CurrentSet:
(following texts of firsts "/Sets/" of it) of strings "CurrentSet" of dictionaries of files "/Library/Preferences/SystemConfiguration/preferences.plist"
This will give you the dictionaries of all sets so the sub elements can be queried:
dictionaries of values of entries of dictionaries "Sets" of dictionaries of files "/Library/Preferences/SystemConfiguration/preferences.plist"
This will give you only the Set dictionary of the CurrentSet:
dictionaries of values of entries whose((unique value of (following texts of firsts "/Sets/" of it) of strings "CurrentSet" of dictionaries of files "/Library/Preferences/SystemConfiguration/preferences.plist")= key of it) of dictionaries "Sets" of dictionaries of files "/Library/Preferences/SystemConfiguration/preferences.plist"
It is important to note that the following is not so much an error message, as it is warning you that the selected object does not have a direct string representation:
E: The operator "string" is not defined.
It is confusing, but that is what you should see when you select a dictionary directly.