Ticket #550 (closed Feature Request: fixed)

Opened 7 years ago

Last modified 7 years ago

Question: How to use "Geo Coordinates", with Geo Objects and Site Facets populate a "Geo Objects" facet (in a "Kiezatlas Website")?

Reported by: Malte Owned by: jri
Priority: Blocker Milestone:
Component: DeepaMehta Standard Distribution Version: 4.1.2
Keywords: Cc:
Complexity: 3 Area: GUI / Usability
Module: deepamehta-facets

Description

I don't really get how "Geo Coordinates" and "Geo Objects" relate (Question1) and just have assumptions on how "Facets", "Geo Objects" and "Kiezatlas Website" are supposed to work together. At least I couldn't get a better understanding through just reading the existing (and distributed pieces of) code.

I have the geo-coordinates at hand and created a "Geo Coordinate"-Object, but that's not sufficient for being displayed in a "Kiezatlas Website", or? At least I did not succeed. I guess I need "Geo Objects" but how can I create them when just having the coordinates? I probably could understand this but "Geo Coordinates" are not part of a "Geo Object".

My goal is the following:

  1. Create a topic which is visible in a "Kiezatlas Website" (resp. it's conntected Geomap), while (a) that visible topic shall aggregate a (composite) "Tweet" object (via a "Facet" I guess) and (b) that visible topic is displayed at existing "Geo Coordinates" (those coming with a "Tweet").

I want to understand this more before doing further trial and error since I have the feeling that some fundamental understanding (at my side) is missing to realize this now.

The second question, which then (might still) arise, is, regarding the use of a "Tweet" as a "Facet".

  1. I have introduced "Tweet" (a composite type in itself) to a "Kiezatlas Site" via a "Tweet Facet". Shall I now just add a Tweet to a Geo Object (or Geo Coordinate) via the facetService.updateFacets()-Method, like I tried in the following:
facetService.updateFacet(geoCoordinate, TWEET_FACET_TYPE_URI, new TopicModel(tweet.getModel()), null, null);

Should this then also work?

Thank you for your support.

Attachments

twitter-1.png (163.2 KB) - added by jri 7 years ago.
twitter-model.png (71.9 KB) - added by jri 7 years ago.
twitter-2.png (157.6 KB) - added by jri 7 years ago.

Change History

comment:1 Changed 7 years ago by jri

Geo Object is composed of Name and Address.

The Geo Coordinate Facet is added to an Address (by Google geocoder). This is done by the Geomaps plugin in postCreateTopic() and postUpdateTopic() each time an Address is created or updated.

So, this is possibly where you hang: between a Geo Object and the Geo Coordinate is always an Address. And if I understand your scenario you don't have an Address but plain geo coordinates.

You don't have Addresses, right?

If so, no problem. If I understand your scenario right you are not interested in Kiezatlas' multi-facet / multi-site aspect. You must not rely on Geo Objects at all then.

You can place any type of topic on a geomap as long it has a Geo Coordinate topic as a (direct or indirect) child. Even Geo Coordinate must not be part of your topic's type definition. An instance-level association is sufficient. Either Composition or Aggregation, with Geo Coordinate being the dm4.core.child.

So, create a Tweet or something, associate a Geo Coordinate to it and add *the Geo Coordinate* to a Geomap (by addTopicToGeomap()). THat's all. This is important: you always add the *Geo Coordinate* topic to the Geomap, not the domain topic like Tweet.

Hope this helps.
I'm available for more questions.

comment:2 Changed 7 years ago by jri

Kiezatlas is 90% Geomaps.
The remaining 10% is the multi-facet / multi-site aspect functionality by the means of Geo Object and Kiezatlas Website. These 2 types are defined by Kiezatlas plugin. You don't need them.
You need Geo Coordinate, which is defined in Geomaps plugin.

Just to make the borders more clear.

comment:3 Changed 7 years ago by jri

You build on DM 4.1.2 right?
Without Address topics in your model what is not working in 4.1.2 is interactive authoring a geomap, that is add topics to it via search, editing topics (in the page panel) and let them relocate on address change. And the "Show All" listing will appear but clicking the topics will have no effect. in 4.1.2 all this is based on Address topics, which you don't have I think.

In DM 4.1.3 Geomaps is more flexible. The features mentioned above (except relocate on address change) work also if no Address topics are involved.

But if I understand your scenario right DM 4.1.2 should be fine as well, because you're not focusing on the interactive features but rather on programmatic creation of the geomap content, right?

comment:4 Changed 7 years ago by Malte

Overall that's good news, this will make the applications set up much simpler. I plan to use just the Geomaps module now and yes, I have no addresses and I am not directly interested in the multi-site aspect of dm4-kiezatlas.

Your statement is just a bit confusing for me; what I don't quite get, is:

You can place any type of topic on a geomap as long it has a Geo Coordinate topic as a (direct or indirect) child. Even Geo Coordinate must not be part of your topic's type definition. An instance-level association is sufficient. Either Composition or Aggregation, with Geo Coordinate being the dm4.core.child.

Means: I can place/add that "Tweet"-Topic on a "Geomap" and as long it has an (instance level) e..g composition to any "Geo Coordinates" Topic, the Tweets label is going to be displayed on that map (on that coordinate)?

But here you say something different (freely interpreted): I shall not add a "Tweet" to a "Geomap" directly but just the "Tweets" associated (child) "Geo Coordinate" topic ..

So, create a Tweet or something, associate a Geo Coordinate to it and add *the Geo Coordinate* to a Geomap (by addTopicToGeomap()). THat's all. This is important: you always add the *Geo Coordinate* topic to the Geomap, not the domain topic like Tweet.

.. and then the (parent) "Tweet" topic get's automatically displayed in that "Geomap"?

I just ask because that doesn't make much sense to me, a "Tweet" to be displayed in a "Geomap" while that "Tweet" was not added to be part of that map.

At one side I still think that I need to add the "Tweet"-Topic (with it's "Geo Cordinate" child) to the map somehow and of everything else (to find the coordinates) a renderer will take care, but on the other side you say (If I get your right): "Just add the Geo Coordinate-Topic into addTopicToGeomap()") to the "Geomap" and then the "Tweet" will appear?

The latter would leave the following question open for me:

  • How does a renderer of a "Geo Coordinate" knows which parent (Topic/s) should be displayed in this particular map?

Overall, I am glad to hear about how the functionality of Geomaps is thought out. I will go for the approach using only the geomaps-plugin for the twitter city-map. With this info now I am even able to extend the Twitter Research Plugin in a way that "Tweets" (which have coordinates), when revealed in a "Geomap", show up on the location they were sent from.

As an info for my scenario: In the end I plan to use a custom map-renderer to render "Tweets" at "Geo Coordinates" and right now I think I am able to do this just through requesting one specific "Geomap" (containing "Tweets" and their "Coordinates").

Thank you very much for the explanation and your instant response.
Nice greetings.

comment:5 Changed 7 years ago by jri

I understand your confusion.

A Geomap just contains Geo Coordinate topics. When I click a Geo Coordinate topic the page panel shows a *different* topic, the so called domain topic, e.g. a Tweet, which has the clicked Geo Coordinate topic as a (direct or indirect) child. That is, when I click a Geo Coordinate topic the Geomaps Renderer looks up the corresponding domain topic, by traversing upwards the parent-child hierarchy (guided by the "dm4.core.child" and "dm4.core.parent" role types) until no further parent is available. The topic where the traversal stops is regarded the corresponding domain topic. That topic is then shown in the page panel.

So geomaps are different from normal topicmaps, where the topic contained in the map is the *same* topic as displayed in the page panel.

Means: I can place/add that "Tweet"-Topic on a "Geomap" and as long it has an (instance level) e..g composition to any "Geo Coordinates" Topic, the Tweets label is going to be displayed on that map (on that coordinate)?

Now you might understand better what I meant. Physically you add the Geo Coordinate topic to the geomap (by addTopicToGeomap()). When it is clicked the Tweet topic appears in the page panel. So it *appears* as if the Tweet would be contained in the geomap, but in fact only the Geo Coordinate topic is.

Note: the Geo Coordinate topics displayed in a geomap show *no* (Tweet) label. They would not know what label to show. Just pink dots.

So, what do you have to do is creating a Tweet topic, assigning a Geo Coordinate topic to it, e.g. by Composition, important are the "dm4.core.child" and "dm4.core.parent" roletypes, with the Geo Coordinate topic being the child, and add the Geo Coordinate topic to the geomap.

Now you should be able to answer all your questions. Do you?

The current approach is there for performance reasons. A geomap can be displayed *without* fetching all contained domain topics, including all their child topics (to get hold of their Geo Coordinate).

I (and I'm not the only one ;-) know this approach has drawbacks (see #524, #525) and is about to be revised in the (near?) future.

comment:6 follow-up: ↓ 8 Changed 7 years ago by jri

With this info now I am even able to extend the Twitter Research Plugin in a way that "Tweets" (which have coordinates), when revealed in a "Geomap", show up on the location they were sent from.

Yes this would be easy. Just add a Geo Coordinate topic to the Tweet. The Geomaps Renderer takes care of placing a Tweet geographically when revealed by the user (though search) while a geomap is open.

Note: this will work only with DM 4.1.3 SNAPSHOT as DM 4.1.2's Geomap Renderer still relies on Address topics (which you don't have).

comment:7 follow-up: ↓ 11 Changed 7 years ago by Malte

I upgraded my two plugins to DM 4.1.3-SNAPSHOT to give it a try. Here are my findings from this:

As you say:

The topic where the traversal stops is regarded the corresponding domain topic. That topic is then shown in the page panel.

In the corresponding model I work with a "Tweet" is an aggregate of the "Twitter Search" it was found with.

So the limitation of rendering "Geo Cordinates" seems bi-directional/twofold for me now.

(A) A "Geo Coordinate" rendered in a "Geomap" just traverses over its parents until the top-level topic is reached (which in my case let's the "Twitter Search"-Topic appear rendered in Page Panel instead of the coordinates direct "Tweet" parent) and

(B) a "Twitter Search"-Topic is just rendered with *one* "Geo Coordinate" while it (indirectly) has (and represents) n-such topics to display.

When I delete the "Twitter Search"-Topic a "Tweet" was found with, rendering of such "Tweets" in a "Geomap" is OK, it remains just a bit cumbersome for users that, to actually render a "Tweet" based on its "Geo Coordinates" it is not (yet) sufficient to search and reveal that "Tweet" item (when in a "Geomap"), but its child "Geo Coordinate" explicitly.

For now, I think, I have to search for a workaround. But relying solely on "Tweets" in "Topicmaps" for my interface seems not sufficient since then the "Geo Coordinates" (because they are related on instance-level) would not be delivered to my client as part of the Topicmap request.

At the moment I just see a solution with deleting that (uppermost) "Twitter Search"-Topic but with that I would loose the semantics of such item (e..g re-trigger the search-request for the once given query as a Search "Refresh") too. I will think a bit more about a solution and maybe get back to this later tonight (or more probably by tomorrow).

Thanks for your support.

comment:8 in reply to: ↑ 6 Changed 7 years ago by Malte

Replying to jri:

With this info now I am even able to extend the Twitter Research Plugin in a way that "Tweets" (which have coordinates), when revealed in a "Geomap", show up on the location they were sent from.

Yes this would be easy. Just add a Geo Coordinate topic to the Tweet. The Geomaps Renderer takes care of placing a Tweet geographically when revealed by the user (though search) while a geomap is open.

Note: this will work only with DM 4.1.3 SNAPSHOT as DM 4.1.2's Geomap Renderer still relies on Address topics (which you don't have).

I am running on the latest SNAPSHOT and as described this feature seems to be broken. I will double check it right now. I will try to reveal a "Geo Coordinate" in a "Geomap" trough clicking a "Tweet" (which has a "Geo Coordinate" associated as a child).

comment:9 Changed 7 years ago by Malte

I will double check it right now. I will try to reveal a "Geo Coordinate" in a "Geomap" trough clicking a "Tweet" (which has a "Geo Coordinate" associated as a child).

Confirmed. In the latest SNAPSHOT an item on a "Geomap" just appears when I reveal the "Geo Coordinate"-Topic itself (found in the "What's related"-Area of the Page Panel) and not when a "Tweet" is revealed in the Page Panel.

Probably this is related to a "Tweet" not being the "uppermost topic" (but its "Twitter Search" is?)

comment:10 Changed 7 years ago by Malte

So, I think I will go with the following solution for now:

Make a "Geo Coordinate" part of the model of a "Tweet" via an "Aggregation Definition" and use a plain "Topicmap" as a container for my twitter-citymap.

comment:11 in reply to: ↑ 7 Changed 7 years ago by jri

Replying to Malte:

In the corresponding model I work with a "Tweet" is an aggregate of the "Twitter Search" it was found with.

Oh, yes, I see your problem: because of the way your Twitter application is modeled, when clicking a Tweet on a Geomap (actually its Geo Coordinate topic), it does not appear in the page panel, but the higher-ranking Twitter Search topic does.

On the short term (for your application presentation on thursday) I see 2 possibilities:

  • Delete the Twitter Search topics. As I understand your (thursday) application the Twitter topics are created programmatically, not by the user, so the Twitter Search might be disposable, right? (Are Twitter Search topics actually created when a Twitter search is invoked programmatically?)
  • Change your Twitter application model, in the way their is no Aggregation (or Composition) from Twitter Search (parent) to Tweet (child). The (thursday) application wants display single Tweets in Page Panel, not Twitter Searches, right?

On the mid term, it is evident that the the Geomaps plugin needs a redesign. In my view conceiving a new concept, which is of general use (and not targeted at your particular Twitter application) is hard work. I would like to do it together. It is good opportunity that we have 2 reference scenarios now: 1) Kiezatlas with their Address based Geo Objects, and 2) your Twitter application where the geo coordinates are known in advance.

Note that with Kiezatlas a Geo Coordinate is bound to an Address, not directly to the Geo Object (attaching a geo coordinate facet to each Address is an integral feature of the Geomaps plugin). A Geo Object might have more than one Address. Clicking a Geo Coordinate topic on the geomap must not display the Address (the direct parent) in the page panel, but the higher-ranking Geo Object. That's one reason why Geomaps is designed the way it is.

So, I hope you'll find a workaround for thursday and that we have the opportunity to conceive the new Geomaps mechanics so it is suitable for your Twitter application as well.

comment:12 Changed 7 years ago by Malte

About your question regarding the "Twitter Research Plugin":

(Are Twitter Search topics actually created when a Twitter search is invoked programmatically?)

Yes, "Twitter Search"-Topics have proper semantics, equivalent to old "Search"-Topics in DeepaMehta (Refresh/Retrigger?, Expand Search/Show? More) and so It would be a disadvantage to dispose them.

Change your Twitter application model, in the way their is no Aggregation (or Composition) from Twitter Search (parent) to Tweet (child). The (thursday) application wants display single Tweets in Page Panel, not Twitter Searches, right?

And this is no option as it would have severe implications for the complete implementation of the "Twitter Research" plugin.

On the mid term, it is evident that the the Geomaps plugin needs a redesign.

  • Kiezatlas with their Address based Geo Objects, and
  • an application where the geo coordinates are known in advance.

Yes, probably.

So, I hope you'll find a workaround for thursday and that we have the opportunity to conceive the new Geomaps mechanics so it is suitable for your Twitter application as well.

Yep, my solution for the "twitter-citymap"-plugin will be as described above and will not make use of "geomaps".

And just so that you get me right (and possibly identify a completely different issue with the current geomaps):

Oh, yes, I see your problem: because of the way your Twitter application is modeled, when clicking a Tweet on a Geomap (actually its Geo Coordinate topic), it does not appear in the page panel, but the higher-ranking Twitter Search topic does.

So, earlier I tried to describe another issue I detected (but which is most probably related to the one you've described here and not of importance for current dm-geomap-users).

At this state I have not yet programmatically added a "Geo Coordinate"-Topic to a "Gemoap", I am just not there yet, and so when I try to reveal one (just to see something if I was on the correct way..) I discovered what is described in comment nr.9 (imagine: no item visible on a geomap yet).

So what comments nr.8 and 9 are about is me trying to make "any item visible" on a "Geomap" (when having the domain topic already in the "Page Panel").

Now when navigating, e.g. via an "Aggregation Definition" of a "Twitter Search" to a "Tweet" (in the Page Panel) does not automatically reveal (the "Geo Coordinate"-Topic of) a "Tweet" (renderered in that Page Panel) (as described in #9) but I have to navigate even deeper to the "Geo Coordinate"-Topic itself and click it until a "Tweet" get's displayed on a "Geomap". Maybe this is a follow-up issue and currently not of any importance for ordinary users of the geomaps-module, just wanted to point out to comment nr.9 again.

For the record, to get the "Twitter Research"-plugin to integrate properly with dm4-geomaps we would have to find solutions for the following issues in the geomaps-module which now arised:

  • an application where the geo coordinates are known in advance (as mentioned above)
  • allows a "Geo Coordinate"-Topic to be related to many "domain topics" (as it is the nature of a coordinate)
  • allows a "Geomap" to render domain topics with many "Geo Coordinate"-Topics (e.g. that of a "Twitter Search"

Thanks for your support + Cheers.

Changed 7 years ago by jri

comment:13 Changed 7 years ago by jri

Replying to Malte:

Confirmed. In the latest SNAPSHOT an item on a "Geomap" just appears when I reveal the "Geo Coordinate"-Topic itself (found in the "What's related"-Area of the Page Panel) and not when a "Tweet" is revealed in the Page Panel.

Probably this is related to a "Tweet" not being the "uppermost topic" (but its "Twitter Search" is?)

Sorry, I can't produce the problem you describe in comments 8 and 9.
I tried it myself, and it works as intended.

I created a model just like yours:

  • A composite type Tweet with Tweet Text and Geo Coordinate as child topics.
  • A composite type Twitter Search with Tweet as child topic.

I've tried this (see the 3 screenshots attached):

  • Create a Tweet instance "My 3rd Tweet" with a Twitter Search as parent, and manually entered Geo Coordinates.
  • Create 2 other Tweet instances (this time without a Twitter Search as parent) with manually entered Geo Coordinates.
  • Create a Geomap and reveal the Tweets. They appear in the Geomap at the proper location.
  • When I click a Tweet -- which has no Twitter Search as parent -- in the geomap, it appears in the Page Panel.
  • When I click a Tweet -- which has a Twitter Search as parent -- in the geomap, the Twitter Search appears in the Page Panel.
  • Inside a Geomap you can create new Tweet topics, enter their coordinates, and they are properly placed.
  • You even can change a Tweets coordinates via Edit and they are properly relocated in the geomap.

Try a pull and clean build all.

Changed 7 years ago by jri

Changed 7 years ago by jri

comment:14 follow-up: ↓ 15 Changed 7 years ago by Malte

Thanks very much for your efforts. But please note that would you did here, is not my current model.

(Updated: please note, not, please not) - fixed typo

I created a model just like yours:

A composite type Tweet with Tweet Text and Geo Coordinate as child topics.

Because as you said earlier, for a Tweet to be located a relation to a "Geo Coordinate" on instance level is sufficient.

An instance-level association is sufficient. Either Composition or Aggregation, with Geo Coordinate being the dm4.core.child.

Nonetheless, I will triple check it. Maybe I have an error somewhere else.

Last edited 7 years ago by Malte (previous) (diff)

comment:15 in reply to: ↑ 14 Changed 7 years ago by jri

Replying to Malte:

But please note that would you did here, is not my current model.

Because as you said earlier, for a Tweet to be located a relation to a "Geo Coordinate" on instance level is sufficient.

  1. 4 hours ago you wrote you will put Geo Coordinate in your Tweet model (I would use Composition Definition BTW):

    So, I think I will go with the following solution for now:
    Make a "Geo Coordinate" part of the model of a "Tweet" via an "Aggregation Definition"

  1. It works with instance-level Geo Coordinates (without being in the model) as well. I just tried it.

Probably its more efficient to continue this ticket on the phone.

comment:16 Changed 7 years ago by jri

Not connected to anything said before:
I would suggest to put the Geo Coordinate in the Tweet model. Handling topics in a model-backed fashion is much more comfortable. What would be the advantage of putting Geo Coordinate not in the model?
Anyway, you can do it this way or that way. Anything works.

comment:17 Changed 7 years ago by Malte

For the record:

The plugin https://github.com/mukil/twitter-citymap is now based on simple topicmaps, but I do not have the envisioned advantage since topicmaps are just returned "flat" via the /topicmap/-rest-interface and I didn't had time to implement my custom topicmapsview-renderer.

--

For the issue of letting geomaps support ("many geo coordinates" of a) in "Twitter Search"-Topics see #562 now.

--

Concerning my initial question, I will document on how to use

facetService.updateFacet(..)

.. in the list of /wiki/Malted/PluginDevelopmentNotes soon.

--

Concerning the issue: Revealing a composite object (which has some sort of geo-coordinate topic as child) in a geomap I could not succeed yet and will try again in a few days.

From my perspective the issues are clearer now and this ticket can be closed.

Thanks for the quick help.

comment:18 Changed 7 years ago by Malte

For results look at http://twitter.kiezatlas.de

comment:19 Changed 7 years ago by jri

  • Status changed from new to closed
  • Resolution set to fixed
Note: See TracTickets for help on using tickets.