Probabilistic API Matching for Ambiguous Code Usage

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Developers face challenges in accurately matching API code usage with corresponding API specifications due to missing or ambiguous information, such as obfuscated URL/HTTP method/data, uninitialized base URLs, and non-unique API versions, leading to runtime errors and difficulties in identifying deprecated APIs or unsupported services.

Innovation Solution

A probabilistic approach is implemented to match API code usage with API specifications by extracting features like schema, HTTP method, host, and query parameters, using text matching, classification via machine learning, or clustering, and determining a match probability to identify the most likely API specification, allowing communication with the correct endpoint.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Measurement precision

If exact matching is used between API code usage and API specifications, then matching precision is high, but the system cannot handle missing or ambiguous information leading to match failures

Engineering Contradiction:
Improvematching precisionVSAvoidmatch success rate
Core Design Contradiction:
Measurement precisionVSReliability

Solution Approach 1:

The system changes the matching parameter from binary exact match to probabilistic similarity scoring. Instead of requiring complete feature matches, the system calculates match probabilities based on available features and selects the API specification with the highest probability, even when information is missing or ambiguous.

Inventive Principle:
Principle #35Parameter changes

Solution Approach 2:

The system performs partial matching by comparing only the features that are present in the API code usage against API specifications. It does not require all features to be matched, allowing successful matching even with incomplete information, while still maintaining reasonable precision through probability calculation.

Inventive Principle:
Principle #16Partial or excessive action

2Reliability

If probabilistic matching is implemented to handle ambiguous information, then reliability improves, but matching precision may decrease due to potential false matches

Engineering Contradiction:
Improvematch success rateVSAvoidmatching precision
Core Design Contradiction:
ReliabilityVSMeasurement precision

Solution Approach 1:

The system uses feedback mechanisms by comparing the calculated match probabilities against threshold values and allowing developers to provide feedback on match accuracy. This feedback is used to refine the matching algorithm and adjust thresholds, improving precision over time while maintaining high reliability.

Inventive Principle:
Principle #23Feedback

Solution Approach 2:

The system replaces traditional mechanical exact-matching mechanisms with probabilistic and machine learning-based approaches. Instead of rigid feature-by-feature comparison, the system uses similarity algorithms and trained models to determine match likelihood, achieving both reliability and precision through intelligent computation.

Inventive Principle:
Principle #28Mechanics substitution (Replace mechanical system)

3Measurement precision

If multiple API specifications are compared to find the best match, then matching accuracy improves, but computational complexity increases

Engineering Contradiction:
Improvematching accuracyVSAvoidcomputational complexity
Core Design Contradiction:
Measurement precisionVSDevice complexity

Solution Approach 1:

The system segments the matching process into distinct phases: first filtering API specifications based on key features like host and HTTP method, then performing detailed probabilistic comparison only on the filtered subset. This segmentation reduces the number of full comparisons needed, lowering computational complexity while maintaining accuracy.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The system performs preliminary filtering and feature extraction before the main matching process. By pre-processing the API specifications and code usage to extract and normalize features, the system reduces the complexity of the subsequent probabilistic comparison, making the overall process more efficient.

Inventive Principle:
Principle #10Preliminary action

4Adaptability or versatility

If feature extraction from API code usage is performed to enable matching, then matching capability is enabled, but processing time increases

Engineering Contradiction:
Improvematching capabilityVSAvoidprocessing time
Core Design Contradiction:
Adaptability or versatilityVSLoss of time

Solution Approach 1:

The system extracts only the essential features from API code usage that are necessary for matching, such as host, HTTP method, and path segments. By selectively extracting only the most relevant features rather than analyzing the entire code, the system enables comprehensive matching capability while minimizing processing time.

Inventive Principle:
Principle #2Taking out (Extraction)

Data Source

PatentUS11113029B2Probabilistic matching of web application program interface code usage to specifications
Publication Date: 2021.09.07 INTERNATIONAL BUSINESS MACHINE CORPORATION
  • US11113029B2 patent drawing
  • US11113029B2 patent drawing
  • US11113029B2 patent drawing

AI summary

A method and system of matching an application program interface (API) code usage with an API specification are provided. A program having an API code usage is received and its features are extracted therefrom. Features from meta data of a plurality of API specifications are extracted. For each API specification of the plurality of API specifications, a match probability with the API code usage is determined. An API specification having a highest probability is determined. The API code usage is matched with the API specification having the highest probability.