[deepamehta-users] Abstract topics?

Jörg Richter jri at deepamehta.de
Mon Mar 16 20:18:03 CET 2015

Hi Constantin,

the naive approach would be to have 2 question types like "Inductive Question" and "Deductive Question". This would require you to have the parent type ("Introduction") twice as well. At least the simple types (the "leaves" of the type hierarchy) could be shared between both parent types. Not very satisfying I guess. The advantage would be that this doesn't require any programming. You could create/retrieve composite Introduction topics immediately and edit them conveniently via the Webclient's detail panel.

Yes, DM's type system doesn't support inheritance and thus no abstract base types. Instead it features kind of a "mix-in" approach in terms of the Facet API (see the FacetsService as provided by the dm4-facets standard module). A facet is a typed value (simple or composite) that can be attached to a topic. A topic can be attached with an arbitrary number of facets. The Facets API supports you with getting/updating facet values.

So, in your case you could have a single type "Question" whose instances are than attached either with an "Inductive" or a "Deductive" facet value.

The type definition for the facet value is a normal DM type definition (simple or composite). To make a facet definition from it you need to define a parent type for it -- the so called "Facet Type". The Facet Type must be composite and have exactly one child type. By convention the Facet Type is named like the child type but with a "Facet" suffix (same applies for the type URIs). The purpose of the Facet Type is to carry the association definition (in terms of Aggregation vs. Composition, and Cardinality information) to be effective when attaching/accessing the actual facet values to/of a topic (instance).

The Facet API also provides a "addFacetTypeToTopic()" call by which you can make it explicit that a topic is "blessed" with certain Facet types, that is a carrier of respective facet values. In the Webclient when clicking a Question topic you would see then that is of type "Question" and has Facet type "Inductive" for example. However attaching Facet types explicitly to topics is optional. The Facet types are not enforced (at the moment). In fact you can attach arbitrary facet values to a topic.

However, at the moment the DM Webclient provides no out-of-the-box support for displaying and editing facet values in the detail panel. This would require some programming. Use the Webclient's "pre_render_page" and "pre_render_form" events to extend the detail panel rendering and the server-side PostUpdateTopicListener and PreSendTopicListener to facilitate processing of form input and enriching topics with facet values when sent to the client. See the external DM4 Kiezatlas module for a thorough example (https://github.com/jri/dm4-kiezatlas).

Let me know if you need any support.


On Mar 14, 2015, at 13:43, Constantin Jucovschi wrote:

> Hello everybody,
> I don't know how I can model the following in DeepaMehta:
> I have a topic called introduction that should have a field question. The question should either be one that I answer inductively or deductively. Both types of question have a common text field "question" but have different types of children.   For example in inductive reasoning I have a list of independent arguments. In deductive reasoning I have a sequence of interdependent arguments.
> I would normally resolve this problem with an abstract type question that can be instantiated as inductive or deductive. I don't know how to model this in DeepaMehta.
> Best regards,
> Constantin
> -- 
> users mailing list
> users at lists.deepamehta.de
> http://lists.deepamehta.de/mailman/listinfo/users-lists.deepamehta.de

More information about the users mailing list