Ticket #663 (closed Defect: fixed)

Opened 6 years ago

Last modified 6 years ago

new api call needed: enable get_topic_related_assocs_by_topic_id()

Reported by: Malte Owned by:
Priority: Major Milestone:
Component: DeepaMehta Standard Distribution Version: 4.3
Keywords: Cc: jri
Complexity: 3 Area: Application Framework / API
Module:

Description

I have a topic at hand which is associated to an association.

I could not find an API_call allowing me to fetch all related assocs (there may be many). I am just searching for assocs related (via one specific assoc_type) to my topic and I have the topic_id at hand.

Would be great to have access to such since this way, the Wikidata Plugin could provide groundbreaking new page-renderings / paths of navigation.

Thanks for your support.

Change History

comment:1 Changed 6 years ago by Malte

  • Summary changed from new api needed: enable get_topic_related_assocs_by_topic_id() to new api call needed: enable get_topic_related_assocs_by_topic_id()

Changed title of this issue from "new api needed:.. " to "new api call needed: .." -

comment:2 Changed 6 years ago by jri

When you have a Topic at hand you can do this:

Topic topic = ...
RelatedAssociation? assoc = topic.getRelatedAssociation(...);
List<RelatedAssociation?> assocs = topic.getRelatedAssociations(...);

When you know there is at most 1 assoc use the first method (it throws when many are found = DB inconsistency). Otherwise use the 2nd method. See the declarations in the Topic interface.

This should be what you're looking for.

I guess you didn't found these methods as they are specified only in the Topic interface, and not in the generic DeepaMehtaObject interface as they should. (The DM API is not yet orthogonal at this point, see the TODO comments in Topic and Association interfaces).

Last edited 6 years ago by jri (previous) (diff)

comment:3 Changed 6 years ago by Malte

Exactly, thanks. That should work!
(To my shame I have to admit, I did just have a look into the restclient.js)

comment:4 Changed 6 years ago by jri

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