(1) proportional or analogical equation, which we'll designate by the traditional :
(2) product, which we'll simply indicate by juxtaposition, e.g., ab is the product of a and b (although I'll also use a*b when using words rather than letters)
(3) grouping, which we'll again indicate by the traditional ( )
Our terms and operations will obey the following rules
(1) aa = a2 = a [idempotency]
(2) a:b = b:a [commutation of equation]
(3) a(bc) = (ab)c [association of product]
Note that : is nonassociative and product is noncommutative. When we get to our inference rules in a second, it will be pretty obvious that, given a premise with ab you can still get a conclusion with ba, but there's an important difference between commutativity being built into the analogical product and its falling out of the inference rules. If commutativity were built into analogical product, it would follow that you could commute wherever you have the product, without regard for anything else; but with inference rules you can never commute a product without changing other parts of the analogical equation.
As inference rules we could use the following:
Given the starting point, (a:b):(c:d) ["a is to b as c is to d"], we can derive the following conclusions directly:
1. (ad):(cb) [cross-multiplication or cm]
2. (a:c):(b:d) [cross-division or cd]
3. (ad:b):(cb:d) [distribution, in this case of bd, but we could do either b or d alone]
4. (a:b), or (c:d) [disassocation]
Distribution is where most of the magic happens. (4) is not, as far as I can see, essential; it simply facilitates use. So let's take one of Aristotle's examples:
The cup is to Dionysus as the shield to Ares.
We'll then translate it as follows:
From this analogy, Aristotle concludes, "The cup may, therefore, be called 'the shield of Dionysus,' and the shield 'the cup of Ares.'" We can easily show this.
 (c:D):(s:A) [given]
 (c:s):(D:A) [cd]
 (cA:s):(DA:A) [dist of A]
 (cA:s) [left disassociation]
 (s:cA) [commutation]
Product doesn't have a strict translation in English, since English varies our phrasing of it depending on the particular sort of analogical relation and pragmatic goal involved. But ab can usually be read as "the a of b" or else "the b version of a", and a single : can usually be treated as a (figurative) 'is'. So (s:cA) straightforwardly says, "The shield is the cup of Ares." We can have a closely analogous argument yield "The cup is the shield of Dionysus." Another of Aristotle's analogies, "As old age is to life, so is evening to day" can receive exactly similar treatment.
We can in addition to known terms allow unknown terms, and represent them as variables. So, to use Aristotle's example,
For instance, to scatter seed is called sowing: but the action of the sun in scattering his rays is nameless. Still this process bears to the sun the same relation as sowing to the seed. Hence the expression of the poet 'sowing the god-created light.'
We can show this. Take the original analogy:
 (sowing:x):(seed:sunlight) [cd]
 (sowing*sunlight:x):(seed*x:sunlight) [dist]
 (sowing*sunlight:x) [disassoc.]
We can commute, of course, if we want to; and this gives us the metaphor. We could get the exact poetical expressions through ordinary syllogisms by taking this expression as a premise and adding other premises.
Aristotle makes another comment on metaphor by analogy. He says:
We may apply an alien term, and then deny of that term one of its proper attributes; as if we were to call the shield, not 'the cup of Ares,' but 'the wineless cup'.
This simply takes the above conclusion, "The shield is the cup of Ares," combines it with another premise, and uses a basic transformation beyond that; it has nothing to do with the analogical inference itself, but is simply something you can do with the conclusion.
Another thing you can do with the conclusions of such inferences is build new figures of speech; depending on the analogical inferences involved, these figures of speech will either be new metaphors, or new metonymies, or new synecdoches, or new ironies (in the strict senses of the first and last of these).
As I said, all of this could be put more rigorously, but this should give the basic idea. Really, it's all quite simple; it requires only
(1) taking the proportional character of analogy seriously,
(2) recognizing that analogical products make sense, and that the multiplication is noncommutative and idempotent,
(3) seeing how this all relates to (certain kinds of) metaphor.
Of these three, I think the second is the hardest; Aristotle, of course, pointed out the third ages ago, and the first predates even him, besides being obvious. When I was in ninth grade I had already worked out the importance of commutativity of equation, from analogical inferences of the sort that you get in tests; it's not a difficult thing to see the potential advantages of treating analogical inferences like equations of ratios, given that this is what they really are. It's multiplication that's tricky, and, despite the fact that I only recognized its features recently, even that isn't so difficult: idempotency is pretty obvious, and someone with a better mathematical education than mine would have seen at once that it makes sense for it to be noncommutative, rather than having to think it through, tiny step by tiny step, as I did.