This answer may seem long, but to understand openings one has to understand some important positional concepts first.
Space in chess can be loosely described as the number of squares controlled by friendly pieces. Having more space is often a good thing for two reasons.
Firstly, it gives you a freer position and you will have more options than your opponent based on the fact that you have more space on the board to work with. Secondly, if you have more space it means that your opponent will have less space, which will make their position cramped and difficult to play since many of the opponent's pieces will need to occupy the same squares.
Piece activity in chess can be summed up in the following question:
What good are the resources you don't utilize?
An active piece is one that influences the board in a significant way, such as a centralized knight or a rook on the seventh rank. Active pieces are mobile, and can often perform many important aggressive and defensive tasks by themselves. They are often a great nuisance to the opponent, whose pieces are threatened and restricted by active pieces.
Piece coordination is used to describe how well your pieces work together. For instance, two rooks on an open file are considered very powerful because they typically coordinate very well with each other; together they possess double the power of a single rook while at the same time they can defend each other from attack. Pieces who coordinate well are in general stronger than their sum parts, while pieces who coordinate badly are the exact opposite. Piece coordination is an important positional factor which will make or break your position.
This one almost goes without saying; a safe king is less likely to get mated while an unsafe king is more likely to get mated. As simple as this concept is, it very important to pay attention to; many players have fallen for the trap of leaving their king slightly too unsafe at one moment, and have gotten destroyed as a result.
The material count is the most simple and intuitive positional factor in chess, and it is easy to assess at any given moment of the game. Since it is so simple to use, many players tend to overestimate its importance, myself included. The thing to remember about the material count is that it is actually "just" a positional factor among others, and thus it can be trumped by other positional factors. While important (especially in the endgame, when few pieces are left, the one with the advantage in material count tends to have a great advantage), it is not necessarily the most important one; for instance, if you get checkmated due to poor king safety it doesn't really matter much that you have an extra queen compared to your opponent.
Beginners are often advised to follow the basic opening principles, since they are quite simple and will help them coordinate their pieces reasonably well and fight for space, while also getting the king to relative safety early on. The long-term goal of this strategy is simply to get a playable position out of the opening, and for beginners this is a perfectly acceptable outcome of the opening.
Past the beginner stage, chessplayers will often start playing some theoretical opening lines to get an edge over their opponent.
Different opening lines are designed to try and get an edge by emphasizing different positional concepts; for instance many gambits tend to ignore material count to some degree in favour of piece activity and coordination (and often also reduced safety for the opponent's king), while other openings may place emphasis on getting a space advantage and letting the opponent suffer in a cramped position for the long haul.
To answer your question: I'd say that in order to connect your opening to a long-term goal, you first need to understand which positional concepts your opening is designed to emphasize. This can be easy or difficult depending on the opening you look at. As a novice player you could try to study your opening in terms of how well it adheres to the basic opening principles you know. The principles are sound and shouldn't be broken willy-nilly, so if they are broken there will be a good reason for it (if the opening line is sound, that is). This concrete reason will often have to do with one or more of the above-mentioned positional concepts in this post, but sometimes it is of a more concrete nature.