Open APIs

Expand all | Collapse all

TMF 630 - Design principle around filtering

  • 1.  TMF 630 - Design principle around filtering

    TM Forum Member
    Posted 15 days ago
    I was referring to the latest addition related to TMF630 (v4.0.1) for design to follow around filtering.
    The design documents says -- Complex attribute value type may be filtered using a "." notation.

    For a specific use case around TMF639 (Resource Inventory Management), I am looking at options and better approach on how to filter resources based on certain resource characteristics. Lets say, the resource characteristics are in multiple, and among them based on 2 or 3 name value pairs, I need to retrieve the matching ones. In such scenarios, how can I implement the above suggested filtering logic.

    Thanks in advance.

    Chaithanya Krishna Kakimani
    Tata Consultancy Services

  • 2.  RE: TMF 630 - Design principle around filtering

    TM Forum Member
    Posted 9 days ago
    Referring you to @Florin Tene, who wrote the JSON Path section in TMF630, maybe he will be able to advise on how to express the query.
    Of course it's not enough to express the semantics, it's also important to implement in the backend in an efficient way.​
    Hope it helps

    Jonathan Goldberg
    Amdocs Management Limited
    Any opinions and statements made by me on this forum are purely personal, and do not necessarily reflect the position of the TM Forum or my employer.

  • 3.  RE: TMF 630 - Design principle around filtering

    TM Forum Member
    Posted 8 days ago

      Indeed the .(dot) notation mentioned in Part1 has some limitations. But like @Jonathan Goldberg​​​ mentioned there is also the JSON Path described in Part 6 which provides more capabilities through the JSON Path mechanisms.
      However, "characteristics" constructs can become quite complex especially if we have multiple parent arrays and you want to mix & match multiple conditions.
      The best way to look at this one is if you can provide a sample payload derived from your scenario where you want to do the filtering.
      In certain cases if you want to apply the filtering between two unions of arrays, using JSONPath alone is not enough, you will need to make use of the normalized path expression and apply another filtering on that inside your uS or making use of multiple "filter" constructs and apply the logical AND - however is going to be very important the order of the filtering criteria.
       An example where the multiple filters could be like this:

    $.result[*].characteristic[?(  ('characteristic1' && @.value=="value1") || ('characteristic2' && @.value=='value2') )]
       The above will return a mix & match between the elements where those characteristics are present. The above results looking at them from the normalized path expressions could be something like this:


       Then, by applying the logic in the uS the only result with both condition is $['result'][0] so that will be the result you're after.

       Another solution could be like mentioned above is to make use multiple times of the "filter" selector (taking into account that sometimes the order of them might matter):
    filter = $.result[*].characteristic[?('characteristic1' && @.value=="value1")] & filter = $.result[*].characteristic[?('characteristic2' && @.value=="value2")]
       However, this logical and (&) between multiple "filter" selectors is not currently covered by Part 6 but in theory it should work.

    Thank you,

    Florin Tene
    Vodafone Group

  • 4.  RE: TMF 630 - Design principle around filtering

    TM Forum Member
    Posted 5 days ago
    Thanks @Florin Tene, @Jonathan Goldberg  a lot.
    I will try ​​the suggestions made here.

    Chaithanya Krishna Kakimani
    Tata Consultancy ServicesIndia