# Metadata Object


# Type: Object

# Fields:

# Field: Patterns

# Description:

Patterns is an array of string in which each string is a metadata pattern.

"Patterns": {
    "[[Genre]] books for sale in Melbourne",
    "Price under [[Price]] are found"  
}

Each pattern specifies how to compose metadata in sentences to be returned.

When deciding which pattern to use, the one with all mandatory fields existing in the query will be picked. *Mandatory fields are marked in the Pattern Syntax section.

For example:

Query: Search all books of genre Sci-fi 

The first "[[Genre]] books for sale in Melbourne" pattern will be composed, and a metadata sentence will be returned:

Sci-fi books for sale in Melbourne

# Pattern Syntax:

  • []

    • Description:
      • Result count
    • Example:
      • Pattern: [] books in Australia
      • Result:
        • When result count is 30: 30 books in Australia
  • [[]]

    • Description:
      • Mandatory result count
  • [ASPECT]

    • Description:
      • Aspect placeholder. The ASPECT is configured in Index section.
    • Example when aspect is Genre:
      • Pattern: [Genre] books for sale in Australia
      • Result:
        • When Genre is Fantasy: Fantasy books for sale in Australia`
  • [[ASPECT]]

    • Description:
      • Mandatory Aspect placeholder
  • [[ASPECT][DEFAULT_LITERAL]]

    • Description:
      • If Aspect is empty, use DEFAULT_LITERAL instead.
    • Example:
      • Pattern: Books for sell in [[State][Australia]]
      • Result:
        • When aspect State is Victoria: Books for sale in Victoria
        • When aspect State is not queried: Books for sale in Australia
  • [[ASPECT1][ASPECT2][DEFAULT_LITERAL]]

    • Description:
      • If Aspect1 is empty, use ASPECT2 instead.
      • If both Aspect1 and Aspect2 are empty, use DEFAULT_LITERAL instead.
    • Example:
      • Pattern: Books for sale in [[State][Suburb][Australia]]
      • Result:
        • When aspect State is Victoria: Books for sale in Victoria
        • When aspect State is empty and Suburb is Richmond: Books for sale in Richmond
        • When aspect either State or Suburb is not queried: Books for sale in Australia
  • [[[Aspect1][Aspect2]...[AspectN]]]

    • Description:
      • Mandatory aspects placeholder. Use the first non-empty aspect among Aspect1, ASPECT2, ... AspectN.
    • Example:
      • Pattern: Books for sell in [[[State][City][Suburb]]]
      • Result:
        • When aspect State is Victoria: Books for sell in Victoria
        • When aspect State is empty and City is Melbourne: Books for sell in Melbourne
        • When aspect State and City are empty and Suburb is Richmond: Books for sell in Richmond
  • ASPECT*

    • Description:
      • Pluralize the aspect with an ending asterisk *.
      • Pluralize the aspect always even if count is 1 with an ending asterisk **.
      • Ending aspect asterisk can be applied to all other syntax
    • Example:
      • Pattern: [Genre*]
      • Result:
        • When Genre is Book: Books
      • Pattern: [[Genre*][Book*]]
      • Result:
        • When Genre is scifi: Sci-fi Books
          • Explain: Book has been pluralized to Books in English culture setting and scifi pluralized to Sci-fi.
        • When Genre not queried: Books
          • Explain: Book has been pluralized to Books in English culture setting.

# Type: string[]


# Field: CaseStyle

# Description:

CaseStyle formats case styles on the whole metadata object after patterns composing it.

Refer to CaseStyle.

# Type: Object