Open APIs

 View Only
  • 1.  TMF Filter for an attribut that is an array of objects e.g TMF 639 resourceCharacteristic

    TM Forum Member
    Posted Jul 05, 2022 04:56
    Edited by Renata Vakharia Jul 05, 2022 08:25
    What is the best way in TMF to filter for an attribute that is a list of objects?
    We have the requirement to provide a filter that allows the customer to filter by properties of objects in an array.
    In this case, TMF 639 must be filtered according to the name and the value of resourceCharacteristic.

    What is the best way to archive this purpose with jsonpath for example?

    Is the following example a TMF conform filter for searching collections?
    GET /resource?resourceCharacteristic=[{"name":"<characteristic1 name>","value":"<characteristic1  value>"} ,{"name":"characteristic2 name","value":"<characteristic2 value>"}]

    see also https://higherlogicdownload.s3-external-1.amazonaws.com/TMFORUM/d2c768e1-b073-4859-9e96-50e00658c8d0_file.pdf?AWSAccessKeyId=AKIAVRDO7IEREB57R7MT&Expires=1657025394&Signature=HiBHlE3Cmhg3cnnjAZhxfziYQyM%3D
    ------------------------------
    Eric Gomdjim
    Deutsche Telekom AG
    ------------------------------


  • 2.  RE: TMF Filter for an attribut that is an array of objects e.g TMF 639 resourceCharacteristic

    Posted Jul 06, 2022 01:41
    Hi,

    I think TMF has nothing to do with jsonpath.But you can figure out right expression using evaluators on TMF 639 json structure.

    Probably using https://jsonpath.com/

    Example expression for you would be like below

    $.resourceCharacteristic[?(@.name=="premiumValue")]

    JSON Data:
    {
    "id": "444",
    "href": "http://server:port/resourceInventoryManagement/logicalResource/444",
    "description": "This is a MSISDN resource with the category Premium and with an unlocked administrativeState.",
    "category": "Premium",
    "value": "0170123456",
    "administrativeState": "unlocked",
    "operationalState": "disable",
    "usageState": "idle",
    "resourceStatus": "available",
    "resourceSpecification": {
    "id": "4",
    "href": " http://server:port/resourceCatalogManagement/resourceSpecification/4",
    "@referredType": "LogicalResourceSpecification"
    },
    "resourceCharacteristic": [
    {
    "name": "premiumValue",
    "valueType": "string",
    "value": "gold"
    },
    {
    "name": "nonPremiumValue",
    "valueType": "string",
    "value": "silver"
    }
    ],
    "relatedParty": [
    {
    "href": "https://server:port/tmf-api/partyManagement/v4/individual/456",
    "id": "456",
    "name": "John Doe",
    "role": "user",
    "@referredType": "Individual"
    }
    ],
    "@type": "MSISDN",
    "@schemaLocation": "http://server:port/MSISDN.schema.json",
    "@baseType": "Resource"
    }

    Hope this helps.


    ------------------------------
    Hanumantha Marikanti
    Saralam Technologies
    ------------------------------



  • 3.  RE: TMF Filter for an attribut that is an array of objects e.g TMF 639 resourceCharacteristic

    TM Forum Member
    Posted Jul 06, 2022 03:53
    Edited by Eric Gomdjim Jul 06, 2022 03:57
    Thank for you answer. I am looking for a possibility  with and/or combinations, which can be easily extracted and attached to a where clause, for example.  I allready know how to use JsonPath, but extraction of key/value pair and or/and combination from JsonPaht is not easy to implement for dynamic filters.

    I still hoping that this form is conform and I am looking for how to build  combinations with and/or
    https://higherlogicdownload.s3-external-1.amazonaws.com/TMFORUM/d2c768e1-b073-4859-9e96-50e00658c8d0_file.pdf?AWSAccessKeyId=AKIAVRDO7IEREB57R7MT&Expires=1657025394&Signature=HiBHlE3Cmhg3cnnjAZhxfziYQyM%3D

    ------------------------------
    Eric Gomdjim
    Deutsche Telekom AG
    ------------------------------



  • 4.  RE: TMF Filter for an attribut that is an array of objects e.g TMF 639 resourceCharacteristic

    Posted Jul 06, 2022 04:00
    Hi,

    Btw, your link to S3 does not work with  AccessDenied Error.

    ------------------------------
    Hanumantha Marikanti
    Open API Enthusiast
    Saralam Technologies
    ------------------------------



  • 5.  RE: TMF Filter for an attribut that is an array of objects e.g TMF 639 resourceCharacteristic

    TM Forum Member
    Posted Jul 07, 2022 10:54
      |   view attached
    please see the attachment

    ------------------------------
    Eric Gomdjim
    Deutsche Telekom AG
    ------------------------------



  • 6.  RE: TMF Filter for an attribut that is an array of objects e.g TMF 639 resourceCharacteristic

    TM Forum Member
    Posted Jul 07, 2022 06:31
    Edited by Vance Shipley Jul 07, 2022 06:32
    In TMF630 Part 1 basic query filtering is described and does allow deep inspection through the use of dot notation. For example you may query by the value of an attribute of an object which is the value of a top level attribute like this::

    GET /productCatalogManagement/v4/productOffering?productSpecification.id=42

    There are also operators other than = specified in TMF630 Part 1 however it's very basic. If your query requires filtering for array members that doesn't help you.  For that you will want to refer to TMF530 Part 6 JSON Path Extension. It supports an explicit path selection syntax (RFC6902), and an expanded list of operators, which will allow you to query for entities in a collection (i.e. Resources in a Resource Inventory) by Characteristic value, which you cannot do with TMF630 Part 1 syntax. Below we query for Resources containing a Characteristic named foo having a value of 42:

    GET /resourceInventoryManagement/v4/resource?filter=resourceCharacteristic[?(@.name==foo && @.value=42)]

    Note that the above includes the use of reserved characters which need to be escaped for use in HTTP URIs. Below is a safe version of the above:

    GET /resourceInventoryManagement/v4/resource?filter=resourceCharacteristic%5B%3F(%40.name%3D%3Dfoo%20%26%26%20%40.value%3D42)%5D



    ------------------------------
    Vance Shipley
    SigScale
    ------------------------------



  • 7.  RE: TMF Filter for an attribut that is an array of objects e.g TMF 639 resourceCharacteristic

    TM Forum Member
    Posted Jul 07, 2022 10:50
    Edited by Eric Gomdjim Jul 07, 2022 11:07
    Hallo Vance,
    We have already partially implemented this with jsonpath, except that the filtering can only take place after the serialization. With huge amount of data it will lead to performance problem because all the data is first fetched, serialized and then filtered. It is not possible to extract the filter data and combinations from the filter in order to add them to the query.
    It will therefore not be possible to use the advantages of indexes or other tuning mechanisms in the backend service.

    That's why I'm looking for a better way for passing and handling  the query parameters.

    The other problem is that the customer can also pass a filter, which leads to a result set that does not contain all the mandatory fields of TMF (e.g. id href...).
    One of the only ways I could find to validate a JsonPath is "JsonPath.compile". The structure of the JsonPath itself being very dynamic and complex, it would be risky to try to verify its content.

    ------------------------------
    Eric Gomdjim
    Deutsche Telekom AG
    ------------------------------



  • 8.  RE: TMF Filter for an attribut that is an array of objects e.g TMF 639 resourceCharacteristic

    TM Forum Member
    Posted Jul 07, 2022 11:22
    On Jul 07, 2022 10:50 @Eric Gomdjim wrote:
    |  We have already partially implemented this with jsonpath, except that the filtering can only take place after the serialization.

    That is an implementation problem which is not caused by the interface specification.

    At SigScale we don't support any arbitrary advanced query but we do interpret a set of those and implement a highly efficient internal query mechanism to produce the results.  Yeah, it's hand coding at a fairly low level, but it works amazingly well.  Nobody said drinking from the firehose was going to be easy. :)​

    ------------------------------
    Vance Shipley
    SigScale
    ------------------------------



  • 9.  RE: TMF Filter for an attribut that is an array of objects e.g TMF 639 resourceCharacteristic

    TM Forum Member
    Posted Jul 08, 2022 02:51
    thank you anyway!

    ------------------------------
    Eric Gomdjim
    Deutsche Telekom AG
    ------------------------------