|
|
|
Currently, this section is used to gather ideas about the implementation. They will
be completed and structured before release 1.0
API DocumentationYou can browse the API documentation online. It can also be generated from the distribution. Matching algorithmThe current matching algorithm uses the concept of a query and a list of objects that the query operates on. A typical query is something like If method <m> in object <o> returns a value less than <v> , there is a match". When a query is executed, it returns a value from 0 to 1, both inclusive. A 1 means a 100% match, while a 0 return value means a total mismatch. QuerySets
Queries may be combined by using QuerySet-queries. A QuerySet is also a MatchQuery. This way, QuerySets may be nested. Escpecially when nesting QuerySets, you might want to provide different weights for the nested subqueries: query.addPreferred(nestedQuery, 4f); Match query hierarchyRelative matchingSome queries, such as Minimum and Maximum, compare an object against all other objects in the object list. An example of a two-pass query: Let's assume a user wants to look for a small, cheap camp site with a swimming pool. The following code defines and executes this match query: QuerySet query = new QuerySet(); query.addPreferred(new LessThan("size", 100)); query.addPreferred(new NumberEquals("distanceToSwimmingPool", 0)); query.addPreferred(new Minimum("priceIndication")); List campSites = guide.getCampSites(); MatchResult matchResult = matchEngine.executeQuery(query, campSites); The full source of this example can be found in the directory examples/camping in the distribution This kind of queries is called a two-pass query. In the first pass, the relevant data (global minimum and maximum for the price) is calculated. In the second pass, this data is used to calculate the match value. As the name implies, the data is passed twice. This means more communication overhead when the data is retrieved from a large database. ExtensionsYou may want to find a match with more complicated, domain-specific criteria, for example if the car has had regular service intervals. In this case, you can create your own queries by extending class MatchQuery, or one of its subclasses. All you have to do is provide an implementation of getMatchValue, and your query can be part of the matching process. /** * Class RegularServiceIntervals a query to be used by JavaMatch, * that checks if a Car has has been services frequently */ public class RegularServiceIntervals extends MatchQuery { /** * Calculates the regularity of the service intervals * @param matchedObject the car from which the service intervals * are checked * @return an indicator for how regular the car was serviced */ public float getMatchValue(Object matchedObject) throws MatchException { Car carToMatch = (Car)matchedObject; List services = carToMatch.getServices(); ... // calculate and return a value (from 0 to 1, both inclusive) // for how regular the services took place } } Output customizationThere are several ways to customize JavaMatch's output. These customizations are performed on the match engine (classnet.sourceforge.javamatch.engine.MatchEngine
).
Number of returned resultsTo change the number of results that are returned by JavaMatch, you can callmatchEngine.setMaxNumResultItems(<number of items>); Match thresholdYou might want to specify a threshold value: a minimum value before an object is added to the result. This can be done by callingmatchEngine.setThreshold(<threshold value>); Related technologyMatching engines
Persistent storage
Object-oriented data access
Object data retrievalSearch engine technologyOther technologies in depthSodaQuery
SODAQuery project summary: The main differences and similarities between JavaMatch and SODAQuery are:
Returned results
Comparison operators
Customizable filtering
Programming language
Limit usage of strings
Runtime member retrieval
Performance
Collections
Data types
Memory |
Copyright © 2004, Walter van Iterson |