[deepamehta-devel] How do I find a Topic's Associations

Jörg Richter jri at deepamehta.de
Mon Jan 4 17:11:00 CET 2016


Hi Juergen,

To get a list of all parent topics that are related to a given child topic (here: ID 1234) via a "Composition" association:

GET /core/topic/1234/related_topics?assoc_type_uri=dm4.core.composition&my_role_type_uri=dm4.core.child&others_role_type_uri=dm4.core.parent

You'll get a "result list" with an "items" array. The array contains the parent topics, or is empty.

While this might already satisfy your need, keep in mind that a DM user is free to create arbitrary associations manually. The mentioned call just navigates at instance-level. No type-definitions are consulted. That is if the Composition association is created manually by a user (along with Parent and Child roles), it does not necessarily mean that it reflects an underlying **Composition Definition** (at type-level), and thus does not necessarily mean your (child) topic is in danger to be deleted by DM automatically.

Actually you want to know if a topic is in danger to be deleted automatically by DM in the course of a update/delete request bound to one of its parents, right? This would mean you must investigate the type definitions too. You must look in the parent topic's type definition if an association definition (of type "Composition Definition") with a child type that matches your given child topic's type exists.

To get the Topic Type definition for a given type URI (here: dm4.notes.note):

GET /core/topictype/dm4.notes.note

Look in the "assoc_defs" array.

Tell me if you need more info.

Cheers,
Jörg


On Jan 4, 2016, at 13:55, Juergen Neumann wrote:

> Dear Jörg,
> 
> I am still working on my Python code for DeepaMehta. Here is my
> problem: I want to excessively reuse existing Topics. Still, if a Topic
> is part of a composite and associated by a composition, I cannot (and
> do not want) to reuse it in another context.
> 
> How can I find out, where a Topic (by its ID) is being used
> (associated) and if it is part of a composition - through the Rest API?
> 
> Thx and greets,
> 
> Juergen  
> 
> -- 
> GnuPG KeyID: CD914C6C
> Fingerprint: C1CC EF1D 1443 7279 72E7 ABDC A2DA 0328 CD91 4C6C
> 
> -- 
> devel mailing list
> devel at lists.deepamehta.de
> http://lists.deepamehta.de/mailman/listinfo/devel-lists.deepamehta.de



More information about the devel mailing list