Ticket #707 (closed Enhancement: fixed)

Opened 10 years ago

Last modified 10 years ago

Core API: Traversal methods are not orthogonal

Reported by: jri Owned by: jri
Priority: Major Milestone: Release 4.4
Component: DeepaMehta Standard Distribution Version: 4.3
Keywords: Cc: dgf, Malte, carolina
Complexity: 3 Area: Application Framework / API
Module: deepamehta-core

Description

  1. Association's getRelatedAssociation() method has no othersAssocTypeUri argument (like the corresponding Topic method has).
  2. Association has no getRelatedAssociations() method (like Topic has).
  3. Topic's getRelatedAssociations() method is not RESTful.

Subject of this ticket:

  • Moving 2 method from Topic interface upwards to DeepaMehtaObject:
    getRelatedAssociation()
    getRelatedAssociations()
    
  • Make getRelatedAssociations() RESTful (for both topics and associations)

Change History

comment:1 Changed 10 years ago by jri

  • Status changed from new to accepted

comment:2 follow-up: ↓ 3 Changed 10 years ago by Jörg Richter

Webservice: getRelatedAssociations() (#707).

The Topic's getRelatedAssociations() method is RESTful:

GET /core/topic/{id}/related_assocs

Result is an array of associations (may be empty).

To filter the result set the usual 4 traversal query parameters can be applied (all optional):

assoc_type_uri
my_role_type_uri
others_role_type_uri
others_topic_type_uri

Note: the include_childs query parameter is not yet supported.

See #707.

comment:3 in reply to: ↑ 2 Changed 10 years ago by jri

Replying to Jörg Richter:

To filter the result set the usual 4 traversal query parameters can be applied (all optional):

...
others_topic_type_uri

CORRECTION: of course this has to be others_assoc_type_uri in this case

comment:4 Changed 10 years ago by Jörg Richter

Core: include_childs for association lists (#699).

All REST APIs: the Core's JerseyResponseFilter processes the fetch_composite query parameter also for Iterable<Association> responses.

In particular this works for the GET /core/topic/{id}/related_assocs request (see #672, see #707).

See #699.

comment:5 Changed 10 years ago by Jörg Richter

Core API: orthogonal traversal methods (#707).

DeepaMehtaObject base interface has 2 new methods:

RelatedAssociation getRelatedAssociation(String assocTypeUri,
                                         String myRoleTypeUri,
                                         String othersRoleTypeUri,
                                         String othersAssocTypeUri)

ResultList<RelatedAssociation> getRelatedAssociations(String assocTypeUri,
                                                      String myRoleTypeUri,
                                                      String othersRoleTypeUri,
                                                      String othersAssocTypeUri)

Corresponding/similar methods are removed from the Topic and Association sub interfaces (see BREAKING CHANGES).
This make the tranversal API more orthogonal. In particular the 2nd method can now be called on Association objects as well.

ResultList has a new method:

void add(T item)

BREAKING CHANGES

  • Association's getRelatedAssociation() method has a 4th parameter: othersAssocTypeUri (analog to Topic's getRelatedAssociation() method)
  • Topic's getRelatedAssociations() method returns a ResultList instead a List (analog to the getRelatedTopics() counterpart).

Core Service API:

  • getAssociations(String assocTypeUri) returns a ResultList instead a List (analog to the getTopics() counterpart).

Core REST API:

  • The GET /core/topic/{id}/related_assocs request (introduced 5 days ago) returns a ResultList instead a List (analog to the /related_topics counterpart), that is
    {
        "items": [
            ...
        ],
        "total_count": ...
    }
    

instead the plain array.

See #707.

comment:6 Changed 10 years ago by Jörg Richter

Webservice: getAssocRelatedAssociations() (#707).

The Association's getRelatedAssociations() method is RESTful:

GET /core/association/{id}/related_assocs

Result is a 2-property object:

{
    "items": [      # array of associations (may be empty).
        ...
    ],
    "total_count": ...
}

To filter the result the usual 4 traversal query parameters can be
applied (all optional):

assoc_type_uri
my_role_type_uri
others_role_type_uri
others_assoc_type_uri

The include_childs query parameter is supported as well.

The Core's traversal API including its REST API is now fully orthogonal.

See #707.

comment:7 Changed 10 years ago by Jörg Richter

Webservice: getRelatedAssociations() (#707).

The Topic's getRelatedAssociations() method is RESTful:

GET /core/topic/{id}/related_assocs

Result is an array of associations (may be empty).

To filter the result set the usual 4 traversal query parameters can be applied (all optional):

assoc_type_uri
my_role_type_uri
others_role_type_uri
others_topic_type_uri

Note: the include_childs query parameter is not yet supported.

See #707.

comment:8 Changed 10 years ago by Jörg Richter

Core: include_childs for association lists (#699).

All REST APIs: the Core's JerseyResponseFilter processes the fetch_composite query parameter also for Iterable<Association> responses.

In particular this works for the GET /core/topic/{id}/related_assocs request (see #672, see #707).

See #699.

comment:9 Changed 10 years ago by Jörg Richter

Core API: orthogonal traversal methods (#707).

DeepaMehtaObject base interface has 2 new methods:

RelatedAssociation getRelatedAssociation(String assocTypeUri,
                                         String myRoleTypeUri,
                                         String othersRoleTypeUri,
                                         String othersAssocTypeUri)

ResultList<RelatedAssociation> getRelatedAssociations(String assocTypeUri,
                                                      String myRoleTypeUri,
                                                      String othersRoleTypeUri,
                                                      String othersAssocTypeUri)

Corresponding/similar methods are removed from the Topic and Association sub interfaces (see BREAKING CHANGES).
This make the tranversal API more orthogonal. In particular the 2nd method can now be called on Association objects as well.

ResultList has a new method:

void add(T item)

BREAKING CHANGES

  • Association's getRelatedAssociation() method has a 4th parameter: othersAssocTypeUri (analog to Topic's getRelatedAssociation() method)
  • Topic's getRelatedAssociations() method returns a ResultList instead a List (analog to the getRelatedTopics() counterpart).

Core Service API:

  • getAssociations(String assocTypeUri) returns a ResultList instead a List (analog to the getTopics() counterpart).

Core REST API:

  • The GET /core/topic/{id}/related_assocs request (introduced 5 days ago) returns a ResultList instead a List (analog to the /related_topics counterpart), that is
    {
        "items": [
            ...
        ],
        "total_count": ...
    }
    

instead the plain array.

See #707.

comment:10 Changed 10 years ago by Jörg Richter

Webservice: getAssocRelatedAssociations() (#707).

The Association's getRelatedAssociations() method is RESTful:

GET /core/association/{id}/related_assocs

Result is a 2-property object:

{
    "items": [      # array of associations (may be empty).
        ...
    ],
    "total_count": ...
}

To filter the result the usual 4 traversal query parameters can be
applied (all optional):

assoc_type_uri
my_role_type_uri
others_role_type_uri
others_assoc_type_uri

The include_childs query parameter is supported as well.

The Core's traversal API including its REST API is now fully orthogonal.

See #707.

comment:11 Changed 10 years ago by jri

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