liveBook · Manning

Wildcard attribute

As explained in Object-Oriented Software Design in C++

A search criterion indicating that any value of the corresponding book attribute is acceptable.

A wildcard attribute tells a catalogue search to accept any value for that attribute. A search may specify any number of wildcards; every remaining target value must match the corresponding book value. section 2.3

The practical design is to treat a missing attribute in the search target as a wildcard rather than storing a special UNSPECIFIED value. The matcher checks each target pair: an absent book attribute fails, an equal value succeeds, and a wildcard target accepts the book’s value. section 3.9 section 2.3.4

A wildcard search therefore follows these rules:

  • Specify only the attributes that matter; omit the rest. section 2.3.4
  • Require every specified target attribute to exist in the book. section 3.9
  • Compare specified values for equality, with string comparisons remaining case-insensitive. section 3.9

Searching with omitted attributes

A target containing KIND: fiction, LAST: KING, and GENRE: horror omits title, first name, and year. It therefore matches fiction horror books by King regardless of those omitted values, returning Carrie and It: A Novel.

How Object-Oriented Software Design in C++ covers it

How deep it goes
Defines wildcard semantics and shows their matcher implementation, while deferring user-form handling and validation details.
Examples
Demonstrates partial searches for King’s fiction horror novels and Chinese cookbooks.
What it assumes
Assumes book attributes and search targets use corresponding keys and values, while introducing omitted attributes as wildcards.
What you can do after
Apply wildcard semantics by constructing a target attribute map containing only required search values.
How it connects
Connects wildcard matching with attribute maps, case-insensitive string matching, and defensive programming.

This explainer was generated by Manning's knowledge graph from the text of Object-Oriented Software Design in C++. The section links point to the parts of the book it draws on.