Confusing use of の


I'm trying to read a children's book and had some trouble with one sentence.
As I understand the story so far, it's about a depressed snail. But I don't
quite understand what's going on here.

> でんでんむしは おともだち **の** でんでんむし **の** ところに やってきました。

I feel like this should say something like "the snail went to live with his
friend" but the order of "friend" and "snail" in おともだちのでんでんむし is backwards if
that is the case. (It's also possible that I'm way off. This is a children's
book so it has no kanji, and I've already mixed up homonyms once.)

What am I missing here with の? Is my translation even close?




> 「でんでんむしは おともだち **の** でんでんむし **の** ところに やってきました。」

The first の is **appositive** and the second の is **possessive**.

「おともだち **の** でんでんむし」 means "(his) snail friend" = "his friend who is also a
snail".

In meaning, 「おともだち **の** でんでんむし」＝「でんでんむし **の** おともだち」. Why so? Because the 「の」
is **appositive**. The おともだち is a でんでんむし.

In an **appositive** 「AのB」, A = B and B = A.

_**" The snail came to his/her snail friend's place/home."**_

If there were no context at all, 「おともだち **の** でんでんむし」 can also mean "(my)
friend's (pet) snail" and 「でんでんむし **の** おともだち」 can mean "a snail's friend". In
these cases, the 「の」 will be **possessive**.

In a **possessive** 「AのB」, A and B _never_ refer to the same object.

Japanese is a most contextual language, the exact same phrase can mean
completely different things depending on the context it appears in. Therefore,
we keep asking questioners to provide more context.




> 「でんでんむしは おともだち **の** でんでんむし **の** ところに やってきました。」

The first の is **appositive** and the second の is **possessive**.

「おともだち **の** でんでんむし」 means "(his) snail friend" = "his friend who is also a
snail".

In meaning, 「おともだち **の** でんでんむし」＝「でんでんむし **の** おともだち」. Why so? Because the 「の」
is **appositive**. The おともだち is a でんでんむし.

In an **appositive** 「AのB」, A = B and B = A.

_**" The snail came to his/her snail friend's place/home."**_

If there were no context at all, 「おともだち **の** でんでんむし」 can also mean "(my)
friend's (pet) snail" and 「でんでんむし **の** おともだち」 can mean "a snail's friend". In
these cases, the 「の」 will be **possessive**.

In a **possessive** 「AのB」, A and B _never_ refer to the same object.

Japanese is a most contextual language, the exact same phrase can mean
completely different things depending on the context it appears in. Therefore,
we keep asking questioners to provide more context.

