Documentation Center

Sample query: including and excluding conditions

Use conditions to determine exactly which content gets returned.

Within a publication, certain topics may be conditionalized: that is, certain topics are to be shown or returned only if the specific condition-value pair is configured. Within a topic, certain parts of the topic may be conditionalized: that is, certain parts of the topic are to be shown or returned only if the specific condition-value pair is configured.

For example, consider the following query:

ishTopic(url: "2778701/5653153/penguin-guide/penguin-species",
  conditions: [{name: "LatinName", values: ["no"]}],
  excludeConditions:[{name:"Continents", values:["Africa", "Antarctica"]}]) {  
  nestedTopics {
    title
    abstract {
      xhtml
    }
  }
}
This query returns the value of the title element, and the XHTML rendering of the abstract element, for all subordinate topics of the topic designated by the URL 2778701/5653153/penguin-guide/penguin-species. But in this sample, the conditions and excludeConditions parameters further limit exactly what gets returned:
  • If the returned content contains any content that is marked with the condition-value pair LatinName=no, that content will be included.
  • If the returned content contains any content that is marked with the condition-value pair Continents=Africa or with the condition-value pair Continents=Antarctica, that content will be excluded.

Use conditions or excludeConditions, or both, to indicate which conditions should be considered, and how.